@shiflo/ui 0.0.11 → 0.0.13

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.
Files changed (35) hide show
  1. package/dist/assets/icons/index.mjs +14 -8
  2. package/dist/assets/icons/index.ts-CS7JEbxh.js +28 -0
  3. package/dist/assets/icons/solid/index.d.ts +3 -0
  4. package/dist/assets/icons/solid/index.mjs +9 -3
  5. package/dist/assets/icons/solid/plus-large-solid.svg-CdPjcQXo.js +5 -0
  6. package/dist/assets/icons/solid/plus-solid.svg-piiaS3kO.js +5 -0
  7. package/dist/assets/icons/solid/square-plus-solid.svg-SHmhFLCy.js +5 -0
  8. package/dist/components/BottomSheet/BottomSheet.d.ts +1 -1
  9. package/dist/components/BottomSheet/BottomSheet.mjs +30 -26
  10. package/dist/components/BottomSheet/BottomSheet.typing.d.ts +1 -0
  11. package/dist/components/Dialog/Dialog.d.ts +3 -0
  12. package/dist/components/Dialog/Dialog.mjs +71 -0
  13. package/dist/components/Dialog/Dialog.typing.d.ts +6 -0
  14. package/dist/components/Dialog/index.d.ts +4 -0
  15. package/dist/components/Dialog/index.mjs +4 -0
  16. package/dist/components/Icon/Icon.mjs +5 -5
  17. package/dist/components/Icon/Icon.typing.d.ts +3 -1
  18. package/dist/components/Overlay/Overlay.typing.d.ts +2 -1
  19. package/dist/components/Snackbar/Snackbar.d.ts +3 -0
  20. package/dist/components/Snackbar/Snackbar.mjs +111 -0
  21. package/dist/components/Snackbar/Snackbar.typing.d.ts +11 -0
  22. package/dist/components/Snackbar/index.d.ts +4 -0
  23. package/dist/components/Snackbar/index.mjs +4 -0
  24. package/dist/components/Switch/Switch.d.ts +3 -0
  25. package/dist/components/Switch/Switch.mjs +102 -0
  26. package/dist/components/Switch/Switch.typing.d.ts +8 -0
  27. package/dist/components/Switch/index.d.ts +4 -0
  28. package/dist/components/Switch/index.mjs +4 -0
  29. package/dist/components/TextField/TextField.d.ts +3 -0
  30. package/dist/components/TextField/TextField.mjs +191 -0
  31. package/dist/components/TextField/TextField.typing.d.ts +9 -0
  32. package/dist/components/TextField/index.d.ts +4 -0
  33. package/dist/components/TextField/index.mjs +4 -0
  34. package/package.json +1 -1
  35. package/dist/assets/icons/index.ts-BL4wFg6B.js +0 -22
@@ -1,18 +1,24 @@
1
1
  import { S as a } from "./line/calendar-line.svg-DHsuXoUL.js";
2
2
  import { S } from "./solid/calendar-days-solid.svg-CIj8vf6t.js";
3
- import { S as l } from "./solid/calendar-lines-solid.svg-D2qG_E7t.js";
3
+ import { S as s } from "./solid/calendar-lines-solid.svg-D2qG_E7t.js";
4
4
  import { S as i } from "./solid/calendar-week-solid.svg-CVmrJtif.js";
5
5
  import { S as m } from "./solid/calendars-solid.svg-rClh_xBu.js";
6
- import { S as p } from "./solid/gear-solid.svg-C6vEx0Wx.js";
7
- import { S as x } from "./solid/grid-2-solid.svg-BRtzwK6Y.js";
8
- import { S as G } from "./solid/pen-to-square-solid.svg-DUdNcuTM.js";
6
+ import { S as t } from "./solid/gear-solid.svg-C6vEx0Wx.js";
7
+ import { S as n } from "./solid/grid-2-solid.svg-BRtzwK6Y.js";
8
+ import { S as C } from "./solid/pen-to-square-solid.svg-DUdNcuTM.js";
9
+ import { S as L } from "./solid/plus-large-solid.svg-CdPjcQXo.js";
10
+ import { S as G } from "./solid/plus-solid.svg-piiaS3kO.js";
11
+ import { S as k } from "./solid/square-plus-solid.svg-SHmhFLCy.js";
9
12
  export {
10
13
  S as CalendarDaysSolid,
11
14
  a as CalendarLine,
12
- l as CalendarLinesSolid,
15
+ s as CalendarLinesSolid,
13
16
  i as CalendarWeekSolid,
14
17
  m as CalendarsSolid,
15
- p as GearSolid,
16
- x as Grid2Solid,
17
- G as PenToSquareSolid
18
+ t as GearSolid,
19
+ n as Grid2Solid,
20
+ C as PenToSquareSolid,
21
+ L as PlusLargeSolid,
22
+ G as PlusSolid,
23
+ k as SquarePlusSolid
18
24
  };
