chesai-ui 0.16.7 → 0.16.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.
@@ -30,5 +30,10 @@ export interface DataDisplayProps<TData> {
30
30
  */
31
31
  enableSortControl?: boolean;
32
32
  searchViewProps?: Partial<Omit<SearchViewProps, "value" | "onChange">>;
33
+ emptyTitle?: string;
34
+ emptyDescription?: string;
35
+ emptyIcon?: React.ReactNode;
36
+ emptyAction?: React.ReactNode;
37
+ renderEmptyState?: () => React.ReactNode;
33
38
  }
34
- export declare function DataDisplay<TData>({ data, columns, renderItem, layout, gridProps, masonryProps, itemContainerClassName, pageCount, pagination, onPaginationChange, sorting, onSortingChange, columnFilters, onColumnFiltersChange, globalFilter, onGlobalFilterChange, isLoading, toolbarChildren, bulkActions, enableSortControl, searchViewProps, }: DataDisplayProps<TData>): import("react/jsx-runtime").JSX.Element;
39
+ export declare function DataDisplay<TData>({ data, columns, renderItem, layout, gridProps, masonryProps, itemContainerClassName, pageCount, pagination, onPaginationChange, sorting, onSortingChange, columnFilters, onColumnFiltersChange, globalFilter, onGlobalFilterChange, isLoading, toolbarChildren, bulkActions, enableSortControl, searchViewProps, emptyTitle, emptyDescription, emptyIcon, emptyAction, renderEmptyState, }: DataDisplayProps<TData>): import("react/jsx-runtime").JSX.Element;
@@ -1,29 +1,30 @@
1
- import { jsx as e, jsxs as r, Fragment as H } from "react/jsx-runtime";
2
- import { useReactTable as J, getFacetedUniqueValues as K, getFacetedRowModel as O, getSortedRowModel as Q, getPaginationRowModel as W, getFilteredRowModel as X, getCoreRowModel as Y } from "@tanstack/react-table";
3
- import { ArrowUpDown as Z } from "lucide-react";
1
+ import { jsx as e, jsxs as r, Fragment as W } from "react/jsx-runtime";
2
+ import { useReactTable as X, getFacetedUniqueValues as Y, getFacetedRowModel as Z, getSortedRowModel as ee, getPaginationRowModel as te, getFilteredRowModel as ne, getCoreRowModel as re } from "@tanstack/react-table";
3
+ import { ArrowUpDown as oe, Search as ie } from "lucide-react";
4
4
  import n from "react";
