@shiflo/ui 0.1.1 → 0.1.2

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.
@@ -99,7 +99,7 @@ function z({
99
99
  transition: {
100
100
  type: "spring",
101
101
  duration: i,
102
- damping: 10
102
+ bounce: 0.2
103
103
  },
104
104
  style: g,
105
105
  ...y,
@@ -1,7 +1,7 @@
1
1
  import { jsxs as k } from "@emotion/react/jsx-runtime";
2
- import f from "@emotion/styled";
3
- import { motion as v } from "motion/react";
4
- const m = f(v.button)`
2
+ import v from "@emotion/styled";
3
+ import { motion as f } from "motion/react";
4
+ const m = v(f.button)`
5
5
  display: inline-flex;
6
6
  align-items: center;
7
7
  justify-content: center;
@@ -9,11 +9,11 @@ const m = f(v.button)`
9
9
  font-weight: 500;
10
10
  transition: all 0.2s;
11
11
 
12
- ${({ theme: t, variant: l, size: s, color: d }) => {
12
+ ${({ theme: t, variant: l, size: d, color: c }) => {
13
13
  const {
14
14
  mode: a,
15
15
  palette: { primary: e, secondary: r, neutral: o, gradient: p },
16
- typography: { body1: c, body2: g, small1: h, small2: u },
16
+ typography: { body1: s, body2: g, small1: h, small2: u },
17
17
  spacing: n,
18
18
  radius: b
19
19
  } = t, i = {};
@@ -89,7 +89,7 @@ const m = f(v.button)`
89
89
  });
90
90
  break;
91
91
  default:
