@photon-ai/pho-ui 4.11.0 → 4.12.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 (48) hide show
  1. package/dist/chunks/animated-height-zr7BmFY1.js +56 -0
  2. package/dist/chunks/animated-height-zr7BmFY1.js.map +1 -0
  3. package/dist/chunks/basic-page-CJ11ekjH.js +2217 -0
  4. package/dist/chunks/basic-page-CJ11ekjH.js.map +1 -0
  5. package/dist/chunks/{chat-B0WIgEyM.js → chat-CU3XVm99.js} +2 -2
  6. package/dist/chunks/{chat-B0WIgEyM.js.map → chat-CU3XVm99.js.map} +1 -1
  7. package/dist/chunks/{checkbox-CLPmblNA.js → checkbox-CwvoEJhd.js} +2 -2
  8. package/dist/chunks/{checkbox-CLPmblNA.js.map → checkbox-CwvoEJhd.js.map} +1 -1
  9. package/dist/chunks/choice-card-_Ocs0iUj.js +17 -0
  10. package/dist/chunks/choice-card-_Ocs0iUj.js.map +1 -0
  11. package/dist/chunks/{command-iYvU6Mhf.js → command-D5g49VqR.js} +3 -3
  12. package/dist/chunks/{command-iYvU6Mhf.js.map → command-D5g49VqR.js.map} +1 -1
  13. package/dist/chunks/{data-table-B1dmrN6r.js → data-table-Ce_c6T73.js} +3 -3
  14. package/dist/chunks/{data-table-B1dmrN6r.js.map → data-table-Ce_c6T73.js.map} +1 -1
  15. package/dist/chunks/{dialog-MPvem7yV.js → dialog-ChS0tdHa.js} +120 -116
  16. package/dist/chunks/dialog-ChS0tdHa.js.map +1 -0
  17. package/dist/chunks/{filter-bar-B-oYYBsU.js → filter-bar-CMkvhvgL.js} +2 -2
  18. package/dist/chunks/{filter-bar-B-oYYBsU.js.map → filter-bar-CMkvhvgL.js.map} +1 -1
  19. package/dist/chunks/{input-DjvZoF8v.js → input-fFWvPJOf.js} +2 -1
  20. package/dist/chunks/{input-DjvZoF8v.js.map → input-fFWvPJOf.js.map} +1 -1
  21. package/dist/components/chat.js +1 -1
  22. package/dist/components/checkbox.js +1 -1
  23. package/dist/components/command.js +1 -1
  24. package/dist/components/data-table.js +1 -1
  25. package/dist/components/dialog.js +1 -1
  26. package/dist/components/field.js +34 -29
  27. package/dist/components/field.js.map +1 -1
  28. package/dist/components/filter-bar.js +1 -1
  29. package/dist/components/input.js +1 -1
  30. package/dist/components/radio-group.js +64 -59
  31. package/dist/components/radio-group.js.map +1 -1
  32. package/dist/index.js +6 -6
  33. package/dist/sections/basic-page.js +2 -2
  34. package/dist/src/components/dialog/dialog.d.ts +9 -1
  35. package/dist/src/components/field/field.d.ts +11 -1
  36. package/dist/src/components/radio-group/radio-card.d.ts +11 -4
  37. package/dist/src/sections/basic-page/basic-page.d.ts +145 -15
  38. package/dist/src/sections/basic-page/index.d.ts +1 -1
  39. package/dist/src/utils/animated-height.d.ts +16 -7
  40. package/dist/src/utils/choice-card.d.ts +8 -1
  41. package/package.json +1 -1
  42. package/dist/chunks/animated-height-I44sUq0n.js +0 -48
  43. package/dist/chunks/animated-height-I44sUq0n.js.map +0 -1
  44. package/dist/chunks/basic-page-B5FsORRi.js +0 -1885
  45. package/dist/chunks/basic-page-B5FsORRi.js.map +0 -1
  46. package/dist/chunks/choice-card-BVNP1NB6.js +0 -17
  47. package/dist/chunks/choice-card-BVNP1NB6.js.map +0 -1
  48. package/dist/chunks/dialog-MPvem7yV.js.map +0 -1
