@arkyn/components 3.0.1-beta.155 → 3.0.1-beta.156

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 (178) hide show
  1. package/dist/components/calendar/_viewService.d.ts +1 -1
  2. package/dist/components/fullCalendar/_viewService.d.ts +2 -2
  3. package/dist/hooks/useScopedParams.d.ts +1 -1
  4. package/dist/index.js +4683 -4347
  5. package/dist/modules/components/alert/alertContainer/index.js +20 -25
  6. package/dist/modules/components/alert/alertContent/index.js +8 -11
  7. package/dist/modules/components/alert/alertDescription/index.js +8 -11
  8. package/dist/modules/components/alert/alertIcon/index.js +19 -27
  9. package/dist/modules/components/alert/alertTitle/index.js +8 -11
  10. package/dist/modules/components/audioPlayer/index.js +75 -74
  11. package/dist/modules/components/audioUpload/hasFileContent/index.js +62 -54
  12. package/dist/modules/components/audioUpload/index.js +79 -71
  13. package/dist/modules/components/audioUpload/noFileContent/index.js +45 -35
  14. package/dist/modules/components/badge/index.js +22 -26
  15. package/dist/modules/components/button/index.js +32 -39
  16. package/dist/modules/components/calendar/_calendarProvider.js +63 -38
  17. package/dist/modules/components/calendar/_viewService.js +140 -132
  18. package/dist/modules/components/calendar/calendarContainer/index.js +7 -10
  19. package/dist/modules/components/calendar/calendarHeader/index.js +72 -51
  20. package/dist/modules/components/calendar/calendarTableBody/index.js +10 -12
  21. package/dist/modules/components/calendar/calendarTableContainer/index.js +7 -10
  22. package/dist/modules/components/calendar/calendarTableHeader/index.js +10 -13
  23. package/dist/modules/components/calendar/calendarTableTd/index.js +23 -20
  24. package/dist/modules/components/calendar/index.js +49 -31
  25. package/dist/modules/components/cardTab/cardTabButton/index.js +29 -19
  26. package/dist/modules/components/cardTab/cardTabContainer/index.js +28 -22
  27. package/dist/modules/components/cardTab/cardTabContext.js +11 -13
  28. package/dist/modules/components/checkbox/index.js +64 -37
  29. package/dist/modules/components/clientOnly.js +8 -8
  30. package/dist/modules/components/currencyInput/index.js +138 -110
  31. package/dist/modules/components/divider/index.js +11 -10
  32. package/dist/modules/components/drawer/drawerContainer/index.js +43 -40
  33. package/dist/modules/components/drawer/drawerContext.js +11 -13
  34. package/dist/modules/components/drawer/drawerHeader/index.js +27 -20
  35. package/dist/modules/components/facebookPixel/facebookPixel.client.js +18 -8
  36. package/dist/modules/components/facebookPixel/index.js +8 -8
  37. package/dist/modules/components/facebookPixel/pixel.js +52 -47
  38. package/dist/modules/components/fieldError/index.js +8 -12
  39. package/dist/modules/components/fieldLabel/index.js +12 -11
  40. package/dist/modules/components/fieldWrapper/index.js +13 -12
  41. package/dist/modules/components/fileUpload/hasFileContent/index.js +67 -59
  42. package/dist/modules/components/fileUpload/index.js +72 -65
  43. package/dist/modules/components/fileUpload/noFileContent/index.js +45 -35
  44. package/dist/modules/components/fullCalendar/_fullCalendarProvider.js +46 -33
  45. package/dist/modules/components/fullCalendar/_viewService.js +105 -100
  46. package/dist/modules/components/fullCalendar/dayCalendar/dayCalendarContainer/index.js +7 -10
  47. package/dist/modules/components/fullCalendar/dayCalendar/dayCalendarEvent/index.js +78 -70
  48. package/dist/modules/components/fullCalendar/dayCalendar/dayCalendarRow/index.js +33 -28
  49. package/dist/modules/components/fullCalendar/dayCalendar/index.js +9 -12
  50. package/dist/modules/components/fullCalendar/fullCalendarContainer/index.js +7 -10
  51. package/dist/modules/components/fullCalendar/fullCalendarHeader/index.js +70 -67
  52. package/dist/modules/components/fullCalendar/index.js +30 -30
  53. package/dist/modules/components/fullCalendar/monthlyCalendar/index.js +12 -9
  54. package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarEvent/index.js +36 -28
  55. package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableBody/index.js +9 -11
  56. package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableContainer/index.js +9 -10
  57. package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableHeader/index.js +10 -13
  58. package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableTd/index.js +36 -35
  59. package/dist/modules/components/fullCalendar/weekCalendar/index.js +11 -8
  60. package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarEvent/index.js +78 -70
  61. package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableBody/index.js +20 -17
  62. package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableContainer/index.js +8 -9
  63. package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableHeader/index.js +19 -16
  64. package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableTd/index.js +39 -34
  65. package/dist/modules/components/googleAnalytics/googleAnalytics.client.js +7 -7
  66. package/dist/modules/components/googleAnalytics/googleAnalytics.js +17 -17
  67. package/dist/modules/components/googleAnalytics/index.js +9 -9
  68. package/dist/modules/components/googleAnalytics/snippets/generateGAElements.js +12 -10
  69. package/dist/modules/components/googleTagManager/googleTagManager.client.js +6 -6
  70. package/dist/modules/components/googleTagManager/googleTagManager.js +48 -44
  71. package/dist/modules/components/googleTagManager/index.js +27 -16
  72. package/dist/modules/components/googleTagManager/snippets/appendToDataLayer.js +8 -8
  73. package/dist/modules/components/googleTagManager/snippets/generateGTMElements.js +20 -19
  74. package/dist/modules/components/iconButton/index.js +29 -31
  75. package/dist/modules/components/imageUpload/hasFileContent/index.js +63 -46
  76. package/dist/modules/components/imageUpload/index.js +82 -65
  77. package/dist/modules/components/imageUpload/noFileContent/index.js +45 -35
  78. package/dist/modules/components/input/index.js +120 -92
  79. package/dist/modules/components/mapView/index.js +31 -27
  80. package/dist/modules/components/mapView/mapView.client.js +51 -49
  81. package/dist/modules/components/maskedInput/index.js +112 -101
  82. package/dist/modules/components/modal/modalContainer/index.js +42 -49
  83. package/dist/modules/components/modal/modalContext.js +11 -13
  84. package/dist/modules/components/modal/modalFooter/index.js +7 -10
  85. package/dist/modules/components/modal/modalHeader/index.js +27 -20
  86. package/dist/modules/components/multiSelect/index.js +154 -115
  87. package/dist/modules/components/multiSelect/multiSelectChevron/index.js +21 -18
  88. package/dist/modules/components/multiSelect/multiSelectContainer/index.js +29 -13
  89. package/dist/modules/components/multiSelect/multiSelectContent/index.js +8 -11
  90. package/dist/modules/components/multiSelect/multiSelectMark/index.js +22 -19
  91. package/dist/modules/components/multiSelect/multiSelectOption/index.js +13 -17
  92. package/dist/modules/components/multiSelect/multiSelectOptionsContainer/index.js +45 -35
  93. package/dist/modules/components/multiSelect/multiSelectOverlay/index.js +8 -11
  94. package/dist/modules/components/multiSelect/multiSelectSpinner/index.js +16 -13
  95. package/dist/modules/components/pagination/chevronButton/index.js +17 -17
  96. package/dist/modules/components/pagination/currentButton/index.js +7 -11
  97. package/dist/modules/components/pagination/index.js +83 -51
  98. package/dist/modules/components/pagination/pageButton/index.js +8 -12
  99. package/dist/modules/components/pagination/paginationService.js +48 -33
  100. package/dist/modules/components/pagination/spread/index.js +7 -10
  101. package/dist/modules/components/phoneInput/index.js +151 -103
  102. package/dist/modules/components/phoneInput/phoneInputContainer/index.js +19 -12
  103. package/dist/modules/components/phoneInput/phoneInputCountriesOverlay/index.js +8 -11
  104. package/dist/modules/components/phoneInput/phoneInputCountryOption/index.js +15 -23
  105. package/dist/modules/components/phoneInput/phoneInputCountryOptionsContainer/index.js +43 -33
  106. package/dist/modules/components/phoneInput/phoneInputCountrySelector/index.js +21 -25
  107. package/dist/modules/components/phoneInput/phoneInputMask/index.js +62 -46
  108. package/dist/modules/components/popover/index.js +36 -37
  109. package/dist/modules/components/radio/radioBox/index.js +42 -24
  110. package/dist/modules/components/radio/radioContext.js +18 -20
  111. package/dist/modules/components/radio/radioGroup/index.js +64 -41
  112. package/dist/modules/components/richText/blockButton/index.js +23 -20
  113. package/dist/modules/components/richText/element/index.js +58 -72
  114. package/dist/modules/components/richText/index.js +135 -143
  115. package/dist/modules/components/richText/insertImage/index.js +105 -94
  116. package/dist/modules/components/richText/insertVideo/index.js +97 -85
  117. package/dist/modules/components/richText/leaf/index.js +6 -9
  118. package/dist/modules/components/richText/markButton/index.js +22 -19
  119. package/dist/modules/components/richText/toolbar/index.js +7 -10
  120. package/dist/modules/components/searchPlaces.js +66 -57
  121. package/dist/modules/components/select/index.js +144 -112
  122. package/dist/modules/components/select/selectChevron/index.js +21 -18
  123. package/dist/modules/components/select/selectContainer/index.js +29 -13
  124. package/dist/modules/components/select/selectContent/index.js +8 -11
  125. package/dist/modules/components/select/selectOption/index.js +13 -17
  126. package/dist/modules/components/select/selectOptionsContainer/index.js +45 -35
  127. package/dist/modules/components/select/selectOverlay/index.js +8 -11
  128. package/dist/modules/components/select/selectSpinner/index.js +9 -13
  129. package/dist/modules/components/slider/index.js +41 -34
  130. package/dist/modules/components/switch/index.js +62 -35
  131. package/dist/modules/components/tab/tabButton/index.js +29 -19
  132. package/dist/modules/components/tab/tabContainer/index.js +28 -22
  133. package/dist/modules/components/tab/tabContext.js +10 -12
  134. package/dist/modules/components/table/tableBody/index.js +14 -19
  135. package/dist/modules/components/table/tableCaption/index.js +8 -15
  136. package/dist/modules/components/table/tableContainer/index.js +8 -12
  137. package/dist/modules/components/table/tableFooter/index.js +11 -18
  138. package/dist/modules/components/table/tableHeader/index.js +11 -12
  139. package/dist/modules/components/textarea/index.js +69 -51
  140. package/dist/modules/components/tooltip/index.js +45 -34
  141. package/dist/modules/hooks/useAutomation.js +27 -35
  142. package/dist/modules/hooks/useDrawer.js +19 -17
  143. package/dist/modules/hooks/useForm.js +6 -6
  144. package/dist/modules/hooks/useHydrated.js +12 -7
  145. package/dist/modules/hooks/useModal.js +19 -17
  146. package/dist/modules/hooks/useScopedParams.js +17 -17
  147. package/dist/modules/hooks/useScrollLock.js +19 -19
  148. package/dist/modules/hooks/useSearchAutomation.js +14 -31
  149. package/dist/modules/hooks/useSlider.js +13 -13
  150. package/dist/modules/hooks/useToast.js +9 -8
  151. package/dist/modules/index.js +144 -72
  152. package/dist/modules/providers/drawerProvider.js +30 -35
  153. package/dist/modules/providers/formProvider.js +16 -11
  154. package/dist/modules/providers/modalProvider.js +33 -39
  155. package/dist/modules/providers/placesProvider.js +16 -16
  156. package/dist/modules/providers/toastProvider.js +51 -45
  157. package/dist/modules/services/extractTextFromNode.js +6 -6
  158. package/dist/modules/services/fieldTemplate.js +23 -22
  159. package/dist/modules/services/iconRenderer.js +7 -14
  160. package/dist/modules/services/isBlockActive.js +14 -12
  161. package/dist/modules/services/isMarkActive.js +6 -6
  162. package/dist/modules/services/maskCurrencyValues.js +12 -11
  163. package/dist/modules/services/toHtml.js +6 -6
  164. package/dist/modules/services/toRichTextValue.js +7 -7
  165. package/dist/modules/services/toggleBlock.js +19 -20
  166. package/dist/modules/services/toggleMark.js +7 -7
  167. package/dist/modules/style.css +1 -0
  168. package/dist/modules/templates/badResponses.js +13 -13
  169. package/dist/modules/templates/richTextTemplates.js +14 -17
  170. package/dist/modules/templates/successResponses.js +4 -9
  171. package/dist/modules/utils/phoneInputUtilities.js +28 -18
  172. package/dist/modules/utils/richTextUtilities.js +75 -88
  173. package/dist/services/fieldTemplate.d.ts +1 -1
  174. package/dist/services/fieldTemplate.d.ts.map +1 -1
  175. package/dist/style.css +1 -0
  176. package/package.json +65 -65
  177. package/dist/components.css +0 -2
  178. package/dist/modules/components.css +0 -2
