@rokkit/forms 1.0.0-next.127 → 1.0.0-next.129
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/package.json
CHANGED
package/src/Input.svelte
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
{@const Component = resolveRenderer({ type, props: restProps }, allRenderers)}
|
|
25
25
|
<div data-input-root>
|
|
26
26
|
{#if icon}
|
|
27
|
-
<span class={icon} aria-hidden="true"></span>
|
|
27
|
+
<span data-input-icon class={icon} aria-hidden="true"></span>
|
|
28
28
|
{/if}
|
|
29
29
|
<Component bind:value {onchange} {oninput} {onfocus} {onblur} {...extraProps} {...restProps} />
|
|
30
30
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
2
|
+
import { DEFAULT_STATE_ICONS } from '@rokkit/core'
|
|
3
3
|
import { isNil } from 'ramda'
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
let checked = $derived(Boolean(value))
|
|
52
|
-
let stateIcons = $derived({ ...
|
|
52
|
+
let stateIcons = $derived({ ...DEFAULT_STATE_ICONS.checkbox, ...icons })
|
|
53
53
|
let icon = $derived(stateIcons[isNil(value) ? 'unknown' : value ? 'checked' : 'unchecked'])
|
|
54
54
|
</script>
|
|
55
55
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { getItemAtIndex, getIndexForItem, noop } from '@rokkit/core'
|
|
3
|
-
import {
|
|
3
|
+
import { ProxyItem } from '@rokkit/states'
|
|
4
4
|
// import { equals } from 'ramda'
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {Object} InputRadioProps
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
|
|
43
43
|
<radio-group class={className} class:disabled>
|
|
44
44
|
{#each options as item, index (index)}
|
|
45
|
-
{@const proxy = new
|
|
45
|
+
{@const proxy = new ProxyItem(item, fields)}
|
|
46
46
|
<label class="flex flex-row items-center gap-2 rtl:flex-row-reverse">
|
|
47
47
|
<input
|
|
48
48
|
type="radio"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
{onfocus}
|
|
55
55
|
{onblur}
|
|
56
56
|
/>
|
|
57
|
-
<p>{proxy.
|
|
57
|
+
<p>{proxy.label}</p>
|
|
58
58
|
</label>
|
|
59
59
|
{/each}
|
|
60
60
|
</radio-group>
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
// Check if options include an empty string (used as "none" option)
|
|
28
28
|
const hasEmptyOption = $derived(options.some((opt) => opt === '' || (typeof opt === 'object' && opt?.value === '')))
|
|
29
29
|
|
|
30
|
-
// Filter out empty strings — Select +
|
|
30
|
+
// Filter out empty strings — Select + ProxyItem handles string options natively
|
|
31
31
|
const filteredOptions = $derived(
|
|
32
32
|
hasEmptyOption
|
|
33
33
|
? options.filter((opt) => opt !== '' && !(typeof opt === 'object' && opt?.value === ''))
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
</script>
|
|
40
40
|
|
|
41
41
|
<Select
|
|
42
|
-
|
|
42
|
+
items={filteredOptions}
|
|
43
43
|
{fields}
|
|
44
44
|
bind:value
|
|
45
45
|
placeholder={effectivePlaceholder}
|