@primer/react 38.42.0-rc.700f75ee0 → 38.42.0-rc.7ee8d8fea

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 (44) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/ActionBar/ActionBar.js +9 -7
  3. package/dist/ActionBar/index.d.ts +2 -2
  4. package/dist/ActionList/Group.js +4 -5
  5. package/dist/ActionList/Item.js +2 -2
  6. package/dist/Banner/Banner.js +3 -5
  7. package/dist/Button/ButtonBase.js +3 -2
  8. package/dist/Button/IconButton.js +3 -4
  9. package/dist/Button/types.d.ts +2 -2
  10. package/dist/Card/Card.js +1 -2
  11. package/dist/Details/Details.js +2 -4
  12. package/dist/FeatureFlags/FeatureFlagScope.js +1 -0
  13. package/dist/FilteredActionList/constants.js +2 -0
  14. package/dist/FormControl/FormControl.js +55 -80
  15. package/dist/FormControl/FormControlLabel.js +1 -2
  16. package/dist/InlineMessage/InlineMessage.js +1 -2
  17. package/dist/NavList/NavList.js +3 -4
  18. package/dist/Overlay/Overlay.d.ts +2 -0
  19. package/dist/Overlay/Overlay.js +4 -2
  20. package/dist/PageLayout/usePaneWidth.js +2 -2
  21. package/dist/Popover/Popover.js +3 -5
  22. package/dist/ProgressBar/ProgressBar.js +1 -2
  23. package/dist/SegmentedControl/SegmentedControlButton.js +1 -2
  24. package/dist/Select/Select.js +2 -2
  25. package/dist/SelectPanel/SelectPanel.d.ts +1 -1
  26. package/dist/SelectPanel/SelectPanel.js +1 -1
  27. package/dist/Spinner/Spinner.js +1 -2
  28. package/dist/Textarea/Textarea.d.ts +2 -2
  29. package/dist/ToggleSwitch/ToggleSwitch.js +2 -3
  30. package/dist/TopicTag/TopicTag.js +1 -2
  31. package/dist/UnderlineNav/UnderlineNavItem.js +2 -4
  32. package/dist/deprecated/ActionList/List.js +1 -1
  33. package/dist/experimental/SelectPanel2/SelectPanel.d.ts +1 -1
  34. package/dist/hooks/useOpenAndCloseFocus.d.ts +3 -1
  35. package/dist/hooks/useOpenAndCloseFocus.js +28 -16
  36. package/dist/hooks/useOverlay.d.ts +3 -1
  37. package/dist/hooks/useOverlay.js +24 -22
  38. package/dist/internal/components/InputLabel.js +1 -2
  39. package/dist/internal/components/TextInputInnerAction.js +1 -2
  40. package/dist/internal/components/TextInputWrapper.d.ts +3 -0
  41. package/dist/internal/hooks/useThemeProvider.js +3 -3
  42. package/generated/components.json +34 -20
  43. package/generated/hooks.json +12 -0
  44. package/package.json +12 -13
@@ -285,14 +285,14 @@ function usePaneWidth(t0) {
285
285
  if (isResizing) return;
286
286
  isResizing = true;
287
287
  (_paneRef$current4 = paneRef.current) === null || _paneRef$current4 === void 0 || _paneRef$current4.setAttribute("data-dragging", "true");
288
- contentWrapperRef === null || contentWrapperRef === void 0 || (_contentWrapperRef$cu = contentWrapperRef.current) == null || _contentWrapperRef$cu.setAttribute("data-dragging", "true");
288
+ contentWrapperRef === null || contentWrapperRef === void 0 || (_contentWrapperRef$cu = contentWrapperRef.current) === null || _contentWrapperRef$cu === void 0 || _contentWrapperRef$cu.setAttribute("data-dragging", "true");
289
289
  };
290
290
  const endResizeOptimizations = () => {
291
291
  var _paneRef$current5, _contentWrapperRef$cu2;
292
292
  if (!isResizing) return;
293
293
  isResizing = false;
294
294
  (_paneRef$current5 = paneRef.current) === null || _paneRef$current5 === void 0 || _paneRef$current5.removeAttribute("data-dragging");
295
- contentWrapperRef === null || contentWrapperRef === void 0 || (_contentWrapperRef$cu2 = contentWrapperRef.current) == null || _contentWrapperRef$cu2.removeAttribute("data-dragging");
295
+ contentWrapperRef === null || contentWrapperRef === void 0 || (_contentWrapperRef$cu2 = contentWrapperRef.current) === null || _contentWrapperRef$cu2 === void 0 || _contentWrapperRef$cu2.removeAttribute("data-dragging");
296
296
  };
