@alixpartners/ui-components 2.1.2 → 2.3.0
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/README.md +99 -99
- package/dist/DragAndDrop.utils-D3xTV9EK.js +30 -0
- package/dist/ToastProvider-D5LImZ-Q.js +1136 -0
- package/dist/assets/Dialog.css +1 -1
- package/dist/assets/NavBar.css +1 -1
- package/dist/assets/SplitButton.css +1 -1
- package/dist/assets/Tooltip.css +1 -1
- package/dist/components/Banner/Banner.test.js +1 -1
- package/dist/components/Button/Button.test.js +124 -3217
- package/dist/components/Checkbox/Checkbox.js +7 -6
- package/dist/components/Checkbox/Checkbox.test.js +47 -47
- package/dist/components/Creatable/Creatable.js +107 -108
- package/dist/components/Dialog/Dialog.d.ts +21 -7
- package/dist/components/Dialog/Dialog.js +296 -61
- package/dist/components/Dialog/Dialog.test.d.ts +1 -0
- package/dist/components/Dialog/Dialog.test.js +368 -0
- package/dist/components/DragAndDrop/DragAndDrop.d.ts +56 -1
- package/dist/components/DragAndDrop/DragAndDrop.js +144 -83
- package/dist/components/DragAndDrop/DragAndDrop.test.d.ts +1 -0
- package/dist/components/DragAndDrop/DragAndDrop.test.js +606 -0
- package/dist/components/DragAndDrop/DragAndDrop.utils.d.ts +30 -0
- package/dist/components/Dropdown/Dropdown.js +80 -81
- package/dist/components/FilePicker/FilePicker.test.js +1 -1
- package/dist/components/Ghost/Ghost.test.js +6 -6
- package/dist/components/Input/Input.test.js +2 -2
- package/dist/components/NavBar/NavBar.js +16 -16
- package/dist/components/Radio/Radio.js +1 -1
- package/dist/components/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/RadioGroup/RadioGroup.test.js +1 -1
- package/dist/components/Search/Search.test.js +1 -1
- package/dist/components/SplitButton/SplitButton.js +8 -9
- package/dist/components/SplitButton/SplitButton.test.js +1 -1
- package/dist/components/Tag/Tag.test.js +1 -1
- package/dist/components/TagsFields/TagsFields.js +3 -4
- package/dist/components/Textarea/Textarea.js +68 -70
- package/dist/components/Textarea/Textarea.test.js +2 -2
- package/dist/components/Toast/Toast.d.ts +5 -19
- package/dist/components/Toast/Toast.js +65 -62
- package/dist/components/Toast/Toast.test.js +47 -30
- package/dist/components/ToastProvider/ToastContext.d.ts +11 -0
- package/dist/components/ToastProvider/ToastProvider.d.ts +19 -0
- package/dist/components/ToastProvider/ToastProvider.js +7 -0
- package/dist/components/ToastProvider/ToastProvider.test.d.ts +1 -0
- package/dist/components/ToastProvider/ToastProvider.test.js +264 -0
- package/dist/components/ToastProvider/types.d.ts +54 -0
- package/dist/components/ToastProvider/useToast.d.ts +28 -0
- package/dist/components/Toggle/Toggle.js +31 -30
- package/dist/components/Toggle/Toggle.test.js +9 -9
- package/dist/components/Tooltip/Tooltip.js +20 -19
- package/dist/{index-2H7slGYV.js → index-7CBv-Jx6.js} +1 -1
- package/dist/{index-DpfPnSMn.js → index-BymOxiM6.js} +2 -2
- package/dist/index-C-3_YVJ1.js +1539 -0
- package/dist/{index-BKtdMA_j.js → index-C4ffg1vf.js} +24 -23
- package/dist/{index-BGZDIjm9.js → index-Chv2KjIL.js} +171 -168
- package/dist/{index-BJXIvJs4.js → index-CpsmI33B.js} +24 -23
- package/dist/index-CxAtPSMM.js +27 -0
- package/dist/{index-CjQV7MmW.js → index-DEphED6n.js} +11 -11
- package/dist/index-DM51yNMI.js +237 -0
- package/dist/{index-CVWHq7Pr.js → index-D_3jWVyV.js} +37 -36
- package/dist/index-DkTDHhag.js +3098 -0
- package/dist/index-DrR82jOT.js +142 -0
- package/dist/magic-string.es-uPKorP4O.js +663 -0
- package/dist/main.d.ts +5 -1
- package/dist/main.js +47 -40
- package/dist/useToast-Cz5MGKnw.js +11 -0
- package/dist/{vi.ClIskdbk-CFW_9sOK.js → vi.bdSIJ99Y-017e_Pkz.js} +9494 -10227
- package/dist/web.config +8 -8
- package/package.json +87 -84
- package/dist/index-DWydnyjJ.js +0 -245
- package/dist/index-DieLVN0p.js +0 -1664
- package/dist/magic-string.es-D4UQQyt0.js +0 -859
package/dist/web.config
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<configuration>
|
|
3
|
-
<system.webServer>
|
|
4
|
-
<staticContent>
|
|
5
|
-
<remove fileExtension=".json"/>
|
|
6
|
-
<mimeMap fileExtension=".json" mimeType="application/json"/>
|
|
7
|
-
</staticContent>
|
|
8
|
-
</system.webServer>
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<configuration>
|
|
3
|
+
<system.webServer>
|
|
4
|
+
<staticContent>
|
|
5
|
+
<remove fileExtension=".json"/>
|
|
6
|
+
<mimeMap fileExtension=".json" mimeType="application/json"/>
|
|
7
|
+
</staticContent>
|
|
8
|
+
</system.webServer>
|
|
9
9
|
</configuration>
|
package/package.json
CHANGED
|
@@ -1,84 +1,87 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@alixpartners/ui-components",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"files": [
|
|
6
|
-
"dist"
|
|
7
|
-
],
|
|
8
|
-
"exports": "./dist/main.js",
|
|
9
|
-
"module": "./dist/main.js",
|
|
10
|
-
"types": "./dist/main.d.ts",
|
|
11
|
-
"license": "SEE LICENSE IN LICENSE.md",
|
|
12
|
-
"repository": "https://alixpartners-dev.visualstudio.com/_git/AP.UIComponents",
|
|
13
|
-
"main": "./dist/umd/index.js",
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsc -b && vite build",
|
|
16
|
-
"lint": "eslint . --ext ts,tsx",
|
|
17
|
-
"lint:fix": "eslint . --ext ts,tsx --fix",
|
|
18
|
-
"format": "prettier --check .",
|
|
19
|
-
"format:fix": "prettier --write .",
|
|
20
|
-
"stylelint": "stylelint **/*.css",
|
|
21
|
-
"stylelint:fix": "stylelint **/*.css --fix",
|
|
22
|
-
"storybook": "storybook dev -p 6006",
|
|
23
|
-
"build-storybook": "storybook build",
|
|
24
|
-
"test": "vitest",
|
|
25
|
-
"test:unit": "vitest --project unit",
|
|
26
|
-
"test:storybook": "vitest --project storybook",
|
|
27
|
-
"test:ui": "vitest --ui",
|
|
28
|
-
"coverage": "vitest run --coverage",
|
|
29
|
-
"generate-icons": "node ./src/assets/generateIconsHelperFiles.js"
|
|
30
|
-
},
|
|
31
|
-
"dependencies": {
|
|
32
|
-
"clsx": "^2.1.1"
|
|
33
|
-
},
|
|
34
|
-
"peerDependencies": {
|
|
35
|
-
"react": "^18.3.1",
|
|
36
|
-
"react-dom": "^18.3.1",
|
|
37
|
-
"radix-ui": "^1.4.2"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"@storybook/addon-
|
|
44
|
-
"@storybook/
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
47
|
-
"@types/
|
|
48
|
-
"@types/react
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
51
|
-
"@vitest/
|
|
52
|
-
"@vitest/
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"eslint
|
|
56
|
-
"eslint-
|
|
57
|
-
"eslint-plugin-react-
|
|
58
|
-
"eslint-plugin-
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@alixpartners/ui-components",
|
|
3
|
+
"version": "2.3.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"exports": "./dist/main.js",
|
|
9
|
+
"module": "./dist/main.js",
|
|
10
|
+
"types": "./dist/main.d.ts",
|
|
11
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
12
|
+
"repository": "https://alixpartners-dev.visualstudio.com/_git/AP.UIComponents",
|
|
13
|
+
"main": "./dist/umd/index.js",
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -b && vite build",
|
|
16
|
+
"lint": "eslint . --ext ts,tsx",
|
|
17
|
+
"lint:fix": "eslint . --ext ts,tsx --fix",
|
|
18
|
+
"format": "prettier --check .",
|
|
19
|
+
"format:fix": "prettier --write .",
|
|
20
|
+
"stylelint": "stylelint **/*.css",
|
|
21
|
+
"stylelint:fix": "stylelint **/*.css --fix",
|
|
22
|
+
"storybook": "storybook dev -p 6006",
|
|
23
|
+
"build-storybook": "storybook build",
|
|
24
|
+
"test": "vitest",
|
|
25
|
+
"test:unit": "vitest --project unit",
|
|
26
|
+
"test:storybook": "vitest --project storybook",
|
|
27
|
+
"test:ui": "vitest --ui",
|
|
28
|
+
"coverage": "vitest run --coverage",
|
|
29
|
+
"generate-icons": "node ./src/assets/generateIconsHelperFiles.js"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"clsx": "^2.1.1"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"react": "^18.3.1",
|
|
36
|
+
"react-dom": "^18.3.1",
|
|
37
|
+
"radix-ui": "^1.4.2",
|
|
38
|
+
"notistack": "^3.0.1"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@chromatic-com/storybook": "^4.0.1",
|
|
42
|
+
"@eslint/js": "^9.25.0",
|
|
43
|
+
"@storybook/addon-designs": "^10.0.2",
|
|
44
|
+
"@storybook/addon-onboarding": "^9.0.18",
|
|
45
|
+
"@storybook/react-vite": "^9.0.18",
|
|
46
|
+
"@testing-library/react": "^16.3.0",
|
|
47
|
+
"@types/node": "^22.15.21",
|
|
48
|
+
"@types/react": "^19.1.2",
|
|
49
|
+
"@types/react-dom": "^19.1.2",
|
|
50
|
+
"@vitejs/plugin-react": "^4.4.1",
|
|
51
|
+
"@vitest/browser": "^3.1.4",
|
|
52
|
+
"@vitest/coverage-v8": "^3.1.4",
|
|
53
|
+
"@vitest/ui": "^3.1.4",
|
|
54
|
+
"babel-plugin-react-remove-properties": "^0.3.0",
|
|
55
|
+
"eslint": "^9.25.0",
|
|
56
|
+
"eslint-config-prettier": "^10.1.5",
|
|
57
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
58
|
+
"eslint-plugin-react-refresh": "^0.4.19",
|
|
59
|
+
"eslint-plugin-storybook": "^9.0.18",
|
|
60
|
+
"globals": "^16.0.0",
|
|
61
|
+
"happy-dom": "^15.11.6",
|
|
62
|
+
"jsdom": "^26.1.0",
|
|
63
|
+
"notistack": "^3.0.1",
|
|
64
|
+
"playwright": "^1.52.0",
|
|
65
|
+
"postcss-scss": "^4.0.9",
|
|
66
|
+
"prettier": "^3.5.3",
|
|
67
|
+
"sass": "^1.89.0",
|
|
68
|
+
"storybook": "^9.0.18",
|
|
69
|
+
"stylelint": "^16.19.1",
|
|
70
|
+
"stylelint-config-standard": "^38.0.0",
|
|
71
|
+
"stylelint-scss": "^6.12.0",
|
|
72
|
+
"typescript": "~5.8.3",
|
|
73
|
+
"typescript-eslint": "^8.30.1",
|
|
74
|
+
"vite": "^6.3.5",
|
|
75
|
+
"vite-plugin-dts": "^4.5.4",
|
|
76
|
+
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
77
|
+
"vitest": "^3.1.4",
|
|
78
|
+
"@storybook/addon-vitest": "9.0.18",
|
|
79
|
+
"@storybook/addon-docs": "^9.0.18",
|
|
80
|
+
"glob": "^11.0.2"
|
|
81
|
+
},
|
|
82
|
+
"eslintConfig": {
|
|
83
|
+
"extends": [
|
|
84
|
+
"plugin:storybook/recommended"
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
}
|
package/dist/index-DWydnyjJ.js
DELETED
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import * as c from "react";
|
|
2
|
-
import * as P from "react-dom";
|
|
3
|
-
import { jsx as S, Fragment as R } from "react/jsx-runtime";
|
|
4
|
-
function v(t, e) {
|
|
5
|
-
if (typeof t == "function")
|
|
6
|
-
return t(e);
|
|
7
|
-
t != null && (t.current = e);
|
|
8
|
-
}
|
|
9
|
-
function C(...t) {
|
|
10
|
-
return (e) => {
|
|
11
|
-
let o = !1;
|
|
12
|
-
const r = t.map((n) => {
|
|
13
|
-
const s = v(n, e);
|
|
14
|
-
return !o && typeof s == "function" && (o = !0), s;
|
|
15
|
-
});
|
|
16
|
-
if (o)
|
|
17
|
-
return () => {
|
|
18
|
-
for (let n = 0; n < r.length; n++) {
|
|
19
|
-
const s = r[n];
|
|
20
|
-
typeof s == "function" ? s() : v(t[n], null);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function j(...t) {
|
|
26
|
-
return c.useCallback(C(...t), t);
|
|
27
|
-
}
|
|
28
|
-
// @__NO_SIDE_EFFECTS__
|
|
29
|
-
function E(t) {
|
|
30
|
-
const e = /* @__PURE__ */ _(t), o = c.forwardRef((r, n) => {
|
|
31
|
-
const { children: s, ...u } = r, i = c.Children.toArray(s), l = i.find($);
|
|
32
|
-
if (l) {
|
|
33
|
-
const f = l.props.children, d = i.map((a) => a === l ? c.Children.count(f) > 1 ? c.Children.only(null) : c.isValidElement(f) ? f.props.children : null : a);
|
|
34
|
-
return /* @__PURE__ */ S(e, { ...u, ref: n, children: c.isValidElement(f) ? c.cloneElement(f, void 0, d) : null });
|
|
35
|
-
}
|
|
36
|
-
return /* @__PURE__ */ S(e, { ...u, ref: n, children: s });
|
|
37
|
-
});
|
|
38
|
-
return o.displayName = `${t}.Slot`, o;
|
|
39
|
-
}
|
|
40
|
-
// @__NO_SIDE_EFFECTS__
|
|
41
|
-
function _(t) {
|
|
42
|
-
const e = c.forwardRef((o, r) => {
|
|
43
|
-
const { children: n, ...s } = o;
|
|
44
|
-
if (c.isValidElement(n)) {
|
|
45
|
-
const u = O(n), i = z(s, n.props);
|
|
46
|
-
return n.type !== c.Fragment && (i.ref = r ? C(r, u) : u), c.cloneElement(n, i);
|
|
47
|
-
}
|
|
48
|
-
return c.Children.count(n) > 1 ? c.Children.only(null) : null;
|
|
49
|
-
});
|
|
50
|
-
return e.displayName = `${t}.SlotClone`, e;
|
|
51
|
-
}
|
|
52
|
-
var x = Symbol("radix.slottable");
|
|
53
|
-
// @__NO_SIDE_EFFECTS__
|
|
54
|
-
function B(t) {
|
|
55
|
-
const e = ({ children: o }) => /* @__PURE__ */ S(R, { children: o });
|
|
56
|
-
return e.displayName = `${t}.Slottable`, e.__radixId = x, e;
|
|
57
|
-
}
|
|
58
|
-
function $(t) {
|
|
59
|
-
return c.isValidElement(t) && typeof t.type == "function" && "__radixId" in t.type && t.type.__radixId === x;
|
|
60
|
-
}
|
|
61
|
-
function z(t, e) {
|
|
62
|
-
const o = { ...e };
|
|
63
|
-
for (const r in e) {
|
|
64
|
-
const n = t[r], s = e[r];
|
|
65
|
-
/^on[A-Z]/.test(r) ? n && s ? o[r] = (...i) => {
|
|
66
|
-
const l = s(...i);
|
|
67
|
-
return n(...i), l;
|
|
68
|
-
} : n && (o[r] = n) : r === "style" ? o[r] = { ...n, ...s } : r === "className" && (o[r] = [n, s].filter(Boolean).join(" "));
|
|
69
|
-
}
|
|
70
|
-
return { ...t, ...o };
|
|
71
|
-
}
|
|
72
|
-
function O(t) {
|
|
73
|
-
var r, n;
|
|
74
|
-
let e = (r = Object.getOwnPropertyDescriptor(t.props, "ref")) == null ? void 0 : r.get, o = e && "isReactWarning" in e && e.isReactWarning;
|
|
75
|
-
return o ? t.ref : (e = (n = Object.getOwnPropertyDescriptor(t, "ref")) == null ? void 0 : n.get, o = e && "isReactWarning" in e && e.isReactWarning, o ? t.props.ref : t.props.ref || t.ref);
|
|
76
|
-
}
|
|
77
|
-
var N = [
|
|
78
|
-
"a",
|
|
79
|
-
"button",
|
|
80
|
-
"div",
|
|
81
|
-
"form",
|
|
82
|
-
"h2",
|
|
83
|
-
"h3",
|
|
84
|
-
"img",
|
|
85
|
-
"input",
|
|
86
|
-
"label",
|
|
87
|
-
"li",
|
|
88
|
-
"nav",
|
|
89
|
-
"ol",
|
|
90
|
-
"p",
|
|
91
|
-
"select",
|
|
92
|
-
"span",
|
|
93
|
-
"svg",
|
|
94
|
-
"ul"
|
|
95
|
-
], k = N.reduce((t, e) => {
|
|
96
|
-
const o = /* @__PURE__ */ E(`Primitive.${e}`), r = c.forwardRef((n, s) => {
|
|
97
|
-
const { asChild: u, ...i } = n, l = u ? o : e;
|
|
98
|
-
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ S(l, { ...i, ref: s });
|
|
99
|
-
});
|
|
100
|
-
return r.displayName = `Primitive.${e}`, { ...t, [e]: r };
|
|
101
|
-
}, {});
|
|
102
|
-
function F(t, e) {
|
|
103
|
-
t && P.flushSync(() => t.dispatchEvent(e));
|
|
104
|
-
}
|
|
105
|
-
function L(t, e = []) {
|
|
106
|
-
let o = [];
|
|
107
|
-
function r(s, u) {
|
|
108
|
-
const i = c.createContext(u), l = o.length;
|
|
109
|
-
o = [...o, u];
|
|
110
|
-
const f = (a) => {
|
|
111
|
-
var b;
|
|
112
|
-
const { scope: p, children: h, ...m } = a, y = ((b = p == null ? void 0 : p[t]) == null ? void 0 : b[l]) || i, w = c.useMemo(() => m, Object.values(m));
|
|
113
|
-
return /* @__PURE__ */ S(y.Provider, { value: w, children: h });
|
|
114
|
-
};
|
|
115
|
-
f.displayName = s + "Provider";
|
|
116
|
-
function d(a, p) {
|
|
117
|
-
var y;
|
|
118
|
-
const h = ((y = p == null ? void 0 : p[t]) == null ? void 0 : y[l]) || i, m = c.useContext(h);
|
|
119
|
-
if (m) return m;
|
|
120
|
-
if (u !== void 0) return u;
|
|
121
|
-
throw new Error(`\`${a}\` must be used within \`${s}\``);
|
|
122
|
-
}
|
|
123
|
-
return [f, d];
|
|
124
|
-
}
|
|
125
|
-
const n = () => {
|
|
126
|
-
const s = o.map((u) => c.createContext(u));
|
|
127
|
-
return function(i) {
|
|
128
|
-
const l = (i == null ? void 0 : i[t]) || s;
|
|
129
|
-
return c.useMemo(
|
|
130
|
-
() => ({ [`__scope${t}`]: { ...i, [t]: l } }),
|
|
131
|
-
[i, l]
|
|
132
|
-
);
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
return n.scopeName = t, [r, A(n, ...e)];
|
|
136
|
-
}
|
|
137
|
-
function A(...t) {
|
|
138
|
-
const e = t[0];
|
|
139
|
-
if (t.length === 1) return e;
|
|
140
|
-
const o = () => {
|
|
141
|
-
const r = t.map((n) => ({
|
|
142
|
-
useScope: n(),
|
|
143
|
-
scopeName: n.scopeName
|
|
144
|
-
}));
|
|
145
|
-
return function(s) {
|
|
146
|
-
const u = r.reduce((i, { useScope: l, scopeName: f }) => {
|
|
147
|
-
const a = l(s)[`__scope${f}`];
|
|
148
|
-
return { ...i, ...a };
|
|
149
|
-
}, {});
|
|
150
|
-
return c.useMemo(() => ({ [`__scope${e.scopeName}`]: u }), [u]);
|
|
151
|
-
};
|
|
152
|
-
};
|
|
153
|
-
return o.scopeName = e.scopeName, o;
|
|
154
|
-
}
|
|
155
|
-
function M(t, e, { checkForDefaultPrevented: o = !0 } = {}) {
|
|
156
|
-
return function(n) {
|
|
157
|
-
if (t == null || t(n), o === !1 || !n.defaultPrevented)
|
|
158
|
-
return e == null ? void 0 : e(n);
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
var g = globalThis != null && globalThis.document ? c.useLayoutEffect : () => {
|
|
162
|
-
}, I = c[" useInsertionEffect ".trim().toString()] || g;
|
|
163
|
-
function T({
|
|
164
|
-
prop: t,
|
|
165
|
-
defaultProp: e,
|
|
166
|
-
onChange: o = () => {
|
|
167
|
-
},
|
|
168
|
-
caller: r
|
|
169
|
-
}) {
|
|
170
|
-
const [n, s, u] = D({
|
|
171
|
-
defaultProp: e,
|
|
172
|
-
onChange: o
|
|
173
|
-
}), i = t !== void 0, l = i ? t : n;
|
|
174
|
-
{
|
|
175
|
-
const d = c.useRef(t !== void 0);
|
|
176
|
-
c.useEffect(() => {
|
|
177
|
-
const a = d.current;
|
|
178
|
-
a !== i && console.warn(
|
|
179
|
-
`${r} is changing from ${a ? "controlled" : "uncontrolled"} to ${i ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
180
|
-
), d.current = i;
|
|
181
|
-
}, [i, r]);
|
|
182
|
-
}
|
|
183
|
-
const f = c.useCallback(
|
|
184
|
-
(d) => {
|
|
185
|
-
var a;
|
|
186
|
-
if (i) {
|
|
187
|
-
const p = W(d) ? d(t) : d;
|
|
188
|
-
p !== t && ((a = u.current) == null || a.call(u, p));
|
|
189
|
-
} else
|
|
190
|
-
s(d);
|
|
191
|
-
},
|
|
192
|
-
[i, t, s, u]
|
|
193
|
-
);
|
|
194
|
-
return [l, f];
|
|
195
|
-
}
|
|
196
|
-
function D({
|
|
197
|
-
defaultProp: t,
|
|
198
|
-
onChange: e
|
|
199
|
-
}) {
|
|
200
|
-
const [o, r] = c.useState(t), n = c.useRef(o), s = c.useRef(e);
|
|
201
|
-
return I(() => {
|
|
202
|
-
s.current = e;
|
|
203
|
-
}, [e]), c.useEffect(() => {
|
|
204
|
-
var u;
|
|
205
|
-
n.current !== o && ((u = s.current) == null || u.call(s, o), n.current = o);
|
|
206
|
-
}, [o, n]), [o, r, s];
|
|
207
|
-
}
|
|
208
|
-
function W(t) {
|
|
209
|
-
return typeof t == "function";
|
|
210
|
-
}
|
|
211
|
-
function U(t) {
|
|
212
|
-
const [e, o] = c.useState(void 0);
|
|
213
|
-
return g(() => {
|
|
214
|
-
if (t) {
|
|
215
|
-
o({ width: t.offsetWidth, height: t.offsetHeight });
|
|
216
|
-
const r = new ResizeObserver((n) => {
|
|
217
|
-
if (!Array.isArray(n) || !n.length)
|
|
218
|
-
return;
|
|
219
|
-
const s = n[0];
|
|
220
|
-
let u, i;
|
|
221
|
-
if ("borderBoxSize" in s) {
|
|
222
|
-
const l = s.borderBoxSize, f = Array.isArray(l) ? l[0] : l;
|
|
223
|
-
u = f.inlineSize, i = f.blockSize;
|
|
224
|
-
} else
|
|
225
|
-
u = t.offsetWidth, i = t.offsetHeight;
|
|
226
|
-
o({ width: u, height: i });
|
|
227
|
-
});
|
|
228
|
-
return r.observe(t, { box: "border-box" }), () => r.unobserve(t);
|
|
229
|
-
} else
|
|
230
|
-
o(void 0);
|
|
231
|
-
}, [t]), e;
|
|
232
|
-
}
|
|
233
|
-
export {
|
|
234
|
-
k as P,
|
|
235
|
-
M as a,
|
|
236
|
-
C as b,
|
|
237
|
-
L as c,
|
|
238
|
-
j as d,
|
|
239
|
-
U as e,
|
|
240
|
-
F as f,
|
|
241
|
-
E as g,
|
|
242
|
-
B as h,
|
|
243
|
-
g as i,
|
|
244
|
-
T as u
|
|
245
|
-
};
|