@antscorp/antsomi-ui 1.3.5-beta.962 → 1.3.5-beta.964

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.
@@ -40,7 +40,7 @@ export const SelectedTag = styled(Typography.Text) `
40
40
  color: ${props => props.$color};
41
41
 
42
42
  &.antsomi-typography-ellipsis {
43
- max-width: 50px;
43
+ max-width: 60px;
44
44
  }
45
45
  }
46
46
  `;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { PayloadInfo } from '@antscorp/antsomi-ui/es/types';
3
2
  export type TDisplayFormat = 'number' | 'percentage' | 'currency' | 'datetime';
4
3
  type DisplayFormatProps = {
@@ -23,7 +23,7 @@ import { DETECT_LINK, EMOJI, ERROR_TAG, FORCE_SHOW_TOOLTIP, INVALID_TAG, MESSAGE
23
23
  const { CUSTOM_TAG } = TAG_TYPE;
24
24
  const TagifyInput = forwardRef((props, ref) => {
25
25
  // Props
26
- const { initialValue, escapeHTML, status, readonly, readonlyTag, realtime, disabled, maxLength, maxHeight, minWidth, placeholder, minWidthPlaceholder, isSingleLineText, acceptableTagPattern, tagProperties, mapAttributes, mapErrorAttributes, maxPersonalizeTags, name, children, cssTagifyVariables, onTagClick, onChange, } = props;
26
+ const { initialValue, escapeHTML, status, readonly, readonlyTag, realtime, disabled, maxLength, maxHeight, minWidth, placeholder, minWidthPlaceholder, isSingleLineText, acceptableTagPattern, tagProperties, mapAttributes, mapErrorAttributes, maxPersonalizeTags, name, children, cssTagifyVariables, onTagClick, onTagRemove, onChange, } = props;
27
27
  // States
28
28
  const [isLineBreak, setIsLineBreak] = useState(hasLineBreak(initialValue));
29
29
  const [tooltipRefresher, setTooltipRefresher] = useState(1);
@@ -451,6 +451,11 @@ const TagifyInput = forwardRef((props, ref) => {
451
451
  onTagClick(event.detail);
452
452
  }
453
453
  }, [onTagClick]);
454
+ const onTagifyRemoveTag = useCallback((event) => {
455
+ if (event.detail && onTagRemove) {
456
+ onTagRemove(event.detail);
457
+ }
458
+ }, [onTagRemove]);
454
459
  // Used to trigger replace URL detection and line break
455
460
  const onTagifyTyping = useCallback((event) => {
456
461
  if (event.detail) {
@@ -852,11 +857,13 @@ const TagifyInput = forwardRef((props, ref) => {
852
857
  tagifyInstance.on('click', onTagItemClick);
853
858
  tagifyInstance.on('input', onInputTagifyDebounce);
854
859
  tagifyInstance.on('change', onTagifyChangedDebounce);
860
+ tagifyInstance.on('remove', onTagifyRemoveTag);
855
861
  }
856
862
  // Off listen to Tagify events
857
863
  return () => {
858
864
  if (tagifyInstance) {
859
865
  tagifyInstance.off('click', onTagItemClick);
866
+ tagifyInstance.off('remove', onTagifyRemoveTag);
860
867
  if (onInputTagifyDebounce) {
861
868
  tagifyInstance.off('input', onInputTagifyDebounce);
862
869
  }
@@ -865,7 +872,7 @@ const TagifyInput = forwardRef((props, ref) => {
865
872
  }
866
873
  }
867
874
  };
868
- }, [onTagItemClick, onTagifyTyping, onTagifyChanged]);
875
+ }, [onTagItemClick, onTagifyTyping, onTagifyChanged, onTagifyRemoveTag]);
869
876
  // At the first render, need to update URL to tag to show hint in the tooltip with tag
870
877
  useEffect(() => {
871
878
  detectReplaceURLToTag();
@@ -131,6 +131,11 @@ export interface TagifyInputProps {
131
131
  * Receives the tag detail as parameter, allowing custom actions on tag click.
132
132
  */
133
133
  onTagClick?: (tagDetail: Tagify.ClickEventData<TagDataCustomize>) => void;
134
+ /**
135
+ * Event handler triggered when a tag is removed.
136
+ * Receives the tag detail as parameter, allowing custom actions on tag removal.
137
+ */
138
+ onTagRemove?: (tagDetail: Tagify.RemoveEventData<TagDataCustomize>) => void;
134
139
  /**
135
140
  * Event handler triggered when the input value changes.
136
141
  * Receives the updated input value as a string, allowing for controlled component updates.
@@ -3,5 +3,4 @@
3
3
  * Asynchronously loads the component for TemplateListing
4
4
  *
5
5
  */
6
- /// <reference types="react" />
7
6
  export declare const TemplateListing: (props: import("./types").TemplateListingProps<{}>) => JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.962",
3
+ "version": "1.3.5-beta.964",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",