@dvcol/neo-svelte 0.1.2 → 0.1.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/CHANGELOG.md +83 -0
- package/README.md +25 -26
- package/dist/buttons/NeoButton.svelte +140 -128
- package/dist/buttons/NeoButtonGroup.svelte +99 -108
- package/dist/buttons/neo-button-group.model.d.ts +18 -19
- package/dist/buttons/neo-button.model.d.ts +6 -10
- package/dist/cards/NeoCard.svelte +176 -73
- package/dist/cards/NeoCard.svelte.d.ts +1 -1
- package/dist/cards/neo-card.model.d.ts +29 -1
- package/dist/containers/NeoTransitionContainer.svelte +13 -2
- package/dist/containers/neo-transition-container.model.d.ts +9 -1
- package/dist/divider/NeoDivider.svelte +11 -11
- package/dist/icons/IconAccount.svelte +10 -2
- package/dist/icons/IconAdd.svelte +10 -2
- package/dist/icons/IconAlert.svelte +2 -2
- package/dist/icons/IconCalendar.svelte +23 -0
- package/dist/icons/IconCalendar.svelte.d.ts +26 -0
- package/dist/icons/IconCheckbox.svelte +87 -0
- package/dist/icons/IconCheckbox.svelte.d.ts +55 -0
- package/dist/icons/IconCircleLoading.svelte +2 -2
- package/dist/icons/IconClear.svelte +10 -2
- package/dist/icons/IconClose.svelte +2 -2
- package/dist/icons/IconConfirm.svelte +2 -2
- package/dist/icons/IconDownload.svelte +17 -0
- package/dist/icons/IconDownload.svelte.d.ts +26 -0
- package/dist/icons/IconEmpty.svelte +2 -2
- package/dist/icons/IconFileUpload.svelte +2 -2
- package/dist/icons/IconGithub.svelte +2 -2
- package/dist/icons/IconImage.svelte +2 -2
- package/dist/icons/IconMinus.svelte +2 -2
- package/dist/icons/IconMoon.svelte +2 -2
- package/dist/icons/IconPaint.svelte +19 -0
- package/dist/icons/{IconSunrise.svelte.d.ts → IconPaint.svelte.d.ts} +3 -3
- package/dist/icons/IconPencil.svelte +13 -0
- package/dist/icons/IconPencil.svelte.d.ts +26 -0
- package/dist/icons/IconRadio.svelte +14 -0
- package/dist/icons/IconRadio.svelte.d.ts +22 -0
- package/dist/icons/IconSave.svelte +1 -1
- package/dist/icons/IconSave.svelte.d.ts +3 -3
- package/dist/icons/IconSaveOff.svelte +1 -1
- package/dist/icons/IconSaveOff.svelte.d.ts +3 -3
- package/dist/icons/IconSearch.svelte +2 -2
- package/dist/icons/IconSun.svelte +3 -3
- package/dist/icons/{IconSunrise.svelte → IconSunFull.svelte} +5 -4
- package/dist/icons/IconSunFull.svelte.d.ts +26 -0
- package/dist/icons/IconVideo.svelte +2 -2
- package/dist/icons/IconWatch.svelte +2 -2
- package/dist/icons/IconWatchOff.svelte +2 -2
- package/dist/inputs/NeoCheckbox.svelte +316 -0
- package/dist/inputs/NeoCheckbox.svelte.d.ts +19 -0
- package/dist/inputs/NeoColorPicker.svelte +140 -0
- package/dist/inputs/NeoColorPicker.svelte.d.ts +19 -0
- package/dist/inputs/NeoDateTime.svelte +96 -0
- package/dist/inputs/NeoDateTime.svelte.d.ts +19 -0
- package/dist/inputs/NeoFilePicker.svelte +528 -0
- package/dist/inputs/NeoFilePicker.svelte.d.ts +19 -0
- package/dist/inputs/NeoFilePickerCard.svelte +314 -0
- package/dist/inputs/NeoFilePickerCard.svelte.d.ts +19 -0
- package/dist/inputs/NeoNumberStep.svelte +174 -0
- package/dist/inputs/NeoNumberStep.svelte.d.ts +19 -0
- package/dist/inputs/NeoPassword.svelte +86 -17
- package/dist/inputs/NeoPassword.svelte.d.ts +19 -16
- package/dist/inputs/NeoPin.svelte +589 -0
- package/dist/inputs/NeoPin.svelte.d.ts +19 -0
- package/dist/inputs/NeoRadio.svelte +254 -0
- package/dist/inputs/NeoRadio.svelte.d.ts +19 -0
- package/dist/inputs/NeoRange.svelte +518 -0
- package/dist/inputs/NeoRange.svelte.d.ts +18 -0
- package/dist/inputs/NeoSwitch.svelte +373 -0
- package/dist/inputs/NeoSwitch.svelte.d.ts +19 -0
- package/dist/inputs/NeoTextarea.svelte +335 -301
- package/dist/inputs/NeoTextarea.svelte.d.ts +5 -2
- package/dist/inputs/common/NeoAffix.svelte +166 -0
- package/dist/inputs/common/NeoAffix.svelte.d.ts +19 -0
- package/dist/inputs/common/NeoBaseInput.svelte +338 -0
- package/dist/inputs/common/NeoBaseInput.svelte.d.ts +30 -0
- package/dist/inputs/common/NeoInput.svelte +684 -0
- package/dist/inputs/{NeoInput.svelte.d.ts → common/NeoInput.svelte.d.ts} +2 -10
- package/dist/inputs/common/NeoInputValidation.svelte +45 -0
- package/dist/inputs/common/NeoInputValidation.svelte.d.ts +22 -0
- package/dist/inputs/common/NeoLabel.svelte +93 -0
- package/dist/inputs/common/NeoLabel.svelte.d.ts +19 -0
- package/dist/inputs/{NeoValidation.svelte → common/NeoValidation.svelte} +9 -16
- package/dist/inputs/common/NeoValidation.svelte.d.ts +22 -0
- package/dist/inputs/common/neo-affix.model.d.ts +32 -0
- package/dist/inputs/common/neo-input-validation.model.d.ts +20 -0
- package/dist/inputs/common/neo-input-validation.model.js +1 -0
- package/dist/inputs/{neo-input.model.d.ts → common/neo-input.model.d.ts} +148 -68
- package/dist/inputs/common/neo-label.model.d.ts +36 -0
- package/dist/inputs/common/neo-label.model.js +1 -0
- package/dist/inputs/common/neo-validation.model.d.ts +70 -0
- package/dist/inputs/common/neo-validation.model.js +1 -0
- package/dist/inputs/index.d.ts +2 -2
- package/dist/inputs/index.js +1 -1
- package/dist/inputs/neo-checkbox.model.d.ts +9 -0
- package/dist/inputs/neo-checkbox.model.js +1 -0
- package/dist/inputs/neo-color-picker.model.d.ts +17 -0
- package/dist/inputs/neo-color-picker.model.js +1 -0
- package/dist/inputs/neo-date-time.model.d.ts +8 -0
- package/dist/inputs/neo-date-time.model.js +1 -0
- package/dist/inputs/neo-file-picker.model.d.ts +138 -0
- package/dist/inputs/neo-file-picker.model.js +1 -0
- package/dist/inputs/neo-number-step.model.d.ts +24 -0
- package/dist/inputs/neo-number-step.model.js +1 -0
- package/dist/inputs/neo-password.model.d.ts +13 -0
- package/dist/inputs/neo-password.model.js +1 -0
- package/dist/inputs/neo-pin.model.d.ts +47 -0
- package/dist/inputs/neo-pin.model.js +1 -0
- package/dist/inputs/neo-radio.model.d.ts +3 -0
- package/dist/inputs/neo-radio.model.js +1 -0
- package/dist/inputs/neo-switch.model.d.ts +9 -0
- package/dist/inputs/neo-switch.model.js +1 -0
- package/dist/nav/NeoTab.svelte +29 -25
- package/dist/nav/NeoTabPanel.svelte +1 -1
- package/dist/nav/NeoTabs.svelte +51 -44
- package/dist/nav/NeoTabsCard.svelte +8 -10
- package/dist/nav/neo-tabs-context.svelte.d.ts +2 -11
- package/dist/nav/neo-tabs-context.svelte.js +1 -41
- package/dist/nav/neo-tabs.model.d.ts +6 -0
- package/dist/providers/NeoThemeProvider.svelte +417 -305
- package/dist/providers/NeoThemeSelector.svelte +10 -10
- package/dist/providers/neo-theme-provider-context.svelte.js +16 -15
- package/dist/providers/neo-theme-provider.model.d.ts +6 -6
- package/dist/providers/neo-theme-provider.model.js +17 -12
- package/dist/providers/neo-theme-selector.model.d.ts +2 -2
- package/dist/skeletons/NeoSkeletonMedia.svelte +4 -4
- package/dist/skeletons/NeoSkeletonText.svelte +12 -12
- package/dist/styles/common/colors.scss +85 -97
- package/dist/styles/common/filters.scss +17 -0
- package/dist/styles/common/shadows.scss +531 -293
- package/dist/styles/common/spacing.scss +7 -3
- package/dist/styles/common/typography.scss +1 -1
- package/dist/styles/common/utils.scss +1 -1
- package/dist/styles/common/z-index.scss +1 -1
- package/dist/styles/mixin.scss +80 -27
- package/dist/styles/reset.scss +8 -1
- package/dist/styles/theme.scss +39 -16
- package/dist/utils/html-element.utils.d.ts +3 -0
- package/dist/utils/regex.utils.d.ts +3 -0
- package/dist/utils/regex.utils.js +3 -0
- package/dist/utils/shadow.utils.d.ts +30 -3
- package/dist/utils/shadow.utils.js +41 -14
- package/dist/utils/transition.utils.d.ts +4 -0
- package/dist/utils/transition.utils.js +10 -1
- package/dist/utils/utils.svelte.d.ts +6 -0
- package/dist/utils/utils.svelte.js +13 -0
- package/package.json +13 -12
- package/dist/inputs/NeoInput.svelte +0 -750
- package/dist/inputs/NeoValidation.svelte.d.ts +0 -22
- package/dist/inputs/neo-validation.model.d.ts +0 -40
- /package/dist/inputs/{neo-validation.model.js → common/neo-affix.model.js} +0 -0
- /package/dist/inputs/{neo-input.model.js → common/neo-input.model.js} +0 -0
package/dist/nav/NeoTabs.svelte
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { toStyle } from '@dvcol/common-utils/common/class';
|
|
2
3
|
import { height, width } from '@dvcol/svelte-utils/transition';
|
|
3
4
|
|
|
4
5
|
import { untrack } from 'svelte';
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
import { setTabContext } from './neo-tabs-context.svelte.js';
|
|
14
15
|
|
|
15
16
|
import { toAction, toActionProps, toTransition, toTransitionProps } from '../utils/action.utils.js';
|
|
17
|
+
import { computeShadowElevation } from '../utils/shadow.utils.js';
|
|
16
18
|
|
|
17
19
|
/* eslint-disable prefer-const -- necessary for binding checked */
|
|
18
20
|
let {
|
|
@@ -30,8 +32,9 @@
|
|
|
30
32
|
toggle,
|
|
31
33
|
close,
|
|
32
34
|
add,
|
|
33
|
-
slide,
|
|
34
35
|
line,
|
|
36
|
+
slide = true,
|
|
37
|
+
slideElevation = -2,
|
|
35
38
|
|
|
36
39
|
// Events
|
|
37
40
|
onchange,
|
|
@@ -73,7 +76,7 @@
|
|
|
73
76
|
translate = transform(context.position);
|
|
74
77
|
});
|
|
75
78
|
|
|
76
|
-
const style = $derived(
|
|
79
|
+
const style = $derived(toStyle(containerProps?.style, translate));
|
|
77
80
|
|
|
78
81
|
// reflect component active to context
|
|
79
82
|
$effect(() => {
|
|
@@ -91,15 +94,20 @@
|
|
|
91
94
|
toggle,
|
|
92
95
|
add,
|
|
93
96
|
close,
|
|
97
|
+
|
|
98
|
+
// Groups
|
|
99
|
+
borderless: rest.borderless,
|
|
100
|
+
elevation: rest.elevation,
|
|
101
|
+
pressed: rest.pressed,
|
|
102
|
+
convex: rest.convex,
|
|
94
103
|
glass: rest.glass,
|
|
95
|
-
|
|
96
|
-
shallow: rest.shallow,
|
|
104
|
+
start: rest.start,
|
|
97
105
|
vertical: rest.vertical,
|
|
98
|
-
flat: rest.flat,
|
|
99
|
-
text: rest.text,
|
|
100
106
|
});
|
|
101
107
|
});
|
|
102
108
|
|
|
109
|
+
const slideShadow = $derived(computeShadowElevation(slideElevation, { glass: rest.glass }));
|
|
110
|
+
|
|
103
111
|
const inFn = $derived(toTransition(containerProps?.in ?? containerProps?.transition));
|
|
104
112
|
const inProps = $derived(toTransitionProps(containerProps?.in ?? containerProps?.transition));
|
|
105
113
|
const outFn = $derived(toTransition(containerProps?.out ?? containerProps?.transition));
|
|
@@ -118,15 +126,14 @@
|
|
|
118
126
|
this={containerTag}
|
|
119
127
|
bind:this={ref}
|
|
120
128
|
class:neo-tabs={true}
|
|
121
|
-
class:
|
|
122
|
-
class:
|
|
123
|
-
class:
|
|
124
|
-
class:
|
|
125
|
-
class:
|
|
126
|
-
class:
|
|
127
|
-
class:
|
|
128
|
-
|
|
129
|
-
class:shallow={rest.shallow}
|
|
129
|
+
class:neo-inset={(rest?.elevation ?? 0) < 0}
|
|
130
|
+
class:neo-add={add}
|
|
131
|
+
class:neo-line={line}
|
|
132
|
+
class:neo-slide={slide}
|
|
133
|
+
class:neo-translate={translate}
|
|
134
|
+
class:neo-vertical={rest.vertical}
|
|
135
|
+
class:neo-rounded={rest.rounded}
|
|
136
|
+
style:--neo-tabs-slide-box-shadow={slideShadow}
|
|
130
137
|
{...containerProps}
|
|
131
138
|
use:useFn={useProps}
|
|
132
139
|
out:outFn={outProps}
|
|
@@ -162,33 +169,34 @@
|
|
|
162
169
|
.neo-tabs :global(.neo-tabs-add) {
|
|
163
170
|
min-width: 1rem;
|
|
164
171
|
}
|
|
165
|
-
.neo-tabs.vertical :global(.neo-tab) {
|
|
172
|
+
.neo-tabs.neo-vertical :global(.neo-tab) {
|
|
166
173
|
position: relative;
|
|
167
174
|
width: 100%;
|
|
168
175
|
min-width: max-content;
|
|
169
176
|
}
|
|
170
|
-
.neo-tabs.vertical :global(.neo-tab .neo-button) {
|
|
177
|
+
.neo-tabs.neo-vertical :global(.neo-tab .neo-button) {
|
|
171
178
|
justify-content: flex-start;
|
|
172
179
|
}
|
|
173
|
-
.neo-tabs.vertical :global(.neo-tab-close .icon-close) {
|
|
180
|
+
.neo-tabs.neo-vertical :global(.neo-tab-close .neo-icon-close) {
|
|
174
181
|
position: absolute;
|
|
175
182
|
top: calc(50% - 0.5rem);
|
|
176
183
|
}
|
|
177
|
-
.neo-tabs.vertical :global(.neo-tab-close:not(.reverse) .icon-close) {
|
|
184
|
+
.neo-tabs.neo-vertical :global(.neo-tab-close:not(.neo-reverse) .neo-icon-close) {
|
|
178
185
|
right: 0.75rem;
|
|
179
186
|
}
|
|
180
|
-
.neo-tabs.vertical :global(.neo-tab-close.reverse .icon-close) {
|
|
187
|
+
.neo-tabs.neo-vertical :global(.neo-tab-close.neo-reverse .neo-icon-close) {
|
|
181
188
|
left: 0.75rem;
|
|
182
189
|
}
|
|
183
|
-
.neo-tabs.vertical.add :global(.neo-button-group) {
|
|
190
|
+
.neo-tabs.neo-vertical.neo-add :global(.neo-button-group) {
|
|
184
191
|
padding-bottom: 0.5rem;
|
|
185
192
|
}
|
|
186
|
-
.neo-tabs.vertical.line :global(.neo-tab::before) {
|
|
193
|
+
.neo-tabs.neo-vertical.neo-line :global(.neo-tab::before) {
|
|
187
194
|
--neo-tab-width: 2px;
|
|
188
195
|
--neo-tab-old-width: 2px;
|
|
189
196
|
--neo-tab-old-max-height: calc(var(--neo-tab-old-height, 100%) - 1rem);
|
|
190
197
|
--neo-tab-max-height: calc(var(--neo-tab-height, 100%) - 1rem);
|
|
191
198
|
top: 0;
|
|
199
|
+
box-sizing: border-box;
|
|
192
200
|
width: 2px;
|
|
193
201
|
height: 0;
|
|
194
202
|
max-height: var(--neo-tab-max-height);
|
|
@@ -196,29 +204,31 @@
|
|
|
196
204
|
transition: box-shadow 0.3s ease, height 0.3s var(--neo-transition-bezier);
|
|
197
205
|
margin-block: 0.5rem;
|
|
198
206
|
}
|
|
199
|
-
.neo-tabs.vertical.line :global(.neo-tab.active::before) {
|
|
207
|
+
.neo-tabs.neo-vertical.neo-line :global(.neo-tab.neo-active::before) {
|
|
200
208
|
height: var(--neo-tab-height, 100%);
|
|
201
209
|
}
|
|
202
|
-
.neo-tabs.add:not(.vertical) :global(.neo-button-group) {
|
|
210
|
+
.neo-tabs.neo-add:not(.neo-vertical) :global(.neo-button-group) {
|
|
203
211
|
padding-right: 0.5rem;
|
|
204
212
|
}
|
|
205
|
-
.neo-tabs.slide {
|
|
213
|
+
.neo-tabs.neo-slide {
|
|
206
214
|
--neo-tab-width: 100%;
|
|
207
215
|
--neo-tab-height: 100%;
|
|
208
216
|
}
|
|
209
|
-
.neo-tabs.slide :global(.neo-tab .neo-button) {
|
|
217
|
+
.neo-tabs.neo-slide :global(.neo-tab .neo-button) {
|
|
210
218
|
box-shadow: var(--neo-box-shadow-flat) !important;
|
|
211
219
|
}
|
|
212
|
-
.neo-tabs.slide :global(.neo-tab) {
|
|
220
|
+
.neo-tabs.neo-slide :global(.neo-tab .neo-button:hover) {
|
|
221
|
+
color: var(--neo-tabs-text-color-hover, var(--neo-text-color-hover));
|
|
222
|
+
transition: opacity 0.3s ease, color 0.1s ease, background-color 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease, border-radius 0.3s ease, box-shadow 0.15s ease-out;
|
|
223
|
+
}
|
|
224
|
+
.neo-tabs.neo-slide :global(.neo-tab) {
|
|
213
225
|
position: relative;
|
|
214
226
|
}
|
|
215
|
-
.neo-tabs.slide :global(.neo-tab::before) {
|
|
227
|
+
.neo-tabs.neo-slide :global(.neo-tab::before) {
|
|
216
228
|
position: absolute;
|
|
217
|
-
|
|
218
|
-
left: 0;
|
|
229
|
+
inset: 0;
|
|
219
230
|
z-index: var(--neo-z-index-in-front, 1);
|
|
220
|
-
|
|
221
|
-
height: var(--neo-tab-height, 100%);
|
|
231
|
+
box-sizing: border-box;
|
|
222
232
|
border: var(--neo-border-width, 1px) var(--neo-tab-border-color, transparent) solid;
|
|
223
233
|
border-radius: var(--neo-tab-border-radius, var(--neo-border-radius));
|
|
224
234
|
box-shadow: var(--neo-box-shadow-flat);
|
|
@@ -227,13 +237,13 @@
|
|
|
227
237
|
content: "";
|
|
228
238
|
pointer-events: none;
|
|
229
239
|
}
|
|
230
|
-
.neo-tabs.slide.line :global(.neo-tab.active::before) {
|
|
240
|
+
.neo-tabs.neo-slide.neo-line :global(.neo-tab.neo-active::before) {
|
|
231
241
|
top: unset;
|
|
232
242
|
bottom: 0;
|
|
233
243
|
background-color: var(--neo-color-primary, var(--neo-text-color));
|
|
234
244
|
box-shadow: var(--neo-box-shadow-flat);
|
|
235
245
|
}
|
|
236
|
-
.neo-tabs.slide.line:not(.vertical) :global(.neo-tab::before) {
|
|
246
|
+
.neo-tabs.neo-slide.neo-line:not(.neo-vertical) :global(.neo-tab::before) {
|
|
237
247
|
--neo-tab-height: 2px;
|
|
238
248
|
--neo-tab-old-height: 2px;
|
|
239
249
|
--neo-tab-old-max-width: calc(var(--neo-tab-old-width, 100%) - 1.5rem);
|
|
@@ -245,13 +255,13 @@
|
|
|
245
255
|
transition: box-shadow 0.3s ease, width 0.3s var(--neo-transition-bezier);
|
|
246
256
|
margin-inline: 0.75rem;
|
|
247
257
|
}
|
|
248
|
-
.neo-tabs.slide.line:not(.vertical) :global(.neo-tab.active::before) {
|
|
258
|
+
.neo-tabs.neo-slide.neo-line:not(.neo-vertical) :global(.neo-tab.neo-active::before) {
|
|
249
259
|
width: var(--neo-tab-width, 100%);
|
|
250
260
|
}
|
|
251
|
-
.neo-tabs.slide :global(.neo-tab.active::before) {
|
|
252
|
-
box-shadow: var(--neo-box-shadow-inset-
|
|
261
|
+
.neo-tabs.neo-slide :global(.neo-tab.neo-active::before) {
|
|
262
|
+
box-shadow: var(--neo-tabs-slide-box-shadow, var(--neo-box-shadow-inset-2));
|
|
253
263
|
}
|
|
254
|
-
.neo-tabs.slide.translate :global(.neo-tab.active::before) {
|
|
264
|
+
.neo-tabs.neo-slide.neo-translate :global(.neo-tab.neo-active::before) {
|
|
255
265
|
animation: slide 0.6s var(--neo-transition-bezier) forwards;
|
|
256
266
|
}
|
|
257
267
|
@keyframes slide {
|
|
@@ -260,7 +270,7 @@
|
|
|
260
270
|
max-width: var(--neo-tab-old-max-width);
|
|
261
271
|
height: var(--neo-tab-old-height, var(--neo-tab-height, 100%));
|
|
262
272
|
max-height: var(--neo-tab-old-max-height);
|
|
263
|
-
box-shadow: var(--neo-box-shadow-inset-
|
|
273
|
+
box-shadow: var(--neo-tabs-slide-box-shadow, var(--neo-box-shadow-inset-2));
|
|
264
274
|
transform: var(--neo-tabs-transform);
|
|
265
275
|
}
|
|
266
276
|
100% {
|
|
@@ -268,7 +278,7 @@
|
|
|
268
278
|
max-width: var(--neo-tab-max-width);
|
|
269
279
|
height: var(--neo-tab-height, 100%);
|
|
270
280
|
max-height: var(--neo-tab-max-height);
|
|
271
|
-
box-shadow: var(--neo-box-shadow-inset-
|
|
281
|
+
box-shadow: var(--neo-tabs-slide-box-shadow, var(--neo-box-shadow-inset-2));
|
|
272
282
|
transform: translate(0, 0);
|
|
273
283
|
}
|
|
274
284
|
}
|
|
@@ -280,9 +290,6 @@
|
|
|
280
290
|
box-shadow: var(--neo-box-shadow-inset-3);
|
|
281
291
|
}
|
|
282
292
|
}
|
|
283
|
-
.neo-tabs.slide.
|
|
284
|
-
--neo-box-shadow-inset-3: var(--neo-box-shadow-inset-2);
|
|
285
|
-
}
|
|
286
|
-
.neo-tabs.slide.rounded :global(.neo-button-group .neo-tab::before) {
|
|
293
|
+
.neo-tabs.neo-slide.neo-rounded :global(.neo-button-group .neo-tab::before) {
|
|
287
294
|
border-radius: var(--neo-tab-border-radius, var(--neo-border-radius-lg));
|
|
288
295
|
}</style>
|
|
@@ -22,23 +22,21 @@
|
|
|
22
22
|
/* eslint-enable prefer-const */
|
|
23
23
|
|
|
24
24
|
const context = getTabContext();
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return context?.shallow ? 1 : 2;
|
|
32
|
-
});
|
|
25
|
+
const borderless = $derived(context?.state?.borderless);
|
|
26
|
+
const elevation = $derived(context?.state?.elevation);
|
|
27
|
+
const pressed = $derived(context?.state?.pressed);
|
|
28
|
+
const convex = $derived(context?.state?.convex);
|
|
29
|
+
const glass = $derived(context?.state?.glass);
|
|
30
|
+
const start = $derived(context?.state?.start);
|
|
33
31
|
|
|
34
32
|
$effect.pre(() => {
|
|
35
33
|
setTabsCardContext({ animate });
|
|
36
34
|
});
|
|
37
35
|
</script>
|
|
38
36
|
|
|
39
|
-
<NeoCard bind:ref {elevation} {
|
|
37
|
+
<NeoCard bind:ref {borderless} {elevation} {pressed} {convex} {glass} {start} {...rest}>
|
|
40
38
|
{#if animate}
|
|
41
|
-
<NeoTransitionContainer {...containerProps}>
|
|
39
|
+
<NeoTransitionContainer overflowX="hidden" {...containerProps}>
|
|
42
40
|
{@render children?.(context?.state)}
|
|
43
41
|
</NeoTransitionContainer>
|
|
44
42
|
{:else}
|
|
@@ -19,6 +19,7 @@ type NeoTabContextOptions = {
|
|
|
19
19
|
disabled?: boolean;
|
|
20
20
|
/**
|
|
21
21
|
* Whether to animate the tab transition.
|
|
22
|
+
* @default true
|
|
22
23
|
*/
|
|
23
24
|
slide?: boolean;
|
|
24
25
|
/**
|
|
@@ -33,7 +34,7 @@ type NeoTabContextOptions = {
|
|
|
33
34
|
* Add a close button to each tab.
|
|
34
35
|
*/
|
|
35
36
|
close?: boolean;
|
|
36
|
-
} & Pick<NeoButtonGroupProps, '
|
|
37
|
+
} & Pick<NeoButtonGroupProps, 'elevation' | 'pressed' | 'convex' | 'borderless' | 'glass' | 'start' | 'vertical'>;
|
|
37
38
|
export type NeoTabsContext<T = unknown> = NeoTabContextOptions & {
|
|
38
39
|
/**
|
|
39
40
|
* The active tab ID.
|
|
@@ -53,17 +54,7 @@ export declare class NeoTabContext<T = unknown> {
|
|
|
53
54
|
get active(): TabId | undefined;
|
|
54
55
|
get value(): NeoTabContextValue<T> | undefined;
|
|
55
56
|
get previous(): NeoTabContextValue<T> | undefined;
|
|
56
|
-
get disabled(): boolean | undefined;
|
|
57
|
-
get slide(): boolean | undefined;
|
|
58
|
-
get toggle(): boolean | undefined;
|
|
59
|
-
get close(): boolean | undefined;
|
|
60
|
-
get shallow(): boolean | undefined;
|
|
61
|
-
get inset(): boolean | undefined;
|
|
62
|
-
get glass(): boolean | undefined;
|
|
63
|
-
get vertical(): boolean | undefined;
|
|
64
57
|
get position(): NeoTabContextPositions;
|
|
65
|
-
get text(): boolean | undefined;
|
|
66
|
-
get flat(): boolean | undefined;
|
|
67
58
|
get state(): NeoTabsContext;
|
|
68
59
|
constructor({ onChange, onClose }?: NeoTabContextCallbacks<T>);
|
|
69
60
|
getValue(tabId?: TabId): NeoTabContextValue<T> | undefined;
|
|
@@ -19,54 +19,14 @@ export class NeoTabContext {
|
|
|
19
19
|
get previous() {
|
|
20
20
|
return this.getValue(this.#previous);
|
|
21
21
|
}
|
|
22
|
-
get disabled() {
|
|
23
|
-
return this.#options?.disabled;
|
|
24
|
-
}
|
|
25
|
-
get slide() {
|
|
26
|
-
return this.#options?.slide;
|
|
27
|
-
}
|
|
28
|
-
get toggle() {
|
|
29
|
-
return this.#options?.toggle;
|
|
30
|
-
}
|
|
31
|
-
get close() {
|
|
32
|
-
return this.#options?.close;
|
|
33
|
-
}
|
|
34
|
-
get shallow() {
|
|
35
|
-
return this.#options?.shallow;
|
|
36
|
-
}
|
|
37
|
-
get inset() {
|
|
38
|
-
return this.#options?.inset;
|
|
39
|
-
}
|
|
40
|
-
get glass() {
|
|
41
|
-
return this.#options?.glass;
|
|
42
|
-
}
|
|
43
|
-
get vertical() {
|
|
44
|
-
return this.#options?.vertical;
|
|
45
|
-
}
|
|
46
22
|
get position() {
|
|
47
23
|
return this.#position;
|
|
48
24
|
}
|
|
49
|
-
get text() {
|
|
50
|
-
return this.#options?.text;
|
|
51
|
-
}
|
|
52
|
-
get flat() {
|
|
53
|
-
return this.text || this.#options?.flat;
|
|
54
|
-
}
|
|
55
25
|
get state() {
|
|
56
26
|
return {
|
|
57
27
|
...this.#options,
|
|
58
28
|
active: this.active,
|
|
59
29
|
value: this.value,
|
|
60
|
-
slide: this.slide,
|
|
61
|
-
close: this.close,
|
|
62
|
-
toggle: this.toggle,
|
|
63
|
-
inset: this.inset,
|
|
64
|
-
glass: this.glass,
|
|
65
|
-
shallow: this.shallow,
|
|
66
|
-
vertical: this.vertical,
|
|
67
|
-
disabled: this.disabled,
|
|
68
|
-
flat: this.flat,
|
|
69
|
-
text: this.text,
|
|
70
30
|
};
|
|
71
31
|
}
|
|
72
32
|
constructor({ onChange, onClose } = {}) {
|
|
@@ -116,7 +76,7 @@ export class NeoTabContext {
|
|
|
116
76
|
}
|
|
117
77
|
onChange(tabId, emit = true) {
|
|
118
78
|
if (tabId === this.#active) {
|
|
119
|
-
if (this.#active && this.toggle)
|
|
79
|
+
if (this.#active && this.state?.toggle)
|
|
120
80
|
this.onChange();
|
|
121
81
|
return;
|
|
122
82
|
}
|
|
@@ -4,6 +4,7 @@ import type { NeoTabProps, TabId } from './neo-tab.model.js';
|
|
|
4
4
|
import type { NeoTabsContext } from './neo-tabs-context.svelte.js';
|
|
5
5
|
import type { HTMLActionProps } from '../utils/action.utils.js';
|
|
6
6
|
import type { HTMLNeoBaseElement, HTMLRefProps } from '../utils/html-element.utils.js';
|
|
7
|
+
import type { ShadowElevation } from '../utils/shadow.utils.js';
|
|
7
8
|
export type NeoTabContextValue<T = unknown> = {
|
|
8
9
|
index: number;
|
|
9
10
|
value?: T;
|
|
@@ -11,6 +12,7 @@ export type NeoTabContextValue<T = unknown> = {
|
|
|
11
12
|
};
|
|
12
13
|
export type OnChange<T = unknown> = (tabId?: TabId, newValue?: NeoTabContextValue<T>, oldValue?: NeoTabContextValue) => unknown;
|
|
13
14
|
export type OnClose<T = unknown> = (tabId?: TabId, value?: NeoTabContextValue<T>) => unknown;
|
|
15
|
+
export type NeoTabsSlideElevation = ShadowElevation;
|
|
14
16
|
export type NeoTabsContainerProps = HTMLNeoBaseElement & HTMLActionProps;
|
|
15
17
|
export type NeoTabsProps<T = unknown> = {
|
|
16
18
|
/**
|
|
@@ -36,6 +38,10 @@ export type NeoTabsProps<T = unknown> = {
|
|
|
36
38
|
* @default false
|
|
37
39
|
*/
|
|
38
40
|
before?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Whether to animate the tab transition.
|
|
43
|
+
*/
|
|
44
|
+
slideElevation?: NeoTabsSlideElevation;
|
|
39
45
|
/**
|
|
40
46
|
* Event handler that fires when the active tab changes.
|
|
41
47
|
*/
|