@cfx-dev/ui-components 5.0.29 → 5.0.31

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.
@@ -1,38 +1,40 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import r from "react";
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import i from "react";
3
3
  import "../../ui/ui.js";
4
4
  import { MediaQueryValuesMap as t } from "../../ui/ui.types.js";
5
- import d from "./MediaQueryContext.js";
6
- function m(o) {
5
+ import f, { DEFAULT_Q_SIZE as u } from "./MediaQueryContext.js";
6
+ function p(s) {
7
7
  const {
8
- children: u
9
- } = o, i = r.useRef(null), [e, s] = r.useState(null);
10
- r.useLayoutEffect(() => {
8
+ children: l
9
+ } = s, r = i.useRef(null), [e, a] = i.useState(null), [o, d] = i.useState(u);
10
+ i.useLayoutEffect(() => {
11
11
  const n = () => {
12
- typeof window > "u" || (i.current && clearTimeout(i.current), i.current = setTimeout(() => {
13
- s(window.innerWidth);
12
+ typeof window > "u" || (r.current && clearTimeout(r.current), r.current = setTimeout(() => {
13
+ a(window.innerWidth), d(parseFloat(getComputedStyle(document.documentElement).fontSize) * 0.5);
14
14
  }, 250));
15
15
  };
16
16
  return window.addEventListener("resize", n), n(), () => {
17
17
  window.removeEventListener("resize", n);
18
18
  };
19
19
  }, []);
20
- const l = r.useMemo(() => e === null ? {
20
+ const m = i.useMemo(() => e === null ? {
21
21
  size: null,
22
22
  isMobile: null,
23
23
  isTablet: null,
24
24
  isDesktop: null,
25
- isLDesktop: null
25
+ isLDesktop: null,
26
+ qSize: u
26
27
  } : {
27
28
  size: e,
29
+ qSize: o,
28
30
  isMobile: e < t.medium,
29
31
  isTablet: e >= t.medium && e < t.large,
30
32
  isDesktop: e >= t.large && e < t.xlarge,
31
33
  isLDesktop: e >= t.xlarge
32
- }, [e]);
33
- return /* @__PURE__ */ a(d.Provider, { value: l, children: u });
34
+ }, [e, o]);
35
+ return /* @__PURE__ */ c(f.Provider, { value: m, children: l });
34
36
  }
35
- const M = r.memo(m);
37
+ const v = i.memo(p);
36
38
  export {
37
- M as default
39
+ v as default
38
40
  };
@@ -1,4 +1,4 @@
1
- export { default as MediaQueryContext } from './MediaQueryContext';
1
+ export { default as MediaQueryContext, DEFAULT_Q_SIZE } from './MediaQueryContext';
2
2
  export { default as MediaQueryContextProvider } from './MediaQueryContextProvider';
3
3
  export { default as useMediaQuery } from './useMediaQuery';
4
4
  export type { MediaQueryContextValueType } from './MediaQueryContext';
@@ -1,8 +1,9 @@
1
- import { default as t } from "./MediaQueryContext.js";
2
- import { default as o } from "./MediaQueryContextProvider.js";
3
- import { default as u } from "./useMediaQuery.js";
1
+ import { DEFAULT_Q_SIZE as t, default as a } from "./MediaQueryContext.js";
2
+ import { default as d } from "./MediaQueryContextProvider.js";
3
+ import { default as f } from "./useMediaQuery.js";
4
4
  export {
5
- t as MediaQueryContext,
6
- o as MediaQueryContextProvider,
7
- u as useMediaQuery
5
+ t as DEFAULT_Q_SIZE,
6
+ a as MediaQueryContext,
7
+ d as MediaQueryContextProvider,
8
+ f as useMediaQuery
8
9
  };
@@ -9,19 +9,30 @@ export interface ILinkMatch {
9
9
  key: string;
10
10
  text: string;
11
11
  url: string;
12
+ index: number;
12
13
  }
13
14
  export declare function matchLinks(text: string): ILinkSubstitute[];
15
+ export declare function matchMDLinkNodes(text: string): Generator<string | {
16
+ key: string;
17
+ text: string;
18
+ url: string;
19
+ index: number;
20
+ }, void, unknown>;
14
21
  export declare function matchLinkNodes(text: string): Generator<string | {
15
22
  key: string;
16
23
  text: string;
17
24
  url: string;
25
+ index: number;
18
26
  }, void, unknown>;
19
27
  export declare function defaultLinkReplacerx(key: string, text: string, url: string): React.ReactNode;
20
- export declare function defaultLinkReplacer(text: string, url: string): string;
28
+ export declare function defaultLinkReplacer(_: string, text: string, url: string): string;
29
+ export declare function linkify<T>(text: string, replacer?: (key: string, text: string, url: string) => T, matcher?: (text: string) => Iterable<string | ILinkMatch>): (T | string)[];
21
30
  export declare function linkifyx(text: string, replacer?: typeof defaultLinkReplacerx): React.ReactNode;
22
- export declare function linkify(text: string, replacer?: typeof defaultLinkReplacer): string;
31
+ export declare function linkifyWithMD(text: string, replacer?: typeof defaultLinkReplacerx): React.ReactNode;
23
32
  export interface LinkifyProps {
24
33
  text: string;
25
34
  replacer?: typeof defaultLinkReplacerx;
35
+ linkifyFn?: (text: string, replacer: typeof defaultLinkReplacerx) => React.ReactNode;
26
36
  }
27
37
  export declare function Linkify(props: LinkifyProps): import("react/jsx-runtime").JSX.Element;
38
+ export declare function LinkifyWithMD(props: LinkifyProps): import("react/jsx-runtime").JSX.Element;