@ceed/cds 0.0.186 → 0.0.187-cjs.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 (259) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +33 -0
  2. package/dist/_virtual/bind-all.js +5 -0
  3. package/dist/_virtual/bind.js +5 -0
  4. package/dist/_virtual/colorManipulator.js +7 -0
  5. package/dist/_virtual/colorManipulator2.js +5 -0
  6. package/dist/_virtual/createStyled.js +9 -0
  7. package/dist/_virtual/createStyled2.js +5 -0
  8. package/dist/_virtual/extends.js +5 -0
  9. package/dist/_virtual/index.js +7 -0
  10. package/dist/_virtual/index10.js +8 -0
  11. package/dist/_virtual/index11.js +12 -0
  12. package/dist/_virtual/index12.js +12 -0
  13. package/dist/_virtual/index2.js +5 -0
  14. package/dist/_virtual/index3.js +9 -0
  15. package/dist/_virtual/index4.js +5 -0
  16. package/dist/_virtual/index5.js +8 -0
  17. package/dist/_virtual/index6.js +8 -0
  18. package/dist/_virtual/index7.js +12 -0
  19. package/dist/_virtual/index8.js +8 -0
  20. package/dist/_virtual/index9.js +8 -0
  21. package/dist/_virtual/interopRequireDefault.js +5 -0
  22. package/dist/_virtual/objectWithoutPropertiesLoose.js +5 -0
  23. package/dist/components/Accordions/Accordions.js +48 -0
  24. package/dist/components/Autocomplete/Autocomplete.js +198 -0
  25. package/dist/components/Autocomplete/index.js +10 -0
  26. package/dist/components/Avatar/Avatar.js +47 -0
  27. package/dist/components/Box/Box.js +10 -0
  28. package/dist/components/Box/index.js +10 -0
  29. package/dist/components/Breadcrumbs/Breadcrumbs.js +49 -0
  30. package/dist/components/Button/Button.js +22 -0
  31. package/dist/components/Button/index.js +10 -0
  32. package/dist/components/Calendar/Calendar.js +335 -0
  33. package/dist/components/Calendar/hooks/use-calendar-props.js +76 -0
  34. package/dist/components/Calendar/hooks/use-calendar.js +249 -0
  35. package/dist/components/Calendar/index.js +10 -0
  36. package/dist/components/Calendar/utils/index.js +84 -0
  37. package/dist/components/Card/Card.js +26 -0
  38. package/dist/components/Checkbox/Checkbox.js +21 -0
  39. package/dist/components/Checkbox/index.js +10 -0
  40. package/dist/components/Chip/Chip.js +10 -0
  41. package/dist/components/Chip/index.js +10 -0
  42. package/dist/components/Container/Container.js +51 -0
  43. package/dist/components/CurrencyInput/CurrencyInput.js +93 -0
  44. package/dist/components/CurrencyInput/hooks/use-currency-setting.js +169 -0
  45. package/dist/components/CurrencyInput/index.js +10 -0
  46. package/dist/components/DataTable/DataTable.js +570 -0
  47. package/dist/components/DatePicker/DatePicker.js +212 -0
  48. package/dist/components/DatePicker/index.js +10 -0
  49. package/dist/components/DateRangePicker/DateRangePicker.js +215 -0
  50. package/dist/components/DialogActions/DialogActions.js +16 -0
  51. package/dist/components/DialogActions/index.js +10 -0
  52. package/dist/components/DialogContent/DialogContent.js +13 -0
  53. package/dist/components/DialogContent/index.js +10 -0
  54. package/dist/components/DialogFrame/DialogFrame.js +33 -0
  55. package/dist/components/DialogTitle/DialogTitle.js +13 -0
  56. package/dist/components/DialogTitle/index.js +10 -0
  57. package/dist/components/Divider/Divider.js +21 -0
  58. package/dist/components/Drawer/Drawer.js +42 -0
  59. package/dist/components/Dropdown/Dropdown.js +10 -0
  60. package/dist/components/Dropdown/index.js +10 -0
  61. package/dist/components/FormControl/FormControl.js +17 -0
  62. package/dist/components/FormControl/index.js +10 -0
  63. package/dist/components/FormHelperText/FormHelperText.js +10 -0
  64. package/dist/components/FormHelperText/index.js +10 -0
  65. package/dist/components/FormLabel/FormLabel.js +10 -0
  66. package/dist/components/FormLabel/index.js +10 -0
  67. package/dist/components/IconButton/IconButton.js +22 -0
  68. package/dist/components/IconButton/index.js +10 -0
  69. package/dist/components/Input/Input.js +62 -0
  70. package/dist/components/Input/index.js +10 -0
  71. package/dist/components/InsetDrawer/InsetDrawer.js +32 -0
  72. package/dist/components/Markdown/Markdown.d.ts +6 -22
  73. package/dist/components/Markdown/Markdown.js +86 -0
  74. package/dist/components/Menu/Menu.js +46 -0
  75. package/dist/components/Menu/index.js +11 -0
  76. package/dist/components/MenuButton/MenuButton.d.ts +1 -1
  77. package/dist/components/MenuButton/MenuButton.js +28 -0
  78. package/dist/components/Modal/Modal.js +49 -0
  79. package/dist/components/MonthPicker/MonthPicker.js +164 -0
  80. package/dist/components/MonthRangePicker/MonthRangePicker.js +174 -0
  81. package/dist/components/NavigationGroup/NavigationGroup.js +44 -0
  82. package/dist/components/NavigationItem/NavigationItem.js +47 -0
  83. package/dist/components/Navigator/Navigator.js +32 -0
  84. package/dist/components/Pagination/Pagination.js +119 -0
  85. package/dist/components/Pagination/index.js +10 -0
  86. package/dist/components/PercentageInput/PercentageInput.js +87 -0
  87. package/dist/components/Radio/Radio.js +14 -0
  88. package/dist/components/RadioList/RadioList.js +20 -0
  89. package/dist/components/Select/Select.js +59 -0
  90. package/dist/components/Select/index.js +11 -0
  91. package/dist/components/Sheet/Sheet.js +10 -0
  92. package/dist/components/Sheet/index.js +10 -0
  93. package/dist/components/Stack/index.js +16 -0
  94. package/dist/components/Stepper/Stepper.js +70 -0
  95. package/dist/components/Switch/Switch.js +48 -0
  96. package/dist/components/Table/Table.js +68 -0
  97. package/dist/components/Tabs/Tabs.js +22 -0
  98. package/dist/components/Textarea/Textarea.d.ts +3 -17
  99. package/dist/components/Textarea/Textarea.js +33 -0
  100. package/dist/components/Textarea/index.js +10 -0
  101. package/dist/components/ThemeProvider/ThemeProvider.js +250 -0
  102. package/dist/components/Tooltip/Tooltip.js +21 -0
  103. package/dist/components/Tooltip/index.js +10 -0
  104. package/dist/components/Typography/Typography.js +21 -0
  105. package/dist/components/Typography/index.js +10 -0
  106. package/dist/components/Uploader/Uploader.d.ts +1 -1
  107. package/dist/components/Uploader/Uploader.js +366 -0
  108. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/element-adapter-native-data-key.js +10 -0
  109. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/external-adapter.js +251 -0
  110. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/get-element-from-point-without-honey-pot.js +21 -0
  111. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/honey-pot-data-attribute.js +7 -0
  112. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/is-honey-pot-element.js +9 -0
  113. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/dispatch-consumer-event.js +130 -0
  114. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/lifecycle-manager.js +342 -0
  115. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/usage-ledger.js +35 -0
  116. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-adapter.js +62 -0
  117. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-drop-target.js +314 -0
  118. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-monitor.js +98 -0
  119. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/combine.js +15 -0
  120. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/external/file.js +26 -0
  121. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/once.js +20 -0
  122. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/prevent-unhandled.js +104 -0
  123. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/add-attribute.js +12 -0
  124. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/android.js +5 -0
  125. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/count-events-for-safari.js +126 -0
  126. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-entering-window.js +57 -0
  127. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-from-another-window.js +20 -0
  128. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-leaving-window.js +57 -0
  129. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/detect-broken-drag.js +51 -0
  130. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/get-input.js +18 -0
  131. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/is-firefox.js +17 -0
  132. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/is-safari.js +20 -0
  133. package/dist/external/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/media-types/text-media-type.js +10 -0
  134. package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/arrayLikeToArray.js +9 -0
  135. package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/arrayWithHoles.js +7 -0
  136. package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/arrayWithoutHoles.js +9 -0
  137. package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/defineProperty.js +20 -0
  138. package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/iterableToArray.js +7 -0
  139. package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/iterableToArrayLimit.js +28 -0
  140. package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/nonIterableRest.js +7 -0
  141. package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/nonIterableSpread.js +7 -0
  142. package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/slicedToArray.js +12 -0
  143. package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/toConsumableArray.js +12 -0
  144. package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/toPrimitive.js +16 -0
  145. package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/toPropertyKey.js +11 -0
  146. package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/typeof.js +13 -0
  147. package/dist/external/@atlaskit/pragmatic-drag-and-drop/external/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +14 -0
  148. package/dist/external/@babel/runtime/helpers/esm/extends.js +18 -0
  149. package/dist/external/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +16 -0
  150. package/dist/external/@babel/runtime/helpers/extends.js +30 -0
  151. package/dist/external/@babel/runtime/helpers/interopRequireDefault.js +21 -0
  152. package/dist/external/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +28 -0
  153. package/dist/external/@emotion/cache/dist/emotion-cache.esm.js +655 -0
  154. package/dist/external/@emotion/memoize/dist/emotion-memoize.esm.js +11 -0
  155. package/dist/external/@emotion/sheet/dist/emotion-sheet.esm.js +156 -0
  156. package/dist/external/@emotion/weak-memoize/dist/emotion-weak-memoize.esm.js +18 -0
  157. package/dist/external/@mui/icons-material/esm/ArrowUpwardRounded.js +10 -0
  158. package/dist/external/@mui/icons-material/esm/CalendarToday.js +10 -0
  159. package/dist/external/@mui/icons-material/esm/Check.js +10 -0
  160. package/dist/external/@mui/icons-material/esm/ChevronLeft.js +10 -0
  161. package/dist/external/@mui/icons-material/esm/ChevronRight.js +10 -0
  162. package/dist/external/@mui/icons-material/esm/ClearRounded.js +10 -0
  163. package/dist/external/@mui/icons-material/esm/Close.js +10 -0
  164. package/dist/external/@mui/icons-material/esm/CloudUploadRounded.js +10 -0
  165. package/dist/external/@mui/icons-material/esm/ExpandMore.js +10 -0
  166. package/dist/external/@mui/icons-material/esm/Info.js +10 -0
  167. package/dist/external/@mui/icons-material/esm/UploadFileRounded.js +10 -0
  168. package/dist/external/@mui/material/SvgIcon/SvgIcon.js +207 -0
  169. package/dist/external/@mui/material/SvgIcon/svgIconClasses.js +11 -0
  170. package/dist/external/@mui/material/colors/blue.js +20 -0
  171. package/dist/external/@mui/material/colors/common.js +8 -0
  172. package/dist/external/@mui/material/colors/green.js +20 -0
  173. package/dist/external/@mui/material/colors/grey.js +20 -0
  174. package/dist/external/@mui/material/colors/lightBlue.js +20 -0
  175. package/dist/external/@mui/material/colors/orange.js +20 -0
  176. package/dist/external/@mui/material/colors/purple.js +20 -0
  177. package/dist/external/@mui/material/colors/red.js +20 -0
  178. package/dist/external/@mui/material/styles/createMixins.js +21 -0
  179. package/dist/external/@mui/material/styles/createPalette.js +314 -0
  180. package/dist/external/@mui/material/styles/createTheme.js +84 -0
  181. package/dist/external/@mui/material/styles/createTransitions.js +97 -0
  182. package/dist/external/@mui/material/styles/createTypography.js +95 -0
  183. package/dist/external/@mui/material/styles/defaultTheme.js +7 -0
  184. package/dist/external/@mui/material/styles/identifier.js +5 -0
  185. package/dist/external/@mui/material/styles/rootShouldForwardProp.js +7 -0
  186. package/dist/external/@mui/material/styles/shadows.js +13 -0
  187. package/dist/external/@mui/material/styles/slotShouldForwardProp.js +8 -0
  188. package/dist/external/@mui/material/styles/styled.js +17 -0
  189. package/dist/external/@mui/material/styles/useThemeProps.js +19 -0
  190. package/dist/external/@mui/material/styles/zIndex.js +16 -0
  191. package/dist/external/@mui/material/utils/capitalize.js +7 -0
  192. package/dist/external/@mui/material/utils/createSvgIcon.js +45 -0
  193. package/dist/external/@mui/styled-engine/GlobalStyles/GlobalStyles.js +26 -0
  194. package/dist/external/@mui/styled-engine/StyledEngineProvider/StyledEngineProvider.js +39 -0
  195. package/dist/external/@mui/styled-engine/index.js +57 -0
  196. package/dist/external/@mui/system/colorManipulator.js +387 -0
  197. package/dist/external/@mui/system/createStyled.js +272 -0
  198. package/dist/external/@mui/system/esm/borders.js +66 -0
  199. package/dist/external/@mui/system/esm/breakpoints.js +71 -0
  200. package/dist/external/@mui/system/esm/compose.js +28 -0
  201. package/dist/external/@mui/system/esm/createTheme/applyStyles.js +78 -0
  202. package/dist/external/@mui/system/esm/createTheme/createBreakpoints.js +84 -0
  203. package/dist/external/@mui/system/esm/createTheme/createSpacing.js +36 -0
  204. package/dist/external/@mui/system/esm/createTheme/createTheme.js +47 -0
  205. package/dist/external/@mui/system/esm/createTheme/index.js +13 -0
  206. package/dist/external/@mui/system/esm/createTheme/shape.js +7 -0
  207. package/dist/external/@mui/system/esm/cssGrid.js +99 -0
  208. package/dist/external/@mui/system/esm/memoize.js +13 -0
  209. package/dist/external/@mui/system/esm/merge.js +14 -0
  210. package/dist/external/@mui/system/esm/palette.js +33 -0
  211. package/dist/external/@mui/system/esm/responsivePropType.js +7 -0
  212. package/dist/external/@mui/system/esm/sizing.js +76 -0
  213. package/dist/external/@mui/system/esm/spacing.js +153 -0
  214. package/dist/external/@mui/system/esm/style.js +83 -0
  215. package/dist/external/@mui/system/esm/styleFunctionSx/defaultSxConfig.js +295 -0
  216. package/dist/external/@mui/system/esm/styleFunctionSx/extendSxProp.js +53 -0
  217. package/dist/external/@mui/system/esm/styleFunctionSx/index.js +14 -0
  218. package/dist/external/@mui/system/esm/styleFunctionSx/styleFunctionSx.js +134 -0
  219. package/dist/external/@mui/system/esm/useTheme.js +14 -0
  220. package/dist/external/@mui/system/esm/useThemeProps/getThemeProps.js +17 -0
  221. package/dist/external/@mui/system/esm/useThemeProps/useThemeProps.js +24 -0
  222. package/dist/external/@mui/system/esm/useThemeWithoutDefault.js +33 -0
  223. package/dist/external/@mui/utils/ClassNameGenerator/ClassNameGenerator.js +20 -0
  224. package/dist/external/@mui/utils/capitalize/capitalize.js +16 -0
  225. package/dist/external/@mui/utils/capitalize/index.js +7 -0
  226. package/dist/external/@mui/utils/clamp/clamp.js +7 -0
  227. package/dist/external/@mui/utils/clamp/index.js +7 -0
  228. package/dist/external/@mui/utils/composeClasses/composeClasses.js +25 -0
  229. package/dist/external/@mui/utils/deepmerge/deepmerge.js +49 -0
  230. package/dist/external/@mui/utils/deepmerge/index.js +10 -0
  231. package/dist/external/@mui/utils/formatMuiErrorMessage/formatMuiErrorMessage.js +23 -0
  232. package/dist/external/@mui/utils/formatMuiErrorMessage/index.js +7 -0
  233. package/dist/external/@mui/utils/generateUtilityClass/generateUtilityClass.js +27 -0
  234. package/dist/external/@mui/utils/generateUtilityClasses/generateUtilityClasses.js +13 -0
  235. package/dist/external/@mui/utils/getDisplayName/getDisplayName.js +54 -0
  236. package/dist/external/@mui/utils/getDisplayName/index.js +10 -0
  237. package/dist/external/@mui/utils/resolveProps/resolveProps.js +39 -0
  238. package/dist/external/bind-event-listener/dist/bind-all.js +56 -0
  239. package/dist/external/bind-event-listener/dist/bind.js +23 -0
  240. package/dist/external/bind-event-listener/dist/index.js +23 -0
  241. package/dist/external/clsx/dist/clsx.js +8 -0
  242. package/dist/external/object-assign/index.js +101 -0
  243. package/dist/external/prop-types/checkPropTypes.js +117 -0
  244. package/dist/external/prop-types/factoryWithThrowingShims.js +76 -0
  245. package/dist/external/prop-types/factoryWithTypeCheckers.js +627 -0
  246. package/dist/external/prop-types/index.js +35 -0
  247. package/dist/external/prop-types/lib/ReactPropTypesSecret.js +23 -0
  248. package/dist/external/prop-types/lib/has.js +13 -0
  249. package/dist/external/raf-schd/dist/raf-schd.esm.js +36 -0
  250. package/dist/external/stylis/src/Enum.js +22 -0
  251. package/dist/external/stylis/src/Middleware.js +35 -0
  252. package/dist/external/stylis/src/Parser.js +199 -0
  253. package/dist/external/stylis/src/Serializer.js +41 -0
  254. package/dist/external/stylis/src/Tokenizer.js +241 -0
  255. package/dist/external/stylis/src/Utility.js +132 -0
  256. package/dist/hooks/use-controlled-state/index.js +25 -0
  257. package/dist/index.js +521 -2
  258. package/dist/libs/rehype-accent/index.js +41 -0
  259. package/package.json +8 -5
