@zyncat/ui 0.8.0 → 0.9.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 (67) hide show
  1. package/dist/alert.js +5 -6
  2. package/dist/alert.js.map +1 -1
  3. package/dist/chunk-2QWJ6FAX.js +78 -0
  4. package/dist/chunk-2QWJ6FAX.js.map +1 -0
  5. package/dist/{chunk-MXOPCFWR.js → chunk-356HZMT4.js} +25 -4
  6. package/dist/chunk-356HZMT4.js.map +1 -0
  7. package/dist/{chunk-2HORSLXJ.js → chunk-7RNRLIKT.js} +16 -7
  8. package/dist/chunk-7RNRLIKT.js.map +1 -0
  9. package/dist/{chunk-4R2GQO43.js → chunk-FLO4A6BI.js} +4 -4
  10. package/dist/{chunk-4R2GQO43.js.map → chunk-FLO4A6BI.js.map} +1 -1
  11. package/dist/{chunk-XZAEIQDR.js → chunk-GLT5IKQY.js} +5 -5
  12. package/dist/{chunk-XZAEIQDR.js.map → chunk-GLT5IKQY.js.map} +1 -1
  13. package/dist/{chunk-QMSJZCK3.js → chunk-Q5B7JTSR.js} +5 -5
  14. package/dist/{chunk-QMSJZCK3.js.map → chunk-Q5B7JTSR.js.map} +1 -1
  15. package/dist/{chunk-O4N2OBTR.js → chunk-W5YM2FV4.js} +4 -4
  16. package/dist/{chunk-O4N2OBTR.js.map → chunk-W5YM2FV4.js.map} +1 -1
  17. package/dist/{chunk-MKIQFK7S.js → chunk-WM5J5TDI.js} +3 -3
  18. package/dist/{chunk-MKIQFK7S.js.map → chunk-WM5J5TDI.js.map} +1 -1
  19. package/dist/{chunk-W3SHPKSB.js → chunk-XWUWYSCT.js} +16 -6
  20. package/dist/chunk-XWUWYSCT.js.map +1 -0
  21. package/dist/{chunk-L3Q3VDIW.js → chunk-YGCVWGUG.js} +6 -32
  22. package/dist/chunk-YGCVWGUG.js.map +1 -0
  23. package/dist/date-field.js +7 -7
  24. package/dist/date-range-field.js +31 -12
  25. package/dist/date-range-field.js.map +1 -1
  26. package/dist/datetime-field.js +7 -7
  27. package/dist/dialog.js +4 -4
  28. package/dist/glide.js +2 -2
  29. package/dist/motion-devtools.js +1 -1
  30. package/dist/multi-select.js +5 -5
  31. package/dist/pagination.js +1 -1
  32. package/dist/popover.js +4 -4
  33. package/dist/radio-group.js +36 -9
  34. package/dist/radio-group.js.map +1 -1
  35. package/dist/select.js +5 -5
  36. package/dist/sheet.js +5 -5
  37. package/dist/table.js +6 -6
  38. package/dist/table.js.map +1 -1
  39. package/dist/tabs.js +2 -2
  40. package/dist/tag.js +7 -7
  41. package/dist/tag.js.map +1 -1
  42. package/dist/toast.js +4 -5
  43. package/dist/toast.js.map +1 -1
  44. package/dist/tooltip.js +3 -3
  45. package/llms.txt +6 -6
  46. package/package.json +2 -1
  47. package/src/components/composites/date-picker/calendar-panel.tsx +12 -3
  48. package/src/components/composites/date-picker/range-panel.tsx +19 -5
  49. package/src/components/composites/table/Table.tsx +4 -2
  50. package/src/components/primitives/radio-group/RadioGroup.tsx +26 -7
  51. package/src/components/primitives/tag/Tag.tsx +2 -1
  52. package/src/engine/ease.ts +7 -39
  53. package/src/engine/index.ts +1 -11
  54. package/src/motion/element.tsx +9 -9
  55. package/src/motion/flip.ts +61 -0
  56. package/src/motion/presence-context.ts +4 -3
  57. package/src/motion/presence.tsx +25 -1
  58. package/src/motion/use-motion.ts +13 -2
  59. package/dist/chunk-2HORSLXJ.js.map +0 -1
  60. package/dist/chunk-36WVAQKL.js +0 -40
  61. package/dist/chunk-36WVAQKL.js.map +0 -1
  62. package/dist/chunk-JSKXZMLH.js +0 -67
  63. package/dist/chunk-JSKXZMLH.js.map +0 -1
  64. package/dist/chunk-L3Q3VDIW.js.map +0 -1
  65. package/dist/chunk-MXOPCFWR.js.map +0 -1
  66. package/dist/chunk-W3SHPKSB.js.map +0 -1
  67. package/src/motion/flip.tsx +0 -87
