@empreint/ui 1.1.0 → 1.2.0
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/breadcrumb/breadcrumb.js +29 -0
- package/dist/components/breadcrumb/breadcrumb.module.js +8 -0
- package/dist/components/button/button.js +14 -0
- package/dist/components/button/button.module.js +3 -0
- package/dist/components/card/card.js +23 -0
- package/dist/components/card/card.module.js +8 -0
- package/dist/components/checkbox/checkbox.js +18 -0
- package/dist/components/checkbox/checkbox.module.js +7 -0
- package/dist/components/chip/chip.js +25 -0
- package/dist/components/chip/chip.module.js +6 -0
- package/dist/components/collapsible/collapsible.js +51 -0
- package/dist/components/collapsible/collapsible.module.js +9 -0
- package/dist/components/container/container.js +12 -0
- package/dist/components/container/container.module.js +3 -0
- package/dist/components/dropdown-menu/dropdown-menu.js +59 -0
- package/dist/components/dropdown-menu/dropdown-menu.module.js +8 -0
- package/dist/components/dropzone/dropzone.js +99 -0
- package/dist/components/dropzone/dropzone.module.js +9 -0
- package/dist/components/flex/flex.js +17 -0
- package/dist/components/flex/flex.module.js +3 -0
- package/dist/components/grid/grid.js +16 -0
- package/dist/components/grid/grid.module.js +3 -0
- package/dist/components/input/input.js +44 -0
- package/dist/components/input/input.module.js +8 -0
- package/dist/components/language-selector/language-selector.js +19 -0
- package/dist/components/language-selector/language-selector.module.js +3 -0
- package/dist/components/list/list.js +15 -0
- package/dist/components/list/list.module.js +6 -0
- package/dist/components/loader/loader.js +21 -0
- package/dist/components/loader/loader.module.js +8 -0
- package/dist/components/modal/modal.js +69 -0
- package/dist/components/modal/modal.module.js +10 -0
- package/dist/components/pagination/pagination.js +77 -0
- package/dist/components/pagination/pagination.module.js +6 -0
- package/dist/components/popover/popover.js +38 -0
- package/dist/components/popover/popover.module.js +7 -0
- package/dist/components/radio-group/radio-group.js +43 -0
- package/dist/components/radio-group/radio-group.module.js +8 -0
- package/dist/components/select/select.js +75 -0
- package/dist/components/select/select.module.js +10 -0
- package/dist/components/separator/separator.js +14 -0
- package/dist/components/separator/separator.module.js +3 -0
- package/dist/components/sidebar/sidebar.js +31 -0
- package/dist/components/sidebar/sidebar.module.js +9 -0
- package/dist/components/slot/slot.js +39 -0
- package/dist/components/table/table.js +45 -0
- package/dist/components/table/table.module.js +10 -0
- package/dist/components/tabs/tabs.js +45 -0
- package/dist/components/tabs/tabs.module.js +8 -0
- package/dist/components/text/text.js +14 -0
- package/dist/components/text/text.module.js +3 -0
- package/dist/components/title/title.js +15 -0
- package/dist/components/title/title.module.js +3 -0
- package/dist/components/wizard/wizard.js +108 -0
- package/dist/components/wizard/wizard.module.js +8 -0
- package/dist/hooks/use-breadcrumb/use-breadcrumb.js +13 -0
- package/dist/hooks/use-disclosure/use-disclosure.js +20 -0
- package/dist/hooks/use-match-device/use-match-device.js +13 -0
- package/dist/hooks/use-match-resolution/use-match-resolution.js +53 -0
- package/dist/hooks/use-outside-alerter/use-outside-alerter.js +20 -0
- package/dist/hooks/use-pagination/use-pagination.js +31 -0
- package/dist/hooks/use-scroll-to/use-scroll-to.js +6 -0
- package/dist/hooks/use-visible/use-visible.js +13 -0
- package/dist/hooks/use-wizard/use-wizard.js +14 -0
- package/dist/index.d.ts +183 -297
- package/dist/index.js +40 -0
- package/dist/styles.css +2 -0
- package/package.json +18 -27
- package/LICENSE.md +0 -674
- package/README.md +0 -27
- package/dist/empreint.css +0 -2
- package/dist/empreint.js +0 -958
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useOutsideAlerter as e } from "../use-outside-alerter/use-outside-alerter.js";
|
|
2
|
+
import { useEffect as t, useRef as n, useState as r } from "react";
|
|
3
|
+
//#region src/hooks/use-disclosure/use-disclosure.ts
|
|
4
|
+
var i = ({ closeOnOutsideClick: i = !0 } = {}) => {
|
|
5
|
+
let [a, o] = r(!1), s = n(null), { hasClickedOutside: c, onReset: l } = e(s);
|
|
6
|
+
return t(() => {
|
|
7
|
+
i && c && (o(!1), l());
|
|
8
|
+
}, [
|
|
9
|
+
i,
|
|
10
|
+
c,
|
|
11
|
+
l
|
|
12
|
+
]), {
|
|
13
|
+
isOpen: a,
|
|
14
|
+
onClose: () => o(!1),
|
|
15
|
+
onToggle: () => o(!a),
|
|
16
|
+
ref: s
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { i as useDisclosure };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UAParser as e } from "ua-parser-js";
|
|
2
|
+
//#region src/hooks/use-match-device/use-match-device.ts
|
|
3
|
+
var t = (t) => {
|
|
4
|
+
let n = new e(t).getDevice();
|
|
5
|
+
return {
|
|
6
|
+
isMobile: n.is("mobile"),
|
|
7
|
+
isTablet: n.is("tablet"),
|
|
8
|
+
isMobileOrTablet: n.is("mobile") || n.is("tablet"),
|
|
9
|
+
isDesktop: !n.type
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { t as useMatchDevice };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useMatchDevice as e } from "../use-match-device/use-match-device.js";
|
|
2
|
+
import { useCallback as t, useEffect as n, useState as r } from "react";
|
|
3
|
+
//#region src/hooks/use-match-resolution/use-match-resolution.ts
|
|
4
|
+
var i = {
|
|
5
|
+
desktop: "(min-width: 1281px)",
|
|
6
|
+
laptop: "(min-width: 1025px) and (max-width: 1280px)",
|
|
7
|
+
laptopOrUpper: "(min-width: 1025px)",
|
|
8
|
+
laptopOrLower: "(max-width: 1280px)",
|
|
9
|
+
tablet: "(min-width: 768px) and (max-width: 1024px)",
|
|
10
|
+
tabletOrUpper: "(min-width: 768px)",
|
|
11
|
+
tabletOrLower: "(max-width: 1024px)",
|
|
12
|
+
largeMobile: "(min-width: 481px) and (max-width: 767px)",
|
|
13
|
+
largeMobileOrUpper: "(min-width: 481px)",
|
|
14
|
+
largeMobileOrLower: "(max-width: 767px)",
|
|
15
|
+
mobile: "(min-width: 320px) and (max-width: 480px)",
|
|
16
|
+
portrait: "(orientation: portrait)",
|
|
17
|
+
landscape: "(orientation: landscape)"
|
|
18
|
+
}, a = (a, o = i) => {
|
|
19
|
+
let s = typeof window < "u", { isDesktop: c, isMobile: l } = e(a), u = t((e) => s && window.matchMedia(e).matches, [s]), d = t(() => ({
|
|
20
|
+
isDesktop: s ? u(o.desktop) : c,
|
|
21
|
+
isLaptop: s ? u(o.laptop) : c,
|
|
22
|
+
isLaptopOrUpper: s ? u(o.laptopOrUpper) : c,
|
|
23
|
+
isLaptopOrLower: s ? u(o.laptopOrLower) : !1,
|
|
24
|
+
isTablet: s ? u(o.tablet) : l,
|
|
25
|
+
isTabletOrUpper: s ? u(o.tabletOrUpper) : !1,
|
|
26
|
+
isTabletOrLower: s ? u(o.tabletOrLower) : l,
|
|
27
|
+
isLargeMobile: s ? u(o.largeMobile) : l,
|
|
28
|
+
isLargeMobileOrUpper: s ? u(o.largeMobileOrUpper) : !1,
|
|
29
|
+
isLargeMobileOrLower: s ? u(o.largeMobileOrLower) : l,
|
|
30
|
+
isMobile: s ? u(o.mobile) : l,
|
|
31
|
+
isPortrait: s ? u(o.portrait) : !1,
|
|
32
|
+
isLandscape: s ? u(o.landscape) : !1
|
|
33
|
+
}), [
|
|
34
|
+
o,
|
|
35
|
+
s,
|
|
36
|
+
c,
|
|
37
|
+
l,
|
|
38
|
+
u
|
|
39
|
+
]), [f, p] = r(d());
|
|
40
|
+
return n(() => {
|
|
41
|
+
if (!s) return;
|
|
42
|
+
let e = () => p(d());
|
|
43
|
+
return window.addEventListener("resize", e), () => {
|
|
44
|
+
window.removeEventListener("resize", e);
|
|
45
|
+
};
|
|
46
|
+
}, [s, d]), {
|
|
47
|
+
resolution: f,
|
|
48
|
+
breakpoints: o,
|
|
49
|
+
match: u
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
//#endregion
|
|
53
|
+
export { i as defaultBreakpoints, a as useMatchResolution };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useEffect as e, useState as t } from "react";
|
|
2
|
+
//#region src/hooks/use-outside-alerter/use-outside-alerter.ts
|
|
3
|
+
var n = (n) => {
|
|
4
|
+
let [r, i] = t(!1);
|
|
5
|
+
return e(() => {
|
|
6
|
+
let e = (e) => {
|
|
7
|
+
e.target && n.current && i(!n.current.contains(e.target));
|
|
8
|
+
};
|
|
9
|
+
return document.addEventListener("mousedown", e), () => {
|
|
10
|
+
document.removeEventListener("mousedown", e);
|
|
11
|
+
};
|
|
12
|
+
}, [n]), {
|
|
13
|
+
hasClickedOutside: r,
|
|
14
|
+
onReset: () => {
|
|
15
|
+
i(!1);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { n as useOutsideAlerter };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useMemo as e, useState as t } from "react";
|
|
2
|
+
//#region src/hooks/use-pagination/use-pagination.ts
|
|
3
|
+
var n = ({ page: n, totalRecords: r, maxRecordsPerPage: i = 10, itemNeighbours: a = 2, minItems: o = 5, onChange: s }) => {
|
|
4
|
+
let [c, l] = t(n), u = Math.ceil(r / i), d = e(() => {
|
|
5
|
+
let e = [], t = Math.max(1, Math.min(c - a, u + 1 - o)), n = Math.min(u, Math.max(o, c + a));
|
|
6
|
+
for (let r = t; r <= n; r++) e.push(r);
|
|
7
|
+
return e;
|
|
8
|
+
}, [
|
|
9
|
+
c,
|
|
10
|
+
u,
|
|
11
|
+
a,
|
|
12
|
+
o
|
|
13
|
+
]), f = (e) => {
|
|
14
|
+
let t = Math.max(1, Math.min(e, u));
|
|
15
|
+
t !== c && (l(t), s?.(t));
|
|
16
|
+
};
|
|
17
|
+
return {
|
|
18
|
+
currentPage: c,
|
|
19
|
+
total: u,
|
|
20
|
+
items: d,
|
|
21
|
+
goToPage: f,
|
|
22
|
+
goToFirst: () => f(1),
|
|
23
|
+
goToPrevious: () => f(c - 1),
|
|
24
|
+
goToNext: () => f(c + 1),
|
|
25
|
+
goToLast: () => f(u),
|
|
26
|
+
isFirst: c === 1,
|
|
27
|
+
isLast: c === u
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { n as usePagination };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useEffect as e, useState as t } from "react";
|
|
2
|
+
//#region src/hooks/use-visible/use-visible.ts
|
|
3
|
+
var n = (n) => {
|
|
4
|
+
let [r, i] = t(!1);
|
|
5
|
+
return e(() => {
|
|
6
|
+
let e = new IntersectionObserver(([e]) => i(e.isIntersecting));
|
|
7
|
+
return n?.current && e.observe(n.current), () => {
|
|
8
|
+
n?.current && e.unobserve(n.current);
|
|
9
|
+
};
|
|
10
|
+
}, [n]), r;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { n as useVisible };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useState as e } from "react";
|
|
2
|
+
//#region src/hooks/use-wizard/use-wizard.ts
|
|
3
|
+
var t = ({ totalSteps: t, step: n = 1 }) => {
|
|
4
|
+
let [r, i] = e(n);
|
|
5
|
+
return {
|
|
6
|
+
currentIndex: r,
|
|
7
|
+
nextStep: () => i(r + 1),
|
|
8
|
+
previousStep: () => i(r - 1),
|
|
9
|
+
isFirstStep: r === 1,
|
|
10
|
+
isLastStep: r === t
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { t as useWizard };
|