@factorialco/f0-react 14.1.0 → 14.2.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.
@@ -4,7 +4,7 @@ import { useCallback as i, useEffect as a, useRef as o, useState as s } from "re
4
4
  import { jsx as c, jsxs as l } from "react/jsx-runtime";
5
5
  //#region \0virtual:f0-component-status-data
6
6
  var u = {
7
- generatedAt: "2026-11-10T16:19:58.378Z",
7
+ generatedAt: "2026-11-11T08:52:17.529Z",
8
8
  stats: {
9
9
  total: 313,
10
10
  byStatus: {
@@ -1083,7 +1083,7 @@ var u = {
1083
1083
  hasWhenToUse: !0,
1084
1084
  hasWhenNotToUse: !0,
1085
1085
  hasDoDonts: !0,
1086
- exampleCount: 5
1086
+ exampleCount: 6
1087
1087
  },
1088
1088
  a11yTier: "enforced",
1089
1089
  storyFile: "elements/F0Resizable/__stories__/F0Resizable.stories.tsx"
@@ -750,6 +750,8 @@ type ResizableDirection = (typeof resizableDirections)[number];
750
750
  interface F0ResizableProps {
751
751
  direction?: ResizableDirection;
752
752
  children: ReactNode;
753
+ initialSize?: number;
754
+ onSizeChange?: (size: number) => void;
753
755
  }
754
756
  interface F0ResizablePanelProps {
755
757
  children: ReactNode;
@@ -774,7 +776,7 @@ declare namespace F0ResizablePanel {
774
776
  }
775
777
  //#endregion
776
778
  //#region src/elements/F0Resizable/F0Resizable.d.ts
777
- declare const F0ResizableComponent: ({ direction, children }: F0ResizableProps) => import("react").JSX.Element;
779
+ declare const F0ResizableComponent: ({ direction, children, initialSize, onSizeChange }: F0ResizableProps) => import("react").JSX.Element;
778
780
  export declare const F0Resizable: import("react").ForwardRefExoticComponent<F0ResizableProps & WithDataTestIdProps & import("react").RefAttributes<unknown>> & Pick<typeof F0ResizableComponent, never> & {
779
781
  Panel: typeof F0ResizablePanel;
780
782
  Handle: typeof F0ResizableHandle;
@@ -2380,53 +2380,55 @@ var Tp = 30, Ep = 50, Dp = (e, t, n) => Math.min(Math.max(e, t), n), Op = (e) =>
2380
2380
  max: r,
2381
2381
  defaultSize: Dp(i, n, r)
2382
2382
  };
2383
- }, Mp = Object.assign(Sn(En("F0Resizable", ({ direction: e = "horizontal", children: t }) => {
2384
- let n = R(), r = Y(null), i = Y(null), a = Wn({ ref: r }), o = Op(t), [s, c, l] = o;
2385
- if (o.length !== 3 || !kp(s) || !Ap(c) || !kp(l)) throw Error("F0Resizable: children must be exactly F0Resizable.Panel, F0Resizable.Handle and F0Resizable.Panel, in this order.");
2386
- let u = s.props, d = l.props, f = c.props, { min: p, max: m, defaultSize: h } = jp(u, d), g = e === "horizontal", _ = (g ? a.width : a.height) ?? 0, [v, y] = X(h), b = Dp(v, p, m), x = (e) => Math.round(_ * e / 100), S = G((e) => _ > 0 ? Dp(e / _ * 100, p, m) : b, [
2387
- b,
2388
- _,
2389
- m,
2390
- p
2391
- ]), C = G((e) => {
2392
- i.current?.style.setProperty("flex-basis", `${S(e)}%`);
2393
- }, [S]);
2383
+ }, Mp = Object.assign(Sn(En("F0Resizable", ({ direction: e = "horizontal", children: t, initialSize: n, onSizeChange: r }) => {
2384
+ let i = R(), a = Y(null), o = Y(null), s = Wn({ ref: a }), c = Op(t), [l, u, d] = c;
2385
+ if (c.length !== 3 || !kp(l) || !Ap(u) || !kp(d)) throw Error("F0Resizable: children must be exactly F0Resizable.Panel, F0Resizable.Handle and F0Resizable.Panel, in this order.");
2386
+ let f = l.props, p = d.props, m = u.props, { min: h, max: g, defaultSize: _ } = jp(f, p), v = e === "horizontal", y = (v ? s.width : s.height) ?? 0, [b, x] = X(() => n !== void 0 && Number.isFinite(n) ? n : _), S = Dp(b, h, g), C = (e) => Math.round(y * e / 100), w = G((e) => y > 0 ? Dp(e / y * 100, h, g) : S, [
2387
+ S,
2388
+ y,
2389
+ g,
2390
+ h
2391
+ ]), T = G((e) => {
2392
+ o.current?.style.setProperty("flex-basis", `${w(e)}%`);
2393
+ }, [w]), E = (e) => {
2394
+ x(e), r?.(e);
2395
+ };
2394
2396
  return /* @__PURE__ */ $(Ss, {
2395
- ref: r,
2397
+ ref: a,
2396
2398
  display: "flex",
2397
- flexDirection: g ? "row" : "column",
2399
+ flexDirection: v ? "row" : "column",
2398
2400
  width: "full",
2399
2401
  height: "full",
2400
2402
  minHeight: "0",
2401
2403
  children: [
2402
2404
  /* @__PURE__ */ Q("div", {
2403
- ref: i,
2404
- className: B("min-h-0 min-w-0 shrink-0 overflow-y-auto overflow-x-hidden", g ? "h-full" : "w-full"),
2405
- style: { flexBasis: `${b}%` },
2406
- children: u.children
2405
+ ref: o,
2406
+ className: B("min-h-0 min-w-0 shrink-0 overflow-y-auto overflow-x-hidden", v ? "h-full" : "w-full"),
2407
+ style: { flexBasis: `${S}%` },
2408
+ children: f.children
2407
2409
  }),
2408
2410
  /* @__PURE__ */ Q(Sp, {
2409
- value: x(b),
2410
- min: x(p),
2411
- max: x(m),
2412
- growsTowards: g ? "right" : "down",
2413
- ariaLabel: f.ariaLabel ?? n.resizable.resize,
2414
- valueText: n.t("resizable.size", { size: Math.round(b) }),
2411
+ value: C(S),
2412
+ min: C(h),
2413
+ max: C(g),
2414
+ growsTowards: v ? "right" : "down",
2415
+ ariaLabel: m.ariaLabel ?? i.resizable.resize,
2416
+ valueText: i.t("resizable.size", { size: Math.round(S) }),
2415
2417
  divider: !0,
2416
2418
  grip: !0,
2417
- onPreview: C,
2418
- onCommit: (e) => y(S(e)),
2419
- onReset: () => y(h)
2419
+ onPreview: T,
2420
+ onCommit: (e) => E(w(e)),
2421
+ onReset: () => E(_)
2420
2422
  }),
2421
2423
  /* @__PURE__ */ Q(Ss, {
2422
2424
  grow: !0,
2423
2425
  minWidth: "0",
2424
2426
  minHeight: "0",
2425
- width: g ? void 0 : "full",
2426
- height: g ? "full" : void 0,
2427
+ width: v ? void 0 : "full",
2428
+ height: v ? "full" : void 0,
2427
2429
  overflowY: "auto",
2428
2430
  overflowX: "hidden",
2429
- children: d.children
2431
+ children: p.children
2430
2432
  })
2431
2433
  ]
2432
2434
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@factorialco/f0-react",
3
- "version": "14.1.0",
3
+ "version": "14.2.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/factorialco/f0.git",