@@ -1,36 +1,46 @@
1
- import { Button as e } from "../../button/index.js";
2
- /* empty css */
3
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
4
- //#region src/components/audioUpload/noFileContent/index.tsx
5
- function r(r) {
6
- let { dropAudioText: i, isLoading: a, acceptAudio: o, handleSelectFile: s, selectAudioButtonText: c, disabled: l } = r;
7
- function u(e) {
8
- if (l) return;
9
- e.preventDefault();
10
- let t = e.dataTransfer.files[0];
11
- t && s(t);
12
- }
13
- function d() {
14
- if (l) return;
15
- let e = document.createElement("input");
16
- e.type = "file", e.accept = o, e.onchange = (e) => {
17
- let t = e.target.files?.[0];
18
- t && s(t);
19
- }, e.click();
20
- }
21
- return /* @__PURE__ */ n("div", {
22
- onDrop: u,
23
- className: "arkynAudioUploadNoFileContent",
24
- children: [/* @__PURE__ */ t(e, {
25
- isLoading: a,
26
- onClick: d,
27
- variant: "ghost",
28
- size: "sm",
29
- type: "button",
30
- disabled: l,
31
- children: c
32
- }), /* @__PURE__ */ t("p", { children: i })]
33
- });
1
+ import { jsxs as m, jsx as r } from "react/jsx-runtime";
2
+ import { Button as h } from "../../button/index.js";
3
+ /* empty css */
4
+ function k(c) {
5
+ const {
6
+ dropAudioText: a,
7
+ isLoading: s,
8
+ acceptAudio: d,
9
+ handleSelectFile: i,
10
+ selectAudioButtonText: u,
11
+ disabled: n
12
+ } = c;
13
+ function f(t) {
14
+ if (n) return;
15
+ t.preventDefault();
16
+ const e = t.dataTransfer.files[0];
17
+ e && i(e);
18
+ }
19
+ function p() {
20
+ if (n) return;
21
+ const t = document.createElement("input");
22
+ t.type = "file", t.accept = d, t.onchange = (e) => {
23
+ var l;
24
+ const o = (l = e.target.files) == null ? void 0 : l[0];
25
+ o && i(o);
26
+ }, t.click();
27
+ }
28
+ return /* @__PURE__ */ m("div", { onDrop: f, className: "arkynAudioUploadNoFileContent", children: [
29
+ /* @__PURE__ */ r(
30
+ h,
31
+ {
32
+ isLoading: s,
33
+ onClick: p,
34
+ variant: "ghost",
35
+ size: "sm",
36
+ type: "button",
37
+ disabled: n,
38
+ children: u
39
+ }
40
+ ),
41
+ /* @__PURE__ */ r("p", { children: a })
42
+ ] });
34
43
  }
35
- //#endregion
36
- export { r as NoFileContent };
44
+ export {
45
+ k as NoFileContent
46
+ };
@@ -1,27 +1,23 @@
1
- import { IconRenderer as e } from "../../services/iconRenderer.js";
2
- /* empty css */
3
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
4
- //#region src/components/badge/index.tsx
5
- function r(r) {
6
- let { variant: i = "ghost", scheme: a = "primary", size: o = "lg", leftIcon: s, rightIcon: c, className: l = "", children: u, ...d } = r, f = {
7
- md: 12,
8
- lg: 14
9
- }[o];
10
- return /* @__PURE__ */ n("div", {
11
- className: `arkynBadge ${i} ${a} ${o} ${l}`.trim(),
12
- ...d,
13
- children: [
14
- /* @__PURE__ */ t(e, {
15
- iconSize: f,
16
- icon: s
17
- }),
18
- /* @__PURE__ */ t("p", { children: u }),
19
- /* @__PURE__ */ t(e, {
20
- iconSize: f,
21
- icon: c
22
- })
23
- ]
24
- });
1
+ import { jsxs as p, jsx as e } from "react/jsx-runtime";
2
+ import { IconRenderer as n } from "../../services/iconRenderer.js";
3
+ /* empty css */
4
+ function $(o) {
5
+ const {
6
+ variant: c = "ghost",
7
+ scheme: r = "primary",
8
+ size: s = "lg",
9
+ leftIcon: t,
10
+ rightIcon: a,
11
+ className: m = "",
12
+ children: l,
13
+ ...d
14
+ } = o, i = { md: 12, lg: 14 }[s], g = `arkynBadge ${c} ${r} ${s} ${m}`;
15
+ return /* @__PURE__ */ p("div", { className: g.trim(), ...d, children: [
16
+ /* @__PURE__ */ e(n, { iconSize: i, icon: t }),
17
+ /* @__PURE__ */ e("p", { children: l }),
18
+ /* @__PURE__ */ e(n, { iconSize: i, icon: a })
19
+ ] });
25
20
  }
26
- //#endregion
27
- export { r as Badge };
21
+ export {
22
+ $ as Badge
23
+ };
@@ -1,40 +1,33 @@
1
- import { IconRenderer as e } from "../../services/iconRenderer.js";
2
- /* empty css */
3
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
4
- import { Loader2 as r } from "lucide-react";
5
- //#region src/components/button/index.tsx
6
- function i(i) {
7
- let { isLoading: a = !1, scheme: o = "primary", variant: s = "solid", loadingText: c, size: l = "md", leftIcon: u, rightIcon: d, disabled: f, className: p = "", children: m, ...h } = i, g = {
8
- xs: 12,
9
- sm: 16,
10
- md: 20,
11
- lg: 24
12
- }[l];
13
- return /* @__PURE__ */ n("button", {
14
- className: `arkynButton ${a ? "loadingTrue" : "loadingFalse"} ${s} ${o} ${l} ${c ? "loadingTextTrue" : "loadingTextFalse"} ${p}`,
15
- disabled: f || a,
16
- ...h,
17
- children: [/* @__PURE__ */ n("div", {
18
- className: "arkynButtonSpinner",
19
- children: [/* @__PURE__ */ t(r, {
20
- size: g,
21
- strokeWidth: 2.5
22
- }), c && c]
23
- }), /* @__PURE__ */ n("div", {
24
- className: "arkynButtonContent",
25
- children: [
26
- /* @__PURE__ */ t(e, {
27
- iconSize: g,
28
- icon: u
29
- }),
30
- m,
31
- /* @__PURE__ */ t(e, {
32
- iconSize: g,
33
- icon: d
34
- })
35
- ]
36
- })]
37
- });
1
+ import { jsxs as o, jsx as e } from "react/jsx-runtime";
2
+ import { Loader2 as T } from "lucide-react";
3
+ import { IconRenderer as t } from "../../services/iconRenderer.js";
4
+ /* empty css */
5
+ function y(l) {
6
+ const {
7
+ isLoading: i = !1,
8
+ scheme: r = "primary",
9
+ variant: d = "solid",
10
+ loadingText: n,
11
+ size: a = "md",
12
+ leftIcon: c,
13
+ rightIcon: m,
14
+ disabled: g,
15
+ className: u = "",
16
+ children: x,
17
+ ...h
18
+ } = l, s = { xs: 12, sm: 16, md: 20, lg: 24 }[a], p = `arkynButton ${i ? "loadingTrue" : "loadingFalse"} ${d} ${r} ${a} ${n ? "loadingTextTrue" : "loadingTextFalse"} ${u}`;
19
+ return /* @__PURE__ */ o("button", { className: p, disabled: g || i, ...h, children: [
20
+ /* @__PURE__ */ o("div", { className: "arkynButtonSpinner", children: [
21
+ /* @__PURE__ */ e(T, { size: s, strokeWidth: 2.5 }),
22
+ n && n
23
+ ] }),
24
+ /* @__PURE__ */ o("div", { className: "arkynButtonContent", children: [
25
+ /* @__PURE__ */ e(t, { iconSize: s, icon: c }),
26
+ x,
27
+ /* @__PURE__ */ e(t, { iconSize: s, icon: m })
28
+ ] })
29
+ ] });
38
30
  }
39
- //#endregion
40
- export { i as Button };
31
+ export {
32
+ y as Button
33
+ };
@@ -1,40 +1,65 @@
1
- import { ViewService as e } from "./_viewService.js";
2
- import { createContext as t, useContext as n, useState as r } from "react";
3
- import { jsx as i } from "react/jsx-runtime";
4
- //#region src/components/calendar/_calendarProvider.tsx
5
- var a = t({});
6
- function o() {
7
- return n(a);
1
+ import { jsx as Y } from "react/jsx-runtime";
2
+ import { useState as D, createContext as y, useContext as k } from "react";
3
+ import { ViewService as P } from "./_viewService.js";
4
+ const h = y({});
5
+ function B() {
6
+ return k(h);
8
7
  }
9
- function s(t) {
10
- let { calendarType: n, children: o, defaultValue: s, defaultViewValue: c = /* @__PURE__ */ new Date(), language: l = "pt-BR", onChange: u, onChangeView: d, value: f, viewValue: p } = t, m = n === "single" ? [s || /* @__PURE__ */ new Date(), s || /* @__PURE__ */ new Date()] : s || [/* @__PURE__ */ new Date(), /* @__PURE__ */ new Date()], [h, g] = r(c), [_, v] = r(m), y = p || h, b = f ? n === "single" ? [f, f] : f : _, x = new e();
11
- function S(e) {
12
- let t = [new Date(e[0]), new Date(e[1])];
13
- u && n === "range" && u(t), u && n === "single" && u(t[0]), v(t);
14
- }
15
- function C(e) {
16
- d && d(e), g(e);
17
- }
18
- return /* @__PURE__ */ i(a.Provider, {
19
- value: {
20
- valueDate: b,
21
- viewDate: y,
22
- currentDate: y.toLocaleDateString(l).slice(3),
23
- currentDay: x.currentDay(y),
24
- currentMonth: x.currentMonth(y),
25
- currentYear: x.currentYear(y),
26
- listWeek: x.listWeek(l),
27
- listMonths: x.listMonths(y, l),
28
- listYears: x.listYears(100),
29
- listMatrix: x.listMatrix(y, b),
30
- changeDay: (e, t, r) => x.changeDay(e, t, r, n, b, S, C),
31
- changeMonth: (e) => x.changeMonth(e, y, C),
32
- changeYear: (e) => x.changeYear(e, y, C),
33
- nextMonth: () => x.nextMonth(y, C),
34
- previousMonth: () => x.previousMonth(y, C)
35
- },
36
- children: o
37
- });
8
+ function L(g) {
9
+ const {
10
+ calendarType: n,
11
+ children: V,
12
+ defaultValue: u,
13
+ defaultViewValue: f = /* @__PURE__ */ new Date(),
14
+ language: c = "pt-BR",
15
+ onChange: o,
16
+ onChangeView: w,
17
+ value: l,
18
+ viewValue: M
19
+ } = g, v = n === "single" ? [u || /* @__PURE__ */ new Date(), u || /* @__PURE__ */ new Date()] : u || [/* @__PURE__ */ new Date(), /* @__PURE__ */ new Date()], [d, x] = D(f), [p, C] = D(v), t = M || d, s = l ? n === "single" ? [l, l] : l : p, e = new P();
20
+ function m(a) {
21
+ const i = [
22
+ new Date(a[0]),
23
+ new Date(a[1])
24
+ ];
25
+ o && n === "range" && o(i), o && n === "single" && o(i[0]), C(i);
26
+ }
27
+ function r(a) {
28
+ w && w(a), x(a);
29
+ }
30
+ return /* @__PURE__ */ Y(
31
+ h.Provider,
32
+ {
33
+ value: {
34
+ valueDate: s,
35
+ viewDate: t,
36
+ currentDate: t.toLocaleDateString(c).slice(3),
37
+ currentDay: e.currentDay(t),
38
+ currentMonth: e.currentMonth(t),
39
+ currentYear: e.currentYear(t),
40
+ listWeek: e.listWeek(c),
41
+ listMonths: e.listMonths(t, c),
42
+ listYears: e.listYears(100),
43
+ listMatrix: e.listMatrix(t, s),
44
+ changeDay: (a, i, S) => e.changeDay(
45
+ a,
46
+ i,
47
+ S,
48
+ n,
49
+ s,
50
+ m,
51
+ r
52
+ ),
53
+ changeMonth: (a) => e.changeMonth(a, t, r),
54
+ changeYear: (a) => e.changeYear(a, t, r),
55
+ nextMonth: () => e.nextMonth(t, r),
56
+ previousMonth: () => e.previousMonth(t, r)
57
+ },
58
+ children: V
59
+ }
60
+ );
38
61
  }
39
- //#endregion
40
- export { s as CalendarProvider, o as useCalendar };
62
+ export {
63
+ L as CalendarProvider,
64
+ B as useCalendar
65
+ };
@@ -1,133 +1,141 @@
1
- import { formatToCapitalizeFirstWordLetter as e } from "@arkyn/shared";
2
- //#region src/components/calendar/_viewService.ts
3
- var t = class {
4
- currentDay(e) {
5
- return String(e.getDate()).padStart(2, "0");
6
- }
7
- currentMonth(e) {
8
- return String(e.getMonth() + 1).padStart(2, "0");
9
- }
10
- currentYear(e) {
11
- return String(e.getFullYear());
12
- }
13
- capitalize(t) {
14
- return e(t);
15
- }
16
- parseDayType(e, t, n, r) {
17
- let i = r[0].getDate(), a = r[0].getMonth(), o = r[0].getFullYear(), s = r[1].getDate(), c = r[1].getMonth(), l = r[1].getFullYear(), u = new Date(o, a, i), d = new Date(l, c, s), f = new Date(n, t, e);
18
- return u.getTime() === f.getTime() || d.getTime() === f.getTime() ? "checkedDay" : f > u && f < d ? "middleDay" : "uncheckedDay";
19
- }
20
- listWeek(e) {
21
- let t = [], n = new Date(Date.UTC(2023, 0, 1));
22
- for (let r = 0; r < 7; r++) {
23
- let i = new Date(n);
24
- i.setUTCDate(n.getUTCDate() + r);
25
- let a = i.toLocaleDateString(e, {
26
- weekday: "short",
27
- timeZone: "UTC"
28
- });
29
- t.push(a);
30
- }
31
- return t;
32
- }
33
- listMonths(e, t) {
34
- let n = new Intl.DateTimeFormat(t, { month: "long" });
35
- return Array.from({ length: 12 }, (t, r) => {
36
- let i = new Date(e.getFullYear(), r, 1), a = n.format(i);
37
- return {
38
- label: this.capitalize(a),
39
- value: String(r).padStart(2, "0")
40
- };
41
- });
42
- }
43
- listYears(e) {
44
- let t = (/* @__PURE__ */ new Date()).getFullYear();
45
- return Array.from({ length: e + 1 }, (n, r) => {
46
- let i = t - e + r;
47
- return {
48
- label: String(i),
49
- value: String(i)
50
- };
51
- }).reverse();
52
- }
53
- listMatrix(e, t) {
54
- let n = e.getFullYear(), r = e.getMonth(), i = new Date(n, r, 1).getDay(), a = new Date(n, r + 1, 0).getDate(), o = new Date(n, r, 0).getDate(), s = Math.ceil((i + a) / 7) * 7, c = [], l = 1, u = 1;
55
- for (let e = 0; e < s; e++) {
56
- let s = Math.floor(e / 7);
57
- if (c[s] || (c[s] = []), e < i) {
58
- let a = o - (i - e - 1), l = r === 0 ? 11 : r - 1, u = r === 0 ? n - 1 : n;
59
- c[s].push({
60
- day: a,
61
- month: l,
62
- year: u,
63
- dayOwner: "previous",
64
- dayType: this.parseDayType(a, l, u, t)
65
- });
66
- } else if (l <= a) c[s].push({
67
- day: l,
68
- month: r,
69
- year: n,
70
- dayOwner: "current",
71
- dayType: this.parseDayType(l, r, n, t)
72
- }), l++;
73
- else {
74
- let e = r === 11 ? 0 : r + 1, i = r === 11 ? n + 1 : n;
75
- c[s].push({
76
- day: u,
77
- month: e,
78
- year: i,
79
- dayOwner: "next",
80
- dayType: this.parseDayType(u, e, i, t)
81
- }), u++;
82
- }
83
- }
84
- return c;
85
- }
86
- changeDay(e, t, n, r, i, a, o) {
87
- let s = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate()), c = s(new Date(n, t, e));
88
- if (o(c), r === "single") {
89
- a([c, c]);
90
- return;
91
- }
92
- let l = s(i[0]), u = s(i[1]), d = c.getTime(), f = l.getTime(), p = u.getTime();
93
- if (d === f) {
94
- a([c, c]);
95
- return;
96
- }
97
- if (d === p) {
98
- a([c, c]);
99
- return;
100
- }
101
- if (c < l) {
102
- a([c, u]);
103
- return;
104
- }
105
- if (c > u) {
106
- a([l, c]);
107
- return;
108
- }
109
- if (Math.abs(d - f) <= Math.abs(p - d)) {
110
- a([c, u]);
111
- return;
112
- }
113
- a([l, c]);
114
- }
115
- changeMonth(e, t, n) {
116
- let r = new Date(t);
117
- r.setMonth(e), n(r);
118
- }
119
- changeYear(e, t, n) {
120
- let r = new Date(t);
121
- r.setFullYear(e), n(r);
122
- }
123
- nextMonth(e, t) {
124
- let n = new Date(e);
125
- n.setDate(1), n.setMonth(n.getMonth() + 1), t(n);
126
- }
127
- previousMonth(e, t) {
128
- let n = new Date(e);
129
- n.setDate(1), n.setMonth(n.getMonth() - 1), t(n);
130
- }
1
+ import { formatToCapitalizeFirstWordLetter as f } from "@arkyn/shared";
2
+ let p = class {
3
+ currentDay(n) {
4
+ return String(n.getDate()).padStart(2, "0");
5
+ }
6
+ currentMonth(n) {
7
+ return String(n.getMonth() + 1).padStart(2, "0");
8
+ }
9
+ currentYear(n) {
10
+ return String(n.getFullYear());
11
+ }
12
+ capitalize(n) {
13
+ return f(n);
14
+ }
15
+ parseDayType(n, r, t, e) {
16
+ const s = e[0].getDate(), o = e[0].getMonth(), y = e[0].getFullYear(), l = e[1].getDate(), a = e[1].getMonth(), c = e[1].getFullYear(), D = new Date(y, o, s), h = new Date(c, a, l), i = new Date(t, r, n);
17
+ return D.getTime() === i.getTime() || h.getTime() === i.getTime() ? "checkedDay" : i > D && i < h ? "middleDay" : "uncheckedDay";
18
+ }
19
+ listWeek(n) {
20
+ const r = [], t = new Date(Date.UTC(2023, 0, 1));
21
+ for (let e = 0; e < 7; e++) {
22
+ const s = new Date(t);
23
+ s.setUTCDate(t.getUTCDate() + e);
24
+ const o = s.toLocaleDateString(n, {
25
+ weekday: "short",
26
+ timeZone: "UTC"
27
+ });
28
+ r.push(o);
29
+ }
30
+ return r;
31
+ }
32
+ listMonths(n, r) {
33
+ const t = new Intl.DateTimeFormat(r, {
34
+ month: "long"
35
+ });
36
+ return Array.from({ length: 12 }, (e, s) => {
37
+ const o = new Date(n.getFullYear(), s, 1), y = t.format(o);
38
+ return {
39
+ label: this.capitalize(y),
40
+ value: String(s).padStart(2, "0")
41
+ };
42
+ });
43
+ }
44
+ listYears(n) {
45
+ const r = (/* @__PURE__ */ new Date()).getFullYear();
46
+ return Array.from({ length: n + 1 }, (t, e) => {
47
+ const s = r - n + e;
48
+ return { label: String(s), value: String(s) };
49
+ }).reverse();
50
+ }
51
+ listMatrix(n, r) {
52
+ const t = n.getFullYear(), e = n.getMonth(), o = new Date(t, e, 1).getDay(), y = new Date(t, e + 1, 0).getDate(), l = new Date(t, e, 0).getDate(), a = Math.ceil((o + y) / 7) * 7, c = [];
53
+ let D = 1, h = 1;
54
+ for (let i = 0; i < a; i++) {
55
+ const g = Math.floor(i / 7);
56
+ if (c[g] || (c[g] = []), i < o) {
57
+ const d = l - (o - i - 1), u = e === 0 ? 11 : e - 1, w = e === 0 ? t - 1 : t;
58
+ c[g].push({
59
+ day: d,
60
+ month: u,
61
+ year: w,
62
+ dayOwner: "previous",
63
+ dayType: this.parseDayType(d, u, w, r)
64
+ });
65
+ } else if (D <= y)
66
+ c[g].push({
67
+ day: D,
68
+ month: e,
69
+ year: t,
70
+ dayOwner: "current",
71
+ dayType: this.parseDayType(
72
+ D,
73
+ e,
74
+ t,
75
+ r
76
+ )
77
+ }), D++;
78
+ else {
79
+ const d = e === 11 ? 0 : e + 1, u = e === 11 ? t + 1 : t;
80
+ c[g].push({
81
+ day: h,
82
+ month: d,
83
+ year: u,
84
+ dayOwner: "next",
85
+ dayType: this.parseDayType(h, d, u, r)
86
+ }), h++;
87
+ }
88
+ }
89
+ return c;
90
+ }
91
+ changeDay(n, r, t, e, s, o, y) {
92
+ const l = (w) => new Date(w.getFullYear(), w.getMonth(), w.getDate()), a = l(new Date(t, r, n));
93
+ if (y(a), e === "single") {
94
+ o([a, a]);
95
+ return;
96
+ }
97
+ let c = l(s[0]), D = l(s[1]);
98
+ const h = a.getTime(), i = c.getTime(), g = D.getTime();
99
+ if (h === i) {
100
+ o([a, a]);
101
+ return;
102
+ }
103
+ if (h === g) {
104
+ o([a, a]);
105
+ return;
106
+ }
107
+ if (a < c) {
108
+ o([a, D]);
109
+ return;
110
+ }
111
+ if (a > D) {
112
+ o([c, a]);
113
+ return;
114
+ }
115
+ const d = Math.abs(h - i), u = Math.abs(g - h);
116
+ if (d <= u) {
117
+ o([a, D]);
118
+ return;
119
+ }
120
+ o([c, a]);
121
+ }
122
+ changeMonth(n, r, t) {
123
+ const e = new Date(r);
124
+ e.setMonth(n), t(e);
125
+ }
126
+ changeYear(n, r, t) {
127
+ const e = new Date(r);
128
+ e.setFullYear(n), t(e);
129
+ }
130
+ nextMonth(n, r) {
131
+ const t = new Date(n);
132
+ t.setDate(1), t.setMonth(t.getMonth() + 1), r(t);
133
+ }
134
+ previousMonth(n, r) {
135
+ const t = new Date(n);
136
+ t.setDate(1), t.setMonth(t.getMonth() - 1), r(t);
137
+ }
138
+ };
139
+ export {
140
+ p as ViewService
131
141
  };
132
- //#endregion
133
- export { t as ViewService };
@@ -1,11 +1,8 @@
1
- /* empty css */
2
- import { jsx as e } from "react/jsx-runtime";
3
- //#region src/components/calendar/calendarContainer/index.tsx
4
- function t({ children: t }) {
5
- return /* @__PURE__ */ e("div", {
6
- className: "arkynCalendarContainer",
7
- children: t
8
- });
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ /* empty css */
3
+ function o({ children: r }) {
4
+ return /* @__PURE__ */ n("div", { className: "arkynCalendarContainer", children: r });
9
5
  }
10
- //#endregion
11
- export { t as CalendarContainer };
6
+ export {
7
+ o as CalendarContainer
8
+ };