@work-rjkashyap/unified-ui 0.1.0 → 0.1.2
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/CHANGELOG.md +87 -45
- package/README.md +97 -56
- package/dist/{chunk-QXR4VY7Q.cjs → chunk-33QEKXRQ.cjs} +1 -1
- package/dist/chunk-3EHT6IOA.cjs +49 -0
- package/dist/chunk-4NYLE2LT.cjs +10042 -0
- package/dist/{chunk-BIW2RPDU.cjs → chunk-4ON3M3OM.cjs} +4 -4
- package/dist/{chunk-SSGN5QDC.mjs → chunk-5NZDQWRV.mjs} +1 -1
- package/dist/{chunk-3HHJAYQI.cjs → chunk-7ITQSRGX.cjs} +30 -30
- package/dist/chunk-A4YYJAAJ.mjs +9897 -0
- package/dist/{chunk-CWETOWRM.mjs → chunk-F5S6NLOT.mjs} +24 -24
- package/dist/chunk-MBYCK2JJ.mjs +37 -0
- package/dist/chunk-PQR7C4OH.cjs +1533 -0
- package/dist/chunk-QEFOXYBO.cjs +398 -0
- package/dist/chunk-TVCJRD3S.mjs +379 -0
- package/dist/chunk-ZDB557B2.mjs +1505 -0
- package/dist/{chunk-M2LNQWOB.mjs → chunk-ZT3PCXDF.mjs} +4 -4
- package/dist/components.cjs +152 -120
- package/dist/components.d.cts +410 -74
- package/dist/components.d.ts +410 -74
- package/dist/components.mjs +3 -3
- package/dist/index.cjs +313 -201
- package/dist/index.d.cts +6 -14
- package/dist/index.d.ts +6 -14
- package/dist/index.mjs +8 -8
- package/dist/primitives.cjs +14 -14
- package/dist/primitives.d.cts +1 -1
- package/dist/primitives.d.ts +1 -1
- package/dist/primitives.mjs +2 -2
- package/dist/theme.cjs +90 -9
- package/dist/theme.d.cts +271 -12
- package/dist/theme.d.ts +271 -12
- package/dist/theme.mjs +3 -2
- package/dist/tokens.cjs +19 -19
- package/dist/tokens.d.cts +1 -1
- package/dist/tokens.d.ts +1 -1
- package/dist/tokens.mjs +1 -1
- package/dist/utils.cjs +42 -42
- package/dist/utils.d.cts +41 -37
- package/dist/utils.d.ts +41 -37
- package/dist/utils.mjs +3 -3
- package/dist/z-index-G0PBTHL2.d.cts +466 -0
- package/dist/z-index-G0PBTHL2.d.ts +466 -0
- package/package.json +183 -173
- package/styles.css +384 -291
- package/dist/chunk-2RGLRX6K.cjs +0 -279
- package/dist/chunk-5S5DMH5G.cjs +0 -5983
- package/dist/chunk-I74E52C5.mjs +0 -271
- package/dist/chunk-IWJ5VMZ7.mjs +0 -323
- package/dist/chunk-KHON2AEM.cjs +0 -342
- package/dist/chunk-LSNKPQP7.cjs +0 -58
- package/dist/chunk-X2WCY4VB.mjs +0 -5836
- package/dist/chunk-ZBN26FLO.mjs +0 -46
- package/dist/z-index-B_nTQ3qo.d.cts +0 -422
- package/dist/z-index-B_nTQ3qo.d.ts +0 -422
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,89 @@
|
|
|
1
1
|
# Unified UI Changelog
|
|
2
|
-
|
|
3
2
|
All notable changes to the Unified UI design system will be documented in this file.
|
|
4
|
-
|
|
5
3
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
4
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
5
|
---
|
|
9
|
-
|
|
6
|
+
## [Unreleased]
|
|
7
|
+
### Planned
|
|
8
|
+
- Migration guide — mapping from legacy `--ds-*` tokens to new plain `--*` tokens
|
|
9
|
+
- CI/CD pipeline for automated publishing on git tags
|
|
10
|
+
- `UnifiedUIProvider` component for optional auto CSS injection
|
|
11
|
+
- Component tests with Vitest + Testing Library
|
|
12
|
+
---
|
|
13
|
+
## [0.1.2] — 2026-03-03
|
|
14
|
+
### Added
|
|
15
|
+
#### Theme Customizer System
|
|
16
|
+
- **`ThemeCustomizerProvider`** — React context provider for runtime theme management with `localStorage` persistence and cross-tab sync via `StorageEvent`
|
|
17
|
+
- **`useThemeCustomizer()`** — hook exposing `config`, `setColorPreset`, `setRadius`, `setFont`, `setShadow`, `setSurfaceStyle`, `resetConfig`, `isDefault`, `generateCSS`
|
|
18
|
+
- **`ThemeCustomizer`** — drop-in UI component with color swatch picker, radius preview, font preview, shadow/surface style toggles, "Copy CSS" button, and reset
|
|
19
|
+
- **13 color presets**: 5 neutral (`Zinc`, `Slate`, `Gray`, `Stone`, `Neutral`) + 8 chromatic (`Blue`, `Green`, `Violet`, `Rose`, `Orange`, `Red`, `Teal`, `Brand`)
|
|
20
|
+
- **7 radius presets**: None (0px) through XL (16px), default 10px
|
|
21
|
+
- **5 font presets**: Outfit, Inter, System, Serif, Mono
|
|
22
|
+
- **4 shadow presets**: None, Subtle, Default, Heavy (each with light/dark scales)
|
|
23
|
+
- **3 surface style presets**: Bordered, Elevated, Mixed
|
|
24
|
+
- `ThemeConfig` type, `DEFAULT_THEME_CONFIG`, `buildThemeOverrides()`, `generateThemeCSS()` utilities
|
|
25
|
+
- `COLOR_PRESET_KEYS`, `COLOR_PRESETS`, `getColorPreset`, `getFontPreset`, `getRadiusPreset`, `getShadowPreset` helpers
|
|
26
|
+
- Exported types: `ColorPreset`, `ColorPresetKey`, `FontPreset`, `RadiusPreset`, `ShadowPreset`, `SurfaceStylePreset`, `PresetSemanticColors`, `ThemeCustomizerContextValue`, `ThemeCustomizerProps`, `ThemeCustomizerProviderProps`
|
|
27
|
+
#### New Tokens
|
|
28
|
+
- `neutral` color palette added to `tokens/colors`
|
|
29
|
+
- New CSS custom properties: `--card`, `--card-foreground`, `--popover`, `--popover-foreground`, `--accent`, `--accent-foreground`, `--destructive`, `--destructive-foreground`, `--ring`, `--radius`, `--chart-1` through `--chart-5`, `--sidebar-*` (8 tokens)
|
|
30
|
+
#### Select Sub-component Exports
|
|
31
|
+
- Newly exported: `SelectContent`, `SelectContentProps`, `SelectTrigger`, `SelectTriggerProps`, `SelectValue`, `SelectScrollUpButton`, `SelectScrollUpButtonProps`, `SelectScrollDownButton`, `SelectScrollDownButtonProps`
|
|
32
|
+
### Changed
|
|
33
|
+
#### Color Format: RGB → oklch
|
|
34
|
+
- All color tokens migrated from RGB channel strings (e.g. `"79 70 229"`) to complete `oklch()` values (e.g. `"oklch(0.585 0.233 277.117)"`)
|
|
35
|
+
- Affects all palettes: `slate`, `gray`, `zinc`, `brand`, `blue`, `green`, `red`, `amber`, `teal`
|
|
36
|
+
- Semantic colors (light + dark) updated to use oklch values
|
|
37
|
+
- Shadow tokens updated from `rgba()` to `oklch()` syntax
|
|
38
|
+
- `dsColorVar()` now returns `var(--{name})` and uses `color-mix(in oklch, ...)` for alpha variants instead of `rgb(... / alpha)`
|
|
39
|
+
#### CSS Variable Prefix Removal (`--ds-*` → `--*`)
|
|
40
|
+
- Removed the `PREFIX` constant from `contract.ts`
|
|
41
|
+
- All CSS custom properties simplified: `--ds-color-primary` → `--primary`, `--ds-radius-md` → `--radius-md`, `--ds-shadow-lg` → `--shadow-lg`, `--ds-z-modal` → `--z-modal`, `--ds-duration-fast` → `--duration-fast`, `--ds-easing-standard` → `--easing-standard`, `--ds-font-sans` → `--font-sans`
|
|
42
|
+
- All Tailwind utility classes updated: `bg-ds-primary` → `bg-primary`, `text-ds-foreground` → `text-foreground`, `rounded-ds-md` → `rounded-md`, etc.
|
|
43
|
+
- All 25 components, 3 primitives, and all utilities updated for the new naming
|
|
44
|
+
#### Focus Ring System Overhaul
|
|
45
|
+
- Redesigned from ring-based (`focus-visible:ring-2 focus-visible:ring-ds-focus-ring focus-visible:ring-offset-2`) to border-based (`focus-visible:border-border-strong`) focus indicators
|
|
46
|
+
- All focus ring variants updated: `focusRingClasses`, `focusRingInsetClasses`, `focusRingCompactClasses`, `focusWithinRingClasses`, `focusRingGroupRingClasses`, `focusRingGroupTriggerClasses`
|
|
47
|
+
#### Component Updates
|
|
48
|
+
- **Button** — Added `not-prose no-underline` to base styles to prevent prose typography overrides on `<a>` buttons
|
|
49
|
+
- **Select** — Refactored to compositional sub-component pattern; removed `SelectProps` type (use sub-component props instead)
|
|
50
|
+
- **DropdownMenu** — Major refactor (618 lines changed)
|
|
51
|
+
- **Popover** — Major refactor (332 lines changed)
|
|
52
|
+
- **DataTable** — Updated for new token naming and focus styles
|
|
53
|
+
#### Other
|
|
54
|
+
- Updated `UNIFIED_UI_VERSION` exported constant from `"0.1.1"` to `"0.1.2"`
|
|
55
|
+
- `@theme` block in `styles.css` completely rewritten with plain `--{name}` properties and new token categories
|
|
56
|
+
- `dsVar()` now generates `--{category}-{name}` (was `--ds-{category}-{name}`)
|
|
57
|
+
---
|
|
58
|
+
## [0.1.1] — 2026-02-28
|
|
59
|
+
### Added
|
|
60
|
+
#### DataTable Component
|
|
61
|
+
- **DataTable** — Full-featured data table powered by TanStack Table (`@tanstack/react-table` ≥ 8.0.0)
|
|
62
|
+
- Column sorting, filtering (text + faceted), row selection, column visibility toggles
|
|
63
|
+
- Built-in pagination with configurable page sizes
|
|
64
|
+
- `useDataTable` hook for headless table state management
|
|
65
|
+
- `createColumnHelper` re-export for type-safe column definitions
|
|
66
|
+
- Exported types: `DataTableProps`, `DataTableColumnMeta`, `DataTableFacetedFilter`, `UseDataTableOptions`, `UseDataTableReturn`, `ColumnDef`, `ColumnFiltersState`, `PaginationState`, `Row`, `RowSelectionState`, `SortingState`, `VisibilityState`
|
|
67
|
+
- `@tanstack/react-table` added as an optional peer dependency
|
|
68
|
+
#### Motion Hooks
|
|
69
|
+
- `useMotion()` — hook for accessing motion presets with reduced-motion awareness
|
|
70
|
+
- `useMotionProps()` — hook that returns spread-ready motion props
|
|
71
|
+
- `useMotionSpringConfig()` — hook for accessing spring configuration tokens
|
|
72
|
+
- `useReducedMotion()` — hook for detecting `prefers-reduced-motion` user preference
|
|
73
|
+
- `MotionSafe` — wrapper component that conditionally renders motion based on user preference
|
|
74
|
+
### Changed
|
|
75
|
+
- Updated `UNIFIED_UI_VERSION` exported constant from `"0.1.0"` to `"0.1.1"`
|
|
76
|
+
- Component count updated from 22 to 23 across documentation and metadata
|
|
77
|
+
- Package description updated to reflect 23+ components
|
|
78
|
+
### Fixed
|
|
79
|
+
- Removed self-referential dependency (`@work-rjkashyap/unified-ui` depending on itself) from `package.json`
|
|
80
|
+
- Added missing `homepage` and `bugs` fields to `package.json`
|
|
81
|
+
- Added `funding` field to `package.json`
|
|
82
|
+
- Expanded `keywords` in `package.json` for better npm discoverability (`tailwind-css-v4`, `design-tokens`, `css-variables`, `theming`, `dark-mode`, `typescript`, `tree-shakeable`)
|
|
83
|
+
---
|
|
10
84
|
## [0.1.0] — 2026-02-27
|
|
11
|
-
|
|
12
85
|
### Added
|
|
13
|
-
|
|
14
86
|
#### Design Tokens
|
|
15
|
-
|
|
16
87
|
- Color palettes: `slate`, `gray`, `zinc`, `neutral`, `red`, `green`, `blue`, `amber`, `teal`, `brand`, `pure`
|
|
17
88
|
- Semantic color mappings for light and dark themes (`semanticLight`, `semanticDark`)
|
|
18
89
|
- Spacing scale (0–96 + custom values)
|
|
@@ -21,17 +92,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
21
92
|
- Shadow scale with light and dark variants
|
|
22
93
|
- Z-index scale (`hide`, `base`, `dropdown`, `sticky`, `overlay`, `modal`, `popover`, `toast`, `max`)
|
|
23
94
|
- Motion tokens: `duration`, `easing`, `spring`, `stagger` (with CSS and seconds variants)
|
|
24
|
-
|
|
25
95
|
#### Theme System
|
|
26
|
-
|
|
27
|
-
- CSS variable contract using `--ds-` prefix for all tokens
|
|
96
|
+
- CSS variable contract mapping all tokens to plain CSS custom properties
|
|
28
97
|
- `DSThemeProvider` component with light/dark/system mode support
|
|
29
98
|
- `useDSTheme()` hook for programmatic theme access
|
|
30
99
|
- `buildLightThemeVars()` / `buildDarkThemeVars()` / `buildThemeCSS()` utilities
|
|
31
100
|
- `cssVar()` helper for type-safe CSS variable references
|
|
32
|
-
|
|
33
101
|
#### Typography System
|
|
34
|
-
|
|
35
102
|
- Multi-font architecture with four font families:
|
|
36
103
|
- **Outfit** (`--font-outfit`) — primary sans-serif UI typeface
|
|
37
104
|
- **Inter** (`--font-inter`) — display / headings
|
|
@@ -39,15 +106,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
39
106
|
- **JetBrains Mono** (`--font-jetbrains`) — monospace / code
|
|
40
107
|
- `font` prop on `Typography` component for runtime font switching
|
|
41
108
|
- Graceful fallback to system font stacks when web fonts are unavailable
|
|
42
|
-
|
|
43
109
|
#### Tailwind CSS v4 Integration
|
|
44
|
-
|
|
45
|
-
-
|
|
46
|
-
- `ds-*` prefixed utilities for colors, radius, shadows, transitions, fonts
|
|
110
|
+
- `styles.css` with full `@theme` block mapping all tokens to Tailwind utilities
|
|
111
|
+
- Direct Tailwind utilities for colors, radius, shadows, transitions, fonts (no prefix)
|
|
47
112
|
- Font CSS custom properties (`--font-outfit`, `--font-inter`, `--font-lora`, `--font-jetbrains`)
|
|
48
|
-
|
|
49
113
|
#### Primitive Components
|
|
50
|
-
|
|
51
114
|
- **Typography** — polymorphic text component with `variant`, `font`, `color`, `align`, `truncate` props
|
|
52
115
|
- **Heading** — semantic heading (h1–h6) with automatic size mapping
|
|
53
116
|
- **Subheading** — secondary heading variant
|
|
@@ -60,9 +123,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
60
123
|
- **Stack** — flexbox layout with `direction`, `gap`, `align`, `justify`
|
|
61
124
|
- **Grid** — CSS grid layout with responsive column configuration
|
|
62
125
|
- **Divider** — horizontal/vertical separator with label support
|
|
63
|
-
|
|
64
126
|
#### Composite Components (22 total)
|
|
65
|
-
|
|
66
127
|
- **Button** — primary, secondary, outline, ghost, danger, link variants; sm/md/lg sizes; icon-only mode; loading state
|
|
67
128
|
- **Input** — text input with prefix/suffix slots, error state, disabled state
|
|
68
129
|
- **Textarea** — auto-resize support, character count, error state
|
|
@@ -86,9 +147,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
86
147
|
- **Table** — semantic table with striped rows, hover highlight, sticky header, responsive wrapper; compact/default/relaxed density
|
|
87
148
|
- **Pagination** — page numbers with ellipsis, prev/next, compact variant, controlled/uncontrolled
|
|
88
149
|
- **Breadcrumb** — composable sub-components + `BreadcrumbNav` shorthand; truncation with ellipsis
|
|
89
|
-
|
|
90
150
|
#### Motion System
|
|
91
|
-
|
|
92
151
|
- Fade presets: `fadeIn`, `fadeInFast`, `fadeInSlow`
|
|
93
152
|
- Slide presets: `slideUp`, `slideUpSm`, `slideUpLg`, `slideUpSpring`, `slideDown`, `slideDownSm`, `slideLeft`, `slideRight`, `slideInFromLeft`, `slideInFromRight`, `slideInFromBottom`
|
|
94
153
|
- Scale presets: `scaleIn`, `scaleInLg`, `scaleInSpring`
|
|
@@ -101,9 +160,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
101
160
|
- Stagger containers: `staggerContainer`, `staggerContainerFast`, `staggerContainerSlow`
|
|
102
161
|
- `motionProps()` spread helper for clean JSX usage
|
|
103
162
|
- `reduceMotion` / `withReducedMotion()` utilities for `prefers-reduced-motion` support
|
|
104
|
-
|
|
105
163
|
#### Utilities
|
|
106
|
-
|
|
107
164
|
- `cn()` — class name merger (clsx + tailwind-merge)
|
|
108
165
|
- `mergeSlots()` — slot-based class merging for composite components
|
|
109
166
|
- `composeRefs()` — compose multiple React refs into one
|
|
@@ -112,41 +169,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
112
169
|
- `dsVar()` / `dsColorVar()` — CSS custom property reference helpers
|
|
113
170
|
- `typedKeys()` — type-safe `Object.keys`
|
|
114
171
|
- `noop` — no-operation function
|
|
172
|
+
- Focus ring utilities: `focusRingClasses`, `focusRingInsetClasses`, `focusRingCompactClasses`, `focusWithinRingClasses`, `focusRingGroupRingClasses`, `focusRingGroupTriggerClasses`, `focusRingVariantOverrides`
|
|
173
|
+
- WCAG contrast checking: `checkHexContrast`, `checkDSContrast`, `auditContrast`, `contrastRatio`, `relativeLuminance`, `meetsAA`, `meetsAAA`, `meetsNonTextAA`, `parseHex`, `parseRGBString`, `toRGBString`
|
|
115
174
|
- Polymorphic component types: `AsProp`, `PolymorphicProps`, `PolymorphicPropsWithRef`, `PolymorphicRef`, `PolymorphicComponent`
|
|
116
175
|
- Slot types: `SlotClasses`, `SlotConfig`, `SlotDefinition`, `SlotRenderFn`, `Slots`
|
|
117
176
|
- Component types: `ComponentSize`, `ComponentIntent`, `ChildrenProps`, `OptionalChildrenProps`
|
|
118
|
-
|
|
119
177
|
#### Package & Build
|
|
120
|
-
|
|
121
178
|
- `tsup` build pipeline producing ESM (`.mjs`) and CJS (`.cjs`) with TypeScript declarations (`.d.ts` / `.d.cts`)
|
|
122
179
|
- 7 entry points: `index`, `tokens`, `theme`, `primitives`, `components`, `motion`, `utils`
|
|
123
180
|
- Selective `"use client"` directive — applied only to client entry points (not tokens/utils)
|
|
124
181
|
- Radix UI packages externalized as optional peer dependencies
|
|
125
182
|
- Tree-shakeable with code splitting enabled
|
|
126
|
-
- `
|
|
183
|
+
- `styles.css` exported as `@work-rjkashyap/unified-ui/styles.css` for Tailwind `@theme` integration
|
|
127
184
|
- `@unified-ui/*` TypeScript path aliases (zero relative cross-directory imports)
|
|
128
|
-
- Consumer documentation: `INSTALL.md` with setup guide, font loading, theme provider, import patterns, troubleshooting
|
|
129
|
-
|
|
130
185
|
#### Infrastructure
|
|
131
|
-
|
|
132
186
|
- `UNIFIED_UI_VERSION` exported constant for runtime version checking
|
|
133
187
|
- `.npmignore` for clean package distribution
|
|
134
188
|
- `sideEffects` field for optimal tree-shaking
|
|
135
189
|
- Conditional `exports` map with full `import`/`require`/`types` resolution
|
|
136
|
-
|
|
137
|
-
---
|
|
138
|
-
|
|
139
|
-
## [Unreleased]
|
|
140
|
-
|
|
141
|
-
### Planned
|
|
142
|
-
|
|
143
|
-
- Documentation site overhaul (Phase 6) — MDX pages with interactive component previews
|
|
144
|
-
- Motion & accessibility hardening (Phase 7) — focus ring standardization, WCAG AA contrast audit, `prefers-reduced-motion` audit
|
|
145
|
-
- Migration guide (Phase 9) — mapping from legacy `fd-*` tokens to `ds-*` tokens, component replacement strategy
|
|
146
|
-
- CI/CD pipeline for automated publishing on git tags
|
|
147
|
-
- `UnifiedUIProvider` component for optional auto CSS injection
|
|
148
|
-
|
|
190
|
+
- `typesVersions` fallback for older TypeScript resolvers
|
|
149
191
|
---
|
|
150
|
-
|
|
151
|
-
_Design system: Unified UI v0.1.0_
|
|
192
|
+
_Design system: Unified UI_
|
|
152
193
|
_Maintainer: Rajeshwar Kashyap_
|
|
194
|
+
_Repository: [github.com/imrj05/unified-ui](https://github.com/imrj05/unified-ui)_
|
package/README.md
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
# @work-rjkashyap/unified-ui
|
|
2
2
|
|
|
3
|
-
> A scalable, token-driven React design system built with Tailwind CSS v4, Radix UI, and Framer Motion.
|
|
3
|
+
> A scalable, token-driven React design system with 23+ components, built with Tailwind CSS v4, Radix UI, and Framer Motion.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@work-rjkashyap/unified-ui)
|
|
6
|
+
[](https://www.npmjs.com/package/@work-rjkashyap/unified-ui)
|
|
6
7
|
[](./LICENSE)
|
|
8
|
+
[](https://www.typescriptlang.org/)
|
|
9
|
+
[](https://tailwindcss.com/)
|
|
7
10
|
|
|
8
11
|
---
|
|
9
12
|
|
|
10
13
|
## Features
|
|
11
14
|
|
|
12
15
|
- **Token-driven** — Every color, spacing, radius, shadow, and motion value flows from a single source of truth
|
|
13
|
-
- **
|
|
14
|
-
- **Tailwind CSS v4** — First-class integration via `@theme`
|
|
16
|
+
- **23+ components** — Production-ready composites built on Radix UI primitives
|
|
17
|
+
- **Tailwind CSS v4** — First-class integration via `@theme` with direct utility classes
|
|
15
18
|
- **Framer Motion** — Consistent animation presets with `prefers-reduced-motion` support
|
|
16
19
|
- **Accessible** — WCAG AA contrast, keyboard navigation, ARIA attributes, and focus management
|
|
17
20
|
- **Tree-shakeable** — 7 independent entry points with ESM/CJS dual output and code splitting
|
|
18
21
|
- **Type-safe** — Full TypeScript coverage with exported types for every prop, variant, and token
|
|
22
|
+
- **Dark mode** — CSS variable–based theming with automatic `.dark` class support
|
|
19
23
|
|
|
20
24
|
---
|
|
21
25
|
|
|
@@ -27,18 +31,21 @@ npm install @work-rjkashyap/unified-ui
|
|
|
27
31
|
|
|
28
32
|
### Peer Dependencies
|
|
29
33
|
|
|
30
|
-
| Package
|
|
31
|
-
|
|
|
32
|
-
| `react`
|
|
33
|
-
| `react-dom`
|
|
34
|
-
| `tailwindcss`
|
|
34
|
+
| Package | Version | Required |
|
|
35
|
+
| ------------- | -------- | -------- |
|
|
36
|
+
| `react` | ≥ 19.0.0 | Yes |
|
|
37
|
+
| `react-dom` | ≥ 19.0.0 | Yes |
|
|
38
|
+
| `tailwindcss` | ≥ 4.0.0 | Optional |
|
|
35
39
|
|
|
36
|
-
Radix UI primitives
|
|
40
|
+
Radix UI primitives, Framer Motion, and TanStack Table are optional — install only the ones you use:
|
|
37
41
|
|
|
38
42
|
```bash
|
|
39
43
|
# If using motion presets
|
|
40
44
|
npm install framer-motion
|
|
41
45
|
|
|
46
|
+
# If using the DataTable component
|
|
47
|
+
npm install @tanstack/react-table
|
|
48
|
+
|
|
42
49
|
# If using Radix-based components (Dialog, Select, Tabs, etc.)
|
|
43
50
|
npm install @radix-ui/react-dialog @radix-ui/react-select @radix-ui/react-tabs
|
|
44
51
|
# ... and any other @radix-ui/* packages for the components you need
|
|
@@ -50,7 +57,7 @@ npm install @radix-ui/react-dialog @radix-ui/react-select @radix-ui/react-tabs
|
|
|
50
57
|
|
|
51
58
|
### 1. Import the CSS
|
|
52
59
|
|
|
53
|
-
Add the stylesheet to your global CSS file **before** any component usage. This registers all
|
|
60
|
+
Add the stylesheet to your global CSS file **before** any component usage. This registers all CSS custom properties and Tailwind `@theme` utilities.
|
|
54
61
|
|
|
55
62
|
```css
|
|
56
63
|
/* src/app/globals.css */
|
|
@@ -136,7 +143,7 @@ import { Button, Typography, fadeIn, cn } from "@work-rjkashyap/unified-ui";
|
|
|
136
143
|
import { spacing, radius } from "@work-rjkashyap/unified-ui/tokens";
|
|
137
144
|
import { DSThemeProvider } from "@work-rjkashyap/unified-ui/theme";
|
|
138
145
|
import { Typography, Heading } from "@work-rjkashyap/unified-ui/primitives";
|
|
139
|
-
import { Button, Dialog } from "@work-rjkashyap/unified-ui/components";
|
|
146
|
+
import { Button, Dialog, DataTable } from "@work-rjkashyap/unified-ui/components";
|
|
140
147
|
import { slideUp, motionProps } from "@work-rjkashyap/unified-ui/motion";
|
|
141
148
|
import { cn, mergeSlots } from "@work-rjkashyap/unified-ui/utils";
|
|
142
149
|
```
|
|
@@ -162,36 +169,36 @@ The design system is organized into strict layers. Each layer only depends on th
|
|
|
162
169
|
|
|
163
170
|
Raw design values: colors, spacing, typography, radius, shadows, z-index, and motion timing. The **single source of truth** for all visual properties.
|
|
164
171
|
|
|
165
|
-
| File | Contents
|
|
166
|
-
| --------------- |
|
|
167
|
-
| `colors.ts` | Color palettes + semantic maps for light/dark
|
|
168
|
-
| `spacing.ts` | 4px-grid spacing scale
|
|
169
|
-
| `typography.ts` | Font families, sizes, weights, line heights, letter spacing
|
|
170
|
-
| `radius.ts` | Border radius scale
|
|
171
|
-
| `shadows.ts` | Box shadow elevation scale (light + dark)
|
|
172
|
-
| `z-index.ts` | Z-index layering scale
|
|
173
|
-
| `motion.ts` | Duration, easing, spring, and stagger tokens
|
|
172
|
+
| File | Contents |
|
|
173
|
+
| --------------- | ----------------------------------------------------------- |
|
|
174
|
+
| `colors.ts` | Color palettes + semantic maps for light/dark |
|
|
175
|
+
| `spacing.ts` | 4px-grid spacing scale |
|
|
176
|
+
| `typography.ts` | Font families, sizes, weights, line heights, letter spacing |
|
|
177
|
+
| `radius.ts` | Border radius scale |
|
|
178
|
+
| `shadows.ts` | Box shadow elevation scale (light + dark) |
|
|
179
|
+
| `z-index.ts` | Z-index layering scale |
|
|
180
|
+
| `motion.ts` | Duration, easing, spring, and stagger tokens |
|
|
174
181
|
|
|
175
182
|
### Layer 2 — Theme System (`theme/`)
|
|
176
183
|
|
|
177
184
|
Bridges tokens to runtime via CSS custom properties and React context.
|
|
178
185
|
|
|
179
|
-
| File | Contents
|
|
180
|
-
| -------------- |
|
|
181
|
-
| `contract.ts` | Maps token keys → CSS variable names
|
|
182
|
-
| `provider.tsx` | `DSThemeProvider` + `useDSTheme` hook
|
|
186
|
+
| File | Contents |
|
|
187
|
+
| -------------- | ----------------------------------------------------------- |
|
|
188
|
+
| `contract.ts` | Maps token keys → CSS variable names, `cssVar` helper |
|
|
189
|
+
| `provider.tsx` | `DSThemeProvider` + `useDSTheme` hook |
|
|
183
190
|
|
|
184
191
|
### Layer 3 — Primitives (`primitives/`)
|
|
185
192
|
|
|
186
193
|
Foundational UI building blocks:
|
|
187
194
|
|
|
188
|
-
- **Typography** — `Typography`, `Heading`, `Body`, `Caption`, `Label`, `Overline`, `InlineCode`
|
|
195
|
+
- **Typography** — `Typography`, `Heading`, `Subheading`, `Body`, `Caption`, `Label`, `Overline`, `InlineCode`
|
|
189
196
|
- **Layout** — `Container`, `Stack`, `Grid`
|
|
190
197
|
- **Structural** — `Divider`
|
|
191
198
|
|
|
192
199
|
### Layer 4 — Components (`components/`)
|
|
193
200
|
|
|
194
|
-
|
|
201
|
+
23 production-ready composite components:
|
|
195
202
|
|
|
196
203
|
| Component | Component | Component |
|
|
197
204
|
| -------------- | --------------- | -------------- |
|
|
@@ -202,12 +209,14 @@ Foundational UI building blocks:
|
|
|
202
209
|
| Breadcrumb | Popover | Table |
|
|
203
210
|
| Button | Radio | Tabs |
|
|
204
211
|
| Card | Checkbox | Textarea |
|
|
205
|
-
|
|
|
212
|
+
| DataTable | | Toast / Tooltip|
|
|
206
213
|
|
|
207
214
|
### Layer 5 — Motion (`motion/`)
|
|
208
215
|
|
|
209
216
|
Framer Motion animation presets: `fadeIn`, `slideUp`, `scaleIn`, `modalContent`, `toastSlideIn`, stagger containers, micro-interactions, and reduced-motion utilities.
|
|
210
217
|
|
|
218
|
+
Hooks: `useMotion`, `useMotionProps`, `useMotionSpringConfig`, `useReducedMotion`, and the `MotionSafe` wrapper component.
|
|
219
|
+
|
|
211
220
|
### Layer 6 — Utilities (`utils/`)
|
|
212
221
|
|
|
213
222
|
- `cn()` — class merging (clsx + tailwind-merge)
|
|
@@ -215,41 +224,41 @@ Framer Motion animation presets: `fadeIn`, `slideUp`, `scaleIn`, `modalContent`,
|
|
|
215
224
|
- `composeRefs()` — combine multiple refs
|
|
216
225
|
- `dsAttr()` / `dsStateAttr()` — data attribute generators
|
|
217
226
|
- `dsVar()` / `dsColorVar()` — CSS variable reference helpers
|
|
218
|
-
- Focus ring utilities
|
|
219
|
-
- WCAG contrast checking utilities
|
|
227
|
+
- Focus ring utilities (`focusRingClasses`, `focusRingInsetClasses`, etc.)
|
|
228
|
+
- WCAG contrast checking utilities (`checkHexContrast`, `auditContrast`, etc.)
|
|
220
229
|
- Polymorphic component types
|
|
221
230
|
|
|
222
231
|
---
|
|
223
232
|
|
|
224
233
|
## CSS Variable Prefix
|
|
225
234
|
|
|
226
|
-
All CSS custom properties use
|
|
235
|
+
All CSS custom properties use plain `--` prefix with no namespace infix:
|
|
227
236
|
|
|
228
237
|
```
|
|
229
|
-
--
|
|
230
|
-
--
|
|
231
|
-
--
|
|
232
|
-
--
|
|
233
|
-
--
|
|
234
|
-
--
|
|
238
|
+
--primary
|
|
239
|
+
--radius-md
|
|
240
|
+
--shadow-lg
|
|
241
|
+
--duration-normal
|
|
242
|
+
--easing-standard
|
|
243
|
+
--font-sans
|
|
235
244
|
```
|
|
236
245
|
|
|
237
246
|
### Tailwind Utility Classes
|
|
238
247
|
|
|
239
|
-
After importing the CSS, use
|
|
248
|
+
After importing the CSS, use standard Tailwind utilities:
|
|
240
249
|
|
|
241
250
|
```html
|
|
242
251
|
<!-- Colors (supports opacity modifier) -->
|
|
243
|
-
<div class="bg-
|
|
244
|
-
<div class="bg-
|
|
252
|
+
<div class="bg-primary text-primary-foreground">Primary</div>
|
|
253
|
+
<div class="bg-muted/50">Semi-transparent muted</div>
|
|
245
254
|
|
|
246
255
|
<!-- Radius, shadows, transitions -->
|
|
247
|
-
<div class="rounded-
|
|
248
|
-
<button class="duration-
|
|
256
|
+
<div class="rounded-md shadow-lg">Elevated card</div>
|
|
257
|
+
<button class="duration-fast ease-standard">Animated</button>
|
|
249
258
|
|
|
250
259
|
<!-- Fonts -->
|
|
251
|
-
<p class="font-
|
|
252
|
-
<code class="font-
|
|
260
|
+
<p class="font-serif">Editorial text</p>
|
|
261
|
+
<code class="font-mono">console.log("hello")</code>
|
|
253
262
|
```
|
|
254
263
|
|
|
255
264
|
### Data Attributes
|
|
@@ -268,16 +277,16 @@ Components emit `data-ds` attributes for CSS scoping and testing:
|
|
|
268
277
|
|
|
269
278
|
The package provides 7 independently importable entry points for optimal tree-shaking:
|
|
270
279
|
|
|
271
|
-
| Entry Point
|
|
272
|
-
|
|
|
273
|
-
| Root
|
|
274
|
-
| Tokens
|
|
275
|
-
| Theme
|
|
276
|
-
| Primitives
|
|
277
|
-
| Components
|
|
278
|
-
| Motion
|
|
279
|
-
| Utils
|
|
280
|
-
| CSS
|
|
280
|
+
| Entry Point | Import Path | Contains |
|
|
281
|
+
| ----------- | ---------------------------------------- | --------------------------------- |
|
|
282
|
+
| Root | `@work-rjkashyap/unified-ui` | Everything (barrel) |
|
|
283
|
+
| Tokens | `@work-rjkashyap/unified-ui/tokens` | Design tokens (pure JS, no React) |
|
|
284
|
+
| Theme | `@work-rjkashyap/unified-ui/theme` | Theme provider, contract, hooks |
|
|
285
|
+
| Primitives | `@work-rjkashyap/unified-ui/primitives` | Typography, Layout, Divider |
|
|
286
|
+
| Components | `@work-rjkashyap/unified-ui/components` | All 23 composite components |
|
|
287
|
+
| Motion | `@work-rjkashyap/unified-ui/motion` | Animation presets and utilities |
|
|
288
|
+
| Utils | `@work-rjkashyap/unified-ui/utils` | cn, mergeSlots, contrast, etc. |
|
|
289
|
+
| CSS | `@work-rjkashyap/unified-ui/styles.css` | Tailwind @theme + CSS variables |
|
|
281
290
|
|
|
282
291
|
---
|
|
283
292
|
|
|
@@ -335,14 +344,14 @@ Check the installed version programmatically:
|
|
|
335
344
|
|
|
336
345
|
```tsx
|
|
337
346
|
import { UNIFIED_UI_VERSION } from "@work-rjkashyap/unified-ui";
|
|
338
|
-
console.log(UNIFIED_UI_VERSION); // "0.1.
|
|
347
|
+
console.log(UNIFIED_UI_VERSION); // "0.1.1"
|
|
339
348
|
```
|
|
340
349
|
|
|
341
350
|
---
|
|
342
351
|
|
|
343
352
|
## Troubleshooting
|
|
344
353
|
|
|
345
|
-
### `bg-
|
|
354
|
+
### `bg-primary` and other Tailwind utilities aren't working
|
|
346
355
|
|
|
347
356
|
Make sure you import the CSS **after** `@import "tailwindcss"` in your global stylesheet. The `@theme` block must be processed by Tailwind.
|
|
348
357
|
|
|
@@ -358,8 +367,40 @@ Unified UI uses the `.dark` class on `<html>` for dark mode. Ensure your theme p
|
|
|
358
367
|
|
|
359
368
|
Use layer-specific imports (`@work-rjkashyap/unified-ui/components`) instead of the barrel import to improve tree-shaking.
|
|
360
369
|
|
|
370
|
+
### DataTable peer dependency error
|
|
371
|
+
|
|
372
|
+
The `DataTable` component requires `@tanstack/react-table` ≥ 8.0.0. Install it separately:
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
npm install @tanstack/react-table
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
## Documentation
|
|
381
|
+
|
|
382
|
+
Full interactive documentation with live component previews is available in the monorepo's Next.js docs app. To run it locally:
|
|
383
|
+
|
|
384
|
+
```bash
|
|
385
|
+
git clone https://github.com/imrj05/unified-ui.git
|
|
386
|
+
cd unified-ui
|
|
387
|
+
npm install
|
|
388
|
+
npm run dev
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
## Contributing
|
|
394
|
+
|
|
395
|
+
Contributions are welcome! Please see the [GitHub repository](https://github.com/imrj05/unified-ui) for guidelines.
|
|
396
|
+
|
|
397
|
+
1. Fork the repo and create a feature branch
|
|
398
|
+
2. Make your changes in `packages/unified-ui/src/`
|
|
399
|
+
3. Run `npm run build:ds` to verify the build
|
|
400
|
+
4. Submit a pull request
|
|
401
|
+
|
|
361
402
|
---
|
|
362
403
|
|
|
363
404
|
## License
|
|
364
405
|
|
|
365
|
-
MIT © [Rajeshwar Kashyap](https://github.com/
|
|
406
|
+
MIT © [Rajeshwar Kashyap](https://github.com/imrj05)
|
|
@@ -109,7 +109,7 @@ var DS_LIGHT_CRITICAL_PAIRS = [
|
|
|
109
109
|
},
|
|
110
110
|
// Secondary
|
|
111
111
|
{ label: "secondary-fg on secondary", fg: "24 24 27", bg: "244 244 245" },
|
|
112
|
-
// Muted (zinc.600 = 82 82 91 — matches CSS --
|
|
112
|
+
// Muted (zinc.600 = 82 82 91 — matches CSS --muted-foreground)
|
|
113
113
|
{ label: "muted-fg on background", fg: "82 82 91", bg: "255 255 255" },
|
|
114
114
|
{ label: "muted-fg on muted", fg: "82 82 91", bg: "244 244 245" },
|
|
115
115
|
// Semantic — foreground on solid bg (dark text on bright semantic colors)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/utils/focus-ring.ts
|
|
4
|
+
var focusRingClasses = "focus-visible:outline-none focus-visible:border-border-strong";
|
|
5
|
+
var focusRingClassList = [
|
|
6
|
+
"focus-visible:outline-none",
|
|
7
|
+
"focus-visible:border-border-strong"
|
|
8
|
+
];
|
|
9
|
+
var focusRingInsetClasses = "focus-visible:outline-none focus-visible:border-border-strong";
|
|
10
|
+
var focusRingInsetClassList = [
|
|
11
|
+
"focus-visible:outline-none",
|
|
12
|
+
"focus-visible:border-border-strong"
|
|
13
|
+
];
|
|
14
|
+
var focusRingCompactClasses = "focus-visible:outline-none focus-visible:border-border-strong";
|
|
15
|
+
var focusRingCompactClassList = [
|
|
16
|
+
"focus-visible:outline-none",
|
|
17
|
+
"focus-visible:border-border-strong"
|
|
18
|
+
];
|
|
19
|
+
var focusRingVariantOverrides = {
|
|
20
|
+
/** Override focus border color to danger red */
|
|
21
|
+
danger: "focus-visible:border-danger",
|
|
22
|
+
/** Override focus border color to success green */
|
|
23
|
+
success: "focus-visible:border-success",
|
|
24
|
+
/** Override focus border color to warning amber */
|
|
25
|
+
warning: "focus-visible:border-warning",
|
|
26
|
+
/** Override focus border color to info blue */
|
|
27
|
+
info: "focus-visible:border-info",
|
|
28
|
+
/** Override focus border color to current text color */
|
|
29
|
+
current: "focus-visible:border-current"
|
|
30
|
+
};
|
|
31
|
+
var focusRingGroupTriggerClasses = "focus-visible:outline-none";
|
|
32
|
+
var focusRingGroupRingClasses = "group-focus-visible:border-border-strong";
|
|
33
|
+
var focusWithinRingClasses = "focus-within:outline-none focus-within:border-border-strong";
|
|
34
|
+
var focusWithinRingClassList = [
|
|
35
|
+
"focus-within:outline-none",
|
|
36
|
+
"focus-within:border-border-strong"
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
exports.focusRingClassList = focusRingClassList;
|
|
40
|
+
exports.focusRingClasses = focusRingClasses;
|
|
41
|
+
exports.focusRingCompactClassList = focusRingCompactClassList;
|
|
42
|
+
exports.focusRingCompactClasses = focusRingCompactClasses;
|
|
43
|
+
exports.focusRingGroupRingClasses = focusRingGroupRingClasses;
|
|
44
|
+
exports.focusRingGroupTriggerClasses = focusRingGroupTriggerClasses;
|
|
45
|
+
exports.focusRingInsetClassList = focusRingInsetClassList;
|
|
46
|
+
exports.focusRingInsetClasses = focusRingInsetClasses;
|
|
47
|
+
exports.focusRingVariantOverrides = focusRingVariantOverrides;
|
|
48
|
+
exports.focusWithinRingClassList = focusWithinRingClassList;
|
|
49
|
+
exports.focusWithinRingClasses = focusWithinRingClasses;
|