@@ -0,0 +1,28 @@
1
+ import { S as o } from "./line/calendar-line.svg-DHsuXoUL.js";
2
+ import { S } from "./solid/calendar-days-solid.svg-CIj8vf6t.js";
3
+ import { S as r } from "./solid/calendar-lines-solid.svg-D2qG_E7t.js";
4
+ import { S as a } from "./solid/calendar-week-solid.svg-CVmrJtif.js";
5
+ import { S as l } from "./solid/calendars-solid.svg-rClh_xBu.js";
6
+ import { S as e } from "./solid/gear-solid.svg-C6vEx0Wx.js";
7
+ import { S as i } from "./solid/grid-2-solid.svg-BRtzwK6Y.js";
8
+ import { S as d } from "./solid/pen-to-square-solid.svg-DUdNcuTM.js";
9
+ import { S as s } from "./solid/plus-large-solid.svg-CdPjcQXo.js";
10
+ import { S as m } from "./solid/plus-solid.svg-piiaS3kO.js";
11
+ import { S as n } from "./solid/square-plus-solid.svg-SHmhFLCy.js";
12
+ const G = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
13
+ __proto__: null,
14
+ CalendarDaysSolid: S,
15
+ CalendarLine: o,
16
+ CalendarLinesSolid: r,
17
+ CalendarWeekSolid: a,
18
+ CalendarsSolid: l,
19
+ GearSolid: e,
20
+ Grid2Solid: i,
21
+ PenToSquareSolid: d,
22
+ PlusLargeSolid: s,
23
+ PlusSolid: m,
24
+ SquarePlusSolid: n
25
+ }, Symbol.toStringTag, { value: "Module" }));
26
+ export {
27
+ G as S
28
+ };
@@ -5,3 +5,6 @@ export { default as CalendarsSolid } from './calendars-solid.svg';
5
5
  export { default as GearSolid } from './gear-solid.svg';
6
6
  export { default as Grid2Solid } from './grid-2-solid.svg';
7
7
  export { default as PenToSquareSolid } from './pen-to-square-solid.svg';
8
+ export { default as PlusLargeSolid } from './plus-large-solid.svg';
9
+ export { default as PlusSolid } from './plus-solid.svg';
10
+ export { default as SquarePlusSolid } from './square-plus-solid.svg';
@@ -1,16 +1,22 @@
1
1
  import { S as a } from "./calendar-days-solid.svg-CIj8vf6t.js";
2
2
  import { S } from "./calendar-lines-solid.svg-D2qG_E7t.js";
3
- import { S as l } from "./calendar-week-solid.svg-CVmrJtif.js";
3
+ import { S as s } from "./calendar-week-solid.svg-CVmrJtif.js";
4
4
  import { S as i } from "./calendars-solid.svg-rClh_xBu.js";
5
5
  import { S as m } from "./gear-solid.svg-C6vEx0Wx.js";
6
6
  import { S as t } from "./grid-2-solid.svg-BRtzwK6Y.js";
7
7
  import { S as n } from "./pen-to-square-solid.svg-DUdNcuTM.js";
8
+ import { S as C } from "./plus-large-solid.svg-CdPjcQXo.js";
9
+ import { S as q } from "./plus-solid.svg-piiaS3kO.js";
10
+ import { S as L } from "./square-plus-solid.svg-SHmhFLCy.js";
8
11
  export {
9
12
  a as CalendarDaysSolid,
10
13
  S as CalendarLinesSolid,
11
- l as CalendarWeekSolid,
14
+ s as CalendarWeekSolid,
12
15
  i as CalendarsSolid,
13
16
  m as GearSolid,
14
17
  t as Grid2Solid,
15
- n as PenToSquareSolid
18
+ n as PenToSquareSolid,
19
+ C as PlusLargeSolid,
20
+ q as PlusSolid,
21
+ L as SquarePlusSolid
16
22
  };
