lapikit 0.7.3 → 0.7.5
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/@types/components.d.ts +1 -7
- package/dist/@types/dom.d.ts +4 -3
- package/dist/@types/props.d.ts +3 -3
- package/dist/animations/ripple.js +8 -2
- package/dist/components/accordion/accordion.svelte +192 -228
- package/dist/components/accordion/accordion.types.d.ts +5 -7
- package/dist/components/accordion/modules/accordion-item.svelte +144 -140
- package/dist/components/alert/alert.svelte +246 -293
- package/dist/components/alert/alert.types.d.ts +5 -5
- package/dist/components/app/app.svelte +25 -43
- package/dist/components/appbar/appbar.svelte +205 -190
- package/dist/components/appbar/appbar.types.d.ts +6 -6
- package/dist/components/aspect-ratio/aspect-ratio.svelte +43 -63
- package/dist/components/avatar/avatar.svelte +169 -161
- package/dist/components/avatar/avatar.types.d.ts +3 -4
- package/dist/components/btn/btn.svelte +432 -466
- package/dist/components/btn/btn.types.d.ts +5 -6
- package/dist/components/card/card.svelte +24 -23
- package/dist/components/card/card.types.d.ts +2 -2
- package/dist/components/card/modules/card-content.svelte +4 -1
- package/dist/components/card/modules/card-title.svelte +4 -1
- package/dist/components/chip/chip.svelte +416 -464
- package/dist/components/chip/chip.types.d.ts +5 -5
- package/dist/components/dialog/dialog.svelte +184 -175
- package/dist/components/dialog/dialog.types.d.ts +6 -6
- package/dist/components/dropdown/dropdown.svelte +149 -144
- package/dist/components/dropdown/dropdown.types.d.ts +4 -11
- package/dist/components/field/field.svelte +474 -0
- package/dist/components/field/field.svelte.d.ts +4 -0
- package/dist/components/field/field.types.d.ts +46 -0
- package/dist/components/field/field.types.js +1 -0
- package/dist/components/icon/icon.svelte +67 -96
- package/dist/components/icon/icon.types.d.ts +2 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -0
- package/dist/components/list/list.svelte +193 -194
- package/dist/components/list/list.types.d.ts +5 -7
- package/dist/components/list/modules/list-item.svelte +134 -147
- package/dist/components/modal/modal.js +9 -9
- package/dist/components/modal/modal.svelte +239 -222
- package/dist/components/modal/modal.types.d.ts +6 -6
- package/dist/components/popover/popover.svelte +125 -127
- package/dist/components/popover/popover.types.d.ts +4 -11
- package/dist/components/separator/separator.svelte +56 -87
- package/dist/components/separator/separator.types.d.ts +1 -1
- package/dist/components/spacer/spacer.svelte +6 -25
- package/dist/components/textfield/textfield.svelte +94 -543
- package/dist/components/textfield/textfield.types.d.ts +13 -33
- package/dist/components/toolbar/toolbar.svelte +216 -211
- package/dist/components/toolbar/toolbar.types.d.ts +8 -9
- package/dist/components/tooltip/tooltip.svelte +201 -266
- package/dist/components/tooltip/tooltip.types.d.ts +3 -10
- package/dist/constants.js +1 -0
- package/dist/escaping.js +0 -1
- package/dist/html-mapped.d.ts +1 -15
- package/dist/html-mapped.js +0 -19
- package/dist/labs/sheet/sheet.svelte +27 -22
- package/dist/utils/color.d.ts +2 -2
- package/dist/utils/color.js +2 -1
- package/dist/utils/components.d.ts +10 -10
- package/dist/utils/components.js +16 -75
- package/dist/utils/floating.d.ts +58 -0
- package/dist/utils/floating.js +131 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/outside.d.ts +3 -1
- package/dist/utils/outside.js +15 -3
- package/package.json +6 -3
- package/dist/components/dropdown/dropdown.svelte.js +0 -148
- package/dist/components/popover/popover.svelte.js +0 -134
- package/dist/components/tooltip/tooltip.svelte.js +0 -131
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import { makeComponentProps } from '../../html-mapped';
|
|
4
|
-
import { getPositions } from './popover.svelte.js';
|
|
2
|
+
import { clickOutside, floating, useComponentAttrs, useElevation } from '../../utils';
|
|
5
3
|
import type { ModelPopoverProps, PopoverProps } from './popover.types.js';
|
|
6
4
|
|
|
7
5
|
let {
|
|
@@ -12,9 +10,8 @@
|
|
|
12
10
|
rounded = 'md',
|
|
13
11
|
position = 'bottom',
|
|
14
12
|
color,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
style: styleAttr = '',
|
|
13
|
+
class: className,
|
|
14
|
+
style: styleAttr,
|
|
18
15
|
's-class': sClass,
|
|
19
16
|
's-style': sStyle,
|
|
20
17
|
elevation = '2',
|
|
@@ -22,84 +19,36 @@
|
|
|
22
19
|
...rest
|
|
23
20
|
}: PopoverProps = $props();
|
|
24
21
|
|
|
25
|
-
let
|
|
26
|
-
|
|
22
|
+
let attrs = $derived(
|
|
23
|
+
useComponentAttrs('kit-popover-content', { className, sClass, styleAttr, sStyle, color }, rest)
|
|
27
24
|
);
|
|
28
|
-
|
|
29
25
|
let elevationState = $derived(useElevation(elevation));
|
|
30
26
|
|
|
31
|
-
let componentClass = $derived(
|
|
32
|
-
useClassName({
|
|
33
|
-
baseClass: 'kit-popover-content',
|
|
34
|
-
className: `${className ?? ''}`.trim(),
|
|
35
|
-
sClass,
|
|
36
|
-
classProps
|
|
37
|
-
})
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
let componentStyle = $derived(
|
|
41
|
-
useStyles({
|
|
42
|
-
styleAttr,
|
|
43
|
-
sStyle,
|
|
44
|
-
styleProps
|
|
45
|
-
})
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
const positioner = getPositions();
|
|
49
|
-
|
|
50
27
|
let contentRef = $state<HTMLElement | null>(null);
|
|
51
28
|
let activatorRef = $state<HTMLElement | null>(null);
|
|
52
|
-
let axis = $state(positioner.values);
|
|
53
|
-
|
|
54
|
-
const handleToggle = (element: HTMLElement | null) => {
|
|
55
|
-
if (element === null) return;
|
|
56
|
-
activatorRef = element;
|
|
57
|
-
open = !open;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
let model: ModelPopoverProps = {
|
|
61
|
-
toggle: (element) => handleToggle(element)
|
|
62
|
-
};
|
|
63
29
|
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
30
|
+
const model: ModelPopoverProps = {
|
|
31
|
+
toggle: (element) => {
|
|
32
|
+
if (element === null) return;
|
|
33
|
+
activatorRef = element;
|
|
34
|
+
open = !open;
|
|
35
|
+
}
|
|
68
36
|
};
|
|
69
37
|
|
|
70
38
|
$effect(() => {
|
|
71
|
-
|
|
72
|
-
updatePosition();
|
|
73
|
-
}
|
|
39
|
+
ref = contentRef;
|
|
74
40
|
});
|
|
75
41
|
|
|
76
42
|
$effect(() => {
|
|
77
43
|
if (!open) return;
|
|
78
44
|
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
window.addEventListener('scroll', close, { passive: true });
|
|
82
|
-
window.addEventListener('resize', updatePosition);
|
|
83
|
-
|
|
84
|
-
return () => {
|
|
85
|
-
window.removeEventListener('scroll', close);
|
|
86
|
-
window.removeEventListener('resize', updatePosition);
|
|
45
|
+
const onKeydown = (event: KeyboardEvent) => {
|
|
46
|
+
if (event.key === 'Escape') open = false;
|
|
87
47
|
};
|
|
88
|
-
});
|
|
89
48
|
|
|
90
|
-
|
|
91
|
-
|
|
49
|
+
document.addEventListener('keydown', onKeydown);
|
|
50
|
+
return () => document.removeEventListener('keydown', onKeydown);
|
|
92
51
|
});
|
|
93
|
-
|
|
94
|
-
let resolvedStyle = $derived(
|
|
95
|
-
[
|
|
96
|
-
componentStyle,
|
|
97
|
-
color ? `--kit-popover-fg:${color && `var(--kit-color-${color})`}` : '',
|
|
98
|
-
background ? `--kit-popover-bg:${background && `var(--kit-color-${background})`}` : ''
|
|
99
|
-
]
|
|
100
|
-
.filter(Boolean)
|
|
101
|
-
.join('; ')
|
|
102
|
-
);
|
|
103
52
|
</script>
|
|
104
53
|
|
|
105
54
|
{@render activator?.(model)}
|
|
@@ -107,75 +56,124 @@
|
|
|
107
56
|
{#if open}
|
|
108
57
|
<div
|
|
109
58
|
bind:this={contentRef}
|
|
110
|
-
|
|
111
|
-
|
|
59
|
+
popover="manual"
|
|
60
|
+
class={attrs.class}
|
|
61
|
+
style={attrs.style}
|
|
112
62
|
role="dialog"
|
|
113
63
|
data-rounded={rounded}
|
|
114
|
-
data-position={axis.location ?? position}
|
|
115
64
|
data-density={density}
|
|
116
65
|
data-elevation={elevationState.base}
|
|
117
66
|
data-elevation-hover={elevationState.hover}
|
|
118
67
|
data-elevation-active={elevationState.active}
|
|
68
|
+
use:floating={{ anchor: activatorRef, side: position, offset: 6 }}
|
|
119
69
|
use:clickOutside={{ exclude: [contentRef, activatorRef], onClose: () => (open = false) }}
|
|
120
|
-
{...
|
|
70
|
+
{...attrs.rest}
|
|
121
71
|
>
|
|
122
72
|
{@render children?.()}
|
|
123
73
|
</div>
|
|
124
74
|
{/if}
|
|
125
75
|
|
|
126
|
-
<style
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
76
|
+
<style>:where(.kit-popover-content) {
|
|
77
|
+
--kit-popover-content-color: initial;
|
|
78
|
+
--kit-popover-content-on-color: initial;
|
|
79
|
+
--kit-popover-content-active-fg: initial;
|
|
80
|
+
--kit-popover-content-active-shade: initial;
|
|
81
|
+
--kit-popover-content-hover-fg: initial;
|
|
82
|
+
--kit-popover-content-pressed-fg: initial;
|
|
83
|
+
--kit-popover-content-bg: var(--kit-popover-content-color, var(--kit-color-surface-3));
|
|
84
|
+
--kit-popover-content-fg: var(--kit-popover-content-on-color, var(--kit-popover-content-contrast, var(--kit-color-text)));
|
|
85
|
+
--kit-popover-content-ink: var(--kit-popover-content-color, var(--kit-color-text));
|
|
86
|
+
--kit-popover-content-hover: color-mix(in oklab, var(--kit-popover-content-bg), var(--kit-popover-content-fg) 8%);
|
|
87
|
+
--kit-popover-content-pressed: color-mix(in oklab, var(--kit-popover-content-bg), var(--kit-popover-content-fg) 14%);
|
|
88
|
+
--kit-popover-content-soft: color-mix(in oklab, var(--kit-popover-content-bg) 16%, transparent);
|
|
89
|
+
--kit-popover-content-border: color-mix(in oklab, var(--kit-popover-content-bg), var(--kit-popover-content-fg) 20%);
|
|
90
|
+
--kit-popover-content-active: color-mix(
|
|
91
|
+
in oklab,
|
|
92
|
+
var(--kit-popover-content-color),
|
|
93
|
+
var(--kit-popover-content-fg) var(--kit-popover-content-active-shade, 14%)
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
@supports (color: color(from red srgb-linear r g b)) {
|
|
97
|
+
:where(.kit-popover-content) {
|
|
98
|
+
--kit-popover-content-contrast: color(from var(--kit-popover-content-color) srgb-linear clamp(0, (0.1791 - (0.2126 * r + 0.7152 * g + 0.0722 * b)) * 100000, 1) clamp(0, (0.1791 - (0.2126 * r + 0.7152 * g + 0.0722 * b)) * 100000, 1) clamp(0, (0.1791 - (0.2126 * r + 0.7152 * g + 0.0722 * b)) * 100000, 1)/1);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.kit-popover-content {
|
|
103
|
+
position: fixed;
|
|
104
|
+
inset: auto;
|
|
105
|
+
z-index: 1900;
|
|
106
|
+
display: inline-block;
|
|
107
|
+
box-sizing: border-box;
|
|
108
|
+
width: auto;
|
|
109
|
+
max-width: min(28rem, 100vw - 1rem);
|
|
110
|
+
margin: 0;
|
|
111
|
+
padding: calc(var(--kit-space-default) + var(--kit-popover-content-density-offset) / 2);
|
|
112
|
+
overflow: visible;
|
|
113
|
+
border: 0;
|
|
114
|
+
border-radius: var(--kit-popover-content-radius);
|
|
115
|
+
background-color: var(--kit-popover-content-bg);
|
|
116
|
+
color: var(--kit-popover-content-fg);
|
|
117
|
+
animation: kit-popover-enter 140ms ease;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@keyframes kit-popover-enter {
|
|
121
|
+
from {
|
|
122
|
+
opacity: 0;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* rounded
|
|
127
|
+
* @link https://lapikit.dev/docs/customize
|
|
128
|
+
*/
|
|
129
|
+
:where(.kit-popover-content[data-rounded="0"]) {
|
|
130
|
+
--kit-popover-content-radius: var(--kit-shape-none);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
:where(.kit-popover-content[data-rounded=xs]) {
|
|
134
|
+
--kit-popover-content-radius: var(--kit-shape-xs);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
:where(.kit-popover-content[data-rounded=sm]) {
|
|
138
|
+
--kit-popover-content-radius: var(--kit-shape-sm);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
:where(.kit-popover-content[data-rounded=md]) {
|
|
142
|
+
--kit-popover-content-radius: var(--kit-shape-md);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
:where(.kit-popover-content[data-rounded=lg]) {
|
|
146
|
+
--kit-popover-content-radius: var(--kit-shape-lg);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
:where(.kit-popover-content[data-rounded=xl]) {
|
|
150
|
+
--kit-popover-content-radius: var(--kit-shape-xl);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
:where(.kit-popover-content[data-rounded=full]) {
|
|
154
|
+
--kit-popover-content-radius: var(--kit-shape-full);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* density
|
|
159
|
+
* @link https://lapikit.dev/docs/components/popover#density
|
|
160
|
+
*/
|
|
161
|
+
:where(.kit-popover-content[data-density=dense]) {
|
|
162
|
+
--kit-popover-content-density-offset: var(--kit-density-dense);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
:where(.kit-popover-content[data-density=compact]) {
|
|
166
|
+
--kit-popover-content-density-offset: var(--kit-density-compact);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
:where(.kit-popover-content[data-density=default]) {
|
|
170
|
+
--kit-popover-content-density-offset: var(--kit-density-default);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
:where(.kit-popover-content[data-density=comfortable]) {
|
|
174
|
+
--kit-popover-content-density-offset: var(--kit-density-comfortable);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
:where(.kit-popover-content[data-density=spacious]) {
|
|
178
|
+
--kit-popover-content-density-offset: var(--kit-density-spacious);
|
|
179
|
+
}</style>
|
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ColorProps, Component, ElevationProps, RoundedType } from '../../@types';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
export type PositionElement = {
|
|
4
|
-
x: number;
|
|
5
|
-
y: number;
|
|
6
|
-
location: 'top' | 'bottom' | 'left' | 'right' | null;
|
|
7
|
-
};
|
|
8
3
|
export type ModelPopoverProps = {
|
|
9
4
|
toggle: (element: HTMLElement | null) => void;
|
|
10
5
|
};
|
|
11
6
|
export interface PopoverProps extends Component {
|
|
12
7
|
ref?: HTMLElement | null;
|
|
13
8
|
open?: boolean;
|
|
14
|
-
rounded?: RoundedType;
|
|
9
|
+
rounded?: RoundedType | 'full';
|
|
15
10
|
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
16
|
-
color?:
|
|
17
|
-
background?: string;
|
|
11
|
+
color?: ColorProps;
|
|
18
12
|
activator?: Snippet<[ModelPopoverProps]>;
|
|
19
13
|
elevation?: ElevationProps;
|
|
20
|
-
density?:
|
|
21
|
-
[key: string]: PropValue | Record<string, PropValue> | unknown;
|
|
14
|
+
density?: 'dense' | 'compact' | 'default' | 'comfortable' | 'spacious';
|
|
22
15
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import { makeComponentProps } from '../../html-mapped';
|
|
2
|
+
import { useComponentAttrs } from '../../utils';
|
|
4
3
|
import type { SeparatorProps } from './separator.types.js';
|
|
5
4
|
|
|
6
5
|
let {
|
|
@@ -10,104 +9,74 @@
|
|
|
10
9
|
thickness = 'thin',
|
|
11
10
|
orientation = 'horizontal',
|
|
12
11
|
color,
|
|
13
|
-
class: className
|
|
14
|
-
style: styleAttr
|
|
12
|
+
class: className,
|
|
13
|
+
style: styleAttr,
|
|
15
14
|
's-class': sClass,
|
|
16
15
|
's-style': sStyle,
|
|
17
16
|
...rest
|
|
18
17
|
}: SeparatorProps = $props();
|
|
19
18
|
|
|
20
|
-
let
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
let componentStyle = $derived(
|
|
34
|
-
useStyles({
|
|
35
|
-
styleAttr,
|
|
36
|
-
sStyle,
|
|
37
|
-
styleProps
|
|
38
|
-
})
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const formatThickness = (value?: number | string) =>
|
|
42
|
-
typeof thickness === 'number' ? `${value}px` : value;
|
|
43
|
-
|
|
44
|
-
let resolvedStyle = $derived(
|
|
45
|
-
[
|
|
46
|
-
componentStyle,
|
|
47
|
-
color ? `--kit-separator-fg:${color && `var(--kit-color-${color})`}` : '',
|
|
48
|
-
thickness && orientation === 'horizontal'
|
|
49
|
-
? `--kit-separator-top-width:${formatThickness(thickness)}`
|
|
50
|
-
: '',
|
|
51
|
-
thickness && orientation === 'vertical'
|
|
52
|
-
? `--kit-separator-right-width:${formatThickness(thickness)}`
|
|
53
|
-
: ''
|
|
54
|
-
]
|
|
55
|
-
.filter(Boolean)
|
|
56
|
-
.join('; ')
|
|
19
|
+
let resolvedThickness = $derived(typeof thickness === 'number' ? `${thickness}px` : thickness);
|
|
20
|
+
let attrs = $derived(
|
|
21
|
+
useComponentAttrs(
|
|
22
|
+
'kit-separator',
|
|
23
|
+
{
|
|
24
|
+
className,
|
|
25
|
+
sClass,
|
|
26
|
+
styleAttr,
|
|
27
|
+
sStyle: { '--kit-separator-thickness': resolvedThickness, ...sStyle },
|
|
28
|
+
color
|
|
29
|
+
},
|
|
30
|
+
rest
|
|
31
|
+
)
|
|
57
32
|
);
|
|
58
33
|
</script>
|
|
59
34
|
|
|
60
35
|
<svelte:element
|
|
61
36
|
this={is}
|
|
62
37
|
bind:this={ref}
|
|
63
|
-
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
aria-orientation={orientation || 'horizontal'}
|
|
38
|
+
class={attrs.class}
|
|
39
|
+
style={attrs.style}
|
|
40
|
+
role={is === 'hr' ? undefined : 'separator'}
|
|
41
|
+
aria-orientation={orientation}
|
|
68
42
|
data-inset={inset || undefined}
|
|
69
43
|
data-orientation={orientation}
|
|
70
|
-
|
|
44
|
+
{...attrs.rest}
|
|
71
45
|
/>
|
|
72
46
|
|
|
73
|
-
<style
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
display: block;
|
|
79
|
-
flex: 1 1 100%;
|
|
80
|
-
height: 0;
|
|
81
|
-
max-height: 0;
|
|
82
|
-
border-color: var(--kit-separator-color);
|
|
83
|
-
border-style: solid;
|
|
84
|
-
transition: inherit;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.kit-separator[data-inset]:not([data-orientation='vertical']) {
|
|
88
|
-
max-width: calc(100% - 4.5rem);
|
|
89
|
-
margin-inline-start: 4.5rem;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.kit-separator[data-inset][data-orientation='vertical'] {
|
|
93
|
-
margin-block: 0.5rem;
|
|
94
|
-
max-height: calc(100% - 1rem);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.kit-separator:not([data-orientation='vertical']) {
|
|
98
|
-
width: 100%;
|
|
99
|
-
border-width: var(--kit-separator-top-width) 0 0 0;
|
|
100
|
-
}
|
|
47
|
+
<style>:where(.kit-separator) {
|
|
48
|
+
--kit-separator-color: var(--kit-color-border);
|
|
49
|
+
--kit-separator-vertical-min-size: 1.5rem;
|
|
50
|
+
}
|
|
101
51
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
52
|
+
.kit-separator {
|
|
53
|
+
display: block;
|
|
54
|
+
flex: 1 1 100%;
|
|
55
|
+
box-sizing: border-box;
|
|
56
|
+
height: 0;
|
|
57
|
+
max-height: 0;
|
|
58
|
+
border: 0 solid var(--kit-separator-color);
|
|
59
|
+
}
|
|
60
|
+
.kit-separator:not([data-orientation=vertical]) {
|
|
61
|
+
width: 100%;
|
|
62
|
+
border-top-width: var(--kit-separator-thickness);
|
|
63
|
+
}
|
|
64
|
+
.kit-separator[data-orientation=vertical] {
|
|
65
|
+
display: inline-flex;
|
|
66
|
+
align-self: stretch;
|
|
67
|
+
width: 0;
|
|
68
|
+
max-width: 0;
|
|
69
|
+
height: auto;
|
|
70
|
+
min-height: var(--kit-separator-vertical-min-size);
|
|
71
|
+
max-height: none;
|
|
72
|
+
vertical-align: text-bottom;
|
|
73
|
+
border-right-width: var(--kit-separator-thickness);
|
|
74
|
+
}
|
|
75
|
+
.kit-separator[data-inset]:not([data-orientation=vertical]) {
|
|
76
|
+
max-width: calc(100% - 4.5rem);
|
|
77
|
+
margin-inline-start: 4.5rem;
|
|
78
|
+
}
|
|
79
|
+
.kit-separator[data-inset][data-orientation=vertical] {
|
|
80
|
+
max-height: calc(100% - 1rem);
|
|
81
|
+
margin-block: 0.5rem;
|
|
82
|
+
}</style>
|
|
@@ -1,41 +1,22 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import { useClassName, useStyles } from '../../utils';
|
|
2
|
+
import { useComponentAttrs } from '../../utils';
|
|
4
3
|
import type { SpacerProps } from './spacer.types.js';
|
|
5
4
|
|
|
6
5
|
let {
|
|
7
6
|
is = 'div',
|
|
8
|
-
class: className
|
|
9
|
-
style: styleAttr
|
|
7
|
+
class: className,
|
|
8
|
+
style: styleAttr,
|
|
10
9
|
's-class': sClass,
|
|
11
10
|
's-style': sStyle,
|
|
12
11
|
...rest
|
|
13
12
|
}: SpacerProps = $props();
|
|
14
13
|
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
let componentClass = $derived(
|
|
20
|
-
useClassName({
|
|
21
|
-
baseClass: 'kit-spacer',
|
|
22
|
-
className: `${className ?? ''}`.trim(),
|
|
23
|
-
sClass,
|
|
24
|
-
classProps
|
|
25
|
-
})
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
let componentStyle = $derived(
|
|
29
|
-
useStyles({
|
|
30
|
-
styleAttr,
|
|
31
|
-
sStyle,
|
|
32
|
-
styleProps
|
|
33
|
-
})
|
|
14
|
+
let attrs = $derived(
|
|
15
|
+
useComponentAttrs('kit-spacer', { className, sClass, styleAttr, sStyle }, rest)
|
|
34
16
|
);
|
|
35
17
|
</script>
|
|
36
18
|
|
|
37
|
-
<svelte:element this={is} class={
|
|
38
|
-
</svelte:element>
|
|
19
|
+
<svelte:element this={is} class={attrs.class} style={attrs.style} {...attrs.rest}></svelte:element>
|
|
39
20
|
|
|
40
21
|
<style>
|
|
41
22
|
.kit-spacer {
|