@thesage/ui 0.1.0 → 1.0.0

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 (50) hide show
  1. package/README.md +96 -61
  2. package/dist/dates.d.mts +20 -0
  3. package/dist/dates.d.ts +20 -0
  4. package/dist/dates.js +230 -0
  5. package/dist/dates.js.map +1 -0
  6. package/dist/dates.mjs +193 -0
  7. package/dist/dates.mjs.map +1 -0
  8. package/dist/dnd.d.mts +126 -0
  9. package/dist/dnd.d.ts +126 -0
  10. package/dist/dnd.js +274 -0
  11. package/dist/dnd.js.map +1 -0
  12. package/dist/dnd.mjs +250 -0
  13. package/dist/dnd.mjs.map +1 -0
  14. package/dist/forms.d.mts +38 -0
  15. package/dist/forms.d.ts +38 -0
  16. package/dist/forms.js +198 -0
  17. package/dist/forms.js.map +1 -0
  18. package/dist/forms.mjs +159 -0
  19. package/dist/forms.mjs.map +1 -0
  20. package/dist/hooks.js +6 -5
  21. package/dist/hooks.js.map +1 -1
  22. package/dist/hooks.mjs +6 -5
  23. package/dist/hooks.mjs.map +1 -1
  24. package/dist/index.d.mts +484 -352
  25. package/dist/index.d.ts +484 -352
  26. package/dist/index.js +2674 -2092
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +2548 -1966
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/providers.js +6 -5
  31. package/dist/providers.js.map +1 -1
  32. package/dist/providers.mjs +6 -5
  33. package/dist/providers.mjs.map +1 -1
  34. package/dist/tables.d.mts +10 -0
  35. package/dist/tables.d.ts +10 -0
  36. package/dist/tables.js +248 -0
  37. package/dist/tables.js.map +1 -0
  38. package/dist/tables.mjs +218 -0
  39. package/dist/tables.mjs.map +1 -0
  40. package/dist/utils.js +2 -1
  41. package/dist/utils.js.map +1 -1
  42. package/dist/utils.mjs +2 -1
  43. package/dist/utils.mjs.map +1 -1
  44. package/dist/webgl.d.mts +104 -0
  45. package/dist/webgl.d.ts +104 -0
  46. package/dist/webgl.js +226 -0
  47. package/dist/webgl.js.map +1 -0
  48. package/dist/webgl.mjs +195 -0
  49. package/dist/webgl.mjs.map +1 -0
  50. package/package.json +145 -16
