@cagatayfdn/flora-components 0.0.88 → 0.0.89
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/Drawer/Provider.js +22 -8
- package/dist/components/Drawer/index.js +16 -16
- package/dist/index.d.mts +9 -5
- package/dist/index.d.ts +9 -5
- package/package.json +1 -1
|
@@ -1,10 +1,24 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { createContext as
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { j as a } from "../../jsx-runtime-BcAkpsdy.js";
|
|
2
|
+
import { createContext as c, useReducer as i, useContext as d } from "react";
|
|
3
|
+
const w = {}, D = (e, r) => {
|
|
4
|
+
switch (r.type) {
|
|
5
|
+
case "OPEN_DRAWER":
|
|
6
|
+
return { ...e, [r.id]: !0 };
|
|
7
|
+
case "CLOSE_DRAWER":
|
|
8
|
+
return { ...e, [r.id]: !1 };
|
|
9
|
+
default:
|
|
10
|
+
return e;
|
|
11
|
+
}
|
|
12
|
+
}, s = c(void 0), p = ({ children: e }) => {
|
|
13
|
+
const [r, o] = i(D, w), n = (t) => o({ type: "OPEN_DRAWER", id: t }), u = (t) => o({ type: "CLOSE_DRAWER", id: t });
|
|
14
|
+
return /* @__PURE__ */ a.jsx(s.Provider, { value: { state: r, openDrawer: n, closeDrawer: u }, children: e });
|
|
15
|
+
}, x = () => {
|
|
16
|
+
const e = d(s);
|
|
17
|
+
if (!e)
|
|
18
|
+
throw new Error("useDrawer must be used within a DrawerProvider");
|
|
19
|
+
return e;
|
|
20
|
+
};
|
|
7
21
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
22
|
+
p as DrawerProvider,
|
|
23
|
+
x as useDrawer
|
|
10
24
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { j as e } from "../../jsx-runtime-BcAkpsdy.js";
|
|
2
|
-
import { c as
|
|
2
|
+
import { c as n } from "../../index-BHf7G3IG.js";
|
|
3
3
|
import { useDrawer as i } from "./Provider.js";
|
|
4
|
-
import
|
|
5
|
-
import '../../index.css';const
|
|
6
|
-
drawer:
|
|
7
|
-
header:
|
|
8
|
-
body:
|
|
4
|
+
import c from "../Icon/index.js";
|
|
5
|
+
import '../../index.css';const l = "_drawer_1bno3_1", m = "_header_1bno3_10", h = "_body_1bno3_32", s = {
|
|
6
|
+
drawer: l,
|
|
7
|
+
header: m,
|
|
8
|
+
body: h
|
|
9
9
|
};
|
|
10
|
-
function
|
|
11
|
-
const {
|
|
12
|
-
return
|
|
10
|
+
function p({ id: r, children: d, title: t }) {
|
|
11
|
+
const { state: o, closeDrawer: a } = i();
|
|
12
|
+
return o[r] || !1 ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
13
13
|
/* @__PURE__ */ e.jsx(
|
|
14
14
|
"div",
|
|
15
15
|
{
|
|
16
16
|
"data-testid": "drawer-overlay",
|
|
17
|
-
onClick:
|
|
17
|
+
onClick: () => a(r),
|
|
18
18
|
style: {
|
|
19
19
|
position: "fixed",
|
|
20
20
|
top: 0,
|
|
@@ -26,15 +26,15 @@ function j({ children: s, title: a }) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
),
|
|
29
|
-
/* @__PURE__ */ e.jsxs("div", { "data-testid": "drawer", className:
|
|
30
|
-
/* @__PURE__ */ e.jsxs("div", { "data-testid": "drawer-header", className:
|
|
31
|
-
/* @__PURE__ */ e.jsx("div", { children:
|
|
32
|
-
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(
|
|
29
|
+
/* @__PURE__ */ e.jsxs("div", { "data-testid": "drawer", className: n(s.drawer), children: [
|
|
30
|
+
/* @__PURE__ */ e.jsxs("div", { "data-testid": "drawer-header", className: s.header, children: [
|
|
31
|
+
/* @__PURE__ */ e.jsx("div", { children: t }),
|
|
32
|
+
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(c, { onClick: () => a(r), name: "close" }) })
|
|
33
33
|
] }),
|
|
34
|
-
/* @__PURE__ */ e.jsx("div", { "data-testid": "drawer-body", className:
|
|
34
|
+
/* @__PURE__ */ e.jsx("div", { "data-testid": "drawer-body", className: s.body, children: d })
|
|
35
35
|
] })
|
|
36
36
|
] }) : null;
|
|
37
37
|
}
|
|
38
38
|
export {
|
|
39
|
-
|
|
39
|
+
p as default
|
|
40
40
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -438,20 +438,24 @@ export declare type DividerProps = {
|
|
|
438
438
|
margin?: string;
|
|
439
439
|
};
|
|
440
440
|
|
|
441
|
-
export declare function Drawer({ children, title }: DrawerProps): JSX_2.Element | null;
|
|
441
|
+
export declare function Drawer({ id, children, title }: DrawerProps): JSX_2.Element | null;
|
|
442
442
|
|
|
443
443
|
export declare type DrawerContextType = {
|
|
444
|
-
|
|
445
|
-
openDrawer: () => void;
|
|
446
|
-
closeDrawer: () => void;
|
|
447
|
-
toggleDrawer: () => void;
|
|
444
|
+
state: DrawerState;
|
|
445
|
+
openDrawer: (id: string) => void;
|
|
446
|
+
closeDrawer: (id: string) => void;
|
|
448
447
|
};
|
|
449
448
|
|
|
450
449
|
export declare type DrawerProps = {
|
|
450
|
+
id: string;
|
|
451
451
|
children: React.ReactNode;
|
|
452
452
|
title: string;
|
|
453
453
|
};
|
|
454
454
|
|
|
455
|
+
declare type DrawerState = {
|
|
456
|
+
[id: string]: boolean;
|
|
457
|
+
};
|
|
458
|
+
|
|
455
459
|
export declare type DropdownItemType = {
|
|
456
460
|
text: string;
|
|
457
461
|
to?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -438,20 +438,24 @@ export declare type DividerProps = {
|
|
|
438
438
|
margin?: string;
|
|
439
439
|
};
|
|
440
440
|
|
|
441
|
-
export declare function Drawer({ children, title }: DrawerProps): JSX_2.Element | null;
|
|
441
|
+
export declare function Drawer({ id, children, title }: DrawerProps): JSX_2.Element | null;
|
|
442
442
|
|
|
443
443
|
export declare type DrawerContextType = {
|
|
444
|
-
|
|
445
|
-
openDrawer: () => void;
|
|
446
|
-
closeDrawer: () => void;
|
|
447
|
-
toggleDrawer: () => void;
|
|
444
|
+
state: DrawerState;
|
|
445
|
+
openDrawer: (id: string) => void;
|
|
446
|
+
closeDrawer: (id: string) => void;
|
|
448
447
|
};
|
|
449
448
|
|
|
450
449
|
export declare type DrawerProps = {
|
|
450
|
+
id: string;
|
|
451
451
|
children: React.ReactNode;
|
|
452
452
|
title: string;
|
|
453
453
|
};
|
|
454
454
|
|
|
455
|
+
declare type DrawerState = {
|
|
456
|
+
[id: string]: boolean;
|
|
457
|
+
};
|
|
458
|
+
|
|
455
459
|
export declare type DropdownItemType = {
|
|
456
460
|
text: string;
|
|
457
461
|
to?: string;
|