poe-svelte-ui-lib 1.2.16 → 1.2.17
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/Input/Input.svelte
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
componentClass = '',
|
|
17
17
|
maxlength = 100,
|
|
18
18
|
textareaRows = 3,
|
|
19
|
+
isValid = $bindable(true),
|
|
19
20
|
number = { minNum: -1000000, maxNum: 1000000, step: 1 },
|
|
20
21
|
help = { info: '', autocomplete: 'off', copyButton: false, regExp: '^[\\s\\S]*$' },
|
|
21
22
|
onUpdate = () => {},
|
|
@@ -38,7 +39,9 @@
|
|
|
38
39
|
return match ? new RegExp(match[1], match[2]) : new RegExp(pattern)
|
|
39
40
|
}
|
|
40
41
|
let RegExpObj = $derived(() => parseRegExp(help.regExp ?? ''))
|
|
41
|
-
|
|
42
|
+
$effect(() => {
|
|
43
|
+
isValid = RegExpObj().test(typeof value === 'string' ? value : String(value))
|
|
44
|
+
})
|
|
42
45
|
|
|
43
46
|
const handleInputChange = (value: string | number) => {
|
|
44
47
|
if (type === 'number') {
|
|
@@ -63,7 +66,7 @@
|
|
|
63
66
|
class={twMerge(
|
|
64
67
|
`w-full rounded-2xl border px-4 py-1 text-center transition-all duration-300 outline-none focus:border-blue-400
|
|
65
68
|
[&::-webkit-inner-spin-button]:hidden [&::-webkit-outer-spin-button]:hidden
|
|
66
|
-
${isValid ? 'border-(--border-color)' : 'border-red-400 shadow-[0_0_6px_var(--red-color)]'}
|
|
69
|
+
${isValid ? 'border-(--border-color)' : 'border-red-400 shadow-[0_0_6px_var(--red-color)] focus:border-red-400'}
|
|
67
70
|
${disabled ? 'opacity-50' : 'hover:shadow-md'}
|
|
68
71
|
${readonly ? '' : 'hover:shadow-md'}
|
|
69
72
|
${help?.info ? 'pl-8' : ''}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { IInputProps } from '../types';
|
|
2
|
-
declare const Input: import("svelte").Component<IInputProps, {}, "value">;
|
|
2
|
+
declare const Input: import("svelte").Component<IInputProps, {}, "value" | "isValid">;
|
|
3
3
|
type Input = ReturnType<typeof Input>;
|
|
4
4
|
export default Input;
|
package/dist/types.d.ts
CHANGED