@cfx-dev/ui-components 4.2.17 → 4.2.18

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.
@@ -6,38 +6,38 @@ import { ui as I } from "../ui.js";
6
6
  import { clsx as w } from "../../utils/clsx.js";
7
7
  import { debounce as R } from "../../utils/execution.js";
8
8
  import { minmax as y } from "../../utils/math.js";
9
- const T = "cfxui__Accordion__triggerContainer__b92c1", k = "cfxui__Accordion__iconFlip__367de", D = "cfxui__Accordion__iconUp__28d27", E = "cfxui__Accordion__iconDown__b9e95", N = "cfxui__Accordion__text__03dc4", U = "cfxui__Accordion__iconLeft__e348b", $ = "cfxui__Accordion__iconRight__bbf0c", F = "cfxui__Accordion__content__5ecaf", L = "cfxui__Accordion__open__ed604", S = "cfxui__Accordion__contentText__1384b", W = "cfxui__Accordion__closed__be897", o = {
9
+ const T = "cfxui__Accordion__triggerContainer__b92c1", k = "cfxui__Accordion__iconFlip__367de", D = "cfxui__Accordion__iconUp__28d27", E = "cfxui__Accordion__iconDown__b9e95", N = "cfxui__Accordion__text__03dc4", U = "cfxui__Accordion__iconLeft__e348b", F = "cfxui__Accordion__iconRight__bbf0c", $ = "cfxui__Accordion__content__5ecaf", L = "cfxui__Accordion__open__ed604", S = "cfxui__Accordion__contentText__1384b", W = "cfxui__Accordion__closed__be897", o = {
10
10
  triggerContainer: T,
11
11
  iconFlip: k,
12
12
  iconUp: D,
13
13
  iconDown: E,
14
14
  text: N,
15
15
  iconLeft: U,
16
- iconRight: $,
17
- content: F,
16
+ iconRight: F,
17
+ content: $,
18
18
  open: L,
19
19
  contentText: S,
20
20
  closed: W,
21
21
  "content-text-closing": "cfxui__Accordion__content-text-closing__163e4"
22
- }, g = e.createContext(void 0), q = function(i) {
22
+ }, p = e.createContext(void 0), q = function(i) {
23
23
  const {
24
24
  children: t,
25
25
  className: s
26
- } = i, [n, r] = e.useState({}), [d, l] = e.useState(null), a = e.useRef(null), u = e.useCallback((p) => {
26
+ } = i, [n, r] = e.useState({}), [d, l] = e.useState(null), u = e.useRef(null), a = e.useCallback((g) => {
27
27
  r((m) => ({
28
28
  ...m,
29
- [p]: !m[p]
29
+ [g]: !m[g]
30
30
  }));
31
31
  }, []), _ = e.useMemo(() => ({
32
32
  openItems: n,
33
- toggleItem: u,
33
+ toggleItem: a,
34
34
  rootWidth: d
35
- }), [n, u, d]), f = e.useCallback(() => {
36
- a.current && l(a.current.getBoundingClientRect().width);
35
+ }), [n, a, d]), f = e.useCallback(() => {
36
+ u.current && l(u.current.getBoundingClientRect().width);
37
37
  }, []), x = e.useMemo(() => R(f, 250), [f]);
38
38
  return e.useEffect(() => (window.addEventListener("resize", x), () => {
39
39
  window.removeEventListener("resize", x);
40
- }), [x]), /* @__PURE__ */ c(g.Provider, { value: _, children: /* @__PURE__ */ c("div", { ref: a, className: s, role: "presentation", children: t }) });
40
+ }), [x]), /* @__PURE__ */ c(p.Provider, { value: _, children: /* @__PURE__ */ c("div", { ref: u, className: s, role: "presentation", children: t }) });
41
41
  }, C = e.createContext(""), V = function({
42
42
  children: i
43
43
  }) {
@@ -51,28 +51,28 @@ const T = "cfxui__Accordion__triggerContainer__b92c1", k = "cfxui__Accordion__ic
51
51
  text: i,
52
52
  iconLeft: t
53
53
  }) {
54
- const s = e.useContext(g), n = e.useContext(C);
54
+ const s = e.useContext(p), n = e.useContext(C);
55
55
  if (!s)
56
56
  throw new Error("AccordionTrigger must be used within an Accordion");
57
57
  const {
58
58
  toggleItem: r,
59
59
  openItems: d
60
- } = s, l = d[n], [a, u] = e.useState(!1), [_, f] = e.useState(l ? "UpChevron" : "DownChevron"), x = e.useCallback(() => {
60
+ } = s, l = d[n], [u, a] = e.useState(!1), [_, f] = e.useState(l ? "UpChevron" : "DownChevron"), x = e.useCallback(() => {
61
61
  r(n);
62
- }, [n, r]), p = e.useCallback((m) => {
62
+ }, [n, r]), g = e.useCallback((m) => {
63
63
  (m.key === "Enter" || m.key === " ") && r(n);
64
64
  }, [n, r]);
65
65
  return e.useEffect(() => {
66
66
  const m = setTimeout(() => {
67
- f(l ? "UpChevron" : "DownChevron"), u(!1);
67
+ f(l ? "UpChevron" : "DownChevron"), a(!1);
68
68
  }, 300);
69
- return u(!0), () => clearTimeout(m);
69
+ return a(!0), () => clearTimeout(m);
70
70
  }, [l]), /* @__PURE__ */ v(
71
71
  "div",
72
72
  {
73
73
  className: o.triggerContainer,
74
74
  onClick: x,
75
- onKeyDown: p,
75
+ onKeyDown: g,
76
76
  role: "button",
77
77
  tabIndex: 0,
78
78
  "aria-expanded": l,
@@ -85,7 +85,7 @@ const T = "cfxui__Accordion__triggerContainer__b92c1", k = "cfxui__Accordion__ic
85
85
  A,
86
86
  {
87
87
  className: w(o.iconRight, {
88
- [o.iconFlip]: a,
88
+ [o.iconFlip]: u,
89
89
  [o.iconUp]: _ === "UpChevron",
90
90
  [o.iconDown]: _ === "DownChevron"
91
91
  }),
@@ -98,16 +98,16 @@ const T = "cfxui__Accordion__triggerContainer__b92c1", k = "cfxui__Accordion__ic
98
98
  }, Q = function({
99
99
  children: i
100
100
  }) {
101
- const t = e.useContext(g), s = e.useContext(C), [n, r] = e.useState(null), d = e.useRef(null);
101
+ const t = e.useContext(p), s = e.useContext(C), [n, r] = e.useState(null), d = e.useRef(null);
102
102
  if (!t)
103
103
  throw new Error("AccordionContent must be used within an Accordion");
104
104
  const {
105
105
  openItems: l,
106
- rootWidth: a
107
- } = t, u = l[s], _ = e.useMemo(() => n === null ? 250 : y(n / 150 * 250, 250, 500), [n]);
106
+ rootWidth: u
107
+ } = t, a = l[s], _ = e.useMemo(() => n === null ? 250 : y(n / 150 * 250, 350, 500), [n]);
108
108
  return e.useEffect(() => {
109
109
  r(null);
110
- }, [a]), e.useEffect(() => {
110
+ }, [u]), e.useEffect(() => {
111
111
  if (n === null && d.current) {
112
112
  const f = d.current.getBoundingClientRect().height;
113
113
  r(f);
@@ -119,12 +119,12 @@ const T = "cfxui__Accordion__triggerContainer__b92c1", k = "cfxui__Accordion__ic
119
119
  role: "region",
120
120
  "aria-labelledby": `${s}-header`,
121
121
  className: w(o.content, {
122
- [o.open]: u,
123
- [o.closed]: !u
122
+ [o.open]: a,
123
+ [o.closed]: !a
124
124
  }),
125
125
  style: {
126
- "--content-display": n === null ? "inline-block" : "none",
127
- "--content-height": n === null ? I.q(30) : `${n}px`,
126
+ "--content-display": "inline-block",
127
+ "--content-height": I.q(100),
128
128
  "--content-animation-time": `${_}ms`
129
129
  },
130
130
  children: /* @__PURE__ */ c(