@octaviaflow/core 3.0.18-beta.47 → 3.0.18-beta.48

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.
@@ -1 +1 @@
1
- {"version":3,"file":"TimePicker.d.ts","sourceRoot":"","sources":["../../../src/components/TimePicker/TimePicker.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,wBAAwB,EAI7B,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAcf,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEhD,KAAK,YAAY,GAAG,IAAI,CACtB,wBAAwB,CAAC,KAAK,CAAC,EAC/B,UAAU,GAAG,UAAU,GAAG,cAAc,CACzC,CAAC;AAEF,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB;AAmBD,eAAO,MAAM,UAAU,4GAmgBrB,CAAC"}
1
+ {"version":3,"file":"TimePicker.d.ts","sourceRoot":"","sources":["../../../src/components/TimePicker/TimePicker.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,wBAAwB,EAI7B,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAcf,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEhD,KAAK,YAAY,GAAG,IAAI,CACtB,wBAAwB,CAAC,KAAK,CAAC,EAC/B,UAAU,GAAG,UAAU,GAAG,cAAc,CACzC,CAAC;AAEF,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB;AAmBD,eAAO,MAAM,UAAU,4GAkhBrB,CAAC"}
package/dist/index.cjs CHANGED
@@ -11901,6 +11901,7 @@ var import_react_dom9 = require("react-dom");
11901
11901
 
11902
11902
  // src/utils/useAnchoredPopover.ts
11903
11903
  var import_react56 = require("react");
11904
+ var useIsomorphicLayoutEffect = typeof document !== "undefined" ? import_react56.useLayoutEffect : import_react56.useEffect;
11904
11905
  function computeAnchoredPosition({
11905
11906
  anchor,
11906
11907
  viewport,
@@ -11912,8 +11913,17 @@ function computeAnchoredPosition({
11912
11913
  const spaceBelow = viewport.height - anchor.bottom - gap - margin;
11913
11914
  const spaceAbove = anchor.top - gap - margin;
11914
11915
  const openUp = spaceBelow < preferredMinHeight && spaceAbove > spaceBelow;
11915
- const popW = popoverWidth && popoverWidth > 0 ? popoverWidth : anchor.width;
11916
- const maxLeft = viewport.width - popW - margin;
11916
+ const maxHeight = Math.max(0, openUp ? spaceAbove : spaceBelow);
11917
+ const measured = popoverWidth && popoverWidth > 0 ? popoverWidth : 0;
11918
+ const renderW = Math.max(measured, anchor.width);
11919
+ const maxAvailW = viewport.width - 2 * margin;
11920
+ let effectiveW = renderW;
11921
+ let maxWidth;
11922
+ if (renderW > maxAvailW) {
11923
+ effectiveW = maxAvailW;
11924
+ maxWidth = maxAvailW;
11925
+ }
11926
+ const maxLeft = viewport.width - effectiveW - margin;
11917
11927
  let left = anchor.left;
11918
11928
  if (left > maxLeft) left = maxLeft;
11919
11929
  if (left < margin) left = margin;
@@ -11921,7 +11931,8 @@ function computeAnchoredPosition({
11921
11931
  ...openUp ? { bottom: viewport.height - anchor.top + gap } : { top: anchor.bottom + gap },
11922
11932
  left,
11923
11933
  width: anchor.width,
11924
- maxHeight: Math.max(120, openUp ? spaceAbove : spaceBelow),
11934
+ ...maxWidth !== void 0 ? { maxWidth } : {},
11935
+ maxHeight,
11925
11936
  direction: openUp ? "up" : "down"
11926
11937
  };
11927
11938
  }
@@ -11955,7 +11966,7 @@ function useAnchoredPopover(anchorRef, open, options = {}) {
11955
11966
  })
11956
11967
  );
11957
11968
  }, [anchorRef, popoverRef, gap, margin, preferredMinHeight]);
11958
- (0, import_react56.useEffect)(() => {
11969
+ useIsomorphicLayoutEffect(() => {
11959
11970
  if (!open) return;
11960
11971
  update();
11961
11972
  window.addEventListener("scroll", update, true);
@@ -11974,6 +11985,7 @@ function anchoredPopoverStyle(pos, extra) {
11974
11985
  ...pos.bottom !== void 0 ? { bottom: pos.bottom } : {},
11975
11986
  left: pos.left,
11976
11987
  minWidth: pos.width,
11988
+ ...pos.maxWidth !== void 0 ? { maxWidth: pos.maxWidth } : {},
11977
11989
  maxHeight: pos.maxHeight,
11978
11990
  ...extra
11979
11991
  };
@@ -27204,8 +27216,20 @@ var TimePicker = (0, import_react139.forwardRef)(
27204
27216
  setActiveSeg(null);
27205
27217
  }
27206
27218
  };
27219
+ const onKey = (e) => {
27220
+ if (e.key === "Escape") {
27221
+ flushDraft();
27222
+ setOpen(false);
27223
+ setActiveSeg(null);
27224
+ triggerRef.current?.focus();
27225
+ }
27226
+ };
27207
27227
  document.addEventListener("mousedown", onDoc);
27208
- return () => document.removeEventListener("mousedown", onDoc);
27228
+ document.addEventListener("keydown", onKey);
27229
+ return () => {
27230
+ document.removeEventListener("mousedown", onDoc);
27231
+ document.removeEventListener("keydown", onKey);
27232
+ };
27209
27233
  }, [open, flushDraft]);
27210
27234
  const segOrder = () => showSeconds ? ["hours", "minutes", "seconds"] : ["hours", "minutes"];
27211
27235
  const handleSegKey = (seg) => (e) => {