@datavac/ui-kit 1.0.2 → 1.0.4

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.
Files changed (32) hide show
  1. package/dist/components/Accordion/Accordion.d.ts +13 -0
  2. package/dist/components/Accordion/index.d.ts +1 -0
  3. package/dist/components/Badge/Badge.d.ts +11 -0
  4. package/dist/components/Badge/index.d.ts +1 -0
  5. package/dist/components/Button/Button.d.ts +11 -0
  6. package/dist/components/Button/index.d.ts +2 -0
  7. package/dist/components/Drawer/Drawer.d.ts +9 -0
  8. package/dist/components/Drawer/index.d.ts +1 -0
  9. package/dist/components/Input/Input.d.ts +8 -0
  10. package/dist/components/Input/index.d.ts +1 -0
  11. package/dist/components/Spinner/Spinner.d.ts +8 -0
  12. package/dist/components/Spinner/index.d.ts +1 -0
  13. package/dist/components/States/States.d.ts +7 -0
  14. package/dist/components/States/index.d.ts +1 -0
  15. package/dist/components/Switch/Switch.d.ts +16 -0
  16. package/dist/components/Switch/index.d.ts +2 -0
  17. package/dist/components/ThemeProvider/ThemeProvider.d.ts +20 -0
  18. package/dist/components/ThemeProvider/index.d.ts +1 -0
  19. package/dist/components/ThemeToggle/ThemeToggle.d.ts +3 -0
  20. package/dist/components/ThemeToggle/index.d.ts +1 -0
  21. package/dist/components/Tooltip/Tooltip.d.ts +8 -0
  22. package/dist/components/Tooltip/index.d.ts +1 -0
  23. package/dist/components/Typography/Typography.d.ts +13 -0
  24. package/dist/components/Typography/index.d.ts +1 -0
  25. package/dist/icons/index.d.ts +8 -0
  26. package/dist/index.d.ts +19 -0
  27. package/dist/index.js +7 -14
  28. package/dist/lib/utils.d.ts +2 -0
  29. package/dist/test-setup.d.ts +1 -0
  30. package/dist/themes/index.d.ts +8 -0
  31. package/dist/themes/tokens.d.ts +30 -0
  32. package/package.json +2 -2