92
- if (d === "secondary") {
92
+ if (c === "secondary") {
93
93
  Object.assign(i, {
94
94
  backgroundColor: r.main,
95
95
  color: a === "dark" ? o[900] : o[700],
@@ -134,16 +134,16 @@ const m = f(v.button)`
134
134
  });
135
135
  break;
136
136
  }
137
- switch (s) {
137
+ switch (d) {
138
138
  case "large":
139
139
  Object.assign(i, {
140
140
  padding: `${n[300]} ${n[350]}`,
141
141
  borderRadius: b[300],
142
- fontSize: c.fontSize,
143
- lineHeight: c.lineHeight,
142
+ fontSize: s.fontSize,
143
+ lineHeight: s.lineHeight,
144
144
  "& svg": {
145
- width: c.fontSize,
146
- height: c.fontSize
145
+ width: s.fontSize,
146
+ height: s.fontSize
147
147
  }
148
148
  });
149
149
  break;
@@ -190,19 +190,19 @@ const m = f(v.button)`
190
190
  function C({
191
191
  ref: t,
192
192
  children: l,
193
- variant: s = "filled",
194
- size: d = "medium",
193
+ variant: d = "filled",
194
+ size: c = "medium",
195
195
  color: a = "primary",
196
196
  startIcon: e,
197
197
  endIcon: r,
198
198
  ...o
199
199
  }) {
200
- return s === "text" ? /* @__PURE__ */ k(
200
+ return d === "text" ? /* @__PURE__ */ k(
201
201
  m,
202
202
  {
203
203
  ref: t,
204
204
  variant: "text",
205
- size: d,
205
+ size: c,
206
206
  color: "secondary",
207
207
  layout: !0,
208
208
  whileHover: {
@@ -211,8 +211,8 @@ function C({
211
211
  whileTap: { scale: 0.98 },
212
212
  transition: {
213
213
  type: "spring",
214
- stiffness: 400,
215
- damping: 25
214
+ duration: 0.2,
215
+ bounce: 0.2
216
216
  },
217
217
  ...o,
218
218
  children: [
@@ -221,12 +221,12 @@ function C({
221
221
  r
222
222
  ]
223
223
  }
224
- ) : s === "ghost" ? /* @__PURE__ */ k(
224
+ ) : d === "ghost" ? /* @__PURE__ */ k(
225
225
  m,
226
226
  {
227
227
  ref: t,
228
228
  variant: "ghost",
229
- size: d,
229
+ size: c,
230
230
  color: "primary",
231
231
  layout: !0,
232
232
  whileHover: {
@@ -235,8 +235,8 @@ function C({
235
235
  whileTap: { scale: 0.98 },
236
236
  transition: {
237
237
  type: "spring",
238
- stiffness: 400,
239
- damping: 25
238
+ duration: 0.2,
239
+ bounce: 0.2
240
240
  },
241
241
  ...o,
242
242
  children: [
@@ -245,12 +245,12 @@ function C({
245
245
  r
246
246
  ]
247
247
  }
248
- ) : s === "gradient" ? /* @__PURE__ */ k(
248
+ ) : d === "gradient" ? /* @__PURE__ */ k(
249
249
  m,
250
250
  {
251
251
  ref: t,
252
252
  variant: "gradient",
253
- size: d,
253
+ size: c,
254
254
  color: "primary",
255
255
  layout: !0,
256
256
  whileHover: {
@@ -259,8 +259,8 @@ function C({
259
259
  whileTap: { scale: 0.98 },
260
260
  transition: {
261
261
  type: "spring",
262
- stiffness: 400,
263
- damping: 25
262
+ duration: 0.2,
263
+ bounce: 0.2
264
264
  },
265
265
  ...o,
266
266
  children: [
@@ -273,8 +273,8 @@ function C({
273
273
  m,
274
274
  {
275
275
  ref: t,
276
- variant: s,
277
- size: d,
276
+ variant: d,
277
+ size: c,
278
278
  color: a,
279
279
  layout: !0,
280
280
  whileHover: {
@@ -283,8 +283,8 @@ function C({
283
283
  whileTap: { scale: 0.98 },
284
284
  transition: {
285
285
  type: "spring",
286
- stiffness: 400,
287
- damping: 25
286
+ duration: 0.2,
287
+ bounce: 0.2
288
288
  },
289
289
  ...o,
290
290
  children: [
@@ -1,9 +1,9 @@
1
1
  import { jsx as m } from "@emotion/react/jsx-runtime";
2
- import { useState as d, useRef as u, useEffect as h } from "react";
3
- import g from "@emotion/styled";
4
- import { motion as y } from "motion/react";
5
- import $ from "../Overlay/Overlay.mjs";
6
- const x = g(y.div)`
2
+ import { useState as p, useEffect as d } from "react";
3
+ import u from "@emotion/styled";
4
+ import { motion as h } from "motion/react";
5
+ import g from "../Overlay/Overlay.mjs";
6
+ const y = u(h.div)`
7
7
  width: calc(100% - ${({ theme: { spacing: e } }) => e[800]});
8
8
  max-width: ${({ maxWidth: e = "375px" }) => e};
9
9
  max-height: calc(100% - ${({ theme: { spacing: e } }) => e[800]});
@@ -17,60 +17,59 @@ const x = g(y.div)`
17
17
  }
18
18
  }) => e.background};
19
19
  `;
20
- function F({
20
+ function O({
21
21
  open: e,
22
- onClose: l,
23
- children: n,
22
+ onClose: c,
23
+ children: l,
24
24
  transitionDuration: a = 0.2,
25
25
  onClick: o,
26
- style: b,
27
- maxWidth: c = "375px",
26
+ style: $,
27
+ maxWidth: n = "375px",
28
28
  ...s
29
29
  }) {
30
- const [r, i] = d(!1), f = u(null), p = (t) => {
30
+ const [i, r] = p(!1), f = (t) => {
31
31
  t.stopPropagation(), typeof o == "function" && o(t);
32
32
  };
33
- return h(() => {
33
+ return d(() => {
34
34
  let t;
35
35
  return e ? t = requestAnimationFrame(() => {
36
- i(!0);
37
- }) : i(!1), () => {
36
+ r(!0);
37
+ }) : r(!1), () => {
38
38
  t && cancelAnimationFrame(t);
39
39
  };
40
40
  }, [e]), /* @__PURE__ */ m(
41
- $,
41
+ g,
42
42
  {
43
- ref: f,
44
43
  open: e,
45
- onClose: l,
44
+ onClose: c,
46
45
  transitionDuration: a,
47
46
  placement: "center-middle",
48
47
  children: /* @__PURE__ */ m(
49
- x,
48
+ y,
50
49
  {
51
50
  transitionDuration: a,
52
- maxWidth: c,
53
- onClick: p,
51
+ maxWidth: n,
52
+ onClick: f,
54
53
  initial: {
55
54
  scale: 0.9,
56
55
  opacity: 0
57
56
  },
58
57
  animate: {
59
- scale: r ? 1 : 0.9,
60
- opacity: r ? 1 : 0
58
+ scale: i ? 1 : 0.9,
59
+ opacity: i ? 1 : 0
61
60
  },
62
61
  transition: {
63
62
  type: "spring",
64
63
  duration: a,
65
- damping: 10
64
+ bounce: 0.2
66
65
  },
67
66
  ...s,
68
- children: n
67
+ children: l
69
68
  }
70
69
  )
71
70
  }
72
71
  );
73
72
  }
74
73
  export {
75
- F as default
74
+ O as default
76
75
  };
@@ -1,15 +1,15 @@
1
- import { jsxs as x, jsx as f } from "@emotion/react/jsx-runtime";
2
- import { useState as m, useRef as E, useImperativeHandle as I, useLayoutEffect as C, useEffect as w } from "react";
3
- import { createPortal as L } from "react-dom";
4
- import { useTheme as A } from "@emotion/react";
5
- import a from "@emotion/styled";
6
- import { motion as o } from "motion/react";
7
- const F = a(o.div)`
1
+ import { jsxs as k, jsx as c } from "@emotion/react/jsx-runtime";
2
+ import { useState as l, useEffect as j } from "react";
3
+ import { createPortal as v } from "react-dom";
4
+ import { useTheme as x } from "@emotion/react";
5
+ import r from "@emotion/styled";
6
+ import { motion as a } from "motion/react";
7
+ const C = r(a.div)`
8
8
  position: fixed;
9
9
  top: 0;
10
10
  left: 0;
11
11
  z-index: 1;
12
- `, R = a(o.div)`
12
+ `, A = r(a.div)`
13
13
  position: fixed;
14
14
  top: 0;
15
15
  left: 0;
@@ -17,19 +17,19 @@ const F = a(o.div)`
17
17
  height: 100%;
18
18
  background-color: ${({
19
19
  theme: {
20
- palette: { common: r }
20
+ palette: { common: e }
21
21
  }
22
- }) => r.overlay};
23
- `, S = a(o.div)`
22
+ }) => e.overlay};
23
+ `, w = r(a.div)`
24
24
  position: fixed;
25
25
  width: 100%;
26
26
  display: flex;
27
27
  justify-content: center;
28
28
  align-items: center;
29
29
 
30
- ${({ placement: r }) => {
30
+ ${({ placement: e }) => {
31
31
  const t = {};
32
- switch (r) {
32
+ switch (e) {
33
33
  case "top-left":
34
34
  Object.assign(t, {
35
35
  top: 0,
@@ -93,60 +93,56 @@ const F = a(o.div)`
93
93
  return t;
94
94
  }}
95
95
  `;
96
- function N({
97
- children: r,
96
+ function E({
97
+ children: e,
98
98
  open: t,
99
- onClose: d,
100
- transitionDuration: s = 0.2,
101
- placement: p,
102
- ref: u,
103
- onClick: b,
104
- hideOverlay: g,
105
- ...y
99
+ onClose: m,
100
+ transitionDuration: n = 0.2,
101
+ placement: f,
102
+ ref: I,
103
+ onClick: p,
104
+ hideOverlay: d,
105
+ ...b
106
106
  }) {
107
107
  const {
108
- palette: { common: h }
109
- } = A(), [O, i] = m(!0), [v, c] = m(!1), n = E(null), k = (e) => {
110
- d?.(), b?.(e);
108
+ palette: { common: u }
109
+ } = x(), [g, s] = l(!0), [h, i] = l(!1), y = (o) => {
110
+ m?.(), p?.(o);
111
+ }, O = () => {
112
+ t || s(!0);
111
113
  };
112
- return I(u, () => n.current), C(() => {
113
- let e;
114
- return t ? (i(!1), e = requestAnimationFrame(() => {
115
- c(!0);
116
- })) : c(!1), () => {
117
- e && cancelAnimationFrame(e);
114
+ return j(() => {
115
+ let o;
116
+ return t ? (s(!1), o = requestAnimationFrame(() => {
117
+ i(!0);
118
+ })) : i(!1), () => {
119
+ o && cancelAnimationFrame(o);
118
120
  };
119
- }, [t, s]), w(() => {
120
- const e = n.current, l = (j) => {
121
- t || j.propertyName === "opacity" && i(!0);
122
- };
123
- return e?.addEventListener("transitionend", l), () => {
124
- e?.removeEventListener("transitionend", l);
125
- };
126
- }, [t]), O ? null : L(
127
- /* @__PURE__ */ x(F, { children: [
128
- /* @__PURE__ */ f(
129
- R,
121
+ }, [t, n]), g ? null : v(
122
+ /* @__PURE__ */ k(C, { children: [
123
+ /* @__PURE__ */ c(
124
+ A,
130
125
  {
131
- ref: n,
132
126
  initial: { opacity: 0 },
133
127
  animate: {
134
- opacity: v ? 1 : 0,
135
- backgroundColor: g ? "rgba(0, 0, 0, 0)" : h.overlay
128
+ opacity: h ? 1 : 0,
129
+ backgroundColor: d ? "rgba(0, 0, 0, 0)" : u.overlay
136
130
  },
137
131
  transition: {
138
- duration: s,
139
- ease: t ? "easeIn" : "easeOut"
132
+ type: "spring",
133
+ duration: n,
134
+ bounce: 0.2
140
135
  },
141
- onClick: k,
142
- ...y
136
+ onAnimationComplete: O,
137
+ onClick: y,
138
+ ...b
143
139
  }
144
140
  ),
145
- /* @__PURE__ */ f(S, { placement: p, children: r })
141
+ /* @__PURE__ */ c(w, { placement: f, children: e })
146
142
  ] }),
147
143
  document.body
148
144
  );
149
145
  }
150
146
  export {
151
- N as default
147
+ E as default
152
148
  };
@@ -1,9 +1,9 @@
1
- import { jsxs as E, jsx as c } from "@emotion/react/jsx-runtime";
2
- import { useState as y, useRef as b, useImperativeHandle as z, useLayoutEffect as A, useEffect as g } from "react";
3
- import { createPortal as I } from "react-dom";
4
- import i from "@emotion/styled";
5
- import { motion as L } from "motion/react";
6
- const R = i(L.div)`
1
+ import { jsxs as $, jsx as l } from "@emotion/react/jsx-runtime";
2
+ import { useState as h, useRef as v, useEffect as x } from "react";
3
+ import { createPortal as S } from "react-dom";
4
+ import n from "@emotion/styled";
5
+ import { motion as k } from "motion/react";
6
+ const A = n(k.div)`
7
7
  position: fixed;
8
8
  left: 50%;
9
9
  bottom: ${({ theme: { spacing: e } }) => `calc(${e[800]} + var(--safe-area-inset-bottom, 0px))`};
@@ -21,9 +21,9 @@ const R = i(L.div)`
21
21
  }) => e[900]};
22
22
  border-radius: ${({ theme: { radius: e } }) => e[400]};
23
23
  z-index: 1;
24
- `, T = i.div`
24
+ `, z = n.div`
25
25
  white-space: nowrap;
26
- `, j = i.div`
26
+ `, j = n.div`
27
27
  flex-grow: 1;
28
28
  display: -webkit-box;
29
29
  overflow: hidden;
@@ -40,52 +40,49 @@ const R = i(L.div)`
40
40
  lineHeight: t.lineHeight,
41
41
  color: e.surface
42
42
  })}
43
- `, F = i.div`
43
+ `, C = n.div`
44
44
  white-space: nowrap;
45
45
  `;
46
- function B({
46
+ function E({
47
47
  children: e,
48
48
  open: t,
49
- onClose: l,
50
- transitionDuration: a = 0.2,
51
- style: O,
52
- ref: v,
49
+ onClose: c,
50
+ transitionDuration: r = 0.2,
51
+ style: F,
52
+ ref: I,
53
53
  startIcon: m,
54
- action: f,
55
- maxWidth: w = "375px",
56
- autoHideDuration: d = 3e3,
54
+ action: s,
55
+ maxWidth: b = "375px",
56
+ autoHideDuration: f = 3e3,
57
57
  disableAutoHide: p,
58
- ...$
58
+ ...w
59
59
  }) {
60
- const [k, u] = y(!0), [r, h] = y(!1), o = b(null), s = b(null);
61
- return z(v, () => o.current), A(() => {
62
- let n;
63
- return t ? (u(!1), n = requestAnimationFrame(() => {
64
- h(!0);
65
- })) : h(!1), () => {
66
- n && cancelAnimationFrame(n);
60
+ const [g, d] = h(!0), [i, u] = h(!1), o = v(null);
61
+ x(() => {
62
+ let a;
63
+ return t ? (d(!1), a = requestAnimationFrame(() => {
64
+ u(!0);
65
+ })) : u(!1), () => {
66
+ a && cancelAnimationFrame(a);
67
67
  };
68
- }, [t, a]), g(() => {
69
- const n = o.current, x = (S) => {
70
- t || S.propertyName === "opacity" && u(!0);
71
- };
72
- return n?.addEventListener("transitionend", x), () => {
73
- n?.removeEventListener("transitionend", x);
74
- };
75
- }, [t]), g(() => {
76
- if (!(p || !r))
77
- return s.current = setTimeout(() => {
78
- l?.();
79
- }, d), () => {
80
- s.current && clearTimeout(s.current);
68
+ }, [t, r]);
69
+ const y = () => {
70
+ t || d(!0);
71
+ };
72
+ return x(() => {
73
+ if (!(p || !i))
74
+ return o.current = setTimeout(() => {
75
+ c?.();
76
+ }, f), () => {
77
+ o.current && clearTimeout(o.current);
81
78
  };
82
- }, [p, d, r, l]), k ? null : I(
83
- /* @__PURE__ */ E(
84
- R,
79
+ }, [p, f, i, c]), g ? null : S(
80
+ /* @__PURE__ */ $(
81
+ A,
85
82
  {
86
- ref: o,
87
- transitionDuration: a,
88
- maxWidth: w,
83
+ transitionDuration: r,
84
+ maxWidth: b,
85
+ onAnimationComplete: y,
89
86
  initial: {
90
87
  x: "-50%",
91
88
  scale: 0.97,
@@ -93,19 +90,19 @@ function B({
93
90
  },
94
91
  animate: {
95
92
  x: "-50%",
96
- scale: r ? 1 : 0.97,
97
- opacity: r ? 1 : 0
93
+ scale: i ? 1 : 0.97,
94
+ opacity: i ? 1 : 0
98
95
  },
99
96
  transition: {
100
97
  type: "spring",
101
- duration: a,
102
- damping: 10
98
+ duration: r,
99
+ bounce: 0.2
103
100
  },
104
- ...$,
101
+ ...w,
105
102
  children: [
106
- m && /* @__PURE__ */ c(T, { children: m }),
107
- /* @__PURE__ */ c(j, { children: e }),
108
- f && /* @__PURE__ */ c(F, { children: f })
103
+ m && /* @__PURE__ */ l(z, { children: m }),
104
+ /* @__PURE__ */ l(j, { children: e }),
105
+ s && /* @__PURE__ */ l(C, { children: s })
109
106
  ]
110
107
  }
111
108
  ),
@@ -113,5 +110,5 @@ function B({
113
110
  );
114
111
  }
115
112
  export {
116
- B as default
113
+ E as default
117
114
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shiflo/ui",
3
3
  "description": "Shiflo React UI Components",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"