@knitui/dates 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/lib/commonjs/DatesProvider/DatesProvider.js +33 -4
  2. package/lib/commonjs/DatesProvider/DatesProvider.js.map +1 -1
  3. package/lib/commonjs/Day/Day.js +45 -7
  4. package/lib/commonjs/Day/Day.js.map +1 -1
  5. package/lib/commonjs/DecadeLevel/DecadeLevel.js.map +1 -1
  6. package/lib/commonjs/Month/Month.js +266 -80
  7. package/lib/commonjs/Month/Month.js.map +1 -1
  8. package/lib/commonjs/MonthLevel/MonthLevel.js +19 -3
  9. package/lib/commonjs/MonthLevel/MonthLevel.js.map +1 -1
  10. package/lib/commonjs/MonthsList/MonthsList.js +160 -60
  11. package/lib/commonjs/MonthsList/MonthsList.js.map +1 -1
  12. package/lib/commonjs/MonthsList/get-month-in-tab-order/get-month-in-tab-order.js +7 -1
  13. package/lib/commonjs/MonthsList/get-month-in-tab-order/get-month-in-tab-order.js.map +1 -1
  14. package/lib/commonjs/TimeControlsList/TimeControl.js +15 -1
  15. package/lib/commonjs/TimeControlsList/TimeControl.js.map +1 -1
  16. package/lib/commonjs/TimeControlsList/TimeControlsList.js +16 -3
  17. package/lib/commonjs/TimeControlsList/TimeControlsList.js.map +1 -1
  18. package/lib/commonjs/WeekdaysRow/WeekdaysRow.js +23 -4
  19. package/lib/commonjs/WeekdaysRow/WeekdaysRow.js.map +1 -1
  20. package/lib/commonjs/YearsList/YearsList.js +155 -60
  21. package/lib/commonjs/YearsList/YearsList.js.map +1 -1
  22. package/lib/commonjs/YearsList/get-year-in-tab-order/get-year-in-tab-order.js +7 -1
  23. package/lib/commonjs/YearsList/get-year-in-tab-order/get-year-in-tab-order.js.map +1 -1
  24. package/lib/commonjs/hooks/use-dates-state/is-in-range/is-in-range.js +20 -0
  25. package/lib/commonjs/hooks/use-dates-state/is-in-range/is-in-range.js.map +1 -1
  26. package/lib/commonjs/hooks/use-dates-state/use-dates-state.js +25 -7
  27. package/lib/commonjs/hooks/use-dates-state/use-dates-state.js.map +1 -1
  28. package/lib/commonjs/internal/are-cell-props-equal.js +64 -0
  29. package/lib/commonjs/internal/are-cell-props-equal.js.map +1 -0
  30. package/lib/commonjs/internal/date-string-fast-path.js +98 -0
  31. package/lib/commonjs/internal/date-string-fast-path.js.map +1 -0
  32. package/lib/commonjs/internal/memoize-control-props.js +54 -0
  33. package/lib/commonjs/internal/memoize-control-props.js.map +1 -0
  34. package/lib/commonjs/internal/month-days-cache.js +71 -0
  35. package/lib/commonjs/internal/month-days-cache.js.map +1 -0
  36. package/lib/commonjs/utils/get-date-in-tab-order/get-date-in-tab-order.js +9 -1
  37. package/lib/commonjs/utils/get-date-in-tab-order/get-date-in-tab-order.js.map +1 -1
  38. package/lib/commonjs/utils/is-after-min-date/is-after-min-date.js +14 -1
  39. package/lib/commonjs/utils/is-after-min-date/is-after-min-date.js.map +1 -1
  40. package/lib/commonjs/utils/is-before-max-date/is-before-max-date.js +14 -1
  41. package/lib/commonjs/utils/is-before-max-date/is-before-max-date.js.map +1 -1
  42. package/lib/commonjs/utils/is-same-month/is-same-month.js +17 -1
  43. package/lib/commonjs/utils/is-same-month/is-same-month.js.map +1 -1
  44. package/lib/module/DatesProvider/DatesProvider.js +34 -5
  45. package/lib/module/DatesProvider/DatesProvider.js.map +1 -1
  46. package/lib/module/Day/Day.js +46 -8
  47. package/lib/module/Day/Day.js.map +1 -1
  48. package/lib/module/DecadeLevel/DecadeLevel.js.map +1 -1
  49. package/lib/module/Month/Month.js +267 -82
  50. package/lib/module/Month/Month.js.map +1 -1
  51. package/lib/module/MonthLevel/MonthLevel.js +19 -3
  52. package/lib/module/MonthLevel/MonthLevel.js.map +1 -1
  53. package/lib/module/MonthsList/MonthsList.js +159 -60
  54. package/lib/module/MonthsList/MonthsList.js.map +1 -1
  55. package/lib/module/MonthsList/get-month-in-tab-order/get-month-in-tab-order.js +7 -1
  56. package/lib/module/MonthsList/get-month-in-tab-order/get-month-in-tab-order.js.map +1 -1
  57. package/lib/module/TimeControlsList/TimeControl.js +15 -1
  58. package/lib/module/TimeControlsList/TimeControl.js.map +1 -1
  59. package/lib/module/TimeControlsList/TimeControlsList.js +16 -3
  60. package/lib/module/TimeControlsList/TimeControlsList.js.map +1 -1
  61. package/lib/module/WeekdaysRow/WeekdaysRow.js +23 -4
  62. package/lib/module/WeekdaysRow/WeekdaysRow.js.map +1 -1
  63. package/lib/module/YearsList/YearsList.js +154 -60
  64. package/lib/module/YearsList/YearsList.js.map +1 -1
  65. package/lib/module/YearsList/get-year-in-tab-order/get-year-in-tab-order.js +7 -1
  66. package/lib/module/YearsList/get-year-in-tab-order/get-year-in-tab-order.js.map +1 -1
  67. package/lib/module/hooks/use-dates-state/is-in-range/is-in-range.js +20 -0
  68. package/lib/module/hooks/use-dates-state/is-in-range/is-in-range.js.map +1 -1
  69. package/lib/module/hooks/use-dates-state/use-dates-state.js +25 -7
  70. package/lib/module/hooks/use-dates-state/use-dates-state.js.map +1 -1
  71. package/lib/module/internal/are-cell-props-equal.js +60 -0
  72. package/lib/module/internal/are-cell-props-equal.js.map +1 -0
  73. package/lib/module/internal/date-string-fast-path.js +91 -0
  74. package/lib/module/internal/date-string-fast-path.js.map +1 -0
  75. package/lib/module/internal/memoize-control-props.js +50 -0
  76. package/lib/module/internal/memoize-control-props.js.map +1 -0
  77. package/lib/module/internal/month-days-cache.js +68 -0
  78. package/lib/module/internal/month-days-cache.js.map +1 -0
  79. package/lib/module/utils/get-date-in-tab-order/get-date-in-tab-order.js +9 -1
  80. package/lib/module/utils/get-date-in-tab-order/get-date-in-tab-order.js.map +1 -1
  81. package/lib/module/utils/is-after-min-date/is-after-min-date.js +14 -1
  82. package/lib/module/utils/is-after-min-date/is-after-min-date.js.map +1 -1
  83. package/lib/module/utils/is-before-max-date/is-before-max-date.js +14 -1
  84. package/lib/module/utils/is-before-max-date/is-before-max-date.js.map +1 -1
  85. package/lib/module/utils/is-same-month/is-same-month.js +17 -1
  86. package/lib/module/utils/is-same-month/is-same-month.js.map +1 -1
  87. package/lib/typescript/DatesProvider/DatesProvider.d.ts.map +1 -1
  88. package/lib/typescript/Day/Day.d.ts +7 -7
  89. package/lib/typescript/Day/Day.d.ts.map +1 -1
  90. package/lib/typescript/DecadeLevel/DecadeLevel.d.ts.map +1 -1
  91. package/lib/typescript/Month/Month.d.ts +3 -2
  92. package/lib/typescript/Month/Month.d.ts.map +1 -1
  93. package/lib/typescript/MonthLevel/MonthLevel.d.ts.map +1 -1
  94. package/lib/typescript/MonthsList/MonthsList.d.ts +3 -2
  95. package/lib/typescript/MonthsList/MonthsList.d.ts.map +1 -1
  96. package/lib/typescript/MonthsList/get-month-in-tab-order/get-month-in-tab-order.d.ts +6 -0
  97. package/lib/typescript/MonthsList/get-month-in-tab-order/get-month-in-tab-order.d.ts.map +1 -1
  98. package/lib/typescript/TimeControlsList/TimeControl.d.ts +13 -0
  99. package/lib/typescript/TimeControlsList/TimeControl.d.ts.map +1 -1
  100. package/lib/typescript/TimeControlsList/TimeControlsList.d.ts.map +1 -1
  101. package/lib/typescript/WeekdaysRow/WeekdaysRow.d.ts.map +1 -1
  102. package/lib/typescript/YearsList/YearsList.d.ts +3 -2
  103. package/lib/typescript/YearsList/YearsList.d.ts.map +1 -1
  104. package/lib/typescript/YearsList/get-year-in-tab-order/get-year-in-tab-order.d.ts +6 -0
  105. package/lib/typescript/YearsList/get-year-in-tab-order/get-year-in-tab-order.d.ts.map +1 -1
  106. package/lib/typescript/hooks/use-dates-state/is-in-range/is-in-range.d.ts +12 -0
  107. package/lib/typescript/hooks/use-dates-state/is-in-range/is-in-range.d.ts.map +1 -1
  108. package/lib/typescript/hooks/use-dates-state/use-dates-state.d.ts.map +1 -1
  109. package/lib/typescript/internal/are-cell-props-equal.d.ts +21 -0
  110. package/lib/typescript/internal/are-cell-props-equal.d.ts.map +1 -0
  111. package/lib/typescript/internal/date-string-fast-path.d.ts +35 -0
  112. package/lib/typescript/internal/date-string-fast-path.d.ts.map +1 -0
  113. package/lib/typescript/internal/memoize-control-props.d.ts +12 -0
  114. package/lib/typescript/internal/memoize-control-props.d.ts.map +1 -0
  115. package/lib/typescript/internal/month-days-cache.d.ts +19 -0
  116. package/lib/typescript/internal/month-days-cache.d.ts.map +1 -0
  117. package/lib/typescript/utils/get-date-in-tab-order/get-date-in-tab-order.d.ts +9 -1
  118. package/lib/typescript/utils/get-date-in-tab-order/get-date-in-tab-order.d.ts.map +1 -1
  119. package/lib/typescript/utils/is-after-min-date/is-after-min-date.d.ts +6 -0
  120. package/lib/typescript/utils/is-after-min-date/is-after-min-date.d.ts.map +1 -1
  121. package/lib/typescript/utils/is-before-max-date/is-before-max-date.d.ts +6 -0
  122. package/lib/typescript/utils/is-before-max-date/is-before-max-date.d.ts.map +1 -1
  123. package/lib/typescript/utils/is-same-month/is-same-month.d.ts +13 -1
  124. package/lib/typescript/utils/is-same-month/is-same-month.d.ts.map +1 -1
  125. package/package.json +12 -12
  126. package/src/DatesProvider/DatesProvider.tsx +27 -5
  127. package/src/Day/Day.tsx +51 -10
  128. package/src/DecadeLevel/DecadeLevel.tsx +1 -2
  129. package/src/Month/Month.tsx +357 -80
  130. package/src/MonthLevel/MonthLevel.tsx +35 -16
  131. package/src/MonthsList/MonthsList.tsx +201 -55
  132. package/src/MonthsList/get-month-in-tab-order/get-month-in-tab-order.ts +12 -1
  133. package/src/TimeControlsList/TimeControl.tsx +16 -1
  134. package/src/TimeControlsList/TimeControlsList.tsx +15 -3
  135. package/src/WeekdaysRow/WeekdaysRow.tsx +29 -5
  136. package/src/YearsList/YearsList.tsx +196 -55
  137. package/src/YearsList/get-year-in-tab-order/get-year-in-tab-order.ts +12 -1
  138. package/src/hooks/use-dates-state/is-in-range/is-in-range.ts +22 -0
  139. package/src/hooks/use-dates-state/use-dates-state.ts +28 -15
  140. package/src/internal/are-cell-props-equal.ts +63 -0
  141. package/src/internal/date-string-fast-path.ts +94 -0
  142. package/src/internal/memoize-control-props.ts +54 -0
  143. package/src/internal/month-days-cache.ts +77 -0
  144. package/src/utils/get-date-in-tab-order/get-date-in-tab-order.ts +17 -2
  145. package/src/utils/is-after-min-date/is-after-min-date.ts +16 -1
  146. package/src/utils/is-before-max-date/is-before-max-date.ts +16 -1
  147. package/src/utils/is-same-month/is-same-month.ts +18 -1
