@pismo/marola 0.0.1-alpha.1 → 0.0.1-alpha.11
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 +17 -5
- package/dist/Button-B1umG8kJ.js +131 -0
- package/dist/ClickAwayListener-BKznXF1d.js +106 -0
- package/dist/Dialog.module-CGVM5V_D.js +15 -0
- package/dist/Portal-BcdMtRGF.js +73 -0
- package/dist/Tab-CRwnhsj5.js +254 -0
- package/dist/Tabs.module-yYcTJnj6.js +103 -0
- package/dist/_commonjsHelpers-CT_km90n.js +30 -0
- package/dist/assets/Advice.css +1 -0
- package/dist/assets/Button.css +1 -0
- package/dist/assets/Checkbox.css +1 -0
- package/dist/assets/Dialog.css +1 -1
- package/dist/assets/IconButton.css +1 -0
- package/dist/assets/Input.css +1 -0
- package/dist/assets/InputSearch.css +1 -0
- package/dist/assets/LoadingSpinner.css +1 -1
- package/dist/assets/PageHeader.css +1 -0
- package/dist/assets/Pagination.css +1 -0
- package/dist/assets/Skeleton.css +1 -0
- package/dist/assets/Snackbar.css +1 -0
- package/dist/assets/SortTooltip.css +1 -0
- package/dist/assets/Stepper.css +1 -0
- package/dist/assets/Table.css +1 -0
- package/dist/assets/Tabs.css +1 -0
- package/dist/assets/Toggle.css +1 -0
- package/dist/assets/Tooltip.css +1 -0
- package/dist/assets/Typography.css +1 -1
- package/dist/assets/global.css +1 -0
- package/dist/components/Advice/Advice.d.ts +16 -0
- package/dist/components/Advice/Advice.js +25 -0
- package/dist/components/Button/Button.d.ts +29 -0
- package/dist/components/Button/Button.js +70 -0
- package/dist/components/Button/Button.stories.d.ts +60 -0
- package/dist/components/Button/Button.stories.js +40 -0
- package/dist/components/Checkbox/Checkbox.d.ts +19 -0
- package/dist/components/Checkbox/Checkbox.js +56 -0
- package/dist/components/Dialog/Actions.js +1 -1
- package/dist/components/Dialog/Backdrop.d.ts +1 -1
- package/dist/components/Dialog/Backdrop.js +2 -9
- package/dist/components/Dialog/CloseIconButton.js +11 -10
- package/dist/components/Dialog/Dialog.d.ts +5 -4
- package/dist/components/Dialog/Dialog.js +419 -20077
- package/dist/components/Dialog/Dialog.stories.d.ts +343 -0
- package/dist/components/Dialog/Dialog.stories.js +59 -0
- package/dist/components/Dialog/Title.js +22 -7
- package/dist/components/Icon/Icon.d.ts +18 -0
- package/dist/components/Icon/Icon.js +95 -0
- package/dist/components/IconButton/IconButton.d.ts +22 -0
- package/dist/components/IconButton/IconButton.js +68 -0
- package/dist/components/Input/Input.d.ts +44 -0
- package/dist/components/Input/Input.js +497 -0
- package/dist/components/Input/Input.stories.d.ts +43 -0
- package/dist/components/Input/Input.stories.js +106 -0
- package/dist/components/InputSearch/InputSearch.d.ts +11 -0
- package/dist/components/InputSearch/InputSearch.js +29 -0
- package/dist/components/InputSearch/InputSearch.stories.d.ts +22 -0
- package/dist/components/InputSearch/InputSearch.stories.js +36 -0
- package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +2 -0
- package/dist/components/LoadingSpinner/LoadingSpinner.js +12 -13
- package/dist/components/LoadingSpinner/LoadingSpinner.stories.d.ts +14 -0
- package/dist/components/LoadingSpinner/LoadingSpinner.stories.js +38 -0
- package/dist/components/PageHeader/PageHeader.d.ts +36 -0
- package/dist/components/PageHeader/PageHeader.js +51 -0
- package/dist/components/PageHeader/PageHeader.stories.d.ts +43 -0
- package/dist/components/PageHeader/PageHeader.stories.js +49 -0
- package/dist/components/Pagination/Pagination.d.ts +36 -0
- package/dist/components/Pagination/Pagination.js +219 -0
- package/dist/components/Skeleton/Skeleton.d.ts +18 -0
- package/dist/components/Skeleton/Skeleton.js +26 -0
- package/dist/components/Snackbar/Snackbar.d.ts +13 -0
- package/dist/components/Snackbar/Snackbar.js +622 -0
- package/dist/components/SortTooltip/SortTooltip.d.ts +26 -0
- package/dist/components/SortTooltip/SortTooltip.js +67 -0
- package/dist/components/Stepper/Stepper.d.ts +16 -0
- package/dist/components/Stepper/Stepper.js +33 -0
- package/dist/components/Table/Table.d.ts +39 -0
- package/dist/components/Table/Table.js +122 -0
- package/dist/components/Table/TableContext.d.ts +19 -0
- package/dist/components/Table/TableContext.js +21 -0
- package/dist/components/Tabs/Tab.d.ts +9 -0
- package/dist/components/Tabs/Tab.js +8 -0
- package/dist/components/Tabs/TabPanel.d.ts +8 -0
- package/dist/components/Tabs/TabPanel.js +118 -0
- package/dist/components/Tabs/Tabs.d.ts +11 -0
- package/dist/components/Tabs/Tabs.js +827 -0
- package/dist/components/Toggle/Toggle.d.ts +11 -0
- package/dist/components/Toggle/Toggle.js +252 -0
- package/dist/components/Toggle/Toggle.stories.d.ts +21 -0
- package/dist/components/Toggle/Toggle.stories.js +33 -0
- package/dist/components/Tooltip/Tooltip.d.ts +17 -0
- package/dist/components/Tooltip/Tooltip.js +1366 -0
- package/dist/components/Typography/Typography.d.ts +15 -6
- package/dist/components/Typography/Typography.js +75 -67
- package/dist/components/Typography/Typography.stories.d.ts +31 -0
- package/dist/components/Typography/Typography.stories.js +30 -0
- package/dist/components/Typography/typography.test.d.ts +1 -0
- package/dist/components/Typography/typography.test.js +11357 -0
- package/dist/index-BNWbc5Kh.js +19628 -0
- package/dist/index-CqjC7P5Y.js +814 -0
- package/dist/magic-string.es-O_8lTkE3.js +738 -0
- package/dist/main.d.ts +18 -2
- package/dist/main.js +57 -15
- package/dist/objectWithoutPropertiesLoose-D7Cp0Pg_.js +26 -0
- package/dist/test-utils/assertStyles.d.ts +1 -0
- package/dist/test-utils/assertStyles.js +11 -0
- package/dist/types/helpers.d.ts +14 -7
- package/dist/useButton-Bc8IAgyk.js +106 -0
- package/dist/useControlled-CCMYYdCM.js +31 -0
- package/dist/useEnhancedEffect-CJGo-L3B.js +5 -0
- package/dist/useIsFocusVisible-BH4IAdcw.js +69 -0
- package/dist/useTimeout-DxF9kiZL.js +36 -0
- package/dist/utils/styleStrings.d.ts +6 -0
- package/dist/utils/styleStrings.js +10 -0
- package/dist/utils/styleStrings.test.d.ts +1 -0
- package/dist/utils/styleStrings.test.js +41 -0
- package/dist/vi.Y_w82WR8-Df0JUamG.js +9860 -0
- package/package.json +53 -10
- package/dist/Button-REznN-RP.js +0 -1139
- package/dist/Dialog.module-BO0mdB7d.js +0 -15
- package/dist/assets/CallToActionButton.css +0 -1
- package/dist/assets/main.css +0 -1
- package/dist/components/CallToActionButton/CallToActionButton.d.ts +0 -23
- package/dist/components/CallToActionButton/CallToActionButton.js +0 -57
- package/src/playground/Playground.tsx +0 -58
package/dist/main.d.ts
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
|
|
2
|
+
export * from './components/Advice/Advice';
|
|
3
|
+
export * from './components/Button/Button';
|
|
4
|
+
export * from './components/Checkbox/Checkbox';
|
|
2
5
|
export * from './components/Dialog/Dialog';
|
|
3
|
-
export * from './components/
|
|
6
|
+
export * from './components/Icon/Icon';
|
|
7
|
+
export * from './components/IconButton/IconButton';
|
|
8
|
+
export * from './components/Input/Input';
|
|
9
|
+
export * from './components/InputSearch/InputSearch';
|
|
4
10
|
export * from './components/LoadingSpinner/LoadingSpinner';
|
|
5
|
-
export * from './components/
|
|
11
|
+
export * from './components/PageHeader/PageHeader';
|
|
12
|
+
export * from './components/Pagination/Pagination';
|
|
13
|
+
export * from './components/Skeleton/Skeleton';
|
|
14
|
+
export * from './components/Snackbar/Snackbar';
|
|
15
|
+
export * from './components/SortTooltip/SortTooltip';
|
|
16
|
+
export * from './components/Stepper/Stepper';
|
|
17
|
+
export * from './components/Table/Table';
|
|
18
|
+
export * from './components/Tabs/Tabs';
|
|
19
|
+
export * from './components/Toggle/Toggle';
|
|
20
|
+
export * from './components/Tooltip/Tooltip';
|
|
21
|
+
export * from './components/Typography/Typography';
|
package/dist/main.js
CHANGED
|
@@ -1,17 +1,59 @@
|
|
|
1
|
-
import './assets/
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import './assets/global.css';
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { Advice as e } from "./components/Advice/Advice.js";
|
|
4
|
+
import { Button as a } from "./components/Button/Button.js";
|
|
5
|
+
import { Checkbox as m } from "./components/Checkbox/Checkbox.js";
|
|
6
|
+
import { Dialog as x } from "./components/Dialog/Dialog.js";
|
|
7
|
+
import { FamilyAndIcons as i, Icon as T } from "./components/Icon/Icon.js";
|
|
8
|
+
import { IconButton as c } from "./components/IconButton/IconButton.js";
|
|
9
|
+
import { Input as u } from "./components/Input/Input.js";
|
|
10
|
+
import { InputSearch as b } from "./components/InputSearch/InputSearch.js";
|
|
11
|
+
import { LoadingSpinner as k } from "./components/LoadingSpinner/LoadingSpinner.js";
|
|
12
|
+
import { PageHeader as D } from "./components/PageHeader/PageHeader.js";
|
|
13
|
+
import { Pagination as y, paginationDefaultTranslations as A } from "./components/Pagination/Pagination.js";
|
|
14
|
+
import { Skeleton as P, SkeletonCircle as B, SkeletonTable as v } from "./components/Skeleton/Skeleton.js";
|
|
15
|
+
import { Snackbar as H } from "./components/Snackbar/Snackbar.js";
|
|
16
|
+
import { SortTooltip as j, sortTooltipDefaultTranslations as q } from "./components/SortTooltip/SortTooltip.js";
|
|
17
|
+
import { Stepper as z } from "./components/Stepper/Stepper.js";
|
|
18
|
+
import { Table as G } from "./components/Table/Table.js";
|
|
19
|
+
import { Tabs as K } from "./components/Tabs/Tabs.js";
|
|
20
|
+
import { Toggle as N } from "./components/Toggle/Toggle.js";
|
|
21
|
+
import { Tooltip as Q } from "./components/Tooltip/Tooltip.js";
|
|
22
|
+
import { Typography as U } from "./components/Typography/Typography.js";
|
|
23
|
+
import { default as W } from "./components/Dialog/Title.js";
|
|
24
|
+
import { default as Y } from "./components/Dialog/Content.js";
|
|
25
|
+
import { default as _ } from "./components/Dialog/Actions.js";
|
|
26
|
+
import { T as oo } from "./Tab-CRwnhsj5.js";
|
|
27
|
+
import { TabPanel as to } from "./components/Tabs/TabPanel.js";
|
|
9
28
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
29
|
+
_ as Actions,
|
|
30
|
+
e as Advice,
|
|
31
|
+
a as Button,
|
|
32
|
+
m as Checkbox,
|
|
33
|
+
Y as Content,
|
|
34
|
+
x as Dialog,
|
|
35
|
+
W as DialogTitle,
|
|
36
|
+
i as FamilyAndIcons,
|
|
37
|
+
T as Icon,
|
|
38
|
+
c as IconButton,
|
|
39
|
+
u as Input,
|
|
40
|
+
b as InputSearch,
|
|
41
|
+
k as LoadingSpinner,
|
|
42
|
+
D as PageHeader,
|
|
43
|
+
y as Pagination,
|
|
44
|
+
P as Skeleton,
|
|
45
|
+
B as SkeletonCircle,
|
|
46
|
+
v as SkeletonTable,
|
|
47
|
+
H as Snackbar,
|
|
48
|
+
j as SortTooltip,
|
|
49
|
+
z as Stepper,
|
|
50
|
+
oo as Tab,
|
|
51
|
+
to as TabPanel,
|
|
52
|
+
G as Table,
|
|
53
|
+
K as Tabs,
|
|
54
|
+
N as Toggle,
|
|
55
|
+
Q as Tooltip,
|
|
56
|
+
U as Typography,
|
|
57
|
+
A as paginationDefaultTranslations,
|
|
58
|
+
q as sortTooltipDefaultTranslations
|
|
17
59
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function e() {
|
|
2
|
+
return e = Object.assign ? Object.assign.bind() : function(n) {
|
|
3
|
+
for (var a = 1; a < arguments.length; a++) {
|
|
4
|
+
var r = arguments[a];
|
|
5
|
+
for (var t in r)
|
|
6
|
+
Object.prototype.hasOwnProperty.call(r, t) && (n[t] = r[t]);
|
|
7
|
+
}
|
|
8
|
+
return n;
|
|
9
|
+
}, e.apply(this, arguments);
|
|
10
|
+
}
|
|
11
|
+
function i(n, a) {
|
|
12
|
+
if (n == null)
|
|
13
|
+
return {};
|
|
14
|
+
var r = {};
|
|
15
|
+
for (var t in n)
|
|
16
|
+
if (Object.prototype.hasOwnProperty.call(n, t)) {
|
|
17
|
+
if (a.indexOf(t) >= 0)
|
|
18
|
+
continue;
|
|
19
|
+
r[t] = n[t];
|
|
20
|
+
}
|
|
21
|
+
return r;
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
i as _,
|
|
25
|
+
e as a
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const assertClassesApplied: (expectedClasses: string[] | null, component: HTMLElement) => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const i = (h, r) => {
|
|
2
|
+
h == null || h.forEach((a) => {
|
|
3
|
+
if (!r.className.split(" ").some((t) => t.startsWith(`_${a}_`)))
|
|
4
|
+
throw new Error(`
|
|
5
|
+
Received: ${r.className}
|
|
6
|
+
Expected: _${a}_{x}, (where {x} = random hash)`);
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
i as assertClassesApplied
|
|
11
|
+
};
|
package/dist/types/helpers.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
/// <reference types="vite-plugin-svgr/client" />
|
|
2
|
+
|
|
1
3
|
// Saves having to declare 'never' for every property that exists on the 'other' type
|
|
2
4
|
// Creates a new type that 'only' has properties in the first type and not in the second, if the property does not
|
|
3
5
|
// exist in the second type, it is given the value of 'never' so it can never be set
|
|
4
|
-
type Only<T, U> = { [P in keyof T]: T[P] } & Omit<
|
|
5
|
-
{ [P in keyof U]?: never },
|
|
6
|
-
keyof T
|
|
7
|
-
>;
|
|
6
|
+
type Only<T, U> = { [P in keyof T]: T[P] } & Omit<{ [P in keyof U]?: never }, keyof T>;
|
|
8
7
|
|
|
9
8
|
// Usage MyNewType = Either<TypeA, TypeB>
|
|
10
9
|
// Creates a new type via union based on two types
|
|
@@ -15,6 +14,14 @@ export type Either<T, U> = Only<T, U> | Only<U, T>;
|
|
|
15
14
|
// note these arguments must be declared in MyType as optional '?'
|
|
16
15
|
type RequireAllOrNone<T, U extends keyof T = never> = (
|
|
17
16
|
| Required<Pick<T, U>> // Require all properties
|
|
18
|
-
| Partial<Record<U, never>>
|
|
19
|
-
|
|
20
|
-
Omit<T, U>; // remaining keys not listed in U
|
|
17
|
+
| Partial<Record<U, never>> // Require none
|
|
18
|
+
) &
|
|
19
|
+
Omit<T, U>; // remaining keys not listed in U
|
|
20
|
+
|
|
21
|
+
// S = string, D = delimiter to split by. Then split S by D and return array of strings. "foo-bar-baz" = ["foo","bar","baz"]
|
|
22
|
+
// Fallback if no '-' return [s] which is an array of the input string e.g. foo = [foo]
|
|
23
|
+
type Split<S extends string, D extends string> = string extends S
|
|
24
|
+
? string[]
|
|
25
|
+
: S extends `${infer T}${D}${infer Rest}`
|
|
26
|
+
? [T, ...Split<Rest, D>]
|
|
27
|
+
: [S];
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { a as D } from "./objectWithoutPropertiesLoose-D7Cp0Pg_.js";
|
|
2
|
+
import * as i from "react";
|
|
3
|
+
import { u as S, e as k } from "./index-CqjC7P5Y.js";
|
|
4
|
+
import { u as _ } from "./useIsFocusVisible-BH4IAdcw.js";
|
|
5
|
+
function v(p) {
|
|
6
|
+
const {
|
|
7
|
+
rootElementName: n = "",
|
|
8
|
+
componentName: l
|
|
9
|
+
} = p, [c, y] = i.useState(n.toUpperCase());
|
|
10
|
+
process.env.NODE_ENV !== "production" && i.useEffect(() => {
|
|
11
|
+
n && c !== n.toUpperCase() && console.error(`useRootElementName: the \`rootElementName\` prop of ${l ? `the ${l} component` : "a component"} expected the '${n}' element, but a '${c.toLowerCase()}' was rendered instead`, "This may cause hydration issues in an SSR context, for example in a Next.js app");
|
|
12
|
+
}, [n, c, l]);
|
|
13
|
+
const u = i.useCallback((m) => {
|
|
14
|
+
var s;
|
|
15
|
+
y((s = m == null ? void 0 : m.tagName) != null ? s : "");
|
|
16
|
+
}, []);
|
|
17
|
+
return [c, u];
|
|
18
|
+
}
|
|
19
|
+
function h(p = {}) {
|
|
20
|
+
const {
|
|
21
|
+
disabled: n = !1,
|
|
22
|
+
focusableWhenDisabled: l,
|
|
23
|
+
href: c,
|
|
24
|
+
rootRef: y,
|
|
25
|
+
tabIndex: u,
|
|
26
|
+
to: m,
|
|
27
|
+
type: s,
|
|
28
|
+
rootElementName: T
|
|
29
|
+
} = p, b = i.useRef(), [B, N] = i.useState(!1), {
|
|
30
|
+
isFocusVisibleRef: E,
|
|
31
|
+
onFocus: F,
|
|
32
|
+
onBlur: M,
|
|
33
|
+
ref: U
|
|
34
|
+
} = _(), [d, R] = i.useState(!1);
|
|
35
|
+
n && !l && d && R(!1), i.useEffect(() => {
|
|
36
|
+
E.current = d;
|
|
37
|
+
}, [d, E]);
|
|
38
|
+
const [f, V] = v({
|
|
39
|
+
rootElementName: T ?? (c || m ? "a" : void 0),
|
|
40
|
+
componentName: "Button"
|
|
41
|
+
}), w = (t) => (e) => {
|
|
42
|
+
var o;
|
|
43
|
+
d && e.preventDefault(), (o = t.onMouseLeave) == null || o.call(t, e);
|
|
44
|
+
}, K = (t) => (e) => {
|
|
45
|
+
var o;
|
|
46
|
+
M(e), E.current === !1 && R(!1), (o = t.onBlur) == null || o.call(t, e);
|
|
47
|
+
}, P = (t) => (e) => {
|
|
48
|
+
var o;
|
|
49
|
+
if (b.current || (b.current = e.currentTarget), F(e), E.current === !0) {
|
|
50
|
+
var r;
|
|
51
|
+
R(!0), (r = t.onFocusVisible) == null || r.call(t, e);
|
|
52
|
+
}
|
|
53
|
+
(o = t.onFocus) == null || o.call(t, e);
|
|
54
|
+
}, g = () => {
|
|
55
|
+
const t = b.current;
|
|
56
|
+
return f === "BUTTON" || f === "INPUT" && ["button", "submit", "reset"].includes(t == null ? void 0 : t.type) || f === "A" && (t == null ? void 0 : t.href);
|
|
57
|
+
}, I = (t) => (e) => {
|
|
58
|
+
if (!n) {
|
|
59
|
+
var o;
|
|
60
|
+
(o = t.onClick) == null || o.call(t, e);
|
|
61
|
+
}
|
|
62
|
+
}, $ = (t) => (e) => {
|
|
63
|
+
var o;
|
|
64
|
+
n || (N(!0), document.addEventListener("mouseup", () => {
|
|
65
|
+
N(!1);
|
|
66
|
+
}, {
|
|
67
|
+
once: !0
|
|
68
|
+
})), (o = t.onMouseDown) == null || o.call(t, e);
|
|
69
|
+
}, C = (t) => (e) => {
|
|
70
|
+
var o;
|
|
71
|
+
if ((o = t.onKeyDown) == null || o.call(t, e), !e.defaultMuiPrevented && (e.target === e.currentTarget && !g() && e.key === " " && e.preventDefault(), e.target === e.currentTarget && e.key === " " && !n && N(!0), e.target === e.currentTarget && !g() && e.key === "Enter" && !n)) {
|
|
72
|
+
var r;
|
|
73
|
+
(r = t.onClick) == null || r.call(t, e), e.preventDefault();
|
|
74
|
+
}
|
|
75
|
+
}, L = (t) => (e) => {
|
|
76
|
+
var o;
|
|
77
|
+
if (e.target === e.currentTarget && N(!1), (o = t.onKeyUp) == null || o.call(t, e), e.target === e.currentTarget && !g() && !n && e.key === " " && !e.defaultMuiPrevented) {
|
|
78
|
+
var r;
|
|
79
|
+
(r = t.onClick) == null || r.call(t, e);
|
|
80
|
+
}
|
|
81
|
+
}, x = S(V, y, U, b), a = {};
|
|
82
|
+
return u !== void 0 && (a.tabIndex = u), f === "BUTTON" ? (a.type = s ?? "button", l ? a["aria-disabled"] = n : a.disabled = n) : f === "INPUT" ? s && ["button", "submit", "reset"].includes(s) && (l ? a["aria-disabled"] = n : a.disabled = n) : f !== "" && (!c && !m && (a.role = "button", a.tabIndex = u ?? 0), n && (a["aria-disabled"] = n, a.tabIndex = l ? u ?? 0 : -1)), {
|
|
83
|
+
getRootProps: (t = {}) => {
|
|
84
|
+
const e = D({}, k(p), k(t)), o = D({
|
|
85
|
+
type: s
|
|
86
|
+
}, e, a, t, {
|
|
87
|
+
onBlur: K(e),
|
|
88
|
+
onClick: I(e),
|
|
89
|
+
onFocus: P(e),
|
|
90
|
+
onKeyDown: C(e),
|
|
91
|
+
onKeyUp: L(e),
|
|
92
|
+
onMouseDown: $(e),
|
|
93
|
+
onMouseLeave: w(e),
|
|
94
|
+
ref: x
|
|
95
|
+
});
|
|
96
|
+
return delete o.onFocusVisible, o;
|
|
97
|
+
},
|
|
98
|
+
focusVisible: d,
|
|
99
|
+
setFocusVisible: R,
|
|
100
|
+
active: B,
|
|
101
|
+
rootRef: x
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export {
|
|
105
|
+
h as u
|
|
106
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as n from "react";
|
|
2
|
+
function d({
|
|
3
|
+
controlled: o,
|
|
4
|
+
default: r,
|
|
5
|
+
name: t,
|
|
6
|
+
state: s = "value"
|
|
7
|
+
}) {
|
|
8
|
+
const {
|
|
9
|
+
current: e
|
|
10
|
+
} = n.useRef(o !== void 0), [l, c] = n.useState(r), u = e ? o : l;
|
|
11
|
+
if (process.env.NODE_ENV !== "production") {
|
|
12
|
+
n.useEffect(() => {
|
|
13
|
+
e !== (o !== void 0) && console.error([`MUI: A component is changing the ${e ? "" : "un"}controlled ${s} state of ${t} to be ${e ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${t} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join(`
|
|
14
|
+
`));
|
|
15
|
+
}, [s, t, o]);
|
|
16
|
+
const {
|
|
17
|
+
current: i
|
|
18
|
+
} = n.useRef(r);
|
|
19
|
+
n.useEffect(() => {
|
|
20
|
+
!e && i !== r && console.error([`MUI: A component is changing the default ${s} state of an uncontrolled ${t} after being initialized. To suppress this warning opt to use a controlled ${t}.`].join(`
|
|
21
|
+
`));
|
|
22
|
+
}, [JSON.stringify(r)]);
|
|
23
|
+
}
|
|
24
|
+
const f = n.useCallback((i) => {
|
|
25
|
+
e || c(i);
|
|
26
|
+
}, []);
|
|
27
|
+
return [u, f];
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
d as u
|
|
31
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as a from "react";
|
|
2
|
+
import { T as o } from "./useTimeout-DxF9kiZL.js";
|
|
3
|
+
let n = !0, s = !1;
|
|
4
|
+
const c = new o(), f = {
|
|
5
|
+
text: !0,
|
|
6
|
+
search: !0,
|
|
7
|
+
url: !0,
|
|
8
|
+
tel: !0,
|
|
9
|
+
email: !0,
|
|
10
|
+
password: !0,
|
|
11
|
+
number: !0,
|
|
12
|
+
date: !0,
|
|
13
|
+
month: !0,
|
|
14
|
+
week: !0,
|
|
15
|
+
time: !0,
|
|
16
|
+
datetime: !0,
|
|
17
|
+
"datetime-local": !0
|
|
18
|
+
};
|
|
19
|
+
function d(e) {
|
|
20
|
+
const {
|
|
21
|
+
type: t,
|
|
22
|
+
tagName: r
|
|
23
|
+
} = e;
|
|
24
|
+
return !!(r === "INPUT" && f[t] && !e.readOnly || r === "TEXTAREA" && !e.readOnly || e.isContentEditable);
|
|
25
|
+
}
|
|
26
|
+
function h(e) {
|
|
27
|
+
e.metaKey || e.altKey || e.ctrlKey || (n = !0);
|
|
28
|
+
}
|
|
29
|
+
function i() {
|
|
30
|
+
n = !1;
|
|
31
|
+
}
|
|
32
|
+
function y() {
|
|
33
|
+
this.visibilityState === "hidden" && s && (n = !0);
|
|
34
|
+
}
|
|
35
|
+
function m(e) {
|
|
36
|
+
e.addEventListener("keydown", h, !0), e.addEventListener("mousedown", i, !0), e.addEventListener("pointerdown", i, !0), e.addEventListener("touchstart", i, !0), e.addEventListener("visibilitychange", y, !0);
|
|
37
|
+
}
|
|
38
|
+
function b(e) {
|
|
39
|
+
const {
|
|
40
|
+
target: t
|
|
41
|
+
} = e;
|
|
42
|
+
try {
|
|
43
|
+
return t.matches(":focus-visible");
|
|
44
|
+
} catch {
|
|
45
|
+
}
|
|
46
|
+
return n || d(t);
|
|
47
|
+
}
|
|
48
|
+
function w() {
|
|
49
|
+
const e = a.useCallback((u) => {
|
|
50
|
+
u != null && m(u.ownerDocument);
|
|
51
|
+
}, []), t = a.useRef(!1);
|
|
52
|
+
function r() {
|
|
53
|
+
return t.current ? (s = !0, c.start(100, () => {
|
|
54
|
+
s = !1;
|
|
55
|
+
}), t.current = !1, !0) : !1;
|
|
56
|
+
}
|
|
57
|
+
function l(u) {
|
|
58
|
+
return b(u) ? (t.current = !0, !0) : !1;
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
isFocusVisibleRef: t,
|
|
62
|
+
onFocus: l,
|
|
63
|
+
onBlur: r,
|
|
64
|
+
ref: e
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
w as u
|
|
69
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as n from "react";
|
|
2
|
+
const u = {};
|
|
3
|
+
function c(t, r) {
|
|
4
|
+
const e = n.useRef(u);
|
|
5
|
+
return e.current === u && (e.current = t(r)), e;
|
|
6
|
+
}
|
|
7
|
+
const i = [];
|
|
8
|
+
function o(t) {
|
|
9
|
+
n.useEffect(t, i);
|
|
10
|
+
}
|
|
11
|
+
class s {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.currentId = null, this.clear = () => {
|
|
14
|
+
this.currentId !== null && (clearTimeout(this.currentId), this.currentId = null);
|
|
15
|
+
}, this.disposeEffect = () => this.clear;
|
|
16
|
+
}
|
|
17
|
+
static create() {
|
|
18
|
+
return new s();
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
22
|
+
*/
|
|
23
|
+
start(r, e) {
|
|
24
|
+
this.clear(), this.currentId = setTimeout(() => {
|
|
25
|
+
this.currentId = null, e();
|
|
26
|
+
}, r);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function f() {
|
|
30
|
+
const t = c(s.create).current;
|
|
31
|
+
return o(t.disposeEffect), t;
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
s as T,
|
|
35
|
+
f as u
|
|
36
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Split } from '../types/helpers';
|
|
2
|
+
|
|
3
|
+
export type BlockType<T extends string> = Split<T, '-'>[0];
|
|
4
|
+
export declare const bemify: <T extends string>(variant: T, blocksWithElements: BlockType<T>[]) => string;
|
|
5
|
+
export declare const getBEMBase: (variant: string) => string;
|
|
6
|
+
export declare const getBEMBlock: (variant: string) => string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const s = (e, n) => {
|
|
2
|
+
const r = new RegExp(`^([${n.join("|")}]*)-`);
|
|
3
|
+
let t = e.replace(r, "$1__");
|
|
4
|
+
return t = t.replace(new RegExp("(?<!-)-(?!-)", "g"), "--"), t;
|
|
5
|
+
}, c = (e) => e.split("--")[0], l = (e) => e.split(/--|__/)[0];
|
|
6
|
+
export {
|
|
7
|
+
s as bemify,
|
|
8
|
+
c as getBEMBase,
|
|
9
|
+
l as getBEMBlock
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { bemify as a, getBEMBase as e, getBEMBlock as r } from "./styleStrings.js";
|
|
2
|
+
import { d as s, i as o, g as t } from "../vi.Y_w82WR8-Df0JUamG.js";
|
|
3
|
+
s("styleStrings", () => {
|
|
4
|
+
s("bemify", () => {
|
|
5
|
+
o("returns just a block if a block was only given", () => {
|
|
6
|
+
t(a("foo", ["bar"])).toEqual("foo");
|
|
7
|
+
}), o("returns just a block and modifier if no elements for that block", () => {
|
|
8
|
+
t(a("foo-baz", ["bar"])).toEqual("foo--baz");
|
|
9
|
+
}), o("returns just block and element if it is a block with elements", () => {
|
|
10
|
+
t(a("bar-baz", ["bar"])).toEqual("bar__baz");
|
|
11
|
+
}), o("returns block, element and modifier if it has all three parts", () => {
|
|
12
|
+
t(a("bar-baz-qux", ["bar"])).toEqual("bar__baz--qux");
|
|
13
|
+
}), o("accepts alternative types for the generic variants type", () => {
|
|
14
|
+
t(a("abc-def", ["abc"])).toEqual("abc__def");
|
|
15
|
+
});
|
|
16
|
+
}), s("getBEMBase", () => {
|
|
17
|
+
o("returns the base BEM of a Block with no elements or modifiers", () => {
|
|
18
|
+
t(e("foo")).toEqual("foo");
|
|
19
|
+
}), o("returns the base BEM of a Block with an element but no modifiers", () => {
|
|
20
|
+
t(e("foo__bar")).toEqual("foo__bar");
|
|
21
|
+
}), o("returns the base BEM of a Block with no elements but a modifier", () => {
|
|
22
|
+
t(e("foo--baz")).toEqual("foo");
|
|
23
|
+
}), o("returns the base BEM of a Block with an element and a modifier", () => {
|
|
24
|
+
t(e("foo__bar--baz")).toEqual("foo__bar");
|
|
25
|
+
}), o("returns empty if given nothing", () => {
|
|
26
|
+
t(e("")).toEqual("");
|
|
27
|
+
});
|
|
28
|
+
}), s("getBEMBlock", () => {
|
|
29
|
+
o("returns the block part of a full BEM style string", () => {
|
|
30
|
+
t(r("foo__bar--baz")).toEqual("foo");
|
|
31
|
+
}), o("returns the block part of a BEM style string that has just block and element", () => {
|
|
32
|
+
t(r("foo__bar")).toEqual("foo");
|
|
33
|
+
}), o("returns the block part of a BEM style string that has just block and modifier", () => {
|
|
34
|
+
t(r("foo--baz")).toEqual("foo");
|
|
35
|
+
}), o("returns the block part of a BEM style string that has just a block", () => {
|
|
36
|
+
t(r("foo")).toEqual("foo");
|
|
37
|
+
}), o("returns nothing if nothing passed in", () => {
|
|
38
|
+
t(r("")).toEqual("");
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
});
|