@cfx-dev/ui-components 0.0.5
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.
- package/LICENSE +21 -0
- package/README.md +17 -0
- package/dist/Button.module-Z6njvP9Z.js +17 -0
- package/dist/Combination-AG9vHdSx.js +1478 -0
- package/dist/Icons-B26SczGZ.js +162 -0
- package/dist/Rail-DoYzqKk4.js +89 -0
- package/dist/assets/Avatar.css +1 -0
- package/dist/assets/Badge.css +1 -0
- package/dist/assets/Box.css +1 -0
- package/dist/assets/Button.css +1 -0
- package/dist/assets/Center.css +1 -0
- package/dist/assets/Checkbox.css +1 -0
- package/dist/assets/ControlBox.css +1 -0
- package/dist/assets/CountryFlag.css +1 -0
- package/dist/assets/Decorate.css +1 -0
- package/dist/assets/Dot.css +1 -0
- package/dist/assets/Flex.css +1 -0
- package/dist/assets/FlexRestricter.css +1 -0
- package/dist/assets/Flyout.css +1 -0
- package/dist/assets/Icon.css +1 -0
- package/dist/assets/Indicator.css +1 -0
- package/dist/assets/InfoPanel.css +1 -0
- package/dist/assets/Input.css +1 -0
- package/dist/assets/Interactive.css +1 -0
- package/dist/assets/Island.css +1 -0
- package/dist/assets/Loaf.css +1 -0
- package/dist/assets/Modal.css +1 -0
- package/dist/assets/NavList.css +1 -0
- package/dist/assets/Overlay.css +1 -0
- package/dist/assets/Pad.css +1 -0
- package/dist/assets/Page.css +1 -0
- package/dist/assets/Popover.css +1 -0
- package/dist/assets/PremiumBadge.css +1 -0
- package/dist/assets/Prose.css +1 -0
- package/dist/assets/Radio.css +1 -0
- package/dist/assets/Rail.css +1 -0
- package/dist/assets/RichInput.css +1 -0
- package/dist/assets/Select.css +1 -0
- package/dist/assets/Separator.css +1 -0
- package/dist/assets/Shroud.css +1 -0
- package/dist/assets/Spacer.css +1 -0
- package/dist/assets/Switch.css +1 -0
- package/dist/assets/Tabular.css +1 -0
- package/dist/assets/Text.css +1 -0
- package/dist/assets/Textarea.css +1 -0
- package/dist/assets/Title.css +1 -0
- package/dist/assets/global.css +1 -0
- package/dist/assets/themes.css +1 -0
- package/dist/components/Avatar/Avatar.d.ts +8 -0
- package/dist/components/Avatar/Avatar.js +22 -0
- package/dist/components/BackdropPortal/BackdropPortal.d.ts +6 -0
- package/dist/components/BackdropPortal/BackdropPortal.js +11 -0
- package/dist/components/Badge/Badge.d.ts +9 -0
- package/dist/components/Badge/Badge.js +18 -0
- package/dist/components/Button/Button.d.ts +22 -0
- package/dist/components/Button/Button.js +56 -0
- package/dist/components/Button/ButtonBar.d.ts +6 -0
- package/dist/components/Button/ButtonBar.js +13 -0
- package/dist/components/Checkbox/Checkbox.d.ts +12 -0
- package/dist/components/Checkbox/Checkbox.js +42 -0
- package/dist/components/ControlBox/ControlBox.d.ts +9 -0
- package/dist/components/ControlBox/ControlBox.js +19 -0
- package/dist/components/CountryFlag/CountryFlag.d.ts +9 -0
- package/dist/components/CountryFlag/CountryFlag.js +21 -0
- package/dist/components/Decorate/Decorate.d.ts +9 -0
- package/dist/components/Decorate/Decorate.js +20 -0
- package/dist/components/Dot/Dot.d.ts +6 -0
- package/dist/components/Dot/Dot.js +14 -0
- package/dist/components/Flyout/Flyout.d.ts +17 -0
- package/dist/components/Flyout/Flyout.js +60 -0
- package/dist/components/Icon/Icon.d.ts +11 -0
- package/dist/components/Icon/Icon.js +24 -0
- package/dist/components/Icons.d.ts +38 -0
- package/dist/components/Icons.js +6 -0
- package/dist/components/Indicator/Indicator.d.ts +6 -0
- package/dist/components/Indicator/Indicator.js +19 -0
- package/dist/components/InfoPanel/InfoPanel.d.ts +13 -0
- package/dist/components/InfoPanel/InfoPanel.js +34 -0
- package/dist/components/Input/Input.d.ts +37 -0
- package/dist/components/Input/Input.js +96 -0
- package/dist/components/Input/RichInput.d.ts +18 -0
- package/dist/components/Input/RichInput.js +63 -0
- package/dist/components/Interactive/Interactive.d.ts +6 -0
- package/dist/components/Interactive/Interactive.js +18 -0
- package/dist/components/Island/Island.d.ts +26 -0
- package/dist/components/Island/Island.js +34 -0
- package/dist/components/Layout/Box/Box.d.ts +21 -0
- package/dist/components/Layout/Box/Box.js +38 -0
- package/dist/components/Layout/Center/Center.d.ts +9 -0
- package/dist/components/Layout/Center/Center.js +22 -0
- package/dist/components/Layout/Flex/Flex.d.ts +26 -0
- package/dist/components/Layout/Flex/Flex.js +75 -0
- package/dist/components/Layout/Flex/FlexRestricter.d.ts +12 -0
- package/dist/components/Layout/Flex/FlexRestricter.js +20 -0
- package/dist/components/Layout/Pad/Pad.d.ts +15 -0
- package/dist/components/Layout/Pad/Pad.js +36 -0
- package/dist/components/Layout/Page/Page.d.ts +8 -0
- package/dist/components/Layout/Page/Page.js +21 -0
- package/dist/components/Layout/Scrollable/Rail.d.ts +13 -0
- package/dist/components/Layout/Scrollable/Rail.js +10 -0
- package/dist/components/Layout/Scrollable/Scrollable.d.ts +14 -0
- package/dist/components/Layout/Scrollable/Scrollable.js +89 -0
- package/dist/components/Layout/Scrollable/VirtualScrollable.d.ts +11 -0
- package/dist/components/Layout/Scrollable/VirtualScrollable.js +426 -0
- package/dist/components/Loaf/Loaf.d.ts +12 -0
- package/dist/components/Loaf/Loaf.js +27 -0
- package/dist/components/Modal/Modal.d.ts +18 -0
- package/dist/components/Modal/Modal.js +42 -0
- package/dist/components/NavList/NavList.d.ts +14 -0
- package/dist/components/NavList/NavList.js +33 -0
- package/dist/components/OnScreenSensor.d.ts +5 -0
- package/dist/components/OnScreenSensor.js +26 -0
- package/dist/components/Overlay/Overlay.d.ts +20 -0
- package/dist/components/Overlay/Overlay.js +28 -0
- package/dist/components/Popover/Popover.d.ts +12 -0
- package/dist/components/Popover/Popover.js +40 -0
- package/dist/components/PremiumBadge/PremiumBadge.d.ts +15 -0
- package/dist/components/PremiumBadge/PremiumBadge.js +38 -0
- package/dist/components/Prose/Prose.d.ts +6 -0
- package/dist/components/Prose/Prose.js +12 -0
- package/dist/components/Radio/Radio.d.ts +12 -0
- package/dist/components/Radio/Radio.js +45 -0
- package/dist/components/Select/Select.d.ts +16 -0
- package/dist/components/Select/Select.js +3293 -0
- package/dist/components/Separator/Separator.d.ts +8 -0
- package/dist/components/Separator/Separator.js +29 -0
- package/dist/components/Shroud/Shroud.d.ts +6 -0
- package/dist/components/Shroud/Shroud.js +41 -0
- package/dist/components/Spacer/Spacer.d.ts +5 -0
- package/dist/components/Spacer/Spacer.js +26 -0
- package/dist/components/Style/Style.d.ts +12 -0
- package/dist/components/Style/Style.js +23 -0
- package/dist/components/Switch/Switch.d.ts +17 -0
- package/dist/components/Switch/Switch.js +65 -0
- package/dist/components/Symbols.d.ts +5 -0
- package/dist/components/Symbols.js +7 -0
- package/dist/components/Tabular/Tabular.d.ts +30 -0
- package/dist/components/Tabular/Tabular.js +64 -0
- package/dist/components/Text/Text.d.ts +8 -0
- package/dist/components/Text/Text.js +61 -0
- package/dist/components/Text/Text.types.d.ts +33 -0
- package/dist/components/Text/Text.types.js +1 -0
- package/dist/components/Textarea/Textarea.d.ts +15 -0
- package/dist/components/Textarea/Textarea.js +57 -0
- package/dist/components/Title/Title.d.ts +13 -0
- package/dist/components/Title/Title.js +113 -0
- package/dist/components/outlets.d.ts +10 -0
- package/dist/components/outlets.js +7 -0
- package/dist/components/ui.d.ts +28 -0
- package/dist/components/ui.js +29 -0
- package/dist/functional-C0pE183N.js +30 -0
- package/dist/hooks-Bv1kQUpO.js +65 -0
- package/dist/index-C75OpfGQ.js +19577 -0
- package/dist/links-CgOD-Vfj.js +1142 -0
- package/dist/main.d.ts +68 -0
- package/dist/main.js +118 -0
- package/dist/math-i2ceybzU.js +16 -0
- package/dist/medium-Dc7QRuE0.js +118 -0
- package/dist/outlet-C4wpavcH.js +25 -0
- package/dist/outlets-BsMV5obW.js +13 -0
- package/dist/string-NVxCUbqk.js +54 -0
- package/dist/styles-scss/_colors.scss +211 -0
- package/dist/styles-scss/_ui.scss +195 -0
- package/dist/styles-scss/global.scss +71 -0
- package/dist/styles-scss/themes/dark.scss +24 -0
- package/dist/styles-scss/themes/light.scss +54 -0
- package/dist/styles-scss/themes.scss +2 -0
- package/dist/styles-scss/tokens.scss +274 -0
- package/dist/tslib.es6-Dd_EkEfR.js +48 -0
- package/dist/utils/clsx.d.ts +7 -0
- package/dist/utils/clsx.js +14 -0
- package/dist/utils/functional.d.ts +5 -0
- package/dist/utils/functional.js +8 -0
- package/dist/utils/getValue.d.ts +2 -0
- package/dist/utils/getValue.js +6 -0
- package/dist/utils/hooks.d.ts +13 -0
- package/dist/utils/hooks.js +9 -0
- package/dist/utils/links.d.ts +27 -0
- package/dist/utils/links.js +14 -0
- package/dist/utils/math.d.ts +2 -0
- package/dist/utils/math.js +5 -0
- package/dist/utils/mergeRefs.d.ts +3 -0
- package/dist/utils/mergeRefs.js +10 -0
- package/dist/utils/outlet.d.ts +4 -0
- package/dist/utils/outlet.js +6 -0
- package/dist/utils/string.d.ts +6 -0
- package/dist/utils/string.js +9 -0
- package/package.json +82 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import w from "react";
|
|
3
|
+
import { clsx as b } from "../../../utils/clsx.js";
|
|
4
|
+
import { FlexRestricter as R } from "./FlexRestricter.js";
|
|
5
|
+
import '../../../assets/Flex.css';const F = "_root_1audv_1", z = "_centered_1audv_11", C = "_vertical_1audv_30", N = "_repell_1audv_36", E = "_wrap_1audv_39", T = "_stretch_1audv_51", j = "_horizontal_1audv_57", e = {
|
|
6
|
+
root: F,
|
|
7
|
+
"full-width": "_full-width_1audv_5",
|
|
8
|
+
"full-height": "_full-height_1audv_8",
|
|
9
|
+
centered: z,
|
|
10
|
+
"centered-axis": "_centered-axis_1audv_15",
|
|
11
|
+
"centered-cross-axis": "_centered-cross-axis_1audv_18",
|
|
12
|
+
"baseline-axis": "_baseline-axis_1audv_21",
|
|
13
|
+
"baseline-cross-axis": "_baseline-cross-axis_1audv_24",
|
|
14
|
+
"reverse-order": "_reverse-order_1audv_27",
|
|
15
|
+
vertical: C,
|
|
16
|
+
repell: N,
|
|
17
|
+
wrap: E,
|
|
18
|
+
"align-to-end": "_align-to-end_1audv_42",
|
|
19
|
+
"align-to-end-axis": "_align-to-end-axis_1audv_45",
|
|
20
|
+
"space-between": "_space-between_1audv_48",
|
|
21
|
+
stretch: T,
|
|
22
|
+
horizontal: j,
|
|
23
|
+
"gap-none": "_gap-none_1audv_63",
|
|
24
|
+
"gap-thin": "_gap-thin_1audv_66",
|
|
25
|
+
"gap-xsmall": "_gap-xsmall_1audv_69",
|
|
26
|
+
"gap-small": "_gap-small_1audv_72",
|
|
27
|
+
"gap-normal": "_gap-normal_1audv_75",
|
|
28
|
+
"gap-large": "_gap-large_1audv_78",
|
|
29
|
+
"gap-xlarge": "_gap-xlarge_1audv_81"
|
|
30
|
+
};
|
|
31
|
+
function A(l, s) {
|
|
32
|
+
const {
|
|
33
|
+
fullWidth: _ = !1,
|
|
34
|
+
fullHeight: o = !1,
|
|
35
|
+
vertical: t = !1,
|
|
36
|
+
centered: a = !1,
|
|
37
|
+
repell: i = !1,
|
|
38
|
+
stretch: d = !1,
|
|
39
|
+
wrap: c = !1,
|
|
40
|
+
alignToEnd: u = !1,
|
|
41
|
+
alignToEndAxis: p = !1,
|
|
42
|
+
spaceBetween: v = !1,
|
|
43
|
+
reverseOrder: g = !1,
|
|
44
|
+
gap: x = "normal",
|
|
45
|
+
children: f,
|
|
46
|
+
className: h
|
|
47
|
+
} = l, m = b(e.root, h, e[`gap-${x}`], {
|
|
48
|
+
[e["full-width"]]: _,
|
|
49
|
+
[e["full-height"]]: o,
|
|
50
|
+
[e.centered]: a === !0,
|
|
51
|
+
[e["centered-axis"]]: a === "axis",
|
|
52
|
+
[e["centered-cross-axis"]]: a === "cross-axis",
|
|
53
|
+
[e["baseline-axis"]]: a === "baseline-axis",
|
|
54
|
+
[e["baseline-cross-axis"]]: a === "baseline-cross-axis",
|
|
55
|
+
[e.vertical]: t,
|
|
56
|
+
[e.horizontal]: !t,
|
|
57
|
+
[e.repell]: i,
|
|
58
|
+
[e.stretch]: d,
|
|
59
|
+
[e.wrap]: c,
|
|
60
|
+
[e["align-to-end"]]: u,
|
|
61
|
+
[e["align-to-end-axis"]]: p,
|
|
62
|
+
[e["space-between"]]: v,
|
|
63
|
+
[e["reverse-order"]]: g
|
|
64
|
+
});
|
|
65
|
+
return /* @__PURE__ */ r("div", { ref: s, className: m, children: f });
|
|
66
|
+
}
|
|
67
|
+
const B = w.forwardRef(A), n = B;
|
|
68
|
+
n.Restricted = function({
|
|
69
|
+
children: s
|
|
70
|
+
}) {
|
|
71
|
+
return /* @__PURE__ */ r(n, { children: /* @__PURE__ */ r(R, { children: s }) });
|
|
72
|
+
};
|
|
73
|
+
export {
|
|
74
|
+
n as Flex
|
|
75
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface FlexRestricterProps {
|
|
4
|
+
vertical?: boolean;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Useful when you have some flex layout and need to restrict something within to the limits of layout itself
|
|
9
|
+
*
|
|
10
|
+
* To allow scrollable strictly within flex layout, for example
|
|
11
|
+
*/
|
|
12
|
+
export declare const FlexRestricter: React.ForwardRefExoticComponent<FlexRestricterProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import l from "react";
|
|
3
|
+
import { clsx as s } from "../../../utils/clsx.js";
|
|
4
|
+
import '../../../assets/FlexRestricter.css';const n = "_root_1jvko_1", _ = "_vertical_1jvko_4", v = "_horizontal_1jvko_7", o = {
|
|
5
|
+
root: n,
|
|
6
|
+
vertical: _,
|
|
7
|
+
horizontal: v
|
|
8
|
+
}, d = l.forwardRef(function(r, e) {
|
|
9
|
+
const {
|
|
10
|
+
vertical: t = !1,
|
|
11
|
+
children: c
|
|
12
|
+
} = r, a = s(o.root, {
|
|
13
|
+
[o.vertical]: t,
|
|
14
|
+
[o.horizontal]: !t
|
|
15
|
+
});
|
|
16
|
+
return /* @__PURE__ */ i("div", { ref: e, className: a, children: c });
|
|
17
|
+
});
|
|
18
|
+
export {
|
|
19
|
+
d as FlexRestricter
|
|
20
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface PadProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
/**
|
|
7
|
+
* 'normal' by default
|
|
8
|
+
*/
|
|
9
|
+
size?: 'none' | 'small' | 'normal' | 'large' | 'xlarge';
|
|
10
|
+
top?: boolean;
|
|
11
|
+
left?: boolean;
|
|
12
|
+
right?: boolean;
|
|
13
|
+
bottom?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function Pad(props: PadProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as q } from "../../../utils/clsx.js";
|
|
3
|
+
import '../../../assets/Pad.css';const y = "_root_166qt_1", o = {
|
|
4
|
+
root: y,
|
|
5
|
+
"offset-none": "_offset-none_166qt_1",
|
|
6
|
+
"offset-thin": "_offset-thin_166qt_4",
|
|
7
|
+
"offset-xsmall": "_offset-xsmall_166qt_7",
|
|
8
|
+
"offset-small": "_offset-small_166qt_10",
|
|
9
|
+
"offset-normal": "_offset-normal_166qt_13",
|
|
10
|
+
"offset-large": "_offset-large_166qt_16",
|
|
11
|
+
"offset-xlarge": "_offset-xlarge_166qt_19",
|
|
12
|
+
"only-top": "_only-top_166qt_22",
|
|
13
|
+
"only-left": "_only-left_166qt_25",
|
|
14
|
+
"only-right": "_only-right_166qt_28",
|
|
15
|
+
"only-bottom": "_only-bottom_166qt_31"
|
|
16
|
+
};
|
|
17
|
+
function h(_) {
|
|
18
|
+
const {
|
|
19
|
+
top: f = !1,
|
|
20
|
+
left: l = !1,
|
|
21
|
+
right: s = !1,
|
|
22
|
+
bottom: e = !1,
|
|
23
|
+
size: n = "normal",
|
|
24
|
+
children: r,
|
|
25
|
+
className: a
|
|
26
|
+
} = _, t = !(f || l || s || e), m = q(o.root, a, o[`offset-${n}`], {
|
|
27
|
+
[o["only-top"]]: t || f,
|
|
28
|
+
[o["only-left"]]: t || l,
|
|
29
|
+
[o["only-right"]]: t || s,
|
|
30
|
+
[o["only-bottom"]]: t || e
|
|
31
|
+
});
|
|
32
|
+
return /* @__PURE__ */ i("div", { className: m, children: r });
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
h as Pad
|
|
36
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsxs as c, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as n } from "../../../utils/clsx.js";
|
|
3
|
+
import '../../../assets/Page.css';const d = "_root_18k7e_1", _ = "_loader_18k7e_8", m = "_wtf_18k7e_1", o = {
|
|
4
|
+
root: d,
|
|
5
|
+
loader: _,
|
|
6
|
+
wtf: m
|
|
7
|
+
};
|
|
8
|
+
function w(s) {
|
|
9
|
+
const {
|
|
10
|
+
children: r,
|
|
11
|
+
className: t,
|
|
12
|
+
showLoader: e = !1
|
|
13
|
+
} = s, a = n(o.root, t);
|
|
14
|
+
return /* @__PURE__ */ c("div", { className: a, children: [
|
|
15
|
+
r,
|
|
16
|
+
e && /* @__PURE__ */ l("div", { className: o.loader })
|
|
17
|
+
] });
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
w as Page
|
|
21
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
interface RailProps {
|
|
4
|
+
axis: 'x' | 'y';
|
|
5
|
+
pos: number;
|
|
6
|
+
rootRef: React.RefObject<HTMLDivElement>;
|
|
7
|
+
size: number;
|
|
8
|
+
scrollSize: number;
|
|
9
|
+
minThumbSize: number;
|
|
10
|
+
setRootActive(active: boolean): void;
|
|
11
|
+
}
|
|
12
|
+
export declare function Rail(props: RailProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import "../../Interactive/Interactive.js";
|
|
4
|
+
import "../../../utils/clsx.js";
|
|
5
|
+
import "../../../hooks-Bv1kQUpO.js";
|
|
6
|
+
import "../../../math-i2ceybzU.js";
|
|
7
|
+
import { R as e } from "../../../Rail-DoYzqKk4.js";
|
|
8
|
+
export {
|
|
9
|
+
e as Rail
|
|
10
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ScrollableProps {
|
|
4
|
+
minThumbSize?: number;
|
|
5
|
+
className?: string;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
onScroll?: (event: WheelEvent | React.UIEvent<HTMLDivElement, UIEvent>) => void;
|
|
8
|
+
scrollerRef?: React.Ref<HTMLDivElement>;
|
|
9
|
+
/**
|
|
10
|
+
* If true, will repurpose wheel events for horizontal scroll instead
|
|
11
|
+
*/
|
|
12
|
+
verticalAsHorizontal?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const Scrollable: React.ForwardRefExoticComponent<ScrollableProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsxs as j, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import r from "react";
|
|
3
|
+
import { useContextualStyle as W } from "../../Style/Style.js";
|
|
4
|
+
import { clsx as b } from "../../../utils/clsx.js";
|
|
5
|
+
import k from "../../../utils/mergeRefs.js";
|
|
6
|
+
import { s as o, R as w } from "../../../Rail-DoYzqKk4.js";
|
|
7
|
+
const N = {
|
|
8
|
+
size: 0,
|
|
9
|
+
scrollPos: 0,
|
|
10
|
+
scrollSize: 0
|
|
11
|
+
}, K = r.forwardRef(function(f, P) {
|
|
12
|
+
const {
|
|
13
|
+
children: y,
|
|
14
|
+
className: A,
|
|
15
|
+
onScroll: i,
|
|
16
|
+
minThumbSize: S = 20,
|
|
17
|
+
verticalAsHorizontal: a = !1
|
|
18
|
+
} = f, e = r.useRef(null), u = r.useRef(null), [L, m] = r.useState(!1), [l, E] = r.useState(N), [T, g] = r.useState(0), [c, C] = r.useState(N), [I, X] = r.useState(0), Y = b(o.root, A, {
|
|
19
|
+
[o.active]: L
|
|
20
|
+
});
|
|
21
|
+
r.useLayoutEffect(() => {
|
|
22
|
+
if (!u.current)
|
|
23
|
+
throw new Error("No scrollable content ref");
|
|
24
|
+
const s = new ResizeObserver(() => {
|
|
25
|
+
var t, d, h, v, p, x;
|
|
26
|
+
C({
|
|
27
|
+
size: ((t = e.current) == null ? void 0 : t.clientHeight) || 0,
|
|
28
|
+
scrollPos: ((d = e.current) == null ? void 0 : d.scrollTop) || 0,
|
|
29
|
+
scrollSize: ((h = e.current) == null ? void 0 : h.scrollHeight) || 0
|
|
30
|
+
}), E({
|
|
31
|
+
size: ((v = e.current) == null ? void 0 : v.clientWidth) || 0,
|
|
32
|
+
scrollPos: ((p = e.current) == null ? void 0 : p.scrollLeft) || 0,
|
|
33
|
+
scrollSize: ((x = e.current) == null ? void 0 : x.scrollWidth) || 0
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
return s.observe(u.current), () => s.disconnect();
|
|
37
|
+
}, []);
|
|
38
|
+
const _ = r.useCallback(
|
|
39
|
+
(s) => {
|
|
40
|
+
e.current && (i == null || i(s), X(e.current.scrollTop), g(e.current.scrollLeft));
|
|
41
|
+
},
|
|
42
|
+
[a]
|
|
43
|
+
);
|
|
44
|
+
r.useEffect(() => {
|
|
45
|
+
if (!a || !e.current)
|
|
46
|
+
return;
|
|
47
|
+
const s = (t) => {
|
|
48
|
+
t.preventDefault(), t.stopPropagation(), e.current && (e.current.scrollLeft += t.deltaY);
|
|
49
|
+
};
|
|
50
|
+
return e.current.addEventListener("wheel", s), () => {
|
|
51
|
+
var t;
|
|
52
|
+
return (t = e.current) == null ? void 0 : t.removeEventListener("wheel", s);
|
|
53
|
+
};
|
|
54
|
+
}, [a]);
|
|
55
|
+
const z = l.scrollSize - l.size > 1, R = c.scrollSize - c.size > 1, H = b(o.scroller, {
|
|
56
|
+
[o["no-x-scroll"]]: !z,
|
|
57
|
+
[o["no-y-scroll"]]: !R
|
|
58
|
+
});
|
|
59
|
+
return /* @__PURE__ */ j("div", { ref: P, style: W(), className: Y, children: [
|
|
60
|
+
/* @__PURE__ */ n("div", { ref: k(e, f.scrollerRef), className: H, onScroll: _, children: /* @__PURE__ */ n("div", { ref: u, className: o.content, children: y }) }),
|
|
61
|
+
R && /* @__PURE__ */ n(
|
|
62
|
+
w,
|
|
63
|
+
{
|
|
64
|
+
rootRef: e,
|
|
65
|
+
axis: "y",
|
|
66
|
+
size: c.size,
|
|
67
|
+
pos: I,
|
|
68
|
+
scrollSize: c.scrollSize,
|
|
69
|
+
setRootActive: m,
|
|
70
|
+
minThumbSize: S
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
z && /* @__PURE__ */ n(
|
|
74
|
+
w,
|
|
75
|
+
{
|
|
76
|
+
rootRef: e,
|
|
77
|
+
axis: "x",
|
|
78
|
+
size: l.size,
|
|
79
|
+
pos: T,
|
|
80
|
+
scrollSize: l.scrollSize,
|
|
81
|
+
setRootActive: m,
|
|
82
|
+
minThumbSize: S
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
] });
|
|
86
|
+
});
|
|
87
|
+
export {
|
|
88
|
+
K as Scrollable
|
|
89
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface VirtualScrollableProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
itemCount: number;
|
|
6
|
+
itemHeight: number;
|
|
7
|
+
renderItem(index: number): React.ReactNode;
|
|
8
|
+
onScrollUpdate?(offset: number): void;
|
|
9
|
+
initialScrollOffset?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function VirtualScrollable(props: VirtualScrollableProps): import("react/jsx-runtime").JSX.Element;
|