@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
@@ -0,0 +1,114 @@
1
+ import { Transition as n, Dialog as h } from "@headlessui/react";
2
+ import s from "clsx";
3
+ import { noop as g } from "lodash-es";
4
+ import t from "prop-types";
5
+ import e, { Fragment as m } from "react";
6
+ import { isIosBrowser as v } from "../helpers/browser.js";
7
+ import { useViewportHeight as N } from "../hooks/useViewportHeight.js";
8
+ import { CloseIcon as E } from "../icons/src/CloseIcon.js";
9
+ const l = ({
10
+ isOpen: a = !1,
11
+ // Configurable: when true, tapping the dark overlay closes the sheet. Default false keeps parity
12
+ // with Modal. Closing is wired to the overlay's own onClick (not the Dialog's built-in
13
+ // outside-click) so interacting with popovers portaled outside the sheet — the DatePicker
14
+ // calendar, the ComboBox menu — is never mistaken for an outside click.
15
+ shouldCloseOnOutsideClick: o = !1,
16
+ onClose: r,
17
+ children: i,
18
+ className: y
19
+ }) => {
20
+ const u = N(), f = v(), x = () => {
21
+ o && r();
22
+ }, b = f && u ? { maxHeight: `${Math.round(u * 0.9)}px` } : void 0;
23
+ return /* @__PURE__ */ e.createElement(n, { appear: !0, show: a, as: m }, /* @__PURE__ */ e.createElement(h, { as: "div", className: "ui-bottom-sheet fixed inset-0 z-30", onClose: g }, /* @__PURE__ */ e.createElement(
24
+ n.Child,
25
+ {
26
+ as: m,
27
+ enter: "ease-out duration-300",
28
+ enterFrom: "opacity-0",
29
+ enterTo: "opacity-100",
30
+ leave: "ease-in duration-200",
31
+ leaveFrom: "opacity-100",
32
+ leaveTo: "opacity-0"
33
+ },
34
+ /* @__PURE__ */ e.createElement(
35
+ "div",
36
+ {
37
+ className: "ui-bottom-sheet-overlay fixed inset-0 bg-black bg-opacity-80 transition-opacity",
38
+ "aria-hidden": "true",
39
+ onClick: x
40
+ }
41
+ )
42
+ ), /* @__PURE__ */ e.createElement(
43
+ n.Child,
44
+ {
45
+ as: m,
46
+ enter: "transform transition ease-out duration-300",
47
+ enterFrom: "translate-y-full",
48
+ enterTo: "translate-y-0",
49
+ leave: "transform transition ease-in duration-200",
50
+ leaveFrom: "translate-y-0",
51
+ leaveTo: "translate-y-full"
52
+ },
53
+ /* @__PURE__ */ e.createElement(
54
+ "div",
55
+ {
56
+ style: b,
57
+ className: s(
58
+ y,
59
+ "ui-bottom-sheet-panel fixed inset-x-0 bottom-0 flex max-h-[90dvh] w-full flex-col rounded-t-2xl bg-white px-6 pb-8 pt-6 text-left shadow-xl"
60
+ )
61
+ },
62
+ /* @__PURE__ */ e.createElement(
63
+ "button",
64
+ {
65
+ type: "button",
66
+ "aria-label": "Close",
67
+ className: "absolute right-4 top-4 z-10 p-1 text-black hover:text-gray-darker",
68
+ onClick: () => r()
69
+ },
70
+ /* @__PURE__ */ e.createElement(E, null)
71
+ ),
72
+ i
73
+ )
74
+ )));
75
+ };
76
+ l.propTypes = {
77
+ isOpen: t.bool.isRequired,
78
+ shouldCloseOnOutsideClick: t.bool,
79
+ onClose: t.func.isRequired,
80
+ children: t.node.isRequired,
81
+ className: t.string
82
+ };
83
+ const c = ({ children: a, description: o, className: r, ...i }) => /* @__PURE__ */ e.createElement(
84
+ h.Title,
85
+ {
86
+ as: "div",
87
+ className: s(r, "ui-bottom-sheet-header shrink-0 px-8 text-center"),
88
+ ...i
89
+ },
90
+ /* @__PURE__ */ e.createElement("h3", { className: "text-2xl font-semibold leading-6 text-black" }, a),
91
+ o ? /* @__PURE__ */ e.createElement("p", { className: "mt-2 text-base font-normal leading-normal text-gray-darker" }, o) : null
92
+ );
93
+ c.propTypes = {
94
+ children: t.node.isRequired,
95
+ description: t.string,
96
+ className: t.string
97
+ };
98
+ c.displayName = "BottomSheet.Header";
99
+ l.Header = c;
100
+ const d = ({ className: a, ...o }) => /* @__PURE__ */ e.createElement("div", { className: s(a, "ui-bottom-sheet-body mt-6 min-h-0 overflow-y-auto"), ...o });
101
+ d.propTypes = {
102
+ className: t.string
103
+ };
104
+ d.displayName = "BottomSheet.Body";
105
+ l.Body = d;
106
+ const p = ({ className: a, ...o }) => /* @__PURE__ */ e.createElement("div", { className: s(a, "ui-bottom-sheet-footer mt-6 flex shrink-0 gap-3 [&>*]:flex-1"), ...o });
107
+ p.propTypes = {
108
+ className: t.string
109
+ };
110
+ p.displayName = "BottomSheet.Footer";
111
+ l.Footer = p;
112
+ export {
113
+ l as BottomSheet
114
+ };
@@ -1,27 +1,33 @@
1
- import { jsx as t, jsxs as p, Fragment as b } from "react/jsx-runtime";
2
- import { Children as s } from "react";
1
+ import e from "prop-types";
2
+ import r, { Children as i } from "react";
3
3
  import a from "../helpers/classnames.js";
