@platformatic/ui-components 0.15.3 → 0.15.4
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/package.json
CHANGED
|
@@ -14,12 +14,13 @@ function SearchBarV2 ({
|
|
|
14
14
|
dataAttrName = '',
|
|
15
15
|
dataAttrValue = '',
|
|
16
16
|
inputTextClassName = '',
|
|
17
|
-
paddingClass = ''
|
|
17
|
+
paddingClass = '',
|
|
18
|
+
disabled = false
|
|
18
19
|
}) {
|
|
19
20
|
const inputRef = useRef()
|
|
20
21
|
const baseClassName = `${styles.container} ${paddingClass || styles.defaultPaddingClass} ` + commonStyles[`background-color-${backgroundColor}`]
|
|
21
22
|
const [wrapperClassName, setWrapperClassName] = useState(normalClassName())
|
|
22
|
-
const inputClassName = `${styles.input} ${inputTextClassName} `
|
|
23
|
+
const inputClassName = `${styles.input} ${inputTextClassName} ${disabled ? styles.disabled : ''} `
|
|
23
24
|
const [isOnFocus, setIsOnFocus] = useState(false)
|
|
24
25
|
const [showClear, setShowClear] = useState(false)
|
|
25
26
|
const dataProps = {}
|
|
@@ -70,7 +71,16 @@ function SearchBarV2 ({
|
|
|
70
71
|
return (
|
|
71
72
|
<div className={wrapperClassName} {...dataProps}>
|
|
72
73
|
<PlatformaticIcon iconName='LensIcon' color={color} disabled={!isOnFocus} size={SMALL} onClick={handleSearch} />
|
|
73
|
-
<input
|
|
74
|
+
<input
|
|
75
|
+
type='text'
|
|
76
|
+
placeholder={placeholder}
|
|
77
|
+
className={inputClassName}
|
|
78
|
+
ref={inputRef}
|
|
79
|
+
onChange={handleChange}
|
|
80
|
+
onFocus={onFocus}
|
|
81
|
+
onBlur={onBlur}
|
|
82
|
+
disabled={disabled}
|
|
83
|
+
/>
|
|
74
84
|
{showClear && (
|
|
75
85
|
<div className={styles.clearContainer}>
|
|
76
86
|
<PlatformaticIcon iconName='CircleCloseIcon' color={color} size={SMALL} onClick={handleClear} />
|
|
@@ -11,7 +11,6 @@ const Template = (args) => {
|
|
|
11
11
|
)
|
|
12
12
|
}
|
|
13
13
|
export const Standard = Template.bind({})
|
|
14
|
-
|
|
15
14
|
Standard.args = {
|
|
16
15
|
onChange: (value) => {
|
|
17
16
|
console.log('Current search: ' + value)
|
|
@@ -20,3 +19,9 @@ Standard.args = {
|
|
|
20
19
|
alert('Query value: ' + value)
|
|
21
20
|
}
|
|
22
21
|
}
|
|
22
|
+
|
|
23
|
+
export const Disabled = Template.bind({})
|
|
24
|
+
Disabled.args = {
|
|
25
|
+
disabled: true,
|
|
26
|
+
placeholder: 'Disabled'
|
|
27
|
+
}
|