@cfx-dev/ui-components 4.2.20 → 4.2.22
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/dist/assets/css/Badge.css +1 -1
- package/dist/assets/css/Link.css +1 -1
- package/dist/assets/general/global.css +1 -1
- package/dist/components/Accordion/Accordion.d.ts +1 -7
- package/dist/components/Accordion/Accordion.js +1 -1
- package/dist/components/Accordion/AccordionShowcase.js +1 -1
- package/dist/components/Accordion/index.d.ts +1 -0
- package/dist/components/Avatar/AvatarShowcase.js +1 -1
- package/dist/components/BackdropPortal/BackdropPortal.d.ts +2 -0
- package/dist/components/BackdropPortal/BackdropPortal.js +7 -5
- package/dist/components/BackdropPortal/index.d.ts +2 -0
- package/dist/components/BackdropPortal/index.js +5 -0
- package/dist/components/Badge/Badge.d.ts +9 -2
- package/dist/components/Badge/Badge.js +52 -25
- package/dist/components/Badge/BadgeShowcase.js +1 -1
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/BurgerMenu/BurgerMenu.js +1 -1
- package/dist/components/BurgerMenu/BurgerMenuShowcase.js +1 -1
- package/dist/components/Button/ButtonShowcase.js +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/ClipboardButton/ClipboardButton.d.ts +3 -3
- package/dist/components/ClipboardButton/ClipboardButton.js +10 -9
- package/dist/components/ControlBox/ControlBox.d.ts +2 -0
- package/dist/components/ControlBox/ControlBox.js +10 -9
- package/dist/components/ControlBox/index.d.ts +2 -0
- package/dist/components/ControlBox/index.js +4 -0
- package/dist/components/CountryFlag/CountryFlag.d.ts +2 -0
- package/dist/components/CountryFlag/CountryFlag.js +14 -13
- package/dist/components/CountryFlag/index.d.ts +2 -0
- package/dist/components/CountryFlag/index.js +4 -0
- package/dist/components/Decorate/Decorate.d.ts +2 -0
- package/dist/components/Decorate/Decorate.js +15 -14
- package/dist/components/Decorate/index.d.ts +2 -0
- package/dist/components/Decorate/index.js +4 -0
- package/dist/components/DropdownSelect/DropdownSelect.d.ts +1 -1
- package/dist/components/DropdownSelect/DropdownSelect.js +801 -1039
- package/dist/components/DropdownSelect/DropdownSelectShowcase.js +1 -1
- package/dist/components/DropdownSelect/index.d.ts +1 -0
- package/dist/components/Flyout/Flyout.d.ts +2 -1
- package/dist/components/Flyout/index.d.ts +2 -0
- package/dist/components/Flyout/index.js +5 -0
- package/dist/components/Icon/Icon.d.ts +1 -1
- package/dist/components/Icon/Icon.js +1 -1
- package/dist/components/IconBig/IconBig.js +1 -1
- package/dist/components/IconButton/IconButton.d.ts +2 -3
- package/dist/components/IconButton/index.d.ts +1 -1
- package/dist/components/Indicator/index.d.ts +2 -0
- package/dist/components/Indicator/index.js +4 -0
- package/dist/components/InfoPanel/InfoPanelShowcase.js +1 -1
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Input/Input.js +6 -6
- package/dist/components/Input/InputShowcase.js +1 -1
- package/dist/components/Input/RichInput.d.ts +1 -1
- package/dist/components/Input/RichInput.js +4 -4
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/InputDropzone/index.d.ts +3 -3
- package/dist/components/InputDropzone/index.js +3 -3
- package/dist/components/Interactive/index.d.ts +2 -0
- package/dist/components/Interactive/index.js +4 -0
- package/dist/components/Island/Island.js +4 -4
- package/dist/components/Island/index.d.ts +2 -0
- package/dist/components/Island/index.js +5 -0
- package/dist/components/Layout/Box/Box.d.ts +2 -1
- package/dist/components/Layout/Box/Box.js +3 -2
- package/dist/components/Layout/Box/index.d.ts +2 -0
- package/dist/components/Layout/Box/index.js +5 -0
- package/dist/components/Layout/Center/index.d.ts +2 -0
- package/dist/components/Layout/Center/index.js +4 -0
- package/dist/components/Layout/Flex/Flex.d.ts +4 -4
- package/dist/components/Layout/Flex/Flex.js +1 -1
- package/dist/components/Layout/Flex/Flex.types.d.ts +7 -0
- package/dist/components/Layout/Flex/Flex.types.js +6 -5
- package/dist/components/Layout/Flex/index.d.ts +6 -0
- package/dist/components/Layout/Flex/index.js +12 -0
- package/dist/components/Layout/Pad/index.d.ts +2 -0
- package/dist/components/Layout/Pad/index.js +4 -0
- package/dist/components/Layout/Page/index.d.ts +2 -0
- package/dist/components/Layout/Page/index.js +4 -0
- package/dist/components/Layout/Scrollable/ScrollableShowcase.js +1 -1
- package/dist/components/Link/ButtonLink.js +23 -18
- package/dist/components/Link/Link.d.ts +3 -1
- package/dist/components/Link/Link.js +48 -30
- package/dist/components/Link/LinkShowcase.js +46 -41
- package/dist/components/Link/index.d.ts +1 -1
- package/dist/components/Link/index.js +6 -5
- package/dist/components/Loaf/index.d.ts +2 -0
- package/dist/components/Loaf/index.js +4 -0
- package/dist/components/Logos/LogosShowcase.js +1 -1
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/NavList/index.d.ts +2 -0
- package/dist/components/NavList/index.js +4 -0
- package/dist/components/Overlay/index.d.ts +2 -0
- package/dist/components/Overlay/index.js +5 -0
- package/dist/components/PremiumBadge/index.d.ts +2 -0
- package/dist/components/PremiumBadge/index.js +4 -0
- package/dist/components/Prose/Prose.d.ts +1 -2
- package/dist/components/Prose/index.d.ts +2 -0
- package/dist/components/Prose/index.js +4 -0
- package/dist/components/Radio/index.d.ts +2 -0
- package/dist/components/Radio/index.js +4 -0
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Select/Select.js +2 -2
- package/dist/components/Select/SelectShowcase.js +1 -1
- package/dist/components/Separator/Separator.d.ts +1 -1
- package/dist/components/Separator/Separator.js +1 -1
- package/dist/components/Separator/index.d.ts +2 -0
- package/dist/components/Separator/index.js +4 -0
- package/dist/components/Shroud/Shroud.js +6 -6
- package/dist/components/Shroud/index.d.ts +2 -0
- package/dist/components/Shroud/index.js +4 -0
- package/dist/components/Skeleton/Skeleton.d.ts +2 -2
- package/dist/components/Skeleton/Skeleton.js +1 -1
- package/dist/components/Skeleton/SkeletonShowcase.js +1 -1
- package/dist/components/Skeleton/index.d.ts +1 -0
- package/dist/components/Slider/Slider.js +294 -374
- package/dist/components/Slider/SliderShowcase.js +1 -1
- package/dist/components/Spacer/Spacer.d.ts +1 -1
- package/dist/components/Spacer/index.d.ts +2 -0
- package/dist/components/Spacer/index.js +4 -0
- package/dist/components/Style/index.d.ts +2 -0
- package/dist/components/Style/index.js +5 -0
- package/dist/components/Table/Table.d.ts +13 -4
- package/dist/components/Table/Table.js +3 -2
- package/dist/components/Table/TableShowcase.js +1 -1
- package/dist/components/Table/index.d.ts +2 -2
- package/dist/components/Table/index.js +5 -2
- package/dist/components/Tabular/Tabular.d.ts +1 -1
- package/dist/components/Tabular/Tabular.js +1 -1
- package/dist/components/Tabular/TabularShowcase.js +1 -1
- package/dist/components/Text/Text.js +13 -12
- package/dist/components/Text/Text.types.d.ts +3 -2
- package/dist/components/Text/TextShowcase.js +12 -15
- package/dist/components/Text/index.d.ts +2 -2
- package/dist/components/Text/index.js +9 -8
- package/dist/components/Textarea/index.d.ts +2 -0
- package/dist/components/Textarea/index.js +4 -0
- package/dist/components/Title/Title.d.ts +5 -4
- package/dist/components/Title/Title.js +4 -2
- package/dist/components/Title/TitleShowcase.js +1 -1
- package/dist/components/Title/index.d.ts +2 -0
- package/dist/components/Title/index.js +7 -0
- package/dist/components/ToggleGroup/ToggleGroupShowcase.js +1 -1
- package/dist/index-AweK2ufS.js +171 -0
- package/dist/{index-DBus3GoO.js → index-Bz27DCHt.js} +2 -2
- package/dist/main.d.ts +93 -69
- package/dist/main.js +217 -191
- package/dist/styles-scss/global.scss +2 -2
- package/dist/styles-scss/tokens.scss +0 -4
- package/dist/utils/color.d.ts +3 -1
- package/dist/utils/enum.d.ts +1 -0
- package/dist/utils/enum.js +6 -0
- package/dist/utils/ui/index.d.ts +3 -0
- package/dist/utils/ui/index.js +11 -0
- package/dist/{components → utils/ui}/ui.d.ts +2 -68
- package/dist/utils/ui/ui.js +68 -0
- package/dist/utils/ui/ui.types.d.ts +86 -0
- package/dist/utils/ui/ui.types.js +9 -0
- package/package.json +1 -1
- package/dist/components/ui.js +0 -73
- package/dist/index-CjTSD6zB.js +0 -161
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export declare enum ColorEnum {
|
|
2
|
+
accent = "accent",
|
|
3
|
+
primary = "primary",
|
|
4
|
+
secondary = "secondary",
|
|
5
|
+
tertiary = "tertiary",
|
|
6
|
+
green = "green",
|
|
7
|
+
yellow = "yellow",
|
|
8
|
+
red = "red",
|
|
9
|
+
argentum = "argentum",
|
|
10
|
+
aurum = "aurum",
|
|
11
|
+
platinum = "platinum",
|
|
12
|
+
bg = "bg",
|
|
13
|
+
'bg-light' = "bg-light",
|
|
14
|
+
'bg-dark' = "bg-dark",
|
|
15
|
+
'bg-dark-grey' = "bg-dark-grey",
|
|
16
|
+
'bg-black' = "bg-black"
|
|
17
|
+
}
|
|
18
|
+
export type ColorType = keyof typeof ColorEnum;
|
|
19
|
+
export declare enum TextSizeEnum {
|
|
20
|
+
xxsmall = "xxsmall",
|
|
21
|
+
xsmall = "xsmall",
|
|
22
|
+
small = "small",
|
|
23
|
+
normal = "normal",
|
|
24
|
+
medium = "medium",
|
|
25
|
+
large = "large",
|
|
26
|
+
xlarge = "xlarge",
|
|
27
|
+
xxlarge = "xxlarge",
|
|
28
|
+
xxxlarge = "xxxlarge"
|
|
29
|
+
}
|
|
30
|
+
export type TextSize = keyof typeof TextSizeEnum;
|
|
31
|
+
export declare enum BorderRadiusEnum {
|
|
32
|
+
none = "none",
|
|
33
|
+
xxsmall = "xxsmall",
|
|
34
|
+
xsmall = "xsmall",
|
|
35
|
+
small = "small",
|
|
36
|
+
normal = "normal",
|
|
37
|
+
pill = "pill"
|
|
38
|
+
}
|
|
39
|
+
export type BorderRadiusType = keyof typeof BorderRadiusEnum;
|
|
40
|
+
export declare enum ZIndexEnum {
|
|
41
|
+
zero = "zero",
|
|
42
|
+
first = "first",
|
|
43
|
+
second = "second",
|
|
44
|
+
max = "max"
|
|
45
|
+
}
|
|
46
|
+
export type ZIndexType = keyof typeof ZIndexEnum;
|
|
47
|
+
export declare enum OffsetEnum {
|
|
48
|
+
none = "none",
|
|
49
|
+
hairthin = "hairthin",
|
|
50
|
+
thin = "thin",
|
|
51
|
+
xxsmall = "xxsmall",
|
|
52
|
+
xsmall = "xsmall",
|
|
53
|
+
small = "small",
|
|
54
|
+
normal = "normal",
|
|
55
|
+
medium = "medium",
|
|
56
|
+
large = "large",
|
|
57
|
+
xlarge = "xlarge",
|
|
58
|
+
safezone = "safezone"
|
|
59
|
+
}
|
|
60
|
+
export type OffsetType = keyof typeof OffsetEnum;
|
|
61
|
+
export declare enum MediaQueryEnum {
|
|
62
|
+
initial = "initial",
|
|
63
|
+
small = "small",
|
|
64
|
+
'small-medium' = "small-medium",
|
|
65
|
+
medium = "medium",
|
|
66
|
+
'medium-large' = "medium-large",
|
|
67
|
+
large = "large",
|
|
68
|
+
xlarge = "xlarge"
|
|
69
|
+
}
|
|
70
|
+
export type MediaQueryType = keyof typeof MediaQueryEnum;
|
|
71
|
+
export type ResponsiveValueType<T = string | number> = T | {
|
|
72
|
+
[key in MediaQueryType]?: T;
|
|
73
|
+
};
|
|
74
|
+
export type ResponsiveOffsetType = ResponsiveValueType<OffsetType | number>;
|
|
75
|
+
export interface MPProps {
|
|
76
|
+
m?: ResponsiveOffsetType;
|
|
77
|
+
mt?: ResponsiveOffsetType;
|
|
78
|
+
mr?: ResponsiveOffsetType;
|
|
79
|
+
mb?: ResponsiveOffsetType;
|
|
80
|
+
ml?: ResponsiveOffsetType;
|
|
81
|
+
p?: ResponsiveOffsetType;
|
|
82
|
+
pt?: ResponsiveOffsetType;
|
|
83
|
+
pr?: ResponsiveOffsetType;
|
|
84
|
+
pb?: ResponsiveOffsetType;
|
|
85
|
+
pl?: ResponsiveOffsetType;
|
|
86
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var a = /* @__PURE__ */ ((l) => (l.accent = "accent", l.primary = "primary", l.secondary = "secondary", l.tertiary = "tertiary", l.green = "green", l.yellow = "yellow", l.red = "red", l.argentum = "argentum", l.aurum = "aurum", l.platinum = "platinum", l.bg = "bg", l["bg-light"] = "bg-light", l["bg-dark"] = "bg-dark", l["bg-dark-grey"] = "bg-dark-grey", l["bg-black"] = "bg-black", l))(a || {}), r = /* @__PURE__ */ ((l) => (l.xxsmall = "xxsmall", l.xsmall = "xsmall", l.small = "small", l.normal = "normal", l.medium = "medium", l.large = "large", l.xlarge = "xlarge", l.xxlarge = "xxlarge", l.xxxlarge = "xxxlarge", l))(r || {}), g = /* @__PURE__ */ ((l) => (l.none = "none", l.xxsmall = "xxsmall", l.xsmall = "xsmall", l.small = "small", l.normal = "normal", l.pill = "pill", l))(g || {}), x = /* @__PURE__ */ ((l) => (l.zero = "zero", l.first = "first", l.second = "second", l.max = "max", l))(x || {}), e = /* @__PURE__ */ ((l) => (l.none = "none", l.hairthin = "hairthin", l.thin = "thin", l.xxsmall = "xxsmall", l.xsmall = "xsmall", l.small = "small", l.normal = "normal", l.medium = "medium", l.large = "large", l.xlarge = "xlarge", l.safezone = "safezone", l))(e || {}), i = /* @__PURE__ */ ((l) => (l.initial = "initial", l.small = "small", l["small-medium"] = "small-medium", l.medium = "medium", l["medium-large"] = "medium-large", l.large = "large", l.xlarge = "xlarge", l))(i || {});
|
|
2
|
+
export {
|
|
3
|
+
g as BorderRadiusEnum,
|
|
4
|
+
a as ColorEnum,
|
|
5
|
+
i as MediaQueryEnum,
|
|
6
|
+
e as OffsetEnum,
|
|
7
|
+
r as TextSizeEnum,
|
|
8
|
+
x as ZIndexEnum
|
|
9
|
+
};
|
package/package.json
CHANGED
package/dist/components/ui.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { clsx as $ } from "../utils/clsx.js";
|
|
2
|
-
var j = /* @__PURE__ */ ((r) => (r.xxsmall = "xxsmall", r.xsmall = "xsmall", r.small = "small", r.normal = "normal", r.medium = "medium", r.large = "large", r.xlarge = "xlarge", r.xxlarge = "xxlarge", r.xxxlarge = "xxxlarge", r))(j || {}), R = /* @__PURE__ */ ((r) => (r.none = "none", r.xxsmall = "xxsmall", r.xsmall = "xsmall", r.small = "small", r.normal = "normal", r.pill = "pill", r))(R || {}), u = /* @__PURE__ */ ((r) => (r.zero = "zero", r.first = "first", r.second = "second", r.max = "max", r))(u || {}), F = /* @__PURE__ */ ((r) => (r.none = "none", r.hairthin = "hairthin", r.thin = "thin", r.xxsmall = "xxsmall", r.xsmall = "xsmall", r.small = "small", r.normal = "normal", r.medium = "medium", r.large = "large", r.xlarge = "xlarge", r.safezone = "safezone", r))(F || {}), P = /* @__PURE__ */ ((r) => (r.initial = "initial", r.small = "small", r["small-medium"] = "small-medium", r.medium = "medium", r["medium-large"] = "medium-large", r.large = "large", r.xlarge = "xlarge", r))(P || {}), p;
|
|
3
|
-
((r) => {
|
|
4
|
-
function s(e = 1) {
|
|
5
|
-
return `calc(var(--quant) * ${e})`;
|
|
6
|
-
}
|
|
7
|
-
r.q = s;
|
|
8
|
-
function f(e) {
|
|
9
|
-
return `var(--offset-${e})`;
|
|
10
|
-
}
|
|
11
|
-
r.offset = f;
|
|
12
|
-
function h(e = "normal") {
|
|
13
|
-
return `var(--font-size-${e})`;
|
|
14
|
-
}
|
|
15
|
-
r.fontSize = h;
|
|
16
|
-
function b(e = "first") {
|
|
17
|
-
return `var(--zindex-${e})`;
|
|
18
|
-
}
|
|
19
|
-
r.zindex = b;
|
|
20
|
-
function d(e = "normal") {
|
|
21
|
-
return `var(--line-height-${e})`;
|
|
22
|
-
}
|
|
23
|
-
r.lineHeight = d;
|
|
24
|
-
function v(e = "normal") {
|
|
25
|
-
return `var(--border-radius-${e})`;
|
|
26
|
-
}
|
|
27
|
-
r.borderRadius = v;
|
|
28
|
-
function y(e, l, n = 1) {
|
|
29
|
-
let t = l;
|
|
30
|
-
return t === "pure" && (t = ""), typeof t == "number" && (t = `${t}`), `rgba(var(--color-${e}${t ? `-${t}` : ""}), ${n})`;
|
|
31
|
-
}
|
|
32
|
-
r.color = y, ((e) => {
|
|
33
|
-
e.fullWidth = "util-full-width", e.fullHeight = "util-full-height", e.flexGrow = "util-flex-grow", e.flexNoShrink = "util-flex-no-shrink", e.userSelectableText = "util-text-selectable", e.zIndex9000 = "util-z-index-9000";
|
|
34
|
-
})(r.cls || (r.cls = {})), r.pc = (e) => `${e}%`, r.px = (e) => `${e}px`, r.ch = (e) => `${e}ch`, r.em = (e) => `${e}em`, r.rem = (e) => `${e}rem`, r.vh = (e) => `${e}vh`, r.vw = (e) => `${e}vw`, r.url = (e) => `url(${e})`;
|
|
35
|
-
function a(e) {
|
|
36
|
-
return e == null ? "" : typeof e == "number" ? s(e) : e.toString();
|
|
37
|
-
}
|
|
38
|
-
r.defaultResponsiveValueFormatter = a;
|
|
39
|
-
function x(e, l, n = a) {
|
|
40
|
-
return l == null ? {} : typeof l == "object" && !Array.isArray(l) ? Object.entries(l).reduce((t, [o, i]) => (t[`--${e}-${o}`] = n(i), t), {}) : {
|
|
41
|
-
[`--${e}-initial`]: n(l)
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
r.getResponsiveStyles = x;
|
|
45
|
-
function g(e, l) {
|
|
46
|
-
return l == null ? "" : typeof l == "object" && !Array.isArray(l) ? $(Object.keys(l).map((n) => `ui-${e}-${n}`)) : `ui-${e}-initial`;
|
|
47
|
-
}
|
|
48
|
-
r.getResponsiveClassnames = g;
|
|
49
|
-
function A(e, l, n = a) {
|
|
50
|
-
return l == null ? [] : typeof l == "object" && !Array.isArray(l) ? Object.entries(l).reduce((t, [o, i]) => (t.push(`${e}-${o}-${n(i)}`), t), []) : [`${e}-initial-${n(l)}`];
|
|
51
|
-
}
|
|
52
|
-
r.getResponsiveFlatClassnames = A;
|
|
53
|
-
function m(e) {
|
|
54
|
-
return typeof e == "number" ? s(e) : f(e);
|
|
55
|
-
}
|
|
56
|
-
r.offsetResponsiveValueFormatter = m, r.getOffsetStyles = (e, l) => x(e, l, m);
|
|
57
|
-
function c(e, l) {
|
|
58
|
-
return Object.entries(e).reduce((n, [t, o]) => (Object.assign(n, l(t, o)), n), {});
|
|
59
|
-
}
|
|
60
|
-
r.callAllMPProps = c, r.getAllMPStyles = (e) => c(e, r.getOffsetStyles), r.getAllMPClassnames = (e) => $(
|
|
61
|
-
Object.entries(e).map(
|
|
62
|
-
([l, n]) => g(l, n)
|
|
63
|
-
)
|
|
64
|
-
);
|
|
65
|
-
})(p || (p = {}));
|
|
66
|
-
export {
|
|
67
|
-
R as BorderRadiusEnum,
|
|
68
|
-
P as MediaQueryEnum,
|
|
69
|
-
F as OffsetEnum,
|
|
70
|
-
j as TextSizeEnum,
|
|
71
|
-
u as ZIndexEnum,
|
|
72
|
-
p as ui
|
|
73
|
-
};
|
package/dist/index-CjTSD6zB.js
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import * as s from "react";
|
|
2
|
-
import y from "react";
|
|
3
|
-
import { jsx as h, Fragment as O } from "react/jsx-runtime";
|
|
4
|
-
function w(e, t = []) {
|
|
5
|
-
let n = [];
|
|
6
|
-
function r(c, l) {
|
|
7
|
-
const i = s.createContext(l), a = n.length;
|
|
8
|
-
n = [...n, l];
|
|
9
|
-
const S = (R) => {
|
|
10
|
-
var d;
|
|
11
|
-
const { scope: C, children: f, ...u } = R, p = ((d = C == null ? void 0 : C[e]) == null ? void 0 : d[a]) || i, m = s.useMemo(() => u, Object.values(u));
|
|
12
|
-
return /* @__PURE__ */ h(p.Provider, { value: m, children: f });
|
|
13
|
-
};
|
|
14
|
-
S.displayName = c + "Provider";
|
|
15
|
-
function v(R, C) {
|
|
16
|
-
var p;
|
|
17
|
-
const f = ((p = C == null ? void 0 : C[e]) == null ? void 0 : p[a]) || i, u = s.useContext(f);
|
|
18
|
-
if (u) return u;
|
|
19
|
-
if (l !== void 0) return l;
|
|
20
|
-
throw new Error(`\`${R}\` must be used within \`${c}\``);
|
|
21
|
-
}
|
|
22
|
-
return [S, v];
|
|
23
|
-
}
|
|
24
|
-
const o = () => {
|
|
25
|
-
const c = n.map((l) => s.createContext(l));
|
|
26
|
-
return function(i) {
|
|
27
|
-
const a = (i == null ? void 0 : i[e]) || c;
|
|
28
|
-
return s.useMemo(
|
|
29
|
-
() => ({ [`__scope${e}`]: { ...i, [e]: a } }),
|
|
30
|
-
[i, a]
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
return o.scopeName = e, [r, b(o, ...t)];
|
|
35
|
-
}
|
|
36
|
-
function b(...e) {
|
|
37
|
-
const t = e[0];
|
|
38
|
-
if (e.length === 1) return t;
|
|
39
|
-
const n = () => {
|
|
40
|
-
const r = e.map((o) => ({
|
|
41
|
-
useScope: o(),
|
|
42
|
-
scopeName: o.scopeName
|
|
43
|
-
}));
|
|
44
|
-
return function(c) {
|
|
45
|
-
const l = r.reduce((i, { useScope: a, scopeName: S }) => {
|
|
46
|
-
const R = a(c)[`__scope${S}`];
|
|
47
|
-
return { ...i, ...R };
|
|
48
|
-
}, {});
|
|
49
|
-
return s.useMemo(() => ({ [`__scope${t.scopeName}`]: l }), [l]);
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
return n.scopeName = t.scopeName, n;
|
|
53
|
-
}
|
|
54
|
-
function _(e, t) {
|
|
55
|
-
if (typeof e == "function")
|
|
56
|
-
return e(t);
|
|
57
|
-
e != null && (e.current = t);
|
|
58
|
-
}
|
|
59
|
-
function A(...e) {
|
|
60
|
-
return (t) => {
|
|
61
|
-
let n = !1;
|
|
62
|
-
const r = e.map((o) => {
|
|
63
|
-
const c = _(o, t);
|
|
64
|
-
return !n && typeof c == "function" && (n = !0), c;
|
|
65
|
-
});
|
|
66
|
-
if (n)
|
|
67
|
-
return () => {
|
|
68
|
-
for (let o = 0; o < r.length; o++) {
|
|
69
|
-
const c = r[o];
|
|
70
|
-
typeof c == "function" ? c() : _(e[o], null);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
function N(...e) {
|
|
76
|
-
return s.useCallback(A(...e), e);
|
|
77
|
-
}
|
|
78
|
-
var g = s.forwardRef((e, t) => {
|
|
79
|
-
const { children: n, ...r } = e, o = s.Children.toArray(n), c = o.find(V);
|
|
80
|
-
if (c) {
|
|
81
|
-
const l = c.props.children, i = o.map((a) => a === c ? s.Children.count(l) > 1 ? s.Children.only(null) : s.isValidElement(l) ? l.props.children : null : a);
|
|
82
|
-
return /* @__PURE__ */ h(M, { ...r, ref: t, children: s.isValidElement(l) ? s.cloneElement(l, void 0, i) : null });
|
|
83
|
-
}
|
|
84
|
-
return /* @__PURE__ */ h(M, { ...r, ref: t, children: n });
|
|
85
|
-
});
|
|
86
|
-
g.displayName = "Slot";
|
|
87
|
-
var M = s.forwardRef((e, t) => {
|
|
88
|
-
const { children: n, ...r } = e;
|
|
89
|
-
if (s.isValidElement(n)) {
|
|
90
|
-
const o = j(n);
|
|
91
|
-
return s.cloneElement(n, {
|
|
92
|
-
...$(r, n.props),
|
|
93
|
-
// @ts-ignore
|
|
94
|
-
ref: t ? A(t, o) : o
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
return s.Children.count(n) > 1 ? s.Children.only(null) : null;
|
|
98
|
-
});
|
|
99
|
-
M.displayName = "SlotClone";
|
|
100
|
-
var T = ({ children: e }) => /* @__PURE__ */ h(O, { children: e });
|
|
101
|
-
function V(e) {
|
|
102
|
-
return s.isValidElement(e) && e.type === T;
|
|
103
|
-
}
|
|
104
|
-
function $(e, t) {
|
|
105
|
-
const n = { ...t };
|
|
106
|
-
for (const r in t) {
|
|
107
|
-
const o = e[r], c = t[r];
|
|
108
|
-
/^on[A-Z]/.test(r) ? o && c ? n[r] = (...i) => {
|
|
109
|
-
c(...i), o(...i);
|
|
110
|
-
} : o && (n[r] = o) : r === "style" ? n[r] = { ...o, ...c } : r === "className" && (n[r] = [o, c].filter(Boolean).join(" "));
|
|
111
|
-
}
|
|
112
|
-
return { ...e, ...n };
|
|
113
|
-
}
|
|
114
|
-
function j(e) {
|
|
115
|
-
var r, o;
|
|
116
|
-
let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
117
|
-
return n ? e.ref : (t = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
118
|
-
}
|
|
119
|
-
function L(e) {
|
|
120
|
-
const t = e + "CollectionProvider", [n, r] = w(t), [o, c] = n(
|
|
121
|
-
t,
|
|
122
|
-
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
123
|
-
), l = (f) => {
|
|
124
|
-
const { scope: u, children: p } = f, m = y.useRef(null), d = y.useRef(/* @__PURE__ */ new Map()).current;
|
|
125
|
-
return /* @__PURE__ */ h(o, { scope: u, itemMap: d, collectionRef: m, children: p });
|
|
126
|
-
};
|
|
127
|
-
l.displayName = t;
|
|
128
|
-
const i = e + "CollectionSlot", a = y.forwardRef(
|
|
129
|
-
(f, u) => {
|
|
130
|
-
const { scope: p, children: m } = f, d = c(i, p), x = N(u, d.collectionRef);
|
|
131
|
-
return /* @__PURE__ */ h(g, { ref: x, children: m });
|
|
132
|
-
}
|
|
133
|
-
);
|
|
134
|
-
a.displayName = i;
|
|
135
|
-
const S = e + "CollectionItemSlot", v = "data-radix-collection-item", R = y.forwardRef(
|
|
136
|
-
(f, u) => {
|
|
137
|
-
const { scope: p, children: m, ...d } = f, x = y.useRef(null), P = N(u, x), E = c(S, p);
|
|
138
|
-
return y.useEffect(() => (E.itemMap.set(x, { ref: x, ...d }), () => void E.itemMap.delete(x))), /* @__PURE__ */ h(g, { [v]: "", ref: P, children: m });
|
|
139
|
-
}
|
|
140
|
-
);
|
|
141
|
-
R.displayName = S;
|
|
142
|
-
function C(f) {
|
|
143
|
-
const u = c(e + "CollectionConsumer", f);
|
|
144
|
-
return y.useCallback(() => {
|
|
145
|
-
const m = u.collectionRef.current;
|
|
146
|
-
if (!m) return [];
|
|
147
|
-
const d = Array.from(m.querySelectorAll(`[${v}]`));
|
|
148
|
-
return Array.from(u.itemMap.values()).sort(
|
|
149
|
-
(E, I) => d.indexOf(E.ref.current) - d.indexOf(I.ref.current)
|
|
150
|
-
);
|
|
151
|
-
}, [u.collectionRef, u.itemMap]);
|
|
152
|
-
}
|
|
153
|
-
return [
|
|
154
|
-
{ Provider: l, Slot: a, ItemSlot: R },
|
|
155
|
-
C,
|
|
156
|
-
r
|
|
157
|
-
];
|
|
158
|
-
}
|
|
159
|
-
export {
|
|
160
|
-
L as c
|
|
161
|
-
};
|