react-timelane 1.2.1 → 1.2.2

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 (139) hide show
  1. package/dist/_virtual/bind-all.js +4 -0
  2. package/dist/_virtual/bind.js +4 -0
  3. package/dist/_virtual/index.js +5 -0
  4. package/dist/_virtual/index2.js +4 -0
  5. package/dist/_virtual/index3.js +5 -0
  6. package/dist/_virtual/index4.js +4 -0
  7. package/dist/_virtual/react-dom.development.js +4 -0
  8. package/dist/_virtual/react-dom.production.js +4 -0
  9. package/dist/components/Timelane/Timelane.css +1 -0
  10. package/dist/components/Timelane/Timelane.js +53 -0
  11. package/dist/components/TimelaneAllocation/TimelaneAllocation.js +49 -0
  12. package/dist/components/TimelaneAside/TimelaneAside.js +60 -0
  13. package/dist/components/TimelaneBackground/TimelaneBackground.js +46 -0
  14. package/dist/components/TimelaneBody/TimelaneBody.js +13 -0
  15. package/dist/components/TimelaneBody/TimelaneSelectionLayer.js +96 -0
  16. package/dist/components/TimelaneHeader/DaysHeader.js +30 -0
  17. package/dist/components/TimelaneHeader/MonthsHeader.js +38 -0
  18. package/dist/components/TimelaneHeader/TimelaneHeader.js +55 -0
  19. package/dist/components/TimelaneHeader/WeeksHeader.js +39 -0
  20. package/dist/components/TimelaneHeader/renderingUtils.js +26 -0
  21. package/dist/components/TimelaneItem/DragResizeComponent.js +125 -0
  22. package/dist/components/TimelaneItem/TimelaneItem.js +42 -0
  23. package/dist/components/TimelaneLane/DropPreview.js +25 -0
  24. package/dist/components/TimelaneLane/DropTarget.js +57 -0
  25. package/dist/components/TimelaneLane/OverlapIndicator.js +21 -0
  26. package/dist/components/TimelaneLane/TimelaneLane.js +164 -0
  27. package/dist/components/TimelaneLayout/TimelaneLayout.js +77 -0
  28. package/dist/components/TimelaneLayout/layout.css +1 -0
  29. package/dist/components/TimelaneSettingsProvider/TimelaneSettingsContext.js +21 -0
  30. package/dist/components/TimelaneSettingsProvider/TimelaneSettingsProvider.js +15 -0
  31. package/dist/components/utils.js +243 -0
  32. package/dist/hooks/useScroll.js +47 -0
  33. package/dist/hooks/useTimelaneContext.js +6 -0
  34. package/dist/index.js +36 -0
  35. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/element-adapter-native-data-key.js +4 -0
  36. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/element-adapter.js +127 -0
  37. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/get-element-from-point-without-honey-pot.js +9 -0
  38. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/honey-pot-data-attribute.js +4 -0
  39. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/is-honey-pot-element.js +7 -0
  40. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/make-honey-pot-fix.js +226 -0
  41. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/dispatch-consumer-event.js +107 -0
  42. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/lifecycle-manager.js +195 -0
  43. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/usage-ledger.js +21 -0
  44. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-adapter.js +43 -0
  45. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-drop-target.js +253 -0
  46. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-monitor.js +121 -0
  47. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/combine.js +12 -0
  48. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/once.js +17 -0
  49. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/add-attribute.js +9 -0
  50. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/android.js +8 -0
  51. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/count-events-for-safari.js +57 -0
  52. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-from-another-window.js +9 -0
  53. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-leaving-window.js +13 -0
  54. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/detect-broken-drag.js +47 -0
  55. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/get-input.js +17 -0
  56. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/is-firefox.js +7 -0
  57. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/is-safari.js +10 -0
  58. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/max-z-index.js +4 -0
  59. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/media-types/text-media-type.js +4 -0
  60. package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/media-types/url-media-type.js +4 -0
  61. package/dist/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +8 -0
  62. package/dist/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +6 -0
  63. package/dist/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +7 -0
  64. package/dist/node_modules/@babel/runtime/helpers/esm/defineProperty.js +12 -0
  65. package/dist/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +6 -0
  66. package/dist/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +21 -0
  67. package/dist/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +7 -0
  68. package/dist/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +7 -0
  69. package/dist/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +10 -0
  70. package/dist/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +10 -0
  71. package/dist/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +14 -0
  72. package/dist/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +9 -0
  73. package/dist/node_modules/@babel/runtime/helpers/esm/typeof.js +11 -0
  74. package/dist/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +11 -0
  75. package/dist/node_modules/bind-event-listener/dist/bind-all.js +45 -0
  76. package/dist/node_modules/bind-event-listener/dist/bind.js +16 -0
  77. package/dist/node_modules/bind-event-listener/dist/index.js +20 -0
  78. package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +7 -0
  79. package/dist/node_modules/date-fns/_lib/defaultOptions.js +7 -0
  80. package/dist/node_modules/date-fns/_lib/format/formatters.js +583 -0
  81. package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +59 -0
  82. package/dist/node_modules/date-fns/_lib/format/longFormatters.js +52 -0
  83. package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +18 -0
  84. package/dist/node_modules/date-fns/_lib/normalizeDates.js +11 -0
  85. package/dist/node_modules/date-fns/_lib/normalizeInterval.js +8 -0
  86. package/dist/node_modules/date-fns/_lib/protectedTokens.js +20 -0
  87. package/dist/node_modules/date-fns/addDays.js +10 -0
  88. package/dist/node_modules/date-fns/addWeeks.js +8 -0
  89. package/dist/node_modules/date-fns/constants.js +6 -0
  90. package/dist/node_modules/date-fns/constructFrom.js +8 -0
  91. package/dist/node_modules/date-fns/differenceInCalendarDays.js +16 -0
  92. package/dist/node_modules/date-fns/eachDayOfInterval.js +17 -0
  93. package/dist/node_modules/date-fns/eachMonthOfInterval.js +17 -0
  94. package/dist/node_modules/date-fns/eachWeekOfInterval.js +22 -0
  95. package/dist/node_modules/date-fns/format.js +59 -0
  96. package/dist/node_modules/date-fns/getDay.js +8 -0
  97. package/dist/node_modules/date-fns/getDayOfYear.js +11 -0
  98. package/dist/node_modules/date-fns/getISOWeek.js +12 -0
  99. package/dist/node_modules/date-fns/getISOWeekYear.js +15 -0
  100. package/dist/node_modules/date-fns/getWeek.js +12 -0
  101. package/dist/node_modules/date-fns/getWeekYear.js +17 -0
  102. package/dist/node_modules/date-fns/isDate.js +7 -0
  103. package/dist/node_modules/date-fns/isSameDay.js +14 -0
  104. package/dist/node_modules/date-fns/isSunday.js +8 -0
  105. package/dist/node_modules/date-fns/isValid.js +9 -0
  106. package/dist/node_modules/date-fns/lastDayOfMonth.js +9 -0
  107. package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +9 -0
  108. package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +18 -0
  109. package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +31 -0
  110. package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +15 -0
  111. package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +70 -0
  112. package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +33 -0
  113. package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +11 -0
  114. package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +155 -0
  115. package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +110 -0
  116. package/dist/node_modules/date-fns/locale/en-US.js +21 -0
  117. package/dist/node_modules/date-fns/max.js +14 -0
  118. package/dist/node_modules/date-fns/min.js +14 -0
  119. package/dist/node_modules/date-fns/nextDay.js +10 -0
  120. package/dist/node_modules/date-fns/nextSunday.js +8 -0
  121. package/dist/node_modules/date-fns/setHours.js +9 -0
  122. package/dist/node_modules/date-fns/startOfDay.js +9 -0
  123. package/dist/node_modules/date-fns/startOfISOWeek.js +8 -0
  124. package/dist/node_modules/date-fns/startOfISOWeekYear.js +11 -0
  125. package/dist/node_modules/date-fns/startOfWeek.js +11 -0
  126. package/dist/node_modules/date-fns/startOfWeekYear.js +13 -0
  127. package/dist/node_modules/date-fns/startOfYear.js +9 -0
  128. package/dist/node_modules/date-fns/toDate.js +8 -0
  129. package/dist/node_modules/raf-schd/dist/raf-schd.esm.js +15 -0
  130. package/dist/node_modules/re-resizable/lib/index.js +424 -0
  131. package/dist/node_modules/re-resizable/lib/resizer.js +49 -0
  132. package/dist/node_modules/react-dom/cjs/react-dom.development.js +227 -0
  133. package/dist/node_modules/react-dom/cjs/react-dom.production.js +147 -0
  134. package/dist/node_modules/react-dom/index.js +23 -0
  135. package/dist/node_modules/tiny-invariant/dist/esm/tiny-invariant.js +12 -0
  136. package/dist/types/Item.js +6 -0
  137. package/package.json +10 -7
  138. package/dist/react-timelane.css +0 -1
  139. package/dist/react-timelane.js +0 -4754
