@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.
Files changed (215) hide show
  1. package/README.md +136 -87
  2. package/build/components/Alert.js +18 -13
  3. package/build/components/Animation/FadeIn.js +36 -25
  4. package/build/components/Animation/SlideDown.js +14 -9
  5. package/build/components/Avatar.js +17 -10
  6. package/build/components/Badge.js +33 -24
  7. package/build/components/BottomSheet.js +114 -0
  8. package/build/components/Breadcrumb.js +27 -21
  9. package/build/components/Breakdown.js +66 -74
  10. package/build/components/Buttons/Button.js +53 -47
  11. package/build/components/Buttons/ButtonGroup.js +42 -39
  12. package/build/components/Buttons/SecondaryButton.js +31 -0
  13. package/build/components/Buttons/SubmitButton.js +72 -66
  14. package/build/components/Buttons/ToggleButton.js +15 -16
  15. package/build/components/Counter.js +10 -6
  16. package/build/components/DatePicker/DatePicker.helpers.js +24 -13
  17. package/build/components/DatePicker/DatePicker.js +196 -223
  18. package/build/components/DatePicker/DatePickerPopover.js +75 -66
  19. package/build/components/DatePicker/Day.js +35 -32
  20. package/build/components/DatePicker/LocalizedDayPicker.js +15 -18
  21. package/build/components/DatePicker/MonthGrid.js +35 -48
  22. package/build/components/DatePicker/MonthPicker.js +25 -20
  23. package/build/components/DatePicker/MonthSelector.js +39 -40
  24. package/build/components/DatePicker/MonthYearSelector.js +18 -39
  25. package/build/components/DatePicker/NavbarElement.js +26 -35
  26. package/build/components/DatePicker/RangeDatePicker.js +104 -123
  27. package/build/components/DatePicker/RelativeDateRange.js +153 -143
  28. package/build/components/DatePicker/UpcomingDatePicker.js +29 -25
  29. package/build/components/Dot/Dot.js +13 -8
  30. package/build/components/Dot/DotProgress.js +12 -7
  31. package/build/components/Drawer.js +109 -101
  32. package/build/components/Forms/BaseInput.js +50 -34
  33. package/build/components/Forms/Checkbox.js +33 -30
  34. package/build/components/Forms/ComboBox.js +35 -35
  35. package/build/components/Forms/FormGroup.js +7 -3
  36. package/build/components/Forms/InlineValuePopover.js +33 -39
  37. package/build/components/Forms/Input.js +15 -7
  38. package/build/components/Forms/Label.js +14 -8
  39. package/build/components/Forms/RangeSlider.js +41 -22
  40. package/build/components/Forms/Select.js +5 -6
  41. package/build/components/Forms/Switch.js +46 -38
  42. package/build/components/Forms/Textarea.js +37 -30
  43. package/build/components/Forms/ValuePopoverText.js +5 -8
  44. package/build/components/GooglePlacesAutocomplete.js +112 -0
  45. package/build/components/HeaderToolbar.js +30 -22
  46. package/build/components/ImageUpload.js +76 -79
  47. package/build/components/Key.js +21 -16
  48. package/build/components/Logo.js +12 -5
  49. package/build/components/Modal.js +87 -72
  50. package/build/components/Popover/Popover.js +40 -31
  51. package/build/components/Popover/PopoverList.js +43 -36
  52. package/build/components/Provider.js +7 -8
  53. package/build/components/Screens/Login.js +97 -126
  54. package/build/components/Search.js +114 -144
  55. package/build/components/Sidebar/Sidebar.Account.js +39 -46
  56. package/build/components/Sidebar/Sidebar.Button.js +45 -19
  57. package/build/components/Sidebar/Sidebar.Footer.js +8 -7
  58. package/build/components/Sidebar/Sidebar.Heading.js +11 -8
  59. package/build/components/Sidebar/Sidebar.Link.js +79 -44
  60. package/build/components/Sidebar/Sidebar.Menu.js +52 -28
  61. package/build/components/Sidebar/Sidebar.Notifications.js +107 -0
  62. package/build/components/Sidebar/Sidebar.js +207 -214
  63. package/build/components/Sidebar/SidebarContext.js +15 -0
  64. package/build/components/Sidebar/sidebarWidth.js +41 -0
  65. package/build/components/Sidebar/useSidebarWidthState.js +115 -0
  66. package/build/components/Skeleton.js +19 -20
  67. package/build/components/Spinner.js +18 -10
  68. package/build/components/Table.js +86 -50
  69. package/build/components/Tabs/Tabs.Panel.js +9 -5
  70. package/build/components/Tabs/Tabs.Tab.js +28 -23
  71. package/build/components/Tabs/Tabs.js +23 -23
  72. package/build/components/Tag.js +28 -23
  73. package/build/components/Tooltip.js +19 -5
  74. package/build/components/Utilities/Currency.js +49 -42
  75. package/build/components/Utilities/Number.js +14 -12
  76. package/build/components/Utilities/Phone.js +18 -12
  77. package/build/helpers/environment.js +10 -0
  78. package/build/helpers/flash.js +45 -46
  79. package/build/hooks/useIsMobile.js +8 -0
  80. package/build/hooks/useViewportHeight.js +6 -12
  81. package/build/icons/src/AnnounceIcon.js +3 -4
  82. package/build/icons/src/BellIcon.js +0 -1
  83. package/build/icons/src/CalendarIcon.js +0 -1
  84. package/build/icons/src/CheckIcon.js +0 -1
  85. package/build/icons/src/ChevronDownIcon.js +4 -5
  86. package/build/icons/src/ChevronLeftIcon.js +0 -1
  87. package/build/icons/src/ChevronRightIcon.js +0 -1
  88. package/build/icons/src/CircleNotch.js +0 -1
  89. package/build/icons/src/CloseIcon.js +11 -9
  90. package/build/icons/src/DownArrowIcon.js +0 -1
  91. package/build/icons/src/ImageIcon.js +0 -1
  92. package/build/icons/src/SearchIcon.js +4 -5
  93. package/build/icons/src/TrashIcon.js +0 -1
  94. package/build/icons/src/WarningDiamondIcon.js +0 -1
  95. package/build/icons/src/helpers/icon.js +5 -9
  96. package/build/icons/src/images/XolaLogoSimple.js +2 -3
  97. package/build/index.js +143 -130
  98. package/build/style.css +1 -0
  99. package/build/theme.css +76 -0
  100. package/build/theme.js +2 -0
  101. package/build/utils/currency.js +5 -5
  102. package/build/{helpers → utils}/date.js +17 -20
  103. package/build/utils/numbers.js +12 -12
  104. package/build/utils/phone.js +12 -14
  105. package/build/utils/userLocale.js +6 -0
  106. package/index.css +96 -4
  107. package/index.d.ts +204 -0
  108. package/package.json +87 -77
  109. package/skills/README.md +27 -0
  110. package/skills/migrate-2.6-to-3.7/SKILL.md +110 -0
  111. package/tailwind.config.js +5 -2
  112. package/build/base.css +0 -2
  113. package/build/components/Alert.d.ts +0 -18
  114. package/build/components/Animation/FadeIn.d.ts +0 -13
  115. package/build/components/Animation/SlideDown.d.ts +0 -6
  116. package/build/components/Avatar.d.ts +0 -16
  117. package/build/components/Badge.d.ts +0 -28
  118. package/build/components/Breadcrumb.d.ts +0 -21
  119. package/build/components/Breakdown.d.ts +0 -63
  120. package/build/components/Buttons/Button.d.ts +0 -53
  121. package/build/components/Buttons/ButtonGroup.d.ts +0 -35
  122. package/build/components/Buttons/SubmitButton.d.ts +0 -11
  123. package/build/components/Buttons/ToggleButton.d.ts +0 -21
  124. package/build/components/Charts/BaseChartOptions.d.ts +0 -136
  125. package/build/components/Charts/HistogramOptions.d.ts +0 -192
  126. package/build/components/Charts/PieOptions.d.ts +0 -177
  127. package/build/components/Counter.d.ts +0 -5
  128. package/build/components/DatePicker/DatePicker.d.ts +0 -41
  129. package/build/components/DatePicker/DatePicker.helpers.d.ts +0 -17
  130. package/build/components/DatePicker/DatePickerPopover.d.ts +0 -29
  131. package/build/components/DatePicker/Day.d.ts +0 -13
  132. package/build/components/DatePicker/LocalizedDayPicker.d.ts +0 -6
  133. package/build/components/DatePicker/MonthGrid.d.ts +0 -11
  134. package/build/components/DatePicker/MonthPicker.d.ts +0 -7
  135. package/build/components/DatePicker/MonthSelector.d.ts +0 -8
  136. package/build/components/DatePicker/MonthYearSelector.d.ts +0 -8
  137. package/build/components/DatePicker/NavbarElement.d.ts +0 -15
  138. package/build/components/DatePicker/RangeDatePicker.d.ts +0 -25
  139. package/build/components/DatePicker/RelativeDateRange.d.ts +0 -51
  140. package/build/components/DatePicker/UpcomingDatePicker.d.ts +0 -11
  141. package/build/components/Dot/Dot.d.ts +0 -24
  142. package/build/components/Dot/DotProgress.d.ts +0 -6
  143. package/build/components/Drawer.d.ts +0 -28
  144. package/build/components/Forms/BaseInput.d.ts +0 -20
  145. package/build/components/Forms/Checkbox.d.ts +0 -10
  146. package/build/components/Forms/ComboBox.d.ts +0 -8
  147. package/build/components/Forms/FormGroup.d.ts +0 -5
  148. package/build/components/Forms/InlineValuePopover.d.ts +0 -17
  149. package/build/components/Forms/Input.d.ts +0 -6
  150. package/build/components/Forms/Label.d.ts +0 -7
  151. package/build/components/Forms/RangeSlider.d.ts +0 -33
  152. package/build/components/Forms/Select.d.ts +0 -5
  153. package/build/components/Forms/Switch.d.ts +0 -46
  154. package/build/components/Forms/Textarea.d.ts +0 -6
  155. package/build/components/Forms/ValuePopoverText.d.ts +0 -6
  156. package/build/components/GooglePlacesAutocomplete.d.ts +0 -14
  157. package/build/components/HeaderToolbar.d.ts +0 -21
  158. package/build/components/ImageUpload.d.ts +0 -17
  159. package/build/components/Key.d.ts +0 -6
  160. package/build/components/Logo.d.ts +0 -19
  161. package/build/components/Modal.d.ts +0 -52
  162. package/build/components/Popover/Popover.d.ts +0 -20
  163. package/build/components/Popover/PopoverList.d.ts +0 -25
  164. package/build/components/Provider.d.ts +0 -18
  165. package/build/components/Screens/Login.d.ts +0 -25
  166. package/build/components/Search.d.ts +0 -16
  167. package/build/components/Sidebar/Sidebar.Account.d.ts +0 -13
  168. package/build/components/Sidebar/Sidebar.Button.d.ts +0 -10
  169. package/build/components/Sidebar/Sidebar.Footer.d.ts +0 -8
  170. package/build/components/Sidebar/Sidebar.Heading.d.ts +0 -10
  171. package/build/components/Sidebar/Sidebar.Link.d.ts +0 -24
  172. package/build/components/Sidebar/Sidebar.Menu.d.ts +0 -13
  173. package/build/components/Sidebar/Sidebar.d.ts +0 -58
  174. package/build/components/Sidebar/index.d.ts +0 -8
  175. package/build/components/Skeleton.d.ts +0 -13
  176. package/build/components/Spinner.d.ts +0 -26
  177. package/build/components/Table.d.ts +0 -59
  178. package/build/components/Tabs/Tabs.Panel.d.ts +0 -9
  179. package/build/components/Tabs/Tabs.Tab.d.ts +0 -19
  180. package/build/components/Tabs/Tabs.d.ts +0 -27
  181. package/build/components/Tabs/index.d.ts +0 -4
  182. package/build/components/Tag.d.ts +0 -25
  183. package/build/components/Tooltip.d.ts +0 -8
  184. package/build/components/Utilities/Currency.d.ts +0 -32
  185. package/build/components/Utilities/Number.d.ts +0 -8
  186. package/build/components/Utilities/Phone.d.ts +0 -8
  187. package/build/full.css +0 -2
  188. package/build/helpers/avatar.d.ts +0 -1
  189. package/build/helpers/avatar.js +0 -8
  190. package/build/helpers/browser.d.ts +0 -2
  191. package/build/helpers/children.d.ts +0 -3
  192. package/build/helpers/classnames.d.ts +0 -5
  193. package/build/helpers/currency.d.ts +0 -2
  194. package/build/helpers/currency.js +0 -11
  195. package/build/helpers/date.d.ts +0 -12
  196. package/build/helpers/flash.d.ts +0 -21
  197. package/build/helpers/numbers.d.ts +0 -4
  198. package/build/helpers/numbers.js +0 -23
  199. package/build/helpers/phone.d.ts +0 -11
  200. package/build/helpers/phone.js +0 -25
  201. package/build/hooks/useId.d.ts +0 -1
  202. package/build/hooks/useId.js +0 -9
  203. package/build/hooks/useIsClient.d.ts +0 -1
  204. package/build/hooks/useViewportHeight.d.ts +0 -1
  205. package/build/icons/src/helpers/classnames.js +0 -8
  206. package/build/index.d.ts +0 -66
  207. package/build/theme.d.ts +0 -413
  208. package/build/types/index.d.ts +0 -22
  209. package/build/types/migration.d.ts +0 -2
  210. package/build/ui-kit.css +0 -1
  211. package/build/utils/avatar.d.ts +0 -1
  212. package/build/utils/currency.d.ts +0 -2
  213. package/build/utils/index.d.ts +0 -4
  214. package/build/utils/numbers.d.ts +0 -4
  215. package/build/utils/phone.d.ts +0 -2