5
- import { Button as ee } from "../button/index.mjs";
6
- import { DataTableContext as te } from "../data-table/context.mjs";
7
- import { advancedFilterFn as ne } from "../data-table/filter-utils.mjs";
8
- import { DataTablePagination as re } from "../data-table/pagination.mjs";
9
- import { DataTableToolbar as oe } from "../data-table/toolbar.mjs";
10
- import { DropdownMenu as ie, DropdownMenuTrigger as le, DropdownMenuContent as ae, DropdownMenuLabel as se, DropdownMenuSeparator as M, DropdownMenuItem as p } from "../dropdown-menu/index.mjs";
11
- import { Grid as de } from "../layouts/grid.mjs";
12
- import { Masonry as ce } from "../layouts/masonry.mjs";
13
- import { LoadingIndicator as me } from "../loadingIndicator/index.mjs";
14
- function ge({
15
- table: l
5
+ import { Button as ae } from "../button/index.mjs";
6
+ import { EmptyState as le } from "../empty-state/index.mjs";
7
+ import { DataTableContext as se } from "../data-table/context.mjs";
8
+ import { advancedFilterFn as de } from "../data-table/filter-utils.mjs";
9
+ import { DataTablePagination as ce } from "../data-table/pagination.mjs";
10
+ import { DataTableToolbar as me } from "../data-table/toolbar.mjs";
11
+ import { DropdownMenu as ue, DropdownMenuTrigger as ge, DropdownMenuContent as fe, DropdownMenuLabel as pe, DropdownMenuSeparator as C, DropdownMenuItem as p } from "../dropdown-menu/index.mjs";
12
+ import { Grid as he } from "../layouts/grid.mjs";
13
+ import { Masonry as Se } from "../layouts/masonry.mjs";
14
+ import { LoadingIndicator as we } from "../loadingIndicator/index.mjs";
15
+ function Fe({
16
+ table: a
16
17
  }) {
17
- const d = l.getAllColumns().filter((t) => t.getCanSort());
18
+ const d = a.getAllColumns().filter((t) => t.getCanSort());
18
19
  if (d.length === 0) return null;
19
- const o = l.getState().sorting[0];
20
- return /* @__PURE__ */ r(ie, { children: [
21
- /* @__PURE__ */ e(le, { asChild: !0, children: /* @__PURE__ */ r(
22
- ee,
20
+ const o = a.getState().sorting[0];
21
+ return /* @__PURE__ */ r(ue, { children: [
22
+ /* @__PURE__ */ e(ge, { asChild: !0, children: /* @__PURE__ */ r(
23
+ ae,
23
24
  {
24
25
  variant: "secondary",
25
26
  size: "sm",
26
- startIcon: /* @__PURE__ */ e(Z, { className: "h-3.5 w-3.5" }),
27
+ startIcon: /* @__PURE__ */ e(oe, { className: "h-3.5 w-3.5" }),
27
28
  className: "h-8",
28
29
  children: [
29
30
  "Sort",
@@ -37,9 +38,9 @@ function ge({
37
38
  ]
38
39
  }
39
40
  ) }),
40
- /* @__PURE__ */ r(ae, { align: "end", className: "w-48", children: [
41
- /* @__PURE__ */ e(se, { children: "Sort by" }),
42
- /* @__PURE__ */ e(M, {}),
41
+ /* @__PURE__ */ r(fe, { align: "end", className: "w-48", children: [
42
+ /* @__PURE__ */ e(pe, { children: "Sort by" }),
43
+ /* @__PURE__ */ e(C, {}),
43
44
  d.map((t) => {
44
45
  const c = typeof t.columnDef.header == "string" ? t.columnDef.header : t.id;
45
46
  return /* @__PURE__ */ r(n.Fragment, { children: [
@@ -53,99 +54,113 @@ function ge({
53
54
  ] })
54
55
  ] }, t.id);
55
56
  }),
56
- o && /* @__PURE__ */ r(H, { children: [
57
- /* @__PURE__ */ e(M, {}),
58
- /* @__PURE__ */ e(p, { onClick: () => l.resetSorting(), children: "Clear Sort" })
57
+ o && /* @__PURE__ */ r(W, { children: [
58
+ /* @__PURE__ */ e(C, {}),
59
+ /* @__PURE__ */ e(p, { onClick: () => a.resetSorting(), children: "Clear Sort" })
59
60
  ] })
60
61
  ] })
61
62
  ] });
62
63
  }
63
- function ye({
64
- data: l,
64
+ function Ae({
65
+ data: a,
65
66
  columns: d,
66
67
  renderItem: o,
67
68
  layout: t = "grid",
68
69
  gridProps: c,
69
- masonryProps: C,
70
- itemContainerClassName: g,
71
- pageCount: D,
72
- pagination: b,
70
+ masonryProps: D,
71
+ itemContainerClassName: u,
72
+ pageCount: b,
73
+ pagination: y,
73
74
  onPaginationChange: h,
74
75
  sorting: R,
75
76
  onSortingChange: S,
76
- columnFilters: x,
77
+ columnFilters: v,
77
78
  onColumnFiltersChange: w,
78
- globalFilter: y,
79
+ globalFilter: x,
79
80
  onGlobalFilterChange: F,
80
- isLoading: v,
81
- toolbarChildren: N,
82
- bulkActions: I,
83
- enableSortControl: P = !0,
84
- searchViewProps: T
81
+ isLoading: N,
82
+ toolbarChildren: I,
83
+ bulkActions: P,
84
+ enableSortControl: T = !0,
85
+ searchViewProps: V,
86
+ emptyTitle: j,
87
+ emptyDescription: A,
88
+ emptyIcon: k,
89
+ emptyAction: G,
90
+ renderEmptyState: M
85
91
  }) {
86
- const [V, j] = n.useState({}), [A, k] = n.useState({}), [G, U] = n.useState(
92
+ const [U, q] = n.useState({}), [z, L] = n.useState({}), [_, B] = n.useState(
87
93
  []
88
- ), [q, z] = n.useState([]), [L, _] = n.useState(""), [B, $] = n.useState({
94
+ ), [$, E] = n.useState([]), [H, J] = n.useState(""), [K, O] = n.useState({
89
95
  pageIndex: 0,
90
96
  pageSize: 12
91
- }), m = !!h, u = !!S, a = !!w || !!F, f = J({
92
- data: l,
97
+ }), m = !!h, g = !!S, l = !!w || !!F, f = X({
98
+ data: a,
93
99
  columns: d,
94
- pageCount: m ? D : void 0,
100
+ pageCount: m ? b : void 0,
95
101
  state: {
96
- sorting: u ? R : G,
97
- columnFilters: a ? x : q,
98
- globalFilter: a ? y : L,
99
- pagination: m ? b : B,
100
- columnVisibility: A,
101
- rowSelection: V
102
+ sorting: g ? R : _,
103
+ columnFilters: l ? v : $,
104
+ globalFilter: l ? x : H,
105
+ pagination: m ? y : K,
106
+ columnVisibility: z,
107
+ rowSelection: U
102
108
  },
103
- onRowSelectionChange: j,
104
- onColumnVisibilityChange: k,
105
- onSortingChange: u ? S : U,
106
- onColumnFiltersChange: a ? w : z,
107
- onGlobalFilterChange: a ? F : _,
108
- onPaginationChange: m ? h : $,
109
+ onRowSelectionChange: q,
110
+ onColumnVisibilityChange: L,
111
+ onSortingChange: g ? S : B,
112
+ onColumnFiltersChange: l ? w : E,
113
+ onGlobalFilterChange: l ? F : J,
114
+ onPaginationChange: m ? h : O,
109
115
  manualPagination: m,
110
- manualSorting: u,
111
- manualFiltering: a,
112
- getCoreRowModel: Y(),
113
- getFilteredRowModel: X(),
114
- getPaginationRowModel: W(),
115
- getSortedRowModel: Q(),
116
- getFacetedRowModel: O(),
117
- getFacetedUniqueValues: K(),
116
+ manualSorting: g,
117
+ manualFiltering: l,
118
+ getCoreRowModel: re(),
119
+ getFilteredRowModel: ne(),
120
+ getPaginationRowModel: te(),
121
+ getSortedRowModel: ee(),
122
+ getFacetedRowModel: Z(),
123
+ getFacetedUniqueValues: Y(),
118
124
  defaultColumn: {
119
- filterFn: ne
125
+ filterFn: de
120
126
  }
121
- }), s = f.getRowModel().rows, E = () => v && s.length === 0 ? /* @__PURE__ */ e("div", { className: "flex h-64 w-full items-center justify-center", children: /* @__PURE__ */ e(me, { variant: "material-morph" }) }) : s.length === 0 ? /* @__PURE__ */ e("div", { className: "flex h-64 w-full items-center justify-center border-2 border-dashed border-outline-variant rounded-xl text-on-surface-variant", children: "No results found." }) : t === "masonry" ? /* @__PURE__ */ e(
122
- ce,
127
+ }), s = f.getRowModel().rows, Q = () => N && s.length === 0 ? /* @__PURE__ */ e("div", { className: "flex h-64 w-full items-center justify-center", children: /* @__PURE__ */ e(we, { variant: "material-morph" }) }) : s.length === 0 ? M ? M() : /* @__PURE__ */ e("div", { className: "flex h-64 w-full items-center justify-center border-2 border-dashed border-outline-variant rounded-xl p-6", children: /* @__PURE__ */ e(
128
+ le,
129
+ {
130
+ variant: "default",
131
+ icon: k ?? /* @__PURE__ */ e(ie, { className: "h-10 w-10 opacity-40 text-on-surface-variant" }),
132
+ title: j ?? "No results found.",
133
+ description: A ?? "Try adjusting your filters or search terms.",
134
+ action: G
135
+ }
136
+ ) }) : t === "masonry" ? /* @__PURE__ */ e(
137
+ Se,
123
138
  {
124
139
  columns: { default: 1, sm: 2, md: 3, lg: 4 },
125
140
  gap: "md",
126
- ...C,
127
- className: g,
141
+ ...D,
142
+ className: u,
128
143
  children: s.map((i) => /* @__PURE__ */ e(n.Fragment, { children: o(i) }, i.id))
129
144
  }
130
145
  ) : t === "grid" ? /* @__PURE__ */ e(
131
- de,
146
+ he,
132
147
  {
133
148
  columns: { default: 1, sm: 2, md: 3, lg: 4 },
134
149
  gap: "md",
135
150
  ...c,
136
- className: g,
151
+ className: u,
137
152
  children: s.map((i) => /* @__PURE__ */ e(n.Fragment, { children: o(i) }, i.id))
138
153
  }
139
- ) : /* @__PURE__ */ e("div", { className: `flex flex-col gap-4 ${g}`, children: s.map((i) => /* @__PURE__ */ e(n.Fragment, { children: o(i) }, i.id)) });
140
- return /* @__PURE__ */ e(te.Provider, { value: { table: f, searchViewProps: T }, children: /* @__PURE__ */ r("div", { className: "flex flex-col w-full space-y-6", children: [
141
- /* @__PURE__ */ r(oe, { bulkActions: I, children: [
142
- N,
143
- P && /* @__PURE__ */ e(ge, { table: f })
154
+ ) : /* @__PURE__ */ e("div", { className: `flex flex-col gap-4 ${u}`, children: s.map((i) => /* @__PURE__ */ e(n.Fragment, { children: o(i) }, i.id)) });
155
+ return /* @__PURE__ */ e(se.Provider, { value: { table: f, searchViewProps: V }, children: /* @__PURE__ */ r("div", { className: "flex flex-col w-full space-y-6", children: [
156
+ /* @__PURE__ */ r(me, { bulkActions: P, children: [
157
+ I,
158
+ T && /* @__PURE__ */ e(Fe, { table: f })
144
159
  ] }),
145
- /* @__PURE__ */ e("div", { className: "min-h-[200px]", children: E() }),
146
- /* @__PURE__ */ e(re, {})
160
+ /* @__PURE__ */ e("div", { className: "min-h-[200px]", children: Q() }),
161
+ /* @__PURE__ */ e(ce, {})
147
162
  ] }) });
148
163
  }
149
164
  export {
150
- ye as DataDisplay
165
+ Ae as DataDisplay
151
166
  };
@@ -2,17 +2,17 @@ import { jsx as a, jsxs as V } from "react/jsx-runtime";
2
2
  import { Slot as Ce } from "@radix-ui/react-slot";
3
3
  import { useLongPress as Ie } from "@uidotdev/usehooks";
4
4
  import { cva as $ } from "class-variance-authority";
5
- import { clsx as d } from "clsx";
6
- import { useMotionValue as we, useTransform as k, motion as h, AnimatePresence as ke, animate as j, cubicBezier as je } from "framer-motion";
5
+ import { clsx as c } from "clsx";
6
+ import { useMotionValue as we, useTransform as k, motion as h, AnimatePresence as ke, animate as D, cubicBezier as De } from "framer-motion";
7
7
  import * as o from "react";
8
- import { twMerge as c } from "tailwind-merge";
9
- import De from "use-ripple-hook";
8
+ import { twMerge as m } from "tailwind-merge";
9
+ import Pe from "use-ripple-hook";
10
10
  const _ = o.createContext({
11
11
  variant: "primary",
12
12
  size: "md",
13
13
  direction: "horizontal",
14
14
  expanded: !1
15
- }), b = () => o.useContext(_), Ee = $(
15
+ }), N = () => o.useContext(_), je = $(
16
16
  "group/item relative flex flex-wrap items-center transition-all duration-200 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 overflow-hidden z-0",
17
17
  {
18
18
  variants: {
@@ -72,7 +72,7 @@ const _ = o.createContext({
72
72
  elevation: "none"
73
73
  }
74
74
  }
75
- ), Se = $(
75
+ ), Ee = $(
76
76
  "flex shrink-0 items-center justify-center gap-2 [&_svg]:pointer-events-none transition-colors",
77
77
  {
78
78
  variants: {
@@ -98,13 +98,13 @@ const _ = o.createContext({
98
98
  shape: "minimal"
99
99
  }
100
100
  }
101
- ), Me = {
101
+ ), Se = {
102
102
  none: "gap-0",
103
103
  xs: "gap-0.5",
104
104
  sm: "gap-1",
105
105
  md: "gap-2",
106
106
  lg: "gap-4"
107
- }, Pe = (r, e, t, n) => {
107
+ }, Me = (r, e, t, n) => {
108
108
  const l = r === 0, u = r === e - 1, g = e === 1;
109
109
  if (t === "sharp") return "!rounded-none";
110
110
  if (g) {
@@ -132,7 +132,7 @@ const _ = o.createContext({
132
132
  gap: l = "xs",
133
133
  ...u
134
134
  }, g) => {
135
- const z = o.Children.toArray(e).filter(
135
+ const v = o.Children.toArray(e).filter(
136
136
  o.isValidElement
137
137
  );
138
138
  return /* @__PURE__ */ a(
@@ -141,27 +141,27 @@ const _ = o.createContext({
141
141
  ref: g,
142
142
  role: "group",
143
143
  "data-slot": "item-group",
144
- className: c(
145
- d(
144
+ className: m(
145
+ c(
146
146
  "flex",
147
147
  n === "vertical" ? "flex-col" : "flex-row",
148
- Me[l],
148
+ Se[l],
149
149
  r
150
150
  )
151
151
  ),
152
152
  ...u,
153
- children: z.map((N, p) => {
154
- const D = Pe(
155
- p,
156
- z.length,
153
+ children: v.map((y, d) => {
154
+ const P = Me(
155
+ d,
156
+ v.length,
157
157
  t,
158
158
  n
159
159
  );
160
- return o.cloneElement(N, {
161
- className: c(
162
- d(
163
- N.props.className,
164
- D,
160
+ return o.cloneElement(y, {
161
+ className: m(
162
+ c(
163
+ y.props.className,
164
+ P,
165
165
  "focus-visible:z-10"
166
166
  )
167
167
  )
@@ -177,7 +177,7 @@ const Be = o.forwardRef(({ className: r, ...e }, t) => /* @__PURE__ */ a(
177
177
  {
178
178
  ref: t,
179
179
  "data-slot": "item-separator",
180
- className: c(d("h-px w-full bg-outline-variant", r)),
180
+ className: m(c("h-px w-full bg-outline-variant", r)),
181
181
  ...e
182
182
  }
183
183
  ));
@@ -209,87 +209,87 @@ const B = {
209
209
  direction: l = "horizontal",
210
210
  padding: u = "md",
211
211
  bordered: g = !1,
212
- elevation: z = "none",
213
- asChild: N = !1,
214
- disabled: p,
215
- disableRipple: D = !1,
212
+ elevation: v = "none",
213
+ asChild: y = !1,
214
+ disabled: d,
215
+ disableRipple: P = !1,
216
216
  onLongPress: F,
217
217
  onPointerDown: R,
218
218
  expandable: H = !1,
219
- expanded: E,
219
+ expanded: j,
220
220
  defaultExpanded: T = !1,
221
221
  onExpandedChange: A,
222
- swipeType: v = "trigger",
222
+ swipeType: b = "trigger",
223
223
  swipeThreshold: C = 100,
224
224
  swipeRightAction: i,
225
225
  swipeLeftAction: s,
226
226
  onSwipeRight: X,
227
227
  onSwipeLeft: G,
228
- swipeRightOffset: S = 80,
229
- swipeLeftOffset: M = 80,
228
+ swipeRightOffset: E = 80,
229
+ swipeLeftOffset: S = 80,
230
230
  ...U
231
231
  }, L) => {
232
- const ee = N ? Ce : "div", y = o.useRef(null);
233
- o.useImperativeHandle(L, () => y.current);
234
- const W = e || "primary", q = t || "md", J = l || "horizontal", [te, re] = o.useState(T), I = E !== void 0 ? E : te, ne = () => {
235
- if (p) return;
236
- const f = !I;
237
- E === void 0 && re(f), A?.(f);
238
- }, ae = "var(--color-ripple-dark)", [, oe] = De({
239
- ref: y,
232
+ const ee = y ? Ce : "div", z = o.useRef(null);
233
+ o.useImperativeHandle(L, () => z.current);
234
+ const W = e || "primary", q = t || "md", J = l || "horizontal", [te, re] = o.useState(T), I = j !== void 0 ? j : te, ne = () => {
235
+ if (d) return;
236
+ const p = !I;
237
+ j === void 0 && re(p), A?.(p);
238
+ }, ae = "var(--color-ripple-dark)", [, oe] = Pe({
239
+ ref: z,
240
240
  color: ae,
241
241
  duration: 400,
242
- disabled: p || D
242
+ disabled: d || P
243
243
  }), ie = Ie(F ?? (() => {
244
244
  }), {
245
245
  threshold: 500
246
- }), se = (f) => {
247
- oe(f), R?.(f);
248
- }, P = !!i || !!s, m = we(0), [le, K] = o.useState(!1), de = k(m, [-1e3, 0, 1e3], [0, 0, 1e3]), ce = k(m, [-1e3, 0, 1e3], [1e3, 0, 0]), me = k(m, [0, 50], [0, 1]), ue = k(m, [0, -50], [0, 1]), fe = {
249
- left: v === "reveal" ? s ? -M : 0 : -1e3,
250
- right: v === "reveal" ? i ? S : 0 : 1e3
251
- }, pe = (f, ye) => {
252
- if (p) return;
253
- const w = ye?.offset?.x ?? 0, Y = m.get();
246
+ }), se = (p) => {
247
+ oe(p), R?.(p);
248
+ }, M = !!i || !!s, f = we(0), [le, K] = o.useState(!1), de = k(f, [-1e3, 0, 1e3], [0, 0, 1e3]), ce = k(f, [-1e3, 0, 1e3], [1e3, 0, 0]), me = k(f, [0, 50], [0, 1]), ue = k(f, [0, -50], [0, 1]), fe = {
249
+ left: b === "reveal" ? s ? -S : 0 : -1e3,
250
+ right: b === "reveal" ? i ? E : 0 : 1e3
251
+ }, pe = (p, ye) => {
252
+ if (d) return;
253
+ const w = ye?.offset?.x ?? 0, Y = f.get();
254
254
  let x = 0;
255
255
  const be = {
256
256
  type: "tween",
257
- ease: je(0.05, 0.7, 0.1, 1),
257
+ ease: De(0.05, 0.7, 0.1, 1),
258
258
  duration: 0.28
259
259
  };
260
- if (v === "dismiss") {
260
+ if (b === "dismiss") {
261
261
  if (w > C && i) {
262
- x = 600, j(m, x, { type: "tween", duration: 0.2 }).then(() => {
263
- y.current && (K(!0), i.onClick?.(), X?.());
262
+ x = 600, D(f, x, { type: "tween", duration: 0.2 }).then(() => {
263
+ z.current && (K(!0), i.onClick?.(), X?.());
264
264
  });
265
265
  return;
266
266
  } else if (w < -C && s) {
267
- x = -600, j(m, x, { type: "tween", duration: 0.2 }).then(() => {
268
- y.current && (K(!0), s.onClick?.(), G?.());
267
+ x = -600, D(f, x, { type: "tween", duration: 0.2 }).then(() => {
268
+ z.current && (K(!0), s.onClick?.(), G?.());
269
269
  });
270
270
  return;
271
271
  }
272
- } else if (v === "reveal") {
273
- const ze = S / 2, Ne = M / 2;
274
- Y > ze && i ? x = S : Y < -Ne && s && (x = -M);
272
+ } else if (b === "reveal") {
273
+ const ze = E / 2, Ne = S / 2;
274
+ Y > ze && i ? x = E : Y < -Ne && s && (x = -S);
275
275
  } else
276
276
  w > C && i ? (i.onClick?.(), X?.()) : w < -C && s && (s.onClick?.(), G?.());
277
- j(m, x, be);
277
+ D(f, x, be);
278
278
  }, ge = {
279
279
  ...U,
280
- "aria-disabled": p,
280
+ "aria-disabled": d,
281
281
  ...F ? ie : {},
282
282
  onPointerDown: se,
283
- onClick: (f) => {
284
- if (P && Math.abs(m.get()) > 5) {
285
- v === "reveal" && Math.abs(m.get()) > 10 && (f.stopPropagation(), f.preventDefault(), j(m, 0, {
283
+ onClick: (p) => {
284
+ if (M && Math.abs(f.get()) > 5) {
285
+ b === "reveal" && Math.abs(f.get()) > 10 && (p.stopPropagation(), p.preventDefault(), D(f, 0, {
286
286
  type: "tween",
287
287
  ease: [0.05, 0.7, 0.1, 1],
288
288
  duration: 0.25
289
289
  }));
290
290
  return;
291
291
  }
292
- H && ne(), U.onClick?.(f);
292
+ H && ne(), U.onClick?.(p);
293
293
  }
294
294
  }, xe = n === "full" ? I ? "rounded-[16px]" : "rounded-[32px]" : B[n || "minimal"], O = {
295
295
  variant: W,
@@ -299,35 +299,35 @@ const B = {
299
299
  }, Q = /* @__PURE__ */ a(
300
300
  ee,
301
301
  {
302
- ref: P ? void 0 : y,
302
+ ref: M ? void 0 : z,
303
303
  "data-slot": "item",
304
- className: c(
305
- d(
306
- Ee({
304
+ className: m(
305
+ c(
306
+ je({
307
307
  variant: W,
308
308
  size: q,
309
309
  shape: n === "full" ? void 0 : n,
310
310
  direction: J,
311
311
  padding: u,
312
312
  bordered: g,
313
- elevation: z
313
+ elevation: v
314
314
  }),
315
315
  n === "full" && (I ? "rounded-[16px]" : "rounded-[32px]"),
316
316
  H && "cursor-pointer",
317
317
  r,
318
- p && "opacity-50 cursor-not-allowed pointer-events-none"
318
+ d && "opacity-50 cursor-not-allowed pointer-events-none"
319
319
  )
320
320
  ),
321
321
  ...ge
322
322
  }
323
323
  );
324
- if (!P)
324
+ if (!M)
325
325
  return /* @__PURE__ */ a(_.Provider, { value: O, children: Q });
326
326
  const he = i?.shape ? B[i.shape] : "rounded-[inherit]", ve = s?.shape ? B[s.shape] : "rounded-[inherit]";
327
327
  return /* @__PURE__ */ a(_.Provider, { value: O, children: /* @__PURE__ */ V(
328
328
  h.div,
329
329
  {
330
- className: d(
330
+ className: c(
331
331
  "relative w-full overflow-hidden z-0 bg-transparent transform-gpu will-change-[height,opacity] transition-all duration-200 ease-out",
332
332
  xe
333
333
  ),
@@ -346,8 +346,8 @@ const B = {
346
346
  h.div,
347
347
  {
348
348
  style: { width: de },
349
- className: c(
350
- d(
349
+ className: m(
350
+ c(
351
351
  "absolute inset-y-0 left-0 flex items-center justify-center overflow-hidden z-0 transform-gpu will-change-[width,opacity]",
352
352
  he,
353
353
  Z(i.color),
@@ -371,8 +371,8 @@ const B = {
371
371
  h.div,
372
372
  {
373
373
  style: { width: ce },
374
- className: c(
375
- d(
374
+ className: m(
375
+ c(
376
376
  "absolute inset-y-0 right-0 flex items-center justify-center overflow-hidden z-0 transform-gpu will-change-[width,opacity]",
377
377
  ve,
378
378
  Z(s.color),
@@ -395,14 +395,15 @@ const B = {
395
395
  /* @__PURE__ */ a(
396
396
  h.div,
397
397
  {
398
- ref: y,
399
- style: { x: m },
400
- drag: p ? !1 : "x",
398
+ ref: z,
399
+ style: { x: f },
400
+ drag: d ? !1 : "x",
401
401
  dragDirectionLock: !0,
402
402
  dragConstraints: fe,
403
- dragElastic: v === "reveal" ? 0.2 : 0.3,
403
+ dragElastic: b === "reveal" ? 0.2 : 0.3,
404
404
  onDragEnd: pe,
405
- className: "relative z-10 w-full rounded-[inherit] cursor-pointer transform-gpu will-change-transform",
405
+ "data-vaul-no-drag": !0,
406
+ className: "relative z-10 w-full rounded-[inherit] cursor-pointer transform-gpu will-change-transform touch-pan-y",
406
407
  children: Q
407
408
  }
408
409
  )
@@ -411,15 +412,15 @@ const B = {
411
412
  ) });
412
413
  }
413
414
  ), _e = o.forwardRef(({ className: r, variant: e, shape: t = "minimal", ...n }, l) => {
414
- const { size: u, direction: g } = b();
415
+ const { size: u, direction: g } = N();
415
416
  return /* @__PURE__ */ a(
416
417
  "div",
417
418
  {
418
419
  ref: l,
419
420
  "data-slot": "item-media",
420
- className: c(
421
- d(
422
- Se({
421
+ className: m(
422
+ c(
423
+ Ee({
423
424
  variant: e,
424
425
  size: u,
425
426
  shape: t,
@@ -434,14 +435,14 @@ const B = {
434
435
  });
435
436
  _e.displayName = "ItemMedia";
436
437
  const Fe = o.forwardRef(({ className: r, ...e }, t) => {
437
- const { direction: n } = b();
438
+ const { direction: n } = N();
438
439
  return /* @__PURE__ */ a(
439
440
  "div",
440
441
  {
441
442
  ref: t,
442
443
  "data-slot": "item-content",
443
- className: c(
444
- d(
444
+ className: m(
445
+ c(
445
446
  "flex flex-1 flex-col gap-0.5 min-w-0 z-10",
446
447
  n === "vertical" && "items-center",
447
448
  r
@@ -453,14 +454,14 @@ const Fe = o.forwardRef(({ className: r, ...e }, t) => {
453
454
  });
454
455
  Fe.displayName = "ItemContent";
455
456
  const He = o.forwardRef(({ className: r, ...e }, t) => {
456
- const { direction: n } = b();
457
+ const { direction: n } = N();
457
458
  return /* @__PURE__ */ a(
458
459
  "div",
459
460
  {
460
461
  ref: t,
461
462
  "data-slot": "item-title",
462
- className: c(
463
- d(
463
+ className: m(
464
+ c(
464
465
  "flex w-fit items-center gap-2 text-title-medium font-semibold leading-snug text-inherit",
465
466
  n === "vertical" && "justify-center",
466
467
  r
@@ -472,14 +473,14 @@ const He = o.forwardRef(({ className: r, ...e }, t) => {
472
473
  });
473
474
  He.displayName = "ItemTitle";
474
475
  const Xe = o.forwardRef(({ className: r, collapsedLines: e = 2, ...t }, n) => {
475
- const { expanded: l } = b();
476
+ const { expanded: l } = N();
476
477
  return /* @__PURE__ */ a(
477
478
  "p",
478
479
  {
479
480
  ref: n,
480
481
  "data-slot": "item-description",
481
- className: c(
482
- d(
482
+ className: m(
483
+ c(
483
484
  "opacity-80 text-sm font-normal leading-normal text-inherit transition-all duration-200",
484
485
  l ? "" : e === 1 ? "line-clamp-1" : e === 2 ? "line-clamp-2" : e === 3 ? "line-clamp-3" : e === 4 ? "line-clamp-4" : e === 5 ? "line-clamp-5" : e === 6 ? "line-clamp-6" : "",
485
486
  r
@@ -491,14 +492,14 @@ const Xe = o.forwardRef(({ className: r, collapsedLines: e = 2, ...t }, n) => {
491
492
  });
492
493
  Xe.displayName = "ItemDescription";
493
494
  const Ge = o.forwardRef(({ className: r, ...e }, t) => {
494
- const { direction: n } = b();
495
+ const { direction: n } = N();
495
496
  return /* @__PURE__ */ a(
496
497
  "div",
497
498
  {
498
499
  ref: t,
499
500
  "data-slot": "item-actions",
500
- className: c(
501
- d(
501
+ className: m(
502
+ c(
502
503
  "flex items-center gap-2 z-10",
503
504
  n === "horizontal" ? "ml-auto pl-4" : "mt-2",
504
505
  r
@@ -509,18 +510,24 @@ const Ge = o.forwardRef(({ className: r, ...e }, t) => {
509
510
  );
510
511
  });
511
512
  Ge.displayName = "ItemActions";
512
- const Ue = o.forwardRef(({ className: r, children: e, ...t }, n) => {
513
- const { expanded: l } = b();
514
- return /* @__PURE__ */ a(ke, { initial: !1, children: l && /* @__PURE__ */ a(
513
+ const Ue = o.forwardRef(({ className: r, children: e, onClick: t, onPointerDown: n, ...l }, u) => {
514
+ const { expanded: g } = N(), v = (d) => {
515
+ d.stopPropagation(), t?.(d);
516
+ }, y = (d) => {
517
+ d.stopPropagation(), n?.(d);
518
+ };
519
+ return /* @__PURE__ */ a(ke, { initial: !1, children: g && /* @__PURE__ */ a(
515
520
  h.div,
516
521
  {
517
- ref: n,
522
+ ref: u,
518
523
  initial: { height: 0, opacity: 0 },
519
524
  animate: { height: "auto", opacity: 1 },
520
525
  exit: { height: 0, opacity: 0 },
521
526
  transition: { duration: 0.3, ease: [0.2, 0, 0, 1] },
522
- className: c("overflow-hidden w-full", r),
523
- ...t,
527
+ className: m("overflow-hidden w-full", r),
528
+ onClick: v,
529
+ onPointerDown: y,
530
+ ...l,
524
531
  children: /* @__PURE__ */ a("div", { className: "pt-2 pb-1", children: e })
525
532
  }
526
533
  ) });
@@ -531,8 +538,8 @@ const We = o.forwardRef(({ className: r, ...e }, t) => /* @__PURE__ */ a(
531
538
  {
532
539
  ref: t,
533
540
  "data-slot": "item-header",
534
- className: c(
535
- d("flex basis-full items-center justify-between gap-2", r)
541
+ className: m(
542
+ c("flex basis-full items-center justify-between gap-2", r)
536
543
  ),
537
544
  ...e
538
545
  }
@@ -543,8 +550,8 @@ const qe = o.forwardRef(({ className: r, ...e }, t) => /* @__PURE__ */ a(
543
550
  {
544
551
  ref: t,
545
552
  "data-slot": "item-footer",
546
- className: c(
547
- d(
553
+ className: m(
554
+ c(
548
555
  "flex basis-full items-center justify-between gap-2 mt-2",
549
556
  r
550
557
  )
@@ -565,5 +572,5 @@ export {
565
572
  _e as ItemMedia,
566
573
  Be as ItemSeparator,
567
574
  He as ItemTitle,
568
- b as useItem
575
+ N as useItem
569
576
  };
@@ -1,10 +1,11 @@
1
- import { jsxs as a, jsx as n } from "react/jsx-runtime";
2
- import { cva as z } from "class-variance-authority";
1
+ import { jsxs as o, jsx as n } from "react/jsx-runtime";
2
+ import { cva as E } from "class-variance-authority";
3
3
  import { clsx as i } from "clsx";
4
4
  import { motion as h } from "framer-motion";
5
- import { Check as D, X as A } from "lucide-react";
6
- import y, { useState as K } from "react";
7
- const R = z(
5
+ import { Check as A, X as K } from "lucide-react";
6
+ import w, { useState as L } from "react";
7
+ import { useLayout as W } from "../../context/layout-context.mjs";
8
+ const X = E(
8
9
  "relative border-2 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50 outline-none rounded-full transition-colors duration-300",
9
10
  {
10
11
  variants: {
@@ -22,43 +23,50 @@ const R = z(
22
23
  size: "md"
23
24
  }
24
25
  }
25
- ), W = {
26
+ ), _ = {
26
27
  type: "spring",
27
28
  stiffness: 700,
28
29
  damping: 30
29
- }, w = {
30
+ }, k = {
30
31
  type: "spring",
31
32
  stiffness: 500,
32
33
  damping: 25
33
- }, _ = y.forwardRef(
34
+ }, q = w.forwardRef(
34
35
  ({
35
- className: k,
36
- size: o = "md",
37
- label: l,
38
- description: u,
39
- withIcons: N = !0,
40
- showUncheckedIcon: b = !1,
41
- checked: c,
42
- defaultChecked: I,
43
- onCheckedChange: m,
36
+ className: N,
37
+ size: c = "md",
38
+ label: u,
39
+ description: m,
40
+ withIcons: b = !0,
41
+ showUncheckedIcon: I = !1,
42
+ checked: l,
43
+ defaultChecked: j,
44
+ onCheckedChange: d,
44
45
  disabled: t,
45
- id: j,
46
- ...d
47
- }, S) => {
48
- const T = y.useId(), p = j || T, [C, g] = K(
49
- I ?? !1
50
- ), e = c !== void 0 ? c : C, x = (r) => {
46
+ id: S,
47
+ ...p
48
+ }, T) => {
49
+ const C = w.useId(), g = S || C;
50
+ let s = !1;
51
+ try {
52
+ s = W().isRtl;
53
+ } catch {
54
+ typeof window < "u" && (s = document.documentElement.dir === "rtl" || document.documentElement.classList.contains("rtl"));
55
+ }
56
+ const [R, y] = L(
57
+ j ?? !1
58
+ ), e = l !== void 0 ? l : R, x = (r) => {
51
59
  if (t) return;
52
- const s = r.target.checked;
53
- c === void 0 && g(s), m?.(s), d.onChange?.(r);
60
+ const a = r.target.checked;
61
+ l === void 0 && y(a), d?.(a), p.onChange?.(r);
54
62
  }, V = (r) => {
55
63
  if (!t && (r.key === "Enter" || r.key === " ")) {
56
64
  r.preventDefault();
57
- const s = !e;
58
- c === void 0 && g(s), m?.(s);
65
+ const a = !e;
66
+ l === void 0 && y(a), d?.(a);
59
67
  }
60
68
  }, f = (() => {
61
- switch (o) {
69
+ switch (c) {
62
70
  case "sm":
63
71
  return {
64
72
  width: e ? 16 : 12,
@@ -78,12 +86,12 @@ const R = z(
78
86
  x: e ? 22 : 7
79
87
  };
80
88
  }
81
- })(), v = o === "sm" ? 10 : o === "lg" ? 20 : 16;
82
- return /* @__PURE__ */ a("div", { className: i("inline-flex items-center gap-3", k), children: [
83
- /* @__PURE__ */ a(
89
+ })(), z = s ? -1 : 1, D = f.x * z, v = c === "sm" ? 10 : c === "lg" ? 20 : 16;
90
+ return /* @__PURE__ */ o("div", { className: i("inline-flex items-center gap-3", N), children: [
91
+ /* @__PURE__ */ o(
84
92
  "label",
85
93
  {
86
- htmlFor: p,
94
+ htmlFor: g,
87
95
  className: i(
88
96
  "relative inline-flex items-center group outline-none rounded-full select-none",
89
97
  !t && "cursor-pointer",
@@ -96,35 +104,39 @@ const R = z(
96
104
  "input",
97
105
  {
98
106
  type: "checkbox",
99
- id: p,
100
- ref: S,
107
+ id: g,
108
+ ref: T,
101
109
  className: "sr-only",
102
110
  checked: e,
103
111
  onChange: x,
104
112
  disabled: t,
105
113
  tabIndex: -1,
106
- ...d
114
+ ...p
107
115
  }
108
116
  ),
109
117
  /* @__PURE__ */ n(
110
118
  "div",
111
119
  {
112
120
  className: i(
113
- R({ size: o, checked: e }),
121
+ X({ size: c, checked: e }),
114
122
  t && e && "bg-on-surface/12 border-transparent",
115
123
  t && !e && "bg-surface-container-highest/38 border-on-surface/12"
116
124
  ),
117
- children: /* @__PURE__ */ a(
125
+ children: /* @__PURE__ */ o(
118
126
  h.div,
119
127
  {
120
- transition: W,
128
+ transition: _,
121
129
  initial: !1,
122
130
  animate: {
123
- x: f.x,
131
+ x: D,
124
132
  width: f.width,
125
133
  height: f.height,
126
134
  backgroundColor: e ? "var(--md-sys-color-on-primary)" : "var(--md-sys-color-outline-variant)"
127
135
  },
136
+ style: {
137
+ left: s ? "auto" : 0,
138
+ right: s ? 0 : "auto"
139
+ },
128
140
  className: i(
129
141
  "absolute top-1/2 -translate-y-1/2 rounded-full shadow-sm flex items-center justify-center z-10",
130
142
  t && "!bg-on-surface/38"
@@ -142,8 +154,8 @@ const R = z(
142
154
  }
143
155
  }
144
156
  ),
145
- /* @__PURE__ */ a("div", { className: "relative w-full h-full flex items-center justify-center overflow-hidden", children: [
146
- N && /* @__PURE__ */ n(
157
+ /* @__PURE__ */ o("div", { className: "relative w-full h-full flex items-center justify-center overflow-hidden", children: [
158
+ b && /* @__PURE__ */ n(
147
159
  h.div,
148
160
  {
149
161
  initial: !1,
@@ -152,9 +164,9 @@ const R = z(
152
164
  opacity: e ? 1 : 0,
153
165
  rotate: e ? 0 : -90
154
166
  },
155
- transition: w,
167
+ transition: k,
156
168
  children: /* @__PURE__ */ n(
157
- D,
169
+ A,
158
170
  {
159
171
  size: v,
160
172
  strokeWidth: 4,
@@ -163,7 +175,7 @@ const R = z(
163
175
  )
164
176
  }
165
177
  ),
166
- b && /* @__PURE__ */ n(
178
+ I && /* @__PURE__ */ n(
167
179
  h.div,
168
180
  {
169
181
  initial: !1,
@@ -173,9 +185,9 @@ const R = z(
173
185
  opacity: e ? 0 : 1,
174
186
  rotate: e ? 90 : 0
175
187
  },
176
- transition: w,
188
+ transition: k,
177
189
  children: /* @__PURE__ */ n(
178
- A,
190
+ K,
179
191
  {
180
192
  size: v - 2,
181
193
  strokeWidth: 3,
@@ -193,30 +205,30 @@ const R = z(
193
205
  ]
194
206
  }
195
207
  ),
196
- (l || u) && /* @__PURE__ */ a(
208
+ (u || m) && /* @__PURE__ */ o(
197
209
  "div",
198
210
  {
199
211
  className: i("flex flex-col", !t && "cursor-pointer"),
200
212
  onClick: () => !t && x({ target: { checked: !e } }),
201
213
  children: [
202
- l && /* @__PURE__ */ n(
214
+ u && /* @__PURE__ */ n(
203
215
  "span",
204
216
  {
205
217
  className: i(
206
218
  "text-sm font-medium select-none",
207
219
  t ? "text-on-surface/38" : "text-on-surface"
208
220
  ),
209
- children: l
221
+ children: u
210
222
  }
211
223
  ),
212
- u && /* @__PURE__ */ n(
224
+ m && /* @__PURE__ */ n(
213
225
  "span",
214
226
  {
215
227
  className: i(
216
228
  "text-xs select-none",
217
229
  t ? "text-on-surface-variant/38" : "text-on-surface-variant"
218
230
  ),
219
- children: u
231
+ children: m
220
232
  }
221
233
  )
222
234
  ]
@@ -225,7 +237,7 @@ const R = z(
225
237
  ] });
226
238
  }
227
239
  );
228
- _.displayName = "Switch";
240
+ q.displayName = "Switch";
229
241
  export {
230
- _ as Switch
242
+ q as Switch
231
243
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "chesai-ui",
3
3
  "private": false,
4
- "version": "0.16.7",
4
+ "version": "0.16.9",
5
5
  "packageManager": "pnpm@10.12.1",
6
6
  "repository": {
7
7
  "type": "git",