@arkyn/components 3.0.8 → 3.0.10

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 (108) hide show
  1. package/dist/components/calendar/_calendarProvider.d.ts.map +1 -1
  2. package/dist/components/calendar/calendarTableTd/index.d.ts.map +1 -1
  3. package/dist/components/currencyInput/index.d.ts +1 -1
  4. package/dist/components/datePicker/datePickerCalendarContainer/index.d.ts +1 -0
  5. package/dist/components/datePicker/datePickerCalendarContainer/index.d.ts.map +1 -1
  6. package/dist/components/datePicker/datePickerContainer/index.d.ts +5 -1
  7. package/dist/components/datePicker/datePickerContainer/index.d.ts.map +1 -1
  8. package/dist/components/datePicker/index.d.ts.map +1 -1
  9. package/dist/components/drawer/drawerContainer/index.d.ts.map +1 -1
  10. package/dist/components/googleAnalytics/snippets/generateGAElements.d.ts.map +1 -1
  11. package/dist/components/googleTagManager/snippets/appendToDataLayer.d.ts.map +1 -1
  12. package/dist/components/googleTagManager/snippets/generateGTMElements.d.ts.map +1 -1
  13. package/dist/components/imageUpload/index.d.ts +1 -1
  14. package/dist/components/input/index.d.ts +1 -1
  15. package/dist/components/modal/modalContainer/index.d.ts.map +1 -1
  16. package/dist/components/multiSelect/index.d.ts +1 -1
  17. package/dist/components/multiSelect/index.d.ts.map +1 -1
  18. package/dist/components/multiSelect/multiSelectContainer/index.d.ts +6 -1
  19. package/dist/components/multiSelect/multiSelectContainer/index.d.ts.map +1 -1
  20. package/dist/components/multiSelect/multiSelectOption/index.d.ts +2 -0
  21. package/dist/components/multiSelect/multiSelectOption/index.d.ts.map +1 -1
  22. package/dist/components/multiSelect/multiSelectOptionsContainer/index.d.ts +1 -0
  23. package/dist/components/multiSelect/multiSelectOptionsContainer/index.d.ts.map +1 -1
  24. package/dist/components/popover/index.d.ts.map +1 -1
  25. package/dist/components/richText/index.d.ts +1 -1
  26. package/dist/components/richText/index.d.ts.map +1 -1
  27. package/dist/components/select/index.d.ts +1 -1
  28. package/dist/components/select/index.d.ts.map +1 -1
  29. package/dist/components/select/selectContainer/index.d.ts +6 -1
  30. package/dist/components/select/selectContainer/index.d.ts.map +1 -1
  31. package/dist/components/select/selectOption/index.d.ts +2 -0
  32. package/dist/components/select/selectOption/index.d.ts.map +1 -1
  33. package/dist/components/select/selectOptionsContainer/index.d.ts +1 -0
  34. package/dist/components/select/selectOptionsContainer/index.d.ts.map +1 -1
  35. package/dist/hooks/useEscapeKey.d.ts +24 -0
  36. package/dist/hooks/useEscapeKey.d.ts.map +1 -0
  37. package/dist/hooks/useFlipPosition.d.ts +38 -0
  38. package/dist/hooks/useFlipPosition.d.ts.map +1 -0
  39. package/dist/hooks/useFocusTrap.d.ts +28 -0
  40. package/dist/hooks/useFocusTrap.d.ts.map +1 -0
  41. package/dist/index.js +1120 -881
  42. package/dist/index.js.map +1 -1
  43. package/dist/modules/components/calendar/_calendarProvider.js +47 -34
  44. package/dist/modules/components/calendar/_calendarProvider.js.map +1 -1
  45. package/dist/modules/components/calendar/calendarTableTd/index.js +7 -2
  46. package/dist/modules/components/calendar/calendarTableTd/index.js.map +1 -1
  47. package/dist/modules/components/calendar/calendarTableTd/styles.css +1 -1
  48. package/dist/modules/components/calendar/styles.css +2 -2
  49. package/dist/modules/components/currencyInput/index.js.map +1 -1
  50. package/dist/modules/components/datePicker/datePickerCalendarContainer/index.js +12 -16
  51. package/dist/modules/components/datePicker/datePickerCalendarContainer/index.js.map +1 -1
  52. package/dist/modules/components/datePicker/datePickerContainer/index.js +9 -2
  53. package/dist/modules/components/datePicker/datePickerContainer/index.js.map +1 -1
  54. package/dist/modules/components/datePicker/index.js +63 -44
  55. package/dist/modules/components/datePicker/index.js.map +1 -1
  56. package/dist/modules/components/datePicker/styles.css +4 -4
  57. package/dist/modules/components/drawer/drawerContainer/index.js +31 -23
  58. package/dist/modules/components/drawer/drawerContainer/index.js.map +1 -1
  59. package/dist/modules/components/facebookPixel/pixel.js +1 -1
  60. package/dist/modules/components/facebookPixel/pixel.js.map +1 -1
  61. package/dist/modules/components/googleAnalytics/snippets/generateGAElements.js +7 -6
  62. package/dist/modules/components/googleAnalytics/snippets/generateGAElements.js.map +1 -1
  63. package/dist/modules/components/googleTagManager/snippets/appendToDataLayer.js +7 -6
  64. package/dist/modules/components/googleTagManager/snippets/appendToDataLayer.js.map +1 -1
  65. package/dist/modules/components/googleTagManager/snippets/generateGTMElements.js +20 -14
  66. package/dist/modules/components/googleTagManager/snippets/generateGTMElements.js.map +1 -1
  67. package/dist/modules/components/imageUpload/index.js.map +1 -1
  68. package/dist/modules/components/input/index.js.map +1 -1
  69. package/dist/modules/components/modal/modalContainer/index.js +30 -22
  70. package/dist/modules/components/modal/modalContainer/index.js.map +1 -1
  71. package/dist/modules/components/multiSelect/index.js +119 -79
  72. package/dist/modules/components/multiSelect/index.js.map +1 -1
  73. package/dist/modules/components/multiSelect/multiSelectContainer/index.js +10 -2
  74. package/dist/modules/components/multiSelect/multiSelectContainer/index.js.map +1 -1
  75. package/dist/modules/components/multiSelect/multiSelectOption/index.js +7 -3
  76. package/dist/modules/components/multiSelect/multiSelectOption/index.js.map +1 -1
  77. package/dist/modules/components/multiSelect/multiSelectOption/styles.css +1 -1
  78. package/dist/modules/components/multiSelect/multiSelectOptionsContainer/index.js +19 -23
  79. package/dist/modules/components/multiSelect/multiSelectOptionsContainer/index.js.map +1 -1
  80. package/dist/modules/components/multiSelect/styles.css +1 -1
  81. package/dist/modules/components/popover/index.js +23 -17
  82. package/dist/modules/components/popover/index.js.map +1 -1
  83. package/dist/modules/components/richText/index.js +1 -1
  84. package/dist/modules/components/richText/index.js.map +1 -1
  85. package/dist/modules/components/searchPlaces.js +1 -1
  86. package/dist/modules/components/searchPlaces.js.map +1 -1
  87. package/dist/modules/components/select/index.js +120 -80
  88. package/dist/modules/components/select/index.js.map +1 -1
  89. package/dist/modules/components/select/selectContainer/index.js +10 -2
  90. package/dist/modules/components/select/selectContainer/index.js.map +1 -1
  91. package/dist/modules/components/select/selectOption/index.js +5 -2
  92. package/dist/modules/components/select/selectOption/index.js.map +1 -1
  93. package/dist/modules/components/select/selectOption/styles.css +1 -1
  94. package/dist/modules/components/select/selectOptionsContainer/index.js +18 -23
  95. package/dist/modules/components/select/selectOptionsContainer/index.js.map +1 -1
  96. package/dist/modules/components/select/styles.css +1 -1
  97. package/dist/modules/hooks/useEscapeKey.js +18 -0
  98. package/dist/modules/hooks/useEscapeKey.js.map +1 -0
  99. package/dist/modules/hooks/useFlipPosition.js +26 -0
  100. package/dist/modules/hooks/useFlipPosition.js.map +1 -0
  101. package/dist/modules/hooks/useFocusTrap.js +44 -0
  102. package/dist/modules/hooks/useFocusTrap.js.map +1 -0
  103. package/dist/modules/utils/escapeForInlineScript.js +14 -0
  104. package/dist/modules/utils/escapeForInlineScript.js.map +1 -0
  105. package/dist/style.css +1 -1
  106. package/dist/utils/escapeForInlineScript.d.ts +23 -0
  107. package/dist/utils/escapeForInlineScript.d.ts.map +1 -0
  108. package/package.json +16 -13
@@ -1,42 +1,55 @@
1
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";
2
+ import { createContext as t, useCallback as n, useContext as r, useMemo as i, useState as a } from "react";
3
+ import { jsx as o } from "react/jsx-runtime";
4
4
  //#region src/components/calendar/_calendarProvider.tsx
