ish-ui 1.0.49 → 1.0.50

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.
@@ -24,7 +24,7 @@ function AddTagMenuItem({ setActiveTag, tag, classes, handleAdd, hideColor, allo
24
24
  !hideColor && React.createElement("div", { className: clsx(classes.tagColorDotSmall, 'mr-1'), style: { background: '#' + tag.tagBody.color } }),
25
25
  React.createElement("span", { className: "mr-2 flex-fill" }, tag.tagBody.name),
26
26
  (allowParentSelect || !hasChildren) && React.createElement(Checkbox, { onClick: toggleChecked, classes: { root: 'smallIconButton' }, checked: tag.active }),
27
- hasChildren && React.createElement(IconButton, { size: "small", onClick: openSubmenu },
27
+ React.createElement(IconButton, { size: "small", onClick: openSubmenu, className: clsx(!hasChildren && (allowParentSelect ? 'invisible' : 'd-none')) },
28
28
  React.createElement(KeyboardArrowRight, { className: clsx('d-flex textSecondaryColor', classes.proceedIcon) }))));
29
29
  }
30
30
  export default AddTagMenuItem;
@@ -16,7 +16,7 @@ var __rest = (this && this.__rest) || function (s, e) {
16
16
  }
17
17
  return t;
18
18
  };
19
- import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
19
+ import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
20
20
  import { InputAdornment, MenuItem, Select } from '@mui/material';
21
21
  import { ClickAwayListener } from '@mui/base';
22
22
  import Autocomplete from '@mui/material/Autocomplete';
@@ -98,7 +98,7 @@ function TagInputList({ input, tags, placeholder, labelAdornment, meta, label =
98
98
  }, [tags, input.value, inputValue, hideColor]);
99
99
  const inputNode = useRef();
100
100
  const tagMenuNode = useRef();
101
- const menuTags = useMemo(() => (tags && input.value ? getMenuTags(tags.filter(t => t.childrenCount > 0), input.value.map(id => getFullTag(id, tags)).filter(t => t)) : []), [tags, input.value]);
101
+ const menuTags = useMemo(() => (tags && input.value ? getMenuTags(tags.filter(t => allowParentSelect || t.childrenCount > 0), input.value.map(id => getFullTag(id, tags)).filter(t => t)) : []), [tags, input.value, allowParentSelect]);
102
102
  const allMenuTags = useMemo(() => getAllMenuTags(menuTags), [menuTags]);
103
103
  const synchronizeTags = () => {
104
104
  const inputString = getInputString(input.value, tags);
@@ -235,8 +235,14 @@ function TagInputList({ input, tags, placeholder, labelAdornment, meta, label =
235
235
  return (React.createElement("div", { id: "popper", style: Object.assign(Object.assign({}, position), { position: 'absolute', zIndex: 2 }) },
236
236
  React.createElement(ClickAwayListener, { onClickAway: onTagListBlur }, params.children)));
237
237
  }, [allMenuTags, inputValue, currentInputString, inputNode.current, tagMenuNode.current, input.value]);
238
- const listboxAdapter = useCallback(params => (React.createElement("div", { className: params.className, ref: tagMenuNode },
239
- React.createElement(AddTagMenu, { tags: menuTags, handleAdd: onTagAdd, hideColor: hideColor, activeTag: activeTag, setActiveTag: setActiveTag, allowParentSelect: allowParentSelect }))), [menuTags, activeTag, setActiveTag, onTagAdd, hideColor]);
238
+ const listboxAdapter = forwardRef((params, ref) => {
239
+ const setRef = refToSet => {
240
+ tagMenuNode.current = refToSet;
241
+ ref = refToSet;
242
+ };
243
+ return React.createElement("div", { ref: setRef },
244
+ React.createElement(AddTagMenu, { tags: menuTags, handleAdd: onTagAdd, hideColor: hideColor, activeTag: activeTag, setActiveTag: setActiveTag, allowParentSelect: allowParentSelect }));
245
+ });
240
246
  return (React.createElement("div", { className: className, id: input.name },
241
247
  React.createElement("div", { className: clsx('relative', {
242
248
  'pointer-events-none': disabled
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ish-ui",
3
3
  "sideEffects": false,
4
- "version": "1.0.49",
4
+ "version": "1.0.50",
5
5
  "description": "UI elements for onCourse and other ish apps",
6
6
  "main": "main.ts",
7
7
  "devDependencies": {