@bigbinary/neeto-molecules 3.11.1 → 3.12.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.
package/README.md CHANGED
@@ -12,6 +12,7 @@ https://neeto-molecules.neeto.com/
12
12
  ## Exported Components
13
13
 
14
14
  - [AuditLogs](./docs/components/AuditLogs.md)
15
+ - [BoardView](./docs/components/BoardView.md)
15
16
  - [Breadcrumbs](./docs/components/Breadcrumbs.md)
16
17
  - [BrowserSupport](./docs/components/BrowserSupport.md)
17
18
  - [Builder](./docs/components/Builder.md)
@@ -0,0 +1,377 @@
1
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
+ import { useRef, useId, forwardRef, createElement, useState } from 'react';
3
+ import { DragOverlay, useDraggable, useDroppable, useSensors, useSensor, PointerSensor, DndContext } from '@dnd-kit/core';
4
+ import { n } from './inject-css-DmrvuTKK.js';
5
+ import { jsxs, jsx } from 'react/jsx-runtime';
6
+ import { P as PropTypes } from './index-DAYCJu79.js';
7
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
8
+ import classnames from 'classnames';
9
+ import { useInView } from 'react-intersection-observer';
10
+ import './_commonjsHelpers-BFTU3MAI.js';
11
+
12
+ var css = ".neeto-molecules-boardview-section{flex-shrink:0;width:320px}@media screen and (max-width:1024px){.neeto-molecules-boardview-section{width:300px}}@media screen and (max-width:768px){.neeto-molecules-boardview-section{width:280px}}";
13
+ n(css,{});
14
+
15
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
16
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
17
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
18
+ // Customised collision detection algorithm based on `closestCenter` implementation for dnd-kit
19
+ // Extracts collisions by respecting `accepts` property
20
+
21
+ var distanceBetween = function distanceBetween(p1, p2) {
22
+ return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
23
+ };
24
+ var centerOfRectangle = function centerOfRectangle(rect) {
25
+ var left = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : rect.left;
26
+ var top = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : rect.top;
27
+ return {
28
+ x: left + rect.width * 0.5,
29
+ y: top + rect.height * 0.5
30
+ };
31
+ };
32
+ var matchType = function matchType(draggable, droppable) {
33
+ return droppable.data.current.accepts.includes(draggable.data.current.type);
34
+ };
35
+
36
+ // `active` attribute from the `dnd-kit` is unreliable since the data can be lost on unmount during a drag.
37
+ var closestCenter = function closestCenter(_ref) {
38
+ var active = _ref.active;
39
+ return function (_ref2) {
40
+ var collisionRect = _ref2.collisionRect,
41
+ droppableRects = _ref2.droppableRects,
42
+ droppableContainers = _ref2.droppableContainers;
43
+ var centerRect = centerOfRectangle(collisionRect, collisionRect.left, collisionRect.top);
44
+ var minDistance = Number.POSITIVE_INFINITY;
45
+ var collision = {
46
+ id: undefined
47
+ };
48
+
49
+ // eslint-disable-next-line @bigbinary/neeto/use-array-methods
50
+ var _iterator = _createForOfIteratorHelper(droppableContainers),
51
+ _step;
52
+ try {
53
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
54
+ var droppableContainer = _step.value;
55
+ var rect = droppableRects.get(droppableContainer.id);
56
+ if (!rect || droppableContainer.id === active.id) continue;else if (!matchType(active, droppableContainer)) continue;
57
+ var distance = distanceBetween(centerOfRectangle(rect), centerRect);
58
+ if (distance < minDistance) {
59
+ minDistance = distance;
60
+ collision = {
61
+ id: droppableContainer.id,
62
+ data: {
63
+ droppableContainer: droppableContainer,
64
+ value: distance
65
+ }
66
+ };
67
+ }
68
+ }
69
+ } catch (err) {
70
+ _iterator.e(err);
71
+ } finally {
72
+ _iterator.f();
73
+ }
74
+ return [collision];
75
+ };
76
+ };
77
+
78
+ var DRAGGABLE_TYPES = {
79
+ SECTION: "section",
80
+ ITEM: "item"
81
+ };
82
+
83
+ var DndOverlay = function DndOverlay(_ref) {
84
+ var _state$active;
85
+ var props = _ref.props,
86
+ state = _ref.state;
87
+ var renderSectionOverlay = props.renderSectionOverlay,
88
+ renderItemOverlay = props.renderItemOverlay;
89
+ var data = ((_state$active = state.active) === null || _state$active === void 0 ? void 0 : _state$active.data.current) || {};
90
+ return /*#__PURE__*/jsxs(DragOverlay, {
91
+ children: [data.type === DRAGGABLE_TYPES.ITEM && (renderItemOverlay === null || renderItemOverlay === void 0 ? void 0 : renderItemOverlay(data)), data.type === DRAGGABLE_TYPES.SECTION && (renderSectionOverlay === null || renderSectionOverlay === void 0 ? void 0 : renderSectionOverlay(data))]
92
+ });
93
+ };
94
+
95
+ var DndIndicator = function DndIndicator(_ref) {
96
+ var _ref$layout = _ref.layout,
97
+ layout = _ref$layout === void 0 ? "vertical" : _ref$layout;
98
+ return /*#__PURE__*/jsx("div", {
99
+ className: classnames("neeto-ui-rounded-xl neeto-ui-bg-accent-600 absolute", {
100
+ "-bottom-3 left-0 right-0 h-1": layout === "horizontal",
101
+ "-right-2 bottom-0 top-0 w-1": layout === "vertical"
102
+ })
103
+ });
104
+ };
105
+
106
+ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
107
+ function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
108
+ var ItemContainer = function ItemContainer(_ref) {
109
+ var id = _ref.id,
110
+ index = _ref.index,
111
+ data = _ref.data,
112
+ render = _ref.render;
113
+ var mutables = useRef({
114
+ containerHeight: 128
115
+ }).current;
116
+ var _useDraggable = useDraggable({
117
+ data: _objectSpread$3(_objectSpread$3({}, data), {}, {
118
+ index: index,
119
+ type: DRAGGABLE_TYPES.ITEM
120
+ }),
121
+ id: id
122
+ }),
123
+ attributes = _useDraggable.attributes,
124
+ listeners = _useDraggable.listeners,
125
+ isDragging = _useDraggable.isDragging,
126
+ setDraggableNodeRef = _useDraggable.setNodeRef;
127
+ var _useDroppable = useDroppable({
128
+ data: _objectSpread$3(_objectSpread$3({}, data), {}, {
129
+ accepts: [DRAGGABLE_TYPES.ITEM],
130
+ index: index + 1
131
+ }),
132
+ id: id
133
+ }),
134
+ isOver = _useDroppable.isOver,
135
+ setDroppableNodeRef = _useDroppable.setNodeRef;
136
+ var _useInView = useInView({
137
+ onChange: function onChange(inView, entry) {
138
+ if (inView) return; // We need the last height value when elements moves out.
139
+ mutables.containerHeight = entry.target.clientHeight;
140
+ }
141
+ }),
142
+ _useInView2 = _slicedToArray(_useInView, 2),
143
+ setViewRef = _useInView2[0],
144
+ inView = _useInView2[1];
145
+ var isIndicatorVisible = !isDragging && isOver;
146
+ return /*#__PURE__*/jsxs("div", _objectSpread$3(_objectSpread$3({
147
+ className: classnames("relative mt-4", {
148
+ "opacity-65": isDragging
149
+ }),
150
+ ref: function ref(node) {
151
+ setDraggableNodeRef(node);
152
+ setDroppableNodeRef(node);
153
+ setViewRef(node);
154
+ }
155
+ }, _objectSpread$3(_objectSpread$3({
156
+ id: id
157
+ }, attributes), listeners)), {}, {
158
+ style: {
159
+ height: inView ? undefined : mutables.containerHeight
160
+ },
161
+ children: [inView && render(), isIndicatorVisible && /*#__PURE__*/jsx(DndIndicator, {
162
+ layout: "horizontal"
163
+ })]
164
+ }));
165
+ };
166
+
167
+ function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
168
+ function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
169
+ var ItemPlaceholder = function ItemPlaceholder(_ref) {
170
+ var data = _ref.data,
171
+ _ref$index = _ref.index,
172
+ index = _ref$index === void 0 ? 0 : _ref$index;
173
+ var id = useId();
174
+ var _useDroppable = useDroppable({
175
+ data: _objectSpread$2(_objectSpread$2({}, data), {}, {
176
+ accepts: [DRAGGABLE_TYPES.ITEM],
177
+ index: index
178
+ }),
179
+ id: id
180
+ }),
181
+ isOver = _useDroppable.isOver,
182
+ setNodeRef = _useDroppable.setNodeRef;
183
+ return /*#__PURE__*/jsx("div", {
184
+ className: "relative",
185
+ ref: setNodeRef,
186
+ children: isOver && /*#__PURE__*/jsx(DndIndicator, {
187
+ layout: "horizontal"
188
+ })
189
+ });
190
+ };
191
+
192
+ var Section = /*#__PURE__*/forwardRef(function (_ref, ref) {
193
+ var section = _ref.section,
194
+ items = _ref.items,
195
+ renderItem = _ref.renderItem;
196
+ return /*#__PURE__*/jsxs("div", {
197
+ ref: ref,
198
+ className: "relative min-h-0 flex-1 basis-0 overflow-auto",
199
+ children: [/*#__PURE__*/jsx(ItemPlaceholder, {
200
+ data: {
201
+ section: section
202
+ }
203
+ }), items.map(function (item, index) {
204
+ return /*#__PURE__*/createElement(ItemContainer, {
205
+ index: index,
206
+ data: {
207
+ section: section,
208
+ item: item
209
+ },
210
+ id: item.id,
211
+ key: item.id,
212
+ render: function render() {
213
+ return renderItem({
214
+ index: index,
215
+ item: item,
216
+ section: section
217
+ });
218
+ }
219
+ });
220
+ })]
221
+ });
222
+ });
223
+ Section.displayName = "Section";
224
+ Section.propTypes = {
225
+ /** A reference to the section container element. */
226
+ ref: PropTypes.any,
227
+ /** The current section data */
228
+ section: PropTypes.shape({
229
+ id: PropTypes.string.isRequired
230
+ }).isRequired,
231
+ /** An array of items belonging to the current section. */
232
+ items: PropTypes.arrayOf(PropTypes.shape({
233
+ id: PropTypes.string.isRequired
234
+ })).isRequired,
235
+ /** A function that renders the content of each item in the list. */
236
+ renderItem: PropTypes.func.isRequired
237
+ };
238
+
239
+ function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
240
+ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
241
+ var SectionContainer = function SectionContainer(_ref) {
242
+ var id = _ref.id,
243
+ index = _ref.index,
244
+ data = _ref.data,
245
+ render = _ref.render;
246
+ var _useInView = useInView(),
247
+ _useInView2 = _slicedToArray(_useInView, 2),
248
+ setViewRef = _useInView2[0],
249
+ inView = _useInView2[1];
250
+ var _useDraggable = useDraggable({
251
+ data: _objectSpread$1(_objectSpread$1({}, data), {}, {
252
+ type: DRAGGABLE_TYPES.SECTION,
253
+ index: index
254
+ }),
255
+ id: id
256
+ }),
257
+ attributes = _useDraggable.attributes,
258
+ listeners = _useDraggable.listeners,
259
+ isDragging = _useDraggable.isDragging,
260
+ setDraggableNodeRef = _useDraggable.setNodeRef;
261
+ var _useDroppable = useDroppable({
262
+ data: _objectSpread$1(_objectSpread$1({}, data), {}, {
263
+ accepts: [DRAGGABLE_TYPES.SECTION],
264
+ index: index + 1
265
+ }),
266
+ id: id
267
+ }),
268
+ isOver = _useDroppable.isOver,
269
+ setDroppableNodeRef = _useDroppable.setNodeRef;
270
+ var isIndicatorVisible = !isDragging && isOver;
271
+ return /*#__PURE__*/jsxs("div", _objectSpread$1(_objectSpread$1(_objectSpread$1({}, listeners), attributes), {}, {
272
+ className: classnames("neeto-molecules-boardview-section relative ml-3 flex h-full flex-col", {
273
+ "opacity-65": isDragging
274
+ }),
275
+ ref: function ref(node) {
276
+ setDraggableNodeRef(node);
277
+ setDroppableNodeRef(node);
278
+ setViewRef(node);
279
+ },
280
+ children: [inView && render(), isIndicatorVisible && /*#__PURE__*/jsx(DndIndicator, {
281
+ layout: "vertical"
282
+ })]
283
+ }));
284
+ };
285
+
286
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
287
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
288
+ var SectionPlaceholder = function SectionPlaceholder(_ref) {
289
+ var data = _ref.data,
290
+ _ref$index = _ref.index,
291
+ index = _ref$index === void 0 ? 0 : _ref$index;
292
+ var id = useId();
293
+ var _useDroppable = useDroppable({
294
+ data: _objectSpread(_objectSpread({}, data), {}, {
295
+ accepts: [DRAGGABLE_TYPES.SECTION],
296
+ index: index
297
+ }),
298
+ id: id
299
+ }),
300
+ isOver = _useDroppable.isOver,
301
+ setNodeRef = _useDroppable.setNodeRef;
302
+ return /*#__PURE__*/jsx("div", {
303
+ className: "relative",
304
+ ref: setNodeRef,
305
+ children: isOver && /*#__PURE__*/jsx(DndIndicator, {
306
+ layout: "vertical"
307
+ })
308
+ });
309
+ };
310
+
311
+ var sensorConfig = {
312
+ activationConstraint: {
313
+ distance: 8
314
+ }
315
+ };
316
+ var measuringConfig = {
317
+ droppable: {
318
+ frequency: 500
319
+ }
320
+ };
321
+ var BoardView = /*#__PURE__*/forwardRef(function (props, ref) {
322
+ var sections = props.sections,
323
+ onMoveSection = props.onMoveSection,
324
+ onMoveItem = props.onMoveItem,
325
+ renderSection = props.renderSection;
326
+ var _useState = useState({}),
327
+ _useState2 = _slicedToArray(_useState, 2),
328
+ dragState = _useState2[0],
329
+ setDragState = _useState2[1];
330
+ var sensors = useSensors(useSensor(PointerSensor, sensorConfig));
331
+ var onDragEnd = function onDragEnd(drag) {
332
+ var _drag$over;
333
+ var active = dragState.active.data.current;
334
+ var over = (_drag$over = drag.over) === null || _drag$over === void 0 ? void 0 : _drag$over.data.current;
335
+ if (!active || !over) return;
336
+ if (active.type === DRAGGABLE_TYPES.ITEM) {
337
+ onMoveItem === null || onMoveItem === void 0 ? void 0 : onMoveItem(active, over);
338
+ } else if (active.type === DRAGGABLE_TYPES.SECTION) {
339
+ onMoveSection === null || onMoveSection === void 0 ? void 0 : onMoveSection(active, over);
340
+ }
341
+ };
342
+ return /*#__PURE__*/jsxs(DndContext, {
343
+ onDragEnd: onDragEnd,
344
+ sensors: sensors,
345
+ collisionDetection: closestCenter(dragState),
346
+ measuring: measuringConfig,
347
+ onDragStart: setDragState,
348
+ children: [/*#__PURE__*/jsxs("div", {
349
+ ref: ref,
350
+ className: "flex w-full flex-1 overflow-x-auto p-3",
351
+ children: [/*#__PURE__*/jsx(SectionPlaceholder, {}), sections.map(function (section, index) {
352
+ return /*#__PURE__*/createElement(SectionContainer, {
353
+ index: index,
354
+ data: {
355
+ section: section
356
+ },
357
+ id: section.id,
358
+ key: section.id,
359
+ render: function render() {
360
+ return renderSection({
361
+ index: index,
362
+ section: section
363
+ });
364
+ }
365
+ });
366
+ })]
367
+ }), /*#__PURE__*/jsx(DndOverlay, {
368
+ props: props,
369
+ state: dragState
370
+ })]
371
+ });
372
+ });
373
+ BoardView.displayName = "BoardView";
374
+ BoardView.Section = Section;
375
+
376
+ export { BoardView as default };
377
+ //# sourceMappingURL=BoardView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BoardView.js","sources":["../src/components/BoardView/closestCenter.js","../src/components/BoardView/constants.js","../src/components/BoardView/Overlay.jsx","../src/components/BoardView/Indicator.jsx","../src/components/BoardView/Item/Container.jsx","../src/components/BoardView/Item/Placeholder.jsx","../src/components/BoardView/Section/index.jsx","../src/components/BoardView/Section/Container.jsx","../src/components/BoardView/Section/Placeholder.jsx","../src/components/BoardView/index.jsx"],"sourcesContent":["// Customised collision detection algorithm based on `closestCenter` implementation for dnd-kit\n// Extracts collisions by respecting `accepts` property\n\nconst distanceBetween = (p1, p2) =>\n Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));\n\nconst centerOfRectangle = (rect, left = rect.left, top = rect.top) => ({\n x: left + rect.width * 0.5,\n y: top + rect.height * 0.5,\n});\n\nconst matchType = (draggable, droppable) =>\n droppable.data.current.accepts.includes(draggable.data.current.type);\n\n// `active` attribute from the `dnd-kit` is unreliable since the data can be lost on unmount during a drag.\nexport const closestCenter =\n ({ active }) =>\n ({ collisionRect, droppableRects, droppableContainers }) => {\n const centerRect = centerOfRectangle(\n collisionRect,\n collisionRect.left,\n collisionRect.top\n );\n\n let minDistance = Number.POSITIVE_INFINITY;\n let collision = { id: undefined };\n\n // eslint-disable-next-line @bigbinary/neeto/use-array-methods\n for (const droppableContainer of droppableContainers) {\n const rect = droppableRects.get(droppableContainer.id);\n\n if (!rect || droppableContainer.id === active.id) continue;\n else if (!matchType(active, droppableContainer)) continue;\n\n const distance = distanceBetween(centerOfRectangle(rect), centerRect);\n if (distance < minDistance) {\n minDistance = distance;\n collision = {\n id: droppableContainer.id,\n data: { droppableContainer, value: distance },\n };\n }\n }\n\n return [collision];\n };\n","export const DRAGGABLE_TYPES = { SECTION: \"section\", ITEM: \"item\" };\n","import { DragOverlay } from \"@dnd-kit/core\";\n\nimport { DRAGGABLE_TYPES } from \"./constants\";\n\nconst DndOverlay = ({ props, state }) => {\n const { renderSectionOverlay, renderItemOverlay } = props;\n const data = state.active?.data.current || {};\n\n return (\n <DragOverlay>\n {data.type === DRAGGABLE_TYPES.ITEM && renderItemOverlay?.(data)}\n {data.type === DRAGGABLE_TYPES.SECTION && renderSectionOverlay?.(data)}\n </DragOverlay>\n );\n};\n\nexport default DndOverlay;\n","import classNames from \"classnames\";\n\nconst DndIndicator = ({ layout = \"vertical\" }) => (\n <div\n className={classNames(\n \"neeto-ui-rounded-xl neeto-ui-bg-accent-600 absolute\",\n {\n \"-bottom-3 left-0 right-0 h-1\": layout === \"horizontal\",\n \"-right-2 bottom-0 top-0 w-1\": layout === \"vertical\",\n }\n )}\n />\n);\n\nexport default DndIndicator;\n","import { useRef } from \"react\";\n\nimport { useDraggable, useDroppable } from \"@dnd-kit/core\";\nimport classNames from \"classnames\";\nimport { useInView } from \"react-intersection-observer\";\n\nimport { DRAGGABLE_TYPES } from \"../constants\";\nimport DndIndicator from \"../Indicator\";\n\nconst ItemContainer = ({ id, index, data, render }) => {\n const mutables = useRef({ containerHeight: 128 }).current;\n\n const {\n attributes,\n listeners,\n isDragging,\n setNodeRef: setDraggableNodeRef,\n } = useDraggable({\n data: { ...data, index, type: DRAGGABLE_TYPES.ITEM },\n id,\n });\n\n const { isOver, setNodeRef: setDroppableNodeRef } = useDroppable({\n data: { ...data, accepts: [DRAGGABLE_TYPES.ITEM], index: index + 1 },\n id,\n });\n\n const [setViewRef, inView] = useInView({\n onChange: (inView, entry) => {\n if (inView) return; // We need the last height value when elements moves out.\n mutables.containerHeight = entry.target.clientHeight;\n },\n });\n\n const isIndicatorVisible = !isDragging && isOver;\n\n return (\n <div\n className={classNames(\"relative mt-4\", {\n \"opacity-65\": isDragging,\n })}\n ref={node => {\n setDraggableNodeRef(node);\n setDroppableNodeRef(node);\n setViewRef(node);\n }}\n {...{ id, ...attributes, ...listeners }}\n style={{ height: inView ? undefined : mutables.containerHeight }}\n >\n {inView && render()}\n {isIndicatorVisible && <DndIndicator layout=\"horizontal\" />}\n </div>\n );\n};\n\nexport default ItemContainer;\n","import { useId } from \"react\";\n\nimport { useDroppable } from \"@dnd-kit/core\";\n\nimport { DRAGGABLE_TYPES } from \"../constants\";\nimport DndIndicator from \"../Indicator\";\n\nconst ItemPlaceholder = ({ data, index = 0 }) => {\n const id = useId();\n\n const { isOver, setNodeRef } = useDroppable({\n data: { ...data, accepts: [DRAGGABLE_TYPES.ITEM], index },\n id,\n });\n\n return (\n <div className=\"relative\" ref={setNodeRef}>\n {isOver && <DndIndicator layout=\"horizontal\" />}\n </div>\n );\n};\n\nexport default ItemPlaceholder;\n","import { forwardRef } from \"react\";\n\nimport PropTypes from \"prop-types\";\n\nimport ItemContainer from \"../Item/Container\";\nimport ItemPlaceholder from \"../Item/Placeholder\";\n\nconst Section = forwardRef(({ section, items, renderItem }, ref) => (\n <div {...{ ref }} className=\"relative min-h-0 flex-1 basis-0 overflow-auto\">\n <ItemPlaceholder data={{ section }} />\n {items.map((item, index) => (\n <ItemContainer\n {...{ index }}\n data={{ section, item }}\n id={item.id}\n key={item.id}\n render={() => renderItem({ index, item, section })}\n />\n ))}\n </div>\n));\n\nSection.displayName = \"Section\";\nSection.propTypes = {\n /** A reference to the section container element. */\n ref: PropTypes.any,\n\n /** The current section data */\n section: PropTypes.shape({ id: PropTypes.string.isRequired }).isRequired,\n\n /** An array of items belonging to the current section. */\n items: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string.isRequired }))\n .isRequired,\n\n /** A function that renders the content of each item in the list. */\n renderItem: PropTypes.func.isRequired,\n};\n\nexport default Section;\n","import { useDraggable, useDroppable } from \"@dnd-kit/core\";\nimport classNames from \"classnames\";\nimport { useInView } from \"react-intersection-observer\";\n\nimport { DRAGGABLE_TYPES } from \"../constants\";\nimport DndIndicator from \"../Indicator\";\n\nconst SectionContainer = ({ id, index, data, render }) => {\n const [setViewRef, inView] = useInView();\n\n const {\n attributes,\n listeners,\n isDragging,\n setNodeRef: setDraggableNodeRef,\n } = useDraggable({\n data: { ...data, type: DRAGGABLE_TYPES.SECTION, index },\n id,\n });\n\n const { isOver, setNodeRef: setDroppableNodeRef } = useDroppable({\n data: { ...data, accepts: [DRAGGABLE_TYPES.SECTION], index: index + 1 },\n id,\n });\n\n const isIndicatorVisible = !isDragging && isOver;\n\n return (\n <div\n {...listeners}\n {...attributes}\n className={classNames(\n \"neeto-molecules-boardview-section relative ml-3 flex h-full flex-col\",\n { \"opacity-65\": isDragging }\n )}\n ref={node => {\n setDraggableNodeRef(node);\n setDroppableNodeRef(node);\n setViewRef(node);\n }}\n >\n {inView && render()}\n {isIndicatorVisible && <DndIndicator layout=\"vertical\" />}\n </div>\n );\n};\n\nexport default SectionContainer;\n","import { useId } from \"react\";\n\nimport { useDroppable } from \"@dnd-kit/core\";\n\nimport { DRAGGABLE_TYPES } from \"../constants\";\nimport DndIndicator from \"../Indicator\";\n\nconst SectionPlaceholder = ({ data, index = 0 }) => {\n const id = useId();\n\n const { isOver, setNodeRef } = useDroppable({\n data: { ...data, accepts: [DRAGGABLE_TYPES.SECTION], index },\n id,\n });\n\n return (\n <div className=\"relative\" ref={setNodeRef}>\n {isOver && <DndIndicator layout=\"vertical\" />}\n </div>\n );\n};\n\nexport default SectionPlaceholder;\n","import { forwardRef, useState } from \"react\";\n\nimport {\n DndContext,\n PointerSensor,\n useSensor,\n useSensors,\n} from \"@dnd-kit/core\";\nimport PropTypes from \"prop-types\";\n\nimport \"./boardview.scss\";\nimport { closestCenter } from \"./closestCenter\";\nimport { DRAGGABLE_TYPES } from \"./constants\";\nimport DndOverlay from \"./Overlay\";\nimport Section from \"./Section\";\nimport SectionContainer from \"./Section/Container\";\nimport SectionPlaceholder from \"./Section/Placeholder\";\n\nconst sensorConfig = { activationConstraint: { distance: 8 } };\nconst measuringConfig = { droppable: { frequency: 500 } };\n\nconst BoardView = forwardRef((props, ref) => {\n const { sections, onMoveSection, onMoveItem, renderSection } = props;\n\n const [dragState, setDragState] = useState({});\n const sensors = useSensors(useSensor(PointerSensor, sensorConfig));\n\n const onDragEnd = drag => {\n const active = dragState.active.data.current;\n const over = drag.over?.data.current;\n if (!active || !over) return;\n\n if (active.type === DRAGGABLE_TYPES.ITEM) {\n onMoveItem?.(active, over);\n } else if (active.type === DRAGGABLE_TYPES.SECTION) {\n onMoveSection?.(active, over);\n }\n };\n\n return (\n <DndContext\n {...{ onDragEnd, sensors }}\n collisionDetection={closestCenter(dragState)}\n measuring={measuringConfig}\n onDragStart={setDragState}\n >\n <div {...{ ref }} className=\"flex w-full flex-1 overflow-x-auto p-3\">\n <SectionPlaceholder />\n {sections.map((section, index) => (\n <SectionContainer\n {...{ index }}\n data={{ section }}\n id={section.id}\n key={section.id}\n render={() => renderSection({ index, section })}\n />\n ))}\n </div>\n <DndOverlay {...{ props }} state={dragState} />\n </DndContext>\n );\n});\n\nBoardView.displayName = \"BoardView\";\nBoardView.Section = Section;\nBoardView.propTypes = {\n /** A reference to the container element. */\n ref: PropTypes.any,\n\n /**\n An array of sections, each defined by an object with an `id` string.\n */\n sections: PropTypes.arrayOf(\n PropTypes.shape({ id: PropTypes.string.isRequired })\n ).isRequired,\n\n /** function to render each section content in the board view */\n renderSection: PropTypes.func.isRequired,\n\n /** A function to render a drag overlay for individual sections (drag preview) */\n renderSectionOverlay: PropTypes.func.isRequired,\n\n /** A function to render a drag overlay for individual items (drag preview) */\n renderItemOverlay: PropTypes.func.isRequired,\n\n /** Callback function triggered when a section is reordered */\n onMoveSection: PropTypes.func,\n\n /** Callback function triggered when an item is moved */\n onMoveItem: PropTypes.func,\n};\n\nexport default BoardView;\n"],"names":["distanceBetween","p1","p2","Math","sqrt","pow","x","y","centerOfRectangle","rect","left","arguments","length","undefined","top","width","height","matchType","draggable","droppable","data","current","accepts","includes","type","closestCenter","_ref","active","_ref2","collisionRect","droppableRects","droppableContainers","centerRect","minDistance","Number","POSITIVE_INFINITY","collision","id","_iterator","_createForOfIteratorHelper","_step","s","n","done","droppableContainer","value","get","distance","err","e","f","DRAGGABLE_TYPES","SECTION","ITEM","DndOverlay","_state$active","props","state","renderSectionOverlay","renderItemOverlay","_jsxs","DragOverlay","children","DndIndicator","_ref$layout","layout","_jsx","className","classNames","ItemContainer","index","render","mutables","useRef","containerHeight","_useDraggable","useDraggable","_objectSpread","attributes","listeners","isDragging","setDraggableNodeRef","setNodeRef","_useDroppable","useDroppable","isOver","setDroppableNodeRef","_useInView","useInView","onChange","inView","entry","target","clientHeight","_useInView2","_slicedToArray","setViewRef","isIndicatorVisible","ref","node","style","ItemPlaceholder","_ref$index","useId","Section","forwardRef","section","items","renderItem","map","item","_createElement","key","displayName","propTypes","PropTypes","any","shape","string","isRequired","arrayOf","func","SectionContainer","SectionPlaceholder","sensorConfig","activationConstraint","measuringConfig","frequency","BoardView","sections","onMoveSection","onMoveItem","renderSection","_useState","useState","_useState2","dragState","setDragState","sensors","useSensors","useSensor","PointerSensor","onDragEnd","drag","_drag$over","over","DndContext","collisionDetection","measuring","onDragStart"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AACA;;AAEA,IAAMA,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,EAAE,EAAEC,EAAE,EAAA;AAAA,EAAA,OAC7BC,IAAI,CAACC,IAAI,CAACD,IAAI,CAACE,GAAG,CAACJ,EAAE,CAACK,CAAC,GAAGJ,EAAE,CAACI,CAAC,EAAE,CAAC,CAAC,GAAGH,IAAI,CAACE,GAAG,CAACJ,EAAE,CAACM,CAAC,GAAGL,EAAE,CAACK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAAA,CAAA,CAAA;AAEhE,IAAMC,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAIC,IAAI,EAAA;AAAA,EAAA,IAAEC,IAAI,GAAAC,SAAA,CAAAC,MAAA,GAAAD,CAAAA,IAAAA,SAAA,CAAAE,CAAAA,CAAAA,KAAAA,SAAA,GAAAF,SAAA,CAAGF,CAAAA,CAAAA,GAAAA,IAAI,CAACC,IAAI,CAAA;AAAA,EAAA,IAAEI,GAAG,GAAAH,SAAA,CAAAC,MAAA,GAAAD,CAAAA,IAAAA,SAAA,CAAAE,CAAAA,CAAAA,KAAAA,SAAA,GAAAF,SAAA,CAAGF,CAAAA,CAAAA,GAAAA,IAAI,CAACK,GAAG,CAAA;EAAA,OAAM;AACrER,IAAAA,CAAC,EAAEI,IAAI,GAAGD,IAAI,CAACM,KAAK,GAAG,GAAG;AAC1BR,IAAAA,CAAC,EAAEO,GAAG,GAAGL,IAAI,CAACO,MAAM,GAAG,GAAA;GACxB,CAAA;AAAA,CAAC,CAAA;AAEF,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAIC,SAAS,EAAEC,SAAS,EAA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W,gBAAgB,EAAA;AACTpD,UAAAA,KAAK,EAALA,KAAK;AACXlD,UAAAA,IAAI,EAAE;AAAEsF,YAAAA,OAAO,EAAPA,OAAAA;WAAU;UAClBrE,EAAE,EAAEqE,OAAO,CAACrE,EAAG;UACf2E,GAAG,EAAEN,OAAO,CAACrE,EAAG;UAChBkC,MAAM,EAAE,SAARA,MAAMA,GAAA;AAAA,YAAA,OAAQ6D,aAAa,CAAC;AAAE9D,cAAAA,KAAK,EAALA,KAAK;AAAEoC,cAAAA,OAAO,EAAPA,OAAAA;AAAQ,aAAC,CAAC,CAAA;AAAA,WAAA;AAAC,SACjD,CAAC,CAAA;AAAA,OACH,CAAC,CAAA;AAAA,KACC,CAAC,eACNxC,GAAA,CAACZ,UAAU,EAAA;AAAOE,MAAAA,KAAK,EAALA,KAAK;AAAIC,MAAAA,KAAK,EAAE+E,SAAAA;AAAU,KAAE,CAAC,CAAA;AAAA,GACrC,CAAC,CAAA;AAEjB,CAAC,EAAC;AAEFR,SAAS,CAACf,WAAW,GAAG,WAAW,CAAA;AACnCe,SAAS,CAACxB,OAAO,GAAGA,OAAO;;;;"}
@@ -155,7 +155,8 @@ var useOptionFields = function useOptionFields(_ref) {
155
155
  shouldResetEmptyOptionOnBlur = _ref.shouldResetEmptyOptionOnBlur,
156
156
  name = _ref.name,
157
157
  destroyFlagName = _ref.destroyFlagName,
158
- isNewItemsPrefilled = _ref.isNewItemsPrefilled;
158
+ isNewItemsPrefilled = _ref.isNewItemsPrefilled,
159
+ isAddOptionEnabled = _ref.isAddOptionEnabled;
159
160
  var _useState = useState(false),
160
161
  _useState2 = _slicedToArray(_useState, 2),
161
162
  shouldFocus = _useState2[0],
@@ -250,7 +251,7 @@ var useOptionFields = function useOptionFields(_ref) {
250
251
  var inputs = Array.from(form.querySelectorAll("input"));
251
252
  var currentInput = inputs.indexOf(event.target);
252
253
  if (currentInput >= inputs.length - 1) {
253
- handleAddOption();
254
+ isAddOptionEnabled && handleAddOption();
254
255
  } else {
255
256
  var _inputs;
256
257
  (_inputs = inputs[currentInput + 1]) === null || _inputs === void 0 ? void 0 : _inputs.focus();
@@ -567,7 +568,8 @@ var OptionFields = function OptionFields(_ref) {
567
568
  shouldResetEmptyOptionOnBlur: shouldResetEmptyOptionOnBlur,
568
569
  destroyFlagName: destroyFlagName,
569
570
  name: name,
570
- isNewItemsPrefilled: isNewItemsPrefilled
571
+ isNewItemsPrefilled: isNewItemsPrefilled,
572
+ isAddOptionEnabled: isAddOptionEnabled
571
573
  }),
572
574
  shouldFocus = _useOptionFields.shouldFocus,
573
575
  handleAddOption = _useOptionFields.handleAddOption,