@@ -0,0 +1,5 @@
1
+ import * as e from "react";
2
+ const l = (t) => /* @__PURE__ */ e.createElement("svg", { width: 24, height: 25, viewBox: "0 0 24 25", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ e.createElement("g", { clipPath: "url(#clip0_271_18)" }, /* @__PURE__ */ e.createElement("path", { d: "M13.5 2C13.5 1.17031 12.8297 0.5 12 0.5C11.1703 0.5 10.5 1.17031 10.5 2V11H1.5C0.670312 11 0 11.6703 0 12.5C0 13.3297 0.670312 14 1.5 14H10.5V23C10.5 23.8297 11.1703 24.5 12 24.5C12.8297 24.5 13.5 23.8297 13.5 23V14H22.5C23.3297 14 24 13.3297 24 12.5C24 11.6703 23.3297 11 22.5 11H13.5V2Z", fill: "currentColor" })), /* @__PURE__ */ e.createElement("defs", null, /* @__PURE__ */ e.createElement("clipPath", { id: "clip0_271_18" }, /* @__PURE__ */ e.createElement("rect", { width: 24, height: 24, fill: "currentColor", transform: "translate(0 0.5)" }))));
3
+ export {
4
+ l as S
5
+ };
@@ -0,0 +1,5 @@
1
+ import * as e from "react";
2
+ const l = (t) => /* @__PURE__ */ e.createElement("svg", { width: 24, height: 27, viewBox: "0 0 24 27", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ e.createElement("path", { d: "M13.7143 4.21875C13.7143 3.28535 12.9482 2.53125 12 2.53125C11.0518 2.53125 10.2857 3.28535 10.2857 4.21875V11.8125H2.57146C1.62325 11.8125 0.857178 12.5666 0.857178 13.5C0.857178 14.4334 1.62325 15.1875 2.57146 15.1875H10.2857V22.7812C10.2857 23.7146 11.0518 24.4688 12 24.4688C12.9482 24.4688 13.7143 23.7146 13.7143 22.7812V15.1875H21.4286C22.3768 15.1875 23.1429 14.4334 23.1429 13.5C23.1429 12.5666 22.3768 11.8125 21.4286 11.8125H13.7143V4.21875Z", fill: "currentColor" }));
3
+ export {
4
+ l as S
5
+ };
@@ -0,0 +1,5 @@
1
+ import * as e from "react";
2
+ const C = (t) => /* @__PURE__ */ e.createElement("svg", { width: 24, height: 27, viewBox: "0 0 24 27", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ e.createElement("path", { d: "M3.42857 1.6875C1.5375 1.6875 0 3.20098 0 5.0625V21.9375C0 23.799 1.5375 25.3125 3.42857 25.3125H20.5714C22.4625 25.3125 24 23.799 24 21.9375V5.0625C24 3.20098 22.4625 1.6875 20.5714 1.6875H3.42857ZM10.7143 18.1406V14.7656H7.28571C6.57321 14.7656 6 14.2014 6 13.5C6 12.7986 6.57321 12.2344 7.28571 12.2344H10.7143V8.85938C10.7143 8.15801 11.2875 7.59375 12 7.59375C12.7125 7.59375 13.2857 8.15801 13.2857 8.85938V12.2344H16.7143C17.4268 12.2344 18 12.7986 18 13.5C18 14.2014 17.4268 14.7656 16.7143 14.7656H13.2857V18.1406C13.2857 18.842 12.7125 19.4062 12 19.4062C11.2875 19.4062 10.7143 18.842 10.7143 18.1406Z", fill: "currentColor" }));
3
+ export {
4
+ C as S
5
+ };
@@ -1,3 +1,3 @@
1
1
  import { BottomSheetProps } from './BottomSheet.typing';
2
- declare function BottomSheet({ open, onClose, children, transitionDuration, onClick, ref, hideDragHandleBar, style, ...props }: BottomSheetProps): import("react").JSX.Element;
2
+ declare function BottomSheet({ open, onClose, children, transitionDuration, onClick, ref, hideDragHandleBar, hideOverlay, style, ...props }: BottomSheetProps): import("react").JSX.Element;
3
3
  export default BottomSheet;
@@ -1,8 +1,8 @@
1
- import { jsx as y, jsxs as P } from "react/jsx-runtime";
2
- import { useState as V, useRef as o, useImperativeHandle as z, useEffect as S } from "react";
1
+ import { jsx as y, jsxs as V } from "react/jsx-runtime";
2
+ import { useState as z, useRef as o, useImperativeHandle as G, useEffect as S } from "react";
3
3
  import b from "basic-styled";
4
- import G from "../Overlay/Overlay.mjs";
5
- const J = b.div`
4
+ import J from "../Overlay/Overlay.mjs";
5
+ const K = b.div`
6
6
  width: 100%;
7
7
  max-height: calc(100% - ${({ theme: { spacing: t } }) => t[800]});
8
8
  overflow-y: auto;
@@ -18,7 +18,7 @@ const J = b.div`
18
18
  transform ${({ transitionDuration: t }) => `${t}ms`}
19
19
  ${({ ease: t }) => t === "in" ? "ease-out" : "ease-in"},
20
20
  background-color 0.2s;
21
- `, K = b.div`
21
+ `, N = b.div`
22
22
  position: sticky;
23
23
  top: 0;
24
24
  left: 0;
@@ -33,7 +33,7 @@ const J = b.div`
33
33
  }
34
34
  }) => t.background};