@@ -0,0 +1,56 @@
1
+ "use client";
2
+ import { SPRING_SETTLE as v } from "../motion.js";
3
+ import { useEffect as b, useRef as a } from "react";
4
+ import { jsx as d } from "react/jsx-runtime";
5
+ import { animate as g, motion as S, useMotionValue as z, useReducedMotion as w } from "motion/react";
6
+ var R = v;
7
+ function y(o, r, i, n) {
8
+ const e = z("auto"), s = w();
9
+ return b(() => {
10
+ const c = r.current, l = i.current;
11
+ if (!c || !l) return;
12
+ let t = null;
13
+ const h = new ResizeObserver((p) => {
14
+ const u = p[0]?.borderBoxSize?.[0], f = u ? o === "height" ? u.blockSize : u.inlineSize : o === "height" ? l.offsetHeight : l.offsetWidth, m = e.get();
15
+ if (m === "auto" || s) {
16
+ t?.stop(), t = null, c.style.overflow = "", e.set(f);
17
+ return;
18
+ }
19
+ !t && Math.abs(m - f) < 0.5 || (c.style.overflow = "hidden", t?.stop(), t = g(e, f, {
20
+ ...n,
21
+ onComplete: () => {
22
+ t = null, c.style.overflow = "";
23
+ }
24
+ }));
25
+ });
26
+ return h.observe(l), () => {
27
+ h.disconnect(), t?.stop();
28
+ };
29
+ }, [
30
+ o,
31
+ r,
32
+ i,
33
+ e,
34
+ s,
35
+ n
36
+ ]), e;
37
+ }
38
+ function G({ className: o, transition: r, children: i }) {
39
+ const n = a(null), e = a(null), s = y("height", n, e, r ?? R);
40
+ return /* @__PURE__ */ d(S.div, {
41
+ ref: n,
42
+ className: "min-h-0",
43
+ style: { height: s },
44
+ children: /* @__PURE__ */ d("div", {
45
+ ref: e,
46
+ className: o,
47
+ children: i
48
+ })
49
+ });
50
+ }
51
+ export {
52
+ y as n,
53
+ G as t
54
+ };
55
+
56
+ //# sourceMappingURL=animated-height-zr7BmFY1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animated-height-zr7BmFY1.js","names":[],"sources":["../../src/utils/animated-height.tsx"],"sourcesContent":["import { useEffect, useRef, type ReactNode, type RefObject } from \"react\";\nimport { SPRING_SETTLE } from \"../motion\";\nimport {\n animate,\n motion,\n useMotionValue,\n useReducedMotion,\n type MotionValue,\n type ValueAnimationTransition,\n} from \"motion/react\";\n\n/**\n * Height spring for container-size transitions — same feel as the onboarding /\n * invite card and BasicPage footer reveal: quick, critically damped (no\n * overshoot that would flash clipped content).\n */\nconst HEIGHT_SPRING = SPRING_SETTLE;\n\n/**\n * Keeps a container's size on one axis following the measured size of its\n * content on a spring — the core of `AnimatedHeight`, and of any part whose\n * box should glide as its content changes (a paged `Onboard`'s step titles\n * follow their words' width this way). Returns the motion value to put on\n * the container's `style`. Reduced motion snaps it.\n *\n * The container clips only while the spring is in flight. ResizeObserver\n * callbacks run after layout but before paint, so the clip lands before the\n * swap frame can show; once the spring settles it is lifted again, so a focus\n * ring, an effect button's rim, or any other overhang paints normally at\n * rest instead of being cut off at the container's edge.\n */\nexport function useSizeFollow(\n axis: \"height\" | \"width\",\n containerRef: RefObject<HTMLElement | null>,\n contentRef: RefObject<HTMLElement | null>,\n transition: ValueAnimationTransition<number | \"auto\">,\n): MotionValue<number | \"auto\"> {\n const size = useMotionValue<number | \"auto\">(\"auto\");\n const reduceMotion = useReducedMotion();\n\n useEffect(() => {\n const container = containerRef.current;\n const content = contentRef.current;\n if (!container || !content) return;\n\n let animation: ReturnType<typeof animate> | null = null;\n\n const observer = new ResizeObserver((entries) => {\n const box = entries[0]?.borderBoxSize?.[0];\n const next = box\n ? axis === \"height\"\n ? box.blockSize\n : box.inlineSize\n : axis === \"height\"\n ? content.offsetHeight\n : content.offsetWidth;\n const current = size.get();\n if (current === \"auto\" || reduceMotion) {\n animation?.stop();\n animation = null;\n container.style.overflow = \"\";\n size.set(next);\n return;\n }\n if (!animation && Math.abs(current - next) < 0.5) return;\n container.style.overflow = \"hidden\";\n animation?.stop();\n animation = animate(size, next, {\n ...transition,\n // Not fired on stop(), so a retarget can't lift the clip early.\n onComplete: () => {\n animation = null;\n container.style.overflow = \"\";\n },\n });\n });\n observer.observe(content);\n\n return () => {\n observer.disconnect();\n animation?.stop();\n };\n }, [axis, containerRef, contentRef, size, reduceMotion, transition]);\n\n return size;\n}\n\n/**\n * Animates its own height to follow the measured height of `children`, so\n * content swaps (search filtering, skeleton → data) glide instead of jumping.\n * Honors `prefers-reduced-motion` by snapping height with no spring. Clips\n * only while the spring is in flight (see `useSizeFollow`).\n */\nexport function AnimatedHeight({\n className,\n transition,\n children,\n}: {\n className?: string;\n /** Spring override for the height follow. @default the Command spring */\n transition?: ValueAnimationTransition<number | \"auto\">;\n children: ReactNode;\n}) {\n const containerRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const height = useSizeFollow(\n \"height\",\n containerRef,\n contentRef,\n transition ?? HEIGHT_SPRING,\n );\n\n return (\n <motion.div\n ref={containerRef}\n // Stack (and other flex parents) set `min-height: auto` on children,\n // which sizes to content and swallows the height spring. Allow\n // shrinking so the measured height can actually animate; the clip is\n // applied imperatively for the spring's duration only (see above).\n className=\"min-h-0\"\n style={{ height }}\n >\n <div ref={contentRef} className={className}>\n {children}\n </div>\n </motion.div>\n );\n}\n"],"mappings":";;;;;AAgBA,IAAM,IAAgB;AAetB,SAAgB,EACd,GACA,GACA,GACA,GAC8B;AAC9B,QAAM,IAAO,EAAgC,MAAM,GAC7C,IAAe,EAAiB;AAEtC,SAAA,EAAA,MAAgB;AACd,UAAM,IAAY,EAAa,SACzB,IAAU,EAAW;AAC3B,QAAI,CAAC,KAAa,CAAC,EAAS;AAE5B,QAAI,IAA+C;AAEnD,UAAM,IAAW,IAAI,eAAA,CAAgB,MAAY;AAC/C,YAAM,IAAM,EAAQ,CAAA,GAAI,gBAAgB,CAAA,GAClC,IAAO,IACT,MAAS,WACP,EAAI,YACJ,EAAI,aACN,MAAS,WACP,EAAQ,eACR,EAAQ,aACR,IAAU,EAAK,IAAI;AACzB,UAAI,MAAY,UAAU,GAAc;AACtC,QAAA,GAAW,KAAK,GAChB,IAAY,MACZ,EAAU,MAAM,WAAW,IAC3B,EAAK,IAAI,CAAI;AACb;AAAA,MACF;AACA,MAAI,CAAC,KAAa,KAAK,IAAI,IAAU,CAAI,IAAI,QAC7C,EAAU,MAAM,WAAW,UAC3B,GAAW,KAAK,GAChB,IAAY,EAAQ,GAAM,GAAM;AAAA,QAC9B,GAAG;AAAA,QAEH,YAAA,MAAkB;AAChB,UAAA,IAAY,MACZ,EAAU,MAAM,WAAW;AAAA,QAC7B;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AACD,WAAA,EAAS,QAAQ,CAAO,GAExB,MAAa;AACX,MAAA,EAAS,WAAW,GACpB,GAAW,KAAK;AAAA,IAClB;AAAA,EACF,GAAG;AAAA,IAAC;AAAA,IAAM;AAAA,IAAc;AAAA,IAAY;AAAA,IAAM;AAAA,IAAc;AAAA,EAAU,CAAC,GAE5D;AACT;AAQA,SAAgB,EAAe,EAC7B,WAAA,GACA,YAAA,GACA,UAAA,EAAA,GAMC;AACD,QAAM,IAAe,EAAuB,IAAI,GAC1C,IAAa,EAAuB,IAAI,GACxC,IAAS,EACb,UACA,GACA,GACA,KAAc,CAChB;AAEA,SACE,gBAAA,EAAC,EAAO,KAAR;AAAA,IACE,KAAK;AAAA,IAKL,WAAU;AAAA,IACV,OAAO,EAAE,QAAA,EAAO;AAAA,IAEhB,UAAA,gBAAA,EAAC,OAAD;AAAA,MAAK,KAAK;AAAA,MAAuB,WAAA;AAAA,MAC9B,UAAA;AAAA,IACE,CAAA;AAAA,EACK,CAAA;AAEhB"}