@cagatayfdn/flora-components 0.0.87 → 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.
@@ -1,10 +1,24 @@
1
- import { j as p } from "../../jsx-runtime-BcAkpsdy.js";
2
- import { createContext as i, useState as u, useContext as x } from "react";
3
- const r = i({ isOpen: !1 }), D = ({ children: t }) => {
4
- const [s, e] = u(!1), o = () => e(!0), n = () => e(!1), a = () => e((c) => !c);
5
- return /* @__PURE__ */ p.jsx(r.Provider, { value: { isOpen: s, openDrawer: o, closeDrawer: n, toggleDrawer: a }, children: t });
6
- }, f = () => x(r);
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
- D as DrawerProvider,
9
- f as useDrawer
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 o } from "../../index-BHf7G3IG.js";
2
+ import { c as n } from "../../index-BHf7G3IG.js";
3
3
  import { useDrawer as i } from "./Provider.js";
4
- import n from "../Icon/index.js";
5
- import '../../index.css';const c = "_drawer_1bno3_1", l = "_header_1bno3_10", m = "_body_1bno3_32", r = {
6
- drawer: c,
7
- header: l,
8
- body: m
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 j({ children: s, title: a }) {
11
- const { isOpen: t, closeDrawer: d } = i();
12
- return t ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
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: d,
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: o(r.drawer), children: [
30
- /* @__PURE__ */ e.jsxs("div", { "data-testid": "drawer-header", className: r.header, children: [
31
- /* @__PURE__ */ e.jsx("div", { children: a }),
32
- /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(n, { onClick: d, name: "close" }) })
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: r.body, children: s })
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
- j as default
39
+ p as default
40
40
  };
@@ -15,6 +15,7 @@ import "../Checkbox/Checkbox.js";
15
15
  import "../Confirm/Confirm.js";
16
16
  import "../Datepicker/Datepicker.js";
17
17
  import t from "../Divider/Divider.js";
18
+ import "../Drawer/Provider.js";
18
19
  import "../FileUpload/FileUpload.js";
19
20
  import j from "../Modal/Modal.js";
20
21
  import l from "../Grid/Column.js";
@@ -57,7 +58,7 @@ import '../../ErrorLogModal.css';const M = "_realTimeLogModalStyle_2pv2e_1", g =
57
58
  ] }, r == null ? void 0 : r.id)) : /* @__PURE__ */ o.jsx(h, { i18nKey: "text.not_found", values: { dataname: "Log" } }) })
58
59
  }
59
60
  );
60
- }, X = c.create(v);
61
+ }, Y = c.create(v);
61
62
  export {
62
- X as default
63
+ Y as default
63
64
  };
@@ -8,56 +8,57 @@ import { default as C } from "./AuthUserCan/Permission.js";
8
8
  import { default as T } from "./Autocomplete/Autocomplete.js";
9
9
  import { default as S } from "./Card/Card.js";
10
10
  import { default as P } from "./Charts/index.js";
11
- import { default as b } from "./Checkbox/Checkbox.js";
11
+ import { default as w } from "./Checkbox/Checkbox.js";
12
12
  import { default as A } from "./Config/Config.js";
13
- import { default as v } from "./Confirm/Confirm.js";
13
+ import { default as N } from "./Confirm/Confirm.js";
14
14
  import { default as F } from "./ContentHeader/ContentHeader.js";
15
15
  import { default as R } from "./ContentLoader/ContentLoader.js";
16
16
  import { default as y } from "./Countdown/Countdown.js";
17
17
  import { default as U } from "./Datepicker/Datepicker.js";
18
18
  import { default as E } from "./Divider/Divider.js";