@@ -1,3 +1,4 @@
1
+ import * as React from "react";
1
2
  import { type GetProps, type SlotStyles } from "@knitui/core";
2
3
  import { type CalendarSize } from "../cell-metrics";
3
4
  import { type PickerControlProps } from "../PickerControl";
@@ -61,10 +62,10 @@ export interface YearsListProps extends YearsListFrameProps, YearsListSettings {
61
62
  */
62
63
  styles?: SlotStyles<YearsListStyles>;
63
64
  }
64
- export declare const YearsList: import("react").ForwardRefExoticComponent<Omit<import("@tamagui/web").GetFinalProps<import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/web").StackStyleBase, {
65
+ export declare const YearsList: React.ForwardRefExoticComponent<Omit<import("@tamagui/web").GetFinalProps<import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/web").StackStyleBase, {
65
66
  shadow?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | undefined;
66
67
  fullWidth?: boolean | undefined;
67
- }>, keyof YearsListProps> & YearsListProps & import("react").RefAttributes<import("@tamagui/web").TamaguiElement>> & import("@tamagui/web").StaticComponentObject<Omit<import("@tamagui/web").GetFinalProps<import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/web").StackStyleBase, {
68
+ }>, keyof YearsListProps> & YearsListProps & React.RefAttributes<import("@tamagui/web").TamaguiElement>> & import("@tamagui/web").StaticComponentObject<Omit<import("@tamagui/web").GetFinalProps<import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/web").StackStyleBase, {
68
69
  shadow?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | undefined;
