@rokkit/ui 1.0.0-next.113 → 1.0.0-next.114
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 +1 -2
- package/src/Connector.svelte +5 -4
- package/src/DropSearch.svelte +1 -1
- package/src/Icon.svelte +11 -8
- package/src/Link.svelte +1 -1
- package/src/ListEditor.svelte +1 -1
- package/src/Select.svelte +40 -31
- package/src/SlidingColumns.svelte +15 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rokkit/ui",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.114",
|
|
4
4
|
"description": "Organisms are larger, more complex building blocks that are composed of multiple molecules",
|
|
5
5
|
"author": "Jerry Thomas <me@jerrythomas.name>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"dist/**/*.d.ts"
|
|
21
21
|
],
|
|
22
22
|
"exports": {
|
|
23
|
-
"./src": "./src",
|
|
24
23
|
"./package.json": "./package.json",
|
|
25
24
|
"./utils": "./src/lib/index.js",
|
|
26
25
|
".": {
|
package/src/Connector.svelte
CHANGED
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
|
|
13
13
|
<span
|
|
14
14
|
class="grid h-full w-4 min-w-4 grid-cols-2 grid-rows-2"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
data-tag-tree-line
|
|
16
|
+
data-tag-line-empty={validatedType === 'empty' ? '' : undefined}
|
|
17
|
+
data-tag-line-child={validatedType === 'child' ? '' : undefined}
|
|
18
|
+
data-tag-line-sibling={validatedType === 'sibling' ? '' : undefined}
|
|
19
|
+
data-tag-line-last={validatedType === 'last' ? '' : undefined}
|
|
19
20
|
>
|
|
20
21
|
{#if validatedType === 'last'}
|
|
21
22
|
{#if rtl}
|
package/src/DropSearch.svelte
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
}
|
|
25
25
|
</script>
|
|
26
26
|
|
|
27
|
-
<Select {name} bind:value options={filtered} {...restProps} {fields} onselect={handleSelect}>
|
|
27
|
+
<Select {name} bind:value bind:options={filtered} {...restProps} {fields} onselect={handleSelect}>
|
|
28
28
|
<span class="flex flex-grow">
|
|
29
29
|
<input
|
|
30
30
|
type="text"
|
package/src/Icon.svelte
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @property {any} name
|
|
7
7
|
* @property {any} [state]
|
|
8
8
|
* @property {string} [size]
|
|
9
|
-
* @property {
|
|
9
|
+
* @property {'img'|'button'|'checkbox'|'option'} [role]
|
|
10
10
|
* @property {any} [label]
|
|
11
11
|
* @property {boolean} [disabled]
|
|
12
12
|
* @property {number} [tabindex]
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
/** @type {Props} */
|
|
21
21
|
let {
|
|
22
|
+
ref = $bindable(),
|
|
22
23
|
class: classes = '',
|
|
23
24
|
name,
|
|
24
25
|
state = null,
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
e.preventDefault()
|
|
38
39
|
|
|
39
40
|
if (!disabled) {
|
|
40
|
-
if (
|
|
41
|
+
if (isCheckbox) {
|
|
41
42
|
checked = !checked
|
|
42
43
|
emitter?.change(checked)
|
|
43
44
|
}
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
|
|
49
|
+
let isCheckbox = $derived(role === 'checkbox' || role === 'option')
|
|
48
50
|
let validatedTabindex = $derived(role === 'img' || disabled ? -1 : tabindex)
|
|
49
51
|
let ariaChecked = $derived(
|
|
50
52
|
['checkbox', 'option'].includes(role) ? (checked !== null ? checked : false) : null
|
|
@@ -53,18 +55,19 @@
|
|
|
53
55
|
|
|
54
56
|
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
|
55
57
|
<rk-icon
|
|
58
|
+
bind:this={ref}
|
|
59
|
+
data-tag-icon
|
|
60
|
+
data-state={state}
|
|
61
|
+
data-tag-button={role === 'button' ? true : undefined}
|
|
62
|
+
data-tag-checkbox={isCheckbox ? true : undefined}
|
|
63
|
+
data-size={size}
|
|
64
|
+
data-disabled={disabled}
|
|
56
65
|
class={classes}
|
|
57
|
-
class:small={size === 'small'}
|
|
58
|
-
class:medium={size === 'medium'}
|
|
59
|
-
class:large={size === 'large'}
|
|
60
|
-
class:disabled
|
|
61
66
|
{role}
|
|
62
67
|
aria-label={label ?? name}
|
|
63
68
|
aria-checked={ariaChecked}
|
|
64
69
|
onclick={handleClick}
|
|
65
70
|
onkeydown={(e) => e.key === 'Enter' && e.currentTarget.click()}
|
|
66
|
-
data-state={state}
|
|
67
|
-
data-tag="icon"
|
|
68
71
|
tabindex={validatedTabindex}
|
|
69
72
|
onmouseenter={emitter.mouseenter}
|
|
70
73
|
onnmouseleave={emitter.nmouseleave}
|
package/src/Link.svelte
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
/** @type {Props} */
|
|
14
14
|
let { class: classes = '', value, mapping = new FieldMapper(), href = '#', ...rest } = $props()
|
|
15
|
-
let url = $derived(mapping.get('
|
|
15
|
+
let url = $derived(mapping.get('href', value, href))
|
|
16
16
|
let props = $derived({ ...mapping.get('props', value, {}), ...rest })
|
|
17
17
|
</script>
|
|
18
18
|
|
package/src/ListEditor.svelte
CHANGED
package/src/Select.svelte
CHANGED
|
@@ -8,21 +8,22 @@
|
|
|
8
8
|
// import ListItems from './ListItems.svelte'
|
|
9
9
|
import Item from './Item.svelte'
|
|
10
10
|
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
let {
|
|
12
|
+
class: className = '',
|
|
13
|
+
name = null,
|
|
14
|
+
options = $bindable([]),
|
|
15
|
+
fields,
|
|
16
|
+
using = {},
|
|
17
|
+
value = $bindable(null),
|
|
18
|
+
placeholder = '',
|
|
19
|
+
currentItem
|
|
20
|
+
} = $props()
|
|
20
21
|
|
|
21
|
-
let activeIndex
|
|
22
|
-
let open = false
|
|
23
|
-
let offsetTop
|
|
22
|
+
let activeIndex = $state(-1)
|
|
23
|
+
let open = $state(false)
|
|
24
|
+
// let offsetTop
|
|
24
25
|
let icons = defaultStateIcons.selector
|
|
25
|
-
let activeItem
|
|
26
|
+
let activeItem = $state(null)
|
|
26
27
|
|
|
27
28
|
function handleSelect() {
|
|
28
29
|
open = false
|
|
@@ -51,10 +52,10 @@
|
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
$: fields = { ...defaultFields, ...fields }
|
|
55
|
-
$: using = { default: Item, ...using }
|
|
56
|
-
$: activeIndex = options.findIndex((item) => item === value)
|
|
57
|
-
|
|
55
|
+
// $: fields = { ...defaultFields, ...fields }
|
|
56
|
+
// $: using = { default: Item, ...using }
|
|
57
|
+
// $: activeIndex = options.findIndex((item) => item === value)
|
|
58
|
+
let offsetTop = $derived(activeItem?.offsetTop + activeItem?.clientHeight ?? 0)
|
|
58
59
|
</script>
|
|
59
60
|
|
|
60
61
|
<input-select
|
|
@@ -65,27 +66,28 @@
|
|
|
65
66
|
aria-label={name}
|
|
66
67
|
use:dismissable
|
|
67
68
|
use:navigable={{ horizontal: false, vertical: true }}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
onfocus={() => (open = true)}
|
|
70
|
+
onblur={() => (open = false)}
|
|
71
|
+
ondismiss={() => (open = false)}
|
|
72
|
+
onprevious={handlePrevious}
|
|
73
|
+
onnext={handleNext}
|
|
74
|
+
onselect={handleKeySelect}
|
|
74
75
|
>
|
|
75
|
-
<!-- svelte-ignore
|
|
76
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
76
77
|
<selected-item
|
|
77
|
-
|
|
78
|
+
onclick={() => (open = !open)}
|
|
78
79
|
class="flex w-full items-center"
|
|
79
80
|
bind:this={activeItem}
|
|
80
81
|
role="option"
|
|
81
82
|
tabindex="-1"
|
|
82
83
|
aria-selected={value !== null && !open}
|
|
83
84
|
>
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
<item>
|
|
86
|
+
{#if currentItem}
|
|
87
|
+
{@render currentItem(value, fields)}
|
|
88
|
+
{/if}
|
|
89
|
+
<Item value={value ?? placeholder} {fields} />
|
|
90
|
+
</item>
|
|
89
91
|
{#if open}
|
|
90
92
|
<Icon name={icons.opened} label="opened" tabindex="-1" />
|
|
91
93
|
{:else}
|
|
@@ -102,7 +104,14 @@
|
|
|
102
104
|
{using}
|
|
103
105
|
/>
|
|
104
106
|
</list> -->
|
|
105
|
-
<List
|
|
107
|
+
<List
|
|
108
|
+
bind:items={options}
|
|
109
|
+
{fields}
|
|
110
|
+
{using}
|
|
111
|
+
bind:value
|
|
112
|
+
on:select={handleSelect}
|
|
113
|
+
tabindex="-1"
|
|
114
|
+
/>
|
|
106
115
|
</Slider>
|
|
107
116
|
{/if}
|
|
108
117
|
</input-select>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { fly, fade } from 'svelte/transition'
|
|
4
4
|
import { cubicInOut } from 'svelte/easing'
|
|
5
5
|
|
|
6
|
-
let { activeIndex = 0, columns = $bindable([]) } = $props()
|
|
6
|
+
let { activeIndex = $bindable(0), columns = $bindable([]) } = $props()
|
|
7
7
|
let width = $state()
|
|
8
8
|
let offset = $state(1)
|
|
9
9
|
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
offset = -1
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
let activeColumn = $derived(columns[activeIndex])
|
|
23
25
|
</script>
|
|
24
26
|
|
|
25
27
|
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
|
@@ -27,26 +29,22 @@
|
|
|
27
29
|
use:swipeable
|
|
28
30
|
onswipeleft={handlePrevious}
|
|
29
31
|
onswiperight={handleNext}
|
|
30
|
-
use:navigable
|
|
32
|
+
use:navigable={{ orientation: 'horizontal' }}
|
|
31
33
|
onprevious={handlePrevious}
|
|
32
34
|
onnext={handleNext}
|
|
33
35
|
tabindex={0}
|
|
34
36
|
class="relative grid h-full w-full overflow-hidden"
|
|
35
37
|
bind:clientWidth={width}
|
|
36
38
|
>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
{column}
|
|
49
|
-
</rk-segment>
|
|
50
|
-
{/if}
|
|
51
|
-
{/each}
|
|
39
|
+
<rk-segment
|
|
40
|
+
class="slide absolute h-full w-full"
|
|
41
|
+
in:fly={{ x: offset * width, duration: 1000, easing: cubicInOut }}
|
|
42
|
+
out:fade={{
|
|
43
|
+
x: -1 * offset * width,
|
|
44
|
+
duration: 1000,
|
|
45
|
+
easing: cubicInOut
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
{activeColumn}
|
|
49
|
+
</rk-segment>
|
|
52
50
|
</rk-container>
|