chesai-ui 0.16.8 → 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.
@@ -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
  };
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "chesai-ui",
3
3
  "private": false,
4
- "version": "0.16.8",
4
+ "version": "0.16.9",
5
+ "packageManager": "pnpm@10.12.1",
5
6
  "repository": {
6
7
  "type": "git",
7
8
  "url": "https://github.com/ayhamdev/chesai-ui"
@@ -24,6 +25,19 @@
24
25
  "engines": {
25
26
  "node": ">=22"
26
27
  },
28
+ "scripts": {
29
+ "dev": "bunx storybook dev -p 8000",
30
+ "build": "storybook build",
31
+ "build:lib": "tsc && vite build",
32
+ "build:docs": "npx ts-node ./scripts/generate-llm.ts",
33
+ "lint": "npx @biomejs/biome lint --write ./src",
34
+ "format": "npx @biomejs/biome check --write --organize-imports-enabled=true ./src",
35
+ "test": "vitest",
36
+ "test:cov": "vitest run --coverage",
37
+ "gen:context": "bun run ./scripts/context.ts",
38
+ "git:diff-merge": "git diff --unified=2000 $(git merge-base main HEAD)...HEAD",
39
+ "git:diff": "git diff --unified=2000 > git-changes.txt"
40
+ },
27
41
  "dependencies": {
28
42
  "@capacitor/app": "^8.0.0",
29
43
  "@capacitor/core": "^8.0.1",
@@ -154,18 +168,5 @@
154
168
  "biome lint --write --no-errors-on-unmatched --files-ignore-unknown=true",
155
169
  "biome format --write --no-errors-on-unmatched"
156
170
  ]
157
- },
158
- "scripts": {
159
- "dev": "bunx storybook dev -p 8000",
160
- "build": "storybook build",
161
- "build:lib": "tsc && vite build",
162
- "build:docs": "npx ts-node ./scripts/generate-llm.ts",
163
- "lint": "npx @biomejs/biome lint --write ./src",
164
- "format": "npx @biomejs/biome check --write --organize-imports-enabled=true ./src",
165
- "test": "vitest",
166
- "test:cov": "vitest run --coverage",
167
- "gen:context": "bun run ./scripts/context.ts",
168
- "git:diff-merge": "git diff --unified=2000 $(git merge-base main HEAD)...HEAD",
169
- "git:diff": "git diff --unified=2000 > git-changes.txt"
170
171
  }
171
- }
172
+ }