297
297
  const handleResize = () => {
298
298
  startResizeOptimizations();
@@ -9,7 +9,6 @@ import { clsx } from "clsx";
9
9
  const EMPTY_IGNORE_CLICK_REFS = [];
10
10
  const PopoverContext = /*#__PURE__*/ React.createContext(false);
11
11
  const Popover = /*#__PURE__*/ React.forwardRef(function Popover(t0, forwardRef) {
12
- var _open;
13
12
  const $ = c(18);
14
13
  let className;
15
14
  let open;
@@ -32,7 +31,7 @@ const Popover = /*#__PURE__*/ React.forwardRef(function Popover(t0, forwardRef)
32
31
  t1 = $[5];
33
32
  }
34
33
  const caret = t1 === void 0 ? "top" : t1;
35
- const t2 = (_open = open) !== null && _open !== void 0 ? _open : false;
34
+ const t2 = open !== null && open !== void 0 ? open : false;
36
35
  const t3 = open ? "" : void 0;
37
36
  const t4 = relative ? "" : void 0;
38
37
  let t5;
@@ -74,7 +73,6 @@ const Popover = /*#__PURE__*/ React.forwardRef(function Popover(t0, forwardRef)
74
73
  });
75
74
  Popover.displayName = "Popover";
76
75
  const PopoverContent = (t0) => {
77
- var _onClickOutside, _ignoreClickRefs;
78
76
  const $ = c(22);
79
77
  let className;
80
78
  let ignoreClickRefs;
@@ -106,8 +104,8 @@ const PopoverContent = (t0) => {
106
104
  const height = t2 === void 0 ? "fit-content" : t2;
107
105
  const divRef = useRef(null);
108
106
  const open = React.useContext(PopoverContext);
109
- const outsideClickHandler = (_onClickOutside = onClickOutside) !== null && _onClickOutside !== void 0 ? _onClickOutside : _temp;
110
- const t3 = (_ignoreClickRefs = ignoreClickRefs) !== null && _ignoreClickRefs !== void 0 ? _ignoreClickRefs : EMPTY_IGNORE_CLICK_REFS;
107
+ const outsideClickHandler = onClickOutside !== null && onClickOutside !== void 0 ? onClickOutside : _temp;
108
+ const t3 = ignoreClickRefs !== null && ignoreClickRefs !== void 0 ? ignoreClickRefs : EMPTY_IGNORE_CLICK_REFS;
111
109
  let t4;
112
110
  if ($[8] !== outsideClickHandler || $[9] !== t3) {
113
111
  t4 = {
@@ -38,8 +38,7 @@ const Item = /*#__PURE__*/ forwardRef((t0, forwardRef) => {
38
38
  const progressAsNumber = typeof progress === "string" ? parseInt(progress, 10) : progress;
39
39
  let t1;
40
40
  if ($[9] !== ariaValueNow || $[10] !== progressAsNumber) {
41
- var _ariaValueNow;
42
- t1 = (_ariaValueNow = ariaValueNow) !== null && _ariaValueNow !== void 0 ? _ariaValueNow : progressAsNumber !== void 0 && progressAsNumber >= 0 ? Math.round(progressAsNumber) : 0;
41
+ t1 = ariaValueNow !== null && ariaValueNow !== void 0 ? ariaValueNow : progressAsNumber !== void 0 && progressAsNumber >= 0 ? Math.round(progressAsNumber) : 0;
43
42
  $[9] = ariaValueNow;
44
43
  $[10] = progressAsNumber;
45
44
  $[11] = t1;
@@ -6,7 +6,6 @@ import { clsx } from "clsx";
6
6
  import { isElement } from "react-is";
7
7
  //#region src/SegmentedControl/SegmentedControlButton.tsx
8
8
  const SegmentedControlButton = (t0) => {
9
- var _leadingVisual;
10
9
  const $ = c(36);
11
10
  let children;
12
11
  let className;
@@ -56,7 +55,7 @@ const SegmentedControlButton = (t0) => {
56
55
  ariaDisabled = $[10];
57
56
  rest = $[11];
58
57
  }
59
- const LeadingVisual = (_leadingVisual = leadingVisual) !== null && _leadingVisual !== void 0 ? _leadingVisual : leadingIcon;
58
+ const LeadingVisual = leadingVisual !== null && leadingVisual !== void 0 ? leadingVisual : leadingIcon;
60
59
  let t1;
61
60
  if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
62
61
  t1 = clsx(SegmentedControl_module_css_default.Item);
@@ -47,7 +47,7 @@ const ArrowIndicator = (t0) => {
47
47
  return t2;
48
48
  };
49
49
  const Select = /*#__PURE__*/ React.forwardRef((t0, ref) => {
50
- var _ref, _defaultValue;
50
+ var _ref;
51
51
  const $ = c(37);
52
52
  let block;
53
53
  let children;
@@ -99,7 +99,7 @@ const Select = /*#__PURE__*/ React.forwardRef((t0, ref) => {
99
99
  $[14] = t4;
100
100
  } else t4 = $[14];
101
101
  const t5 = Boolean(placeholder);
102
- const t6 = (_ref = (_defaultValue = defaultValue) !== null && _defaultValue !== void 0 ? _defaultValue : placeholder) !== null && _ref !== void 0 ? _ref : void 0;
102
+ const t6 = (_ref = defaultValue !== null && defaultValue !== void 0 ? defaultValue : placeholder) !== null && _ref !== void 0 ? _ref : void 0;
103
103
  let t7;
104
104
  if ($[15] !== placeholder || $[16] !== required) {
105
105
  t7 = placeholder && /* @__PURE__ */ jsx("option", {
@@ -112,7 +112,7 @@ declare const SelectPanel: typeof Panel & {
112
112
  SecondaryActionButton: React.FC<ButtonProps>;
113
113
  SecondaryActionLink: React.FC<LinkButtonProps & {
114
114
  alignContent?: AlignContent;
115
- icon?: React.FunctionComponent<IconProps> | React.ElementType | React.ReactElement<any> | null;
115
+ icon?: React.ReactNode | React.ComponentType<IconProps> | React.ExoticComponent<IconProps>;
116
116
  leadingVisual?: React.ElementType | React.ReactElement<any> | null;
117
117
  trailingVisual?: React.ElementType | React.ReactElement<any> | null;
118
118
  trailingAction?: React.ElementType | null;
@@ -427,7 +427,7 @@ function Panel({ open, onOpenChange, renderAnchor = defaultRenderAnchor, anchorR
427
427
  } : void 0, "anchored");
428
428
  const preventBubbling = useCallback((event) => {
429
429
  var _overlayProps$onKeyDo;
430
- overlayProps === null || overlayProps === void 0 || (_overlayProps$onKeyDo = overlayProps.onKeyDown) == null || _overlayProps$onKeyDo.call(overlayProps, event);
430
+ overlayProps === null || overlayProps === void 0 || (_overlayProps$onKeyDo = overlayProps.onKeyDown) === null || _overlayProps$onKeyDo === void 0 || _overlayProps$onKeyDo.call(overlayProps, event);
431
431
  const activeElement = document.activeElement;
432
432
  if (activeElement.tagName === "INPUT" || activeElement.tagName === "TEXTAREA") return;
433
433
  if (event.ctrlKey || event.altKey || event.metaKey) return;
@@ -14,7 +14,6 @@ const sizeMap = {
14
14
  large: "64px"
15
15
  };
16
16
  function Spinner(t0) {
17
- var _ariaLabel;
18
17
  const $ = c(35);
19
18
  let ariaLabel;
20
19
  let className;
@@ -96,7 +95,7 @@ function Spinner(t0) {
96
95
  $[16] = t8;
97
96
  } else t8 = $[16];
98
97
  const mergedStyle = t8;
99
- const t9 = (_ariaLabel = ariaLabel) !== null && _ariaLabel !== void 0 ? _ariaLabel : void 0;
98
+ const t9 = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : void 0;
100
99
  const t10 = hasHiddenLabel ? labelId : void 0;
101
100
  let t11;
102
101
  if ($[17] !== className) {
@@ -25,7 +25,7 @@ type TextareaProps = {
25
25
  */
26
26
  autoSize?: boolean;
27
27
  /**
28
- * apply a high contrast color to background
28
+ * @deprecated Omit this prop to use the default background.
29
29
  */
30
30
  contrast?: boolean;
31
31
  /**
@@ -76,7 +76,7 @@ declare const Textarea: React.ForwardRefExoticComponent<{
76
76
  */
77
77
  autoSize?: boolean;
78
78
  /**
79
- * apply a high contrast color to background
79
+ * @deprecated Omit this prop to use the default background.
80
80
  */
81
81
  contrast?: boolean;
82
82
  /**
@@ -71,7 +71,6 @@ const LineIcon = (t0) => {
71
71
  return t4;
72
72
  };
73
73
  const ToggleSwitch = /*#__PURE__*/ React.forwardRef(function ToggleSwitch(props, ref) {
74
- var _buttonLabelOn, _buttonLabelOff;
75
74
  const $ = c(90);
76
75
  let ariaDescribedby;
77
76
  let ariaLabelledby;
@@ -222,7 +221,7 @@ const ToggleSwitch = /*#__PURE__*/ React.forwardRef(function ToggleSwitch(props,
222
221
  } else t11 = $[39];
223
222
  const t12 = !acceptsInteraction;
224
223
  const t13 = !isOn;
225
- const t14 = (_buttonLabelOn = buttonLabelOn) !== null && _buttonLabelOn !== void 0 ? _buttonLabelOn : "On";
224
+ const t14 = buttonLabelOn !== null && buttonLabelOn !== void 0 ? buttonLabelOn : "On";
226
225
  let t15;
227
226
  if ($[40] !== t13 || $[41] !== t14) {
228
227
  t15 = /* @__PURE__ */ jsx("span", {
@@ -234,7 +233,7 @@ const ToggleSwitch = /*#__PURE__*/ React.forwardRef(function ToggleSwitch(props,
234
233
  $[41] = t14;
235
234
  $[42] = t15;
236
235
  } else t15 = $[42];
237
- const t16 = (_buttonLabelOff = buttonLabelOff) !== null && _buttonLabelOff !== void 0 ? _buttonLabelOff : "Off";
236
+ const t16 = buttonLabelOff !== null && buttonLabelOff !== void 0 ? buttonLabelOff : "Off";
238
237
  let t17;
239
238
  if ($[43] !== isOn || $[44] !== t16) {
240
239
  t17 = /* @__PURE__ */ jsx("span", {
@@ -4,7 +4,6 @@ import { jsx } from "react/jsx-runtime";
4
4
  import { clsx } from "clsx";
5
5
  //#region src/TopicTag/TopicTag.tsx
6
6
  function TopicTag(t0) {
7
- var _as;
8
7
  const $ = c(12);
9
8
  let as;
10
9
  let children;
@@ -23,7 +22,7 @@ function TopicTag(t0) {
23
22
  className = $[3];
24
23
  rest = $[4];
25
24
  }
26
- const BaseComponent = (_as = as) !== null && _as !== void 0 ? _as : "a";
25
+ const BaseComponent = as !== null && as !== void 0 ? as : "a";
27
26
  let t1;
28
27
  if ($[5] !== className) {
29
28
  t1 = clsx(className, TopicTag_module_css_default.TopicTag);
@@ -8,7 +8,6 @@ import { forwardRef, useContext, useRef } from "react";
8
8
  import { jsx } from "react/jsx-runtime";
9
9
  //#region src/UnderlineNav/UnderlineNavItem.tsx
10
10
  const UnderlineNavItem = /*#__PURE__*/ forwardRef((allProps, forwardedRef) => {
11
- var _leadingVisual;
12
11
  const $ = c(33);
13
12
  let Icon;
14
13
  let ariaCurrent;
@@ -45,8 +44,7 @@ const UnderlineNavItem = /*#__PURE__*/ forwardRef((allProps, forwardedRef) => {
45
44
  const Component = t0 === void 0 ? "a" : t0;
46
45
  let t1;
47
46
  if ($[10] !== Component || $[11] !== href) {
48
- var _href;
49
- t1 = Component === "a" ? { href: (_href = href) !== null && _href !== void 0 ? _href : "#" } : href === void 0 ? {} : { href };
47
+ t1 = Component === "a" ? { href: href !== null && href !== void 0 ? href : "#" } : href === void 0 ? {} : { href };
50
48
  $[10] = Component;
51
49
  $[11] = href;
52
50
  $[12] = t1;
@@ -75,7 +73,7 @@ const UnderlineNavItem = /*#__PURE__*/ forwardRef((allProps, forwardedRef) => {
75
73
  } else t3 = $[16];
76
74
  const clickHandler = t3;
77
75
  const t4 = isOverflowing ? true : allProps["aria-hidden"];
78
- const t5 = (_leadingVisual = leadingVisual) !== null && _leadingVisual !== void 0 ? _leadingVisual : Icon;
76
+ const t5 = leadingVisual !== null && leadingVisual !== void 0 ? leadingVisual : Icon;
79
77
  const t6 = isOverflowing ? -1 : allProps.tabIndex;
80
78
  let t7;
81
79
  if ($[17] !== Component || $[18] !== ariaCurrent || $[19] !== children || $[20] !== clickHandler || $[21] !== counter || $[22] !== forwardedRef || $[23] !== hrefProps || $[24] !== keyDownHandler || $[25] !== loadingCounters || $[26] !== props || $[27] !== t5 || $[28] !== t6) {
@@ -86,7 +86,7 @@ const List = /*#__PURE__*/ React.forwardRef((props, forwardedRef) => {
86
86
  for (const itemProps_0 of restProps.items) {
87
87
  var _group$items$length, _group$items, _group$items2;
88
88
  const group = groupMap.get(itemProps_0.groupId);
89
- const itemIndex_0 = (_group$items$length = group === null || group === void 0 ? void 0 : (_group$items = group.items) === null || _group$items === void 0 ? void 0 : _group$items.length) !== null && _group$items$length !== void 0 ? _group$items$length : 0;
89
+ const itemIndex_0 = (_group$items$length = group === null || group === void 0 || (_group$items = group.items) === null || _group$items === void 0 ? void 0 : _group$items.length) !== null && _group$items$length !== void 0 ? _group$items$length : 0;
90
90
  groupMap.set(itemProps_0.groupId, {
91
91
  ...group,
92
92
  items: [...(_group$items2 = group === null || group === void 0 ? void 0 : group.items) !== null && _group$items2 !== void 0 ? _group$items2 : [], renderItem({
@@ -52,7 +52,7 @@ type SelectPanelMessageProps = {
52
52
  declare const SelectPanel: React.FC<SelectPanelProps> & {
53
53
  Button: WithSlotMarker<React.ForwardRefExoticComponent<{
54
54
  alignContent?: AlignContent;
55
- icon?: React.FunctionComponent<import("@primer/octicons-react").IconProps> | React.ElementType | React.ReactElement<any> | null;
55
+ icon?: React.ReactNode | React.ComponentType<import("@primer/octicons-react").IconProps> | React.ExoticComponent<import("@primer/octicons-react").IconProps>;
56
56
  leadingVisual?: React.ElementType | React.ReactElement<any> | null;
57
57
  trailingVisual?: React.ElementType | React.ReactElement<any> | null;
58
58
  trailingAction?: React.ElementType | null;
@@ -6,12 +6,14 @@ type UseOpenAndCloseFocusSettings = {
6
6
  containerRef: React.RefObject<HTMLElement | null>;
7
7
  returnFocusRef: React.RefObject<HTMLElement | null>;
8
8
  preventFocusOnOpen?: boolean;
9
+ preventFocusOnClose?: boolean;
9
10
  };
10
11
  declare function useOpenAndCloseFocus({
11
12
  initialFocusRef,
12
13
  returnFocusRef,
13
14
  containerRef,
14
- preventFocusOnOpen
15
+ preventFocusOnOpen,
16
+ preventFocusOnClose
15
17
  }: UseOpenAndCloseFocusSettings): void;
16
18
  //#endregion
17
19
  export { UseOpenAndCloseFocusSettings, useOpenAndCloseFocus };
@@ -1,14 +1,24 @@
1
1
  import { c } from "../utils/react-compiler-runtime.js";
2
+ import { useEffectCallback } from "../internal/hooks/useEffectCallback.js";
2
3
  import { useEffect } from "react";
3
4
  import { iterateFocusableElements } from "@primer/behaviors/utils";
4
5
  //#region src/hooks/useOpenAndCloseFocus.ts
5
6
  function useOpenAndCloseFocus(t0) {
6
- const $ = c(6);
7
- const { initialFocusRef, returnFocusRef, containerRef, preventFocusOnOpen } = t0;
7
+ const $ = c(9);
8
+ const { initialFocusRef, returnFocusRef, containerRef, preventFocusOnOpen, preventFocusOnClose } = t0;
8
9
  let t1;
10
+ if ($[0] !== preventFocusOnClose) {
11
+ t1 = (element) => {
12
+ if (!preventFocusOnClose) element === null || element === void 0 || element.focus();
13
+ };
14
+ $[0] = preventFocusOnClose;
15
+ $[1] = t1;
16
+ } else t1 = $[1];
17
+ const restoreFocus = useEffectCallback(t1);
9
18
  let t2;
10
- if ($[0] !== containerRef || $[1] !== initialFocusRef || $[2] !== preventFocusOnOpen || $[3] !== returnFocusRef) {
11
- t1 = () => {
19
+ let t3;
20
+ if ($[2] !== containerRef || $[3] !== initialFocusRef || $[4] !== preventFocusOnOpen || $[5] !== restoreFocus || $[6] !== returnFocusRef) {
21
+ t2 = () => {
12
22
  if (!preventFocusOnOpen) {
13
23
  if (initialFocusRef && initialFocusRef.current) initialFocusRef.current.focus();
14
24
  else if (containerRef.current) {
@@ -18,26 +28,28 @@ function useOpenAndCloseFocus(t0) {
18
28
  }
19
29
  const returnFocusRefCurrent = returnFocusRef.current;
20
30
  return function() {
21
- returnFocusRefCurrent === null || returnFocusRefCurrent === void 0 || returnFocusRefCurrent.focus();
31
+ restoreFocus(returnFocusRefCurrent);
22
32
  };
23
33
  };
24
- t2 = [
34
+ t3 = [
25
35
  initialFocusRef,
26
36
  returnFocusRef,
27
37
  containerRef,
28
- preventFocusOnOpen
38
+ preventFocusOnOpen,
39
+ restoreFocus
29
40
  ];
30
- $[0] = containerRef;
31
- $[1] = initialFocusRef;
32
- $[2] = preventFocusOnOpen;
33
- $[3] = returnFocusRef;
34
- $[4] = t1;
35
- $[5] = t2;
41
+ $[2] = containerRef;
42
+ $[3] = initialFocusRef;
43
+ $[4] = preventFocusOnOpen;
44
+ $[5] = restoreFocus;
45
+ $[6] = returnFocusRef;
46
+ $[7] = t2;
47
+ $[8] = t3;
36
48
  } else {
37
- t1 = $[4];
38
- t2 = $[5];
49
+ t2 = $[7];
50
+ t3 = $[8];
39
51
  }
40
- useEffect(t1, t2);
52
+ useEffect(t2, t3);
41
53
  }
42
54
  //#endregion
43
55
  export { useOpenAndCloseFocus };
@@ -9,6 +9,7 @@ type UseOverlaySettings = {
9
9
  onClickOutside: (e: TouchOrMouseEvent) => void;
10
10
  overlayRef?: React.RefObject<HTMLDivElement | null>;
11
11
  preventFocusOnOpen?: boolean;
12
+ preventFocusOnClose?: boolean;
12
13
  };
13
14
  type OverlayReturnProps = {
14
15
  ref: React.RefObject<HTMLDivElement | null>;
@@ -20,7 +21,8 @@ declare const useOverlay: ({
20
21
  onEscape,
21
22
  ignoreClickRefs,
22
23
  onClickOutside,
23
- preventFocusOnOpen
24
+ preventFocusOnOpen,
25
+ preventFocusOnClose
24
26
  }: UseOverlaySettings) => OverlayReturnProps;
25
27
  //#endregion
26
28
  export { OverlayReturnProps, UseOverlaySettings, useOverlay };
@@ -5,53 +5,55 @@ import { useOnEscapePress } from "./useOnEscapePress.js";
5
5
  import { useOpenAndCloseFocus } from "./useOpenAndCloseFocus.js";
6
6
  //#region src/hooks/useOverlay.tsx
7
7
  const useOverlay = (t0) => {
8
- const $ = c(13);
9
- const { overlayRef: _overlayRef, returnFocusRef, initialFocusRef, onEscape, ignoreClickRefs, onClickOutside, preventFocusOnOpen } = t0;
8
+ const $ = c(14);
9
+ const { overlayRef: _overlayRef, returnFocusRef, initialFocusRef, onEscape, ignoreClickRefs, onClickOutside, preventFocusOnOpen, preventFocusOnClose } = t0;
10
10
  const overlayRef = useProvidedRefOrCreate(_overlayRef);
11
11
  let t1;
12
- if ($[0] !== initialFocusRef || $[1] !== overlayRef || $[2] !== preventFocusOnOpen || $[3] !== returnFocusRef) {
12
+ if ($[0] !== initialFocusRef || $[1] !== overlayRef || $[2] !== preventFocusOnClose || $[3] !== preventFocusOnOpen || $[4] !== returnFocusRef) {
13
13
  t1 = {
14
14
  containerRef: overlayRef,
15
15
  returnFocusRef,
16
16
  initialFocusRef,
17
- preventFocusOnOpen
17
+ preventFocusOnOpen,
18
+ preventFocusOnClose
18
19
  };
19
20
  $[0] = initialFocusRef;
20
21
  $[1] = overlayRef;
21
- $[2] = preventFocusOnOpen;
22
- $[3] = returnFocusRef;
23
- $[4] = t1;
24
- } else t1 = $[4];
22
+ $[2] = preventFocusOnClose;
23
+ $[3] = preventFocusOnOpen;
24
+ $[4] = returnFocusRef;
25
+ $[5] = t1;
26
+ } else t1 = $[5];
25
27
  useOpenAndCloseFocus(t1);
26
28
  let t2;
27
- if ($[5] !== ignoreClickRefs || $[6] !== onClickOutside || $[7] !== overlayRef) {
29
+ if ($[6] !== ignoreClickRefs || $[7] !== onClickOutside || $[8] !== overlayRef) {
28
30
  t2 = {
29
31
  containerRef: overlayRef,
30
32
  ignoreClickRefs,
31
33
  onClickOutside
32
34
  };
33
- $[5] = ignoreClickRefs;
34
- $[6] = onClickOutside;
35
- $[7] = overlayRef;
36
- $[8] = t2;
37
- } else t2 = $[8];
35
+ $[6] = ignoreClickRefs;
36
+ $[7] = onClickOutside;
37
+ $[8] = overlayRef;
38
+ $[9] = t2;
39
+ } else t2 = $[9];
38
40
  useOnOutsideClick(t2);
39
41
  let t3;
40
- if ($[9] !== onEscape) {
42
+ if ($[10] !== onEscape) {
41
43
  t3 = (event) => {
42
44
  onEscape(event);
43
45
  event.preventDefault();
44
46
  };
45
- $[9] = onEscape;
46
- $[10] = t3;
47
- } else t3 = $[10];
47
+ $[10] = onEscape;
48
+ $[11] = t3;
49
+ } else t3 = $[11];
48
50
  useOnEscapePress(t3);
49
51
  let t4;
50
- if ($[11] !== overlayRef) {
52
+ if ($[12] !== overlayRef) {
51
53
  t4 = { ref: overlayRef };
52
- $[11] = overlayRef;
53
- $[12] = t4;
54
- } else t4 = $[12];
54
+ $[12] = overlayRef;
55
+ $[13] = t4;
56
+ } else t4 = $[13];
55
57
  return t4;
56
58
  };
57
59
  //#endregion
@@ -54,12 +54,11 @@ function InputLabel(t0) {
54
54
  } else t4 = $[13];
55
55
  let t5;
56
56
  if ($[14] !== children || $[15] !== required || $[16] !== requiredIndicator || $[17] !== requiredText) {
57
- var _requiredText;
58
57
  t5 = required || requiredText ? /* @__PURE__ */ jsxs("span", {
59
58
  className: InputLabel_module_css_default.RequiredText,
60
59
  children: [/* @__PURE__ */ jsx("span", { children }), /* @__PURE__ */ jsx("span", {
61
60
  "aria-hidden": requiredIndicator ? void 0 : true,
62
- children: (_requiredText = requiredText) !== null && _requiredText !== void 0 ? _requiredText : "*"
61
+ children: requiredText !== null && requiredText !== void 0 ? requiredText : "*"
63
62
  })]
64
63
  }) : children;
65
64
  $[14] = children;
@@ -94,13 +94,12 @@ const TextInputAction = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
94
94
  } else t6 = $[17];
95
95
  let t7;
96
96
  if ($[18] !== accessibleLabel || $[19] !== ariaLabel || $[20] !== children || $[21] !== forwardedRef || $[22] !== icon || $[23] !== rest || $[24] !== styleProps || $[25] !== tooltipDirection || $[26] !== variant) {
97
- var _tooltipDirection;
98
97
  t7 = /* @__PURE__ */ jsx("span", {
99
98
  className: t6,
100
99
  "data-component": "TextInput.Action",
101
100
  children: icon && !children && ariaLabel ? /* @__PURE__ */ jsx(IconButton, {
102
101
  ...accessibleLabel,
103
- tooltipDirection: (_tooltipDirection = tooltipDirection) !== null && _tooltipDirection !== void 0 ? _tooltipDirection : "s",
102
+ tooltipDirection: tooltipDirection !== null && tooltipDirection !== void 0 ? tooltipDirection : "s",
104
103
  variant,
105
104
  type: "button",
106
105
  icon,
@@ -5,6 +5,9 @@ import React, { ComponentProps } from "react";
5
5
  type TextInputSizes = 'small' | 'medium' | 'large';
6
6
  type StyledTextInputBaseWrapperProps = {
7
7
  block?: boolean;
8
+ /**
9
+ * @deprecated Omit this prop to use the default background.
10
+ */
8
11
  contrast?: boolean;
9
12
  disabled?: boolean;
10
13
  hasTrailingAction?: boolean;
@@ -53,7 +53,7 @@ function useThemeProvider(props) {
53
53
  }
54
54
  function subscribeToSystemColorMode(callback) {
55
55
  var _window, _window$matchMedia;
56
- const media = (_window = window) === null || _window === void 0 ? void 0 : (_window$matchMedia = _window.matchMedia) === null || _window$matchMedia === void 0 ? void 0 : _window$matchMedia.call(_window, "(prefers-color-scheme: dark)");
56
+ const media = (_window = window) === null || _window === void 0 || (_window$matchMedia = _window.matchMedia) === null || _window$matchMedia === void 0 ? void 0 : _window$matchMedia.call(_window, "(prefers-color-scheme: dark)");
57
57
  media === null || media === void 0 || media.addEventListener("change", callback);
58
58
  return () => media === null || media === void 0 ? void 0 : media.removeEventListener("change", callback);
59
59
  }
@@ -64,8 +64,8 @@ function _temp() {
64
64
  return "day";
65
65
  }
66
66
  function getSystemColorMode() {
67
- var _window2, _window2$matchMedia, _window2$matchMedia$c;
68
- return (_window2 = window) !== null && _window2 !== void 0 && (_window2$matchMedia = _window2.matchMedia) !== null && _window2$matchMedia !== void 0 && (_window2$matchMedia$c = _window2$matchMedia.call(_window2, "(prefers-color-scheme: dark)")) !== null && _window2$matchMedia$c !== void 0 && _window2$matchMedia$c.matches ? "night" : "day";
67
+ var _window2, _window2$matchMedia;
68
+ return (_window2 = window) !== null && _window2 !== void 0 && (_window2$matchMedia = _window2.matchMedia) !== null && _window2$matchMedia !== void 0 && (_window2$matchMedia = _window2$matchMedia.call(_window2, "(prefers-color-scheme: dark)")) !== null && _window2$matchMedia !== void 0 && _window2$matchMedia.matches ? "night" : "day";
69
69
  }
70
70
  //#endregion
71
71
  export { useThemeProvider };