@shiflo/ui 0.0.10 → 0.0.12
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/components/BottomSheet/BottomSheet.mjs +17 -16
- package/dist/components/BottomSheet/BottomSheet.typing.d.ts +1 -1
- package/dist/components/Dialog/Dialog.d.ts +3 -0
- package/dist/components/Dialog/Dialog.mjs +71 -0
- package/dist/components/Dialog/Dialog.typing.d.ts +6 -0
- package/dist/components/Dialog/index.d.ts +4 -0
- package/dist/components/Dialog/index.mjs +4 -0
- package/dist/components/Icon/Icon.mjs +4 -4
- package/dist/components/Icon/Icon.typing.d.ts +3 -1
- package/dist/components/Overlay/Overlay.d.ts +1 -1
- package/dist/components/Overlay/Overlay.mjs +46 -38
- package/dist/components/Overlay/Overlay.typing.d.ts +1 -1
- package/dist/components/Snackbar/Snackbar.d.ts +3 -0
- package/dist/components/Snackbar/Snackbar.mjs +111 -0
- package/dist/components/Snackbar/Snackbar.typing.d.ts +10 -0
- package/dist/components/Snackbar/index.d.ts +4 -0
- package/dist/components/Snackbar/index.mjs +4 -0
- package/dist/components/Switch/Switch.d.ts +3 -0
- package/dist/components/Switch/Switch.mjs +102 -0
- package/dist/components/Switch/Switch.typing.d.ts +8 -0
- package/dist/components/Switch/index.d.ts +4 -0
- package/dist/components/Switch/index.mjs +4 -0
- package/dist/components/TextField/TextField.d.ts +3 -0
- package/dist/components/TextField/TextField.mjs +189 -0
- package/dist/components/TextField/TextField.typing.d.ts +8 -0
- package/dist/components/TextField/index.d.ts +4 -0
- package/dist/components/TextField/index.mjs +4 -0
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ const J = b.div`
|
|
|
7
7
|
max-height: calc(100% - ${({ theme: { spacing: t } }) => t[800]});
|
|
8
8
|
overflow-y: auto;
|
|
9
9
|
margin: ${({ theme: { spacing: t } }) => t[400]};
|
|
10
|
+
margin-bottom: ${({ theme: { spacing: t } }) => `calc(${t[400]} + var(--safe-area-inset-bottom, 0px))`};
|
|
10
11
|
border-radius: ${({ theme: { radius: t } }) => t[150]};
|
|
11
12
|
background-color: ${({
|
|
12
13
|
theme: {
|
|
@@ -48,16 +49,16 @@ function _({
|
|
|
48
49
|
onClose: c,
|
|
49
50
|
children: T,
|
|
50
51
|
transitionDuration: s = 200,
|
|
51
|
-
onClick:
|
|
52
|
+
onClick: $,
|
|
52
53
|
ref: j,
|
|
53
|
-
hideDragHandleBar:
|
|
54
|
-
style:
|
|
55
|
-
...
|
|
54
|
+
hideDragHandleBar: I,
|
|
55
|
+
style: O,
|
|
56
|
+
...A
|
|
56
57
|
}) {
|
|
57
|
-
const [
|
|
58
|
+
const [L, h] = V(!1), l = o(null), R = o(null), i = o(null), d = o(!1), v = o(0), f = o(0), m = o(0), g = o(0), p = o(0), F = o(0.25);
|
|
58
59
|
z(j, () => l.current);
|
|
59
60
|
const W = (r) => {
|
|
60
|
-
r.stopPropagation(), typeof
|
|
61
|
+
r.stopPropagation(), typeof $ == "function" && $(r);
|
|
61
62
|
};
|
|
62
63
|
return S(() => {
|
|
63
64
|
let r;
|
|
@@ -69,7 +70,7 @@ function _({
|
|
|
69
70
|
}, [t]), S(() => {
|
|
70
71
|
const r = l.current, n = R.current, k = (e) => {
|
|
71
72
|
r && (r.scrollTop > 0 || (d.current = !0, v.current = e, f.current = e, m.current = r.offsetHeight, p.current = Date.now(), r.style.transition = "none", r.style.cursor = "grabbing", n && (n.style.transition = "none"), i.current && (i.current.style.cursor = "grabbing")));
|
|
72
|
-
},
|
|
73
|
+
}, x = (e) => {
|
|
73
74
|
if (!r || !d.current) return;
|
|
74
75
|
const u = e - v.current;
|
|
75
76
|
if (u < 0) return;
|
|
@@ -83,13 +84,13 @@ function _({
|
|
|
83
84
|
}, a = () => {
|
|
84
85
|
if (!r || !d.current) return;
|
|
85
86
|
d.current = !1, r.style.cursor = "default", i.current && (i.current.style.cursor = "grab");
|
|
86
|
-
const e = f.current - v.current, u = m.current *
|
|
87
|
+
const e = f.current - v.current, u = m.current * F.current;
|
|
87
88
|
r.style.transition = `transform ${s}ms ease-out`, n && (n.style.transition = `opacity ${s}ms ease-out`), e > u || g.current > 0.5 && g.current > 0 ? (r.style.transform = "translate3d(0, 200%, 0)", n && (n.style.opacity = "0"), c == null || c()) : (r.style.transform = "translate3d(0, 0, 0)", n && (n.style.opacity = "1"));
|
|
88
|
-
},
|
|
89
|
-
return r == null || r.addEventListener("mousedown",
|
|
90
|
-
r == null || r.removeEventListener("mousedown",
|
|
89
|
+
}, w = (e) => k(e.clientY), H = (e) => x(e.clientY), Y = (e) => k(e.touches[0].clientY), B = (e) => x(e.touches[0].clientY);
|
|
90
|
+
return r == null || r.addEventListener("mousedown", w), r == null || r.addEventListener("mousemove", H), r == null || r.addEventListener("mouseup", a), r == null || r.addEventListener("mouseleave", a), r == null || r.addEventListener("touchstart", Y), r == null || r.addEventListener("touchmove", B), r == null || r.addEventListener("touchend", a), r == null || r.addEventListener("touchcancel", a), () => {
|
|
91
|
+
r == null || r.removeEventListener("mousedown", w), r == null || r.removeEventListener("mousemove", H), r == null || r.removeEventListener("mouseup", a), r == null || r.removeEventListener("mouseleave", a), r == null || r.removeEventListener("touchstart", Y), r == null || r.removeEventListener("touchmove", B), r == null || r.removeEventListener("touchend", a), r == null || r.removeEventListener("touchcancel", a);
|
|
91
92
|
};
|
|
92
|
-
}, [
|
|
93
|
+
}, [L, c, s]), /* @__PURE__ */ y(
|
|
93
94
|
G,
|
|
94
95
|
{
|
|
95
96
|
ref: R,
|
|
@@ -104,13 +105,13 @@ function _({
|
|
|
104
105
|
ease: t ? "in" : "out",
|
|
105
106
|
transitionDuration: s,
|
|
106
107
|
onClick: W,
|
|
107
|
-
...
|
|
108
|
+
...A,
|
|
108
109
|
style: {
|
|
109
|
-
transform: `translate3d(0, ${
|
|
110
|
-
...
|
|
110
|
+
transform: `translate3d(0, ${L ? "0" : "200%"}, 0)`,
|
|
111
|
+
...O
|
|
111
112
|
},
|
|
112
113
|
children: [
|
|
113
|
-
!
|
|
114
|
+
!I && /* @__PURE__ */ y(K, { ref: i, children: /* @__PURE__ */ y(N, {}) }),
|
|
114
115
|
T
|
|
115
116
|
]
|
|
116
117
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useState as d, useRef as $, useEffect as p } from "react";
|
|
3
|
+
import h from "basic-styled";
|
|
4
|
+
import g from "../Overlay/Overlay.mjs";
|
|
5
|
+
const y = h.div`
|
|
6
|
+
width: calc(100% - ${({ theme: { spacing: e } }) => e[800]});
|
|
7
|
+
max-height: calc(100% - ${({ theme: { spacing: e } }) => e[800]});
|
|
8
|
+
overflow-y: auto;
|
|
9
|
+
margin: ${({ theme: { spacing: e } }) => e[400]};
|
|
10
|
+
margin-bottom: ${({ theme: { spacing: e } }) => `calc(${e[400]} + var(--safe-area-inset-bottom, 0px))`};
|
|
11
|
+
border-radius: ${({ theme: { radius: e } }) => e[150]};
|
|
12
|
+
background-color: ${({
|
|
13
|
+
theme: {
|
|
14
|
+
palette: { common: e }
|
|
15
|
+
}
|
|
16
|
+
}) => e.background};
|
|
17
|
+
transition:
|
|
18
|
+
transform ${({ transitionDuration: e }) => `${e}ms`}
|
|
19
|
+
${({ ease: e }) => e === "in" ? "ease-out" : "ease-in"},
|
|
20
|
+
opacity ${({ transitionDuration: e }) => `${e}ms`}
|
|
21
|
+
${({ ease: e }) => e === "in" ? "ease-out" : "ease-in"},
|
|
22
|
+
background-color 0.2s;
|
|
23
|
+
`;
|
|
24
|
+
function O({
|
|
25
|
+
open: e,
|
|
26
|
+
onClose: n,
|
|
27
|
+
children: m,
|
|
28
|
+
transitionDuration: a = 200,
|
|
29
|
+
onClick: o,
|
|
30
|
+
style: l,
|
|
31
|
+
...c
|
|
32
|
+
}) {
|
|
33
|
+
const [r, i] = d(!1), f = $(null), u = (t) => {
|
|
34
|
+
t.stopPropagation(), typeof o == "function" && o(t);
|
|
35
|
+
};
|
|
36
|
+
return p(() => {
|
|
37
|
+
let t;
|
|
38
|
+
return e ? t = requestAnimationFrame(() => {
|
|
39
|
+
i(!0);
|
|
40
|
+
}) : i(!1), () => {
|
|
41
|
+
t && cancelAnimationFrame(t);
|
|
42
|
+
};
|
|
43
|
+
}, [e]), /* @__PURE__ */ s(
|
|
44
|
+
g,
|
|
45
|
+
{
|
|
46
|
+
ref: f,
|
|
47
|
+
open: e,
|
|
48
|
+
onClose: n,
|
|
49
|
+
transitionDuration: a,
|
|
50
|
+
placement: "center-middle",
|
|
51
|
+
children: /* @__PURE__ */ s(
|
|
52
|
+
y,
|
|
53
|
+
{
|
|
54
|
+
ease: e ? "in" : "out",
|
|
55
|
+
transitionDuration: a,
|
|
56
|
+
onClick: u,
|
|
57
|
+
...c,
|
|
58
|
+
style: {
|
|
59
|
+
transform: `scale(${r ? 1 : 0.9})`,
|
|
60
|
+
opacity: r ? 1 : 0,
|
|
61
|
+
...l
|
|
62
|
+
},
|
|
63
|
+
children: m
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
O as default
|
|
71
|
+
};
|
|
@@ -9,11 +9,11 @@ const f = c.svg`
|
|
|
9
9
|
height 0.2s,
|
|
10
10
|
color 0.2s;
|
|
11
11
|
|
|
12
|
-
width: ${({ width: t }) => t ||
|
|
13
|
-
height: ${({ height: t }) => t ||
|
|
12
|
+
width: ${({ width: t }) => `${t || 24}px`};
|
|
13
|
+
height: ${({ height: t }) => `${t || 24}px`};
|
|
14
14
|
color: ${({ theme: { palette: t }, color: r }) => d(t, r || "") || "inherit"};
|
|
15
15
|
`;
|
|
16
|
-
function
|
|
16
|
+
function S({ ref: t, name: r, width: e = 24, height: n = 24, ...s }) {
|
|
17
17
|
const h = a[r];
|
|
18
18
|
return p.map(h(), (i) => {
|
|
19
19
|
if (!l(i))
|
|
@@ -26,5 +26,5 @@ function v({ ref: t, name: r, width: e = 24, height: n = 24, ...s }) {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
export {
|
|
29
|
-
|
|
29
|
+
S as default
|
|
30
30
|
};
|
|
@@ -5,5 +5,7 @@ import type * as Svgs from "../../assets/icons";
|
|
|
5
5
|
export interface BaseIconProps extends Pick<UtilityProps, "css"> {
|
|
6
6
|
name: keyof typeof Svgs;
|
|
7
7
|
color?: RecursionPath<BasicTheme["palette"]> | "inherit";
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
8
10
|
}
|
|
9
|
-
export type IconProps = BaseIconProps & Omit<ComponentPropsWithRef<"svg">, "children">;
|
|
11
|
+
export type IconProps = BaseIconProps & Omit<ComponentPropsWithRef<"svg">, "children" | "width" | "height">;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { OverlayProps } from './Overlay.typing';
|
|
2
|
-
declare function Overlay({ children, open, onClose, transitionDuration, placement, style, ...props }: OverlayProps): import('react').ReactPortal | null;
|
|
2
|
+
declare function Overlay({ children, open, onClose, transitionDuration, placement, style, ref, ...props }: OverlayProps): import('react').ReactPortal | null;
|
|
3
3
|
export default Overlay;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import
|
|
5
|
-
const
|
|
1
|
+
import { jsxs as j, jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useState as c, useRef as h, useImperativeHandle as O, useLayoutEffect as I, useEffect as k } from "react";
|
|
3
|
+
import { createPortal as C } from "react-dom";
|
|
4
|
+
import i from "basic-styled";
|
|
5
|
+
const v = i.div`
|
|
6
6
|
position: fixed;
|
|
7
7
|
top: 0;
|
|
8
8
|
left: 0;
|
|
9
9
|
width: 100%;
|
|
10
10
|
height: 100%;
|
|
11
|
-
|
|
11
|
+
z-index: 1;
|
|
12
|
+
`, $ = i.div`
|
|
12
13
|
position: fixed;
|
|
13
14
|
top: 0;
|
|
14
15
|
left: 0;
|
|
@@ -16,23 +17,23 @@ const j = a.div`
|
|
|
16
17
|
height: 100%;
|
|
17
18
|
background-color: ${({
|
|
18
19
|
theme: {
|
|
19
|
-
palette: { common:
|
|
20
|
+
palette: { common: n }
|
|
20
21
|
}
|
|
21
|
-
}) =>
|
|
22
|
+
}) => n.overlay};
|
|
22
23
|
transition:
|
|
23
|
-
opacity ${({ transitionDuration:
|
|
24
|
-
${({ ease:
|
|
24
|
+
opacity ${({ transitionDuration: n }) => `${n}ms`}
|
|
25
|
+
${({ ease: n }) => n === "in" ? "ease-in" : "ease-out"},
|
|
25
26
|
background-color 0.2s;
|
|
26
|
-
`,
|
|
27
|
+
`, w = i.div`
|
|
27
28
|
position: fixed;
|
|
28
29
|
top: 0;
|
|
29
30
|
left: 0;
|
|
30
31
|
width: 100%;
|
|
31
32
|
height: 100%;
|
|
32
33
|
|
|
33
|
-
${({ placement:
|
|
34
|
+
${({ placement: n }) => {
|
|
34
35
|
const e = {};
|
|
35
|
-
switch (
|
|
36
|
+
switch (n) {
|
|
36
37
|
case "top-left":
|
|
37
38
|
Object.assign(e, {
|
|
38
39
|
display: "flex",
|
|
@@ -100,44 +101,51 @@ const j = a.div`
|
|
|
100
101
|
return e;
|
|
101
102
|
}}
|
|
102
103
|
`;
|
|
103
|
-
function
|
|
104
|
-
children:
|
|
104
|
+
function R({
|
|
105
|
+
children: n,
|
|
105
106
|
open: e,
|
|
106
|
-
onClose:
|
|
107
|
-
transitionDuration:
|
|
108
|
-
placement:
|
|
109
|
-
style:
|
|
110
|
-
|
|
107
|
+
onClose: d,
|
|
108
|
+
transitionDuration: a = 200,
|
|
109
|
+
placement: u,
|
|
110
|
+
style: y,
|
|
111
|
+
ref: m,
|
|
112
|
+
...p
|
|
111
113
|
}) {
|
|
112
|
-
const [
|
|
113
|
-
return
|
|
114
|
-
let
|
|
115
|
-
return e ? (
|
|
116
|
-
r(!0);
|
|
117
|
-
})) : (r(!1), i = setTimeout(() => {
|
|
114
|
+
const [x, r] = c(!0), [g, l] = c(!1), s = h(null);
|
|
115
|
+
return O(m, () => s.current), I(() => {
|
|
116
|
+
let t;
|
|
117
|
+
return e ? (r(!1), t = requestAnimationFrame(() => {
|
|
118
118
|
l(!0);
|
|
119
|
-
}
|
|
120
|
-
|
|
119
|
+
})) : l(!1), () => {
|
|
120
|
+
t && cancelAnimationFrame(t);
|
|
121
121
|
};
|
|
122
|
-
}, [e,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
}, [e, a]), k(() => {
|
|
123
|
+
const t = s.current, o = (b) => {
|
|
124
|
+
e || b.propertyName === "opacity" && r(!0);
|
|
125
|
+
};
|
|
126
|
+
return t == null || t.addEventListener("transitionend", o), () => {
|
|
127
|
+
t == null || t.removeEventListener("transitionend", o);
|
|
128
|
+
};
|
|
129
|
+
}, [e]), x ? null : C(
|
|
130
|
+
/* @__PURE__ */ j(v, { onClick: d, children: [
|
|
131
|
+
/* @__PURE__ */ f(
|
|
132
|
+
$,
|
|
126
133
|
{
|
|
127
|
-
|
|
134
|
+
ref: s,
|
|
135
|
+
transitionDuration: a,
|
|
128
136
|
ease: e ? "in" : "out",
|
|
129
137
|
style: {
|
|
130
|
-
opacity:
|
|
131
|
-
...
|
|
138
|
+
opacity: g ? 1 : 0,
|
|
139
|
+
...y
|
|
132
140
|
},
|
|
133
|
-
...
|
|
141
|
+
...p
|
|
134
142
|
}
|
|
135
143
|
),
|
|
136
|
-
/* @__PURE__ */
|
|
144
|
+
/* @__PURE__ */ f(w, { placement: u, children: n })
|
|
137
145
|
] }),
|
|
138
146
|
document.body
|
|
139
147
|
);
|
|
140
148
|
}
|
|
141
149
|
export {
|
|
142
|
-
|
|
150
|
+
R as default
|
|
143
151
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
2
|
export interface OverlayProps extends ComponentPropsWithRef<"div"> {
|
|
3
3
|
open?: boolean;
|
|
4
|
-
onClose
|
|
4
|
+
onClose?: () => void;
|
|
5
5
|
transitionDuration?: number;
|
|
6
6
|
placement?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | "center-top" | "center-bottom" | "center-middle" | "center-left" | "center-right";
|
|
7
7
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SnackbarProps } from './Snackbar.typing';
|
|
2
|
+
declare function Snackbar({ children, open, onClose, transitionDuration, style, ref, startIcon, action, autoHideDuration, disableAutoHide, ...props }: SnackbarProps): import('react').ReactPortal | null;
|
|
3
|
+
export default Snackbar;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsxs as z, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useState as x, useRef as y, useImperativeHandle as A, useLayoutEffect as I, useEffect as v } from "react";
|
|
3
|
+
import { createPortal as L } from "react-dom";
|
|
4
|
+
import a from "basic-styled";
|
|
5
|
+
const R = a.div`
|
|
6
|
+
position: fixed;
|
|
7
|
+
bottom: ${({ theme: { spacing: e } }) => `calc(${e[800]} + var(--safe-area-inset-bottom, 0px))`};
|
|
8
|
+
left: 50%;
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: ${({ theme: { spacing: e } }) => e[400]};
|
|
12
|
+
width: 100%;
|
|
13
|
+
max-width: calc(100% - ${({ theme: { spacing: e } }) => e[800]});
|
|
14
|
+
min-height: 56px;
|
|
15
|
+
padding: ${({ theme: { spacing: e } }) => e[400]};
|
|
16
|
+
background-color: ${({
|
|
17
|
+
theme: {
|
|
18
|
+
palette: { neutral: e }
|
|
19
|
+
}
|
|
20
|
+
}) => e[900]};
|
|
21
|
+
border-radius: ${({ theme: { radius: e } }) => e[400]};
|
|
22
|
+
z-index: 1;
|
|
23
|
+
|
|
24
|
+
transition:
|
|
25
|
+
opacity ${({ transitionDuration: e }) => `${e}ms`}
|
|
26
|
+
${({ ease: e }) => e === "in" ? "ease-in" : "ease-out"},
|
|
27
|
+
transform ${({ transitionDuration: e }) => `${e}ms`},
|
|
28
|
+
background-color 0.2s;
|
|
29
|
+
`, T = a.div`
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
`, j = a.div`
|
|
32
|
+
flex-grow: 1;
|
|
33
|
+
display: -webkit-box;
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
-webkit-line-clamp: 2;
|
|
36
|
+
-webkit-box-orient: vertical;
|
|
37
|
+
|
|
38
|
+
${({
|
|
39
|
+
theme: {
|
|
40
|
+
palette: { common: e },
|
|
41
|
+
typography: { body2: r }
|
|
42
|
+
}
|
|
43
|
+
}) => ({
|
|
44
|
+
fontSize: r.fontSize,
|
|
45
|
+
lineHeight: r.lineHeight,
|
|
46
|
+
color: e.surface
|
|
47
|
+
})}
|
|
48
|
+
`, E = a.div`
|
|
49
|
+
white-space: nowrap;
|
|
50
|
+
`;
|
|
51
|
+
function H({
|
|
52
|
+
children: e,
|
|
53
|
+
open: r,
|
|
54
|
+
onClose: n,
|
|
55
|
+
transitionDuration: l = 200,
|
|
56
|
+
style: w,
|
|
57
|
+
ref: g,
|
|
58
|
+
startIcon: f,
|
|
59
|
+
action: m,
|
|
60
|
+
autoHideDuration: d = 3e3,
|
|
61
|
+
disableAutoHide: u,
|
|
62
|
+
...b
|
|
63
|
+
}) {
|
|
64
|
+
const [S, p] = x(!0), [i, h] = x(!1), s = y(null), o = y(null);
|
|
65
|
+
return A(g, () => s.current), I(() => {
|
|
66
|
+
let t;
|
|
67
|
+
return r ? (p(!1), t = requestAnimationFrame(() => {
|
|
68
|
+
h(!0);
|
|
69
|
+
})) : h(!1), () => {
|
|
70
|
+
t && cancelAnimationFrame(t);
|
|
71
|
+
};
|
|
72
|
+
}, [r, l]), v(() => {
|
|
73
|
+
const t = s.current, $ = (k) => {
|
|
74
|
+
r || k.propertyName === "opacity" && p(!0);
|
|
75
|
+
};
|
|
76
|
+
return t == null || t.addEventListener("transitionend", $), () => {
|
|
77
|
+
t == null || t.removeEventListener("transitionend", $);
|
|
78
|
+
};
|
|
79
|
+
}, [r]), v(() => {
|
|
80
|
+
if (!(u || !i))
|
|
81
|
+
return o.current = setTimeout(() => {
|
|
82
|
+
n == null || n();
|
|
83
|
+
}, d), () => {
|
|
84
|
+
o.current && clearTimeout(o.current);
|
|
85
|
+
};
|
|
86
|
+
}, [u, d, i, n]), S ? null : L(
|
|
87
|
+
/* @__PURE__ */ z(
|
|
88
|
+
R,
|
|
89
|
+
{
|
|
90
|
+
ref: s,
|
|
91
|
+
transitionDuration: l,
|
|
92
|
+
ease: r ? "in" : "out",
|
|
93
|
+
style: {
|
|
94
|
+
opacity: i ? 1 : 0,
|
|
95
|
+
transform: i ? "translate3d(-50%, 0, 0) scale(1)" : "translate3d(-50%, 0, 0) scale(0.97)",
|
|
96
|
+
...w
|
|
97
|
+
},
|
|
98
|
+
...b,
|
|
99
|
+
children: [
|
|
100
|
+
f && /* @__PURE__ */ c(T, { children: f }),
|
|
101
|
+
/* @__PURE__ */ c(j, { children: e }),
|
|
102
|
+
m && /* @__PURE__ */ c(E, { children: m })
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
document.body
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
export {
|
|
110
|
+
H as default
|
|
111
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode, ComponentPropsWithRef } from 'react';
|
|
2
|
+
export interface SnackbarProps extends ComponentPropsWithRef<"div"> {
|
|
3
|
+
open?: boolean;
|
|
4
|
+
onClose?: () => void;
|
|
5
|
+
transitionDuration?: number;
|
|
6
|
+
startIcon?: ReactNode;
|
|
7
|
+
action?: ReactNode;
|
|
8
|
+
autoHideDuration?: number;
|
|
9
|
+
disableAutoHide?: boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import l from "basic-styled";
|
|
3
|
+
const c = l.button`
|
|
4
|
+
position: relative;
|
|
5
|
+
border-radius: 9999px;
|
|
6
|
+
transition:
|
|
7
|
+
width 0.2s,
|
|
8
|
+
height 0.2s,
|
|
9
|
+
background-color 0.2s;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
|
|
12
|
+
${({ theme: { palette: t }, checked: r, disabled: o, size: i }) => {
|
|
13
|
+
const e = {};
|
|
14
|
+
switch (i) {
|
|
15
|
+
case "small":
|
|
16
|
+
Object.assign(e, {
|
|
17
|
+
width: "40px",
|
|
18
|
+
height: "24px",
|
|
19
|
+
"&::after": {
|
|
20
|
+
width: "16px",
|
|
21
|
+
height: "16px"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
break;
|
|
25
|
+
case "large":
|
|
26
|
+
Object.assign(e, {
|
|
27
|
+
width: "56px",
|
|
28
|
+
height: "32px",
|
|
29
|
+
"&::after": {
|
|
30
|
+
width: "24px",
|
|
31
|
+
height: "24px"
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
break;
|
|
35
|
+
default:
|
|
36
|
+
Object.assign(e, {
|
|
37
|
+
width: "48px",
|
|
38
|
+
height: "28px",
|
|
39
|
+
"&::after": {
|
|
40
|
+
width: "20px",
|
|
41
|
+
height: "20px"
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
return r ? Object.assign(e, {
|
|
47
|
+
backgroundColor: t.primary.main
|
|
48
|
+
}) : Object.assign(e, {
|
|
49
|
+
backgroundColor: t.neutral[300]
|
|
50
|
+
}), o && Object.assign(e, {
|
|
51
|
+
backgroundColor: t.neutral[200]
|
|
52
|
+
}), e;
|
|
53
|
+
}};
|
|
54
|
+
|
|
55
|
+
&::after {
|
|
56
|
+
content: "";
|
|
57
|
+
position: absolute;
|
|
58
|
+
top: 50%;
|
|
59
|
+
left: 0;
|
|
60
|
+
background-color: ${({
|
|
61
|
+
theme: {
|
|
62
|
+
palette: { common: t }
|
|
63
|
+
}
|
|
64
|
+
}) => t.background};
|
|
65
|
+
border-radius: 50%;
|
|
66
|
+
transition:
|
|
67
|
+
width 0.2s,
|
|
68
|
+
height 0.2s,
|
|
69
|
+
background-color 0.2s,
|
|
70
|
+
transform 0.2s ${({ ease: t }) => t === "in" ? "ease-in" : "ease-out"};
|
|
71
|
+
transform: ${({ theme: { spacing: t }, checked: r }) => r ? `translate3d(calc(100% + ${t[100]}), -50%, 0)` : `translate3d(${t[100]}, -50%, 0)`};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&:disabled {
|
|
75
|
+
cursor: not-allowed;
|
|
76
|
+
}
|
|
77
|
+
`;
|
|
78
|
+
function f({
|
|
79
|
+
checked: t = !1,
|
|
80
|
+
disabled: r = !1,
|
|
81
|
+
size: o = "medium",
|
|
82
|
+
onChange: i,
|
|
83
|
+
onClick: e,
|
|
84
|
+
...s
|
|
85
|
+
}) {
|
|
86
|
+
return /* @__PURE__ */ n(
|
|
87
|
+
c,
|
|
88
|
+
{
|
|
89
|
+
size: o,
|
|
90
|
+
checked: t,
|
|
91
|
+
disabled: r,
|
|
92
|
+
ease: t ? "in" : "out",
|
|
93
|
+
onClick: (a) => {
|
|
94
|
+
!r && typeof i == "function" && i(a, !t), typeof e == "function" && e(a);
|
|
95
|
+
},
|
|
96
|
+
...s
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
f as default
|
|
102
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, MouseEvent } from 'react';
|
|
2
|
+
import { UtilityProps } from '../../typings/utility';
|
|
3
|
+
export interface SwitchProps extends Omit<ComponentPropsWithRef<"button">, "onChange">, Pick<UtilityProps, "css"> {
|
|
4
|
+
checked?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
size?: "small" | "medium" | "large";
|
|
7
|
+
onChange?: (event: MouseEvent<HTMLButtonElement>, checked: boolean) => void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { jsxs as u, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p } from "react";
|
|
3
|
+
import s from "basic-styled";
|
|
4
|
+
const m = s.div`
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
gap: ${({ theme: { spacing: e } }) => e[200]};
|
|
8
|
+
border: 1px solid transparent;
|
|
9
|
+
border-radius: ${({ theme: { radius: e } }) => e[200]};
|
|
10
|
+
transition:
|
|
11
|
+
background-color 0.2s,
|
|
12
|
+
border-color 0.2s,
|
|
13
|
+
padding 0.2s,
|
|
14
|
+
font-size 0.2s,
|
|
15
|
+
font-weight 0.2s,
|
|
16
|
+
color 0.2s;
|
|
17
|
+
background-color: ${({
|
|
18
|
+
theme: {
|
|
19
|
+
palette: { common: e }
|
|
20
|
+
}
|
|
21
|
+
}) => e.background};
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
|
|
24
|
+
${({
|
|
25
|
+
theme: {
|
|
26
|
+
palette: { border: e, secondary: n }
|
|
27
|
+
},
|
|
28
|
+
variant: o
|
|
29
|
+
}) => {
|
|
30
|
+
const t = {};
|
|
31
|
+
switch (o) {
|
|
32
|
+
case "outlined":
|
|
33
|
+
Object.assign(t, {
|
|
34
|
+
borderColor: e.main
|
|
35
|
+
});
|
|
36
|
+
break;
|
|
37
|
+
default:
|
|
38
|
+
Object.assign(t, {
|
|
39
|
+
backgroundColor: n.main,
|
|
40
|
+
borderColor: "transparent"
|
|
41
|
+
});
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
}};
|
|
46
|
+
|
|
47
|
+
${({
|
|
48
|
+
theme: {
|
|
49
|
+
spacing: e,
|
|
50
|
+
typography: { small1: n, body2: o, body1: t }
|
|
51
|
+
},
|
|
52
|
+
size: r
|
|
53
|
+
}) => {
|
|
54
|
+
const i = {};
|
|
55
|
+
switch (r) {
|
|
56
|
+
case "small":
|
|
57
|
+
Object.assign(i, {
|
|
58
|
+
padding: `${e[100]} ${e[150]}`,
|
|
59
|
+
fontSize: n.fontSize,
|
|
60
|
+
lineHeight: n.lineHeight,
|
|
61
|
+
"& svg": {
|
|
62
|
+
width: n.fontSize,
|
|
63
|
+
height: n.fontSize
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
break;
|
|
67
|
+
case "large":
|
|
68
|
+
Object.assign(i, {
|
|
69
|
+
padding: `${e[300]} ${e[350]}`,
|
|
70
|
+
fontSize: t.fontSize,
|
|
71
|
+
lineHeight: t.lineHeight,
|
|
72
|
+
"& svg": {
|
|
73
|
+
width: t.fontSize,
|
|
74
|
+
height: t.fontSize
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
break;
|
|
78
|
+
default:
|
|
79
|
+
Object.assign(i, {
|
|
80
|
+
padding: `${e[200]} ${e[250]}`,
|
|
81
|
+
fontSize: o.fontSize,
|
|
82
|
+
lineHeight: o.lineHeight,
|
|
83
|
+
"& svg": {
|
|
84
|
+
width: o.fontSize,
|
|
85
|
+
height: o.fontSize
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
return i;
|
|
91
|
+
}};
|
|
92
|
+
|
|
93
|
+
${({
|
|
94
|
+
theme: {
|
|
95
|
+
palette: { primary: e }
|
|
96
|
+
},
|
|
97
|
+
variant: n,
|
|
98
|
+
focused: o
|
|
99
|
+
}) => {
|
|
100
|
+
const t = {};
|
|
101
|
+
return n === "outlined" && o && Object.assign(t, {
|
|
102
|
+
borderColor: e.main,
|
|
103
|
+
"& svg": {
|
|
104
|
+
color: e.main
|
|
105
|
+
}
|
|
106
|
+
}), t;
|
|
107
|
+
}};
|
|
108
|
+
|
|
109
|
+
${({ fullWidth: e }) => e ? {
|
|
110
|
+
width: "100%",
|
|
111
|
+
maxWidth: "100%",
|
|
112
|
+
flexGrow: 1
|
|
113
|
+
} : {
|
|
114
|
+
width: "fit-content"
|
|
115
|
+
}};
|
|
116
|
+
|
|
117
|
+
${({
|
|
118
|
+
theme: {
|
|
119
|
+
palette: { neutral: e }
|
|
120
|
+
},
|
|
121
|
+
disabled: n
|
|
122
|
+
}) => n ? {
|
|
123
|
+
backgroundColor: e[200],
|
|
124
|
+
color: e[500],
|
|
125
|
+
cursor: "not-allowed"
|
|
126
|
+
} : {}};
|
|
127
|
+
`, b = s.input`
|
|
128
|
+
flex-grow: 1;
|
|
129
|
+
border: none;
|
|
130
|
+
outline: none;
|
|
131
|
+
background-color: transparent;
|
|
132
|
+
|
|
133
|
+
&::placeholder {
|
|
134
|
+
color: ${({
|
|
135
|
+
theme: {
|
|
136
|
+
palette: { neutral: e }
|
|
137
|
+
}
|
|
138
|
+
}) => e[500]};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
&:disabled {
|
|
142
|
+
cursor: not-allowed;
|
|
143
|
+
}
|
|
144
|
+
`, w = s.div`
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
justify-content: center;
|
|
148
|
+
white-space: nowrap;
|
|
149
|
+
`, S = s.div`
|
|
150
|
+
display: flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
justify-content: center;
|
|
153
|
+
white-space: nowrap;
|
|
154
|
+
`;
|
|
155
|
+
function v({
|
|
156
|
+
variant: e = "outlined",
|
|
157
|
+
size: n = "medium",
|
|
158
|
+
fullWidth: o,
|
|
159
|
+
disabled: t,
|
|
160
|
+
startIcon: r,
|
|
161
|
+
endIcon: i,
|
|
162
|
+
onFocus: l,
|
|
163
|
+
onBlur: a,
|
|
164
|
+
...f
|
|
165
|
+
}) {
|
|
166
|
+
const [g, h] = p(!1);
|
|
167
|
+
return /* @__PURE__ */ u(
|
|
168
|
+
m,
|
|
169
|
+
{
|
|
170
|
+
variant: e,
|
|
171
|
+
size: n,
|
|
172
|
+
focused: g,
|
|
173
|
+
fullWidth: o,
|
|
174
|
+
disabled: t,
|
|
175
|
+
children: [
|
|
176
|
+
r && /* @__PURE__ */ c(w, { children: r }),
|
|
177
|
+
/* @__PURE__ */ c(b, { ...f, onFocus: (d) => {
|
|
178
|
+
h(!0), l == null || l(d);
|
|
179
|
+
}, onBlur: (d) => {
|
|
180
|
+
h(!1), a == null || a(d);
|
|
181
|
+
}, disabled: t }),
|
|
182
|
+
i && /* @__PURE__ */ c(S, { children: i })
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
export {
|
|
188
|
+
v as default
|
|
189
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
export interface TextFieldProps extends Omit<ComponentPropsWithRef<"input">, "children" | "size"> {
|
|
3
|
+
variant?: "contained" | "outlined";
|
|
4
|
+
startIcon?: ReactNode;
|
|
5
|
+
endIcon?: ReactNode;
|
|
6
|
+
fullWidth?: boolean;
|
|
7
|
+
size?: "small" | "medium" | "large";
|
|
8
|
+
}
|