4
- const x = ({ separator: n = "/", children: r, classNames: e = {}, className: o, ...i }) => {
5
- const d = s.count(r) - 1;
6
- return /* @__PURE__ */ t("div", { className: a("ui-breadcrumb", "whitespace-nowrap text-2xl font-semibold", o), ...i, children: s.map(r, (u, l) => {
7
- const m = l >= d;
8
- return /* @__PURE__ */ p(b, { children: [
9
- /* @__PURE__ */ t("span", { className: a(e.item, m ? "text-black" : "text-gray-dark"), children: u }),
10
- m ? null : /* @__PURE__ */ t("span", { className: a(e.separator, "mx-2 text-gray-dark"), children: n })
11
- ] });
12
- }) });
13
- }, c = ({ className: n, onClick: r, children: e }) => /* @__PURE__ */ t(
4
+ const n = ({ className: m, classNames: t = {}, separator: s = "/", children: c, ...l }) => {
5
+ const p = i.count(c) - 1;
6
+ return /* @__PURE__ */ r.createElement("div", { className: a("ui-breadcrumb", "whitespace-nowrap text-2xl font-semibold", m), ...l }, i.map(c, (d, u) => {
7
+ const o = u >= p;
8
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("span", { className: a(t.item, o ? "text-black" : "text-gray-dark") }, d), o ? null : /* @__PURE__ */ r.createElement("span", { className: a(t.separator, "mx-2 text-gray-dark") }, s));
9
+ }));
10
+ };
11
+ n.propTypes = {
12
+ className: e.string,
13
+ classNames: e.object,
14
+ separator: e.string,
15
+ children: e.oneOfType([e.arrayOf(e.node), e.node])
16
+ };
17
+ n.Item = ({ className: m, onClick: t, children: s }) => /* @__PURE__ */ r.createElement(
14
18
  "div",
15
19
  {
16
- className: a("ui-breadcrumb-item inline", r && "cursor-pointer hover:underline", n),
17
- onClick: r,
18
- children: e
19
- }
20
+ className: a("ui-breadcrumb-item inline", t && "cursor-pointer hover:underline", m),
21
+ onClick: t
22
+ },
23
+ s
20
24
  );
21
- c.displayName = "Breadcrumb.Item";
22
- const B = Object.assign(x, {
23
- Item: c
24
- });
25
+ n.Item.displayName = "Breadcrumb.Item";
26
+ n.Item.propTypes = {
27
+ className: e.string,
28
+ onClick: e.func,
29
+ children: e.node.isRequired
30
+ };
25
31
  export {
26
- B as Breadcrumb
32
+ n as Breadcrumb
27
33
  };
