lapikit 0.6.3 → 0.6.4
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/accordion/accordion.svelte +172 -42
- package/dist/components/accordion/accordion.types.d.ts +8 -3
- package/dist/components/accordion/modules/accordion-item.svelte +71 -72
- package/dist/components/alert/alert.svelte +201 -118
- package/dist/components/alert/alert.types.d.ts +8 -6
- package/dist/components/app/app.svelte +4 -4
- package/dist/components/appbar/appbar.svelte +115 -64
- package/dist/components/appbar/appbar.types.d.ts +4 -4
- package/dist/components/aspect-ratio/aspect-ratio.svelte +4 -12
- package/dist/components/aspect-ratio/aspect-ratio.types.d.ts +2 -1
- package/dist/components/avatar/avatar.svelte +108 -66
- package/dist/components/avatar/avatar.types.d.ts +7 -5
- package/dist/components/btn/btn.svelte +167 -169
- package/dist/components/btn/btn.types.d.ts +5 -2
- package/dist/components/chip/chip.svelte +162 -140
- package/dist/components/chip/chip.types.d.ts +7 -3
- package/dist/components/dialog/dialog.svelte +84 -81
- package/dist/components/dialog/dialog.types.d.ts +7 -5
- package/dist/components/dropdown/dropdown.svelte +46 -36
- package/dist/components/dropdown/dropdown.types.d.ts +4 -2
- package/dist/components/icon/icon.svelte +28 -52
- package/dist/components/list/modules/list-item.svelte +0 -55
- package/dist/components/modal/modal.svelte +104 -98
- package/dist/components/modal/modal.types.d.ts +7 -5
- package/dist/components/popover/popover.svelte +46 -34
- package/dist/components/popover/popover.types.d.ts +3 -1
- package/dist/components/separator/separator.svelte +11 -30
- package/dist/components/separator/separator.types.d.ts +1 -2
- package/dist/components/textfield/textfield.svelte +180 -157
- package/dist/components/textfield/textfield.types.d.ts +4 -3
- package/dist/components/toolbar/toolbar.svelte +126 -108
- package/dist/components/toolbar/toolbar.types.d.ts +6 -7
- package/dist/components/tooltip/tooltip.svelte +39 -45
- package/dist/components/tooltip/tooltip.types.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { useClassName, useStyles } from '../../utils';
|
|
2
|
+
import { useClassName, useElevation, useStyles } from '../../utils';
|
|
3
3
|
import { makeComponentProps } from '../../html-mapped';
|
|
4
4
|
import type { AppbarProps } from './appbar.types.js';
|
|
5
5
|
|
|
@@ -12,31 +12,22 @@
|
|
|
12
12
|
's-class': sClass,
|
|
13
13
|
's-style': sStyle,
|
|
14
14
|
classContent,
|
|
15
|
+
size = 'md',
|
|
15
16
|
variant = 'filled',
|
|
16
17
|
rounded = 0,
|
|
17
18
|
background,
|
|
18
19
|
color,
|
|
19
20
|
density = 'default',
|
|
21
|
+
elevation,
|
|
20
22
|
...rest
|
|
21
23
|
}: AppbarProps = $props();
|
|
22
24
|
|
|
23
|
-
let safeVariant = $derived(
|
|
24
|
-
typeof variant === 'string' && (variant === 'outline' || variant === 'text')
|
|
25
|
-
? variant
|
|
26
|
-
: 'filled'
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
let safeDensity = $derived(
|
|
30
|
-
typeof density === 'string' &&
|
|
31
|
-
(density === 'compact' || density === 'comfortable' || density === 'default')
|
|
32
|
-
? density
|
|
33
|
-
: 'default'
|
|
34
|
-
);
|
|
35
|
-
|
|
36
25
|
let { classProps, styleProps, restProps } = $derived(
|
|
37
26
|
makeComponentProps(rest as Record<string, unknown>)
|
|
38
27
|
);
|
|
39
28
|
|
|
29
|
+
let elevationState = $derived(useElevation(elevation));
|
|
30
|
+
|
|
40
31
|
let componentClass = $derived(
|
|
41
32
|
useClassName({
|
|
42
33
|
baseClass: 'kit-appbar',
|
|
@@ -65,16 +56,7 @@
|
|
|
65
56
|
})
|
|
66
57
|
);
|
|
67
58
|
|
|
68
|
-
let mergedStyle = $derived(
|
|
69
|
-
[
|
|
70
|
-
componentStyle,
|
|
71
|
-
background ? `--kit-appbar-bg:${background}` : '',
|
|
72
|
-
color ? `--kit-appbar-fg:${color}` : '',
|
|
73
|
-
typeof rounded === 'string' && rounded.includes('px') ? `--kit-appbar-radius:${rounded}` : ''
|
|
74
|
-
]
|
|
75
|
-
.filter(Boolean)
|
|
76
|
-
.join('; ')
|
|
77
|
-
);
|
|
59
|
+
let mergedStyle = $derived([componentStyle].filter(Boolean).join('; '));
|
|
78
60
|
</script>
|
|
79
61
|
|
|
80
62
|
<svelte:element
|
|
@@ -82,12 +64,18 @@
|
|
|
82
64
|
bind:this={ref}
|
|
83
65
|
class={componentClass}
|
|
84
66
|
style={mergedStyle}
|
|
85
|
-
{
|
|
86
|
-
data-variant={
|
|
87
|
-
data-density={
|
|
67
|
+
data-size={size}
|
|
68
|
+
data-variant={variant}
|
|
69
|
+
data-density={density}
|
|
88
70
|
data-rounded={rounded}
|
|
71
|
+
data-elevation={elevationState.base}
|
|
72
|
+
data-elevation-hover={elevationState.hover}
|
|
73
|
+
data-elevation-active={elevationState.active}
|
|
74
|
+
style:--kit-appbar-fg={color && `var(--kit-color-${color})`}
|
|
75
|
+
style:--kit-appbar-bg={background && `var(--kit-color-${background})`}
|
|
76
|
+
{...restProps}
|
|
89
77
|
>
|
|
90
|
-
{#if
|
|
78
|
+
{#if variant === 'outline'}
|
|
91
79
|
<span class="outline"></span>
|
|
92
80
|
{/if}
|
|
93
81
|
|
|
@@ -98,68 +86,133 @@
|
|
|
98
86
|
|
|
99
87
|
<style>
|
|
100
88
|
.kit-appbar {
|
|
101
|
-
--kit-appbar-bg: var(--kit-surface-2);
|
|
102
|
-
--kit-appbar-fg: var(--kit-fg);
|
|
103
|
-
--kit-appbar-radius: 1rem;
|
|
104
|
-
--kit-appbar-size: 4rem;
|
|
105
|
-
--kit-appbar-padding-x: 1rem;
|
|
106
|
-
--kit-appbar-padding-wrapper: 0;
|
|
107
|
-
--kit-appbar-bd: color-mix(in oklab, var(--kit-appbar-fg), transparent 88%);
|
|
108
|
-
|
|
109
89
|
display: flex;
|
|
110
90
|
align-items: center;
|
|
111
91
|
box-sizing: border-box;
|
|
112
92
|
position: relative;
|
|
113
93
|
width: 100%;
|
|
114
|
-
|
|
115
|
-
|
|
94
|
+
gap: var(--kit-appbar-gap);
|
|
95
|
+
min-height: calc(var(--kit-appbar-h) * var(--kit-appbar-density-h-scale));
|
|
96
|
+
padding: calc(var(--kit-appbar-px) * var(--kit-appbar-density-scale));
|
|
116
97
|
border-radius: var(--kit-appbar-radius);
|
|
117
98
|
color: var(--kit-appbar-fg);
|
|
118
99
|
background-color: var(--kit-appbar-bg);
|
|
119
100
|
overflow: hidden;
|
|
101
|
+
font-size: var(--kit-appbar-font);
|
|
102
|
+
transition:
|
|
103
|
+
background 140ms ease,
|
|
104
|
+
color 140ms ease,
|
|
105
|
+
box-shadow 140ms ease,
|
|
106
|
+
translate 140ms ease;
|
|
120
107
|
}
|
|
121
108
|
|
|
122
|
-
|
|
123
|
-
|
|
109
|
+
/**
|
|
110
|
+
* rounded
|
|
111
|
+
* @link ...
|
|
112
|
+
*/
|
|
113
|
+
.kit-appbar[data-rounded='0'] {
|
|
114
|
+
--kit-appbar-radius: var(--kit-shape-none);
|
|
115
|
+
}
|
|
116
|
+
.kit-appbar[data-rounded='xs'] {
|
|
117
|
+
--kit-appbar-radius: var(--kit-shape-xs);
|
|
118
|
+
}
|
|
119
|
+
.kit-appbar[data-rounded='sm'] {
|
|
120
|
+
--kit-appbar-radius: var(--kit-shape-sm);
|
|
121
|
+
}
|
|
122
|
+
.kit-appbar[data-rounded='md'] {
|
|
123
|
+
--kit-appbar-radius: var(--kit-shape-md);
|
|
124
|
+
}
|
|
125
|
+
.kit-appbar[data-rounded='lg'] {
|
|
126
|
+
--kit-appbar-radius: var(--kit-shape-lg);
|
|
127
|
+
}
|
|
128
|
+
.kit-appbar[data-rounded='xl'] {
|
|
129
|
+
--kit-appbar-radius: var(--kit-shape-xl);
|
|
130
|
+
}
|
|
131
|
+
.kit-appbar[data-rounded='full'] {
|
|
132
|
+
--kit-appbar-radius: var(--kit-shape-full);
|
|
124
133
|
}
|
|
125
134
|
|
|
135
|
+
/**
|
|
136
|
+
* density
|
|
137
|
+
* @link no links
|
|
138
|
+
*/
|
|
139
|
+
.kit-appbar[data-density='none'] {
|
|
140
|
+
--kit-appbar-density-scale: 0;
|
|
141
|
+
--kit-appbar-density-h-scale: 0;
|
|
142
|
+
}
|
|
126
143
|
.kit-appbar[data-density='compact'] {
|
|
127
|
-
--kit-appbar-
|
|
128
|
-
--kit-appbar-
|
|
144
|
+
--kit-appbar-density-scale: 0.9;
|
|
145
|
+
--kit-appbar-density-h-scale: 0.92;
|
|
129
146
|
}
|
|
130
|
-
|
|
131
147
|
.kit-appbar[data-density='default'] {
|
|
132
|
-
--kit-appbar-
|
|
133
|
-
--kit-appbar-
|
|
148
|
+
--kit-appbar-density-scale: 1;
|
|
149
|
+
--kit-appbar-density-h-scale: 1;
|
|
134
150
|
}
|
|
135
|
-
|
|
136
151
|
.kit-appbar[data-density='comfortable'] {
|
|
137
|
-
--kit-appbar-
|
|
138
|
-
--kit-appbar-
|
|
152
|
+
--kit-appbar-density-scale: 1.1;
|
|
153
|
+
--kit-appbar-density-h-scale: 1.15;
|
|
139
154
|
}
|
|
140
155
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
156
|
+
/**
|
|
157
|
+
* variant
|
|
158
|
+
* @link no links...
|
|
159
|
+
*/
|
|
160
|
+
.kit-appbar[data-variant='filled'] {
|
|
161
|
+
--kit-appbar-bg: var(--kit-color-surface-1);
|
|
162
|
+
--kit-appbar-fg: var(--kit-color-text);
|
|
144
163
|
|
|
145
|
-
|
|
146
|
-
--kit-appbar-
|
|
164
|
+
--kit-appbar-hover-bg: color-mix(in oklab, var(--kit-appbar-bg), black 10%);
|
|
165
|
+
--kit-appbar-active-bg: color-mix(in oklab, var(--kit-appbar-bg), black 16%);
|
|
147
166
|
}
|
|
167
|
+
.kit-appbar[data-variant='outline'] {
|
|
168
|
+
--kit-appbar-bg: transparent;
|
|
169
|
+
--kit-appbar-fg: var(--kit-color-text);
|
|
170
|
+
--kit-appbar-bd: var(--kit-appbar-fg);
|
|
148
171
|
|
|
149
|
-
|
|
150
|
-
--kit-appbar-
|
|
172
|
+
--kit-appbar-hover-bg: color-mix(in oklab, var(--kit-appbar-fg), transparent 80%);
|
|
173
|
+
--kit-appbar-active-bg: color-mix(in oklab, var(--kit-appbar-fg), transparent 92%);
|
|
151
174
|
}
|
|
175
|
+
.kit-appbar[data-variant='text'] {
|
|
176
|
+
--kit-appbar-bg: transparent;
|
|
177
|
+
--kit-appbar-fg: var(--kit-color-text);
|
|
152
178
|
|
|
153
|
-
|
|
154
|
-
--kit-appbar-
|
|
179
|
+
--kit-appbar-hover-bg: color-mix(in oklab, var(--kit-appbar-fg), transparent 80%);
|
|
180
|
+
--kit-appbar-active-bg: color-mix(in oklab, var(--kit-appbar-fg), transparent 92%);
|
|
155
181
|
}
|
|
156
182
|
|
|
157
|
-
|
|
158
|
-
|
|
183
|
+
/**
|
|
184
|
+
* size
|
|
185
|
+
* @link nothing...
|
|
186
|
+
*/
|
|
187
|
+
.kit-appbar[data-size='xs'] {
|
|
188
|
+
--kit-appbar-h: 28px;
|
|
189
|
+
--kit-appbar-px: 10px;
|
|
190
|
+
--kit-appbar-gap: 4px;
|
|
191
|
+
--kit-appbar-font: 0.75rem;
|
|
159
192
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
--kit-appbar-
|
|
193
|
+
.kit-appbar[data-size='sm'] {
|
|
194
|
+
--kit-appbar-h: 32px;
|
|
195
|
+
--kit-appbar-px: 12px;
|
|
196
|
+
--kit-appbar-gap: 6px;
|
|
197
|
+
--kit-appbar-font: 0.875rem;
|
|
198
|
+
}
|
|
199
|
+
.kit-appbar[data-size='md'] {
|
|
200
|
+
--kit-appbar-h: 40px;
|
|
201
|
+
--kit-appbar-px: 14px;
|
|
202
|
+
--kit-appbar-gap: 8px;
|
|
203
|
+
--kit-appbar-font: 1rem;
|
|
204
|
+
}
|
|
205
|
+
.kit-appbar[data-size='lg'] {
|
|
206
|
+
--kit-appbar-h: 48px;
|
|
207
|
+
--kit-appbar-px: 16px;
|
|
208
|
+
--kit-appbar-gap: 10px;
|
|
209
|
+
--kit-appbar-font: 1.125rem;
|
|
210
|
+
}
|
|
211
|
+
.kit-appbar[data-size='xl'] {
|
|
212
|
+
--kit-appbar-h: 56px;
|
|
213
|
+
--kit-appbar-px: 18px;
|
|
214
|
+
--kit-appbar-gap: 12px;
|
|
215
|
+
--kit-appbar-font: 1.25rem;
|
|
163
216
|
}
|
|
164
217
|
|
|
165
218
|
.kit-appbar__wrapper {
|
|
@@ -175,7 +228,5 @@
|
|
|
175
228
|
|
|
176
229
|
.kit-appbar .outline {
|
|
177
230
|
--outline-color: var(--kit-appbar-bd);
|
|
178
|
-
|
|
179
|
-
pointer-events: none;
|
|
180
231
|
}
|
|
181
232
|
</style>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { Component, RoundedType } from '../../@types';
|
|
2
|
-
type Density = 'compact' | 'comfortable' | 'default';
|
|
1
|
+
import type { Component, DensityType, ElevationProps, RoundedType } from '../../@types';
|
|
3
2
|
type Variant = 'filled' | 'outline' | 'text';
|
|
4
3
|
export interface AppbarProps extends Component {
|
|
5
4
|
ref?: HTMLElement | null;
|
|
6
5
|
is?: 'div' | 'header' | 'nav';
|
|
7
6
|
variant?: Variant;
|
|
8
|
-
rounded?: RoundedType |
|
|
9
|
-
density?:
|
|
7
|
+
rounded?: RoundedType | 'full';
|
|
8
|
+
density?: DensityType;
|
|
10
9
|
color?: string;
|
|
11
10
|
background?: string;
|
|
12
11
|
classContent?: string | string[] | undefined;
|
|
12
|
+
elevation?: ElevationProps;
|
|
13
13
|
}
|
|
14
14
|
export {};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { useClassName, useStyles } from '../../utils';
|
|
3
3
|
import { makeComponentProps } from '../../html-mapped';
|
|
4
|
-
import type {
|
|
4
|
+
import type { AspectRatioProps, AspectRatioValue } from './aspect-ratio.types.js';
|
|
5
5
|
|
|
6
6
|
const FALLBACK_RATIO = 16 / 9;
|
|
7
|
-
const FALLBACK_FIT: AspectRatioFit = 'cover';
|
|
8
7
|
|
|
9
8
|
function resolveRatio(value: AspectRatioValue | undefined): number {
|
|
10
9
|
if (typeof value === 'number') {
|
|
@@ -33,10 +32,6 @@
|
|
|
33
32
|
return Number.isFinite(asNumber) && asNumber > 0 ? asNumber : FALLBACK_RATIO;
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
function resolveFit(value: AspectRatioFit | undefined): AspectRatioFit {
|
|
37
|
-
return value === 'cover' || value === 'contain' || value === 'fill' ? value : FALLBACK_FIT;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
35
|
let {
|
|
41
36
|
ref = $bindable(),
|
|
42
37
|
is = 'div',
|
|
@@ -74,12 +69,7 @@
|
|
|
74
69
|
);
|
|
75
70
|
|
|
76
71
|
let resolvedRatio = $derived(resolveRatio(ratio ?? aspectRatio));
|
|
77
|
-
let
|
|
78
|
-
let mergedStyle = $derived(
|
|
79
|
-
[componentStyle, `--kit-aspect-ratio: ${resolvedRatio}`, `--kit-aspect-fit: ${resolvedFit}`]
|
|
80
|
-
.filter(Boolean)
|
|
81
|
-
.join('; ')
|
|
82
|
-
);
|
|
72
|
+
let mergedStyle = $derived([componentStyle].filter(Boolean).join('; '));
|
|
83
73
|
</script>
|
|
84
74
|
|
|
85
75
|
<svelte:element
|
|
@@ -88,6 +78,8 @@
|
|
|
88
78
|
class={componentClass}
|
|
89
79
|
style={mergedStyle}
|
|
90
80
|
data-inline={inline}
|
|
81
|
+
style:--kit-aspect-ratio={resolvedRatio}
|
|
82
|
+
style:--kit-aspect-fit={fit}
|
|
91
83
|
{...restProps}
|
|
92
84
|
>
|
|
93
85
|
<div class="kit-aspect-ratio__inner">
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Component } from '../../@types';
|
|
2
2
|
export type AspectRatioValue = string | number;
|
|
3
|
-
|
|
3
|
+
type AspectRatioFit = 'cover' | 'contain' | 'fill';
|
|
4
4
|
export interface AspectRatioProps extends Component {
|
|
5
5
|
ref?: HTMLElement | null;
|
|
6
6
|
is?: 'div' | 'span' | 'figure' | 'section' | 'article';
|
|
@@ -9,3 +9,4 @@ export interface AspectRatioProps extends Component {
|
|
|
9
9
|
fit?: AspectRatioFit;
|
|
10
10
|
inline?: boolean;
|
|
11
11
|
}
|
|
12
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { useClassName, useStyles } from '../../utils';
|
|
2
|
+
import { useClassName, useElevation, useStyles } from '../../utils';
|
|
3
3
|
import { makeComponentProps } from '../../html-mapped';
|
|
4
4
|
import type { AvatarProps } from './avatar.types.js';
|
|
5
5
|
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
label = undefined,
|
|
14
14
|
size = 'md',
|
|
15
15
|
density = 'default',
|
|
16
|
+
rounded = 'full',
|
|
17
|
+
elevation,
|
|
18
|
+
color,
|
|
19
|
+
background,
|
|
16
20
|
...rest
|
|
17
21
|
}: AvatarProps = $props();
|
|
18
22
|
|
|
@@ -37,20 +41,7 @@
|
|
|
37
41
|
})
|
|
38
42
|
);
|
|
39
43
|
|
|
40
|
-
let
|
|
41
|
-
size === 'default'
|
|
42
|
-
? 'md'
|
|
43
|
-
: size === 'xs' || size === 'sm' || size === 'md' || size === 'lg' || size === 'xl'
|
|
44
|
-
? size
|
|
45
|
-
: 'md'
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
let safeDensity = $derived(
|
|
49
|
-
density === 'compact' || density === 'comfortable' || density === 'default'
|
|
50
|
-
? density
|
|
51
|
-
: 'default'
|
|
52
|
-
);
|
|
53
|
-
|
|
44
|
+
let elevationState = $derived(useElevation(elevation));
|
|
54
45
|
let contentType = $derived(label && label.trim().length > 0 ? 'label' : children);
|
|
55
46
|
let displayLabel = $derived(label?.trim() ?? '');
|
|
56
47
|
</script>
|
|
@@ -60,10 +51,16 @@
|
|
|
60
51
|
bind:this={ref}
|
|
61
52
|
class={componentClass}
|
|
62
53
|
style={componentStyle}
|
|
63
|
-
{...restProps}
|
|
64
54
|
data-type={contentType}
|
|
65
|
-
data-size={contentType === 'label' ?
|
|
66
|
-
data-density={contentType === 'label' ?
|
|
55
|
+
data-size={contentType === 'label' ? size : undefined}
|
|
56
|
+
data-density={contentType === 'label' ? density : undefined}
|
|
57
|
+
data-rounded={rounded}
|
|
58
|
+
data-elevation={elevationState.base}
|
|
59
|
+
data-elevation-hover={elevationState.hover}
|
|
60
|
+
data-elevation-active={elevationState.active}
|
|
61
|
+
style:--kit-avatar-fg={color && `var(--kit-color-${color})`}
|
|
62
|
+
style:--kit-avatar-bg={background && `var(--kit-color-${background})`}
|
|
63
|
+
{...restProps}
|
|
67
64
|
>
|
|
68
65
|
{#if contentType === 'label'}
|
|
69
66
|
<span class="kit-avatar__label">{displayLabel}</span>
|
|
@@ -74,32 +71,25 @@
|
|
|
74
71
|
|
|
75
72
|
<style>
|
|
76
73
|
.kit-avatar {
|
|
77
|
-
--kit-avatar-size-xs: 1.75rem;
|
|
78
|
-
--kit-avatar-size-sm: 2rem;
|
|
79
|
-
--kit-avatar-size-md: 2.25rem;
|
|
80
|
-
--kit-avatar-size-lg: 2.5rem;
|
|
81
|
-
--kit-avatar-size-xl: 2.75rem;
|
|
82
|
-
--kit-avatar-font-xs: 0.75rem;
|
|
83
|
-
--kit-avatar-font-sm: 0.8125rem;
|
|
84
|
-
--kit-avatar-font-md: 0.875rem;
|
|
85
|
-
--kit-avatar-font-lg: 1rem;
|
|
86
|
-
--kit-avatar-font-xl: 1.125rem;
|
|
87
|
-
--kit-avatar-size: var(--kit-avatar-size-md);
|
|
88
|
-
--kit-avatar-font-size: var(--kit-avatar-font-md);
|
|
89
|
-
--kit-avatar-density-scale: 1;
|
|
90
|
-
|
|
91
74
|
display: inline-flex;
|
|
92
75
|
align-items: center;
|
|
93
76
|
justify-content: center;
|
|
94
|
-
width: calc(var(--kit-avatar-
|
|
95
|
-
height: calc(var(--kit-avatar-
|
|
96
|
-
|
|
77
|
+
width: calc(var(--kit-avatar-h) * var(--kit-avatar-density-h-scale));
|
|
78
|
+
height: calc(var(--kit-avatar-h) * var(--kit-avatar-density-h-scale));
|
|
79
|
+
padding: calc(var(--kit-avatar-px) * var(--kit-avatar-density-scale));
|
|
97
80
|
overflow: hidden;
|
|
98
|
-
background: var(--kit-surface-
|
|
99
|
-
color: var(--kit-
|
|
81
|
+
background: var(--kit-color-surface-3);
|
|
82
|
+
color: var(--kit-color-text);
|
|
83
|
+
border-radius: var(--kit-avatar-radius);
|
|
84
|
+
border: 0;
|
|
100
85
|
font-weight: 600;
|
|
101
86
|
line-height: 1;
|
|
102
87
|
user-select: none;
|
|
88
|
+
transition:
|
|
89
|
+
background 140ms ease,
|
|
90
|
+
color 140ms ease,
|
|
91
|
+
box-shadow 140ms ease,
|
|
92
|
+
translate 140ms ease;
|
|
103
93
|
}
|
|
104
94
|
|
|
105
95
|
.kit-avatar[data-type='label'] {
|
|
@@ -107,49 +97,101 @@
|
|
|
107
97
|
text-transform: uppercase;
|
|
108
98
|
}
|
|
109
99
|
|
|
110
|
-
.kit-
|
|
111
|
-
|
|
112
|
-
|
|
100
|
+
.kit-avatar__label {
|
|
101
|
+
display: inline-flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
justify-content: center;
|
|
104
|
+
max-width: 100%;
|
|
105
|
+
padding-inline: 0.25rem;
|
|
113
106
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
107
|
+
|
|
108
|
+
.kit-avatar :global(img) {
|
|
109
|
+
display: block;
|
|
110
|
+
width: 100%;
|
|
111
|
+
height: 100%;
|
|
112
|
+
object-fit: cover;
|
|
117
113
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* rounded
|
|
117
|
+
* @link ...
|
|
118
|
+
*/
|
|
119
|
+
.kit-avatar[data-rounded='0'] {
|
|
120
|
+
--kit-avatar-radius: var(--kit-shape-none);
|
|
121
121
|
}
|
|
122
|
-
.kit-avatar[data-
|
|
123
|
-
--kit-avatar-
|
|
124
|
-
--kit-avatar-font-size: var(--kit-avatar-font-lg);
|
|
122
|
+
.kit-avatar[data-rounded='xs'] {
|
|
123
|
+
--kit-avatar-radius: var(--kit-shape-xs);
|
|
125
124
|
}
|
|
126
|
-
.kit-avatar[data-
|
|
127
|
-
--kit-avatar-
|
|
128
|
-
|
|
125
|
+
.kit-avatar[data-rounded='sm'] {
|
|
126
|
+
--kit-avatar-radius: var(--kit-shape-sm);
|
|
127
|
+
}
|
|
128
|
+
.kit-avatar[data-rounded='md'] {
|
|
129
|
+
--kit-avatar-radius: var(--kit-shape-md);
|
|
130
|
+
}
|
|
131
|
+
.kit-avatar[data-rounded='lg'] {
|
|
132
|
+
--kit-avatar-radius: var(--kit-shape-lg);
|
|
133
|
+
}
|
|
134
|
+
.kit-avatar[data-rounded='xl'] {
|
|
135
|
+
--kit-avatar-radius: var(--kit-shape-xl);
|
|
129
136
|
}
|
|
130
137
|
|
|
138
|
+
.kit-avatar[data-rounded='full'] {
|
|
139
|
+
--kit-avatar-radius: var(--kit-shape-full);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* density
|
|
144
|
+
* @link ...
|
|
145
|
+
*/
|
|
146
|
+
.kit-avatar[data-density='none'] {
|
|
147
|
+
--kit-avatar-density-scale: 0;
|
|
148
|
+
--kit-avatar-density-h-scale: 0;
|
|
149
|
+
}
|
|
131
150
|
.kit-avatar[data-density='compact'] {
|
|
132
|
-
--kit-avatar-density-scale: 0.
|
|
151
|
+
--kit-avatar-density-scale: 0.8;
|
|
152
|
+
--kit-avatar-density-h-scale: 0.92;
|
|
133
153
|
}
|
|
134
154
|
.kit-avatar[data-density='default'] {
|
|
135
155
|
--kit-avatar-density-scale: 1;
|
|
156
|
+
--kit-avatar-density-h-scale: 1;
|
|
136
157
|
}
|
|
137
158
|
.kit-avatar[data-density='comfortable'] {
|
|
138
|
-
--kit-
|
|
159
|
+
--kit-list-density-scale: 1.1;
|
|
160
|
+
--kit-avatar-density-h-scale: 1.15;
|
|
139
161
|
}
|
|
140
162
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
163
|
+
/**
|
|
164
|
+
* size
|
|
165
|
+
* @link nothing...
|
|
166
|
+
*/
|
|
167
|
+
.kit-avatar[data-size='xs'] {
|
|
168
|
+
--kit-avatar-h: 28px;
|
|
169
|
+
--kit-avatar-px: 10px;
|
|
170
|
+
--kit-avatar-gap: 4px;
|
|
171
|
+
--kit-avatar-font: 0.75rem;
|
|
147
172
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
173
|
+
.kit-avatar[data-size='sm'] {
|
|
174
|
+
--kit-avatar-h: 32px;
|
|
175
|
+
--kit-avatar-px: 12px;
|
|
176
|
+
--kit-avatar-gap: 6px;
|
|
177
|
+
--kit-avatar-font: 0.875rem;
|
|
178
|
+
}
|
|
179
|
+
.kit-avatar[data-size='md'] {
|
|
180
|
+
--kit-avatar-h: 40px;
|
|
181
|
+
--kit-avatar-px: 16px;
|
|
182
|
+
--kit-avatar-gap: 8px;
|
|
183
|
+
--kit-avatar-font: 1rem;
|
|
184
|
+
}
|
|
185
|
+
.kit-avatar[data-size='lg'] {
|
|
186
|
+
--kit-avatar-h: 48px;
|
|
187
|
+
--kit-avatar-px: 20px;
|
|
188
|
+
--kit-avatar-gap: 10px;
|
|
189
|
+
--kit-avatar-font: 1.125rem;
|
|
190
|
+
}
|
|
191
|
+
.kit-avatar[data-size='xl'] {
|
|
192
|
+
--kit-avatar-h: 56px;
|
|
193
|
+
--kit-avatar-px: 24px;
|
|
194
|
+
--kit-avatar-gap: 12px;
|
|
195
|
+
--kit-avatar-font: 1.25rem;
|
|
154
196
|
}
|
|
155
197
|
</style>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type { Component } from '../../@types';
|
|
2
|
-
export type AvatarSize = 'default' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
3
|
-
export type AvatarDensity = 'compact' | 'comfortable' | 'default';
|
|
1
|
+
import type { Component, DensityType, ElevationProps, RoundedType, SizeType } from '../../@types';
|
|
4
2
|
export interface AvatarProps extends Component {
|
|
5
3
|
ref?: HTMLElement | null;
|
|
6
4
|
label?: string;
|
|
7
|
-
size?:
|
|
8
|
-
density?:
|
|
5
|
+
size?: SizeType;
|
|
6
|
+
density?: DensityType;
|
|
7
|
+
rounded?: RoundedType | 'full';
|
|
8
|
+
elevation?: ElevationProps;
|
|
9
|
+
color?: string;
|
|
10
|
+
background?: string;
|
|
9
11
|
}
|