@@ -0,0 +1,424 @@
1
+ import { jsx as A, jsxs as V } from "react/jsx-runtime";
2
+ import { PureComponent as Z } from "react";
3
+ import { r as q } from "../../../_virtual/index3.js";
4
+ import { Resizer as J } from "./resizer.js";
5
+ var K = /* @__PURE__ */ function() {
6
+ var r = function(o, t) {
7
+ return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, i) {
8
+ e.__proto__ = i;
9
+ } || function(e, i) {
10
+ for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && (e[n] = i[n]);
11
+ }, r(o, t);
12
+ };
13
+ return function(o, t) {
14
+ if (typeof t != "function" && t !== null)
15
+ throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
16
+ r(o, t);
17
+ function e() {
18
+ this.constructor = o;
19
+ }
20
+ o.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
21
+ };
22
+ }(), z = function() {
23
+ return z = Object.assign || function(r) {
24
+ for (var o, t = 1, e = arguments.length; t < e; t++) {
25
+ o = arguments[t];
26
+ for (var i in o) Object.prototype.hasOwnProperty.call(o, i) && (r[i] = o[i]);
27
+ }
28
+ return r;
29
+ }, z.apply(this, arguments);
30
+ }, Q = {
31
+ width: "auto",
32
+ height: "auto"
33
+ }, B = function(r, o, t) {
34
+ return Math.max(Math.min(r, t), o);
35
+ }, O = function(r, o, t) {
36
+ var e = Math.round(r / o);
37
+ return e * o + t * (e - 1);
38
+ }, x = function(r, o) {
39
+ return new RegExp(r, "i").test(o);
40
+ }, _ = function(r) {
41
+ return !!(r.touches && r.touches.length);
42
+ }, $ = function(r) {
43
+ return !!((r.clientX || r.clientX === 0) && (r.clientY || r.clientY === 0));
44
+ }, j = function(r, o, t) {
45
+ t === void 0 && (t = 0);
46
+ var e = o.reduce(function(n, a, s) {
47
+ return Math.abs(a - r) < Math.abs(o[n] - r) ? s : n;
48
+ }, 0), i = Math.abs(o[e] - r);
49
+ return t === 0 || i < t ? o[e] : r;
50
+ }, P = function(r) {
51
+ return r = r.toString(), r === "auto" || r.endsWith("px") || r.endsWith("%") || r.endsWith("vh") || r.endsWith("vw") || r.endsWith("vmax") || r.endsWith("vmin") ? r : "".concat(r, "px");
52
+ }, N = function(r, o, t, e) {
53
+ if (r && typeof r == "string") {
54
+ if (r.endsWith("px"))
55
+ return Number(r.replace("px", ""));
56
+ if (r.endsWith("%")) {
57
+ var i = Number(r.replace("%", "")) / 100;
58
+ return o * i;
59
+ }
60
+ if (r.endsWith("vw")) {
61
+ var i = Number(r.replace("vw", "")) / 100;
62
+ return t * i;
63
+ }
64
+ if (r.endsWith("vh")) {
65
+ var i = Number(r.replace("vh", "")) / 100;
66
+ return e * i;
67
+ }
68
+ }
69
+ return r;
70
+ }, tt = function(r, o, t, e, i, n, a) {
71
+ return e = N(e, r.width, o, t), i = N(i, r.height, o, t), n = N(n, r.width, o, t), a = N(a, r.height, o, t), {
72
+ maxWidth: typeof e > "u" ? void 0 : Number(e),
73
+ maxHeight: typeof i > "u" ? void 0 : Number(i),
74
+ minWidth: typeof n > "u" ? void 0 : Number(n),
75
+ minHeight: typeof a > "u" ? void 0 : Number(a)
76
+ };
77
+ }, et = function(r) {
78
+ return Array.isArray(r) ? r : [r, r];
79
+ }, it = [
80
+ "as",
81
+ "ref",
82
+ "style",
83
+ "className",
84
+ "grid",
85
+ "gridGap",
86
+ "snap",
87
+ "bounds",
88
+ "boundsByDirection",
89
+ "size",
90
+ "defaultSize",
91
+ "minWidth",
92
+ "minHeight",
93
+ "maxWidth",
94
+ "maxHeight",
95
+ "lockAspectRatio",
96
+ "lockAspectRatioExtraWidth",
97
+ "lockAspectRatioExtraHeight",
98
+ "enable",
99
+ "handleStyles",
100
+ "handleClasses",
101
+ "handleWrapperStyle",
102
+ "handleWrapperClass",
103
+ "children",
104
+ "onResizeStart",
105
+ "onResize",
106
+ "onResizeStop",
107
+ "handleComponent",
108
+ "scale",
109
+ "resizeRatio",
110
+ "snapGap"
111
+ ], F = "__resizable_base__", ht = (
112
+ /** @class */
113
+ function(r) {
114
+ K(o, r);
115
+ function o(t) {
116
+ var e, i, n, a, s = r.call(this, t) || this;
117
+ return s.ratio = 1, s.resizable = null, s.parentLeft = 0, s.parentTop = 0, s.resizableLeft = 0, s.resizableRight = 0, s.resizableTop = 0, s.resizableBottom = 0, s.targetLeft = 0, s.targetTop = 0, s.delta = {
118
+ width: 0,
119
+ height: 0
120
+ }, s.appendBase = function() {
121
+ if (!s.resizable || !s.window)
122
+ return null;
123
+ var p = s.parentNode;
124
+ if (!p)
125
+ return null;
126
+ var h = s.window.document.createElement("div");
127
+ return h.style.width = "100%", h.style.height = "100%", h.style.position = "absolute", h.style.transform = "scale(0, 0)", h.style.left = "0", h.style.flex = "0 0 100%", h.classList ? h.classList.add(F) : h.className += F, p.appendChild(h), h;
128
+ }, s.removeBase = function(p) {
129
+ var h = s.parentNode;
130
+ h && h.removeChild(p);
131
+ }, s.state = {
132
+ isResizing: !1,
133
+ width: (i = (e = s.propsSize) === null || e === void 0 ? void 0 : e.width) !== null && i !== void 0 ? i : "auto",
134
+ height: (a = (n = s.propsSize) === null || n === void 0 ? void 0 : n.height) !== null && a !== void 0 ? a : "auto",
135
+ direction: "right",
136
+ original: {
137
+ x: 0,
138
+ y: 0,
139
+ width: 0,
140
+ height: 0
141
+ },
142
+ backgroundStyle: {
143
+ height: "100%",
144
+ width: "100%",
145
+ backgroundColor: "rgba(0,0,0,0)",
146
+ cursor: "auto",
147
+ opacity: 0,
148
+ position: "fixed",
149
+ zIndex: 9999,
150
+ top: "0",
151
+ left: "0",
152
+ bottom: "0",
153
+ right: "0"
154
+ },
155
+ flexBasis: void 0
156
+ }, s.onResizeStart = s.onResizeStart.bind(s), s.onMouseMove = s.onMouseMove.bind(s), s.onMouseUp = s.onMouseUp.bind(s), s;
157
+ }
158
+ return Object.defineProperty(o.prototype, "parentNode", {
159
+ get: function() {
160
+ return this.resizable ? this.resizable.parentNode : null;
161
+ },
162
+ enumerable: !1,
163
+ configurable: !0
164
+ }), Object.defineProperty(o.prototype, "window", {
165
+ get: function() {
166
+ return !this.resizable || !this.resizable.ownerDocument ? null : this.resizable.ownerDocument.defaultView;
167
+ },
168
+ enumerable: !1,
169
+ configurable: !0
170
+ }), Object.defineProperty(o.prototype, "propsSize", {
171
+ get: function() {
172
+ return this.props.size || this.props.defaultSize || Q;
173
+ },
174
+ enumerable: !1,
175
+ configurable: !0
176
+ }), Object.defineProperty(o.prototype, "size", {
177
+ get: function() {
178
+ var t = 0, e = 0;
179
+ if (this.resizable && this.window) {
180
+ var i = this.resizable.offsetWidth, n = this.resizable.offsetHeight, a = this.resizable.style.position;
181
+ a !== "relative" && (this.resizable.style.position = "relative"), t = this.resizable.style.width !== "auto" ? this.resizable.offsetWidth : i, e = this.resizable.style.height !== "auto" ? this.resizable.offsetHeight : n, this.resizable.style.position = a;
182
+ }
183
+ return { width: t, height: e };
184
+ },
185
+ enumerable: !1,
186
+ configurable: !0
187
+ }), Object.defineProperty(o.prototype, "sizeStyle", {
188
+ get: function() {
189
+ var t = this, e = this.props.size, i = function(s) {
190
+ var p;
191
+ if (typeof t.state[s] > "u" || t.state[s] === "auto")
192
+ return "auto";
193
+ if (t.propsSize && t.propsSize[s] && (!((p = t.propsSize[s]) === null || p === void 0) && p.toString().endsWith("%"))) {
194
+ if (t.state[s].toString().endsWith("%"))
195
+ return t.state[s].toString();
196
+ var h = t.getParentSize(), l = Number(t.state[s].toString().replace("px", "")), d = l / h[s] * 100;
197
+ return "".concat(d, "%");
198
+ }
199
+ return P(t.state[s]);
200
+ }, n = e && typeof e.width < "u" && !this.state.isResizing ? P(e.width) : i("width"), a = e && typeof e.height < "u" && !this.state.isResizing ? P(e.height) : i("height");
201
+ return { width: n, height: a };
202
+ },
203
+ enumerable: !1,
204
+ configurable: !0
205
+ }), o.prototype.getParentSize = function() {
206
+ if (!this.parentNode)
207
+ return this.window ? { width: this.window.innerWidth, height: this.window.innerHeight } : { width: 0, height: 0 };
208
+ var t = this.appendBase();
209
+ if (!t)
210
+ return { width: 0, height: 0 };
211
+ var e = !1, i = this.parentNode.style.flexWrap;
212
+ i !== "wrap" && (e = !0, this.parentNode.style.flexWrap = "wrap"), t.style.position = "relative", t.style.minWidth = "100%", t.style.minHeight = "100%";
213
+ var n = {
214
+ width: t.offsetWidth,
215
+ height: t.offsetHeight
216
+ };
217
+ return e && (this.parentNode.style.flexWrap = i), this.removeBase(t), n;
218
+ }, o.prototype.bindEvents = function() {
219
+ this.window && (this.window.addEventListener("mouseup", this.onMouseUp), this.window.addEventListener("mousemove", this.onMouseMove), this.window.addEventListener("mouseleave", this.onMouseUp), this.window.addEventListener("touchmove", this.onMouseMove, {
220
+ capture: !0,
221
+ passive: !1
222
+ }), this.window.addEventListener("touchend", this.onMouseUp));
223
+ }, o.prototype.unbindEvents = function() {
224
+ this.window && (this.window.removeEventListener("mouseup", this.onMouseUp), this.window.removeEventListener("mousemove", this.onMouseMove), this.window.removeEventListener("mouseleave", this.onMouseUp), this.window.removeEventListener("touchmove", this.onMouseMove, !0), this.window.removeEventListener("touchend", this.onMouseUp));
225
+ }, o.prototype.componentDidMount = function() {
226
+ if (!(!this.resizable || !this.window)) {
227
+ var t = this.window.getComputedStyle(this.resizable);
228
+ this.setState({
229
+ width: this.state.width || this.size.width,
230
+ height: this.state.height || this.size.height,
231
+ flexBasis: t.flexBasis !== "auto" ? t.flexBasis : void 0
232
+ });
233
+ }
234
+ }, o.prototype.componentWillUnmount = function() {
235
+ this.window && this.unbindEvents();
236
+ }, o.prototype.createSizeForCssProperty = function(t, e) {
237
+ var i = this.propsSize && this.propsSize[e];
238
+ return this.state[e] === "auto" && this.state.original[e] === t && (typeof i > "u" || i === "auto") ? "auto" : t;
239
+ }, o.prototype.calculateNewMaxFromBoundary = function(t, e) {
240
+ var i = this.props.boundsByDirection, n = this.state.direction, a = i && x("left", n), s = i && x("top", n), p, h;
241
+ if (this.props.bounds === "parent") {
242
+ var l = this.parentNode;
243
+ l && (p = a ? this.resizableRight - this.parentLeft : l.offsetWidth + (this.parentLeft - this.resizableLeft), h = s ? this.resizableBottom - this.parentTop : l.offsetHeight + (this.parentTop - this.resizableTop));
244
+ } else this.props.bounds === "window" ? this.window && (p = a ? this.resizableRight : this.window.innerWidth - this.resizableLeft, h = s ? this.resizableBottom : this.window.innerHeight - this.resizableTop) : this.props.bounds && (p = a ? this.resizableRight - this.targetLeft : this.props.bounds.offsetWidth + (this.targetLeft - this.resizableLeft), h = s ? this.resizableBottom - this.targetTop : this.props.bounds.offsetHeight + (this.targetTop - this.resizableTop));
245
+ return p && Number.isFinite(p) && (t = t && t < p ? t : p), h && Number.isFinite(h) && (e = e && e < h ? e : h), { maxWidth: t, maxHeight: e };
246
+ }, o.prototype.calculateNewSizeFromDirection = function(t, e) {
247
+ var i = this.props.scale || 1, n = et(this.props.resizeRatio || 1), a = n[0], s = n[1], p = this.state, h = p.direction, l = p.original, d = this.props, b = d.lockAspectRatio, y = d.lockAspectRatioExtraHeight, g = d.lockAspectRatioExtraWidth, u = l.width, v = l.height, w = y || 0, m = g || 0;
248
+ return x("right", h) && (u = l.width + (t - l.x) * a / i, b && (v = (u - m) / this.ratio + w)), x("left", h) && (u = l.width - (t - l.x) * a / i, b && (v = (u - m) / this.ratio + w)), x("bottom", h) && (v = l.height + (e - l.y) * s / i, b && (u = (v - w) * this.ratio + m)), x("top", h) && (v = l.height - (e - l.y) * s / i, b && (u = (v - w) * this.ratio + m)), { newWidth: u, newHeight: v };
249
+ }, o.prototype.calculateNewSizeFromAspectRatio = function(t, e, i, n) {
250
+ var a = this.props, s = a.lockAspectRatio, p = a.lockAspectRatioExtraHeight, h = a.lockAspectRatioExtraWidth, l = typeof n.width > "u" ? 10 : n.width, d = typeof i.width > "u" || i.width < 0 ? t : i.width, b = typeof n.height > "u" ? 10 : n.height, y = typeof i.height > "u" || i.height < 0 ? e : i.height, g = p || 0, u = h || 0;
251
+ if (s) {
252
+ var v = (b - g) * this.ratio + u, w = (y - g) * this.ratio + u, m = (l - u) / this.ratio + g, f = (d - u) / this.ratio + g, c = Math.max(l, v), R = Math.min(d, w), W = Math.max(b, m), M = Math.min(y, f);
253
+ t = B(t, c, R), e = B(e, W, M);
254
+ } else
255
+ t = B(t, l, d), e = B(e, b, y);
256
+ return { newWidth: t, newHeight: e };
257
+ }, o.prototype.setBoundingClientRect = function() {
258
+ var t = 1 / (this.props.scale || 1);
259
+ if (this.props.bounds === "parent") {
260
+ var e = this.parentNode;
261
+ if (e) {
262
+ var i = e.getBoundingClientRect();
263
+ this.parentLeft = i.left * t, this.parentTop = i.top * t;
264
+ }
265
+ }
266
+ if (this.props.bounds && typeof this.props.bounds != "string") {
267
+ var n = this.props.bounds.getBoundingClientRect();
268
+ this.targetLeft = n.left * t, this.targetTop = n.top * t;
269
+ }
270
+ if (this.resizable) {
271
+ var a = this.resizable.getBoundingClientRect(), s = a.left, p = a.top, h = a.right, l = a.bottom;
272
+ this.resizableLeft = s * t, this.resizableRight = h * t, this.resizableTop = p * t, this.resizableBottom = l * t;
273
+ }
274
+ }, o.prototype.onResizeStart = function(t, e) {
275
+ if (!(!this.resizable || !this.window)) {
276
+ var i = 0, n = 0;
277
+ if (t.nativeEvent && $(t.nativeEvent) ? (i = t.nativeEvent.clientX, n = t.nativeEvent.clientY) : t.nativeEvent && _(t.nativeEvent) && (i = t.nativeEvent.touches[0].clientX, n = t.nativeEvent.touches[0].clientY), this.props.onResizeStart && this.resizable) {
278
+ var a = this.props.onResizeStart(t, e, this.resizable);
279
+ if (a === !1)
280
+ return;
281
+ }
282
+ this.props.size && (typeof this.props.size.height < "u" && this.props.size.height !== this.state.height && this.setState({ height: this.props.size.height }), typeof this.props.size.width < "u" && this.props.size.width !== this.state.width && this.setState({ width: this.props.size.width })), this.ratio = typeof this.props.lockAspectRatio == "number" ? this.props.lockAspectRatio : this.size.width / this.size.height;
283
+ var s, p = this.window.getComputedStyle(this.resizable);
284
+ if (p.flexBasis !== "auto") {
285
+ var h = this.parentNode;
286
+ if (h) {
287
+ var l = this.window.getComputedStyle(h).flexDirection;
288
+ this.flexDir = l.startsWith("row") ? "row" : "column", s = p.flexBasis;
289
+ }
290
+ }
291
+ this.setBoundingClientRect(), this.bindEvents();
292
+ var d = {
293
+ original: {
294
+ x: i,
295
+ y: n,
296
+ width: this.size.width,
297
+ height: this.size.height
298
+ },
299
+ isResizing: !0,
300
+ backgroundStyle: z(z({}, this.state.backgroundStyle), { cursor: this.window.getComputedStyle(t.target).cursor || "auto" }),
301
+ direction: e,
302
+ flexBasis: s
303
+ };
304
+ this.setState(d);
305
+ }
306
+ }, o.prototype.onMouseMove = function(t) {
307
+ var e = this;
308
+ if (!(!this.state.isResizing || !this.resizable || !this.window)) {
309
+ if (this.window.TouchEvent && _(t))
310
+ try {
311
+ t.preventDefault(), t.stopPropagation();
312
+ } catch {
313
+ }
314
+ var i = this.props, n = i.maxWidth, a = i.maxHeight, s = i.minWidth, p = i.minHeight, h = _(t) ? t.touches[0].clientX : t.clientX, l = _(t) ? t.touches[0].clientY : t.clientY, d = this.state, b = d.direction, y = d.original, g = d.width, u = d.height, v = this.getParentSize(), w = tt(v, this.window.innerWidth, this.window.innerHeight, n, a, s, p);
315
+ n = w.maxWidth, a = w.maxHeight, s = w.minWidth, p = w.minHeight;
316
+ var m = this.calculateNewSizeFromDirection(h, l), f = m.newHeight, c = m.newWidth, R = this.calculateNewMaxFromBoundary(n, a);
317
+ this.props.snap && this.props.snap.x && (c = j(c, this.props.snap.x, this.props.snapGap)), this.props.snap && this.props.snap.y && (f = j(f, this.props.snap.y, this.props.snapGap));
318
+ var W = this.calculateNewSizeFromAspectRatio(c, f, { width: R.maxWidth, height: R.maxHeight }, { width: s, height: p });
319
+ if (c = W.newWidth, f = W.newHeight, this.props.grid) {
320
+ var M = O(c, this.props.grid[0], this.props.gridGap ? this.props.gridGap[0] : 0), k = O(f, this.props.grid[1], this.props.gridGap ? this.props.gridGap[1] : 0), E = this.props.snapGap || 0, U = E === 0 || Math.abs(M - c) <= E ? M : c, X = E === 0 || Math.abs(k - f) <= E ? k : f;
321
+ c = U, f = X;
322
+ }
323
+ var D = {
324
+ width: c - y.width,
325
+ height: f - y.height
326
+ };
327
+ if (this.delta = D, g && typeof g == "string") {
328
+ if (g.endsWith("%")) {
329
+ var C = c / v.width * 100;
330
+ c = "".concat(C, "%");
331
+ } else if (g.endsWith("vw")) {
332
+ var L = c / this.window.innerWidth * 100;
333
+ c = "".concat(L, "vw");
334
+ } else if (g.endsWith("vh")) {
335
+ var H = c / this.window.innerHeight * 100;
336
+ c = "".concat(H, "vh");
337
+ }
338
+ }
339
+ if (u && typeof u == "string") {
340
+ if (u.endsWith("%")) {
341
+ var C = f / v.height * 100;
342
+ f = "".concat(C, "%");
343
+ } else if (u.endsWith("vw")) {
344
+ var L = f / this.window.innerWidth * 100;
345
+ f = "".concat(L, "vw");
346
+ } else if (u.endsWith("vh")) {
347
+ var H = f / this.window.innerHeight * 100;
348
+ f = "".concat(H, "vh");
349
+ }
350
+ }
351
+ var S = {
352
+ width: this.createSizeForCssProperty(c, "width"),
353
+ height: this.createSizeForCssProperty(f, "height")
354
+ };
355
+ this.flexDir === "row" ? S.flexBasis = S.width : this.flexDir === "column" && (S.flexBasis = S.height);
356
+ var Y = this.state.width !== S.width, G = this.state.height !== S.height, I = this.state.flexBasis !== S.flexBasis, T = Y || G || I;
357
+ T && q.flushSync(function() {
358
+ e.setState(S);
359
+ }), this.props.onResize && T && this.props.onResize(t, b, this.resizable, D);
360
+ }
361
+ }, o.prototype.onMouseUp = function(t) {
362
+ var e, i, n = this.state, a = n.isResizing, s = n.direction;
363
+ n.original, !(!a || !this.resizable) && (this.props.onResizeStop && this.props.onResizeStop(t, s, this.resizable, this.delta), this.props.size && this.setState({ width: (e = this.props.size.width) !== null && e !== void 0 ? e : "auto", height: (i = this.props.size.height) !== null && i !== void 0 ? i : "auto" }), this.unbindEvents(), this.setState({
364
+ isResizing: !1,
365
+ backgroundStyle: z(z({}, this.state.backgroundStyle), { cursor: "auto" })
366
+ }));
367
+ }, o.prototype.updateSize = function(t) {
368
+ var e, i;
369
+ this.setState({ width: (e = t.width) !== null && e !== void 0 ? e : "auto", height: (i = t.height) !== null && i !== void 0 ? i : "auto" });
370
+ }, o.prototype.renderResizer = function() {
371
+ var t = this, e = this.props, i = e.enable, n = e.handleStyles, a = e.handleClasses, s = e.handleWrapperStyle, p = e.handleWrapperClass, h = e.handleComponent;
372
+ if (!i)
373
+ return null;
374
+ var l = Object.keys(i).map(function(d) {
375
+ return i[d] !== !1 ? A(J, { direction: d, onResizeStart: t.onResizeStart, replaceStyles: n && n[d], className: a && a[d], children: h && h[d] ? h[d] : null }, d) : null;
376
+ });
377
+ return A("div", { className: p, style: s, children: l });
378
+ }, o.prototype.render = function() {
379
+ var t = this, e = Object.keys(this.props).reduce(function(a, s) {
380
+ return it.indexOf(s) !== -1 || (a[s] = t.props[s]), a;
381
+ }, {}), i = z(z(z({ position: "relative", userSelect: this.state.isResizing ? "none" : "auto" }, this.props.style), this.sizeStyle), { maxWidth: this.props.maxWidth, maxHeight: this.props.maxHeight, minWidth: this.props.minWidth, minHeight: this.props.minHeight, boxSizing: "border-box", flexShrink: 0 });
382
+ this.state.flexBasis && (i.flexBasis = this.state.flexBasis);
383
+ var n = this.props.as || "div";
384
+ return V(n, z({ style: i, className: this.props.className }, e, {
385
+ // `ref` is after `extendsProps` to ensure this one wins over a version
386
+ // passed in
387
+ ref: function(a) {
388
+ a && (t.resizable = a);
389
+ },
390
+ children: [this.state.isResizing && A("div", { style: this.state.backgroundStyle }), this.props.children, this.renderResizer()]
391
+ }));
392
+ }, o.defaultProps = {
393
+ as: "div",
394
+ onResizeStart: function() {
395
+ },
396
+ onResize: function() {
397
+ },
398
+ onResizeStop: function() {
399
+ },
400
+ enable: {
401
+ top: !0,
402
+ right: !0,
403
+ bottom: !0,
404
+ left: !0,
405
+ topRight: !0,
406
+ bottomRight: !0,
407
+ bottomLeft: !0,
408
+ topLeft: !0
409
+ },
410
+ style: {},
411
+ grid: [1, 1],
412
+ gridGap: [0, 0],
413
+ lockAspectRatio: !1,
414
+ lockAspectRatioExtraWidth: 0,
415
+ lockAspectRatioExtraHeight: 0,
416
+ scale: 1,
417
+ resizeRatio: 1,
418
+ snapGap: 0
419
+ }, o;
420
+ }(Z)
421
+ );
422
+ export {
423
+ ht as Resizable
424
+ };
@@ -0,0 +1,49 @@
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import { memo as m, useCallback as u, useMemo as g } from "react";
3
+ var e = function() {
4
+ return e = Object.assign || function(r) {
5
+ for (var o, t = 1, s = arguments.length; t < s; t++) {
6
+ o = arguments[t];
7
+ for (var n in o) Object.prototype.hasOwnProperty.call(o, n) && (r[n] = o[n]);
8
+ }
9
+ return r;
10
+ }, e.apply(this, arguments);
11
+ }, l = {
12
+ width: "100%",
13
+ height: "10px",
14
+ top: "0px",
15
+ left: "0px",
16
+ cursor: "row-resize"
17
+ }, c = {
18
+ width: "10px",
19
+ height: "100%",
20
+ top: "0px",
21
+ left: "0px",
22
+ cursor: "col-resize"
23
+ }, i = {
24
+ width: "20px",
25
+ height: "20px",
26
+ position: "absolute",
27
+ zIndex: 1
28
+ }, v = {
29
+ top: e(e({}, l), { top: "-5px" }),
30
+ right: e(e({}, c), { left: void 0, right: "-5px" }),
31
+ bottom: e(e({}, l), { top: void 0, bottom: "-5px" }),
32
+ left: e(e({}, c), { left: "-5px" }),
33
+ topRight: e(e({}, i), { right: "-10px", top: "-10px", cursor: "ne-resize" }),
34
+ bottomRight: e(e({}, i), { right: "-10px", bottom: "-10px", cursor: "se-resize" }),
35
+ bottomLeft: e(e({}, i), { left: "-10px", bottom: "-10px", cursor: "sw-resize" }),
36
+ topLeft: e(e({}, i), { left: "-10px", top: "-10px", cursor: "nw-resize" })
37
+ }, w = m(function(r) {
38
+ var o = r.onResizeStart, t = r.direction, s = r.children, n = r.replaceStyles, p = r.className, f = u(function(a) {
39
+ o(a, t);
40
+ }, [o, t]), h = u(function(a) {
41
+ o(a, t);
42
+ }, [o, t]), x = g(function() {
43
+ return e(e({ position: "absolute", userSelect: "none" }, v[t]), n ?? {});
44
+ }, [n, t]);
45
+ return d("div", { className: p || void 0, style: x, onMouseDown: f, onTouchStart: h, children: s });
46
+ });
47
+ export {
48
+ w as Resizer
49
+ };