@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.
Files changed (126) hide show
  1. package/README.md +98 -19
  2. package/build/components/Alert.js +29 -0
  3. package/build/components/Animation/FadeIn.js +40 -0
  4. package/build/components/Animation/SlideDown.js +25 -0
  5. package/build/components/Avatar.js +28 -0
  6. package/build/components/Badge.js +51 -0
  7. package/build/components/BottomSheet.js +114 -0
  8. package/build/components/Breadcrumb.js +33 -0
  9. package/build/components/Breakdown.js +81 -0
  10. package/build/components/Buttons/Button.js +89 -0
  11. package/build/components/Buttons/ButtonGroup.js +58 -0
  12. package/build/components/Buttons/SecondaryButton.js +31 -0
  13. package/build/components/Buttons/SubmitButton.js +89 -0
  14. package/build/components/Buttons/ToggleButton.js +33 -0
  15. package/build/components/Charts/BaseChartOptions.js +95 -0
  16. package/build/components/Charts/HistogramOptions.js +69 -0
  17. package/build/components/Charts/PieOptions.js +55 -0
  18. package/build/components/Counter.js +20 -0
  19. package/build/components/DatePicker/DatePicker.helpers.js +33 -0
  20. package/build/components/DatePicker/DatePicker.js +214 -0
  21. package/build/components/DatePicker/DatePickerPopover.js +90 -0
  22. package/build/components/DatePicker/Day.js +43 -0
  23. package/build/components/DatePicker/LocalizedDayPicker.js +17 -0
  24. package/build/components/DatePicker/MonthGrid.js +39 -0
  25. package/build/components/DatePicker/MonthPicker.js +33 -0
  26. package/build/components/DatePicker/MonthSelector.js +46 -0
  27. package/build/components/DatePicker/MonthYearSelector.js +23 -0
  28. package/build/components/DatePicker/NavbarElement.js +34 -0
  29. package/build/components/DatePicker/RangeDatePicker.js +111 -0
  30. package/build/components/DatePicker/RelativeDateRange.js +290 -0
  31. package/build/components/DatePicker/UpcomingDatePicker.js +31 -0
  32. package/build/components/Dot/Dot.js +29 -0
  33. package/build/components/Dot/DotProgress.js +15 -0
  34. package/build/components/Drawer.js +134 -0
  35. package/build/components/Forms/BaseInput.js +57 -0
  36. package/build/components/Forms/Checkbox.js +37 -0
  37. package/build/components/Forms/Checkbox.module.css.js +7 -0
  38. package/build/components/Forms/ComboBox.js +41 -0
  39. package/build/components/Forms/FormGroup.js +10 -0
  40. package/build/components/Forms/InlineValuePopover.js +41 -0
  41. package/build/components/Forms/Input.js +17 -0
  42. package/build/components/Forms/Label.js +23 -0
  43. package/build/components/Forms/RangeSlider.js +58 -0
  44. package/build/components/Forms/Select.js +7 -0
  45. package/build/components/Forms/Switch.js +70 -0
  46. package/build/components/Forms/Textarea.js +42 -0
  47. package/build/components/Forms/ValuePopoverText.js +7 -0
  48. package/build/components/GooglePlacesAutocomplete.js +112 -0
  49. package/build/components/HeaderToolbar.js +41 -0
  50. package/build/components/ImageUpload.js +83 -0
  51. package/build/components/Key.js +33 -0
  52. package/build/components/Logo.js +17 -0
  53. package/build/components/Modal.js +141 -0
  54. package/build/components/Popover/Popover.js +53 -0
  55. package/build/components/Popover/Popover.module.css.js +7 -0
  56. package/build/components/Popover/PopoverList.js +57 -0
  57. package/build/components/Popover/PopoverScroll.module.css.js +4 -0
  58. package/build/components/Provider.js +16 -0
  59. package/build/components/Screens/Login.js +115 -0
  60. package/build/components/Search.js +144 -0
  61. package/build/components/Sidebar/Sidebar.Account.js +49 -0
  62. package/build/components/Sidebar/Sidebar.Button.js +47 -0
  63. package/build/components/Sidebar/Sidebar.Footer.js +10 -0
  64. package/build/components/Sidebar/Sidebar.Heading.js +13 -0
  65. package/build/components/Sidebar/Sidebar.Link.js +92 -0
  66. package/build/components/Sidebar/Sidebar.Menu.js +54 -0
  67. package/build/components/Sidebar/Sidebar.Menu.module.css.js +7 -0
  68. package/build/components/Sidebar/Sidebar.Notifications.js +107 -0
  69. package/build/components/Sidebar/Sidebar.js +212 -0
  70. package/build/components/Sidebar/SidebarContext.js +15 -0
  71. package/build/components/Sidebar/SidebarScroll.module.css.js +4 -0
  72. package/build/components/Sidebar/sidebarWidth.js +41 -0
  73. package/build/components/Sidebar/useSidebarWidthState.js +115 -0
  74. package/build/components/Skeleton.js +28 -0
  75. package/build/components/Skeleton.module.css.js +7 -0
  76. package/build/components/Spinner.js +35 -0
  77. package/build/components/Table.js +107 -0
  78. package/build/components/Tabs/Tabs.Panel.js +11 -0
  79. package/build/components/Tabs/Tabs.Tab.js +42 -0
  80. package/build/components/Tabs/Tabs.js +28 -0
  81. package/build/components/Tag.js +41 -0
  82. package/build/components/Tooltip.js +22 -0
  83. package/build/components/Utilities/Currency.js +56 -0
  84. package/build/components/Utilities/Number.js +17 -0
  85. package/build/components/Utilities/Phone.js +25 -0
  86. package/build/helpers/browser.js +9 -0
  87. package/build/helpers/children.js +6 -0
  88. package/build/helpers/classnames.js +8 -0
  89. package/build/helpers/environment.js +10 -0
  90. package/build/helpers/flash.js +86 -0
  91. package/build/hooks/useIsClient.js +10 -0
  92. package/build/hooks/useIsMobile.js +8 -0
  93. package/build/hooks/useViewportHeight.js +9 -0
  94. package/build/icons/src/AnnounceIcon.js +12 -0
  95. package/build/icons/src/BellIcon.js +26 -0
  96. package/build/icons/src/CalendarIcon.js +15 -0
  97. package/build/icons/src/CheckIcon.js +7 -0
  98. package/build/icons/src/ChevronDownIcon.js +7 -0
  99. package/build/icons/src/ChevronLeftIcon.js +7 -0
  100. package/build/icons/src/ChevronRightIcon.js +7 -0
  101. package/build/icons/src/CircleNotch.js +5 -0
  102. package/build/icons/src/CloseIcon.js +13 -0
  103. package/build/icons/src/DownArrowIcon.js +15 -0
  104. package/build/icons/src/ImageIcon.js +26 -0
  105. package/build/icons/src/SearchIcon.js +15 -0
  106. package/build/icons/src/TrashIcon.js +19 -0
  107. package/build/icons/src/WarningDiamondIcon.js +26 -0
  108. package/build/icons/src/helpers/icon.js +7 -0
  109. package/build/icons/src/helpers/iconSizes.js +13 -0
  110. package/build/icons/src/images/XolaLogoSimple.js +13 -0
  111. package/build/index.js +155 -0
  112. package/build/style.css +1 -1
  113. package/build/theme.js +374 -0
  114. package/build/utils/avatar.js +8 -0
  115. package/build/utils/currency.js +11 -0
  116. package/build/utils/date.js +46 -0
  117. package/build/utils/numbers.js +19 -0
  118. package/build/utils/phone.js +15 -0
  119. package/build/utils/userLocale.js +6 -0
  120. package/index.d.ts +132 -79
  121. package/package.json +76 -45
  122. package/postcss.config.js +1 -1
  123. package/skills/README.md +27 -0
  124. package/skills/migrate-2.6-to-3.7/SKILL.md +110 -0
  125. package/tailwind.config.js +9 -5
  126. package/build/ui-kit.es.js +0 -16771
