@archytechtor/ui 0.1.0 → 0.2.0
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/components/attachment/types.d.ts +1 -1
- package/dist/components/badge/types.d.ts +1 -1
- package/dist/components/bottom-nav/bottom-nav.d.ts +19 -0
- package/dist/components/bottom-nav/bottom-nav.js +59 -0
- package/dist/components/bottom-nav/index.d.ts +3 -0
- package/dist/components/bottom-nav/index.js +3 -0
- package/dist/components/bottom-nav/types.d.ts +45 -0
- package/dist/components/bottom-nav/types.js +44 -0
- package/dist/components/box/box.d.ts +7 -0
- package/dist/components/box/box.js +26 -0
- package/dist/components/box/index.d.ts +3 -0
- package/dist/components/box/index.js +3 -0
- package/dist/components/box/types.d.ts +23 -0
- package/dist/components/box/types.js +27 -0
- package/dist/components/button/types.d.ts +3 -3
- package/dist/components/button-group/types.d.ts +1 -1
- package/dist/components/field/types.d.ts +1 -1
- package/dist/components/grid/grid.d.ts +7 -0
- package/dist/components/grid/grid.js +36 -0
- package/dist/components/grid/index.d.ts +3 -0
- package/dist/components/grid/index.js +3 -0
- package/dist/components/grid/types.d.ts +35 -0
- package/dist/components/grid/types.js +102 -0
- package/dist/components/item/types.d.ts +1 -1
- package/dist/components/marker/types.d.ts +1 -1
- package/dist/components/number-stepper/types.d.ts +2 -2
- package/dist/components/stack/index.d.ts +3 -0
- package/dist/components/stack/index.js +3 -0
- package/dist/components/stack/stack.d.ts +7 -0
- package/dist/components/stack/stack.js +29 -0
- package/dist/components/stack/types.d.ts +56 -0
- package/dist/components/stack/types.js +62 -0
- package/dist/components/statistics/index.d.ts +3 -0
- package/dist/components/statistics/index.js +3 -0
- package/dist/components/statistics/statistics.d.ts +31 -0
- package/dist/components/statistics/statistics.js +141 -0
- package/dist/components/statistics/types.d.ts +84 -0
- package/dist/components/statistics/types.js +27 -0
- package/dist/components/tabs/types.d.ts +1 -1
- package/dist/components/toast/toast.js +1 -1
- package/dist/components/typography/types.d.ts +1 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +11 -1
- package/dist/styles/index.css +2 -0
- package/dist/styles/theme.css +4 -0
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const attachmentVariants: (props?: ({
|
|
10
10
|
size?: "default" | "sm" | "xs" | null | undefined;
|
|
11
|
-
orientation?: "
|
|
11
|
+
orientation?: "vertical" | "horizontal" | null | undefined;
|
|
12
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
13
|
/**
|
|
14
14
|
* Стили медиа вложения: иконка или превью изображения
|
|
@@ -6,7 +6,7 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
6
6
|
* Цвет наведения появляется только у бейджа-ссылки (render={<a />}).
|
|
7
7
|
*/
|
|
8
8
|
export declare const badgeVariants: (props?: ({
|
|
9
|
-
variant?: "
|
|
9
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | null | undefined;
|
|
10
10
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
11
|
/**
|
|
12
12
|
* Варианты оформления бейджа
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BottomNavActionPropsT, BottomNavItemPropsT, BottomNavPropsT } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Нижняя навигация для телефона: пункты разделов и выделенное действие по центру
|
|
4
|
+
* @param props - пропсы навигации
|
|
5
|
+
* @returns навигация
|
|
6
|
+
*/
|
|
7
|
+
export declare function BottomNav({ className, position, render, ...props }: BottomNavPropsT): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
8
|
+
/**
|
|
9
|
+
* Пункт нижней навигации: иконка и подпись. Ссылку рисуют через render={<a href />}
|
|
10
|
+
* @param props - пропсы пункта
|
|
11
|
+
* @returns кнопка или свой элемент в стилях пункта
|
|
12
|
+
*/
|
|
13
|
+
export declare function BottomNavItem({ className, active, render, ...props }: BottomNavItemPropsT): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
14
|
+
/**
|
|
15
|
+
* Выделенное действие нижней навигации: круглая кнопка с иконкой, приподнятая над панелью
|
|
16
|
+
* @param props - пропсы действия
|
|
17
|
+
* @returns кнопка или свой элемент в стилях действия
|
|
18
|
+
*/
|
|
19
|
+
export declare function BottomNavAction({ className, render, ...props }: BottomNavActionPropsT): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { cn } from "../../lib/utils.js";
|
|
2
|
+
import { bottomNavActionVariants, bottomNavItemVariants, bottomNavVariants } from "./types.js";
|
|
3
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
4
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
+
// src/components/bottom-nav/bottom-nav.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Нижняя навигация для телефона: пункты разделов и выделенное действие по центру
|
|
8
|
+
* @param props - пропсы навигации
|
|
9
|
+
* @returns навигация
|
|
10
|
+
*/
|
|
11
|
+
function BottomNav({ className, position = "fixed", render, ...props }) {
|
|
12
|
+
const classes = cn(bottomNavVariants({ position }), className);
|
|
13
|
+
return useRender({
|
|
14
|
+
defaultTagName: "nav",
|
|
15
|
+
render,
|
|
16
|
+
props: mergeProps({
|
|
17
|
+
"data-slot": "bottom-nav",
|
|
18
|
+
"data-position": position,
|
|
19
|
+
"className": classes
|
|
20
|
+
}, props)
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Пункт нижней навигации: иконка и подпись. Ссылку рисуют через render={<a href />}
|
|
25
|
+
* @param props - пропсы пункта
|
|
26
|
+
* @returns кнопка или свой элемент в стилях пункта
|
|
27
|
+
*/
|
|
28
|
+
function BottomNavItem({ className, active = false, render, ...props }) {
|
|
29
|
+
const classes = cn(bottomNavItemVariants(), className);
|
|
30
|
+
return useRender({
|
|
31
|
+
defaultTagName: "button",
|
|
32
|
+
render,
|
|
33
|
+
props: mergeProps({
|
|
34
|
+
"type": render ? void 0 : "button",
|
|
35
|
+
"data-slot": "bottom-nav-item",
|
|
36
|
+
"data-active": active || void 0,
|
|
37
|
+
"aria-current": active ? "page" : void 0,
|
|
38
|
+
"className": classes
|
|
39
|
+
}, props)
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Выделенное действие нижней навигации: круглая кнопка с иконкой, приподнятая над панелью
|
|
44
|
+
* @param props - пропсы действия
|
|
45
|
+
* @returns кнопка или свой элемент в стилях действия
|
|
46
|
+
*/
|
|
47
|
+
function BottomNavAction({ className, render, ...props }) {
|
|
48
|
+
const classes = cn(bottomNavActionVariants(), className);
|
|
49
|
+
return useRender({
|
|
50
|
+
defaultTagName: "button",
|
|
51
|
+
render,
|
|
52
|
+
props: mergeProps({
|
|
53
|
+
"type": render ? void 0 : "button",
|
|
54
|
+
"data-slot": "bottom-nav-action",
|
|
55
|
+
"className": classes
|
|
56
|
+
}, props)
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
export { BottomNav, BottomNavAction, BottomNavItem };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { BottomNavActionPropsT, BottomNavItemPropsT, BottomNavPropsT, bottomNavActionVariants, bottomNavItemVariants, bottomNavVariants } from "./types.js";
|
|
2
|
+
import { BottomNav, BottomNavAction, BottomNavItem } from "./bottom-nav.js";
|
|
3
|
+
export { BottomNav, BottomNavAction, type BottomNavActionPropsT, BottomNavItem, type BottomNavItemPropsT, type BottomNavPropsT, bottomNavActionVariants, bottomNavItemVariants, bottomNavVariants };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { bottomNavActionVariants, bottomNavItemVariants, bottomNavVariants } from "./types.js";
|
|
2
|
+
import { BottomNav, BottomNavAction, BottomNavItem } from "./bottom-nav.js";
|
|
3
|
+
export { BottomNav, BottomNavAction, BottomNavItem, bottomNavActionVariants, bottomNavItemVariants, bottomNavVariants };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
/**
|
|
4
|
+
* Стили нижней навигации: положение на странице.
|
|
5
|
+
* Высота 64px плюс безопасная зона снизу (полоска жестов iPhone).
|
|
6
|
+
*/
|
|
7
|
+
export declare const bottomNavVariants: (props?: ({
|
|
8
|
+
position?: "fixed" | "sticky" | "static" | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Стили пункта нижней навигации: иконка над подписью, активный пункт выделен цветом.
|
|
12
|
+
* Экспортируются, чтобы оформить пунктом другой элемент.
|
|
13
|
+
*/
|
|
14
|
+
export declare const bottomNavItemVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
15
|
+
/**
|
|
16
|
+
* Стили выделенного действия: круглая кнопка, приподнятая над панелью.
|
|
17
|
+
* Экспортируются, чтобы оформить действием другой элемент.
|
|
18
|
+
*/
|
|
19
|
+
export declare const bottomNavActionVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
20
|
+
/**
|
|
21
|
+
* Положение нижней навигации
|
|
22
|
+
*/
|
|
23
|
+
export type BottomNavVariantsT = VariantProps<typeof bottomNavVariants>;
|
|
24
|
+
/**
|
|
25
|
+
* Пропсы нижней навигации
|
|
26
|
+
*/
|
|
27
|
+
export type BottomNavPropsT = useRender.ComponentProps<'nav'> & {
|
|
28
|
+
/**
|
|
29
|
+
* Положение: fixed — прибита к низу экрана, sticky — прилипает к низу прокручиваемого блока,
|
|
30
|
+
* static — в потоке страницы. По умолчанию fixed
|
|
31
|
+
*/
|
|
32
|
+
position?: BottomNavVariantsT['position'];
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Пропсы пункта нижней навигации
|
|
36
|
+
*/
|
|
37
|
+
export type BottomNavItemPropsT = useRender.ComponentProps<'button'> & {
|
|
38
|
+
/** Текущий раздел: пункт выделен, у элемента aria-current="page" */
|
|
39
|
+
active?: boolean;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Пропсы выделенного действия нижней навигации.
|
|
43
|
+
* В кнопке только иконка, поэтому подпись для скринридера обязательна: aria-label
|
|
44
|
+
*/
|
|
45
|
+
export type BottomNavActionPropsT = useRender.ComponentProps<'button'>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
// src/components/bottom-nav/types.ts
|
|
3
|
+
/**
|
|
4
|
+
* Стили нижней навигации: положение на странице.
|
|
5
|
+
* Высота 64px плюс безопасная зона снизу (полоска жестов iPhone).
|
|
6
|
+
*/
|
|
7
|
+
const bottomNavVariants = cva(["z-40 flex h-[calc(--spacing(16)+env(safe-area-inset-bottom))] w-full items-stretch gap-1", "border-t bg-background px-2 pb-[env(safe-area-inset-bottom)] text-foreground"], {
|
|
8
|
+
variants: { position: {
|
|
9
|
+
fixed: "fixed inset-x-0 bottom-0",
|
|
10
|
+
sticky: "sticky bottom-0",
|
|
11
|
+
static: "relative"
|
|
12
|
+
} },
|
|
13
|
+
defaultVariants: { position: "fixed" }
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Стили пункта нижней навигации: иконка над подписью, активный пункт выделен цветом.
|
|
17
|
+
* Экспортируются, чтобы оформить пунктом другой элемент.
|
|
18
|
+
*/
|
|
19
|
+
const bottomNavItemVariants = cva([
|
|
20
|
+
"group/bottom-nav-item my-1 flex min-w-0 flex-1 cursor-pointer flex-col items-center justify-center gap-1",
|
|
21
|
+
"rounded-lg px-1 text-xs font-medium whitespace-nowrap text-muted-foreground transition-all outline-none select-none",
|
|
22
|
+
"hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",
|
|
23
|
+
"active:not-aria-disabled:translate-y-px data-active:text-foreground",
|
|
24
|
+
"disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50",
|
|
25
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-5"
|
|
26
|
+
]);
|
|
27
|
+
/**
|
|
28
|
+
* Стили выделенного действия: круглая кнопка, приподнятая над панелью.
|
|
29
|
+
* Экспортируются, чтобы оформить действием другой элемент.
|
|
30
|
+
*/
|
|
31
|
+
const bottomNavActionVariants = cva([
|
|
32
|
+
"flex size-14 shrink-0 cursor-pointer items-center justify-center self-center rounded-full",
|
|
33
|
+
"-translate-y-4 bg-primary text-primary-foreground shadow-lg ring-4 ring-background",
|
|
34
|
+
"transition-all outline-none select-none hover:bg-[color-mix(in_oklch,var(--primary),var(--background)_20%)]",
|
|
35
|
+
"active:scale-95",
|
|
36
|
+
"focus-visible:ring-ring/50",
|
|
37
|
+
"disabled:cursor-not-allowed disabled:bg-[color-mix(in_oklch,var(--primary),var(--background)_50%)]",
|
|
38
|
+
"aria-disabled:cursor-not-allowed aria-disabled:bg-[color-mix(in_oklch,var(--primary),var(--background)_50%)]",
|
|
39
|
+
"disabled:text-[color-mix(in_oklch,var(--primary-foreground),var(--background)_50%)]",
|
|
40
|
+
"aria-disabled:text-[color-mix(in_oklch,var(--primary-foreground),var(--background)_50%)]",
|
|
41
|
+
"disabled:shadow-none aria-disabled:shadow-none",
|
|
42
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-6"
|
|
43
|
+
]);
|
|
44
|
+
export { bottomNavActionVariants, bottomNavItemVariants, bottomNavVariants };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BoxPropsT } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Контейнер: ограничивает ширину содержимого, центрирует его и добавляет боковые отступы
|
|
4
|
+
* @param props - пропсы контейнера
|
|
5
|
+
* @returns контейнер или свой элемент в стилях контейнера (render)
|
|
6
|
+
*/
|
|
7
|
+
export declare function Box({ className, size, padded, render, ...props }: BoxPropsT): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { cn } from "../../lib/utils.js";
|
|
2
|
+
import { boxVariants } from "./types.js";
|
|
3
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
4
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
+
// src/components/box/box.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Контейнер: ограничивает ширину содержимого, центрирует его и добавляет боковые отступы
|
|
8
|
+
* @param props - пропсы контейнера
|
|
9
|
+
* @returns контейнер или свой элемент в стилях контейнера (render)
|
|
10
|
+
*/
|
|
11
|
+
function Box({ className, size = "xl", padded = true, render, ...props }) {
|
|
12
|
+
const classes = cn(boxVariants({
|
|
13
|
+
size,
|
|
14
|
+
padded
|
|
15
|
+
}), className);
|
|
16
|
+
return useRender({
|
|
17
|
+
defaultTagName: "div",
|
|
18
|
+
render,
|
|
19
|
+
props: mergeProps({
|
|
20
|
+
"data-slot": "box",
|
|
21
|
+
"data-size": size,
|
|
22
|
+
"className": classes
|
|
23
|
+
}, props)
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export { Box };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
/**
|
|
4
|
+
* Стили контейнера: максимальная ширина по брейкпоинтам Tailwind и боковые отступы.
|
|
5
|
+
* Экспортируются, чтобы ограничить ширину другого элемента: boxVariants({ size: 'md' }).
|
|
6
|
+
*/
|
|
7
|
+
export declare const boxVariants: (props?: ({
|
|
8
|
+
size?: "sm" | "lg" | "md" | "xl" | "2xl" | "full" | null | undefined;
|
|
9
|
+
padded?: boolean | null | undefined;
|
|
10
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Размеры контейнера
|
|
13
|
+
*/
|
|
14
|
+
export type BoxVariantsT = VariantProps<typeof boxVariants>;
|
|
15
|
+
/**
|
|
16
|
+
* Пропсы контейнера
|
|
17
|
+
*/
|
|
18
|
+
export type BoxPropsT = useRender.ComponentProps<'div'> & {
|
|
19
|
+
/** Максимальная ширина: sm — 640px, md — 768px, lg — 1024px, xl — 1280px, 2xl — 1536px, full — без ограничения */
|
|
20
|
+
size?: BoxVariantsT['size'];
|
|
21
|
+
/** Боковые отступы: 16px на телефоне, 24px от sm, 32px от lg. По умолчанию включены */
|
|
22
|
+
padded?: boolean;
|
|
23
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
// src/components/box/types.ts
|
|
3
|
+
/**
|
|
4
|
+
* Стили контейнера: максимальная ширина по брейкпоинтам Tailwind и боковые отступы.
|
|
5
|
+
* Экспортируются, чтобы ограничить ширину другого элемента: boxVariants({ size: 'md' }).
|
|
6
|
+
*/
|
|
7
|
+
const boxVariants = cva("mx-auto w-full", {
|
|
8
|
+
variants: {
|
|
9
|
+
size: {
|
|
10
|
+
"sm": "max-w-(--breakpoint-sm)",
|
|
11
|
+
"md": "max-w-(--breakpoint-md)",
|
|
12
|
+
"lg": "max-w-(--breakpoint-lg)",
|
|
13
|
+
"xl": "max-w-(--breakpoint-xl)",
|
|
14
|
+
"2xl": "max-w-(--breakpoint-2xl)",
|
|
15
|
+
"full": "max-w-none"
|
|
16
|
+
},
|
|
17
|
+
padded: {
|
|
18
|
+
true: "px-4 sm:px-6 lg:px-8",
|
|
19
|
+
false: ""
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
size: "xl",
|
|
24
|
+
padded: true
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
export { boxVariants };
|
|
@@ -11,8 +11,8 @@ import { MouseEvent, ReactNode, Ref } from "react";
|
|
|
11
11
|
* а цвета наведения у каждого варианта возвращаются к обычным.
|
|
12
12
|
*/
|
|
13
13
|
export declare const buttonVariants: (props?: ({
|
|
14
|
-
variant?: "
|
|
15
|
-
size?: "default" | "
|
|
14
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | null | undefined;
|
|
15
|
+
size?: "default" | "icon" | "sm" | "xs" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
16
16
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
17
17
|
/**
|
|
18
18
|
* Варианты оформления и размеры кнопки
|
|
@@ -22,7 +22,7 @@ export type ButtonVariantsT = VariantProps<typeof buttonVariants>;
|
|
|
22
22
|
* Стили заливки удержания: растёт слева направо поверх кнопки, цвет контрастен варианту
|
|
23
23
|
*/
|
|
24
24
|
export declare const buttonHoldFillVariants: (props?: ({
|
|
25
|
-
variant?: "
|
|
25
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | null | undefined;
|
|
26
26
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
27
27
|
/**
|
|
28
28
|
* Пропсы кнопки
|
|
@@ -7,7 +7,7 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
7
7
|
* Экспортируются, чтобы оформить группой другой элемент: buttonGroupVariants({ orientation: 'vertical' }).
|
|
8
8
|
*/
|
|
9
9
|
export declare const buttonGroupVariants: (props?: ({
|
|
10
|
-
orientation?: "
|
|
10
|
+
orientation?: "vertical" | "horizontal" | null | undefined;
|
|
11
11
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
12
|
/**
|
|
13
13
|
* Варианты стилей группы
|
|
@@ -6,7 +6,7 @@ import { ComponentProps, ReactNode } from "react";
|
|
|
6
6
|
* Экспортируются, чтобы оформить полем другой элемент: fieldVariants({ orientation: 'horizontal' }).
|
|
7
7
|
*/
|
|
8
8
|
export declare const fieldVariants: (props?: ({
|
|
9
|
-
orientation?: "
|
|
9
|
+
orientation?: "vertical" | "horizontal" | "responsive" | null | undefined;
|
|
10
10
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
11
|
/**
|
|
12
12
|
* Варианты стилей поля
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GridPropsT } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Сетка: элементы по колонкам с отступом между ячейками
|
|
4
|
+
* @param props - пропсы сетки
|
|
5
|
+
* @returns сетка или свой элемент в стилях сетки (render)
|
|
6
|
+
*/
|
|
7
|
+
export declare function Grid({ className, columns, gap, render, ...props }: GridPropsT): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { cn } from "../../lib/utils.js";
|
|
2
|
+
import { gridColumnsClasses, gridVariants } from "./types.js";
|
|
3
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
4
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
+
// src/components/grid/grid.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Классы колонок: число — на любой ширине, объект — по брейкпоинтам
|
|
8
|
+
* @param columns - число колонок или колонки по брейкпоинтам
|
|
9
|
+
* @returns классы grid-cols-*
|
|
10
|
+
*/
|
|
11
|
+
function getColumnsClasses(columns) {
|
|
12
|
+
if (typeof columns === "number") return gridColumnsClasses.base[columns];
|
|
13
|
+
const classes = [];
|
|
14
|
+
for (const [breakpoint, count] of Object.entries(columns)) {
|
|
15
|
+
if (count === void 0) continue;
|
|
16
|
+
classes.push(gridColumnsClasses[breakpoint][count]);
|
|
17
|
+
}
|
|
18
|
+
return classes;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Сетка: элементы по колонкам с отступом между ячейками
|
|
22
|
+
* @param props - пропсы сетки
|
|
23
|
+
* @returns сетка или свой элемент в стилях сетки (render)
|
|
24
|
+
*/
|
|
25
|
+
function Grid({ className, columns = 1, gap = 4, render, ...props }) {
|
|
26
|
+
const classes = cn(gridVariants({ gap }), getColumnsClasses(columns), className);
|
|
27
|
+
return useRender({
|
|
28
|
+
defaultTagName: "div",
|
|
29
|
+
render,
|
|
30
|
+
props: mergeProps({
|
|
31
|
+
"data-slot": "grid",
|
|
32
|
+
"className": classes
|
|
33
|
+
}, props)
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export { Grid };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { GridBreakpointT, GridColumnsCountT, GridColumnsResponsiveT, GridPropsT, gridColumnsClasses, gridVariants } from "./types.js";
|
|
2
|
+
import { Grid } from "./grid.js";
|
|
3
|
+
export { Grid, type GridBreakpointT, type GridColumnsCountT, type GridColumnsResponsiveT, type GridPropsT, gridColumnsClasses, gridVariants };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { GapT } from "../stack/types.js";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
/**
|
|
4
|
+
* Число колонок сетки
|
|
5
|
+
*/
|
|
6
|
+
export type GridColumnsCountT = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
7
|
+
/**
|
|
8
|
+
* Брейкпоинт Tailwind; base — без брейкпоинта, на любой ширине
|
|
9
|
+
*/
|
|
10
|
+
export type GridBreakpointT = 'base' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
11
|
+
/**
|
|
12
|
+
* Число колонок по брейкпоинтам: { base: 1, md: 2, lg: 4 }
|
|
13
|
+
*/
|
|
14
|
+
export type GridColumnsResponsiveT = Partial<Record<GridBreakpointT, GridColumnsCountT>>;
|
|
15
|
+
/**
|
|
16
|
+
* Классы колонок по брейкпоинтам.
|
|
17
|
+
* Перечислены целиком, чтобы Tailwind потребителя их увидел.
|
|
18
|
+
*/
|
|
19
|
+
export declare const gridColumnsClasses: Record<GridBreakpointT, Record<GridColumnsCountT, string>>;
|
|
20
|
+
/**
|
|
21
|
+
* Стили сетки: отступ между ячейками. Колонки — gridColumnsClasses.
|
|
22
|
+
* Экспортируются, чтобы разложить сеткой другой элемент: gridVariants({ gap: 4 }).
|
|
23
|
+
*/
|
|
24
|
+
export declare const gridVariants: (props?: ({
|
|
25
|
+
gap?: 0 | 1 | 2 | 0.5 | 1.5 | 2.5 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | null | undefined;
|
|
26
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Пропсы сетки
|
|
29
|
+
*/
|
|
30
|
+
export type GridPropsT = useRender.ComponentProps<'div'> & {
|
|
31
|
+
/** Число колонок от 1 до 12 или по брейкпоинтам: { base: 1, md: 2, lg: 4 }. По умолчанию 1 */
|
|
32
|
+
columns?: GridColumnsCountT | GridColumnsResponsiveT;
|
|
33
|
+
/** Отступ между ячейками по шкале Tailwind: 4 → 16px. По умолчанию 4 */
|
|
34
|
+
gap?: GapT;
|
|
35
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { gapClasses } from "../stack/types.js";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
// src/components/grid/types.ts
|
|
4
|
+
/**
|
|
5
|
+
* Классы колонок по брейкпоинтам.
|
|
6
|
+
* Перечислены целиком, чтобы Tailwind потребителя их увидел.
|
|
7
|
+
*/
|
|
8
|
+
const gridColumnsClasses = {
|
|
9
|
+
"base": {
|
|
10
|
+
1: "grid-cols-1",
|
|
11
|
+
2: "grid-cols-2",
|
|
12
|
+
3: "grid-cols-3",
|
|
13
|
+
4: "grid-cols-4",
|
|
14
|
+
5: "grid-cols-5",
|
|
15
|
+
6: "grid-cols-6",
|
|
16
|
+
7: "grid-cols-7",
|
|
17
|
+
8: "grid-cols-8",
|
|
18
|
+
9: "grid-cols-9",
|
|
19
|
+
10: "grid-cols-10",
|
|
20
|
+
11: "grid-cols-11",
|
|
21
|
+
12: "grid-cols-12"
|
|
22
|
+
},
|
|
23
|
+
"sm": {
|
|
24
|
+
1: "sm:grid-cols-1",
|
|
25
|
+
2: "sm:grid-cols-2",
|
|
26
|
+
3: "sm:grid-cols-3",
|
|
27
|
+
4: "sm:grid-cols-4",
|
|
28
|
+
5: "sm:grid-cols-5",
|
|
29
|
+
6: "sm:grid-cols-6",
|
|
30
|
+
7: "sm:grid-cols-7",
|
|
31
|
+
8: "sm:grid-cols-8",
|
|
32
|
+
9: "sm:grid-cols-9",
|
|
33
|
+
10: "sm:grid-cols-10",
|
|
34
|
+
11: "sm:grid-cols-11",
|
|
35
|
+
12: "sm:grid-cols-12"
|
|
36
|
+
},
|
|
37
|
+
"md": {
|
|
38
|
+
1: "md:grid-cols-1",
|
|
39
|
+
2: "md:grid-cols-2",
|
|
40
|
+
3: "md:grid-cols-3",
|
|
41
|
+
4: "md:grid-cols-4",
|
|
42
|
+
5: "md:grid-cols-5",
|
|
43
|
+
6: "md:grid-cols-6",
|
|
44
|
+
7: "md:grid-cols-7",
|
|
45
|
+
8: "md:grid-cols-8",
|
|
46
|
+
9: "md:grid-cols-9",
|
|
47
|
+
10: "md:grid-cols-10",
|
|
48
|
+
11: "md:grid-cols-11",
|
|
49
|
+
12: "md:grid-cols-12"
|
|
50
|
+
},
|
|
51
|
+
"lg": {
|
|
52
|
+
1: "lg:grid-cols-1",
|
|
53
|
+
2: "lg:grid-cols-2",
|
|
54
|
+
3: "lg:grid-cols-3",
|
|
55
|
+
4: "lg:grid-cols-4",
|
|
56
|
+
5: "lg:grid-cols-5",
|
|
57
|
+
6: "lg:grid-cols-6",
|
|
58
|
+
7: "lg:grid-cols-7",
|
|
59
|
+
8: "lg:grid-cols-8",
|
|
60
|
+
9: "lg:grid-cols-9",
|
|
61
|
+
10: "lg:grid-cols-10",
|
|
62
|
+
11: "lg:grid-cols-11",
|
|
63
|
+
12: "lg:grid-cols-12"
|
|
64
|
+
},
|
|
65
|
+
"xl": {
|
|
66
|
+
1: "xl:grid-cols-1",
|
|
67
|
+
2: "xl:grid-cols-2",
|
|
68
|
+
3: "xl:grid-cols-3",
|
|
69
|
+
4: "xl:grid-cols-4",
|
|
70
|
+
5: "xl:grid-cols-5",
|
|
71
|
+
6: "xl:grid-cols-6",
|
|
72
|
+
7: "xl:grid-cols-7",
|
|
73
|
+
8: "xl:grid-cols-8",
|
|
74
|
+
9: "xl:grid-cols-9",
|
|
75
|
+
10: "xl:grid-cols-10",
|
|
76
|
+
11: "xl:grid-cols-11",
|
|
77
|
+
12: "xl:grid-cols-12"
|
|
78
|
+
},
|
|
79
|
+
"2xl": {
|
|
80
|
+
1: "2xl:grid-cols-1",
|
|
81
|
+
2: "2xl:grid-cols-2",
|
|
82
|
+
3: "2xl:grid-cols-3",
|
|
83
|
+
4: "2xl:grid-cols-4",
|
|
84
|
+
5: "2xl:grid-cols-5",
|
|
85
|
+
6: "2xl:grid-cols-6",
|
|
86
|
+
7: "2xl:grid-cols-7",
|
|
87
|
+
8: "2xl:grid-cols-8",
|
|
88
|
+
9: "2xl:grid-cols-9",
|
|
89
|
+
10: "2xl:grid-cols-10",
|
|
90
|
+
11: "2xl:grid-cols-11",
|
|
91
|
+
12: "2xl:grid-cols-12"
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Стили сетки: отступ между ячейками. Колонки — gridColumnsClasses.
|
|
96
|
+
* Экспортируются, чтобы разложить сеткой другой элемент: gridVariants({ gap: 4 }).
|
|
97
|
+
*/
|
|
98
|
+
const gridVariants = cva("grid", {
|
|
99
|
+
variants: { gap: gapClasses },
|
|
100
|
+
defaultVariants: { gap: 4 }
|
|
101
|
+
});
|
|
102
|
+
export { gridColumnsClasses, gridVariants };
|
|
@@ -14,7 +14,7 @@ export declare const itemVariants: (props?: ({
|
|
|
14
14
|
* Стили медиа элемента: без оформления, иконка или изображение
|
|
15
15
|
*/
|
|
16
16
|
export declare const itemMediaVariants: (props?: ({
|
|
17
|
-
variant?: "
|
|
17
|
+
variant?: "default" | "image" | "icon" | null | undefined;
|
|
18
18
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
19
19
|
/**
|
|
20
20
|
* Варианты оформления и размеры элемента
|
|
@@ -6,7 +6,7 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
6
6
|
* Ссылка (render={<a />}) подчёркнута и темнеет при наведении
|
|
7
7
|
*/
|
|
8
8
|
export declare const markerVariants: (props?: ({
|
|
9
|
-
variant?: "
|
|
9
|
+
variant?: "default" | "separator" | "border" | null | undefined;
|
|
10
10
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
11
|
/**
|
|
12
12
|
* Варианты оформления отметки
|
|
@@ -8,7 +8,7 @@ import { NumberField } from "@base-ui/react/number-field";
|
|
|
8
8
|
export declare const numberStepperVariants: (props?: ({
|
|
9
9
|
variant?: "outline" | "ghost" | "pill" | null | undefined;
|
|
10
10
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
11
|
-
orientation?: "
|
|
11
|
+
orientation?: "vertical" | "horizontal" | null | undefined;
|
|
12
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
13
|
/**
|
|
14
14
|
* Стили кнопок степпера: «−» и «+» (в вертикальном — стрелки)
|
|
@@ -16,7 +16,7 @@ export declare const numberStepperVariants: (props?: ({
|
|
|
16
16
|
export declare const numberStepperButtonVariants: (props?: ({
|
|
17
17
|
variant?: "outline" | "ghost" | "pill" | null | undefined;
|
|
18
18
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
19
|
-
orientation?: "
|
|
19
|
+
orientation?: "vertical" | "horizontal" | null | undefined;
|
|
20
20
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
21
21
|
/**
|
|
22
22
|
* Варианты оформления, размеры и ориентации степпера
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StackPropsT } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Стек: элементы в столбик или в строку с отступом между ними
|
|
4
|
+
* @param props - пропсы стека
|
|
5
|
+
* @returns стек или свой элемент в стилях стека (render)
|
|
6
|
+
*/
|
|
7
|
+
export declare function Stack({ className, direction, gap, align, justify, wrap, render, ...props }: StackPropsT): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { cn } from "../../lib/utils.js";
|
|
2
|
+
import { stackVariants } from "./types.js";
|
|
3
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
4
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
+
// src/components/stack/stack.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Стек: элементы в столбик или в строку с отступом между ними
|
|
8
|
+
* @param props - пропсы стека
|
|
9
|
+
* @returns стек или свой элемент в стилях стека (render)
|
|
10
|
+
*/
|
|
11
|
+
function Stack({ className, direction = "column", gap = 2, align = "stretch", justify = "start", wrap = false, render, ...props }) {
|
|
12
|
+
const classes = cn(stackVariants({
|
|
13
|
+
direction,
|
|
14
|
+
gap,
|
|
15
|
+
align,
|
|
16
|
+
justify,
|
|
17
|
+
wrap
|
|
18
|
+
}), className);
|
|
19
|
+
return useRender({
|
|
20
|
+
defaultTagName: "div",
|
|
21
|
+
render,
|
|
22
|
+
props: mergeProps({
|
|
23
|
+
"data-slot": "stack",
|
|
24
|
+
"data-direction": direction,
|
|
25
|
+
"className": classes
|
|
26
|
+
}, props)
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export { Stack };
|