@@ -1,47 +1,41 @@
1
- import { jsxs as d, jsx as e } from "react/jsx-runtime";
2
- import { useRef as P } from "react";
3
- import i from "../../helpers/classnames.js";
4
- import { Popover as f } from "../Popover/Popover.js";
5
- import { ValuePopoverText as g } from "./ValuePopoverText.js";
6
- import { DownArrowIcon as j } from "../../icons/src/DownArrowIcon.js";
7
- const D = ({
8
- text: l,
9
- isOpen: b = !1,
10
- showArrow: x = !0,
11
- autoSelectOnClick: c = !1,
12
- children: h,
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
- classNames: r,
15
- onClick: o,
16
- onClickOutside: v,
17
- ...m
16
+ ...x
18
17
  }) => {
19
- const t = P(null), w = (I) => {
18
+ const i = h(), E = (w) => {
20
19
  setTimeout(() => {
21
20
  var u;
22
- const n = (u = t == null ? void 0 : t.current) == null ? void 0 : u.querySelector("select,textarea,input");
23
- n && (n.focus(), c && n.select());
24
- }, 0), o == null || o(I);
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__ */ d(f, { visible: b, className: "", onClickOutside: v, ...m, children: [
27
- /* @__PURE__ */ d(
28
- "span",
29
- {
30
- className: i(
31
- "cursor-pointer whitespace-nowrap",
32
- p && "!border-danger !text-danger",
33
- r == null ? void 0 : r.text
34
- ),
35
- onClick: w,
36
- children: [
37
- /* @__PURE__ */ e("span", { className: i("border-b border-b-black font-bold text-black", r == null ? void 0 : r.textField), children: /* @__PURE__ */ e(g, { value: l, error: p }) }),
38
- x && /* @__PURE__ */ e(j, { size: "medium" })
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
- D as InlineValuePopover
40
+ q as InlineValuePopover
47
41
  };
@@ -1,9 +1,17 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { forwardRef as n } from "react";
3
- import a from "../../helpers/classnames.js";
4
- import { BaseInput as e } from "./BaseInput.js";
5
- const s = n(({ className: t, type: r = "text", value: o, ...p }, m) => /* @__PURE__ */ i(e, { ref: m, as: "input", className: a("ui-input", t), type: r, value: o, ...p }));
6
- s.displayName = "Input";
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
- s as Input
16
+ p as Input
9
17
  };
@@ -1,17 +1,23 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import r from "../../helpers/classnames.js";
3
- const s = ({ isDisabled: t = !1, isError: e = !1, className: l, ...a }) => /* @__PURE__ */ o(
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: r(
7
+ className: s(
7
8
  "ui-label",
8
- l,
9
+ r,
9
10
  "mb-1 block text-sm font-bold",
10
- e ? "text-danger" : t ? "text-gray" : "text-black"
11
+ o ? "text-danger" : t ? "text-gray" : "text-black"
11
12
  ),
12
- ...a
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
- s as Label
22
+ m as Label
17
23
  };
@@ -1,39 +1,58 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import u from "nouislider-react";
1
+ import c from "nouislider-react";
3
2
  /* empty css */
4
- import g from "../../helpers/classnames.js";
3
+ import e from "prop-types";
4
+ import b from "react";
5
+ import R from "../../helpers/classnames.js";
5
6
  /* empty css */
6
- const j = ({
7
- values: t,
8
- min: o,
9
- max: e,
10
- isDisabled: i = !1,
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: n = !0,
14
- tooltipCustomFormatter: s = null,
15
- tooltipSuffix: l,
16
- className: p,
15
+ isTooltipEnabled: l = !0,
16
+ tooltipCustomFormatter: u = null,
17
+ tooltipSuffix: p,
17
18
  onChange: f
18
19
  }) => {
19
- const c = s ?? t.map(() => ({
20
+ const d = u ?? o.map(() => ({
20
21
  from: (r) => r,
21
- to: (r) => `${Math.round(r)}${l ?? ""}`
22
+ to: (r) => Math.round(r) + p
22
23
  }));
23
- return /* @__PURE__ */ d(
24
- u,
24
+ return /* @__PURE__ */ b.createElement(
25
+ c,
25
26
  {
26
- className: g("ui-range-slider", p),
27
+ className: R("ui-range-slider", t),
27
28
  connect: a,
28
- disabled: i,
29
- start: t,
30
- range: { min: o, max: e },
29
+ disabled: n,
30
+ start: o,
31
+ range: { min: i, max: s },
31
32
  step: m,
32
- tooltips: n ? c : !1,
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
- j as RangeSlider
57
+ g as RangeSlider
39
58
  };
@@ -1,8 +1,7 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { forwardRef as o } from "react";
3
- import { BaseInput as m } from "./BaseInput.js";
4
- const p = o((e, r) => /* @__PURE__ */ t(m, { ref: r, as: "select", ...e }));
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
- p as Select
6
+ r as Select
8
7
  };
@@ -1,8 +1,8 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { Switch as s } from "@headlessui/react";
3
- import { noop as m } from "lodash-es";
4
- import e from "../../helpers/classnames.js";
5
- const i = {
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
- }, p = ({ isChecked: n = !1, size: r = "medium", disabled: a, className: c, onChange: u }) => /* @__PURE__ */ t(
22
- s,
21
+ }, n = ({ isChecked: e = !1, size: r = "medium", ...s }) => /* @__PURE__ */ a.createElement(
22
+ o,
23
23
  {
24
- checked: n,
25
- disabled: a,
26
- className: e(
24
+ checked: e,
25
+ className: i(
27
26
  "ui-switch",
28
- n ? "bg-primary disabled:bg-gray-light" : "bg-gray disabled:bg-gray-light",
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
- i[r].parent,
31
- c
29
+ l[r].parent
32
30
  ),
33
- onChange: u ?? m,
34
- children: /* @__PURE__ */ t(
35
- "span",
36
- {
37
- className: e(
38
- n ? i[r].translate : "translate-x-0",
39
- "ui-switch-inner pointer-events-none inline-block transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out",
40
- i[r].inner
41
- )
42
- }
43
- )
44
- }
45
- ), o = ({ children: n, className: r }) => /* @__PURE__ */ t(s.Group, { as: "div", className: e("ui-switch-group", "inline-flex items-center", r), children: n });
46
- o.displayName = "Switch.Group";
47
- const l = ({ direction: n = "left", children: r, className: a }) => /* @__PURE__ */ t(
48
- s.Label,
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: e("ui-switch-label", "cursor-pointer", n === "left" ? "mr-2" : "ml-2", a),
52
- children: r
53
- }
58
+ className: i("ui-switch-label", "cursor-pointer", e === "left" ? "mr-2" : "ml-2", r)
59
+ },
60
+ s
54
61
  );
55
- l.displayName = "Switch.Label";
56
- const g = Object.assign(p, {
57
- Group: o,
58
- Label: l
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
- g as Switch
69
+ n as Switch
62
70
  };
@@ -1,35 +1,42 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { forwardRef as x } from "react";
3
- import f from "react-textarea-autosize";
4
- import i from "../../helpers/classnames.js";
5
- import { BaseInput as s } from "./BaseInput.js";
6
- const n = x(
7
- ({ className: a, value: r, shouldAutoSize: p = !1, rows: t = 2, ...e }, o) => p ? (
8
- // 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
9
- /* @__PURE__ */ m(
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: o,
24
- as: "textarea",
25
- value: r,
26
- rows: t,
27
- className: i("ui-textarea", a),
28
- ...e
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
- n.displayName = "Textarea";
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
- n as Textarea
41
+ r as Textarea
35
42
  };
@@ -1,10 +1,7 @@
1
- import { jsxs as e, jsx as n } from "react/jsx-runtime";
2
- import { Tooltip as t } from "../Tooltip.js";
3
- import { WarningDiamondIcon as a } from "../../icons/src/WarningDiamondIcon.js";
4
- const l = ({ value: r, error: o }) => /* @__PURE__ */ e("span", { children: [
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
- l as ValuePopoverText
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 { jsx as a } from "react/jsx-runtime";
2
- import o from "../helpers/classnames.js";
3
- import { Search as c } from "./Search.js";
4
- import { Breadcrumb as d } from "./Breadcrumb.js";
5
- const l = ({ classNames: r, children: e }) => /* @__PURE__ */ a(
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: o(
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
- r
12
- ),
13
- children: e
14
- }
15
- ), m = ({ children: r, className: e }) => /* @__PURE__ */ a(
16
- d,
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: o(
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
- children: r
24
- }
28
+ )
29
+ },
30
+ o
25
31
  );
26
- m.displayName = "HeaderToolbar.Breadcrumb";
27
- const t = (r) => /* @__PURE__ */ a(c, { className: "ui-header-toolbar-search w-full flex-grow pr-1", ...r });
28
- t.displayName = "HeaderToolbar.Search";
29
- l.Breadcrumb = m;
30
- l.Search = t;
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
- l as HeaderToolbar
40
+ r as HeaderToolbar
33
41
  };