@kadoui/react 1.9.8 → 1.9.9

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 (2) hide show
  1. package/README.md +557 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -8,6 +8,14 @@ Primitive components for `React` powered by `Kadoui-css` styles.
8
8
 
9
9
  You can just import them and use easily.
10
10
 
11
+ We recommend use `Kadoui-css` for styling the components:
12
+
13
+ [Read about `Kadoui-css`](https://www.npmjs.com/package/@kadoui/css)
14
+
15
+ Also we recommend use `lucide-react` for icons:
16
+
17
+ [Read about `lucide-react`](https://www.npmjs.com/package/lucide-react)
18
+
11
19
  ### AccessNavigation
12
20
 
13
21
  For add arrow-key nagivations to your UIs.
@@ -126,3 +134,552 @@ or
126
134
  <CopyIcon className="btn-icon-size" />
127
135
  </Clipboard>
128
136
  ```
137
+
138
+ ### ContextMenu
139
+
140
+ ```tsx
141
+ <ContextMenu className="context-menu border-4 border-dashed border-foreground h-[33vh]">
142
+ <span className="absolute inset-center">Context menu!</span>
143
+
144
+ <ContextMenu.Body className="context-menu-body">
145
+ <AccessNavigation className="card card-menu card-y">
146
+ <button className="btn btn-ghost">
147
+ <TrashIcon className="compatible-icon" />
148
+ <span>DELETE</span>
149
+ </button>
150
+ <button className="btn btn-ghost">
151
+ <RefreshCwIcon className="compatible-icon" />
152
+ <span>RELOAD</span>
153
+ </button>
154
+ <button className="btn btn-ghost">
155
+ <FlagIcon className="compatible-icon" />
156
+ <span>IGNORE IT</span>
157
+ </button>
158
+ </AccessNavigation>
159
+ </ContextMenu.Body>
160
+ </ContextMenu>
161
+ ```
162
+
163
+ ### Drawer
164
+
165
+ ```tsx
166
+ <Drawer>
167
+ <Drawer.Toggle className="btn btn-soft">Open left drawer</Drawer.Toggle>
168
+
169
+ <Drawer.Portal className="drawer-portal">
170
+ <Drawer.Body className="drawer-body">
171
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum porro vero delectus
172
+ eum qui laboriosam, dolore veritatis eligendi amet voluptatibus incidunt temporibus
173
+ dolores fuga adipisci eius saepe quod aspernatur iure.
174
+ </Drawer.Body>
175
+ </Drawer.Portal>
176
+ </Drawer>
177
+ ```
178
+
179
+ or
180
+
181
+ ```tsx
182
+ <Drawer>
183
+ <Drawer.Toggle className="btn btn-soft">Open top drawer</Drawer.Toggle>
184
+
185
+ <Drawer.Portal className="drawer-portal">
186
+ <Drawer.Body
187
+ className="drawer-body"
188
+ position="top">
189
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum porro vero delectus
190
+ eum qui laboriosam, dolore veritatis eligendi amet voluptatibus incidunt temporibus
191
+ dolores fuga adipisci eius saepe quod aspernatur iure.
192
+ </Drawer.Body>
193
+ </Drawer.Portal>
194
+ </Drawer>
195
+ ```
196
+
197
+ or
198
+
199
+ ```tsx
200
+ <Drawer>
201
+ <Drawer.Toggle className="btn btn-soft">Open right drawer</Drawer.Toggle>
202
+
203
+ <Drawer.Portal className="drawer-portal">
204
+ <Drawer.Body
205
+ className="drawer-body"
206
+ position="right">
207
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum porro vero delectus
208
+ eum qui laboriosam, dolore veritatis eligendi amet voluptatibus incidunt temporibus
209
+ dolores fuga adipisci eius saepe quod aspernatur iure.
210
+ </Drawer.Body>
211
+ </Drawer.Portal>
212
+ </Drawer>
213
+ ```
214
+
215
+ or
216
+
217
+ ```tsx
218
+ <Drawer>
219
+ <Drawer.Toggle className="btn btn-soft">Open bottom drawer</Drawer.Toggle>
220
+
221
+ <Drawer.Portal className="drawer-portal">
222
+ <Drawer.Body
223
+ className="drawer-body"
224
+ position="bottom">
225
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum porro vero delectus
226
+ eum qui laboriosam, dolore veritatis eligendi amet voluptatibus incidunt temporibus
227
+ dolores fuga adipisci eius saepe quod aspernatur iure.
228
+ </Drawer.Body>
229
+ </Drawer.Portal>
230
+ </Drawer>
231
+ ```
232
+
233
+ ### Modal
234
+
235
+ ```tsx
236
+ <Modal>
237
+ <Modal.Toggle className="btn btn-soft">Open modal</Modal.Toggle>
238
+
239
+ <Modal.Portal className="modal-portal">
240
+ <Modal.Body className="modal-body">
241
+ <Modal.Header className="modal-header font-bold justify-center">
242
+ Say hello to modal
243
+ </Modal.Header>
244
+ <Modal.Content className="modal-content max-w-xl">
245
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos, ratione
246
+ repudiandae eveniet quisquam, vitae, nobis iure voluptas harum est incidunt odio?
247
+ Dolorem quod numquam placeat sed beatae, natus cum porro!
248
+ </Modal.Content>
249
+ </Modal.Body>
250
+ </Modal.Portal>
251
+ </Modal>
252
+ ```
253
+
254
+ ### OTP
255
+
256
+ ```tsx
257
+ <Otp className="otp">
258
+ <Otp.Inputs
259
+ length={6}
260
+ className="input input-outline input-square"
261
+ onLastChange={(otp) => alert(otp)}
262
+ />
263
+
264
+ <Otp.HiddenInput />
265
+ </Otp>
266
+ ```
267
+
268
+ ### Pagination
269
+
270
+ With state:
271
+
272
+ ```tsx
273
+ <PaginationWithState pagesLength={6}>
274
+ <div className="pagination">
275
+ <PaginationWithState.PrevBtn className="btn btn-soft btn-square">
276
+ <ChevronLeftIcon className="btn-icon-size" />
277
+ </PaginationWithState.PrevBtn>
278
+
279
+ <PaginationWithState.Counts className="btn data-[state=false]:btn-ghost data-[state=true]:btn-fill" />
280
+
281
+ <PaginationWithState.NextBtn className="btn btn-soft btn-square">
282
+ <ChevronRightIcon className="btn-icon-size" />
283
+ </PaginationWithState.NextBtn>
284
+ </div>
285
+ </PaginationWithState>
286
+ ```
287
+
288
+ With search params:
289
+
290
+ ```tsx
291
+ <Suspense>
292
+ <PaginationWithSearchParams pagesLength={6}>
293
+ <div className="pagination">
294
+ <PaginationWithSearchParams.PrevBtn className="btn btn-soft btn-square">
295
+ <ChevronLeftIcon className="btn-icon-size" />
296
+ </PaginationWithSearchParams.PrevBtn>
297
+
298
+ <PaginationWithSearchParams.Counts className="btn data-[state=false]:btn-ghost data-[state=true]:btn-fill" />
299
+
300
+ <PaginationWithSearchParams.NextBtn className="btn btn-soft btn-square">
301
+ <ChevronRightIcon className="btn-icon-size" />
302
+ </PaginationWithSearchParams.NextBtn>
303
+ </div>
304
+ </PaginationWithSearchParams>
305
+ </Suspense>
306
+ ```
307
+
308
+ ### Pagination with pages
309
+
310
+ With state:
311
+
312
+ ```tsx
313
+ const PAGES_WITH_STATE = [
314
+ {
315
+ name: "Hello world",
316
+ component: (
317
+ <p>
318
+ One: Lorem ipsum, dolor sit amet consectetur adipisicing elit. Quis officiis quia,
319
+ dolores similique, cumque ut vel aspernatur non vitae voluptas reiciendis? Veniam,
320
+ voluptates impedit soluta blanditiis ad nam eligendi dignissimos.
321
+ </p>
322
+ ),
323
+ },
324
+ {
325
+ name: "Finish",
326
+ component: (
327
+ <p>
328
+ Two: Lorem ipsum, dolor sit amet consectetur adipisicing elit. Quis officiis quia,
329
+ dolores similique, cumque ut vel aspernatur non vitae voluptas reiciendis? Veniam,
330
+ voluptates impedit soluta blanditiis ad nam eligendi dignissimos.
331
+ </p>
332
+ ),
333
+ },
334
+ ];
335
+
336
+ <PaginationWithState pages={PAGES_WITH_STATE}>
337
+ <div className="max-w-96">
338
+ <PaginationWithState.Pages />
339
+
340
+ <div className="pagination">
341
+ <PaginationWithState.PrevBtn className="btn btn-soft btn-square">
342
+ <ChevronLeftIcon className="btn-icon-size" />
343
+ </PaginationWithState.PrevBtn>
344
+
345
+ <PaginationWithState.Counts className="btn data-[state=false]:btn-ghost data-[state=true]:btn-fill" />
346
+
347
+ <PaginationWithState.NextBtn className="btn btn-soft btn-square">
348
+ <ChevronRightIcon className="btn-icon-size" />
349
+ </PaginationWithState.NextBtn>
350
+ </div>
351
+ </div>
352
+ </PaginationWithState>;
353
+ ```
354
+
355
+ With search params:
356
+
357
+ ```tsx
358
+ const PAGES_WITH_SEARCHPARAMS = [
359
+ {
360
+ name: "Hello world",
361
+ component: (
362
+ <p>
363
+ One: Lorem ipsum, dolor sit amet consectetur adipisicing elit. Quis officiis quia,
364
+ dolores similique, cumque ut vel aspernatur non vitae voluptas reiciendis? Veniam,
365
+ voluptates impedit soluta blanditiis ad nam eligendi dignissimos.
366
+ </p>
367
+ ),
368
+ },
369
+ {
370
+ name: "Finish",
371
+ component: (
372
+ <p>
373
+ Two: Lorem ipsum, dolor sit amet consectetur adipisicing elit. Quis officiis quia,
374
+ dolores similique, cumque ut vel aspernatur non vitae voluptas reiciendis? Veniam,
375
+ voluptates impedit soluta blanditiis ad nam eligendi dignissimos.
376
+ </p>
377
+ ),
378
+ },
379
+ ];
380
+
381
+ <Suspense>
382
+ <PaginationWithSearchParams pages={PAGES_WITH_SEARCHPARAMS}>
383
+ <div className="max-w-96">
384
+ <PaginationWithSearchParams.Pages />
385
+
386
+ <div className="pagination">
387
+ <PaginationWithSearchParams.PrevBtn className="btn btn-soft btn-square">
388
+ <ChevronLeftIcon className="btn-icon-size" />
389
+ </PaginationWithSearchParams.PrevBtn>
390
+
391
+ <PaginationWithSearchParams.Counts className="btn data-[state=false]:btn-ghost data-[state=true]:btn-fill" />
392
+
393
+ <PaginationWithSearchParams.NextBtn className="btn btn-soft btn-square">
394
+ <ChevronRightIcon className="btn-icon-size" />
395
+ </PaginationWithSearchParams.NextBtn>
396
+ </div>
397
+ </div>
398
+ </PaginationWithSearchParams>
399
+ </Suspense>;
400
+ ```
401
+
402
+ ### PasswordInput
403
+
404
+ ```tsx
405
+ <PasswordInput className="input input-outline">
406
+ <PasswordInput.Field className="input-field" />
407
+ <PasswordInput.Toggle
408
+ className="btn btn-ghost btn-sm"
409
+ visibleChildren={<EyeIcon className="btn-icon-size" />}>
410
+ <EyeClosedIcon className="btn-icon-size" />
411
+ </PasswordInput.Toggle>
412
+ </PasswordInput>
413
+ ```
414
+
415
+ ### Popover
416
+
417
+ ```tsx
418
+ <Popover
419
+ className="popover"
420
+ mode="hover">
421
+ <Popover.Toggle className="btn btn-soft">Hover me</Popover.Toggle>
422
+
423
+ <Popover.Body className="popover-body popover-body-b card card-menu max-w-[200%]">
424
+ Lorem ipsum dolor sit amet, consectetur adipisicing.
425
+ </Popover.Body>
426
+ </Popover>
427
+ ```
428
+
429
+ or
430
+
431
+ ```tsx
432
+ <Popover
433
+ className="popover"
434
+ mode="both">
435
+ <Popover.Toggle className="btn btn-soft">Hover and click me</Popover.Toggle>
436
+
437
+ <Popover.Body className="popover-body popover-body-b card card-menu max-w-[200%]">
438
+ Lorem ipsum dolor sit amet, consectetur adipisicing.
439
+ </Popover.Body>
440
+ </Popover>
441
+ ```
442
+
443
+ or
444
+
445
+ ```tsx
446
+ <Popover
447
+ className="popover"
448
+ mode="click">
449
+ <Popover.Toggle className="btn btn-soft">Click me</Popover.Toggle>
450
+
451
+ <Popover.Body className="popover-body popover-body-b card card-menu max-w-[200%]">
452
+ Lorem ipsum dolor sit amet, consectetur adipisicing.
453
+ </Popover.Body>
454
+ </Popover>
455
+ ```
456
+
457
+ ### Portal
458
+
459
+ ```tsx
460
+ <Portal>
461
+ <p>
462
+ Lorem ipsum dolor sit, amet consectetur adipisicing elit. Similique placeat eligendi
463
+ dolore adipisci sunt magni quo accusamus commodi rerum excepturi! Temporibus
464
+ molestias, et nesciunt ut aut labore quod nihil magni?
465
+ </p>
466
+ </Portal>
467
+ ```
468
+
469
+ ### Progress
470
+
471
+ ```tsx
472
+ <Progress
473
+ className="progress"
474
+ value={45}>
475
+ <Progress.Bar className="progress-bar" />
476
+ </Progress>
477
+ ```
478
+
479
+ ### QrCode
480
+
481
+ ```tsx
482
+ <QrCode
483
+ className="w-96 rounded-lg"
484
+ value="https://github.com/FarzadVav"
485
+ options={{ width: 384 }}
486
+ />
487
+ ```
488
+
489
+ ### Rating
490
+
491
+ ```tsx
492
+ const [rating, setRating] = useState(3);
493
+
494
+ <Rating className="rating">
495
+ <Rating.Items
496
+ className="rating-items"
497
+ count={5}
498
+ value={rating}
499
+ onValueChange={setRating}
500
+ element={<StarIcon className="size-9" />}
501
+ activeElement={<StarIcon className="fill-foreground size-9" />}
502
+ />
503
+ </Rating>;
504
+ ```
505
+
506
+ ### Sheet
507
+
508
+ ```tsx
509
+ <Sheet>
510
+ <Sheet.Toggle className="btn btn-soft">Open sheet</Sheet.Toggle>
511
+
512
+ <Sheet.Portal className="sheet-portal">
513
+ <Sheet.Body className="sheet-body">
514
+ <Sheet.Header className="sheet-header">
515
+ <Sheet.Handlebar className="sheet-handlebar" />
516
+ </Sheet.Header>
517
+
518
+ <Sheet.Content className="sheet-content">
519
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Molestiae explicabo
520
+ numquam sed dolorem nesciunt repellat deleniti quisquam laudantium? Quas ullam
521
+ magni voluptate esse animi vero dicta maxime mollitia amet dolor.
522
+ </Sheet.Content>
523
+ </Sheet.Body>
524
+ </Sheet.Portal>
525
+ </Sheet>
526
+ ```
527
+
528
+ ### ShowMore
529
+
530
+ ```tsx
531
+ <ShowMore
532
+ className="max-w-96"
533
+ maxLines={3}>
534
+ <ShowMore.Content>
535
+ Lorem ipsum dolor sit, amet consectetur adipisicing elit. Accusantium exercitationem
536
+ repellendus debitis, dignissimos non quis! Fugit ducimus adipisci minus quas est
537
+ expedita, voluptatibus minima ad facere quis, dolor ipsum debitis!
538
+ </ShowMore.Content>
539
+
540
+ <ShowMore.Fade className="show-more-fade" />
541
+
542
+ <ShowMore.Toggle className="btn btn-soft mt-1.5">Show more</ShowMore.Toggle>
543
+ </ShowMore>
544
+ ```
545
+
546
+ ### Spoiler
547
+
548
+ ```tsx
549
+ <p>
550
+ Lorem ipsum dolor sit{" "}
551
+ <Spoiler className="spoiler">
552
+ <Spoiler.Blur className="spoiler-blur">amet consectetur adipisicing</Spoiler.Blur>
553
+ </Spoiler>{" "}
554
+ elit. Officiis nemo incidunt tenetur assumenda consequuntur beatae harum iusto, libero
555
+ labore! Ea quo dolore accusantium veniam illo vel quae nihil iure aliquid.
556
+ </p>
557
+ ```
558
+
559
+ ### Submit
560
+
561
+ ```tsx
562
+ <form
563
+ action={async () => {
564
+ await new Promise((resolve) => setTimeout(resolve, 1000));
565
+ }}>
566
+ <Submit className="btn btn-soft">
567
+ <span>Press the from</span>
568
+ <Submit.Loader loader={<LoaderIcon className="btn-icon-size animate-spin" />}>
569
+ <SendHorizonalIcon className="btn-icon-size" />
570
+ </Submit.Loader>
571
+ </Submit>
572
+ </form>
573
+ ```
574
+
575
+ ### Swap
576
+
577
+ ```tsx
578
+ const SWAP_KEYS = ["one", "two", "three"];
579
+
580
+ const [swapKey, setSwapKey] = useState(SWAP_KEYS[0] as string);
581
+
582
+ <Swap
583
+ keys={SWAP_KEYS}
584
+ activeKey={swapKey}
585
+ setActiveKey={setSwapKey}>
586
+ <Swap.Btn
587
+ className="btn btn-soft"
588
+ btnKey={SWAP_KEYS[0] as string}
589
+ />
590
+
591
+ <Swap.Btn
592
+ className="btn btn-soft"
593
+ btnKey={SWAP_KEYS[1] as string}
594
+ />
595
+
596
+ <Swap.Btn
597
+ className="btn btn-soft"
598
+ btnKey={SWAP_KEYS[2] as string}
599
+ />
600
+ </Swap>;
601
+ ```
602
+
603
+ ### Tabs
604
+
605
+ ```tsx
606
+ const [activeTab, setActiveTab] = useState("1");
607
+
608
+ <Tabs
609
+ activeTab={activeTab}
610
+ setActiveTab={setActiveTab}>
611
+ <AccessNavigation direction="x">
612
+ <Tabs.List className="tabs-list join-border">
613
+ <Tabs.Tab
614
+ value="1"
615
+ className="btn data-[state=false]:btn-soft data-[state=true]:btn-fill">
616
+ Tab 1
617
+ </Tabs.Tab>
618
+ <Tabs.Tab
619
+ value="2"
620
+ className="btn data-[state=false]:btn-soft data-[state=true]:btn-fill">
621
+ Tab 2
622
+ </Tabs.Tab>
623
+ <Tabs.Tab
624
+ value="3"
625
+ className="btn data-[state=false]:btn-soft data-[state=true]:btn-fill">
626
+ Tab 3
627
+ </Tabs.Tab>
628
+ </Tabs.List>
629
+ </AccessNavigation>
630
+
631
+ <Tabs.Panel
632
+ className="tabs-panel card-lg"
633
+ key={"1"}
634
+ value="1">
635
+ Tab 1: Lorem, ipsum dolor sit amet consectetur adipisicing elit. Voluptates, animi
636
+ nisi, magni quis dolore cum molestias ipsam accusantium sunt repudiandae repellendus
637
+ perspiciatis cumque unde commodi reprehenderit distinctio nostrum quisquam nihil?
638
+ </Tabs.Panel>
639
+
640
+ <Tabs.Panel
641
+ className="tabs-panel card-lg"
642
+ key={"2"}
643
+ value="2">
644
+ Tab 2: Lorem, ipsum dolor sit amet consectetur adipisicing elit. Voluptates, animi
645
+ nisi, magni quis dolore cum molestias ipsam accusantium sunt repudiandae quisquam
646
+ nihil?
647
+ </Tabs.Panel>
648
+
649
+ <Tabs.Panel
650
+ className="tabs-panel card-lg"
651
+ key={"3"}
652
+ value="3">
653
+ Tab 3: Lorem, ipsum dolor sit amet consectetur adipisicing elit. Voluptates, animi
654
+ nisi, magni quis dolore cum molestias ipsam accusantium sunt repudiandae repellendus
655
+ perspiciatis cumque unde commodi reprehenderit distinctio nostrum quisquam nihil?
656
+ <br />
657
+ Lorem ipsum dolor sit amet consectetur, adipisicing elit. Fugiat ut corporis sequi
658
+ expedita deserunt aliquid iste facere, nisi ipsa iure ad nostrum animi. Adipisci
659
+ placeat eos laborum error magnam officiis necessitatibus illo commodi a, aperiam
660
+ tempora alias voluptatum eveniet, atque quas dolores, facilis architecto quisquam
661
+ ipsum dolore officia debitis facere! Dicta iste consectetur, illo amet obcaecati aut
662
+ error, ipsam optio at earum odio laudantium voluptatibus? Nemo, nisi debitis et, nam
663
+ voluptas tempora ipsa ipsum culpa nobis perferendis ipsam cumque blanditiis quos
664
+ corrupti, rerum eos? Sapiente fugiat voluptatibus laborum culpa at. Quidem, suscipit
665
+ perferendis. Illum doloribus in cumque fuga laboriosam dignissimos!
666
+ </Tabs.Panel>
667
+ </Tabs>;
668
+ ```
669
+
670
+ ### LinkLoader
671
+
672
+ ```tsx
673
+ <Link
674
+ className="btn btn-soft mt-6"
675
+ href={"/test"}>
676
+ <span>Test page</span>
677
+ <LinkLoader loader={<LoaderIcon className="btn-icon-size animate-spin" />}>
678
+ <ArrowRightIcon className="btn-icon-size" />
679
+ </LinkLoader>
680
+ </Link>
681
+ ```
682
+
683
+ ---
684
+
685
+ Written with ❤️ by [Farzad Vahdati](https://github.com/FarzadVav)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kadoui/react",
3
- "version": "1.9.8",
3
+ "version": "1.9.9",
4
4
  "description": "Kadoui primitive components for React",
5
5
  "author": "FarzadVav",
6
6
  "license": "MIT",