uibee 2.7.10 → 2.7.12
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.
|
@@ -36,5 +36,5 @@ export default function TagInput({ label, name, value = [], onChange, placeholde
|
|
|
36
36
|
disabled:opacity-50 disabled:cursor-not-allowed
|
|
37
37
|
transition-all duration-200
|
|
38
38
|
${error ? 'border-red-500 focus-within:border-red-500 focus-within:ring-red-500' : ''}
|
|
39
|
-
`, children: [value.map((tag, index) => (_jsxs("span", { className: 'flex items-center gap-1 px-2 py-1 bg-login rounded text-sm text-white', children: [tag, !disabled && (_jsx("button", { type: 'button', onClick: () => removeTag(index), className: 'hover:text-red-200 transition-colors', children: _jsx(X, { size: 14 }) }))] }, index))), _jsx("input", { type: 'text', value: inputValue, required: required && value.length === 0, onChange: (e) => setInputValue(e.target.value), onKeyDown: handleKeyDown, disabled: disabled, placeholder: value.length === 0 ? placeholder : '', className: 'flex-1 bg-transparent outline-none min-w-30 text-login-text placeholder:text-login-200' })] }),
|
|
39
|
+
`, children: [value.map((tag, index) => (_jsxs("span", { className: 'flex items-center gap-1 px-2 py-1 bg-login rounded text-sm text-white', children: [tag, !disabled && (_jsx("button", { type: 'button', onClick: () => removeTag(index), className: 'hover:text-red-200 transition-colors', children: _jsx(X, { size: 14 }) }))] }, index))), _jsx("input", { type: 'text', value: inputValue, required: required && value.length === 0, onChange: (e) => setInputValue(e.target.value), onKeyDown: handleKeyDown, disabled: disabled, placeholder: value.length === 0 ? placeholder : '', className: 'flex-1 bg-transparent outline-none min-w-30 text-login-text placeholder:text-login-200' })] }), _jsx("input", { type: 'hidden', name: name, value: value.join(',') })] }));
|
|
40
40
|
}
|
package/package.json
CHANGED
|
@@ -12,6 +12,7 @@ interface SelectionWrapperProps {
|
|
|
12
12
|
children: ReactNode
|
|
13
13
|
className?: string
|
|
14
14
|
disabled?: boolean
|
|
15
|
+
hideError?: boolean
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export default function SelectionWrapper({
|
|
@@ -23,6 +24,7 @@ export default function SelectionWrapper({
|
|
|
23
24
|
children,
|
|
24
25
|
className,
|
|
25
26
|
disabled,
|
|
27
|
+
hideError,
|
|
26
28
|
}: SelectionWrapperProps) {
|
|
27
29
|
return (
|
|
28
30
|
<div className={`flex flex-col gap-1 ${className || ''}`}>
|
|
@@ -41,7 +43,7 @@ export default function SelectionWrapper({
|
|
|
41
43
|
</div>
|
|
42
44
|
{info && <InputInfo info={info} />}
|
|
43
45
|
</div>
|
|
44
|
-
<InputError error={error} />
|
|
46
|
+
{!hideError && <InputError error={error} />}
|
|
45
47
|
</div>
|
|
46
48
|
)
|
|
47
49
|
}
|
|
@@ -11,6 +11,7 @@ export type SwitchProps = {
|
|
|
11
11
|
error?: string
|
|
12
12
|
info?: string
|
|
13
13
|
required?: boolean
|
|
14
|
+
switchOnly?: boolean
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export default function Switch({
|
|
@@ -23,6 +24,7 @@ export default function Switch({
|
|
|
23
24
|
error,
|
|
24
25
|
info,
|
|
25
26
|
required,
|
|
27
|
+
switchOnly,
|
|
26
28
|
}: SwitchProps) {
|
|
27
29
|
return (
|
|
28
30
|
<SelectionWrapper
|
|
@@ -31,10 +33,11 @@ export default function Switch({
|
|
|
31
33
|
required={required}
|
|
32
34
|
info={info}
|
|
33
35
|
error={error}
|
|
36
|
+
hideError={switchOnly}
|
|
34
37
|
className={className}
|
|
35
38
|
disabled={disabled}
|
|
36
39
|
>
|
|
37
|
-
<label className=
|
|
40
|
+
<label className={`relative inline-flex items-center cursor-pointer ${switchOnly ? 'h-fit' : 'h-10.5'}`}>
|
|
38
41
|
<input
|
|
39
42
|
type='checkbox'
|
|
40
43
|
id={name}
|
|
@@ -48,7 +51,7 @@ export default function Switch({
|
|
|
48
51
|
<div className={`
|
|
49
52
|
w-11 h-6 bg-login-500/50 rounded-full peer
|
|
50
53
|
peer-checked:after:translate-x-full peer-checked:after:border-white
|
|
51
|
-
after:content-[''] after:absolute
|
|
54
|
+
after:content-[''] after:absolute ${switchOnly ? 'top-0.5' : 'top-2.75'} after:left-0.5
|
|
52
55
|
after:bg-white after:border-gray-300 after:border after:rounded-full
|
|
53
56
|
after:h-5 after:w-5 after:transition-all peer-checked:bg-login
|
|
54
57
|
${disabled ? 'opacity-50 cursor-not-allowed' : ''}
|
|
@@ -99,14 +99,11 @@ export default function TagInput({
|
|
|
99
99
|
className='flex-1 bg-transparent outline-none min-w-30 text-login-text placeholder:text-login-200'
|
|
100
100
|
/>
|
|
101
101
|
</div>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
value={tag}
|
|
108
|
-
/>
|
|
109
|
-
))}
|
|
102
|
+
<input
|
|
103
|
+
type='hidden'
|
|
104
|
+
name={name}
|
|
105
|
+
value={value.join(',')}
|
|
106
|
+
/>
|
|
110
107
|
</FieldWrapper>
|
|
111
108
|
)
|
|
112
109
|
}
|