lapikit 0.0.0-insiders.b9305c0 → 0.0.0-insiders.baf0558
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/dist/components/alert/alert.css +16 -7
- package/dist/components/chip/chip.css +1 -0
- package/dist/components/textfield/textfield.css +99 -10
- package/dist/components/textfield/textfield.svelte +25 -3
- package/dist/components/textfield/textfield.svelte.d.ts +1 -1
- package/dist/components/textfield/types.d.ts +28 -1
- package/package.json +1 -1
|
@@ -1,23 +1,24 @@
|
|
|
1
|
+
/* root */
|
|
1
2
|
.kit-alert {
|
|
2
3
|
--alert-color: var(--on, var(--kit-on-container));
|
|
3
4
|
--alert-background: var(--base, var(--kit-container));
|
|
4
5
|
--alert-radius: var(--shape, var(--kit-radius-md));
|
|
6
|
+
}
|
|
5
7
|
|
|
8
|
+
.kit-alert {
|
|
6
9
|
display: grid;
|
|
7
10
|
flex: 1 1;
|
|
8
11
|
grid-template-areas:
|
|
9
12
|
'prepend content append close'
|
|
10
13
|
'. content . .';
|
|
11
|
-
|
|
14
|
+
grid-template-columns: max-content minmax(0, 1fr) max-content max-content;
|
|
12
15
|
position: relative;
|
|
13
16
|
padding: 1rem;
|
|
14
17
|
overflow: hidden;
|
|
15
18
|
color: var(--alert-color);
|
|
16
19
|
background-color: var(--alert-background);
|
|
17
20
|
border-radius: var(--alert-radius);
|
|
18
|
-
|
|
19
|
-
color 0.5s,
|
|
20
|
-
background-color 0.5s; */
|
|
21
|
+
line-height: 0;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
.kit-alert .kit-alert--underlay {
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
padding-top: 0.75rem;
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
.kit-alert .kit-alert
|
|
57
|
+
.kit-alert .kit-alert--prepend {
|
|
57
58
|
align-self: flex-start;
|
|
58
59
|
display: flex;
|
|
59
60
|
align-items: center;
|
|
@@ -61,8 +62,8 @@
|
|
|
61
62
|
margin-inline-end: 1rem;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
.kit-alert .kit-alert
|
|
65
|
-
align-self:
|
|
65
|
+
.kit-alert .kit-alert--content {
|
|
66
|
+
align-self: flex-start;
|
|
66
67
|
grid-area: content;
|
|
67
68
|
overflow: hidden;
|
|
68
69
|
}
|
|
@@ -74,6 +75,14 @@
|
|
|
74
75
|
grid-area: close;
|
|
75
76
|
}
|
|
76
77
|
|
|
78
|
+
.kit-alert .kit-alert--append {
|
|
79
|
+
align-self: flex-start;
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
grid-area: append;
|
|
83
|
+
margin-inline-start: 1rem;
|
|
84
|
+
}
|
|
85
|
+
|
|
77
86
|
/* state */
|
|
78
87
|
.kit-alert.kit-alert--info:not([class*='alert--variant-']) {
|
|
79
88
|
--on: var(--kit-on-info);
|
|
@@ -16,6 +16,45 @@
|
|
|
16
16
|
grid-template-rows: 1fr auto;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
/* variant */
|
|
20
|
+
.kit-textfield[breakpoint]kit-textfield--variant-filled .kit-field {
|
|
21
|
+
--textfield-border-color: var(--textfield-background);
|
|
22
|
+
background-color: var(--textfield-background);
|
|
23
|
+
border-radius: var(--textfield-radius);
|
|
24
|
+
color: var(--textfield-color);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.kit-textfield[breakpoint]kit-textfield--variant-outline .kit-field {
|
|
28
|
+
--textfield-border-color: var(--textfield-color);
|
|
29
|
+
background-color: var(--textfield-background);
|
|
30
|
+
border-radius: var(--textfield-radius);
|
|
31
|
+
color: var(--textfield-color);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.kit-textfield[breakpoint]kit-textfield--variant-filled .kit-textfield-outline,
|
|
35
|
+
.kit-textfield[breakpoint]kit-textfield--variant-outline .kit-textfield-outline {
|
|
36
|
+
border-bottom: 1px solid var(--textfield-border-color);
|
|
37
|
+
border-top: 1px solid var(--textfield-border-color);
|
|
38
|
+
border-right: 1px solid var(--textfield-border-color);
|
|
39
|
+
border-left: 1px solid var(--textfield-border-color);
|
|
40
|
+
border-radius: var(--textfield-radius);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.kit-textfield[breakpoint]kit-textfield--variant-text .kit-field {
|
|
44
|
+
--textfield-border-color: var(--textfield-color);
|
|
45
|
+
background-color: transparent;
|
|
46
|
+
border-radius: 0;
|
|
47
|
+
color: var(--textfield-color);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.kit-textfield[breakpoint]kit-textfield--variant-text .kit-textfield-outline {
|
|
51
|
+
border-bottom: 1px solid var(--textfield-border-color);
|
|
52
|
+
border-top: 0;
|
|
53
|
+
border-right: 0;
|
|
54
|
+
border-left: 0;
|
|
55
|
+
border-radius: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
19
58
|
.kit-textfield--hide-spin-buttons input[type='number'] {
|
|
20
59
|
-moz-appearance: textfield;
|
|
21
60
|
appearance: textfield;
|
|
@@ -49,7 +88,6 @@
|
|
|
49
88
|
position: absolute;
|
|
50
89
|
right: 0;
|
|
51
90
|
width: 100%;
|
|
52
|
-
border: 1px solid var(--textfield-background);
|
|
53
91
|
}
|
|
54
92
|
|
|
55
93
|
.kit-textfield .kit-textfield-prepend {
|
|
@@ -72,9 +110,6 @@
|
|
|
72
110
|
.kit-textfield-control {
|
|
73
111
|
display: flex;
|
|
74
112
|
grid-area: control;
|
|
75
|
-
background-color: var(--textfield-background);
|
|
76
|
-
border-radius: var(--textfield-radius);
|
|
77
|
-
color: var(--textfield-color);
|
|
78
113
|
}
|
|
79
114
|
|
|
80
115
|
.kit-textfield-control .kit-textfield-prepend-inner {
|
|
@@ -119,14 +154,16 @@
|
|
|
119
154
|
.kit-textfield-control .kit-field {
|
|
120
155
|
display: grid;
|
|
121
156
|
grid-template-areas: 'prepend-inner field clear append-inner';
|
|
122
|
-
grid-template-columns:
|
|
123
|
-
font-size:
|
|
157
|
+
grid-template-columns: max-content minmax(0, 1fr) max-content max-content;
|
|
158
|
+
font-size: calc(var(--kit-spacing) * var(--textfield-multiplier-font-size));
|
|
124
159
|
max-width: 100%;
|
|
125
|
-
border-radius: 4px;
|
|
126
160
|
contain: layout;
|
|
127
161
|
flex: 1 0;
|
|
128
162
|
grid-area: control;
|
|
129
163
|
position: relative;
|
|
164
|
+
padding: calc(var(--kit-spacing) * var(--textfield-multiplier-x))
|
|
165
|
+
calc(var(--kit-spacing) * var(--textfield-multiplier-y));
|
|
166
|
+
gap: calc(var(--kit-spacing) * var(--textfield-multiplier-gap));
|
|
130
167
|
}
|
|
131
168
|
|
|
132
169
|
.kit-textfield-control .kit-field .kit-field--field {
|
|
@@ -141,7 +178,6 @@
|
|
|
141
178
|
font: inherit;
|
|
142
179
|
border-radius: 0;
|
|
143
180
|
color: inherit;
|
|
144
|
-
/* opacity: 0; */
|
|
145
181
|
flex: 1;
|
|
146
182
|
min-width: 0;
|
|
147
183
|
align-items: center;
|
|
@@ -163,13 +199,13 @@
|
|
|
163
199
|
|
|
164
200
|
/* message */
|
|
165
201
|
.kit-textfield-message {
|
|
166
|
-
padding-inline:
|
|
202
|
+
padding-inline: var(--textfield-spacing-y);
|
|
167
203
|
align-items: flex-end;
|
|
168
204
|
display: flex;
|
|
169
205
|
font-size: 0.75rem;
|
|
170
206
|
grid-area: messages;
|
|
171
207
|
min-height: 22px;
|
|
172
|
-
padding-top:
|
|
208
|
+
padding-top: var(--textfield-spacing-x);
|
|
173
209
|
overflow: hidden;
|
|
174
210
|
justify-content: space-between;
|
|
175
211
|
opacity: 0;
|
|
@@ -186,6 +222,7 @@
|
|
|
186
222
|
min-width: 1px;
|
|
187
223
|
position: relative;
|
|
188
224
|
display: grid;
|
|
225
|
+
gap: calc(var(--kit-spacing) * var(--textfield-multiplier-gap));
|
|
189
226
|
grid-template-areas: 'message-prepend message message-append ';
|
|
190
227
|
grid-template-columns: max-content minmax(0, 1fr) max-content;
|
|
191
228
|
}
|
|
@@ -214,3 +251,55 @@
|
|
|
214
251
|
.kit-message .kit-message--append {
|
|
215
252
|
grid-area: message-append;
|
|
216
253
|
}
|
|
254
|
+
|
|
255
|
+
/* size */
|
|
256
|
+
.kit-textfield[breakpoint]kit-textfield--size-xs {
|
|
257
|
+
--textfield-multiplier-x: 2;
|
|
258
|
+
--textfield-multiplier-y: 2;
|
|
259
|
+
--textfield-multiplier-gap: 1;
|
|
260
|
+
--textfield-multiplier-font-size: 6;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.kit-textfield[breakpoint]kit-textfield--size-sm {
|
|
264
|
+
--textfield-multiplier-x: 3;
|
|
265
|
+
--textfield-multiplier-y: 4;
|
|
266
|
+
--textfield-multiplier-gap: 2;
|
|
267
|
+
--textfield-multiplier-font-size: 7;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.kit-textfield[breakpoint]kit-textfield--size-md {
|
|
271
|
+
--textfield-multiplier-x: 4;
|
|
272
|
+
--textfield-multiplier-y: 6;
|
|
273
|
+
--textfield-multiplier-gap: 2;
|
|
274
|
+
--textfield-multiplier-font-size: 8;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.kit-textfield[breakpoint]kit-textfield--size-lg {
|
|
278
|
+
--textfield-multiplier-x: 5;
|
|
279
|
+
--textfield-multiplier-y: 6;
|
|
280
|
+
--textfield-multiplier-gap: 2;
|
|
281
|
+
--textfield-multiplier-font-size: 9;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.kit-textfield[breakpoint]kit-textfield--size-xl {
|
|
285
|
+
--textfield-multiplier-x: 6;
|
|
286
|
+
--textfield-multiplier-y: 8;
|
|
287
|
+
--textfield-multiplier-gap: 3;
|
|
288
|
+
--textfield-multiplier-font-size: 10;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/*density */
|
|
292
|
+
.kit-textfield[breakpoint]kit-textfield--density-default {
|
|
293
|
+
--textfield-spacing-x: 0;
|
|
294
|
+
--textfield-spacing-y: calc(var(--kit-spacing) * var(--textfield-multiplier-y));
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.kit-textfield[breakpoint]kit-textfield--density-compact {
|
|
298
|
+
--textfield-spacing-x: calc(0 - 0.5rem);
|
|
299
|
+
--textfield-spacing-y: calc(var(--kit-spacing) * var(--textfield-multiplier-y) - 0.5rem);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.kit-textfield[breakpoint]kit-textfield--density-comfortable {
|
|
303
|
+
--textfield-spacing-x: calc(0 + 0.5rem);
|
|
304
|
+
--textfield-spacing-y: calc(var(--kit-spacing) * var(--textfield-multiplier-y) + 0.5rem);
|
|
305
|
+
}
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
2
|
+
import { getAssets } from '../../internal/index.js';
|
|
3
3
|
import type { TextfieldProps } from './types.js';
|
|
4
4
|
|
|
5
|
+
//external
|
|
6
|
+
import { Icon } from '../index.js';
|
|
7
|
+
|
|
5
8
|
let {
|
|
9
|
+
ref = $bindable(),
|
|
6
10
|
prepend,
|
|
7
11
|
append,
|
|
8
12
|
prependInner,
|
|
9
13
|
appendInner,
|
|
10
14
|
value = $bindable(),
|
|
11
15
|
type = 'text',
|
|
16
|
+
density = 'default',
|
|
17
|
+
size = 'md',
|
|
18
|
+
variant = 'filled',
|
|
12
19
|
placeholder,
|
|
20
|
+
light,
|
|
21
|
+
dark,
|
|
13
22
|
counter,
|
|
14
23
|
min,
|
|
15
24
|
max,
|
|
@@ -26,9 +35,14 @@
|
|
|
26
35
|
persistentMessage,
|
|
27
36
|
hideSpinButtons, // only type="number"
|
|
28
37
|
readonly,
|
|
38
|
+
color,
|
|
39
|
+
background,
|
|
40
|
+
rounded,
|
|
29
41
|
...rest
|
|
30
42
|
}: TextfieldProps = $props();
|
|
31
43
|
|
|
44
|
+
const assets = getAssets();
|
|
45
|
+
|
|
32
46
|
let counterValue: number = $state(0);
|
|
33
47
|
let displayMessage: boolean = $state(false);
|
|
34
48
|
let displayClear: boolean = $state(false);
|
|
@@ -76,17 +90,25 @@
|
|
|
76
90
|
});
|
|
77
91
|
</script>
|
|
78
92
|
|
|
79
|
-
{errorMessage}
|
|
80
93
|
<div
|
|
94
|
+
bind:this={ref}
|
|
81
95
|
{...rest}
|
|
82
96
|
class={[
|
|
83
97
|
'kit-textfield',
|
|
98
|
+
light && 'light',
|
|
99
|
+
dark && 'dark',
|
|
100
|
+
size && assets.className('textfield', 'size', size),
|
|
101
|
+
variant && assets.className('textfield', 'variant', variant),
|
|
102
|
+
density && assets.className('textfield', 'density', density),
|
|
84
103
|
disabled && 'kit-textfield--disabled',
|
|
85
104
|
readonly && 'kit-textfield--readonly',
|
|
86
105
|
error && 'kit-textfield--error',
|
|
87
106
|
type === 'number' && hideSpinButtons && 'kit-textfield--hide-spin-buttons',
|
|
88
107
|
rest.class
|
|
89
108
|
]}
|
|
109
|
+
style:--base={assets.color(background)}
|
|
110
|
+
style:--on={assets.color(color)}
|
|
111
|
+
style:--shape={assets.shape(rounded)}
|
|
90
112
|
>
|
|
91
113
|
{#if prepend}
|
|
92
114
|
<div class="kit-textfield-prepend">
|
|
@@ -160,7 +182,7 @@
|
|
|
160
182
|
{#if counter || messageSuffix}
|
|
161
183
|
<div class="kit-message--append">
|
|
162
184
|
{#if counter}
|
|
163
|
-
{counterValue}
|
|
185
|
+
{counterValue}{max ? `/${max}` : ''}
|
|
164
186
|
{:else if messageSuffix}
|
|
165
187
|
{messageSuffix}
|
|
166
188
|
{/if}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { TextfieldProps } from './types.js';
|
|
2
|
-
declare const Textfield: import("svelte").Component<TextfieldProps, {}, "value">;
|
|
2
|
+
declare const Textfield: import("svelte").Component<TextfieldProps, {}, "value" | "ref">;
|
|
3
3
|
type Textfield = ReturnType<typeof Textfield>;
|
|
4
4
|
export default Textfield;
|
|
@@ -1,10 +1,37 @@
|
|
|
1
1
|
import type { Base } from '../../internal/types.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
2
3
|
export interface TextfieldProps extends Base {
|
|
3
|
-
|
|
4
|
+
ref?: HTMLElement | null;
|
|
5
|
+
dark?: boolean;
|
|
6
|
+
light?: boolean;
|
|
4
7
|
value?: string | number;
|
|
5
8
|
type?: 'text' | 'email' | 'password' | 'number';
|
|
6
9
|
placeholder?: string;
|
|
7
10
|
counter?: boolean;
|
|
8
11
|
min?: number;
|
|
9
12
|
max?: number;
|
|
13
|
+
variant?: 'outline' | 'text' | 'filled';
|
|
14
|
+
density?: 'compact' | 'comfortable' | 'default';
|
|
15
|
+
error?: boolean;
|
|
16
|
+
errorMessage?: string;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
color?: string;
|
|
19
|
+
background?: string;
|
|
20
|
+
size?: string | {
|
|
21
|
+
[key: string]: string;
|
|
22
|
+
};
|
|
23
|
+
readonly?: boolean;
|
|
24
|
+
hideSpinButtons?: boolean;
|
|
25
|
+
persistentMessage?: boolean;
|
|
26
|
+
persistentClear?: boolean;
|
|
27
|
+
clearable?: boolean;
|
|
28
|
+
message?: string;
|
|
29
|
+
messagePrefix?: string;
|
|
30
|
+
messageSuffix?: string;
|
|
31
|
+
append?: Snippet;
|
|
32
|
+
prepend?: Snippet;
|
|
33
|
+
prependInner?: Snippet;
|
|
34
|
+
appendInner?: Snippet;
|
|
35
|
+
prefix?: string;
|
|
36
|
+
suffix?: string;
|
|
10
37
|
}
|