package/dist/dates.mjs ADDED
@@ -0,0 +1,193 @@
1
+ "use client";
2
+
3
+ // src/components/data-display/Calendar.tsx
4
+ import { ChevronLeft, ChevronRight } from "lucide-react";
5
+ import { DayPicker } from "react-day-picker";
6
+
7
+ // src/lib/utils.ts
8
+ import { clsx } from "clsx";
9
+ import { twMerge } from "tailwind-merge";
10
+ function cn(...inputs) {
11
+ return twMerge(clsx(inputs));
12
+ }
13
+
14
+ // src/components/actions/Button.tsx
15
+ import { cva } from "class-variance-authority";
16
+ import { Slot } from "@radix-ui/react-slot";
17
+ import { jsx } from "react/jsx-runtime";
18
+ var buttonVariants = cva(
19
+ "inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 sage-interactive [&_svg]:transition-transform [&_svg]:duration-300 hover:[&_svg]:translate-x-1",
20
+ {
21
+ variants: {
22
+ variant: {
23
+ default: "bg-primary text-primary-foreground shadow",
24
+ primary: "bg-primary text-primary-foreground shadow",
25
+ // Alias for default
26
+ destructive: "bg-destructive text-destructive-foreground shadow-sm",
27
+ outline: "border border-input bg-transparent shadow-sm hover:bg-primary hover:text-primary-foreground hover:border-primary",
28
+ secondary: "bg-black/5 dark:bg-white/10 backdrop-blur-md border border-black/5 dark:border-white/10 text-secondary-foreground shadow-sm hover:bg-primary hover:text-primary-foreground dark:hover:bg-primary dark:hover:text-primary-foreground",
29
+ ghost: "hover:text-accent-foreground",
30
+ link: "text-primary underline-offset-4 hover:underline"
31
+ },
32
+ size: {
33
+ default: "h-9 px-4 py-2",
34
+ sm: "h-8 rounded-md px-3 text-xs",
35
+ lg: "h-10 rounded-md px-8",
36
+ icon: "h-9 w-9"
37
+ }
38
+ },
39
+ defaultVariants: {
40
+ variant: "default",
41
+ size: "default"
42
+ }
43
+ }
44
+ );
45
+ var Button = ({
46
+ ref,
47
+ className,
48
+ variant,
49
+ size,
50
+ asChild = false,
51
+ children,
52
+ ...props
53
+ }) => {
54
+ const Comp = asChild ? Slot : "button";
55
+ return /* @__PURE__ */ jsx(
56
+ Comp,
57
+ {
58
+ className: cn(buttonVariants({ variant, size, className })),
59
+ ref,
60
+ ...props,
61
+ children: asChild ? children : /* @__PURE__ */ jsx("span", { className: "relative z-20 flex items-center justify-center gap-2", children })
62
+ }
63
+ );
64
+ };
65
+
66
+ // src/components/data-display/Calendar.tsx
67
+ import { jsx as jsx2 } from "react/jsx-runtime";
68
+ function Calendar({
69
+ className,
70
+ classNames,
71
+ showOutsideDays = true,
72
+ ...props
73
+ }) {
74
+ return /* @__PURE__ */ jsx2(
75
+ DayPicker,
76
+ {
77
+ showOutsideDays,
78
+ className: cn("p-3", className),
79
+ classNames: {
80
+ months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
81
+ month: "space-y-4",
82
+ caption: "flex justify-center pt-1 relative items-center",
83
+ caption_label: "text-sm font-medium",
84
+ nav: "space-x-1 flex items-center",
85
+ nav_button: cn(
86
+ buttonVariants({ variant: "outline" }),
87
+ "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
88
+ ),
89
+ nav_button_previous: "absolute left-1",
90
+ nav_button_next: "absolute right-1",
91
+ table: "w-full border-collapse space-y-1",
92
+ head_row: "flex",
93
+ head_cell: "text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
94
+ row: "flex w-full mt-2",
95
+ cell: "h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",
96
+ day: cn(
97
+ buttonVariants({ variant: "ghost" }),
98
+ "h-9 w-9 p-0 font-normal aria-selected:opacity-100"
99
+ ),
100
+ day_range_end: "day-range-end",
101
+ day_selected: "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
102
+ day_today: "bg-accent text-accent-foreground",
103
+ day_outside: "day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",
104
+ day_disabled: "text-muted-foreground opacity-50",
105
+ day_range_middle: "aria-selected:bg-accent aria-selected:text-accent-foreground",
106
+ day_hidden: "invisible",
107
+ ...classNames
108
+ },
109
+ components: {
110
+ Chevron: ({ ...props2 }) => {
111
+ if (props2.orientation === "left") {
112
+ return /* @__PURE__ */ jsx2(ChevronLeft, { className: "h-4 w-4" });
113
+ }
114
+ return /* @__PURE__ */ jsx2(ChevronRight, { className: "h-4 w-4" });
115
+ }
116
+ },
117
+ ...props
118
+ }
119
+ );
120
+ }
121
+ Calendar.displayName = "Calendar";
122
+
123
+ // src/components/layout/DatePicker.tsx
124
+ import { format } from "date-fns";
125
+ import { Calendar as CalendarIcon } from "lucide-react";
126
+
127
+ // src/components/overlays/Popover.tsx
128
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
129
+ import { jsx as jsx3 } from "react/jsx-runtime";
130
+ var Popover = PopoverPrimitive.Root;
131
+ var PopoverTrigger = PopoverPrimitive.Trigger;
132
+ var PopoverContent = ({
133
+ ref,
134
+ className,
135
+ align = "center",
136
+ sideOffset = 4,
137
+ ...props
138
+ }) => /* @__PURE__ */ jsx3(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx3(
139
+ PopoverPrimitive.Content,
140
+ {
141
+ ref,
142
+ align,
143
+ sideOffset,
144
+ className: cn(
145
+ "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
146
+ className
147
+ ),
148
+ ...props
149
+ }
150
+ ) });
151
+
152
+ // src/components/layout/DatePicker.tsx
153
+ import { jsx as jsx4, jsxs } from "react/jsx-runtime";
154
+ function DatePicker({
155
+ date,
156
+ onDateChange,
157
+ placeholder = "Pick a date",
158
+ className,
159
+ disabled = false
160
+ }) {
161
+ return /* @__PURE__ */ jsxs(Popover, { children: [
162
+ /* @__PURE__ */ jsx4(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
163
+ Button,
164
+ {
165
+ variant: "outline",
166
+ className: cn(
167
+ "w-[280px] justify-start text-left font-normal",
168
+ !date && "text-muted-foreground",
169
+ className
170
+ ),
171
+ disabled,
172
+ children: [
173
+ /* @__PURE__ */ jsx4(CalendarIcon, { className: "mr-2 h-4 w-4" }),
174
+ date ? format(date, "PPP") : /* @__PURE__ */ jsx4("span", { children: placeholder })
175
+ ]
176
+ }
177
+ ) }),
178
+ /* @__PURE__ */ jsx4(PopoverContent, { className: "w-auto p-0", children: /* @__PURE__ */ jsx4(
179
+ Calendar,
180
+ {
181
+ mode: "single",
182
+ selected: date,
183
+ onSelect: onDateChange,
184
+ initialFocus: true
185
+ }
186
+ ) })
187
+ ] });
188
+ }
189
+ export {
190
+ Calendar,
191
+ DatePicker
192
+ };
193
+ //# sourceMappingURL=dates.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/data-display/Calendar.tsx","../src/lib/utils.ts","../src/components/actions/Button.tsx","../src/components/layout/DatePicker.tsx","../src/components/overlays/Popover.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { ChevronLeft, ChevronRight } from \"lucide-react\"\nimport { DayPicker } from \"react-day-picker\"\n\nimport { cn } from \"../../lib/utils\"\nimport { buttonVariants } from \"../actions/Button\"\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n ...props\n}: CalendarProps) {\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n className={cn(\"p-3\", className)}\n classNames={{\n months: \"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0\",\n month: \"space-y-4\",\n caption: \"flex justify-center pt-1 relative items-center\",\n caption_label: \"text-sm font-medium\",\n nav: \"space-x-1 flex items-center\",\n nav_button: cn(\n buttonVariants({ variant: \"outline\" }),\n \"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100\"\n ),\n nav_button_previous: \"absolute left-1\",\n nav_button_next: \"absolute right-1\",\n table: \"w-full border-collapse space-y-1\",\n head_row: \"flex\",\n head_cell:\n \"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]\",\n row: \"flex w-full mt-2\",\n cell: \"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20\",\n day: cn(\n buttonVariants({ variant: \"ghost\" }),\n \"h-9 w-9 p-0 font-normal aria-selected:opacity-100\"\n ),\n day_range_end: \"day-range-end\",\n day_selected:\n \"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground\",\n day_today: \"bg-accent text-accent-foreground\",\n day_outside:\n \"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30\",\n day_disabled: \"text-muted-foreground opacity-50\",\n day_range_middle:\n \"aria-selected:bg-accent aria-selected:text-accent-foreground\",\n day_hidden: \"invisible\",\n ...classNames,\n }}\n components={{\n Chevron: ({ ...props }) => {\n if (props.orientation === \"left\") {\n return <ChevronLeft className=\"h-4 w-4\" />\n }\n return <ChevronRight className=\"h-4 w-4\" />\n },\n }}\n {...props}\n />\n )\n}\nCalendar.displayName = \"Calendar\"\n\nexport { Calendar }\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../lib/utils';\nimport { Slot } from '@radix-ui/react-slot';\n\nconst buttonVariants = cva(\n 'inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 sage-interactive [&_svg]:transition-transform [&_svg]:duration-300 hover:[&_svg]:translate-x-1',\n {\n variants: {\n variant: {\n default: 'bg-primary text-primary-foreground shadow',\n primary: 'bg-primary text-primary-foreground shadow', // Alias for default\n destructive: 'bg-destructive text-destructive-foreground shadow-sm',\n outline: 'border border-input bg-transparent shadow-sm hover:bg-primary hover:text-primary-foreground hover:border-primary',\n secondary: 'bg-black/5 dark:bg-white/10 backdrop-blur-md border border-black/5 dark:border-white/10 text-secondary-foreground shadow-sm hover:bg-primary hover:text-primary-foreground dark:hover:bg-primary dark:hover:text-primary-foreground',\n ghost: 'hover:text-accent-foreground',\n link: 'text-primary underline-offset-4 hover:underline',\n },\n size: {\n default: 'h-9 px-4 py-2',\n sm: 'h-8 rounded-md px-3 text-xs',\n lg: 'h-10 rounded-md px-8',\n icon: 'h-9 w-9',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n }\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nconst Button = (\n {\n ref,\n className,\n variant,\n size,\n asChild = false,\n children,\n ...props\n }: ButtonProps & {\n ref?: React.Ref<HTMLButtonElement>;\n }\n) => {\n const Comp = asChild ? Slot : \"button\"\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n >\n {asChild ? (\n children\n ) : (\n <span className=\"relative z-20 flex items-center justify-center gap-2\">\n {children}\n </span>\n )}\n </Comp>\n )\n}\n\nexport { Button, buttonVariants };\n","\"use client\"\n\nimport * as React from \"react\"\nimport { format } from \"date-fns\"\nimport { Calendar as CalendarIcon } from \"lucide-react\"\n\nimport { cn } from \"../../lib/utils\"\nimport { Button } from \"../actions/Button\"\nimport { Calendar } from \"../data-display/Calendar\"\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"../overlays/Popover\"\n\nexport interface DatePickerProps {\n date?: Date\n onDateChange?: (date: Date | undefined) => void\n placeholder?: string\n className?: string\n disabled?: boolean\n}\n\nexport function DatePicker({\n date,\n onDateChange,\n placeholder = \"Pick a date\",\n className,\n disabled = false,\n}: DatePickerProps) {\n return (\n <Popover>\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n className={cn(\n \"w-[280px] justify-start text-left font-normal\",\n !date && \"text-muted-foreground\",\n className\n )}\n disabled={disabled}\n >\n <CalendarIcon className=\"mr-2 h-4 w-4\" />\n {date ? format(date, \"PPP\") : <span>{placeholder}</span>}\n </Button>\n </PopoverTrigger>\n <PopoverContent className=\"w-auto p-0\">\n <Calendar\n mode=\"single\"\n selected={date}\n onSelect={onDateChange}\n initialFocus\n />\n </PopoverContent>\n </Popover>\n )\n}\n","\"use client\";\nimport * as React from \"react\"\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\"\n\nimport { cn } from \"../../lib/utils\"\n\nconst Popover = PopoverPrimitive.Root\n\nconst PopoverTrigger = PopoverPrimitive.Trigger\n\nconst PopoverAnchor = PopoverPrimitive.Anchor\n\nconst PopoverContent = (\n {\n ref,\n className,\n align = \"center\",\n sideOffset = 4,\n ...props\n }: React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> & {\n ref?: React.Ref<React.ElementRef<typeof PopoverPrimitive.Content>>;\n }\n) => (<PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n</PopoverPrimitive.Portal>)\n\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }\n"],"mappings":";;;AAGA,SAAS,aAAa,oBAAoB;AAC1C,SAAS,iBAAiB;;;ACJ1B,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AACxC,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC/B;;;ACJA,SAAS,WAA8B;AAEvC,SAAS,YAAY;AA0DL;AAxDhB,IAAM,iBAAiB;AAAA,EACnB;AAAA,EACA;AAAA,IACI,UAAU;AAAA,MACN,SAAS;AAAA,QACL,SAAS;AAAA,QACT,SAAS;AAAA;AAAA,QACT,aAAa;AAAA,QACb,SAAS;AAAA,QACT,WAAW;AAAA,QACX,OAAO;AAAA,QACP,MAAM;AAAA,MACV;AAAA,MACA,MAAM;AAAA,QACF,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,IACA,iBAAiB;AAAA,MACb,SAAS;AAAA,MACT,MAAM;AAAA,IACV;AAAA,EACJ;AACJ;AAQA,IAAM,SAAS,CACX;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,GAAG;AACP,MAGC;AACD,QAAM,OAAO,UAAU,OAAO;AAC9B,SACI;AAAA,IAAC;AAAA;AAAA,MACG,WAAW,GAAG,eAAe,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC;AAAA,MAC1D;AAAA,MACC,GAAG;AAAA,MAEH,oBACG,WAEA,oBAAC,UAAK,WAAU,wDACX,UACL;AAAA;AAAA,EAER;AAER;;;AFTmB,gBAAAA,YAAA;AA/CnB,SAAS,SAAS;AAAA,EAChB;AAAA,EACA;AAAA,EACA,kBAAkB;AAAA,EAClB,GAAG;AACL,GAAkB;AAChB,SACE,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW,GAAG,OAAO,SAAS;AAAA,MAC9B,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,SAAS;AAAA,QACT,eAAe;AAAA,QACf,KAAK;AAAA,QACL,YAAY;AAAA,UACV,eAAe,EAAE,SAAS,UAAU,CAAC;AAAA,UACrC;AAAA,QACF;AAAA,QACA,qBAAqB;AAAA,QACrB,iBAAiB;AAAA,QACjB,OAAO;AAAA,QACP,UAAU;AAAA,QACV,WACE;AAAA,QACF,KAAK;AAAA,QACL,MAAM;AAAA,QACN,KAAK;AAAA,UACH,eAAe,EAAE,SAAS,QAAQ,CAAC;AAAA,UACnC;AAAA,QACF;AAAA,QACA,eAAe;AAAA,QACf,cACE;AAAA,QACF,WAAW;AAAA,QACX,aACE;AAAA,QACF,cAAc;AAAA,QACd,kBACE;AAAA,QACF,YAAY;AAAA,QACZ,GAAG;AAAA,MACL;AAAA,MACA,YAAY;AAAA,QACV,SAAS,CAAC,EAAE,GAAGC,OAAM,MAAM;AACzB,cAAIA,OAAM,gBAAgB,QAAQ;AAChC,mBAAO,gBAAAD,KAAC,eAAY,WAAU,WAAU;AAAA,UAC1C;AACA,iBAAO,gBAAAA,KAAC,gBAAa,WAAU,WAAU;AAAA,QAC3C;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;AACA,SAAS,cAAc;;;AGhEvB,SAAS,cAAc;AACvB,SAAS,YAAY,oBAAoB;;;ACFzC,YAAY,sBAAsB;AAqBhC,gBAAAE,YAAA;AAjBF,IAAM,UAA2B;AAEjC,IAAM,iBAAkC;AAIxC,IAAM,iBAAiB,CACrB;AAAA,EACE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,GAAG;AACL,MAGI,gBAAAC,KAAkB,yBAAjB,EACL,0BAAAA;AAAA,EAAkB;AAAA,EAAjB;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA;AACN,GACF;;;ADAQ,SASE,OAAAC,MATF;AAVD,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA,WAAW;AACb,GAAoB;AAClB,SACE,qBAAC,WACC;AAAA,oBAAAA,KAAC,kBAAe,SAAO,MACrB;AAAA,MAAC;AAAA;AAAA,QACC,SAAQ;AAAA,QACR,WAAW;AAAA,UACT;AAAA,UACA,CAAC,QAAQ;AAAA,UACT;AAAA,QACF;AAAA,QACA;AAAA,QAEA;AAAA,0BAAAA,KAAC,gBAAa,WAAU,gBAAe;AAAA,UACtC,OAAO,OAAO,MAAM,KAAK,IAAI,gBAAAA,KAAC,UAAM,uBAAY;AAAA;AAAA;AAAA,IACnD,GACF;AAAA,IACA,gBAAAA,KAAC,kBAAe,WAAU,cACxB,0BAAAA;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,UAAU;AAAA,QACV,UAAU;AAAA,QACV,cAAY;AAAA;AAAA,IACd,GACF;AAAA,KACF;AAEJ;","names":["jsx","props","jsx","jsx","jsx"]}
package/dist/dnd.d.mts ADDED
@@ -0,0 +1,126 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React__default from 'react';
3
+ import { SortingStrategy } from '@dnd-kit/sortable';
4
+
5
+ /**
6
+ * Item interface for drag and drop lists
7
+ */
8
+ interface DragDropItem {
9
+ id: string;
10
+ [key: string]: any;
11
+ }
12
+ /**
13
+ * Props for DragDropList component
14
+ */
15
+ interface DragDropListProps<T extends DragDropItem> {
16
+ /**
17
+ * Array of items to display
18
+ */
19
+ items: T[];
20
+ /**
21
+ * Callback fired when items are reordered
22
+ */
23
+ onReorder: (items: T[]) => void;
24
+ /**
25
+ * Render function for each item
26
+ */
27
+ renderItem: (item: T, isDragging: boolean) => React__default.ReactNode;
28
+ /**
29
+ * Enable drag handle mode (only drag from handle)
30
+ * @default false
31
+ */
32
+ withHandle?: boolean;
33
+ /**
34
+ * Custom class name for the list container
35
+ */
36
+ className?: string;
37
+ /**
38
+ * Custom class name for list items
39
+ */
40
+ itemClassName?: string;
41
+ /**
42
+ * Sorting strategy for the drag & drop behavior
43
+ * - verticalListSortingStrategy: For vertical lists (default)
44
+ * - rectSortingStrategy: For grid layouts
45
+ * @default verticalListSortingStrategy
46
+ */
47
+ strategy?: SortingStrategy;
48
+ }
49
+ /**
50
+ * Drag handle component for manual drag control
51
+ * Must be used within a DragDropList with withHandle={true}
52
+ */
53
+ interface DragDropHandleProps {
54
+ /**
55
+ * Custom class name
56
+ */
57
+ className?: string;
58
+ /**
59
+ * Handle icon
60
+ */
61
+ icon?: React__default.ReactNode;
62
+ }
63
+ declare function DragDropHandle({ className, icon }: DragDropHandleProps): react_jsx_runtime.JSX.Element | null;
64
+ /**
65
+ * DragDropList - Sortable list component with drag and drop functionality
66
+ *
67
+ * @example
68
+ * ```tsx
69
+ * const [items, setItems] = useState([
70
+ * { id: '1', name: 'Item 1' },
71
+ * { id: '2', name: 'Item 2' },
72
+ * ]);
73
+ *
74
+ * <DragDropList
75
+ * items={items}
76
+ * onReorder={setItems}
77
+ * renderItem={(item) => (
78
+ * <div className="p-4 bg-surface rounded">{item.name}</div>
79
+ * )}
80
+ * />
81
+ * ```
82
+ */
83
+ declare function DragDropList<T extends DragDropItem>({ items, onReorder, renderItem, withHandle, className, itemClassName, strategy, }: DragDropListProps<T>): react_jsx_runtime.JSX.Element;
84
+ /**
85
+ * Props for DragDropTable component
86
+ */
87
+ interface DragDropTableProps<T extends DragDropItem> {
88
+ /**
89
+ * Array of items to display
90
+ */
91
+ items: T[];
92
+ /**
93
+ * Callback fired when items are reordered
94
+ */
95
+ onReorder: (items: T[]) => void;
96
+ /**
97
+ * Table columns configuration
98
+ */
99
+ columns: {
100
+ key: string;
101
+ header: string;
102
+ render?: (item: T) => React__default.ReactNode;
103
+ }[];
104
+ /**
105
+ * Custom class name for the table
106
+ */
107
+ className?: string;
108
+ }
109
+ /**
110
+ * DragDropTable - Sortable table with draggable rows
111
+ *
112
+ * @example
113
+ * ```tsx
114
+ * <DragDropTable
115
+ * items={data}
116
+ * onReorder={setData}
117
+ * columns={[
118
+ * { key: 'name', header: 'Name' },
119
+ * { key: 'email', header: 'Email' },
120
+ * ]}
121
+ * />
122
+ * ```
123
+ */
124
+ declare function DragDropTable<T extends DragDropItem>({ items, onReorder, columns, className, }: DragDropTableProps<T>): react_jsx_runtime.JSX.Element;
125
+
126
+ export { DragDropHandle, type DragDropHandleProps, type DragDropItem, DragDropList, type DragDropListProps, DragDropTable, type DragDropTableProps };
package/dist/dnd.d.ts ADDED
@@ -0,0 +1,126 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React__default from 'react';
3
+ import { SortingStrategy } from '@dnd-kit/sortable';
4
+
5
+ /**
6
+ * Item interface for drag and drop lists
7
+ */
8
+ interface DragDropItem {
9
+ id: string;
10
+ [key: string]: any;
11
+ }
12
+ /**
13
+ * Props for DragDropList component
14
+ */
15
+ interface DragDropListProps<T extends DragDropItem> {
16
+ /**
17
+ * Array of items to display
18
+ */
19
+ items: T[];
20
+ /**
21
+ * Callback fired when items are reordered
22
+ */
23
+ onReorder: (items: T[]) => void;
24
+ /**
25
+ * Render function for each item
26
+ */
27
+ renderItem: (item: T, isDragging: boolean) => React__default.ReactNode;
28
+ /**
29
+ * Enable drag handle mode (only drag from handle)
30
+ * @default false
31
+ */
32
+ withHandle?: boolean;
33
+ /**
34
+ * Custom class name for the list container
35
+ */
36
+ className?: string;
37
+ /**
38
+ * Custom class name for list items
39
+ */
40
+ itemClassName?: string;
41
+ /**
42
+ * Sorting strategy for the drag & drop behavior
43
+ * - verticalListSortingStrategy: For vertical lists (default)
44
+ * - rectSortingStrategy: For grid layouts
45
+ * @default verticalListSortingStrategy
46
+ */
47
+ strategy?: SortingStrategy;
48
+ }
49
+ /**
50
+ * Drag handle component for manual drag control
51
+ * Must be used within a DragDropList with withHandle={true}
52
+ */
53
+ interface DragDropHandleProps {
54
+ /**
55
+ * Custom class name
56
+ */
57
+ className?: string;
58
+ /**
59
+ * Handle icon
60
+ */
61
+ icon?: React__default.ReactNode;
62
+ }
63
+ declare function DragDropHandle({ className, icon }: DragDropHandleProps): react_jsx_runtime.JSX.Element | null;
64
+ /**
65
+ * DragDropList - Sortable list component with drag and drop functionality
66
+ *
67
+ * @example
68
+ * ```tsx
69
+ * const [items, setItems] = useState([
70
+ * { id: '1', name: 'Item 1' },
71
+ * { id: '2', name: 'Item 2' },
72
+ * ]);
73
+ *
74
+ * <DragDropList
75
+ * items={items}
76
+ * onReorder={setItems}
77
+ * renderItem={(item) => (
78
+ * <div className="p-4 bg-surface rounded">{item.name}</div>
79
+ * )}
80
+ * />
81
+ * ```
82
+ */
83
+ declare function DragDropList<T extends DragDropItem>({ items, onReorder, renderItem, withHandle, className, itemClassName, strategy, }: DragDropListProps<T>): react_jsx_runtime.JSX.Element;
84
+ /**
85
+ * Props for DragDropTable component
86
+ */
87
+ interface DragDropTableProps<T extends DragDropItem> {
88
+ /**
89
+ * Array of items to display
90
+ */
91
+ items: T[];
92
+ /**
93
+ * Callback fired when items are reordered
94
+ */
95
+ onReorder: (items: T[]) => void;
96
+ /**
97
+ * Table columns configuration
98
+ */
99
+ columns: {
100
+ key: string;
101
+ header: string;
102
+ render?: (item: T) => React__default.ReactNode;
103
+ }[];
104
+ /**
105
+ * Custom class name for the table
106
+ */
107
+ className?: string;
108
+ }
109
+ /**
110
+ * DragDropTable - Sortable table with draggable rows
111
+ *
112
+ * @example
113
+ * ```tsx
114
+ * <DragDropTable
115
+ * items={data}
116
+ * onReorder={setData}
117
+ * columns={[
118
+ * { key: 'name', header: 'Name' },
119
+ * { key: 'email', header: 'Email' },
120
+ * ]}
121
+ * />
122
+ * ```
123
+ */
124
+ declare function DragDropTable<T extends DragDropItem>({ items, onReorder, columns, className, }: DragDropTableProps<T>): react_jsx_runtime.JSX.Element;
125
+
126
+ export { DragDropHandle, type DragDropHandleProps, type DragDropItem, DragDropList, type DragDropListProps, DragDropTable, type DragDropTableProps };