shru-design-system 0.1.5 → 0.1.8
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 +96 -166
- package/dist/index.d.mts +54 -1
- package/dist/index.d.ts +54 -1
- package/dist/index.js +232 -104
- package/dist/index.mjs +222 -105
- package/package.json +7 -1
- package/scripts/apply-theme-sync.js +59 -23
- package/scripts/applyThemeSync.js +285 -0
- package/scripts/init.js +192 -367
- package/scripts/themeConfig.js +214 -0
- package/scripts/themeUtils.js +452 -0
- package/scripts/tokens/base.json +46 -0
- package/scripts/tokens/palettes.json +47 -0
- package/scripts/tokens/themes/animation/brisk.json +10 -0
- package/scripts/tokens/themes/animation/gentle.json +10 -0
- package/scripts/tokens/themes/color/dark.json +25 -0
- package/scripts/tokens/themes/color/white.json +25 -0
- package/scripts/tokens/themes/custom/brand.json +14 -0
- package/scripts/tokens/themes/custom/minimal.json +17 -0
- package/scripts/tokens/themes/density/comfortable.json +12 -0
- package/scripts/tokens/themes/density/compact.json +12 -0
- package/scripts/tokens/themes/shape/sharp.json +8 -0
- package/scripts/tokens/themes/shape/smooth.json +8 -0
- package/scripts/tokens/themes/typography/sans.json +7 -0
- package/scripts/tokens/themes/typography/serif.json +7 -0
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,184 +1,114 @@
|
|
|
1
1
|
# shru-design-system
|
|
2
2
|
|
|
3
|
-
A React component library with atoms and molecules built on Radix UI and Tailwind CSS.
|
|
3
|
+
A React component library with atoms and molecules built on Radix UI and Tailwind CSS, featuring a dynamic theme system.
|
|
4
|
+
|
|
5
|
+
## Project Structure
|
|
6
|
+
|
|
7
|
+
### Root Files
|
|
8
|
+
|
|
9
|
+
- **`package.json`** - Package configuration, dependencies, and scripts
|
|
10
|
+
- **`tsconfig.json`** - TypeScript configuration
|
|
11
|
+
- **`tsup.config.ts`** - Build configuration for bundling (ESM/CJS)
|
|
12
|
+
- **`tailwind.config.js`** - Tailwind CSS configuration (for library development)
|
|
13
|
+
- **`postcss.config.js`** - PostCSS configuration (for library development)
|
|
14
|
+
- **`.gitignore`** - Git ignore rules
|
|
15
|
+
|
|
16
|
+
### Source Code (`src/`)
|
|
17
|
+
|
|
18
|
+
- **`src/index.ts`** - Main entry point, exports all components and utilities
|
|
19
|
+
- **`src/utils.ts`** - Utility functions (cn helper for class merging)
|
|
20
|
+
|
|
21
|
+
#### Atoms (`src/atoms/`)
|
|
22
|
+
Basic UI building blocks:
|
|
23
|
+
- **`Button.tsx`** - Button component with variants and sizes
|
|
24
|
+
- **`Badge.tsx`** - Badge component for labels and tags
|
|
25
|
+
- **`TextInput.tsx`** - Text input field component
|
|
26
|
+
- **`Label.tsx`** - Form label component
|
|
27
|
+
- **`Textarea.tsx`** - Multi-line text input component
|
|
28
|
+
- **`Separator.tsx`** - Horizontal/vertical divider component
|
|
29
|
+
- **`Checkbox.tsx`** - Checkbox input component
|
|
30
|
+
|
|
31
|
+
#### Molecules (`src/molecules/`)
|
|
32
|
+
Composite components:
|
|
33
|
+
- **`Modal.tsx`** - Modal dialog component
|
|
34
|
+
- **`Select.tsx`** - Dropdown select component
|
|
35
|
+
- **`Tooltip.tsx`** - Tooltip component
|
|
36
|
+
|
|
37
|
+
#### Theme System (`src/themes/`)
|
|
38
|
+
- **`themeConfig.ts`** - Theme configuration and category definitions
|
|
39
|
+
- **`themeUtils.ts`** - Theme utility functions (loading, merging, flattening)
|
|
40
|
+
- **`applyThemeSync.ts`** - Synchronous theme application (prevents FOUC)
|
|
41
|
+
- **`useTheme.tsx`** - React hook for theme management
|
|
42
|
+
- **`ui/ThemeToggle/`** - Theme toggle UI component and related files
|
|
43
|
+
- **`ThemeToggle.tsx`** - Main theme toggle component
|
|
44
|
+
- **`useThemeToggle.ts`** - Hook for theme toggle UI state
|
|
45
|
+
- **`themeToggleConfig.ts`** - Theme toggle configuration
|
|
46
|
+
- **`themeToggleUtils.ts`** - Theme toggle utility functions
|
|
47
|
+
- **`index.ts`** - Theme toggle exports
|
|
48
|
+
|
|
49
|
+
### Build Output (`dist/`)
|
|
50
|
+
|
|
51
|
+
- **`index.js`** - CommonJS bundle
|
|
52
|
+
- **`index.mjs`** - ESM bundle
|
|
53
|
+
- **`index.d.ts`** - TypeScript declarations (CJS)
|
|
54
|
+
- **`index.d.mts`** - TypeScript declarations (ESM)
|
|
55
|
+
|
|
56
|
+
### Scripts (`scripts/`)
|
|
57
|
+
|
|
58
|
+
Setup and runtime scripts:
|
|
59
|
+
- **`init.js`** - Postinstall script that sets up Tailwind, PostCSS, and token files in consuming apps
|
|
60
|
+
- **`apply-theme-sync.js`** - Standalone synchronous theme script (injected into HTML)
|
|
61
|
+
- **`applyThemeSync.js`** - Synchronous theme application module
|
|
62
|
+
- **`themeConfig.js`** - Theme configuration (JavaScript version)
|
|
63
|
+
- **`themeUtils.js`** - Theme utilities (JavaScript version)
|
|
64
|
+
- **`tokens/`** - Default token files (copied to consuming apps)
|
|
65
|
+
- **`base.json`** - Base design tokens
|
|
66
|
+
- **`palettes.json`** - Color palette definitions
|
|
67
|
+
- **`themes/`** - Theme category files
|
|
68
|
+
- **`color/`** - Color theme variants (white, dark)
|
|
69
|
+
- **`typography/`** - Typography themes (sans, serif)
|
|
70
|
+
- **`shape/`** - Shape themes (smooth, sharp)
|
|
71
|
+
- **`density/`** - Density themes (comfortable, compact)
|
|
72
|
+
- **`animation/`** - Animation themes (gentle, brisk)
|
|
73
|
+
- **`custom/`** - Custom theme examples (brand, minimal)
|
|
74
|
+
|
|
75
|
+
### Test Application (`test/`)
|
|
76
|
+
|
|
77
|
+
Local test environment for developing and testing the library:
|
|
78
|
+
- **`package.json`** - Test app dependencies
|
|
79
|
+
- **`vite.config.ts`** - Vite configuration for test app
|
|
80
|
+
- **`index.html`** - Test app HTML entry point
|
|
81
|
+
- **`src/App.tsx`** - Test app component showcasing all library components
|
|
82
|
+
- **`src/main.tsx`** - Test app entry point
|
|
83
|
+
- **`src/index.css`** - Test app global styles
|
|
84
|
+
- **`tailwind.config.js`** - Tailwind config for test app
|
|
85
|
+
- **`postcss.config.js`** - PostCSS config for test app
|
|
86
|
+
- **`public/tokens/`** - Token files for testing (generated by init script)
|
|
87
|
+
- **`dist/`** - Vite build output (ignored in git)
|
|
4
88
|
|
|
5
|
-
##
|
|
89
|
+
## Usage
|
|
6
90
|
|
|
91
|
+
Install the package:
|
|
7
92
|
```bash
|
|
8
93
|
npm install shru-design-system
|
|
9
94
|
```
|
|
10
95
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
After installation, run the setup script to configure Tailwind CSS:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npx shru-design-system-init
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Or it will run automatically after `npm install` (you can skip this step if it already ran).
|
|
20
|
-
|
|
21
|
-
## Manual Setup
|
|
22
|
-
|
|
23
|
-
If you prefer to set up manually or the automatic setup didn't work:
|
|
24
|
-
|
|
25
|
-
### 1. Install Tailwind CSS
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npm install -D tailwindcss postcss autoprefixer
|
|
29
|
-
npx tailwindcss init -p
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
### 2. Configure Tailwind
|
|
33
|
-
|
|
34
|
-
Update `tailwind.config.js`:
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
export default {
|
|
38
|
-
content: [
|
|
39
|
-
"./index.html",
|
|
40
|
-
"./src/**/*.{js,ts,jsx,tsx}",
|
|
41
|
-
"./node_modules/shru-design-system/dist/**/*.{js,mjs}",
|
|
42
|
-
],
|
|
43
|
-
theme: {
|
|
44
|
-
extend: {
|
|
45
|
-
colors: {
|
|
46
|
-
background: "hsl(var(--background))",
|
|
47
|
-
foreground: "hsl(var(--foreground))",
|
|
48
|
-
primary: {
|
|
49
|
-
DEFAULT: "hsl(var(--primary))",
|
|
50
|
-
foreground: "hsl(var(--primary-foreground))",
|
|
51
|
-
},
|
|
52
|
-
secondary: {
|
|
53
|
-
DEFAULT: "hsl(var(--secondary))",
|
|
54
|
-
foreground: "hsl(var(--secondary-foreground))",
|
|
55
|
-
},
|
|
56
|
-
destructive: {
|
|
57
|
-
DEFAULT: "hsl(var(--destructive))",
|
|
58
|
-
foreground: "hsl(var(--destructive-foreground))",
|
|
59
|
-
},
|
|
60
|
-
muted: {
|
|
61
|
-
DEFAULT: "hsl(var(--muted))",
|
|
62
|
-
foreground: "hsl(var(--muted-foreground))",
|
|
63
|
-
},
|
|
64
|
-
accent: {
|
|
65
|
-
DEFAULT: "hsl(var(--accent))",
|
|
66
|
-
foreground: "hsl(var(--accent-foreground))",
|
|
67
|
-
},
|
|
68
|
-
popover: {
|
|
69
|
-
DEFAULT: "hsl(var(--popover))",
|
|
70
|
-
foreground: "hsl(var(--popover-foreground))",
|
|
71
|
-
},
|
|
72
|
-
border: "hsl(var(--border))",
|
|
73
|
-
input: "hsl(var(--input))",
|
|
74
|
-
ring: "hsl(var(--ring))",
|
|
75
|
-
},
|
|
76
|
-
borderRadius: {
|
|
77
|
-
lg: "var(--radius)",
|
|
78
|
-
md: "calc(var(--radius) - 2px)",
|
|
79
|
-
sm: "calc(var(--radius) - 4px)",
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
plugins: [],
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### 3. Add CSS Variables
|
|
88
|
-
|
|
89
|
-
Create or update `src/index.css`:
|
|
90
|
-
|
|
91
|
-
```css
|
|
92
|
-
@tailwind base;
|
|
93
|
-
@tailwind components;
|
|
94
|
-
@tailwind utilities;
|
|
95
|
-
|
|
96
|
-
@layer base {
|
|
97
|
-
:root {
|
|
98
|
-
--background: 0 0% 100%;
|
|
99
|
-
--foreground: 222.2 84% 4.9%;
|
|
100
|
-
--primary: 222.2 47.4% 11.2%;
|
|
101
|
-
--primary-foreground: 210 40% 98%;
|
|
102
|
-
--secondary: 210 40% 96.1%;
|
|
103
|
-
--secondary-foreground: 222.2 47.4% 11.2%;
|
|
104
|
-
--destructive: 0 84.2% 60.2%;
|
|
105
|
-
--destructive-foreground: 210 40% 98%;
|
|
106
|
-
--muted: 210 40% 96.1%;
|
|
107
|
-
--muted-foreground: 215.4 16.3% 46.9%;
|
|
108
|
-
--accent: 210 40% 96.1%;
|
|
109
|
-
--accent-foreground: 222.2 47.4% 11.2%;
|
|
110
|
-
--popover: 0 0% 100%;
|
|
111
|
-
--popover-foreground: 222.2 84% 4.9%;
|
|
112
|
-
--border: 214.3 31.8% 91.4%;
|
|
113
|
-
--input: 214.3 31.8% 91.4%;
|
|
114
|
-
--ring: 222.2 84% 4.9%;
|
|
115
|
-
--radius: 0.5rem;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
* {
|
|
119
|
-
border-color: hsl(var(--border));
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
body {
|
|
123
|
-
background-color: hsl(var(--background));
|
|
124
|
-
color: hsl(var(--foreground));
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
### 4. Import CSS
|
|
130
|
-
|
|
131
|
-
Import the CSS file in your entry point (e.g., `src/main.tsx`):
|
|
96
|
+
The `postinstall` script automatically sets up Tailwind CSS, PostCSS, and token files in your project.
|
|
132
97
|
|
|
98
|
+
Import components:
|
|
133
99
|
```tsx
|
|
134
|
-
import '
|
|
100
|
+
import { Button, Modal, ThemeToggle } from 'shru-design-system'
|
|
135
101
|
```
|
|
136
102
|
|
|
137
|
-
##
|
|
103
|
+
## Development
|
|
138
104
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
function App() {
|
|
143
|
-
return (
|
|
144
|
-
<div>
|
|
145
|
-
<Button variant="default">Click me</Button>
|
|
146
|
-
<Badge>New</Badge>
|
|
147
|
-
|
|
148
|
-
<Modal>
|
|
149
|
-
<ModalTrigger asChild>
|
|
150
|
-
<Button>Open Modal</Button>
|
|
151
|
-
</ModalTrigger>
|
|
152
|
-
<ModalContent>
|
|
153
|
-
<ModalHeader>
|
|
154
|
-
<ModalTitle>Hello</ModalTitle>
|
|
155
|
-
<ModalDescription>This is a modal</ModalDescription>
|
|
156
|
-
</ModalHeader>
|
|
157
|
-
</ModalContent>
|
|
158
|
-
</Modal>
|
|
159
|
-
</div>
|
|
160
|
-
)
|
|
161
|
-
}
|
|
105
|
+
Build the library:
|
|
106
|
+
```bash
|
|
107
|
+
npm run build
|
|
162
108
|
```
|
|
163
109
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
### Atoms
|
|
167
|
-
- **Button** - Versatile button with multiple variants and sizes
|
|
168
|
-
- **Badge** - Small status indicators
|
|
169
|
-
|
|
170
|
-
### Molecules
|
|
171
|
-
- **Modal** - Dialog component with overlay
|
|
172
|
-
- **Select** - Dropdown select component
|
|
173
|
-
|
|
174
|
-
## Peer Dependencies
|
|
175
|
-
|
|
176
|
-
Make sure to install these peer dependencies:
|
|
177
|
-
|
|
110
|
+
Test locally:
|
|
178
111
|
```bash
|
|
179
|
-
|
|
112
|
+
cd test && npm run dev
|
|
180
113
|
```
|
|
181
114
|
|
|
182
|
-
## License
|
|
183
|
-
|
|
184
|
-
MIT
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
5
|
+
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
6
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
4
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
8
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
6
9
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
@@ -26,6 +29,30 @@ declare const Badge: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<
|
|
|
26
29
|
asChild?: boolean;
|
|
27
30
|
}, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
28
31
|
|
|
32
|
+
declare const textInputTypes: readonly ["text", "email", "password", "number", "tel", "url", "search"];
|
|
33
|
+
interface TextInputProps extends React.ComponentProps<"input"> {
|
|
34
|
+
type?: typeof textInputTypes[number];
|
|
35
|
+
}
|
|
36
|
+
declare const TextInput: React.ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
37
|
+
|
|
38
|
+
interface LabelProps extends React.ComponentProps<typeof LabelPrimitive.Root> {
|
|
39
|
+
}
|
|
40
|
+
declare const Label: React.ForwardRefExoticComponent<Omit<LabelProps, "ref"> & React.RefAttributes<HTMLLabelElement>>;
|
|
41
|
+
|
|
42
|
+
interface TextareaProps extends React.ComponentProps<"textarea"> {
|
|
43
|
+
}
|
|
44
|
+
declare const Textarea: React.ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
|
|
45
|
+
|
|
46
|
+
declare const separatorOrientations: readonly ["horizontal", "vertical"];
|
|
47
|
+
interface SeparatorProps extends React.ComponentProps<typeof SeparatorPrimitive.Root> {
|
|
48
|
+
orientation?: typeof separatorOrientations[number];
|
|
49
|
+
}
|
|
50
|
+
declare const Separator: React.ForwardRefExoticComponent<Omit<SeparatorProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
51
|
+
|
|
52
|
+
interface CheckboxProps extends React.ComponentProps<typeof CheckboxPrimitive.Root> {
|
|
53
|
+
}
|
|
54
|
+
declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
55
|
+
|
|
29
56
|
declare function Modal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
30
57
|
declare function ModalTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
|
|
31
58
|
declare function ModalPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): react_jsx_runtime.JSX.Element;
|
|
@@ -130,6 +157,16 @@ type ThemeCategory = {
|
|
|
130
157
|
order: number;
|
|
131
158
|
themes: Record<string, ThemeMetadata>;
|
|
132
159
|
};
|
|
160
|
+
/**
|
|
161
|
+
* Centralized theme category order
|
|
162
|
+
* Used everywhere to ensure consistency
|
|
163
|
+
* Custom category is included but handled specially (optional, user-created files)
|
|
164
|
+
*
|
|
165
|
+
* ⚠️ IF YOU UPDATE THIS, ALSO UPDATE:
|
|
166
|
+
* 1. scripts/themeConfig.js - THEME_CATEGORY_ORDER (JavaScript version)
|
|
167
|
+
* 2. scripts/apply-theme-sync.js - THEME_CATEGORY_ORDER constant (standalone script, can't import)
|
|
168
|
+
*/
|
|
169
|
+
declare const THEME_CATEGORY_ORDER: readonly ["color", "typography", "shape", "density", "animation", "custom"];
|
|
133
170
|
/**
|
|
134
171
|
* Register a custom theme dynamically
|
|
135
172
|
* Allows users to add themes without modifying the base config
|
|
@@ -152,6 +189,22 @@ declare function getThemesForCategory(category: string): Promise<Record<string,
|
|
|
152
189
|
*/
|
|
153
190
|
declare function getTheme(category: string, themeId: string): Promise<ThemeMetadata | null>;
|
|
154
191
|
|
|
192
|
+
/**
|
|
193
|
+
* Theme Utilities
|
|
194
|
+
* Pure utility functions for theme management
|
|
195
|
+
* Note: generateAndApplyTheme has side effects (modifies DOM) but is the main theme application utility
|
|
196
|
+
*/
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Debug helper: Enable debug mode to see all CSS variables in console
|
|
200
|
+
* Call this in browser console: window.__DESIGN_SYSTEM_DEBUG__ = true
|
|
201
|
+
*/
|
|
202
|
+
declare function enableDebugMode(): void;
|
|
203
|
+
/**
|
|
204
|
+
* Debug helper: Get all current CSS variables
|
|
205
|
+
*/
|
|
206
|
+
declare function getCurrentCSSVariables(): Record<string, string>;
|
|
207
|
+
|
|
155
208
|
/**
|
|
156
209
|
* Synchronous theme application for blocking script execution
|
|
157
210
|
* This runs before React hydrates to prevent theme flash
|
|
@@ -162,4 +215,4 @@ declare function getTheme(category: string, themeId: string): Promise<ThemeMetad
|
|
|
162
215
|
*/
|
|
163
216
|
declare function applyThemeSync(): void;
|
|
164
217
|
|
|
165
|
-
export { Badge, Button, Modal, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalTitle, ModalTrigger, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, type ThemeMetadata$1 as ThemeMetadata, type ThemeSelection, ThemeToggle, type ThemeToggleProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, applyThemeSync, badgeVariants, buttonVariants, getTheme, getThemeCategories, getThemeFilePath, getThemesForCategory, registerTheme, useTheme, useThemeToggle };
|
|
218
|
+
export { Badge, Button, Checkbox, Label, Modal, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalTitle, ModalTrigger, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, THEME_CATEGORY_ORDER, TextInput, Textarea, type ThemeMetadata$1 as ThemeMetadata, type ThemeSelection, ThemeToggle, type ThemeToggleProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, applyThemeSync, badgeVariants, buttonVariants, enableDebugMode, getCurrentCSSVariables, getTheme, getThemeCategories, getThemeFilePath, getThemesForCategory, registerTheme, useTheme, useThemeToggle };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
5
|
+
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
6
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
4
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
8
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
6
9
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
@@ -26,6 +29,30 @@ declare const Badge: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<
|
|
|
26
29
|
asChild?: boolean;
|
|
27
30
|
}, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
28
31
|
|
|
32
|
+
declare const textInputTypes: readonly ["text", "email", "password", "number", "tel", "url", "search"];
|
|
33
|
+
interface TextInputProps extends React.ComponentProps<"input"> {
|
|
34
|
+
type?: typeof textInputTypes[number];
|
|
35
|
+
}
|
|
36
|
+
declare const TextInput: React.ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
37
|
+
|
|
38
|
+
interface LabelProps extends React.ComponentProps<typeof LabelPrimitive.Root> {
|
|
39
|
+
}
|
|
40
|
+
declare const Label: React.ForwardRefExoticComponent<Omit<LabelProps, "ref"> & React.RefAttributes<HTMLLabelElement>>;
|
|
41
|
+
|
|
42
|
+
interface TextareaProps extends React.ComponentProps<"textarea"> {
|
|
43
|
+
}
|
|
44
|
+
declare const Textarea: React.ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
|
|
45
|
+
|
|
46
|
+
declare const separatorOrientations: readonly ["horizontal", "vertical"];
|
|
47
|
+
interface SeparatorProps extends React.ComponentProps<typeof SeparatorPrimitive.Root> {
|
|
48
|
+
orientation?: typeof separatorOrientations[number];
|
|
49
|
+
}
|
|
50
|
+
declare const Separator: React.ForwardRefExoticComponent<Omit<SeparatorProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
51
|
+
|
|
52
|
+
interface CheckboxProps extends React.ComponentProps<typeof CheckboxPrimitive.Root> {
|
|
53
|
+
}
|
|
54
|
+
declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
55
|
+
|
|
29
56
|
declare function Modal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
30
57
|
declare function ModalTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
|
|
31
58
|
declare function ModalPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): react_jsx_runtime.JSX.Element;
|
|
@@ -130,6 +157,16 @@ type ThemeCategory = {
|
|
|
130
157
|
order: number;
|
|
131
158
|
themes: Record<string, ThemeMetadata>;
|
|
132
159
|
};
|
|
160
|
+
/**
|
|
161
|
+
* Centralized theme category order
|
|
162
|
+
* Used everywhere to ensure consistency
|
|
163
|
+
* Custom category is included but handled specially (optional, user-created files)
|
|
164
|
+
*
|
|
165
|
+
* ⚠️ IF YOU UPDATE THIS, ALSO UPDATE:
|
|
166
|
+
* 1. scripts/themeConfig.js - THEME_CATEGORY_ORDER (JavaScript version)
|
|
167
|
+
* 2. scripts/apply-theme-sync.js - THEME_CATEGORY_ORDER constant (standalone script, can't import)
|
|
168
|
+
*/
|
|
169
|
+
declare const THEME_CATEGORY_ORDER: readonly ["color", "typography", "shape", "density", "animation", "custom"];
|
|
133
170
|
/**
|
|
134
171
|
* Register a custom theme dynamically
|
|
135
172
|
* Allows users to add themes without modifying the base config
|
|
@@ -152,6 +189,22 @@ declare function getThemesForCategory(category: string): Promise<Record<string,
|
|
|
152
189
|
*/
|
|
153
190
|
declare function getTheme(category: string, themeId: string): Promise<ThemeMetadata | null>;
|
|
154
191
|
|
|
192
|
+
/**
|
|
193
|
+
* Theme Utilities
|
|
194
|
+
* Pure utility functions for theme management
|
|
195
|
+
* Note: generateAndApplyTheme has side effects (modifies DOM) but is the main theme application utility
|
|
196
|
+
*/
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Debug helper: Enable debug mode to see all CSS variables in console
|
|
200
|
+
* Call this in browser console: window.__DESIGN_SYSTEM_DEBUG__ = true
|
|
201
|
+
*/
|
|
202
|
+
declare function enableDebugMode(): void;
|
|
203
|
+
/**
|
|
204
|
+
* Debug helper: Get all current CSS variables
|
|
205
|
+
*/
|
|
206
|
+
declare function getCurrentCSSVariables(): Record<string, string>;
|
|
207
|
+
|
|
155
208
|
/**
|
|
156
209
|
* Synchronous theme application for blocking script execution
|
|
157
210
|
* This runs before React hydrates to prevent theme flash
|
|
@@ -162,4 +215,4 @@ declare function getTheme(category: string, themeId: string): Promise<ThemeMetad
|
|
|
162
215
|
*/
|
|
163
216
|
declare function applyThemeSync(): void;
|
|
164
217
|
|
|
165
|
-
export { Badge, Button, Modal, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalTitle, ModalTrigger, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, type ThemeMetadata$1 as ThemeMetadata, type ThemeSelection, ThemeToggle, type ThemeToggleProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, applyThemeSync, badgeVariants, buttonVariants, getTheme, getThemeCategories, getThemeFilePath, getThemesForCategory, registerTheme, useTheme, useThemeToggle };
|
|
218
|
+
export { Badge, Button, Checkbox, Label, Modal, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalTitle, ModalTrigger, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, THEME_CATEGORY_ORDER, TextInput, Textarea, type ThemeMetadata$1 as ThemeMetadata, type ThemeSelection, ThemeToggle, type ThemeToggleProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, applyThemeSync, badgeVariants, buttonVariants, enableDebugMode, getCurrentCSSVariables, getTheme, getThemeCategories, getThemeFilePath, getThemesForCategory, registerTheme, useTheme, useThemeToggle };
|