wx-svelte-core 1.3.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/license.txt +21 -0
- package/package.json +35 -0
- package/src/Locale.svelte +17 -0
- package/src/components/Area.svelte +70 -0
- package/src/components/Button.svelte +187 -0
- package/src/components/Calendar.svelte +42 -0
- package/src/components/Checkbox.svelte +132 -0
- package/src/components/CheckboxGroup.svelte +52 -0
- package/src/components/ColorBoard.svelte +311 -0
- package/src/components/ColorPicker.svelte +110 -0
- package/src/components/ColorSelect.svelte +204 -0
- package/src/components/Combo.svelte +228 -0
- package/src/components/Counter.svelte +178 -0
- package/src/components/DatePicker.svelte +115 -0
- package/src/components/DateRangePicker.svelte +138 -0
- package/src/components/Dropdown.svelte +125 -0
- package/src/components/Field.svelte +91 -0
- package/src/components/Globals.svelte +53 -0
- package/src/components/Icon.svelte +31 -0
- package/src/components/Modal.svelte +115 -0
- package/src/components/ModalArea.svelte +32 -0
- package/src/components/MultiCombo.svelte +279 -0
- package/src/components/Notice.svelte +145 -0
- package/src/components/Notices.svelte +20 -0
- package/src/components/Pager.svelte +131 -0
- package/src/components/Popup.svelte +53 -0
- package/src/components/Portal.svelte +42 -0
- package/src/components/RadioButton.svelte +129 -0
- package/src/components/RadioButtonGroup.svelte +50 -0
- package/src/components/RangeCalendar.svelte +134 -0
- package/src/components/RichSelect.svelte +149 -0
- package/src/components/Segmented.svelte +115 -0
- package/src/components/Select.svelte +124 -0
- package/src/components/SideArea.svelte +33 -0
- package/src/components/Slider.svelte +242 -0
- package/src/components/Switch.svelte +88 -0
- package/src/components/Tabs.svelte +163 -0
- package/src/components/Text.svelte +185 -0
- package/src/components/Timepicker.svelte +217 -0
- package/src/components/TwoState.svelte +60 -0
- package/src/components/calendar/Button.svelte +40 -0
- package/src/components/calendar/Duodecade.svelte +97 -0
- package/src/components/calendar/Header.svelte +105 -0
- package/src/components/calendar/Month.svelte +189 -0
- package/src/components/calendar/Panel.svelte +119 -0
- package/src/components/calendar/Year.svelte +89 -0
- package/src/components/calendar/helpers.js +56 -0
- package/src/components/helpers/SuggestDropdown.svelte +79 -0
- package/src/components/helpers/colorTransformator.js +146 -0
- package/src/components/helpers/colorValidation.js +21 -0
- package/src/components/helpers/listnav.js +85 -0
- package/src/components/helpers/sliderMove.js +42 -0
- package/src/components/helpers.js +6 -0
- package/src/index.js +50 -0
- package/src/themes/FontOpenSans.svelte +36 -0
- package/src/themes/FonttRoboto.svelte +19 -0
- package/src/themes/Material.svelte +321 -0
- package/src/themes/Willow.svelte +323 -0
- package/src/themes/WillowDark.svelte +320 -0
- package/whatsnew.md +97 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { createEventDispatcher } from "svelte";
|
|
3
|
+
import { clickOutside } from "wx-lib-dom";
|
|
4
|
+
import { fly } from "svelte/transition";
|
|
5
|
+
|
|
6
|
+
const dispatch = createEventDispatcher();
|
|
7
|
+
export let position = "right";
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<div
|
|
11
|
+
class="wx-sidearea wx-pos-{position}"
|
|
12
|
+
use:clickOutside={() => dispatch("close")}
|
|
13
|
+
transition:fly={{ x: 650, opacity: 1 }}
|
|
14
|
+
>
|
|
15
|
+
<slot />
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<style>
|
|
19
|
+
.wx-sidearea {
|
|
20
|
+
position: absolute;
|
|
21
|
+
z-index: var(--wx-popup-z-index);
|
|
22
|
+
background: var(--wx-modal-background);
|
|
23
|
+
box-shadow: var(--wx-modal-shadow);
|
|
24
|
+
border: var(--wx-modal-border);
|
|
25
|
+
border-radius: var(--wx-modal-border-radius);
|
|
26
|
+
min-width: var(--wx-modal-width);
|
|
27
|
+
height: 100vh;
|
|
28
|
+
}
|
|
29
|
+
.wx-sidearea.wx-pos-right {
|
|
30
|
+
right: 0;
|
|
31
|
+
top: 0;
|
|
32
|
+
}
|
|
33
|
+
</style>
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { createEventDispatcher } from "svelte";
|
|
3
|
+
import { uid } from "wx-lib-dom";
|
|
4
|
+
|
|
5
|
+
const dispatch = createEventDispatcher();
|
|
6
|
+
|
|
7
|
+
export let id = uid();
|
|
8
|
+
export let label = "";
|
|
9
|
+
export let width = "";
|
|
10
|
+
export let min = 0;
|
|
11
|
+
export let max = 100;
|
|
12
|
+
export let value = 0;
|
|
13
|
+
export let step = 1;
|
|
14
|
+
export let title = "";
|
|
15
|
+
export let disabled = false;
|
|
16
|
+
|
|
17
|
+
let progress = 0;
|
|
18
|
+
let bgStyle = "";
|
|
19
|
+
|
|
20
|
+
let previous;
|
|
21
|
+
$: {
|
|
22
|
+
progress = ((value - min) / (max - min)) * 100 + "%";
|
|
23
|
+
bgStyle = disabled
|
|
24
|
+
? ""
|
|
25
|
+
: `background: linear-gradient(90deg, var(--wx-slider-primary) 0% ${progress}, var(--wx-slider-background) ${progress} 100%);`;
|
|
26
|
+
|
|
27
|
+
if (isNaN(value)) value = 0;
|
|
28
|
+
|
|
29
|
+
if (previous !== value) {
|
|
30
|
+
dispatch("change", { value, previous, input: true });
|
|
31
|
+
previous = value;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function onChange({ target }) {
|
|
36
|
+
const v = target.value * 1;
|
|
37
|
+
dispatch("change", { value: v });
|
|
38
|
+
value = v;
|
|
39
|
+
}
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<div class="wx-slider" style={width ? `width: ${width}` : ""} {title}>
|
|
43
|
+
{#if label}<label for={id}>{label}</label>{/if}
|
|
44
|
+
<div>
|
|
45
|
+
<input
|
|
46
|
+
{id}
|
|
47
|
+
type="range"
|
|
48
|
+
{min}
|
|
49
|
+
{max}
|
|
50
|
+
{step}
|
|
51
|
+
{disabled}
|
|
52
|
+
bind:value
|
|
53
|
+
on:change={onChange}
|
|
54
|
+
style={bgStyle}
|
|
55
|
+
/>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<style>
|
|
60
|
+
.wx-slider {
|
|
61
|
+
width: var(--wx-input-width);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
label {
|
|
65
|
+
display: block;
|
|
66
|
+
margin: var(--wx-slider-label-margin);
|
|
67
|
+
font-family: var(--wx-slider-label-font-family);
|
|
68
|
+
font-size: var(--wx-slider-label-font-size);
|
|
69
|
+
line-height: var(--wx-slider-label-line-height);
|
|
70
|
+
font-weight: var(--wx-slider-label-font-weight);
|
|
71
|
+
color: var(--wx-slider-label-font-color);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.wx-slider div {
|
|
75
|
+
padding: calc(
|
|
76
|
+
(var(--wx-slider-height) - var(--wx-slider-track-height)) / 2
|
|
77
|
+
)
|
|
78
|
+
0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
input {
|
|
82
|
+
-webkit-appearance: none;
|
|
83
|
+
-moz-appearance: none;
|
|
84
|
+
appearance: none;
|
|
85
|
+
display: block;
|
|
86
|
+
width: 100%;
|
|
87
|
+
height: var(--wx-slider-track-height);
|
|
88
|
+
background: var(--wx-slider-background);
|
|
89
|
+
border: none;
|
|
90
|
+
border-radius: var(--wx-slider-track-border-radius);
|
|
91
|
+
margin: 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
input:focus {
|
|
95
|
+
outline: none;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
input::-webkit-slider-runnable-track {
|
|
99
|
+
margin: 0;
|
|
100
|
+
width: 100%;
|
|
101
|
+
height: var(--wx-slider-track-height);
|
|
102
|
+
border: none;
|
|
103
|
+
border-radius: var(--wx-slider-track-border-radius);
|
|
104
|
+
cursor: pointer;
|
|
105
|
+
background: transparent;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
input::-webkit-slider-thumb {
|
|
109
|
+
margin-top: calc(
|
|
110
|
+
(var(--wx-slider-track-height) - var(--wx-slider-thumb-size)) / 2
|
|
111
|
+
);
|
|
112
|
+
width: var(--wx-slider-thumb-size);
|
|
113
|
+
height: var(--wx-slider-thumb-size);
|
|
114
|
+
background: var(--wx-slider-primary);
|
|
115
|
+
border: var(--wx-slider-thumb-border);
|
|
116
|
+
box-shadow: var(--wx-slider-thumb-shadow);
|
|
117
|
+
border-radius: 50%;
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
appearance: none;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
input::-moz-range-track {
|
|
123
|
+
margin: 0;
|
|
124
|
+
width: 100%;
|
|
125
|
+
height: var(--wx-slider-track-height);
|
|
126
|
+
border: none;
|
|
127
|
+
border-radius: var(--wx-slider-track-border-radius);
|
|
128
|
+
cursor: pointer;
|
|
129
|
+
background: transparent;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
input::-moz-range-thumb {
|
|
133
|
+
margin-top: calc(
|
|
134
|
+
(var(--wx-slider-track-height) - var(--wx-slider-thumb-size)) / 2
|
|
135
|
+
);
|
|
136
|
+
width: var(--wx-slider-thumb-size);
|
|
137
|
+
height: var(--wx-slider-thumb-size);
|
|
138
|
+
background: var(--wx-slider-primary);
|
|
139
|
+
border: var(--wx-slider-thumb-border);
|
|
140
|
+
border-radius: 50%;
|
|
141
|
+
cursor: pointer;
|
|
142
|
+
appearance: none;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
input::-moz-range-progress {
|
|
146
|
+
background-color: var(--wx-slider-primary);
|
|
147
|
+
height: var(--wx-slider-track-height);
|
|
148
|
+
border-top-left-radius: var(--wx-slider-track-border-radius);
|
|
149
|
+
border-bottom-left-radius: var(--wx-slider-track-border-radius);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
input::-ms-track {
|
|
153
|
+
color: transparent;
|
|
154
|
+
margin: 0;
|
|
155
|
+
width: 100%;
|
|
156
|
+
height: var(--wx-slider-track-height);
|
|
157
|
+
border: none;
|
|
158
|
+
border-radius: var(--wx-slider-track-border-radius);
|
|
159
|
+
cursor: pointer;
|
|
160
|
+
background: transparent;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
input::-ms-fill-lower {
|
|
164
|
+
background: var(--wx-slider-primary);
|
|
165
|
+
border: 0.2px solid var(--wx-slider-primary);
|
|
166
|
+
border-radius: var(--wx-slider-track-border-radius);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
input::-ms-fill-upper {
|
|
170
|
+
background: var(--wx-slider-background);
|
|
171
|
+
border: 0.2px solid var(--wx-slider-background);
|
|
172
|
+
border-radius: var(--wx-slider-track-border-radius);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
input::-ms-thumb {
|
|
176
|
+
margin-top: calc(
|
|
177
|
+
(var(--wx-slider-track-height) - var(--wx-slider-thumb-size)) / 2
|
|
178
|
+
);
|
|
179
|
+
width: var(--wx-slider-thumb-size);
|
|
180
|
+
height: var(--wx-slider-thumb-size);
|
|
181
|
+
background: var(--wx-slider-primary);
|
|
182
|
+
border: var(--wx-slider-thumb-border);
|
|
183
|
+
border-radius: 50%;
|
|
184
|
+
cursor: pointer;
|
|
185
|
+
appearance: none;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
input:focus::-ms-fill-lower {
|
|
189
|
+
background: var(--wx-slider-primary);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
input:focus::-ms-fill-upper {
|
|
193
|
+
background: var(--wx-slider-background);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
input[disabled] {
|
|
197
|
+
cursor: not-allowed;
|
|
198
|
+
background: var(--wx-color-disabled);
|
|
199
|
+
}
|
|
200
|
+
input[disabled]::-webkit-slider-runnable-track {
|
|
201
|
+
cursor: not-allowed;
|
|
202
|
+
}
|
|
203
|
+
input[disabled]::-webkit-slider-thumb {
|
|
204
|
+
cursor: not-allowed;
|
|
205
|
+
background: var(--wx-background);
|
|
206
|
+
border: var(--wx-slider-thumb-border-disabled);
|
|
207
|
+
}
|
|
208
|
+
input[disabled]::-moz-range-track {
|
|
209
|
+
cursor: not-allowed;
|
|
210
|
+
}
|
|
211
|
+
input[disabled]::-moz-range-thumb {
|
|
212
|
+
cursor: not-allowed;
|
|
213
|
+
background: var(--wx-background);
|
|
214
|
+
border: var(--wx-slider-thumb-border-disabled);
|
|
215
|
+
}
|
|
216
|
+
input[disabled]::-moz-range-progress {
|
|
217
|
+
cursor: not-allowed;
|
|
218
|
+
background: var(--wx-color-disabled);
|
|
219
|
+
}
|
|
220
|
+
input[disabled]::-ms-track {
|
|
221
|
+
cursor: not-allowed;
|
|
222
|
+
}
|
|
223
|
+
input[disabled]::-ms-fill-lower {
|
|
224
|
+
background: var(--wx-color-disabled);
|
|
225
|
+
border-color: var(--wx-color-disabled);
|
|
226
|
+
}
|
|
227
|
+
input[disabled]::-ms-fill-upper {
|
|
228
|
+
background: var(--wx-color-disabled);
|
|
229
|
+
border-color: var(--wx-color-disabled);
|
|
230
|
+
}
|
|
231
|
+
input[disabled]::-ms-thumb {
|
|
232
|
+
cursor: not-allowed;
|
|
233
|
+
background: var(--wx-background);
|
|
234
|
+
border: var(--wx-slider-thumb-border-disabled);
|
|
235
|
+
}
|
|
236
|
+
input[disabled]:focus::-ms-fill-lower {
|
|
237
|
+
background: var(--wx-color-disabled);
|
|
238
|
+
}
|
|
239
|
+
input[disabled]:focus::-ms-fill-upper {
|
|
240
|
+
background: var(--wx-color-disabled);
|
|
241
|
+
}
|
|
242
|
+
</style>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { uid } from "wx-lib-dom";
|
|
3
|
+
|
|
4
|
+
export let id = uid();
|
|
5
|
+
export let value;
|
|
6
|
+
export let disabled = false;
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<label class="wx-switch">
|
|
10
|
+
<input type="checkbox" {disabled} bind:checked={value} {id} />
|
|
11
|
+
<span />
|
|
12
|
+
</label>
|
|
13
|
+
|
|
14
|
+
<style>
|
|
15
|
+
.wx-switch {
|
|
16
|
+
position: relative;
|
|
17
|
+
display: inline-block;
|
|
18
|
+
vertical-align: top;
|
|
19
|
+
margin: 0;
|
|
20
|
+
cursor: default;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
input {
|
|
24
|
+
appearance: none;
|
|
25
|
+
width: 0;
|
|
26
|
+
height: 0;
|
|
27
|
+
opacity: 0;
|
|
28
|
+
position: absolute;
|
|
29
|
+
left: 0;
|
|
30
|
+
top: 0;
|
|
31
|
+
margin: 0;
|
|
32
|
+
padding: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
span {
|
|
36
|
+
display: block;
|
|
37
|
+
position: relative;
|
|
38
|
+
width: var(--wx-switch-width);
|
|
39
|
+
height: var(--wx-switch-height);
|
|
40
|
+
border: var(--wx-switch-border-width) solid
|
|
41
|
+
var(--wx-switch-border-color);
|
|
42
|
+
border-radius: calc(var(--wx-switch-height) / 2);
|
|
43
|
+
background-color: var(--wx-switch-background);
|
|
44
|
+
transition: background-color 0.4s ease;
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
span:before {
|
|
50
|
+
content: "";
|
|
51
|
+
position: absolute;
|
|
52
|
+
left: var(--wx-switch-thumb-offset);
|
|
53
|
+
top: var(--wx-switch-thumb-offset);
|
|
54
|
+
height: calc(
|
|
55
|
+
var(--wx-switch-height) - var(--wx-switch-thumb-offset) * 2 -
|
|
56
|
+
var(--wx-switch-border-width) * 2
|
|
57
|
+
);
|
|
58
|
+
width: calc(
|
|
59
|
+
var(--wx-switch-height) - var(--wx-switch-thumb-offset) * 2 -
|
|
60
|
+
var(--wx-switch-border-width) * 2
|
|
61
|
+
);
|
|
62
|
+
border: var(--wx-switch-thumb-border);
|
|
63
|
+
border-radius: 50%;
|
|
64
|
+
background: var(--wx-switch-thumb-background);
|
|
65
|
+
box-shadow: var(--wx-switch-thumb-shadow);
|
|
66
|
+
transition: transform 0.4s ease;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
input:checked ~ span {
|
|
70
|
+
background-color: var(--wx-switch-primary);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
input:checked ~ span:before {
|
|
74
|
+
transform: translateX(
|
|
75
|
+
calc(var(--wx-switch-width) - var(--wx-switch-height))
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
input[disabled] ~ span {
|
|
80
|
+
background-color: var(--wx-color-disabled);
|
|
81
|
+
border-color: var(--wx-switch-border-color-disabled);
|
|
82
|
+
cursor: not-allowed;
|
|
83
|
+
}
|
|
84
|
+
input[disabled] ~ span:before {
|
|
85
|
+
border: var(--wx-switch-thumb-border-disabled);
|
|
86
|
+
background: var(--wx-switch-thumb-background-disabled);
|
|
87
|
+
}
|
|
88
|
+
</style>
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { createEventDispatcher } from "svelte";
|
|
3
|
+
export let options;
|
|
4
|
+
export let value;
|
|
5
|
+
export let type = "top";
|
|
6
|
+
|
|
7
|
+
const dispatch = createEventDispatcher();
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<div class="wx-tabs wx-{type}">
|
|
11
|
+
{#each options as option}
|
|
12
|
+
<button
|
|
13
|
+
class:wx-active={option.id == value}
|
|
14
|
+
on:click={() => {
|
|
15
|
+
value = option.id;
|
|
16
|
+
dispatch("change", value);
|
|
17
|
+
}}
|
|
18
|
+
>
|
|
19
|
+
{#if option.icon}
|
|
20
|
+
<i
|
|
21
|
+
class="wx-icon {option.icon} {!option.label
|
|
22
|
+
? 'wx-only'
|
|
23
|
+
: ''}"
|
|
24
|
+
/>
|
|
25
|
+
{/if}
|
|
26
|
+
{#if option.label}<span class="wx-label">{option.label}</span>{/if}
|
|
27
|
+
</button>
|
|
28
|
+
{/each}
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<style>
|
|
32
|
+
.wx-tabs {
|
|
33
|
+
display: inline-flex;
|
|
34
|
+
flex-wrap: nowrap;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
button {
|
|
38
|
+
position: relative;
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-wrap: nowrap;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
text-decoration: none;
|
|
44
|
+
text-align: center;
|
|
45
|
+
letter-spacing: normal;
|
|
46
|
+
text-transform: var(--wx-button-text-transform);
|
|
47
|
+
font-family: var(--wx-button-font-family);
|
|
48
|
+
font-size: var(--wx-button-font-size);
|
|
49
|
+
line-height: var(--wx-button-line-height);
|
|
50
|
+
font-weight: var(--wx-button-font-weight);
|
|
51
|
+
padding: var(--wx-button-padding);
|
|
52
|
+
border: var(--wx-button-border);
|
|
53
|
+
border-width: var(--wx-tabs-border-width);
|
|
54
|
+
border-radius: 0;
|
|
55
|
+
background: var(--wx-tabs-background);
|
|
56
|
+
color: var(--wx-button-font-color);
|
|
57
|
+
cursor: pointer;
|
|
58
|
+
box-shadow: none;
|
|
59
|
+
transition: none;
|
|
60
|
+
max-width: 100%;
|
|
61
|
+
min-width: var(--wx-tabs-cell-min-width);
|
|
62
|
+
user-select: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
button + button:before {
|
|
66
|
+
content: "";
|
|
67
|
+
display: block;
|
|
68
|
+
position: absolute;
|
|
69
|
+
left: calc(
|
|
70
|
+
var(--wx-tabs-border-width) * -1 - var(--wx-tabs-divider-width) / 2
|
|
71
|
+
);
|
|
72
|
+
top: 50%;
|
|
73
|
+
transform: translateY(-50%);
|
|
74
|
+
width: 0;
|
|
75
|
+
height: calc(
|
|
76
|
+
var(--wx-tabs-border-width) * 2 + var(--wx-tabs-divider-height)
|
|
77
|
+
);
|
|
78
|
+
border-left: var(--wx-tabs-divider-width) solid
|
|
79
|
+
var(--wx-tabs-divider-color);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
button:first-child {
|
|
83
|
+
border-top-left-radius: var(--wx-tabs-border-radius);
|
|
84
|
+
border-bottom-left-radius: var(--wx-tabs-border-radius);
|
|
85
|
+
}
|
|
86
|
+
button:last-child {
|
|
87
|
+
border-top-right-radius: var(--wx-tabs-border-radius);
|
|
88
|
+
border-bottom-right-radius: var(--wx-tabs-border-radius);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
button,
|
|
92
|
+
button:focus,
|
|
93
|
+
button:active {
|
|
94
|
+
outline: none;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
button:hover {
|
|
98
|
+
background: var(--wx-tabs-background-hover);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
button.wx-active,
|
|
102
|
+
button.wx-active:hover,
|
|
103
|
+
button.wx-active:focus {
|
|
104
|
+
background: var(--wx-tabs-active-background);
|
|
105
|
+
color: var(--wx-tabs-active-color);
|
|
106
|
+
cursor: default;
|
|
107
|
+
}
|
|
108
|
+
button.wx-active:before {
|
|
109
|
+
display: none;
|
|
110
|
+
}
|
|
111
|
+
button.wx-active + button:before {
|
|
112
|
+
display: none;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
button.wx-active:after,
|
|
116
|
+
button:hover:after {
|
|
117
|
+
content: "";
|
|
118
|
+
display: block;
|
|
119
|
+
position: absolute;
|
|
120
|
+
left: 13px;
|
|
121
|
+
height: 0;
|
|
122
|
+
width: calc(100% - 26px);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
button.wx-active:after {
|
|
126
|
+
border-bottom: 2px solid var(--wx-tabs-active-border);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
button:not(.wx-active):hover:after {
|
|
130
|
+
border-bottom: 2px solid var(--wx-tabs-hover-border);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.wx-top button.wx-active:after,
|
|
134
|
+
.wx-top button:hover:after {
|
|
135
|
+
top: 100%;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.wx-bottom button.wx-active:after,
|
|
139
|
+
.wx-bottom button:hover:after {
|
|
140
|
+
top: 0;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.wx-icon {
|
|
144
|
+
position: relative;
|
|
145
|
+
font-size: var(--wx-button-icon-size);
|
|
146
|
+
line-height: 1;
|
|
147
|
+
height: var(--wx-button-line-height);
|
|
148
|
+
opacity: 0.7;
|
|
149
|
+
}
|
|
150
|
+
.wx-icon:before {
|
|
151
|
+
display: block;
|
|
152
|
+
position: relative;
|
|
153
|
+
top: 50%;
|
|
154
|
+
transform: translateY(-50%);
|
|
155
|
+
}
|
|
156
|
+
.wx-icon.wx-only {
|
|
157
|
+
opacity: 1;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.wx-icon + .wx-label {
|
|
161
|
+
margin-left: 4px;
|
|
162
|
+
}
|
|
163
|
+
</style>
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { uid } from "wx-lib-dom";
|
|
3
|
+
import { onMount, createEventDispatcher } from "svelte";
|
|
4
|
+
|
|
5
|
+
export let value = "";
|
|
6
|
+
export let id = uid();
|
|
7
|
+
export let readonly = false;
|
|
8
|
+
export let focus = false;
|
|
9
|
+
export let select = false;
|
|
10
|
+
export let type = "text";
|
|
11
|
+
export let placeholder = "";
|
|
12
|
+
export let disabled = false;
|
|
13
|
+
export let error = false;
|
|
14
|
+
export let inputStyle = "";
|
|
15
|
+
export let title = "";
|
|
16
|
+
export let css = "";
|
|
17
|
+
export let icon = "";
|
|
18
|
+
|
|
19
|
+
const dispatch = createEventDispatcher();
|
|
20
|
+
|
|
21
|
+
if (icon && css.indexOf("wx-icon-left") === -1)
|
|
22
|
+
css = "wx-icon-right " + css;
|
|
23
|
+
|
|
24
|
+
let input;
|
|
25
|
+
onMount(() => {
|
|
26
|
+
// wait till the source click processing will end
|
|
27
|
+
setTimeout(() => {
|
|
28
|
+
if (focus && input) input.focus();
|
|
29
|
+
if (select && input) input.select();
|
|
30
|
+
}, 1);
|
|
31
|
+
});
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<div class="wx-text {css}" class:wx-error={error} class:wx-disabled={disabled}>
|
|
35
|
+
{#if type == "password"}
|
|
36
|
+
<input
|
|
37
|
+
bind:value
|
|
38
|
+
bind:this={input}
|
|
39
|
+
{id}
|
|
40
|
+
{readonly}
|
|
41
|
+
{disabled}
|
|
42
|
+
{placeholder}
|
|
43
|
+
type="password"
|
|
44
|
+
style={inputStyle}
|
|
45
|
+
{title}
|
|
46
|
+
on:input={() => dispatch("change", { value, input: true })}
|
|
47
|
+
on:change={() => dispatch("change", { value })}
|
|
48
|
+
/>
|
|
49
|
+
{:else if type == "number"}
|
|
50
|
+
<input
|
|
51
|
+
bind:value
|
|
52
|
+
bind:this={input}
|
|
53
|
+
{id}
|
|
54
|
+
{readonly}
|
|
55
|
+
{disabled}
|
|
56
|
+
{placeholder}
|
|
57
|
+
type="number"
|
|
58
|
+
style={inputStyle}
|
|
59
|
+
{title}
|
|
60
|
+
on:input={() => dispatch("change", { value, input: true })}
|
|
61
|
+
on:change={() => dispatch("change", { value })}
|
|
62
|
+
/>
|
|
63
|
+
{:else}
|
|
64
|
+
<input
|
|
65
|
+
bind:value
|
|
66
|
+
bind:this={input}
|
|
67
|
+
{id}
|
|
68
|
+
{readonly}
|
|
69
|
+
{disabled}
|
|
70
|
+
{placeholder}
|
|
71
|
+
{title}
|
|
72
|
+
style={inputStyle}
|
|
73
|
+
on:input={() => dispatch("change", { value, input: true })}
|
|
74
|
+
on:change={() => dispatch("change", { value })}
|
|
75
|
+
/>
|
|
76
|
+
{/if}
|
|
77
|
+
|
|
78
|
+
{#if icon}<i class="wx-icon {icon}" />{/if}
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<style>
|
|
82
|
+
.wx-text {
|
|
83
|
+
position: relative;
|
|
84
|
+
width: var(--wx-input-width);
|
|
85
|
+
}
|
|
86
|
+
.wx-text.wx-disabled .wx-icon {
|
|
87
|
+
color: var(--wx-color-font-disabled);
|
|
88
|
+
}
|
|
89
|
+
.wx-text.wx-error .wx-icon {
|
|
90
|
+
color: var(--wx-color-danger);
|
|
91
|
+
}
|
|
92
|
+
.wx-icon {
|
|
93
|
+
position: absolute;
|
|
94
|
+
right: var(--wx-input-icon-indent);
|
|
95
|
+
top: 50%;
|
|
96
|
+
transform: translateY(-50%);
|
|
97
|
+
font-size: var(--wx-input-icon-size);
|
|
98
|
+
line-height: 1;
|
|
99
|
+
width: var(--wx-input-icon-size);
|
|
100
|
+
height: var(--wx-input-icon-size);
|
|
101
|
+
display: flex;
|
|
102
|
+
justify-content: center;
|
|
103
|
+
align-items: center;
|
|
104
|
+
pointer-events: none;
|
|
105
|
+
user-select: none;
|
|
106
|
+
color: var(--wx-input-icon-color);
|
|
107
|
+
}
|
|
108
|
+
.wx-icon:before {
|
|
109
|
+
display: block;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.wx-icon-left .wx-icon {
|
|
113
|
+
right: auto;
|
|
114
|
+
left: var(--wx-input-icon-indent);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
input {
|
|
118
|
+
display: block;
|
|
119
|
+
width: var(--wx-input-width);
|
|
120
|
+
height: var(--wx-input-height);
|
|
121
|
+
max-width: 100%;
|
|
122
|
+
padding: var(--wx-input-padding);
|
|
123
|
+
outline: none;
|
|
124
|
+
font-family: var(--wx-input-font-family);
|
|
125
|
+
font-size: var(--wx-input-font-size);
|
|
126
|
+
line-height: var(--wx-input-line-height);
|
|
127
|
+
font-weight: var(--wx-input-font-weight);
|
|
128
|
+
text-align: var(--wx-input-text-align);
|
|
129
|
+
color: var(--wx-input-font-color);
|
|
130
|
+
border: var(--wx-input-border);
|
|
131
|
+
border-radius: var(--wx-input-border-radius);
|
|
132
|
+
background: var(--wx-input-background);
|
|
133
|
+
overflow: hidden;
|
|
134
|
+
text-overflow: ellipsis;
|
|
135
|
+
}
|
|
136
|
+
input:focus {
|
|
137
|
+
border: var(--wx-input-border-focus);
|
|
138
|
+
}
|
|
139
|
+
input::placeholder {
|
|
140
|
+
color: var(--wx-input-placeholder-color);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.wx-icon-left input {
|
|
144
|
+
padding-left: calc(
|
|
145
|
+
var(--wx-input-icon-size) + var(--wx-input-icon-indent) * 2
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
.wx-icon-right input {
|
|
149
|
+
padding-right: calc(
|
|
150
|
+
var(--wx-input-icon-size) + var(--wx-input-icon-indent) * 2
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
input[disabled] {
|
|
155
|
+
cursor: not-allowed !important;
|
|
156
|
+
border: var(--wx-input-border-disabled);
|
|
157
|
+
color: var(--wx-color-font-disabled);
|
|
158
|
+
background: var(--wx-input-background-disabled);
|
|
159
|
+
pointer-events: none;
|
|
160
|
+
}
|
|
161
|
+
input[disabled]::placeholder {
|
|
162
|
+
color: var(--wx-color-font-disabled);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.wx-error input {
|
|
166
|
+
border-color: var(--wx-color-danger);
|
|
167
|
+
color: var(--wx-color-danger);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.wx-title input {
|
|
171
|
+
border: 1px solid transparent;
|
|
172
|
+
font-weight: var(--wx-font-weight-md);
|
|
173
|
+
font-size: var(--wx-font-size-md);
|
|
174
|
+
line-height: var(--wx-line-height-md);
|
|
175
|
+
color: var(--wx-color-secondary-font);
|
|
176
|
+
margin-left: -8px;
|
|
177
|
+
width: calc(100% + 8px);
|
|
178
|
+
}
|
|
179
|
+
.wx-title:focus:not([disabled]) input {
|
|
180
|
+
border: var(--wx-input-border-focus);
|
|
181
|
+
}
|
|
182
|
+
.wx-title:hover:not([disabled]) input {
|
|
183
|
+
border: var(--wx-input-border-focus);
|
|
184
|
+
}
|
|
185
|
+
</style>
|