69
70
  fullWidth?: boolean | undefined;
70
71
  }>, keyof YearsListProps> & YearsListProps, import("@tamagui/web").TamaguiElement, import("@tamagui/core").RNTamaguiViewNonStyleProps & YearsListProps, import("@tamagui/web").StackStyleBase, {
@@ -1 +1 @@
1
- {"version":3,"file":"YearsList.d.ts","sourceRoot":"","sources":["../../../src/YearsList/YearsList.tsx"],"names":[],"mappings":"AAuBA,OAAO,EAEL,KAAK,QAAQ,EAEb,KAAK,UAAU,EAGhB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,iBAAiB,CAAC;AAIlE,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,KAAK,EAGV,qBAAqB,EACrB,eAAe,EAChB,MAAM,UAAU,CAAC;AAsBlB,sEAAsE;AACtE,QAAA,MAAM,cAAc;;;6CAgBlB,CAAC;AAEH,4CAA4C;AAC5C,QAAA,MAAM,YAAY;;;6CAiBhB,CAAC;AAEH;;;;;GAKG;AACH,QAAA,MAAM,aAAa;;;6CAYjB,CAAC;AAWH,8DAA8D;AAC9D,MAAM,WAAW,eAAe;IAC9B,+CAA+C;IAC/C,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,cAAc,CAAC,CAAC;IACvC,wCAAwC;IACxC,GAAG,CAAC,EAAE,QAAQ,CAAC,OAAO,YAAY,CAAC,CAAC;IACpC,kDAAkD;IAClD,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAC;IACtC,oFAAoF;IACpF,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACvC;AASD,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC9D,wDAAwD;IACxD,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,kGAAkG;IAClG,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAE7E,yDAAyD;IACzD,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B,6FAA6F;IAC7F,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,KAAK,mBAAmB,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,cAAc,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,CAAC,CAAC;AAEpG,MAAM,WAAW,cAAe,SAAQ,mBAAmB,EAAE,iBAAiB;IAC5E,0FAA0F;IAC1F,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,yFAAyF;IACzF,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,uFAAuF;IACvF,MAAM,EAAE,eAAe,CAAC;IAExB,gDAAgD;IAChD,IAAI,CAAC,EAAE,YAAY,CAAC;IAEpB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;CACtC;AAkKD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIpB,CAAC"}
1
+ {"version":3,"file":"YearsList.d.ts","sourceRoot":"","sources":["../../../src/YearsList/YearsList.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAEL,KAAK,QAAQ,EAEb,KAAK,UAAU,EAGhB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,iBAAiB,CAAC;AAMlE,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,KAAK,EAGV,qBAAqB,EACrB,eAAe,EAChB,MAAM,UAAU,CAAC;AAsBlB,sEAAsE;AACtE,QAAA,MAAM,cAAc;;;6CAgBlB,CAAC;AAEH,4CAA4C;AAC5C,QAAA,MAAM,YAAY;;;6CAiBhB,CAAC;AAEH;;;;;GAKG;AACH,QAAA,MAAM,aAAa;;;6CAYjB,CAAC;AAyIH,8DAA8D;AAC9D,MAAM,WAAW,eAAe;IAC9B,+CAA+C;IAC/C,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,cAAc,CAAC,CAAC;IACvC,wCAAwC;IACxC,GAAG,CAAC,EAAE,QAAQ,CAAC,OAAO,YAAY,CAAC,CAAC;IACpC,kDAAkD;IAClD,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAC;IACtC,oFAAoF;IACpF,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACvC;AASD,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC9D,wDAAwD;IACxD,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,kGAAkG;IAClG,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAE7E,yDAAyD;IACzD,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B,6FAA6F;IAC7F,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,KAAK,mBAAmB,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,cAAc,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,CAAC,CAAC;AAEpG,MAAM,WAAW,cAAe,SAAQ,mBAAmB,EAAE,iBAAiB;IAC5E,0FAA0F;IAC1F,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,yFAAyF;IACzF,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,uFAAuF;IACvF,MAAM,EAAE,eAAe,CAAC;IAExB,gDAAgD;IAChD,IAAI,CAAC,EAAE,YAAY,CAAC;IAEpB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;CACtC;AA2KD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIpB,CAAC"}
@@ -4,6 +4,12 @@ interface GetYearInTabOrderInput {
4
4
  years: DateStringValue[][];
5
5
  minDate: DateStringValue | undefined;
6
6
  maxDate: DateStringValue | undefined;
7
+ /**
8
+ * Consulted TWICE per year below (once for `disabled`, once for `selected`), so
9
+ * callers should pass a getter wrapped in `memoizeByDate` — the same wrapper they
10
+ * use for their own cell loop, so the whole render resolves each year's props
11
+ * exactly once. See `internal/memoize-control-props.ts`.
12
+ */
7
13
  getYearControlProps: ((year: DateStringValue) => Partial<PickerControlProps>) | undefined;
8
14
  }
9
15
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"get-year-in-tab-order.d.ts","sourceRoot":"","sources":["../../../../src/YearsList/get-year-in-tab-order/get-year-in-tab-order.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGnD,UAAU,sBAAsB;IAC9B,KAAK,EAAE,eAAe,EAAE,EAAE,CAAC;IAC3B,OAAO,EAAE,eAAe,GAAG,SAAS,CAAC;IACrC,OAAO,EAAE,eAAe,GAAG,SAAS,CAAC;IACrC,mBAAmB,EAAE,CAAC,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC,GAAG,SAAS,CAAC;CAC3F;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,OAAO,EACP,OAAO,EACP,mBAAmB,GACpB,EAAE,sBAAsB,GAAG,eAAe,GAAG,SAAS,CAqBtD"}
1
+ {"version":3,"file":"get-year-in-tab-order.d.ts","sourceRoot":"","sources":["../../../../src/YearsList/get-year-in-tab-order/get-year-in-tab-order.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGnD,UAAU,sBAAsB;IAC9B,KAAK,EAAE,eAAe,EAAE,EAAE,CAAC;IAC3B,OAAO,EAAE,eAAe,GAAG,SAAS,CAAC;IACrC,OAAO,EAAE,eAAe,GAAG,SAAS,CAAC;IACrC;;;;;OAKG;IACH,mBAAmB,EAAE,CAAC,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC,GAAG,SAAS,CAAC;CAC3F;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,OAAO,EACP,OAAO,EACP,mBAAmB,GACpB,EAAE,sBAAsB,GAAG,eAAe,GAAG,SAAS,CA0BtD"}
@@ -4,6 +4,18 @@ import type { DateStringValue } from "../../../types";
4
4
  * Mantine's `is-in-range`. The pair is sorted first (so callers may pass the
5
5
  * endpoints in either order), then the bounds are widened by 1ms to the day's
6
6
  * edges so the comparison is inclusive of both endpoints. Pure dayjs — no DOM.
7
+ *
8
+ * The Mantine spelling is the most expensive per-cell call in a range picker:
9
+ * `[...range].sort()` allocates an array and builds 2 dayjs instances inside the
10
+ * comparator, then each bound costs an instance plus `startOf`/`endOf` and
11
+ * `subtract`/`add` clones — ~11 instances per call, and `getControlProps` calls
12
+ * it for every cell (up to 3× per cell across the range/first/last checks).
13
+ *
14
+ * The widened bounds exist purely to make the endpoint comparison inclusive at
15
+ * DAY granularity, so for canonical zero-padded `YYYY-MM-DD` strings the whole
16
+ * thing reduces to `min <= date <= max` on the date prefix — exact, and with no
17
+ * sort, no clones and no allocations. Any non-canonical endpoint falls back to
18
+ * the original dayjs path.
7
19
  */
8
20
  export declare function isInRange(date: DateStringValue, range: [DateStringValue, DateStringValue]): boolean;
9
21
  //# sourceMappingURL=is-in-range.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-in-range.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/use-dates-state/is-in-range/is-in-range.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,eAAe,EACrB,KAAK,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC,GACxC,OAAO,CAMT"}
1
+ {"version":3,"file":"is-in-range.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/use-dates-state/is-in-range/is-in-range.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,eAAe,EACrB,KAAK,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC,GACxC,OAAO,CAeT"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-dates-state.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-dates-state/use-dates-state.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAEf,eAAe,EACf,eAAe,EAChB,MAAM,aAAa,CAAC;AAuBrB,wFAAwF;AACxF,UAAU,iBAAiB;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,oDAAoD;AACpD,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,iFAAiF;AACjF,UAAU,kBAAkB,CAC1B,IAAI,SAAS,cAAc,GAAG,SAAS,CACvC,SAAQ,eAAe,CAAC,IAAI,CAAC;IAC7B,uEAAuE;IACvE,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;IAEhC,6BAA6B;IAC7B,IAAI,EAAE,IAAI,CAAC;IAEX;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,IAAI,SAAS,cAAc,GAAG,SAAS,EAAE,EACrE,IAAI,EACJ,KAAK,EACL,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,sBAAsB,EACtB,aAAa,EACb,YAAY,GACb,EAAE,kBAAkB,CAAC,IAAI,CAAC;yBA8BG,eAAe;+BAvDpB,OAAO,KAAK,IAAI;gCAmLJ,eAAe;4BAxBnB,eAAe,KAAG,iBAAiB,GAAG,oBAAoB;;;EAwD1F"}
1
+ {"version":3,"file":"use-dates-state.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-dates-state/use-dates-state.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAEf,eAAe,EACf,eAAe,EAChB,MAAM,aAAa,CAAC;AAoBrB,wFAAwF;AACxF,UAAU,iBAAiB;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,oDAAoD;AACpD,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,iFAAiF;AACjF,UAAU,kBAAkB,CAC1B,IAAI,SAAS,cAAc,GAAG,SAAS,CACvC,SAAQ,eAAe,CAAC,IAAI,CAAC;IAC7B,uEAAuE;IACvE,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;IAEhC,6BAA6B;IAC7B,IAAI,EAAE,IAAI,CAAC;IAEX;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,IAAI,SAAS,cAAc,GAAG,SAAS,EAAE,EACrE,IAAI,EACJ,KAAK,EACL,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,sBAAsB,EACtB,aAAa,EACb,YAAY,GACb,EAAE,kBAAkB,CAAC,IAAI,CAAC;yBA8BG,eAAe;+BAvDpB,OAAO,KAAK,IAAI;gCAkMJ,eAAe;4BApBnB,eAAe,KAAG,iBAAiB,GAAG,oBAAoB;;;EAoD1F"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * One-level-deep `React.memo` comparator for a memoized grid cell.
3
+ *
4
+ * A plain shallow compare is not enough for these grids: a cell's per-item inputs
5
+ * arrive as FRESHLY BUILT objects on every render — the per-item prop getter
6
+ * (`getDayProps` / `getMonthControlProps` / `getYearControlProps`, which is
7
+ * `useDatesState`'s `getControlProps`) returns a new object by design, and
8
+ * `slotStyles().get()/merge()` likewise. Their CONTENTS, though, are stable
9
+ * booleans for all but the two or three cells whose state actually moved.
10
+ *
11
+ * So: compare props shallowly, and where both sides are plain objects, compare one
12
+ * level deeper. That is exactly deep enough to see "same selection state, new
13
+ * object" and shallow enough to stay O(props) — and it degrades safely, since any
14
+ * value it cannot prove equal (a nested object, a fresh function) reads as changed
15
+ * and simply re-renders the cell.
16
+ *
17
+ * Generic over the cell's props so each grid keeps its own precise props type; the
18
+ * comparator itself only ever reads keys and compares values.
19
+ */
20
+ export declare function areCellPropsEqual<P extends object>(prev: P, next: P): boolean;
21
+ //# sourceMappingURL=are-cell-props-equal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"are-cell-props-equal.d.ts","sourceRoot":"","sources":["../../../src/internal/are-cell-props-equal.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,OAAO,CA+B7E"}
@@ -0,0 +1,35 @@
1
+ /** Whether `value` is a canonical `YYYY-MM-DD…` string safe to compare as text. */
2
+ export declare function isCanonicalDateString(value: unknown): value is string;
3
+ /** Whether `value` starts with a canonical zero-padded `YYYY-MM`. */
4
+ export declare function isCanonicalYearMonthString(value: unknown): value is string;
5
+ /** Prefix length of a canonical date string that carries each granularity. */
6
+ declare const PREFIX_LENGTH: {
7
+ readonly year: 4;
8
+ readonly month: 7;
9
+ readonly day: 10;
10
+ };
11
+ /** The comparison granularities the pickers use (`useDatesState`'s `level`). */
12
+ export type DateGranularity = keyof typeof PREFIX_LENGTH;
13
+ /**
14
+ * `dayjs(a).isSame(b, level)` for canonical date strings, as a prefix compare.
15
+ *
16
+ * Returns `null` when either side is NOT canonical, so callers can fall back to
17
+ * the dayjs comparison rather than silently changing semantics — the same
18
+ * belt-and-braces shape as the predicates above.
19
+ *
20
+ * This is the single hottest comparison in a range picker: `getControlProps`
21
+ * runs it for `selected`, `firstInRange` and `lastInRange` on EVERY cell, so a
22
+ * 42-cell grid pays for it well over a hundred times per render — and a web
23
+ * hover move triggers a full re-render.
24
+ */
25
+ export declare function isSameByPrefix(a: string | null | undefined, b: string | null | undefined, level: DateGranularity): boolean | null;
26
+ /**
27
+ * `dayjs(a).isBefore(b)` for canonical date strings, as a prefix compare.
28
+ *
29
+ * Both sides parse to local midnight, so comparing the `YYYY-MM-DD` prefix
30
+ * lexicographically is equivalent to dayjs' millisecond comparison. Returns
31
+ * `null` when either side is not canonical.
32
+ */
33
+ export declare function isBeforeByPrefix(a: string | null | undefined, b: string | null | undefined): boolean | null;
34
+ export {};
35
+ //# sourceMappingURL=date-string-fast-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-string-fast-path.d.ts","sourceRoot":"","sources":["../../../src/internal/date-string-fast-path.ts"],"names":[],"mappings":"AAoCA,mFAAmF;AACnF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAErE;AAED,qEAAqE;AACrE,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE1E;AAED,8EAA8E;AAC9E,QAAA,MAAM,aAAa;;;;CAA0C,CAAC;AAE9D,gFAAgF;AAChF,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,aAAa,CAAC;AAEzD;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC5B,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC5B,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC5B,KAAK,EAAE,eAAe,GACrB,OAAO,GAAG,IAAI,CAOhB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC5B,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC3B,OAAO,GAAG,IAAI,CAMhB"}
@@ -0,0 +1,12 @@
1
+ import type { DateStringValue } from "../types";
2
+ /**
3
+ * Wrap a per-date prop getter so each distinct date is resolved at most once.
4
+ *
5
+ * Returns `undefined` when `getter` is `undefined`, preserving the optionality
6
+ * of the original prop so call sites keep their `getter?.(date)` shape and their
7
+ * result stays `T | undefined`. Call this ONCE PER RENDER and share the result
8
+ * with every consumer in that render — see the note above on why the cache must
9
+ * not be memoized across renders.
10
+ */
11
+ export declare function memoizeByDate<T>(getter: ((date: DateStringValue) => T) | undefined): ((date: DateStringValue) => T) | undefined;
12
+ //# sourceMappingURL=memoize-control-props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memoize-control-props.d.ts","sourceRoot":"","sources":["../../../src/internal/memoize-control-props.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,eAAe,KAAK,CAAC,CAAC,GAAG,SAAS,GACjD,CAAC,CAAC,IAAI,EAAE,eAAe,KAAK,CAAC,CAAC,GAAG,SAAS,CAmB5C"}
@@ -0,0 +1,19 @@
1
+ import type { DateStringValue, DayOfWeek } from "../types";
2
+ interface CachedMonthDaysInput {
3
+ /** Any date within the month to enumerate, `YYYY-MM-DD`. */
4
+ month: DateStringValue;
5
+ /** First weekday of each row. */
6
+ firstDayOfWeek: DayOfWeek;
7
+ /** Pad to a fixed 6 weeks so the grid height never shifts. */
8
+ consistentWeeks: boolean | undefined;
9
+ }
10
+ /**
11
+ * `getMonthDays` memoized on its three primitive inputs.
12
+ *
13
+ * The returned weeks array is SHARED — treat it as read-only. Callers also get a
14
+ * stable identity for a given key, so it can be passed straight to `useMemo` as a
15
+ * dependency.
16
+ */
17
+ export declare function getCachedMonthDays({ month, firstDayOfWeek, consistentWeeks, }: CachedMonthDaysInput): DateStringValue[][];
18
+ export {};
19
+ //# sourceMappingURL=month-days-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"month-days-cache.d.ts","sourceRoot":"","sources":["../../../src/internal/month-days-cache.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAQ3D,UAAU,oBAAoB;IAC5B,4DAA4D;IAC5D,KAAK,EAAE,eAAe,CAAC;IACvB,iCAAiC;IACjC,cAAc,EAAE,SAAS,CAAC;IAC1B,8DAA8D;IAC9D,eAAe,EAAE,OAAO,GAAG,SAAS,CAAC;CACtC;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,cAAc,EACd,eAAe,GAChB,EAAE,oBAAoB,GAAG,eAAe,EAAE,EAAE,CAuB5C"}
@@ -7,7 +7,15 @@ interface GetDateInTabOrderInput {
7
7
  minDate: DateStringValue | undefined;
8
8
  /** Upper bound, `YYYY-MM-DD`. */
9
9
  maxDate: DateStringValue | undefined;
10
- /** Per-day prop getter — its `disabled`/`selected` participate in the choice. */
10
+ /**
11
+ * Per-day prop getter — its `disabled`/`selected` participate in the choice.
12
+ *
13
+ * It is consulted TWICE per date below (once for `disabled`, once for
14
+ * `selected`), so callers should pass a getter wrapped in
15
+ * `memoizeByDate` — the same wrapper they use for their own cell loop, so the
16
+ * whole render resolves each date's props exactly once. See
17
+ * `internal/memoize-control-props.ts`.
18
+ */
11
19
  getDayProps: ((date: DateStringValue) => Partial<DayProps>) | undefined;
12
20
  /** Predicate marking a day disabled. */
13
21
  excludeDate: ((date: DateStringValue) => boolean) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"get-date-in-tab-order.d.ts","sourceRoot":"","sources":["../../../../src/utils/get-date-in-tab-order/get-date-in-tab-order.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAKnD,UAAU,sBAAsB;IAC9B,6EAA6E;IAC7E,KAAK,EAAE,eAAe,EAAE,EAAE,CAAC;IAC3B,iCAAiC;IACjC,OAAO,EAAE,eAAe,GAAG,SAAS,CAAC;IACrC,iCAAiC;IACjC,OAAO,EAAE,eAAe,GAAG,SAAS,CAAC;IACrC,iFAAiF;IACjF,WAAW,EAAE,CAAC,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,CAAC;IACxE,wCAAwC;IACxC,WAAW,EAAE,CAAC,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;IAC9D,uEAAuE;IACvE,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,yCAAyC;IACzC,KAAK,EAAE,eAAe,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,KAAK,GACN,EAAE,sBAAsB,GAAG,eAAe,GAAG,SAAS,CAyBtD"}
1
+ {"version":3,"file":"get-date-in-tab-order.d.ts","sourceRoot":"","sources":["../../../../src/utils/get-date-in-tab-order/get-date-in-tab-order.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAKnD,UAAU,sBAAsB;IAC9B,6EAA6E;IAC7E,KAAK,EAAE,eAAe,EAAE,EAAE,CAAC;IAC3B,iCAAiC;IACjC,OAAO,EAAE,eAAe,GAAG,SAAS,CAAC;IACrC,iCAAiC;IACjC,OAAO,EAAE,eAAe,GAAG,SAAS,CAAC;IACrC;;;;;;;;OAQG;IACH,WAAW,EAAE,CAAC,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,CAAC;IACxE,wCAAwC;IACxC,WAAW,EAAE,CAAC,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;IAC9D,uEAAuE;IACvE,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,yCAAyC;IACzC,KAAK,EAAE,eAAe,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,KAAK,GACN,EAAE,sBAAsB,GAAG,eAAe,GAAG,SAAS,CAgCtD"}
@@ -2,6 +2,12 @@ import type { DateStringValue } from "../../types";
2
2
  /**
3
3
  * Whether `date` is on or after `minDate` (no lower bound when `minDate` is
4
4
  * absent). Mirrors @mantine/dates `isAfterMinDate`.
5
+ *
6
+ * The lower-bound twin of `isBeforeMaxDate` — the dayjs spelling
7
+ * (`isAfter(minDate - 1 day, "day")`) is a day-granularity `>=`, exactly a
8
+ * lexicographic `>=` for canonical zero-padded `YYYY-MM-DD` strings. Same hot
9
+ * path (once per cell in `Month`, again in `getDateInTabOrder`), same fallback
10
+ * for non-canonical input.
5
11
  */
6
12
  export declare function isAfterMinDate(date: DateStringValue, minDate: DateStringValue | undefined): boolean;
7
13
  //# sourceMappingURL=is-after-min-date.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-after-min-date.d.ts","sourceRoot":"","sources":["../../../../src/utils/is-after-min-date/is-after-min-date.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,eAAe,GAAG,SAAS,GACnC,OAAO,CAET"}
1
+ {"version":3,"file":"is-after-min-date.d.ts","sourceRoot":"","sources":["../../../../src/utils/is-after-min-date/is-after-min-date.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,eAAe,GAAG,SAAS,GACnC,OAAO,CAUT"}
@@ -2,6 +2,12 @@ import type { DateStringValue } from "../../types";
2
2
  /**
3
3
  * Whether `date` is on or before `maxDate` (no upper bound when `maxDate` is
4
4
  * absent). Mirrors @mantine/dates `isBeforeMaxDate`.
5
+ *
6
+ * Called once per cell by `Month` and again by `getDateInTabOrder`. The dayjs
7
+ * spelling (`isBefore(maxDate + 1 day, "day")`) is a day-granularity `<=`, which
8
+ * for canonical zero-padded `YYYY-MM-DD` strings is exactly a lexicographic
9
+ * `<=` — same answer, no `add`, no clones, no allocations. Non-canonical input
10
+ * falls back to the original path.
5
11
  */
6
12
  export declare function isBeforeMaxDate(date: DateStringValue, maxDate: DateStringValue | undefined): boolean;
7
13
  //# sourceMappingURL=is-before-max-date.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-before-max-date.d.ts","sourceRoot":"","sources":["../../../../src/utils/is-before-max-date/is-before-max-date.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,eAAe,GAAG,SAAS,GACnC,OAAO,CAET"}
1
+ {"version":3,"file":"is-before-max-date.d.ts","sourceRoot":"","sources":["../../../../src/utils/is-before-max-date/is-before-max-date.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,eAAe,GAAG,SAAS,GACnC,OAAO,CAUT"}
@@ -1,4 +1,16 @@
1
1
  import type { DateStringValue } from "../../types";
2
- /** Whether two dates fall in the same calendar month. Mirrors @mantine/dates `isSameMonth`. */
2
+ /**
3
+ * Whether two dates fall in the same calendar month. Mirrors @mantine/dates
4
+ * `isSameMonth`.
5
+ *
6
+ * This is one of the hottest comparisons in the package — `Month` calls it once
7
+ * per cell (42×) to decide `outside`, and `getDateInTabOrder` calls it again per
8
+ * cell whenever `hideOutsideDates` is on (which `DatePicker` enables
9
+ * automatically for multiple columns). The dayjs spelling cost 2 instances plus
10
+ * 2 `format("YYYY-MM")` calls (locale lookup + regex replace) EACH TIME; for the
11
+ * canonical `YYYY-MM-DD` strings that are the actual inputs, comparing the
12
+ * `YYYY-MM` prefix is exact and allocates nothing. `Date` inputs (and any
13
+ * non-canonical string) keep the original dayjs path.
14
+ */
3
15
  export declare function isSameMonth(date: DateStringValue | Date, comparison: DateStringValue | Date): boolean;
4
16
  //# sourceMappingURL=is-same-month.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-same-month.d.ts","sourceRoot":"","sources":["../../../../src/utils/is-same-month/is-same-month.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,+FAA+F;AAC/F,wBAAgB,WAAW,CACzB,IAAI,EAAE,eAAe,GAAG,IAAI,EAC5B,UAAU,EAAE,eAAe,GAAG,IAAI,GACjC,OAAO,CAET"}
1
+ {"version":3,"file":"is-same-month.d.ts","sourceRoot":"","sources":["../../../../src/utils/is-same-month/is-same-month.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,eAAe,GAAG,IAAI,EAC5B,UAAU,EAAE,eAAe,GAAG,IAAI,GACjC,OAAO,CAMT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knitui/dates",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Date and time components for Knit UI.",
5
5
  "license": "MIT",
6
6
  "author": "The Haus <joost@the.haus>",
@@ -55,9 +55,9 @@
55
55
  "sideEffects": false,
56
56
  "dependencies": {
57
57
  "dayjs": "^1.11.13",
58
- "@knitui/components": "0.4.0",
59
- "@knitui/core": "0.4.0",
60
- "@knitui/hooks": "0.4.0"
58
+ "@knitui/components": "0.6.0",
59
+ "@knitui/core": "0.6.0",
60
+ "@knitui/hooks": "0.6.0"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "react": "*",
@@ -75,26 +75,26 @@
75
75
  },
76
76
  "devDependencies": {
77
77
  "@babel/core": "^7.25.0",
78
- "@storybook/addon-docs": "^10.4.1",
79
- "@storybook/react-vite": "^10.4.1",
80
- "@tamagui/build": "^2.3.0",
78
+ "@storybook/addon-docs": "^10.5.3",
79
+ "@storybook/react-vite": "^10.5.3",
80
+ "@tamagui/build": "^2.4.6",
81
81
  "@testing-library/jest-dom": "^6.6.3",
82
82
  "@testing-library/react": "^16.1.0",
83
83
  "@testing-library/user-event": "^14.5.2",
84
84
  "@types/jest": "^29.5.12",
85
85
  "@types/react": "~19.2.0",
86
- "@vitejs/plugin-react": "^6.0.2",
86
+ "@vitejs/plugin-react": "^6.0.3",
87
87
  "babel-jest": "^29.7.0",
88
- "babel-preset-expo": "^57.0.2",
88
+ "babel-preset-expo": "^57.0.3",
89
89
  "jest": "^29.7.0",
90
90
  "jest-environment-jsdom": "^29.7.0",
91
91
  "react": "19.2.3",
92
92
  "react-dom": "19.2.3",
93
93
  "react-native": "0.86.0",
94
- "react-native-builder-bob": "^0.40.5",
94
+ "react-native-builder-bob": "^0.43.0",
95
95
  "react-native-web": "~0.21.0",
96
- "storybook": "^10.4.1",
97
- "vite": "^8.0.14"
96
+ "storybook": "^10.5.3",
97
+ "vite": "^8.1.5"
98
98
  },
99
99
  "react-native-builder-bob": {
100
100
  "source": "src",
@@ -18,7 +18,7 @@
18
18
  // the ported `@mantine/dates` build (the upstream `tz`/dayjs-timezone layer is
19
19
  // not part of this port).
20
20
  // ───────────────────────────────────────────────────────────────────────────
21
- import { createContext, type ReactNode } from "react";
21
+ import { createContext, type ReactNode, useMemo } from "react";
22
22
 
23
23
  import type { DayOfWeek } from "../types";
24
24
 
@@ -70,11 +70,33 @@ export interface DatesProviderProps {
70
70
  * Components read it through `useDatesContext`.
71
71
  */
72
72
  export function DatesProvider({ settings, children }: DatesProviderProps) {
73
- return (
74
- <DatesProviderContext.Provider value={{ ...DATES_PROVIDER_DEFAULT_SETTINGS, ...settings }}>
75
- {children}
76
- </DatesProviderContext.Provider>
73
+ // The context value MUST keep a stable identity across renders. A context change
74
+ // propagates past every `React.memo` boundary below it, so an inline
75
+ // `value={{ ...defaults, ...settings }}` — a fresh object each render — defeats
76
+ // the memoized day cell (`Month`'s `MonthDayCell`) for all 42 cells of every
77
+ // month grid, which is exactly the boundary that keeps a web hover from
78
+ // re-rendering the whole calendar.
79
+ //
80
+ // `settings` itself is documented (and used throughout the stories/tests) as an
81
+ // INLINE literal, so memoizing on its identity would never hit. We therefore
82
+ // depend on the individual fields: the four primitives by value, and
83
+ // `weekendDays` by its joined value rather than its identity so an inlined
84
+ // `weekendDays={[0, 6]}` does not invalidate on every render either.
85
+ const { locale, firstDayOfWeek, weekendDays, labelSeparator, consistentWeeks } = settings;
86
+ const weekendDaysKey = weekendDays?.join(",");
87
+
88
+ const value = useMemo<DatesProviderValue>(
89
+ // The merge is kept verbatim (rather than rebuilt from the destructured
90
+ // locals) so the exact spread semantics are preserved — including a key that
91
+ // is present with an explicit `undefined`, which overrides its default.
92
+ () => ({ ...DATES_PROVIDER_DEFAULT_SETTINGS, ...settings }),
93
+ // `settings` is read inside but deliberately NOT a dependency — that is the
94
+ // whole point (see above); `weekendDays` is depended on via `weekendDaysKey`.
95
+ // eslint-disable-next-line react-hooks/exhaustive-deps
96
+ [locale, firstDayOfWeek, weekendDaysKey, labelSeparator, consistentWeeks],
77
97
  );
98
+
99
+ return <DatesProviderContext.Provider value={value}>{children}</DatesProviderContext.Provider>;
78
100
  }
79
101
 
80
102
  DatesProvider.displayName = "@knitui/dates/DatesProvider";
package/src/Day/Day.tsx CHANGED
@@ -1,12 +1,12 @@
1
1
  import * as React from "react";
2
2
 
3
- import dayjs from "dayjs";
3
+ import dayjs, { type Dayjs } from "dayjs";
4
4
 
5
5
  import { Text, UnstyledButton } from "@knitui/components";
6
6
  import { createStyledContext, type GetProps, styled, withStaticProperties } from "@knitui/core";
7
7
 
8
8
  import { type CalendarSize, CELL_FONT, CELL_WIDTH } from "../cell-metrics";
9
- import { useDatesContext } from "../DatesProvider";
9
+ import { DatesProviderContext } from "../DatesProvider";
10
10
  import { controlA11yProps } from "../internal/a11y";
11
11
  import { webCursor } from "../internal/web-cursor";
12
12
  import type { DateStringValue } from "../types";
@@ -51,6 +51,26 @@ const dayFontVariant = {
51
51
 
52
52
  const DayContext = createStyledContext<{ size: DaySize }>({ size: "md" });
53
53
 
54
+ /**
55
+ * Whether `day` falls on today's LOCAL calendar date, compared without
56
+ * allocating a single extra dayjs instance.
57
+ *
58
+ * `day.isSame(new Date(), "day")` — the obvious spelling — costs a `Date`, a
59
+ * dayjs instance wrapping it, and two more clones for dayjs' internal
60
+ * `startOf`/`endOf` bracket, i.e. ~4 allocations PER CELL (×42 cells, every
61
+ * render). Reading the three calendar fields off the instance we already have
62
+ * is exact (`year`/`month`/`date` are plain field reads, no clone) and costs
63
+ * only the one `Date` for "now".
64
+ */
65
+ function isSameDayAsToday(day: Dayjs): boolean {
66
+ const now = new Date();
67
+ return (
68
+ day.date() === now.getDate() &&
69
+ day.month() === now.getMonth() &&
70
+ day.year() === now.getFullYear()
71
+ );
72
+ }
73
+
54
74
  /**
55
75
  * The atomic calendar cell — an `UnstyledButton`-based control composed via
56
76
  * `styled`. Accent comes from the active theme's palette ramp via the `theme`
@@ -281,16 +301,37 @@ const DayComponent = DayFrame.styleable<DayProps>(function Day(props, ref) {
281
301
  ...rest
282
302
  } = props;
283
303
 
284
- const ctx = useDatesContext();
304
+ // The RAW context, not `useDatesContext()`. The hook's four `useCallback` getter
305
+ // helpers are convenience for components that resolve several settings; `Day`
306
+ // needs exactly one value — the locale for its fallback label — and it is the
307
+ // grid's hottest leaf (42 instances per month × `numberOfColumns`, all
308
+ // re-rendering on a hover frame). Going through the hook there cost 42 extra
309
+ // hook subscriptions and ~168 freshly allocated closures per grid render for a
310
+ // single string read. `locale || ctx.locale` below is the getter's body verbatim
311
+ // (`getLocale = (input) => input || ctx.locale`), so a standalone `<Day>`
312
+ // resolves its locale exactly as before.
313
+ const ctx = React.useContext(DatesProviderContext);
285
314
  const day = dayjs(date);
286
- const isToday = day.isSame(new Date(), "day");
315
+
316
+ // Only the `highlightToday` border consults "is this today", so the comparison
317
+ // is skipped entirely when the border is off (the default).
318
+ const isToday = highlightToday && isSameDayAsToday(day);
287
319
 
288
320
  // Locale-aware default label, read from `DatesProvider`. A static (display-only)
289
- // day announces nothing — it is not an interactive date. An explicit
290
- // `aria-label` in `...rest` still wins (it is spread last).
291
- const defaultAriaLabel = isStatic
321
+ // day announces nothing — it is not an interactive date.
322
+ //
323
+ // An explicit `aria-label` WINS, so it is read up-front and the fallback is
324
+ // only built when there is none: `Month` always passes its own `aria-label`
325
+ // through `...rest` (spread last), which means computing the fallback there
326
+ // was pure waste — a locale clone plus `format("D MMMM YYYY")`, the most
327
+ // expensive token set in the file, for a string that was always discarded,
328
+ // ×42 cells every render. Reading the explicit label here also means NATIVE
329
+ // (`accessibilityLabel` below) now announces the same custom label web does,
330
+ // instead of the generic date it used to fall back to.
331
+ const explicitAriaLabel = props["aria-label"];
332
+ const ariaLabel = isStatic
292
333
  ? undefined
293
- : day.locale(ctx.getLocale(locale)).format("D MMMM YYYY");
334
+ : (explicitAriaLabel ?? day.locale(locale || ctx.locale).format("D MMMM YYYY"));
294
335
 
295
336
  // Mirror Mantine's data-attribute gating: a disabled day shows none of the
296
337
  // selection/range/weekend/outside styling, and today's border is suppressed
@@ -327,7 +368,7 @@ const DayComponent = DayFrame.styleable<DayProps>(function Day(props, ref) {
327
368
  fullWidth={fullWidth}
328
369
  disabled={disabled}
329
370
  role={isStatic ? "presentation" : "button"}
330
- aria-label={defaultAriaLabel}
371
+ aria-label={ariaLabel}
331
372
  aria-selected={isSelected || undefined}
332
373
  aria-disabled={disabled || undefined}
333
374
  aria-hidden={hidden || undefined}
@@ -335,7 +376,7 @@ const DayComponent = DayFrame.styleable<DayProps>(function Day(props, ref) {
335
376
  // a static display cell announces nothing interactive (`role="none"`).
336
377
  {...controlA11yProps({
337
378
  role: isStatic ? "none" : "button",
338
- label: defaultAriaLabel,
379
+ label: ariaLabel,
339
380
  selected: isSelected,
340
381
  disabled,
341
382
  })}
@@ -46,8 +46,7 @@ import { getDecadeRange } from "./get-decade-range/get-decade-range";
46
46
 
47
47
  /** Two-arg decade label format — receives the start and end of the decade. */
48
48
  export type DecadeLabelFormat =
49
- | string
50
- | ((startOfDecade: DateStringValue, endOfDecade: DateStringValue) => React.ReactNode);
49
+ string | ((startOfDecade: DateStringValue, endOfDecade: DateStringValue) => React.ReactNode);
51
50
 
52
51
  export interface DecadeLevelBaseSettings extends YearsListSettings {
53
52
  /** dayjs format for the decade label, or a function returning it. @default 'YYYY' */