@dvcol/neo-svelte 0.1.1
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/CHANGELOG.md +58 -0
- package/LICENSE +21 -0
- package/README.md +89 -0
- package/dist/assets/neo-icon-resizer-bottom-right.svg +5 -0
- package/dist/buttons/NeoButton.svelte +466 -0
- package/dist/buttons/NeoButton.svelte.d.ts +19 -0
- package/dist/buttons/NeoButtonGroup.svelte +369 -0
- package/dist/buttons/NeoButtonGroup.svelte.d.ts +19 -0
- package/dist/buttons/index.d.ts +4 -0
- package/dist/buttons/index.js +2 -0
- package/dist/buttons/neo-button-group.model.d.ts +71 -0
- package/dist/buttons/neo-button-group.model.js +1 -0
- package/dist/buttons/neo-button.model.d.ts +110 -0
- package/dist/buttons/neo-button.model.js +1 -0
- package/dist/cards/NeoCard.svelte +413 -0
- package/dist/cards/NeoCard.svelte.d.ts +19 -0
- package/dist/cards/index.d.ts +2 -0
- package/dist/cards/index.js +1 -0
- package/dist/cards/neo-card.model.d.ts +129 -0
- package/dist/cards/neo-card.model.js +1 -0
- package/dist/containers/NeoTransitionContainer.svelte +34 -0
- package/dist/containers/NeoTransitionContainer.svelte.d.ts +19 -0
- package/dist/containers/index.d.ts +2 -0
- package/dist/containers/index.js +1 -0
- package/dist/containers/neo-transition-container.model.d.ts +25 -0
- package/dist/containers/neo-transition-container.model.js +1 -0
- package/dist/divider/NeoDivider.svelte +47 -0
- package/dist/divider/NeoDivider.svelte.d.ts +19 -0
- package/dist/divider/index.d.ts +2 -0
- package/dist/divider/index.js +1 -0
- package/dist/divider/neo-divider.model.d.ts +7 -0
- package/dist/divider/neo-divider.model.js +1 -0
- package/dist/icons/IconAccount.svelte +10 -0
- package/dist/icons/IconAccount.svelte.d.ts +26 -0
- package/dist/icons/IconAdd.svelte +10 -0
- package/dist/icons/IconAdd.svelte.d.ts +26 -0
- package/dist/icons/IconAlert.svelte +14 -0
- package/dist/icons/IconAlert.svelte.d.ts +26 -0
- package/dist/icons/IconCircleLoading.svelte +16 -0
- package/dist/icons/IconCircleLoading.svelte.d.ts +26 -0
- package/dist/icons/IconClear.svelte +10 -0
- package/dist/icons/IconClear.svelte.d.ts +26 -0
- package/dist/icons/IconClose.svelte +14 -0
- package/dist/icons/IconClose.svelte.d.ts +26 -0
- package/dist/icons/IconConfirm.svelte +10 -0
- package/dist/icons/IconConfirm.svelte.d.ts +26 -0
- package/dist/icons/IconEmpty.svelte +10 -0
- package/dist/icons/IconEmpty.svelte.d.ts +26 -0
- package/dist/icons/IconFileUpload.svelte +18 -0
- package/dist/icons/IconFileUpload.svelte.d.ts +26 -0
- package/dist/icons/IconGithub.svelte +29 -0
- package/dist/icons/IconGithub.svelte.d.ts +26 -0
- package/dist/icons/IconImage.svelte +18 -0
- package/dist/icons/IconImage.svelte.d.ts +26 -0
- package/dist/icons/IconMinus.svelte +14 -0
- package/dist/icons/IconMinus.svelte.d.ts +26 -0
- package/dist/icons/IconMoon.svelte +64 -0
- package/dist/icons/IconMoon.svelte.d.ts +26 -0
- package/dist/icons/IconSave.svelte +15 -0
- package/dist/icons/IconSave.svelte.d.ts +26 -0
- package/dist/icons/IconSaveOff.svelte +19 -0
- package/dist/icons/IconSaveOff.svelte.d.ts +26 -0
- package/dist/icons/IconSearch.svelte +14 -0
- package/dist/icons/IconSearch.svelte.d.ts +26 -0
- package/dist/icons/IconSun.svelte +54 -0
- package/dist/icons/IconSun.svelte.d.ts +26 -0
- package/dist/icons/IconSunrise.svelte +24 -0
- package/dist/icons/IconSunrise.svelte.d.ts +26 -0
- package/dist/icons/IconVideo.svelte +15 -0
- package/dist/icons/IconVideo.svelte.d.ts +26 -0
- package/dist/icons/IconWatch.svelte +21 -0
- package/dist/icons/IconWatch.svelte.d.ts +26 -0
- package/dist/icons/IconWatchOff.svelte +26 -0
- package/dist/icons/IconWatchOff.svelte.d.ts +26 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/inputs/NeoInput.svelte +750 -0
- package/dist/inputs/NeoInput.svelte.d.ts +27 -0
- package/dist/inputs/NeoPassword.svelte +31 -0
- package/dist/inputs/NeoPassword.svelte.d.ts +19 -0
- package/dist/inputs/NeoTextarea.svelte +768 -0
- package/dist/inputs/NeoTextarea.svelte.d.ts +27 -0
- package/dist/inputs/NeoValidation.svelte +106 -0
- package/dist/inputs/NeoValidation.svelte.d.ts +22 -0
- package/dist/inputs/index.d.ts +4 -0
- package/dist/inputs/index.js +3 -0
- package/dist/inputs/neo-input.model.d.ts +234 -0
- package/dist/inputs/neo-input.model.js +10 -0
- package/dist/inputs/neo-validation.model.d.ts +40 -0
- package/dist/inputs/neo-validation.model.js +1 -0
- package/dist/nav/NeoTab.svelte +170 -0
- package/dist/nav/NeoTab.svelte.d.ts +19 -0
- package/dist/nav/NeoTabPanel.svelte +75 -0
- package/dist/nav/NeoTabPanel.svelte.d.ts +19 -0
- package/dist/nav/NeoTabs.svelte +288 -0
- package/dist/nav/NeoTabs.svelte.d.ts +19 -0
- package/dist/nav/NeoTabsCard.svelte +47 -0
- package/dist/nav/NeoTabsCard.svelte.d.ts +19 -0
- package/dist/nav/index.d.ts +8 -0
- package/dist/nav/index.js +4 -0
- package/dist/nav/neo-tab-panel.model.d.ts +30 -0
- package/dist/nav/neo-tab-panel.model.js +1 -0
- package/dist/nav/neo-tab.model.d.ts +43 -0
- package/dist/nav/neo-tab.model.js +1 -0
- package/dist/nav/neo-tabs-card.model.d.ts +25 -0
- package/dist/nav/neo-tabs-card.model.js +5 -0
- package/dist/nav/neo-tabs-context.svelte.d.ts +82 -0
- package/dist/nav/neo-tabs-context.svelte.js +163 -0
- package/dist/nav/neo-tabs.model.d.ts +60 -0
- package/dist/nav/neo-tabs.model.js +1 -0
- package/dist/providers/NeoThemeProvider.svelte +28 -0
- package/dist/providers/NeoThemeProvider.svelte.d.ts +21 -0
- package/dist/providers/NeoThemeSelector.svelte +79 -0
- package/dist/providers/NeoThemeSelector.svelte.d.ts +19 -0
- package/dist/providers/index.d.ts +5 -0
- package/dist/providers/index.js +3 -0
- package/dist/providers/neo-theme-provider-context.svelte.d.ts +26 -0
- package/dist/providers/neo-theme-provider-context.svelte.js +78 -0
- package/dist/providers/neo-theme-provider.model.d.ts +35 -0
- package/dist/providers/neo-theme-provider.model.js +20 -0
- package/dist/providers/neo-theme-selector.model.d.ts +6 -0
- package/dist/providers/neo-theme-selector.model.js +1 -0
- package/dist/skeletons/NeoSkeletonContainer.svelte +48 -0
- package/dist/skeletons/NeoSkeletonContainer.svelte.d.ts +19 -0
- package/dist/skeletons/NeoSkeletonMedia.svelte +146 -0
- package/dist/skeletons/NeoSkeletonMedia.svelte.d.ts +19 -0
- package/dist/skeletons/NeoSkeletonText.svelte +170 -0
- package/dist/skeletons/NeoSkeletonText.svelte.d.ts +19 -0
- package/dist/skeletons/index.d.ts +4 -0
- package/dist/skeletons/index.js +2 -0
- package/dist/skeletons/neo-skeleton-container.model.d.ts +29 -0
- package/dist/skeletons/neo-skeleton-container.model.js +1 -0
- package/dist/skeletons/neo-skeleton-media.model.d.ts +40 -0
- package/dist/skeletons/neo-skeleton-media.model.js +1 -0
- package/dist/skeletons/neo-skeleton-text.model.d.ts +45 -0
- package/dist/skeletons/neo-skeleton-text.model.js +1 -0
- package/dist/styles/animation.scss +75 -0
- package/dist/styles/common/colors.scss +217 -0
- package/dist/styles/common/flex.scss +26 -0
- package/dist/styles/common/properties.css +23 -0
- package/dist/styles/common/shadows.scss +305 -0
- package/dist/styles/common/spacing.scss +27 -0
- package/dist/styles/common/typography.scss +13 -0
- package/dist/styles/common/utils.scss +8 -0
- package/dist/styles/common/z-index.scss +12 -0
- package/dist/styles/mixin.scss +225 -0
- package/dist/styles/reset.scss +81 -0
- package/dist/styles/theme.scss +22 -0
- package/dist/utils/action.utils.d.ts +52 -0
- package/dist/utils/action.utils.js +30 -0
- package/dist/utils/error.utils.d.ts +25 -0
- package/dist/utils/error.utils.js +35 -0
- package/dist/utils/html-element.utils.d.ts +22 -0
- package/dist/utils/html-element.utils.js +1 -0
- package/dist/utils/logger.utils.d.ts +14 -0
- package/dist/utils/logger.utils.js +31 -0
- package/dist/utils/shadow.utils.d.ts +8 -0
- package/dist/utils/shadow.utils.js +26 -0
- package/dist/utils/timeout.util.d.ts +5 -0
- package/dist/utils/timeout.util.js +15 -0
- package/dist/utils/transition.utils.d.ts +5 -0
- package/dist/utils/transition.utils.js +8 -0
- package/package.json +180 -0
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { NeoCardContext, NeoCardProps } from './neo-card.model.js';
|
|
3
|
+
|
|
4
|
+
import NeoButton from '../buttons/NeoButton.svelte';
|
|
5
|
+
import NeoDivider from '../divider/NeoDivider.svelte';
|
|
6
|
+
import IconClose from '../icons/IconClose.svelte';
|
|
7
|
+
import { toAction, toActionProps, toTransition, toTransitionProps } from '../utils/action.utils.js';
|
|
8
|
+
import { computeGlassFilter, computeHoverShadowElevation, computeShadowElevation } from '../utils/shadow.utils.js';
|
|
9
|
+
|
|
10
|
+
/* eslint-disable prefer-const -- necessary for binding checked */
|
|
11
|
+
let {
|
|
12
|
+
// Snippets
|
|
13
|
+
children: content,
|
|
14
|
+
header,
|
|
15
|
+
action,
|
|
16
|
+
footer,
|
|
17
|
+
media,
|
|
18
|
+
|
|
19
|
+
// States
|
|
20
|
+
ref = $bindable(),
|
|
21
|
+
tag = 'div',
|
|
22
|
+
close,
|
|
23
|
+
|
|
24
|
+
// Styles
|
|
25
|
+
elevation = 3,
|
|
26
|
+
hover = 0,
|
|
27
|
+
borderless,
|
|
28
|
+
rounded,
|
|
29
|
+
glass,
|
|
30
|
+
segmented,
|
|
31
|
+
cover,
|
|
32
|
+
start,
|
|
33
|
+
horizontal,
|
|
34
|
+
|
|
35
|
+
// Flex
|
|
36
|
+
justify,
|
|
37
|
+
align,
|
|
38
|
+
flex,
|
|
39
|
+
|
|
40
|
+
// Transition
|
|
41
|
+
in: inAction,
|
|
42
|
+
out: outAction,
|
|
43
|
+
transition: transitionAction,
|
|
44
|
+
|
|
45
|
+
// Actions
|
|
46
|
+
use,
|
|
47
|
+
|
|
48
|
+
// Events
|
|
49
|
+
onClose,
|
|
50
|
+
|
|
51
|
+
// Other props
|
|
52
|
+
contentTag = 'div',
|
|
53
|
+
contentProps,
|
|
54
|
+
headerTag = 'div',
|
|
55
|
+
headerProps,
|
|
56
|
+
footerTag = 'div',
|
|
57
|
+
footerProps,
|
|
58
|
+
actionTag = 'div',
|
|
59
|
+
actionProps,
|
|
60
|
+
mediaTag = 'div',
|
|
61
|
+
mediaProps,
|
|
62
|
+
...rest
|
|
63
|
+
}: NeoCardProps = $props();
|
|
64
|
+
/* eslint-enable prefer-const */
|
|
65
|
+
|
|
66
|
+
const filter = $derived.by(() => computeGlassFilter(elevation, glass));
|
|
67
|
+
|
|
68
|
+
const boxShadow = $derived.by(() => computeShadowElevation(elevation, glass));
|
|
69
|
+
const hoverElevation = $derived(elevation + hover);
|
|
70
|
+
const hoverShadow = $derived.by(() => computeHoverShadowElevation(elevation, hover, glass) ?? boxShadow);
|
|
71
|
+
|
|
72
|
+
const hoverFlat = $derived(boxShadow.endsWith('flat') && !hoverShadow.endsWith('flat'));
|
|
73
|
+
const flatHover = $derived(hoverShadow.endsWith('flat') && !boxShadow.endsWith('flat'));
|
|
74
|
+
|
|
75
|
+
const segments = $derived([content, header, action, footer, media, close].filter(Boolean).length > 1);
|
|
76
|
+
|
|
77
|
+
const context: NeoCardContext = $derived({
|
|
78
|
+
elevation,
|
|
79
|
+
hover,
|
|
80
|
+
borderless,
|
|
81
|
+
rounded,
|
|
82
|
+
glass,
|
|
83
|
+
segmented,
|
|
84
|
+
cover,
|
|
85
|
+
start,
|
|
86
|
+
horizontal,
|
|
87
|
+
close,
|
|
88
|
+
onClose,
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const inFn = $derived(toTransition(inAction ?? transitionAction));
|
|
92
|
+
const inProps = $derived(toTransitionProps(inAction ?? transitionAction));
|
|
93
|
+
const outFn = $derived(toTransition(outAction ?? transitionAction));
|
|
94
|
+
const outProps = $derived(toTransitionProps(outAction ?? transitionAction));
|
|
95
|
+
|
|
96
|
+
const useFn = $derived(toAction(use));
|
|
97
|
+
const useProps = $derived(toActionProps(use));
|
|
98
|
+
</script>
|
|
99
|
+
|
|
100
|
+
{#snippet closeBtn()}
|
|
101
|
+
{#if close}
|
|
102
|
+
<div class="neo-card-close">
|
|
103
|
+
<NeoButton aria-label="Close card" rounded text onclick={onClose}>
|
|
104
|
+
{#snippet icon()}
|
|
105
|
+
<IconClose />
|
|
106
|
+
{/snippet}
|
|
107
|
+
</NeoButton>
|
|
108
|
+
</div>
|
|
109
|
+
{/if}
|
|
110
|
+
{/snippet}
|
|
111
|
+
|
|
112
|
+
{#snippet divider()}
|
|
113
|
+
{#if segments && typeof segmented === 'number'}
|
|
114
|
+
<div class="neo-card-divider">
|
|
115
|
+
<NeoDivider vertical={horizontal} elevation={segmented} />
|
|
116
|
+
</div>
|
|
117
|
+
{/if}
|
|
118
|
+
{/snippet}
|
|
119
|
+
|
|
120
|
+
<svelte:element
|
|
121
|
+
this={tag}
|
|
122
|
+
bind:this={ref}
|
|
123
|
+
class:neo-card={true}
|
|
124
|
+
class:horizontal
|
|
125
|
+
class:borderless
|
|
126
|
+
class:segmented={segmented === true}
|
|
127
|
+
class:segments
|
|
128
|
+
class:image={media && !segments}
|
|
129
|
+
class:rounded
|
|
130
|
+
class:hover
|
|
131
|
+
class:start
|
|
132
|
+
class:raised={elevation > 3}
|
|
133
|
+
class:flat={!elevation}
|
|
134
|
+
class:hover-flat={hoverFlat}
|
|
135
|
+
class:flat-hover={flatHover}
|
|
136
|
+
class:glass
|
|
137
|
+
style:--neo-card-hover-shadow={hoverShadow}
|
|
138
|
+
style:--neo-card-box-shadow={boxShadow}
|
|
139
|
+
style:--neo-card-glass-blur={filter}
|
|
140
|
+
style:justify-content={justify}
|
|
141
|
+
style:align-items={align}
|
|
142
|
+
style:flex
|
|
143
|
+
use:useFn={useProps}
|
|
144
|
+
out:outFn={outProps}
|
|
145
|
+
in:inFn={inProps}
|
|
146
|
+
{...rest}
|
|
147
|
+
>
|
|
148
|
+
{#if media}
|
|
149
|
+
<svelte:element
|
|
150
|
+
this={mediaTag}
|
|
151
|
+
class:neo-card-segment={true}
|
|
152
|
+
class:neo-card-media={true}
|
|
153
|
+
class:cover
|
|
154
|
+
class:inset={elevation < 0 || hoverElevation < 0}
|
|
155
|
+
{...mediaProps}
|
|
156
|
+
>
|
|
157
|
+
{@render media?.(context)}
|
|
158
|
+
</svelte:element>
|
|
159
|
+
{/if}
|
|
160
|
+
{#if header || (!horizontal && close)}
|
|
161
|
+
<svelte:element this={headerTag} class:neo-card-segment={true} class:neo-card-header={true} {...headerProps}>
|
|
162
|
+
{@render header?.(context)}
|
|
163
|
+
{#if !horizontal}
|
|
164
|
+
{@render closeBtn()}
|
|
165
|
+
{/if}
|
|
166
|
+
</svelte:element>
|
|
167
|
+
{/if}
|
|
168
|
+
{#if segments}
|
|
169
|
+
{@render divider()}
|
|
170
|
+
{#if content}
|
|
171
|
+
<svelte:element this={contentTag} class:neo-card-segment={true} class:neo-card-content={true} {...contentProps}>
|
|
172
|
+
{@render content?.(context)}
|
|
173
|
+
</svelte:element>
|
|
174
|
+
{/if}
|
|
175
|
+
{:else}
|
|
176
|
+
{@render content?.(context)}
|
|
177
|
+
{/if}
|
|
178
|
+
{#if footer}
|
|
179
|
+
{@render divider()}
|
|
180
|
+
<svelte:element this={footerTag} class:neo-card-segment={true} class:neo-card-footer={true} {...footerProps}>
|
|
181
|
+
{@render footer?.(context)}
|
|
182
|
+
</svelte:element>
|
|
183
|
+
{/if}
|
|
184
|
+
{#if action || (horizontal && close)}
|
|
185
|
+
{@render divider()}
|
|
186
|
+
<svelte:element this={actionTag} class:neo-card-segment={true} class:neo-card-action={true} {...actionProps}>
|
|
187
|
+
{#if horizontal}
|
|
188
|
+
{@render closeBtn()}
|
|
189
|
+
{/if}
|
|
190
|
+
{@render action?.(context)}
|
|
191
|
+
</svelte:element>
|
|
192
|
+
{/if}
|
|
193
|
+
</svelte:element>
|
|
194
|
+
|
|
195
|
+
<style>.neo-card {
|
|
196
|
+
--neo-card-full-spacing: var(--neo-card-spacing, 1.5rem);
|
|
197
|
+
--neo-card-half-spacing: calc(var(--neo-card-spacing, 1.5rem) / 2);
|
|
198
|
+
display: flex;
|
|
199
|
+
flex-direction: column;
|
|
200
|
+
box-sizing: border-box;
|
|
201
|
+
width: fit-content;
|
|
202
|
+
margin: var(--neo-shadow-margin, 0.6rem);
|
|
203
|
+
padding: var(--neo-card-full-spacing);
|
|
204
|
+
color: var(--neo-card-text-color, inherit);
|
|
205
|
+
background-color: var(--neo-card-bg-color, transparent);
|
|
206
|
+
border: var(--neo-border-width, 1px) var(--neo-card-border-color, transparent) solid;
|
|
207
|
+
border-radius: var(--neo-card-border-radius, var(--neo-border-radius));
|
|
208
|
+
box-shadow: var(--neo-card-box-shadow, var(--neo-box-shadow-flat));
|
|
209
|
+
transition: margin 0.3s ease, color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, border-radius 0.3s ease, backdrop-filter 0.3s ease, box-shadow 0.3s ease-out;
|
|
210
|
+
}
|
|
211
|
+
.neo-card.borderless {
|
|
212
|
+
border-color: transparent !important;
|
|
213
|
+
}
|
|
214
|
+
.neo-card.raised {
|
|
215
|
+
margin: var(--neo-shadow-margin-lg, 1.125rem);
|
|
216
|
+
}
|
|
217
|
+
.neo-card.hover.flat-hover:hover, .neo-card.flat:not(.borderless, .hover-flat:hover) {
|
|
218
|
+
border-color: var(--neo-card-border-color, var(--neo-border-color));
|
|
219
|
+
}
|
|
220
|
+
.neo-card.hover:hover {
|
|
221
|
+
box-shadow: var(--neo-card-hover-shadow, var(--neo-card-box-shadow));
|
|
222
|
+
}
|
|
223
|
+
.neo-card .neo-card-divider {
|
|
224
|
+
margin: 0.5rem calc(var(--neo-card-full-spacing) - 0.25rem);
|
|
225
|
+
}
|
|
226
|
+
.neo-card .neo-card-segment {
|
|
227
|
+
transition: border-radius 0.3s ease;
|
|
228
|
+
}
|
|
229
|
+
.neo-card .neo-card-segment:not(.neo-card-media) {
|
|
230
|
+
padding: var(--neo-card-half-spacing) var(--neo-card-full-spacing);
|
|
231
|
+
}
|
|
232
|
+
.neo-card .neo-card-segment:not(.neo-card-media):first-child {
|
|
233
|
+
padding: var(--neo-card-full-spacing) var(--neo-card-full-spacing) var(--neo-card-half-spacing);
|
|
234
|
+
border-radius: var(--neo-card-border-radius, var(--neo-border-radius)) var(--neo-card-border-radius, var(--neo-border-radius)) 0 0;
|
|
235
|
+
}
|
|
236
|
+
.neo-card .neo-card-segment:not(.neo-card-media):last-child {
|
|
237
|
+
padding: var(--neo-card-half-spacing) var(--neo-card-full-spacing) var(--neo-card-full-spacing);
|
|
238
|
+
border-radius: 0 0 var(--neo-card-border-radius, var(--neo-border-radius)) var(--neo-card-border-radius, var(--neo-border-radius));
|
|
239
|
+
}
|
|
240
|
+
.neo-card .neo-card-media {
|
|
241
|
+
margin: var(--neo-card-full-spacing);
|
|
242
|
+
overflow: hidden;
|
|
243
|
+
border-radius: var(--neo-card-border-radius, var(--neo-border-radius));
|
|
244
|
+
}
|
|
245
|
+
.neo-card .neo-card-media.cover:not(.inset) {
|
|
246
|
+
padding: 0;
|
|
247
|
+
}
|
|
248
|
+
.neo-card .neo-card-media.cover:not(.inset):not(:only-child) {
|
|
249
|
+
margin: 0 0 var(--neo-card-full-spacing);
|
|
250
|
+
border-radius: var(--neo-card-border-radius, var(--neo-border-radius)) var(--neo-card-border-radius, var(--neo-border-radius)) 0 0;
|
|
251
|
+
}
|
|
252
|
+
.neo-card .neo-card-media.cover:not(.inset) :global(.neo-skeleton-media) {
|
|
253
|
+
border-radius: 0;
|
|
254
|
+
}
|
|
255
|
+
.neo-card .neo-card-action,
|
|
256
|
+
.neo-card .neo-card-header {
|
|
257
|
+
display: flex;
|
|
258
|
+
align-items: center;
|
|
259
|
+
}
|
|
260
|
+
.neo-card .neo-card-close {
|
|
261
|
+
align-self: flex-start;
|
|
262
|
+
margin-left: auto;
|
|
263
|
+
opacity: 0;
|
|
264
|
+
transition: opacity 0.3s ease;
|
|
265
|
+
--neo-btn-text-color-focused: var(--neo-close-color-focused, rgb(255 0 0 / 50%));
|
|
266
|
+
--neo-btn-text-color-focused-hover: var(--neo-close-color-hover, rgb(255 0 0 / 75%));
|
|
267
|
+
--neo-text-color-focused-active: var(--neo-close-color, rgb(255 0 0));
|
|
268
|
+
--neo-btn-text-color-hover: var(--neo-close-color-hover, rgb(255 0 0 / 75%));
|
|
269
|
+
--neo-btn-text-color-active: var(--neo-close-color, rgb(255 0 0));
|
|
270
|
+
}
|
|
271
|
+
.neo-card:focus-within .neo-card-close, .neo-card:focus .neo-card-close, .neo-card:hover .neo-card-close {
|
|
272
|
+
opacity: 1;
|
|
273
|
+
}
|
|
274
|
+
.neo-card.image {
|
|
275
|
+
padding: 0;
|
|
276
|
+
}
|
|
277
|
+
.neo-card.image .neo-card-media.cover:not(.inset) {
|
|
278
|
+
margin: 0;
|
|
279
|
+
}
|
|
280
|
+
.neo-card.segments {
|
|
281
|
+
padding: 0;
|
|
282
|
+
}
|
|
283
|
+
.neo-card.segmented .neo-card-segment:not(.neo-card-media) {
|
|
284
|
+
padding: var(--neo-card-full-spacing);
|
|
285
|
+
}
|
|
286
|
+
.neo-card.segmented .neo-card-segment:not(.neo-card-media, :last-child) {
|
|
287
|
+
border-bottom: var(--neo-border-width, 1px) solid var(--neo-card-border-color, var(--neo-border-color));
|
|
288
|
+
}
|
|
289
|
+
.neo-card.glass {
|
|
290
|
+
--neo-skeleton-color: var(--neo-glass-skeleton-color);
|
|
291
|
+
background-color: var(--neo-card-bg-color, var(--neo-glass-background-color));
|
|
292
|
+
border-color: var(--neo-card-border-color, var(--neo-glass-top-border-color) var(--neo-glass-right-border-color) var(--neo-glass-bottom-border-color) var(--neo-glass-left-border-color));
|
|
293
|
+
backdrop-filter: var(--neo-card-glass-blur, var(--neo-blur-4) var(--neo-saturate-2));
|
|
294
|
+
}
|
|
295
|
+
@starting-style {
|
|
296
|
+
.neo-card.start {
|
|
297
|
+
box-shadow: var(--neo-box-shadow-flat);
|
|
298
|
+
}
|
|
299
|
+
.neo-card.start:not(.borderless) {
|
|
300
|
+
border-color: var(--neo-card-border-color, var(--neo-border-color));
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
.neo-card.horizontal {
|
|
304
|
+
flex-direction: row;
|
|
305
|
+
}
|
|
306
|
+
.neo-card.horizontal .neo-card-action {
|
|
307
|
+
flex-direction: column;
|
|
308
|
+
}
|
|
309
|
+
.neo-card.horizontal .neo-card-close {
|
|
310
|
+
align-self: flex-end;
|
|
311
|
+
margin-bottom: auto;
|
|
312
|
+
}
|
|
313
|
+
.neo-card.horizontal .neo-card-media.cover:not(.inset, :only-child) {
|
|
314
|
+
margin: 0 var(--neo-card-full-spacing) 0 0;
|
|
315
|
+
border-radius: var(--neo-card-border-radius, var(--neo-border-radius)) 0 0 var(--neo-card-border-radius, var(--neo-border-radius));
|
|
316
|
+
}
|
|
317
|
+
.neo-card.horizontal .neo-card-segment:not(.neo-card-media) {
|
|
318
|
+
padding: var(--neo-card-full-spacing) var(--neo-card-half-spacing);
|
|
319
|
+
}
|
|
320
|
+
.neo-card.horizontal .neo-card-segment:not(.neo-card-media):first-child {
|
|
321
|
+
padding: var(--neo-card-full-spacing) var(--neo-card-half-spacing) var(--neo-card-full-spacing) var(--neo-card-full-spacing);
|
|
322
|
+
border-radius: var(--neo-card-border-radius, var(--neo-border-radius)) 0 0 var(--neo-card-border-radius, var(--neo-border-radius));
|
|
323
|
+
}
|
|
324
|
+
.neo-card.horizontal .neo-card-segment:not(.neo-card-media):last-child {
|
|
325
|
+
padding: var(--neo-card-full-spacing) var(--neo-card-full-spacing) var(--neo-card-full-spacing) var(--neo-card-half-spacing);
|
|
326
|
+
border-radius: 0 var(--neo-card-border-radius, var(--neo-border-radius)) var(--neo-card-border-radius, var(--neo-border-radius)) 0;
|
|
327
|
+
}
|
|
328
|
+
.neo-card.rounded {
|
|
329
|
+
border-radius: var(--neo-card-border-radius, var(--neo-border-radius-lg));
|
|
330
|
+
}
|
|
331
|
+
.neo-card.rounded .neo-card-media {
|
|
332
|
+
border-radius: var(--neo-card-border-radius, var(--neo-border-radius-md));
|
|
333
|
+
}
|
|
334
|
+
.neo-card.rounded .neo-card-media.cover:not(.inset) {
|
|
335
|
+
border-radius: var(--neo-card-border-radius, var(--neo-border-radius-lg));
|
|
336
|
+
}
|
|
337
|
+
.neo-card.rounded .neo-card-media.cover:not(.inset):not(:only-child) {
|
|
338
|
+
border-radius: var(--neo-card-border-radius, var(--neo-border-radius-lg)) var(--neo-card-border-radius, var(--neo-border-radius-lg)) 0 0;
|
|
339
|
+
}
|
|
340
|
+
.neo-card.rounded .neo-card-segment:not(.neo-card-media):first-child {
|
|
341
|
+
border-radius: var(--neo-card-border-radius, var(--neo-border-radius-lg)) var(--neo-card-border-radius, var(--neo-border-radius-lg)) 0 0;
|
|
342
|
+
}
|
|
343
|
+
.neo-card.rounded .neo-card-segment:not(.neo-card-media):last-child {
|
|
344
|
+
border-radius: 0 0 var(--neo-card-border-radius, var(--neo-border-radius-lg)) var(--neo-card-border-radius, var(--neo-border-radius-lg));
|
|
345
|
+
}
|
|
346
|
+
.neo-card.rounded.horizontal .neo-card-segment:not(.neo-card-media):first-child {
|
|
347
|
+
border-radius: var(--neo-card-border-radius, var(--neo-border-radius-lg)) 0 0 var(--neo-card-border-radius, var(--neo-border-radius-lg));
|
|
348
|
+
}
|
|
349
|
+
.neo-card.rounded.horizontal .neo-card-segment:not(.neo-card-media):last-child {
|
|
350
|
+
border-radius: 0 var(--neo-card-border-radius, var(--neo-border-radius-lg)) var(--neo-card-border-radius, var(--neo-border-radius-lg)) 0;
|
|
351
|
+
}
|
|
352
|
+
.neo-card.rounded.horizontal .neo-card-media.cover:not(.inset, :only-child) {
|
|
353
|
+
border-radius: var(--neo-card-border-radius, var(--neo-border-radius-lg)) 0 0 var(--neo-card-border-radius, var(--neo-border-radius-lg));
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.neo-card,
|
|
357
|
+
.neo-card-media,
|
|
358
|
+
.neo-card-header,
|
|
359
|
+
.neo-card-content,
|
|
360
|
+
.neo-card-action,
|
|
361
|
+
.neo-card-footer {
|
|
362
|
+
scrollbar-gutter: stable;
|
|
363
|
+
}
|
|
364
|
+
.neo-card::-webkit-scrollbar,
|
|
365
|
+
.neo-card-media::-webkit-scrollbar,
|
|
366
|
+
.neo-card-header::-webkit-scrollbar,
|
|
367
|
+
.neo-card-content::-webkit-scrollbar,
|
|
368
|
+
.neo-card-action::-webkit-scrollbar,
|
|
369
|
+
.neo-card-footer::-webkit-scrollbar {
|
|
370
|
+
width: var(--neo-scrollbar-width, 0.45rem);
|
|
371
|
+
background-color: transparent;
|
|
372
|
+
border: none;
|
|
373
|
+
cursor: pointer;
|
|
374
|
+
}
|
|
375
|
+
.neo-card::-webkit-scrollbar-button,
|
|
376
|
+
.neo-card-media::-webkit-scrollbar-button,
|
|
377
|
+
.neo-card-header::-webkit-scrollbar-button,
|
|
378
|
+
.neo-card-content::-webkit-scrollbar-button,
|
|
379
|
+
.neo-card-action::-webkit-scrollbar-button,
|
|
380
|
+
.neo-card-footer::-webkit-scrollbar-button {
|
|
381
|
+
height: var(--neo-scrollbar-button-height, 2px);
|
|
382
|
+
}
|
|
383
|
+
.neo-card::-webkit-scrollbar-thumb,
|
|
384
|
+
.neo-card-media::-webkit-scrollbar-thumb,
|
|
385
|
+
.neo-card-header::-webkit-scrollbar-thumb,
|
|
386
|
+
.neo-card-content::-webkit-scrollbar-thumb,
|
|
387
|
+
.neo-card-action::-webkit-scrollbar-thumb,
|
|
388
|
+
.neo-card-footer::-webkit-scrollbar-thumb {
|
|
389
|
+
background-color: var(--neo-scrollbar-color);
|
|
390
|
+
border: none;
|
|
391
|
+
border-radius: var(--neo-border-radius);
|
|
392
|
+
cursor: pointer;
|
|
393
|
+
}
|
|
394
|
+
.neo-card::-webkit-scrollbar-corner,
|
|
395
|
+
.neo-card-media::-webkit-scrollbar-corner,
|
|
396
|
+
.neo-card-header::-webkit-scrollbar-corner,
|
|
397
|
+
.neo-card-content::-webkit-scrollbar-corner,
|
|
398
|
+
.neo-card-action::-webkit-scrollbar-corner,
|
|
399
|
+
.neo-card-footer::-webkit-scrollbar-corner {
|
|
400
|
+
background-color: transparent;
|
|
401
|
+
background-clip: border-box;
|
|
402
|
+
border: none;
|
|
403
|
+
outline: none;
|
|
404
|
+
}
|
|
405
|
+
.neo-card::-webkit-resizer,
|
|
406
|
+
.neo-card-media::-webkit-resizer,
|
|
407
|
+
.neo-card-header::-webkit-resizer,
|
|
408
|
+
.neo-card-content::-webkit-resizer,
|
|
409
|
+
.neo-card-action::-webkit-resizer,
|
|
410
|
+
.neo-card-footer::-webkit-resizer {
|
|
411
|
+
background: url("~/assets/neo-icon-resizer-bottom-right.svg") no-repeat bottom;
|
|
412
|
+
background-clip: border-box;
|
|
413
|
+
}</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { NeoCardProps } from './neo-card.model.js';
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const NeoCard: $$__sveltets_2_IsomorphicComponent<NeoCardProps, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, "ref">;
|
|
18
|
+
type NeoCard = InstanceType<typeof NeoCard>;
|
|
19
|
+
export default NeoCard;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NeoCard } from './NeoCard.svelte';
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { NeoButtonProps } from '../buttons/neo-button.model.js';
|
|
3
|
+
import type { HTMLActionProps } from '../utils/action.utils.js';
|
|
4
|
+
import type { HTMLFlexProps, HTMLNeoBaseElement, HTMLRefProps } from '../utils/html-element.utils.js';
|
|
5
|
+
import type { ShadowElevation } from '../utils/shadow.utils.js';
|
|
6
|
+
export type NeoCardElevation = ShadowElevation;
|
|
7
|
+
export type NeoCardContext = {
|
|
8
|
+
/**
|
|
9
|
+
* Card elevation.
|
|
10
|
+
* @default 3
|
|
11
|
+
*/
|
|
12
|
+
elevation?: NeoCardElevation;
|
|
13
|
+
/**
|
|
14
|
+
* Weather to increase/decrease the elevation when hovered.
|
|
15
|
+
* @default 0
|
|
16
|
+
*/
|
|
17
|
+
hover?: number;
|
|
18
|
+
/**
|
|
19
|
+
* By default, cards with no elevation will display a border.
|
|
20
|
+
* If this is `true`, the card will never display a border.
|
|
21
|
+
*/
|
|
22
|
+
borderless?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* If true, the card will have a rounded border.
|
|
25
|
+
*/
|
|
26
|
+
rounded?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* If true, the card will be displayed with a glass effect.
|
|
29
|
+
*/
|
|
30
|
+
glass?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* If true, a border will separate the card content from the header, footer, and action.
|
|
33
|
+
* If a number is provided, a raised/inset divider will be displayed instead.
|
|
34
|
+
*/
|
|
35
|
+
segmented?: boolean | number;
|
|
36
|
+
/**
|
|
37
|
+
* If true, the media will be displayed as a cover (no margin).
|
|
38
|
+
*/
|
|
39
|
+
cover?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* If true, the card will start as flat on first render.
|
|
42
|
+
* @see [@starting-style](https://developer.mozilla.org/en-US/docs/Web/CSS/@starting-style) for browser support
|
|
43
|
+
*/
|
|
44
|
+
start?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* If true, the card will be displayed as a horizontal card.
|
|
47
|
+
*/
|
|
48
|
+
horizontal?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* If true, the card will show a close butto.
|
|
51
|
+
*/
|
|
52
|
+
close?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Callback when the close button is clicked.
|
|
55
|
+
*/
|
|
56
|
+
onClose?: NeoButtonProps['onclick'];
|
|
57
|
+
};
|
|
58
|
+
export type NeoCardProps = {
|
|
59
|
+
/**
|
|
60
|
+
* Snippet to display as the card content.
|
|
61
|
+
*/
|
|
62
|
+
children: Snippet<[NeoCardContext]>;
|
|
63
|
+
/**
|
|
64
|
+
* Optional snippets to display as the card header.
|
|
65
|
+
*/
|
|
66
|
+
header?: Snippet<[NeoCardContext]>;
|
|
67
|
+
/**
|
|
68
|
+
* Optional snippet to display as the card action.
|
|
69
|
+
*/
|
|
70
|
+
action?: Snippet<[NeoCardContext]>;
|
|
71
|
+
/**
|
|
72
|
+
* Optional snippet to display as the card footer.
|
|
73
|
+
*/
|
|
74
|
+
footer?: Snippet<[NeoCardContext]>;
|
|
75
|
+
/**
|
|
76
|
+
* Optional snippet to display as the card media.
|
|
77
|
+
*/
|
|
78
|
+
media?: Snippet<[NeoCardContext]>;
|
|
79
|
+
/**
|
|
80
|
+
* The HTML tag to use for the card.
|
|
81
|
+
* @default 'div'
|
|
82
|
+
*/
|
|
83
|
+
tag?: keyof HTMLElementTagNameMap;
|
|
84
|
+
/**
|
|
85
|
+
* The HTML tag to use for the card content.
|
|
86
|
+
* @default 'div'
|
|
87
|
+
*/
|
|
88
|
+
contentTag?: keyof HTMLElementTagNameMap;
|
|
89
|
+
/**
|
|
90
|
+
* The HTML tag to use for the card header.
|
|
91
|
+
* @default 'div'
|
|
92
|
+
*/
|
|
93
|
+
headerTag?: keyof HTMLElementTagNameMap;
|
|
94
|
+
/**
|
|
95
|
+
* The HTML tag to use for the card action.
|
|
96
|
+
* @default 'div'
|
|
97
|
+
*/
|
|
98
|
+
actionTag?: keyof HTMLElementTagNameMap;
|
|
99
|
+
/**
|
|
100
|
+
* The HTML tag to use for the card footer.
|
|
101
|
+
* @default 'div'
|
|
102
|
+
*/
|
|
103
|
+
footerTag?: keyof HTMLElementTagNameMap;
|
|
104
|
+
/**
|
|
105
|
+
* The HTML tag to use for the card media.
|
|
106
|
+
* @default 'div'
|
|
107
|
+
*/
|
|
108
|
+
mediaTag?: keyof HTMLElementTagNameMap;
|
|
109
|
+
/**
|
|
110
|
+
* Props for the card content.
|
|
111
|
+
*/
|
|
112
|
+
contentProps?: HTMLNeoBaseElement;
|
|
113
|
+
/**
|
|
114
|
+
* Props for the card header.
|
|
115
|
+
*/
|
|
116
|
+
headerProps?: HTMLNeoBaseElement;
|
|
117
|
+
/**
|
|
118
|
+
* Props for the card action
|
|
119
|
+
*/
|
|
120
|
+
actionProps?: HTMLActionProps;
|
|
121
|
+
/**
|
|
122
|
+
* Props for the card footer.
|
|
123
|
+
*/
|
|
124
|
+
footerProps?: HTMLNeoBaseElement;
|
|
125
|
+
/**
|
|
126
|
+
* Props for the card media.
|
|
127
|
+
*/
|
|
128
|
+
mediaProps?: HTMLNeoBaseElement;
|
|
129
|
+
} & NeoCardContext & HTMLNeoBaseElement & HTMLFlexProps & HTMLActionProps & HTMLRefProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { NeoTransitionContainerProps } from './neo-transition-container.model.js';
|
|
3
|
+
|
|
4
|
+
const {
|
|
5
|
+
// Snippets
|
|
6
|
+
children,
|
|
7
|
+
|
|
8
|
+
// States
|
|
9
|
+
tag = 'div',
|
|
10
|
+
|
|
11
|
+
// Styles
|
|
12
|
+
overflow = 'hidden',
|
|
13
|
+
width,
|
|
14
|
+
height,
|
|
15
|
+
|
|
16
|
+
// Other props
|
|
17
|
+
...rest
|
|
18
|
+
}: NeoTransitionContainerProps = $props();
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<svelte:element this={tag} class:neo-transition-container={true} style:overflow-x={overflow} style:width style:height {...rest}>
|
|
22
|
+
{@render children?.()}
|
|
23
|
+
</svelte:element>
|
|
24
|
+
|
|
25
|
+
<style>.neo-transition-container {
|
|
26
|
+
display: grid;
|
|
27
|
+
flex-grow: 1;
|
|
28
|
+
grid-template-areas: "transition";
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: 100%;
|
|
31
|
+
}
|
|
32
|
+
.neo-transition-container :global(> *) {
|
|
33
|
+
grid-area: transition;
|
|
34
|
+
}</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { NeoTransitionContainerProps } from './neo-transition-container.model.js';
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const NeoTransitionContainer: $$__sveltets_2_IsomorphicComponent<NeoTransitionContainerProps, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, "">;
|
|
18
|
+
type NeoTransitionContainer = InstanceType<typeof NeoTransitionContainer>;
|
|
19
|
+
export default NeoTransitionContainer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NeoTransitionContainer } from './NeoTransitionContainer.svelte';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLNeoBaseElement } from '../utils/html-element.utils.js';
|
|
3
|
+
export type NeoTransitionContainerProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Snippet to display as the container content.
|
|
6
|
+
*/
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
/**
|
|
9
|
+
* The HTML tag to use for the container.
|
|
10
|
+
* @default 'div'
|
|
11
|
+
*/
|
|
12
|
+
tag?: keyof HTMLElementTagNameMap;
|
|
13
|
+
/**
|
|
14
|
+
* Horizontal overflow style (overflow-x).
|
|
15
|
+
*/
|
|
16
|
+
overflow?: CSSStyleDeclaration['overflowX'];
|
|
17
|
+
/**
|
|
18
|
+
* Width of the container.
|
|
19
|
+
*/
|
|
20
|
+
width?: CSSStyleDeclaration['width'];
|
|
21
|
+
/**
|
|
22
|
+
* Height of the container.
|
|
23
|
+
*/
|
|
24
|
+
height?: CSSStyleDeclaration['height'];
|
|
25
|
+
} & HTMLNeoBaseElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|