sud-ui 1.9.0 → 1.9.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.
@@ -0,0 +1,42 @@
1
+ import type { Context, FC, ReactNode } from "react";
2
+
3
+ export type ThemeScale = Record<string | number, string>;
4
+
5
+ export interface ComponentColorToken {
6
+ bg?: string;
7
+ txt?: string;
8
+ border?: string;
9
+ separator?: string;
10
+ text?: string;
11
+ now?: string;
12
+ [key: string]: unknown;
13
+ }
14
+
15
+ export interface SUDTheme {
16
+ body?: {
17
+ backgroundColor?: string;
18
+ color?: string;
19
+ [key: string]: unknown;
20
+ };
21
+ colors?: Record<string, ThemeScale>;
22
+ components?: Record<string, Record<string, ComponentColorToken>>;
23
+ typography?: {
24
+ fontSize?: Record<string, string>;
25
+ fontWeight?: Record<string, string | number>;
26
+ [key: string]: unknown;
27
+ };
28
+ shadows?: Record<string, string>;
29
+ shapes?: Record<string, Record<string, string | number>>;
30
+ [key: string]: unknown;
31
+ }
32
+
33
+ export interface ThemeProviderProps {
34
+ theme?: SUDTheme;
35
+ darkTheme?: SUDTheme;
36
+ isDarkMode?: boolean;
37
+ children?: ReactNode;
38
+ }
39
+
40
+ export declare const ThemeContext: Context<SUDTheme | null>;
41
+ export declare const useTheme: () => SUDTheme;
42
+ export declare const ThemeProvider: FC<ThemeProviderProps>;
@@ -0,0 +1,3 @@
1
+ import type { SUDTheme } from "./ThemeContext";
2
+
3
+ export declare const darkTheme: SUDTheme;
@@ -0,0 +1,3 @@
1
+ import type { SUDTheme } from "./ThemeContext";
2
+
3
+ export declare const defaultTheme: SUDTheme;
@@ -0,0 +1,4 @@
1
+ export * from "./ThemeContext.d";
2
+ export * from "./defaultTheme.d";
3
+ export * from "./darkTheme.d";
4
+ export * from "./themeUtils.d";
@@ -0,0 +1,80 @@
1
+ import type { shadowType, surfaceType } from "../components/commonType";
2
+ import type { SUDTheme } from "./ThemeContext";
3
+
4
+ export interface ComputeColorStylesOptions {
5
+ theme?: SUDTheme;
6
+ border?: boolean;
7
+ fallback?: string;
8
+ componentType?: string;
9
+ }
10
+
11
+ export interface ColorStyleResult {
12
+ bgColor?: string;
13
+ txtColor?: string;
14
+ borColor?: string | null;
15
+ separator?: string;
16
+ text?: string;
17
+ now?: string;
18
+ }
19
+
20
+ export interface ParsedColorString {
21
+ color?: string;
22
+ intensity?: number;
23
+ }
24
+
25
+ export interface ResolveSurfaceStyleOptions {
26
+ surface?: surfaceType;
27
+ border?: boolean;
28
+ shadow?: shadowType | boolean | null;
29
+ }
30
+
31
+ export interface ResolvedSurfaceStyle {
32
+ border: boolean;
33
+ shadow: shadowType;
34
+ }
35
+
36
+ export declare const computeColorStyles: (
37
+ options?: ComputeColorStylesOptions
38
+ ) => ColorStyleResult;
39
+ export declare const parseColorString: (colorString?: string) => ParsedColorString;
40
+ export declare const resolveColor: (
41
+ colorString?: string,
42
+ theme?: SUDTheme
43
+ ) => string;
44
+ export declare const adjustBrightness: (hex: string, percent: number) => string;
45
+ export declare const getColorWithIntensity: (
46
+ color: string,
47
+ intensity?: number,
48
+ theme?: SUDTheme
49
+ ) => string;
50
+ export declare const mergeClassNames: (
51
+ ...args: Array<string | false | null | undefined>
52
+ ) => string;
53
+ export declare const normalizeShadow: (
54
+ shadow?: shadowType | boolean | null | ""
55
+ ) => shadowType;
56
+ export declare const surfacePresets: Record<
57
+ surfaceType,
58
+ { border: boolean; shadow: shadowType }
59
+ >;
60
+ export declare const resolveSurfaceStyle: (
61
+ options?: ResolveSurfaceStyleOptions
62
+ ) => ResolvedSurfaceStyle;
63
+ export declare const getShadowStyle: (
64
+ shadow?: shadowType | boolean | null,
65
+ theme?: SUDTheme
66
+ ) => string;
67
+ export declare const getShapeStyles: (
68
+ shape?: string,
69
+ theme?: SUDTheme
70
+ ) => Record<string, string | number>;
71
+ export declare const getFontStyles: (options: {
72
+ size?: string;
73
+ weight?: string;
74
+ theme: SUDTheme;
75
+ }) => {
76
+ fontSize: string;
77
+ fontWeight: string | number;
78
+ };
79
+ export declare const applyPulseEffect: (element: HTMLElement) => void;
80
+ export declare const pulseThumbScaleWithBounce: (element: HTMLElement) => void;
@@ -0,0 +1,29 @@
1
+ # Surface Guidelines
2
+
3
+ Sud UI components should not enable border and shadow at the same time by default.
4
+
5
+ ## Defaults
6
+
7
+ - Content and form surfaces use a border by default and no shadow.
8
+ - Floating surfaces use a shadow by default and no border.
9
+ - Action components such as `Button` stay flat by default unless the caller asks for a shadow.
10
+
11
+ ## Component Types
12
+
13
+ - `content`: `Card`, `Collapse`, dense layout panels
14
+ - `input`: `Input`, `Select`, form controls
15
+ - `floating`: `Modal`, `Drawer`, `PopupBase`, `Dropdown`, overlays
16
+ - `action`: `Button`, icon buttons, compact commands
17
+
18
+ Use `surface`, `border`, and `shadow` to override these defaults explicitly.
19
+
20
+ ## Release Check
21
+
22
+ Before publishing, run:
23
+
24
+ ```bash
25
+ npm run lint
26
+ npm run build
27
+ npm run check:exports
28
+ npm pack --dry-run
29
+ ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sud-ui",
3
3
  "description": "A React UI component library with dark mode support, customizable styles, reusable components, and utility-style class names.",
4
- "version": "1.9.0",
4
+ "version": "1.9.1",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
@@ -16,11 +16,13 @@
16
16
  "./dist/index.css": "./dist/index.css"
17
17
  },
18
18
  "files": [
19
- "dist"
19
+ "dist",
20
+ "docs"
20
21
  ],
21
22
  "scripts": {
22
23
  "dev": "vite",
23
24
  "build": "vite build && node scripts/copy-types.mjs",
25
+ "check:exports": "node scripts/check-exports.mjs",
24
26
  "lint": "eslint .",
25
27
  "preview": "vite preview"
26
28
  },