farm-react 1.0.5 → 1.0.6
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/cjs/assets/data/header.d.ts +6 -0
- package/dist/cjs/assets/data/header.js +17 -0
- package/dist/cjs/assets/data/header.js.map +1 -0
- package/dist/cjs/assets/data/home.d.ts +0 -0
- package/dist/cjs/assets/data/home.js +2 -0
- package/dist/cjs/assets/data/home.js.map +1 -0
- package/dist/cjs/assets/data/icons.d.ts +0 -0
- package/dist/cjs/assets/data/icons.js +2 -0
- package/dist/cjs/assets/data/icons.js.map +1 -0
- package/dist/cjs/components/Button.d.ts +2 -0
- package/dist/cjs/components/Button.js +9 -0
- package/dist/cjs/components/Button.js.map +1 -0
- package/dist/cjs/components/Label.d.ts +14 -0
- package/dist/cjs/components/Label.js +23 -0
- package/dist/cjs/components/Label.js.map +1 -0
- package/dist/cjs/components/Layout/Footer.d.ts +3 -0
- package/dist/cjs/components/Layout/Footer.js +20 -0
- package/dist/cjs/components/Layout/Footer.js.map +1 -0
- package/dist/cjs/components/Layout/Header.d.ts +3 -0
- package/dist/cjs/components/Layout/Header.js +28 -0
- package/dist/cjs/components/Layout/Header.js.map +1 -0
- package/dist/cjs/components/Layout/Sidebar.d.ts +3 -0
- package/dist/cjs/components/Layout/Sidebar.js +11 -0
- package/dist/cjs/components/Layout/Sidebar.js.map +1 -0
- package/dist/cjs/components/TextInput.d.ts +10 -0
- package/dist/cjs/components/TextInput.js +26 -0
- package/dist/cjs/components/TextInput.js.map +1 -0
- package/dist/cjs/constants/app.d.ts +1 -0
- package/dist/cjs/constants/app.js +5 -0
- package/dist/cjs/constants/app.js.map +1 -0
- package/dist/cjs/constants/images.d.ts +0 -0
- package/dist/cjs/constants/images.js +2 -0
- package/dist/cjs/constants/images.js.map +1 -0
- package/dist/cjs/constants/routes.d.ts +0 -0
- package/dist/cjs/constants/routes.js +2 -0
- package/dist/cjs/constants/routes.js.map +1 -0
- package/dist/cjs/container/index.d.ts +0 -0
- package/dist/cjs/container/index.js +2 -0
- package/dist/cjs/container/index.js.map +1 -0
- package/dist/cjs/helpers/app.d.ts +81 -0
- package/dist/cjs/helpers/app.js +151 -0
- package/dist/cjs/helpers/app.js.map +1 -0
- package/dist/cjs/helpers/index.d.ts +0 -0
- package/dist/cjs/helpers/index.js +2 -0
- package/dist/cjs/helpers/index.js.map +1 -0
- package/dist/cjs/hooks/index.d.ts +0 -0
- package/dist/cjs/hooks/index.js +2 -0
- package/dist/cjs/hooks/index.js.map +1 -0
- package/dist/cjs/index.d.ts +4 -2
- package/dist/cjs/index.js +7 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/strings/en.d.ts +3 -0
- package/dist/cjs/strings/en.js +8 -0
- package/dist/cjs/strings/en.js.map +1 -0
- package/dist/cjs/strings/index.d.ts +0 -0
- package/dist/cjs/strings/index.js +2 -0
- package/dist/cjs/strings/index.js.map +1 -0
- package/dist/esm/assets/data/header.d.ts +6 -0
- package/dist/esm/assets/data/header.js +14 -0
- package/dist/esm/assets/data/header.js.map +1 -0
- package/dist/esm/assets/data/home.d.ts +0 -0
- package/dist/esm/assets/data/home.js +2 -0
- package/dist/esm/assets/data/home.js.map +1 -0
- package/dist/esm/assets/data/icons.d.ts +0 -0
- package/dist/esm/assets/data/icons.js +2 -0
- package/dist/esm/assets/data/icons.js.map +1 -0
- package/dist/esm/components/Button.d.ts +2 -0
- package/dist/esm/components/Button.js +5 -0
- package/dist/esm/components/Button.js.map +1 -0
- package/dist/esm/components/Label.d.ts +14 -0
- package/dist/esm/components/Label.js +20 -0
- package/dist/esm/components/Label.js.map +1 -0
- package/dist/esm/components/Layout/Footer.d.ts +3 -0
- package/dist/esm/components/Layout/Footer.js +17 -0
- package/dist/esm/components/Layout/Footer.js.map +1 -0
- package/dist/esm/components/Layout/Header.d.ts +3 -0
- package/dist/esm/components/Layout/Header.js +25 -0
- package/dist/esm/components/Layout/Header.js.map +1 -0
- package/dist/esm/components/Layout/Sidebar.d.ts +3 -0
- package/dist/esm/components/Layout/Sidebar.js +8 -0
- package/dist/esm/components/Layout/Sidebar.js.map +1 -0
- package/dist/esm/components/Notification.d.ts +1 -0
- package/dist/esm/components/Notification.js +46 -0
- package/dist/esm/components/Notification.js.map +1 -0
- package/dist/esm/components/SwitchItem.d.ts +8 -0
- package/dist/esm/components/SwitchItem.js +7 -0
- package/dist/esm/components/SwitchItem.js.map +1 -0
- package/dist/esm/components/TextInput.d.ts +10 -0
- package/dist/esm/components/TextInput.js +23 -0
- package/dist/esm/components/TextInput.js.map +1 -0
- package/dist/esm/constants/aap.d.ts +1 -0
- package/dist/esm/constants/aap.js +2 -0
- package/dist/esm/constants/aap.js.map +1 -0
- package/dist/esm/constants/app.d.ts +1 -0
- package/dist/esm/constants/app.js +2 -0
- package/dist/esm/constants/app.js.map +1 -0
- package/dist/esm/constants/images.d.ts +0 -0
- package/dist/esm/constants/images.js +2 -0
- package/dist/esm/constants/images.js.map +1 -0
- package/dist/esm/constants/routes.d.ts +0 -0
- package/dist/esm/constants/routes.js +2 -0
- package/dist/esm/constants/routes.js.map +1 -0
- package/dist/esm/container/index.d.ts +0 -0
- package/dist/esm/container/index.js +2 -0
- package/dist/esm/container/index.js.map +1 -0
- package/dist/esm/helpers/app.d.ts +81 -0
- package/dist/esm/helpers/app.js +136 -0
- package/dist/esm/helpers/app.js.map +1 -0
- package/dist/esm/helpers/index.d.ts +0 -0
- package/dist/esm/helpers/index.js +2 -0
- package/dist/esm/helpers/index.js.map +1 -0
- package/dist/esm/hooks/index.d.ts +0 -0
- package/dist/esm/hooks/index.js +2 -0
- package/dist/esm/hooks/index.js.map +1 -0
- package/dist/esm/index.d.ts +4 -2
- package/dist/esm/index.js +4 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/strings/en.d.ts +3 -0
- package/dist/esm/strings/en.js +5 -0
- package/dist/esm/strings/en.js.map +1 -0
- package/dist/esm/strings/index.d.ts +0 -0
- package/dist/esm/strings/index.js +2 -0
- package/dist/esm/strings/index.js.map +1 -0
- package/package.json +16 -11
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var headerItem = [
|
|
2
|
+
{ id: 1, label: 'Bootstrap 5', link: 'https://getbootstrap.com/docs/5.3/getting-started/introduction/' },
|
|
3
|
+
{ id: 2, label: 'React bootstrap', link: 'https://react-bootstrap.netlify.app/' },
|
|
4
|
+
{ id: 4, label: 'Seed App', link: 'https://seed-app' },
|
|
5
|
+
{ id: 3, label: 'Updates group', link: 'https://chat.whatsapp.com/ISQ2i9zTTvr2dGPzyvE5FV?mode=ac_t' },
|
|
6
|
+
// { id: 6, label: 'home', link: '' },
|
|
7
|
+
// { id: 7, label: 'home', link: '' },
|
|
8
|
+
// { id: 8, label: 'home', link: '' },
|
|
9
|
+
// { id: 9, label: 'home', link: '' },
|
|
10
|
+
// { id: 10, label: 'home', link: '' },
|
|
11
|
+
// { id: 11, label: 'home', link: '' },
|
|
12
|
+
];
|
|
13
|
+
export { headerItem };
|
|
14
|
+
//# sourceMappingURL=header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.js","sourceRoot":"","sources":["../../../../src/assets/data/header.ts"],"names":[],"mappings":"AAAA,IAAM,UAAU,GAAG;IACjB,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,iEAAiE,EAAE;IACxG,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,sCAAsC,EAAE;IACjF,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,kBAAkB,EAAE;IACtD,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,4DAA4D,EAAE;IACrG,sCAAsC;IACtC,sCAAsC;IACtC,sCAAsC;IACtC,sCAAsC;IACtC,uCAAuC;IACvC,uCAAuC;CACxC,CAAA;AACD,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"home.js","sourceRoot":"","sources":["../../../../src/assets/data/home.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../../../../src/assets/data/icons.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAA;AAEhD,MAAM,CAAC,OAAO,UAAU,MAAM;IAC5B,OAAO,gCAAW,CAAA;AACpB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
interface Classnames {
|
|
3
|
+
label?: string;
|
|
4
|
+
icon?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface LabelProps {
|
|
7
|
+
id?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
icon?: string;
|
|
10
|
+
tooltip?: string | ReactElement;
|
|
11
|
+
classnames?: Classnames;
|
|
12
|
+
}
|
|
13
|
+
declare function Label({ id, label, icon, tooltip, classnames }: LabelProps): ReactElement | null;
|
|
14
|
+
export default Label;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { OverlayTrigger, Tooltip } from 'react-bootstrap';
|
|
4
|
+
import { destructObj } from '../helpers/app';
|
|
5
|
+
function Label(_a) {
|
|
6
|
+
var id = _a.id, label = _a.label, _b = _a.icon, icon = _b === void 0 ? 'bi bi-info-circle' : _b, tooltip = _a.tooltip, classnames = _a.classnames;
|
|
7
|
+
// Destructure classnames safely
|
|
8
|
+
var _c = destructObj(classnames), labelClass = _c.label, iconClass = _c.icon;
|
|
9
|
+
/** Renders the label icon */
|
|
10
|
+
var renderLabelIcon = function () { return React.createElement("i", { className: clsx(icon, iconClass, { 'ms-2': tooltip }) }); };
|
|
11
|
+
if (!label)
|
|
12
|
+
return null;
|
|
13
|
+
return (React.createElement("label", { htmlFor: id, className: clsx(labelClass, 'form-label', {
|
|
14
|
+
'd-flex align-items-center': !!icon,
|
|
15
|
+
}) },
|
|
16
|
+
label,
|
|
17
|
+
tooltip ? (React.createElement(OverlayTrigger, { placement: 'top', overlay: React.createElement(Tooltip, { className: 'bg-white rounded' }, tooltip) }, renderLabelIcon())) : (renderLabelIcon())));
|
|
18
|
+
}
|
|
19
|
+
export default Label;
|
|
20
|
+
//# sourceMappingURL=Label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.js","sourceRoot":"","sources":["../../../src/components/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAA;AAChD,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAe5C,SAAS,KAAK,CAAC,EAA0E;QAAxE,EAAE,QAAA,EAAE,KAAK,WAAA,EAAE,YAA0B,EAA1B,IAAI,mBAAG,mBAAmB,KAAA,EAAE,OAAO,aAAA,EAAE,UAAU,gBAAA;IACzE,gCAAgC;IAC1B,IAAA,KAAyC,WAAW,CAAC,UAAU,CAAC,EAAvD,UAAU,WAAA,EAAQ,SAAS,UAA4B,CAAA;IAEtE,6BAA6B;IAC7B,IAAM,eAAe,GAAG,cAAoB,OAAA,2BAAG,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAI,EAA5D,CAA4D,CAAA;IAExG,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IAEvB,OAAO,CACL,+BACE,OAAO,EAAE,EAAE,EACX,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,YAAY,EAAE;YACxC,2BAA2B,EAAE,CAAC,CAAC,IAAI;SACpC,CAAC;QAED,KAAK;QACL,OAAO,CAAC,CAAC,CAAC,CACT,oBAAC,cAAc,IAAC,SAAS,EAAC,KAAK,EAAC,OAAO,EAAE,oBAAC,OAAO,IAAC,SAAS,EAAC,kBAAkB,IAAE,OAAO,CAAW,IAC/F,eAAe,EAAE,CACH,CAClB,CAAC,CAAC,CAAC,CACF,eAAe,EAAE,CAClB,CACK,CACT,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { headerItem } from '../../assets/data/header';
|
|
3
|
+
import { Col, Container, Image, Nav, Row } from 'react-bootstrap';
|
|
4
|
+
import { LOGO_IMG } from '../../constants/app';
|
|
5
|
+
function Footer() {
|
|
6
|
+
return (React.createElement("footer", null,
|
|
7
|
+
React.createElement(Container, null,
|
|
8
|
+
React.createElement(Row, null,
|
|
9
|
+
React.createElement(Col, { lg: 2 },
|
|
10
|
+
React.createElement(Image, { src: LOGO_IMG, alt: 'farm-react logo', height: 40, width: 40 }),
|
|
11
|
+
' '),
|
|
12
|
+
React.createElement(Col, { lg: 4 }),
|
|
13
|
+
React.createElement(Col, { lg: 6 },
|
|
14
|
+
React.createElement(Nav, { className: 'd-flex' }, headerItem.map(function (item) { return (React.createElement(Nav.Link, { key: item.id, href: item.link, className: 'text-dark' }, item.label)); })))))));
|
|
15
|
+
}
|
|
16
|
+
export default Footer;
|
|
17
|
+
//# sourceMappingURL=Footer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Footer.js","sourceRoot":"","sources":["../../../../src/components/Layout/Footer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE9C,SAAS,MAAM;IACb,OAAO,CACL;QACE,oBAAC,SAAS;YACR,oBAAC,GAAG;gBACF,oBAAC,GAAG,IAAC,EAAE,EAAE,CAAC;oBACR,oBAAC,KAAK,IAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAC,iBAAiB,EAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,GAAI;oBAAC,GAAG,CACrE;gBACN,oBAAC,GAAG,IAAC,EAAE,EAAE,CAAC,GAAI;gBACd,oBAAC,GAAG,IAAC,EAAE,EAAE,CAAC;oBACR,oBAAC,GAAG,IAAC,SAAS,EAAC,QAAQ,IACpB,UAAU,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,CACxB,oBAAC,GAAG,CAAC,IAAI,IAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAC,WAAW,IAC3D,IAAI,CAAC,KAAK,CACF,CACZ,EAJyB,CAIzB,CAAC,CACE,CACF,CACF,CACI,CACL,CACV,CAAA;AACH,CAAC;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Container from 'react-bootstrap/Container';
|
|
3
|
+
import Nav from 'react-bootstrap/Nav';
|
|
4
|
+
import Navbar from 'react-bootstrap/Navbar';
|
|
5
|
+
import NavDropdown from 'react-bootstrap/NavDropdown';
|
|
6
|
+
import { headerItem } from '../../assets/data/header';
|
|
7
|
+
import { Link } from 'react-router';
|
|
8
|
+
import { Image } from 'react-bootstrap';
|
|
9
|
+
import { LOGO_IMG } from '../../constants/app';
|
|
10
|
+
function Header() {
|
|
11
|
+
return (React.createElement("header", { className: 'position-sticky top-0' },
|
|
12
|
+
React.createElement(Navbar, { expand: 'lg', className: 'bg-body-tertiary' },
|
|
13
|
+
React.createElement(Container, null,
|
|
14
|
+
React.createElement(Navbar.Brand, { href: '#' },
|
|
15
|
+
React.createElement(Image, { src: LOGO_IMG, alt: 'logo image', height: 30, width: 30 })),
|
|
16
|
+
React.createElement(Navbar.Toggle, { "aria-controls": 'basic-navbar-nav' }),
|
|
17
|
+
React.createElement(Navbar.Collapse, { id: 'basic-navbar-nav' },
|
|
18
|
+
React.createElement(Nav, { className: 'me-auto' },
|
|
19
|
+
headerItem.map(function (item) { return (React.createElement(Nav.Link, { key: item.id, to: item.link, as: Link }, item.label)); }),
|
|
20
|
+
React.createElement(NavDropdown, { title: 'Version', id: 'basic-nav-dropdown' },
|
|
21
|
+
React.createElement(NavDropdown.Item, { href: '#' }, "farm-react 1.0.0"),
|
|
22
|
+
React.createElement(NavDropdown.Item, { href: '#' }, "farm-react 2.0.0"))))))));
|
|
23
|
+
}
|
|
24
|
+
export default Header;
|
|
25
|
+
//# sourceMappingURL=Header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../../../src/components/Layout/Header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,SAAS,MAAM,2BAA2B,CAAA;AACjD,OAAO,GAAG,MAAM,qBAAqB,CAAA;AACrC,OAAO,MAAM,MAAM,wBAAwB,CAAA;AAC3C,OAAO,WAAW,MAAM,6BAA6B,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE9C,SAAS,MAAM;IACb,OAAO,CACL,gCAAQ,SAAS,EAAC,uBAAuB;QACvC,oBAAC,MAAM,IAAC,MAAM,EAAC,IAAI,EAAC,SAAS,EAAC,kBAAkB;YAC9C,oBAAC,SAAS;gBACR,oBAAC,MAAM,CAAC,KAAK,IAAC,IAAI,EAAC,GAAG;oBACpB,oBAAC,KAAK,IAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAC,YAAY,EAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,GAAI,CACnD;gBACf,oBAAC,MAAM,CAAC,MAAM,qBAAe,kBAAkB,GAAG;gBAClD,oBAAC,MAAM,CAAC,QAAQ,IAAC,EAAE,EAAC,kBAAkB;oBACpC,oBAAC,GAAG,IAAC,SAAS,EAAC,SAAS;wBACrB,UAAU,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,CACxB,oBAAC,GAAG,CAAC,IAAI,IAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,IAC5C,IAAI,CAAC,KAAK,CACF,CACZ,EAJyB,CAIzB,CAAC;wBACF,oBAAC,WAAW,IAAC,KAAK,EAAC,SAAS,EAAC,EAAE,EAAC,oBAAoB;4BAClD,oBAAC,WAAW,CAAC,IAAI,IAAC,IAAI,EAAC,GAAG,uBAAoC;4BAC9D,oBAAC,WAAW,CAAC,IAAI,IAAC,IAAI,EAAC,GAAG,uBAAoC,CAClD,CACV,CACU,CACR,CACL,CACF,CACV,CAAA;AACH,CAAC;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Offcanvas from 'react-bootstrap/Offcanvas';
|
|
3
|
+
function Sidebar() {
|
|
4
|
+
return (React.createElement(Offcanvas, { show: true, className: 'top-60', backdrop: false, scroll: true },
|
|
5
|
+
React.createElement(Offcanvas.Body, null, "Some text as placeholder. In real life you can have the elements you have chosen. Like, text, images, lists, etc.")));
|
|
6
|
+
}
|
|
7
|
+
export default Sidebar;
|
|
8
|
+
//# sourceMappingURL=Sidebar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar.js","sourceRoot":"","sources":["../../../../src/components/Layout/Sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,SAAS,MAAM,2BAA2B,CAAA;AAEjD,SAAS,OAAO;IACd,OAAO,CACL,oBAAC,SAAS,IAAC,IAAI,QAAC,SAAS,EAAC,QAAQ,EAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI;QAC9D,oBAAC,SAAS,CAAC,IAAI,4HAGE,CACP,CACb,CAAA;AACH,CAAC;AAED,eAAe,OAAO,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function Parent(): import("react").JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import { useRef, useState } from 'react';
|
|
3
|
+
import ConfirmPopup from './ConfirmPopup';
|
|
4
|
+
import SwitchItem from './SwitchItem';
|
|
5
|
+
var initialSwitches = [
|
|
6
|
+
{ id: '1', label: 'Email Notifications', enabled: true },
|
|
7
|
+
{ id: '2', label: 'SMS Alerts', enabled: false },
|
|
8
|
+
{ id: '3', label: 'Push Messages', enabled: true },
|
|
9
|
+
];
|
|
10
|
+
export default function Parent() {
|
|
11
|
+
var _a;
|
|
12
|
+
var _b = useState(initialSwitches), switches = _b[0], setSwitches = _b[1];
|
|
13
|
+
var _c = useState(false), confirmOpen = _c[0], setConfirmOpen = _c[1];
|
|
14
|
+
var activeSwitchRef = useRef(null);
|
|
15
|
+
var handleSwitchToggle = function (id, value) {
|
|
16
|
+
if (value) {
|
|
17
|
+
console.log(id, value);
|
|
18
|
+
// ✅ enable directly
|
|
19
|
+
setSwitches(function (prev) { return prev.map(function (sw) { return (sw.id === id ? __assign(__assign({}, sw), { enabled: true }) : sw); }); });
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
// ✅ before disabling → open popup
|
|
23
|
+
var target = switches.find(function (sw) { return sw.id === id; });
|
|
24
|
+
if (target) {
|
|
25
|
+
activeSwitchRef.current = target;
|
|
26
|
+
setConfirmOpen(true);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
console.log(activeSwitchRef);
|
|
30
|
+
};
|
|
31
|
+
var handleConfirm = function () {
|
|
32
|
+
if (activeSwitchRef.current) {
|
|
33
|
+
setSwitches(function (prev) { return prev.map(function (sw) { return (sw.id === activeSwitchRef.current.id ? __assign(__assign({}, sw), { enabled: false }) : sw); }); });
|
|
34
|
+
}
|
|
35
|
+
setConfirmOpen(false);
|
|
36
|
+
// activeSwitchRef.current = null;
|
|
37
|
+
};
|
|
38
|
+
var handleCancel = function () {
|
|
39
|
+
setConfirmOpen(false);
|
|
40
|
+
activeSwitchRef.current = null;
|
|
41
|
+
};
|
|
42
|
+
return (React.createElement(React.Fragment, null,
|
|
43
|
+
React.createElement("div", null, switches.map(function (sw) { return (React.createElement(SwitchItem, { key: sw.id, id: sw.id, label: sw.label, enabled: sw.enabled, onToggle: handleSwitchToggle })); })),
|
|
44
|
+
confirmOpen && (React.createElement(ConfirmPopup, { title: "Disable ".concat((_a = activeSwitchRef.current) === null || _a === void 0 ? void 0 : _a.label, "?"), onConfirm: handleConfirm, onCancel: handleCancel }))));
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=Notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Notification.js","sourceRoot":"","sources":["../../../src/components/Notification.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,YAAY,MAAM,gBAAgB,CAAA;AACzC,OAAO,UAAU,MAAM,cAAc,CAAA;AAQrC,IAAM,eAAe,GAAqB;IACxC,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,qBAAqB,EAAE,OAA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CAAC,CAAA;IAED,IAAM,aAAa,GAAG;QACpB,IAAI,eAAe,CAAC,OAAO,EAAE,CAAC;YAC5B,WAAW,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,GAAG,CAAC,UAAC,EAAE,IAAK,OAAA,CAAC,EAAE,CAAC,EAAE,KAAK,eAAe,CAAC,OAAQ,CAAC,EAAE,CAAC,CAAC,uBAAM,EAAE,KAAE,OAAO,EAAE,KAAK,IAAG,CAAC,CAAC,EAAE,CAAC,EAAxE,CAAwE,CAAC,EAA1F,CAA0F,CAAC,CAAA;QACnH,CAAC;QACD,cAAc,CAAC,KAAK,CAAC,CAAA;QACrB,kCAAkC;IACpC,CAAC,CAAA;IAED,IAAM,YAAY,GAAG;QACnB,cAAc,CAAC,KAAK,CAAC,CAAA;QACrB,eAAe,CAAC,OAAO,GAAG,IAAI,CAAA;IAChC,CAAC,CAAA;IAED,OAAO,CACL;QACE,iCACG,QAAQ,CAAC,GAAG,CAAC,UAAC,EAAE,IAAK,OAAA,CACpB,oBAAC,UAAU,IAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,kBAAkB,GAAI,CAC1G,EAFqB,CAErB,CAAC,CACE;QAEL,WAAW,IAAI,CACd,oBAAC,YAAY,IACX,KAAK,EAAE,kBAAW,MAAA,eAAe,CAAC,OAAO,0CAAE,KAAK,MAAG,EACnD,SAAS,EAAE,aAAa,EACxB,QAAQ,EAAE,YAAY,GACtB,CACH,CACA,CACJ,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export default function SwitchItem(_a) {
|
|
2
|
+
var id = _a.id, label = _a.label, enabled = _a.enabled, onToggle = _a.onToggle;
|
|
3
|
+
return (React.createElement("label", { style: { display: 'block', margin: '8px 0' } },
|
|
4
|
+
React.createElement("input", { type: 'checkbox', checked: enabled, onChange: function () { return onToggle(id, !enabled); } }),
|
|
5
|
+
label));
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=SwitchItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitchItem.js","sourceRoot":"","sources":["../../../src/components/SwitchItem.tsx"],"names":[],"mappings":"AAOA,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAAiD;QAA/C,EAAE,QAAA,EAAE,KAAK,WAAA,EAAE,OAAO,aAAA,EAAE,QAAQ,cAAA;IAC/D,OAAO,CACL,+BAAO,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;QACjD,+BAAO,IAAI,EAAC,UAAU,EAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAM,OAAA,QAAQ,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAtB,CAAsB,GAAI;QAClF,KAAK,CACA,CACT,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LabelProps } from './Label';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export interface TextInputProps {
|
|
4
|
+
labelProps?: LabelProps;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
variant?: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
}
|
|
10
|
+
export default function TextInput({ labelProps, placeholder, type, variant, id }: TextInputProps): React.JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import Label from './Label';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { Button, Form } from 'react-bootstrap';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
export default function TextInput(_a) {
|
|
8
|
+
var labelProps = _a.labelProps, placeholder = _a.placeholder, _b = _a.type, type = _b === void 0 ? 'text' : _b, _c = _a.variant, variant = _c === void 0 ? 'sm' : _c, id = _a.id;
|
|
9
|
+
var _d = useState(false), showPassword = _d[0], setShowPassword = _d[1];
|
|
10
|
+
var handleToggle = function () {
|
|
11
|
+
setShowPassword(function (prev) { return !prev; });
|
|
12
|
+
};
|
|
13
|
+
function renderInput() {
|
|
14
|
+
return (React.createElement(Form.Control, { placeholder: placeholder, id: id, type: type === 'password' && showPassword ? 'text' : type, className: clsx("form-control-".concat(variant)) }));
|
|
15
|
+
}
|
|
16
|
+
return (React.createElement("div", { className: clsx('text-input-wrapper') },
|
|
17
|
+
React.createElement(Label, __assign({}, labelProps, { id: id })),
|
|
18
|
+
type === 'password' ? (React.createElement("div", { className: 'position-relative' },
|
|
19
|
+
renderInput(),
|
|
20
|
+
React.createElement(Button, { variant: 'transparent', className: 'form-control-icon text-dark', onClick: handleToggle },
|
|
21
|
+
React.createElement("i", { className: clsx(showPassword ? 'bi bi-eye bi' : 'bi-eye-slash') })))) : (renderInput())));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=TextInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../../src/components/TextInput.tsx"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,OAAO,KAAK,MAAM,SAAS,CAAA;AAC3B,OAAO,EAAE,QAAQ,EAAqB,MAAM,OAAO,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,KAAK,MAAM,OAAO,CAAA;AAUzB,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAA8E;QAA5E,UAAU,gBAAA,EAAE,WAAW,iBAAA,EAAE,YAAa,EAAb,IAAI,mBAAG,MAAM,KAAA,EAAE,eAAc,EAAd,OAAO,mBAAG,IAAI,KAAA,EAAE,EAAE,QAAA;IACtF,IAAA,KAAkC,QAAQ,CAAC,KAAK,CAAC,EAAhD,YAAY,QAAA,EAAE,eAAe,QAAmB,CAAA;IAEvD,IAAM,YAAY,GAAG;QACnB,eAAe,CAAC,UAAC,IAAI,IAAK,OAAA,CAAC,IAAI,EAAL,CAAK,CAAC,CAAA;IAClC,CAAC,CAAA;IAED,SAAS,WAAW;QAClB,OAAO,CACL,oBAAC,IAAI,CAAC,OAAO,IACX,WAAW,EAAE,WAAW,EACxB,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,KAAK,UAAU,IAAI,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EACzD,SAAS,EAAE,IAAI,CAAC,uBAAgB,OAAO,CAAE,CAAC,GAC1C,CACH,CAAA;IACH,CAAC;IAED,OAAO,CACL,6BAAK,SAAS,EAAE,IAAI,CAAC,oBAAoB,CAAC;QACxC,oBAAC,KAAK,eAAK,UAAU,IAAE,EAAE,EAAE,EAAE,IAAI;QAChC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,CACrB,6BAAK,SAAS,EAAC,mBAAmB;YAC/B,WAAW,EAAE;YACd,oBAAC,MAAM,IAAC,OAAO,EAAC,aAAa,EAAC,SAAS,EAAC,6BAA6B,EAAC,OAAO,EAAE,YAAY;gBACzF,2BAAG,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,GAAI,CAC/D,CACL,CACP,CAAC,CAAC,CAAC,CACF,WAAW,EAAE,CACd,CACG,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LOGO_IMG = "app/assets/images/logo.png";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aap.js","sourceRoot":"","sources":["../../../src/constants/aap.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,QAAQ,GAAG,4BAA4B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LOGO_IMG = "app/assets/images/logo.png";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/constants/app.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,QAAQ,GAAG,4BAA4B,CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"images.js","sourceRoot":"","sources":["../../../src/constants/images.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../src/constants/routes.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/container/index.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safely returns the provided object or an empty object as fallback.
|
|
3
|
+
* @param value - The object to check.
|
|
4
|
+
* @returns The original object if defined, otherwise an empty object of type T.
|
|
5
|
+
*/
|
|
6
|
+
export declare function destructObj<T extends object>(value?: T): T;
|
|
7
|
+
/**
|
|
8
|
+
* Checks if the given value is an empty string (after trimming).
|
|
9
|
+
* @param value - The string to check.
|
|
10
|
+
* @returns true if the value is not a valid string or is empty after trimming, false otherwise.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isEmptyString(value?: string | null): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Checks if the given value is a non-empty string.
|
|
15
|
+
* @param value - The string to check.
|
|
16
|
+
* @returns true if the value is a string with at least one character, false otherwise.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isStringNotEmpty(value?: string | null): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Checks if the given value is a non-empty array.
|
|
21
|
+
* @param value - The array to check.
|
|
22
|
+
* @returns true if the value is an array with at least one element, false otherwise.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isArrayNotEmpty<T>(value?: T[] | null): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Checks if the given value is an empty array.
|
|
27
|
+
* @param value - The array to check.
|
|
28
|
+
* @returns true if the value is an array with no elements, false otherwise.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isArrayEmpty<T>(value?: T[] | null): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Safely returns the length of the given array.
|
|
33
|
+
* @param value - The array to check.
|
|
34
|
+
* @returns The number of elements in the array, or 0 if the array is null/undefined.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getArrayLength<T>(value?: T[] | null): number;
|
|
37
|
+
/**
|
|
38
|
+
* Safely checks if the given array includes a specific value.
|
|
39
|
+
* @param array - The array to check.
|
|
40
|
+
* @param item - The item to search for.
|
|
41
|
+
* @returns true if the array includes the item, false otherwise.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isArrayIncludes<T>(array: T[] | null | undefined, item: T): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Checks if the given value is an empty object.
|
|
46
|
+
* @param value - The object to check.
|
|
47
|
+
* @returns true if the value is an object with no own enumerable keys, false otherwise.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isObjEmpty(value?: object | null): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Checks if the given value is a non-empty plain object.
|
|
52
|
+
* @param value - The object to check.
|
|
53
|
+
* @returns true if the value is a plain object with at least one own key, false otherwise.
|
|
54
|
+
*/
|
|
55
|
+
export declare function isObjNotEmpty(value?: object | null): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Checks if the given value is empty.
|
|
58
|
+
* Supports: string, array, object.
|
|
59
|
+
* @param value - The value to check.
|
|
60
|
+
* @returns true if the value is empty, false otherwise.
|
|
61
|
+
*/
|
|
62
|
+
export declare function isEmpty(value: any): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Generates an array of dates between two dates (inclusive).
|
|
65
|
+
* @param start - The start date.
|
|
66
|
+
* @param end - The end date.
|
|
67
|
+
* @returns An array of Date objects from start to end.
|
|
68
|
+
*/
|
|
69
|
+
export declare function getDates(start: Date, end: Date): Date[];
|
|
70
|
+
/**
|
|
71
|
+
* Formats a given date into a string.
|
|
72
|
+
* @param date - The date to format.
|
|
73
|
+
* @param format - The format string (default: "YYYY-MM-DD").
|
|
74
|
+
* Supported tokens: YYYY, MM, DD, HH, mm, ss
|
|
75
|
+
* @returns The formatted date string.
|
|
76
|
+
*/
|
|
77
|
+
export declare function getFormattedDate(date: Date, format?: string): string;
|
|
78
|
+
/**
|
|
79
|
+
* Returns the current logged-in user from localStorage.
|
|
80
|
+
*/
|
|
81
|
+
export declare function getCurrentUser(): any | null;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safely returns the provided object or an empty object as fallback.
|
|
3
|
+
* @param value - The object to check.
|
|
4
|
+
* @returns The original object if defined, otherwise an empty object of type T.
|
|
5
|
+
*/
|
|
6
|
+
export function destructObj(value) {
|
|
7
|
+
return (value !== null && value !== void 0 ? value : {});
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Checks if the given value is an empty string (after trimming).
|
|
11
|
+
* @param value - The string to check.
|
|
12
|
+
* @returns true if the value is not a valid string or is empty after trimming, false otherwise.
|
|
13
|
+
*/
|
|
14
|
+
export function isEmptyString(value) {
|
|
15
|
+
return !(typeof value === 'string' && value.trim().length > 0);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Checks if the given value is a non-empty string.
|
|
19
|
+
* @param value - The string to check.
|
|
20
|
+
* @returns true if the value is a string with at least one character, false otherwise.
|
|
21
|
+
*/
|
|
22
|
+
export function isStringNotEmpty(value) {
|
|
23
|
+
return typeof value === 'string' && value.trim().length > 0;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Checks if the given value is a non-empty array.
|
|
27
|
+
* @param value - The array to check.
|
|
28
|
+
* @returns true if the value is an array with at least one element, false otherwise.
|
|
29
|
+
*/
|
|
30
|
+
export function isArrayNotEmpty(value) {
|
|
31
|
+
return Array.isArray(value) && value.length > 0;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Checks if the given value is an empty array.
|
|
35
|
+
* @param value - The array to check.
|
|
36
|
+
* @returns true if the value is an array with no elements, false otherwise.
|
|
37
|
+
*/
|
|
38
|
+
export function isArrayEmpty(value) {
|
|
39
|
+
return Array.isArray(value) && value.length === 0;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Safely returns the length of the given array.
|
|
43
|
+
* @param value - The array to check.
|
|
44
|
+
* @returns The number of elements in the array, or 0 if the array is null/undefined.
|
|
45
|
+
*/
|
|
46
|
+
export function getArrayLength(value) {
|
|
47
|
+
return Array.isArray(value) ? value.length : 0;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Safely checks if the given array includes a specific value.
|
|
51
|
+
* @param array - The array to check.
|
|
52
|
+
* @param item - The item to search for.
|
|
53
|
+
* @returns true if the array includes the item, false otherwise.
|
|
54
|
+
*/
|
|
55
|
+
export function isArrayIncludes(array, item) {
|
|
56
|
+
return Array.isArray(array) && array.includes(item);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Checks if the given value is an empty object.
|
|
60
|
+
* @param value - The object to check.
|
|
61
|
+
* @returns true if the value is an object with no own enumerable keys, false otherwise.
|
|
62
|
+
*/
|
|
63
|
+
export function isObjEmpty(value) {
|
|
64
|
+
return !!value && Object.keys(value).length === 0 && value.constructor === Object;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Checks if the given value is a non-empty plain object.
|
|
68
|
+
* @param value - The object to check.
|
|
69
|
+
* @returns true if the value is a plain object with at least one own key, false otherwise.
|
|
70
|
+
*/
|
|
71
|
+
export function isObjNotEmpty(value) {
|
|
72
|
+
return !!value && value.constructor === Object && Object.keys(value).length > 0;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Checks if the given value is empty.
|
|
76
|
+
* Supports: string, array, object.
|
|
77
|
+
* @param value - The value to check.
|
|
78
|
+
* @returns true if the value is empty, false otherwise.
|
|
79
|
+
*/
|
|
80
|
+
export function isEmpty(value) {
|
|
81
|
+
if (value == null)
|
|
82
|
+
return true; // null or undefined
|
|
83
|
+
if (typeof value === 'string') {
|
|
84
|
+
return value.trim().length === 0;
|
|
85
|
+
}
|
|
86
|
+
if (Array.isArray(value)) {
|
|
87
|
+
return value.length === 0;
|
|
88
|
+
}
|
|
89
|
+
if (typeof value === 'object') {
|
|
90
|
+
return Object.keys(value).length === 0 && value.constructor === Object;
|
|
91
|
+
}
|
|
92
|
+
return false; // for numbers, booleans, functions, etc.
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Generates an array of dates between two dates (inclusive).
|
|
96
|
+
* @param start - The start date.
|
|
97
|
+
* @param end - The end date.
|
|
98
|
+
* @returns An array of Date objects from start to end.
|
|
99
|
+
*/
|
|
100
|
+
export function getDates(start, end) {
|
|
101
|
+
var dates = [];
|
|
102
|
+
var current = new Date(start);
|
|
103
|
+
while (current <= end) {
|
|
104
|
+
dates.push(new Date(current)); // push a copy
|
|
105
|
+
current.setDate(current.getDate() + 1); // move to next day
|
|
106
|
+
}
|
|
107
|
+
return dates;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Formats a given date into a string.
|
|
111
|
+
* @param date - The date to format.
|
|
112
|
+
* @param format - The format string (default: "YYYY-MM-DD").
|
|
113
|
+
* Supported tokens: YYYY, MM, DD, HH, mm, ss
|
|
114
|
+
* @returns The formatted date string.
|
|
115
|
+
*/
|
|
116
|
+
export function getFormattedDate(date, format) {
|
|
117
|
+
if (format === void 0) { format = 'YYYY-MM-DD'; }
|
|
118
|
+
var pad = function (n) { return n.toString().padStart(2, '0'); };
|
|
119
|
+
var map = {
|
|
120
|
+
YYYY: date.getFullYear().toString(),
|
|
121
|
+
MM: pad(date.getMonth() + 1),
|
|
122
|
+
DD: pad(date.getDate()),
|
|
123
|
+
HH: pad(date.getHours()),
|
|
124
|
+
mm: pad(date.getMinutes()),
|
|
125
|
+
ss: pad(date.getSeconds()),
|
|
126
|
+
};
|
|
127
|
+
return format.replace(/YYYY|MM|DD|HH|mm|ss/g, function (match) { return map[match]; });
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Returns the current logged-in user from localStorage.
|
|
131
|
+
*/
|
|
132
|
+
export function getCurrentUser() {
|
|
133
|
+
var user = localStorage.getItem('currentUser');
|
|
134
|
+
return user ? JSON.parse(user) : null;
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/helpers/app.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAmB,KAAS;IACrD,OAAO,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAM,CAAA;AAC3B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAqB;IACjD,OAAO,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;AAChE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAqB;IACpD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAA;AAC7D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAI,KAAkB;IACnD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAA;AACjD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAI,KAAkB;IAChD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAA;AACnD,CAAC;AAED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B,EAAE,UAAC,KAAK,IAAK,OAAA,GAAG,CAAC,KAAK,CAAC,EAAV,CAAU,CAAC,CAAA;AACtE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,IAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;IAChD,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AACvC,CAAC"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":""}
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import TextInput from './components/TextInput';
|
|
2
|
+
import Label from './components/Label';
|
|
3
|
+
import Button from './components/Button';
|
|
4
|
+
export { Label, Button, TextInput };
|
|
3
5
|
//# sourceMappingURL=index.js.map
|