@@ -0,0 +1,13 @@
1
+ import { type ReactNode } from 'react';
2
+ interface AccordionProps {
3
+ children: ReactNode;
4
+ className?: string;
5
+ }
6
+ export declare function Accordion({ children, className }: AccordionProps): import("react/jsx-runtime").JSX.Element;
7
+ interface AccordionItemProps {
8
+ title: string;
9
+ children: ReactNode;
10
+ value?: string;
11
+ }
12
+ export declare function AccordionItem({ title, children, value }: AccordionItemProps): import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1 @@
1
+ export { Accordion, AccordionItem } from './Accordion';
@@ -0,0 +1,11 @@
1
+ import { type ButtonHTMLAttributes, type HTMLAttributes } from 'react';
2
+ export declare function Badge({ className, ...props }: HTMLAttributes<HTMLSpanElement>): import("react/jsx-runtime").JSX.Element;
3
+ interface ChipProps extends ButtonHTMLAttributes<HTMLButtonElement> {
4
+ selected?: boolean;
5
+ }
6
+ export declare function Chip({ selected, className, ...props }: ChipProps): import("react/jsx-runtime").JSX.Element;
7
+ interface CounterProps extends HTMLAttributes<HTMLSpanElement> {
8
+ count: number;
9
+ }
10
+ export declare function Counter({ count, className, ...props }: CounterProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1 @@
1
+ export { Badge, Chip, Counter } from './Badge';
@@ -0,0 +1,11 @@
1
+ import { type VariantProps } from 'class-variance-authority';
2
+ import { type ButtonHTMLAttributes } from 'react';
3
+ declare const buttonVariants: (props?: ({
4
+ variant?: "primary" | "dark" | null | undefined;
5
+ size?: "md" | "sm" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
8
+ asChild?: boolean;
9
+ }
10
+ export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
11
+ export {};
@@ -0,0 +1,2 @@
1
+ export { Button } from './Button';
2
+ export type { ButtonProps } from './Button';
@@ -0,0 +1,9 @@
1
+ import { type ReactNode } from 'react';
2
+ interface DrawerProps {
3
+ trigger: ReactNode;
4
+ title: string;
5
+ children: ReactNode;
6
+ className?: string;
7
+ }
8
+ export declare function Drawer({ trigger, title, children, className }: DrawerProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1 @@
1
+ export { Drawer } from './Drawer';
@@ -0,0 +1,8 @@
1
+ import { type InputHTMLAttributes } from 'react';
2
+ interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
3
+ variant?: 'white' | 'grey';
4
+ }
5
+ export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
6
+ type SearchBarProps = InputHTMLAttributes<HTMLInputElement>;
7
+ export declare const SearchBar: import("react").ForwardRefExoticComponent<SearchBarProps & import("react").RefAttributes<HTMLInputElement>>;
8
+ export {};
@@ -0,0 +1 @@
1
+ export { Input, SearchBar } from './Input';
@@ -0,0 +1,8 @@
1
+ import { type HTMLAttributes } from 'react';
2
+ type SpinnerSize = 'sm' | 'md' | 'lg';
3
+ export declare function Spinner({ size, className }: {
4
+ size?: SpinnerSize;
5
+ className?: string;
6
+ }): import("react/jsx-runtime").JSX.Element;
7
+ export declare function Skeleton({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1 @@
1
+ export { Spinner, Skeleton } from './Spinner';
@@ -0,0 +1,7 @@
1
+ interface StateProps {
2
+ message?: string;
3
+ className?: string;
4
+ }
5
+ export declare function EmptyState({ message, className }: StateProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function ErrorState({ message, className }: StateProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1 @@
1
+ export { EmptyState, ErrorState } from './States';
@@ -0,0 +1,16 @@
1
+ export interface SwitchProps {
2
+ checked: boolean;
3
+ onChange: (checked: boolean) => void;
4
+ /** sm — 32×20 (ThemeToggle desktop), md — 45×24 (default) */
5
+ size?: 'sm' | 'md';
6
+ /** Overrides track color (replaces default bg-accent/bg-subtle logic) */
7
+ trackClassName?: string;
8
+ /** Overrides thumb color (replaces default bg-white) */
9
+ thumbClassName?: string;
10
+ id?: string;
11
+ disabled?: boolean;
12
+ className?: string;
13
+ 'aria-label'?: string;
14
+ 'aria-labelledby'?: string;
15
+ }
16
+ export declare function Switch({ checked, onChange, size, trackClassName, thumbClassName, id, disabled, className, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, }: SwitchProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { Switch } from './Switch';
2
+ export type { SwitchProps } from './Switch';
@@ -0,0 +1,20 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { ThemeName, ThemeTokens } from '../../themes';
3
+ interface ThemeContextValue {
4
+ themeName: ThemeName;
5
+ tokens: ThemeTokens;
6
+ setTheme: (name: ThemeName) => void;
7
+ toggleTheme: () => void;
8
+ }
9
+ interface ThemeProviderProps {
10
+ children: ReactNode;
11
+ /** Начальная тема. По умолчанию следует системным настройкам */
12
+ defaultTheme?: ThemeName;
13
+ /** Кастомная тема — переопределяет встроенные */
14
+ customThemes?: Record<string, ThemeTokens>;
15
+ /** Применять CSS-переменные на :root (true) или на обёртку (false) */
16
+ applyToRoot?: boolean;
17
+ }
18
+ export declare function ThemeProvider({ children, defaultTheme: initialTheme, customThemes, applyToRoot, }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare function useTheme(): ThemeContextValue;
20
+ export {};
@@ -0,0 +1 @@
1
+ export { ThemeProvider, useTheme } from './ThemeProvider';
@@ -0,0 +1,3 @@
1
+ export declare function ThemeToggle({ className }: {
2
+ className?: string;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export { ThemeToggle } from './ThemeToggle';
@@ -0,0 +1,8 @@
1
+ import { type ReactNode } from 'react';
2
+ interface TooltipProps {
3
+ content: ReactNode;
4
+ children: ReactNode;
5
+ className?: string;
6
+ }
7
+ export declare function Tooltip({ content, children, className }: TooltipProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1 @@
1
+ export { Tooltip } from './Tooltip';
@@ -0,0 +1,13 @@
1
+ import { type HTMLAttributes } from 'react';
2
+ interface HeadingProps extends HTMLAttributes<HTMLHeadingElement> {
3
+ as?: 'h1' | 'h2' | 'h3' | 'h4';
4
+ size?: 'xl' | 'lg' | 'md';
5
+ }
6
+ export declare const Heading: import("react").ForwardRefExoticComponent<HeadingProps & import("react").RefAttributes<HTMLHeadingElement>>;
7
+ interface TextProps extends HTMLAttributes<HTMLParagraphElement> {
8
+ size?: 'md' | 'sm';
9
+ }
10
+ export declare const Text: import("react").ForwardRefExoticComponent<TextProps & import("react").RefAttributes<HTMLParagraphElement>>;
11
+ export declare const Label: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement> & import("react").RefAttributes<HTMLParagraphElement>>;
12
+ export declare const Caption: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement> & import("react").RefAttributes<HTMLParagraphElement>>;
13
+ export {};
@@ -0,0 +1 @@
1
+ export { Heading, Text, Label, Caption } from './Typography';
@@ -0,0 +1,8 @@
1
+ import type { SVGProps } from 'react';
2
+ export type IconProps = SVGProps<SVGSVGElement>;
3
+ export declare function ArrowsIcon({ width, height, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
4
+ export declare function InfoCircleIcon({ width, height, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function MenuIcon({ width, height, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function MoonStarsIcon({ width, height, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function PlusIcon({ width, height, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function SunIcon({ width, height, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import './tailwind.css';
2
+ export { cn } from './lib/utils';
3
+ export { Heading, Text, Label, Caption } from './components/Typography';
4
+ export { Button } from './components/Button';
5
+ export type { ButtonProps } from './components/Button';
6
+ export { Badge, Chip, Counter } from './components/Badge';
7
+ export { Input, SearchBar } from './components/Input';
8
+ export { Tooltip } from './components/Tooltip';
9
+ export { Drawer } from './components/Drawer';
10
+ export { Accordion, AccordionItem } from './components/Accordion';
11
+ export { Spinner, Skeleton } from './components/Spinner';
12
+ export { EmptyState, ErrorState } from './components/States';
13
+ export { ThemeToggle } from './components/ThemeToggle';
14
+ export { Switch } from './components/Switch';
15
+ export type { SwitchProps } from './components/Switch';
16
+ export * from './icons';
17
+ export { ThemeProvider, useTheme } from './components/ThemeProvider';
18
+ export { defaultTheme, darkTheme, themes, tokensToCssVars } from './themes';
19
+ export type { ThemeTokens, ThemeName } from './themes';
package/dist/index.js CHANGED
@@ -6726,28 +6726,21 @@ function Ju({ children: e, defaultTheme: t, customThemes: n, applyToRoot: r = !0
6726
6726
  if (window.matchMedia("(prefers-color-scheme: dark)").matches) return "dark";
6727
6727
  }
6728
6728
  return "light";
6729
- }), u = a[s] ?? Vu, f = i((e) => {
6730
- let t = r ? document.documentElement : null;
6731
- t && (Object.entries(e).forEach(([e, n]) => t.style.setProperty(e, n)), t.classList.toggle("dark", s === "dark"));
6732
- }, [r, s]);
6729
+ }), u = a[s] ?? Vu;
6733
6730
  o(() => {
6734
- f(Ku(u)), localStorage.setItem("datavac-theme", s);
6735
- }, [
6736
- u,
6737
- s,
6738
- f
6739
- ]);
6740
- let p = i((e) => {
6731
+ r && document.documentElement.classList.toggle("dark", s === "dark"), localStorage.setItem("datavac-theme", s);
6732
+ }, [s, r]);
6733
+ let f = i((e) => {
6741
6734
  a[e] && c(e);
6742
- }, [a]), m = i(() => {
6735
+ }, [a]), p = i(() => {
6743
6736
  c((e) => e === "dark" ? "light" : "dark");
6744
6737
  }, []);
6745
6738
  return /* @__PURE__ */ d(qu.Provider, {
6746
6739
  value: {
6747
6740
  themeName: s,
6748
6741
  tokens: u,
6749
- setTheme: p,
6750
- toggleTheme: m
6742
+ setTheme: f,
6743
+ toggleTheme: p
6751
6744
  },
6752
6745
  children: e
6753
6746
  });
@@ -0,0 +1,2 @@
1
+ import { type ClassValue } from 'clsx';
2
+ export declare function cn(...inputs: ClassValue[]): string;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,8 @@
1
+ import type { ThemeTokens } from './tokens';
2
+ import defaultTheme from './default.json';
3
+ import darkTheme from './dark.json';
4
+ export { defaultTheme, darkTheme };
5
+ export type { ThemeTokens, ThemeName } from './tokens';
6
+ export declare const themes: Record<string, ThemeTokens>;
7
+ /** Конвертирует объект токенов в CSS custom properties */
8
+ export declare function tokensToCssVars(tokens: ThemeTokens): Record<string, string>;
@@ -0,0 +1,30 @@
1
+ export interface ThemeTokens {
2
+ colors: {
3
+ accent: string;
4
+ accentHover: string;
5
+ fg: string;
6
+ fgSecondary: string;
7
+ fgMuted: string;
8
+ page: string;
9
+ card: string;
10
+ subtle: string;
11
+ interactive: string;
12
+ overlay: string;
13
+ neutral: string;
14
+ border: string;
15
+ link: string;
16
+ };
17
+ radius: {
18
+ tooltip: string;
19
+ icon: string;
20
+ sm: string;
21
+ input: string;
22
+ card: string;
23
+ pill: string;
24
+ button: string;
25
+ };
26
+ font: {
27
+ sans: string;
28
+ };
29
+ }
30
+ export type ThemeName = string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datavac/ui-kit",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -19,7 +19,7 @@
19
19
  "scripts": {
20
20
  "theme:generate": "node scripts/generate-theme-css.mjs",
21
21
  "icons:generate": "node scripts/generate-icons.mjs",
22
- "build": "tsc -b && vite build",
22
+ "build": "tsc -b && vite build && tsc --project tsconfig.declaration.json",
23
23
  "dev": "vite build --watch",
24
24
  "lint": "eslint ./src",
25
25
  "format": "prettier ./src --write",