@rokkit/ui 1.0.0-next.124 → 1.0.0-next.127
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/README.md +198 -101
- package/package.json +52 -34
- package/src/components/BreadCrumbs.svelte +82 -0
- package/src/components/Button.svelte +87 -0
- package/src/components/ButtonGroup.svelte +18 -0
- package/src/components/Card.svelte +61 -0
- package/src/components/Carousel.svelte +169 -0
- package/src/components/Code.svelte +185 -0
- package/src/components/Connector.svelte +46 -0
- package/src/components/FloatingAction.svelte +331 -0
- package/src/components/FloatingNavigation.svelte +228 -0
- package/src/components/ItemContent.svelte +24 -0
- package/src/components/List.svelte +476 -0
- package/src/components/Menu.svelte +421 -0
- package/src/components/MultiSelect.svelte +521 -0
- package/src/components/PaletteManager.svelte +354 -0
- package/src/components/Pill.svelte +78 -0
- package/src/components/ProgressBar.svelte +31 -0
- package/src/components/Range.svelte +325 -0
- package/src/components/Rating.svelte +91 -0
- package/src/components/Reveal.svelte +58 -0
- package/src/components/SearchFilter.svelte +80 -0
- package/src/components/Select.svelte +585 -0
- package/src/{Shine.svelte → components/Shine.svelte} +29 -21
- package/src/components/Stepper.svelte +169 -0
- package/src/components/Switch.svelte +75 -0
- package/src/components/Table.svelte +243 -0
- package/src/components/Tabs.svelte +268 -0
- package/src/components/Tilt.svelte +68 -0
- package/src/components/Timeline.svelte +61 -0
- package/src/components/Toggle.svelte +157 -0
- package/src/components/Toolbar.svelte +307 -0
- package/src/components/ToolbarGroup.svelte +17 -0
- package/src/components/Tree.svelte +613 -0
- package/src/components/index.ts +33 -0
- package/src/index.ts +41 -0
- package/src/types/button.ts +83 -0
- package/src/types/code.ts +46 -0
- package/src/types/floating-action.ts +118 -0
- package/src/types/floating-navigation.ts +68 -0
- package/src/types/index.ts +53 -0
- package/src/types/item-proxy.ts +358 -0
- package/src/types/list.ts +196 -0
- package/src/types/menu.ts +195 -0
- package/src/types/palette.ts +143 -0
- package/src/types/range.ts +51 -0
- package/src/types/search-filter.ts +67 -0
- package/src/types/select.ts +206 -0
- package/src/types/switch.ts +64 -0
- package/src/types/table.ts +210 -0
- package/src/types/tabs.ts +124 -0
- package/src/types/timeline.ts +51 -0
- package/src/types/toggle.ts +109 -0
- package/src/types/toolbar.ts +164 -0
- package/src/types/tree.ts +259 -0
- package/src/utils/palette.ts +582 -0
- package/src/utils/shiki.ts +122 -0
- package/dist/constants.d.ts +0 -2
- package/dist/index.d.ts +0 -41
- package/dist/lib/fields.d.ts +0 -16
- package/dist/lib/form.d.ts +0 -95
- package/dist/lib/index.d.ts +0 -6
- package/dist/lib/layout.d.ts +0 -7
- package/dist/lib/nested.d.ts +0 -48
- package/dist/lib/schema.d.ts +0 -7
- package/dist/lib/select.d.ts +0 -8
- package/dist/lib/tree.d.ts +0 -9
- package/dist/tree/List.spec.svelte.d.ts +0 -1
- package/dist/tree/Node.spec.svelte.d.ts +0 -1
- package/dist/tree/Root.spec.svelte.d.ts +0 -1
- package/dist/types.d.ts +0 -5
- package/dist/wrappers/index.d.ts +0 -3
- package/src/Accordion.svelte +0 -118
- package/src/BreadCrumbs.svelte +0 -32
- package/src/Button.svelte +0 -57
- package/src/Calendar.svelte +0 -93
- package/src/Card.svelte +0 -45
- package/src/Carousel.svelte +0 -49
- package/src/CheckBox.svelte +0 -56
- package/src/Connector.svelte +0 -40
- package/src/DropDown.svelte +0 -68
- package/src/DropSearch.svelte +0 -37
- package/src/Fillable.svelte +0 -19
- package/src/GraphPaper.svelte +0 -43
- package/src/Icon.svelte +0 -81
- package/src/Item.svelte +0 -25
- package/src/Link.svelte +0 -21
- package/src/List.svelte +0 -89
- package/src/ListBody.svelte +0 -43
- package/src/Message.svelte +0 -11
- package/src/MultiSelect.svelte +0 -48
- package/src/NestedList.svelte +0 -78
- package/src/NestedPaginator.svelte +0 -63
- package/src/Node.svelte +0 -76
- package/src/Overlay.svelte +0 -21
- package/src/PageNavigator.svelte +0 -94
- package/src/PickOne.svelte +0 -60
- package/src/Pill.svelte +0 -41
- package/src/ProgressBar.svelte +0 -21
- package/src/ProgressDots.svelte +0 -53
- package/src/RadioGroup.svelte +0 -52
- package/src/Range.svelte +0 -45
- package/src/RangeMinMax.svelte +0 -124
- package/src/RangeSlider.svelte +0 -79
- package/src/RangeTick.svelte +0 -28
- package/src/Rating.svelte +0 -95
- package/src/ResponsiveGrid.svelte +0 -88
- package/src/Scrollable.svelte +0 -7
- package/src/Select.svelte +0 -114
- package/src/Separator.svelte +0 -1
- package/src/Slider.svelte +0 -14
- package/src/SlidingColumns.svelte +0 -50
- package/src/Stage.svelte +0 -41
- package/src/Stepper.svelte +0 -66
- package/src/Summary.svelte +0 -22
- package/src/Switch.svelte +0 -106
- package/src/TableCell.svelte +0 -51
- package/src/TableHeaderCell.svelte +0 -54
- package/src/Tabs.svelte +0 -176
- package/src/Tilt.svelte +0 -66
- package/src/Toggle.svelte +0 -58
- package/src/ToggleThemeMode.svelte +0 -23
- package/src/Tree.svelte +0 -80
- package/src/TreeTable.svelte +0 -171
- package/src/ValidationReport.svelte +0 -23
- package/src/constants.js +0 -4
- package/src/index.js +0 -48
- package/src/lib/fields.js +0 -118
- package/src/lib/form.js +0 -72
- package/src/lib/index.js +0 -13
- package/src/lib/layout.js +0 -63
- package/src/lib/nested.js +0 -192
- package/src/lib/schema.js +0 -32
- package/src/lib/select.js +0 -38
- package/src/lib/tree.js +0 -22
- package/src/tree/List.spec.svelte.js +0 -84
- package/src/tree/List.svelte +0 -78
- package/src/tree/Node.spec.svelte.js +0 -104
- package/src/tree/Node.svelte +0 -80
- package/src/tree/Root.spec.svelte.js +0 -63
- package/src/tree/Root.svelte +0 -81
- package/src/types.js +0 -9
- package/src/wrappers/Category.svelte +0 -27
- package/src/wrappers/Section.svelte +0 -16
- package/src/wrappers/Wrapper.svelte +0 -12
- package/src/wrappers/index.js +0 -3
package/src/RangeSlider.svelte
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { pannable } from '@rokkit/actions'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @typedef Props
|
|
6
|
-
* @property {number} min - The minimum value of the thumb.
|
|
7
|
-
* @property {number} max - The maximum value of the thumb.
|
|
8
|
-
* @property {number} value - The current value of the thumb.
|
|
9
|
-
* @property {number} cx - The current position of the thumb.
|
|
10
|
-
* @property {number[]} steps - An array of steps within a range.
|
|
11
|
-
* @property {import('d3-scale').ScaleLinear} scale - Scale mapping the thumb's position to its value.
|
|
12
|
-
*/
|
|
13
|
-
/** @type {Props} */
|
|
14
|
-
let { min = 0, max = 100, value = $bindable(), cx = $bindable(), steps = [], scale } = $props()
|
|
15
|
-
|
|
16
|
-
function handlePanMove(event) {
|
|
17
|
-
let x = cx + event.detail.dx
|
|
18
|
-
let limits = [scale.invert(min), scale.invert(max)]
|
|
19
|
-
|
|
20
|
-
cx = Math.min(Math.max(x, limits[0]), limits[1])
|
|
21
|
-
if (steps.length > 0) {
|
|
22
|
-
const result = scale(x)
|
|
23
|
-
let index = 0
|
|
24
|
-
let matched = false
|
|
25
|
-
while (!matched && index < steps.length - 1) {
|
|
26
|
-
if (steps[index] <= result && steps[index + 1] > result) {
|
|
27
|
-
value =
|
|
28
|
-
result - steps[index] > steps[index + 1] - result ? steps[index + 1] : steps[index]
|
|
29
|
-
matched = true
|
|
30
|
-
}
|
|
31
|
-
index++
|
|
32
|
-
}
|
|
33
|
-
} else {
|
|
34
|
-
value = scale(cx)
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function handlePanEnd() {
|
|
38
|
-
sliding = false
|
|
39
|
-
if (steps.length > 0) {
|
|
40
|
-
cx = scale.invert(value)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function handleKeyDown(event) {
|
|
44
|
-
if (steps.length === 0) {
|
|
45
|
-
const offset = (max - min) / 10
|
|
46
|
-
const step = event.key === 'ArrowLeft' ? -offset : event.key === 'ArrowRight' ? offset : 0
|
|
47
|
-
value = Math.min(Math.max(value + step, min), max)
|
|
48
|
-
} else {
|
|
49
|
-
const index = steps.findIndex((step) => step === value)
|
|
50
|
-
if (event.key === 'ArrowLeft' && index > 0) {
|
|
51
|
-
value = steps[index - 1]
|
|
52
|
-
cx = scale.invert(value)
|
|
53
|
-
} else if (event.key === 'ArrowRight' && index < steps.length - 1) {
|
|
54
|
-
value = steps[index + 1]
|
|
55
|
-
cx = scale.invert(value)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
let sliding = $state(false)
|
|
60
|
-
let position = $derived(`${cx}px`)
|
|
61
|
-
</script>
|
|
62
|
-
|
|
63
|
-
<rk-thumb
|
|
64
|
-
class="absolute -top-1 box-border h-4 w-4 cursor-pointer"
|
|
65
|
-
style:left={position}
|
|
66
|
-
class:sliding
|
|
67
|
-
tabindex="0"
|
|
68
|
-
onfocus={() => (sliding = true)}
|
|
69
|
-
onblur={() => (sliding = false)}
|
|
70
|
-
use:pannable
|
|
71
|
-
onpanmove={handlePanMove}
|
|
72
|
-
onpanstart={() => (sliding = true)}
|
|
73
|
-
onpanend={handlePanEnd}
|
|
74
|
-
onkeydown={handleKeyDown}
|
|
75
|
-
role="slider"
|
|
76
|
-
aria-valuenow={value}
|
|
77
|
-
aria-valuemin={min}
|
|
78
|
-
aria-valuemax={max}
|
|
79
|
-
></rk-thumb>
|
package/src/RangeTick.svelte
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { noop } from '@rokkit/core'
|
|
3
|
-
/**
|
|
4
|
-
* @typedef {Object} Props
|
|
5
|
-
* @property {string} [label]
|
|
6
|
-
* @property {number} value
|
|
7
|
-
* @property {boolean} [selected]
|
|
8
|
-
* @property {Function} [onclick]
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/** @type {Props} */
|
|
12
|
-
let { label = null, value, selected = false, onclick = noop } = $props()
|
|
13
|
-
let text = $derived(label ?? value.toFixed(0))
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
17
|
-
<rk-tick
|
|
18
|
-
class="grid cursor-pointer select-none grid-cols-2"
|
|
19
|
-
{onclick}
|
|
20
|
-
role="option"
|
|
21
|
-
aria-selected={selected}
|
|
22
|
-
tabindex="0"
|
|
23
|
-
>
|
|
24
|
-
<rk-tick-bar class="h-5px col-start-2 border-l"></rk-tick-bar>
|
|
25
|
-
<p class="col-span-2 flex justify-center">
|
|
26
|
-
{text}
|
|
27
|
-
</p>
|
|
28
|
-
</rk-tick>
|
package/src/Rating.svelte
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { createEmitter, defaultStateIcons } from '@rokkit/core'
|
|
3
|
-
import Icon from './Icon.svelte'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @typedef {Object} Props
|
|
7
|
-
* @property {any} [id]
|
|
8
|
-
* @property {any} [name]
|
|
9
|
-
* @property {number} [value]
|
|
10
|
-
* @property {number} [max]
|
|
11
|
-
* @property {boolean} [disabled]
|
|
12
|
-
* @property {any} [stateIcons]
|
|
13
|
-
* @property {string} [placeholder]
|
|
14
|
-
* @property {number} [tabindex]
|
|
15
|
-
* @event {CustomEvent} [onchange]
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/** @type {Props} */
|
|
19
|
-
let {
|
|
20
|
-
id = null,
|
|
21
|
-
name = null,
|
|
22
|
-
value = $bindable(0),
|
|
23
|
-
max = 5,
|
|
24
|
-
disabled = false,
|
|
25
|
-
stateIcons = defaultStateIcons.rating,
|
|
26
|
-
placeholder = 'Rating',
|
|
27
|
-
tabindex = 0,
|
|
28
|
-
...events
|
|
29
|
-
} = $props()
|
|
30
|
-
|
|
31
|
-
let emitter = $derived(createEmitter(events, ['change']))
|
|
32
|
-
function handleClick(index) {
|
|
33
|
-
if (!disabled) {
|
|
34
|
-
value = value === 1 && index === 0 ? index : index + 1
|
|
35
|
-
emitter.change({ value })
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function handleEnter(index) {
|
|
39
|
-
if (!disabled) {
|
|
40
|
-
hoverIndex = index
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function handleLeave() {
|
|
44
|
-
if (!disabled) {
|
|
45
|
-
hoverIndex = -1
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
function handleKeyDown(event) {
|
|
49
|
-
if (event.key === 'ArrowLeft' || event.key === 'ArrowDown') {
|
|
50
|
-
event.preventDefault()
|
|
51
|
-
value = Math.max(value - 1, 0)
|
|
52
|
-
} else if (event.key === 'ArrowRight' || event.key === 'ArrowUp') {
|
|
53
|
-
event.preventDefault()
|
|
54
|
-
value = Math.min(value + 1, max)
|
|
55
|
-
} else {
|
|
56
|
-
var number = parseInt(event.code.replace('Digit', ''), 10)
|
|
57
|
-
if (number >= 0 && number <= 9 && number <= max) {
|
|
58
|
-
event.preventDefault()
|
|
59
|
-
value = number
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
let hoverIndex = $state(-1)
|
|
65
|
-
let stars = $derived([...Array(max).keys()].map((i) => i < value))
|
|
66
|
-
</script>
|
|
67
|
-
|
|
68
|
-
<rk-rating
|
|
69
|
-
{id}
|
|
70
|
-
class="flex cursor-pointer select-none"
|
|
71
|
-
class:disabled
|
|
72
|
-
{tabindex}
|
|
73
|
-
role="radiogroup"
|
|
74
|
-
onkeydown={handleKeyDown}
|
|
75
|
-
>
|
|
76
|
-
{#if name}
|
|
77
|
-
<input {name} hidden type="number" bind:value min={0} {max} readOnly={disabled} />
|
|
78
|
-
{/if}
|
|
79
|
-
{#each stars as selected, index (index)}
|
|
80
|
-
{@const stateIcon = selected ? stateIcons.filled : stateIcons.empty}
|
|
81
|
-
{@const label = [placeholder, index + 1, 'out of', max].join(' ')}
|
|
82
|
-
<Icon
|
|
83
|
-
name={stateIcon}
|
|
84
|
-
{label}
|
|
85
|
-
role="option"
|
|
86
|
-
{disabled}
|
|
87
|
-
checked={index < value}
|
|
88
|
-
class={index <= hoverIndex ? 'hovering' : ''}
|
|
89
|
-
onmouseenter={() => handleEnter(index)}
|
|
90
|
-
onmouseleave={handleLeave}
|
|
91
|
-
onclick={() => handleClick(index)}
|
|
92
|
-
tabindex="-1"
|
|
93
|
-
/>
|
|
94
|
-
{/each}
|
|
95
|
-
</rk-rating>
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
// To Do add navigable
|
|
3
|
-
import { defaultMapping } from './constants'
|
|
4
|
-
import { swipeable } from '@rokkit/actions'
|
|
5
|
-
import { fly, fade } from 'svelte/transition'
|
|
6
|
-
import { cubicInOut } from 'svelte/easing'
|
|
7
|
-
import { equals } from 'ramda'
|
|
8
|
-
/**
|
|
9
|
-
* @typedef {Object} Props
|
|
10
|
-
* @property {string} [class]
|
|
11
|
-
* @property {any} items
|
|
12
|
-
* @property {import('@rokkit/core').FieldMapper} [mapping]
|
|
13
|
-
* @property {boolean} [small]
|
|
14
|
-
* @property {number} [duration]
|
|
15
|
-
* @property {any} [easing]
|
|
16
|
-
* @property {any} [value]
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/** @type {Props} */
|
|
20
|
-
let {
|
|
21
|
-
class: className = 'three-col',
|
|
22
|
-
items,
|
|
23
|
-
mapping = defaultMapping,
|
|
24
|
-
small = true,
|
|
25
|
-
duration = 400,
|
|
26
|
-
easing = cubicInOut,
|
|
27
|
-
value = $bindable(null)
|
|
28
|
-
} = $props()
|
|
29
|
-
|
|
30
|
-
let previous = $state(-1)
|
|
31
|
-
let activeIndex = $state(0)
|
|
32
|
-
let direction = $derived(Math.sign(activeIndex - previous))
|
|
33
|
-
let width = $state()
|
|
34
|
-
|
|
35
|
-
function handleNext() {
|
|
36
|
-
if (activeIndex < items.length - 1) value = items[activeIndex + 1]
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function handlePrevious() {
|
|
40
|
-
if (activeIndex > 0) value = items[activeIndex - 1]
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function activeIndexFromPage(value) {
|
|
44
|
-
const index = items.findIndex((item) => equals(item, value))
|
|
45
|
-
return index > -1 ? index : 0
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
$effect.pre(() => {
|
|
49
|
-
activeIndex = activeIndexFromPage(value)
|
|
50
|
-
// direction = Math.sign(activeIndex - previous)
|
|
51
|
-
previous = activeIndex
|
|
52
|
-
})
|
|
53
|
-
</script>
|
|
54
|
-
|
|
55
|
-
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
|
56
|
-
<rk-container
|
|
57
|
-
use:swipeable={{ enabled: small }}
|
|
58
|
-
onswipeLeft={handleNext}
|
|
59
|
-
onswipeRight={handlePrevious}
|
|
60
|
-
onprevious={handlePrevious}
|
|
61
|
-
onnext={handleNext}
|
|
62
|
-
tabindex={0}
|
|
63
|
-
class="overflow-hidden {className}"
|
|
64
|
-
bind:clientWidth={width}
|
|
65
|
-
>
|
|
66
|
-
{#each items as item, index (index)}
|
|
67
|
-
{@const segmentClass = 'col-' + (index + 1)}
|
|
68
|
-
{@const props = mapping.get('props', item, {})}
|
|
69
|
-
{@const Template = item[mapping.fields.component]}
|
|
70
|
-
{#if small && equals(index, activeIndex)}
|
|
71
|
-
<rk-segment
|
|
72
|
-
class="absolute h-full w-full {segmentClass}"
|
|
73
|
-
out:fade={{
|
|
74
|
-
x: -1 * direction * width,
|
|
75
|
-
duration,
|
|
76
|
-
easing
|
|
77
|
-
}}
|
|
78
|
-
in:fly={{ x: direction * width, duration, easing }}
|
|
79
|
-
>
|
|
80
|
-
<Template {...props} />
|
|
81
|
-
</rk-segment>
|
|
82
|
-
{:else if !small}
|
|
83
|
-
<rk-segment class={segmentClass}>
|
|
84
|
-
<Template {...props} />
|
|
85
|
-
</rk-segment>
|
|
86
|
-
{/if}
|
|
87
|
-
{/each}
|
|
88
|
-
</rk-container>
|
package/src/Scrollable.svelte
DELETED
package/src/Select.svelte
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { defaultFields, defaultStateIcons } from '@rokkit/core'
|
|
3
|
-
import Slider from './Slider.svelte'
|
|
4
|
-
import Icon from './Icon.svelte'
|
|
5
|
-
import { dismissable, navigable } from '@rokkit/actions'
|
|
6
|
-
|
|
7
|
-
import List from './List.svelte'
|
|
8
|
-
// import ListItems from './ListItems.svelte'
|
|
9
|
-
import Item from './Item.svelte'
|
|
10
|
-
|
|
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()
|
|
21
|
-
|
|
22
|
-
let activeIndex = $state(-1)
|
|
23
|
-
let open = $state(false)
|
|
24
|
-
// let offsetTop
|
|
25
|
-
let icons = defaultStateIcons.selector
|
|
26
|
-
let activeItem = $state(null)
|
|
27
|
-
|
|
28
|
-
function handleSelect() {
|
|
29
|
-
open = false
|
|
30
|
-
dispatch('select', value)
|
|
31
|
-
dispatch('change', value)
|
|
32
|
-
}
|
|
33
|
-
function handleNext() {
|
|
34
|
-
if (!open) {
|
|
35
|
-
open = true
|
|
36
|
-
} else if (activeIndex < options.length - 1) {
|
|
37
|
-
value = options[activeIndex + 1]
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function handlePrevious() {
|
|
41
|
-
if (!open) {
|
|
42
|
-
open = true
|
|
43
|
-
} else if (activeIndex > 0) {
|
|
44
|
-
value = options[activeIndex - 1]
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function handleKeySelect() {
|
|
48
|
-
if (open) {
|
|
49
|
-
if (value) {
|
|
50
|
-
handleSelect()
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
let offsetTop = $derived(activeItem?.offsetTop + activeItem?.clientHeight ?? 0)
|
|
56
|
-
</script>
|
|
57
|
-
|
|
58
|
-
<input-select
|
|
59
|
-
class="relative flex flex-col {className}"
|
|
60
|
-
class:open
|
|
61
|
-
tabindex="0"
|
|
62
|
-
role="listbox"
|
|
63
|
-
aria-label={name}
|
|
64
|
-
use:dismissable
|
|
65
|
-
use:navigable={{ horizontal: false, vertical: true }}
|
|
66
|
-
onfocus={() => (open = true)}
|
|
67
|
-
onblur={() => (open = false)}
|
|
68
|
-
ondismiss={() => (open = false)}
|
|
69
|
-
onprevious={handlePrevious}
|
|
70
|
-
onnext={handleNext}
|
|
71
|
-
onselect={handleKeySelect}
|
|
72
|
-
>
|
|
73
|
-
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
74
|
-
<selected-item
|
|
75
|
-
onclick={() => (open = !open)}
|
|
76
|
-
class="flex w-full items-center"
|
|
77
|
-
bind:this={activeItem}
|
|
78
|
-
role="option"
|
|
79
|
-
tabindex="-1"
|
|
80
|
-
aria-selected={value !== null && !open}
|
|
81
|
-
>
|
|
82
|
-
<item>
|
|
83
|
-
{#if currentItem}
|
|
84
|
-
{@render currentItem(value, fields)}
|
|
85
|
-
{/if}
|
|
86
|
-
<Item value={value ?? placeholder} {fields} />
|
|
87
|
-
</item>
|
|
88
|
-
{#if open}
|
|
89
|
-
<Icon name={icons.opened} label="opened" tabindex="-1" />
|
|
90
|
-
{:else}
|
|
91
|
-
<Icon name={icons.closed} label="closed" tabindex="-1" />
|
|
92
|
-
{/if}
|
|
93
|
-
</selected-item>
|
|
94
|
-
{#if open}
|
|
95
|
-
<Slider top={offsetTop}>
|
|
96
|
-
<!-- <list class="flex flex-col w-full flex-shrink-0 select-none" role="listbox" tabindex="-1">
|
|
97
|
-
<ListItems
|
|
98
|
-
items={options}
|
|
99
|
-
bind:value
|
|
100
|
-
{fields}
|
|
101
|
-
{using}
|
|
102
|
-
/>
|
|
103
|
-
</list> -->
|
|
104
|
-
<List
|
|
105
|
-
bind:items={options}
|
|
106
|
-
{fields}
|
|
107
|
-
{using}
|
|
108
|
-
bind:value
|
|
109
|
-
on:select={handleSelect}
|
|
110
|
-
tabindex="-1"
|
|
111
|
-
/>
|
|
112
|
-
</Slider>
|
|
113
|
-
{/if}
|
|
114
|
-
</input-select>
|
package/src/Separator.svelte
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<rk-separator class="flex flex-grow"></rk-separator>
|
package/src/Slider.svelte
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { slide, fade } from 'svelte/transition'
|
|
3
|
-
|
|
4
|
-
let { class: className = 'menu', top = 16, offset = -top, children } = $props()
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<scroll
|
|
8
|
-
in:slide={{ duration: 50, y: offset }}
|
|
9
|
-
out:fade={{ duration: 50 }}
|
|
10
|
-
style:top="{top}px"
|
|
11
|
-
class="absolute z-10 flex w-full flex-col overflow-scroll {className}"
|
|
12
|
-
>
|
|
13
|
-
{@render children?.()}
|
|
14
|
-
</scroll>
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { swipeable, navigable } from '@rokkit/actions'
|
|
3
|
-
import { fly, fade } from 'svelte/transition'
|
|
4
|
-
import { cubicInOut } from 'svelte/easing'
|
|
5
|
-
|
|
6
|
-
let { activeIndex = $bindable(0), columns = $bindable([]) } = $props()
|
|
7
|
-
let width = $state()
|
|
8
|
-
let offset = $state(1)
|
|
9
|
-
|
|
10
|
-
function handleNext() {
|
|
11
|
-
if (activeIndex < columns.length - 1) {
|
|
12
|
-
activeIndex = activeIndex + 1
|
|
13
|
-
offset = 1
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function handlePrevious() {
|
|
18
|
-
if (activeIndex > 0) {
|
|
19
|
-
activeIndex = activeIndex - 1
|
|
20
|
-
offset = -1
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
let activeColumn = $derived(columns[activeIndex])
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
|
28
|
-
<rk-container
|
|
29
|
-
use:swipeable
|
|
30
|
-
onswipeleft={handlePrevious}
|
|
31
|
-
onswiperight={handleNext}
|
|
32
|
-
use:navigable={{ orientation: 'horizontal' }}
|
|
33
|
-
onprevious={handlePrevious}
|
|
34
|
-
onnext={handleNext}
|
|
35
|
-
tabindex={0}
|
|
36
|
-
class="relative grid h-full w-full overflow-hidden"
|
|
37
|
-
bind:clientWidth={width}
|
|
38
|
-
>
|
|
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>
|
|
50
|
-
</rk-container>
|
package/src/Stage.svelte
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import Icon from './Icon.svelte'
|
|
3
|
-
|
|
4
|
-
export let text
|
|
5
|
-
export let completed
|
|
6
|
-
export let active
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
10
|
-
<div
|
|
11
|
-
class="circle stage h-16 w-16 cursor-pointer select-none"
|
|
12
|
-
class:completed
|
|
13
|
-
class:active
|
|
14
|
-
on:click
|
|
15
|
-
role="option"
|
|
16
|
-
aria-selected={active}
|
|
17
|
-
tabindex="0"
|
|
18
|
-
>
|
|
19
|
-
{#if completed}
|
|
20
|
-
<Icon name="tick" on:click />
|
|
21
|
-
{:else}
|
|
22
|
-
<p class="circle h-full w-full border-2">
|
|
23
|
-
{text}
|
|
24
|
-
</p>
|
|
25
|
-
{/if}
|
|
26
|
-
</div>
|
|
27
|
-
|
|
28
|
-
<style lang="postcss">
|
|
29
|
-
.circle {
|
|
30
|
-
@apply flex items-center justify-center rounded-full border-2;
|
|
31
|
-
}
|
|
32
|
-
.stage.completed {
|
|
33
|
-
@apply bg-primary-500 text-white;
|
|
34
|
-
}
|
|
35
|
-
.stage.active {
|
|
36
|
-
@apply border-primary-500 border;
|
|
37
|
-
}
|
|
38
|
-
.stage.active .circle {
|
|
39
|
-
@apply border-4 shadow;
|
|
40
|
-
}
|
|
41
|
-
</style>
|
package/src/Stepper.svelte
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
// import { format } from 'd3-format'
|
|
3
|
-
import { createEventDispatcher } from 'svelte'
|
|
4
|
-
|
|
5
|
-
import Stage from './Stage.svelte'
|
|
6
|
-
import Steps from './ProgressDots.svelte'
|
|
7
|
-
|
|
8
|
-
const dispatch = createEventDispatcher()
|
|
9
|
-
|
|
10
|
-
export let data
|
|
11
|
-
// export let currentStep
|
|
12
|
-
export let currentStage
|
|
13
|
-
|
|
14
|
-
// $: data = data.map((d) => ({
|
|
15
|
-
// completed: d.steps?.value === d.steps?.count,
|
|
16
|
-
// ...d
|
|
17
|
-
// }))
|
|
18
|
-
function handleClick(d) {
|
|
19
|
-
dispatch('click', { ...d, data: data[d.stage] })
|
|
20
|
-
}
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<div
|
|
24
|
-
class="stepper flex w-full flex-col items-center gap-3 rounded border p-8 shadow"
|
|
25
|
-
style:--count={data.length}
|
|
26
|
-
>
|
|
27
|
-
<row>
|
|
28
|
-
{#each data as { text, completed, active, steps }, stage (stage)}
|
|
29
|
-
<div class="flex flex-col items-center justify-center first:col-start-2">
|
|
30
|
-
<Stage {text} {completed} {active} on:click={() => handleClick({ stage })} />
|
|
31
|
-
</div>
|
|
32
|
-
{#if steps}
|
|
33
|
-
<div class="col-span-2 flex flex-col items-center justify-center">
|
|
34
|
-
<Steps
|
|
35
|
-
count={steps.count}
|
|
36
|
-
bind:value={steps.value}
|
|
37
|
-
bind:current={steps.current}
|
|
38
|
-
on:click={(e) => handleClick({ ...e.detail, stage })}
|
|
39
|
-
/>
|
|
40
|
-
</div>
|
|
41
|
-
{/if}
|
|
42
|
-
{/each}
|
|
43
|
-
</row>
|
|
44
|
-
<row>
|
|
45
|
-
{#each data as { label }, stage (stage)}
|
|
46
|
-
{#if label}
|
|
47
|
-
<p
|
|
48
|
-
class="text-surface-800 col-span-3 flex w-full justify-center text-center font-medium leading-loose"
|
|
49
|
-
class:pending={stage > currentStage}
|
|
50
|
-
>
|
|
51
|
-
{label}
|
|
52
|
-
</p>
|
|
53
|
-
{/if}
|
|
54
|
-
{/each}
|
|
55
|
-
</row>
|
|
56
|
-
</div>
|
|
57
|
-
|
|
58
|
-
<style lang="postcss">
|
|
59
|
-
.stepper row {
|
|
60
|
-
@apply grid w-full;
|
|
61
|
-
grid-template-columns: repeat(var(--count), 2fr 6fr 2fr);
|
|
62
|
-
}
|
|
63
|
-
.pending {
|
|
64
|
-
@apply text-surface-500 font-light;
|
|
65
|
-
}
|
|
66
|
-
</style>
|
package/src/Summary.svelte
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import Item from './Item.svelte'
|
|
3
|
-
/**
|
|
4
|
-
* @typedef {Object} Props
|
|
5
|
-
* @property {import('@rokkit/states').NodeProxy} value
|
|
6
|
-
* @property {Boolean} [expanded]
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/** @type {Props} */
|
|
10
|
-
let { value = $bindable(), fields, expanded = false, hasChildren = false } = $props()
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<rk-summary class="flex w-full flex-shrink-0 cursor-pointer flex-row items-center" tabindex="-1">
|
|
14
|
-
<Item bind:value {fields} />
|
|
15
|
-
{#if hasChildren}
|
|
16
|
-
{#if expanded}
|
|
17
|
-
<icon class="accordion-opened sm" aria-label="collapse"></icon>
|
|
18
|
-
{:else}
|
|
19
|
-
<icon class="accordion-closed sm" aria-label="expand"></icon>
|
|
20
|
-
{/if}
|
|
21
|
-
{/if}
|
|
22
|
-
</rk-summary>
|