@shmidko61/lc-ui-kit 0.0.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.
- package/README.md +38 -0
- package/dist/accordion/accordion-context.d.ts +3 -0
- package/dist/accordion/accordion-item.d.ts +48 -0
- package/dist/accordion/accordion-root.d.ts +5 -0
- package/dist/accordion/accordion.d.ts +8 -0
- package/dist/accordion.cjs +1 -0
- package/dist/accordion.js +206 -0
- package/dist/arrow-CS6d64Y4.cjs +1 -0
- package/dist/arrow-DBc2opRL.js +5 -0
- package/dist/box/box.d.ts +7 -0
- package/dist/box/box.helpers.d.ts +11 -0
- package/dist/box/box.types.d.ts +62 -0
- package/dist/box.cjs +1 -0
- package/dist/box.js +342 -0
- package/dist/button/button.d.ts +22 -0
- package/dist/button/button.helpers.d.ts +119 -0
- package/dist/button.cjs +1 -0
- package/dist/button.js +438 -0
- package/dist/design-tokens/color.tokens.d.ts +6 -0
- package/dist/design-tokens/typography.tokens.d.ts +9 -0
- package/dist/drop-down-CdIuWbLC.cjs +1 -0
- package/dist/drop-down-DH2_3qXq.js +5 -0
- package/dist/eye-open-5zYaeyLp.cjs +1 -0
- package/dist/eye-open-CoTSj5cT.js +5 -0
- package/dist/flex/flex.d.ts +5 -0
- package/dist/flex/flex.helpers.d.ts +9 -0
- package/dist/flex/flex.types.d.ts +12 -0
- package/dist/flex.cjs +1 -0
- package/dist/flex.js +128 -0
- package/dist/grid/grid.d.ts +25 -0
- package/dist/grid/grid.helpers.d.ts +13 -0
- package/dist/grid/grid.types.d.ts +49 -0
- package/dist/grid.cjs +1 -0
- package/dist/grid.js +103 -0
- package/dist/icons/icons.d.ts +30 -0
- package/dist/icons.cjs +1 -0
- package/dist/icons.js +38 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +97 -0
- package/dist/input/input.d.ts +49 -0
- package/dist/input/input.helpers.d.ts +9 -0
- package/dist/input.cjs +1 -0
- package/dist/input.js +85 -0
- package/dist/media-card/components/media-card-pick-indicator.d.ts +6 -0
- package/dist/media-card/components/media-card-preview.d.ts +7 -0
- package/dist/media-card/components/media-card-upload-footer.d.ts +7 -0
- package/dist/media-card/components/media-card-upload.d.ts +5 -0
- package/dist/media-card/media-card-pick.d.ts +5 -0
- package/dist/media-card/media-card.d.ts +4 -0
- package/dist/media-card/media-card.types.d.ts +10 -0
- package/dist/media-card.cjs +1 -0
- package/dist/media-card.js +104 -0
- package/dist/media-gallery/media-gallery.d.ts +12 -0
- package/dist/media-gallery/media-gallery.helpers.d.ts +27 -0
- package/dist/media-gallery/media-gallery.types.d.ts +59 -0
- package/dist/media-gallery.cjs +1 -0
- package/dist/media-gallery.js +100 -0
- package/dist/media-picture-BN4saEVT.js +6 -0
- package/dist/media-picture-BmERSmsd.cjs +1 -0
- package/dist/modal/modal.d.ts +50 -0
- package/dist/modal.cjs +1 -0
- package/dist/modal.js +143 -0
- package/dist/pagination/pagination.d.ts +22 -0
- package/dist/pagination.cjs +1 -0
- package/dist/pagination.js +155 -0
- package/dist/picture/picture.d.ts +12 -0
- package/dist/picture/picture.helpers.d.ts +9 -0
- package/dist/picture/picture.types.d.ts +56 -0
- package/dist/picture.cjs +1 -0
- package/dist/picture.js +55 -0
- package/dist/responsive-style.config-B2m9jVlX.cjs +1 -0
- package/dist/responsive-style.config-DFuATrIM.js +19 -0
- package/dist/responsive-style.utils-BdyoDkKg.cjs +1 -0
- package/dist/responsive-style.utils-D10sC561.js +25 -0
- package/dist/select/select.d.ts +55 -0
- package/dist/select/select.helpers.d.ts +14 -0
- package/dist/select/select.types.d.ts +12 -0
- package/dist/select.cjs +1 -0
- package/dist/select.js +179 -0
- package/dist/shared/lib/cn.d.ts +2 -0
- package/dist/shared/responsive-style/responsive-style.config.d.ts +20 -0
- package/dist/shared/responsive-style/responsive-style.types.d.ts +52 -0
- package/dist/shared/responsive-style/responsive-style.utils.d.ts +17 -0
- package/dist/status-badge/status-badge.d.ts +11 -0
- package/dist/status-badge.cjs +1 -0
- package/dist/status-badge.js +39 -0
- package/dist/styles.css +1 -0
- package/dist/switch/switch.d.ts +34 -0
- package/dist/switch.cjs +1 -0
- package/dist/switch.js +127 -0
- package/dist/table/data-table.d.ts +3 -0
- package/dist/table/table-container.d.ts +8 -0
- package/dist/table/table-primitives.d.ts +40 -0
- package/dist/table/table-status.d.ts +12 -0
- package/dist/table/table.d.ts +8 -0
- package/dist/table/table.types.d.ts +48 -0
- package/dist/table-container-BsE-uIE1.js +242 -0
- package/dist/table-container-DqqqkChm.cjs +1 -0
- package/dist/table.cjs +1 -0
- package/dist/table.js +16 -0
- package/dist/telephone-DVftjRG9.cjs +1 -0
- package/dist/telephone-DvXakgBQ.js +26 -0
- package/dist/time-clock-DOwPzcx7.cjs +1 -0
- package/dist/time-clock-DjqcZ8tI.js +5 -0
- package/dist/types/flex.types.d.ts +25 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/interaction.types.d.ts +8 -0
- package/dist/types/layout.types.d.ts +52 -0
- package/dist/types/shared.types.d.ts +8 -0
- package/dist/types/spacing.types.d.ts +123 -0
- package/dist/types/typography.types.d.ts +75 -0
- package/dist/types/visual.types.d.ts +82 -0
- package/dist/types.cjs +1 -0
- package/dist/types.js +1 -0
- package/dist/typography/typography.d.ts +39 -0
- package/dist/typography/typography.helpers.d.ts +237 -0
- package/dist/typography.cjs +1 -0
- package/dist/typography.js +469 -0
- package/dist/ui-kit-provider/ui-kit-provider.d.ts +53 -0
- package/dist/ui-kit-provider-C6Mk5g_7.js +167 -0
- package/dist/ui-kit-provider-raEFsUm0.cjs +1 -0
- package/dist/ui-kit-provider.cjs +1 -0
- package/dist/ui-kit-provider.js +8 -0
- package/dist/vite.config.d.ts +2 -0
- package/dist/x-mark-DId-ylR6.cjs +1 -0
- package/dist/x-mark-WU1eT82T.js +5 -0
- package/package.json +219 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "./responsive-style.config-DFuATrIM.js";
|
|
3
|
+
import { S as u, a as p } from "./media-picture-BN4saEVT.js";
|
|
4
|
+
import { S as f } from "./x-mark-WU1eT82T.js";
|
|
5
|
+
import { Typography as b } from "./typography.js";
|
|
6
|
+
function x({ isPicked: e }) {
|
|
7
|
+
return /* @__PURE__ */ r(
|
|
8
|
+
"span",
|
|
9
|
+
{
|
|
10
|
+
className: c(
|
|
11
|
+
"absolute right-[4px] top-[4px] inline-flex size-[20px] items-center justify-center rounded-full ",
|
|
12
|
+
e ? " bg-[var(--color-primary-accent)] text-[var(--color-background-default)]" : "bg-[var(--color-background-default)] text-transparent"
|
|
13
|
+
),
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
children: /* @__PURE__ */ r(u, { className: "size-[18px]" })
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
function l({ fileName: e, imgUrl: a, children: t }) {
|
|
20
|
+
return /* @__PURE__ */ i("div", { className: "relative flex aspect-square w-full items-center justify-center rounded-[8px] overflow-hidden bg-[var(--color-background-subtle)]", children: [
|
|
21
|
+
a ? /* @__PURE__ */ r("img", { className: "w-full object-contain", src: a, alt: e }) : /* @__PURE__ */ r(p, { className: "size-[40px] text-[var(--color-text-secondary)]" }),
|
|
22
|
+
t
|
|
23
|
+
] });
|
|
24
|
+
}
|
|
25
|
+
function m({
|
|
26
|
+
className: e,
|
|
27
|
+
fileName: a,
|
|
28
|
+
imgUrl: t,
|
|
29
|
+
isPicked: n = !1,
|
|
30
|
+
onSubmit: o
|
|
31
|
+
}) {
|
|
32
|
+
return /* @__PURE__ */ r(
|
|
33
|
+
"button",
|
|
34
|
+
{
|
|
35
|
+
type: "button",
|
|
36
|
+
className: c(
|
|
37
|
+
"block w-full overflow-hidden rounded-[10px] border border-[var(--color-primary-accent)] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-[color-mix(in_srgb,var(--color-primary-accent)_35%,transparent)]",
|
|
38
|
+
e
|
|
39
|
+
),
|
|
40
|
+
onClick: o,
|
|
41
|
+
children: /* @__PURE__ */ r(l, { fileName: a, imgUrl: t, children: /* @__PURE__ */ r(x, { isPicked: n }) })
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
function v({
|
|
46
|
+
fileName: e,
|
|
47
|
+
onDelete: a
|
|
48
|
+
}) {
|
|
49
|
+
return /* @__PURE__ */ i("div", { className: "flex justify-between items-center gap-[8px]", children: [
|
|
50
|
+
/* @__PURE__ */ r(b, { variant: "b3", children: e }),
|
|
51
|
+
a ? /* @__PURE__ */ r("button", { type: "button", "aria-label": `Удалить ${e}`, onClick: a, children: /* @__PURE__ */ r(f, { className: "size-[16px]" }) }) : null
|
|
52
|
+
] });
|
|
53
|
+
}
|
|
54
|
+
function g({
|
|
55
|
+
className: e,
|
|
56
|
+
fileName: a,
|
|
57
|
+
imgUrl: t,
|
|
58
|
+
onDelete: n
|
|
59
|
+
}) {
|
|
60
|
+
return /* @__PURE__ */ i(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
className: c(
|
|
64
|
+
"flex flex-col w-full gap-[4px] rounded-[10px] bg-[var(--color-background-subtle)] p-[4px]",
|
|
65
|
+
e
|
|
66
|
+
),
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ r(l, { fileName: a, imgUrl: t }),
|
|
69
|
+
/* @__PURE__ */ r(v, { fileName: a, onDelete: n })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
function M({
|
|
75
|
+
className: e,
|
|
76
|
+
fileName: a,
|
|
77
|
+
imgUrl: t,
|
|
78
|
+
isPicked: n,
|
|
79
|
+
onDelete: o,
|
|
80
|
+
onSubmit: s,
|
|
81
|
+
variant: d
|
|
82
|
+
}) {
|
|
83
|
+
return d === "img-pick" ? /* @__PURE__ */ r(
|
|
84
|
+
m,
|
|
85
|
+
{
|
|
86
|
+
className: e,
|
|
87
|
+
fileName: a,
|
|
88
|
+
imgUrl: t,
|
|
89
|
+
isPicked: n,
|
|
90
|
+
onSubmit: s
|
|
91
|
+
}
|
|
92
|
+
) : /* @__PURE__ */ r(
|
|
93
|
+
g,
|
|
94
|
+
{
|
|
95
|
+
className: e,
|
|
96
|
+
fileName: a,
|
|
97
|
+
imgUrl: t,
|
|
98
|
+
onDelete: o
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
export {
|
|
103
|
+
M as MediaCard
|
|
104
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { MediaGalleryItem, MediaGalleryProps } from './media-gallery.types';
|
|
3
|
+
/**
|
|
4
|
+
* Галерея медиа-карточек для выбора изображений.
|
|
5
|
+
*
|
|
6
|
+
* Компонент не знает ничего о доменной модели приложения: он получает готовые
|
|
7
|
+
* элементы `MediaGalleryItem`, отображает их через `MediaCard` и возвращает
|
|
8
|
+
* выбранный item в `onSubmit`. Количество колонок и gap настраиваются через
|
|
9
|
+
* base/md/lg/xl props и передаются в общий `Grid`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function MediaGallery<TItem extends MediaGalleryItem = MediaGalleryItem>({ className, columns, errorMessage, emptyMessage, gap, gridClassName, items, isLoading, lg, maxHeight, md, onSubmit, scrollable, scrollThreshold, xl, ...props }: MediaGalleryProps<TItem>): JSX.Element;
|
|
12
|
+
export type { MediaGalleryItem, MediaGalleryProps } from './media-gallery.types';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GridProps } from '../grid/grid.types';
|
|
2
|
+
import { MediaGalleryProps } from './media-gallery.types';
|
|
3
|
+
interface MediaGalleryLayoutInput {
|
|
4
|
+
itemsCount: number;
|
|
5
|
+
maxHeight: MediaGalleryProps['maxHeight'];
|
|
6
|
+
scrollable: MediaGalleryProps['scrollable'];
|
|
7
|
+
scrollThreshold: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Определяет параметры scroll-контейнера галереи.
|
|
11
|
+
*
|
|
12
|
+
* По умолчанию галерея становится скроллируемой, когда количество элементов
|
|
13
|
+
* превышает `scrollThreshold`. Потребитель может переопределить это поведение
|
|
14
|
+
* явным prop `scrollable`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getMediaGalleryScrollState({ itemsCount, maxHeight, scrollable, scrollThreshold, }: MediaGalleryLayoutInput): {
|
|
17
|
+
maxHeightValue: string;
|
|
18
|
+
shouldUseScroll: boolean;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Преобразует API MediaGallery (`columns`) в API Grid (`cols`).
|
|
22
|
+
*
|
|
23
|
+
* MediaGallery оставляет предметное имя `columns`, а Grid использует короткое
|
|
24
|
+
* layout-имя `cols`. Этот helper держит маппинг в одном месте.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getMediaGalleryGridProps({ columns, gap, lg, md, xl, }: Pick<MediaGalleryProps, 'columns' | 'gap' | 'lg' | 'md' | 'xl'>): Pick<GridProps, 'cols' | 'gap' | 'lg' | 'md' | 'xl'>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { GridCols, GridGap } from '../grid/grid.types';
|
|
3
|
+
/**
|
|
4
|
+
* Минимальная модель элемента, которую умеет отрисовать MediaGallery.
|
|
5
|
+
*
|
|
6
|
+
* Потребитель может расширять этот тип через generic и хранить рядом доменные
|
|
7
|
+
* данные, которые вернутся обратно в `onSubmit`.
|
|
8
|
+
*/
|
|
9
|
+
export interface MediaGalleryItem {
|
|
10
|
+
/** Подпись/имя файла для alt и accessibility-текста карточки. */
|
|
11
|
+
fileName: string;
|
|
12
|
+
/** Стабильный key элемента. */
|
|
13
|
+
id: string | number;
|
|
14
|
+
/** URL изображения для preview. */
|
|
15
|
+
imgUrl?: string;
|
|
16
|
+
/** Признак выбранного состояния карточки. */
|
|
17
|
+
isPicked?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Настройки сетки MediaGallery для одного responsive-состояния.
|
|
21
|
+
*/
|
|
22
|
+
export interface MediaGalleryBreakpointConfig {
|
|
23
|
+
/** Количество колонок в сетке. */
|
|
24
|
+
columns?: GridCols;
|
|
25
|
+
/** Зазор между карточками. Число трактуется как px. */
|
|
26
|
+
gap?: GridGap;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Props MediaGallery.
|
|
30
|
+
*
|
|
31
|
+
* Верхний уровень (`columns`, `gap`) задаёт base-состояние, а `md`, `lg`, `xl`
|
|
32
|
+
* переопределяют параметры сетки на соответствующих breakpoint-ах.
|
|
33
|
+
*/
|
|
34
|
+
export interface MediaGalleryProps<TItem extends MediaGalleryItem = MediaGalleryItem> extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onSubmit'>, MediaGalleryBreakpointConfig {
|
|
35
|
+
/** Текст ошибки загрузки или подготовки галереи. */
|
|
36
|
+
errorMessage?: ReactNode;
|
|
37
|
+
/** Сообщение для пустого состояния. */
|
|
38
|
+
emptyMessage?: ReactNode;
|
|
39
|
+
/** Дополнительный className для grid-области с карточками. */
|
|
40
|
+
gridClassName?: string;
|
|
41
|
+
/** Список медиа-элементов для отображения. */
|
|
42
|
+
items: TItem[];
|
|
43
|
+
/** Показывает loading-state вместо пустого состояния. */
|
|
44
|
+
isLoading?: boolean;
|
|
45
|
+
/** Responsive-настройки сетки для lg и шире. */
|
|
46
|
+
lg?: MediaGalleryBreakpointConfig;
|
|
47
|
+
/** Максимальная высота скроллируемой галереи. Число трактуется как px. */
|
|
48
|
+
maxHeight?: number | string;
|
|
49
|
+
/** Responsive-настройки сетки для md и шире. */
|
|
50
|
+
md?: MediaGalleryBreakpointConfig;
|
|
51
|
+
/** Callback выбора карточки. */
|
|
52
|
+
onSubmit?: (item: TItem) => void;
|
|
53
|
+
/** Принудительно включает/выключает scroll container. По умолчанию зависит от scrollThreshold. */
|
|
54
|
+
scrollable?: boolean;
|
|
55
|
+
/** Количество элементов, после которого галерея становится скроллируемой. */
|
|
56
|
+
scrollThreshold?: number;
|
|
57
|
+
/** Responsive-настройки сетки для xl и шире. */
|
|
58
|
+
xl?: MediaGalleryBreakpointConfig;
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),q=require("./grid.cjs"),C=require("./time-clock-DOwPzcx7.cjs"),N=require("./media-card.cjs"),p=require("./responsive-style.config-B2m9jVlX.cjs"),s=require("./typography.cjs");function P({itemsCount:e,maxHeight:n,scrollable:l,scrollThreshold:a}){return{maxHeightValue:M(n??420),shouldUseScroll:l??e>a}}function k({columns:e,gap:n,lg:l,md:a,xl:t}){return{cols:e??4,gap:n??8,md:c(a),lg:c(l),xl:c(t)}}function c(e){if(e)return{cols:e.columns,gap:e.gap}}function M(e){return typeof e=="number"?`${e}px`:e}function T({className:e,columns:n,errorMessage:l,emptyMessage:a="В галерее пока нет изображений.",gap:t,gridClassName:g,items:i,isLoading:d=!1,lg:x,maxHeight:y,md:h,onSubmit:m,scrollable:f,scrollThreshold:v=6,xl:j,...S}){const{maxHeightValue:b,shouldUseScroll:u}=P({itemsCount:i.length,maxHeight:y,scrollable:f,scrollThreshold:v}),G=k({columns:n,gap:t,lg:x,md:h,xl:j});return r.jsxs("div",{className:p.cn("grid gap-[12px]",e),...S,children:[d?r.jsxs("div",{className:"flex items-center gap-[8px] text-[var(--color-text-secondary)]",children:[r.jsx(C.SvgTimeClock,{className:"size-[16px] animate-spin"}),r.jsx(s.Typography,{as:"span",variant:"b3",children:"Загружаем галерею..."})]}):null,l?r.jsx(s.Typography,{as:"p",color:"--color-secondary-accent-2",variant:"b3",children:l}):null,i.length>0?r.jsx(q.Grid,{...G,className:p.cn(u&&"overflow-y-auto rounded-[12px] bg-[var(--color-background-subtle)] p-[8px]",g),style:u?{maxHeight:b}:void 0,children:i.map(o=>r.jsx(N.MediaCard,{fileName:o.fileName,imgUrl:o.imgUrl,isPicked:o.isPicked,variant:"img-pick",onSubmit:()=>m?.(o)},o.id))}):null,!d&&i.length===0?r.jsx(s.Typography,{as:"p",color:"--color-text-secondary",variant:"b3",children:a}):null]})}exports.MediaGallery=T;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsxs as m, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Grid as k } from "./grid.js";
|
|
3
|
+
import { S as C } from "./time-clock-DjqcZ8tI.js";
|
|
4
|
+
import { MediaCard as U } from "./media-card.js";
|
|
5
|
+
import { c as u } from "./responsive-style.config-DFuATrIM.js";
|
|
6
|
+
import { Typography as c } from "./typography.js";
|
|
7
|
+
function H({
|
|
8
|
+
itemsCount: r,
|
|
9
|
+
maxHeight: e,
|
|
10
|
+
scrollable: l,
|
|
11
|
+
scrollThreshold: a
|
|
12
|
+
}) {
|
|
13
|
+
return {
|
|
14
|
+
maxHeightValue: j(e ?? 420),
|
|
15
|
+
shouldUseScroll: l ?? r > a
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function M({
|
|
19
|
+
columns: r,
|
|
20
|
+
gap: e,
|
|
21
|
+
lg: l,
|
|
22
|
+
md: a,
|
|
23
|
+
xl: t
|
|
24
|
+
}) {
|
|
25
|
+
return {
|
|
26
|
+
cols: r ?? 4,
|
|
27
|
+
gap: e ?? 8,
|
|
28
|
+
md: s(a),
|
|
29
|
+
lg: s(l),
|
|
30
|
+
xl: s(t)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function s(r) {
|
|
34
|
+
if (r)
|
|
35
|
+
return {
|
|
36
|
+
cols: r.columns,
|
|
37
|
+
gap: r.gap
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function j(r) {
|
|
41
|
+
return typeof r == "number" ? `${r}px` : r;
|
|
42
|
+
}
|
|
43
|
+
function q({
|
|
44
|
+
className: r,
|
|
45
|
+
columns: e,
|
|
46
|
+
errorMessage: l,
|
|
47
|
+
emptyMessage: a = "В галерее пока нет изображений.",
|
|
48
|
+
gap: t,
|
|
49
|
+
gridClassName: g,
|
|
50
|
+
items: i,
|
|
51
|
+
isLoading: d = !1,
|
|
52
|
+
lg: f,
|
|
53
|
+
maxHeight: x,
|
|
54
|
+
md: h,
|
|
55
|
+
onSubmit: y,
|
|
56
|
+
scrollable: v,
|
|
57
|
+
scrollThreshold: S = 6,
|
|
58
|
+
xl: b,
|
|
59
|
+
...G
|
|
60
|
+
}) {
|
|
61
|
+
const { maxHeightValue: N, shouldUseScroll: p } = H({
|
|
62
|
+
itemsCount: i.length,
|
|
63
|
+
maxHeight: x,
|
|
64
|
+
scrollable: v,
|
|
65
|
+
scrollThreshold: S
|
|
66
|
+
}), P = M({ columns: e, gap: t, lg: f, md: h, xl: b });
|
|
67
|
+
return /* @__PURE__ */ m("div", { className: u("grid gap-[12px]", r), ...G, children: [
|
|
68
|
+
d ? /* @__PURE__ */ m("div", { className: "flex items-center gap-[8px] text-[var(--color-text-secondary)]", children: [
|
|
69
|
+
/* @__PURE__ */ o(C, { className: "size-[16px] animate-spin" }),
|
|
70
|
+
/* @__PURE__ */ o(c, { as: "span", variant: "b3", children: "Загружаем галерею..." })
|
|
71
|
+
] }) : null,
|
|
72
|
+
l ? /* @__PURE__ */ o(c, { as: "p", color: "--color-secondary-accent-2", variant: "b3", children: l }) : null,
|
|
73
|
+
i.length > 0 ? /* @__PURE__ */ o(
|
|
74
|
+
k,
|
|
75
|
+
{
|
|
76
|
+
...P,
|
|
77
|
+
className: u(
|
|
78
|
+
p && "overflow-y-auto rounded-[12px] bg-[var(--color-background-subtle)] p-[8px]",
|
|
79
|
+
g
|
|
80
|
+
),
|
|
81
|
+
style: p ? { maxHeight: N } : void 0,
|
|
82
|
+
children: i.map((n) => /* @__PURE__ */ o(
|
|
83
|
+
U,
|
|
84
|
+
{
|
|
85
|
+
fileName: n.fileName,
|
|
86
|
+
imgUrl: n.imgUrl,
|
|
87
|
+
isPicked: n.isPicked,
|
|
88
|
+
variant: "img-pick",
|
|
89
|
+
onSubmit: () => y?.(n)
|
|
90
|
+
},
|
|
91
|
+
n.id
|
|
92
|
+
))
|
|
93
|
+
}
|
|
94
|
+
) : null,
|
|
95
|
+
!d && i.length === 0 ? /* @__PURE__ */ o(c, { as: "p", color: "--color-text-secondary", variant: "b3", children: a }) : null
|
|
96
|
+
] });
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
q as MediaGallery
|
|
100
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
const l = (t) => /* @__PURE__ */ e.createElement("svg", { width: 20, height: 20, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ e.createElement("path", { d: "M5.5 9.57143L8.77273 13L14.5 7", stroke: "#152237", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" })), n = (t) => /* @__PURE__ */ e.createElement("svg", { width: 20, height: 20, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ e.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M4.6875 7.03125C4.6875 5.73683 5.73683 4.6875 7.03125 4.6875C8.32567 4.6875 9.375 5.73683 9.375 7.03125C9.375 8.32567 8.32567 9.375 7.03125 9.375C5.73683 9.375 4.6875 8.32567 4.6875 7.03125ZM7.03125 5.9375C6.42719 5.9375 5.9375 6.42719 5.9375 7.03125C5.9375 7.63531 6.42719 8.125 7.03125 8.125C7.63531 8.125 8.125 7.63531 8.125 7.03125C8.125 6.42719 7.63531 5.9375 7.03125 5.9375Z", fill: "#152237" }), /* @__PURE__ */ e.createElement("path", { d: "M11.2121 10.2968C11.5782 9.93065 12.1718 9.93065 12.5379 10.2968L14.8706 12.6294C15.1147 12.8735 15.5103 12.8735 15.7544 12.6294C15.9985 12.3853 15.9985 11.9897 15.7544 11.7456L13.4218 9.4129C12.5675 8.55865 11.1825 8.55865 10.3282 9.4129L5.18306 14.5581C4.93898 14.8022 4.93898 15.1978 5.18306 15.4419C5.42713 15.686 5.82286 15.686 6.06694 15.4419L11.2121 10.2968Z", fill: "#152237" }), /* @__PURE__ */ e.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M1.875 5.41667C1.875 3.46066 3.46066 1.875 5.41667 1.875H14.5833C16.5393 1.875 18.125 3.46066 18.125 5.41667V14.5833C18.125 16.5393 16.5393 18.125 14.5833 18.125H5.41667C3.46066 18.125 1.875 16.5393 1.875 14.5833V5.41667ZM5.41667 3.125C4.15102 3.125 3.125 4.15102 3.125 5.41667V14.5833C3.125 15.849 4.15102 16.875 5.41667 16.875H14.5833C15.849 16.875 16.875 15.849 16.875 14.5833V5.41667C16.875 4.15102 15.849 3.125 14.5833 3.125H5.41667Z", fill: "#152237" }));
|
|
3
|
+
export {
|
|
4
|
+
l as S,
|
|
5
|
+
n as a
|
|
6
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const i=require("react");function o(e){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(l,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return l.default=e,Object.freeze(l)}const t=o(i),c=e=>t.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},t.createElement("path",{d:"M5.5 9.57143L8.77273 13L14.5 7",stroke:"#152237",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),a=e=>t.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},t.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.6875 7.03125C4.6875 5.73683 5.73683 4.6875 7.03125 4.6875C8.32567 4.6875 9.375 5.73683 9.375 7.03125C9.375 8.32567 8.32567 9.375 7.03125 9.375C5.73683 9.375 4.6875 8.32567 4.6875 7.03125ZM7.03125 5.9375C6.42719 5.9375 5.9375 6.42719 5.9375 7.03125C5.9375 7.63531 6.42719 8.125 7.03125 8.125C7.63531 8.125 8.125 7.63531 8.125 7.03125C8.125 6.42719 7.63531 5.9375 7.03125 5.9375Z",fill:"#152237"}),t.createElement("path",{d:"M11.2121 10.2968C11.5782 9.93065 12.1718 9.93065 12.5379 10.2968L14.8706 12.6294C15.1147 12.8735 15.5103 12.8735 15.7544 12.6294C15.9985 12.3853 15.9985 11.9897 15.7544 11.7456L13.4218 9.4129C12.5675 8.55865 11.1825 8.55865 10.3282 9.4129L5.18306 14.5581C4.93898 14.8022 4.93898 15.1978 5.18306 15.4419C5.42713 15.686 5.82286 15.686 6.06694 15.4419L11.2121 10.2968Z",fill:"#152237"}),t.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.875 5.41667C1.875 3.46066 3.46066 1.875 5.41667 1.875H14.5833C16.5393 1.875 18.125 3.46066 18.125 5.41667V14.5833C18.125 16.5393 16.5393 18.125 14.5833 18.125H5.41667C3.46066 18.125 1.875 16.5393 1.875 14.5833V5.41667ZM5.41667 3.125C4.15102 3.125 3.125 4.15102 3.125 5.41667V14.5833C3.125 15.849 4.15102 16.875 5.41667 16.875H14.5833C15.849 16.875 16.875 15.849 16.875 14.5833V5.41667C16.875 4.15102 15.849 3.125 14.5833 3.125H5.41667Z",fill:"#152237"}));exports.SvgCheck=c;exports.SvgMediaPicture=a;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { AriaModalOverlayProps } from 'react-aria';
|
|
2
|
+
import { OverlayTriggerProps as OverlayTriggerStateProps, OverlayTriggerState } from 'react-stately';
|
|
3
|
+
import { ButtonHTMLAttributes, JSX, ReactNode } from 'react';
|
|
4
|
+
import { BoxProps } from '../box/box';
|
|
5
|
+
import { ButtonProps } from '../button/button';
|
|
6
|
+
import { FlexProps } from '../flex/flex';
|
|
7
|
+
type ModalBoxProps = Omit<Partial<BoxProps>, 'as' | 'children'>;
|
|
8
|
+
type ModalContentWrapperProps = Omit<FlexProps, 'children'>;
|
|
9
|
+
export type ModalProps = AriaModalOverlayProps & ModalBoxProps & {
|
|
10
|
+
/** Состояние overlay, созданное снаружи или через `Modal.Trigger`. */
|
|
11
|
+
state: OverlayTriggerState;
|
|
12
|
+
/** Содержимое модального слоя. */
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
/** Кастомный слот кнопки закрытия. */
|
|
15
|
+
closeButtonSlot?: (close: () => void) => ReactNode;
|
|
16
|
+
/** Фон полноэкранного overlay. */
|
|
17
|
+
overlayBackground?: string;
|
|
18
|
+
/** Значение backdrop blur: число приводится к px. */
|
|
19
|
+
overlayBlur?: string | number;
|
|
20
|
+
/** Props Flex-обертки, которая позиционирует содержимое внутри viewport. */
|
|
21
|
+
contentWrapperProps?: ModalContentWrapperProps;
|
|
22
|
+
/** DOM-контейнер, в который будет создан portal. */
|
|
23
|
+
portalContainer?: Element;
|
|
24
|
+
};
|
|
25
|
+
export type ModalTriggerRenderProps = {
|
|
26
|
+
/** Props, которые нужно передать кастомному trigger-элементу. */
|
|
27
|
+
triggerProps: ButtonHTMLAttributes<HTMLButtonElement>;
|
|
28
|
+
/** Текущее состояние overlay. */
|
|
29
|
+
state: OverlayTriggerState;
|
|
30
|
+
/** Открывает модальное окно. */
|
|
31
|
+
open: () => void;
|
|
32
|
+
/** Закрывает модальное окно. */
|
|
33
|
+
close: () => void;
|
|
34
|
+
};
|
|
35
|
+
export type ModalTriggerProps = OverlayTriggerStateProps & Omit<ModalProps, 'children' | 'state'> & {
|
|
36
|
+
/** Render prop содержимого модального окна. */
|
|
37
|
+
children: (close: () => void) => ReactNode;
|
|
38
|
+
/** Текст стандартной trigger-кнопки. */
|
|
39
|
+
label?: ReactNode;
|
|
40
|
+
/** Props стандартной trigger-кнопки. */
|
|
41
|
+
triggerButtonProps?: Omit<ButtonProps, 'children' | 'href' | 'onClick' | 'type'>;
|
|
42
|
+
/** Кастомный trigger, если стандартной Button недостаточно. */
|
|
43
|
+
customTrigger?: (props: ModalTriggerRenderProps) => ReactNode;
|
|
44
|
+
};
|
|
45
|
+
declare function ModalRoot({ children, className, closeButtonSlot, contentWrapperProps, isDismissable, overlayBackground, overlayBlur, portalContainer, state, style, ...props }: ModalProps): JSX.Element | null;
|
|
46
|
+
declare function ModalTrigger({ children, customTrigger, defaultOpen, isOpen, label, onOpenChange, triggerButtonProps, ...modalProps }: ModalTriggerProps): JSX.Element;
|
|
47
|
+
export declare const Modal: typeof ModalRoot & {
|
|
48
|
+
Trigger: typeof ModalTrigger;
|
|
49
|
+
};
|
|
50
|
+
export { ModalRoot, ModalTrigger };
|
package/dist/modal.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("react-aria"),O=require("react-stately"),k=require("react"),B=require("./box.cjs"),j=require("./button.cjs"),b=require("./flex.cjs"),S=require("./x-mark-DId-ylR6.cjs"),y=require("./responsive-style.config-B2m9jVlX.cjs");function x({children:e,className:o,closeButtonSlot:a,contentWrapperProps:l,isDismissable:i=!0,overlayBackground:u="rgb(0 0 0 / 40%)",overlayBlur:d=4,portalContainer:g,state:t,style:p,...n}){const c=k.useRef(null),{modalProps:P,underlayProps:M}=s.useModalOverlay({...n,isDismissable:i},t,c);if(!t.isOpen)return null;const h=M,f=P,q=l?.className,m=R(d),F={backdropFilter:m,WebkitBackdropFilter:m,...h.style};return r.jsx(s.Overlay,{portalContainer:g,children:r.jsx(s.FocusScope,{contain:!0,restoreFocus:!0,autoFocus:!0,children:r.jsx(b.Flex,{...h,align:"center",bg:u,height:"100dvh",justify:"center",p:{px:16,py:16},position:{type:"fixed",top:0,right:0,bottom:0,left:0,zIndex:50},style:F,width:"100%",children:r.jsx("div",{...f,className:y.cn("size-full outline-none",f.className),ref:c,children:r.jsxs(B.Box,{bg:"transparent",className:y.cn("relative size-full overflow-y-auto",o),height:"100dvh",style:p,width:"100%",...n,children:[i?N(t.close,a):null,r.jsx(b.Flex,{align:"center",height:"100%",justify:"center",width:"100%",...l,className:y.cn(q),children:e})]})})})})})}function v({children:e,customTrigger:o,defaultOpen:a,isOpen:l,label:i="Открыть",onOpenChange:u,triggerButtonProps:d,...g}){const t=O.useOverlayTriggerState({defaultOpen:a,isOpen:l,onOpenChange:u}),{triggerProps:p}=s.useOverlayTrigger({type:"dialog"},t),n=T(p),c=o?o({close:t.close,open:t.open,state:t,triggerProps:n}):r.jsx(j.Button,{...d,...n,type:"button",onClick:t.open,children:i});return r.jsxs(r.Fragment,{children:[c,r.jsx(x,{state:t,...g,children:e(t.close)})]})}const z=Object.assign(x,{Trigger:v});function N(e,o){return o?o(e):r.jsx(j.Button,{"aria-label":"Закрыть модальное окно",p:10,position:{type:"absolute",right:20,top:20,zIndex:1},size:"md",type:"button",variant:"secondary",onClick:e,children:r.jsx(S.SvgXMark,{})})}function R(e){return typeof e=="number"?`blur(${e}px)`:e}function T(e){const o={...e};return delete o.onPress,s.mergeProps(o)}exports.Modal=z;exports.ModalRoot=x;exports.ModalTrigger=v;
|
package/dist/modal.js
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { jsx as t, jsxs as b, Fragment as z } from "react/jsx-runtime";
|
|
2
|
+
import { useModalOverlay as B, Overlay as N, FocusScope as j, useOverlayTrigger as M, mergeProps as w } from "react-aria";
|
|
3
|
+
import { useOverlayTriggerState as C } from "react-stately";
|
|
4
|
+
import { useRef as S } from "react";
|
|
5
|
+
import { Box as D } from "./box.js";
|
|
6
|
+
import { Button as v } from "./button.js";
|
|
7
|
+
import { Flex as h } from "./flex.js";
|
|
8
|
+
import { S as R } from "./x-mark-WU1eT82T.js";
|
|
9
|
+
import { c as m } from "./responsive-style.config-DFuATrIM.js";
|
|
10
|
+
function x({
|
|
11
|
+
children: e,
|
|
12
|
+
className: o,
|
|
13
|
+
closeButtonSlot: a,
|
|
14
|
+
contentWrapperProps: i,
|
|
15
|
+
isDismissable: l = !0,
|
|
16
|
+
overlayBackground: c = "rgb(0 0 0 / 40%)",
|
|
17
|
+
overlayBlur: u = 4,
|
|
18
|
+
portalContainer: p,
|
|
19
|
+
state: r,
|
|
20
|
+
style: d,
|
|
21
|
+
...n
|
|
22
|
+
}) {
|
|
23
|
+
const s = S(null), { modalProps: P, underlayProps: F } = B(
|
|
24
|
+
{ ...n, isDismissable: l },
|
|
25
|
+
r,
|
|
26
|
+
s
|
|
27
|
+
);
|
|
28
|
+
if (!r.isOpen)
|
|
29
|
+
return null;
|
|
30
|
+
const g = F, f = P, O = i?.className, y = V(u), k = {
|
|
31
|
+
backdropFilter: y,
|
|
32
|
+
WebkitBackdropFilter: y,
|
|
33
|
+
...g.style
|
|
34
|
+
};
|
|
35
|
+
return /* @__PURE__ */ t(N, { portalContainer: p, children: /* @__PURE__ */ t(j, { contain: !0, restoreFocus: !0, autoFocus: !0, children: /* @__PURE__ */ t(
|
|
36
|
+
h,
|
|
37
|
+
{
|
|
38
|
+
...g,
|
|
39
|
+
align: "center",
|
|
40
|
+
bg: c,
|
|
41
|
+
height: "100dvh",
|
|
42
|
+
justify: "center",
|
|
43
|
+
p: { px: 16, py: 16 },
|
|
44
|
+
position: { type: "fixed", top: 0, right: 0, bottom: 0, left: 0, zIndex: 50 },
|
|
45
|
+
style: k,
|
|
46
|
+
width: "100%",
|
|
47
|
+
children: /* @__PURE__ */ t(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
...f,
|
|
51
|
+
className: m("size-full outline-none", f.className),
|
|
52
|
+
ref: s,
|
|
53
|
+
children: /* @__PURE__ */ b(
|
|
54
|
+
D,
|
|
55
|
+
{
|
|
56
|
+
bg: "transparent",
|
|
57
|
+
className: m("relative size-full overflow-y-auto", o),
|
|
58
|
+
height: "100dvh",
|
|
59
|
+
style: d,
|
|
60
|
+
width: "100%",
|
|
61
|
+
...n,
|
|
62
|
+
children: [
|
|
63
|
+
l ? I(r.close, a) : null,
|
|
64
|
+
/* @__PURE__ */ t(
|
|
65
|
+
h,
|
|
66
|
+
{
|
|
67
|
+
align: "center",
|
|
68
|
+
height: "100%",
|
|
69
|
+
justify: "center",
|
|
70
|
+
width: "100%",
|
|
71
|
+
...i,
|
|
72
|
+
className: m(O),
|
|
73
|
+
children: e
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
) }) });
|
|
83
|
+
}
|
|
84
|
+
function T({
|
|
85
|
+
children: e,
|
|
86
|
+
customTrigger: o,
|
|
87
|
+
defaultOpen: a,
|
|
88
|
+
isOpen: i,
|
|
89
|
+
label: l = "Открыть",
|
|
90
|
+
onOpenChange: c,
|
|
91
|
+
triggerButtonProps: u,
|
|
92
|
+
...p
|
|
93
|
+
}) {
|
|
94
|
+
const r = C({ defaultOpen: a, isOpen: i, onOpenChange: c }), { triggerProps: d } = M({ type: "dialog" }, r), n = W(d), s = o ? o({
|
|
95
|
+
close: r.close,
|
|
96
|
+
open: r.open,
|
|
97
|
+
state: r,
|
|
98
|
+
triggerProps: n
|
|
99
|
+
}) : /* @__PURE__ */ t(
|
|
100
|
+
v,
|
|
101
|
+
{
|
|
102
|
+
...u,
|
|
103
|
+
...n,
|
|
104
|
+
type: "button",
|
|
105
|
+
onClick: r.open,
|
|
106
|
+
children: l
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
return /* @__PURE__ */ b(z, { children: [
|
|
110
|
+
s,
|
|
111
|
+
/* @__PURE__ */ t(x, { state: r, ...p, children: e(r.close) })
|
|
112
|
+
] });
|
|
113
|
+
}
|
|
114
|
+
const L = Object.assign(x, {
|
|
115
|
+
Trigger: T
|
|
116
|
+
});
|
|
117
|
+
function I(e, o) {
|
|
118
|
+
return o ? o(e) : /* @__PURE__ */ t(
|
|
119
|
+
v,
|
|
120
|
+
{
|
|
121
|
+
"aria-label": "Закрыть модальное окно",
|
|
122
|
+
p: 10,
|
|
123
|
+
position: { type: "absolute", right: 20, top: 20, zIndex: 1 },
|
|
124
|
+
size: "md",
|
|
125
|
+
type: "button",
|
|
126
|
+
variant: "secondary",
|
|
127
|
+
onClick: e,
|
|
128
|
+
children: /* @__PURE__ */ t(R, {})
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
function V(e) {
|
|
133
|
+
return typeof e == "number" ? `blur(${e}px)` : e;
|
|
134
|
+
}
|
|
135
|
+
function W(e) {
|
|
136
|
+
const o = { ...e };
|
|
137
|
+
return delete o.onPress, w(o);
|
|
138
|
+
}
|
|
139
|
+
export {
|
|
140
|
+
L as Modal,
|
|
141
|
+
x as ModalRoot,
|
|
142
|
+
T as ModalTrigger
|
|
143
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { HTMLAttributes, JSX } from 'react';
|
|
2
|
+
export interface PaginationProps extends HTMLAttributes<HTMLElement> {
|
|
3
|
+
/** Количество всегда видимых страниц в начале и конце списка. */
|
|
4
|
+
boundaryCount?: number;
|
|
5
|
+
/** Активная страница, нумерация начинается с 1. */
|
|
6
|
+
currentPage: number;
|
|
7
|
+
/** Отключает все элементы пагинации. */
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
/** Вызывается при выборе страницы или клике по стрелкам. */
|
|
10
|
+
onPageChange?: (page: number) => void;
|
|
11
|
+
/** Количество элементов на странице, нужно для подписи диапазона вида "1-10 из 96". */
|
|
12
|
+
pageSize?: number;
|
|
13
|
+
/** Показывать подпись диапазона слева от кнопок страниц. */
|
|
14
|
+
showRangeLabel?: boolean;
|
|
15
|
+
/** Количество страниц, видимых слева и справа от активной страницы. */
|
|
16
|
+
siblingCount?: number;
|
|
17
|
+
/** Общее количество элементов, нужно для подписи диапазона вида "1-10 из 96". */
|
|
18
|
+
totalItems?: number;
|
|
19
|
+
/** Общее количество страниц. */
|
|
20
|
+
totalPages: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function Pagination({ boundaryCount, className, currentPage, disabled, onPageChange, pageSize, showRangeLabel, siblingCount, totalItems, totalPages, ...props }: PaginationProps): JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),g=require("./arrow-CS6d64Y4.cjs"),u=require("./responsive-style.config-B2m9jVlX.cjs"),_=require("./typography.cjs");function k({boundaryCount:e=1,className:s,currentPage:r,disabled:i=!1,onPageChange:a,pageSize:o,showRangeLabel:h=!0,siblingCount:x=1,totalItems:p,totalPages:t,...d}){const f=Math.max(1,t),c=y(r,1,f),j=$({boundaryCount:e,currentPage:c,siblingCount:x,totalPages:f}),b=c>1&&!i,w=c<f&&!i,M=q({currentPage:c,pageSize:o,totalItems:p,totalPages:f});return n.jsxs("nav",{"aria-label":"Pagination",className:u.cn("inline-flex items-center gap-6",s),...d,children:[h?n.jsx(_.Typography,{as:"span",className:"whitespace-nowrap text-[var(--color-text-secondary)]",variant:"b3",children:M}):null,n.jsxs("div",{className:"inline-flex items-center gap-[6px]",children:[n.jsx(v,{"aria-label":"Предыдущая страница",disabled:!b,onClick:()=>a?.(c-1),children:n.jsx(g.SvgArrow,{className:"h-[9px] w-3"})}),j.map((l,N)=>l==="ellipsis"?n.jsx("span",{"aria-hidden":"true",className:"inline-flex min-h-6 min-w-6 items-center justify-center text-[13px] leading-[18px] text-[var(--color-text-secondary)]",children:"..."},`ellipsis-${N}`):n.jsx(v,{"aria-current":l===c?"page":void 0,"aria-label":`Страница ${l}`,isActive:l===c,disabled:i,onClick:()=>a?.(l),children:l},l)),n.jsx(v,{"aria-label":"Следующая страница",disabled:!w,onClick:()=>a?.(c+1),children:n.jsx(g.SvgArrow,{className:"h-[9px] w-3 rotate-180"})})]})]})}function v({children:e,className:s,disabled:r,isActive:i=!1,...a}){return n.jsx("button",{className:u.cn("inline-flex min-h-6 min-w-6 items-center justify-center rounded-[6px] bg-[var(--color-background-subtle)] px-1 text-[13px] font-normal leading-[18px] text-[var(--color-text-primary)] transition-colors [font-family:var(--font-family)] hover:bg-[color-mix(in_srgb,var(--color-background-subtle)_90%,#000)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color-mix(in_srgb,var(--color-primary-accent)_35%,transparent)] disabled:pointer-events-none disabled:opacity-50 [&_svg]:shrink-0",i&&"bg-[var(--color-primary-accent)] text-[var(--color-background-default)] hover:bg-[color-mix(in_srgb,var(--color-primary-accent)_80%,#fff)]",s),disabled:r,type:"button",...a,children:e})}function $({boundaryCount:e,currentPage:s,siblingCount:r,totalPages:i}){const a=e*2+r*2+3;if(i<=a)return m(1,i);const o=m(1,e),h=m(i-e+1,i),x=Math.max(Math.min(s-r,i-e-r*2-1),e+2),p=Math.min(Math.max(s+r,e+r*2+2),i-e-1),t=[...o];return x>e+2?t.push("ellipsis"):e+1<i-e&&t.push(e+1),t.push(...m(x,p)),p<i-e-1?t.push("ellipsis"):i-e>e&&t.push(i-e),t.push(...h),t}function m(e,s){if(s<e)return[];const r=[];for(let i=e;i<=s;i+=1)r.push(i);return r}function y(e,s,r){return Math.min(Math.max(e,s),r)}function q({currentPage:e,pageSize:s,totalItems:r,totalPages:i}){if(!s||!r)return`${e} из ${i}`;const a=(e-1)*s+1,o=Math.min(e*s,r);return`${a}-${o} из ${r}`}exports.Pagination=k;
|