@shiflo/ui 0.0.11 → 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/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/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
|
@@ -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">;
|
|
@@ -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
|
+
}
|