@@ -0,0 +1,335 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var joy = require('@mui/joy');
5
+ var ChevronLeft = require('../../external/@mui/icons-material/esm/ChevronLeft.js');
6
+ var ChevronRight = require('../../external/@mui/icons-material/esm/ChevronRight.js');
7
+ var framerMotion = require('framer-motion');
8
+ var Button = require('../Button/Button.js');
9
+ var Typography = require('../Typography/Typography.js');
10
+ var index = require('./utils/index.js');
11
+ var IconButton = require('../IconButton/IconButton.js');
12
+ var useCalendarProps = require('./hooks/use-calendar-props.js');
13
+ var useCalendar = require('./hooks/use-calendar.js');
14
+
15
+ const CalendarRoot = joy.styled("div", {
16
+ name: "Calendar",
17
+ slot: "root",
18
+ })({
19
+ maxWidth: "264px",
20
+ });
21
+ const CalendarHeader = joy.styled("div", {
22
+ name: "Calendar",
23
+ slot: "calendarHeader",
24
+ })(({ theme }) => ({
25
+ display: "flex",
26
+ justifyContent: "space-between",
27
+ alignItems: "center",
28
+ padding: theme.spacing(2),
29
+ }));
30
+ const CalendarViewContainer = joy.styled("div", {
31
+ name: "Calendar",
32
+ slot: "viewContainer",
33
+ shouldForwardProp: (prop) => prop !== "calendarType",
34
+ })(({ theme, calendarType }) => ({
35
+ paddingLeft: theme.spacing(2),
36
+ paddingRight: theme.spacing(2),
37
+ position: "relative",
38
+ overflow: "hidden",
39
+ minHeight: calendarType === "datePicker" ? "250px" : "unset",
40
+ }));
41
+ const CalendarViewTable = joy.styled(framerMotion.motion.table, {
42
+ name: "Calendar",
43
+ slot: "viewTable",
44
+ })(({ theme }) => ({
45
+ borderSpacing: 0,
46
+ "& td, & th": {
47
+ padding: 0,
48
+ },
49
+ "& th": {
50
+ paddingTop: theme.spacing(2),
51
+ paddingBottom: theme.spacing(2),
52
+ },
53
+ }));
54
+ const CalendarWeekHeaderContainer = joy.styled("thead", {
55
+ name: "Calendar",
56
+ slot: "weekHeaderContainer",
57
+ })({});
58
+ const CalendarDayPickerContainer = joy.styled("tbody", {
59
+ name: "Calendar",
60
+ slot: "dayPickerContainer",
61
+ })({});
62
+ const CalendarSwitchViewButton = joy.styled(Button.Button, {
63
+ name: "Calendar",
64
+ slot: "switchViewButton",
65
+ })(({ ownerState }) => [
66
+ ownerState.view === "month" && {
67
+ pointerEvents: "none",
68
+ },
69
+ ]);
70
+ const CalendarDayCell = joy.styled("td", {
71
+ name: "Calendar",
72
+ slot: "dayCell",
73
+ })(({ theme }) => ({
74
+ // aria-current=date === range에 포함된 버튼
75
+ "&[aria-current=date]": {
76
+ position: "relative",
77
+ "& button[aria-current=date]:not([aria-selected=true]):not(:hover):not(:active)": {
78
+ backgroundColor: `rgb(${theme.palette.primary.lightChannel})`,
79
+ },
80
+ '& + td[aria-hidden] + td[aria-current="date"]::before': {
81
+ content: '""',
82
+ position: "absolute",
83
+ top: 0,
84
+ left: "-10px",
85
+ bottom: 0,
86
+ width: "16px",
87
+ backgroundColor: `rgb(${theme.palette.primary.lightChannel})`,
88
+ zIndex: -1,
89
+ },
90
+ },
91
+ }));
92
+ const CalendarMonthCell = joy.styled("td", {
93
+ name: "Calendar",
94
+ slot: "monthCell",
95
+ })(({ theme }) => ({
96
+ // aria-current=date === range에 포함된 버튼
97
+ "&[aria-current=date]": {
98
+ position: "relative",
99
+ "& button[aria-current=date]:not([aria-selected=true]):not(:hover):not(:active)": {
100
+ backgroundColor: `rgb(${theme.palette.primary.lightChannel})`,
101
+ },
102
+ '& + td[aria-hidden] + td[aria-current="date"]::before': {
103
+ content: '""',
104
+ position: "absolute",
105
+ top: 0,
106
+ left: "-10px",
107
+ bottom: 0,
108
+ width: "16px",
109
+ backgroundColor: `rgb(${theme.palette.primary.lightChannel})`,
110
+ zIndex: -1,
111
+ },
112
+ },
113
+ }));
114
+ const CalendarMonth = joy.styled(Button.Button, {
115
+ name: "Calendar",
116
+ slot: "month",
117
+ shouldForwardProp: (prop) => prop !== "isSelected",
118
+ })(({ theme, isSelected, disabled }) => [
119
+ {
120
+ width: "59px",
121
+ // height: "32px",
122
+ textAlign: "center",
123
+ "&:hover": {
124
+ color: theme.palette.primary.softColor,
125
+ backgroundColor: theme.palette.primary.softHoverBg,
126
+ },
127
+ "&:active": {
128
+ color: theme.palette.primary.softColor,
129
+ backgroundColor: theme.palette.primary.softActiveBg,
130
+ },
131
+ },
132
+ isSelected && {
133
+ backgroundColor: theme.palette.primary.solidBg,
134
+ color: theme.palette.primary.solidColor,
135
+ "&:hover": {
136
+ color: theme.palette.primary.solidColor,
137
+ backgroundColor: theme.palette.primary.solidHoverBg,
138
+ },
139
+ "&:active": {
140
+ color: theme.palette.primary.solidColor,
141
+ backgroundColor: theme.palette.primary.solidActiveBg,
142
+ },
143
+ },
144
+ disabled && {
145
+ color: theme.palette.neutral.solidDisabledColor,
146
+ backgroundColor: theme.palette.neutral.solidDisabledBg,
147
+ },
148
+ ]);
149
+ const CalendarDay = joy.styled(Button.Button, {
150
+ name: "Calendar",
151
+ slot: "day",
152
+ shouldForwardProp: (prop) => !["isToday", "isSelected"].includes(prop),
153
+ })(({ theme, isToday, isSelected, disabled }) => [
154
+ {
155
+ width: "32px",
156
+ height: "32px",
157
+ textAlign: "center",
158
+ "&:hover": {
159
+ color: theme.palette.primary.softColor,
160
+ backgroundColor: theme.palette.primary.softHoverBg,
161
+ },
162
+ "&:active": {
163
+ color: theme.palette.primary.softColor,
164
+ backgroundColor: theme.palette.primary.softActiveBg,
165
+ },
166
+ },
167
+ // NOTE: enabled, disabled 일때만 border 적용
168
+ isToday &&
169
+ !isSelected && {
170
+ "&:not([aria-current=date]):not(:hover)": {
171
+ border: `1px solid ${theme.palette.neutral.outlinedBorder}`,
172
+ },
173
+ },
174
+ isSelected && {
175
+ backgroundColor: theme.palette.primary.solidBg,
176
+ color: theme.palette.primary.solidColor,
177
+ "&:hover": {
178
+ color: theme.palette.primary.solidColor,
179
+ backgroundColor: theme.palette.primary.solidHoverBg,
180
+ },
181
+ "&:active": {
182
+ color: theme.palette.primary.solidColor,
183
+ backgroundColor: theme.palette.primary.solidActiveBg,
184
+ },
185
+ },
186
+ disabled && {
187
+ color: theme.palette.neutral.solidDisabledColor,
188
+ backgroundColor: theme.palette.neutral.solidDisabledBg,
189
+ },
190
+ ]);
191
+ const variants = {
192
+ enter: (direction) => {
193
+ return {
194
+ x: direction > 0 ? 300 : -300,
195
+ opacity: 0,
196
+ };
197
+ },
198
+ center: {
199
+ position: "relative",
200
+ zIndex: 1,
201
+ x: 0,
202
+ opacity: 1,
203
+ },
204
+ exit: (direction) => {
205
+ return {
206
+ position: "absolute",
207
+ zIndex: 0,
208
+ x: direction < 0 ? 300 : -300,
209
+ opacity: 0,
210
+ };
211
+ },
212
+ };
213
+ const swipeConfidenceThreshold = 10000;
214
+ const swipePower = (offset, velocity) => {
215
+ return Math.abs(offset) * velocity;
216
+ };
217
+ const PickerDays = (props) => {
218
+ // prop destruction
219
+ const { ownerState } = props;
220
+ // lib hooks
221
+ const { getPickerDayProps, getDayCellProps } = useCalendar.useCalendar(ownerState);
222
+ // state, ref, querystring hooks
223
+ // form hooks
224
+ // query hooks
225
+ // calculated values
226
+ const calendarDates = React.useMemo(() => index.getCalendarDates(ownerState.viewMonth), [ownerState.viewMonth]);
227
+ const weekdayNames = React.useMemo(() => index.getWeekdayNames(ownerState.locale || "default"), [ownerState.locale]);
228
+ // effects
229
+ // handlers
230
+ return (React.createElement(CalendarViewContainer, { calendarType: "datePicker" },
231
+ React.createElement(framerMotion.AnimatePresence, { initial: false, custom: ownerState.direction },
232
+ React.createElement(CalendarViewTable
233
+ // #region framer-motion
234
+ , {
235
+ // #region framer-motion
236
+ key: `${ownerState.viewMonth.toString()}_${ownerState.direction}`, custom: ownerState.direction, variants: variants, initial: "enter", animate: "center", exit: "exit", transition: {
237
+ x: { type: "spring", stiffness: 300, damping: 30 },
238
+ opacity: { duration: 0.2 },
239
+ }, drag: "x", dragConstraints: { left: 0, right: 0 }, dragElastic: 1, onDragEnd: (e, { offset, velocity }) => {
240
+ const swipe = swipePower(offset.x, velocity.x);
241
+ if (swipe < -1e4) {
242
+ const date = new Date(ownerState.viewMonth || new Date());
243
+ date.setMonth(date.getMonth() + 1);
244
+ ownerState.onMonthChange?.(date);
245
+ }
246
+ else if (swipe > swipeConfidenceThreshold) {
247
+ const date = new Date(ownerState.viewMonth || new Date());
248
+ date.setMonth(date.getMonth() - 1);
249
+ ownerState.onMonthChange?.(date);
250
+ }
251
+ } },
252
+ React.createElement(CalendarWeekHeaderContainer, null,
253
+ React.createElement("tr", null, weekdayNames.map((name, i) => (React.createElement(React.Fragment, { key: `${ownerState.viewMonth}_${name}_${i}` },
254
+ React.createElement("th", null,
255
+ React.createElement(Typography.Typography, { level: "body-xs", textAlign: "center" }, name)),
256
+ i < 6 && (React.createElement("th", { style: { width: 4 }, "aria-hidden": "true", "aria-description": "cell-gap" }))))))),
257
+ React.createElement(CalendarDayPickerContainer, null, calendarDates.map((weekDates, rowIndex) => (React.createElement(React.Fragment, { key: `${ownerState.viewMonth}_${rowIndex}` },
258
+ React.createElement("tr", null, weekDates.map((date, i) => date ? (React.createElement(React.Fragment, { key: i },
259
+ React.createElement(CalendarDayCell, { ...getDayCellProps(date) },
260
+ React.createElement(CalendarDay, { size: "sm", variant: "plain", color: "neutral", ...getPickerDayProps(date) }, date)),
261
+ i < 6 && (React.createElement("td", { "aria-hidden": "true", "aria-description": "cell-gap" })))) : (React.createElement(React.Fragment, { key: i },
262
+ React.createElement("td", null),
263
+ i < 6 && (React.createElement("td", { "aria-hidden": "true", "aria-description": "cell-gap" })))))),
264
+ rowIndex < calendarDates.length - 1 && (React.createElement("tr", { "aria-hidden": "true", "aria-description": "row-gap" },
265
+ React.createElement("td", { colSpan: 13, style: { height: 4 } })))))))))));
266
+ };
267
+ const PickerMonths = (props) => {
268
+ const { ownerState } = props;
269
+ const { getPickerMonthProps, getMonthCellProps } = useCalendar.useCalendar(ownerState);
270
+ const chunkedMonths = Array.from({ length: 12 }, (_, i) => i).reduce((acc, month) => {
271
+ if (acc[acc.length - 1].length === 4) {
272
+ acc.push([]);
273
+ }
274
+ acc[acc.length - 1].push(month);
275
+ return acc;
276
+ }, [[]]);
277
+ const isMonthPicker = !ownerState.views?.find((view) => view === "day");
278
+ return (React.createElement(CalendarViewContainer, { calendarType: isMonthPicker ? "monthPicker" : "datePicker" },
279
+ React.createElement(framerMotion.AnimatePresence, { initial: false, custom: ownerState.direction },
280
+ React.createElement(CalendarViewTable
281
+ // #region framer-motion
282
+ , {
283
+ // #region framer-motion
284
+ key: `${ownerState.viewMonth.getFullYear()}_${ownerState.direction}`, custom: ownerState.direction, variants: variants, initial: "enter", animate: "center", exit: "exit", transition: {
285
+ x: { type: "spring", stiffness: 300, damping: 30 },
286
+ opacity: { duration: 0.2 },
287
+ }, drag: "x", dragConstraints: { left: 0, right: 0 }, dragElastic: 1, onDragEnd: (e, { offset, velocity }) => {
288
+ const swipe = swipePower(offset.x, velocity.x);
289
+ if (swipe < -1e4) {
290
+ const date = new Date(ownerState.viewMonth || new Date());
291
+ date.setMonth(date.getMonth() + 1);
292
+ ownerState.onMonthChange?.(date);
293
+ }
294
+ else if (swipe > swipeConfidenceThreshold) {
295
+ const date = new Date(ownerState.viewMonth || new Date());
296
+ date.setMonth(date.getMonth() - 1);
297
+ ownerState.onMonthChange?.(date);
298
+ }
299
+ } },
300
+ React.createElement("tbody", null, chunkedMonths.map((months, i) => (React.createElement(React.Fragment, { key: i },
301
+ React.createElement("tr", null, months.map((monthIndex, j) => (React.createElement(React.Fragment, { key: monthIndex },
302
+ React.createElement(CalendarMonthCell, { ...getMonthCellProps(monthIndex) },
303
+ React.createElement(CalendarMonth, { size: "sm", variant: "plain", color: "neutral", ...getPickerMonthProps(monthIndex) }, index.getMonthNameFromIndex(monthIndex, ownerState.locale))),
304
+ j < 3 && (React.createElement("td", { style: { width: 4 }, "aria-hidden": "true", "aria-description": "cell-gap" })))))),
305
+ i < chunkedMonths.length - 1 && (React.createElement("tr", { "aria-hidden": "true", "aria-description": "row-gap" },
306
+ React.createElement("td", { colSpan: 7, style: { height: 4 } })))))))))));
307
+ };
308
+ /**
309
+ * @see https://mui.com/x/api/date-pickers/date-calendar/ 인터페이스 참고
310
+ */
311
+ const Calendar = React.forwardRef((inProps, ref) => {
312
+ // prop destruction
313
+ const [props, ownerState] = useCalendarProps.useCalendarProps(inProps);
314
+ const { value, defaultValue, onChange, locale, onViewChange, onMonthChange, view, views, rangeSelection, minDate, maxDate, disableFuture, disablePast, ...others } = props;
315
+ // lib hooks
316
+ const { calendarTitle, onPrev, onNext } = useCalendar.useCalendar(ownerState);
317
+ // state, ref, querystring hooks
318
+ // form hooks
319
+ // query hooks
320
+ // calculated values
321
+ // effects
322
+ // handlers
323
+ return (React.createElement(CalendarRoot, { ref: ref, ...others },
324
+ React.createElement(CalendarHeader, null,
325
+ React.createElement(IconButton.IconButton, { size: "sm", onClick: onPrev, "aria-label": `Previous ${view === "day" ? "Month" : "Year"}` },
326
+ React.createElement(ChevronLeft, null)),
327
+ React.createElement(CalendarSwitchViewButton, { ownerState: ownerState, variant: "plain", color: "neutral", onClick: onViewChange, "aria-label": "Switch Calendar View" }, calendarTitle),
328
+ React.createElement(IconButton.IconButton, { size: "sm", onClick: onNext, "aria-label": `Next ${view === "day" ? "Month" : "Year"}` },
329
+ React.createElement(ChevronRight, null))),
330
+ view === "day" && React.createElement(PickerDays, { ownerState: ownerState }),
331
+ view === "month" && React.createElement(PickerMonths, { ownerState: ownerState })));
332
+ });
333
+ Calendar.displayName = "Calendar";
334
+
335
+ exports.Calendar = Calendar;
@@ -0,0 +1,76 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var joy = require('@mui/joy');
5
+
6
+ const resolveView = (view, views) => {
7
+ return views.includes(view) ? view : views[0];
8
+ };
9
+ const useCalendarProps = (inProps) => {
10
+ const [uncontrolledView, setUncontrolledView] = React.useState(() => resolveView(inProps.view || "day", inProps.views || ["day", "month"]));
11
+ const [uncontrolledValue, setUncontrolledValue] = React.useState(inProps.defaultValue);
12
+ const [viewMonth, setViewMonth] = React.useState(() => {
13
+ const today = new Date();
14
+ today.setDate(1);
15
+ today.setHours(0, 0, 0, 0);
16
+ return inProps.value?.[0] || inProps.defaultValue?.[0] || today;
17
+ });
18
+ const [[page, direction], setPage] = React.useState([0, 0]);
19
+ const resolvedView = inProps.view ?? uncontrolledView;
20
+ const paginate = (newDirection) => {
21
+ setPage([page + newDirection, newDirection]);
22
+ };
23
+ const handleViewMonthChange = React.useCallback((newMonth) => {
24
+ setViewMonth(newMonth);
25
+ if (resolvedView === "month") {
26
+ if (viewMonth.getFullYear() !== newMonth.getFullYear()) {
27
+ paginate(newMonth > viewMonth ? 1 : -1);
28
+ }
29
+ }
30
+ else {
31
+ paginate(newMonth > viewMonth ? 1 : -1);
32
+ }
33
+ inProps.onMonthChange?.(newMonth);
34
+ }, [inProps.onMonthChange, viewMonth, resolvedView]);
35
+ const props = joy.useThemeProps({
36
+ props: {
37
+ locale: "default",
38
+ views: ["day", "month"],
39
+ view: resolvedView,
40
+ value: inProps.value ?? uncontrolledValue,
41
+ ...inProps,
42
+ // overrides
43
+ onChange: inProps.value
44
+ ? // Controlled
45
+ inProps.onChange
46
+ : // Uncontrolled
47
+ (value) => {
48
+ setUncontrolledValue(value);
49
+ inProps.onChange?.(value);
50
+ },
51
+ onMonthChange: handleViewMonthChange,
52
+ onViewChange: () => {
53
+ const newView = resolvedView === "month" ? "day" : "month";
54
+ const isAllowedView = !inProps.views
55
+ ? true
56
+ : inProps.views.includes(newView);
57
+ if (!isAllowedView || inProps.view === newView)
58
+ return;
59
+ if (inProps.onViewChange) {
60
+ inProps.onViewChange(newView);
61
+ }
62
+ else {
63
+ setUncontrolledView(newView);
64
+ }
65
+ },
66
+ },
67
+ name: "Calendar",
68
+ });
69
+ /**
70
+ * For ownerState
71
+ */
72
+ const ownerState = React.useMemo(() => ({ ...props, viewMonth, direction }), [props, viewMonth, direction]);
73
+ return [props, ownerState];
74
+ };
75
+
76
+ exports.useCalendarProps = useCalendarProps;
@@ -0,0 +1,249 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var index = require('../utils/index.js');
5
+
6
+ const useCalendar = (ownerState) => {
7
+ const [hoverDay, setHoverDay] = React.useState(null);
8
+ const [hoverMonth, setHoverMonth] = React.useState(null);
9
+ return {
10
+ calendarTitle: ownerState.view === "month"
11
+ ? index.getYearName(ownerState.viewMonth, ownerState.locale || "default")
12
+ : index.getMonthName(ownerState.viewMonth, ownerState.locale || "default"),
13
+ onPrev: React.useCallback(() => {
14
+ if (ownerState.view === "day") {
15
+ const prevMonth = new Date(ownerState.viewMonth || new Date());
16
+ prevMonth.setMonth(prevMonth.getMonth() - 1);
17
+ ownerState.onMonthChange?.(prevMonth);
18
+ }
19
+ else if (ownerState.view === "month") {
20
+ const prevYear = new Date(ownerState.viewMonth || new Date());
21
+ prevYear.setFullYear(prevYear.getFullYear() - 1);
22
+ ownerState.onMonthChange?.(prevYear);
23
+ }
24
+ }, [ownerState.onMonthChange, ownerState.viewMonth, ownerState.view]),
25
+ onNext: React.useCallback(() => {
26
+ if (ownerState.view === "day") {
27
+ const nextMonth = new Date(ownerState.viewMonth || new Date());
28
+ nextMonth.setMonth(nextMonth.getMonth() + 1);
29
+ ownerState.onMonthChange?.(nextMonth);
30
+ }
31
+ else if (ownerState.view === "month") {
32
+ const nextYear = new Date(ownerState.viewMonth || new Date());
33
+ nextYear.setFullYear(nextYear.getFullYear() + 1);
34
+ ownerState.onMonthChange?.(nextYear);
35
+ }
36
+ }, [ownerState.onMonthChange, ownerState.viewMonth, ownerState.view]),
37
+ getDayCellProps: React.useCallback((day) => {
38
+ const thisDay = new Date(ownerState.viewMonth || new Date());
39
+ thisDay.setHours(0, 0, 0, 0);
40
+ thisDay.setDate(day);
41
+ const inRange = ownerState.rangeSelection &&
42
+ ownerState.value &&
43
+ ownerState.value[0] &&
44
+ // NOTE: hover day is not included in the range
45
+ ((hoverDay &&
46
+ index.isWithinRange(ownerState.value[0], hoverDay, thisDay)) ||
47
+ // NOTE: Selected range is included in the range
48
+ (ownerState.value[1] &&
49
+ index.isWithinRange(ownerState.value[0], ownerState.value[1], thisDay)));
50
+ return {
51
+ "aria-label": thisDay.toLocaleDateString(),
52
+ "aria-current": inRange ? "date" : undefined,
53
+ };
54
+ }, [
55
+ ownerState.rangeSelection,
56
+ ownerState.value,
57
+ ownerState.viewMonth,
58
+ hoverDay,
59
+ ]),
60
+ getMonthCellProps: React.useCallback((monthIndex) => {
61
+ const thisMonth = new Date(ownerState.viewMonth || new Date());
62
+ thisMonth.setDate(1);
63
+ thisMonth.setHours(0, 0, 0, 0);
64
+ thisMonth.setMonth(monthIndex);
65
+ const isMonthRangeSelection = !ownerState.views?.find((view) => view === "day") &&
66
+ ownerState.rangeSelection;
67
+ const inRange = isMonthRangeSelection &&
68
+ ownerState.value &&
69
+ ownerState.value[0] &&
70
+ // NOTE: hover day is not included in the range
71
+ ((hoverMonth &&
72
+ index.isWithinRange(ownerState.value[0], hoverMonth, thisMonth)) ||
73
+ // NOTE: Selected range is included in the range
74
+ (ownerState.value[1] &&
75
+ index.isWithinRange(ownerState.value[0], ownerState.value[1], thisMonth)));
76
+ return {
77
+ "aria-label": thisMonth.toLocaleDateString(),
78
+ "aria-current": inRange ? "date" : undefined,
79
+ };
80
+ }, [
81
+ ownerState.rangeSelection,
82
+ ownerState.value,
83
+ ownerState.viewMonth,
84
+ hoverMonth,
85
+ ]),
86
+ getPickerDayProps: React.useCallback((day) => {
87
+ const thisDay = new Date(ownerState.viewMonth || new Date());
88
+ thisDay.setHours(0, 0, 0, 0);
89
+ thisDay.setDate(day);
90
+ const isSelected = !!ownerState.value &&
91
+ (index.isSameDay(thisDay, ownerState.value[0]) ||
92
+ (ownerState.value[1] && index.isSameDay(thisDay, ownerState.value[1])));
93
+ const inRange = ownerState.rangeSelection &&
94
+ ownerState.value &&
95
+ ownerState.value[0] &&
96
+ // NOTE: hover day is not included in the range
97
+ ((hoverDay &&
98
+ index.isWithinRange(ownerState.value[0], hoverDay, thisDay)) ||
99
+ // NOTE: Selected range is included in the range
100
+ (ownerState.value[1] &&
101
+ index.isWithinRange(ownerState.value[0], ownerState.value[1], thisDay)));
102
+ const handleDayClick = () => {
103
+ if (ownerState.rangeSelection) {
104
+ if (!ownerState.value) {
105
+ ownerState.onChange?.([thisDay, undefined]);
106
+ }
107
+ else if (ownerState.value[0] && !ownerState.value[1]) {
108
+ ownerState.onChange?.([
109
+ new Date(Math.min(ownerState.value[0].getTime(), thisDay.getTime())),
110
+ new Date(Math.max(ownerState.value[0].getTime(), thisDay.getTime())),
111
+ ]);
112
+ }
113
+ else {
114
+ ownerState.onChange?.([thisDay, undefined]);
115
+ }
116
+ }
117
+ else {
118
+ ownerState.onChange?.([thisDay, undefined]);
119
+ }
120
+ setHoverDay(null);
121
+ };
122
+ return {
123
+ isToday: index.isToday(thisDay),
124
+ isSelected,
125
+ onClick: handleDayClick,
126
+ onMouseEnter: ownerState.rangeSelection &&
127
+ ownerState.value?.[0] &&
128
+ !ownerState.value?.[1]
129
+ ? () => setHoverDay(thisDay)
130
+ : undefined,
131
+ disabled: (ownerState.minDate && thisDay < ownerState.minDate) ||
132
+ (ownerState.maxDate && thisDay > ownerState.maxDate) ||
133
+ (ownerState.disableFuture && thisDay > new Date()) ||
134
+ (ownerState.disablePast &&
135
+ thisDay <
136
+ (() => {
137
+ const today = new Date();
138
+ today.setHours(0, 0, 0, 0);
139
+ return today;
140
+ })()),
141
+ tabIndex: -1,
142
+ "aria-label": thisDay.toLocaleDateString(),
143
+ "aria-selected": isSelected ? "true" : undefined,
144
+ "aria-current": inRange ? "date" : undefined,
145
+ };
146
+ }, [
147
+ ownerState.onChange,
148
+ ownerState.value,
149
+ ownerState.viewMonth,
150
+ ownerState.rangeSelection,
151
+ ownerState.minDate,
152
+ ownerState.maxDate,
153
+ ownerState.disableFuture,
154
+ ownerState.disablePast,
155
+ hoverDay,
156
+ ]),
157
+ getPickerMonthProps: React.useCallback((monthIndex) => {
158
+ const thisMonth = new Date(ownerState.viewMonth || new Date());
159
+ thisMonth.setDate(1);
160
+ thisMonth.setHours(0, 0, 0, 0);
161
+ thisMonth.setMonth(monthIndex);
162
+ const isMonthPicker = !ownerState.views?.find((view) => view === "day");
163
+ const isMonthRangeSelection = isMonthPicker && ownerState.rangeSelection;
164
+ const isSelected = !!ownerState.value &&
165
+ (index.isSameMonth(thisMonth, ownerState.value[0]) ||
166
+ (ownerState.value[1] &&
167
+ index.isSameMonth(thisMonth, ownerState.value[1])));
168
+ const inRange = isMonthRangeSelection &&
169
+ ownerState.value &&
170
+ ownerState.value[0] &&
171
+ // NOTE: hover day is not included in the range
172
+ ((hoverMonth &&
173
+ index.isWithinRange(ownerState.value[0], hoverMonth, thisMonth)) ||
174
+ // NOTE: Selected range is included in the range
175
+ (ownerState.value[1] &&
176
+ index.isWithinRange(ownerState.value[0], ownerState.value[1], thisMonth)));
177
+ const handleMonthClick = () => {
178
+ if (isMonthRangeSelection) {
179
+ if (!ownerState.value) {
180
+ ownerState.onChange?.([thisMonth, undefined]);
181
+ }
182
+ else if (ownerState.value[0] && !ownerState.value[1]) {
183
+ ownerState.onChange?.([
184
+ new Date(Math.min(ownerState.value[0].getTime(), thisMonth.getTime())),
185
+ new Date(Math.max(ownerState.value[0].getTime(), thisMonth.getTime())),
186
+ ]);
187
+ }
188
+ else {
189
+ ownerState.onChange?.([thisMonth, undefined]);
190
+ }
191
+ }
192
+ else if (isMonthPicker) {
193
+ ownerState.onChange?.([thisMonth, undefined]);
194
+ }
195
+ else {
196
+ ownerState.onViewChange?.("day");
197
+ ownerState.onMonthChange?.(thisMonth);
198
+ }
199
+ setHoverMonth(null);
200
+ };
201
+ return {
202
+ isSelected,
203
+ onMouseEnter: isMonthRangeSelection &&
204
+ ownerState.value?.[0] &&
205
+ !ownerState.value?.[1]
206
+ ? () => setHoverMonth(thisMonth)
207
+ : undefined,
208
+ disabled: (ownerState.minDate &&
209
+ (() => {
210
+ // check all days disabled in this month
211
+ const lastDay = new Date(thisMonth);
212
+ lastDay.setMonth(lastDay.getMonth() + 1);
213
+ lastDay.setDate(0);
214
+ return lastDay < ownerState.minDate;
215
+ })()) ||
216
+ (ownerState.maxDate &&
217
+ (() => {
218
+ // check all days disabled in this month
219
+ const lastDay = new Date(thisMonth);
220
+ lastDay.setDate(0);
221
+ return lastDay > ownerState.maxDate;
222
+ })()) ||
223
+ (ownerState.disableFuture && thisMonth > new Date()) ||
224
+ (ownerState.disablePast &&
225
+ thisMonth < new Date() &&
226
+ !index.isSameMonth(thisMonth, new Date())),
227
+ onClick: handleMonthClick,
228
+ tabIndex: -1,
229
+ "aria-label": index.getMonthName(thisMonth, ownerState.locale || "default"),
230
+ "aria-selected": isSelected ? "true" : undefined,
231
+ "aria-current": inRange ? "date" : undefined,
232
+ };
233
+ }, [
234
+ ownerState.onMonthChange,
235
+ ownerState.onViewChange,
236
+ ownerState.onChange,
237
+ ownerState.viewMonth,
238
+ ownerState.locale,
239
+ ownerState.value,
240
+ ownerState.minDate,
241
+ ownerState.maxDate,
242
+ ownerState.disableFuture,
243
+ ownerState.disablePast,
244
+ hoverMonth,
245
+ ]),
246
+ };
247
+ };
248
+
249
+ exports.useCalendar = useCalendar;
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var Calendar = require('./Calendar.js');
6
+
7
+
8
+
9
+ exports.Calendar = Calendar.Calendar;
10
+ exports.default = Calendar.Calendar;