@bigtablet/design-system 3.19.2 → 3.19.4

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 (2) hide show
  1. package/dist/index.js +35 -12
  2. package/package.json +7 -6
package/dist/index.js CHANGED
@@ -333,11 +333,14 @@ function useAnchoredPosition({
333
333
  maxWidth: 0,
334
334
  maxHeight: 0,
335
335
  ready: false,
336
- anchorWidth: 0
336
+ anchorWidth: 0,
337
+ anchorHidden: false
337
338
  });
338
339
  useSafeLayoutEffect(() => {
339
340
  if (!open) {
340
- setState((prev) => prev.ready ? { ...prev, ready: false } : prev);
341
+ setState(
342
+ (prev) => prev.ready || prev.anchorHidden ? { ...prev, ready: false, anchorHidden: false } : prev
343
+ );
341
344
  return;
342
345
  }
343
346
  const anchor = anchorRef.current;
@@ -352,10 +355,12 @@ function useAnchoredPosition({
352
355
  { width: window.innerWidth, height: window.innerHeight },
353
356
  { placement, align, gap, padding }
354
357
  );
358
+ const anchorHidden = a.width > 0 && a.height > 0 && (a.bottom <= 0 || a.top >= window.innerHeight || a.right <= 0 || a.left >= window.innerWidth);
355
359
  setState({
356
360
  ...result,
357
361
  ready: true,
358
- anchorWidth: Math.min(a.width, result.maxWidth)
362
+ anchorWidth: Math.min(a.width, result.maxWidth),
363
+ anchorHidden
359
364
  });
360
365
  };
361
366
  let frame = 0;
@@ -685,6 +690,12 @@ function useListboxPopup({
685
690
  gap: LIST_GAP,
686
691
  padding: LIST_PADDING
687
692
  });
693
+ useEffect(() => {
694
+ if (!isOpen || !anchored.ready || !anchored.anchorHidden) return;
695
+ const focusInPanel = !!panelRef.current?.contains(document.activeElement);
696
+ setIsOpen(false);
697
+ if (focusInPanel && returnFocusOnClose) triggerRef.current?.focus({ preventScroll: true });
698
+ }, [isOpen, anchored.ready, anchored.anchorHidden, returnFocusOnClose]);
688
699
  return {
689
700
  isOpen,
690
701
  setIsOpen,
@@ -1280,6 +1291,14 @@ var Menu = ({ items, trigger, align = "start" }) => {
1280
1291
  gap: MENU_GAP,
1281
1292
  padding: 8
1282
1293
  });
1294
+ React11.useEffect(() => {
1295
+ if (!open || !pos.ready || !pos.anchorHidden) return;
1296
+ const focusInMenu = !!menuRef.current?.contains(document.activeElement);
1297
+ setOpen(false);
1298
+ if (focusInMenu) {
1299
+ wrapperRef.current?.querySelector("[aria-haspopup]")?.focus({ preventScroll: true });
1300
+ }
1301
+ }, [open, pos.ready, pos.anchorHidden]);
1283
1302
  const style = useSpringPresence({
1284
1303
  visible: open,
1285
1304
  from: pos.placement === "top" ? `translateY(${MENU_GAP}px)` : `translateY(-${MENU_GAP}px)`
@@ -2101,6 +2120,9 @@ var Tooltip = ({
2101
2120
  gap: TOOLTIP_GAP,
2102
2121
  padding: 8
2103
2122
  });
2123
+ React11.useEffect(() => {
2124
+ if (open && pos.ready && pos.anchorHidden) hideNow();
2125
+ }, [open, pos.ready, pos.anchorHidden, hideNow]);
2104
2126
  const fromTransform = (() => {
2105
2127
  switch (pos.placement) {
2106
2128
  case "top":
@@ -2883,6 +2905,7 @@ var FieldContext = createContext(void 0);
2883
2905
  function useFieldControl() {
2884
2906
  return useContext(FieldContext);
2885
2907
  }
2908
+ var FieldControlBoundary = ({ children }) => /* @__PURE__ */ jsx(FieldContext.Provider, { value: void 0, children });
2886
2909
  var Field = ({
2887
2910
  name,
2888
2911
  label,
@@ -4812,7 +4835,7 @@ var DatePicker = ({
4812
4835
  return /* @__PURE__ */ jsxs("div", { className: rootClassName, style: containerStyle, children: [
4813
4836
  label && /* @__PURE__ */ jsx("span", { className: "date_picker_label", id: groupId, children: label }),
4814
4837
  constraintDesc && /* @__PURE__ */ jsx("span", { id: constraintId, className: "date_picker_sr_only", children: constraintDesc }),
4815
- /* @__PURE__ */ jsxs(
4838
+ /* @__PURE__ */ jsx(
4816
4839
  "div",
4817
4840
  {
4818
4841
  className: "date_picker_fields",
@@ -4820,7 +4843,7 @@ var DatePicker = ({
4820
4843
  "aria-labelledby": field?.labelId ?? (label ? groupId : void 0),
4821
4844
  "aria-describedby": [field?.describedBy, constraintDesc ? constraintId : void 0].filter(Boolean).join(" ") || void 0,
4822
4845
  "aria-invalid": field?.invalid || void 0,
4823
- children: [
4846
+ children: /* @__PURE__ */ jsxs(FieldControlBoundary, { children: [
4824
4847
  /* @__PURE__ */ jsx(
4825
4848
  Dropdown,
4826
4849
  {
@@ -4860,7 +4883,7 @@ var DatePicker = ({
4860
4883
  disabled: disabled || !month
4861
4884
  }
4862
4885
  )
4863
- ]
4886
+ ] })
4864
4887
  }
4865
4888
  )
4866
4889
  ] });
@@ -4897,7 +4920,7 @@ var DateRangePicker = ({
4897
4920
  date_range_picker_full_width: fullWidth,
4898
4921
  date_range_picker_disabled: disabled
4899
4922
  }),
4900
- children: /* @__PURE__ */ jsxs(
4923
+ children: /* @__PURE__ */ jsx(
4901
4924
  "div",
4902
4925
  {
4903
4926
  className: "date_range_picker_fields",
@@ -4905,7 +4928,7 @@ var DateRangePicker = ({
4905
4928
  "aria-labelledby": field?.labelId,
4906
4929
  "aria-describedby": field?.describedBy,
4907
4930
  "aria-invalid": field?.invalid || void 0,
4908
- children: [
4931
+ children: /* @__PURE__ */ jsxs(FieldControlBoundary, { children: [
4909
4932
  /* @__PURE__ */ jsx(
4910
4933
  DatePicker,
4911
4934
  {
@@ -4934,7 +4957,7 @@ var DateRangePicker = ({
4934
4957
  fullWidth: true
4935
4958
  }
4936
4959
  )
4937
- ]
4960
+ ] })
4938
4961
  }
4939
4962
  )
4940
4963
  }
@@ -6006,7 +6029,7 @@ var TimePicker = ({
6006
6029
  children: [
6007
6030
  label && /* @__PURE__ */ jsx("span", { className: "time_picker_label", id: groupId, children: label }),
6008
6031
  constraint && /* @__PURE__ */ jsx("span", { id: constraintId, className: "time_picker_sr_only", children: constraint }),
6009
- /* @__PURE__ */ jsxs(
6032
+ /* @__PURE__ */ jsx(
6010
6033
  "div",
6011
6034
  {
6012
6035
  className: "time_picker_fields",
@@ -6014,7 +6037,7 @@ var TimePicker = ({
6014
6037
  "aria-labelledby": field?.labelId ?? (label ? groupId : void 0),
6015
6038
  "aria-describedby": [field?.describedBy, constraint ? constraintId : void 0].filter(Boolean).join(" ") || void 0,
6016
6039
  "aria-invalid": field?.invalid || void 0,
6017
- children: [
6040
+ children: /* @__PURE__ */ jsxs(FieldControlBoundary, { children: [
6018
6041
  /* @__PURE__ */ jsx(
6019
6042
  Dropdown,
6020
6043
  {
@@ -6041,7 +6064,7 @@ var TimePicker = ({
6041
6064
  disabled: disabled || hour === null
6042
6065
  }
6043
6066
  )
6044
- ]
6067
+ ] })
6045
6068
  }
6046
6069
  )
6047
6070
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigtablet/design-system",
3
- "version": "3.19.2",
3
+ "version": "3.19.4",
4
4
  "description": "Bigtablet Design System UI Components",
5
5
  "type": "module",
6
6
  "types": "dist/index.d.ts",
@@ -125,17 +125,18 @@
125
125
  "size-limit": [
126
126
  {
127
127
  "path": "dist/index.js",
128
- "limit": "60 kB",
129
- "message": "Raised 50 kB -> 60 kB on 2026-08-05: baseline was 49.34 kB, leaving 0.66 kB (1.3%) under the old 50 kB limit. The current limit leaves 10.66 kB. Re-measure before raising again."
128
+ "limit": "70 kB",
129
+ "message": "Raised 60 kB -> 70 kB on 2026-09-10: baseline was 59.82 kB on develop (59.91 kB with PR #625), leaving 0.09-0.18 kB (0.3%) under the old 60 kB limit. Of that baseline, 18.48 kB is @react-spring/web (a runtime dependency, so size-limit bundles it) and 40.55 kB is this package - measure `dist/index.js` alone before blaming the dependency. The current limit leaves 10.09 kB. Re-measure before raising again."
130
130
  },
131
131
  {
132
132
  "path": "dist/vanilla/bigtablet.min.js",
133
- "limit": "7 kB",
134
- "message": "Raised 5 kB -> 7 kB on 2026-08-06: Dropdown multiple/searchable pushed the baseline from 4.13 kB to 5.6 kB, 0.6 kB over the old limit. The current limit leaves 1.4 kB. Re-measure before raising again."
133
+ "limit": "8 kB",
134
+ "message": "Raised 7 kB -> 8 kB on 2026-09-10: baseline was 6.83 kB, leaving 0.17 kB (2.4%) under the old 7 kB limit. The current limit leaves 1.17 kB. Re-measure before raising again."
135
135
  },
136
136
  {
137
137
  "path": "dist/index.css",
138
- "limit": "130 kB"
138
+ "limit": "18 kB",
139
+ "message": "Lowered 130 kB -> 18 kB on 2026-09-10: baseline is 14.56 kB brotlied, so the old limit sat 9x above reality and could never fire. The current limit leaves 3.44 kB. Raise it with a measurement, not to make a build pass."
139
140
  }
140
141
  ],
141
142
  "dependencies": {