@@ -1,9 +1,9 @@
1
- import { jsx as e, jsxs as m } from "react/jsx-runtime";
2
- import { isNumber as f } from "lodash-es";
3
- import { useMemo as S, createContext as v, useContext as h } from "react";
4
- import r from "../helpers/classnames.js";
5
- import { Currency as b } from "./Utilities/Currency.js";
6
- const w = {
1
+ import { isNumber as N } from "lodash-es";
2
+ import t from "prop-types";
3
+ import e, { useMemo as x, createContext as S, useContext as y } from "react";
4
+ import a from "../helpers/classnames.js";
5
+ import { Currency as w } from "./Utilities/Currency.js";
6
+ const p = {
7
7
  default: "text-gray-darker",
8
8
  black: "text-black",
9
9
  primary: "text-primary",
@@ -12,78 +12,70 @@ const w = {
12
12
  success: "text-success",
13
13
  danger: "text-danger",
14
14
  caution: "text-caution"
15
- }, u = v(void 0), B = ({ currency: a, locale: t, children: s, className: c, ...l }) => {
16
- const i = S(() => ({ currency: a, locale: t }), [a, t]);
17
- return /* @__PURE__ */ e(u.Provider, { value: i, children: /* @__PURE__ */ e("table", { className: r("ui-breakdown", "w-full", c), ...l, children: /* @__PURE__ */ e("tbody", { children: s }) }) });
18
- }, k = ({
19
- info: a,
20
- methodIcon: t,
21
- secondary: s,
22
- value: c,
23
- color: l = "default",
15
+ }, b = S(), s = ({ children: r, className: o, currency: l, locale: n, ...c }) => {
16
+ const d = x(() => ({ currency: l, locale: n }), [l, n]);
17
+ return /* @__PURE__ */ e.createElement(b.Provider, { value: d }, /* @__PURE__ */ e.createElement("table", { className: a("ui-breakdown", "w-full", o), ...c }, /* @__PURE__ */ e.createElement("tbody", null, r)));
18
+ };
19
+ s.propTypes = {
20
+ children: t.node,
21
+ className: t.string,
22
+ currency: t.string.isRequired,
23
+ locale: t.string
24
+ };
25
+ const k = ({
26
+ info: r,
27
+ methodIcon: o,
28
+ secondary: l,
29
+ value: n,
30
+ color: c = "default",
31
+ className: d,
32
+ classNames: m = { key: "", children: "", info: "", value: "" },
24
33
  children: i,
25
- classNames: d = {},
26
- className: o,
27
- ...p
34
+ ...u
28
35
  }) => {
29
- const n = h(u), g = n == null ? void 0 : n.currency, x = n == null ? void 0 : n.locale;
30
- return /* @__PURE__ */ m("tr", { className: r("ui-breakdown-item", w[l], o), ...p, children: [
31
- /* @__PURE__ */ m("td", { colSpan: 2, className: r("break-words text-left leading-none", d.key), children: [
32
- /* @__PURE__ */ e("span", { className: "mr-0.5", children: t }),
33
- /* @__PURE__ */ e("span", { className: r("mr-1 break-normal md:break-all", d.children), children: i ?? "" }),
34
- /* @__PURE__ */ m("span", { className: r("text-sm", d.info), children: [
35
- a && /* @__PURE__ */ e("span", { className: "mr-2 rounded bg-white p-1 uppercase text-black empty:hidden", children: a }),
36
- s && /* @__PURE__ */ e("span", { className: "empty:hidden", children: s })
37
- ] })
38
- ] }),
39
- /* @__PURE__ */ e("td", { className: r("w-[1%] whitespace-nowrap pl-4 text-right", d.value), children: f(c) ? /* @__PURE__ */ e(
40
- b,
41
- {
42
- shouldRemoveTrailingZeroes: !1,
43
- currency: g,
44
- locale: x,
45
- compact: void 0,
46
- isNarrowSymbolForm: void 0,
47
- children: c
48
- }
49
- ) : /* @__PURE__ */ e("span", { children: c }) })
50
- ] });
36
+ const { currency: h, locale: E } = y(b) ?? {};
37
+ return /* @__PURE__ */ e.createElement("tr", { className: a("ui-breakdown-item", p[c], d), ...u }, /* @__PURE__ */ e.createElement("td", { colSpan: 2, className: a("break-words text-left leading-none", m.key) }, /* @__PURE__ */ e.createElement("span", { className: "mr-0.5" }, o), /* @__PURE__ */ e.createElement("span", { className: a("mr-1 break-normal md:break-all", m.children) }, i ?? ""), /* @__PURE__ */ e.createElement("span", { className: a("text-sm", m.info) }, r && /* @__PURE__ */ e.createElement("span", { className: "mr-2 rounded bg-white p-1 uppercase text-black empty:hidden" }, r), l && /* @__PURE__ */ e.createElement("span", { className: "empty:hidden" }, l))), /* @__PURE__ */ e.createElement("td", { className: a("w-[1%] whitespace-nowrap pl-4 text-right", m.value) }, N(n) ? /* @__PURE__ */ e.createElement(w, { shouldRemoveTrailingZeroes: !1, currency: h, locale: E }, n) : /* @__PURE__ */ e.createElement("span", null, n)));
38
+ };
39
+ k.propTypes = {
40
+ children: t.node,
41
+ info: t.node,
42
+ methodIcon: t.node,
43
+ secondary: t.node,
44
+ value: t.node,
45
+ className: t.string,
46
+ classNames: t.object,
47
+ color: t.oneOf(Object.keys(p))
51
48
  };
52
- k.displayName = "Breakdown.Item";
53
- const y = ({
54
- info: a,
55
- value: t,
56
- color: s = "black",
57
- children: c,
58
- classNames: l = {},
59
- className: i,
60
- ...d
49
+ s.Item = k;
50
+ s.Item.displayName = "Breakdown.Item";
51
+ const f = ({
52
+ info: r,
53
+ value: o,
54
+ color: l = "black",
55
+ className: n,
56
+ classNames: c = { children: "", info: "", value: "" },
57
+ children: d,
58
+ ...m
61
59
  }) => {
62
- const o = h(u), p = o == null ? void 0 : o.currency, n = o == null ? void 0 : o.locale;
63
- return /* @__PURE__ */ m("tr", { className: r("ui-breakdown-subtotal-item", "font-bold", w[s], i), ...d, children: [
64
- /* @__PURE__ */ e("td", { className: r("pb-4 pt-1 text-left", l.children), children: c }),
65
- /* @__PURE__ */ e("td", { className: r("whitespace-nowrap pb-4 pt-1 text-right", l.info), children: a }),
66
- /* @__PURE__ */ e("td", { className: r("w-[1%] whitespace-nowrap pb-4 pl-4 pt-1 text-right", l.value), children: /* @__PURE__ */ e(
67
- b,
68
- {
69
- shouldRemoveTrailingZeroes: !1,
70
- currency: p,
71
- locale: n,
72
- compact: void 0,
73
- isNarrowSymbolForm: void 0,
74
- children: t ?? 0
75
- }
76
- ) })
77
- ] });
60
+ const { currency: i, locale: u } = y(b) ?? {};
61
+ return /* @__PURE__ */ e.createElement("tr", { className: a("ui-breakdown-subtotal-item", "font-bold", p[l], n), ...m }, /* @__PURE__ */ e.createElement("td", { className: a("pt-1 pb-4 text-left", c.children) }, d), /* @__PURE__ */ e.createElement("td", { className: a("whitespace-nowrap pt-1 pb-4 text-right", c.info) }, r), /* @__PURE__ */ e.createElement("td", { className: a("w-[1%] whitespace-nowrap pt-1 pb-4 pl-4 text-right", c.value) }, /* @__PURE__ */ e.createElement(w, { shouldRemoveTrailingZeroes: !1, currency: i, locale: u }, o)));
62
+ };
63
+ f.propTypes = {
64
+ children: t.node,
65
+ info: t.node,
66
+ value: t.node,
67
+ className: t.string,
68
+ classNames: t.object,
69
+ color: t.oneOf(Object.keys(p))
70
+ };
71
+ s.SubtotalItem = f;
72
+ s.SubtotalItem.displayName = "Breakdown.SubtotalItem";
73
+ const g = ({ className: r, ...o }) => /* @__PURE__ */ e.createElement("tr", { className: a("ui-breakdown-separator", r), ...o }, /* @__PURE__ */ e.createElement("td", { colSpan: 3, className: "border-b border-gray-light pb-1" }));
74
+ g.propTypes = {
75
+ className: t.string
78
76
  };
79
- y.displayName = "Breakdown.SubtotalItem";
80
- const N = ({ className: a, ...t }) => /* @__PURE__ */ e("tr", { className: r("ui-breakdown-separator", a), ...t, children: /* @__PURE__ */ e("td", { colSpan: 3, className: "border-b border-gray-light pb-1" }) });
81
- N.displayName = "Breakdown.Separator";
82
- const T = Object.assign(B, {
83
- Item: k,
84
- SubtotalItem: y,
85
- Separator: N
86
- });
77
+ s.Separator = g;
78
+ s.Separator.displayName = "Breakdown.Separator";
87
79
  export {
88
- T as Breakdown
80
+ s as Breakdown
89
81
  };
@@ -1,15 +1,16 @@
1
- import { jsxs as u, jsx as n } from "react/jsx-runtime";
2
- import h from "../../helpers/classnames.js";
3
- const m = {
1
+ import e from "prop-types";
2
+ import i from "react";
3
+ import m from "../../helpers/classnames.js";
4
+ const n = {
4
5
  standard: {
5
6
  common: "border-transparent text-white",
6
7
  // Common classes for each style
7
- primary: "bg-primary hover:bg-primary-darker disabled:bg-primary active:bg-primary",
8
- secondary: "bg-secondary text-white hover:bg-secondary-dark disabled:bg-secondary border-transparent active:bg-secondary",
9
- success: "bg-success hover:bg-success-dark disabled:bg-success active:bg-success",
10
- warning: "bg-warning hover:bg-warning-dark disabled:bg-warning active:bg-warning",
11
- caution: "bg-caution hover:bg-caution-dark disabled:bg-caution active:bg-caution",
12
- danger: "bg-danger hover:bg-danger-dark disabled:bg-danger active:bg-danger"
8
+ primary: "bg-primary hover:bg-primary-darker active:bg-primary",
9
+ secondary: "bg-secondary text-white hover:bg-secondary-dark border-transparent active:bg-secondary",
10
+ success: "bg-success hover:bg-success-dark active:bg-success",
11
+ warning: "bg-warning hover:bg-warning-dark active:bg-warning",
12
+ caution: "bg-caution hover:bg-caution-dark active:bg-caution",
13
+ danger: "bg-danger hover:bg-danger-dark active:bg-danger"
13
14
  },
14
15
  outline: {
15
16
  common: "bg-white border hover:bg-white active:text-white",
@@ -31,7 +32,7 @@ const m = {
31
32
  caution: "text-caution",
32
33
  danger: "text-danger"
33
34
  }
34
- }, y = {
35
+ }, c = {
35
36
  tiny: "px-2 py-0.5 text-xs leading-xs",
36
37
  // 20px
37
38
  small: "px-3 py-2 h-7.5 text-sm leading-sm",
@@ -40,44 +41,49 @@ const m = {
40
41
  // 40px
41
42
  large: "px-6 py-4 h-[50px] text-md leading-md"
42
43
  // 50px
43
- }, x = ({
44
- as: s,
45
- variant: o = "standard",
46
- color: a = "primary",
44
+ }, u = ({
45
+ as: r = "button",
46
+ variant: t = "standard",
47
+ color: s = "primary",
47
48
  size: d = "medium",
48
- icon: r,
49
- iconPlacement: t = "left",
50
- children: i,
51
- className: c,
52
- ...g
53
- }) => {
54
- const b = s ?? "button";
55
- process.env.NODE_ENV !== "production" && r && !i && console.error(
56
- "UI Kit: You are using an icon without specifying children. If you want to use an icon only specify it as a child instead of prop"
57
- );
58
- const e = m[o], l = a in e ? e[a] : e.primary;
59
- return /* @__PURE__ */ u(
60
- b,
61
- {
62
- className: h(
63
- "ui-button",
64
- "inline-flex rounded border transition-colors focus:ring disabled:cursor-default disabled:bg-gray-lighter disabled:text-gray-dark",
65
- "items-center justify-center font-semibold",
66
- e.common,
67
- l,
68
- y[d],
69
- c
70
- ),
71
- ...g,
72
- children: [
73
- r && t === "left" ? /* @__PURE__ */ n("span", { className: "mr-2 flex-shrink-0", children: r }) : null,
74
- i,
75
- r && t === "right" ? /* @__PURE__ */ n("span", { className: "ml-2 flex-shrink-0", children: r }) : null
76
- ]
77
- }
78
- );
49
+ icon: a,
50
+ iconPlacement: o = "left",
51
+ className: g,
52
+ children: b,
53
+ ...l
54
+ }) => /* @__PURE__ */ i.createElement(
55
+ r,
56
+ {
57
+ className: m(
58
+ "ui-button",
59
+ "inline-flex rounded border transition-colors focus:ring disabled:cursor-default disabled:bg-gray-lighter disabled:text-gray-darker",
60
+ "items-center justify-center font-semibold",
61
+ n[t].common,
62
+ n[t][s],
63
+ c[d],
64
+ g
65
+ ),
66
+ ...l
67
+ },
68
+ a && o === "left" ? /* @__PURE__ */ i.createElement("span", { className: "mr-2 flex-shrink-0" }, a) : null,
69
+ b,
70
+ a && o === "right" ? /* @__PURE__ */ i.createElement("span", { className: "ml-2 flex-shrink-0" }, a) : null
71
+ );
72
+ u.propTypes = {
73
+ // as: PropTypes.string,
74
+ color: e.oneOf(Object.keys(n.outline)),
75
+ variant: e.oneOf(Object.keys(n)),
76
+ size: e.oneOf(Object.keys(c)),
77
+ className: e.string,
78
+ children: e.oneOfType([e.arrayOf(e.node), e.node]),
79
+ icon(r, ...t) {
80
+ return r.icon && !r.children ? new Error(
81
+ "UI Kit: You are using an icon without specifying children. If you want to use an icon only specify it as a child instead of prop"
82
+ ) : e.element(r, ...t);
83
+ },
84
+ iconPlacement: e.string
79
85
  };
80
86
  export {
81
- x as Button,
82
- m as colors
87
+ u as Button,
88
+ n as colors
83
89
  };
@@ -1,55 +1,58 @@
1
- import { jsx as d, jsxs as g } from "react/jsx-runtime";
2
- import x, { Children as h, cloneElement as y } from "react";
3
- import m from "../../helpers/classnames.js";
4
- const B = {
1
+ import e from "prop-types";
2
+ import l, { Children as y, cloneElement as h } from "react";
3
+ import f from "../../helpers/classnames.js";
4
+ const m = {
5
5
  small: "px-2 py-1.5 text-sm",
6
6
  medium: "py-3 px-2.5 text-base",
7
7
  large: "px-4 py-3.5 text-lg"
8
- }, k = ({
9
- size: i,
10
- value: e,
11
- isCollapsed: a = !1,
12
- children: p,
13
- className: u,
14
- onChange: t,
15
- ...n
16
- }) => /* @__PURE__ */ d("span", { className: m("ui-button-group", "inline-flex whitespace-nowrap", u), ...n, children: h.map(p, (r, s) => {
17
- if (!x.isValidElement(r) || r.props.isHidden)
18
- return null;
19
- const o = { size: i };
20
- return e !== void 0 && (o.isActive = e === s), a && e >= 0 && e !== s && (o.shouldShowText = !1), t && (o.onClick = () => t(s)), y(r, o);
21
- }) }), c = ({
22
- as: i,
23
- isActive: e,
24
- shouldShowText: a = !0,
8
+ }, b = ({ size: a, value: r, isCollapsed: p = !1, onChange: d, className: u, children: t, ...n }) => /* @__PURE__ */ l.createElement("span", { className: f("ui-button-group", "inline-flex whitespace-nowrap", u), ...n }, y.map(t, (i, s) => {
9
+ const o = { size: a };
10
+ if (!i.props.isHidden)
11
+ return r !== void 0 && (o.isActive = r === s), p && r >= 0 && r !== s && (o.shouldShowText = !1), d && (o.onClick = () => d(s)), h(i, o);
12
+ }));
13
+ b.propTypes = {
14
+ className: e.string,
15
+ size: e.oneOf(Object.keys(m)).isRequired,
16
+ value: e.number.isRequired,
17
+ isCollapsed: e.bool,
18
+ onChange: e.func.isRequired,
19
+ children: e.node.isRequired
20
+ };
21
+ const c = ({
22
+ as: a = "button",
23
+ isActive: r,
24
+ shouldShowText: p = !0,
25
25
  /* eslint-disable-next-line @typescript-eslint/no-unused-vars */
26
- isHidden: p = !1,
26
+ isHidden: d = !1,
27
27
  size: u = "medium",
28
28
  icon: t,
29
29
  iconPlacement: n = "left",
30
- children: r,
31
- className: s,
30
+ className: i,
31
+ children: s,
32
32
  ...o
33
33
  }) => {
34
- const f = i ?? "button", l = { ...o };
35
- delete l.isActive, delete l.shouldShowText, delete l.isHidden;
36
- const b = m(
34
+ const g = f(
37
35
  "ui-button-group-button",
38
36
  "inline-flex border-t border-l border-b last:border-r first:rounded-l-md last:rounded-r-md transition-colors focus:ring disabled:opacity-60 focus:z-10 leading-none",
39
- B[u],
40
- e ? "bg-primary border-primary text-white hover:bg-primary-dark" : "border-gray-light hover:bg-gray-lighter text-gray-darker",
41
- s
37
+ m[u],
38
+ r ? "bg-primary border-primary text-white hover:bg-primary-dark" : "border-gray-light hover:bg-gray-lighter text-gray-darker",
39
+ i
42
40
  );
43
- return /* @__PURE__ */ g(f, { className: b, ...l, children: [
44
- t && n === "left" ? /* @__PURE__ */ d("span", { className: "mr-2 flex-shrink-0", children: t }) : null,
45
- a ? r : t ? null : r,
46
- t && n === "right" ? /* @__PURE__ */ d("span", { className: "ml-2 flex-shrink-0", children: t }) : null
47
- ] });
41
+ return /* @__PURE__ */ l.createElement(a, { "aria-pressed": r, className: g, ...o }, t && n === "left" ? /* @__PURE__ */ l.createElement("span", { className: "mr-2 flex-shrink-0" }, t) : null, p ? s : t ? null : s, t && n === "right" ? /* @__PURE__ */ l.createElement("span", { className: "ml-2 flex-shrink-0" }, t) : null);
48
42
  };
49
43
  c.displayName = "ButtonGroup.Button";
50
- const j = Object.assign(k, {
51
- Button: c
52
- });
44
+ c.propTypes = {
45
+ as: e.oneOfType([e.string, e.elementType]),
46
+ isActive: e.bool,
47
+ shouldShowText: e.bool,
48
+ isHidden: e.bool,
49
+ size: e.oneOf(Object.keys(m)),
50
+ icon: e.element,
51
+ iconPlacement: e.oneOf(["left", "right"]),
52
+ className: e.string,
53
+ children: e.node.isRequired
54
+ };
55
+ b.Button = c;
53
56
  export {
54
- j as ButtonGroup
57
+ b as ButtonGroup
55
58
  };
@@ -0,0 +1,31 @@
1
+ import a from "prop-types";
2
+ import s from "react";
3
+ import i from "../../helpers/classnames.js";
4
+ import { Button as e } from "./Button.js";
5
+ const c = ({
6
+ type: t = "button",
7
+ size: r = "medium",
8
+ disabled: o = !1,
9
+ className: n,
10
+ children: p,
11
+ ...m
12
+ }) => /* @__PURE__ */ s.createElement(
13
+ e,
14
+ {
15
+ type: t,
16
+ size: r,
17
+ disabled: o,
18
+ variant: "outline",
19
+ color: "secondary",
20
+ className: i(o ? "pointer-events-none" : "pointer-events-auto", n),
21
+ ...m
22
+ },
23
+ p
24
+ );
25
+ c.propTypes = {
26
+ ...e.propTypes,
27
+ disabled: a.bool
28
+ };
29
+ export {
30
+ c as SecondaryButton
31
+ };