19
- import { default as W } from "./Dropdown/DropdownList.js";
20
- import { default as q } from "./FileUpload/FileUpload.js";
21
- import { default as G } from "./FileUpload/ImagePreview.js";
22
- import { default as K } from "./FileUpload/LengthCard.js";
23
- import { default as Q } from "./FileUpload/PreviewModal.js";
24
- import { default as Y } from "./Grid/Column.js";
25
- import { default as _ } from "./Grid/Row.js";
26
- import { default as oo } from "./Heading/Heading.js";
27
- import { default as ro } from "./Icon/index.js";
28
- import { default as ao } from "./InfiniteScroll/InfiniteScroll.js";
29
- import { default as lo } from "./InfoBoxList/InfoBoxList.js";
30
- import { createConnectedService as mo } from "./InfoBoxList/helper.js";
31
- import { default as so } from "./InfoDate/InfoDate.js";
32
- import { InfoText as io } from "./InfoText/InfoText.js";
33
- import { default as co } from "./Input/Input.js";
34
- import { default as go } from "./Label/Label.js";
35
- import { default as Io } from "./Loading/Loading.js";
36
- import { default as Lo } from "./Modal/Modal.js";
37
- import { default as ho } from "./NavigatorCard/index.js";
38
- import { default as wo } from "./NoResult/NoResult.js";
39
- import { Notification as No } from "./Notification/Notification.js";
40
- import { default as Do } from "./PageWrapper/PageWrap.js";
41
- import { default as Mo } from "./Pager/Pager.js";
42
- import { default as ko } from "./Panel/Panel.js";
43
- import { default as Bo } from "./PermaLink/PermaLink.js";
44
- import { default as Ho, RadioList as Eo } from "./Radio/Radio.js";
45
- import { default as Wo } from "./ResultError/ResultError.js";
46
- import { default as qo } from "./ScrollContainer/ScrollContainer.js";
47
- import { default as Go } from "./Select/NoData.js";
48
- import { S as Ko } from "../Select-DcLZCXNo.js";
49
- import { default as Qo } from "./Sidebar/index.js";
50
- import { M as Yo } from "../MenuItem-DAf7NU3h.js";
51
- import { default as _o } from "./StatusTypography/StatusTypography.js";
52
- import { default as oe } from "./Stepper/Stepper.js";
53
- import { default as re } from "./Switch/Switch.js";
54
- import { default as ae } from "./Tab/Tab.js";
55
- import { default as le } from "./Table/Table.js";
56
- import { T as pe } from "../TableHeader-Cjx9ZwYH.js";
57
- import { default as xe } from "./Textarea/Textarea.js";
58
- import { default as ue } from "./Tooltip/Tooltip.js";
59
- import { default as ne } from "./TypographyText/TypographyText.js";
60
- import { default as Ce } from "./ValidationError/ValidationError.js";
19
+ import { default as W } from "./Drawer/index.js";
20
+ import { default as q } from "./Dropdown/DropdownList.js";
21
+ import { default as G } from "./FileUpload/FileUpload.js";
22
+ import { default as K } from "./FileUpload/ImagePreview.js";
23
+ import { default as Q } from "./FileUpload/LengthCard.js";
24
+ import { default as Y } from "./FileUpload/PreviewModal.js";
25
+ import { default as _ } from "./Grid/Column.js";
26
+ import { default as oo } from "./Grid/Row.js";
27
+ import { default as ro } from "./Heading/Heading.js";
28
+ import { default as ao } from "./Icon/index.js";
29
+ import { default as lo } from "./InfiniteScroll/InfiniteScroll.js";
30
+ import { default as mo } from "./InfoBoxList/InfoBoxList.js";
31
+ import { createConnectedService as so } from "./InfoBoxList/helper.js";
32
+ import { default as io } from "./InfoDate/InfoDate.js";
33
+ import { InfoText as co } from "./InfoText/InfoText.js";
34
+ import { default as go } from "./Input/Input.js";
35
+ import { default as Io } from "./Label/Label.js";
36
+ import { default as Lo } from "./Loading/Loading.js";
37
+ import { default as ho } from "./Modal/Modal.js";
38
+ import { default as bo } from "./NavigatorCard/index.js";
39
+ import { default as Do } from "./NoResult/NoResult.js";
40
+ import { Notification as vo } from "./Notification/Notification.js";
41
+ import { default as Mo } from "./PageWrapper/PageWrap.js";
42
+ import { default as ko } from "./Pager/Pager.js";
43
+ import { default as Bo } from "./Panel/Panel.js";
44
+ import { default as Ho } from "./PermaLink/PermaLink.js";
45
+ import { default as Vo, RadioList as Wo } from "./Radio/Radio.js";
46
+ import { default as qo } from "./ResultError/ResultError.js";
47
+ import { default as Go } from "./ScrollContainer/ScrollContainer.js";
48
+ import { default as Ko } from "./Select/NoData.js";
49
+ import { S as Qo } from "../Select-DcLZCXNo.js";
50
+ import { default as Yo } from "./Sidebar/index.js";
51
+ import { M as _o } from "../MenuItem-DAf7NU3h.js";
52
+ import { default as oe } from "./StatusTypography/StatusTypography.js";
53
+ import { default as re } from "./Stepper/Stepper.js";
54
+ import { default as ae } from "./Switch/Switch.js";
55
+ import { default as le } from "./Tab/Tab.js";
56
+ import { default as pe } from "./Table/Table.js";
57
+ import { T as xe } from "../TableHeader-Cjx9ZwYH.js";
58
+ import { default as ue } from "./Textarea/Textarea.js";
59
+ import { default as ne } from "./Tooltip/Tooltip.js";
60
+ import { default as Ce } from "./TypographyText/TypographyText.js";
61
+ import { default as Te } from "./ValidationError/ValidationError.js";
61
62
  export {
62
63
  m as Accordion,
63
64
  x as AccordionItem,
@@ -67,59 +68,60 @@ export {
67
68
  r as Button,
68
69
  S as Card,
69
70
  P as Chart,
70
- b as Checkbox,
71
- Y as Column,
71
+ w as Checkbox,
72
+ _ as Column,
72
73
  A as Config,
73
- v as Confirm,
74
+ N as Confirm,
74
75
  F as ContentHeader,
75
76
  R as ContentLoader,
76
77
  y as Countdown,
77
78
  U as Datepicker,
78
79
  E as Divider,
79
- W as DropdownList,
80
- q as FileUpload,
81
- G as FileUploadImagePreview,
82
- K as FileUploadLengthCard,
83
- Q as FileUploadPreviewModal,
84
- oo as Heading,
85
- ro as Icon,
86
- ao as InfiniteScroll,
87
- lo as InfoBoxList,
88
- so as InfoDate,
89
- io as InfoText,
90
- co as Input,
91
- go as Label,
92
- Io as Loading,
93
- Yo as MenuItem,
94
- Lo as Modal,
95
- ho as NavigatorCard,
80
+ W as Drawer,
81
+ q as DropdownList,
82
+ G as FileUpload,
83
+ K as FileUploadImagePreview,
84
+ Q as FileUploadLengthCard,
85
+ Y as FileUploadPreviewModal,
86
+ ro as Heading,
87
+ ao as Icon,
88
+ lo as InfiniteScroll,
89
+ mo as InfoBoxList,
90
+ io as InfoDate,
91
+ co as InfoText,
92
+ go as Input,
93
+ Io as Label,
94
+ Lo as Loading,
95
+ _o as MenuItem,
96
+ ho as Modal,
97
+ bo as NavigatorCard,
96
98
  a as NiceModal,
97
- Go as NoData,
98
- wo as NoResult,
99
- No as Notification,
100
- Do as PageWrapper,
101
- Mo as Pager,
102
- ko as Panel,
99
+ Ko as NoData,
100
+ Do as NoResult,
101
+ vo as Notification,
102
+ Mo as PageWrapper,
103
+ ko as Pager,
104
+ Bo as Panel,
103
105
  l as PermFallBack,
104
- Bo as PermaLink,
106
+ Ho as PermaLink,
105
107
  C as Permission,
106
- Ho as Radio,
107
- Eo as RadioList,
108
- Wo as ResultError,
109
- _ as Row,
110
- qo as ScrollContainer,
111
- Ko as Select,
112
- Qo as Sidebar,
113
- _o as StatusTypography,
114
- oe as Stepper,
115
- re as Switch,
116
- ae as Tab,
117
- le as Table,
118
- pe as TableHeader,
119
- xe as Textarea,
120
- ue as Tooltip,
121
- ne as TypographyText,
122
- Ce as ValidationError,
123
- mo as createConnectedService,
108
+ Vo as Radio,
109
+ Wo as RadioList,
110
+ qo as ResultError,
111
+ oo as Row,
112
+ Go as ScrollContainer,
113
+ Qo as Select,
114
+ Yo as Sidebar,
115
+ oe as StatusTypography,
116
+ re as Stepper,
117
+ ae as Switch,
118
+ le as Tab,
119
+ pe as Table,
120
+ xe as TableHeader,
121
+ ue as Textarea,
122
+ ne as Tooltip,
123
+ Ce as TypographyText,
124
+ Te as ValidationError,
125
+ so as createConnectedService,
124
126
  d as getAuth
125
127
  };
@@ -2,10 +2,12 @@ import { AuthProvider as o, useAuth as u } from "./useAauth.js";
2
2
  import { default as t } from "./useDisclosure.js";
3
3
  import { default as f } from "./useNiceModal.js";
4
4
  import { default as l } from "./useMediaQuery.js";
5
+ import { useDrawer as p } from "../components/Drawer/Provider.js";
5
6
  export {
6
7
  o as AuthProvider,
7
8
  u as useAuth,
8
9
  t as useDisclosure,
10
+ p as useDrawer,
9
11
  l as useMediaQuery,
10
12
  f as useNiceModal
11
13
  };
package/dist/index.d.mts CHANGED
@@ -438,6 +438,24 @@ export declare type DividerProps = {
438
438
  margin?: string;
439
439
  };
440
440
 
441
+ export declare function Drawer({ id, children, title }: DrawerProps): JSX_2.Element | null;
442
+
443
+ export declare type DrawerContextType = {
444
+ state: DrawerState;
445
+ openDrawer: (id: string) => void;
446
+ closeDrawer: (id: string) => void;
447
+ };
448
+
449
+ export declare type DrawerProps = {
450
+ id: string;
451
+ children: React.ReactNode;
452
+ title: string;
453
+ };
454
+
455
+ declare type DrawerState = {
456
+ [id: string]: boolean;
457
+ };
458
+
441
459
  export declare type DropdownItemType = {
442
460
  text: string;
443
461
  to?: string;
@@ -1358,6 +1376,8 @@ export declare function useDisclosure(isOpenInit?: boolean): {
1358
1376
  onToggle: () => void;
1359
1377
  };
1360
1378
 
1379
+ export declare const useDrawer: () => DrawerContextType;
1380
+
1361
1381
  export declare const useMediaQuery: ({ query, onMatch, onUnmatch }: MediaQueryProps) => boolean;
1362
1382
 
1363
1383
  declare type UseNiceModal = [() => void, () => void, string];
package/dist/index.d.ts CHANGED
@@ -438,6 +438,24 @@ export declare type DividerProps = {
438
438
  margin?: string;
439
439
  };
440
440
 
441
+ export declare function Drawer({ id, children, title }: DrawerProps): JSX_2.Element | null;
442
+
443
+ export declare type DrawerContextType = {
444
+ state: DrawerState;
445
+ openDrawer: (id: string) => void;
446
+ closeDrawer: (id: string) => void;
447
+ };
448
+
449
+ export declare type DrawerProps = {
450
+ id: string;
451
+ children: React.ReactNode;
452
+ title: string;
453
+ };
454
+
455
+ declare type DrawerState = {
456
+ [id: string]: boolean;
457
+ };
458
+
441
459
  export declare type DropdownItemType = {
442
460
  text: string;
443
461
  to?: string;
@@ -1358,6 +1376,8 @@ export declare function useDisclosure(isOpenInit?: boolean): {
1358
1376
  onToggle: () => void;
1359
1377
  };
1360
1378
 
1379
+ export declare const useDrawer: () => DrawerContextType;
1380
+
1361
1381
  export declare const useMediaQuery: ({ query, onMatch, onUnmatch }: MediaQueryProps) => boolean;
1362
1382
 
1363
1383
  declare type UseNiceModal = [() => void, () => void, string];