@grafana/components 0.0.39 → 0.0.41

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.
@@ -25264,8 +25264,8 @@ const Popover = React.forwardRef(
25264
25264
  const arrowRef = React.useRef(null);
25265
25265
  const closeTimer = React.useRef(void 0);
25266
25266
  const popoverId = React.useId();
25267
- const [isOpenState, setOpen] = React.useState(isOpenControlled);
25268
- const [isDelayedOpen, setDelayedOpen] = React.useState(isOpenControlled);
25267
+ const [isOpenState, setOpen] = React.useState(isOpenControlled != null ? isOpenControlled : false);
25268
+ const [isDelayedOpen, setDelayedOpen] = React.useState(isOpenControlled != null ? isOpenControlled : false);
25269
25269
  const isOpen = isOpenControlled != null ? isOpenControlled : isOpenState;
25270
25270
  const middleware = getMiddleware({ placement, arrowRef });
25271
25271
  const styles = getStyles$7();
@@ -25349,9 +25349,29 @@ const Popover = React.forwardRef(
25349
25349
  },
25350
25350
  [forwardedRef, refs]
25351
25351
  );
25352
- const [trigger, content] = typeof _trigger !== "undefined" ? [_trigger, children] : [children, _content];
25352
+ const [trigger, content] = (() => {
25353
+ switch (true) {
25354
+ /**
25355
+ * If the popover is controlled, the trigger isn’t used at all
25356
+ */
25357
+ case typeof isOpenControlled !== "undefined":
25358
+ return [void 0, children];
25359
+ /**
25360
+ * If a trigger prop was passed, use it as the trigger, and the children
25361
+ * as the popover content
25362
+ */
25363
+ case typeof _trigger !== "undefined":
25364
+ return [_trigger, children];
25365
+ /**
25366
+ * Otherwise, use the children as the trigger element, and the content
25367
+ * prop as the popover content
25368
+ */
25369
+ default:
25370
+ return [children, _content];
25371
+ }
25372
+ })();
25353
25373
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
25354
- React.cloneElement(trigger, {
25374
+ typeof trigger !== "undefined" && React.cloneElement(trigger, {
25355
25375
  ref: handleRef,
25356
25376
  tabIndex: 0,
25357
25377
  "aria-describedby": isOpen ? popoverId : void 0,