@axium/client 0.15.0 → 0.15.2
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/assets/styles.css +2 -0
- package/lib/Icon.svelte +1 -1
- package/lib/Popover.svelte +16 -4
- package/lib/UserDiscovery.svelte +2 -2
- package/lib/ZodInput.svelte +6 -14
- package/package.json +2 -2
package/assets/styles.css
CHANGED
package/lib/Icon.svelte
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
const href = $derived(`/icons/${style}.svg#${id}`);
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="1em" height="1em" {...rest}>
|
|
7
|
+
<svg class="Icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="1em" height="1em" {...rest}>
|
|
8
8
|
<use {href} />
|
|
9
9
|
</svg>
|
|
10
10
|
|
package/lib/Popover.svelte
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
3
|
import Icon from './Icon.svelte';
|
|
3
|
-
const {
|
|
4
|
+
const {
|
|
5
|
+
children,
|
|
6
|
+
toggle,
|
|
7
|
+
showToggle,
|
|
8
|
+
popover,
|
|
9
|
+
...rest
|
|
10
|
+
}: {
|
|
11
|
+
children(): any;
|
|
12
|
+
toggle?(): any;
|
|
13
|
+
showToggle?: 'hover' | 'always';
|
|
14
|
+
popover?: 'auto' | 'hint' | 'manual';
|
|
15
|
+
} & HTMLAttributes<HTMLDivElement> = $props();
|
|
4
16
|
|
|
5
|
-
let
|
|
17
|
+
let popoverElement = $state<HTMLDivElement>();
|
|
6
18
|
|
|
7
19
|
function onclick(e: MouseEvent) {
|
|
8
20
|
e.stopPropagation();
|
|
9
21
|
// @ts-expect-error 2345
|
|
10
|
-
|
|
22
|
+
popoverElement?.togglePopover({ source: e.currentTarget });
|
|
11
23
|
}
|
|
12
24
|
</script>
|
|
13
25
|
|
|
@@ -20,7 +32,7 @@
|
|
|
20
32
|
</span>
|
|
21
33
|
{/if}
|
|
22
34
|
|
|
23
|
-
<div popover bind:this={
|
|
35
|
+
<div popover={popover || 'auto'} bind:this={popoverElement} {...rest}>
|
|
24
36
|
{@render children()}
|
|
25
37
|
</div>
|
|
26
38
|
</div>
|
package/lib/UserDiscovery.svelte
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
let value = $state<string>();
|
|
25
25
|
let gotError = $state<boolean>(false);
|
|
26
26
|
|
|
27
|
-
async function
|
|
27
|
+
async function oninput() {
|
|
28
28
|
if (!value || !value.length) {
|
|
29
29
|
results = [];
|
|
30
30
|
return;
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
}
|
|
56
56
|
</script>
|
|
57
57
|
|
|
58
|
-
<input bind:value type="text" placeholder="Add users and roles" {
|
|
58
|
+
<input bind:value type="text" placeholder="Add users and roles" {oninput} />
|
|
59
59
|
{#if !gotError && value}
|
|
60
60
|
<!-- Don't show results when we can't use the discovery API -->
|
|
61
61
|
<div class="results">
|
package/lib/ZodInput.svelte
CHANGED
|
@@ -87,14 +87,14 @@
|
|
|
87
87
|
updateValue(rootValue);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
const
|
|
90
|
+
const oninput = onchange;
|
|
91
91
|
</script>
|
|
92
92
|
|
|
93
93
|
{#snippet _in(rest: HTMLInputAttributes)}
|
|
94
94
|
<div class="ZodInput">
|
|
95
95
|
{#if !noLabel}<label for={id}>{label || path}</label>{/if}
|
|
96
96
|
{#if error}<span class="ZodInput-error error-text">{error}</span>{/if}
|
|
97
|
-
<input {id} {...rest} bind:value {onchange} {
|
|
97
|
+
<input {id} {...rest} bind:value {onchange} {oninput} required={!optional} {defaultValue} class={[error && 'error']} />
|
|
98
98
|
</div>
|
|
99
99
|
{/snippet}
|
|
100
100
|
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
{:else if schema.type == 'boolean'}
|
|
108
108
|
<div class="ZodInput">
|
|
109
109
|
{#if !noLabel}<label for="{id}:checkbox">{label || path}</label>{/if}
|
|
110
|
-
<input bind:checked={value} id="{id}:checkbox" type="checkbox" {onchange}
|
|
110
|
+
<input bind:checked={value} id="{id}:checkbox" type="checkbox" {onchange} required={!optional} />
|
|
111
111
|
<label for="{id}:checkbox" {id} class="checkbox">
|
|
112
112
|
{#if value}<Icon i="check" --size="1.3em" />{/if}
|
|
113
113
|
</label>
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
{:else if schema.type == 'literal'}
|
|
124
124
|
<div class="ZodInput">
|
|
125
125
|
<label for={id}>{label || path}</label>
|
|
126
|
-
<select bind:value {id} {
|
|
126
|
+
<select bind:value {id} {oninput} required={!optional}>
|
|
127
127
|
{#each schema.values as value}
|
|
128
128
|
<option {value} selected={value === value}>{value}</option>
|
|
129
129
|
{/each}
|
|
@@ -143,15 +143,7 @@
|
|
|
143
143
|
<div class="ZodInput-array">
|
|
144
144
|
{#each value, i}
|
|
145
145
|
<div class="ZodInput-element">
|
|
146
|
-
<input
|
|
147
|
-
id="{id}.{i}"
|
|
148
|
-
bind:value={value[i]}
|
|
149
|
-
{onchange}
|
|
150
|
-
{onkeyup}
|
|
151
|
-
required={!optional}
|
|
152
|
-
{defaultValue}
|
|
153
|
-
class={[error && 'error']}
|
|
154
|
-
/>
|
|
146
|
+
<input id="{id}.{i}" bind:value={value[i]} {oninput} required={!optional} {defaultValue} class={[error && 'error']} />
|
|
155
147
|
<button
|
|
156
148
|
onclick={e => {
|
|
157
149
|
value.splice(i, 1);
|
|
@@ -192,7 +184,7 @@
|
|
|
192
184
|
<div class="ZodInput">
|
|
193
185
|
{#if !noLabel}<label for={id}>{label || path}</label>{/if}
|
|
194
186
|
{#if error}<span class="ZodInput-error error-text">{error}</span>{/if}
|
|
195
|
-
<select {id} {onchange}
|
|
187
|
+
<select {id} {onchange} bind:value required={!optional}>
|
|
196
188
|
{#each Object.entries(schema.enum) as [key, value]}
|
|
197
189
|
<option {value} selected={value === value}>{key}</option>
|
|
198
190
|
{/each}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axium/client",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2",
|
|
4
4
|
"author": "James Prevett <jp@jamespre.dev>",
|
|
5
5
|
"funding": {
|
|
6
6
|
"type": "individual",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@axium/core": ">=0.19.0",
|
|
45
|
-
"utilium": "^2.3
|
|
45
|
+
"utilium": "^2.6.3",
|
|
46
46
|
"zod": "^4.0.5",
|
|
47
47
|
"svelte": "^5.36.0"
|
|
48
48
|
},
|