@@ -1,87 +0,0 @@
1
- 'use client';
2
-
3
- import { useLayoutEffect, useRef, type RefObject } from 'react';
4
- import {
5
- dropShared,
6
- flip,
7
- keepShared,
8
- measure,
9
- readShared,
10
- type Box,
11
- type FlipOptions,
12
- type Playback,
13
- } from '../engine';
14
- import { UIMotion } from '../tokens/motion-tokens';
15
-
16
- export type FlipTuning = FlipOptions;
17
-
18
- export function useSelfFlip<T extends HTMLElement>(tuning: FlipTuning = {}, enabled = true): RefObject<T | null> {
19
- const ref = useRef<T | null>(null);
20
- const previous = useRef<Box | null>(null);
21
- const playing = useRef<Playback | null>(null);
22
- const { scale, timing } = tuning;
23
-
24
- useLayoutEffect(() => {
25
- const el = ref.current;
26
- if (!el || !enabled) return;
27
- const from = playing.current ? measure(el) : previous.current;
28
- playing.current?.stop();
29
- previous.current = measure(el);
30
- const next = from && !UIMotion.reduced ? flip(el, from, { scale, timing }) : null;
31
- playing.current = next;
32
- next?.finished.then(() => {
33
- if (playing.current === next) playing.current = null;
34
- });
35
- });
36
-
37
- useLayoutEffect(
38
- () => () => {
39
- playing.current?.stop();
40
- },
41
- [],
42
- );
43
-
44
- return ref;
45
- }
46
-
47
- export function useSharedFlip<T extends HTMLElement>(
48
- id: string,
49
- tuning: FlipTuning = {},
50
- enabled = true,
51
- ): RefObject<T | null> {
52
- const ref = useRef<T | null>(null);
53
- const playing = useRef<{ play: Playback; el: T } | null>(null);
54
- const { scale, timing } = tuning;
55
-
56
- useLayoutEffect(() => {
57
- const el = ref.current;
58
- if (!el || !enabled) return;
59
- const live = playing.current;
60
- const from = live && live.el === el ? measure(el) : readShared(id);
61
- live?.play.stop();
62
- keepShared(id, measure(el));
63
- const next = from && !UIMotion.reduced ? flip(el, from, { scale, timing }) : null;
64
- playing.current = next ? { play: next, el } : null;
65
- next?.finished.then(() => {
66
- if (playing.current?.play === next) playing.current = null;
67
- });
68
- });
69
-
70
- useLayoutEffect(() => {
71
- if (!enabled) return;
72
- return () => {
73
- const live = playing.current;
74
- if (live) {
75
- const box = measure(live.el);
76
- if (box.width && box.height) keepShared(id, box);
77
- live.play.stop();
78
- }
79
- const mine = readShared(id);
80
- queueMicrotask(() => {
81
- if (readShared(id) === mine) dropShared(id);
82
- });
83
- };
84
- }, [id, enabled]);
85
-
86
- return ref;
87
- }