@@ -0,0 +1,141 @@
1
+ import { Transition as c, Dialog as p } from "@headlessui/react";
2
+ import o from "prop-types";
3
+ import e, { Fragment as d } from "react";
4
+ import a from "../helpers/classnames.js";
5
+ import { CloseIcon as x } from "../icons/src/CloseIcon.js";
6
+ const y = {
7
+ small: "max-w-100",
8
+ // 400px
9
+ medium: "max-w-125",
10
+ // 500px
11
+ large: "max-w-150",
12
+ // 600px
13
+ huge: "max-w-200"
14
+ // 800px
15
+ }, f = {
16
+ center: "inline-block",
17
+ topLeft: "absolute m-4 top-0 left-0",
18
+ topRight: "absolute m-4 top-0 right-0",
19
+ bottomLeft: "absolute m-4 bottom-0 left-0",
20
+ bottomRight: "absolute m-4 bottom-0 right-0"
21
+ }, l = {
22
+ center: {
23
+ enterFrom: "translate-y-4 sm:translate-y-0 sm:scale-95",
24
+ enterTo: "translate-y-0 sm:scale-100",
25
+ leaveFrom: "translate-y-0 sm:scale-100",
26
+ leaveTo: "translate-y-4 sm:translate-y-0 sm:scale-95"
27
+ },
28
+ topLeft: {
29
+ enterFrom: "scale-0 origin-top-left",
30
+ enterTo: "scale-100 origin-top-left",
31
+ leaveFrom: "scale-100 origin-top-left",
32
+ leaveTo: "scale-0 origin-top-left"
33
+ },
34
+ topRight: {
35
+ enterFrom: "scale-0 origin-top-right",
36
+ enterTo: "scale-100 origin-top-right",
37
+ leaveFrom: "scale-100 origin-top-right",
38
+ leaveTo: "scale-0 origin-top-right"
39
+ },
40
+ bottomLeft: {
41
+ enterFrom: "scale-0 origin-bottom-left",
42
+ enterTo: "scale-100 origin-bottom-left",
43
+ leaveFrom: "scale-100 origin-bottom-left",
44
+ leaveTo: "scale-0 origin-bottom-left"
45
+ },
46
+ bottomRight: {
47
+ enterFrom: "scale-0 origin-bottom-right",
48
+ enterTo: "scale-100 origin-bottom-right",
49
+ leaveFrom: "scale-100 origin-bottom-right",
50
+ leaveTo: "scale-0 origin-bottom-right"
51
+ }
52
+ }, i = ({
53
+ size: r = "medium",
54
+ position: t = "center",
55
+ isOpen: n = !1,
56
+ shouldCloseOnOutsideClick: s = !1,
57
+ onClose: m,
58
+ children: h,
59
+ className: v
60
+ }) => {
61
+ const T = () => {
62
+ s && m();
63
+ };
64
+ return /* @__PURE__ */ e.createElement(c, { appear: !0, show: n, as: d }, /* @__PURE__ */ e.createElement(p, { as: "div", className: "ui-modal fixed inset-0 z-30 overflow-y-auto", onClose: T }, /* @__PURE__ */ e.createElement("div", { className: "min-h-screen px-4 text-center" }, /* @__PURE__ */ e.createElement(
65
+ c.Child,
66
+ {
67
+ as: d,
68
+ enter: "ease-out duration-300",
69
+ enterFrom: "opacity-0",
70
+ enterTo: "opacity-100",
71
+ leave: "ease-in duration-200",
72
+ leaveFrom: "opacity-100",
73
+ leaveTo: "opacity-0"
74
+ },
75
+ /* @__PURE__ */ e.createElement(p.Overlay, { className: "ui-modal-overlay fixed inset-0 bg-black bg-opacity-80 transition-opacity" })
76
+ ), t === "center" && /* @__PURE__ */ e.createElement("span", { className: "inline-block h-screen align-middle", "aria-hidden": "true" }, "​"), /* @__PURE__ */ e.createElement(
77
+ c.Child,
78
+ {
79
+ as: d,
80
+ enter: a("ease-out duration-300"),
81
+ enterFrom: a("opacity-0", l[t].enterFrom),
82
+ enterTo: a("opacity-100", l[t].enterTo),
83
+ leave: a("ease-in duration-300"),
84
+ leaveFrom: a("opacity-100", l[t].leaveFrom),
85
+ leaveTo: a("opacity-0", l[t].leaveTo)
86
+ },
87
+ /* @__PURE__ */ e.createElement(
88
+ "div",
89
+ {
90
+ className: a(
91
+ v,
92
+ y[r],
93
+ f[t],
94
+ "w-full transform overflow-hidden rounded-lg bg-white p-10 text-left align-middle shadow-xl transition-all"
95
+ )
96
+ },
97
+ m ? /* @__PURE__ */ e.createElement(
98
+ "button",
99
+ {
100
+ type: "button",
101
+ className: "absolute right-0 top-0 m-4 hidden p-2 text-black hover:text-gray-darker sm:block",
102
+ onClick: () => m()
103
+ },
104
+ /* @__PURE__ */ e.createElement(x, null)
105
+ ) : null,
106
+ h
107
+ )
108
+ ))));
109
+ };
110
+ i.propTypes = {
111
+ size: o.oneOf(Object.keys(y)),
112
+ position: o.oneOf(Object.keys(f)),
113
+ isOpen: o.bool.isRequired,
114
+ shouldCloseOnOutsideClick: o.bool,
115
+ onClose: o.func.isRequired,
116
+ children: o.node.isRequired,
117
+ className: o.string
118
+ };
119
+ const g = ({ children: r, description: t, className: n, ...s }) => /* @__PURE__ */ e.createElement(p.Title, { as: "div", className: a(n, "ui-modal-header text-center"), ...s }, /* @__PURE__ */ e.createElement("h3", { className: "text-2xl font-semibold leading-6 text-black" }, r), t ? /* @__PURE__ */ e.createElement("p", { className: "mt-2 text-base font-normal leading-normal text-gray-darker" }, t) : null);
120
+ g.propTypes = {
121
+ children: o.node.isRequired,
122
+ description: o.string,
123
+ className: o.string
124
+ };
125
+ g.displayName = "Modal.Header";
126
+ i.Header = g;
127
+ const u = ({ className: r, ...t }) => /* @__PURE__ */ e.createElement("div", { className: a(r, "ui-modal-body mt-10"), ...t });
128
+ u.propTypes = {
129
+ className: o.string
130
+ };
131
+ u.displayName = "Modal.Body";
132
+ i.Body = u;
133
+ const b = ({ className: r, ...t }) => /* @__PURE__ */ e.createElement("div", { className: a(r, "ui-modal-footer mt-10 space-x-4 text-right"), ...t });
134
+ b.propTypes = {
135
+ className: o.string
136
+ };
137
+ b.displayName = "Modal.Footer";
138
+ i.Footer = b;
139
+ export {
140
+ i as Modal
141
+ };
@@ -0,0 +1,53 @@
1
+ import c from "@tippyjs/react";
2
+ import t from "prop-types";
3
+ import r, { Children as C, useState as T } from "react";
4
+ import { followCursor as v } from "tippy.js";
5
+ /* empty css */
6
+ /* empty css */
7
+ import { getChildrenByType as N } from "../../helpers/children.js";
8
+ import d from "../../helpers/classnames.js";
9
+ import h from "./Popover.module.css.js";
10
+ import z from "./PopoverScroll.module.css.js";
11
+ const m = ({ isLazy: e = !0, skidding: o = 0, distance: i = 10, className: s, children: p, ...n }) => {
12
+ const a = N(p, m.Content), y = C.toArray(p).filter((g) => g.type !== m.Content), f = e ? u : c;
13
+ return /* @__PURE__ */ r.createElement(
14
+ f,
15
+ {
16
+ interactive: !0,
17
+ zIndex: 50,
18
+ content: a,
19
+ className: d("ui-popover", z, h.main, "!rounded-lg !border-gray-light shadow-xl", s),
20
+ plugins: [v],
21
+ offset: [o ?? 0, i ?? 10],
22
+ ...n
23
+ },
24
+ /* @__PURE__ */ r.createElement("span", null, y)
25
+ );
26
+ };
27
+ m.propTypes = {
28
+ isLazy: t.bool,
29
+ className: t.string,
30
+ skidding: t.number,
31
+ distance: t.number,
32
+ children: t.node.isRequired
33
+ };
34
+ const l = ({ className: e, children: o }) => /* @__PURE__ */ r.createElement("div", { className: d("ui-popover-content", e) }, o);
35
+ l.displayName = "Popover.Content";
36
+ l.propTypes = {
37
+ className: t.string,
38
+ children: t.node.isRequired
39
+ };
40
+ m.Content = l;
41
+ const u = r.forwardRef((e, o) => {
42
+ const [i, s] = T(!1), p = {
43
+ fn: () => ({
44
+ onMount: () => s(!0),
45
+ onHidden: () => s(!1)
46
+ })
47
+ }, n = { ...e };
48
+ return n.plugins = [p, ...e.plugins || []], e.render ? n.render = (...a) => i ? e.render(...a) : "" : n.content = i ? e.content : "", /* @__PURE__ */ r.createElement(c, { ...n, ref: o });
49
+ });
50
+ u.displayName = "LazyTippy";
51
+ export {
52
+ m as Popover
53
+ };
@@ -0,0 +1,7 @@
1
+ const t = "_main_jm0tk_1", a = {
2
+ main: t
3
+ };
4
+ export {
5
+ a as default,
6
+ t as main
7
+ };
@@ -0,0 +1,57 @@
1
+ import e from "prop-types";
2
+ import l, { Children as f } from "react";
3
+ import u from "../../helpers/classnames.js";
4
+ import { Popover as y } from "./Popover.js";
5
+ import h from "./PopoverScroll.module.css.js";
6
+ const s = ({ placement: o = "bottom", className: m, children: p, ...n }) => {
7
+ const r = f.toArray(p), i = r.filter((t) => t.type !== s.Item), c = r.length - i.length, a = r.map((t, g) => t.type === s.Item ? l.cloneElement(t, { position: g, total: c }) : null), d = /* @__PURE__ */ l.createElement(
8
+ y.Content,
9
+ {
10
+ className: u(h, "ui-popover-list-content divide-y divide-solid divide-gray-lighter p-0 ")
11
+ },
12
+ a
13
+ );
14
+ return /* @__PURE__ */ l.createElement(y, { content: d, placement: o, className: u("ui-popover-list", "w-40", m), ...n }, i);
15
+ };
16
+ s.propTypes = {
17
+ placement: e.string,
18
+ className: e.string,
19
+ children: e.node.isRequired
20
+ };
21
+ const v = ({ name: o, isActive: m = !1, id: p = null, position: n, total: r, children: i, className: c, onClickItem: a, ...d }) => {
22
+ const t = (g) => a(g, o, p);
23
+ return /* @__PURE__ */ l.createElement(
24
+ "div",
25
+ {
26
+ name: o,
27
+ className: u(
28
+ "ui-popover-list-item",
29
+ "flex cursor-pointer space-x-2.5 p-4 align-text-top font-semibold leading-4 tracking-tightest hover:bg-gray-lighter",
30
+ m ? "bg-gray-lighter" : null,
31
+ n === 1 ? "rounded-t-lg" : null,
32
+ // Round the top left & right corners if it's the first one
33
+ n === r ? "rounded-b-lg" : null,
34
+ // Round bottom left & right if it's the last one
35
+ c
36
+ ),
37
+ onClick: t,
38
+ ...d
39
+ },
40
+ i
41
+ );
42
+ };
43
+ v.displayName = "PopoverList.Item";
44
+ v.propTypes = {
45
+ position: e.number,
46
+ total: e.number,
47
+ name: e.string.isRequired,
48
+ isActive: e.bool,
49
+ id: e.string,
50
+ children: e.node.isRequired,
51
+ className: e.string,
52
+ onClickItem: e.func.isRequired
53
+ };
54
+ s.Item = v;
55
+ export {
56
+ s as PopoverList
57
+ };
@@ -0,0 +1,4 @@
1
+ const l = {};
2
+ export {
3
+ l as default
4
+ };
@@ -0,0 +1,16 @@
1
+ import u, { useRef as c, useCallback as l, useMemo as s, createContext as i } from "react";
2
+ let p = 1;
3
+ const w = i({
4
+ generateId: () => (console.warn(
5
+ "Please wrap your app with `<Provider />` component from `@xola/ui-kit`. Otherwise your app will not work with SSR frameworks."
6
+ ), p++),
7
+ localize: !0,
8
+ locale: "en_US"
9
+ }), m = ({ children: n, localize: e = !0, locale: r = "en_US" }) => {
10
+ const t = c(1), o = l(() => t.current++, [t]), a = s(() => ({ generateId: o, localize: e, locale: r }), [o, e, r]);
11
+ return /* @__PURE__ */ u.createElement(w.Provider, { value: a }, n);
12
+ };
13
+ export {
14
+ w as Context,
15
+ m as Provider
16
+ };
@@ -0,0 +1,115 @@
1
+ import t from "prop-types";
2
+ import e, { useState as N } from "react";
3
+ import { Alert as C } from "../Alert.js";
4
+ import { Button as R } from "../Buttons/Button.js";
5
+ import { Checkbox as S } from "../Forms/Checkbox.js";
6
+ import { FormGroup as d } from "../Forms/FormGroup.js";
7
+ import { Input as u } from "../Forms/Input.js";
8
+ import { Label as p } from "../Forms/Label.js";
9
+ import { Spinner as j } from "../Spinner.js";
10
+ import { XolaLogoSimple as I } from "../../icons/src/images/XolaLogoSimple.js";
11
+ const f = {
12
+ default: "https://files.xola.com/x2/images/login/old-photo-1554629947-334ff61d85dc.jpeg",
13
+ x2: "https://files.xola.com/x2/images/login/x2-34fc260271ca80160c61777846784611.jpeg",
14
+ admin: "https://files.xola.com/x2/images/login/admin-42e40b1836193f064f0fe0fafce1d2af.png",
15
+ scaffold: "https://files.xola.com/x2/images/login/scaffold-f3bd19169b6976f1c75da53e7b61d0a7.jpeg"
16
+ }, F = ({
17
+ defaultValues: g,
18
+ isLoading: n = !1,
19
+ error: l = null,
20
+ onSubmit: b,
21
+ passwordResetUrl: x,
22
+ label: s,
23
+ backgroundImage: h = null,
24
+ backgroundType: E = "default",
25
+ ...y
26
+ }) => {
27
+ const [a, c] = N({ email: "", password: "", shouldRemember: !1, ...g }), i = (r) => {
28
+ const { name: m, value: o } = r.target;
29
+ c({ ...a, [m]: o });
30
+ }, w = (r) => {
31
+ const { name: m, checked: o } = r.target;
32
+ c({ ...a, [m]: o });
33
+ }, v = (r) => {
34
+ r.preventDefault(), b(a);
35
+ }, k = {
36
+ backgroundImage: `url("${h ?? f[E] ?? f.default}")`,
37
+ backgroundRepeat: "no-repeat",
38
+ backgroundPosition: "center",
39
+ backgroundSize: "cover"
40
+ };
41
+ return /* @__PURE__ */ e.createElement(
42
+ "div",
43
+ {
44
+ className: "ui-login h-screen overflow-hidden bg-white bg-opacity-100 bg-blend-overlay md:bg-opacity-0",
45
+ style: k,
46
+ ...y
47
+ },
48
+ /* @__PURE__ */ e.createElement("div", { className: "md:full flex h-[88%] w-full flex-col items-center justify-center space-y-8" }, /* @__PURE__ */ e.createElement("div", { className: "w-85 rounded-lg px-9 py-0 md:bg-white md:py-10" }, /* @__PURE__ */ e.createElement("div", { className: "mb-12 space-y-4 md:mb-20" }, /* @__PURE__ */ e.createElement(I, { className: "mx-auto h-10 w-auto md:h-12" }), s && /* @__PURE__ */ e.createElement("div", { className: "flex items-center justify-center" }, s)), /* @__PURE__ */ e.createElement("form", { onSubmit: v }, /* @__PURE__ */ e.createElement("fieldset", { className: "space-y-6", disabled: n }, /* @__PURE__ */ e.createElement("div", { className: "-space-y-px rounded-md bg-white" }, /* @__PURE__ */ e.createElement(d, { className: "md:mb-7" }, /* @__PURE__ */ e.createElement(p, null, "Email"), /* @__PURE__ */ e.createElement(
49
+ u,
50
+ {
51
+ required: !0,
52
+ name: "email",
53
+ type: "email",
54
+ autoComplete: "email",
55
+ value: a.email,
56
+ isError: !!l,
57
+ onChange: i
58
+ }
59
+ )), /* @__PURE__ */ e.createElement(d, null, /* @__PURE__ */ e.createElement(p, null, "Password"), /* @__PURE__ */ e.createElement(
60
+ u,
61
+ {
62
+ required: !0,
63
+ name: "password",
64
+ type: "password",
65
+ autoComplete: "current-password",
66
+ value: a.password,
67
+ isError: !!l,
68
+ onChange: i
69
+ }
70
+ ))), /* @__PURE__ */ e.createElement(
71
+ S,
72
+ {
73
+ name: "shouldRemember",
74
+ label: "Remember me",
75
+ checked: a.shouldRemember,
76
+ onChange: w
77
+ }
78
+ ), l ? /* @__PURE__ */ e.createElement(C, { color: "danger" }, l) : null, /* @__PURE__ */ e.createElement(R, { type: "submit", className: "w-full", color: "primary" }, n ? /* @__PURE__ */ e.createElement(j, { size: "current", color: "current", className: "mr-2" }) : null, "Login"), /* @__PURE__ */ e.createElement("div", { className: "mt-5 text-center text-sm" }, /* @__PURE__ */ e.createElement(
79
+ "a",
80
+ {
81
+ href: x,
82
+ className: "font-semibold text-gray-darker underline hover:text-black",
83
+ target: "_blank",
84
+ rel: "noreferrer"
85
+ },
86
+ "Forgot your password?"
87
+ )))))),
88
+ /* @__PURE__ */ e.createElement("footer", null, /* @__PURE__ */ e.createElement("div", { className: "flex w-full flex-col items-center justify-center overflow-hidden px-4 py-1 sm:px-6 lg:px-8" }, /* @__PURE__ */ e.createElement("div", { className: "m-5 w-85 rounded-lg px-4 text-center text-xs opacity-80 md:text-sm" }, /* @__PURE__ */ e.createElement(
89
+ "a",
90
+ {
91
+ href: "https://www.xola.com/team",
92
+ target: "_blank",
93
+ className: "text-gray md:text-gray-dark",
94
+ rel: "noreferrer"
95
+ },
96
+ "Designed in San Francisco & Rouen, France",
97
+ /* @__PURE__ */ e.createElement("br", null),
98
+ "Built in Houston, Belgrade, Ukraine & Bengaluru"
99
+ ), /* @__PURE__ */ e.createElement("div", { className: "text-center text-gray md:text-gray-dark" }, "© ", (/* @__PURE__ */ new Date()).getFullYear(), " Xola, Inc."))))
100
+ );
101
+ };
102
+ F.propTypes = {
103
+ defaultValues: t.shape({
104
+ email: t.string,
105
+ password: t.string,
106
+ shouldRemember: t.bool
107
+ }),
108
+ isLoading: t.bool,
109
+ error: t.string,
110
+ onSubmit: t.func,
111
+ passwordResetUrl: t.string
112
+ };
113
+ export {
114
+ F as Login
115
+ };
@@ -0,0 +1,144 @@
1
+ import { useCombobox as I } from "downshift";
2
+ import { debounce as se } from "lodash-es";
3
+ import a from "prop-types";
4
+ import e, { useState as u, useRef as P, useId as F, useEffect as R } from "react";
5
+ import { useHotkeys as V } from "react-hotkeys-hook";
6
+ import { isOSX as re } from "../helpers/browser.js";
7
+ import C from "../helpers/classnames.js";
8
+ import { useIsClient as ne } from "../hooks/useIsClient.js";
9
+ import { Key as l } from "./Key.js";
10
+ import { Spinner as D } from "./Spinner.js";
11
+ import { SearchIcon as le } from "../icons/src/SearchIcon.js";
12
+ const ce = se((m, i) => m(i), 500), oe = ({
13
+ className: m,
14
+ items: i = [],
15
+ defaultValue: H,
16
+ onChange: o,
17
+ onSubmit: p,
18
+ onSelect: f,
19
+ children: d,
20
+ isLoading: h = !1,
21
+ shouldStayOpen: K = !1,
22
+ shouldDestroyOnClose: M = !0,
23
+ shouldHideMenu: T = !1,
24
+ minChars: g = 0,
25
+ ...z
26
+ }) => {
27
+ const [B, k] = u(!0), [s, E] = u(H ?? ""), [U, O] = u(!1), r = P(), W = F("search-input"), $ = F("search-menu"), X = ne(), j = P(), [q, y] = u(!0);
28
+ R(() => {
29
+ s.length > 0 ? O(!0) : O(!1);
30
+ }, [s]);
31
+ const b = { value: s }, c = s ? [b, ...i] : [], A = ({ selectedItem: t, type: n }) => {
32
+ n !== I.stateChangeTypes.InputBlur && n !== I.stateChangeTypes.FunctionCloseMenu && (t === b ? (p == null || p(s), r.current.blur()) : t && (f == null || f(t), r.current.blur()), _());
33
+ }, G = ({ inputValue: t }) => {
34
+ E(t), o && ce(o, t);
35
+ }, {
36
+ isOpen: x,
37
+ openMenu: J,
38
+ getMenuProps: L,
39
+ getInputProps: Q,
40
+ getComboboxProps: Y,
41
+ highlightedIndex: S,
42
+ getItemProps: Z,
43
+ closeMenu: _
44
+ } = I({
45
+ items: c,
46
+ inputValue: s,
47
+ onInputValueChange: G,
48
+ itemToString: () => s,
49
+ // We will not change the search input after an item is selected.
50
+ defaultHighlightedIndex: 0,
51
+ onSelectedItemChange: A
52
+ });
53
+ R(() => {
54
+ x ? y(!1) : setTimeout(() => y(!0), 1);
55
+ }, [x, y]);
56
+ const ee = () => {
57
+ k(!1), J();
58
+ }, te = () => {
59
+ E(""), o && o(""), r.current.focus();
60
+ };
61
+ V(
62
+ re ? "cmd+k" : "ctrl+k",
63
+ (t) => {
64
+ t.preventDefault(), r.current.focus();
65
+ },
66
+ { enableOnTags: ["INPUT"] }
67
+ ), V(
68
+ "esc",
69
+ (t) => {
70
+ (document == null ? void 0 : document.activeElement) === r.current && (t.preventDefault(), s.length > 0 ? te() : r.current.blur());
71
+ },
72
+ { enableOnTags: ["INPUT"] }
73
+ );
74
+ const N = (x || !q || K) && c.length > 0 && !T, ae = N && !h && c.length <= 1 && s.length >= g, v = N || !M, w = c.some((t) => !!t.id);
75
+ return /* @__PURE__ */ e.createElement("div", { suppressHydrationWarning: !0, className: "ui-search relative w-full" }, /* @__PURE__ */ e.createElement("div", { ...Y({ className: "w-full relative rounded-md" }) }, /* @__PURE__ */ e.createElement("div", { className: "pointer-events-none absolute inset-y-0 -top-0.5 left-0 hidden items-center md:flex" }, /* @__PURE__ */ e.createElement(le, { className: "h-4 w-4 text-gray-darker" })), /* @__PURE__ */ e.createElement(
76
+ "input",
77
+ {
78
+ suppressHydrationWarning: !0,
79
+ ...Q({
80
+ id: W,
81
+ type: "text",
82
+ className: C(
83
+ "ui-search-input",
84
+ "block w-full border-none pl-0 md:pl-7 text-base md:text-md text-gray-darker leading-p2 focus:ring-0",
85
+ m
86
+ ),
87
+ ref: r,
88
+ onFocus: ee,
89
+ onBlur: () => k(!0),
90
+ onChange: (t) => E(t.target.value),
91
+ ...z
92
+ })
93
+ }
94
+ ), /* @__PURE__ */ e.createElement("div", { className: "pointer-events-none absolute inset-y-0 right-0 hidden items-center space-x-1 pr-3 lg:flex" }, X && B ? /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(l, { char: "cmd" }), " ", /* @__PURE__ */ e.createElement(l, { char: "K" })) : null)), /* @__PURE__ */ e.createElement("div", { className: "relative" }, T && /* @__PURE__ */ e.createElement(
95
+ "div",
96
+ {
97
+ ref: j,
98
+ className: `text-gray-500 absolute left-0 top-full transform
99
+ text-xs transition-all duration-200
100
+ ease-in-out ${U ? "translate-y-0 opacity-100" : "-translate-y-2 opacity-0"}`
101
+ },
102
+ /* @__PURE__ */ e.createElement("span", { className: "inline-flex items-center gap-1" }, /* @__PURE__ */ e.createElement(l, { char: "Esc" }), /* @__PURE__ */ e.createElement("span", null, "Clear search"))
103
+ )), /* @__PURE__ */ e.createElement(
104
+ "ul",
105
+ {
106
+ ...L({
107
+ id: $,
108
+ className: C(
109
+ "ui-search-menu",
110
+ "absolute top-10 divide-y divide-gray-light w-full xl:w-[590px] max-h-[75vh] border border-secondary-lighter shadow-xl mt-1 rounded overflow-auto z-20 bg-white",
111
+ { hidden: !N }
112
+ )
113
+ })
114
+ },
115
+ v ? c.map((t, n) => /* @__PURE__ */ e.createElement("li", { key: (t == null ? void 0 : t.id) ?? n, ...Z({ item: t, index: n, className: "ui-search-item" }) }, t === b ? h && !w ? /* @__PURE__ */ e.createElement("div", { className: "p-3 text-center" }, /* @__PURE__ */ e.createElement(D, { size: "small" })) : s.length < g ? /* @__PURE__ */ e.createElement(
116
+ "div",
117
+ {
118
+ className: C(
119
+ "cursor-pointer p-2",
120
+ S === n ? "bg-blue-light text-white" : ""
121
+ )
122
+ },
123
+ `Enter at least ${g} characters to begin search`
124
+ ) : null : d == null ? void 0 : d(t, S === n))) : null,
125
+ v && ae ? /* @__PURE__ */ e.createElement("li", { className: "cursor-not-allowed p-2" }, "No results found") : null,
126
+ v && w && /* @__PURE__ */ e.createElement("li", { className: "bg-white search-footer pointer-events sticky bottom-0 items-center flex space-x-5 p-2 text-sm text-gray-dark" }, /* @__PURE__ */ e.createElement("span", { className: "flex items-center" }, /* @__PURE__ */ e.createElement(l, { char: "up", className: "mr-0.5" }), /* @__PURE__ */ e.createElement(l, { char: "down", className: "mr-2" }), " navigate results"), /* @__PURE__ */ e.createElement("span", { className: "flex items-center" }, /* @__PURE__ */ e.createElement(l, { char: "enter", className: "mr-2" }), " submit"), /* @__PURE__ */ e.createElement("span", { className: "flex items-center" }, /* @__PURE__ */ e.createElement(l, { char: "esc", className: "mr-2" }), " close search"), h && /* @__PURE__ */ e.createElement("span", null, /* @__PURE__ */ e.createElement(D, { size: "tiny", className: "mr-1" }), " Fetching ", w ? "more data" : "data"))
127
+ ));
128
+ };
129
+ oe.propTypes = {
130
+ className: a.string,
131
+ items: a.arrayOf(a.any),
132
+ defaultValue: a.string,
133
+ onChange: a.func,
134
+ onSubmit: a.func,
135
+ onSelect: a.func,
136
+ children: a.oneOfType([a.arrayOf(a.node), a.node, a.func]),
137
+ isLoading: a.bool,
138
+ shouldStayOpen: a.bool,
139
+ shouldDestroyOnClose: a.bool,
140
+ shouldHideMenu: a.bool
141
+ };
142
+ export {
143
+ oe as Search
144
+ };
@@ -0,0 +1,49 @@
1
+ import t from "prop-types";
2
+ import e, { useRef as d } from "react";
3
+ import f from "../../helpers/classnames.js";
4
+ import { isDevelopment as v } from "../../helpers/environment.js";
5
+ import { Avatar as b } from "../Avatar.js";
6
+ import { useSidebar as g } from "./SidebarContext.js";
7
+ import { ChevronRightIcon as h } from "../../icons/src/ChevronRightIcon.js";
8
+ const o = ({
9
+ name: s,
10
+ description: a,
11
+ image: i,
12
+ icon: c = /* @__PURE__ */ e.createElement(h, null),
13
+ isResponsive: m,
14
+ className: l,
15
+ ...p
16
+ }) => {
17
+ const { showText: r } = g(), u = i ?? /* @__PURE__ */ e.createElement(b, { size: "tiny", name: s }), n = d(!1);
18
+ return v && m !== void 0 && !n.current && (n.current = !0, console.warn(
19
+ "UI Kit: Sidebar.Account no longer needs `isResponsive`; the sidebar's variant drives this. Remove the prop."
20
+ )), /* @__PURE__ */ e.createElement(
21
+ "button",
22
+ {
23
+ type: "button",
24
+ className: f(
25
+ "ui-sidebar-account",
26
+ "flex h-12 w-full cursor-pointer items-center rounded px-4 py-3 hover:bg-gray-darker",
27
+ r ? "justify-start" : "justify-center",
28
+ l
29
+ ),
30
+ ...p
31
+ },
32
+ /* @__PURE__ */ e.createElement("div", { className: "shrink-0" }, u),
33
+ r && /* @__PURE__ */ e.createElement("div", { className: "ml-2 min-w-0 text-left" }, /* @__PURE__ */ e.createElement("div", { className: "truncate text-base" }, s), a && /* @__PURE__ */ e.createElement("div", { className: "truncate text-sm text-gray-dark" }, a)),
34
+ r && /* @__PURE__ */ e.createElement("span", { className: "ml-auto" }, c)
35
+ );
36
+ };
37
+ o.displayName = "Sidebar.Account";
38
+ o.propTypes = {
39
+ name: t.string.isRequired,
40
+ description: t.string,
41
+ image: t.node,
42
+ icon: t.node,
43
+ // Deprecated no-op, retained so existing consumers keep compiling. Warns in development.
44
+ isResponsive: t.bool,
45
+ className: t.string
46
+ };
47
+ export {
48
+ o as SidebarAccount
49
+ };
@@ -0,0 +1,47 @@
1
+ import r from "prop-types";
2
+ import i from "react";
3
+ import a from "../../helpers/classnames.js";
4
+ import { useSidebar as d } from "./SidebarContext.js";
5
+ const s = ({ icon: p, label: n, appearance: m = "plain", className: l, ...c }) => {
6
+ const { showIcons: o, showText: t } = d(), e = m === "solid";
7
+ return /* @__PURE__ */ i.createElement(
8
+ "button",
9
+ {
10
+ type: "button",
11
+ className: a(
12
+ "ui-sidebar-button flex min-w-0 cursor-pointer items-center rounded",
13
+ e ? "mx-2 mb-4 bg-white py-1.5 text-base font-semibold text-gray-darker hover:bg-gray-lighter" : "w-full py-2 hover:bg-gray-darker",
14
+ t && (e ? "px-3" : "px-4"),
15
+ !t && "justify-center px-2",
16
+ l
17
+ ),
18
+ "aria-label": t ? void 0 : n,
19
+ ...c
20
+ },
21
+ /* @__PURE__ */ i.createElement("div", { className: a("shrink-0", e ? "p-0.5" : "p-1.5", !o && "hidden") }, /* @__PURE__ */ i.createElement(p, { className: a("shrink-0", e ? "h-5 w-5" : "h-4 w-4") })),
22
+ /* @__PURE__ */ i.createElement(
23
+ "span",
24
+ {
25
+ className: a(
26
+ "min-w-0 truncate",
27
+ !t && "hidden",
28
+ o && (e ? "ml-3" : "ml-2"),
29
+ e && "whitespace-nowrap"
30
+ )
31
+ },
32
+ n
33
+ )
34
+ );
35
+ };
36
+ s.displayName = "Sidebar.Button";
37
+ s.propTypes = {
38
+ icon: r.elementType.isRequired,
39
+ label: r.string.isRequired,
40
+ // "solid" is the filled, card-like treatment that lifts one action out of the list. It
41
+ // carries a larger icon to match.
42
+ appearance: r.oneOf(["plain", "solid"]),
43
+ className: r.string
44
+ };
45
+ export {
46
+ s as SidebarButton
47
+ };
@@ -0,0 +1,10 @@
1
+ import t from "prop-types";
2
+ import e from "react";
3
+ const r = ({ children: o, ...a }) => /* @__PURE__ */ e.createElement("div", { className: "ui-sidebar-footer py-3", ...a }, /* @__PURE__ */ e.createElement("div", { className: "mx-4 border-t border-secondary-darker pb-2" }), o);
4
+ r.displayName = "Sidebar.Footer";
5
+ r.propTypes = {
6
+ children: t.node.isRequired
7
+ };
8
+ export {
9
+ r as SidebarFooter
10
+ };
@@ -0,0 +1,13 @@
1
+ import e from "prop-types";
2
+ import t from "react";
3
+ import s from "../../helpers/classnames.js";
4
+ const r = ({ icon: a, label: i, className: m }) => /* @__PURE__ */ t.createElement("p", { className: s("ml-4 flex items-center text-white", m) }, /* @__PURE__ */ t.createElement(a, { className: "mr-3 h-5 w-5" }), /* @__PURE__ */ t.createElement("span", { className: "text-md font-bold" }, i));
5
+ r.displayName = "Sidebar.Heading";
6
+ r.propTypes = {
7
+ icon: e.func.isRequired,
8
+ label: e.string.isRequired,
9
+ className: e.string
10
+ };
11
+ export {
12
+ r as SidebarHeading
13
+ };