noorui-rtl 0.4.7 → 0.5.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.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Nuno Marques
3
+ Copyright (c) 2024-2025 Nuno Marques
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
- # Noor UI
1
+ # Noor UI
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/noorui-rtl.svg)](https://www.npmjs.com/package/noorui-rtl)
3
+ > نور - "Light" in Arabic
4
+
5
+ [![npm version](https://badge.fury.io/js/noorui-rtl.svg)](https://www.npmjs.com/package/noorui-rtl)
4
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
7
  [![Storybook](https://img.shields.io/badge/Storybook-Interactive-FF4785?logo=storybook&logoColor=white)](https://storybook.noorui.com)
6
8
 
@@ -8,100 +10,329 @@
8
10
 
9
11
  Beautiful RTL-first React components for bilingual applications. Built with Radix UI, Tailwind CSS, and full Arabic/English support.
10
12
 
11
- ## Features
13
+ **[Documentation](https://noorui.com)** · **[Storybook](https://storybook.noorui.com)** · **[Examples](https://noorui.com/examples)** · **[npm](https://www.npmjs.com/package/noorui-rtl)**
14
+
15
+ ## ✨ Features
12
16
 
13
- **RTL-First Design** - Built from the ground up with RTL languages in mind
14
- 🌍 **Bilingual Support** - Seamless English/Arabic language switching
15
- ♿ **Accessible** - WCAG 2.1 compliant components
16
- 🎨 **Themeable** - Multiple built-in themes with easy customization
17
- 📦 **Tree-shakeable** - Import only what you need
18
- **TypeScript** - Full type safety out of the box
19
- 🕌 **GCC-Specific** - Components for Gulf region markets (Prayer Times, Hijri Calendar, Zakat Calculator)
17
+ - 🌍 **RTL-First**: Perfect Arabic/Persian support with logical properties
18
+ - 🎨 **74+ Components**: Complete UI toolkit for modern applications
19
+ - ♿ **Accessible**: WCAG AA compliant with full keyboard navigation
20
+ - 🎯 **TypeScript**: Full type safety and IntelliSense support
21
+ - 🎭 **Themeable**: Light/dark mode with customizable design tokens
22
+ - 🕌 **GCC-Specific**: Prayer times, Hijri calendar, Arabic numbers, Zakat calculator
23
+ - **Modern Stack**: Next.js 15, React 19, Tailwind CSS, Radix UI
24
+ - 📦 **Tree-shakeable**: Only bundle what you use
20
25
 
21
- ## Installation
26
+ ## 📦 Installation
22
27
 
23
28
  ```bash
24
29
  npm install noorui-rtl
30
+ # or
31
+ yarn add noorui-rtl
32
+ # or
33
+ pnpm add noorui-rtl
34
+ ```
35
+
36
+ ## 🚀 Quick Start
37
+
38
+ ### 1. Install the package
39
+
40
+ ```bash
41
+ npm install noorui-rtl
42
+ ```
43
+
44
+ ### 2. Import the CSS
45
+
46
+ **Option A: Pre-compiled CSS (Recommended - No Tailwind setup needed)**
47
+
48
+ Import the pre-compiled CSS in your root layout or app entry point:
49
+
50
+ ```tsx
51
+ // app/layout.tsx or _app.tsx
52
+ import 'noorui-rtl/dist/styles.css'
53
+ ```
54
+
55
+ This includes all component styles, CSS variables, theme definitions, and RTL support. **No Tailwind configuration required!**
56
+
57
+ **Option B: Tailwind Configuration (For custom Tailwind setups)**
58
+
59
+ If you're already using Tailwind and want to customize the configuration:
60
+
61
+ 1. Update your `tailwind.config.ts`:
62
+
63
+ ```typescript
64
+ import type { Config } from 'tailwindcss'
65
+
66
+ const config: Config = {
67
+ content: [
68
+ './app/**/*.{js,ts,jsx,tsx,mdx}',
69
+ './components/**/*.{js,ts,jsx,tsx,mdx}',
70
+ // Add noorui-rtl components
71
+ './node_modules/noorui-rtl/**/*.{js,ts,jsx,tsx}',
72
+ ],
73
+ theme: {
74
+ extend: {},
75
+ },
76
+ plugins: [],
77
+ }
78
+
79
+ export default config
80
+ ```
81
+
82
+ 2. Add CSS variables to `globals.css`:
83
+
84
+ ```css
85
+ @tailwind base;
86
+ @tailwind components;
87
+ @tailwind utilities;
88
+
89
+ @layer base {
90
+ :root {
91
+ --background: 0 0% 100%;
92
+ --foreground: 222.2 84% 4.9%;
93
+ --card: 0 0% 100%;
94
+ --card-foreground: 222.2 84% 4.9%;
95
+ --popover: 0 0% 100%;
96
+ --popover-foreground: 222.2 84% 4.9%;
97
+ --primary: 222.2 47.4% 11.2%;
98
+ --primary-foreground: 210 40% 98%;
99
+ --secondary: 210 40% 96.1%;
100
+ --secondary-foreground: 222.2 47.4% 11.2%;
101
+ --muted: 210 40% 96.1%;
102
+ --muted-foreground: 215.4 16.3% 46.9%;
103
+ --accent: 210 40% 96.1%;
104
+ --accent-foreground: 222.2 47.4% 11.2%;
105
+ --destructive: 0 84.2% 60.2%;
106
+ --destructive-foreground: 210 40% 98%;
107
+ --border: 214.3 31.8% 91.4%;
108
+ --input: 214.3 31.8% 91.4%;
109
+ --ring: 222.2 84% 4.9%;
110
+ --radius: 0.5rem;
111
+ }
112
+
113
+ .dark {
114
+ --background: 222.2 84% 4.9%;
115
+ --foreground: 210 40% 98%;
116
+ /* ... rest of dark mode variables */
117
+ }
118
+ }
119
+ ```
120
+
121
+ ### 3. Wrap your app with providers
122
+
123
+ Add the theme and direction providers to enable all features:
124
+
125
+ ```tsx
126
+ import { ThemeProvider } from 'next-themes'
127
+ import { DirectionProvider, DesignSystemProvider } from 'noorui-rtl'
128
+
129
+ export default function RootLayout({ children }) {
130
+ return (
131
+ <html>
132
+ <body>
133
+ <ThemeProvider attribute="class" enableSystem={true}>
134
+ <DirectionProvider>
135
+ <DesignSystemProvider defaultTheme="cozy">
136
+ {children}
137
+ </DesignSystemProvider>
138
+ </DirectionProvider>
139
+ </ThemeProvider>
140
+ </body>
141
+ </html>
142
+ )
143
+ }
144
+ ```
145
+
146
+ **What each provider does:**
147
+ - **`ThemeProvider`** (next-themes): Light/Dark mode with system preference support
148
+ - **`DirectionProvider`**: RTL/LTR direction and locale switching (ar/en)
149
+ - **`DesignSystemProvider`**: Design theme variants (minimal/futuristic/cozy/artistic)
150
+
151
+ **Switching themes programmatically:**
152
+
153
+ ```tsx
154
+ import { useDesignSystem } from 'noorui-rtl'
155
+ import { useTheme } from 'next-themes'
156
+ import { useDirection } from 'noorui-rtl'
157
+
158
+ function Settings() {
159
+ const { designTheme, setDesignTheme } = useDesignSystem()
160
+ const { theme, setTheme } = useTheme()
161
+ const { direction, setDirection } = useDirection()
162
+
163
+ return (
164
+ <div>
165
+ {/* Design theme */}
166
+ <select value={designTheme} onChange={(e) => setDesignTheme(e.target.value)}>
167
+ <option value="minimal">Minimal</option>
168
+ <option value="futuristic">Futuristic</option>
169
+ <option value="cozy">Cozy</option>
170
+ <option value="artistic">Artistic</option>
171
+ </select>
172
+
173
+ {/* Light/Dark mode */}
174
+ <button onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}>
175
+ Toggle {theme === 'dark' ? 'Light' : 'Dark'} Mode
176
+ </button>
177
+
178
+ {/* Direction */}
179
+ <button onClick={() => setDirection(direction === 'rtl' ? 'ltr' : 'rtl')}>
180
+ Switch to {direction === 'rtl' ? 'LTR' : 'RTL'}
181
+ </button>
182
+ </div>
183
+ )
184
+ }
185
+ ```
186
+
187
+ ### 4. Start using components
188
+
189
+ ```tsx
190
+ import { Button, Card, CardHeader, CardTitle, CardContent } from 'noorui-rtl'
191
+
192
+ export default function App() {
193
+ return (
194
+ <Card>
195
+ <CardHeader>
196
+ <CardTitle>Welcome to Noor UI</CardTitle>
197
+ </CardHeader>
198
+ <CardContent>
199
+ <Button>Get Started</Button>
200
+ </CardContent>
201
+ </Card>
202
+ )
203
+ }
25
204
  ```
26
205
 
27
- ## Quick Start
206
+ ## 📚 Components
207
+
208
+ ### Core UI (69 components)
209
+
210
+ **Forms**: Button, Input, Label, Textarea, Checkbox, Radio, Select, Switch, Slider, Form
211
+
212
+ **Layout**: Card, Separator, Tabs, Accordion, Collapsible
213
+
214
+ **Navigation**: Breadcrumb, Pagination, Command
215
+
216
+ **Feedback**: Alert, Toast, Progress, Skeleton, Badge, Avatar, Loading Spinner
217
+
218
+ **Overlays**: Dialog, Sheet, Popover, Tooltip, Dropdown Menu, Context Menu
219
+
220
+ **Data**: Table, DataTable, Stats Card, Feature Card, Empty State, Listing Card
221
+
222
+ **Advanced**: File Upload, Rich Text Editor, Date Picker, Time Picker, Number Input, Dashboard Shell, User Menu, Notification Center, Stepper
223
+
224
+ ### GCC-Specific (5 components)
225
+
226
+ - **Prayer Times**: Display Islamic prayer times with countdown and Adhan notifications
227
+ - **Hijri Date**: Dual Gregorian/Hijri calendar display
228
+ - **Arabic Number**: Arabic-Indic numeral utilities and SAR currency formatting
229
+ - **Zakat Calculator**: Calculate Islamic Zakat with export/sharing
230
+ - **Calendar**: Date picker with Hijri support and event markers
231
+
232
+ ### AI/LLM Components (10 experimental) 🧪
233
+
234
+ Chat Message, Streaming Text, Prompt Input, Thinking Indicator, Message Actions, Model Selector, Parameter Slider, Token Counter, Conversation History, Workflow Canvas
235
+
236
+ > Note: AI/LLM components are functional but APIs may evolve based on feedback.
237
+
238
+ ## 🎨 RTL Support
239
+
240
+ All components support RTL out of the box:
28
241
 
29
242
  ```tsx
30
- import { NoorProvider } from 'noorui-rtl';
31
- import 'noorui-rtl/styles.css';
243
+ 'use client'
244
+
245
+ import { useState } from 'react'
246
+ import { Button, Tabs, TabsList, TabsTrigger } from 'noorui-rtl'
247
+
248
+ export default function App() {
249
+ const [direction, setDirection] = useState<'ltr' | 'rtl'>('ltr')
250
+
251
+ return (
252
+ <div dir={direction}>
253
+ <Button onClick={() => setDirection(d => d === 'ltr' ? 'rtl' : 'ltr')}>
254
+ Toggle Direction
255
+ </Button>
256
+
257
+ <Tabs defaultValue="tab1">
258
+ <TabsList>
259
+ <TabsTrigger value="tab1">Tab 1</TabsTrigger>
260
+ <TabsTrigger value="tab2">Tab 2</TabsTrigger>
261
+ </TabsList>
262
+ </Tabs>
263
+ </div>
264
+ )
265
+ }
266
+ ```
267
+
268
+ Components automatically adapt to text direction using logical properties.
269
+
270
+ ## 🔧 Usage with Providers
271
+
272
+ For advanced features like direction context:
273
+
274
+ ```tsx
275
+ import { DirectionProvider, useDirection } from 'noorui-rtl'
32
276
 
33
277
  function App() {
34
278
  return (
35
- <NoorProvider locale="ar" direction="rtl">
279
+ <DirectionProvider>
36
280
  <YourApp />
37
- </NoorProvider>
38
- );
281
+ </DirectionProvider>
282
+ )
283
+ }
284
+
285
+ function YourComponent() {
286
+ const { direction, setDirection, locale } = useDirection()
287
+
288
+ return (
289
+ <button onClick={() => setDirection(direction === 'ltr' ? 'rtl' : 'ltr')}>
290
+ Current: {direction}
291
+ </button>
292
+ )
39
293
  }
40
294
  ```
41
295
 
42
- ## Documentation
43
-
44
- - **[Documentation](https://noorui.com)** - Full documentation and guides
45
- - **[Storybook](https://storybook.noorui.com)** - Interactive component playground with 749 stories
46
- - **[Examples](https://noorui.com/examples)** - Real-world usage examples
47
-
48
- ## Components
49
-
50
- ### Core Components
51
- - Button, Card, Badge, Avatar, Separator, Label, Input
52
- - Alert, Toast, Dialog, Sheet, Popover, Tooltip
53
- - Select, Checkbox, Radio Group, Switch, Slider
54
- - Tabs, Accordion, Collapsible
55
- - Table, Data Table, Pagination
56
- - Command Menu, Dropdown Menu, Context Menu
57
-
58
- ### Advanced Components
59
- - Dashboard Shell
60
- - User Menu
61
- - Notification Center
62
- - Stepper
63
- - File Upload
64
- - Rich Text Editor
65
- - Date Picker, Time Picker
66
- - Number Input
67
-
68
- ### GCC-Specific Components
69
- - Prayer Times
70
- - Hijri Date
71
- - Arabic Number
72
- - Zakat Calculator
73
-
74
- ### AI/LLM Components
75
- - Chat Message
76
- - Prompt Input
77
- - Thinking Indicator
78
- - Message Actions
79
- - Model Selector
80
- - Parameter Slider
81
- - Token Counter
82
- - Conversation History
83
- - Workflow Canvas
84
- - Workflow Node
85
-
86
- ## Requirements
87
-
88
- - React 18+
89
- - Tailwind CSS 3.4+
90
- - Node.js 18+
91
-
92
- ## License
93
-
94
- MIT © [Nuno Marques](https://ositaka.com)
95
-
96
- ## Links
97
-
98
- - 🌐 [Website](https://noorui.com)
99
- - 📚 [Documentation](https://noorui.com/documentation)
100
- - 📖 [Storybook](https://storybook.noorui.com) - Interactive component showcase
101
- - 💬 [Discord Community](https://discord.gg/gvrqU2WG)
102
- - 🐛 [Issues](https://github.com/ositaka/noor-ui/issues)
103
- - 💬 [Discussions](https://github.com/ositaka/noor-ui/discussions)
296
+ ## 📖 Documentation
297
+
298
+ Full documentation, examples, and guides available at **[noorui.com](https://noorui.com)**
299
+
300
+ - [Getting Started](https://noorui.com/getting-started)
301
+ - [Components](https://noorui.com/components)
302
+ - [Storybook](https://storybook.noorui.com) - **Interactive component playground with 749 stories**
303
+ - [RTL Guide](https://noorui.com/rtl-guide)
304
+ - [Examples](https://noorui.com/examples)
305
+ - [Starters](https://noorui.com/starters)
306
+ - [Design Tokens](https://noorui.com/tokens)
307
+
308
+ ## 🤝 Contributing
309
+
310
+ Contributions are welcome! Please read our [Contributing Guide](https://github.com/ositaka/noor-ui/blob/main/CONTRIBUTING.md).
311
+
312
+ ## 📄 License
313
+
314
+ MIT License - see [LICENSE](https://github.com/ositaka/noor-ui/blob/main/LICENSE)
315
+
316
+ ## 🙏 Credits
317
+
318
+ Built with:
319
+ - [Radix UI](https://www.radix-ui.com/) - Accessible component primitives
320
+ - [Tailwind CSS](https://tailwindcss.com/) - Utility-first CSS framework
321
+ - [Lucide React](https://lucide.dev/) - Beautiful icons
322
+ - [Next.js](https://nextjs.org/) - React framework
323
+
324
+ ## 💬 Support
325
+
326
+ - 💬 Discord: [Join our community](https://discord.gg/gvrqU2WG)
327
+ - 📧 Email: info@ositaka.com
328
+ - 🐛 Issues: [GitHub Issues](https://github.com/ositaka/noor-ui/issues)
329
+ - 💬 Discussions: [GitHub Discussions](https://github.com/ositaka/noor-ui/discussions)
330
+ - 🌐 Website: [noorui.com](https://noorui.com)
331
+
332
+ ## 🌟 Show Your Support
333
+
334
+ If you find Noor UI helpful, please give it a ⭐️ on [GitHub](https://github.com/ositaka/noor-ui)!
104
335
 
105
336
  ---
106
337
 
107
- Made with ❤️ for the bilingual web
338
+ **Built with ❤️ for the GCC market by [Nuno Marques](https://ositaka.com)**