5
- var a = t({});
6
- function o() {
7
- return n(a);
5
+ var s = t({});
6
+ function c() {
7
+ return r(s);
8
8
  }
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
9
+ var l = new e();
10
+ function u(e) {
11
+ let { calendarType: t, children: r, defaultValue: c, defaultViewValue: u = /* @__PURE__ */ new Date(), language: d = "pt-BR", onChange: f, onChangeView: p, value: m, viewValue: h } = e, g = t === "single" ? [c || /* @__PURE__ */ new Date(), c || /* @__PURE__ */ new Date()] : c || [/* @__PURE__ */ new Date(), /* @__PURE__ */ new Date()], [_, v] = a(u), [y, b] = a(g), x = h || _, S = m ? t === "single" ? [m, m] : m : y, C = n((e) => {
12
+ let n = [new Date(e[0]), new Date(e[1])];
13
+ f && t === "range" && f(n), f && t === "single" && f(n[0]), b(n);
14
+ }, [t, f]), w = n((e) => {
15
+ p && p(e), v(e);
16
+ }, [p]), T = n((e, n, r) => l.changeDay(e, n, r, t, S, C, w), [
17
+ t,
18
+ S,
19
+ C,
20
+ w
21
+ ]), E = n((e) => l.changeMonth(e, x, w), [x, w]), D = n((e) => l.changeYear(e, x, w), [x, w]), O = n(() => l.nextMonth(x, w), [x, w]), k = n(() => l.previousMonth(x, w), [x, w]), A = i(() => ({
22
+ valueDate: S,
23
+ viewDate: x,
24
+ currentDate: x.toLocaleDateString(d).slice(3),
25
+ currentDay: l.currentDay(x),
26
+ currentMonth: l.currentMonth(x),
27
+ currentYear: l.currentYear(x),
28
+ listWeek: l.listWeek(d),
29
+ listMonths: l.listMonths(x, d),
30
+ listYears: l.listYears(100),
31
+ listMatrix: l.listMatrix(x, S),
32
+ changeDay: T,
33
+ changeMonth: E,
34
+ changeYear: D,
35
+ nextMonth: O,
36
+ previousMonth: k
37
+ }), [
38
+ S,
39
+ x,
40
+ d,
41
+ T,
42
+ E,
43
+ D,
44
+ O,
45
+ k
46
+ ]);
47
+ return /* @__PURE__ */ o(s.Provider, {
48
+ value: A,
49
+ children: r
37
50
  });
38
51
  }
39
52
  //#endregion
40
- export { s as CalendarProvider, o as useCalendar };
53
+ export { u as CalendarProvider, c as useCalendar };
41
54
 
42
55
  //# sourceMappingURL=_calendarProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_calendarProvider.js","names":[],"sources":["../../../../src/components/calendar/_calendarProvider.tsx"],"sourcesContent":["import { createContext, type ReactNode, useContext, useState } from \"react\";\nimport { type CalendarMatrix, ViewService } from \"./_viewService\";\n\ntype CalendarContextProps = {\n\tvalueDate: Date[];\n\tviewDate: Date;\n\tcurrentDate: string;\n\tcurrentDay: string;\n\tcurrentMonth: string;\n\tcurrentYear: string;\n\tlistWeek: string[];\n\tlistMonths: { label: string; value: string }[];\n\tlistYears: { label: string; value: string }[];\n\tlistMatrix: CalendarMatrix;\n\tchangeDay: (day: number, month: number, year: number) => void;\n\tchangeMonth: (month: number) => void;\n\tchangeYear: (year: number) => void;\n\tnextMonth: () => void;\n\tpreviousMonth: () => void;\n};\n\ntype SingleCalendarProviderProps = {\n\tchildren: ReactNode;\n\tcalendarType: \"single\";\n\tlanguage?: string;\n\tonChangeView?: (date: Date) => void;\n\tdefaultValue?: Date;\n\tonChange?: (date: Date) => void;\n\tvalue?: Date;\n\tviewValue?: Date;\n\tdefaultViewValue?: Date;\n};\n\ntype RangeCalendarProviderProps = {\n\tchildren: ReactNode;\n\tcalendarType: \"range\";\n\tlanguage?: string;\n\tonChangeView?: (date: Date) => void;\n\tdefaultValue?: [Date, Date];\n\tonChange?: (date: [Date, Date]) => void;\n\tvalue?: [Date, Date];\n\tviewValue?: Date;\n\tdefaultViewValue?: Date;\n};\n\ntype CalendarProviderProps =\n\t| SingleCalendarProviderProps\n\t| RangeCalendarProviderProps;\n\nconst CalendarContext = createContext({} as CalendarContextProps);\n\nfunction useCalendar() {\n\treturn useContext(CalendarContext);\n}\n\nfunction CalendarProvider(props: CalendarProviderProps) {\n\tconst {\n\t\tcalendarType,\n\t\tchildren,\n\t\tdefaultValue: rawDefaultValue,\n\t\tdefaultViewValue = new Date(),\n\t\tlanguage = \"pt-BR\",\n\t\tonChange,\n\t\tonChangeView,\n\t\tvalue,\n\t\tviewValue,\n\t} = props;\n\n\tconst defaultValue: [Date, Date] =\n\t\tcalendarType === \"single\"\n\t\t\t? [rawDefaultValue || new Date(), rawDefaultValue || new Date()]\n\t\t\t: rawDefaultValue || [new Date(), new Date()];\n\n\tconst [rawViewDate, rawSetViewDate] = useState(defaultViewValue);\n\tconst [rawValueDate, rawSetValueDate] = useState<[Date, Date]>(defaultValue);\n\n\tconst viewDate = viewValue || rawViewDate;\n\tconst valueDate: [Date, Date] = value\n\t\t? calendarType === \"single\"\n\t\t\t? [value, value]\n\t\t\t: value\n\t\t: rawValueDate;\n\n\tconst viewService = new ViewService();\n\n\tfunction setValueDate(value: [Date, Date]) {\n\t\tconst normalizedValue: [Date, Date] = [\n\t\t\tnew Date(value[0]),\n\t\t\tnew Date(value[1]),\n\t\t];\n\n\t\tif (onChange && calendarType === \"range\") {\n\t\t\tonChange(normalizedValue);\n\t\t}\n\n\t\tif (onChange && calendarType === \"single\") {\n\t\t\tonChange(normalizedValue[0]);\n\t\t}\n\n\t\trawSetValueDate(normalizedValue);\n\t}\n\n\tfunction setViewDate(date: Date) {\n\t\tif (onChangeView) onChangeView(date);\n\t\trawSetViewDate(date);\n\t}\n\n\treturn (\n\t\t<CalendarContext.Provider\n\t\t\tvalue={{\n\t\t\t\tvalueDate,\n\t\t\t\tviewDate,\n\t\t\t\tcurrentDate: viewDate.toLocaleDateString(language).slice(3),\n\t\t\t\tcurrentDay: viewService.currentDay(viewDate),\n\t\t\t\tcurrentMonth: viewService.currentMonth(viewDate),\n\t\t\t\tcurrentYear: viewService.currentYear(viewDate),\n\t\t\t\tlistWeek: viewService.listWeek(language),\n\t\t\t\tlistMonths: viewService.listMonths(viewDate, language),\n\t\t\t\tlistYears: viewService.listYears(100),\n\t\t\t\tlistMatrix: viewService.listMatrix(viewDate, valueDate),\n\t\t\t\tchangeDay: (day, month, year) =>\n\t\t\t\t\tviewService.changeDay(\n\t\t\t\t\t\tday,\n\t\t\t\t\t\tmonth,\n\t\t\t\t\t\tyear,\n\t\t\t\t\t\tcalendarType,\n\t\t\t\t\t\tvalueDate,\n\t\t\t\t\t\tsetValueDate,\n\t\t\t\t\t\tsetViewDate,\n\t\t\t\t\t),\n\t\t\t\tchangeMonth: (month) =>\n\t\t\t\t\tviewService.changeMonth(month, viewDate, setViewDate),\n\t\t\t\tchangeYear: (year) =>\n\t\t\t\t\tviewService.changeYear(year, viewDate, setViewDate),\n\t\t\t\tnextMonth: () => viewService.nextMonth(viewDate, setViewDate),\n\t\t\t\tpreviousMonth: () => viewService.previousMonth(viewDate, setViewDate),\n\t\t\t}}\n\t\t>\n\t\t\t{children}\n\t\t</CalendarContext.Provider>\n\t);\n}\n\nexport { CalendarProvider, useCalendar };\n"],"mappings":";;;;AAiDA,IAAM,IAAkB,EAAc,CAAC,CAAyB;AAEhE,SAAS,IAAc;CACtB,OAAO,EAAW,CAAe;AAClC;AAEA,SAAS,EAAiB,GAA8B;CACvD,IAAM,EACL,iBACA,aACA,cAAc,GACd,sCAAmB,IAAI,KAAK,GAC5B,cAAW,SACX,aACA,iBACA,UACA,iBACG,GAEE,IACL,MAAiB,WACd,CAAC,qBAAmB,IAAI,KAAK,GAAG,qBAAmB,IAAI,KAAK,C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Provider.tsx"],"sourcesContent":["import {\n\tcreateContext,\n\ttype ReactNode,\n\tuseCallback,\n\tuseContext,\n\tuseMemo,\n\tuseState,\n} from \"react\";\nimport { type CalendarMatrix, ViewService } from \"./_viewService\";\n\ntype CalendarContextProps = {\n\tvalueDate: Date[];\n\tviewDate: Date;\n\tcurrentDate: string;\n\tcurrentDay: string;\n\tcurrentMonth: string;\n\tcurrentYear: string;\n\tlistWeek: string[];\n\tlistMonths: { label: string; value: string }[];\n\tlistYears: { label: string; value: string }[];\n\tlistMatrix: CalendarMatrix;\n\tchangeDay: (day: number, month: number, year: number) => void;\n\tchangeMonth: (month: number) => void;\n\tchangeYear: (year: number) => void;\n\tnextMonth: () => void;\n\tpreviousMonth: () => void;\n};\n\ntype SingleCalendarProviderProps = {\n\tchildren: ReactNode;\n\tcalendarType: \"single\";\n\tlanguage?: string;\n\tonChangeView?: (date: Date) => void;\n\tdefaultValue?: Date;\n\tonChange?: (date: Date) => void;\n\tvalue?: Date;\n\tviewValue?: Date;\n\tdefaultViewValue?: Date;\n};\n\ntype RangeCalendarProviderProps = {\n\tchildren: ReactNode;\n\tcalendarType: \"range\";\n\tlanguage?: string;\n\tonChangeView?: (date: Date) => void;\n\tdefaultValue?: [Date, Date];\n\tonChange?: (date: [Date, Date]) => void;\n\tvalue?: [Date, Date];\n\tviewValue?: Date;\n\tdefaultViewValue?: Date;\n};\n\ntype CalendarProviderProps =\n\t| SingleCalendarProviderProps\n\t| RangeCalendarProviderProps;\n\nconst CalendarContext = createContext({} as CalendarContextProps);\n\nfunction useCalendar() {\n\treturn useContext(CalendarContext);\n}\n\n// Stateless — safe to share a single instance instead of instantiating on every render.\nconst viewService = new ViewService();\n\nfunction CalendarProvider(props: CalendarProviderProps) {\n\tconst {\n\t\tcalendarType,\n\t\tchildren,\n\t\tdefaultValue: rawDefaultValue,\n\t\tdefaultViewValue = new Date(),\n\t\tlanguage = \"pt-BR\",\n\t\tonChange,\n\t\tonChangeView,\n\t\tvalue,\n\t\tviewValue,\n\t} = props;\n\n\tconst defaultValue: [Date, Date] =\n\t\tcalendarType === \"single\"\n\t\t\t? [rawDefaultValue || new Date(), rawDefaultValue || new Date()]\n\t\t\t: rawDefaultValue || [new Date(), new Date()];\n\n\tconst [rawViewDate, rawSetViewDate] = useState(defaultViewValue);\n\tconst [rawValueDate, rawSetValueDate] = useState<[Date, Date]>(defaultValue);\n\n\tconst viewDate = viewValue || rawViewDate;\n\tconst valueDate: [Date, Date] = value\n\t\t? calendarType === \"single\"\n\t\t\t? [value, value]\n\t\t\t: value\n\t\t: rawValueDate;\n\n\tconst setValueDate = useCallback(\n\t\t(newValue: [Date, Date]) => {\n\t\t\tconst normalizedValue: [Date, Date] = [\n\t\t\t\tnew Date(newValue[0]),\n\t\t\t\tnew Date(newValue[1]),\n\t\t\t];\n\n\t\t\tif (onChange && calendarType === \"range\") {\n\t\t\t\tonChange(normalizedValue);\n\t\t\t}\n\n\t\t\tif (onChange && calendarType === \"single\") {\n\t\t\t\tonChange(normalizedValue[0]);\n\t\t\t}\n\n\t\t\trawSetValueDate(normalizedValue);\n\t\t},\n\t\t[calendarType, onChange],\n\t);\n\n\tconst setViewDate = useCallback(\n\t\t(date: Date) => {\n\t\t\tif (onChangeView) onChangeView(date);\n\t\t\trawSetViewDate(date);\n\t\t},\n\t\t[onChangeView],\n\t);\n\n\tconst changeDay = useCallback(\n\t\t(day: number, month: number, year: number) =>\n\t\t\tviewService.changeDay(\n\t\t\t\tday,\n\t\t\t\tmonth,\n\t\t\t\tyear,\n\t\t\t\tcalendarType,\n\t\t\t\tvalueDate,\n\t\t\t\tsetValueDate,\n\t\t\t\tsetViewDate,\n\t\t\t),\n\t\t[calendarType, valueDate, setValueDate, setViewDate],\n\t);\n\n\tconst changeMonth = useCallback(\n\t\t(month: number) => viewService.changeMonth(month, viewDate, setViewDate),\n\t\t[viewDate, setViewDate],\n\t);\n\n\tconst changeYear = useCallback(\n\t\t(year: number) => viewService.changeYear(year, viewDate, setViewDate),\n\t\t[viewDate, setViewDate],\n\t);\n\n\tconst nextMonth = useCallback(\n\t\t() => viewService.nextMonth(viewDate, setViewDate),\n\t\t[viewDate, setViewDate],\n\t);\n\n\tconst previousMonth = useCallback(\n\t\t() => viewService.previousMonth(viewDate, setViewDate),\n\t\t[viewDate, setViewDate],\n\t);\n\n\tconst contextValue = useMemo<CalendarContextProps>(\n\t\t() => ({\n\t\t\tvalueDate,\n\t\t\tviewDate,\n\t\t\tcurrentDate: viewDate.toLocaleDateString(language).slice(3),\n\t\t\tcurrentDay: viewService.currentDay(viewDate),\n\t\t\tcurrentMonth: viewService.currentMonth(viewDate),\n\t\t\tcurrentYear: viewService.currentYear(viewDate),\n\t\t\tlistWeek: viewService.listWeek(language),\n\t\t\tlistMonths: viewService.listMonths(viewDate, language),\n\t\t\tlistYears: viewService.listYears(100),\n\t\t\tlistMatrix: viewService.listMatrix(viewDate, valueDate),\n\t\t\tchangeDay,\n\t\t\tchangeMonth,\n\t\t\tchangeYear,\n\t\t\tnextMonth,\n\t\t\tpreviousMonth,\n\t\t}),\n\t\t[\n\t\t\tvalueDate,\n\t\t\tviewDate,\n\t\t\tlanguage,\n\t\t\tchangeDay,\n\t\t\tchangeMonth,\n\t\t\tchangeYear,\n\t\t\tnextMonth,\n\t\t\tpreviousMonth,\n\t\t],\n\t);\n\n\treturn (\n\t\t<CalendarContext.Provider value={contextValue}>\n\t\t\t{children}\n\t\t</CalendarContext.Provider>\n\t);\n}\n\nexport { CalendarProvider, useCalendar };\n"],"mappings":";;;;AAwDA,IAAM,IAAkB,EAAc,CAAC,CAAyB;AAEhE,SAAS,IAAc;CACtB,OAAO,EAAW,CAAe;AAClC;AAGA,IAAM,IAAc,IAAI,EAAY;AAEpC,SAAS,EAAiB,GAA8B;CACvD,IAAM,EACL,iBACA,aACA,cAAc,GACd,sCAAmB,IAAI,KAAK,GAC5B,cAAW,SACX,aACA,iBACA,UACA,iBACG,GAEE,IACL,MAAiB,WACd,CAAC,qBAAmB,IAAI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C,UAAU,EAAY,SAAS,CAAQ;EACvC,YAAY,EAAY,WAAW,GAAU,CAAQ;EACrD,WAAW,EAAY,UAAU,GAAG;EACpC,YAAY,EAAY,WAAW,GAAU,CAAS;EACtD;EACA;EACA;EACA;EACA;CACD,IACA;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,CACD;CAEA,OACC,kBAAC,EAAgB,UAAjB;EAA0B,OAAO;EAC/B;CACwB,CAAA;AAE5B"}
@@ -8,11 +8,16 @@ function r(r) {
8
8
  let e = /* @__PURE__ */ new Date();
9
9
  return i === e.getDate() && a === e.getMonth() && o === e.getFullYear();
10
10
  }
11
+ function d() {
12
+ l(i, a, o);
13
+ }
11
14
  return /* @__PURE__ */ t("td", {
12
- onClick: () => l(i, a, o),
13
15
  className: `arkynCalendarTableTd ${s} ${c} ${u() ? "today" : ""}`,
14
- children: /* @__PURE__ */ n("div", {
16
+ children: /* @__PURE__ */ n("button", {
17
+ type: "button",
15
18
  className: "textGroup",
19
+ "aria-pressed": c === "checkedDay",
20
+ onClick: d,
16
21
  children: [/* @__PURE__ */ t("span", {}), /* @__PURE__ */ t("p", { children: i })]
17
22
  })
18
23
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/calendar/calendarTableTd/index.tsx"],"sourcesContent":["import { useCalendar } from \"../_calendarProvider\";\nimport \"./styles.css\";\n\ntype CalendarTableTdProps = {\n\tday: number;\n\tmonth: number;\n\tyear: number;\n\tdayType: \"checkedDay\" | \"middleDay\" | \"uncheckedDay\";\n\tdayOwner: \"previous\" | \"current\" | \"next\";\n};\n\nfunction CalendarTableTd(props: CalendarTableTdProps) {\n\tconst { day, month, year, dayOwner, dayType } = props;\n\tconst { changeDay } = useCalendar();\n\n\tfunction isToday() {\n\t\tconst today = new Date();\n\t\treturn (\n\t\t\tday === today.getDate() &&\n\t\t\tmonth === today.getMonth() &&\n\t\t\tyear === today.getFullYear()\n\t\t);\n\t}\n\n\treturn (\n\t\t<td\n\t\t\tonClick={() => changeDay(day, month, year)}\n\t\t\tclassName={`arkynCalendarTableTd ${dayOwner} ${dayType} ${isToday() ? \"today\" : \"\"}`}\n\t\t>\n\t\t\t<div className=\"textGroup\">\n\t\t\t\t<span />\n\t\t\t\t<p>{day}</p>\n\t\t\t</div>\n\t\t</td>\n\t);\n}\n\nexport { CalendarTableTd };\n"],"mappings":";;;;AAWA,SAAS,EAAgB,GAA6B;CACrD,IAAM,EAAE,QAAK,UAAO,SAAM,aAAU,eAAY,GAC1C,EAAE,iBAAc,EAAY;CAElC,SAAS,IAAU;EAClB,IAAM,oBAAQ,IAAI,KAAK;EACvB,OACC,MAAQ,EAAM,QAAQ,KACtB,MAAU,EAAM,SAAS,KACzB,MAAS,EAAM,YAAY;CAE7B;CAEA,OACC,kBAAC,MAAD;EACC,eAAe,EAAU,GAAK,GAAO,CAAI;EACzC,WAAW,wBAAwB,EAAS,GAAG,EAAQ,GAAG,EAAQ,IAAI,UAAU;YAEhF,kBAAC,OAAD;GAAK,WAAU;aAAf,CACC,kBAAC,QAAD,CAAO,CAAA,GACP,kBAAC,KAAD,EAAA,UAAI,EAAO,CAAA,CACP;;CACF,CAAA;AAEN"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/calendar/calendarTableTd/index.tsx"],"sourcesContent":["import { useCalendar } from \"../_calendarProvider\";\nimport \"./styles.css\";\n\ntype CalendarTableTdProps = {\n\tday: number;\n\tmonth: number;\n\tyear: number;\n\tdayType: \"checkedDay\" | \"middleDay\" | \"uncheckedDay\";\n\tdayOwner: \"previous\" | \"current\" | \"next\";\n};\n\nfunction CalendarTableTd(props: CalendarTableTdProps) {\n\tconst { day, month, year, dayOwner, dayType } = props;\n\tconst { changeDay } = useCalendar();\n\n\tfunction isToday() {\n\t\tconst today = new Date();\n\t\treturn (\n\t\t\tday === today.getDate() &&\n\t\t\tmonth === today.getMonth() &&\n\t\t\tyear === today.getFullYear()\n\t\t);\n\t}\n\n\tfunction handleSelectDay() {\n\t\tchangeDay(day, month, year);\n\t}\n\n\treturn (\n\t\t<td\n\t\t\tclassName={`arkynCalendarTableTd ${dayOwner} ${dayType} ${isToday() ? \"today\" : \"\"}`}\n\t\t>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclassName=\"textGroup\"\n\t\t\t\taria-pressed={dayType === \"checkedDay\"}\n\t\t\t\tonClick={handleSelectDay}\n\t\t\t>\n\t\t\t\t<span />\n\t\t\t\t<p>{day}</p>\n\t\t\t</button>\n\t\t</td>\n\t);\n}\n\nexport { CalendarTableTd };\n"],"mappings":";;;;AAWA,SAAS,EAAgB,GAA6B;CACrD,IAAM,EAAE,QAAK,UAAO,SAAM,aAAU,eAAY,GAC1C,EAAE,iBAAc,EAAY;CAElC,SAAS,IAAU;EAClB,IAAM,oBAAQ,IAAI,KAAK;EACvB,OACC,MAAQ,EAAM,QAAQ,KACtB,MAAU,EAAM,SAAS,KACzB,MAAS,EAAM,YAAY;CAE7B;CAEA,SAAS,IAAkB;EAC1B,EAAU,GAAK,GAAO,CAAI;CAC3B;CAEA,OACC,kBAAC,MAAD;EACC,WAAW,wBAAwB,EAAS,GAAG,EAAQ,GAAG,EAAQ,IAAI,UAAU;YAEhF,kBAAC,UAAD;GACC,MAAK;GACL,WAAU;GACV,gBAAc,MAAY;GAC1B,SAAS;aAJV,CAMC,kBAAC,QAAD,CAAO,CAAA,GACP,kBAAC,KAAD,EAAA,UAAI,EAAO,CAAA,CACJ;;CACL,CAAA;AAEN"}
@@ -1 +1 @@
1
- @layer arkyn{.arkynCalendarTableTd{-webkit-user-select:none;user-select:none;cursor:pointer}.arkynCalendarTableTd p{text-align:center;border-radius:8px;justify-content:center;align-items:center;width:40px;height:40px;margin:auto;font-size:14px;display:flex}.arkynCalendarTableTd.previous p,.arkynCalendarTableTd.next p{color:var(--text-muted,#a1a1aa)}.arkynCalendarTableTd.current p{color:var(--text-body,#52525b)}.arkynCalendarTableTd:hover p{color:rgb(var(--spotlight-primary,17, 109, 220))}.arkynCalendarTableTd.today:not(.checkedDay) p{color:var(--text-body,#52525b);background-color:var(--background-underground,#fafafa);filter:brightness(.97);font-weight:500}.arkynCalendarTableTd .textGroup{width:40px;height:40px;margin:auto;position:relative}.arkynCalendarTableTd.checkedDay .textGroup span{content:" ";background-color:rgb(var(--spotlight-primary,17, 109, 220));z-index:2;border-radius:8px;position:absolute;inset:0}.arkynCalendarTableTd.checkedDay .textGroup p{color:var(--white,#fff);z-index:3;font-weight:600;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.arkynCalendarTableTd.middleDay .textGroup span{content:" ";background-color:var(--background-underground,#fafafa);filter:brightness(.95);z-index:1;position:absolute;inset:0 -15px}.arkynCalendarTableTd:first-child.middleDay .textGroup span{border-top-left-radius:6px;border-bottom-left-radius:6px;left:0;right:-15px}.arkynCalendarTableTd:last-child.middleDay .textGroup span{border-top-right-radius:6px;border-bottom-right-radius:6px;left:-15px;right:0}.arkynCalendarTableTd.middleDay .textGroup p{color:var(--text-muted,#a1a1aa);z-index:2;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.arkynCalendarTableTd.current.middleDay .textGroup p{color:var(--text-body,#52525b)}}
1
+ @layer arkyn{.arkynCalendarTableTd{-webkit-user-select:none;user-select:none;cursor:pointer}.arkynCalendarTableTd p{text-align:center;border-radius:8px;justify-content:center;align-items:center;width:40px;height:40px;margin:auto;font-size:14px;display:flex}.arkynCalendarTableTd.previous p,.arkynCalendarTableTd.next p{color:var(--text-muted,#a1a1aa)}.arkynCalendarTableTd.current p{color:var(--text-body,#52525b)}.arkynCalendarTableTd:hover p{color:rgb(var(--spotlight-primary,17, 109, 220))}.arkynCalendarTableTd.today:not(.checkedDay) p{color:var(--text-body,#52525b);background-color:var(--background-underground,#fafafa);filter:brightness(.97);font-weight:500}.arkynCalendarTableTd .textGroup{width:40px;height:40px;font:inherit;cursor:pointer;background-color:#0000;border:none;margin:auto;padding:0;display:block;position:relative}.arkynCalendarTableTd.checkedDay .textGroup span{content:" ";background-color:rgb(var(--spotlight-primary,17, 109, 220));z-index:2;border-radius:8px;position:absolute;inset:0}.arkynCalendarTableTd.checkedDay .textGroup p{color:var(--white,#fff);z-index:3;font-weight:600;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.arkynCalendarTableTd.middleDay .textGroup span{content:" ";background-color:var(--background-underground,#fafafa);filter:brightness(.95);z-index:1;position:absolute;inset:0 -15px}.arkynCalendarTableTd:first-child.middleDay .textGroup span{border-top-left-radius:6px;border-bottom-left-radius:6px;left:0;right:-15px}.arkynCalendarTableTd:last-child.middleDay .textGroup span{border-top-right-radius:6px;border-bottom-right-radius:6px;left:-15px;right:0}.arkynCalendarTableTd.middleDay .textGroup p{color:var(--text-muted,#a1a1aa);z-index:2;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.arkynCalendarTableTd.current.middleDay .textGroup p{color:var(--text-body,#52525b)}}
@@ -14,7 +14,7 @@
14
14
 
15
15
  @layer arkyn{.arkynSelectContent{flex-wrap:wrap;flex:1;align-items:start;gap:4px;display:flex}.arkynSelectContent>p{color:var(--text-muted,#a1a1aa);-webkit-user-select:none;user-select:none;font-weight:400}.arkynSelectContent>p.hasValue{color:var(--text-body,#52525b)}.arkynSelectContent.md>p{font-size:14px;line-height:14px}.arkynSelectContent.lg>p{font-size:16px;line-height:16px}}
16
16
 
17
- @layer arkyn{.arkynSelectOption{color:var(--text-body,#52525b);background-color:inherit;-webkit-user-select:none;user-select:none;border:none;justify-content:space-between;align-items:center;font-weight:400;line-height:21.79px;display:flex}.arkynSelectOption.md{padding:8px 16px;font-size:14px}.arkynSelectOption.lg{padding:8px 16px;font-size:16px}.arkynSelectOption svg{width:20px;height:20px;color:rgb(var(--spotlight-primary,17, 109, 220));display:none}.arkynSelectOption:hover{cursor:pointer;filter:brightness(.98)}.arkynSelectOption.active{color:var(--text-heading,#09090b);filter:brightness(.95);font-weight:600}.arkynSelectOption.active svg{display:unset}html.dark .arkynSelectOption:hover,html.dark .arkynSelectOption.active{filter:brightness(1.2)}}
17
+ @layer arkyn{.arkynSelectOption{color:var(--text-body,#52525b);background-color:inherit;-webkit-user-select:none;user-select:none;border:none;justify-content:space-between;align-items:center;font-weight:400;line-height:21.79px;display:flex}.arkynSelectOption.md{padding:8px 16px;font-size:14px}.arkynSelectOption.lg{padding:8px 16px;font-size:16px}.arkynSelectOption svg{width:20px;height:20px;color:rgb(var(--spotlight-primary,17, 109, 220));display:none}.arkynSelectOption:hover{cursor:pointer;filter:brightness(.98)}.arkynSelectOption.active{color:var(--text-heading,#09090b);filter:brightness(.95);font-weight:600}.arkynSelectOption.active svg{display:unset}.arkynSelectOption.highlighted{filter:brightness(.98)}html.dark .arkynSelectOption:hover,html.dark .arkynSelectOption.active,html.dark .arkynSelectOption.highlighted{filter:brightness(1.2)}}
18
18
 
19
19
  @layer arkyn{.arkynSelectOptionsContainer{z-index:7;border:1px solid var(--border,#e2e8f0);background-color:var(--background-foreground,#fff);border-radius:6px;flex-direction:column;flex:1;height:max-content;max-height:300px;list-style:none;display:flex;position:absolute;left:-2px;right:-2px;overflow:auto;box-shadow:0 4px 8px #0000001a}.arkynSelectOptionsContainer.bottom{top:calc(100% + 5px)}.arkynSelectOptionsContainer.top{bottom:calc(100% + 5px)}.arkynSelectOptionsContainer>p{text-align:center;color:var(--text-body,#52525b);padding:16px;font-size:14px;font-weight:400;line-height:21.79px}}
20
20
 
@@ -26,7 +26,7 @@
26
26
 
27
27
  @layer arkyn{.arkynCalendarTableBody{border-collapse:collapse;border-spacing:0}.arkynCalendarTableBody td p{text-align:center;padding:16px;font-size:14px}.arkynCalendarTableBody tr:first-child td{padding-top:8px}}
28
28
 
29
- @layer arkyn{.arkynCalendarTableTd{-webkit-user-select:none;user-select:none;cursor:pointer}.arkynCalendarTableTd p{text-align:center;border-radius:8px;justify-content:center;align-items:center;width:40px;height:40px;margin:auto;font-size:14px;display:flex}.arkynCalendarTableTd.previous p,.arkynCalendarTableTd.next p{color:var(--text-muted,#a1a1aa)}.arkynCalendarTableTd.current p{color:var(--text-body,#52525b)}.arkynCalendarTableTd:hover p{color:rgb(var(--spotlight-primary,17, 109, 220))}.arkynCalendarTableTd.today:not(.checkedDay) p{color:var(--text-body,#52525b);background-color:var(--background-underground,#fafafa);filter:brightness(.97);font-weight:500}.arkynCalendarTableTd .textGroup{width:40px;height:40px;margin:auto;position:relative}.arkynCalendarTableTd.checkedDay .textGroup span{content:" ";background-color:rgb(var(--spotlight-primary,17, 109, 220));z-index:2;border-radius:8px;position:absolute;inset:0}.arkynCalendarTableTd.checkedDay .textGroup p{color:var(--white,#fff);z-index:3;font-weight:600;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.arkynCalendarTableTd.middleDay .textGroup span{content:" ";background-color:var(--background-underground,#fafafa);filter:brightness(.95);z-index:1;position:absolute;inset:0 -15px}.arkynCalendarTableTd:first-child.middleDay .textGroup span{border-top-left-radius:6px;border-bottom-left-radius:6px;left:0;right:-15px}.arkynCalendarTableTd:last-child.middleDay .textGroup span{border-top-right-radius:6px;border-bottom-right-radius:6px;left:-15px;right:0}.arkynCalendarTableTd.middleDay .textGroup p{color:var(--text-muted,#a1a1aa);z-index:2;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.arkynCalendarTableTd.current.middleDay .textGroup p{color:var(--text-body,#52525b)}}
29
+ @layer arkyn{.arkynCalendarTableTd{-webkit-user-select:none;user-select:none;cursor:pointer}.arkynCalendarTableTd p{text-align:center;border-radius:8px;justify-content:center;align-items:center;width:40px;height:40px;margin:auto;font-size:14px;display:flex}.arkynCalendarTableTd.previous p,.arkynCalendarTableTd.next p{color:var(--text-muted,#a1a1aa)}.arkynCalendarTableTd.current p{color:var(--text-body,#52525b)}.arkynCalendarTableTd:hover p{color:rgb(var(--spotlight-primary,17, 109, 220))}.arkynCalendarTableTd.today:not(.checkedDay) p{color:var(--text-body,#52525b);background-color:var(--background-underground,#fafafa);filter:brightness(.97);font-weight:500}.arkynCalendarTableTd .textGroup{width:40px;height:40px;font:inherit;cursor:pointer;background-color:#0000;border:none;margin:auto;padding:0;display:block;position:relative}.arkynCalendarTableTd.checkedDay .textGroup span{content:" ";background-color:rgb(var(--spotlight-primary,17, 109, 220));z-index:2;border-radius:8px;position:absolute;inset:0}.arkynCalendarTableTd.checkedDay .textGroup p{color:var(--white,#fff);z-index:3;font-weight:600;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.arkynCalendarTableTd.middleDay .textGroup span{content:" ";background-color:var(--background-underground,#fafafa);filter:brightness(.95);z-index:1;position:absolute;inset:0 -15px}.arkynCalendarTableTd:first-child.middleDay .textGroup span{border-top-left-radius:6px;border-bottom-left-radius:6px;left:0;right:-15px}.arkynCalendarTableTd:last-child.middleDay .textGroup span{border-top-right-radius:6px;border-bottom-right-radius:6px;left:-15px;right:0}.arkynCalendarTableTd.middleDay .textGroup p{color:var(--text-muted,#a1a1aa);z-index:2;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.arkynCalendarTableTd.current.middleDay .textGroup p{color:var(--text-body,#52525b)}}
30
30
 
31
31
  @layer arkyn{.arkynCalendarTableContainer{border-collapse:collapse;border-spacing:0}}
32
32
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/currencyInput/index.tsx"],"sourcesContent":["import { Loader2, type LucideIcon } from \"lucide-react\";\nimport {\n\ttype ChangeEvent,\n\ttype FocusEvent,\n\ttype InputHTMLAttributes,\n\tuseEffect,\n\tuseId,\n\tuseRef,\n\tuseState,\n} from \"react\";\n\nimport { useForm } from \"../../hooks/useForm\";\nimport { FieldTemplate } from \"../../services/fieldTemplate\";\nimport { IconRenderer } from \"../../services/iconRenderer\";\nimport {\n\tmaskCurrencyValues,\n\tnormalizeValue,\n} from \"../../services/maskCurrencyValues\";\n\nimport \"./style.css\";\n\ntype Locale =\n\t| \"USD\"\n\t| \"EUR\"\n\t| \"JPY\"\n\t| \"GBP\"\n\t| \"AUD\"\n\t| \"CAD\"\n\t| \"CHF\"\n\t| \"CNY\"\n\t| \"SEK\"\n\t| \"NZD\"\n\t| \"BRL\"\n\t| \"INR\"\n\t| \"RUB\"\n\t| \"ZAR\"\n\t| \"MXN\"\n\t| \"SGD\"\n\t| \"HKD\"\n\t| \"NOK\"\n\t| \"KRW\"\n\t| \"TRY\"\n\t| \"IDR\"\n\t| \"THB\";\n\ntype CurrencyInputProps = Omit<\n\tInputHTMLAttributes<HTMLInputElement>,\n\t| \"size\"\n\t| \"prefix\"\n\t| \"name\"\n\t| \"type\"\n\t| \"max\"\n\t| \"defaultValue\"\n\t| \"value\"\n\t| \"onChange\"\n\t| \"placeholder\"\n> & {\n\t/** Field name for form submission. Required. */\n\tname: string;\n\t/**\n\t * Currency locale used to format the displayed value.\n\t * Supported: `\"USD\"` | `\"EUR\"` | `\"BRL\"` | `\"JPY\"` | `\"GBP\"` | … (22 locales).\n\t * Required.\n\t */\n\tlocale: Locale;\n\t/** Optional label text displayed above the input. */\n\tlabel?: string;\n\t/** Validation error message displayed below the input. */\n\terrorMessage?: string;\n\t/** Shows a spinner and disables the input during async operations. @default false */\n\tisLoading?: boolean;\n\t/** When true, skips `FieldTemplate` wrapper (label and error text). @default false */\n\tunShowFieldTemplate?: boolean;\n\t/**\n\t * Input size.\n\t * @default \"md\"\n\t */\n\tsize?: \"md\" | \"lg\";\n\t/**\n\t * Visual style variant.\n\t * - `solid`: filled background.\n\t * - `outline`: bordered, transparent background.\n\t * - `underline`: bottom border only.\n\t * @default \"solid\"\n\t */\n\tvariant?: \"solid\" | \"outline\" | \"underline\";\n\t/**\n\t * Layout direction forwarded to `FieldTemplate`.\n\t * @default \"horizontal\"\n\t */\n\torientation?: \"horizontal\" | \"vertical\" | \"horizontalReverse\";\n\t/** Text or icon rendered at the far left, outside the input area. */\n\tprefix?: string | LucideIcon;\n\t/** Text or icon rendered at the far right, outside the input area. */\n\tsuffix?: string | LucideIcon;\n\t/** Displays an asterisk on the label to signal a required field. */\n\tshowAsterisk?: boolean;\n\t/** Lucide icon rendered inside the input on the left. */\n\tleftIcon?: LucideIcon;\n\t/** Lucide icon rendered inside the input on the right. */\n\trightIcon?: LucideIcon;\n\t/** Maximum numeric value allowed. @default 1_000_000_000 */\n\tmax?: number;\n\t/** Controlled numeric value. */\n\tvalue?: number;\n\t/** Uncontrolled default numeric value. */\n\tdefaultValue?: number;\n\t/**\n\t * Callback fired on value change.\n\t * @param event - Native change event.\n\t * @param originalValue - Raw numeric string (e.g. `\"1234.56\"`).\n\t * @param maskedValue - Formatted display string (e.g. `\"$ 1,234.56\"`).\n\t */\n\tonChange?: (\n\t\tevent: ChangeEvent<HTMLInputElement>,\n\t\toriginalValue: string,\n\t\tmaskedValue: string,\n\t) => void;\n};\n\n/**\n * CurrencyInput, numeric input that automatically formats the displayed value according to a currency locale.\n *\n * The raw numeric value is stored in a hidden `<input>` for form submission.\n * Integrates with `useForm` to display validation errors by field name.\n *\n * @param props.name - Field name for form submission. Required.\n * @param props.locale - Currency locale (e.g. `\"USD\"`, `\"BRL\"`, `\"EUR\"`). Required.\n * @param props.label - Label text displayed above the input.\n * @param props.errorMessage - Validation error message.\n * @param props.isLoading - Shows a spinner and disables the input. Default: false\n * @param props.size - Input size (`md` | `lg`). Default: \"md\"\n * @param props.variant - Visual style variant. Default: \"solid\"\n * @param props.max - Maximum numeric value allowed. Default: 1_000_000_000\n * @param props.value - Controlled numeric value.\n * @param props.defaultValue - Uncontrolled default numeric value.\n * @param props.onChange - Callback fired on change, receives the event, the raw numeric string, and the formatted string.\n * @param props.prefix - Text or icon at the far left.\n * @param props.suffix - Text or icon at the far right.\n * @param props.leftIcon - Lucide icon inside the input on the left.\n * @param props.rightIcon - Lucide icon inside the input on the right.\n * @param props.showAsterisk - Appends `*` to the label.\n * @param props.orientation - Layout direction. Default: \"horizontal\"\n * @param props.unShowFieldTemplate - Skips wrapper, label, and error rendering. Default: false\n *\n * **...Other valid HTML properties for `<input>` (except `type`, `max`, `value`, `defaultValue`, `onChange`, `placeholder`)**\n *\n * @returns CurrencyInput JSX element wrapped in `FieldTemplate`.\n *\n * @example\n * ```tsx\n * // Basic\n * <CurrencyInput name=\"price\" locale=\"USD\" />\n *\n * // With label and validation\n * <CurrencyInput\n * name=\"salary\"\n * locale=\"BRL\"\n * label=\"Monthly Salary\"\n * showAsterisk\n * errorMessage=\"Please enter a valid amount\"\n * />\n *\n * // With max value and controlled state\n * <CurrencyInput\n * name=\"limit\"\n * locale=\"USD\"\n * label=\"Credit Limit\"\n * max={10000}\n * value={creditLimit}\n * onChange={(e, original) => setCreditLimit(Number(original))}\n * />\n * ```\n */\n\nfunction CurrencyInput(props: CurrencyInputProps) {\n\tconst {\n\t\tname,\n\t\tdisabled,\n\t\ttitle,\n\t\tstyle,\n\t\tvariant = \"solid\",\n\t\tlabel,\n\t\tclassName: wrapperClassName = \"\",\n\t\tvalue,\n\t\tdefaultValue,\n\t\tmax = 1000000000,\n\t\tlocale,\n\t\tonChange,\n\t\tprefix,\n\t\tsuffix,\n\t\tisLoading = false,\n\t\tleftIcon,\n\t\treadOnly,\n\t\tonFocus,\n\t\tonBlur,\n\t\terrorMessage: baseErrorMessage,\n\t\tunShowFieldTemplate,\n\t\torientation,\n\t\tshowAsterisk,\n\t\trightIcon,\n\t\tsize = \"md\",\n\t\tid,\n\t\t...rest\n\t} = props;\n\n\tconst { fieldErrors } = useForm();\n\tconst [isFocused, setIsFocused] = useState(false);\n\tconst [maskedValue, setMaskedValue] = useState(\"0\");\n\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\tconst generatedId = useId();\n\tconst inputId = id || generatedId;\n\n\tconst errorMessage = baseErrorMessage || fieldErrors?.[name];\n\tconst isError = !!errorMessage;\n\tconst isDisabled = disabled || isLoading;\n\n\tconst iconSizes = { md: 20, lg: 20 };\n\tconst iconSize = iconSizes[size];\n\n\tconst loadingPosition = rightIcon ? \"right\" : \"left\";\n\n\tconst showLeftSpinner = loadingPosition === \"left\" && isLoading;\n\tconst showRightSpinner = loadingPosition === \"right\" && isLoading;\n\n\tfunction handleSectionClick() {\n\t\tif (isDisabled || !inputRef?.current) return;\n\t\tsetIsFocused(true);\n\t\tinputRef.current.focus();\n\t}\n\n\tfunction handleFocus(e: FocusEvent<HTMLInputElement>) {\n\t\tsetIsFocused(true);\n\t\tif (onFocus) onFocus(e);\n\t}\n\n\tfunction handleBlur(e: FocusEvent<HTMLInputElement>) {\n\t\tsetIsFocused(false);\n\t\tif (onBlur) onBlur(e);\n\t}\n\n\tconst updateValues = (originalValue: string | number) => {\n\t\tconst [calculatedValue, calculatedMaskedValue] = maskCurrencyValues(\n\t\t\toriginalValue,\n\t\t\tlocale,\n\t\t);\n\n\t\tif (!max || calculatedValue <= max) {\n\t\t\tsetMaskedValue(calculatedMaskedValue);\n\t\t\treturn [calculatedValue, calculatedMaskedValue];\n\t\t}\n\n\t\treturn maskCurrencyValues(originalValue, locale);\n\t};\n\n\tconst handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n\t\tevent.preventDefault();\n\t\tconst [originalValue, maskedValue] = updateValues(event.target.value);\n\n\t\tonChange?.(event, String(originalValue), String(maskedValue));\n\t};\n\n\tuseEffect(() => {\n\t\tfunction currentValue() {\n\t\t\tif (typeof value === \"number\") return value;\n\t\t\tif (typeof defaultValue === \"number\") return defaultValue;\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst [, maskedValue] = maskCurrencyValues(currentValue(), locale);\n\n\t\tsetMaskedValue(maskedValue);\n\t}, [locale, defaultValue, value]);\n\n\tconst hasPrefix = prefix ? \"hasPrefix\" : \"\";\n\tconst hasSuffix = suffix ? \"hasSuffix\" : \"\";\n\tconst errored = isError ? \"errored\" : \"\";\n\tconst opacity = isDisabled || readOnly || isLoading ? \"opacity\" : \"\";\n\tconst focused = isFocused ? \"focused\" : \"\";\n\n\tconst className = `arkynCurrencyInput ${hasPrefix} ${hasSuffix} ${variant} ${size} ${opacity} ${errored} ${focused}`;\n\n\treturn (\n\t\t<FieldTemplate\n\t\t\tname={name}\n\t\t\tlabel={label}\n\t\t\tshowAsterisk={showAsterisk}\n\t\t\tclassName={wrapperClassName}\n\t\t\terrorMessage={errorMessage}\n\t\t\tunShowFieldTemplate={unShowFieldTemplate}\n\t\t\torientation={orientation}\n\t\t>\n\t\t\t<section\n\t\t\t\ttitle={title}\n\t\t\t\tstyle={style}\n\t\t\t\tclassName={className}\n\t\t\t\tonClick={handleSectionClick}\n\t\t\t>\n\t\t\t\t<IconRenderer iconSize={iconSize} icon={prefix} className=\"prefix\" />\n\n\t\t\t\t<IconRenderer\n\t\t\t\t\tshow={showLeftSpinner}\n\t\t\t\t\ticonSize={iconSize}\n\t\t\t\t\tclassName=\"spinner\"\n\t\t\t\t\ticon={Loader2}\n\t\t\t\t/>\n\n\t\t\t\t<IconRenderer show={!isLoading} icon={leftIcon} iconSize={iconSize} />\n\n\t\t\t\t<input\n\t\t\t\t\tdisabled={isDisabled}\n\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\tref={inputRef}\n\t\t\t\t\tonFocus={handleFocus}\n\t\t\t\t\tonBlur={handleBlur}\n\t\t\t\t\tonChange={handleChange}\n\t\t\t\t\tid={inputId}\n\t\t\t\t\tplaceholder={isDisabled ? maskedValue : undefined}\n\t\t\t\t\tvalue={isDisabled ? undefined : maskedValue}\n\t\t\t\t\t{...rest}\n\t\t\t\t/>\n\n\t\t\t\t<input\n\t\t\t\t\ttype=\"hidden\"\n\t\t\t\t\tname={name}\n\t\t\t\t\tvalue={normalizeValue(maskedValue)}\n\t\t\t\t\treadOnly\n\t\t\t\t/>\n\n\t\t\t\t<IconRenderer show={!isLoading} icon={rightIcon} iconSize={iconSize} />\n\n\t\t\t\t<IconRenderer\n\t\t\t\t\tshow={showRightSpinner}\n\t\t\t\t\ticonSize={iconSize}\n\t\t\t\t\tclassName=\"spinner\"\n\t\t\t\t\ticon={Loader2}\n\t\t\t\t/>\n\n\t\t\t\t<IconRenderer iconSize={iconSize} icon={suffix} className=\"suffix\" />\n\t\t\t</section>\n\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ources":["../../../../src/components/currencyInput/index.tsx"],"sourcesContent":["import { Loader2, type LucideIcon } from \"lucide-react\";\nimport {\n\ttype ChangeEvent,\n\ttype FocusEvent,\n\ttype InputHTMLAttributes,\n\tuseEffect,\n\tuseId,\n\tuseRef,\n\tuseState,\n} from \"react\";\n\nimport { useForm } from \"../../hooks/useForm\";\nimport { FieldTemplate } from \"../../services/fieldTemplate\";\nimport { IconRenderer } from \"../../services/iconRenderer\";\nimport {\n\tmaskCurrencyValues,\n\tnormalizeValue,\n} from \"../../services/maskCurrencyValues\";\n\nimport \"./style.css\";\n\ntype Locale =\n\t| \"USD\"\n\t| \"EUR\"\n\t| \"JPY\"\n\t| \"GBP\"\n\t| \"AUD\"\n\t| \"CAD\"\n\t| \"CHF\"\n\t| \"CNY\"\n\t| \"SEK\"\n\t| \"NZD\"\n\t| \"BRL\"\n\t| \"INR\"\n\t| \"RUB\"\n\t| \"ZAR\"\n\t| \"MXN\"\n\t| \"SGD\"\n\t| \"HKD\"\n\t| \"NOK\"\n\t| \"KRW\"\n\t| \"TRY\"\n\t| \"IDR\"\n\t| \"THB\";\n\ntype CurrencyInputProps = Omit<\n\tInputHTMLAttributes<HTMLInputElement>,\n\t| \"size\"\n\t| \"prefix\"\n\t| \"name\"\n\t| \"type\"\n\t| \"max\"\n\t| \"defaultValue\"\n\t| \"value\"\n\t| \"onChange\"\n\t| \"placeholder\"\n> & {\n\t/** Field name for form submission. Required. */\n\tname: string;\n\t/**\n\t * Currency locale used to format the displayed value.\n\t * Supported: `\"USD\"` | `\"EUR\"` | `\"BRL\"` | `\"JPY\"` | `\"GBP\"` | … (22 locales).\n\t * Required.\n\t */\n\tlocale: Locale;\n\t/** Optional label text displayed above the input. */\n\tlabel?: string;\n\t/** Validation error message displayed below the input. */\n\terrorMessage?: string;\n\t/** Shows a spinner and disables the input during async operations. @default false */\n\tisLoading?: boolean;\n\t/** When true, skips `FieldTemplate` wrapper (label and error text). @default false */\n\tunShowFieldTemplate?: boolean;\n\t/**\n\t * Input size.\n\t * @default \"md\"\n\t */\n\tsize?: \"md\" | \"lg\";\n\t/**\n\t * Visual style variant.\n\t * - `solid`: filled background.\n\t * - `outline`: bordered, transparent background.\n\t * - `underline`: bottom border only.\n\t * @default \"solid\"\n\t */\n\tvariant?: \"solid\" | \"outline\" | \"underline\";\n\t/**\n\t * Layout direction forwarded to `FieldTemplate`.\n\t * @default \"horizontal\"\n\t */\n\torientation?: \"horizontal\" | \"vertical\" | \"horizontalReverse\";\n\t/** Text or icon rendered at the far left, outside the input area. */\n\tprefix?: string | LucideIcon;\n\t/** Text or icon rendered at the far right, outside the input area. */\n\tsuffix?: string | LucideIcon;\n\t/** Displays an asterisk on the label to signal a required field. */\n\tshowAsterisk?: boolean;\n\t/** Lucide icon rendered inside the input on the left. */\n\tleftIcon?: LucideIcon;\n\t/** Lucide icon rendered inside the input on the right. */\n\trightIcon?: LucideIcon;\n\t/** Maximum numeric value allowed. @default 1_000_000_000 */\n\tmax?: number;\n\t/** Controlled numeric value. */\n\tvalue?: number;\n\t/** Uncontrolled default numeric value. */\n\tdefaultValue?: number;\n\t/**\n\t * Callback fired on value change.\n\t * @param event - Native change event.\n\t * @param originalValue - Raw numeric string (e.g. `\"1234.56\"`).\n\t * @param maskedValue - Formatted display string (e.g. `\"$ 1,234.56\"`).\n\t */\n\tonChange?: (\n\t\tevent: ChangeEvent<HTMLInputElement>,\n\t\toriginalValue: string,\n\t\tmaskedValue: string,\n\t) => void;\n};\n\n/**\n * CurrencyInput, numeric input that automatically formats the displayed value according to a currency locale.\n *\n * The raw numeric value is stored in a hidden `<input>` for form submission.\n * Integrates with `useForm` to display validation errors by field name.\n *\n * @param props.name - Field name for form submission. Required.\n * @param props.locale - Currency locale (e.g. `\"USD\"`, `\"BRL\"`, `\"EUR\"`). Required.\n * @param props.label - Label text displayed above the input.\n * @param props.errorMessage - Validation error message.\n * @param props.isLoading - Shows a spinner and disables the input. Default: false\n * @param props.size - Input size (`md` | `lg`). Default: \"md\"\n * @param props.variant - Visual style variant. Default: \"solid\"\n * @param props.max - Maximum numeric value allowed. Default: 1_000_000_000\n * @param props.value - Controlled numeric value.\n * @param props.defaultValue - Uncontrolled default numeric value.\n * @param props.onChange - Callback fired on change, receives the event, the raw numeric string, and the formatted string.\n * @param props.prefix - Text or icon at the far left.\n * @param props.suffix - Text or icon at the far right.\n * @param props.leftIcon - Lucide icon inside the input on the left.\n * @param props.rightIcon - Lucide icon inside the input on the right.\n * @param props.showAsterisk - Appends `*` to the label.\n * @param props.orientation - Layout direction. Default: \"vertical\"\n * @param props.unShowFieldTemplate - Skips wrapper, label, and error rendering. Default: false\n *\n * **...Other valid HTML properties for `<input>` (except `type`, `max`, `value`, `defaultValue`, `onChange`, `placeholder`)**\n *\n * @returns CurrencyInput JSX element wrapped in `FieldTemplate`.\n *\n * @example\n * ```tsx\n * // Basic\n * <CurrencyInput name=\"price\" locale=\"USD\" />\n *\n * // With label and validation\n * <CurrencyInput\n * name=\"salary\"\n * locale=\"BRL\"\n * label=\"Monthly Salary\"\n * showAsterisk\n * errorMessage=\"Please enter a valid amount\"\n * />\n *\n * // With max value and controlled state\n * <CurrencyInput\n * name=\"limit\"\n * locale=\"USD\"\n * label=\"Credit Limit\"\n * max={10000}\n * value={creditLimit}\n * onChange={(e, original) => setCreditLimit(Number(original))}\n * />\n * ```\n */\n\nfunction CurrencyInput(props: CurrencyInputProps) {\n\tconst {\n\t\tname,\n\t\tdisabled,\n\t\ttitle,\n\t\tstyle,\n\t\tvariant = \"solid\",\n\t\tlabel,\n\t\tclassName: wrapperClassName = \"\",\n\t\tvalue,\n\t\tdefaultValue,\n\t\tmax = 1000000000,\n\t\tlocale,\n\t\tonChange,\n\t\tprefix,\n\t\tsuffix,\n\t\tisLoading = false,\n\t\tleftIcon,\n\t\treadOnly,\n\t\tonFocus,\n\t\tonBlur,\n\t\terrorMessage: baseErrorMessage,\n\t\tunShowFieldTemplate,\n\t\torientation,\n\t\tshowAsterisk,\n\t\trightIcon,\n\t\tsize = \"md\",\n\t\tid,\n\t\t...rest\n\t} = props;\n\n\tconst { fieldErrors } = useForm();\n\tconst [isFocused, setIsFocused] = useState(false);\n\tconst [maskedValue, setMaskedValue] = useState(\"0\");\n\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\tconst generatedId = useId();\n\tconst inputId = id || generatedId;\n\n\tconst errorMessage = baseErrorMessage || fieldErrors?.[name];\n\tconst isError = !!errorMessage;\n\tconst isDisabled = disabled || isLoading;\n\n\tconst iconSizes = { md: 20, lg: 20 };\n\tconst iconSize = iconSizes[size];\n\n\tconst loadingPosition = rightIcon ? \"right\" : \"left\";\n\n\tconst showLeftSpinner = loadingPosition === \"left\" && isLoading;\n\tconst showRightSpinner = loadingPosition === \"right\" && isLoading;\n\n\tfunction handleSectionClick() {\n\t\tif (isDisabled || !inputRef?.current) return;\n\t\tsetIsFocused(true);\n\t\tinputRef.current.focus();\n\t}\n\n\tfunction handleFocus(e: FocusEvent<HTMLInputElement>) {\n\t\tsetIsFocused(true);\n\t\tif (onFocus) onFocus(e);\n\t}\n\n\tfunction handleBlur(e: FocusEvent<HTMLInputElement>) {\n\t\tsetIsFocused(false);\n\t\tif (onBlur) onBlur(e);\n\t}\n\n\tconst updateValues = (originalValue: string | number) => {\n\t\tconst [calculatedValue, calculatedMaskedValue] = maskCurrencyValues(\n\t\t\toriginalValue,\n\t\t\tlocale,\n\t\t);\n\n\t\tif (!max || calculatedValue <= max) {\n\t\t\tsetMaskedValue(calculatedMaskedValue);\n\t\t\treturn [calculatedValue, calculatedMaskedValue];\n\t\t}\n\n\t\treturn maskCurrencyValues(originalValue, locale);\n\t};\n\n\tconst handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n\t\tevent.preventDefault();\n\t\tconst [originalValue, maskedValue] = updateValues(event.target.value);\n\n\t\tonChange?.(event, String(originalValue), String(maskedValue));\n\t};\n\n\tuseEffect(() => {\n\t\tfunction currentValue() {\n\t\t\tif (typeof value === \"number\") return value;\n\t\t\tif (typeof defaultValue === \"number\") return defaultValue;\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst [, maskedValue] = maskCurrencyValues(currentValue(), locale);\n\n\t\tsetMaskedValue(maskedValue);\n\t}, [locale, defaultValue, value]);\n\n\tconst hasPrefix = prefix ? \"hasPrefix\" : \"\";\n\tconst hasSuffix = suffix ? \"hasSuffix\" : \"\";\n\tconst errored = isError ? \"errored\" : \"\";\n\tconst opacity = isDisabled || readOnly || isLoading ? \"opacity\" : \"\";\n\tconst focused = isFocused ? \"focused\" : \"\";\n\n\tconst className = `arkynCurrencyInput ${hasPrefix} ${hasSuffix} ${variant} ${size} ${opacity} ${errored} ${focused}`;\n\n\treturn (\n\t\t<FieldTemplate\n\t\t\tname={name}\n\t\t\tlabel={label}\n\t\t\tshowAsterisk={showAsterisk}\n\t\t\tclassName={wrapperClassName}\n\t\t\terrorMessage={errorMessage}\n\t\t\tunShowFieldTemplate={unShowFieldTemplate}\n\t\t\torientation={orientation}\n\t\t>\n\t\t\t<section\n\t\t\t\ttitle={title}\n\t\t\t\tstyle={style}\n\t\t\t\tclassName={className}\n\t\t\t\tonClick={handleSectionClick}\n\t\t\t>\n\t\t\t\t<IconRenderer iconSize={iconSize} icon={prefix} className=\"prefix\" />\n\n\t\t\t\t<IconRenderer\n\t\t\t\t\tshow={showLeftSpinner}\n\t\t\t\t\ticonSize={iconSize}\n\t\t\t\t\tclassName=\"spinner\"\n\t\t\t\t\ticon={Loader2}\n\t\t\t\t/>\n\n\t\t\t\t<IconRenderer show={!isLoading} icon={leftIcon} iconSize={iconSize} />\n\n\t\t\t\t<input\n\t\t\t\t\tdisabled={isDisabled}\n\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\tref={inputRef}\n\t\t\t\t\tonFocus={handleFocus}\n\t\t\t\t\tonBlur={handleBlur}\n\t\t\t\t\tonChange={handleChange}\n\t\t\t\t\tid={inputId}\n\t\t\t\t\tplaceholder={isDisabled ? maskedValue : undefined}\n\t\t\t\t\tvalue={isDisabled ? undefined : maskedValue}\n\t\t\t\t\t{...rest}\n\t\t\t\t/>\n\n\t\t\t\t<input\n\t\t\t\t\ttype=\"hidden\"\n\t\t\t\t\tname={name}\n\t\t\t\t\tvalue={normalizeValue(maskedValue)}\n\t\t\t\t\treadOnly\n\t\t\t\t/>\n\n\t\t\t\t<IconRenderer show={!isLoading} icon={rightIcon} iconSize={iconSize} />\n\n\t\t\t\t<IconRenderer\n\t\t\t\t\tshow={showRightSpinner}\n\t\t\t\t\ticonSize={iconSize}\n\t\t\t\t\tclassName=\"spinner\"\n\t\t\t\t\ticon={Loader2}\n\t\t\t\t/>\n\n\t\t\t\t<IconRenderer iconSize={iconSize} icon={suffix} className=\"suffix\" />\n\t\t\t</section>\n\t\t</FieldTemplate>\n\t);\n}\n\nexport { CurrencyInput };\n"],"mappings":";;;;;;;;;AA+KA,SAAS,EAAc,GAA2B;CACjD,IAAM,EACL,SACA,aACA,UACA,UACA,aAAU,SACV,UACA,WAAW,IAAmB,IAC9B,UACA,iBACA,SAAM,KACN,WACA,aACA,WACA,WACA,eAAY,IACZ,aACA,aACA,YACA,WACA,cAAc,GACd,wBACA,gBACA,iBACA,cACA,UAAO,MACP,OACA,GAAG,MACA,GAEE,EAAE,mBAAgB,EAAQ,GAC1B,CAAC,GAAW,KAAgB,EAAS,EAAK,GAC1C,CAAC,GAAa,KAAkB,EAAS,GAAG,GAE5C,IAAW,EAAyB,IAAI,GACxC,IAAc,EAAM,GACpB,IAAU,KAAM,GAEhB,IAAe,KAAoB,IAAc,IACjD,IAAU,CAAC,CAAC,GACZ,IAAa,KAAY,GAGzB,IAAW;EADG,IAAI;EAAI,IAAI;CACf,EAAU,IAErB,IAAkB,IAAY,UAAU,QAExC,IAAkB,MAAoB,UAAU,GAChD,KAAmB,MAAoB,WAAW;CAExD,SAAS,KAAqB;EACzB,KAAc,CAAC,GAAU,YAC7B,EAAa,EAAI,GACjB,EAAS,QAAQ,MAAM;CACxB;CAEA,SAAS,GAAY,GAAiC;EA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O,CAAW,CAAC;KAC7D;KAwDI,IAAI;KACJ,aAAa,IAAa,IAAc,KAAA;KACxC,OAAO,IAAa,KAAA,IAAY;KAChC,GAAI;IACJ,CAAA;IAED,kBAAC,SAAD;KACC,MAAK;KACC;KACN,OAAO,EAAe,CAAW;KACjC,UAAA;IACA,CAAA;IAED,kBAAC,GAAD;KAAc,MAAM,CAAC;KAAW,MAAM;KAAqB;IAAW,CAAA;IAEtE,kBAAC,GAAD;KACC,MAAM;KACI;KACV,WAAU;KACV,MAAM;IACN,CAAA;IAED,kBAAC,GAAD;KAAwB;KAAU,MAAM;KAAQ,WAAU;IAAU,CAAA;GAC5D;;CACK,CAAA;AAEjB"}
@@ -1,25 +1,21 @@
1
- import { useScrollLock as e } from "../../../hooks/useScrollLock.js";
1
+ import { useFlipPosition as e } from "../../../hooks/useFlipPosition.js";
2
+ import { useScrollLock as t } from "../../../hooks/useScrollLock.js";
2
3
  /* empty css */
3
- import { useEffect as t, useRef as n, useState as r } from "react";
4
- import { jsx as i } from "react/jsx-runtime";
4
+ import { useRef as n } from "react";
5
+ import { jsx as r } from "react/jsx-runtime";
5
6
  //#region src/components/datePicker/datePickerCalendarContainer/index.tsx
6
- function a(a) {
7
- let { children: o, isFocused: s } = a, c = n(null), [l, u] = r("bottom");
8
- return e(s), t(() => {
9
- s && (() => {
10
- if (!c.current) return;
11
- let e = c.current.parentElement;
12
- if (!e) return;
13
- let t = e.getBoundingClientRect();
14
- window.innerHeight - t.bottom < 420 && t.top > 420 ? u("top") : u("bottom");
15
- })();
16
- }, [s]), s ? /* @__PURE__ */ i("div", {
7
+ function i(i) {
8
+ let { children: a, id: o, isFocused: s } = i, c = n(null), l = e(c, s, 420);
9
+ return t(s), s ? /* @__PURE__ */ r("div", {
17
10
  ref: c,
11
+ id: o,
12
+ role: "dialog",
13
+ "aria-modal": "false",
18
14
  className: `arkynDatePickerCalendarContainer ${l}`,
19
- children: o
15
+ children: a
20
16
  }) : null;
21
17
  }
22
18
  //#endregion
23
- export { a as DatePickerCalendarContainer };
19
+ export { i as DatePickerCalendarContainer };
24
20
 
25
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/datePicker/datePickerCalendarContainer/index.tsx"],"sourcesContent":["import { type ReactNode, useEffect, useRef, useState } from \"react\";\n\nimport { useScrollLock } from \"../../../hooks/useScrollLock\";\n\nimport \"./styles.css\";\n\ntype DatePickerCalendarContainerProps = {\n\tisFocused: boolean;\n\tchildren: ReactNode;\n};\n\nfunction DatePickerCalendarContainer(props: DatePickerCalendarContainerProps) {\n\tconst { children, isFocused } = props;\n\n\tconst containerRef = useRef<HTMLDivElement>(null);\n\tconst [position, setPosition] = useState<\"bottom\" | \"top\">(\"bottom\");\n\n\tuseScrollLock(isFocused);\n\n\tuseEffect(() => {\n\t\tif (!isFocused) return;\n\n\t\tconst checkContainerPosition = () => {\n\t\t\tif (!containerRef.current) return;\n\n\t\t\tconst parentElement = containerRef.current.parentElement;\n\t\t\tif (!parentElement) return;\n\n\t\t\tconst parentRect = parentElement.getBoundingClientRect();\n\t\t\tconst viewportHeight = window.innerHeight;\n\n\t\t\tconst estimatedContainerHeight = 420;\n\t\t\tconst spaceBelow = viewportHeight - parentRect.bottom;\n\n\t\t\tif (\n\t\t\t\tspaceBelow < estimatedContainerHeight &&\n\t\t\t\tparentRect.top > estimatedContainerHeight\n\t\t\t) {\n\t\t\t\tsetPosition(\"top\");\n\t\t\t} else {\n\t\t\t\tsetPosition(\"bottom\");\n\t\t\t}\n\t\t};\n\n\t\tcheckContainerPosition();\n\t}, [isFocused]);\n\n\tif (!isFocused) return null;\n\n\treturn (\n\t\t<div\n\t\t\tref={containerRef}\n\t\t\tclassName={`arkynDatePickerCalendarContainer ${position}`}\n\t\t>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n\nexport { DatePickerCalendarContainer };\n"],"mappings":";;;;;AAWA,SAAS,EAA4B,GAAyC;CAC7E,IAAM,EAAE,aAAU,iBAAc,GAE1B,IAAe,EAAuB,IAAI,GAC1C,CAAC,GAAU,KAAe,EAA2B,QAAQ;CAkCnE,OAhCA,EAAc,CAAS,GAEvB,QAAgB;EACV,YAEgC;GACpC,IAAI,CAAC,EAAa,SAAS;GAE3B,IAAM,IAAgB,EAAa,QAAQ;GAC3C,IAAI,CAAC,GAAe;GAEpB,IAAM,IAAa,EAAc,sBAAsB;GAMvD,AALuB,OAAO,cAGM,EAAW,SAGjC,OACb,EAAW,MAAM,MAEjB,EAAY,KAAK,IAEjB,EAAY,QAAQ;EAEtB,EAEA,CAAuB;CACxB,GAAG,CAAC,CAAS,CAAC,GAET,IAGJ,kBAAC,OAAD;EACC,KAAK;EACL,WAAW,oCAAoC;EAE9C;CACG,CAAA,IARiB;AAUxB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/datePicker/datePickerCalendarContainer/index.tsx"],"sourcesContent":["import { type ReactNode, useRef } from \"react\";\n\nimport { useFlipPosition } from \"../../../hooks/useFlipPosition\";\nimport { useScrollLock } from \"../../../hooks/useScrollLock\";\n\nimport \"./styles.css\";\n\ntype DatePickerCalendarContainerProps = {\n\tid?: string;\n\tisFocused: boolean;\n\tchildren: ReactNode;\n};\n\nfunction DatePickerCalendarContainer(props: DatePickerCalendarContainerProps) {\n\tconst { children, id, isFocused } = props;\n\n\tconst containerRef = useRef<HTMLDivElement>(null);\n\tconst position = useFlipPosition(containerRef, isFocused, 420);\n\n\tuseScrollLock(isFocused);\n\n\tif (!isFocused) return null;\n\n\treturn (\n\t\t<div\n\t\t\tref={containerRef}\n\t\t\tid={id}\n\t\t\trole=\"dialog\"\n\t\t\taria-modal=\"false\"\n\t\t\tclassName={`arkynDatePickerCalendarContainer ${position}`}\n\t\t>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n\nexport { DatePickerCalendarContainer };\n"],"mappings":";;;;;;AAaA,SAAS,EAA4B,GAAyC;CAC7E,IAAM,EAAE,aAAU,OAAI,iBAAc,GAE9B,IAAe,EAAuB,IAAI,GAC1C,IAAW,EAAgB,GAAc,GAAW,GAAG;CAM7D,OAJA,EAAc,CAAS,GAElB,IAGJ,kBAAC,OAAD;EACC,KAAK;EACD;EACJ,MAAK;EACL,cAAW;EACX,WAAW,oCAAoC;EAE9C;CACG,CAAA,IAXiB;AAaxB"}
@@ -2,11 +2,18 @@
2
2
  import { jsx as e } from "react/jsx-runtime";
3
3
  //#region src/components/datePicker/datePickerContainer/index.tsx
4
4
  function t(t) {
5
- let { children: n, handleContainerFocus: r, disabled: i, isError: a, isLoading: o, isFocused: s, className: c, readOnly: l, variant: u, size: d, id: f, prefixExists: p } = t;
6
- return /* @__PURE__ */ e("section", {
5
+ let { children: n, handleContainerFocus: r, disabled: i, isError: a, isLoading: o, isFocused: s, className: c, readOnly: l, variant: u, size: d, id: f, prefixExists: p, containerRef: m, onContainerKeyDown: h, tabIndex: g, ariaControls: _ } = t;
6
+ return /* @__PURE__ */ e("div", {
7
+ ref: m,
7
8
  id: f,
9
+ tabIndex: g,
10
+ role: "combobox",
11
+ "aria-haspopup": "dialog",
12
+ "aria-expanded": s,
13
+ "aria-controls": _,
8
14
  className: `arkynDatePickerContainer ${p ? "hasPrefix" : ""} ${u} ${d} ${i || l || o ? "opacity" : ""} ${a ? "errored" : ""} ${s ? "focused" : ""} ${c}`,
9
15
  onClick: r,
16
+ onKeyDown: h,
10
17
  children: n
11
18
  });
12
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/datePicker/datePickerContainer/index.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport \"./styles.css\";\n\ntype DatePickerContainerProps = {\n\tchildren: ReactNode;\n\thandleContainerFocus: () => void;\n\tprefixExists: boolean;\n\tisError: boolean;\n\tdisabled: boolean;\n\treadOnly: boolean;\n\tisLoading: boolean;\n\tisFocused: boolean;\n\tclassName?: string;\n\tid: string;\n\tvariant: \"solid\" | \"outline\" | \"underline\";\n\tsize: \"md\" | \"lg\";\n};\n\nfunction DatePickerContainer(props: DatePickerContainerProps) {\n\tconst {\n\t\tchildren,\n\t\thandleContainerFocus,\n\t\tdisabled,\n\t\tisError,\n\t\tisLoading,\n\t\tisFocused,\n\t\tclassName,\n\t\treadOnly,\n\t\tvariant,\n\t\tsize,\n\t\tid,\n\t\tprefixExists,\n\t} = props;\n\n\tconst hasPrefix = prefixExists ? \"hasPrefix\" : \"\";\n\tconst errored = isError ? \"errored\" : \"\";\n\tconst opacity = disabled || readOnly || isLoading ? \"opacity\" : \"\";\n\tconst focused = isFocused ? \"focused\" : \"\";\n\n\treturn (\n\t\t<section\n\t\t\tid={id}\n\t\t\tclassName={`arkynDatePickerContainer ${hasPrefix} ${variant} ${size} ${opacity} ${errored} ${focused} ${className}`}\n\t\t\tonClick={handleContainerFocus}\n\t\t>\n\t\t\t{children}\n\t\t</section>\n\t);\n}\n\nexport { DatePickerContainer };\n"],"mappings":";;;AAkBA,SAAS,EAAoB,GAAiC;CAC7D,IAAM,EACL,aACA,yBACA,aACA,YACA,cACA,cACA,cACA,aACA,YACA,SACA,OACA,oBACG;CAOJ,OACC,kBAAC,WAAD;EACK;EACJ,WAAW,4BARK,IAAe,cAAc,GAQI,GAAG,EAAQ,GAAG,EAAK,GANtD,KAAY,KAAY,IAAY,YAAY,GAMiB,GAPjE,IAAU,YAAY,GAOsD,GAL5E,IAAY,YAAY,GAK+D,GAAG;EACxG,SAAS;EAER;CACO,CAAA;AAEX"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/datePicker/datePickerContainer/index.tsx"],"sourcesContent":["import type { KeyboardEvent, ReactNode, RefObject } from \"react\";\nimport \"./styles.css\";\n\ntype DatePickerContainerProps = {\n\tchildren: ReactNode;\n\thandleContainerFocus: () => void;\n\tprefixExists: boolean;\n\tisError: boolean;\n\tdisabled: boolean;\n\treadOnly: boolean;\n\tisLoading: boolean;\n\tisFocused: boolean;\n\tclassName?: string;\n\tid: string;\n\tvariant: \"solid\" | \"outline\" | \"underline\";\n\tsize: \"md\" | \"lg\";\n\tcontainerRef?: RefObject<HTMLDivElement | null>;\n\tonContainerKeyDown?: (e: KeyboardEvent<HTMLDivElement>) => void;\n\ttabIndex?: number;\n\tariaControls?: string;\n};\n\nfunction DatePickerContainer(props: DatePickerContainerProps) {\n\tconst {\n\t\tchildren,\n\t\thandleContainerFocus,\n\t\tdisabled,\n\t\tisError,\n\t\tisLoading,\n\t\tisFocused,\n\t\tclassName,\n\t\treadOnly,\n\t\tvariant,\n\t\tsize,\n\t\tid,\n\t\tprefixExists,\n\t\tcontainerRef,\n\t\tonContainerKeyDown,\n\t\ttabIndex,\n\t\tariaControls,\n\t} = props;\n\n\tconst hasPrefix = prefixExists ? \"hasPrefix\" : \"\";\n\tconst errored = isError ? \"errored\" : \"\";\n\tconst opacity = disabled || readOnly || isLoading ? \"opacity\" : \"\";\n\tconst focused = isFocused ? \"focused\" : \"\";\n\n\treturn (\n\t\t<div\n\t\t\tref={containerRef}\n\t\t\tid={id}\n\t\t\ttabIndex={tabIndex}\n\t\t\trole=\"combobox\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-expanded={isFocused}\n\t\t\taria-controls={ariaControls}\n\t\t\tclassName={`arkynDatePickerContainer ${hasPrefix} ${variant} ${size} ${opacity} ${errored} ${focused} ${className}`}\n\t\t\tonClick={handleContainerFocus}\n\t\t\tonKeyDown={onContainerKeyDown}\n\t\t>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n\nexport { DatePickerContainer };\n"],"mappings":";;;AAsBA,SAAS,EAAoB,GAAiC;CAC7D,IAAM,EACL,aACA,yBACA,aACA,YACA,cACA,cACA,cACA,aACA,YACA,SACA,OACA,iBACA,iBACA,uBACA,aACA,oBACG;CAOJ,OACC,kBAAC,OAAD;EACC,KAAK;EACD;EACM;EACV,MAAK;EACL,iBAAc;EACd,iBAAe;EACf,iBAAe;EACf,WAAW,4BAdK,IAAe,cAAc,GAcI,GAAG,EAAQ,GAAG,EAAK,GAZtD,KAAY,KAAY,IAAY,YAAY,GAYiB,GAbjE,IAAU,YAAY,GAasD,GAX5E,IAAY,YAAY,GAW+D,GAAG;EACxG,SAAS;EACT,WAAW;EAEV;CACG,CAAA;AAEP"}
@@ -19,61 +19,74 @@ function g(e) {
19
19
  return e.toLocaleDateString("pt-BR");
20
20
  }
21
21
  function _(_) {
22
- let { name: v, className: y = "", placeholder: b = "Selecione uma data...", errorMessage: ee, isLoading: x = !1, readOnly: S = !1, id: C, label: w, showAsterisk: T, leftIcon: E, onFocus: te, onBlur: D, disabled: O = !1, prefix: k, size: A = "md", value: j, variant: M = "solid", orientation: N = "vertical", unShowFieldTemplate: P = !1, calendarVariant: F = "complete" } = _, I = _.closeOnSelect ?? _.type === "single", { fieldErrors: L } = e(), R = d(null), z = u(), B = C || z, V = ee || L?.[v], H = !!V, U = O || x || S, W = {
22
+ let { name: v, className: y = "", placeholder: b = "Selecione uma data...", errorMessage: ee, isLoading: x = !1, readOnly: S = !1, id: te, label: C, showAsterisk: w, leftIcon: T, onFocus: ne, onBlur: re, disabled: E = !1, prefix: D, size: O = "md", value: k, variant: A = "solid", orientation: j = "vertical", unShowFieldTemplate: M = !1, calendarVariant: N = "complete" } = _, P = _.closeOnSelect ?? _.type === "single", { fieldErrors: F } = e(), I = d(null), L = d(null), R = u(), z = te || R, B = `${z}-calendar`, V = ee || F?.[v], H = !!V, U = E || x || S, W = {
23
23
  md: 20,
24
24
  lg: 20
25
- }[A], [G, K] = f(!1), [q, J] = f(_.type === "single" ? _.defaultValue : void 0), [Y, X] = f(_.type === "range" ? _.defaultValue : void 0);
25
+ }[O], [G, K] = f(!1), [q, J] = f(_.type === "single" ? _.defaultValue : void 0), [Y, ie] = f(_.type === "range" ? _.defaultValue : void 0);
26
+ function X() {
27
+ U || !I?.current || G || (K(!0), I.current.focus(), ne?.());
28
+ }
26
29
  function Z() {
27
- U || !R?.current || G || (K(!0), R.current.focus(), te?.());
30
+ K(!1), re && I.current && I.current.blur();
28
31
  }
29
- function Q() {
30
- K(!1), D && R.current && R.current.blur();
32
+ function Q(e) {
33
+ if (!U) {
34
+ if (!G) {
35
+ (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(), X());
36
+ return;
37
+ }
38
+ e.key === "Escape" && (e.preventDefault(), Z(), L.current?.focus());
39
+ }
31
40
  }
32
- function ne(e) {
33
- j === void 0 && J(e), _.type === "single" && _.onChange?.(e), I && Q();
41
+ function ae(e) {
42
+ k === void 0 && J(e), _.type === "single" && _.onChange?.(e), P && Z();
34
43
  }
35
- function re(e) {
36
- j === void 0 && X(e), _.type === "range" && _.onChange?.(e), I && Q();
44
+ function oe(e) {
45
+ k === void 0 && ie(e), _.type === "range" && _.onChange?.(e), P && Z();
37
46
  }
38
47
  if (_.type === "range") {
39
- let e = _.rangeSeparator ?? " até ", u = j === void 0 ? Y : j, d = u ? JSON.stringify([h(u[0]), h(u[1])]) : "";
48
+ let e = _.rangeSeparator ?? " até ", u = k === void 0 ? Y : k, d = u ? JSON.stringify([h(u[0]), h(u[1])]) : "";
40
49
  return /* @__PURE__ */ p(n, {
41
50
  name: v,
42
- label: w,
43
- showAsterisk: T,
51
+ label: C,
52
+ showAsterisk: w,
44
53
  className: y,
45
54
  errorMessage: V,
46
- unShowFieldTemplate: P,
47
- orientation: N,
55
+ unShowFieldTemplate: M,
56
+ orientation: j,
48
57
  children: /* @__PURE__ */ m(o, {
49
- handleContainerFocus: Z,
58
+ handleContainerFocus: X,
50
59
  disabled: U,
51
60
  isError: H,
52
61
  isFocused: G,
53
62
  isLoading: x,
54
63
  readOnly: S,
55
- size: A,
56
- variant: M,
57
- prefixExists: !!k,
58
- id: B,
64
+ size: O,
65
+ variant: A,
66
+ prefixExists: !!D,
67
+ id: z,
68
+ containerRef: L,
69
+ onContainerKeyDown: Q,
70
+ tabIndex: U ? -1 : 0,
71
+ ariaControls: B,
59
72
  children: [
60
73
  /* @__PURE__ */ p("input", {
61
- ref: R,
74
+ ref: I,
62
75
  name: v,
63
76
  value: d,
64
77
  type: "hidden"
65
78
  }),
66
79
  /* @__PURE__ */ p(t, {
67
80
  iconSize: W,
68
- icon: k,
81
+ icon: D,
69
82
  className: "prefix"
70
83
  }),
71
- E && /* @__PURE__ */ p(E, {
84
+ T && /* @__PURE__ */ p(T, {
72
85
  size: W,
73
86
  strokeWidth: 2.5
74
87
  }),
75
88
  /* @__PURE__ */ p(s, {
76
- size: A,
89
+ size: O,
77
90
  children: u ? /* @__PURE__ */ m("p", {
78
91
  className: "hasValue",
79
92
  children: [
@@ -84,12 +97,13 @@ function _(_) {
84
97
  }) : /* @__PURE__ */ p("p", { children: b })
85
98
  }),
86
99
  /* @__PURE__ */ p(i, {
100
+ id: B,
87
101
  isFocused: G,
88
102
  children: /* @__PURE__ */ p(r, {
89
103
  type: "range",
90
- variant: F,
104
+ variant: N,
91
105
  value: u,
92
- onChange: re,
106
+ onChange: oe,
93
107
  viewValue: _.viewValue,
94
108
  defaultViewValue: _.defaultViewValue,
95
109
  onChangeView: _.onChangeView
@@ -107,63 +121,68 @@ function _(_) {
107
121
  isLoading: x
108
122
  }),
109
123
  /* @__PURE__ */ p(c, {
110
- handleBlur: Q,
124
+ handleBlur: Z,
111
125
  isFocused: G
112
126
  })
113
127
  ]
114
128
  })
115
129
  });
116
130
  }
117
- let $ = j === void 0 ? q : j, ie = $ ? h($) : "";
131
+ let $ = k === void 0 ? q : k, se = $ ? h($) : "";
118
132
  return /* @__PURE__ */ p(n, {
119
133
  name: v,
120
- label: w,
121
- showAsterisk: T,
134
+ label: C,
135
+ showAsterisk: w,
122
136
  className: y,
123
137
  errorMessage: V,
124
- unShowFieldTemplate: P,
125
- orientation: N,
138
+ unShowFieldTemplate: M,
139
+ orientation: j,
126
140
  children: /* @__PURE__ */ m(o, {
127
- handleContainerFocus: Z,
141
+ handleContainerFocus: X,
128
142
  disabled: U,
129
143
  isError: H,
130
144
  isFocused: G,
131
145
  isLoading: x,
132
146
  readOnly: S,
133
- size: A,
134
- variant: M,
135
- prefixExists: !!k,
136
- id: B,
147
+ size: O,
148
+ variant: A,
149
+ prefixExists: !!D,
150
+ id: z,
151
+ containerRef: L,
152
+ onContainerKeyDown: Q,
153
+ tabIndex: U ? -1 : 0,
154
+ ariaControls: B,
137
155
  children: [
138
156
  /* @__PURE__ */ p("input", {
139
- ref: R,
157
+ ref: I,
140
158
  name: v,
141
- value: ie,
159
+ value: se,
142
160
  type: "hidden"
143
161
  }),
144
162
  /* @__PURE__ */ p(t, {
145
163
  iconSize: W,
146
- icon: k,
164
+ icon: D,
147
165
  className: "prefix"
148
166
  }),
149
- E && /* @__PURE__ */ p(E, {
167
+ T && /* @__PURE__ */ p(T, {
150
168
  size: W,
151
169
  strokeWidth: 2.5
152
170
  }),
153
171
  /* @__PURE__ */ p(s, {
154
- size: A,
172
+ size: O,
155
173
  children: $ ? /* @__PURE__ */ p("p", {
156
174
  className: "hasValue",
157
175
  children: g($)
158
176
  }) : /* @__PURE__ */ p("p", { children: b })
159
177
  }),
160
178
  /* @__PURE__ */ p(i, {
179
+ id: B,
161
180
  isFocused: G,
162
181
  children: /* @__PURE__ */ p(r, {
163
182
  type: "single",
164
- variant: F,
183
+ variant: N,
165
184
  value: $,
166
- onChange: ne,
185
+ onChange: ae,
167
186
  viewValue: _.viewValue,
168
187
  defaultViewValue: _.defaultViewValue,
169
188
  onChangeView: _.onChangeView
@@ -181,7 +200,7 @@ function _(_) {
181
200
  isLoading: x
182
201
  }),
183
202
  /* @__PURE__ */ p(c, {
184
- handleBlur: Q,
203
+ handleBlur: Z,
185
204
  isFocused: G
186
205
  })
187
206
  ]