@alphakits/ui 2.0.11 → 2.0.13
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.
- package/dist/checkbox/index.module.css +1 -1
- package/dist/checkbox/index.module.css.js +7 -7
- package/dist/checkbox-lists/index.module.css +1 -1
- package/dist/checkbox-lists/index.module.css.js +8 -6
- package/dist/checkbox-lists/index.module.css.js.map +1 -1
- package/dist/form/templates/base-form/index.js +24 -21
- package/dist/form/templates/base-form/index.js.map +1 -1
- package/dist/form/templates/filters-form/index.js +24 -21
- package/dist/form/templates/filters-form/index.js.map +1 -1
- package/dist/form/templates/rest-form/index.js +27 -24
- package/dist/form/templates/rest-form/index.js.map +1 -1
- package/dist/header-search/component.d.ts +0 -1
- package/dist/header-search/component.js +18 -20
- package/dist/header-search/component.js.map +1 -1
- package/dist/header-search/index.module.css +1 -1
- package/dist/header-search/index.module.css.js +4 -6
- package/dist/header-search/index.module.css.js.map +1 -1
- package/dist/input/index.module.css +1 -1
- package/dist/table/columns.js +4 -3
- package/dist/table/columns.js.map +1 -1
- package/dist/table/components/cell/component.d.ts +0 -1
- package/dist/table/components/cell/component.js +21 -22
- package/dist/table/components/cell/component.js.map +1 -1
- package/dist/table/components/cell/index.module.css +1 -1
- package/dist/table/components/cell/index.module.css.js +12 -14
- package/dist/table/components/cell/index.module.css.js.map +1 -1
- package/dist/table/components/cells/index.d.ts +1 -2
- package/dist/table/components/cells/index.js +35 -29
- package/dist/table/components/cells/index.js.map +1 -1
- package/dist/table/components/cells/index.module.css +1 -1
- package/dist/table/components/cells/index.module.css.js +12 -12
- package/dist/table/components/pagination/index.d.ts +0 -1
- package/dist/table/components/pagination/index.js +79 -97
- package/dist/table/components/pagination/index.js.map +1 -1
- package/dist/table/components/pagination/index.module.css +1 -1
- package/dist/table/components/pagination/index.module.css.js +18 -20
- package/dist/table/components/pagination/index.module.css.js.map +1 -1
- package/dist/table/components/table-header/index.d.ts +0 -1
- package/dist/table/components/table-header/index.js +26 -28
- package/dist/table/components/table-header/index.js.map +1 -1
- package/dist/table/index.module.css +1 -1
- package/dist/table/index.module.css.js +12 -12
- package/dist/table/table.d.ts +1 -3
- package/dist/table/table.js +86 -91
- package/dist/table/table.js.map +1 -1
- package/dist/table/utils/prepare-rows.d.ts +1 -2
- package/dist/table/utils/prepare-rows.js +6 -8
- package/dist/table/utils/prepare-rows.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../../src/table/components/cell/component.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\n\nimport { Cell as BaseCell } from '../../../cell';\nimport { BaseProps } from '../../../cell/base/component';\n\nimport styles from './index.module.css';\n\nexport type CellProps = {\n className?: string;\n dataTestID?: string;\n title?: BaseProps['title'];\n subtitle?: BaseProps['subtitle'];\n cellProps?: Omit<BaseProps, 'title' | 'subtitle'>;\n tableProps?: React.TdHTMLAttributes<any>;\n addon?: React.ReactNode;\n children?: React.ReactNode;\n width?: string;\n align?: 'left' | 'right' | 'center';\n compact?: boolean;\n
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../../src/table/components/cell/component.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\n\nimport { Cell as BaseCell } from '../../../cell';\nimport { BaseProps } from '../../../cell/base/component';\n\nimport styles from './index.module.css';\n\nexport type CellProps = {\n className?: string;\n dataTestID?: string;\n title?: BaseProps['title'];\n subtitle?: BaseProps['subtitle'];\n cellProps?: Omit<BaseProps, 'title' | 'subtitle'>;\n tableProps?: React.TdHTMLAttributes<any>;\n addon?: React.ReactNode;\n children?: React.ReactNode;\n width?: string;\n align?: 'left' | 'right' | 'center';\n compact?: boolean;\n\n /**\n * HTML тег\n */\n tag?: 'td' | 'div';\n};\n\nexport const TableCell: React.FC<CellProps> = ({\n dataTestID,\n className,\n children,\n title,\n subtitle,\n tableProps,\n cellProps,\n addon,\n align,\n compact,\n width,\n tag: Component = 'td',\n}) => (\n <Component\n data-test-id={ dataTestID }\n className={ cn(styles.cell, className, {\n [styles.is_div]: Component === 'div',\n [styles.compact_cell]: compact,\n }) }\n style={ { width } }\n { ...tableProps }\n >\n { children ? (\n <div\n className={ cn(styles.children, {\n [styles.center]: align === 'center',\n [styles.right]: align === 'right',\n }) }\n >\n { children }\n </div>\n ) : (\n <BaseCell.Base\n title={ title === undefined ? '-' : title }\n subtitle={ subtitle }\n size={ cellProps?.size || (compact ? 's' : 'm') }\n compactAddon={ compact }\n singleLineTitle={ compact }\n showTitleTooltipOnOverflow={ compact }\n className={ cn({\n [styles.center]: align === 'center',\n [styles.right]: align === 'right',\n [styles.compact_content]: compact,\n }) }\n addon={ addon }\n { ...cellProps }\n />\n ) }\n </Component>\n);\n"],"names":["TableCell","dataTestID","className","children","title","subtitle","tableProps","cellProps","addon","align","compact","width","Component","jsx","cn","styles","BaseCell"],"mappings":";;;;AA2BO,MAAMA,IAAiC,CAAC;AAAA,EAC3C,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,KAAKC,IAAY;AACrB,MACI,gBAAAC;AAAA,EAACD;AAAA,EAAA;AAAA,IACG,gBAAeX;AAAA,IACf,WAAYa,EAAGC,EAAO,MAAMb,GAAW;AAAA,MACnC,CAACa,EAAO,MAAM,GAAGH,MAAc;AAAA,MAC/B,CAACG,EAAO,YAAY,GAAGL;AAAA,IAAA,CAC1B;AAAA,IACD,OAAQ,EAAE,OAAAC,EAAA;AAAA,IACR,GAAGL;AAAA,IAEH,UAAAH,IACE,gBAAAU;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,WAAYC,EAAGC,EAAO,UAAU;AAAA,UAC5B,CAACA,EAAO,MAAM,GAAGN,MAAU;AAAA,UAC3B,CAACM,EAAO,KAAK,GAAGN,MAAU;AAAA,QAAA,CAC7B;AAAA,QAEC,UAAAN;AAAA,MAAA;AAAA,IAAA,IAGN,gBAAAU;AAAA,MAACG,EAAS;AAAA,MAAT;AAAA,QACG,OAAQZ,MAAU,SAAY,MAAMA;AAAA,QACpC,UAAAC;AAAA,QACA,OAAOE,KAAA,gBAAAA,EAAW,UAASG,IAAU,MAAM;AAAA,QAC3C,cAAeA;AAAA,QACf,iBAAkBA;AAAA,QAClB,4BAA6BA;AAAA,QAC7B,WAAYI,EAAG;AAAA,UACX,CAACC,EAAO,MAAM,GAAGN,MAAU;AAAA,UAC3B,CAACM,EAAO,KAAK,GAAGN,MAAU;AAAA,UAC1B,CAACM,EAAO,eAAe,GAAGL;AAAA,QAAA,CAC7B;AAAA,QACD,OAAAF;AAAA,QACE,GAAGD;AAAA,MAAA;AAAA,IAAA;AAAA,EACT;AAER;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
table tr:last-child .cell_SVZP
|
|
1
|
+
table tr:last-child .cell_SVZP{border-bottom:0!important}.cell_SVZP{padding:8px 16px;border-bottom:1px solid var(--color-border-secondary);position:relative;min-height:56px;box-sizing:border-box;vertical-align:middle}.compact_cell_zSJH{min-height:44px;padding:8px 12px}.right_30pJ{justify-content:flex-end}.children_X057{width:100%;display:flex;align-items:center}.compact_content_bjnq{gap:0 6px!important;min-height:40px!important}.is_div_XHlH{display:flex;align-items:center}.cell_SVZP.is_div_XHlH{padding-top:12px;padding-bottom:12px}.compact_cell_zSJH.is_div_XHlH{min-height:44px}
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import './index.module.css';
|
|
2
|
-
const c = "cell_SVZP", t = "
|
|
2
|
+
const c = "cell_SVZP", t = "compact_cell_zSJH", l = "right_30pJ", n = "children_X057", o = "compact_content_bjnq", e = "is_div_XHlH", _ = {
|
|
3
3
|
cell: c,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
is_div: o
|
|
4
|
+
compact_cell: t,
|
|
5
|
+
right: l,
|
|
6
|
+
children: n,
|
|
7
|
+
compact_content: o,
|
|
8
|
+
is_div: e
|
|
10
9
|
};
|
|
11
10
|
export {
|
|
12
11
|
c as cell,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
_ as right
|
|
12
|
+
n as children,
|
|
13
|
+
t as compact_cell,
|
|
14
|
+
o as compact_content,
|
|
15
|
+
_ as default,
|
|
16
|
+
e as is_div,
|
|
17
|
+
l as right
|
|
20
18
|
};
|
|
21
19
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -5,7 +5,6 @@ type Props<T extends object> = {
|
|
|
5
5
|
order: QueryDTO['order'];
|
|
6
6
|
addParam: ({ sort, order }: Pick<Query, 'order' | 'sort'>) => void;
|
|
7
7
|
compact?: boolean;
|
|
8
|
-
v2?: boolean;
|
|
9
8
|
};
|
|
10
|
-
export declare function Cells<T extends object>({ columns, sort, order, addParam, compact,
|
|
9
|
+
export declare function Cells<T extends object>({ columns, sort, order, addParam, compact, }: Props<T>): JSX.Element;
|
|
11
10
|
export {};
|
|
@@ -1,56 +1,62 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { Typography as
|
|
5
|
-
import
|
|
6
|
-
function
|
|
7
|
-
columns:
|
|
1
|
+
import { jsx as a, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import n from "@alphakits/icons/dist/ChevronForwardS";
|
|
3
|
+
import i from "classnames";
|
|
4
|
+
import { Typography as f } from "../../../typography/component.js";
|
|
5
|
+
import r from "./index.module.css.js";
|
|
6
|
+
function S({
|
|
7
|
+
columns: o,
|
|
8
8
|
sort: d,
|
|
9
|
-
order:
|
|
9
|
+
order: c,
|
|
10
10
|
addParam: h,
|
|
11
|
-
compact:
|
|
12
|
-
v2: s = !1
|
|
11
|
+
compact: l = !1
|
|
13
12
|
}) {
|
|
14
|
-
return /* @__PURE__ */ a("thead", { children: /* @__PURE__ */ a("tr", { className:
|
|
15
|
-
const t =
|
|
13
|
+
return /* @__PURE__ */ a("thead", { children: /* @__PURE__ */ a("tr", { className: r.header_row, children: o.map((e) => {
|
|
14
|
+
const t = e.accessor && d === e.accessor, s = t && c === "ASC" ? "DESC" : "ASC";
|
|
16
15
|
return /* @__PURE__ */ a(
|
|
17
16
|
"th",
|
|
18
17
|
{
|
|
19
|
-
className:
|
|
20
|
-
[
|
|
21
|
-
[
|
|
18
|
+
className: i(r.cell, {
|
|
19
|
+
[r.clickable]: e.sort,
|
|
20
|
+
[r.headerCellCompact]: l
|
|
22
21
|
}),
|
|
23
|
-
align:
|
|
24
|
-
style: { width:
|
|
25
|
-
onClick:
|
|
26
|
-
children: /* @__PURE__ */
|
|
27
|
-
|
|
22
|
+
align: e.align,
|
|
23
|
+
style: { width: e.width || "auto" },
|
|
24
|
+
onClick: e.sort ? () => h({ order: s, sort: e.accessor }) : void 0,
|
|
25
|
+
children: /* @__PURE__ */ p(
|
|
26
|
+
f.Text,
|
|
28
27
|
{
|
|
29
|
-
className:
|
|
30
|
-
view:
|
|
28
|
+
className: r.head_wrapper,
|
|
29
|
+
view: "title",
|
|
31
30
|
tag: "div",
|
|
32
31
|
color: "secondary",
|
|
33
32
|
weight: "medium",
|
|
34
33
|
children: [
|
|
35
|
-
|
|
36
|
-
r.sort && /* @__PURE__ */ a(
|
|
34
|
+
/* @__PURE__ */ a(
|
|
37
35
|
"span",
|
|
38
36
|
{
|
|
39
|
-
className:
|
|
40
|
-
|
|
37
|
+
className: r.head_text,
|
|
38
|
+
title: typeof e.header == "string" ? e.header : void 0,
|
|
39
|
+
children: e.header
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
e.sort && /* @__PURE__ */ a(
|
|
43
|
+
"span",
|
|
44
|
+
{
|
|
45
|
+
className: i(r.arrow, r[s], {
|
|
46
|
+
[r.accent]: t
|
|
41
47
|
}),
|
|
42
|
-
children: /* @__PURE__ */ a(
|
|
48
|
+
children: /* @__PURE__ */ a(n, {})
|
|
43
49
|
}
|
|
44
50
|
)
|
|
45
51
|
]
|
|
46
52
|
}
|
|
47
53
|
)
|
|
48
54
|
},
|
|
49
|
-
String(
|
|
55
|
+
String(e.accessor || e.header)
|
|
50
56
|
);
|
|
51
57
|
}) }) });
|
|
52
58
|
}
|
|
53
59
|
export {
|
|
54
|
-
|
|
60
|
+
S as Cells
|
|
55
61
|
};
|
|
56
62
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/table/components/cells/index.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport React from 'react';\nimport ChevronForwardS from '@alphakits/icons/dist/ChevronForwardS';\nimport cn from 'classnames';\n\nimport { Typography } from '../../../typography';\nimport { Query, QueryDTO, TableColumns } from '../../types';\n\nimport styles from './index.module.css';\n\ntype Props<T extends object> = {\n columns: TableColumns<T>;\n sort: QueryDTO['sort'];\n order: QueryDTO['order'];\n addParam: ({ sort, order }: Pick<Query, 'order' | 'sort'>) => void;\n compact?: boolean;\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/table/components/cells/index.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport React from 'react';\nimport ChevronForwardS from '@alphakits/icons/dist/ChevronForwardS';\nimport cn from 'classnames';\n\nimport { Typography } from '../../../typography';\nimport { Query, QueryDTO, TableColumns } from '../../types';\n\nimport styles from './index.module.css';\n\ntype Props<T extends object> = {\n columns: TableColumns<T>;\n sort: QueryDTO['sort'];\n order: QueryDTO['order'];\n addParam: ({ sort, order }: Pick<Query, 'order' | 'sort'>) => void;\n compact?: boolean;\n};\n\nexport function Cells<T extends object>({\n columns, sort, order, addParam, compact = false,\n}: Props<T>) {\n return (\n <thead>\n <tr className={ styles.header_row }>\n { columns.map((column) => {\n const isSorted = column.accessor && sort === column.accessor;\n const direction: QueryDTO['order'] =\n isSorted && order === 'ASC' ? 'DESC' : 'ASC';\n\n return (\n <th\n key={ String(column.accessor || column.header) }\n className={ cn(styles.cell, {\n [styles.clickable]: column.sort,\n [styles.headerCellCompact]: compact,\n }) }\n align={ column.align }\n style={ { width: column.width || 'auto' } }\n onClick={\n column.sort\n ? () => addParam({ order: direction, sort: column.accessor })\n : undefined\n }\n >\n <Typography.Text\n className={ styles.head_wrapper }\n view=\"title\"\n tag=\"div\"\n color=\"secondary\"\n weight=\"medium\"\n >\n <span\n className={ styles.head_text }\n title={ typeof column.header === 'string' ? column.header : undefined }\n >\n { column.header }\n </span>\n\n { column.sort && (\n <span\n className={ cn(styles.arrow, styles[direction], {\n [styles.accent]: isSorted,\n }) }\n >\n <ChevronForwardS />\n </span>\n ) }\n </Typography.Text>\n </th>\n );\n }) }\n </tr>\n </thead>\n );\n}\n"],"names":["Cells","columns","sort","order","addParam","compact","jsx","styles","column","isSorted","direction","cn","jsxs","Typography","ChevronForwardS"],"mappings":";;;;;AAkBO,SAASA,EAAwB;AAAA,EACpC,SAAAC;AAAA,EAAS,MAAAC;AAAA,EAAM,OAAAC;AAAA,EAAO,UAAAC;AAAA,EAAU,SAAAC,IAAU;AAC9C,GAAa;AACT,SACI,gBAAAC,EAAC,SAAA,EACG,UAAA,gBAAAA,EAAC,MAAA,EAAG,WAAYC,EAAO,YACjB,UAAAN,EAAQ,IAAI,CAACO,MAAW;AACtB,UAAMC,IAAWD,EAAO,YAAYN,MAASM,EAAO,UAC9CE,IACFD,KAAYN,MAAU,QAAQ,SAAS;AAE3C,WACI,gBAAAG;AAAA,MAAC;AAAA,MAAA;AAAA,QAEG,WAAYK,EAAGJ,EAAO,MAAM;AAAA,UACxB,CAACA,EAAO,SAAS,GAAGC,EAAO;AAAA,UAC3B,CAACD,EAAO,iBAAiB,GAAGF;AAAA,QAAA,CAC/B;AAAA,QACD,OAAQG,EAAO;AAAA,QACf,OAAQ,EAAE,OAAOA,EAAO,SAAS,OAAA;AAAA,QACjC,SACIA,EAAO,OACD,MAAMJ,EAAS,EAAE,OAAOM,GAAW,MAAMF,EAAO,SAAA,CAAU,IAC1D;AAAA,QAGV,UAAA,gBAAAI;AAAA,UAACC,EAAW;AAAA,UAAX;AAAA,YACG,WAAYN,EAAO;AAAA,YACnB,MAAK;AAAA,YACL,KAAI;AAAA,YACJ,OAAM;AAAA,YACN,QAAO;AAAA,YAEP,UAAA;AAAA,cAAA,gBAAAD;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACG,WAAYC,EAAO;AAAA,kBACnB,OAAQ,OAAOC,EAAO,UAAW,WAAWA,EAAO,SAAS;AAAA,kBAE1D,UAAAA,EAAO;AAAA,gBAAA;AAAA,cAAA;AAAA,cAGXA,EAAO,QACL,gBAAAF;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACG,WAAYK,EAAGJ,EAAO,OAAOA,EAAOG,CAAS,GAAG;AAAA,oBAC5C,CAACH,EAAO,MAAM,GAAGE;AAAA,kBAAA,CACpB;AAAA,kBAED,4BAACK,GAAA,CAAA,CAAgB;AAAA,gBAAA;AAAA,cAAA;AAAA,YACrB;AAAA,UAAA;AAAA,QAAA;AAAA,MAER;AAAA,MApCM,OAAON,EAAO,YAAYA,EAAO,MAAM;AAAA,IAAA;AAAA,EAuCzD,CAAC,GACL,GACJ;AAER;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.header_row_-IYY{overflow:hidden}.
|
|
1
|
+
.header_row_-IYY{overflow:hidden}.cell_c2wS{height:44px;padding:10px 16px;box-sizing:border-box;background:var(--color-bg-special-big-objects);border-bottom:1px solid var(--color-border-secondary);position:sticky;top:0;z-index:9}.headerCellCompact_i56i{height:40px;padding:8px 12px}.clickable_uhII{cursor:pointer}.head_wrapper_WjtN{display:flex;align-items:center;min-width:0}.head_text_pR3i{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.arrow_svnk{height:14px;width:14px;margin-left:6px;display:flex;flex-direction:column;flex-shrink:0;color:var(--color-graphic-thirdly);opacity:.55}.headerCellCompact_i56i .arrow_svnk{margin-left:8px}.accent_5Dn8{color:var(--color-graphic-primary)}.DESC_p2eV{transform:rotate(-90deg)}.ASC_fIiQ{transform:rotate(90deg)}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import './index.module.css';
|
|
2
|
-
const e = "header_row_-IYY", c = "cell_c2wS", a = "
|
|
2
|
+
const e = "header_row_-IYY", c = "cell_c2wS", a = "headerCellCompact_i56i", t = "clickable_uhII", r = "head_wrapper_WjtN", o = "head_text_pR3i", l = "arrow_svnk", _ = "accent_5Dn8", n = "DESC_p2eV", s = "ASC_fIiQ", d = {
|
|
3
3
|
header_row: e,
|
|
4
4
|
cell: c,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
arrow:
|
|
5
|
+
headerCellCompact: a,
|
|
6
|
+
clickable: t,
|
|
7
|
+
head_wrapper: r,
|
|
8
|
+
head_text: o,
|
|
9
|
+
arrow: l,
|
|
10
10
|
accent: _,
|
|
11
11
|
DESC: n,
|
|
12
12
|
ASC: s
|
|
@@ -15,13 +15,13 @@ export {
|
|
|
15
15
|
s as ASC,
|
|
16
16
|
n as DESC,
|
|
17
17
|
_ as accent,
|
|
18
|
-
|
|
18
|
+
l as arrow,
|
|
19
19
|
c as cell,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
t as clickable,
|
|
21
|
+
d as default,
|
|
22
|
+
o as head_text,
|
|
23
|
+
r as head_wrapper,
|
|
24
|
+
a as headerCellCompact,
|
|
25
25
|
e as header_row
|
|
26
26
|
};
|
|
27
27
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1,115 +1,97 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
1
|
+
import { jsxs as d, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import f from "@alphakits/icons/dist/ChevronForwardS";
|
|
3
3
|
import m from "classnames";
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Typography as
|
|
6
|
-
import { translate as
|
|
4
|
+
import { Button as h } from "../../../button/component.js";
|
|
5
|
+
import { Typography as g } from "../../../typography/component.js";
|
|
6
|
+
import { translate as b } from "../../languages/index.js";
|
|
7
7
|
import i from "./index.module.css.js";
|
|
8
|
-
function
|
|
9
|
-
const p =
|
|
10
|
-
let
|
|
11
|
-
for (let
|
|
12
|
-
(
|
|
13
|
-
return l.forEach((
|
|
14
|
-
|
|
15
|
-
}),
|
|
8
|
+
function N(r, o) {
|
|
9
|
+
const p = r - 2, c = r + 2 + 1, l = [], a = [];
|
|
10
|
+
let n = 0;
|
|
11
|
+
for (let e = 1; e <= o; e++)
|
|
12
|
+
(e === 1 || e === o || e >= p && e < c) && l.push(e);
|
|
13
|
+
return l.forEach((e) => {
|
|
14
|
+
n && (e - n === 2 ? a.push(n + 1) : e - n !== 1 && a.push("...")), a.push(e), n = e;
|
|
15
|
+
}), a;
|
|
16
16
|
}
|
|
17
|
-
const
|
|
18
|
-
pagesCount:
|
|
19
|
-
currentPage:
|
|
20
|
-
recordsPerPage:
|
|
17
|
+
const j = ({
|
|
18
|
+
pagesCount: r,
|
|
19
|
+
currentPage: o,
|
|
20
|
+
recordsPerPage: v = 30,
|
|
21
21
|
total: p,
|
|
22
|
-
language:
|
|
23
|
-
addParam: l
|
|
24
|
-
v2: c
|
|
22
|
+
language: c,
|
|
23
|
+
addParam: l
|
|
25
24
|
}) => {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
leftAddons: /* @__PURE__ */ t(b, {}),
|
|
32
|
-
view: "ghost",
|
|
33
|
-
onClick: () => l({ page: s - 1 }),
|
|
34
|
-
disabled: n
|
|
35
|
-
}
|
|
36
|
-
),
|
|
37
|
-
o.map((e, x) => Number.isFinite(e) ? /* @__PURE__ */ t(
|
|
38
|
-
v,
|
|
39
|
-
{
|
|
40
|
-
className: m(
|
|
41
|
-
i.pagination_btn,
|
|
42
|
-
{ [i.active]: e === s }
|
|
43
|
-
),
|
|
44
|
-
size: "xs",
|
|
45
|
-
view: "ghost",
|
|
46
|
-
onClick: () => l({ page: e }),
|
|
47
|
-
children: e
|
|
48
|
-
},
|
|
49
|
-
e
|
|
50
|
-
) : /* @__PURE__ */ t(
|
|
51
|
-
v,
|
|
52
|
-
{
|
|
53
|
-
className: m(i.pagination_btn),
|
|
54
|
-
view: "ghost",
|
|
55
|
-
disabled: !0,
|
|
56
|
-
children: "..."
|
|
57
|
-
},
|
|
58
|
-
e + x
|
|
59
|
-
)),
|
|
60
|
-
/* @__PURE__ */ t(
|
|
61
|
-
v,
|
|
62
|
-
{
|
|
63
|
-
className: m(i.btn, { [i.disabled_btn]: w }),
|
|
64
|
-
leftAddons: /* @__PURE__ */ t(b, {}),
|
|
65
|
-
view: "ghost",
|
|
66
|
-
onClick: () => {
|
|
67
|
-
l({ page: s + 1 });
|
|
68
|
-
},
|
|
69
|
-
disabled: w
|
|
70
|
-
}
|
|
71
|
-
)
|
|
72
|
-
] });
|
|
73
|
-
return c ? /* @__PURE__ */ r("div", { className: m(i.pagination_wrap, i.v2), children: [
|
|
74
|
-
/* @__PURE__ */ r("div", { className: i.pages_info, children: [
|
|
75
|
-
/* @__PURE__ */ t(h.Text, { view: "title", weight: "medium", color: "secondary", children: g(a)("totalCount") }),
|
|
76
|
-
/* @__PURE__ */ t(h.Text, { view: "title", weight: "medium", color: "primary", children: p })
|
|
25
|
+
const a = N(o, r), n = o === 1, e = o === r;
|
|
26
|
+
return /* @__PURE__ */ d("div", { className: i.pagination_wrap, children: [
|
|
27
|
+
/* @__PURE__ */ d("div", { className: i.pages_info, children: [
|
|
28
|
+
/* @__PURE__ */ s(g.Text, { view: "title", weight: "medium", color: "secondary", children: b(c)("totalCount") }),
|
|
29
|
+
/* @__PURE__ */ s(g.Text, { view: "title", weight: "medium", color: "primary", children: p })
|
|
77
30
|
] }),
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
31
|
+
/* @__PURE__ */ s("div", { className: i.pagination_center, children: a.length > 1 && /* @__PURE__ */ d("div", { className: i.pagination, children: [
|
|
32
|
+
/* @__PURE__ */ s(
|
|
33
|
+
h,
|
|
34
|
+
{
|
|
35
|
+
className: m(i.prev_btn, i.btn, { [i.disabled_btn]: n }),
|
|
36
|
+
leftAddons: /* @__PURE__ */ s(f, {}),
|
|
37
|
+
view: "ghost",
|
|
38
|
+
onClick: () => l({ page: o - 1 }),
|
|
39
|
+
disabled: n
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
a.map((t, w) => Number.isFinite(t) ? /* @__PURE__ */ s(
|
|
43
|
+
h,
|
|
44
|
+
{
|
|
45
|
+
className: m(
|
|
46
|
+
i.pagination_btn,
|
|
47
|
+
{ [i.active]: t === o }
|
|
48
|
+
),
|
|
49
|
+
size: "xs",
|
|
50
|
+
view: "ghost",
|
|
51
|
+
onClick: () => l({ page: t }),
|
|
52
|
+
children: t
|
|
53
|
+
},
|
|
54
|
+
t
|
|
55
|
+
) : /* @__PURE__ */ s(
|
|
56
|
+
h,
|
|
57
|
+
{
|
|
58
|
+
className: m(i.pagination_btn),
|
|
59
|
+
view: "ghost",
|
|
60
|
+
disabled: !0,
|
|
61
|
+
children: "..."
|
|
62
|
+
},
|
|
63
|
+
t + w
|
|
64
|
+
)),
|
|
65
|
+
/* @__PURE__ */ s(
|
|
66
|
+
h,
|
|
67
|
+
{
|
|
68
|
+
className: m(i.btn, { [i.disabled_btn]: e }),
|
|
69
|
+
leftAddons: /* @__PURE__ */ s(f, {}),
|
|
70
|
+
view: "ghost",
|
|
71
|
+
onClick: () => {
|
|
72
|
+
l({ page: o + 1 });
|
|
73
|
+
},
|
|
74
|
+
disabled: e
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
] }) }),
|
|
78
|
+
/* @__PURE__ */ d("div", { className: i.select_wrap, children: [
|
|
79
|
+
/* @__PURE__ */ s(g.Text, { view: "title", weight: "medium", color: "secondary", children: b(c)("resultsOnPage") }),
|
|
80
|
+
/* @__PURE__ */ s(
|
|
82
81
|
"select",
|
|
83
82
|
{
|
|
84
|
-
value:
|
|
83
|
+
value: v,
|
|
85
84
|
className: i.select,
|
|
86
|
-
onChange: (
|
|
87
|
-
l({ page: 1, limit:
|
|
85
|
+
onChange: (t) => {
|
|
86
|
+
l({ page: 1, limit: t.target.value });
|
|
88
87
|
},
|
|
89
|
-
children: [5, 10, 20, 30, 40, 50].map((
|
|
88
|
+
children: [5, 10, 20, 30, 40, 50].map((t) => /* @__PURE__ */ s("option", { value: t, children: t }, t))
|
|
90
89
|
}
|
|
91
90
|
)
|
|
92
91
|
] })
|
|
93
|
-
] }) : /* @__PURE__ */ r("div", { className: i.pagination_wrap, children: [
|
|
94
|
-
/* @__PURE__ */ r("div", { className: i.pages_info, children: [
|
|
95
|
-
/* @__PURE__ */ t(h.Text, { view: "title", weight: "medium", color: "secondary", children: g(a)("totalCount") }),
|
|
96
|
-
/* @__PURE__ */ t(h.Text, { view: "title", weight: "medium", color: "primary", children: p })
|
|
97
|
-
] }),
|
|
98
|
-
u,
|
|
99
|
-
/* @__PURE__ */ t(
|
|
100
|
-
"select",
|
|
101
|
-
{
|
|
102
|
-
value: f,
|
|
103
|
-
className: i.select,
|
|
104
|
-
onChange: (e) => {
|
|
105
|
-
l({ page: 1, limit: e.target.value });
|
|
106
|
-
},
|
|
107
|
-
children: [5, 10, 20, 30, 40, 50].map((e) => /* @__PURE__ */ t("option", { value: e, children: `${g(a)("resultsOnPage")}${N}${e}${_}` }, e))
|
|
108
|
-
}
|
|
109
|
-
)
|
|
110
92
|
] });
|
|
111
93
|
};
|
|
112
94
|
export {
|
|
113
|
-
|
|
95
|
+
j as Pagination
|
|
114
96
|
};
|
|
115
97
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/table/components/pagination/index.tsx"],"sourcesContent":["import React from 'react';\nimport ChevronForwardS from '@alphakits/icons/dist/ChevronForwardS';\nimport cn from 'classnames';\n\nimport { Button } from '../../../button';\nimport { Typography } from '../../../typography';\nimport { translate } from '../../languages';\n\nimport styles from './index.module.css';\n\nfunction pagination(current: number, last: number) {\n const delta = 2;\n const left = current - delta;\n const right = current + delta + 1;\n const range = [];\n const rangeWithDots: any = [];\n let l = 0;\n\n for (let i = 1; i <= last; i++) {\n if (i === 1 || i === last || (i >= left && i < right)) {\n range.push(i);\n }\n }\n\n range.forEach((i: number) => {\n if (l) {\n if (i - l === 2) {\n rangeWithDots.push(l + 1);\n } else if (i - l !== 1) {\n rangeWithDots.push('...');\n }\n }\n rangeWithDots.push(i);\n l = i;\n });\n\n return rangeWithDots;\n}\n\ntype Props = {\n pagesCount: number;\n currentPage: number;\n recordsPerPage: number;\n total: number;\n addParam: (param: Record<string, unknown>) => void;\n language: 'en' | 'de' | 'ru';\n v2?: boolean;\n};\n\nexport const Pagination: React.FC<Props> = ({\n pagesCount,\n currentPage,\n recordsPerPage = 30,\n total,\n language,\n addParam,\n v2,\n}) => {\n const pg = pagination(currentPage, pagesCount);\n\n const disablePreviewsPage = currentPage === 1;\n const disableNextPage = currentPage === pagesCount;\n\n const space = '\\xa0\\xa0\\xa0\\xa0';\n const spaceAfter = '\\xa0\\xa0\\xa0';\n\n const paginationButtons = pg.length > 1 && (\n <div className={ styles.pagination }>\n <Button\n className={ cn(styles.prev_btn, styles.btn, { [styles.disabled_btn]: disablePreviewsPage }) }\n leftAddons={ <ChevronForwardS /> }\n view=\"ghost\"\n onClick={ () => addParam({ page: currentPage - 1 }) }\n disabled={ disablePreviewsPage }\n />\n { pg.map((p: number, i: number) =>\n (Number.isFinite(p) ? (\n <Button\n className={ cn(\n styles.pagination_btn,\n { [styles.active]: p === currentPage },\n ) }\n size=\"xs\"\n view=\"ghost\"\n key={ p }\n onClick={ () => addParam({ page: p }) }\n >\n { p }\n </Button>\n ) : (\n <Button\n // eslint-disable-next-line react/no-array-index-key\n key={ p + i }\n className={ cn(styles.pagination_btn) }\n view=\"ghost\"\n disabled={ true }\n >\n ...\n </Button>\n ))) }\n <Button\n className={ cn(styles.btn, { [styles.disabled_btn]: disableNextPage }) }\n leftAddons={ <ChevronForwardS /> }\n view=\"ghost\"\n onClick={ () => {\n addParam({ page: currentPage + 1 });\n } }\n disabled={ disableNextPage }\n />\n </div>\n );\n\n if (v2) {\n return (\n <div className={ cn(styles.pagination_wrap, styles.v2) }>\n <div className={ styles.pages_info }>\n <Typography.Text view=\"title\" weight=\"medium\" color=\"secondary\">\n { translate(language)('totalCount') }\n </Typography.Text>\n\n <Typography.Text view=\"title\" weight=\"medium\" color=\"primary\">\n { total }\n </Typography.Text>\n </div>\n\n <div className={ styles.pagination_center }>\n { paginationButtons }\n </div>\n\n <div className={ styles.select_wrap }>\n <Typography.Text view=\"title\" weight=\"medium\" color=\"secondary\">\n { translate(language)('resultsOnPage') }\n </Typography.Text>\n\n <select\n value={ recordsPerPage }\n className={ styles.select }\n onChange={ (e) => {\n addParam({ page: 1, limit: e.target.value });\n } }\n >\n { [5, 10, 20, 30, 40, 50].map((size) => (\n <option key={ size } value={ size }>\n { size }\n </option>\n )) }\n </select>\n </div>\n </div>\n );\n }\n\n return (\n <div className={ styles.pagination_wrap }>\n <div className={ styles.pages_info }>\n <Typography.Text view=\"title\" weight=\"medium\" color=\"secondary\">\n { translate(language)('totalCount') }\n </Typography.Text>\n\n <Typography.Text view=\"title\" weight=\"medium\" color=\"primary\">\n { total }\n </Typography.Text>\n </div>\n\n { paginationButtons }\n\n <select\n value={ recordsPerPage }\n className={ styles.select }\n onChange={ (e) => {\n addParam({ page: 1, limit: e.target.value });\n } }\n >\n { [5, 10, 20, 30, 40, 50].map((size) => (\n <option key={ size } value={ size }>\n { `${translate(language)('resultsOnPage')}${space}${size}${spaceAfter}` }\n </option>\n )) }\n </select>\n </div>\n );\n};\n"],"names":["pagination","current","last","left","right","range","rangeWithDots","l","i","Pagination","pagesCount","currentPage","recordsPerPage","total","language","addParam","v2","pg","disablePreviewsPage","disableNextPage","space","spaceAfter","paginationButtons","styles","jsx","Button","cn","ChevronForwardS","p","jsxs","Typography","translate","size"],"mappings":";;;;;;;AAUA,SAASA,EAAWC,GAAiBC,GAAc;AAE/C,QAAMC,IAAOF,IAAU,GACjBG,IAAQH,IAAU,IAAQ,GAC1BI,IAAQ,CAAA,GACRC,IAAqB,CAAA;AAC3B,MAAIC,IAAI;AAER,WAASC,IAAI,GAAGA,KAAKN,GAAMM;AACvB,KAAIA,MAAM,KAAKA,MAAMN,KAASM,KAAKL,KAAQK,IAAIJ,MAC3CC,EAAM,KAAKG,CAAC;AAIpB,SAAAH,EAAM,QAAQ,CAACG,MAAc;AACzB,IAAID,MACIC,IAAID,MAAM,IACVD,EAAc,KAAKC,IAAI,CAAC,IACjBC,IAAID,MAAM,KACjBD,EAAc,KAAK,KAAK,IAGhCA,EAAc,KAAKE,CAAC,GACpBD,IAAIC;AAAA,EACR,CAAC,GAEMF;AACX;AAYO,MAAMG,IAA8B,CAAC;AAAA,EACxC,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,gBAAAC,IAAiB;AAAA,EACjB,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,IAAAC;AACJ,MAAM;AACF,QAAMC,IAAKjB,EAAWW,GAAaD,CAAU,GAEvCQ,IAAsBP,MAAgB,GACtCQ,IAAkBR,MAAgBD,GAElCU,IAAQ,QACRC,IAAa,OAEbC,IAAoBL,EAAG,SAAS,uBACjC,OAAA,EAAI,WAAYM,EAAO,YACpB,UAAA;AAAA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;AAAA,MAEA,gBAAAU,EAACM,EAAW,MAAX,EAAgB,MAAK,SAAQ,QAAO,UAAS,OAAM,WAC9C,UAAAjB,EAAA,CACN;AAAA,IAAA,GACJ;AAAA,IAEES;AAAA,IAEF,gBAAAE;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,OAAQZ;AAAA,QACR,WAAYW,EAAO;AAAA,QACnB,UAAW,CAAC,MAAM;AACd,UAAAR,EAAS,EAAE,MAAM,GAAG,OAAO,EAAE,OAAO,OAAO;AAAA,QAC/C;AAAA,QAEE,UAAA,CAAC,GAAG,IAAI,IAAI,IAAI,IAAI,EAAE,EAAE,IAAI,CAACiB,MAC3B,gBAAAR,EAAC,UAAA,EAAoB,OAAQQ,GACvB,UAAA,GAAGD,EAAUjB,CAAQ,EAAE,eAAe,CAAC,GAAGM,CAAK,GAAGY,CAAI,GAAGX,CAAU,GAAA,GAD3DW,CAEd,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EACL,GACJ;AAER;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/table/components/pagination/index.tsx"],"sourcesContent":["import React from 'react';\nimport ChevronForwardS from '@alphakits/icons/dist/ChevronForwardS';\nimport cn from 'classnames';\n\nimport { Button } from '../../../button';\nimport { Typography } from '../../../typography';\nimport { translate } from '../../languages';\n\nimport styles from './index.module.css';\n\nfunction pagination(current: number, last: number) {\n const delta = 2;\n const left = current - delta;\n const right = current + delta + 1;\n const range = [];\n const rangeWithDots: any = [];\n let l = 0;\n\n for (let i = 1; i <= last; i++) {\n if (i === 1 || i === last || (i >= left && i < right)) {\n range.push(i);\n }\n }\n\n range.forEach((i: number) => {\n if (l) {\n if (i - l === 2) {\n rangeWithDots.push(l + 1);\n } else if (i - l !== 1) {\n rangeWithDots.push('...');\n }\n }\n rangeWithDots.push(i);\n l = i;\n });\n\n return rangeWithDots;\n}\n\ntype Props = {\n pagesCount: number;\n currentPage: number;\n recordsPerPage: number;\n total: number;\n addParam: (param: Record<string, unknown>) => void;\n language: 'en' | 'de' | 'ru';\n};\n\nexport const Pagination: React.FC<Props> = ({\n pagesCount,\n currentPage,\n recordsPerPage = 30,\n total,\n language,\n addParam,\n}) => {\n const pg = pagination(currentPage, pagesCount);\n\n const disablePreviewsPage = currentPage === 1;\n const disableNextPage = currentPage === pagesCount;\n\n return (\n <div className={ styles.pagination_wrap }>\n <div className={ styles.pages_info }>\n <Typography.Text view=\"title\" weight=\"medium\" color=\"secondary\">\n { translate(language)('totalCount') }\n </Typography.Text>\n\n <Typography.Text view=\"title\" weight=\"medium\" color=\"primary\">\n { total }\n </Typography.Text>\n </div>\n\n <div className={ styles.pagination_center }>\n { pg.length > 1 && (\n <div className={ styles.pagination }>\n <Button\n className={ cn(styles.prev_btn, styles.btn, { [styles.disabled_btn]: disablePreviewsPage }) }\n leftAddons={ <ChevronForwardS /> }\n view=\"ghost\"\n onClick={ () => addParam({ page: currentPage - 1 }) }\n disabled={ disablePreviewsPage }\n />\n { pg.map((p: number, i: number) =>\n (Number.isFinite(p) ? (\n <Button\n className={ cn(\n styles.pagination_btn,\n { [styles.active]: p === currentPage },\n ) }\n size=\"xs\"\n view=\"ghost\"\n key={ p }\n onClick={ () => addParam({ page: p }) }\n >\n { p }\n </Button>\n ) : (\n <Button\n // eslint-disable-next-line react/no-array-index-key\n key={ p + i }\n className={ cn(styles.pagination_btn) }\n view=\"ghost\"\n disabled={ true }\n >\n ...\n </Button>\n ))) }\n <Button\n className={ cn(styles.btn, { [styles.disabled_btn]: disableNextPage }) }\n leftAddons={ <ChevronForwardS /> }\n view=\"ghost\"\n onClick={ () => {\n addParam({ page: currentPage + 1 });\n } }\n disabled={ disableNextPage }\n />\n </div>\n ) }\n </div>\n\n <div className={ styles.select_wrap }>\n <Typography.Text view=\"title\" weight=\"medium\" color=\"secondary\">\n { translate(language)('resultsOnPage') }\n </Typography.Text>\n\n <select\n value={ recordsPerPage }\n className={ styles.select }\n onChange={ (e) => {\n addParam({ page: 1, limit: e.target.value });\n } }\n >\n { [5, 10, 20, 30, 40, 50].map((size) => (\n <option key={ size } value={ size }>\n { size }\n </option>\n )) }\n </select>\n </div>\n </div>\n );\n};\n"],"names":["pagination","current","last","left","right","range","rangeWithDots","l","i","Pagination","pagesCount","currentPage","recordsPerPage","total","language","addParam","pg","disablePreviewsPage","disableNextPage","jsxs","styles","jsx","Typography","translate","Button","cn","ChevronForwardS","p","e","size"],"mappings":";;;;;;;AAUA,SAASA,EAAWC,GAAiBC,GAAc;AAE/C,QAAMC,IAAOF,IAAU,GACjBG,IAAQH,IAAU,IAAQ,GAC1BI,IAAQ,CAAA,GACRC,IAAqB,CAAA;AAC3B,MAAIC,IAAI;AAER,WAASC,IAAI,GAAGA,KAAKN,GAAMM;AACvB,KAAIA,MAAM,KAAKA,MAAMN,KAASM,KAAKL,KAAQK,IAAIJ,MAC3CC,EAAM,KAAKG,CAAC;AAIpB,SAAAH,EAAM,QAAQ,CAACG,MAAc;AACzB,IAAID,MACIC,IAAID,MAAM,IACVD,EAAc,KAAKC,IAAI,CAAC,IACjBC,IAAID,MAAM,KACjBD,EAAc,KAAK,KAAK,IAGhCA,EAAc,KAAKE,CAAC,GACpBD,IAAIC;AAAA,EACR,CAAC,GAEMF;AACX;AAWO,MAAMG,IAA8B,CAAC;AAAA,EACxC,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,gBAAAC,IAAiB;AAAA,EACjB,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AACJ,MAAM;AACF,QAAMC,IAAKhB,EAAWW,GAAaD,CAAU,GAEvCO,IAAsBN,MAAgB,GACtCO,IAAkBP,MAAgBD;AAExC,SACI,gBAAAS,EAAC,OAAA,EAAI,WAAYC,EAAO,iBACpB,UAAA;AAAA,IAAA,gBAAAD,EAAC,OAAA,EAAI,WAAYC,EAAO,YACpB,UAAA;AAAA,MAAA,gBAAAC,EAACC,EAAW,MAAX,EAAgB,MAAK,SAAQ,QAAO,UAAS,OAAM,aAC9C,UAAAC,EAAUT,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8BAAcQ,GAAA,EAAgB;AAAA,UAC9B,MAAK;AAAA,UACL,SAAU,MAAM;AACZ,YAAAX,EAAS,EAAE,MAAMJ,IAAc,EAAA,CAAG;AAAA,UACtC;AAAA,UACA,UAAWO;AAAA,QAAA;AAAA,MAAA;AAAA,IACf,EAAA,CACJ,EAAA,CAER;AAAA,IAEA,gBAAAC,EAAC,OAAA,EAAI,WAAYC,EAAO,aACpB,UAAA;AAAA,MAAA,gBAAAC,EAACC,EAAW,MAAX,EAAgB,MAAK,SAAQ,QAAO,UAAS,OAAM,aAC9C,UAAAC,EAAUT,CAAQ,EAAE,eAAe,GACzC;AAAA,MAEA,gBAAAO;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,OAAQT;AAAA,UACR,WAAYQ,EAAO;AAAA,UACnB,UAAW,CAACQ,MAAM;AACd,YAAAb,EAAS,EAAE,MAAM,GAAG,OAAOa,EAAE,OAAO,OAAO;AAAA,UAC/C;AAAA,UAEE,WAAC,GAAG,IAAI,IAAI,IAAI,IAAI,EAAE,EAAE,IAAI,CAACC,MAC3B,gBAAAR,EAAC,UAAA,EAAoB,OAAQQ,GACvB,UAAAA,EAAA,GADQA,CAEd,CACH;AAAA,QAAA;AAAA,MAAA;AAAA,IACL,EAAA,CACJ;AAAA,EAAA,GACJ;AAER;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.pagination_wrap_kmil{
|
|
1
|
+
.pagination_wrap_kmil{min-height:40px;padding:4px 24px;display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:center;grid-gap:16px;gap:16px;background-color:var(--color-bg-primary);position:sticky;bottom:0;border:1px solid var(--color-border-secondary);border-radius:0 0 12px 12px;box-sizing:border-box;font-size:14px}.pages_info_9Quw{display:flex;gap:8px;align-items:baseline;color:var(--color-text-secondary);justify-self:start}.pagination_center_rtzL{display:flex;justify-content:center;justify-self:center;grid-column:2}.pagination_36rf{display:grid;grid-column-gap:4px;-moz-column-gap:4px;column-gap:4px;grid-auto-flow:column;align-items:center}.prev_btn_UnDy svg{transform:rotate(180deg)}.disabled_btn_G6J6{opacity:.4}.pagination_btn_vexg{color:var(--color-text-secondary)!important;font-weight:500;min-width:28px!important;height:28px!important;padding:0 6px!important;border-radius:6px!important;background-color:transparent!important}.pagination_btn_vexg:hover{background-color:var(--color-bg-secondary)!important}.pagination_btn_vexg.active_F46k{color:var(--color-text-primary)!important;font-weight:700;background-color:transparent!important}.btn_-Zrx{min-width:28px!important;height:28px!important;padding:0!important;color:var(--color-text-secondary)!important}.select_wrap_QwzZ{justify-self:end;grid-column:3;display:flex;align-items:center;gap:12px;color:var(--color-text-secondary)}.select_XysE{margin:0;border:1px solid var(--color-border-secondary);outline:none;border-radius:8px;height:32px;padding:0 28px 0 12px;font-weight:500;font-size:14px;line-height:1;color:var(--color-text-primary);background-color:var(--color-bg-primary);cursor:pointer;appearance:none;-webkit-appearance:none;background-image:linear-gradient(45deg,transparent 50%,var(--color-graphic-secondary, var(--color-text-secondary)) 50%),linear-gradient(135deg,var(--color-graphic-secondary, var(--color-text-secondary)) 50%,transparent 50%);background-position:calc(100% - 14px) 50%,calc(100% - 9px) 50%;background-size:5px 5px,5px 5px;background-repeat:no-repeat}.select_XysE:focus-visible{outline:2px solid var(--color-border-link, var(--color-graphic-accent));outline-offset:1px}
|
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
import './index.module.css';
|
|
2
|
-
const n = "pagination_wrap_kmil", t = "pages_info_9Quw", a = "
|
|
2
|
+
const n = "pagination_wrap_kmil", t = "pages_info_9Quw", a = "pagination_center_rtzL", e = "pagination_36rf", i = "prev_btn_UnDy", _ = "disabled_btn_G6J6", o = "pagination_btn_vexg", s = "active_F46k", p = "btn_-Zrx", c = "select_wrap_QwzZ", g = "select_XysE", r = {
|
|
3
3
|
pagination_wrap: n,
|
|
4
4
|
pages_info: t,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
pagination_center: a,
|
|
6
|
+
pagination: e,
|
|
7
|
+
prev_btn: i,
|
|
8
|
+
disabled_btn: _,
|
|
9
|
+
pagination_btn: o,
|
|
10
10
|
active: s,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
select_wrap: r
|
|
11
|
+
btn: p,
|
|
12
|
+
select_wrap: c,
|
|
13
|
+
select: g
|
|
15
14
|
};
|
|
16
15
|
export {
|
|
17
16
|
s as active,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
p as btn,
|
|
18
|
+
r as default,
|
|
19
|
+
_ as disabled_btn,
|
|
21
20
|
t as pages_info,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
e as pagination,
|
|
22
|
+
o as pagination_btn,
|
|
23
|
+
a as pagination_center,
|
|
25
24
|
n as pagination_wrap,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
p as v2
|
|
25
|
+
i as prev_btn,
|
|
26
|
+
g as select,
|
|
27
|
+
c as select_wrap
|
|
30
28
|
};
|
|
31
29
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|