wx-svelte-core 2.3.0 → 2.4.0
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 +4 -3
- package/readme.md +2 -2
- package/src/components/Checkbox.svelte +6 -4
- package/src/components/CheckboxGroup.svelte +3 -0
- package/src/components/ColorPicker.svelte +5 -3
- package/src/components/ColorSelect.svelte +5 -3
- package/src/components/Combo.svelte +6 -3
- package/src/components/Counter.svelte +5 -3
- package/src/components/DatePicker.svelte +2 -2
- package/src/components/DateRangePicker.svelte +2 -2
- package/src/components/Field.svelte +22 -8
- package/src/components/Fullscreen.svelte +82 -0
- package/src/components/MultiCombo.svelte +5 -3
- package/src/components/Popup.svelte +5 -4
- package/src/components/RadioButton.svelte +6 -4
- package/src/components/RadioButtonGroup.svelte +2 -0
- package/src/components/Select.svelte +5 -3
- package/src/components/Slider.svelte +5 -3
- package/src/components/Switch.svelte +5 -8
- package/src/components/Text.svelte +7 -5
- package/src/components/TextArea.svelte +5 -3
- package/src/components/TimePicker.svelte +6 -3
- package/src/components/helpers/getInputId.js +7 -0
- package/src/index.js +1 -0
- package/types/index.d.ts +446 -0
- package/whatsnew.md +27 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wx-svelte-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "SVAR Svelte Core - Svelte UI library of 20+ components and form controls",
|
|
5
5
|
"productTag": "core",
|
|
6
6
|
"productTrial": false,
|
|
@@ -33,12 +33,13 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://svar.dev/svelte/core/",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@svar-ui/core-locales": "2.
|
|
37
|
-
"@svar-ui/lib-dom": "0.
|
|
36
|
+
"@svar-ui/core-locales": "2.4.0",
|
|
37
|
+
"@svar-ui/lib-dom": "0.11.1",
|
|
38
38
|
"@svar-ui/lib-svelte": "0.5.2"
|
|
39
39
|
},
|
|
40
40
|
"files": [
|
|
41
41
|
"src",
|
|
42
|
+
"types",
|
|
42
43
|
"readme.md",
|
|
43
44
|
"whatsnew.md",
|
|
44
45
|
"license.txt"
|
package/readme.md
CHANGED
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
|
|
19
19
|
</div>
|
|
20
20
|
|
|
21
|
-
[SVAR Core library](https://svar.dev/svelte/core/) offers a set of 20+ ready-made Svelte UI components: form controls, popups, date and time picker,
|
|
21
|
+
[SVAR Svelte Core library](https://svar.dev/svelte/core/) offers a set of 20+ ready-made Svelte UI components: form controls, popups, date and time picker, selects, notifications, and more. All components are lightweight, responsive, fast-performing, and support TypeScript. The library comes in beautifully designed light and dark themes that are easy to customize.
|
|
22
22
|
|
|
23
23
|
<img src="https://svar.dev/images/github/github-core.png" alt="SVAR Core - Svelte UI Components Library" style="width: 752px;">
|
|
24
24
|
|
|
25
|
-
SVAR Core library includes the following components:
|
|
25
|
+
SVAR Svelte Core library includes the following components:
|
|
26
26
|
|
|
27
27
|
- buttons & form controls,
|
|
28
28
|
- calendar (datepicker),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
2
|
+
import { getInputId } from "./helpers/getInputId";
|
|
3
3
|
|
|
4
4
|
let {
|
|
5
|
-
id
|
|
5
|
+
id,
|
|
6
6
|
label = "",
|
|
7
7
|
inputValue = "",
|
|
8
8
|
value = $bindable(false),
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
onchange,
|
|
12
12
|
} = $props();
|
|
13
13
|
|
|
14
|
+
const inputId = $state(getInputId(id));
|
|
15
|
+
|
|
14
16
|
function handlerChange({ target }) {
|
|
15
17
|
value = target.checked;
|
|
16
18
|
onchange && onchange({ value, inputValue });
|
|
@@ -20,13 +22,13 @@
|
|
|
20
22
|
<div {style} class="wx-checkbox">
|
|
21
23
|
<input
|
|
22
24
|
type="checkbox"
|
|
23
|
-
{
|
|
25
|
+
id={inputId}
|
|
24
26
|
{disabled}
|
|
25
27
|
checked={value}
|
|
26
28
|
value={inputValue}
|
|
27
29
|
onchange={handlerChange}
|
|
28
30
|
/>
|
|
29
|
-
<label for={
|
|
31
|
+
<label for={inputId}>
|
|
30
32
|
<span></span>
|
|
31
33
|
{#if label}<span>{label}</span>{/if}
|
|
32
34
|
</label>
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import Checkbox from "./Checkbox.svelte";
|
|
3
|
+
import { setContext } from "svelte";
|
|
3
4
|
|
|
4
5
|
let { options = [], value = $bindable([]), type = "", onchange } = $props();
|
|
5
6
|
|
|
7
|
+
setContext("wx-input-id", null);
|
|
8
|
+
|
|
6
9
|
function handleChange(obj) {
|
|
7
10
|
if (obj.value) value = [...value, obj.inputValue];
|
|
8
11
|
else value = value.filter(a => a != obj.inputValue);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { uid } from "@svar-ui/lib-dom";
|
|
3
2
|
import Dropdown from "./Dropdown.svelte";
|
|
4
3
|
import ColorBoard from "./ColorBoard.svelte";
|
|
4
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
5
5
|
|
|
6
6
|
let {
|
|
7
7
|
value = $bindable(""),
|
|
8
|
-
id
|
|
8
|
+
id,
|
|
9
9
|
placeholder = "",
|
|
10
10
|
title = "",
|
|
11
11
|
disabled = false,
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
onchange,
|
|
15
15
|
} = $props();
|
|
16
16
|
|
|
17
|
+
const inputId = $state(getInputId(id));
|
|
18
|
+
|
|
17
19
|
let popup = $state(false);
|
|
18
20
|
|
|
19
21
|
function handlePopup() {
|
|
@@ -43,7 +45,7 @@
|
|
|
43
45
|
{title}
|
|
44
46
|
{value}
|
|
45
47
|
readonly
|
|
46
|
-
{
|
|
48
|
+
id={inputId}
|
|
47
49
|
{placeholder}
|
|
48
50
|
{disabled}
|
|
49
51
|
class:wx-error={error}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { uid } from "@svar-ui/lib-dom";
|
|
3
2
|
import Dropdown from "./Dropdown.svelte";
|
|
3
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
4
4
|
|
|
5
5
|
const defaultColors = [
|
|
6
6
|
"#00a037",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
let {
|
|
16
16
|
colors = defaultColors,
|
|
17
17
|
value = $bindable(""),
|
|
18
|
-
id
|
|
18
|
+
id,
|
|
19
19
|
clear = false,
|
|
20
20
|
placeholder = "",
|
|
21
21
|
title = "",
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
onchange,
|
|
25
25
|
} = $props();
|
|
26
26
|
|
|
27
|
+
const inputId = $state(getInputId(id));
|
|
28
|
+
|
|
27
29
|
let popup = $state(false);
|
|
28
30
|
|
|
29
31
|
function selectColor(ev, color) {
|
|
@@ -50,7 +52,7 @@
|
|
|
50
52
|
{title}
|
|
51
53
|
{value}
|
|
52
54
|
readonly
|
|
53
|
-
{
|
|
55
|
+
id={inputId}
|
|
54
56
|
{placeholder}
|
|
55
57
|
{disabled}
|
|
56
58
|
class:wx-error={error}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import List from "./helpers/SuggestDropdown.svelte";
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
4
5
|
|
|
5
6
|
let {
|
|
6
7
|
value = $bindable(""),
|
|
7
|
-
id
|
|
8
|
+
id,
|
|
8
9
|
options = [],
|
|
9
10
|
textOptions = null,
|
|
10
11
|
textField = "label",
|
|
@@ -17,6 +18,8 @@
|
|
|
17
18
|
onchange,
|
|
18
19
|
} = $props();
|
|
19
20
|
|
|
21
|
+
const inputId = $state(getInputId(id));
|
|
22
|
+
|
|
20
23
|
let filterActive = $state(false);
|
|
21
24
|
let textInput = $state("");
|
|
22
25
|
|
|
@@ -115,7 +118,7 @@
|
|
|
115
118
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
116
119
|
<div class="wx-combo" {onclick} {onkeydown} {title}>
|
|
117
120
|
<input
|
|
118
|
-
{
|
|
121
|
+
id={inputId}
|
|
119
122
|
bind:this={inputElement}
|
|
120
123
|
value={text}
|
|
121
124
|
class:wx-error={error}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
2
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
3
3
|
|
|
4
4
|
let {
|
|
5
|
-
id
|
|
5
|
+
id,
|
|
6
6
|
value = $bindable(0),
|
|
7
7
|
step = 1,
|
|
8
8
|
min = 0,
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
onchange,
|
|
14
14
|
} = $props();
|
|
15
15
|
|
|
16
|
+
const inputId = $state(getInputId(id));
|
|
17
|
+
|
|
16
18
|
function dec() {
|
|
17
19
|
if (readonly || value <= min) return;
|
|
18
20
|
value -= step;
|
|
@@ -58,7 +60,7 @@
|
|
|
58
60
|
</svg>
|
|
59
61
|
</button>
|
|
60
62
|
<input
|
|
61
|
-
{
|
|
63
|
+
id={inputId}
|
|
62
64
|
type="text"
|
|
63
65
|
class="wx-input"
|
|
64
66
|
{disabled}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { getContext } from "svelte";
|
|
3
|
-
import {
|
|
3
|
+
import { dateToString } from "@svar-ui/lib-dom";
|
|
4
4
|
|
|
5
5
|
import Text from "./Text.svelte";
|
|
6
6
|
import Dropdown from "./Dropdown.svelte";
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
let {
|
|
11
11
|
value = $bindable(),
|
|
12
|
-
id
|
|
12
|
+
id,
|
|
13
13
|
disabled = false,
|
|
14
14
|
error = false,
|
|
15
15
|
width = "unset",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { getContext } from "svelte";
|
|
3
|
-
import {
|
|
3
|
+
import { dateToString } from "@svar-ui/lib-dom";
|
|
4
4
|
|
|
5
5
|
import Text from "./Text.svelte";
|
|
6
6
|
import Dropdown from "./Dropdown.svelte";
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
let {
|
|
11
11
|
value = $bindable(),
|
|
12
|
-
id
|
|
12
|
+
id,
|
|
13
13
|
disabled = false,
|
|
14
14
|
error = false,
|
|
15
15
|
width = "unset",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { uid } from "@svar-ui/lib-dom";
|
|
3
|
-
|
|
3
|
+
import { setContext } from "svelte";
|
|
4
4
|
let {
|
|
5
5
|
label = "",
|
|
6
6
|
position = "",
|
|
@@ -11,7 +11,15 @@
|
|
|
11
11
|
children,
|
|
12
12
|
} = $props();
|
|
13
13
|
|
|
14
|
-
let
|
|
14
|
+
let firstInputId = $state(null);
|
|
15
|
+
|
|
16
|
+
const registerInput = () => {
|
|
17
|
+
const id = uid();
|
|
18
|
+
if (!firstInputId) firstInputId = id;
|
|
19
|
+
return id;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
setContext("wx-input-id", registerInput);
|
|
15
23
|
</script>
|
|
16
24
|
|
|
17
25
|
<div
|
|
@@ -20,9 +28,15 @@
|
|
|
20
28
|
class:wx-required={required}
|
|
21
29
|
style={width ? `width: ${width}` : ""}
|
|
22
30
|
>
|
|
23
|
-
{#if label}
|
|
31
|
+
{#if label}
|
|
32
|
+
{#if firstInputId}
|
|
33
|
+
<label class="wx-label" for={firstInputId}>{label}</label>
|
|
34
|
+
{:else}
|
|
35
|
+
<div class="wx-label">{label}</div>
|
|
36
|
+
{/if}
|
|
37
|
+
{/if}
|
|
24
38
|
<div class="wx-field-control wx-{type}">
|
|
25
|
-
{@render children?.(
|
|
39
|
+
{@render children?.()}
|
|
26
40
|
</div>
|
|
27
41
|
</div>
|
|
28
42
|
|
|
@@ -37,7 +51,7 @@
|
|
|
37
51
|
flex-wrap: nowrap;
|
|
38
52
|
align-items: flex-start;
|
|
39
53
|
}
|
|
40
|
-
.wx-field.wx-left > label {
|
|
54
|
+
.wx-field.wx-left > .wx-label {
|
|
41
55
|
width: var(--wx-label-width);
|
|
42
56
|
flex-shrink: 0;
|
|
43
57
|
margin: 0 var(--wx-field-gutter) 0 0;
|
|
@@ -49,7 +63,7 @@
|
|
|
49
63
|
.wx-field.wx-left > .wx-field-control {
|
|
50
64
|
max-width: calc(100% - var(--wx-label-width) - var(--wx-field-gutter));
|
|
51
65
|
}
|
|
52
|
-
.wx-field.wx-error label {
|
|
66
|
+
.wx-field.wx-error .wx-label {
|
|
53
67
|
color: var(--wx-color-danger);
|
|
54
68
|
}
|
|
55
69
|
|
|
@@ -78,7 +92,7 @@
|
|
|
78
92
|
);
|
|
79
93
|
}
|
|
80
94
|
|
|
81
|
-
label {
|
|
95
|
+
.wx-label {
|
|
82
96
|
display: block;
|
|
83
97
|
margin: var(--wx-label-margin);
|
|
84
98
|
padding: var(--wx-label-padding);
|
|
@@ -89,7 +103,7 @@
|
|
|
89
103
|
color: var(--wx-label-font-color);
|
|
90
104
|
}
|
|
91
105
|
|
|
92
|
-
.wx-required label::after {
|
|
106
|
+
.wx-required .wx-label::after {
|
|
93
107
|
content: " *";
|
|
94
108
|
color: var(--wx-color-danger);
|
|
95
109
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { hotkeys } from "@svar-ui/lib-dom";
|
|
3
|
+
import Button from "./Button.svelte";
|
|
4
|
+
|
|
5
|
+
let { hotkey = null, toggleButton, children } = $props();
|
|
6
|
+
|
|
7
|
+
$effect(() => {
|
|
8
|
+
if (hotkey)
|
|
9
|
+
$hotkeys.configure(
|
|
10
|
+
{
|
|
11
|
+
[hotkey]: toggleFullscreen,
|
|
12
|
+
},
|
|
13
|
+
node
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
let node = null;
|
|
18
|
+
let inFullscreen = $state(false);
|
|
19
|
+
let icon = $derived(`wxi-${inFullscreen ? "collapse" : "expand"}`);
|
|
20
|
+
|
|
21
|
+
function toggleFullscreen() {
|
|
22
|
+
if (!inFullscreen && node) {
|
|
23
|
+
node.requestFullscreen();
|
|
24
|
+
} else if (inFullscreen) {
|
|
25
|
+
document.exitFullscreen();
|
|
26
|
+
}
|
|
27
|
+
inFullscreen = !inFullscreen;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const setFullscreenState = () => {
|
|
31
|
+
inFullscreen = document.fullscreenElement === node;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
$effect(() => {
|
|
35
|
+
document.addEventListener("fullscreenchange", setFullscreenState);
|
|
36
|
+
return () => {
|
|
37
|
+
document.removeEventListener(
|
|
38
|
+
"fullscreenchange",
|
|
39
|
+
setFullscreenState
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<div class="wx-fullscreen" bind:this={node} tabindex="-1">
|
|
46
|
+
{@render children?.()}
|
|
47
|
+
{#if toggleButton}
|
|
48
|
+
{@render toggleButton(toggleFullscreen, inFullscreen)}
|
|
49
|
+
{:else}
|
|
50
|
+
<Button css="wx-fullscreen-button" onclick={toggleFullscreen}>
|
|
51
|
+
<i class={`${icon} wx-fullscreen-icon`}> </i>
|
|
52
|
+
</Button>
|
|
53
|
+
{/if}
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<style>
|
|
57
|
+
.wx-fullscreen::backdrop {
|
|
58
|
+
background-color: var(--wx-background);
|
|
59
|
+
}
|
|
60
|
+
.wx-fullscreen {
|
|
61
|
+
position: relative;
|
|
62
|
+
height: 100%;
|
|
63
|
+
width: 100%;
|
|
64
|
+
outline: none;
|
|
65
|
+
}
|
|
66
|
+
.wx-fullscreen-icon {
|
|
67
|
+
font-size: 20px;
|
|
68
|
+
height: 20px;
|
|
69
|
+
margin: auto;
|
|
70
|
+
}
|
|
71
|
+
.wx-fullscreen :global(.wx-fullscreen-button) {
|
|
72
|
+
width: 40px;
|
|
73
|
+
height: 40px;
|
|
74
|
+
border: none;
|
|
75
|
+
border-radius: 50%;
|
|
76
|
+
position: absolute;
|
|
77
|
+
right: 25px;
|
|
78
|
+
bottom: 35px;
|
|
79
|
+
display: flex;
|
|
80
|
+
padding: initial;
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { uid } from "@svar-ui/lib-dom";
|
|
3
2
|
import List from "./helpers/SuggestDropdown.svelte";
|
|
4
3
|
import Checkbox from "./Checkbox.svelte";
|
|
4
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
5
5
|
|
|
6
6
|
let {
|
|
7
|
-
id
|
|
7
|
+
id,
|
|
8
8
|
value = $bindable([]),
|
|
9
9
|
options = [],
|
|
10
10
|
textOptions = null,
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
children,
|
|
19
19
|
} = $props();
|
|
20
20
|
|
|
21
|
+
const inputId = $state(getInputId(id));
|
|
22
|
+
|
|
21
23
|
let text = $state("");
|
|
22
24
|
let selected = $derived(
|
|
23
25
|
value ? (textOptions || options).filter(i => value.includes(i.id)) : []
|
|
@@ -117,7 +119,7 @@
|
|
|
117
119
|
</div>
|
|
118
120
|
<div class="wx-select">
|
|
119
121
|
<input
|
|
120
|
-
{
|
|
122
|
+
id={inputId}
|
|
121
123
|
type="text"
|
|
122
124
|
bind:this={inputElement}
|
|
123
125
|
bind:value={text}
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
at = "bottom",
|
|
9
9
|
parent = null,
|
|
10
10
|
oncancel,
|
|
11
|
-
mount,
|
|
12
11
|
children,
|
|
13
12
|
} = $props();
|
|
14
13
|
|
|
@@ -28,8 +27,10 @@
|
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
onMount(() => {
|
|
31
|
+
updatePosition();
|
|
32
|
+
requestAnimationFrame(updatePosition);
|
|
33
|
+
});
|
|
33
34
|
$effect(() => {
|
|
34
35
|
updatePosition(parent);
|
|
35
36
|
});
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
use:clickOutside={down}
|
|
44
45
|
bind:this={self}
|
|
45
46
|
class="wx-popup"
|
|
46
|
-
style="position:
|
|
47
|
+
style="position:absolute;top:{y}px;left:{x}px;width:{width};"
|
|
47
48
|
>
|
|
48
49
|
{@render children?.()}
|
|
49
50
|
</div>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
2
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
3
3
|
|
|
4
4
|
let {
|
|
5
|
-
id
|
|
5
|
+
id,
|
|
6
6
|
label = "",
|
|
7
7
|
value = $bindable(""),
|
|
8
8
|
name = "",
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
onchange,
|
|
12
12
|
} = $props();
|
|
13
13
|
|
|
14
|
+
const inputId = $state(getInputId(id));
|
|
15
|
+
|
|
14
16
|
function handlerChange(ev) {
|
|
15
17
|
value = ev.target.checked;
|
|
16
18
|
if (value) onchange && onchange({ value: true, inputValue });
|
|
@@ -20,14 +22,14 @@
|
|
|
20
22
|
<div class="wx-radio">
|
|
21
23
|
<input
|
|
22
24
|
type="radio"
|
|
23
|
-
{
|
|
25
|
+
id={inputId}
|
|
24
26
|
{disabled}
|
|
25
27
|
{name}
|
|
26
28
|
value={inputValue}
|
|
27
29
|
checked={value}
|
|
28
30
|
onchange={handlerChange}
|
|
29
31
|
/>
|
|
30
|
-
<label for={
|
|
32
|
+
<label for={inputId}>
|
|
31
33
|
<span></span>
|
|
32
34
|
{#if label}<span>{label}</span>{/if}
|
|
33
35
|
</label>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { uid } from "@svar-ui/lib-dom";
|
|
3
3
|
import RadioButton from "./RadioButton.svelte";
|
|
4
|
+
import { setContext } from "svelte";
|
|
4
5
|
|
|
5
6
|
let {
|
|
6
7
|
options = [{}],
|
|
@@ -9,6 +10,7 @@
|
|
|
9
10
|
onchange,
|
|
10
11
|
} = $props();
|
|
11
12
|
|
|
13
|
+
setContext("wx-input-id", null);
|
|
12
14
|
const name = uid();
|
|
13
15
|
|
|
14
16
|
function handleChange(ev) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
2
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
3
3
|
|
|
4
4
|
let {
|
|
5
5
|
value = $bindable(""),
|
|
@@ -10,10 +10,12 @@
|
|
|
10
10
|
error = false,
|
|
11
11
|
textField = "label",
|
|
12
12
|
clear = false,
|
|
13
|
-
id
|
|
13
|
+
id,
|
|
14
14
|
onchange,
|
|
15
15
|
} = $props();
|
|
16
16
|
|
|
17
|
+
const inputId = $state(getInputId(id));
|
|
18
|
+
|
|
17
19
|
function unselect() {
|
|
18
20
|
value = "";
|
|
19
21
|
onchange && onchange({ value });
|
|
@@ -26,7 +28,7 @@
|
|
|
26
28
|
|
|
27
29
|
<div class="wx-select">
|
|
28
30
|
<select
|
|
29
|
-
{
|
|
31
|
+
id={inputId}
|
|
30
32
|
bind:value
|
|
31
33
|
{disabled}
|
|
32
34
|
class:wx-error={error}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
2
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
3
3
|
|
|
4
4
|
let {
|
|
5
|
-
id
|
|
5
|
+
id,
|
|
6
6
|
label = "",
|
|
7
7
|
width = "",
|
|
8
8
|
min = 0,
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
onchange,
|
|
15
15
|
} = $props();
|
|
16
16
|
|
|
17
|
+
const inputId = $state(getInputId(id));
|
|
18
|
+
|
|
17
19
|
let bgStyle = $derived(() => {
|
|
18
20
|
return disabled
|
|
19
21
|
? ""
|
|
@@ -40,7 +42,7 @@
|
|
|
40
42
|
{#if label}<label for={id}>{label}</label>{/if}
|
|
41
43
|
<div>
|
|
42
44
|
<input
|
|
43
|
-
{
|
|
45
|
+
id={inputId}
|
|
44
46
|
type="range"
|
|
45
47
|
{min}
|
|
46
48
|
{max}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
2
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
3
3
|
|
|
4
|
-
let {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
disabled = false,
|
|
8
|
-
onchange,
|
|
9
|
-
} = $props();
|
|
4
|
+
let { id, value = $bindable(false), disabled = false, onchange } = $props();
|
|
5
|
+
|
|
6
|
+
const inputId = $state(getInputId(id));
|
|
10
7
|
|
|
11
8
|
function onChange(event) {
|
|
12
9
|
value = event.target.checked;
|
|
@@ -20,7 +17,7 @@
|
|
|
20
17
|
checked={value}
|
|
21
18
|
onchange={onChange}
|
|
22
19
|
{disabled}
|
|
23
|
-
{
|
|
20
|
+
id={inputId}
|
|
24
21
|
/>
|
|
25
22
|
<span></span>
|
|
26
23
|
</label>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { uid } from "@svar-ui/lib-dom";
|
|
3
2
|
import { onMount } from "svelte";
|
|
3
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
4
4
|
|
|
5
5
|
let {
|
|
6
6
|
value = $bindable(""),
|
|
7
|
-
id
|
|
7
|
+
id,
|
|
8
8
|
readonly = false,
|
|
9
9
|
focus = false,
|
|
10
10
|
select = false,
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
onchange,
|
|
21
21
|
} = $props();
|
|
22
22
|
|
|
23
|
+
const inputId = $state(getInputId(id));
|
|
24
|
+
|
|
23
25
|
let cssString = $derived(
|
|
24
26
|
icon && css.indexOf("wx-icon-left") === -1
|
|
25
27
|
? "wx-icon-right " + css
|
|
@@ -57,7 +59,7 @@
|
|
|
57
59
|
<input
|
|
58
60
|
bind:value
|
|
59
61
|
bind:this={input}
|
|
60
|
-
{
|
|
62
|
+
id={inputId}
|
|
61
63
|
{readonly}
|
|
62
64
|
{disabled}
|
|
63
65
|
{placeholder}
|
|
@@ -71,7 +73,7 @@
|
|
|
71
73
|
<input
|
|
72
74
|
bind:value
|
|
73
75
|
bind:this={input}
|
|
74
|
-
{
|
|
76
|
+
id={inputId}
|
|
75
77
|
{readonly}
|
|
76
78
|
{disabled}
|
|
77
79
|
{placeholder}
|
|
@@ -85,7 +87,7 @@
|
|
|
85
87
|
<input
|
|
86
88
|
bind:value
|
|
87
89
|
bind:this={input}
|
|
88
|
-
{
|
|
90
|
+
id={inputId}
|
|
89
91
|
{readonly}
|
|
90
92
|
{disabled}
|
|
91
93
|
{placeholder}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
2
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
3
3
|
|
|
4
4
|
let {
|
|
5
5
|
value = $bindable(""),
|
|
6
|
-
id
|
|
6
|
+
id,
|
|
7
7
|
placeholder = "",
|
|
8
8
|
title = "",
|
|
9
9
|
disabled = false,
|
|
@@ -11,13 +11,15 @@
|
|
|
11
11
|
readonly = false,
|
|
12
12
|
onchange,
|
|
13
13
|
} = $props();
|
|
14
|
+
|
|
15
|
+
const inputId = $state(getInputId(id));
|
|
14
16
|
</script>
|
|
15
17
|
|
|
16
18
|
<textarea
|
|
17
19
|
class="wx-textarea"
|
|
18
20
|
class:wx-error={error}
|
|
19
21
|
bind:value
|
|
20
|
-
{
|
|
22
|
+
id={inputId}
|
|
21
23
|
{disabled}
|
|
22
24
|
{placeholder}
|
|
23
25
|
{readonly}
|
|
@@ -6,14 +6,15 @@
|
|
|
6
6
|
import TwoState from "./TwoState.svelte";
|
|
7
7
|
|
|
8
8
|
import { getContext } from "svelte";
|
|
9
|
-
import { dateToString
|
|
9
|
+
import { dateToString } from "@svar-ui/lib-dom";
|
|
10
10
|
import { defaultLocale } from "./helpers/locale";
|
|
11
|
+
import { getInputId } from "./helpers/getInputId.js";
|
|
11
12
|
|
|
12
13
|
const defValue = new Date(0, 0, 0, 0, 0);
|
|
13
14
|
|
|
14
15
|
let {
|
|
15
16
|
value = $bindable(defValue),
|
|
16
|
-
id
|
|
17
|
+
id,
|
|
17
18
|
title = "",
|
|
18
19
|
css = "",
|
|
19
20
|
disabled = false,
|
|
@@ -22,6 +23,8 @@
|
|
|
22
23
|
onchange,
|
|
23
24
|
} = $props();
|
|
24
25
|
|
|
26
|
+
const inputId = $state(getInputId(id));
|
|
27
|
+
|
|
25
28
|
const { calendar: calendarLocale, formats } = (
|
|
26
29
|
getContext("wx-i18n") || defaultLocale()
|
|
27
30
|
).getRaw();
|
|
@@ -123,7 +126,7 @@
|
|
|
123
126
|
onclick={click}
|
|
124
127
|
>
|
|
125
128
|
<Text
|
|
126
|
-
{
|
|
129
|
+
id={inputId}
|
|
127
130
|
{css}
|
|
128
131
|
{title}
|
|
129
132
|
value={textValue}
|
package/src/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export { default as ColorPicker } from "./components/ColorPicker.svelte";
|
|
|
8
8
|
export { default as Combo } from "./components/Combo.svelte";
|
|
9
9
|
export { default as DatePicker } from "./components/DatePicker.svelte";
|
|
10
10
|
export { default as DateRangePicker } from "./components/DateRangePicker.svelte";
|
|
11
|
+
export { default as Fullscreen } from "./components/Fullscreen.svelte";
|
|
11
12
|
export { default as Icon } from "./components/Icon.svelte";
|
|
12
13
|
export { default as MultiCombo } from "./components/MultiCombo.svelte";
|
|
13
14
|
export { default as Popup } from "./components/Popup.svelte";
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import { TPosition } from "@svar-ui/lib-dom";
|
|
2
|
+
import type { Component } from "svelte";
|
|
3
|
+
import type { Snippet } from "svelte";
|
|
4
|
+
|
|
5
|
+
export declare const TextArea: Component<{
|
|
6
|
+
value?: string;
|
|
7
|
+
id?: string | number;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
error?: boolean;
|
|
12
|
+
readonly?: boolean;
|
|
13
|
+
onchange?: (ev: { value: string; input?: boolean }) => void;
|
|
14
|
+
}>;
|
|
15
|
+
|
|
16
|
+
export declare const Button: Component<{
|
|
17
|
+
type?:
|
|
18
|
+
| "primary"
|
|
19
|
+
| "secondary"
|
|
20
|
+
| "danger"
|
|
21
|
+
| "link"
|
|
22
|
+
| "primary block"
|
|
23
|
+
| "secondary block"
|
|
24
|
+
| "danger block"
|
|
25
|
+
| "link block";
|
|
26
|
+
css?: string;
|
|
27
|
+
icon?: string;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
title?: string;
|
|
30
|
+
text?: string;
|
|
31
|
+
children?: () => any;
|
|
32
|
+
onclick?: (ev: MouseEvent) => void;
|
|
33
|
+
}>;
|
|
34
|
+
|
|
35
|
+
export declare const Checkbox: Component<{
|
|
36
|
+
id?: string | number;
|
|
37
|
+
label?: string;
|
|
38
|
+
inputValue?: string | number;
|
|
39
|
+
value?: boolean;
|
|
40
|
+
style?: string;
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
onchange?: (ev: { value: boolean; inputValue: string | number }) => void;
|
|
43
|
+
}>;
|
|
44
|
+
|
|
45
|
+
export declare const CheckboxGroup: Component<{
|
|
46
|
+
options?: { id: string | number; label: string }[];
|
|
47
|
+
value?: (string | number)[];
|
|
48
|
+
type?: "inline" | "grid";
|
|
49
|
+
onchange?: (ev: { value: (string | number)[] }) => void;
|
|
50
|
+
}>;
|
|
51
|
+
|
|
52
|
+
export declare const ColorSelect: Component<{
|
|
53
|
+
colors?: string[];
|
|
54
|
+
value?: string;
|
|
55
|
+
id?: string | number;
|
|
56
|
+
clear?: boolean;
|
|
57
|
+
placeholder?: string;
|
|
58
|
+
title?: string;
|
|
59
|
+
disabled?: boolean;
|
|
60
|
+
error?: boolean;
|
|
61
|
+
onchange?: (ev: { value: string }) => void;
|
|
62
|
+
}>;
|
|
63
|
+
|
|
64
|
+
export declare const ColorBoard: Component<{
|
|
65
|
+
value?: string;
|
|
66
|
+
button?: boolean;
|
|
67
|
+
onchange?: (ev: { value: string; input?: boolean }) => void;
|
|
68
|
+
}>;
|
|
69
|
+
|
|
70
|
+
export declare const ColorPicker: Component<{
|
|
71
|
+
value?: string;
|
|
72
|
+
id?: string | number;
|
|
73
|
+
placeholder?: string;
|
|
74
|
+
title?: string;
|
|
75
|
+
disabled?: boolean;
|
|
76
|
+
error?: boolean;
|
|
77
|
+
clear?: boolean;
|
|
78
|
+
onchange?: (ev: { value: string }) => void;
|
|
79
|
+
}>;
|
|
80
|
+
|
|
81
|
+
export declare const Combo: Component<{
|
|
82
|
+
value?: string | number;
|
|
83
|
+
id?: string | number;
|
|
84
|
+
options?: { id: string | number; label: string }[];
|
|
85
|
+
textOptions?: { id: string | number; label: string }[];
|
|
86
|
+
textField?: string;
|
|
87
|
+
placeholder?: string;
|
|
88
|
+
title?: string;
|
|
89
|
+
disabled?: boolean;
|
|
90
|
+
error?: boolean;
|
|
91
|
+
clear?: boolean;
|
|
92
|
+
children?: () => any;
|
|
93
|
+
onchange?: (ev: { value: string | number }) => void;
|
|
94
|
+
}>;
|
|
95
|
+
|
|
96
|
+
export declare const DatePicker: Component<{
|
|
97
|
+
value?: Date;
|
|
98
|
+
id?: string | number;
|
|
99
|
+
disabled?: boolean;
|
|
100
|
+
error?: boolean;
|
|
101
|
+
width?: string;
|
|
102
|
+
align?: "start" | "center" | "end";
|
|
103
|
+
placeholder?: string;
|
|
104
|
+
format?: string | ((value: Date) => string);
|
|
105
|
+
buttons?: boolean | ("clear" | "today")[];
|
|
106
|
+
css?: string;
|
|
107
|
+
title?: string;
|
|
108
|
+
editable?: boolean | ((value: string) => Date | null);
|
|
109
|
+
clear?: boolean;
|
|
110
|
+
onchange?: (ev: { value: Date | null }) => void;
|
|
111
|
+
}>;
|
|
112
|
+
|
|
113
|
+
export declare const DateRangePicker: Component<{
|
|
114
|
+
value?: { start: Date; end?: Date };
|
|
115
|
+
id?: string | number;
|
|
116
|
+
disabled?: boolean;
|
|
117
|
+
error?: boolean;
|
|
118
|
+
width?: string;
|
|
119
|
+
align?: "start" | "center" | "end";
|
|
120
|
+
placeholder?: string;
|
|
121
|
+
css?: string;
|
|
122
|
+
title?: string;
|
|
123
|
+
format?: string | ((date: Date) => string);
|
|
124
|
+
months?: 1 | 2;
|
|
125
|
+
buttons?: boolean | ("clear" | "today" | "done")[];
|
|
126
|
+
editable?: boolean | ((value: string) => Date | null);
|
|
127
|
+
clear?: boolean;
|
|
128
|
+
onchange?: (ev: {
|
|
129
|
+
value: { start: Date; end: Date | null } | null;
|
|
130
|
+
}) => void;
|
|
131
|
+
}>;
|
|
132
|
+
|
|
133
|
+
export declare const Fullscreen: Component<{
|
|
134
|
+
toggleButton?: Snippet<[(ev: MouseEvent) => void, boolean]>;
|
|
135
|
+
children?: () => any;
|
|
136
|
+
hotkey?: string;
|
|
137
|
+
}>;
|
|
138
|
+
|
|
139
|
+
export declare const Icon: Component<{
|
|
140
|
+
css?: string;
|
|
141
|
+
title?: string;
|
|
142
|
+
children?: () => any;
|
|
143
|
+
onclick?: (ev: MouseEvent) => void;
|
|
144
|
+
}>;
|
|
145
|
+
|
|
146
|
+
export declare const MultiCombo: Component<{
|
|
147
|
+
id?: string | number;
|
|
148
|
+
value?: (string | number)[];
|
|
149
|
+
options?: { id: string | number; label: string }[];
|
|
150
|
+
textOptions?: { id: string | number; label: string }[];
|
|
151
|
+
textField?: string;
|
|
152
|
+
placeholder?: string;
|
|
153
|
+
title?: string;
|
|
154
|
+
disabled?: boolean;
|
|
155
|
+
error?: boolean;
|
|
156
|
+
checkboxes?: boolean;
|
|
157
|
+
children?: () => any;
|
|
158
|
+
onchange?: (ev: { value: (string | number)[] }) => void;
|
|
159
|
+
}>;
|
|
160
|
+
|
|
161
|
+
export declare const Popup: Component<{
|
|
162
|
+
left?: number;
|
|
163
|
+
top?: number;
|
|
164
|
+
at?: TPosition;
|
|
165
|
+
parent?: HTMLElement;
|
|
166
|
+
children?: () => any;
|
|
167
|
+
oncancel?: (ev: MouseEvent) => void;
|
|
168
|
+
}>;
|
|
169
|
+
|
|
170
|
+
export declare const Dropdown: Component<{
|
|
171
|
+
position?: string;
|
|
172
|
+
align?: "start" | "center" | "end";
|
|
173
|
+
autoFit?: boolean;
|
|
174
|
+
width?: string;
|
|
175
|
+
children?: () => any;
|
|
176
|
+
oncancel?: (ev: MouseEvent) => void;
|
|
177
|
+
}>;
|
|
178
|
+
|
|
179
|
+
export declare const Pager: Component<{
|
|
180
|
+
total?: number;
|
|
181
|
+
pageSize?: number;
|
|
182
|
+
value?: number;
|
|
183
|
+
onchange?: (ev: { value: number; from: number; to: number }) => void;
|
|
184
|
+
}>;
|
|
185
|
+
|
|
186
|
+
export declare const RadioButton: Component<{
|
|
187
|
+
id?: string | number;
|
|
188
|
+
label?: string;
|
|
189
|
+
value?: boolean;
|
|
190
|
+
name?: string;
|
|
191
|
+
inputValue?: string | number;
|
|
192
|
+
disabled?: boolean;
|
|
193
|
+
onchange?: (ev: { value: boolean; inputValue: string | number }) => void;
|
|
194
|
+
}>;
|
|
195
|
+
|
|
196
|
+
export declare const RadioButtonGroup: Component<{
|
|
197
|
+
options?: { id: string | number; label: string }[];
|
|
198
|
+
value?: string | number;
|
|
199
|
+
type?: "inline" | "grid";
|
|
200
|
+
onchange?: (ev: { value: string | number }) => void;
|
|
201
|
+
}>;
|
|
202
|
+
|
|
203
|
+
export declare const RichSelect: Component<{
|
|
204
|
+
value?: string | number;
|
|
205
|
+
options?: { id: string | number; label: string }[];
|
|
206
|
+
textOptions?: { id: string | number; label: string }[];
|
|
207
|
+
placeholder?: string;
|
|
208
|
+
disabled?: boolean;
|
|
209
|
+
error?: boolean;
|
|
210
|
+
title?: string;
|
|
211
|
+
textField?: string;
|
|
212
|
+
clear?: boolean;
|
|
213
|
+
children?: () => any;
|
|
214
|
+
onchange?: (ev: { value: string | number }) => void;
|
|
215
|
+
}>;
|
|
216
|
+
|
|
217
|
+
export declare const Segmented: Component<{
|
|
218
|
+
options?: {
|
|
219
|
+
id: string | number;
|
|
220
|
+
label: string;
|
|
221
|
+
icon?: string;
|
|
222
|
+
title?: string;
|
|
223
|
+
}[];
|
|
224
|
+
value?: string | number;
|
|
225
|
+
css?: string;
|
|
226
|
+
children?: () => any;
|
|
227
|
+
onchange?: (ev: { value: string | number }) => void;
|
|
228
|
+
}>;
|
|
229
|
+
|
|
230
|
+
export declare const Select: Component<{
|
|
231
|
+
value?: string | number;
|
|
232
|
+
options?: { id: string | number; label: string }[];
|
|
233
|
+
placeholder?: string;
|
|
234
|
+
title?: string;
|
|
235
|
+
disabled?: boolean;
|
|
236
|
+
error?: boolean;
|
|
237
|
+
textField?: string;
|
|
238
|
+
clear?: boolean;
|
|
239
|
+
id?: string | number;
|
|
240
|
+
onchange?: (ev: { value: string | number }) => void;
|
|
241
|
+
}>;
|
|
242
|
+
|
|
243
|
+
export declare const Slider: Component<{
|
|
244
|
+
id?: string | number;
|
|
245
|
+
label?: string;
|
|
246
|
+
width?: string;
|
|
247
|
+
min?: number;
|
|
248
|
+
max?: number;
|
|
249
|
+
value?: number;
|
|
250
|
+
step?: number;
|
|
251
|
+
title?: string;
|
|
252
|
+
disabled?: boolean;
|
|
253
|
+
onchange?: (ev: {
|
|
254
|
+
value: number;
|
|
255
|
+
previous: number;
|
|
256
|
+
input?: boolean;
|
|
257
|
+
}) => void;
|
|
258
|
+
}>;
|
|
259
|
+
|
|
260
|
+
export declare const Switch: Component<{
|
|
261
|
+
id?: string | number;
|
|
262
|
+
value?: boolean;
|
|
263
|
+
disabled?: boolean;
|
|
264
|
+
onchange?: (ev: { value: boolean }) => void;
|
|
265
|
+
}>;
|
|
266
|
+
|
|
267
|
+
export declare const Tabs: Component<{
|
|
268
|
+
options?: {
|
|
269
|
+
id: string | number;
|
|
270
|
+
label?: string;
|
|
271
|
+
title?: string;
|
|
272
|
+
icon?: string;
|
|
273
|
+
}[];
|
|
274
|
+
value?: string | number;
|
|
275
|
+
type?: "top" | "bottom";
|
|
276
|
+
onchange?: (ev: { value: string | number }) => void;
|
|
277
|
+
}>;
|
|
278
|
+
|
|
279
|
+
export declare const Text: Component<{
|
|
280
|
+
value?: string | number;
|
|
281
|
+
id?: string | number;
|
|
282
|
+
readonly?: boolean;
|
|
283
|
+
focus?: boolean;
|
|
284
|
+
select?: boolean;
|
|
285
|
+
type?: "text" | "number" | "password";
|
|
286
|
+
placeholder?: string;
|
|
287
|
+
disabled?: boolean;
|
|
288
|
+
error?: boolean;
|
|
289
|
+
inputStyle?: string;
|
|
290
|
+
title?: string;
|
|
291
|
+
css?: string;
|
|
292
|
+
icon?: string;
|
|
293
|
+
clear?: boolean;
|
|
294
|
+
onchange?: (ev: { value: string | number; input?: boolean }) => void;
|
|
295
|
+
}>;
|
|
296
|
+
|
|
297
|
+
export declare const Counter: Component<{
|
|
298
|
+
id?: string | number;
|
|
299
|
+
value?: number;
|
|
300
|
+
step?: number;
|
|
301
|
+
min?: number;
|
|
302
|
+
max?: number;
|
|
303
|
+
error?: boolean;
|
|
304
|
+
disabled?: boolean;
|
|
305
|
+
readonly?: boolean;
|
|
306
|
+
onchange?: (ev: { value: number; input?: boolean }) => void;
|
|
307
|
+
}>;
|
|
308
|
+
|
|
309
|
+
export declare const Field: Component<{
|
|
310
|
+
label?: string;
|
|
311
|
+
position?: "left";
|
|
312
|
+
width?: string;
|
|
313
|
+
error?: boolean;
|
|
314
|
+
type?: "checkbox" | "slider" | "switch";
|
|
315
|
+
required?: boolean;
|
|
316
|
+
children?: () => any;
|
|
317
|
+
}>;
|
|
318
|
+
|
|
319
|
+
export declare const Calendar: Component<{
|
|
320
|
+
value?: Date;
|
|
321
|
+
current?: Date;
|
|
322
|
+
markers?: (date: Date) => string;
|
|
323
|
+
buttons?: boolean | ("clear" | "today")[];
|
|
324
|
+
onchange?: (ev: { value: Date | null }) => void;
|
|
325
|
+
}>;
|
|
326
|
+
|
|
327
|
+
export declare const Month: Component<{
|
|
328
|
+
value?: { start: Date; end: Date } | Date;
|
|
329
|
+
current?: Date;
|
|
330
|
+
part?: string;
|
|
331
|
+
markers?: (date: Date) => string;
|
|
332
|
+
oncancel?: () => void;
|
|
333
|
+
onchange?: (ev: Date) => void;
|
|
334
|
+
}>;
|
|
335
|
+
|
|
336
|
+
export declare const RangeCalendar: Component<{
|
|
337
|
+
start?: Date;
|
|
338
|
+
end?: Date;
|
|
339
|
+
current?: Date;
|
|
340
|
+
months?: 1 | 2;
|
|
341
|
+
markers?: (date: Date) => string;
|
|
342
|
+
buttons?: boolean | ("clear" | "today" | "done")[];
|
|
343
|
+
onchange?: (ev: { start: Date | null; end: Date | null }) => void;
|
|
344
|
+
}>;
|
|
345
|
+
|
|
346
|
+
export declare const TimePicker: Component<{
|
|
347
|
+
value?: Date;
|
|
348
|
+
id?: string | number;
|
|
349
|
+
title?: string;
|
|
350
|
+
css?: string;
|
|
351
|
+
disabled?: boolean;
|
|
352
|
+
error?: boolean;
|
|
353
|
+
format?: string | ((value: Date) => string);
|
|
354
|
+
onchange?: (ev: { value: Date }) => void;
|
|
355
|
+
}>;
|
|
356
|
+
|
|
357
|
+
export declare const TwoState: Component<{
|
|
358
|
+
value?: boolean;
|
|
359
|
+
type?:
|
|
360
|
+
| "primary"
|
|
361
|
+
| "secondary"
|
|
362
|
+
| "danger"
|
|
363
|
+
| "link"
|
|
364
|
+
| "primary block"
|
|
365
|
+
| "secondary block"
|
|
366
|
+
| "danger block"
|
|
367
|
+
| "link block";
|
|
368
|
+
icon?: string;
|
|
369
|
+
disabled?: boolean;
|
|
370
|
+
iconActive?: string;
|
|
371
|
+
title?: string;
|
|
372
|
+
css?: string;
|
|
373
|
+
text?: string;
|
|
374
|
+
textActive?: string;
|
|
375
|
+
active?: Snippet<[]>;
|
|
376
|
+
children?: () => any;
|
|
377
|
+
onclick?: (ev: MouseEvent) => void;
|
|
378
|
+
onchange?: (ev: { value: boolean }) => void;
|
|
379
|
+
}>;
|
|
380
|
+
|
|
381
|
+
export declare const Modal: Component<{
|
|
382
|
+
title?: string;
|
|
383
|
+
buttons?: boolean | string[];
|
|
384
|
+
header?: Snippet<[]>;
|
|
385
|
+
footer?: Snippet<[]>;
|
|
386
|
+
children?: () => any;
|
|
387
|
+
onconfirm?: (ev: { button?: string; event: MouseEvent }) => void;
|
|
388
|
+
oncancel?: (ev: { button?: string; event: MouseEvent }) => void;
|
|
389
|
+
}>;
|
|
390
|
+
|
|
391
|
+
export declare const ModalArea: Component<{
|
|
392
|
+
children?: () => any;
|
|
393
|
+
}>;
|
|
394
|
+
|
|
395
|
+
export declare const SideArea: Component<{
|
|
396
|
+
position?: "right";
|
|
397
|
+
children?: () => any;
|
|
398
|
+
oncancel?: () => void;
|
|
399
|
+
}>;
|
|
400
|
+
|
|
401
|
+
export declare const Portal: Component<{
|
|
402
|
+
theme?: "willow" | "willow-dark";
|
|
403
|
+
target?: HTMLElement;
|
|
404
|
+
children?: () => any;
|
|
405
|
+
}>;
|
|
406
|
+
|
|
407
|
+
export declare const Material: Component<{
|
|
408
|
+
fonts?: boolean;
|
|
409
|
+
children?: () => any;
|
|
410
|
+
}>;
|
|
411
|
+
|
|
412
|
+
export declare const Willow: Component<{
|
|
413
|
+
fonts?: boolean;
|
|
414
|
+
children?: () => any;
|
|
415
|
+
}>;
|
|
416
|
+
|
|
417
|
+
export declare const WillowDark: Component<{
|
|
418
|
+
fonts?: boolean;
|
|
419
|
+
children?: () => any;
|
|
420
|
+
}>;
|
|
421
|
+
|
|
422
|
+
export declare const Locale: Component<{
|
|
423
|
+
words?: any;
|
|
424
|
+
optional?: boolean;
|
|
425
|
+
children?: () => any;
|
|
426
|
+
}>;
|
|
427
|
+
|
|
428
|
+
export declare const Globals: Component<{
|
|
429
|
+
children?: () => any;
|
|
430
|
+
}>;
|
|
431
|
+
|
|
432
|
+
export declare const SuggestDropdown: Component<{
|
|
433
|
+
items?: { id: string | number; label: string }[];
|
|
434
|
+
children?: () => any;
|
|
435
|
+
onselect?: (ev: { id: string | number }) => void;
|
|
436
|
+
onready?: (ev: {
|
|
437
|
+
navigate?: (dir: number | null, ev?: KeyboardEvent) => void;
|
|
438
|
+
keydown?: (ev: KeyboardEvent, dir: number) => void;
|
|
439
|
+
move?: (ev: KeyboardEvent) => void;
|
|
440
|
+
}) => void;
|
|
441
|
+
}>;
|
|
442
|
+
|
|
443
|
+
export type { ILocale, Terms } from "@svar-ui/lib-dom";
|
|
444
|
+
export type { TPosition } from "@svar-ui/lib-dom";
|
|
445
|
+
|
|
446
|
+
export declare function popupContainer(node: HTMLElement): void;
|
package/whatsnew.md
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
## 2.
|
|
1
|
+
## Version 2.4.0
|
|
2
|
+
|
|
3
|
+
### New features
|
|
4
|
+
|
|
5
|
+
- Fullscreen component
|
|
6
|
+
|
|
7
|
+
### Updates
|
|
8
|
+
|
|
9
|
+
- Enhanced syntax of Field component that ensures proper label-input association
|
|
10
|
+
- More options to precisely position and align Popup
|
|
11
|
+
|
|
12
|
+
### Fixes
|
|
13
|
+
|
|
14
|
+
- Incorrect position of Popup in relatively positioned continer
|
|
15
|
+
- Incorrect position of Popup close to container edges
|
|
16
|
+
|
|
17
|
+
### Breaking changes
|
|
18
|
+
|
|
19
|
+
- Popup `mount` property was removed
|
|
20
|
+
|
|
21
|
+
## Version 2.3.1
|
|
22
|
+
|
|
23
|
+
### Fixes
|
|
24
|
+
|
|
25
|
+
- Incorrect location of d.ts files
|
|
26
|
+
|
|
27
|
+
## Version 2.3.0
|
|
2
28
|
|
|
3
29
|
### New features
|
|
4
30
|
|