react-core-ts 1.3.74 → 1.3.75
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/AutoCompleteWithTreeStructure.js +32 -21
- package/dist/AutoCompleteWithTreeStructure.js.map +1 -1
- package/dist/commontypes.d.ts +3 -0
- package/dist/styles/styles/components/autocomplete.css +631 -0
- package/dist/styles/styles/components/selectedautocomplete.css +130 -0
- package/dist/styles/styles/components/tooltip.css +497 -0
- package/dist/styles/styles/components/treedropdown.css +90 -0
- package/dist/styles/styles/global.css +8 -0
- package/package.json +1 -1
- package/src/AutoCompleteWithTreeStructure.tsx +57 -31
- package/src/commontypes.ts +5 -0
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
forwardRef,
|
|
3
|
-
useCallback,
|
|
4
|
-
useEffect,
|
|
5
|
-
useImperativeHandle,
|
|
6
|
-
useRef,
|
|
7
|
-
useState,
|
|
8
|
-
} from 'react';
|
|
1
|
+
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
9
2
|
import ReactDOM from 'react-dom';
|
|
10
3
|
|
|
11
4
|
import { AutoSuggestionInputProps } from './commontypes';
|
|
@@ -70,6 +63,8 @@ const AutoCompleteWithTreeStructure = forwardRef<
|
|
|
70
63
|
showIcon,
|
|
71
64
|
handleShowIcon,
|
|
72
65
|
hasDisableSelection,
|
|
66
|
+
inputType = 'text',
|
|
67
|
+
onFocusTreeDropdown,
|
|
73
68
|
},
|
|
74
69
|
ref
|
|
75
70
|
) => {
|
|
@@ -600,6 +595,7 @@ const AutoCompleteWithTreeStructure = forwardRef<
|
|
|
600
595
|
className={`qbs-textfield-expandable ${
|
|
601
596
|
!expandable ? 'qbs-normal' : ''
|
|
602
597
|
}`}
|
|
598
|
+
style={{ width: inputType === 'text' ? '100%' : 'auto' }}
|
|
603
599
|
data-value={
|
|
604
600
|
selectedItems?.length > 0 || searchValue
|
|
605
601
|
? searchValue
|
|
@@ -607,29 +603,59 @@ const AutoCompleteWithTreeStructure = forwardRef<
|
|
|
607
603
|
}
|
|
608
604
|
onClick={() => onInputFocus()}
|
|
609
605
|
>
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
readOnly
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
606
|
+
{inputType === 'text' ? (
|
|
607
|
+
<input
|
|
608
|
+
id={id}
|
|
609
|
+
ref={inputRef}
|
|
610
|
+
type="text"
|
|
611
|
+
value={
|
|
612
|
+
type === 'auto_suggestion' && !expandable
|
|
613
|
+
? inputValue
|
|
614
|
+
: inputValue
|
|
615
|
+
}
|
|
616
|
+
onChange={handleChange}
|
|
617
|
+
// onBlur={handleBlur}
|
|
618
|
+
onFocus={onFocus}
|
|
619
|
+
onClick={() => handleOnClick()}
|
|
620
|
+
className={generateClassName()}
|
|
621
|
+
placeholder={selectedItems?.length > 0 ? '' : placeholder ?? ''}
|
|
622
|
+
readOnly={
|
|
623
|
+
readOnly ||
|
|
624
|
+
type === 'custom_select' ||
|
|
625
|
+
(type == 'auto_suggestion' && !expandable)
|
|
626
|
+
}
|
|
627
|
+
disabled={disabled}
|
|
628
|
+
data-testid="custom-autocomplete"
|
|
629
|
+
/>
|
|
630
|
+
) : (
|
|
631
|
+
<textarea
|
|
632
|
+
id={id}
|
|
633
|
+
ref={inputRef}
|
|
634
|
+
value={inputValue}
|
|
635
|
+
// onChange={handleChange}
|
|
636
|
+
onFocus={onFocusTreeDropdown}
|
|
637
|
+
onClick={() => handleOnClick()}
|
|
638
|
+
className={`${generateClassName()} resize-none overflow-y-auto`}
|
|
639
|
+
placeholder={selectedItems?.length > 0 ? '' : placeholder ?? ''}
|
|
640
|
+
readOnly={
|
|
641
|
+
readOnly ||
|
|
642
|
+
type === 'custom_select' ||
|
|
643
|
+
(type == 'auto_suggestion' && !expandable)
|
|
644
|
+
}
|
|
645
|
+
disabled={disabled}
|
|
646
|
+
data-testid="custom-autocomplete"
|
|
647
|
+
rows={4} // Set initial rows to 4
|
|
648
|
+
style={{
|
|
649
|
+
height: 'auto', // Allow it to expand
|
|
650
|
+
minHeight: '80px', // Approx. 4 lines of text
|
|
651
|
+
maxHeight: '160px', // Restrict max height to prevent large expansion
|
|
652
|
+
overflowY: 'auto', // Add scrollbar when exceeding 4 lines
|
|
653
|
+
wordWrap: 'break-word', // Ensure long words wrap correctly
|
|
654
|
+
whiteSpace: 'pre-wrap', // Preserve line breaks & spacing
|
|
655
|
+
}}
|
|
656
|
+
/>
|
|
657
|
+
)}
|
|
658
|
+
)
|
|
633
659
|
</div>
|
|
634
660
|
|
|
635
661
|
{/* Icons for Clearing Input or Toggling Dropdown */}
|
package/src/commontypes.ts
CHANGED
|
@@ -69,6 +69,10 @@ export interface AutoSuggestionInputProps {
|
|
|
69
69
|
showIcon?: boolean;
|
|
70
70
|
handleShowIcon?: (node: any) => boolean;
|
|
71
71
|
hasDisableSelection?: (node: any) => boolean;
|
|
72
|
+
onFocusTreeDropdown?: (
|
|
73
|
+
e: React.FocusEvent<HTMLTextAreaElement, Element>
|
|
74
|
+
) => void;
|
|
75
|
+
inputType?: 'text' | 'textarea';
|
|
72
76
|
}
|
|
73
77
|
export interface IconsProps {
|
|
74
78
|
name: any;
|
|
@@ -144,6 +148,7 @@ export interface TextFieldProps {
|
|
|
144
148
|
onCreatableChange?: (e: string[]) => void;
|
|
145
149
|
infoTitle?: string;
|
|
146
150
|
showInfo?: boolean;
|
|
151
|
+
inputType?: 'text' | 'textarea';
|
|
147
152
|
}
|
|
148
153
|
|
|
149
154
|
export interface TextAreaProps {
|