poe-svelte-ui-lib 1.2.15 → 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.
@@ -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
- let isValid = $derived(RegExpObj().test(typeof value === 'string' ? value : String(value)))
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;
@@ -307,7 +307,7 @@
307
307
 
308
308
  {#if tooltip.show}
309
309
  <div
310
- class="fixed z-50 w-max max-w-[20%] rounded-md px-2 py-1 text-sm whitespace-pre-wrap shadow-lg"
310
+ class="fixed z-50 w-max max-w-[30%] rounded-md px-2 py-1 text-left text-sm whitespace-pre-wrap shadow-lg"
311
311
  style="background: color-mix(in srgb, var(--yellow-color) 30%, var(--back-color)); transform: translateX(-50%); left: {tooltip.x +
312
312
  10}px; top: {tooltip.y + 10}px;"
313
313
  transition:fly={{ y: 10, duration: 200 }}
package/dist/types.d.ts CHANGED
@@ -79,6 +79,7 @@ export interface IInputProps {
79
79
  maxlength?: number;
80
80
  textareaRows?: number;
81
81
  placeholder?: string;
82
+ isValid?: boolean;
82
83
  number?: {
83
84
  minNum?: number;
84
85
  maxNum?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-svelte-ui-lib",
3
- "version": "1.2.15",
3
+ "version": "1.2.17",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {