@xola/ui-kit 3.5.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 +136 -87
- package/build/components/Alert.js +18 -13
- package/build/components/Animation/FadeIn.js +36 -25
- package/build/components/Animation/SlideDown.js +14 -9
- package/build/components/Avatar.js +17 -10
- package/build/components/Badge.js +33 -24
- package/build/components/BottomSheet.js +114 -0
- package/build/components/Breadcrumb.js +27 -21
- package/build/components/Breakdown.js +66 -74
- package/build/components/Buttons/Button.js +53 -47
- package/build/components/Buttons/ButtonGroup.js +42 -39
- package/build/components/Buttons/SecondaryButton.js +31 -0
- package/build/components/Buttons/SubmitButton.js +72 -66
- package/build/components/Buttons/ToggleButton.js +15 -16
- package/build/components/Counter.js +10 -6
- package/build/components/DatePicker/DatePicker.helpers.js +24 -13
- package/build/components/DatePicker/DatePicker.js +196 -223
- package/build/components/DatePicker/DatePickerPopover.js +75 -66
- package/build/components/DatePicker/Day.js +35 -32
- package/build/components/DatePicker/LocalizedDayPicker.js +15 -18
- package/build/components/DatePicker/MonthGrid.js +35 -48
- package/build/components/DatePicker/MonthPicker.js +25 -20
- package/build/components/DatePicker/MonthSelector.js +39 -40
- package/build/components/DatePicker/MonthYearSelector.js +18 -39
- package/build/components/DatePicker/NavbarElement.js +26 -35
- package/build/components/DatePicker/RangeDatePicker.js +104 -123
- package/build/components/DatePicker/RelativeDateRange.js +153 -143
- package/build/components/DatePicker/UpcomingDatePicker.js +29 -25
- package/build/components/Dot/Dot.js +13 -8
- package/build/components/Dot/DotProgress.js +12 -7
- package/build/components/Drawer.js +109 -101
- package/build/components/Forms/BaseInput.js +50 -34
- package/build/components/Forms/Checkbox.js +33 -30
- package/build/components/Forms/ComboBox.js +35 -35
- package/build/components/Forms/FormGroup.js +7 -3
- package/build/components/Forms/InlineValuePopover.js +33 -39
- package/build/components/Forms/Input.js +15 -7
- package/build/components/Forms/Label.js +14 -8
- package/build/components/Forms/RangeSlider.js +41 -22
- package/build/components/Forms/Select.js +5 -6
- package/build/components/Forms/Switch.js +46 -38
- package/build/components/Forms/Textarea.js +37 -30
- package/build/components/Forms/ValuePopoverText.js +5 -8
- package/build/components/GooglePlacesAutocomplete.js +112 -0
- package/build/components/HeaderToolbar.js +30 -22
- package/build/components/ImageUpload.js +76 -79
- package/build/components/Key.js +21 -16
- package/build/components/Logo.js +12 -5
- package/build/components/Modal.js +87 -72
- package/build/components/Popover/Popover.js +40 -31
- package/build/components/Popover/PopoverList.js +43 -36
- package/build/components/Provider.js +7 -8
- package/build/components/Screens/Login.js +97 -126
- package/build/components/Search.js +114 -144
- package/build/components/Sidebar/Sidebar.Account.js +39 -46
- package/build/components/Sidebar/Sidebar.Button.js +45 -19
- package/build/components/Sidebar/Sidebar.Footer.js +8 -7
- package/build/components/Sidebar/Sidebar.Heading.js +11 -8
- package/build/components/Sidebar/Sidebar.Link.js +79 -44
- package/build/components/Sidebar/Sidebar.Menu.js +52 -28
- package/build/components/Sidebar/Sidebar.Notifications.js +107 -0
- package/build/components/Sidebar/Sidebar.js +207 -214
- package/build/components/Sidebar/SidebarContext.js +15 -0
- package/build/components/Sidebar/sidebarWidth.js +41 -0
- package/build/components/Sidebar/useSidebarWidthState.js +115 -0
- package/build/components/Skeleton.js +19 -20
- package/build/components/Spinner.js +18 -10
- package/build/components/Table.js +86 -50
- package/build/components/Tabs/Tabs.Panel.js +9 -5
- package/build/components/Tabs/Tabs.Tab.js +28 -23
- package/build/components/Tabs/Tabs.js +23 -23
- package/build/components/Tag.js +28 -23
- package/build/components/Tooltip.js +19 -5
- package/build/components/Utilities/Currency.js +49 -42
- package/build/components/Utilities/Number.js +14 -12
- package/build/components/Utilities/Phone.js +18 -12
- package/build/helpers/environment.js +10 -0
- package/build/helpers/flash.js +45 -46
- package/build/hooks/useIsMobile.js +8 -0
- package/build/hooks/useViewportHeight.js +6 -12
- package/build/icons/src/AnnounceIcon.js +3 -4
- package/build/icons/src/BellIcon.js +0 -1
- package/build/icons/src/CalendarIcon.js +0 -1
- package/build/icons/src/CheckIcon.js +0 -1
- package/build/icons/src/ChevronDownIcon.js +4 -5
- package/build/icons/src/ChevronLeftIcon.js +0 -1
- package/build/icons/src/ChevronRightIcon.js +0 -1
- package/build/icons/src/CircleNotch.js +0 -1
- package/build/icons/src/CloseIcon.js +11 -9
- package/build/icons/src/DownArrowIcon.js +0 -1
- package/build/icons/src/ImageIcon.js +0 -1
- package/build/icons/src/SearchIcon.js +4 -5
- package/build/icons/src/TrashIcon.js +0 -1
- package/build/icons/src/WarningDiamondIcon.js +0 -1
- package/build/icons/src/helpers/icon.js +5 -9
- package/build/icons/src/images/XolaLogoSimple.js +2 -3
- package/build/index.js +143 -130
- package/build/style.css +1 -0
- package/build/theme.css +76 -0
- package/build/theme.js +2 -0
- package/build/utils/currency.js +5 -5
- package/build/{helpers → utils}/date.js +17 -20
- package/build/utils/numbers.js +12 -12
- package/build/utils/phone.js +12 -14
- package/build/utils/userLocale.js +6 -0
- package/index.css +96 -4
- package/index.d.ts +204 -0
- package/package.json +87 -77
- package/skills/README.md +27 -0
- package/skills/migrate-2.6-to-3.7/SKILL.md +110 -0
- package/tailwind.config.js +5 -2
- package/build/base.css +0 -2
- package/build/components/Alert.d.ts +0 -18
- package/build/components/Animation/FadeIn.d.ts +0 -13
- package/build/components/Animation/SlideDown.d.ts +0 -6
- package/build/components/Avatar.d.ts +0 -16
- package/build/components/Badge.d.ts +0 -28
- package/build/components/Breadcrumb.d.ts +0 -21
- package/build/components/Breakdown.d.ts +0 -63
- package/build/components/Buttons/Button.d.ts +0 -53
- package/build/components/Buttons/ButtonGroup.d.ts +0 -35
- package/build/components/Buttons/SubmitButton.d.ts +0 -11
- package/build/components/Buttons/ToggleButton.d.ts +0 -21
- package/build/components/Charts/BaseChartOptions.d.ts +0 -136
- package/build/components/Charts/HistogramOptions.d.ts +0 -192
- package/build/components/Charts/PieOptions.d.ts +0 -177
- package/build/components/Counter.d.ts +0 -5
- package/build/components/DatePicker/DatePicker.d.ts +0 -41
- package/build/components/DatePicker/DatePicker.helpers.d.ts +0 -17
- package/build/components/DatePicker/DatePickerPopover.d.ts +0 -29
- package/build/components/DatePicker/Day.d.ts +0 -13
- package/build/components/DatePicker/LocalizedDayPicker.d.ts +0 -6
- package/build/components/DatePicker/MonthGrid.d.ts +0 -11
- package/build/components/DatePicker/MonthPicker.d.ts +0 -7
- package/build/components/DatePicker/MonthSelector.d.ts +0 -8
- package/build/components/DatePicker/MonthYearSelector.d.ts +0 -8
- package/build/components/DatePicker/NavbarElement.d.ts +0 -15
- package/build/components/DatePicker/RangeDatePicker.d.ts +0 -25
- package/build/components/DatePicker/RelativeDateRange.d.ts +0 -51
- package/build/components/DatePicker/UpcomingDatePicker.d.ts +0 -11
- package/build/components/Dot/Dot.d.ts +0 -24
- package/build/components/Dot/DotProgress.d.ts +0 -6
- package/build/components/Drawer.d.ts +0 -28
- package/build/components/Forms/BaseInput.d.ts +0 -20
- package/build/components/Forms/Checkbox.d.ts +0 -10
- package/build/components/Forms/ComboBox.d.ts +0 -8
- package/build/components/Forms/FormGroup.d.ts +0 -5
- package/build/components/Forms/InlineValuePopover.d.ts +0 -17
- package/build/components/Forms/Input.d.ts +0 -6
- package/build/components/Forms/Label.d.ts +0 -7
- package/build/components/Forms/RangeSlider.d.ts +0 -33
- package/build/components/Forms/Select.d.ts +0 -5
- package/build/components/Forms/Switch.d.ts +0 -46
- package/build/components/Forms/Textarea.d.ts +0 -6
- package/build/components/Forms/ValuePopoverText.d.ts +0 -6
- package/build/components/GooglePlacesAutocomplete.d.ts +0 -14
- package/build/components/HeaderToolbar.d.ts +0 -21
- package/build/components/ImageUpload.d.ts +0 -17
- package/build/components/Key.d.ts +0 -6
- package/build/components/Logo.d.ts +0 -19
- package/build/components/Modal.d.ts +0 -52
- package/build/components/Popover/Popover.d.ts +0 -20
- package/build/components/Popover/PopoverList.d.ts +0 -25
- package/build/components/Provider.d.ts +0 -18
- package/build/components/Screens/Login.d.ts +0 -25
- package/build/components/Search.d.ts +0 -16
- package/build/components/Sidebar/Sidebar.Account.d.ts +0 -13
- package/build/components/Sidebar/Sidebar.Button.d.ts +0 -10
- package/build/components/Sidebar/Sidebar.Footer.d.ts +0 -8
- package/build/components/Sidebar/Sidebar.Heading.d.ts +0 -10
- package/build/components/Sidebar/Sidebar.Link.d.ts +0 -24
- package/build/components/Sidebar/Sidebar.Menu.d.ts +0 -13
- package/build/components/Sidebar/Sidebar.d.ts +0 -58
- package/build/components/Sidebar/index.d.ts +0 -8
- package/build/components/Skeleton.d.ts +0 -13
- package/build/components/Spinner.d.ts +0 -26
- package/build/components/Table.d.ts +0 -59
- package/build/components/Tabs/Tabs.Panel.d.ts +0 -9
- package/build/components/Tabs/Tabs.Tab.d.ts +0 -19
- package/build/components/Tabs/Tabs.d.ts +0 -27
- package/build/components/Tabs/index.d.ts +0 -4
- package/build/components/Tag.d.ts +0 -25
- package/build/components/Tooltip.d.ts +0 -8
- package/build/components/Utilities/Currency.d.ts +0 -32
- package/build/components/Utilities/Number.d.ts +0 -8
- package/build/components/Utilities/Phone.d.ts +0 -8
- package/build/full.css +0 -2
- package/build/helpers/avatar.d.ts +0 -1
- package/build/helpers/avatar.js +0 -8
- package/build/helpers/browser.d.ts +0 -2
- package/build/helpers/children.d.ts +0 -3
- package/build/helpers/classnames.d.ts +0 -5
- package/build/helpers/currency.d.ts +0 -2
- package/build/helpers/currency.js +0 -11
- package/build/helpers/date.d.ts +0 -12
- package/build/helpers/flash.d.ts +0 -21
- package/build/helpers/numbers.d.ts +0 -4
- package/build/helpers/numbers.js +0 -23
- package/build/helpers/phone.d.ts +0 -11
- package/build/helpers/phone.js +0 -25
- package/build/hooks/useId.d.ts +0 -1
- package/build/hooks/useId.js +0 -9
- package/build/hooks/useIsClient.d.ts +0 -1
- package/build/hooks/useViewportHeight.d.ts +0 -1
- package/build/icons/src/helpers/classnames.js +0 -8
- package/build/index.d.ts +0 -66
- package/build/theme.d.ts +0 -413
- package/build/types/index.d.ts +0 -22
- package/build/types/migration.d.ts +0 -2
- package/build/ui-kit.css +0 -1
- package/build/utils/avatar.d.ts +0 -1
- package/build/utils/currency.d.ts +0 -2
- package/build/utils/index.d.ts +0 -4
- package/build/utils/numbers.d.ts +0 -4
- package/build/utils/phone.d.ts +0 -2
|
@@ -1,47 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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,
|
|
13
15
|
error: p = null,
|
|
14
|
-
|
|
15
|
-
onClick: o,
|
|
16
|
-
onClickOutside: v,
|
|
17
|
-
...m
|
|
16
|
+
...x
|
|
18
17
|
}) => {
|
|
19
|
-
const
|
|
18
|
+
const i = h(), E = (w) => {
|
|
20
19
|
setTimeout(() => {
|
|
21
20
|
var u;
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
}, 0),
|
|
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);
|
|
25
24
|
};
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
),
|
|
42
|
-
/* @__PURE__ */ e(f.Content, { children: /* @__PURE__ */ e("div", { ref: t, className: i("p-2", r == null ? void 0 : r.children), children: h }) })
|
|
43
|
-
] });
|
|
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)));
|
|
44
38
|
};
|
|
45
39
|
export {
|
|
46
|
-
|
|
40
|
+
q as InlineValuePopover
|
|
47
41
|
};
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import { BaseInput as
|
|
5
|
-
const
|
|
6
|
-
|
|
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
|
+
};
|
|
7
15
|
export {
|
|
8
|
-
|
|
16
|
+
p as Input
|
|
9
17
|
};
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
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(
|
|
4
5
|
"label",
|
|
5
6
|
{
|
|
6
|
-
className:
|
|
7
|
+
className: s(
|
|
7
8
|
"ui-label",
|
|
8
|
-
|
|
9
|
+
r,
|
|
9
10
|
"mb-1 block text-sm font-bold",
|
|
10
|
-
|
|
11
|
+
o ? "text-danger" : t ? "text-gray" : "text-black"
|
|
11
12
|
),
|
|
12
|
-
...
|
|
13
|
+
...l
|
|
13
14
|
}
|
|
14
15
|
);
|
|
16
|
+
m.propTypes = {
|
|
17
|
+
isDisabled: e.bool,
|
|
18
|
+
isError: e.bool,
|
|
19
|
+
className: e.string
|
|
20
|
+
};
|
|
15
21
|
export {
|
|
16
|
-
|
|
22
|
+
m as Label
|
|
17
23
|
};
|
|
@@ -1,39 +1,58 @@
|
|
|
1
|
-
import
|
|
2
|
-
import u from "nouislider-react";
|
|
1
|
+
import c from "nouislider-react";
|
|
3
2
|
/* empty css */
|
|
4
|
-
import
|
|
3
|
+
import e from "prop-types";
|
|
4
|
+
import b from "react";
|
|
5
|
+
import R from "../../helpers/classnames.js";
|
|
5
6
|
/* empty css */
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const g = ({
|
|
8
|
+
className: t,
|
|
9
|
+
values: o,
|
|
10
|
+
min: i,
|
|
11
|
+
max: s,
|
|
12
|
+
isDisabled: n = !1,
|
|
11
13
|
shouldConnectHandles: a = !1,
|
|
12
14
|
step: m = 1,
|
|
13
|
-
isTooltipEnabled:
|
|
14
|
-
tooltipCustomFormatter:
|
|
15
|
-
tooltipSuffix:
|
|
16
|
-
className: p,
|
|
15
|
+
isTooltipEnabled: l = !0,
|
|
16
|
+
tooltipCustomFormatter: u = null,
|
|
17
|
+
tooltipSuffix: p,
|
|
17
18
|
onChange: f
|
|
18
19
|
}) => {
|
|
19
|
-
const
|
|
20
|
+
const d = u ?? o.map(() => ({
|
|
20
21
|
from: (r) => r,
|
|
21
|
-
to: (r) =>
|
|
22
|
+
to: (r) => Math.round(r) + p
|
|
22
23
|
}));
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
|
|
24
|
+
return /* @__PURE__ */ b.createElement(
|
|
25
|
+
c,
|
|
25
26
|
{
|
|
26
|
-
className:
|
|
27
|
+
className: R("ui-range-slider", t),
|
|
27
28
|
connect: a,
|
|
28
|
-
disabled:
|
|
29
|
-
start:
|
|
30
|
-
range: { min:
|
|
29
|
+
disabled: n,
|
|
30
|
+
start: o,
|
|
31
|
+
range: { min: i, max: s },
|
|
31
32
|
step: m,
|
|
32
|
-
tooltips:
|
|
33
|
+
tooltips: l ? d : !1,
|
|
33
34
|
onChange: f
|
|
34
35
|
}
|
|
35
36
|
);
|
|
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
|
+
};
|
|
37
56
|
export {
|
|
38
|
-
|
|
57
|
+
g as RangeSlider
|
|
39
58
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
p.displayName = "Select";
|
|
1
|
+
import p from "react";
|
|
2
|
+
import { BaseInput as e } from "./BaseInput.js";
|
|
3
|
+
const r = (t) => /* @__PURE__ */ p.createElement(e, { as: "select", ...t });
|
|
4
|
+
r.propTypes = e.propTypes;
|
|
6
5
|
export {
|
|
7
|
-
|
|
6
|
+
r as Select
|
|
8
7
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const
|
|
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
6
|
large: {
|
|
7
7
|
parent: "h-6 w-11",
|
|
8
8
|
inner: "h-5 w-5",
|
|
@@ -18,45 +18,53 @@ const i = {
|
|
|
18
18
|
inner: "h-2 w-2",
|
|
19
19
|
translate: "translate-x-2"
|
|
20
20
|
}
|
|
21
|
-
},
|
|
22
|
-
|
|
21
|
+
}, n = ({ isChecked: e = !1, size: r = "medium", ...s }) => /* @__PURE__ */ a.createElement(
|
|
22
|
+
o,
|
|
23
23
|
{
|
|
24
|
-
checked:
|
|
25
|
-
|
|
26
|
-
className: e(
|
|
24
|
+
checked: e,
|
|
25
|
+
className: i(
|
|
27
26
|
"ui-switch",
|
|
28
|
-
|
|
27
|
+
e ? "bg-primary disabled:bg-gray-light" : "bg-gray disabled:bg-gray-light",
|
|
29
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",
|
|
30
|
-
|
|
31
|
-
c
|
|
29
|
+
l[r].parent
|
|
32
30
|
),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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,
|
|
49
56
|
{
|
|
50
57
|
as: "span",
|
|
51
|
-
className:
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
className: i("ui-switch-label", "cursor-pointer", e === "left" ? "mr-2" : "ml-2", r)
|
|
59
|
+
},
|
|
60
|
+
s
|
|
54
61
|
);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
n.Label.displayName = "Switch.Label";
|
|
63
|
+
n.Label.propTypes = {
|
|
64
|
+
direction: t.string,
|
|
65
|
+
className: t.string,
|
|
66
|
+
children: t.node.isRequired
|
|
67
|
+
};
|
|
60
68
|
export {
|
|
61
|
-
|
|
69
|
+
n as Switch
|
|
62
70
|
};
|
|
@@ -1,35 +1,42 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { BaseInput as
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
s,
|
|
11
|
-
{
|
|
12
|
-
ref: o,
|
|
13
|
-
as: f,
|
|
14
|
-
value: r,
|
|
15
|
-
minRows: t,
|
|
16
|
-
className: i("ui-textarea", a),
|
|
17
|
-
...e
|
|
18
|
-
}
|
|
19
|
-
)
|
|
20
|
-
) : /* @__PURE__ */ m(
|
|
21
|
-
s,
|
|
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,
|
|
22
10
|
{
|
|
23
|
-
ref:
|
|
24
|
-
as:
|
|
25
|
-
value:
|
|
26
|
-
|
|
27
|
-
className:
|
|
28
|
-
...
|
|
11
|
+
ref: s,
|
|
12
|
+
as: n,
|
|
13
|
+
value: t,
|
|
14
|
+
minRows: a,
|
|
15
|
+
className: u("ui-textarea", o),
|
|
16
|
+
...p
|
|
29
17
|
}
|
|
30
18
|
)
|
|
31
|
-
)
|
|
32
|
-
|
|
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
|
+
};
|
|
33
40
|
export {
|
|
34
|
-
|
|
41
|
+
r as Textarea
|
|
35
42
|
};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Tooltip as
|
|
3
|
-
import { WarningDiamondIcon as
|
|
4
|
-
const
|
|
5
|
-
o ? /* @__PURE__ */ n(t, { content: o, className: "", children: /* @__PURE__ */ n("span", { children: /* @__PURE__ */ n(a, { className: "mr-1 text-danger" }) }) }) : null,
|
|
6
|
-
r
|
|
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);
|
|
8
5
|
export {
|
|
9
|
-
|
|
6
|
+
c as ValuePopoverText
|
|
10
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
|
+
};
|
|
@@ -1,33 +1,41 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
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(
|
|
6
7
|
"div",
|
|
7
8
|
{
|
|
8
|
-
className:
|
|
9
|
+
className: m(
|
|
9
10
|
"ui-header-toolbar",
|
|
10
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",
|
|
11
|
-
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
)
|
|
16
|
-
|
|
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,
|
|
17
23
|
{
|
|
18
|
-
className:
|
|
24
|
+
className: m(
|
|
19
25
|
"ui-header-toolbar-breadcrumb",
|
|
20
26
|
"border-r border-gray-light text-xl md:pr-4 xl:pr-6",
|
|
21
27
|
e
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
)
|
|
29
|
+
},
|
|
30
|
+
o
|
|
25
31
|
);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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";
|
|
31
39
|
export {
|
|
32
|
-
|
|
40
|
+
r as HeaderToolbar
|
|
33
41
|
};
|