@casinogate/ui 1.10.13 → 1.10.14

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.
@@ -15,12 +15,22 @@
15
15
  max = Infinity,
16
16
  step = 1,
17
17
  allowFloat = false,
18
+ precision = 2,
18
19
  class: className,
19
20
  containerClass,
21
+ disabled,
20
22
  ...restProps
21
23
  }: NumberInputProps = $props();
22
24
 
23
- const onlyNumberPattern = $derived(allowFloat ? /^\d*\.?\d*$/ : /^\d*$/);
25
+ const onlyNumberPattern = $derived.by(() => {
26
+ if (allowFloat) {
27
+ if (typeof precision === 'number') {
28
+ return new RegExp(`^\\d*\\.?\\d{0,${precision}}$`);
29
+ }
30
+ return /^\d*\.?\d*$/;
31
+ }
32
+ return /^\d*$/;
33
+ });
24
34
 
25
35
  let internalValue = $state(value?.toString() ?? '');
26
36
 
@@ -85,11 +95,17 @@
85
95
  class="cgui:border cgui:w-9 cgui:border-r-0 cgui:border-stroke-default cgui:text-fg-dark cgui:bg-surface-lightest"
86
96
  size="clean"
87
97
  onclick={onMinusClick}
98
+ {disabled}
88
99
  >
89
100
  <Icon.Minus width={16} height={16} />
90
101
  </Button>
91
102
 
92
- <Input bind:value={internalValueBox.current} class={cn('cgui:border-r cgui:border-l!', className)} {...restProps} />
103
+ <Input
104
+ bind:value={internalValueBox.current}
105
+ class={cn('cgui:border-r cgui:border-l!', className)}
106
+ {disabled}
107
+ {...restProps}
108
+ />
93
109
 
94
110
  <Button
95
111
  type="button"
@@ -98,6 +114,7 @@
98
114
  class="cgui:border cgui:w-9 cgui:border-stroke-default cgui:text-fg-dark cgui:bg-surface-lightest"
99
115
  size="clean"
100
116
  onclick={onPlusClick}
117
+ {disabled}
101
118
  >
102
119
  <Icon.Plus width={16} height={16} />
103
120
  </Button>
@@ -5,5 +5,6 @@ export type NumberInputProps = Omit<InputProps, 'value' | 'min' | 'max' | 'step'
5
5
  step?: number;
6
6
  value?: number;
7
7
  allowFloat?: boolean;
8
+ precision?: number;
8
9
  containerClass?: string;
9
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casinogate/ui",
3
- "version": "1.10.13",
3
+ "version": "1.10.14",
4
4
  "svelte": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",