@xola/ui-kit 3.6.0 → 3.7.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/README.md +98 -19
- package/build/components/Alert.js +29 -0
- package/build/components/Animation/FadeIn.js +40 -0
- package/build/components/Animation/SlideDown.js +25 -0
- package/build/components/Avatar.js +28 -0
- package/build/components/Badge.js +51 -0
- package/build/components/BottomSheet.js +114 -0
- package/build/components/Breadcrumb.js +33 -0
- package/build/components/Breakdown.js +81 -0
- package/build/components/Buttons/Button.js +89 -0
- package/build/components/Buttons/ButtonGroup.js +58 -0
- package/build/components/Buttons/SecondaryButton.js +31 -0
- package/build/components/Buttons/SubmitButton.js +89 -0
- package/build/components/Buttons/ToggleButton.js +33 -0
- package/build/components/Charts/BaseChartOptions.js +95 -0
- package/build/components/Charts/HistogramOptions.js +69 -0
- package/build/components/Charts/PieOptions.js +55 -0
- package/build/components/Counter.js +20 -0
- package/build/components/DatePicker/DatePicker.helpers.js +33 -0
- package/build/components/DatePicker/DatePicker.js +214 -0
- package/build/components/DatePicker/DatePickerPopover.js +90 -0
- package/build/components/DatePicker/Day.js +43 -0
- package/build/components/DatePicker/LocalizedDayPicker.js +17 -0
- package/build/components/DatePicker/MonthGrid.js +39 -0
- package/build/components/DatePicker/MonthPicker.js +33 -0
- package/build/components/DatePicker/MonthSelector.js +46 -0
- package/build/components/DatePicker/MonthYearSelector.js +23 -0
- package/build/components/DatePicker/NavbarElement.js +34 -0
- package/build/components/DatePicker/RangeDatePicker.js +111 -0
- package/build/components/DatePicker/RelativeDateRange.js +290 -0
- package/build/components/DatePicker/UpcomingDatePicker.js +31 -0
- package/build/components/Dot/Dot.js +29 -0
- package/build/components/Dot/DotProgress.js +15 -0
- package/build/components/Drawer.js +134 -0
- package/build/components/Forms/BaseInput.js +57 -0
- package/build/components/Forms/Checkbox.js +37 -0
- package/build/components/Forms/Checkbox.module.css.js +7 -0
- package/build/components/Forms/ComboBox.js +41 -0
- package/build/components/Forms/FormGroup.js +10 -0
- package/build/components/Forms/InlineValuePopover.js +41 -0
- package/build/components/Forms/Input.js +17 -0
- package/build/components/Forms/Label.js +23 -0
- package/build/components/Forms/RangeSlider.js +58 -0
- package/build/components/Forms/Select.js +7 -0
- package/build/components/Forms/Switch.js +70 -0
- package/build/components/Forms/Textarea.js +42 -0
- package/build/components/Forms/ValuePopoverText.js +7 -0
- package/build/components/GooglePlacesAutocomplete.js +112 -0
- package/build/components/HeaderToolbar.js +41 -0
- package/build/components/ImageUpload.js +83 -0
- package/build/components/Key.js +33 -0
- package/build/components/Logo.js +17 -0
- package/build/components/Modal.js +141 -0
- package/build/components/Popover/Popover.js +53 -0
- package/build/components/Popover/Popover.module.css.js +7 -0
- package/build/components/Popover/PopoverList.js +57 -0
- package/build/components/Popover/PopoverScroll.module.css.js +4 -0
- package/build/components/Provider.js +16 -0
- package/build/components/Screens/Login.js +115 -0
- package/build/components/Search.js +144 -0
- package/build/components/Sidebar/Sidebar.Account.js +49 -0
- package/build/components/Sidebar/Sidebar.Button.js +47 -0
- package/build/components/Sidebar/Sidebar.Footer.js +10 -0
- package/build/components/Sidebar/Sidebar.Heading.js +13 -0
- package/build/components/Sidebar/Sidebar.Link.js +92 -0
- package/build/components/Sidebar/Sidebar.Menu.js +54 -0
- package/build/components/Sidebar/Sidebar.Menu.module.css.js +7 -0
- package/build/components/Sidebar/Sidebar.Notifications.js +107 -0
- package/build/components/Sidebar/Sidebar.js +212 -0
- package/build/components/Sidebar/SidebarContext.js +15 -0
- package/build/components/Sidebar/SidebarScroll.module.css.js +4 -0
- package/build/components/Sidebar/sidebarWidth.js +41 -0
- package/build/components/Sidebar/useSidebarWidthState.js +115 -0
- package/build/components/Skeleton.js +28 -0
- package/build/components/Skeleton.module.css.js +7 -0
- package/build/components/Spinner.js +35 -0
- package/build/components/Table.js +107 -0
- package/build/components/Tabs/Tabs.Panel.js +11 -0
- package/build/components/Tabs/Tabs.Tab.js +42 -0
- package/build/components/Tabs/Tabs.js +28 -0
- package/build/components/Tag.js +41 -0
- package/build/components/Tooltip.js +22 -0
- package/build/components/Utilities/Currency.js +56 -0
- package/build/components/Utilities/Number.js +17 -0
- package/build/components/Utilities/Phone.js +25 -0
- package/build/helpers/browser.js +9 -0
- package/build/helpers/children.js +6 -0
- package/build/helpers/classnames.js +8 -0
- package/build/helpers/environment.js +10 -0
- package/build/helpers/flash.js +86 -0
- package/build/hooks/useIsClient.js +10 -0
- package/build/hooks/useIsMobile.js +8 -0
- package/build/hooks/useViewportHeight.js +9 -0
- package/build/icons/src/AnnounceIcon.js +12 -0
- package/build/icons/src/BellIcon.js +26 -0
- package/build/icons/src/CalendarIcon.js +15 -0
- package/build/icons/src/CheckIcon.js +7 -0
- package/build/icons/src/ChevronDownIcon.js +7 -0
- package/build/icons/src/ChevronLeftIcon.js +7 -0
- package/build/icons/src/ChevronRightIcon.js +7 -0
- package/build/icons/src/CircleNotch.js +5 -0
- package/build/icons/src/CloseIcon.js +13 -0
- package/build/icons/src/DownArrowIcon.js +15 -0
- package/build/icons/src/ImageIcon.js +26 -0
- package/build/icons/src/SearchIcon.js +15 -0
- package/build/icons/src/TrashIcon.js +19 -0
- package/build/icons/src/WarningDiamondIcon.js +26 -0
- package/build/icons/src/helpers/icon.js +7 -0
- package/build/icons/src/helpers/iconSizes.js +13 -0
- package/build/icons/src/images/XolaLogoSimple.js +13 -0
- package/build/index.js +155 -0
- package/build/style.css +1 -1
- package/build/theme.js +374 -0
- package/build/utils/avatar.js +8 -0
- package/build/utils/currency.js +11 -0
- package/build/utils/date.js +46 -0
- package/build/utils/numbers.js +19 -0
- package/build/utils/phone.js +15 -0
- package/build/utils/userLocale.js +6 -0
- package/index.d.ts +132 -79
- package/package.json +76 -45
- package/postcss.config.js +1 -1
- package/skills/README.md +27 -0
- package/skills/migrate-2.6-to-3.7/SKILL.md +110 -0
- package/tailwind.config.js +9 -5
- package/build/ui-kit.es.js +0 -16771
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import r from "prop-types";
|
|
2
|
+
import i from "react";
|
|
3
|
+
import o from "../helpers/classnames.js";
|
|
4
|
+
import { CircleNotch as c } from "../icons/src/CircleNotch.js";
|
|
5
|
+
const a = {
|
|
6
|
+
primary: "text-primary",
|
|
7
|
+
secondary: "text-secondary",
|
|
8
|
+
warning: "text-warning",
|
|
9
|
+
success: "text-success",
|
|
10
|
+
danger: "text-danger",
|
|
11
|
+
caution: "text-caution",
|
|
12
|
+
current: null
|
|
13
|
+
// TODO: Consider setting this as the default value.
|
|
14
|
+
}, m = {
|
|
15
|
+
tiny: "w-4 h-4",
|
|
16
|
+
small: "w-7 h-7",
|
|
17
|
+
medium: "w-10 h-10",
|
|
18
|
+
large: "w-14 h-14",
|
|
19
|
+
current: "w-[1em] h-[1em]"
|
|
20
|
+
// TODO: Consider setting this as the default value.
|
|
21
|
+
}, l = ({ className: e, size: t = "small", color: n = "secondary", ...s }) => /* @__PURE__ */ i.createElement(
|
|
22
|
+
c,
|
|
23
|
+
{
|
|
24
|
+
className: o("ui-spinner", e, m[t], a[n], "inline-block animate-spin"),
|
|
25
|
+
...s
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
l.propTypes = {
|
|
29
|
+
className: r.string,
|
|
30
|
+
size: r.string,
|
|
31
|
+
color: r.string
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
l as Spinner
|
|
35
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import r from "prop-types";
|
|
2
|
+
import t, { useState as p, useRef as b, useEffect as w } from "react";
|
|
3
|
+
import i from "../helpers/classnames.js";
|
|
4
|
+
const e = ({ className: l, ...a }) => /* @__PURE__ */ t.createElement("div", { className: "ui-table flex flex-col" }, /* @__PURE__ */ t.createElement("div", { className: "-my-2 overflow-x-auto" }, /* @__PURE__ */ t.createElement("div", { className: "inline-block min-w-full py-2 align-middle" }, /* @__PURE__ */ t.createElement("div", { className: "overflow-hidden border-b border-gray-lighter sm:rounded-lg" }, /* @__PURE__ */ t.createElement("table", { className: i(l, "min-w-full divide-y border border-gray-lighter"), ...a })))));
|
|
5
|
+
e.propTypes = {
|
|
6
|
+
className: r.string
|
|
7
|
+
};
|
|
8
|
+
e.Head = ({ className: l, ...a }) => /* @__PURE__ */ t.createElement("thead", { className: i("ui-table-head", "bg-gray-lighter", l), ...a });
|
|
9
|
+
e.Head.displayName = "Table.Head";
|
|
10
|
+
e.Head.propTypes = {
|
|
11
|
+
className: r.string
|
|
12
|
+
};
|
|
13
|
+
e.Header = ({ className: l, ...a }) => /* @__PURE__ */ t.createElement("th", { className: i("ui-table-header", "px-4 py-2 text-left text-base font-bold", l), ...a });
|
|
14
|
+
e.Header.displayName = "Table.Header";
|
|
15
|
+
e.Header.propTypes = {
|
|
16
|
+
className: r.string
|
|
17
|
+
};
|
|
18
|
+
e.Body = ({ className: l, isStriped: a = !1, children: n, ...d }) => /* @__PURE__ */ t.createElement(
|
|
19
|
+
"tbody",
|
|
20
|
+
{
|
|
21
|
+
className: i(
|
|
22
|
+
"ui-table-body",
|
|
23
|
+
"border-none",
|
|
24
|
+
// Stripe via CSS instead of cloning isStriped onto every child; a non-Row child
|
|
25
|
+
// would otherwise spread it to the DOM and warn under React.
|
|
26
|
+
a && "[&>tr:nth-child(even)]:bg-gray-lighter",
|
|
27
|
+
l
|
|
28
|
+
),
|
|
29
|
+
...d
|
|
30
|
+
},
|
|
31
|
+
n
|
|
32
|
+
);
|
|
33
|
+
e.Body.displayName = "Table.Body";
|
|
34
|
+
e.Body.propTypes = {
|
|
35
|
+
className: r.string,
|
|
36
|
+
children: r.node.isRequired,
|
|
37
|
+
isStriped: r.bool
|
|
38
|
+
};
|
|
39
|
+
e.Row = ({ isStriped: l = !1, className: a, ...n }) => /* @__PURE__ */ t.createElement("tr", { className: i("ui-table-row", l && "even:bg-gray-lighter", a), ...n });
|
|
40
|
+
e.Row.displayName = "Table.Row";
|
|
41
|
+
e.Row.propTypes = {
|
|
42
|
+
isStriped: r.bool,
|
|
43
|
+
className: r.string
|
|
44
|
+
};
|
|
45
|
+
e.Cell = ({ className: l, ...a }) => /* @__PURE__ */ t.createElement(
|
|
46
|
+
"td",
|
|
47
|
+
{
|
|
48
|
+
className: i("ui-table-cell", "whitespace-nowrap px-4 py-2 text-base text-gray-darker", l),
|
|
49
|
+
...a
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
e.Cell.displayName = "Table.Cell";
|
|
53
|
+
e.Cell.propTypes = {
|
|
54
|
+
className: r.string
|
|
55
|
+
};
|
|
56
|
+
const v = ({ className: l, value: a, onSave: n, ...d }) => {
|
|
57
|
+
const [o, u] = p(!1), [c, y] = p(a), m = b(null), g = b(null), [h, f] = p("auto"), N = async () => {
|
|
58
|
+
u(!1), c !== a && n(c);
|
|
59
|
+
}, E = () => {
|
|
60
|
+
o || u(!0);
|
|
61
|
+
}, x = (s) => {
|
|
62
|
+
y(s.target.value), s.target.style.height = "auto", s.target.style.height = `${s.target.scrollHeight}px`;
|
|
63
|
+
};
|
|
64
|
+
return w(() => {
|
|
65
|
+
if (o) {
|
|
66
|
+
requestAnimationFrame(() => {
|
|
67
|
+
var s;
|
|
68
|
+
(s = g.current) == null || s.focus();
|
|
69
|
+
});
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
m.current && f(`${m.current.scrollHeight * 1.07}px`);
|
|
73
|
+
}, [o]), /* @__PURE__ */ t.createElement(
|
|
74
|
+
"td",
|
|
75
|
+
{
|
|
76
|
+
className: i(
|
|
77
|
+
"ui-table-cell",
|
|
78
|
+
"whitespace-nowrap px-4 py-2 text-base text-gray-darker",
|
|
79
|
+
{ "bg-gray-hover": o },
|
|
80
|
+
l
|
|
81
|
+
),
|
|
82
|
+
onClick: E,
|
|
83
|
+
...d
|
|
84
|
+
},
|
|
85
|
+
o ? /* @__PURE__ */ t.createElement(
|
|
86
|
+
"textarea",
|
|
87
|
+
{
|
|
88
|
+
ref: g,
|
|
89
|
+
value: c,
|
|
90
|
+
style: { height: h },
|
|
91
|
+
className: "h-auto w-full rounded border-none p-1 focus:outline-0 focus:!ring-gray-light",
|
|
92
|
+
onChange: x,
|
|
93
|
+
onBlur: N
|
|
94
|
+
}
|
|
95
|
+
) : /* @__PURE__ */ t.createElement("div", { ref: m, className: "cursor-text whitespace-pre-wrap" }, c || /* @__PURE__ */ t.createElement("span", { className: "text-gray" }, "Not Available"))
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
e.EditableCell = v;
|
|
99
|
+
e.EditableCell.displayName = "Table.EditableCell";
|
|
100
|
+
e.EditableCell.propTypes = {
|
|
101
|
+
className: r.string,
|
|
102
|
+
value: r.string.isRequired,
|
|
103
|
+
onSave: r.func.isRequired
|
|
104
|
+
};
|
|
105
|
+
export {
|
|
106
|
+
e as Table
|
|
107
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import p from "prop-types";
|
|
2
|
+
import s from "react";
|
|
3
|
+
import t from "../../helpers/classnames.js";
|
|
4
|
+
const e = ({ className: a, ...r }) => /* @__PURE__ */ s.createElement("div", { className: t("ui-tabs-panel", a), ...r });
|
|
5
|
+
e.propTypes = {
|
|
6
|
+
className: p.string
|
|
7
|
+
};
|
|
8
|
+
e.displayName = "Tabs.Panel";
|
|
9
|
+
export {
|
|
10
|
+
e as Panel
|
|
11
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import e from "prop-types";
|
|
2
|
+
import p from "react";
|
|
3
|
+
import t from "../../helpers/classnames.js";
|
|
4
|
+
const a = {
|
|
5
|
+
default: (r) => t(
|
|
6
|
+
"border-b border-gray-light",
|
|
7
|
+
r ? "text-primary border-l border-r border-b-transparent" : "hover:text-gray-darker"
|
|
8
|
+
),
|
|
9
|
+
simple: (r) => t(
|
|
10
|
+
"flex-1 text-lg transition-colors",
|
|
11
|
+
r ? "bg-white text-black" : "text-gray-dark hover:text-black hover:bg-gray-light"
|
|
12
|
+
)
|
|
13
|
+
}, o = ({
|
|
14
|
+
variant: r = "default",
|
|
15
|
+
as: s = "button",
|
|
16
|
+
className: i,
|
|
17
|
+
isActive: n = !1,
|
|
18
|
+
isHidden: l = !1,
|
|
19
|
+
...b
|
|
20
|
+
}) => l ? null : /* @__PURE__ */ p.createElement(
|
|
21
|
+
s,
|
|
22
|
+
{
|
|
23
|
+
className: t(
|
|
24
|
+
"ui-tabs-tab",
|
|
25
|
+
i,
|
|
26
|
+
"cursor-pointer whitespace-nowrap py-4 px-8 text-center font-semibold focus-visible:ring",
|
|
27
|
+
a[r](n)
|
|
28
|
+
),
|
|
29
|
+
...b
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
o.propTypes = {
|
|
33
|
+
variant: e.oneOf(Object.keys(a)),
|
|
34
|
+
as: e.oneOfType([e.string, e.elementType]),
|
|
35
|
+
className: e.string,
|
|
36
|
+
isActive: e.bool,
|
|
37
|
+
isHidden: e.bool
|
|
38
|
+
};
|
|
39
|
+
o.displayName = "Tabs.Tab";
|
|
40
|
+
export {
|
|
41
|
+
o as Tab
|
|
42
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import r from "prop-types";
|
|
2
|
+
import t, { Children as u, cloneElement as y } from "react";
|
|
3
|
+
import g from "../../helpers/classnames.js";
|
|
4
|
+
import { Panel as T } from "./Tabs.Panel.js";
|
|
5
|
+
import { Tab as h } from "./Tabs.Tab.js";
|
|
6
|
+
const m = {
|
|
7
|
+
default: "border-t border-gray-light",
|
|
8
|
+
simple: "bg-gray-lighter"
|
|
9
|
+
}, l = ({ className: c, variant: a = "default", value: i, onChange: o, children: d, ...b }) => {
|
|
10
|
+
const s = u.toArray(d), f = s.filter((e) => e.type === l.Tab), p = s.filter((e) => e.type === l.Panel);
|
|
11
|
+
return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("nav", { className: g("ui-tabs", "flex overflow-x-auto", m[a], c), ...b }, a === "default" ? /* @__PURE__ */ t.createElement("div", { className: "min-w-10 flex-shrink-0 border-b border-gray-light" }) : null, f.map((e, n) => y(e, {
|
|
12
|
+
variant: a,
|
|
13
|
+
isActive: n === i,
|
|
14
|
+
onClick: () => o == null ? void 0 : o(n)
|
|
15
|
+
})), a === "default" ? /* @__PURE__ */ t.createElement("div", { className: "min-w-10 flex-grow border-b border-gray-light" }) : null), p[i]);
|
|
16
|
+
};
|
|
17
|
+
l.propTypes = {
|
|
18
|
+
variant: r.oneOf(Object.keys(m)),
|
|
19
|
+
className: r.string,
|
|
20
|
+
value: r.number.isRequired,
|
|
21
|
+
onChange: r.func.isRequired,
|
|
22
|
+
children: r.node.isRequired
|
|
23
|
+
};
|
|
24
|
+
l.Tab = h;
|
|
25
|
+
l.Panel = T;
|
|
26
|
+
export {
|
|
27
|
+
l as Tabs
|
|
28
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import e from "prop-types";
|
|
2
|
+
import a from "react";
|
|
3
|
+
import o from "../helpers/classnames.js";
|
|
4
|
+
import { CloseIcon as m } from "../icons/src/CloseIcon.js";
|
|
5
|
+
const s = {
|
|
6
|
+
primary: "bg-primary-lighter text-black border border-primary",
|
|
7
|
+
secondary: "bg-secondary-light text-gray-darker border border-secondary",
|
|
8
|
+
success: "bg-success-lighter text-black border border-success",
|
|
9
|
+
warning: "bg-warning-lighter text-black border border-warning",
|
|
10
|
+
danger: "bg-danger-lighter text-black border border-danger",
|
|
11
|
+
caution: "bg-caution-lighter text-black border border-caution"
|
|
12
|
+
}, n = {
|
|
13
|
+
small: "px-1 py-0.75 text-sm leading-3.5",
|
|
14
|
+
medium: "px-2 py-1 text-base leading-3.5",
|
|
15
|
+
large: "px-2 py-1.5 text-base leading-4"
|
|
16
|
+
}, p = ({ color: c = "primary", size: t = "small", onClose: r, className: i, children: l, ...d }) => {
|
|
17
|
+
const g = (b) => {
|
|
18
|
+
b.stopPropagation(), r == null || r();
|
|
19
|
+
};
|
|
20
|
+
return /* @__PURE__ */ a.createElement("span", { className: o("ui-tag", "inline-flex rounded", s[c], n[t], i), ...d }, l, r ? /* @__PURE__ */ a.createElement(
|
|
21
|
+
m,
|
|
22
|
+
{
|
|
23
|
+
size: "small",
|
|
24
|
+
className: o(
|
|
25
|
+
"ui-tag-close ml-2 cursor-pointer leading-4 hover:text-gray-darker",
|
|
26
|
+
t === "large" ? "mt-0.5" : "mt-0.25"
|
|
27
|
+
),
|
|
28
|
+
onClick: g
|
|
29
|
+
}
|
|
30
|
+
) : null);
|
|
31
|
+
};
|
|
32
|
+
p.propTypes = {
|
|
33
|
+
color: e.oneOf(Object.keys(s)),
|
|
34
|
+
size: e.oneOf(Object.keys(n)),
|
|
35
|
+
onClose: e.func,
|
|
36
|
+
className: e.string,
|
|
37
|
+
children: e.node.isRequired
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
p as Tag
|
|
41
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import s from "@tippyjs/react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import o from "react";
|
|
4
|
+
import { followCursor as l } from "tippy.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
/* empty css */
|
|
7
|
+
/* empty css */
|
|
8
|
+
/* empty css */
|
|
9
|
+
/* empty css */
|
|
10
|
+
const a = ({ children: p, className: i, contentClassName: e, content: r, ...m }) => {
|
|
11
|
+
const n = e ? /* @__PURE__ */ o.createElement("span", { className: e }, r) : r;
|
|
12
|
+
return /* @__PURE__ */ o.createElement(s, { content: n, ...m, className: "ui-tooltip text-white", plugins: [l] }, /* @__PURE__ */ o.createElement("span", { className: i }, p));
|
|
13
|
+
};
|
|
14
|
+
a.propTypes = {
|
|
15
|
+
content: t.node.isRequired,
|
|
16
|
+
// string, an element, or an array of elements
|
|
17
|
+
children: t.node.isRequired,
|
|
18
|
+
className: t.string
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
a as Tooltip
|
|
22
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import e from "prop-types";
|
|
2
|
+
import i from "react";
|
|
3
|
+
import { isZeroDecimal as y, getSymbol as S } from "../../utils/currency.js";
|
|
4
|
+
import { numberFormat as f, almostZero as g, roundNumber as N } from "../../utils/numbers.js";
|
|
5
|
+
import { getDefaultLocale as R } from "../../utils/userLocale.js";
|
|
6
|
+
const a = ({
|
|
7
|
+
currency: r = "USD",
|
|
8
|
+
locale: s = R(),
|
|
9
|
+
shouldRemoveTrailingZeroes: l = !0,
|
|
10
|
+
maximumFractionDigits: u = 2,
|
|
11
|
+
compact: n = !1,
|
|
12
|
+
isNarrowSymbolForm: m,
|
|
13
|
+
children: c
|
|
14
|
+
}) => {
|
|
15
|
+
let t = c;
|
|
16
|
+
g(t) && (t = 0);
|
|
17
|
+
const p = y(r) ? 0 : u;
|
|
18
|
+
let o = f(t, r, s, p, n);
|
|
19
|
+
const d = t < 0;
|
|
20
|
+
return d && (o = o.replace("-", "")), n ? /* @__PURE__ */ i.createElement("span", { className: "ui-currency" }, d && "-", S(r, s, m), o) : (o = l ? o.replace(".00", "") : o, /* @__PURE__ */ i.createElement("span", { className: "ui-currency" }, d && "-", o));
|
|
21
|
+
};
|
|
22
|
+
a.propTypes = {
|
|
23
|
+
currency: e.string,
|
|
24
|
+
locale: e.string,
|
|
25
|
+
shouldRemoveTrailingZeroes: e.bool,
|
|
26
|
+
maximumFractionDigits: e.number,
|
|
27
|
+
children: e.node.isRequired
|
|
28
|
+
};
|
|
29
|
+
a.Round = ({ currency: r, children: s }) => {
|
|
30
|
+
const l = N(r, s);
|
|
31
|
+
return /* @__PURE__ */ i.createElement("span", { className: "ui-currency-round" }, l);
|
|
32
|
+
};
|
|
33
|
+
a.Round.displayName = "Currency.Round";
|
|
34
|
+
a.Round.propTypes = {
|
|
35
|
+
currency: e.string,
|
|
36
|
+
children: e.node.isRequired
|
|
37
|
+
};
|
|
38
|
+
a.Split = ({ currency: r = "USD", locale: s = R(), isNarrowSymbolForm: l, children: u }) => {
|
|
39
|
+
let n = u;
|
|
40
|
+
g(n) && (n = 0);
|
|
41
|
+
const m = N(r, n).toString().split("."), c = m[0];
|
|
42
|
+
let t = m[1] || "0";
|
|
43
|
+
t.length === 1 && (t += "0");
|
|
44
|
+
const p = f(c, r, s, 0, l);
|
|
45
|
+
return /* @__PURE__ */ i.createElement("span", { title: n, className: "ui-currency-split" }, /* @__PURE__ */ i.createElement("span", { className: "ui-currency-split-int" }, p), !y(r) && /* @__PURE__ */ i.createElement("span", { className: "ui-currency-split-decimal pl-1" }, /* @__PURE__ */ i.createElement("sup", null, t)));
|
|
46
|
+
};
|
|
47
|
+
a.Split.displayName = "Currency.Split";
|
|
48
|
+
a.Split.propTypes = {
|
|
49
|
+
currency: e.string,
|
|
50
|
+
locale: e.string,
|
|
51
|
+
children: e.node.isRequired,
|
|
52
|
+
isNarrowSymbolForm: e.bool
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
a as Currency
|
|
56
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import e from "prop-types";
|
|
2
|
+
import i from "react";
|
|
3
|
+
import { numberFormat as n } from "../../utils/numbers.js";
|
|
4
|
+
import { getDefaultLocale as p } from "../../utils/userLocale.js";
|
|
5
|
+
const s = ({ locale: r = p(), maximumFractionDigits: o = 2, isCompact: m = !1, children: t }) => {
|
|
6
|
+
const a = n(t, null, r, o, m);
|
|
7
|
+
return /* @__PURE__ */ i.createElement("span", { className: "ui-number" }, a);
|
|
8
|
+
};
|
|
9
|
+
s.propTypes = {
|
|
10
|
+
locale: e.string,
|
|
11
|
+
maximumFractionDigits: e.number,
|
|
12
|
+
isCompact: e.bool,
|
|
13
|
+
children: e.node.isRequired
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
s as Number
|
|
17
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import r from "prop-types";
|
|
2
|
+
import s from "react";
|
|
3
|
+
import a from "../../helpers/classnames.js";
|
|
4
|
+
import { formatPhoneNumber as c, getRegionCode as p } from "../../utils/phone.js";
|
|
5
|
+
const d = ({ countryCode: e = "US", className: t, children: n }) => {
|
|
6
|
+
const o = n, m = c(o, e), i = p(o, e);
|
|
7
|
+
return /* @__PURE__ */ s.createElement(
|
|
8
|
+
"span",
|
|
9
|
+
{
|
|
10
|
+
className: a("ui-phone", t),
|
|
11
|
+
"data-region-code": i || "N/A",
|
|
12
|
+
"data-country-code": e,
|
|
13
|
+
title: o
|
|
14
|
+
},
|
|
15
|
+
m
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
d.propTypes = {
|
|
19
|
+
countryCode: r.string,
|
|
20
|
+
className: r.string,
|
|
21
|
+
children: r.node.isRequired
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
d as Phone
|
|
25
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const o = typeof window > "u" ? !1 : window.navigator.userAgent.includes("Macintosh"), s = () => {
|
|
2
|
+
if (typeof window > "u" || !window.navigator) return !1;
|
|
3
|
+
const n = window.navigator.userAgent, t = !!/ipad/i.test(n) || !!/iphone/i.test(n), i = !!/webkit/i.test(n), e = !!/macintosh/i.test(n) && navigator.maxTouchPoints > 1;
|
|
4
|
+
return t && i || e;
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
s as isIosBrowser,
|
|
8
|
+
o as isOSX
|
|
9
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Transition as p } from "@headlessui/react";
|
|
2
|
+
import n, { Fragment as d } from "react";
|
|
3
|
+
import i from "react-hot-toast";
|
|
4
|
+
import y from "./classnames.js";
|
|
5
|
+
import { CloseIcon as g } from "../icons/src/CloseIcon.js";
|
|
6
|
+
const h = {
|
|
7
|
+
primary: "bg-primary",
|
|
8
|
+
secondary: "bg-secondary",
|
|
9
|
+
success: "bg-success",
|
|
10
|
+
warning: "bg-warning",
|
|
11
|
+
danger: "bg-danger",
|
|
12
|
+
caution: "bg-caution"
|
|
13
|
+
}, w = {
|
|
14
|
+
small: "px-3 py-2 text-sm leading-3.5 shadow max-w-50",
|
|
15
|
+
medium: "px-4 py-3.5 text-base leading-4 shadow max-w-100",
|
|
16
|
+
large: "px-4.5 py-4 text-md leading-4.5 shadow max-w-xl"
|
|
17
|
+
}, f = {
|
|
18
|
+
duration: 3e3,
|
|
19
|
+
position: "top-center",
|
|
20
|
+
reverseOrder: !1
|
|
21
|
+
}, l = {
|
|
22
|
+
show({ text: e, size: r = "medium", color: t = "success", className: o, canClose: s = !0, onClose: a, ...m }) {
|
|
23
|
+
const c = { ...f, ...m };
|
|
24
|
+
s || (c.duration = Number.POSITIVE_INFINITY);
|
|
25
|
+
const u = l.getStyles(t, r, o, s);
|
|
26
|
+
return i.custom(l.container.bind(this, e, u, s ? a : null), c);
|
|
27
|
+
},
|
|
28
|
+
//
|
|
29
|
+
// Shortcut methods for flash.show
|
|
30
|
+
//
|
|
31
|
+
primary(e, r) {
|
|
32
|
+
return this.show({ color: "primary", text: e, ...r });
|
|
33
|
+
},
|
|
34
|
+
secondary(e, r) {
|
|
35
|
+
return this.show({ color: "secondary", text: e, ...r });
|
|
36
|
+
},
|
|
37
|
+
success(e, r) {
|
|
38
|
+
return this.show({ color: "success", text: e, ...r });
|
|
39
|
+
},
|
|
40
|
+
warning(e, r) {
|
|
41
|
+
return this.show({ color: "warning", text: e, ...r });
|
|
42
|
+
},
|
|
43
|
+
caution(e, r) {
|
|
44
|
+
return this.show({ color: "caution", text: e, ...r });
|
|
45
|
+
},
|
|
46
|
+
danger(e, r) {
|
|
47
|
+
return this.show({ color: "danger", text: e, ...r });
|
|
48
|
+
},
|
|
49
|
+
getStyles(e, r, t) {
|
|
50
|
+
return y("flex text-white rounded pointer-events-auto", h[e], w[r], t);
|
|
51
|
+
},
|
|
52
|
+
container(e, r, t, o) {
|
|
53
|
+
const s = (a) => t(a, o);
|
|
54
|
+
return /* @__PURE__ */ n.createElement(
|
|
55
|
+
p,
|
|
56
|
+
{
|
|
57
|
+
appear: !0,
|
|
58
|
+
as: d,
|
|
59
|
+
show: o.visible,
|
|
60
|
+
enter: "transition transform duration-500 ease-out",
|
|
61
|
+
enterFrom: "-translate-y-full !opacity-0",
|
|
62
|
+
enterTo: "translate-y-0 !opacity-100",
|
|
63
|
+
leave: "transition transform duration-500 ease-in",
|
|
64
|
+
leaveFrom: "!opacity-90 translate-y-0",
|
|
65
|
+
leaveTo: "!opacity-0 -translate-y-full"
|
|
66
|
+
},
|
|
67
|
+
/* @__PURE__ */ n.createElement("div", { key: o.id, className: r }, /* @__PURE__ */ n.createElement("div", { className: "w-full" }, e), t && /* @__PURE__ */ n.createElement(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
className: "flex cursor-pointer items-center justify-center pl-3 opacity-60 hover:opacity-100",
|
|
71
|
+
onClick: s
|
|
72
|
+
},
|
|
73
|
+
/* @__PURE__ */ n.createElement(g, null)
|
|
74
|
+
))
|
|
75
|
+
);
|
|
76
|
+
},
|
|
77
|
+
remove(e) {
|
|
78
|
+
return i.remove(e);
|
|
79
|
+
},
|
|
80
|
+
dismiss(e) {
|
|
81
|
+
return i.dismiss(e);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
export {
|
|
85
|
+
l as flash
|
|
86
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useMount as o, useEventListener as r } from "ahooks";
|
|
2
|
+
import { useState as n } from "react";
|
|
3
|
+
const g = () => {
|
|
4
|
+
const [e, i] = n(0), t = () => i(window.innerHeight);
|
|
5
|
+
return o(t), r("orientationchange", t), e;
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
g as useViewportHeight
|
|
9
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsxs as n, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { createIcon as o } from "./helpers/icon.js";
|
|
3
|
+
const l = o((e) => /* @__PURE__ */ n("svg", { viewBox: "0 0 14 14", width: 15, height: 14, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e, children: [
|
|
4
|
+
/* @__PURE__ */ n("g", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
5
|
+
/* @__PURE__ */ r("path", { d: "M2.666 9.904l1.18 1.776M9.187 2l4.479 6.746M13.43 8.39l-9.82 2.934-.709-1.067 6.514-7.912 4.009 6.038.007.006z" }),
|
|
6
|
+
/* @__PURE__ */ r("path", { d: "M8.721 9.798c.54.617.47 1.558-.147 2.098-.625.541-1.566.47-2.106-.147-.042-.05-.084-.098-.12-.154l-.617-.934" })
|
|
7
|
+
] }),
|
|
8
|
+
/* @__PURE__ */ r("defs", { children: /* @__PURE__ */ r("clipPath", { id: "prefix__clip0", children: /* @__PURE__ */ r("path", { fill: "#fff", transform: "translate(.666)", d: "M0 0h14v14H0z" }) }) })
|
|
9
|
+
] }));
|
|
10
|
+
export {
|
|
11
|
+
l as AnnounceIcon
|
|
12
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsxs as n, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { createIcon as t } from "./helpers/icon.js";
|
|
3
|
+
const e = t((r) => /* @__PURE__ */ n("svg", { viewBox: "0 0 14 14", width: 14, height: 14, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...r, children: [
|
|
4
|
+
/* @__PURE__ */ o(
|
|
5
|
+
"path",
|
|
6
|
+
{
|
|
7
|
+
d: "M5.663 10.7v.214a1.337 1.337 0 002.674 0V10.7M8.07 3.355v-.536a1.07 1.07 0 10-2.14 0v.536",
|
|
8
|
+
stroke: "currentColor",
|
|
9
|
+
strokeLinecap: "round",
|
|
10
|
+
strokeLinejoin: "round"
|
|
11
|
+
}
|
|
12
|
+
),
|
|
13
|
+
/* @__PURE__ */ o(
|
|
14
|
+
"path",
|
|
15
|
+
{
|
|
16
|
+
d: "M3.828 5.943A2.643 2.643 0 016.471 3.3H7.53a2.643 2.643 0 012.643 2.643v1.631c0 .31.123.607.342.825l.374.374c.218.219.341.516.341.825 0 .61-.493 1.103-1.102 1.103H3.873a1.102 1.102 0 01-1.102-1.103c0-.31.123-.606.341-.825l.374-.374c.219-.218.342-.515.342-.825V5.943v0z",
|
|
17
|
+
stroke: "currentColor",
|
|
18
|
+
strokeLinecap: "round",
|
|
19
|
+
strokeLinejoin: "round"
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
] }));
|
|
23
|
+
e.tags = ["notification", "pending"];
|
|
24
|
+
export {
|
|
25
|
+
e as BellIcon
|
|
26
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { createIcon as t } from "./helpers/icon.js";
|
|
3
|
+
const e = t((r) => /* @__PURE__ */ o("svg", { width: 14, height: 14, fill: "none", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 14 14", ...r, children: /* @__PURE__ */ o(
|
|
4
|
+
"path",
|
|
5
|
+
{
|
|
6
|
+
d: "M10.333 12.5H3.667C2.747 12.5 2 11.754 2 10.833V4.167c0-.92.746-1.667 1.667-1.667h6.666c.92 0 1.667.746 1.667 1.667v6.666c0 .92-.746 1.667-1.667 1.667zM4.5 1.5v2.174M9.5 1.5v2.174",
|
|
7
|
+
stroke: "currentColor",
|
|
8
|
+
strokeLinecap: "round",
|
|
9
|
+
strokeLinejoin: "round"
|
|
10
|
+
}
|
|
11
|
+
) }));
|
|
12
|
+
e.tags = ["date"];
|
|
13
|
+
export {
|
|
14
|
+
e as CalendarIcon
|
|
15
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { createIcon as t } from "./helpers/icon.js";
|
|
3
|
+
const e = t((r) => /* @__PURE__ */ o("svg", { viewBox: "0 0 14 12", width: 14, height: 14, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...r, children: /* @__PURE__ */ o("path", { d: "M12.166 3l-7.333 7.333L1.5 7", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
4
|
+
e.tags = ["tick", "correct"];
|
|
5
|
+
export {
|
|
6
|
+
e as CheckIcon
|
|
7
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { createIcon as n } from "./helpers/icon.js";
|
|
3
|
+
const t = n((r) => /* @__PURE__ */ o("svg", { viewBox: "0 0 14 14", width: 14, height: 14, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...r, children: /* @__PURE__ */ o("path", { d: "M12.75 4.25l-5.5 5.5-5.5-5.5", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
4
|
+
t.tags = ["arrow"];
|
|
5
|
+
export {
|
|
6
|
+
t as ChevronDownIcon
|
|
7
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { createIcon as t } from "./helpers/icon.js";
|
|
3
|
+
const e = t((r) => /* @__PURE__ */ o("svg", { viewBox: "0 0 14 14", width: 14, height: 14, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...r, children: /* @__PURE__ */ o("path", { d: "M9 12.5L3.5 7 9 1.5", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
4
|
+
e.tags = ["arrow"];
|
|
5
|
+
export {
|
|
6
|
+
e as ChevronLeftIcon
|
|
7
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { createIcon as t } from "./helpers/icon.js";
|
|
3
|
+
const e = t((r) => /* @__PURE__ */ o("svg", { viewBox: "0 0 14 14", width: 14, height: 14, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...r, children: /* @__PURE__ */ o("path", { d: "M4.5 1.5L10 7l-5.5 5.5", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
4
|
+
e.tags = ["arrow"];
|
|
5
|
+
export {
|
|
6
|
+
e as ChevronRightIcon
|
|
7
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
const e = (t) => /* @__PURE__ */ r("svg", { xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", fill: "none", viewBox: "0 0 14 14", ...t, children: /* @__PURE__ */ r("path", { fill: "currentColor", d: "M14 7a7 7 0 10-7 7v-1.4A5.6 5.6 0 1112.6 7H14z" }) });
|
|
3
|
+
export {
|
|
4
|
+
e as CircleNotch
|
|
5
|
+
};
|