35
35
  transition: background-color 0.2s;
36
- `, N = b.div`
36
+ `, Q = b.div`
37
37
  width: 24px;
38
38
  height: 4px;
39
39
  border-radius: ${({ theme: { radius: t } }) => t[100]};
@@ -44,7 +44,7 @@ const J = b.div`
44
44
  }) => t.main};
45
45
  transition: background-color 0.2s;
46
46
  `;
47
- function _({
47
+ function C({
48
48
  open: t,
49
49
  onClose: c,
50
50
  children: T,
@@ -52,12 +52,13 @@ function _({
52
52
  onClick: $,
53
53
  ref: j,
54
54
  hideDragHandleBar: I,
55
- style: O,
56
- ...A
55
+ hideOverlay: O,
56
+ style: A,
57
+ ...F
57
58
  }) {
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);
59
- z(j, () => l.current);
60
- const W = (r) => {
59
+ const [L, h] = z(!1), l = o(null), k = o(null), i = o(null), d = o(!1), v = o(0), f = o(0), m = o(0), g = o(0), p = o(0), W = o(0.25);
60
+ G(j, () => l.current);
61
+ const q = (r) => {
61
62
  r.stopPropagation(), typeof $ == "function" && $(r);
62
63
  };
63
64
  return S(() => {
@@ -68,7 +69,7 @@ function _({
68
69
  r && cancelAnimationFrame(r);
69
70
  };
70
71
  }, [t]), S(() => {
71
- const r = l.current, n = R.current, k = (e) => {
72
+ const r = l.current, n = k.current, R = (e) => {
72
73
  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")));
73
74
  }, x = (e) => {
74
75
  if (!r || !d.current) return;
@@ -77,41 +78,44 @@ function _({
77
78
  f.current = e;
78
79
  const D = Date.now(), M = D - p.current;
79
80
  if (M > 0) {
80
- const q = f.current;
81
- g.current = (e - q) / M, p.current = D;
81
+ const P = f.current;
82
+ g.current = (e - P) / M, p.current = D;
82
83
  }
83
84
  n && (n.style.opacity = `${Math.max(0, 1 - u / (m.current * 2))}`), r.style.transform = `translate3d(0, ${u}px, 0)`;
84
85
  }, a = () => {
85
86
  if (!r || !d.current) return;
86
87
  d.current = !1, r.style.cursor = "default", i.current && (i.current.style.cursor = "grab");
87
- const e = f.current - v.current, u = m.current * F.current;
88
+ const e = f.current - v.current, u = m.current * W.current;
88
89
  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"));
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
+ }, w = (e) => R(e.clientY), H = (e) => x(e.clientY), Y = (e) => R(e.touches[0].clientY), B = (e) => x(e.touches[0].clientY);
90
91
  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
92
  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);
92
93
  };
93
94
  }, [L, c, s]), /* @__PURE__ */ y(
94
- G,
95
+ J,
95
96
  {
96
- ref: R,
97
+ ref: k,
97
98
  open: t,
98
99
  onClose: c,
99
100
  transitionDuration: s,
100
101
  placement: "center-bottom",
101
- children: /* @__PURE__ */ P(
102
- J,
102
+ css: O ? {
103
+ backgroundColor: "transparent !important"
104
+ } : void 0,
105
+ children: /* @__PURE__ */ V(
106
+ K,
103
107
  {
104
108
  ref: l,
105
109
  ease: t ? "in" : "out",
106
110
  transitionDuration: s,
107
- onClick: W,
108
- ...A,
111
+ onClick: q,
112
+ ...F,
109
113
  style: {
110
114
  transform: `translate3d(0, ${L ? "0" : "200%"}, 0)`,
111
- ...O
115
+ ...A
112
116
  },
113
117
  children: [
114
- !I && /* @__PURE__ */ y(K, { ref: i, children: /* @__PURE__ */ y(N, {}) }),
118
+ !I && /* @__PURE__ */ y(N, { ref: i, children: /* @__PURE__ */ y(Q, {}) }),
115
119
  T
116
120
  ]
117
121
  }
@@ -120,5 +124,5 @@ function _({
120
124
  );
121
125
  }
122
126
  export {
123
- _ as default
127
+ C as default
124
128
  };
@@ -4,4 +4,5 @@ export interface BottomSheetProps extends ComponentPropsWithRef<"div"> {
4
4
  onClose?: () => void;
5
5
  transitionDuration?: number;
6
6
  hideDragHandleBar?: boolean;
7
+ hideOverlay?: boolean;
7
8
  }
@@ -0,0 +1,3 @@
1
+ import { DialogProps } from './Dialog.typing';
2
+ declare function Dialog({ open, onClose, children, transitionDuration, onClick, style, ...props }: DialogProps): import("react").JSX.Element;
3
+ export default Dialog;
@@ -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
+ };
@@ -0,0 +1,6 @@
1
+ import { ComponentPropsWithRef } from 'react';
2
+ export interface DialogProps extends ComponentPropsWithRef<"div"> {
3
+ open?: boolean;
4
+ onClose?: () => void;
5
+ transitionDuration?: number;
6
+ }
@@ -0,0 +1,4 @@
1
+ import { default as Dialog } from './Dialog';
2
+ import { DialogProps } from './Dialog.typing';
3
+ export type { DialogProps };
4
+ export default Dialog;
@@ -0,0 +1,4 @@
1
+ import a from "./Dialog.mjs";
2
+ export {
3
+ a as default
4
+ };
@@ -1,6 +1,6 @@
1
1
  import { jsx as m } from "react/jsx-runtime";
2
2
  import { Children as p, isValidElement as l } from "react";
3
- import { S as a } from "../../assets/icons/index.ts-BL4wFg6B.js";
3
+ import { S as a } from "../../assets/icons/index.ts-CS7JEbxh.js";
4
4
  import c from "basic-styled";
5
5
  import d from "../../utils/getValueByPath.mjs";
6
6
  const f = c.svg`
@@ -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 || "24px"};
13
- height: ${({ height: t }) => t || "24px"};
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 v({ ref: t, name: r, width: e = 24, height: n = 24, ...s }) {
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
- v as default
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,5 +1,6 @@
1
1
  import { ComponentPropsWithRef } from 'react';
2
- export interface OverlayProps extends ComponentPropsWithRef<"div"> {
2
+ import { UtilityProps } from '../../typings/utility';
3
+ export interface OverlayProps extends ComponentPropsWithRef<"div">, Pick<UtilityProps, "css"> {
3
4
  open?: boolean;
4
5
  onClose?: () => void;
5
6
  transitionDuration?: number;
@@ -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,11 @@
1
+ import { ReactNode, ComponentPropsWithRef } from 'react';
2
+ import { UtilityProps } from '../../typings/utility';
3
+ export interface SnackbarProps extends ComponentPropsWithRef<"div">, UtilityProps {
4
+ open?: boolean;
5
+ onClose?: () => void;
6
+ transitionDuration?: number;
7
+ startIcon?: ReactNode;
8
+ action?: ReactNode;
9
+ autoHideDuration?: number;
10
+ disableAutoHide?: boolean;
11
+ }
@@ -0,0 +1,4 @@
1
+ import { default as Snackbar } from './Snackbar';
2
+ import { SnackbarProps } from './Snackbar.typing';
3
+ export type { SnackbarProps };
4
+ export default Snackbar;
@@ -0,0 +1,4 @@
1
+ import r from "./Snackbar.mjs";
2
+ export {
3
+ r as default
4
+ };
@@ -0,0 +1,3 @@
1
+ import { SwitchProps } from './Switch.typing';
2
+ declare function Switch({ checked, disabled, size, onChange, onClick, ...props }: SwitchProps): import("react").JSX.Element;
3
+ export default Switch;
@@ -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,4 @@
1
+ import { default as Switch } from './Switch';
2
+ import { SwitchProps } from './Switch.typing';
3
+ export type { SwitchProps };
4
+ export default Switch;
@@ -0,0 +1,4 @@
1
+ import o from "./Switch.mjs";
2
+ export {
3
+ o as default
4
+ };
@@ -0,0 +1,3 @@
1
+ import { TextFieldProps } from './TextField.typing';
2
+ declare function TextField({ variant, size, fullWidth, disabled, startIcon, endIcon, css, onFocus, onBlur, ...props }: TextFieldProps): import("react").JSX.Element;
3
+ export default TextField;
@@ -0,0 +1,191 @@
1
+ import { jsxs as p, jsx as c } from "react/jsx-runtime";
2
+ import { useState as m } from "react";
3
+ import s from "basic-styled";
4
+ const b = 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
+ `, w = 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
+ `, S = s.div`
145
+ display: flex;
146
+ align-items: center;
147
+ justify-content: center;
148
+ white-space: nowrap;
149
+ `, $ = s.div`
150
+ display: flex;
151
+ align-items: center;
152
+ justify-content: center;
153
+ white-space: nowrap;
154
+ `;
155
+ function H({
156
+ variant: e = "outlined",
157
+ size: n = "medium",
158
+ fullWidth: o,
159
+ disabled: t,
160
+ startIcon: r,
161
+ endIcon: i,
162
+ css: f,
163
+ onFocus: l,
164
+ onBlur: a,
165
+ ...g
166
+ }) {
167
+ const [u, h] = m(!1);
168
+ return /* @__PURE__ */ p(
169
+ b,
170
+ {
171
+ variant: e,
172
+ size: n,
173
+ focused: u,
174
+ fullWidth: o,
175
+ disabled: t,
176
+ css: f,
177
+ children: [
178
+ r && /* @__PURE__ */ c(S, { children: r }),
179
+ /* @__PURE__ */ c(w, { ...g, onFocus: (d) => {
180
+ h(!0), l == null || l(d);
181
+ }, onBlur: (d) => {
182
+ h(!1), a == null || a(d);
183
+ }, disabled: t }),
184
+ i && /* @__PURE__ */ c($, { children: i })
185
+ ]
186
+ }
187
+ );
188
+ }
189
+ export {
190
+ H as default
191
+ };
@@ -0,0 +1,9 @@
1
+ import { ComponentPropsWithRef, ReactNode } from 'react';
2
+ import { UtilityProps } from '../../typings/utility';
3
+ export interface TextFieldProps extends Omit<ComponentPropsWithRef<"input">, "children" | "size">, Pick<UtilityProps, "css"> {
4
+ variant?: "contained" | "outlined";
5
+ startIcon?: ReactNode;
6
+ endIcon?: ReactNode;
7
+ fullWidth?: boolean;
8
+ size?: "small" | "medium" | "large";
9
+ }
@@ -0,0 +1,4 @@
1
+ import { default as TextField } from './TextField';
2
+ import { TextFieldProps } from './TextField.typing';
3
+ export type { TextFieldProps };
4
+ export default TextField;
@@ -0,0 +1,4 @@
1
+ import t from "./TextField.mjs";
2
+ export {
3
+ t as default
4
+ };
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.0.11",
4
+ "version": "0.0.13",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -1,22 +0,0 @@
1
- import { S as o } from "./line/calendar-line.svg-DHsuXoUL.js";
2
- import { S as r } from "./solid/calendar-days-solid.svg-CIj8vf6t.js";
3
- import { S as a } from "./solid/calendar-lines-solid.svg-D2qG_E7t.js";
4
- import { S } from "./solid/calendar-week-solid.svg-CVmrJtif.js";
5
- import { S as e } from "./solid/calendars-solid.svg-rClh_xBu.js";
6
- import { S as i } from "./solid/gear-solid.svg-C6vEx0Wx.js";
7
- import { S as l } from "./solid/grid-2-solid.svg-BRtzwK6Y.js";
8
- import { S as d } from "./solid/pen-to-square-solid.svg-DUdNcuTM.js";
9
- const C = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10
- __proto__: null,
11
- CalendarDaysSolid: r,
12
- CalendarLine: o,
13
- CalendarLinesSolid: a,
14
- CalendarWeekSolid: S,
15
- CalendarsSolid: e,
16
- GearSolid: i,
17
- Grid2Solid: l,
18
- PenToSquareSolid: d
19
- }, Symbol.toStringTag, { value: "Module" }));
20
- export {
21
- C as S
22
- };