@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,41 @@
|
|
|
1
|
+
import t, { useRef as h } from "react";
|
|
2
|
+
import n from "../../helpers/classnames.js";
|
|
3
|
+
import { Popover as l } from "../Popover/Popover.js";
|
|
4
|
+
import { ValuePopoverText as I } from "./ValuePopoverText.js";
|
|
5
|
+
import { DownArrowIcon as P } from "../../icons/src/DownArrowIcon.js";
|
|
6
|
+
const q = ({
|
|
7
|
+
text: f,
|
|
8
|
+
isOpen: c = !1,
|
|
9
|
+
showArrow: d = !0,
|
|
10
|
+
autoSelectOnClick: b = !1,
|
|
11
|
+
onClick: r,
|
|
12
|
+
onClickOutside: m,
|
|
13
|
+
classNames: e,
|
|
14
|
+
children: v,
|
|
15
|
+
error: p = null,
|
|
16
|
+
...x
|
|
17
|
+
}) => {
|
|
18
|
+
const i = h(), E = (w) => {
|
|
19
|
+
setTimeout(() => {
|
|
20
|
+
var u;
|
|
21
|
+
const o = (u = i.current) == null ? void 0 : u.querySelector("select,textarea,input");
|
|
22
|
+
o && (o.focus(), b && o.select());
|
|
23
|
+
}, 0), r == null || r(w);
|
|
24
|
+
};
|
|
25
|
+
return /* @__PURE__ */ t.createElement(l, { visible: c, onClickOutside: m, ...x }, /* @__PURE__ */ t.createElement(
|
|
26
|
+
"span",
|
|
27
|
+
{
|
|
28
|
+
className: n(
|
|
29
|
+
"cursor-pointer whitespace-nowrap",
|
|
30
|
+
p && "!border-danger !text-danger",
|
|
31
|
+
e == null ? void 0 : e.text
|
|
32
|
+
),
|
|
33
|
+
onClick: E
|
|
34
|
+
},
|
|
35
|
+
/* @__PURE__ */ t.createElement("span", { className: n("border-b border-b-black font-bold text-black", e == null ? void 0 : e.textField) }, /* @__PURE__ */ t.createElement(I, { value: f, error: p })),
|
|
36
|
+
d && /* @__PURE__ */ t.createElement(P, { size: "medium" })
|
|
37
|
+
), /* @__PURE__ */ t.createElement(l.Content, null, /* @__PURE__ */ t.createElement("div", { ref: i, className: n("p-2", e == null ? void 0 : e.children) }, v)));
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
q as InlineValuePopover
|
|
41
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import m from "prop-types";
|
|
2
|
+
import n, { forwardRef as i } from "react";
|
|
3
|
+
import u from "../../helpers/classnames.js";
|
|
4
|
+
import { BaseInput as t } from "./BaseInput.js";
|
|
5
|
+
const p = i(({ className: e, type: r = "text", value: o, ...s }, a) => /* @__PURE__ */ n.createElement(t, { ref: a, as: "input", className: u("ui-input", e), type: r, value: o, ...s }));
|
|
6
|
+
p.displayName = "Input";
|
|
7
|
+
p.propTypes = {
|
|
8
|
+
...t.propTypes,
|
|
9
|
+
type: m.string
|
|
10
|
+
};
|
|
11
|
+
p.defaultProps = {
|
|
12
|
+
...t.defaultProps,
|
|
13
|
+
type: "text"
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
p as Input
|
|
17
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import e from "prop-types";
|
|
2
|
+
import a from "react";
|
|
3
|
+
import s from "../../helpers/classnames.js";
|
|
4
|
+
const m = ({ isDisabled: t = !1, isError: o = !1, className: r, ...l }) => /* @__PURE__ */ a.createElement(
|
|
5
|
+
"label",
|
|
6
|
+
{
|
|
7
|
+
className: s(
|
|
8
|
+
"ui-label",
|
|
9
|
+
r,
|
|
10
|
+
"mb-1 block text-sm font-bold",
|
|
11
|
+
o ? "text-danger" : t ? "text-gray" : "text-black"
|
|
12
|
+
),
|
|
13
|
+
...l
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
m.propTypes = {
|
|
17
|
+
isDisabled: e.bool,
|
|
18
|
+
isError: e.bool,
|
|
19
|
+
className: e.string
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
m as Label
|
|
23
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import c from "nouislider-react";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import e from "prop-types";
|
|
4
|
+
import b from "react";
|
|
5
|
+
import R from "../../helpers/classnames.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
const g = ({
|
|
8
|
+
className: t,
|
|
9
|
+
values: o,
|
|
10
|
+
min: i,
|
|
11
|
+
max: s,
|
|
12
|
+
isDisabled: n = !1,
|
|
13
|
+
shouldConnectHandles: a = !1,
|
|
14
|
+
step: m = 1,
|
|
15
|
+
isTooltipEnabled: l = !0,
|
|
16
|
+
tooltipCustomFormatter: u = null,
|
|
17
|
+
tooltipSuffix: p,
|
|
18
|
+
onChange: f
|
|
19
|
+
}) => {
|
|
20
|
+
const d = u ?? o.map(() => ({
|
|
21
|
+
from: (r) => r,
|
|
22
|
+
to: (r) => Math.round(r) + p
|
|
23
|
+
}));
|
|
24
|
+
return /* @__PURE__ */ b.createElement(
|
|
25
|
+
c,
|
|
26
|
+
{
|
|
27
|
+
className: R("ui-range-slider", t),
|
|
28
|
+
connect: a,
|
|
29
|
+
disabled: n,
|
|
30
|
+
start: o,
|
|
31
|
+
range: { min: i, max: s },
|
|
32
|
+
step: m,
|
|
33
|
+
tooltips: l ? d : !1,
|
|
34
|
+
onChange: f
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
g.propTypes = {
|
|
39
|
+
className: e.string,
|
|
40
|
+
values: e.arrayOf(e.number).isRequired,
|
|
41
|
+
min: e.number.isRequired,
|
|
42
|
+
max: e.number.isRequired,
|
|
43
|
+
isDisabled: e.bool,
|
|
44
|
+
shouldConnectHandles: e.bool,
|
|
45
|
+
isTooltipEnabled: e.bool,
|
|
46
|
+
tooltipSuffix: e.string,
|
|
47
|
+
tooltipCustomFormatter: e.arrayOf(
|
|
48
|
+
e.shape({
|
|
49
|
+
from: e.func.isRequired,
|
|
50
|
+
to: e.func.isRequired
|
|
51
|
+
})
|
|
52
|
+
),
|
|
53
|
+
step: e.number,
|
|
54
|
+
onChange: e.func
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
g as RangeSlider
|
|
58
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Switch as o } from "@headlessui/react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import a from "react";
|
|
4
|
+
import i from "../../helpers/classnames.js";
|
|
5
|
+
const l = {
|
|
6
|
+
large: {
|
|
7
|
+
parent: "h-6 w-11",
|
|
8
|
+
inner: "h-5 w-5",
|
|
9
|
+
translate: "translate-x-5"
|
|
10
|
+
},
|
|
11
|
+
medium: {
|
|
12
|
+
parent: "h-5 w-8",
|
|
13
|
+
inner: "h-4 w-4",
|
|
14
|
+
translate: "translate-x-3"
|
|
15
|
+
},
|
|
16
|
+
small: {
|
|
17
|
+
parent: "h-3 w-5",
|
|
18
|
+
inner: "h-2 w-2",
|
|
19
|
+
translate: "translate-x-2"
|
|
20
|
+
}
|
|
21
|
+
}, n = ({ isChecked: e = !1, size: r = "medium", ...s }) => /* @__PURE__ */ a.createElement(
|
|
22
|
+
o,
|
|
23
|
+
{
|
|
24
|
+
checked: e,
|
|
25
|
+
className: i(
|
|
26
|
+
"ui-switch",
|
|
27
|
+
e ? "bg-primary disabled:bg-gray-light" : "bg-gray disabled:bg-gray-light",
|
|
28
|
+
"relative inline-flex flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none",
|
|
29
|
+
l[r].parent
|
|
30
|
+
),
|
|
31
|
+
...s
|
|
32
|
+
},
|
|
33
|
+
/* @__PURE__ */ a.createElement(
|
|
34
|
+
"span",
|
|
35
|
+
{
|
|
36
|
+
className: i(
|
|
37
|
+
e ? l[r].translate : "translate-x-0",
|
|
38
|
+
"ui-switch-inner pointer-events-none inline-block transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out",
|
|
39
|
+
l[r].inner
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
);
|
|
44
|
+
n.propTypes = {
|
|
45
|
+
isChecked: t.bool,
|
|
46
|
+
size: t.string
|
|
47
|
+
};
|
|
48
|
+
n.Group = ({ className: e, children: r }) => /* @__PURE__ */ a.createElement(o.Group, { as: "div", className: i("ui-switch-group", "inline-flex items-center", e) }, r);
|
|
49
|
+
n.Group.displayName = "Switch.Group";
|
|
50
|
+
n.Group.propTypes = {
|
|
51
|
+
className: t.string,
|
|
52
|
+
children: t.node.isRequired
|
|
53
|
+
};
|
|
54
|
+
n.Label = ({ direction: e = "left", className: r, children: s }) => /* @__PURE__ */ a.createElement(
|
|
55
|
+
o.Label,
|
|
56
|
+
{
|
|
57
|
+
as: "span",
|
|
58
|
+
className: i("ui-switch-label", "cursor-pointer", e === "left" ? "mr-2" : "ml-2", r)
|
|
59
|
+
},
|
|
60
|
+
s
|
|
61
|
+
);
|
|
62
|
+
n.Label.displayName = "Switch.Label";
|
|
63
|
+
n.Label.propTypes = {
|
|
64
|
+
direction: t.string,
|
|
65
|
+
className: t.string,
|
|
66
|
+
children: t.node.isRequired
|
|
67
|
+
};
|
|
68
|
+
export {
|
|
69
|
+
n as Switch
|
|
70
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import m from "prop-types";
|
|
2
|
+
import i, { forwardRef as l } from "react";
|
|
3
|
+
import n from "react-textarea-autosize";
|
|
4
|
+
import u from "../../helpers/classnames.js";
|
|
5
|
+
import { BaseInput as e } from "./BaseInput.js";
|
|
6
|
+
const r = l(({ className: o, value: t, shouldAutoSize: f = !1, rows: a = 2, ...p }, s) => f ? (
|
|
7
|
+
// TextareaAutosize has a few special props like minRows and maxRows instead of rows field so using rows field to feed the minRows prop. See full list here https://github.com/Andarist/react-textarea-autosize?tab=readme-ov-file#props
|
|
8
|
+
/* @__PURE__ */ i.createElement(
|
|
9
|
+
e,
|
|
10
|
+
{
|
|
11
|
+
ref: s,
|
|
12
|
+
as: n,
|
|
13
|
+
value: t,
|
|
14
|
+
minRows: a,
|
|
15
|
+
className: u("ui-textarea", o),
|
|
16
|
+
...p
|
|
17
|
+
}
|
|
18
|
+
)
|
|
19
|
+
) : /* @__PURE__ */ i.createElement(
|
|
20
|
+
e,
|
|
21
|
+
{
|
|
22
|
+
ref: s,
|
|
23
|
+
as: "textarea",
|
|
24
|
+
value: t,
|
|
25
|
+
rows: a,
|
|
26
|
+
className: u("ui-textarea", o),
|
|
27
|
+
...p
|
|
28
|
+
}
|
|
29
|
+
));
|
|
30
|
+
r.displayName = "Textarea";
|
|
31
|
+
r.propTypes = {
|
|
32
|
+
...e.propTypes,
|
|
33
|
+
rows: m.number,
|
|
34
|
+
shouldAutoSize: m.bool
|
|
35
|
+
};
|
|
36
|
+
r.defaultProps = {
|
|
37
|
+
rows: 2,
|
|
38
|
+
shouldAutoSize: !1
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
r as Textarea
|
|
42
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "react";
|
|
2
|
+
import { Tooltip as o } from "../Tooltip.js";
|
|
3
|
+
import { WarningDiamondIcon as r } from "../../icons/src/WarningDiamondIcon.js";
|
|
4
|
+
const c = ({ value: n, error: t }) => /* @__PURE__ */ e.createElement("span", null, t ? /* @__PURE__ */ e.createElement(o, { content: t }, /* @__PURE__ */ e.createElement("span", null, /* @__PURE__ */ e.createElement(r, { className: "mr-1 text-danger" }))) : null, n);
|
|
5
|
+
export {
|
|
6
|
+
c as ValuePopoverText
|
|
7
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import r, { useState as l, useRef as p, useEffect as P, useCallback as $ } from "react";
|
|
2
|
+
import m from "prop-types";
|
|
3
|
+
import { startCase as z } from "lodash-es";
|
|
4
|
+
import { useDebouncedCallback as B } from "use-debounce";
|
|
5
|
+
import T from "axios";
|
|
6
|
+
import { useClickAway as U } from "ahooks";
|
|
7
|
+
import { Input as V } from "./Forms/Input.js";
|
|
8
|
+
import { Badge as j } from "./Badge.js";
|
|
9
|
+
const R = ({ initialValue: s, onSelect: u, apiBaseUrl: b, remoteId: E }) => {
|
|
10
|
+
var C;
|
|
11
|
+
const [_, k] = l(s || ""), [a, f] = l([]), [G, D] = l(!1), [g, n] = l(!1), [I, h] = l(""), [y, c] = l(0), L = (C = a[y]) != null && C.place_id ? `autocomplete-item-${y}` : void 0, N = p(null), S = p(!1), i = p(!1), d = p(u);
|
|
12
|
+
P(() => {
|
|
13
|
+
d.current = u;
|
|
14
|
+
}, [u]);
|
|
15
|
+
const x = $((e) => {
|
|
16
|
+
var t;
|
|
17
|
+
k(e.description || e.name || ""), n(!1), i.current || (t = d.current) == null || t.call(d, e), i.current = !1;
|
|
18
|
+
}, []), F = (e) => {
|
|
19
|
+
k(e.target.value), n(!0), i.current = !1, A(e.target.value);
|
|
20
|
+
}, K = (e) => {
|
|
21
|
+
if (!(!g || a.length === 0))
|
|
22
|
+
switch (e.key) {
|
|
23
|
+
case "ArrowDown":
|
|
24
|
+
e.preventDefault(), c((t) => (t + 1) % a.length);
|
|
25
|
+
break;
|
|
26
|
+
case "ArrowUp":
|
|
27
|
+
e.preventDefault(), c((t) => (t - 1 + a.length) % a.length);
|
|
28
|
+
break;
|
|
29
|
+
case "Enter":
|
|
30
|
+
e.preventDefault(), x(a[y]);
|
|
31
|
+
break;
|
|
32
|
+
case "Escape":
|
|
33
|
+
n(!1);
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}, A = B(
|
|
37
|
+
async (e, t = null) => {
|
|
38
|
+
if (!e.trim()) {
|
|
39
|
+
f([]), h("");
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
D(!0), h("");
|
|
43
|
+
try {
|
|
44
|
+
const { data: o } = await T.get(`${b}/searchGooglePlaces`, {
|
|
45
|
+
params: { input: e }
|
|
46
|
+
}), v = Array.isArray(o) ? o : o.predictions || [];
|
|
47
|
+
if (f(v), t !== null) {
|
|
48
|
+
const w = v.findIndex((M) => M.place_id === t);
|
|
49
|
+
w !== -1 && (c(w), x(v[w]));
|
|
50
|
+
}
|
|
51
|
+
} catch (o) {
|
|
52
|
+
console.error("Google Places error:", o), f([]), h("Failed to load suggestions. Please try again.");
|
|
53
|
+
} finally {
|
|
54
|
+
D(!1);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
300,
|
|
58
|
+
[b]
|
|
59
|
+
);
|
|
60
|
+
return P(() => {
|
|
61
|
+
s && !S.current && (S.current = !0, i.current = !0, A(s, E));
|
|
62
|
+
}, [s, E]), U(() => {
|
|
63
|
+
n(!1);
|
|
64
|
+
}, N), /* @__PURE__ */ r.createElement("div", { ref: N, className: "relative" }, /* @__PURE__ */ r.createElement(
|
|
65
|
+
V,
|
|
66
|
+
{
|
|
67
|
+
"data-testid": "google-places-input",
|
|
68
|
+
type: "text",
|
|
69
|
+
role: "combobox",
|
|
70
|
+
"aria-expanded": g,
|
|
71
|
+
"aria-controls": "autocomplete-list",
|
|
72
|
+
"aria-activedescendant": L || void 0,
|
|
73
|
+
"aria-autocomplete": "list",
|
|
74
|
+
value: _,
|
|
75
|
+
placeholder: "Search place...",
|
|
76
|
+
onChange: F,
|
|
77
|
+
onKeyDown: K
|
|
78
|
+
}
|
|
79
|
+
), g && /* @__PURE__ */ r.createElement(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
className: "absolute z-10 max-h-65 w-full overflow-y-auto rounded-md border border-gray bg-white shadow-lg",
|
|
83
|
+
role: "listbox"
|
|
84
|
+
},
|
|
85
|
+
G ? /* @__PURE__ */ r.createElement("div", { className: "px-3 py-2 text-gray-dark" }, "Loading...") : I ? /* @__PURE__ */ r.createElement("div", { className: "px-3 py-2 text-gray-dark" }, I) : a.length === 0 ? /* @__PURE__ */ r.createElement("div", { className: "px-3 py-2 text-gray-dark" }, "No results") : a.map((e, t) => /* @__PURE__ */ r.createElement(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
key: e.place_id,
|
|
89
|
+
"data-testid": "google-places-option",
|
|
90
|
+
className: "flex cursor-pointer flex-col gap-2 border-b border-gray bg-white px-3 py-2 hover:bg-gray-light hover:text-blue-light",
|
|
91
|
+
onClick: () => x(e),
|
|
92
|
+
onMouseEnter: () => c(t)
|
|
93
|
+
},
|
|
94
|
+
/* @__PURE__ */ r.createElement("div", { className: "flex flex-wrap items-center gap-1" }, /* @__PURE__ */ r.createElement("p", { className: "mr-2 whitespace-nowrap text-md" }, e.description || e.name), (e.types || []).slice(0, 4).map((o) => /* @__PURE__ */ r.createElement(j, { key: o, color: "secondary" }, z(o)))),
|
|
95
|
+
e.formatted_address && /* @__PURE__ */ r.createElement("p", null, e.formatted_address)
|
|
96
|
+
))
|
|
97
|
+
));
|
|
98
|
+
};
|
|
99
|
+
R.propTypes = {
|
|
100
|
+
initialValue: m.string,
|
|
101
|
+
onSelect: m.func,
|
|
102
|
+
apiBaseUrl: m.string.isRequired,
|
|
103
|
+
remoteId: m.string
|
|
104
|
+
};
|
|
105
|
+
R.defaultProps = {
|
|
106
|
+
initialValue: "",
|
|
107
|
+
onSelect: null,
|
|
108
|
+
remoteId: null
|
|
109
|
+
};
|
|
110
|
+
export {
|
|
111
|
+
R as GooglePlacesAutocomplete
|
|
112
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import a from "prop-types";
|
|
2
|
+
import l from "react";
|
|
3
|
+
import m from "../helpers/classnames.js";
|
|
4
|
+
import { Search as t } from "./Search.js";
|
|
5
|
+
import { Breadcrumb as c } from "./Breadcrumb.js";
|
|
6
|
+
const r = ({ classNames: e, children: o }) => /* @__PURE__ */ l.createElement(
|
|
7
|
+
"div",
|
|
8
|
+
{
|
|
9
|
+
className: m(
|
|
10
|
+
"ui-header-toolbar",
|
|
11
|
+
"flex w-full items-center space-x-2 border-b border-gray-light px-5 py-3 pr-3 xl:space-x-6 xl:px-10 xl:py-5",
|
|
12
|
+
e
|
|
13
|
+
)
|
|
14
|
+
},
|
|
15
|
+
o
|
|
16
|
+
);
|
|
17
|
+
r.propTypes = {
|
|
18
|
+
classNames: a.string,
|
|
19
|
+
children: a.node.isRequired
|
|
20
|
+
};
|
|
21
|
+
r.Breadcrumb = ({ className: e, children: o }) => /* @__PURE__ */ l.createElement(
|
|
22
|
+
c,
|
|
23
|
+
{
|
|
24
|
+
className: m(
|
|
25
|
+
"ui-header-toolbar-breadcrumb",
|
|
26
|
+
"border-r border-gray-light text-xl md:pr-4 xl:pr-6",
|
|
27
|
+
e
|
|
28
|
+
)
|
|
29
|
+
},
|
|
30
|
+
o
|
|
31
|
+
);
|
|
32
|
+
r.Breadcrumb.displayName = "HeaderToolbar.Breadcrumb";
|
|
33
|
+
r.Breadcrumb.propTypes = {
|
|
34
|
+
className: a.string,
|
|
35
|
+
children: a.node.isRequired
|
|
36
|
+
};
|
|
37
|
+
r.Search = (e) => /* @__PURE__ */ l.createElement(t, { className: "ui-header-toolbar-search w-full flex-grow pr-1", ...e });
|
|
38
|
+
r.Search.displayName = "HeaderToolbar.Search";
|
|
39
|
+
export {
|
|
40
|
+
r as HeaderToolbar
|
|
41
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import t from "prop-types";
|
|
2
|
+
import e, { useRef as I, useState as B } from "react";
|
|
3
|
+
import g from "../helpers/classnames.js";
|
|
4
|
+
import { Button as T } from "./Buttons/Button.js";
|
|
5
|
+
import { SubmitButton as u } from "./Buttons/SubmitButton.js";
|
|
6
|
+
import { Logo as h } from "./Logo.js";
|
|
7
|
+
import { ImageIcon as U } from "../icons/src/ImageIcon.js";
|
|
8
|
+
import { TrashIcon as w } from "../icons/src/TrashIcon.js";
|
|
9
|
+
const D = ({
|
|
10
|
+
src: o,
|
|
11
|
+
size: c = "large",
|
|
12
|
+
isLoading: n = !1,
|
|
13
|
+
maxSize: r = 5,
|
|
14
|
+
hasDelete: s = !0,
|
|
15
|
+
requirements: l = null,
|
|
16
|
+
caption: a = null,
|
|
17
|
+
csvAcceptFormats: E = "image/png,image/jpeg,image/webp",
|
|
18
|
+
onChange: y,
|
|
19
|
+
onDelete: b,
|
|
20
|
+
onError: x,
|
|
21
|
+
...N
|
|
22
|
+
}) => {
|
|
23
|
+
const i = I(), [m, v] = B(0), d = () => {
|
|
24
|
+
i.current.click();
|
|
25
|
+
}, C = (P) => {
|
|
26
|
+
const [f] = P.target.files;
|
|
27
|
+
if (r && 1048576 * r < f.size) {
|
|
28
|
+
x(`Image size shouldn't exceed ${r}MB`);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
y(f);
|
|
32
|
+
}, k = () => {
|
|
33
|
+
v(m + 1), b();
|
|
34
|
+
}, R = typeof l == "string" ? (l == null ? void 0 : l.trim().length) > 0 : !!l, p = a ? a.trim().length > 0 : !1;
|
|
35
|
+
return /* @__PURE__ */ e.createElement("div", { className: g("flex items-center rounded bg-gray-lighter p-4", s ? "space-x-2" : "space-x-3") }, /* @__PURE__ */ e.createElement("div", null, o ? /* @__PURE__ */ e.createElement(h, { src: o, size: c }) : /* @__PURE__ */ e.createElement(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
className: g(
|
|
39
|
+
h.sizes[c],
|
|
40
|
+
"flex items-center justify-center rounded border border-gray-light"
|
|
41
|
+
)
|
|
42
|
+
},
|
|
43
|
+
/* @__PURE__ */ e.createElement(U, { size: "large", className: "text-gray" })
|
|
44
|
+
)), /* @__PURE__ */ e.createElement("div", { className: "flex flex-col space-y-2" }, /* @__PURE__ */ e.createElement("div", { className: "space-x-2" }, s ? /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
|
|
45
|
+
T,
|
|
46
|
+
{
|
|
47
|
+
variant: "outline",
|
|
48
|
+
color: "secondary",
|
|
49
|
+
icon: /* @__PURE__ */ e.createElement(w, null),
|
|
50
|
+
disabled: n,
|
|
51
|
+
onClick: k
|
|
52
|
+
},
|
|
53
|
+
"Delete"
|
|
54
|
+
), /* @__PURE__ */ e.createElement(u, { disabled: n, isLoading: n, onClick: d }, p ? a.trim() : "Upload New Photo")) : /* @__PURE__ */ e.createElement(u, { disabled: n, isLoading: n, onClick: d }, p ? a.trim() : o ? "Replace Photo" : "Upload New Photo")), /* @__PURE__ */ e.createElement(
|
|
55
|
+
"input",
|
|
56
|
+
{
|
|
57
|
+
key: m,
|
|
58
|
+
ref: i,
|
|
59
|
+
className: "hidden",
|
|
60
|
+
type: "file",
|
|
61
|
+
multiple: !1,
|
|
62
|
+
accept: E,
|
|
63
|
+
onChange: C,
|
|
64
|
+
...N
|
|
65
|
+
}
|
|
66
|
+
), /* @__PURE__ */ e.createElement("div", { className: "text-xs text-gray-darker" }, R ? l : /* @__PURE__ */ e.createElement("div", null, "Check that the image is in PNG, JPG or WebP format", r ? ` and does not exceed ${r}MB` : ""))));
|
|
67
|
+
};
|
|
68
|
+
D.propTypes = {
|
|
69
|
+
src: t.string,
|
|
70
|
+
size: t.oneOf(["small", "medium", "large"]),
|
|
71
|
+
isLoading: t.bool,
|
|
72
|
+
maxSize: t.number,
|
|
73
|
+
hasDelete: t.bool,
|
|
74
|
+
caption: t.string,
|
|
75
|
+
requirements: t.oneOfType([t.node, t.string]),
|
|
76
|
+
csvAcceptFormats: t.string,
|
|
77
|
+
onChange: t.func.isRequired,
|
|
78
|
+
onDelete: t.func.isRequired,
|
|
79
|
+
onError: t.func.isRequired
|
|
80
|
+
};
|
|
81
|
+
export {
|
|
82
|
+
D as ImageUpload
|
|
83
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import o from "prop-types";
|
|
2
|
+
import s from "react";
|
|
3
|
+
import c from "../helpers/classnames.js";
|
|
4
|
+
import { isOSX as t } from "../helpers/browser.js";
|
|
5
|
+
const p = ({ char: e, className: n, ...i }) => {
|
|
6
|
+
const r = m[e] ?? e;
|
|
7
|
+
return /* @__PURE__ */ s.createElement(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
className: c(
|
|
11
|
+
"ui-key",
|
|
12
|
+
"no-translate inline-flex h-5 items-center justify-center rounded bg-gray-lighter py-1 px-2 text-xs font-semibold text-gray",
|
|
13
|
+
r.length === 1 && "w-5",
|
|
14
|
+
n
|
|
15
|
+
),
|
|
16
|
+
...i
|
|
17
|
+
},
|
|
18
|
+
r
|
|
19
|
+
);
|
|
20
|
+
}, m = {
|
|
21
|
+
cmd: t ? "⌘" : "ctrl",
|
|
22
|
+
option: t ? "⌥" : "win",
|
|
23
|
+
ctrl: "ctrl",
|
|
24
|
+
up: "↑",
|
|
25
|
+
down: "↓"
|
|
26
|
+
};
|
|
27
|
+
p.propTypes = {
|
|
28
|
+
char: o.string.isRequired,
|
|
29
|
+
className: o.string
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
p as Key
|
|
33
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import e from "prop-types";
|
|
2
|
+
import t from "react";
|
|
3
|
+
import c from "../helpers/classnames.js";
|
|
4
|
+
const r = {
|
|
5
|
+
small: "w-10 h-10",
|
|
6
|
+
medium: "w-16 h-16",
|
|
7
|
+
large: "w-20 h-20"
|
|
8
|
+
}, s = ({ className: o, size: i = "small", ...m }) => /* @__PURE__ */ t.createElement("img", { className: c("ui-logo", o, "inline-block rounded object-cover", r[i]), ...m });
|
|
9
|
+
s.sizes = r;
|
|
10
|
+
s.propTypes = {
|
|
11
|
+
className: e.string,
|
|
12
|
+
src: e.string.isRequired,
|
|
13
|
+
size: e.string
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
s as Logo
|
|
17
|
+
};
|