@antscorp/antsomi-ui 1.3.5-beta.902 → 1.3.5-beta.903

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.
@@ -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 = {
@@ -22,7 +22,7 @@ import { acceptablePatternChecking, detectURLRegex, getCachedRegex, getPersonali
22
22
  import { DETECT_LINK, EMOJI, FORCE_SHOW_TOOLTIP, INVALID_TAG, MESSAGE_TAG, NO_VIEW_TAG, PERSONALIZE_PTN, PROMOTION_CODE, READONLY_TAG, REMOVED_TAG, SHORT_LINK, SHORT_LINK_PTN, defaultCssVariables, tagifyDefaultProps, } from './constants';
23
23
  const TagifyInput = forwardRef((props, ref) => {
24
24
  // Props
25
- const { initialValue, escapeHTML, status, readonly, readonlyTag, disabled, maxLength, maxHeight, minWidth, placeholder, isSingleLineText, acceptableTagPattern, mapAttributes, mapErrorAttributes, maxPersonalizeTags, name, children, cssTagifyVariables, onTagClick, onChange, } = props;
25
+ const { initialValue, escapeHTML, status, readonly, readonlyTag, realtime, disabled, maxLength, maxHeight, minWidth, placeholder, isSingleLineText, acceptableTagPattern, mapAttributes, mapErrorAttributes, maxPersonalizeTags, name, children, cssTagifyVariables, onTagClick, onChange, } = props;
26
26
  // States
27
27
  const [isLineBreak, setIsLineBreak] = useState(hasLineBreak(initialValue));
28
28
  const [tooltipRefresher, setTooltipRefresher] = useState(1);
@@ -406,15 +406,20 @@ const TagifyInput = forwardRef((props, ref) => {
406
406
  // Used to trigger replace URL detection and line break
407
407
  const onTagifyTyping = useCallback((event) => {
408
408
  if (event.detail) {
409
- const { textContent } = event.detail;
409
+ const { textContent, tagify } = event.detail;
410
410
  // Tracking if the tagify input is line break
411
411
  setIsLineBreak(hasLineBreak(textContent));
412
412
  // Update URL to tag to show hint in the tooltip with tag
413
413
  if (textContent) {
414
414
  detectReplaceURLToTag();
415
415
  }
416
+ if (realtime) {
417
+ const inputValue = tagify.getInputValue();
418
+ const convertedValue = convertInputStringToOriginal(inputValue);
419
+ onOutputData(convertedValue);
420
+ }
416
421
  }
417
- }, [detectReplaceURLToTag]);
422
+ }, [realtime, detectReplaceURLToTag, onOutputData]);
418
423
  /**
419
424
  * Capture to trigger when tagify changed
420
425
  */
@@ -48,6 +48,7 @@ export const DEFAULT_ACCEPT_TAGS = [
48
48
  export const tagifyDefaultProps = {
49
49
  initialValue: '',
50
50
  name: 'tagifyInput',
51
+ realtime: true,
51
52
  maxHeight: 266,
52
53
  placeholder: undefined,
53
54
  acceptableTagPattern: DEFAULT_ACCEPT_TAGS,
@@ -20,6 +20,13 @@ export interface TagifyInputProps {
20
20
  * Defines whether the input should escape HTML characters.
21
21
  */
22
22
  escapeHTML?: boolean;
23
+ /**
24
+ * Defines whether the input should be in *realtime* mode.
25
+ * In *realtime* mode, the input is updated as the user stops typing, otherwise only on blur types.
26
+ *
27
+ * @default true
28
+ */
29
+ realtime?: boolean;
23
30
  /**
24
31
  * Optional mapping configuration for custom attributes associated with tags.
25
32
  * Defines how tag attributes are mapped and processed internally.
@@ -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.902",
3
+ "version": "1.3.5-beta.903",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",