@bigbinary/neeto-tags-frontend 2.2.34-beta2 → 2.2.35-beta1
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/dist/.ready +1 -1
- package/dist/cjs/v2/TagsComponent.js +183 -129
- package/dist/cjs/v2/TagsComponent.js.map +1 -1
- package/dist/v2/TagsComponent.js +183 -129
- package/dist/v2/TagsComponent.js.map +1 -1
- package/package.json +7 -7
package/dist/.ready
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Built at 2026-09-
|
|
1
|
+
Built at 2026-09-24T09:45:06.949Z
|
|
@@ -74,17 +74,22 @@ var Title = function Title(_ref) {
|
|
|
74
74
|
|
|
75
75
|
var TitleActionBlock = function TitleActionBlock(_ref) {
|
|
76
76
|
var isDisabled = _ref.isDisabled,
|
|
77
|
-
setIsTagsDropdownVisible = _ref.setIsTagsDropdownVisible
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
77
|
+
setIsTagsDropdownVisible = _ref.setIsTagsDropdownVisible,
|
|
78
|
+
anchorRef = _ref.anchorRef;
|
|
79
|
+
return /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
80
|
+
className: "inline-flex",
|
|
81
|
+
ref: anchorRef,
|
|
82
|
+
children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
|
|
83
|
+
"data-testid": "neeto-tags-add-tag-button",
|
|
84
|
+
disabled: isDisabled,
|
|
85
|
+
icon: lucideReact.Settings,
|
|
86
|
+
size: "icon-sm",
|
|
87
|
+
variant: "ghost",
|
|
88
|
+
onClick: function onClick(event) {
|
|
89
|
+
event.stopPropagation();
|
|
90
|
+
setIsTagsDropdownVisible(ramda.not);
|
|
91
|
+
}
|
|
92
|
+
})
|
|
88
93
|
});
|
|
89
94
|
};
|
|
90
95
|
|
|
@@ -97,7 +102,9 @@ var Container = function Container(_ref) {
|
|
|
97
102
|
titleComponentProps = _ref.titleComponentProps,
|
|
98
103
|
children = _ref.children,
|
|
99
104
|
isTagsBodyVisible = _ref.isTagsBodyVisible,
|
|
100
|
-
bodyProps = _ref.bodyProps
|
|
105
|
+
bodyProps = _ref.bodyProps,
|
|
106
|
+
_ref$isHeaderInteract = _ref.isHeaderInteractive,
|
|
107
|
+
isHeaderInteractive = _ref$isHeaderInteract === void 0 ? true : _ref$isHeaderInteract;
|
|
101
108
|
if (isMetadataBlock) {
|
|
102
109
|
return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread$4(_objectSpread$4({
|
|
103
110
|
className: "space-y-4 rounded-lg border border-border bg-background p-4"
|
|
@@ -111,13 +118,13 @@ var Container = function Container(_ref) {
|
|
|
111
118
|
var isDisabled = actionBlockProps.isDisabled,
|
|
112
119
|
setIsTagsDropdownVisible = actionBlockProps.setIsTagsDropdownVisible;
|
|
113
120
|
var onHeaderClick = function onHeaderClick() {
|
|
114
|
-
!isDisabled && setIsTagsDropdownVisible(ramda.not);
|
|
121
|
+
isHeaderInteractive && !isDisabled && setIsTagsDropdownVisible(ramda.not);
|
|
115
122
|
};
|
|
116
123
|
return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread$4(_objectSpread$4({
|
|
117
124
|
className: "flex w-full flex-col items-start gap-2"
|
|
118
125
|
}, containerProps), {}, {
|
|
119
126
|
children: [titleComponentProps.showTitleBar && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
120
|
-
className: classNames("flex w-full
|
|
127
|
+
className: classNames("flex w-full items-center justify-between gap-2 text-foreground", isHeaderInteractive && "cursor-pointer", titleComponentProps.containerClassName),
|
|
121
128
|
onClick: onHeaderClick,
|
|
122
129
|
children: [/*#__PURE__*/jsxRuntime.jsx(Title, _objectSpread$4({}, titleComponentProps)), titleComponentProps.showAddTagsOnTitle && /*#__PURE__*/jsxRuntime.jsx(TitleActionBlock, _objectSpread$4({}, actionBlockProps))]
|
|
123
130
|
}), isTagsBodyVisible && /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread$4(_objectSpread$4({
|
|
@@ -140,7 +147,11 @@ var PopoverTagsSelector = function PopoverTagsSelector(_ref) {
|
|
|
140
147
|
_ref$buttonProps = _ref.buttonProps,
|
|
141
148
|
buttonProps = _ref$buttonProps === void 0 ? {} : _ref$buttonProps,
|
|
142
149
|
_ref$isDisabled = _ref.isDisabled,
|
|
143
|
-
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled
|
|
150
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
151
|
+
dataTestId = _ref.dataTestId,
|
|
152
|
+
anchorRef = _ref.anchorRef,
|
|
153
|
+
_ref$hideTriggerButto = _ref.hideTriggerButton,
|
|
154
|
+
hideTriggerButton = _ref$hideTriggerButto === void 0 ? false : _ref$hideTriggerButto;
|
|
144
155
|
var _useTranslation = reactI18next.useTranslation(),
|
|
145
156
|
t = _useTranslation.t;
|
|
146
157
|
var triggerRef = react.useRef(null);
|
|
@@ -178,12 +189,16 @@ var PopoverTagsSelector = function PopoverTagsSelector(_ref) {
|
|
|
178
189
|
var optionId = function optionId(index) {
|
|
179
190
|
return "".concat(listboxId, "-option-").concat(index);
|
|
180
191
|
};
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
192
|
+
|
|
193
|
+
// Positioning and focus target the external anchor (the gear) when the
|
|
194
|
+
// in-body trigger button is hidden, otherwise this component's own wrapper.
|
|
195
|
+
var focusTrigger = react.useCallback(function () {
|
|
196
|
+
var _anchor$querySelector;
|
|
197
|
+
var anchor = hideTriggerButton && (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) || triggerRef.current;
|
|
198
|
+
anchor === null || anchor === void 0 || (_anchor$querySelector = anchor.querySelector("button")) === null || _anchor$querySelector === void 0 || _anchor$querySelector.focus({
|
|
184
199
|
preventScroll: true
|
|
185
200
|
});
|
|
186
|
-
};
|
|
201
|
+
}, [hideTriggerButton, anchorRef]);
|
|
187
202
|
var close = react.useCallback(function () {
|
|
188
203
|
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
189
204
|
_ref4$restoreFocus = _ref4.restoreFocus,
|
|
@@ -195,7 +210,7 @@ var PopoverTagsSelector = function PopoverTagsSelector(_ref) {
|
|
|
195
210
|
// Return focus to the trigger only for keyboard / selection dismissals;
|
|
196
211
|
// an outside click should leave focus wherever the user clicked.
|
|
197
212
|
if (restoreFocus) focusTrigger();
|
|
198
|
-
}, [onOpenChange]);
|
|
213
|
+
}, [onOpenChange, focusTrigger]);
|
|
199
214
|
var handleSelect = function handleSelect(tag) {
|
|
200
215
|
onChange(tag);
|
|
201
216
|
close({
|
|
@@ -239,7 +254,7 @@ var PopoverTagsSelector = function PopoverTagsSelector(_ref) {
|
|
|
239
254
|
};
|
|
240
255
|
var updatePosition = react.useCallback(function () {
|
|
241
256
|
var _panelRef$current$off, _panelRef$current;
|
|
242
|
-
var trigger = triggerRef.current;
|
|
257
|
+
var trigger = hideTriggerButton && (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) || triggerRef.current;
|
|
243
258
|
if (!trigger) return;
|
|
244
259
|
var rect = trigger.getBoundingClientRect();
|
|
245
260
|
var panelHeight = (_panelRef$current$off = (_panelRef$current = panelRef.current) === null || _panelRef$current === void 0 ? void 0 : _panelRef$current.offsetHeight) !== null && _panelRef$current$off !== void 0 ? _panelRef$current$off : 0;
|
|
@@ -252,7 +267,7 @@ var PopoverTagsSelector = function PopoverTagsSelector(_ref) {
|
|
|
252
267
|
top: top,
|
|
253
268
|
left: left
|
|
254
269
|
});
|
|
255
|
-
}, []);
|
|
270
|
+
}, [hideTriggerButton, anchorRef]);
|
|
256
271
|
|
|
257
272
|
// Position on open and whenever the panel's height changes (list filtering),
|
|
258
273
|
// synchronously before paint so the panel is never seen mispositioned.
|
|
@@ -268,8 +283,12 @@ var PopoverTagsSelector = function PopoverTagsSelector(_ref) {
|
|
|
268
283
|
preventScroll: true
|
|
269
284
|
});
|
|
270
285
|
var handleClickOutside = function handleClickOutside(event) {
|
|
271
|
-
var _triggerRef$
|
|
272
|
-
if ((_triggerRef$
|
|
286
|
+
var _triggerRef$current, _anchorRef$current, _panelRef$current3;
|
|
287
|
+
if ((_triggerRef$current = triggerRef.current) !== null && _triggerRef$current !== void 0 && _triggerRef$current.contains(event.target)) return;
|
|
288
|
+
|
|
289
|
+
// Treat the external anchor (the gear) as inside, so its own toggle
|
|
290
|
+
// governs open/close instead of this handler racing it.
|
|
291
|
+
if (anchorRef !== null && anchorRef !== void 0 && (_anchorRef$current = anchorRef.current) !== null && _anchorRef$current !== void 0 && _anchorRef$current.contains(event.target)) return;
|
|
273
292
|
if ((_panelRef$current3 = panelRef.current) !== null && _panelRef$current3 !== void 0 && _panelRef$current3.contains(event.target)) return;
|
|
274
293
|
close();
|
|
275
294
|
};
|
|
@@ -293,10 +312,88 @@ var PopoverTagsSelector = function PopoverTagsSelector(_ref) {
|
|
|
293
312
|
if (rafRef.current) window.cancelAnimationFrame(rafRef.current);
|
|
294
313
|
rafRef.current = null;
|
|
295
314
|
};
|
|
296
|
-
}, [open, close, updatePosition]);
|
|
315
|
+
}, [open, close, updatePosition, anchorRef]);
|
|
297
316
|
var optionClassName = function optionClassName(isActive) {
|
|
298
317
|
return classNames("flex w-full cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-start text-sm", isActive ? "bg-accent text-accent-foreground" : "hover:bg-accent");
|
|
299
318
|
};
|
|
319
|
+
var panel = open && /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
320
|
+
className: "bg-popover text-popover-foreground border-border fixed z-50 overflow-hidden rounded-md border shadow-md",
|
|
321
|
+
ref: panelRef,
|
|
322
|
+
style: {
|
|
323
|
+
top: (_coords$top = coords === null || coords === void 0 ? void 0 : coords.top) !== null && _coords$top !== void 0 ? _coords$top : 0,
|
|
324
|
+
left: (_coords$left = coords === null || coords === void 0 ? void 0 : coords.left) !== null && _coords$left !== void 0 ? _coords$left : 0,
|
|
325
|
+
width: POPOVER_PANEL_WIDTH,
|
|
326
|
+
visibility: coords ? "visible" : "hidden"
|
|
327
|
+
},
|
|
328
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
329
|
+
className: "border-border border-b p-2",
|
|
330
|
+
children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Input, {
|
|
331
|
+
"aria-autocomplete": "list",
|
|
332
|
+
"aria-controls": listboxId,
|
|
333
|
+
"aria-expanded": open,
|
|
334
|
+
"data-testid": dataTestId,
|
|
335
|
+
placeholder: t("neetoTags.placeholder.searchOrCreateTags"),
|
|
336
|
+
prefix: /*#__PURE__*/jsxRuntime.jsx(lucideReact.Search, {
|
|
337
|
+
size: 14
|
|
338
|
+
}),
|
|
339
|
+
role: "combobox",
|
|
340
|
+
size: "small",
|
|
341
|
+
value: query,
|
|
342
|
+
"aria-activedescendant": optionCount > 0 ? optionId(activeIndex) : undefined,
|
|
343
|
+
onChange: handleQueryChange,
|
|
344
|
+
onKeyDown: handleKeyDown
|
|
345
|
+
})
|
|
346
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
347
|
+
className: "max-h-56 overflow-y-auto p-1",
|
|
348
|
+
id: listboxId,
|
|
349
|
+
role: "listbox",
|
|
350
|
+
children: [filteredTags.map(function (tag, index) {
|
|
351
|
+
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
352
|
+
"aria-selected": index === activeIndex,
|
|
353
|
+
className: optionClassName(index === activeIndex),
|
|
354
|
+
id: optionId(index),
|
|
355
|
+
role: "option",
|
|
356
|
+
type: "button",
|
|
357
|
+
onClick: function onClick() {
|
|
358
|
+
return handleSelect(tag);
|
|
359
|
+
},
|
|
360
|
+
onMouseEnter: function onMouseEnter() {
|
|
361
|
+
return setActiveIndex(index);
|
|
362
|
+
},
|
|
363
|
+
children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Badge, {
|
|
364
|
+
label: tag.label,
|
|
365
|
+
variant: constants$1.TAG_STYLE_TO_BADGE_VARIANT[tag.style] || "secondary"
|
|
366
|
+
})
|
|
367
|
+
}, tag.value);
|
|
368
|
+
}), canCreate && /*#__PURE__*/jsxRuntime.jsxs("button", {
|
|
369
|
+
"aria-selected": activeIndex === filteredTags.length,
|
|
370
|
+
className: optionClassName(activeIndex === filteredTags.length),
|
|
371
|
+
id: optionId(filteredTags.length),
|
|
372
|
+
role: "option",
|
|
373
|
+
type: "button",
|
|
374
|
+
onClick: handleCreate,
|
|
375
|
+
onMouseEnter: function onMouseEnter() {
|
|
376
|
+
return setActiveIndex(filteredTags.length);
|
|
377
|
+
},
|
|
378
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(lucideReact.Plus, {
|
|
379
|
+
size: 14
|
|
380
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
381
|
+
className: "truncate",
|
|
382
|
+
children: [t("neetoTags.button.createNewTag"), ": ", /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
383
|
+
className: "font-medium",
|
|
384
|
+
children: trimmedQuery
|
|
385
|
+
})]
|
|
386
|
+
})]
|
|
387
|
+
}), optionCount === 0 && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
388
|
+
className: "text-muted-foreground px-2 py-2 text-sm",
|
|
389
|
+
children: t("neetoTags.common.noTagsFound")
|
|
390
|
+
})]
|
|
391
|
+
})]
|
|
392
|
+
}), document.body);
|
|
393
|
+
|
|
394
|
+
// Gear-anchored mode: render only the floating panel (the gear is the
|
|
395
|
+
// trigger), with no in-body wrapper or button of its own.
|
|
396
|
+
if (hideTriggerButton) return panel || null;
|
|
300
397
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
301
398
|
className: "inline-block",
|
|
302
399
|
ref: triggerRef,
|
|
@@ -311,79 +408,7 @@ var PopoverTagsSelector = function PopoverTagsSelector(_ref) {
|
|
|
311
408
|
onClick: function onClick() {
|
|
312
409
|
return onOpenChange(!open);
|
|
313
410
|
}
|
|
314
|
-
}, buttonProps)),
|
|
315
|
-
className: "bg-popover text-popover-foreground border-border fixed z-50 overflow-hidden rounded-md border shadow-md",
|
|
316
|
-
ref: panelRef,
|
|
317
|
-
style: {
|
|
318
|
-
top: (_coords$top = coords === null || coords === void 0 ? void 0 : coords.top) !== null && _coords$top !== void 0 ? _coords$top : 0,
|
|
319
|
-
left: (_coords$left = coords === null || coords === void 0 ? void 0 : coords.left) !== null && _coords$left !== void 0 ? _coords$left : 0,
|
|
320
|
-
width: POPOVER_PANEL_WIDTH,
|
|
321
|
-
visibility: coords ? "visible" : "hidden"
|
|
322
|
-
},
|
|
323
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
324
|
-
className: "border-border border-b p-2",
|
|
325
|
-
children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Input, {
|
|
326
|
-
"aria-autocomplete": "list",
|
|
327
|
-
"aria-controls": listboxId,
|
|
328
|
-
"aria-expanded": open,
|
|
329
|
-
placeholder: t("neetoTags.placeholder.searchOrCreateTags"),
|
|
330
|
-
prefix: /*#__PURE__*/jsxRuntime.jsx(lucideReact.Search, {
|
|
331
|
-
size: 14
|
|
332
|
-
}),
|
|
333
|
-
role: "combobox",
|
|
334
|
-
size: "small",
|
|
335
|
-
value: query,
|
|
336
|
-
"aria-activedescendant": optionCount > 0 ? optionId(activeIndex) : undefined,
|
|
337
|
-
onChange: handleQueryChange,
|
|
338
|
-
onKeyDown: handleKeyDown
|
|
339
|
-
})
|
|
340
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
341
|
-
className: "max-h-56 overflow-y-auto p-1",
|
|
342
|
-
id: listboxId,
|
|
343
|
-
role: "listbox",
|
|
344
|
-
children: [filteredTags.map(function (tag, index) {
|
|
345
|
-
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
346
|
-
"aria-selected": index === activeIndex,
|
|
347
|
-
className: optionClassName(index === activeIndex),
|
|
348
|
-
id: optionId(index),
|
|
349
|
-
role: "option",
|
|
350
|
-
type: "button",
|
|
351
|
-
onClick: function onClick() {
|
|
352
|
-
return handleSelect(tag);
|
|
353
|
-
},
|
|
354
|
-
onMouseEnter: function onMouseEnter() {
|
|
355
|
-
return setActiveIndex(index);
|
|
356
|
-
},
|
|
357
|
-
children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Badge, {
|
|
358
|
-
label: tag.label,
|
|
359
|
-
variant: constants$1.TAG_STYLE_TO_BADGE_VARIANT[tag.style] || "secondary"
|
|
360
|
-
})
|
|
361
|
-
}, tag.value);
|
|
362
|
-
}), canCreate && /*#__PURE__*/jsxRuntime.jsxs("button", {
|
|
363
|
-
"aria-selected": activeIndex === filteredTags.length,
|
|
364
|
-
id: optionId(filteredTags.length),
|
|
365
|
-
role: "option",
|
|
366
|
-
type: "button",
|
|
367
|
-
className: optionClassName(activeIndex === filteredTags.length),
|
|
368
|
-
onClick: handleCreate,
|
|
369
|
-
onMouseEnter: function onMouseEnter() {
|
|
370
|
-
return setActiveIndex(filteredTags.length);
|
|
371
|
-
},
|
|
372
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(lucideReact.Plus, {
|
|
373
|
-
size: 14
|
|
374
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
375
|
-
className: "truncate",
|
|
376
|
-
children: [t("neetoTags.button.createNewTag"), ": ", /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
377
|
-
className: "font-medium",
|
|
378
|
-
children: trimmedQuery
|
|
379
|
-
})]
|
|
380
|
-
})]
|
|
381
|
-
}), optionCount === 0 && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
382
|
-
className: "text-muted-foreground px-2 py-2 text-sm",
|
|
383
|
-
children: t("neetoTags.common.noTagsFound")
|
|
384
|
-
})]
|
|
385
|
-
})]
|
|
386
|
-
}), document.body)]
|
|
411
|
+
}, buttonProps)), panel]
|
|
387
412
|
});
|
|
388
413
|
};
|
|
389
414
|
|
|
@@ -497,14 +522,19 @@ var Tags = function Tags(_ref) {
|
|
|
497
522
|
_ref$isMetadataBlock = _ref.isMetadataBlock,
|
|
498
523
|
isMetadataBlock = _ref$isMetadataBlock === void 0 ? false : _ref$isMetadataBlock,
|
|
499
524
|
_ref$pickerVariant = _ref.pickerVariant,
|
|
500
|
-
pickerVariant = _ref$pickerVariant === void 0 ? "
|
|
525
|
+
pickerVariant = _ref$pickerVariant === void 0 ? "popover" : _ref$pickerVariant,
|
|
526
|
+
dataTestId = _ref.dataTestId;
|
|
501
527
|
var _useTranslation = reactI18next.useTranslation(),
|
|
502
528
|
t = _useTranslation.t;
|
|
503
529
|
var _useState = react.useState(false),
|
|
504
530
|
_useState2 = _slicedToArray(_useState, 2),
|
|
505
531
|
isTagsDropdownVisible = _useState2[0],
|
|
506
532
|
setIsTagsDropdownVisible = _useState2[1];
|
|
533
|
+
|
|
534
|
+
// The title-bar/metadata settings gear, used as the popover's trigger anchor.
|
|
535
|
+
var gearAnchorRef = react.useRef(null);
|
|
507
536
|
useHotkeys(KEYBOARD_SHORTCUTS.addTag.sequence, function (event) {
|
|
537
|
+
if (isDisabled) return;
|
|
508
538
|
event.preventDefault();
|
|
509
539
|
setIsTagsDropdownVisible(true);
|
|
510
540
|
});
|
|
@@ -532,9 +562,22 @@ var Tags = function Tags(_ref) {
|
|
|
532
562
|
setIsTagsDropdownVisible(false);
|
|
533
563
|
onTagCreate(tagName);
|
|
534
564
|
};
|
|
565
|
+
|
|
566
|
+
// Fall back to `selectProps.dataTestId` so consumers that only targeted the
|
|
567
|
+
// inline select can keep addressing the picker after the popover default.
|
|
568
|
+
var resolvedDataTestId = dataTestId !== null && dataTestId !== void 0 ? dataTestId : selectProps.dataTestId;
|
|
535
569
|
var isPopoverPicker = pickerVariant === "popover";
|
|
536
|
-
|
|
537
|
-
|
|
570
|
+
// A settings gear in the title bar (always shown in a metadata block) acts as
|
|
571
|
+
// the popover's trigger and positioning anchor. When present, the popover
|
|
572
|
+
// drops its own in-body "Add tag" button and opens directly below the gear.
|
|
573
|
+
var hasTitleGear = isMetadataBlock || showTitleBar && showAddTagsOnTitle;
|
|
574
|
+
var isGearAnchoredPopover = isPopoverPicker && hasTitleGear;
|
|
575
|
+
// Without a gear to anchor to, the popover renders its own in-body "Add tag"
|
|
576
|
+
// button as the trigger (kept permanently visible so there is always an
|
|
577
|
+
// anchor), e.g. when `showAddTagsOnTitle` is false or the title bar is hidden.
|
|
578
|
+
var isInBodyPopoverPicker = isPopoverPicker && !hasTitleGear;
|
|
579
|
+
var isAddTagsButtonVisible = !isPopoverPicker && !showAddTagsOnTitle && !isTagsDropdownVisible;
|
|
580
|
+
var isTagsBodyVisible = neetoCist.isNotEmpty(selectedTags) || !isPopoverPicker && isTagsDropdownVisible || isAddTagsButtonVisible || isInBodyPopoverPicker;
|
|
538
581
|
var titleComponentProps = {
|
|
539
582
|
isLoading: isLoading,
|
|
540
583
|
isUpdating: isUpdating,
|
|
@@ -545,7 +588,8 @@ var Tags = function Tags(_ref) {
|
|
|
545
588
|
};
|
|
546
589
|
var actionBlockProps = {
|
|
547
590
|
isDisabled: isDisabled,
|
|
548
|
-
setIsTagsDropdownVisible: setIsTagsDropdownVisible
|
|
591
|
+
setIsTagsDropdownVisible: setIsTagsDropdownVisible,
|
|
592
|
+
anchorRef: isGearAnchoredPopover ? gearAnchorRef : undefined
|
|
549
593
|
};
|
|
550
594
|
var tagsListProps = {
|
|
551
595
|
handleDeleteTag: handleDeleteTag,
|
|
@@ -560,33 +604,43 @@ var Tags = function Tags(_ref) {
|
|
|
560
604
|
onCreateOption: handleCreateTag,
|
|
561
605
|
selectProps: selectProps
|
|
562
606
|
};
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
607
|
+
var popoverTagsSelectorProps = {
|
|
608
|
+
buttonProps: buttonProps,
|
|
609
|
+
isDisabled: isDisabled,
|
|
610
|
+
tags: tags,
|
|
611
|
+
dataTestId: resolvedDataTestId,
|
|
612
|
+
open: isTagsDropdownVisible,
|
|
613
|
+
onChange: handleAddExistingTag,
|
|
614
|
+
onCreateOption: handleCreateTag,
|
|
615
|
+
onOpenChange: setIsTagsDropdownVisible
|
|
616
|
+
};
|
|
617
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
618
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(Container, {
|
|
619
|
+
actionBlockProps: actionBlockProps,
|
|
620
|
+
bodyProps: bodyProps,
|
|
621
|
+
containerProps: containerProps,
|
|
622
|
+
isMetadataBlock: isMetadataBlock,
|
|
623
|
+
isTagsBodyVisible: isTagsBodyVisible,
|
|
624
|
+
titleComponentProps: titleComponentProps,
|
|
625
|
+
// The gear is the popover's sole trigger; letting the header row toggle
|
|
626
|
+
// too would race the panel's outside-click close and reopen it.
|
|
627
|
+
isHeaderInteractive: !isGearAnchoredPopover,
|
|
628
|
+
children: [neetoCist.isNotEmpty(selectedTags) && /*#__PURE__*/jsxRuntime.jsx(TagsList, _objectSpread({}, tagsListProps)), isInBodyPopoverPicker && /*#__PURE__*/jsxRuntime.jsx(PopoverTagsSelector, _objectSpread({}, popoverTagsSelectorProps)), !isPopoverPicker && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
629
|
+
children: [isTagsDropdownVisible && /*#__PURE__*/jsxRuntime.jsx(TagsSelector, _objectSpread({}, tagsSelectorProps)), isAddTagsButtonVisible && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, _objectSpread({
|
|
630
|
+
disabled: isDisabled,
|
|
631
|
+
icon: lucideReact.Plus,
|
|
632
|
+
label: t("neetoTags.button.addTag", constants.SINGULAR),
|
|
633
|
+
size: "sm",
|
|
634
|
+
variant: "link",
|
|
635
|
+
onClick: function onClick() {
|
|
636
|
+
return setIsTagsDropdownVisible(true);
|
|
637
|
+
}
|
|
638
|
+
}, buttonProps))]
|
|
639
|
+
})]
|
|
640
|
+
}), isGearAnchoredPopover && /*#__PURE__*/jsxRuntime.jsx(PopoverTagsSelector, _objectSpread(_objectSpread({}, popoverTagsSelectorProps), {}, {
|
|
641
|
+
hideTriggerButton: true,
|
|
642
|
+
anchorRef: gearAnchorRef
|
|
643
|
+
}))]
|
|
590
644
|
});
|
|
591
645
|
};
|
|
592
646
|
|