@ceed/cds 0.0.185 → 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 (260) 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 +7 -5
  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/framer/index.js +30 -30
  260. package/package.json +8 -5
@@ -0,0 +1,130 @@
1
+ 'use strict';
2
+
3
+ var rafSchd_esm = require('../../../../../raf-schd/dist/raf-schd.esm.js');
4
+
5
+ var scheduleOnDrag = rafSchd_esm(function (fn) {
6
+ return fn();
7
+ });
8
+ var dragStart = function () {
9
+ var scheduled = null;
10
+ function schedule(fn) {
11
+ var frameId = requestAnimationFrame(function () {
12
+ scheduled = null;
13
+ fn();
14
+ });
15
+ scheduled = {
16
+ frameId: frameId,
17
+ fn: fn
18
+ };
19
+ }
20
+ function flush() {
21
+ if (scheduled) {
22
+ cancelAnimationFrame(scheduled.frameId);
23
+ scheduled.fn();
24
+ scheduled = null;
25
+ }
26
+ }
27
+ return {
28
+ schedule: schedule,
29
+ flush: flush
30
+ };
31
+ }();
32
+ function makeDispatch(_ref) {
33
+ var source = _ref.source,
34
+ initial = _ref.initial,
35
+ dispatchEvent = _ref.dispatchEvent;
36
+ var previous = {
37
+ dropTargets: []
38
+ };
39
+ function safeDispatch(args) {
40
+ dispatchEvent(args);
41
+ previous = {
42
+ dropTargets: args.payload.location.current.dropTargets
43
+ };
44
+ }
45
+ var dispatch = {
46
+ start: function start(_ref2) {
47
+ var nativeSetDragImage = _ref2.nativeSetDragImage;
48
+ // Ensuring that both `onGenerateDragPreview` and `onDragStart` get the same location.
49
+ // We do this so that `previous` is`[]` in `onDragStart` (which is logical)
50
+ var location = {
51
+ current: initial,
52
+ previous: previous,
53
+ initial: initial
54
+ };
55
+ // a `onGenerateDragPreview` does _not_ add another entry for `previous`
56
+ // onDragPreview
57
+ safeDispatch({
58
+ eventName: 'onGenerateDragPreview',
59
+ payload: {
60
+ source: source,
61
+ location: location,
62
+ nativeSetDragImage: nativeSetDragImage
63
+ }
64
+ });
65
+ dragStart.schedule(function () {
66
+ safeDispatch({
67
+ eventName: 'onDragStart',
68
+ payload: {
69
+ source: source,
70
+ location: location
71
+ }
72
+ });
73
+ });
74
+ },
75
+ dragUpdate: function dragUpdate(_ref3) {
76
+ var current = _ref3.current;
77
+ dragStart.flush();
78
+ scheduleOnDrag.cancel();
79
+ safeDispatch({
80
+ eventName: 'onDropTargetChange',
81
+ payload: {
82
+ source: source,
83
+ location: {
84
+ initial: initial,
85
+ previous: previous,
86
+ current: current
87
+ }
88
+ }
89
+ });
90
+ },
91
+ drag: function drag(_ref4) {
92
+ var current = _ref4.current;
93
+ scheduleOnDrag(function () {
94
+ dragStart.flush();
95
+ var location = {
96
+ initial: initial,
97
+ previous: previous,
98
+ current: current
99
+ };
100
+ safeDispatch({
101
+ eventName: 'onDrag',
102
+ payload: {
103
+ source: source,
104
+ location: location
105
+ }
106
+ });
107
+ });
108
+ },
109
+ drop: function drop(_ref5) {
110
+ var current = _ref5.current,
111
+ updatedSourcePayload = _ref5.updatedSourcePayload;
112
+ dragStart.flush();
113
+ scheduleOnDrag.cancel();
114
+ safeDispatch({
115
+ eventName: 'onDrop',
116
+ payload: {
117
+ source: updatedSourcePayload !== null && updatedSourcePayload !== undefined ? updatedSourcePayload : source,
118
+ location: {
119
+ current: current,
120
+ previous: previous,
121
+ initial: initial
122
+ }
123
+ }
124
+ });
125
+ }
126
+ };
127
+ return dispatch;
128
+ }
129
+
130
+ exports.makeDispatch = makeDispatch;
@@ -0,0 +1,342 @@
1
+ 'use strict';
2
+
3
+ var toConsumableArray = require('../../../external/@babel/runtime/helpers/esm/toConsumableArray.js');
4
+ var index = require('../../../../../../_virtual/index.js');
5
+ var getElementFromPointWithoutHoneyPot = require('../honey-pot-fix/get-element-from-point-without-honey-pot.js');
6
+ var isHoneyPotElement = require('../honey-pot-fix/is-honey-pot-element.js');
7
+ var isLeavingWindow = require('../util/changing-window/is-leaving-window.js');
8
+ var detectBrokenDrag = require('../util/detect-broken-drag.js');
9
+ var getInput = require('../util/get-input.js');
10
+ var dispatchConsumerEvent = require('./dispatch-consumer-event.js');
11
+
12
+ var globalState = {
13
+ isActive: false
14
+ };
15
+ function canStart() {
16
+ return !globalState.isActive;
17
+ }
18
+ function getNativeSetDragImage(event) {
19
+ if (event.dataTransfer) {
20
+ // need to use `.bind` as `setDragImage` is required
21
+ // to be run with `event.dataTransfer` as the "this" context
22
+ return event.dataTransfer.setDragImage.bind(event.dataTransfer);
23
+ }
24
+ return null;
25
+ }
26
+ function hasHierarchyChanged(_ref) {
27
+ var current = _ref.current,
28
+ next = _ref.next;
29
+ if (current.length !== next.length) {
30
+ return true;
31
+ }
32
+ // not checking stickiness, data or dropEffect,
33
+ // just whether the hierarchy has changed
34
+ for (var i = 0; i < current.length; i++) {
35
+ if (current[i].element !== next[i].element) {
36
+ return true;
37
+ }
38
+ }
39
+ return false;
40
+ }
41
+ function start(_ref2) {
42
+ var event = _ref2.event,
43
+ dragType = _ref2.dragType,
44
+ getDropTargetsOver = _ref2.getDropTargetsOver,
45
+ dispatchEvent = _ref2.dispatchEvent;
46
+ if (!canStart()) {
47
+ return;
48
+ }
49
+ var initial = getStartLocation({
50
+ event: event,
51
+ dragType: dragType,
52
+ getDropTargetsOver: getDropTargetsOver
53
+ });
54
+ globalState.isActive = true;
55
+ var state = {
56
+ current: initial
57
+ };
58
+
59
+ // Setting initial drop effect for the drag
60
+ setDropEffectOnEvent({
61
+ event: event,
62
+ current: initial.dropTargets
63
+ });
64
+ var dispatch = dispatchConsumerEvent.makeDispatch({
65
+ source: dragType.payload,
66
+ dispatchEvent: dispatchEvent,
67
+ initial: initial
68
+ });
69
+ function updateState(next) {
70
+ // only looking at whether hierarchy has changed to determine whether something as 'changed'
71
+ var hasChanged = hasHierarchyChanged({
72
+ current: state.current.dropTargets,
73
+ next: next.dropTargets
74
+ });
75
+
76
+ // Always updating the state to include latest data, dropEffect and stickiness
77
+ // Only updating consumers if the hierarchy has changed in some way
78
+ // Consumers can get the latest data by using `onDrag`
79
+ state.current = next;
80
+ if (hasChanged) {
81
+ dispatch.dragUpdate({
82
+ current: state.current
83
+ });
84
+ }
85
+ }
86
+ function onUpdateEvent(event) {
87
+ var input = getInput.getInput(event);
88
+
89
+ // If we are over the honey pot, we need to get the element
90
+ // that the user would have been over if not for the honey pot
91
+ var target = isHoneyPotElement.isHoneyPotElement(event.target) ? getElementFromPointWithoutHoneyPot.getElementFromPointWithoutHoneypot({
92
+ x: input.clientX,
93
+ y: input.clientY
94
+ }) : event.target;
95
+ var nextDropTargets = getDropTargetsOver({
96
+ target: target,
97
+ input: input,
98
+ source: dragType.payload,
99
+ current: state.current.dropTargets
100
+ });
101
+ if (nextDropTargets.length) {
102
+ // 🩸 must call `event.preventDefault()` to allow a browser drop to occur
103
+ event.preventDefault();
104
+ setDropEffectOnEvent({
105
+ event: event,
106
+ current: nextDropTargets
107
+ });
108
+ }
109
+ updateState({
110
+ dropTargets: nextDropTargets,
111
+ input: input
112
+ });
113
+ }
114
+ function cancel() {
115
+ // The spec behaviour is that when a drag is cancelled, or when dropping on no drop targets,
116
+ // a "dragleave" event is fired on the active drop target before a "dragend" event.
117
+ // We are replicating that behaviour in `cancel` if there are any active drop targets to
118
+ // ensure consistent behaviour.
119
+ //
120
+ // Note: When cancelling, or dropping on no drop targets, a "dragleave" event
121
+ // will have already cleared the dropTargets to `[]` (as that particular "dragleave" has a `relatedTarget` of `null`)
122
+
123
+ if (state.current.dropTargets.length) {
124
+ updateState({
125
+ dropTargets: [],
126
+ input: state.current.input
127
+ });
128
+ }
129
+ dispatch.drop({
130
+ current: state.current,
131
+ updatedSourcePayload: null
132
+ });
133
+ finish();
134
+ }
135
+ function finish() {
136
+ globalState.isActive = false;
137
+ unbindEvents();
138
+ }
139
+ var unbindEvents = index.distExports.bindAll(window, [{
140
+ // 👋 Note: we are repurposing the `dragover` event as our `drag` event
141
+ // this is because firefox does not publish pointer coordinates during
142
+ // a `drag` event, but does for every other type of drag event
143
+ // `dragover` fires on all elements that are being dragged over
144
+ // Because we are binding to `window` - our `dragover` is effectively the same as a `drag`
145
+ // 🦊😤
146
+ type: 'dragover',
147
+ listener: function listener(event) {
148
+ // We need to regularly calculate the drop targets in order to allow:
149
+ // - dynamic `canDrop()` checks
150
+ // - rapid updating `getData()` calls to attach data in response to user input (eg for edge detection)
151
+ // Sadly we cannot schedule inspecting changes resulting from this event
152
+ // we need to be able to conditionally cancel the event with `event.preventDefault()`
153
+ // to enable the correct native drop experience.
154
+
155
+ // 1. check to see if anything has changed
156
+ onUpdateEvent(event);
157
+
158
+ // 2. let consumers know a move has occurred
159
+ // This will include the latest 'input' values
160
+ dispatch.drag({
161
+ current: state.current
162
+ });
163
+ }
164
+ }, {
165
+ type: 'dragenter',
166
+ listener: onUpdateEvent
167
+ }, {
168
+ type: 'dragleave',
169
+ listener: function listener(event) {
170
+ if (!isLeavingWindow.isLeavingWindow({
171
+ dragLeave: event
172
+ })) {
173
+ return;
174
+ }
175
+
176
+ /**
177
+ * At this point we don't know if a drag is being cancelled,
178
+ * or if a drag is leaving the `window`.
179
+ *
180
+ * Both have:
181
+ * 1. "dragleave" (with `relatedTarget: null`)
182
+ * 2. "dragend" (a "dragend" can occur when outside the `window`)
183
+ *
184
+ * **Clearing drop targets**
185
+ *
186
+ * For either case we are clearing the the drop targets
187
+ *
188
+ * - cancelling: we clear drop targets in `"dragend"` anyway
189
+ * - leaving the `window`: we clear the drop targets (to clear stickiness)
190
+ *
191
+ * **Leaving the window and finishing the drag**
192
+ *
193
+ * _internal drags_
194
+ *
195
+ * - The drag continues when the user is outside the `window`
196
+ * and can resume if the user drags back over the `window`,
197
+ * or end when the user drops in an external `window`.
198
+ * - We will get a `"dragend"`, or we can listen for other
199
+ * events to determine the drag is finished when the user re-enters the `window`).
200
+ *
201
+ * _external drags_
202
+ *
203
+ * - We conclude the drag operation.
204
+ * - We have no idea if the user will drag back over the `window`,
205
+ * or if the drag ends elsewhere.
206
+ * - We will create a new drag if the user re-enters the `window`.
207
+ *
208
+ * **Not updating `input`**
209
+ *
210
+ * 🐛 Bug[Chrome] the final `"dragleave"` has default input values (eg `clientX == 0`)
211
+ * Workaround: intentionally not updating `input` in "dragleave"
212
+ * rather than the users current input values
213
+ * - [Conversation](https://twitter.com/alexandereardon/status/1642697633864241152)
214
+ * - [Bug](https://bugs.chromium.org/p/chromium/issues/detail?id=1429937)
215
+ **/
216
+
217
+ updateState({
218
+ input: state.current.input,
219
+ dropTargets: []
220
+ });
221
+ if (dragType.startedFrom === 'external') {
222
+ cancel();
223
+ }
224
+ }
225
+ }, {
226
+ // A "drop" can only happen if the browser allowed the drop
227
+ type: 'drop',
228
+ listener: function listener(event) {
229
+ // Capture the final input.
230
+ // We are capturing the final `input` for the
231
+ // most accurate honey pot experience
232
+ state.current = {
233
+ dropTargets: state.current.dropTargets,
234
+ input: getInput.getInput(event)
235
+ };
236
+
237
+ /** If there are no drop targets, then we will get
238
+ * a "drop" event if:
239
+ * - `preventUnhandled()` is being used
240
+ * - there is an unmanaged drop target (eg another library)
241
+ * In these cases, it's up to the consumer
242
+ * to handle the drop if it's not over one of our drop targets
243
+ * - `preventUnhandled()` will cancel the "drop"
244
+ * - unmanaged drop targets can handle the "drop" how they want to
245
+ * We won't call `event.preventDefault()` in this call path */
246
+
247
+ if (!state.current.dropTargets.length) {
248
+ cancel();
249
+ return;
250
+ }
251
+ event.preventDefault();
252
+
253
+ // applying the latest drop effect to the event
254
+ setDropEffectOnEvent({
255
+ event: event,
256
+ current: state.current.dropTargets
257
+ });
258
+ dispatch.drop({
259
+ current: state.current,
260
+ // When dropping something native, we need to extract the latest
261
+ // `.items` from the "drop" event as it is now accessible
262
+ updatedSourcePayload: dragType.type === 'external' ? dragType.getDropPayload(event) : null
263
+ });
264
+ finish();
265
+ }
266
+ }, {
267
+ // "dragend" fires when on the drag source (eg a draggable element)
268
+ // when the drag is finished.
269
+ // "dragend" will fire after "drop" (if there was a successful drop)
270
+ // "dragend" does not fire if the draggable source has been removed during the drag
271
+ // or for external drag sources (eg files)
272
+
273
+ // This "dragend" listener will not fire if there was a successful drop
274
+ // as we will have already removed the event listener
275
+
276
+ type: 'dragend',
277
+ listener: function listener(event) {
278
+ // In firefox, the position of the "dragend" event can
279
+ // be a bit different to the last "dragover" event.
280
+ // Updating the input so we can get the best possible
281
+ // information for the honey pot.
282
+ state.current = {
283
+ dropTargets: state.current.dropTargets,
284
+ input: getInput.getInput(event)
285
+ };
286
+ cancel();
287
+ }
288
+ }].concat(toConsumableArray(detectBrokenDrag.getBindingsForBrokenDrags({
289
+ onDragEnd: cancel
290
+ }))),
291
+ // Once we have started a managed drag operation it is important that we see / own all drag events
292
+ // We got one adoption bug pop up where some code was stopping (`event.stopPropagation()`)
293
+ // all "drop" events in the bubble phase on the `document.body`.
294
+ // This meant that we never saw the "drop" event.
295
+ {
296
+ capture: true
297
+ });
298
+ dispatch.start({
299
+ nativeSetDragImage: getNativeSetDragImage(event)
300
+ });
301
+ }
302
+ function setDropEffectOnEvent(_ref3) {
303
+ var _current$;
304
+ var event = _ref3.event,
305
+ current = _ref3.current;
306
+ // setting the `dropEffect` to be the innerMost drop targets dropEffect
307
+ var innerMost = (_current$ = current[0]) === null || _current$ === undefined ? undefined : _current$.dropEffect;
308
+ if (innerMost != null && event.dataTransfer) {
309
+ event.dataTransfer.dropEffect = innerMost;
310
+ }
311
+ }
312
+ function getStartLocation(_ref4) {
313
+ var event = _ref4.event,
314
+ dragType = _ref4.dragType,
315
+ getDropTargetsOver = _ref4.getDropTargetsOver;
316
+ var input = getInput.getInput(event);
317
+
318
+ // When dragging from outside of the browser,
319
+ // the drag is not being sourced from any local drop targets
320
+ if (dragType.startedFrom === 'external') {
321
+ return {
322
+ input: input,
323
+ dropTargets: []
324
+ };
325
+ }
326
+ var dropTargets = getDropTargetsOver({
327
+ input: input,
328
+ source: dragType.payload,
329
+ target: event.target,
330
+ current: []
331
+ });
332
+ return {
333
+ input: input,
334
+ dropTargets: dropTargets
335
+ };
336
+ }
337
+ var lifecycle = {
338
+ canStart: canStart,
339
+ start: start
340
+ };
341
+
342
+ exports.lifecycle = lifecycle;
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ // Extending `Map` to allow us to link Key and Values together
4
+
5
+ var ledger = new Map();
6
+ function registerUsage(_ref) {
7
+ var typeKey = _ref.typeKey,
8
+ mount = _ref.mount;
9
+ var entry = ledger.get(typeKey);
10
+ if (entry) {
11
+ entry.usageCount++;
12
+ return entry;
13
+ }
14
+ var initial = {
15
+ typeKey: typeKey,
16
+ unmount: mount(),
17
+ usageCount: 1
18
+ };
19
+ ledger.set(typeKey, initial);
20
+ return initial;
21
+ }
22
+ function register(args) {
23
+ var entry = registerUsage(args);
24
+ return function unregister() {
25
+ entry.usageCount--;
26
+ if (entry.usageCount > 0) {
27
+ return;
28
+ }
29
+ // Only a single usage left, remove it
30
+ entry.unmount();
31
+ ledger.delete(args.typeKey);
32
+ };
33
+ }
34
+
35
+ exports.register = register;
@@ -0,0 +1,62 @@
1
+ 'use strict';
2
+
3
+ var lifecycleManager = require('../ledger/lifecycle-manager.js');
4
+ var usageLedger = require('../ledger/usage-ledger.js');
5
+ var makeDropTarget = require('./make-drop-target.js');
6
+ var makeMonitor = require('./make-monitor.js');
7
+
8
+ function makeAdapter(_ref) {
9
+ var typeKey = _ref.typeKey,
10
+ mount = _ref.mount,
11
+ dispatchEventToSource = _ref.dispatchEventToSource,
12
+ onPostDispatch = _ref.onPostDispatch,
13
+ defaultDropEffect = _ref.defaultDropEffect;
14
+ var monitorAPI = makeMonitor.makeMonitor();
15
+ var dropTargetAPI = makeDropTarget.makeDropTarget({
16
+ typeKey: typeKey,
17
+ defaultDropEffect: defaultDropEffect
18
+ });
19
+ function dispatchEvent(args) {
20
+ // 1. forward the event to source
21
+ dispatchEventToSource === null || dispatchEventToSource === undefined || dispatchEventToSource(args);
22
+
23
+ // 2. forward the event to relevant dropTargets
24
+ dropTargetAPI.dispatchEvent(args);
25
+
26
+ // 3. forward event to monitors
27
+ monitorAPI.dispatchEvent(args);
28
+
29
+ // 4. post consumer dispatch (used for honey pot fix)
30
+ onPostDispatch === null || onPostDispatch === undefined || onPostDispatch(args);
31
+ }
32
+ function start(_ref2) {
33
+ var event = _ref2.event,
34
+ dragType = _ref2.dragType;
35
+ lifecycleManager.lifecycle.start({
36
+ event: event,
37
+ dragType: dragType,
38
+ getDropTargetsOver: dropTargetAPI.getIsOver,
39
+ dispatchEvent: dispatchEvent
40
+ });
41
+ }
42
+ function registerUsage() {
43
+ function mountAdapter() {
44
+ var api = {
45
+ canStart: lifecycleManager.lifecycle.canStart,
46
+ start: start
47
+ };
48
+ return mount(api);
49
+ }
50
+ return usageLedger.register({
51
+ typeKey: typeKey,
52
+ mount: mountAdapter
53
+ });
54
+ }
55
+ return {
56
+ registerUsage: registerUsage,
57
+ dropTarget: dropTargetAPI.dropTargetForConsumers,
58
+ monitor: monitorAPI.monitorForConsumers
59
+ };
60
+ }
61
+
62
+ exports.makeAdapter = makeAdapter;