@uoguelph/react-components 1.10.2-rc.0 → 1.10.2

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/accordion.js +15 -11
  2. package/package.json +1 -1
package/dist/accordion.js CHANGED
@@ -1,29 +1,33 @@
1
1
  "use client";
2
- import { jsx as n } from "react/jsx-runtime";
2
+ import { jsx as r } from "react/jsx-runtime";
3
3
  import { Disclosure as m } from "@headlessui/react";
4
4
  import { twMerge as l } from "tailwind-merge";
5
5
  import { AccordionContext as u } from "./accordion-context.js";
6
- import { useRef as d, useEffect as f } from "react";
6
+ import { useRef as h, useEffect as d } from "react";
7
7
  import { AccordionButton as O } from "./accordion-button.js";
8
8
  import { AccordionContent as B } from "./accordion-content.js";
9
- function h({ id: e, children: c, className: i }) {
10
- const s = l("my-2 [&_p:last-child]:mb-0", i), t = d(null);
11
- return f(() => {
9
+ function f({ id: e, children: c, className: i }) {
10
+ const s = l("my-2 [&_p:last-child]:mb-0", i), t = h(null);
11
+ return d(() => {
12
12
  if (!e) return;
13
13
  const o = () => {
14
14
  if (window.location.hash.replace(/^#/, "") !== e) return;
15
- const r = document.getElementById(e);
16
- if (!r) return;
17
- r.querySelector("[data-open]") !== null || t.current?.click(), r.scrollIntoView({ block: "start" });
15
+ const n = document.getElementById(e);
16
+ if (!n) return;
17
+ n.querySelector("[data-open]") !== null || t.current?.click(), n.scrollIntoView({
18
+ behavior: "smooth",
19
+ block: "start",
20
+ inline: "nearest"
21
+ });
18
22
  }, a = setTimeout(o, 0);
19
23
  return window.addEventListener("hashchange", o), () => {
20
24
  clearTimeout(a), window.removeEventListener("hashchange", o);
21
25
  };
22
- }, [e]), /* @__PURE__ */ n(m, { children: ({ open: o }) => /* @__PURE__ */ n("div", { id: e, className: `uofg-accordion ${s}`, children: /* @__PURE__ */ n(u.Provider, { value: { isOpen: o, buttonRef: t }, children: c }) }) });
26
+ }, [e]), /* @__PURE__ */ r(m, { children: ({ open: o }) => /* @__PURE__ */ r("div", { id: e, className: `uofg-accordion ${s}`, children: /* @__PURE__ */ r(u.Provider, { value: { isOpen: o, buttonRef: t }, children: c }) }) });
23
27
  }
24
- h.displayName = "Accordion";
28
+ f.displayName = "Accordion";
25
29
  export {
26
- h as Accordion,
30
+ f as Accordion,
27
31
  O as AccordionButton,
28
32
  B as AccordionContent
29
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uoguelph/react-components",
3
- "version": "1.10.2-rc.0",
3
+ "version": "1.10.2",
4
4
  "description": "University of Guelph React Components Library",
5
5
  "type": "module",
6
6
  "scripts": {