@yimingliao/cms 0.0.85 → 0.0.86

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.
@@ -356,6 +356,32 @@ declare const buttonVariants: (props?: ({
356
356
  type ButtonProps$1 = React$1.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
357
357
  asChild?: boolean;
358
358
  };
359
+ declare function Button$1({ className, variant, size, asChild, ...props }: ButtonProps$1): react_jsx_runtime.JSX.Element;
360
+
361
+ declare function Card({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
362
+ declare function CardHeader({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
363
+ declare function CardTitle({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
364
+ declare function CardDescription({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
365
+ declare function CardAction({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
366
+ declare function CardContent({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
367
+ declare function CardFooter({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
368
+
369
+ declare function InputGroup({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
370
+ declare const inputGroupAddonVariants: (props?: ({
371
+ align?: "inline-start" | "inline-end" | "block-start" | "block-end" | null | undefined;
372
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
373
+ declare function InputGroupAddon({ className, align, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>): react_jsx_runtime.JSX.Element;
374
+ declare const inputGroupButtonVariants: (props?: ({
375
+ size?: "sm" | "icon-sm" | "xs" | "icon-xs" | null | undefined;
376
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
377
+ declare function InputGroupButton({ className, type, variant, size, ...props }: Omit<React$1.ComponentProps<typeof Button$1>, "size"> & VariantProps<typeof inputGroupButtonVariants>): react_jsx_runtime.JSX.Element;
378
+ declare function InputGroupText({ className, ...props }: React$1.ComponentProps<"span">): react_jsx_runtime.JSX.Element;
379
+ declare function InputGroupInput({ className, ...props }: React$1.ComponentProps<"input">): react_jsx_runtime.JSX.Element;
380
+ declare function InputGroupTextarea({ className, ...props }: React$1.ComponentProps<"textarea">): react_jsx_runtime.JSX.Element;
381
+
382
+ declare function Spinner({ className, ...props }: ComponentProps<"svg">): react_jsx_runtime.JSX.Element;
383
+
384
+ declare function Textarea({ className, ...props }: React$1.ComponentProps<"textarea">): react_jsx_runtime.JSX.Element;
359
385
 
360
386
  interface ButtonProps extends ButtonProps$1, UIStates {
361
387
  icon?: LucideIcon;
@@ -368,12 +394,8 @@ interface InputProps<T = Record<string, unknown>> extends ComponentProps<"input"
368
394
  }
369
395
  declare function Input<T>({ fieldName, setFormData, isLoading, isDisabled, isError, children, ...props }: InputProps<T>): react_jsx_runtime.JSX.Element;
370
396
 
371
- declare function AuthForm({ title, children, className, ...props }: ComponentProps<"form"> & {
372
- title: string;
373
- }): react_jsx_runtime.JSX.Element;
374
-
375
397
  declare const cn: (...inputs: ClassValue[]) => string;
376
398
 
377
399
  declare function useDeviceInfo(): DeviceInfo | null;
378
400
 
379
- export { AdminProvider, AuthForm, Button, type ButtonProps, Form, Input, type InputProps, type ShowToastOption, cn, createAdminInitializer, createRequestInterceptor, createResponseInterceptor, createSmartFetch, createUseCommand, createUseQuery, handleToast, useAdmin, useDeviceInfo };
401
+ export { AdminProvider, Button, type ButtonProps, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Form, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type InputProps, type ShowToastOption, Spinner, Textarea, cn, createAdminInitializer, createRequestInterceptor, createResponseInterceptor, createSmartFetch, createUseCommand, createUseQuery, handleToast, useAdmin, useDeviceInfo };
@@ -2,7 +2,7 @@ import { ensureArray } from '../chunk-OAENV763.js';
2
2
  import { toast } from 'sonner';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { useMutation, useQuery } from '@tanstack/react-query';
5
- import * as React2 from 'react';
5
+ import * as React6 from 'react';
6
6
  import { createContext, useState, useContext, useEffect } from 'react';
7
7
  import { clsx } from 'clsx';
8
8
  import { twMerge } from 'tailwind-merge';
@@ -325,48 +325,82 @@ function Button({
325
325
  }
326
326
  );
327
327
  }
328
- function Spinner({ className, ...props }) {
328
+ function Card({ className, ...props }) {
329
329
  return /* @__PURE__ */ jsx(
330
- Loader2Icon,
330
+ "div",
331
331
  {
332
- role: "status",
333
- "aria-label": "Loading",
334
- className: cn("size-4 animate-spin", className),
332
+ "data-slot": "card",
333
+ className: cn(
334
+ "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
335
+ className
336
+ ),
335
337
  ...props
336
338
  }
337
339
  );
338
340
  }
339
- function Button2({
340
- icon,
341
- href,
342
- openNewTab = false,
343
- // ui states
344
- isDisabled = false,
345
- isLoading = false,
346
- // base
347
- children,
348
- ...props
349
- }) {
350
- const router = useRouter();
351
- const handleClick = () => {
352
- if (!href) return;
353
- if (openNewTab) {
354
- window.open(href, "_blank");
355
- } else {
356
- router.push(href);
341
+ function CardHeader({ className, ...props }) {
342
+ return /* @__PURE__ */ jsx(
343
+ "div",
344
+ {
345
+ "data-slot": "card-header",
346
+ className: cn(
347
+ "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
348
+ className
349
+ ),
350
+ ...props
357
351
  }
358
- };
352
+ );
353
+ }
354
+ function CardTitle({ className, ...props }) {
359
355
  return /* @__PURE__ */ jsx(
360
- Button,
356
+ "div",
361
357
  {
362
- type: props.type ?? "button",
363
- disabled: isDisabled || isLoading,
364
- onClick: props.onClick ?? handleClick,
365
- ...props,
366
- children: isLoading ? /* @__PURE__ */ jsx(Spinner, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [
367
- icon && React2.createElement(icon),
368
- children
369
- ] })
358
+ "data-slot": "card-title",
359
+ className: cn("leading-none font-semibold", className),
360
+ ...props
361
+ }
362
+ );
363
+ }
364
+ function CardDescription({ className, ...props }) {
365
+ return /* @__PURE__ */ jsx(
366
+ "div",
367
+ {
368
+ "data-slot": "card-description",
369
+ className: cn("text-muted-foreground text-sm", className),
370
+ ...props
371
+ }
372
+ );
373
+ }
374
+ function CardAction({ className, ...props }) {
375
+ return /* @__PURE__ */ jsx(
376
+ "div",
377
+ {
378
+ "data-slot": "card-action",
379
+ className: cn(
380
+ "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
381
+ className
382
+ ),
383
+ ...props
384
+ }
385
+ );
386
+ }
387
+ function CardContent({ className, ...props }) {
388
+ return /* @__PURE__ */ jsx(
389
+ "div",
390
+ {
391
+ "data-slot": "card-content",
392
+ className: cn("px-6", className),
393
+ ...props
394
+ }
395
+ );
396
+ }
397
+ function CardFooter({ className, ...props }) {
398
+ return /* @__PURE__ */ jsx(
399
+ "div",
400
+ {
401
+ "data-slot": "card-footer",
402
+ className: cn("flex items-center px-6 [.border-t]:pt-6", className),
403
+ ...props
370
404
  }
371
405
  );
372
406
  }
@@ -386,6 +420,21 @@ function Input({ className, type, ...props }) {
386
420
  }
387
421
  );
388
422
  }
423
+ function Textarea({ className, ...props }) {
424
+ return /* @__PURE__ */ jsx(
425
+ "textarea",
426
+ {
427
+ "data-slot": "textarea",
428
+ className: cn(
429
+ // "min-h-16",
430
+ // "field-sizing-content",
431
+ "border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
432
+ className
433
+ ),
434
+ ...props
435
+ }
436
+ );
437
+ }
389
438
  function InputGroup({ className, ...props }) {
390
439
  return /* @__PURE__ */ jsx(
391
440
  "div",
@@ -448,7 +497,7 @@ function InputGroupAddon({
448
497
  }
449
498
  );
450
499
  }
451
- cva(
500
+ var inputGroupButtonVariants = cva(
452
501
  "text-sm shadow-none flex gap-2 items-center",
453
502
  {
454
503
  variants: {
@@ -464,106 +513,140 @@ cva(
464
513
  }
465
514
  }
466
515
  );
467
- function InputGroupInput({
516
+ function InputGroupButton({
468
517
  className,
518
+ type = "button",
519
+ variant = "ghost",
520
+ size = "xs",
469
521
  ...props
470
522
  }) {
471
523
  return /* @__PURE__ */ jsx(
472
- Input,
524
+ Button,
525
+ {
526
+ type,
527
+ "data-size": size,
528
+ variant,
529
+ className: cn(inputGroupButtonVariants({ size }), className),
530
+ ...props
531
+ }
532
+ );
533
+ }
534
+ function InputGroupText({ className, ...props }) {
535
+ return /* @__PURE__ */ jsx(
536
+ "span",
473
537
  {
474
- "data-slot": "input-group-control",
475
538
  className: cn(
476
- "flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",
539
+ "text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
477
540
  className
478
541
  ),
479
542
  ...props
480
543
  }
481
544
  );
482
545
  }
483
- function Input2({
484
- // form context
485
- fieldName,
486
- setFormData,
487
- // ui states
488
- isLoading = false,
489
- isDisabled = false,
490
- isError = false,
491
- // base
492
- children,
546
+ function InputGroupInput({
547
+ className,
493
548
  ...props
494
549
  }) {
495
- return /* @__PURE__ */ jsxs(InputGroup, { "data-disabled": isDisabled || isLoading, children: [
496
- isLoading ? /* @__PURE__ */ jsx(InputGroupAddon, { children: /* @__PURE__ */ jsx(Spinner, {}) }) : /* @__PURE__ */ jsx(
497
- InputGroupInput,
498
- {
499
- disabled: isDisabled || isLoading,
500
- "aria-invalid": isError,
501
- onChange: (e) => {
502
- if (!setFormData || !fieldName) return;
503
- setFormData((p) => ({ ...p, [fieldName]: e.target.value }));
504
- },
505
- ...props
506
- }
507
- ),
508
- children
509
- ] });
510
- }
511
- function Card({ className, ...props }) {
512
550
  return /* @__PURE__ */ jsx(
513
- "div",
551
+ Input,
514
552
  {
515
- "data-slot": "card",
553
+ "data-slot": "input-group-control",
516
554
  className: cn(
517
- "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
555
+ "flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",
518
556
  className
519
557
  ),
520
558
  ...props
521
559
  }
522
560
  );
523
561
  }
524
- function CardHeader({ className, ...props }) {
562
+ function InputGroupTextarea({
563
+ className,
564
+ ...props
565
+ }) {
525
566
  return /* @__PURE__ */ jsx(
526
- "div",
567
+ Textarea,
527
568
  {
528
- "data-slot": "card-header",
569
+ "data-slot": "input-group-control",
529
570
  className: cn(
530
- "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
571
+ "flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
531
572
  className
532
573
  ),
533
574
  ...props
534
575
  }
535
576
  );
536
577
  }
537
- function CardTitle({ className, ...props }) {
578
+ function Spinner({ className, ...props }) {
538
579
  return /* @__PURE__ */ jsx(
539
- "div",
580
+ Loader2Icon,
540
581
  {
541
- "data-slot": "card-title",
542
- className: cn("leading-none font-semibold", className),
582
+ role: "status",
583
+ "aria-label": "Loading",
584
+ className: cn("size-4 animate-spin", className),
543
585
  ...props
544
586
  }
545
587
  );
546
588
  }
547
- function CardContent({ className, ...props }) {
589
+ function Button2({
590
+ icon,
591
+ href,
592
+ openNewTab = false,
593
+ // ui states
594
+ isDisabled = false,
595
+ isLoading = false,
596
+ // base
597
+ children,
598
+ ...props
599
+ }) {
600
+ const router = useRouter();
601
+ const handleClick = () => {
602
+ if (!href) return;
603
+ if (openNewTab) {
604
+ window.open(href, "_blank");
605
+ } else {
606
+ router.push(href);
607
+ }
608
+ };
548
609
  return /* @__PURE__ */ jsx(
549
- "div",
610
+ Button,
550
611
  {
551
- "data-slot": "card-content",
552
- className: cn("px-6", className),
553
- ...props
612
+ type: props.type ?? "button",
613
+ disabled: isDisabled || isLoading,
614
+ onClick: props.onClick ?? handleClick,
615
+ ...props,
616
+ children: isLoading ? /* @__PURE__ */ jsx(Spinner, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [
617
+ icon && React6.createElement(icon),
618
+ children
619
+ ] })
554
620
  }
555
621
  );
556
622
  }
557
- function AuthForm({
558
- title,
623
+ function Input2({
624
+ // form context
625
+ fieldName,
626
+ setFormData,
627
+ // ui states
628
+ isLoading = false,
629
+ isDisabled = false,
630
+ isError = false,
631
+ // base
559
632
  children,
560
- className,
561
633
  ...props
562
634
  }) {
563
- return /* @__PURE__ */ jsx(Form, { className: cn("mx-auto mt-20 w-96", className), ...props, children: /* @__PURE__ */ jsxs(Card, { children: [
564
- /* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "mx-auto", children: title }) }),
565
- /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", { className: "relative flex flex-col gap-6", children }) })
566
- ] }) });
635
+ return /* @__PURE__ */ jsxs(InputGroup, { "data-disabled": isDisabled || isLoading, children: [
636
+ isLoading ? /* @__PURE__ */ jsx(InputGroupAddon, { children: /* @__PURE__ */ jsx(Spinner, {}) }) : /* @__PURE__ */ jsx(
637
+ InputGroupInput,
638
+ {
639
+ disabled: isDisabled || isLoading,
640
+ "aria-invalid": isError,
641
+ onChange: (e) => {
642
+ if (!setFormData || !fieldName) return;
643
+ setFormData((p) => ({ ...p, [fieldName]: e.target.value }));
644
+ },
645
+ ...props
646
+ }
647
+ ),
648
+ children
649
+ ] });
567
650
  }
568
651
 
569
- export { AdminProvider, AuthForm, Button2 as Button, Form, Input2 as Input, cn, createAdminInitializer, createRequestInterceptor, createResponseInterceptor, createSmartFetch, createUseCommand, createUseQuery, handleToast, useAdmin, useDeviceInfo };
652
+ export { AdminProvider, Button2 as Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Form, Input2 as Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Spinner, Textarea, cn, createAdminInitializer, createRequestInterceptor, createResponseInterceptor, createSmartFetch, createUseCommand, createUseQuery, handleToast, useAdmin, useDeviceInfo };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yimingliao/cms",
3
- "version": "0.0.85",
3
+ "version": "0.0.86",
4
4
  "author": "Yiming Liao",
5
5
  "license": "MIT",
6
6
  "type": "module",