@quaffui/quaff 0.1.0-prealpha16 → 0.1.0-prealpha19
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/README.md +6 -6
- package/dist/classes/QContext.svelte.d.ts +42 -0
- package/dist/classes/QContext.svelte.js +63 -0
- package/dist/classes/QScrollObserver.svelte.d.ts +44 -0
- package/dist/classes/QScrollObserver.svelte.js +95 -0
- package/dist/classes/QTheme.svelte.d.ts +11 -0
- package/dist/classes/QTheme.svelte.js +49 -0
- package/dist/classes/Quaff.svelte.d.ts +14 -0
- package/dist/classes/Quaff.svelte.js +35 -0
- package/dist/components/avatar/QAvatar.scss +97 -0
- package/dist/components/avatar/QAvatar.svelte +35 -60
- package/dist/components/avatar/QAvatar.svelte.d.ts +2 -25
- package/dist/components/avatar/docs.props.js +21 -5
- package/dist/components/avatar/index.scss +5 -3
- package/dist/components/avatar/props.d.ts +24 -7
- package/dist/components/breadcrumbs/QBreadcrumbs.scss +10 -0
- package/dist/components/breadcrumbs/QBreadcrumbs.svelte +24 -9
- package/dist/components/breadcrumbs/QBreadcrumbs.svelte.d.ts +2 -22
- package/dist/components/breadcrumbs/QBreadcrumbsEl.scss +10 -0
- package/dist/components/breadcrumbs/QBreadcrumbsEl.svelte +64 -38
- package/dist/components/breadcrumbs/QBreadcrumbsEl.svelte.d.ts +2 -25
- package/dist/components/breadcrumbs/docs.props.js +27 -27
- package/dist/components/breadcrumbs/props.d.ts +25 -24
- package/dist/components/button/QBtn.scss +133 -0
- package/dist/components/button/QBtn.svelte +88 -48
- package/dist/components/button/QBtn.svelte.d.ts +2 -33
- package/dist/components/button/docs.props.js +26 -18
- package/dist/components/button/props.d.ts +21 -15
- package/dist/components/card/QCard.scss +25 -0
- package/dist/components/card/QCard.svelte +25 -16
- package/dist/components/card/QCard.svelte.d.ts +2 -25
- package/dist/components/card/QCardActions.scss +10 -0
- package/dist/components/card/QCardActions.svelte +11 -8
- package/dist/components/card/QCardActions.svelte.d.ts +2 -21
- package/dist/components/card/QCardSection.scss +10 -0
- package/dist/components/card/QCardSection.svelte +8 -6
- package/dist/components/card/QCardSection.svelte.d.ts +2 -22
- package/dist/components/card/docs.props.js +6 -14
- package/dist/components/card/props.d.ts +9 -15
- package/dist/components/checkbox/QCheckbox.svelte +8 -3
- package/dist/components/checkbox/QCheckbox.svelte.d.ts +2 -20
- package/dist/components/checkbox/docs.props.js +1 -1
- package/dist/components/checkbox/index.scss +3 -1
- package/dist/components/checkbox/props.d.ts +1 -2
- package/dist/components/chip/QChip.scss +179 -0
- package/dist/components/chip/QChip.svelte +95 -70
- package/dist/components/chip/QChip.svelte.d.ts +2 -35
- package/dist/components/chip/docs.props.js +23 -47
- package/dist/components/chip/props.d.ts +21 -34
- package/dist/components/codeBlock/QCodeBlock.svelte +64 -42
- package/dist/components/codeBlock/QCodeBlock.svelte.d.ts +2 -20
- package/dist/components/codeBlock/docs.props.js +10 -2
- package/dist/components/codeBlock/props.d.ts +6 -1
- package/dist/components/dialog/{index.scss → QDialog.scss} +9 -7
- package/dist/components/dialog/QDialog.svelte +72 -70
- package/dist/components/dialog/QDialog.svelte.d.ts +6 -36
- package/dist/components/dialog/docs.props.d.ts +0 -8
- package/dist/components/dialog/docs.props.js +1 -131
- package/dist/components/dialog/props.d.ts +0 -16
- package/dist/components/drawer/QDrawer.scss +45 -0
- package/dist/components/drawer/QDrawer.svelte +87 -91
- package/dist/components/drawer/QDrawer.svelte.d.ts +6 -32
- package/dist/components/drawer/docs.props.js +3 -3
- package/dist/components/drawer/props.d.ts +2 -2
- package/dist/components/footer/QFooter.scss +42 -0
- package/dist/components/footer/QFooter.svelte +62 -23
- package/dist/components/footer/QFooter.svelte.d.ts +2 -23
- package/dist/components/footer/docs.props.js +14 -6
- package/dist/components/footer/props.d.ts +8 -5
- package/dist/components/header/QHeader.scss +54 -0
- package/dist/components/header/QHeader.svelte +52 -24
- package/dist/components/header/QHeader.svelte.d.ts +2 -23
- package/dist/components/header/docs.props.js +23 -7
- package/dist/components/header/props.d.ts +11 -3
- package/dist/components/icon/{index.scss → QIcon.scss} +2 -4
- package/dist/components/icon/QIcon.svelte +29 -16
- package/dist/components/icon/QIcon.svelte.d.ts +2 -27
- package/dist/components/icon/docs.props.js +3 -3
- package/dist/components/icon/props.d.ts +4 -4
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +2 -2
- package/dist/components/input/QInput.svelte +52 -25
- package/dist/components/input/QInput.svelte.d.ts +2 -32
- package/dist/components/input/docs.props.js +33 -1
- package/dist/components/input/props.d.ts +5 -12
- package/dist/components/input/props.js +1 -12
- package/dist/components/layout/QLayout.scss +178 -0
- package/dist/components/layout/QLayout.svelte +100 -80
- package/dist/components/layout/QLayout.svelte.d.ts +16 -43
- package/dist/components/layout/docs.props.js +57 -1
- package/dist/components/layout/props.d.ts +8 -0
- package/dist/components/list/QItem.scss +61 -0
- package/dist/components/list/QItem.svelte +65 -46
- package/dist/components/list/QItem.svelte.d.ts +2 -30
- package/dist/components/list/QItemSection.scss +45 -0
- package/dist/components/list/QItemSection.svelte +48 -33
- package/dist/components/list/QItemSection.svelte.d.ts +2 -24
- package/dist/components/list/QList.scss +30 -0
- package/dist/components/list/QList.svelte +25 -14
- package/dist/components/list/QList.svelte.d.ts +2 -28
- package/dist/components/list/docs.props.js +36 -4
- package/dist/components/list/props.d.ts +9 -8
- package/dist/components/list/props.js +1 -25
- package/dist/components/private/ContextReseter.svelte +6 -11
- package/dist/components/private/ContextReseter.svelte.d.ts +6 -18
- package/dist/components/private/QApi.svelte +117 -103
- package/dist/components/private/QApi.svelte.d.ts +4 -16
- package/dist/components/private/QDocs.svelte +67 -48
- package/dist/components/private/QDocs.svelte.d.ts +9 -20
- package/dist/components/private/QDocsSection.svelte +15 -14
- package/dist/components/private/QDocsSection.svelte.d.ts +7 -19
- package/dist/components/private/QIconSnippet.svelte +12 -0
- package/dist/components/private/QIconSnippet.svelte.d.ts +8 -0
- package/dist/components/progress/QCircularProgress.scss +63 -0
- package/dist/components/progress/QCircularProgress.svelte +104 -28
- package/dist/components/progress/QCircularProgress.svelte.d.ts +2 -22
- package/dist/components/progress/QLinearProgress.scss +75 -0
- package/dist/components/progress/QLinearProgress.svelte +55 -13
- package/dist/components/progress/QLinearProgress.svelte.d.ts +2 -20
- package/dist/components/progress/docs.props.js +138 -10
- package/dist/components/progress/props.d.ts +75 -12
- package/dist/components/radio/QRadio.svelte +14 -3
- package/dist/components/radio/QRadio.svelte.d.ts +2 -21
- package/dist/components/radio/docs.props.js +1 -1
- package/dist/components/radio/index.scss +3 -1
- package/dist/components/radio/props.d.ts +1 -3
- package/dist/components/radio/props.js +1 -8
- package/dist/components/railbar/QRailbar.scss +54 -0
- package/dist/components/railbar/QRailbar.svelte +43 -66
- package/dist/components/railbar/QRailbar.svelte.d.ts +2 -22
- package/dist/components/railbar/docs.props.js +4 -4
- package/dist/components/railbar/props.d.ts +3 -3
- package/dist/components/select/QSelect.svelte +121 -88
- package/dist/components/select/QSelect.svelte.d.ts +2 -34
- package/dist/components/select/docs.js +7 -0
- package/dist/components/select/docs.props.js +41 -1
- package/dist/components/select/index.scss +8 -6
- package/dist/components/select/props.d.ts +6 -12
- package/dist/components/select/props.js +1 -12
- package/dist/components/separator/QSeparator.scss +54 -0
- package/dist/components/separator/QSeparator.svelte +38 -45
- package/dist/components/separator/QSeparator.svelte.d.ts +2 -24
- package/dist/components/separator/docs.props.js +4 -4
- package/dist/components/separator/props.d.ts +5 -7
- package/dist/components/separator/props.js +1 -9
- package/dist/components/switch/QSwitch.scss +305 -0
- package/dist/components/switch/QSwitch.svelte +96 -0
- package/dist/components/switch/QSwitch.svelte.d.ts +3 -0
- package/dist/components/{toggle → switch}/docs.d.ts +1 -1
- package/dist/components/{toggle → switch}/docs.js +3 -3
- package/dist/components/{toggle → switch}/docs.props.d.ts +1 -1
- package/dist/components/{toggle → switch}/docs.props.js +30 -6
- package/dist/components/switch/props.d.ts +13 -0
- package/dist/components/switch/props.js +1 -0
- package/dist/components/table/QTable.svelte +99 -85
- package/dist/components/table/QTable.svelte.d.ts +3 -29
- package/dist/components/table/docs.props.js +9 -1
- package/dist/components/table/index.scss +3 -1
- package/dist/components/table/props.d.ts +10 -0
- package/dist/components/tabs/QTab.scss +71 -0
- package/dist/components/tabs/QTab.svelte +74 -90
- package/dist/components/tabs/QTab.svelte.d.ts +2 -25
- package/dist/components/tabs/QTabs.scss +40 -0
- package/dist/components/tabs/QTabs.svelte +110 -58
- package/dist/components/tabs/QTabs.svelte.d.ts +6 -31
- package/dist/components/tabs/docs.props.js +3 -3
- package/dist/components/tabs/index.scss +4 -2
- package/dist/components/tabs/props.d.ts +5 -4
- package/dist/components/toolbar/QToolbar.svelte +15 -12
- package/dist/components/toolbar/QToolbar.svelte.d.ts +2 -23
- package/dist/components/toolbar/QToolbarTitle.svelte +8 -7
- package/dist/components/toolbar/QToolbarTitle.svelte.d.ts +2 -21
- package/dist/components/toolbar/docs.props.js +4 -4
- package/dist/components/toolbar/index.scss +12 -14
- package/dist/components/toolbar/props.d.ts +4 -5
- package/dist/components/tooltip/QTooltip.svelte +5 -9
- package/dist/components/tooltip/QTooltip.svelte.d.ts +2 -21
- package/dist/components/tooltip/docs.props.js +1 -1
- package/dist/components/tooltip/index.scss +3 -1
- package/dist/components/tooltip/props.d.ts +1 -1
- package/dist/composables/index.d.ts +1 -1
- package/dist/composables/index.js +1 -1
- package/dist/composables/useSize.d.ts +10 -9
- package/dist/composables/useSize.js +32 -20
- package/dist/composables/useSizeLegacy.d.ts +9 -0
- package/dist/composables/useSizeLegacy.js +25 -0
- package/dist/css/_components.scss +31 -0
- package/dist/css/_disabled.scss +18 -0
- package/dist/css/{ripple.scss → _ripple.scss} +1 -1
- package/dist/css/_variables.scss +73 -0
- package/dist/css/classes/_design.scss +57 -0
- package/dist/css/classes/_flex.scss +62 -0
- package/dist/css/classes/_grid.scss +35 -0
- package/dist/css/classes/_index.scss +7 -0
- package/dist/css/classes/_overflow.scss +7 -0
- package/dist/css/classes/_position.scss +7 -0
- package/dist/css/classes/_select.scss +6 -0
- package/dist/css/classes/_spaces.scss +23 -0
- package/dist/css/index.css +1 -1
- package/dist/css/index.scss +15 -94
- package/dist/css/mixins/_design.scss +63 -0
- package/dist/css/mixins/{field-mixins.scss → _field.scss} +16 -5
- package/dist/css/mixins/_image.scss +63 -0
- package/dist/css/mixins/_index.scss +9 -0
- package/dist/css/mixins/_layout.scss +20 -0
- package/dist/css/mixins/{menu.scss → _menu.scss} +4 -2
- package/dist/css/mixins/{selection.scss → _selection.scss} +7 -67
- package/dist/css/mixins/_spaces.scss +36 -0
- package/dist/css/mixins/_typography.scss +7 -0
- package/dist/css/shared/q-field.scss +62 -32
- package/dist/css/theme/_colors.scss +173 -0
- package/dist/css/theme/css-variables.scss +5 -0
- package/dist/css/theme/page.scss +3 -3
- package/dist/css/theme/reset.scss +17 -1
- package/dist/css/theme/theme.scss +2 -3
- package/dist/css/theme/tokens.scss +0 -159
- package/dist/helpers/clickOutside.js +2 -1
- package/dist/helpers/ripple.d.ts +1 -1
- package/dist/helpers/ripple.js +13 -4
- package/dist/helpers/version.d.ts +1 -1
- package/dist/helpers/version.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/stores/index.d.ts +0 -2
- package/dist/stores/index.js +1 -2
- package/dist/utils/colors.d.ts +71 -0
- package/dist/utils/colors.js +101 -14
- package/dist/utils/dom.d.ts +2 -0
- package/dist/utils/dom.js +6 -0
- package/dist/utils/number.d.ts +2 -0
- package/dist/utils/number.js +9 -0
- package/dist/utils/props.js +3 -1
- package/dist/utils/router.d.ts +17 -0
- package/dist/utils/router.js +23 -0
- package/dist/utils/string.d.ts +1 -0
- package/dist/utils/string.js +3 -0
- package/dist/utils/types.d.ts +6 -1
- package/dist/utils/types.js +0 -3
- package/dist/utils/types.json +8 -5
- package/dist/utils/watchable.d.ts +0 -1
- package/package.json +40 -37
- package/dist/components/breadcrumbs/index.scss +0 -20
- package/dist/components/button/index.scss +0 -103
- package/dist/components/card/index.scss +0 -56
- package/dist/components/chip/index.scss +0 -103
- package/dist/components/drawer/index.scss +0 -59
- package/dist/components/footer/index.scss +0 -28
- package/dist/components/layout/index.scss +0 -387
- package/dist/components/list/index.scss +0 -144
- package/dist/components/progress/index.scss +0 -82
- package/dist/components/railbar/index.scss +0 -39
- package/dist/components/separator/index.scss +0 -52
- package/dist/components/toggle/QToggle.svelte +0 -34
- package/dist/components/toggle/QToggle.svelte.d.ts +0 -23
- package/dist/components/toggle/index.scss +0 -31
- package/dist/components/toggle/props.d.ts +0 -9
- package/dist/components/toggle/props.js +0 -9
- package/dist/css/grid.scss +0 -50
- package/dist/css/mixins.scss +0 -137
- package/dist/css/states.scss +0 -75
- package/dist/css/theme/bridge.scss +0 -15
- package/dist/css/theme/theme.dark.scss +0 -39
- package/dist/css/theme/theme.light.scss +0 -39
- package/dist/css/variables-sass.scss +0 -16
- package/dist/stores/QTheme.d.ts +0 -42
- package/dist/stores/QTheme.js +0 -59
- package/dist/stores/Quaff.d.ts +0 -32
- package/dist/stores/Quaff.js +0 -58
- /package/dist/css/mixins/{table.scss → _table.scss} +0 -0
|
@@ -1,108 +1,92 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const isInitallyActive = to !== void 0 ? isRouteActive($Quaff.router, to) : name === $qTabStore.value;
|
|
23
|
-
$:
|
|
24
|
-
if (isInitallyActive && qTab) {
|
|
25
|
-
setActive(qTab);
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getContext, hasContext } from "svelte";
|
|
3
|
+
import { QIcon } from "../..";
|
|
4
|
+
import QContext from "../../classes/QContext.svelte";
|
|
5
|
+
import { ripple } from "../../helpers";
|
|
6
|
+
import {
|
|
7
|
+
getClosestFocusableBlock,
|
|
8
|
+
getClosestFocusableSibling,
|
|
9
|
+
} from "../../utils/dom";
|
|
10
|
+
import {
|
|
11
|
+
getDirection,
|
|
12
|
+
isActivationKey,
|
|
13
|
+
isArrowKey,
|
|
14
|
+
isTabKey,
|
|
15
|
+
} from "../../utils/events";
|
|
16
|
+
import { isRouteActive } from "../../utils/router";
|
|
17
|
+
let { name, to, icon, children, ...props } = $props();
|
|
18
|
+
let qTab;
|
|
19
|
+
const tag = $derived(to ? "a" : "button");
|
|
20
|
+
if (!hasContext("QTabsValue")) {
|
|
21
|
+
console.warn("QTab should be use inside QTabs.");
|
|
26
22
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
function setActive(el) {
|
|
37
|
-
const store = get(qTabStore);
|
|
38
|
-
const previousEl = store.activeEl;
|
|
39
|
-
const variant = store.variant;
|
|
40
|
-
const child = variant === "primary" ? el.firstElementChild : { offsetLeft: 0, offsetWidth: 0 };
|
|
41
|
-
const position = variant === "vertical" ? el.offsetTop : el.offsetLeft + child.offsetLeft;
|
|
42
|
-
const size = variant === "vertical" ? el.offsetHeight : child.offsetWidth || el.offsetWidth;
|
|
43
|
-
$qTabStore = {
|
|
44
|
-
variant,
|
|
45
|
-
value: name,
|
|
46
|
-
previousEl,
|
|
47
|
-
activeEl: el,
|
|
48
|
-
utils: {
|
|
49
|
-
size,
|
|
50
|
-
position
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function onClick(e) {
|
|
55
|
-
if (!isActive) {
|
|
56
|
-
setActive(e.target);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function onKeydown(e) {
|
|
60
|
-
if (isActivationKey(e)) {
|
|
61
|
-
e.preventDefault();
|
|
62
|
-
const click = new MouseEvent("click");
|
|
63
|
-
qTab.dispatchEvent(click);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (isArrowKey(e)) {
|
|
67
|
-
e.preventDefault();
|
|
68
|
-
const direction = getDirection(e);
|
|
69
|
-
const targetTab = getClosestFocusableSibling(qTab, direction);
|
|
70
|
-
if (targetTab === qTab) {
|
|
23
|
+
const qTabsRequestCtx = QContext.get("QTabsRequest");
|
|
24
|
+
const qTabsValueCtx = QContext.get("QTabsValue");
|
|
25
|
+
const variant = getContext("QTabsVariant");
|
|
26
|
+
const isActive = $derived(
|
|
27
|
+
to ? $isRouteActive(to) : name === qTabsValueCtx.value,
|
|
28
|
+
);
|
|
29
|
+
function onclick(e) {
|
|
30
|
+
props.onclick?.(e);
|
|
31
|
+
if (e.defaultPrevented || isActive) {
|
|
71
32
|
return;
|
|
72
33
|
}
|
|
73
|
-
|
|
74
|
-
return;
|
|
34
|
+
qTabsRequestCtx.update(name);
|
|
75
35
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
36
|
+
function onkeydown(e) {
|
|
37
|
+
props.onkeydown?.(e);
|
|
38
|
+
if (isActivationKey(e)) {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
const click = new MouseEvent("click");
|
|
41
|
+
return onclick(click);
|
|
42
|
+
}
|
|
43
|
+
if (isArrowKey(e)) {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
const direction = getDirection(e);
|
|
46
|
+
const targetTab = getClosestFocusableSibling(qTab, direction);
|
|
47
|
+
if (targetTab === qTab) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
return targetTab?.focus();
|
|
51
|
+
}
|
|
52
|
+
if (isTabKey(e)) {
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
const direction = e.shiftKey ? "previous" : "next";
|
|
55
|
+
const targetBlock = getClosestFocusableBlock(qTab, direction);
|
|
56
|
+
targetBlock?.focus();
|
|
57
|
+
}
|
|
81
58
|
}
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
59
|
</script>
|
|
85
60
|
|
|
86
61
|
<svelte:element
|
|
87
62
|
this={tag}
|
|
88
|
-
use:ripple
|
|
89
63
|
bind:this={qTab}
|
|
64
|
+
use:ripple
|
|
65
|
+
{...props}
|
|
66
|
+
class="q-tab{props.class ? ` ${props.class}` : ''}"
|
|
67
|
+
class:q-tab--active={isActive}
|
|
90
68
|
href={to}
|
|
91
69
|
role={tag === "a" ? "button" : undefined}
|
|
92
70
|
aria-current={isActive || undefined}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
on:click={onClick}
|
|
97
|
-
on:keydown={onKeydown}
|
|
98
|
-
{...$$restProps}
|
|
71
|
+
aria-label={name}
|
|
72
|
+
{onclick}
|
|
73
|
+
{onkeydown}
|
|
99
74
|
>
|
|
100
|
-
<div>
|
|
101
|
-
{#if icon}
|
|
75
|
+
<div class="q-tab__content">
|
|
76
|
+
{#if typeof icon === "string"}
|
|
102
77
|
<QIcon name={icon} class="q-tab__icon" />
|
|
103
|
-
{:else
|
|
104
|
-
|
|
78
|
+
{:else}
|
|
79
|
+
{@render icon?.()}
|
|
80
|
+
{/if}
|
|
81
|
+
|
|
82
|
+
{@render children?.()}
|
|
83
|
+
|
|
84
|
+
{#if variant === "primary"}
|
|
85
|
+
<div class="q-tab__indicator"></div>
|
|
105
86
|
{/if}
|
|
106
|
-
<slot />
|
|
107
87
|
</div>
|
|
88
|
+
|
|
89
|
+
{#if variant !== "primary"}
|
|
90
|
+
<div class="q-tab__indicator"></div>
|
|
91
|
+
{/if}
|
|
108
92
|
</svelte:element>
|
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { QTabProps } from "./props";
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
[x: string]: any;
|
|
6
|
-
name: QTabProps["name"];
|
|
7
|
-
to?: QTabProps["to"];
|
|
8
|
-
icon?: QTabProps["icon"];
|
|
9
|
-
class?: string | null | undefined;
|
|
10
|
-
};
|
|
11
|
-
events: {
|
|
12
|
-
click: MouseEvent;
|
|
13
|
-
} & {
|
|
14
|
-
[evt: string]: CustomEvent<any>;
|
|
15
|
-
};
|
|
16
|
-
slots: {
|
|
17
|
-
icon: {};
|
|
18
|
-
default: {};
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
type QTabProps_ = typeof __propDef.props;
|
|
22
|
-
export { QTabProps_ as QTabProps };
|
|
23
|
-
export type QTabEvents = typeof __propDef.events;
|
|
24
|
-
export type QTabSlots = typeof __propDef.slots;
|
|
25
|
-
export default class QTab extends SvelteComponent<QTabProps, QTabEvents, QTabSlots> {
|
|
26
|
-
}
|
|
2
|
+
declare const QTab: import("svelte").Component<QTabProps, {}, "">;
|
|
3
|
+
export default QTab;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
@use "$css/mixins";
|
|
2
|
+
|
|
3
|
+
.q-tabs {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
gap: 0;
|
|
8
|
+
max-width: 100%;
|
|
9
|
+
overflow: auto;
|
|
10
|
+
scroll-behavior: smooth;
|
|
11
|
+
border-radius: 0;
|
|
12
|
+
border-bottom: solid 0.0625rem var(--outline);
|
|
13
|
+
&::-webkit-scrollbar {
|
|
14
|
+
display: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&.q-tabs--secondary .q-tab .q-tab__indicator {
|
|
18
|
+
border-radius: 0;
|
|
19
|
+
height: 0.125rem;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&.q-tabs--vertical {
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
width: fit-content;
|
|
25
|
+
align-items: stretch;
|
|
26
|
+
border-bottom: unset;
|
|
27
|
+
border-right: solid 0.0625rem var(--outline);
|
|
28
|
+
|
|
29
|
+
& > .q-tab {
|
|
30
|
+
@include mixins.padding("x-md");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
& .q-tab .q-tab__indicator {
|
|
34
|
+
inset: 0 0 0 auto;
|
|
35
|
+
border-radius: 0;
|
|
36
|
+
height: unset;
|
|
37
|
+
width: 0.125rem;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -1,66 +1,118 @@
|
|
|
1
|
-
<script context="module"></script>
|
|
1
|
+
<script context="module" lang="ts"></script>
|
|
2
2
|
|
|
3
|
-
<script
|
|
4
|
-
import { setContext } from "svelte";
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
qTabStore.update(($store) => {
|
|
22
|
-
$store.value = value;
|
|
23
|
-
return $store;
|
|
3
|
+
<script lang="ts">
|
|
4
|
+
import { setContext, untrack } from "svelte";
|
|
5
|
+
import QContext from "../../classes/QContext.svelte";
|
|
6
|
+
import { shouldReduceMotion } from "../../utils/dom";
|
|
7
|
+
let {
|
|
8
|
+
value = $bindable(),
|
|
9
|
+
variant = "primary",
|
|
10
|
+
round = false,
|
|
11
|
+
children,
|
|
12
|
+
...props
|
|
13
|
+
} = $props();
|
|
14
|
+
let qTabs;
|
|
15
|
+
let tabList;
|
|
16
|
+
const valueContext = new QContext("QTabsValue", value);
|
|
17
|
+
const requestContext = new QContext("QTabsRequest", null);
|
|
18
|
+
setContext("QTabsVariant", variant);
|
|
19
|
+
$effect(() => {
|
|
20
|
+
tabList = Array.from(qTabs.querySelectorAll(".q-tab"));
|
|
24
21
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
22
|
+
$effect(() => {
|
|
23
|
+
if (!value) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
untrack(() => {
|
|
27
|
+
const newTab = getResquetingTab(value);
|
|
28
|
+
animateIndicator(newTab);
|
|
29
|
+
valueContext.update(value);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
$effect(() => {
|
|
33
|
+
const request = requestContext.value;
|
|
34
|
+
if (!request) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const defaultPrevented = !dispatchEvent(
|
|
38
|
+
new Event("change", { bubbles: true, cancelable: true }),
|
|
39
|
+
);
|
|
40
|
+
const requester = getResquetingTab(request);
|
|
41
|
+
if (defaultPrevented || !requester) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
untrack(() => {
|
|
45
|
+
value = request;
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
function getResquetingTab(requestingTabName) {
|
|
49
|
+
return (
|
|
50
|
+
tabList.find(
|
|
51
|
+
(tab) => tab.getAttribute("aria-label") === requestingTabName,
|
|
52
|
+
) ?? null
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
function getActiveTab() {
|
|
56
|
+
return (
|
|
57
|
+
tabList.find((tab) => tab.getAttribute("aria-current") === "true") ?? null
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
function animateIndicator(newTab) {
|
|
61
|
+
const qIndicator = newTab?.querySelector(".q-tab__indicator");
|
|
62
|
+
if (!qIndicator) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const previousTab = getActiveTab();
|
|
66
|
+
qIndicator.getAnimations().forEach((animation) => animation.cancel());
|
|
67
|
+
const frames = getKeyframes(previousTab, newTab);
|
|
68
|
+
if (frames) {
|
|
69
|
+
qIndicator.animate(frames, {
|
|
70
|
+
duration: 600,
|
|
71
|
+
easing: "cubic-bezier(.18,.77,0,1)",
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function getKeyframes(oldTab, newTab) {
|
|
76
|
+
const reduceMotion = shouldReduceMotion();
|
|
77
|
+
if (!oldTab) {
|
|
78
|
+
return reduceMotion ? [{ opacity: 1 }, { transform: "none" }] : null;
|
|
79
|
+
}
|
|
80
|
+
const previousEl =
|
|
81
|
+
variant === "primary" ? oldTab?.querySelector(".q-tab__content") : oldTab;
|
|
82
|
+
const activeEl =
|
|
83
|
+
variant === "primary" ? newTab?.querySelector(".q-tab__content") : newTab;
|
|
84
|
+
const pos = variant === "vertical" ? "top" : "left";
|
|
85
|
+
const extent = variant === "vertical" ? "height" : "width";
|
|
86
|
+
const axis = variant === "vertical" ? "Y" : "X";
|
|
87
|
+
const fromRect = previousEl?.getBoundingClientRect() ?? {};
|
|
88
|
+
const fromPos = fromRect[pos];
|
|
89
|
+
const fromExtent = fromRect[extent];
|
|
90
|
+
const toRect = activeEl?.getBoundingClientRect() ?? {};
|
|
91
|
+
const toPos = toRect[pos];
|
|
92
|
+
const toExtent = toRect[extent];
|
|
93
|
+
const scale = fromExtent / toExtent;
|
|
94
|
+
const keyframe = {};
|
|
95
|
+
if (
|
|
96
|
+
!reduceMotion &&
|
|
97
|
+
fromPos !== void 0 &&
|
|
98
|
+
toPos !== void 0 &&
|
|
99
|
+
!isNaN(scale)
|
|
100
|
+
) {
|
|
101
|
+
const translateAnimation = (fromPos - toPos).toFixed(4);
|
|
102
|
+
const scaleAnimation = scale.toFixed(4);
|
|
103
|
+
keyframe.transform = `translate${axis}(${translateAnimation}px) scale${axis}(${scaleAnimation})`;
|
|
41
104
|
} else {
|
|
42
|
-
|
|
43
|
-
let transitionSize;
|
|
44
|
-
if (comparePositions === "next") {
|
|
45
|
-
transitionSize = prepareTransitionSize(storeVariant, previousEl, activeEl);
|
|
46
|
-
} else {
|
|
47
|
-
transitionSize = prepareTransitionSize(storeVariant, activeEl, previousEl);
|
|
48
|
-
qTabs.style.setProperty(cssVars.indicatorPosition, `${position}px`);
|
|
49
|
-
}
|
|
50
|
-
qTabs.style.setProperty(cssVars.indicatorSize, `${transitionSize / tabsSize}`);
|
|
51
|
-
setTimeout(() => {
|
|
52
|
-
qTabs.style.setProperty(cssVars.indicatorPosition, `${position}px`);
|
|
53
|
-
qTabs.style.setProperty(cssVars.indicatorSize, `${tabSize}`);
|
|
54
|
-
}, 250);
|
|
105
|
+
keyframe.opacity = 0;
|
|
55
106
|
}
|
|
107
|
+
return [keyframe, { transform: "none" }];
|
|
56
108
|
}
|
|
57
|
-
function prepareTransitionSize(storeVariant, fromEl, toEl) {
|
|
58
|
-
const fromElChild = storeVariant === "primary" ? fromEl.firstElementChild : { offsetLeft: 0, offsetWidth: 0 };
|
|
59
|
-
const toElChild = storeVariant === "primary" ? toEl.firstElementChild : { offsetLeft: 0, offsetWidth: 0 };
|
|
60
|
-
return storeVariant === "vertical" ? toEl.offsetTop + toEl.offsetHeight - fromEl.offsetTop : toEl.offsetLeft + toElChild.offsetLeft + (toElChild.offsetWidth || toEl.offsetWidth) - (fromEl.offsetLeft + fromElChild.offsetLeft);
|
|
61
|
-
}
|
|
62
109
|
</script>
|
|
63
110
|
|
|
64
|
-
<nav
|
|
65
|
-
|
|
111
|
+
<nav
|
|
112
|
+
{...props}
|
|
113
|
+
bind:this={qTabs}
|
|
114
|
+
class="q-tabs{props.class ? ` ${props.class}` : ''} q-tabs--{variant}"
|
|
115
|
+
class:q-tabs--rounded={round}
|
|
116
|
+
>
|
|
117
|
+
{@render children?.()}
|
|
66
118
|
</nav>
|
|
@@ -1,33 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
variant: QTabsProps["variant"];
|
|
6
|
-
previousEl: QTab | null;
|
|
7
|
-
activeEl: QTab | null;
|
|
8
|
-
utils: {
|
|
9
|
-
position: number;
|
|
10
|
-
size: number;
|
|
11
|
-
};
|
|
1
|
+
export type QTabEl = HTMLAnchorElement | HTMLButtonElement;
|
|
2
|
+
export type QTabsElementsContext = {
|
|
3
|
+
previous: QTabEl | null;
|
|
4
|
+
active: QTabEl | null;
|
|
12
5
|
};
|
|
13
6
|
import type { QTabsProps } from "./props";
|
|
14
|
-
declare const
|
|
15
|
-
|
|
16
|
-
value?: QTabsProps["value"];
|
|
17
|
-
variant?: QTabsProps["variant"];
|
|
18
|
-
round?: QTabsProps["round"];
|
|
19
|
-
class?: string | null | undefined;
|
|
20
|
-
};
|
|
21
|
-
events: {
|
|
22
|
-
[evt: string]: CustomEvent<any>;
|
|
23
|
-
};
|
|
24
|
-
slots: {
|
|
25
|
-
default: {};
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
type QTabsProps_ = typeof __propDef.props;
|
|
29
|
-
export { QTabsProps_ as QTabsProps };
|
|
30
|
-
export type QTabsEvents = typeof __propDef.events;
|
|
31
|
-
export type QTabsSlots = typeof __propDef.slots;
|
|
32
|
-
export default class QTabs extends SvelteComponent<QTabsProps, QTabsEvents, QTabsSlots> {
|
|
33
|
-
}
|
|
7
|
+
declare const QTabs: import("svelte").Component<QTabsProps, {}, "value">;
|
|
8
|
+
export default QTabs;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// AUTO GENERATED FILE - DO NOT MODIFY OR DELETE
|
|
2
|
-
// @quaffHash
|
|
2
|
+
// @quaffHash 34e1efd974e8b37c46e10e23636ef284
|
|
3
3
|
export const QTabsDocsProps = [
|
|
4
4
|
{
|
|
5
5
|
name: "value",
|
|
@@ -45,9 +45,9 @@ export const QTabDocsProps = [
|
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
name: "icon",
|
|
48
|
-
type: "
|
|
48
|
+
type: "MaterialSymbol | Snippet",
|
|
49
49
|
optional: true,
|
|
50
|
-
clickableType:
|
|
50
|
+
clickableType: true,
|
|
51
51
|
description: "",
|
|
52
52
|
default: "",
|
|
53
53
|
},
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use "$css/mixins";
|
|
2
|
+
|
|
1
3
|
.q-tabs {
|
|
2
4
|
position: relative;
|
|
3
5
|
display: flex;
|
|
@@ -26,7 +28,7 @@
|
|
|
26
28
|
border-radius: 0;
|
|
27
29
|
gap: 0;
|
|
28
30
|
overflow: hidden;
|
|
29
|
-
@include padding("x
|
|
31
|
+
@include mixins.padding("x-md");
|
|
30
32
|
|
|
31
33
|
& .q-tab__icon {
|
|
32
34
|
margin-right: 0.25rem;
|
|
@@ -65,7 +67,7 @@
|
|
|
65
67
|
border-right: solid 0.0625rem var(--outline-4);
|
|
66
68
|
|
|
67
69
|
& > .q-tab {
|
|
68
|
-
@include padding("x
|
|
70
|
+
@include mixins.padding("x-md");
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
&::after {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import type { MaterialSymbol } from "material-symbols";
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
1
3
|
import type { HTMLAttributes } from "svelte/elements";
|
|
2
|
-
import type { NativeProps } from "../../utils";
|
|
3
4
|
export type QTabsVariants = "primary" | "secondary" | "vertical";
|
|
4
|
-
export interface QTabsProps extends
|
|
5
|
+
export interface QTabsProps extends HTMLAttributes<HTMLElement> {
|
|
5
6
|
value?: string;
|
|
6
7
|
variant?: QTabsVariants;
|
|
7
8
|
round?: boolean;
|
|
8
9
|
}
|
|
9
|
-
export interface QTabProps extends
|
|
10
|
+
export interface QTabProps extends HTMLAttributes<HTMLElement> {
|
|
10
11
|
name: string;
|
|
11
12
|
to?: string;
|
|
12
|
-
icon?:
|
|
13
|
+
icon?: MaterialSymbol | Snippet;
|
|
13
14
|
}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let {
|
|
3
|
+
inset = false,
|
|
4
|
+
border = false,
|
|
5
|
+
elevate = false,
|
|
6
|
+
height = 64,
|
|
7
|
+
children,
|
|
8
|
+
...props
|
|
9
|
+
} = $props();
|
|
5
10
|
</script>
|
|
6
11
|
|
|
7
|
-
<
|
|
8
|
-
|
|
12
|
+
<nav
|
|
13
|
+
{...props}
|
|
14
|
+
class="q-toolbar{props.class ? ` ${props.class}` : ''}"
|
|
9
15
|
class:q-toolbar--inset={inset}
|
|
10
16
|
class:q-toolbar--elevated={elevate}
|
|
11
17
|
class:q-toolbar--bordered={border}
|
|
12
18
|
role="toolbar"
|
|
13
|
-
style
|
|
14
|
-
{...$$restProps}
|
|
19
|
+
style:--toolbar-height="{height}px"
|
|
15
20
|
>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
</nav>
|
|
19
|
-
</header>
|
|
21
|
+
{@render children?.()}
|
|
22
|
+
</nav>
|
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { QToolbarProps } from "./props";
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
[x: string]: any;
|
|
6
|
-
inset?: QToolbarProps["inset"];
|
|
7
|
-
border?: QToolbarProps["border"];
|
|
8
|
-
elevate?: QToolbarProps["elevate"];
|
|
9
|
-
height?: QToolbarProps["height"];
|
|
10
|
-
class?: string | null | undefined;
|
|
11
|
-
};
|
|
12
|
-
events: {
|
|
13
|
-
[evt: string]: CustomEvent<any>;
|
|
14
|
-
};
|
|
15
|
-
slots: {
|
|
16
|
-
default: {};
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
type QToolbarProps_ = typeof __propDef.props;
|
|
20
|
-
export { QToolbarProps_ as QToolbarProps };
|
|
21
|
-
export type QToolbarEvents = typeof __propDef.events;
|
|
22
|
-
export type QToolbarSlots = typeof __propDef.slots;
|
|
23
|
-
export default class QToolbar extends SvelteComponent<QToolbarProps, QToolbarEvents, QToolbarSlots> {
|
|
24
|
-
}
|
|
2
|
+
declare const QToolbar: import("svelte").Component<QToolbarProps, {}, "">;
|
|
3
|
+
export default QToolbar;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
export { userClasses as class, userStyles as style };
|
|
4
|
-
$:
|
|
5
|
-
classes = createClasses([shrink && "shrink", userClasses], { component: "q-toolbar-title" });
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let { shrink = false, children, ...props } = $props();
|
|
6
3
|
</script>
|
|
7
4
|
|
|
8
|
-
<div
|
|
9
|
-
|
|
5
|
+
<div
|
|
6
|
+
{...props}
|
|
7
|
+
class="q-toolbar-title{props.class ? ` ${props.class}` : ''}"
|
|
8
|
+
class:q-toolbar-title--shrink={shrink}
|
|
9
|
+
>
|
|
10
|
+
{@render children?.()}
|
|
10
11
|
</div>
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { QToolbarTitleProps } from "./props";
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
[x: string]: any;
|
|
6
|
-
shrink?: QToolbarTitleProps["shrink"];
|
|
7
|
-
class?: string | null | undefined;
|
|
8
|
-
style?: string | null | undefined;
|
|
9
|
-
};
|
|
10
|
-
events: {
|
|
11
|
-
[evt: string]: CustomEvent<any>;
|
|
12
|
-
};
|
|
13
|
-
slots: {
|
|
14
|
-
default: {};
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
type QToolbarTitleProps_ = typeof __propDef.props;
|
|
18
|
-
export { QToolbarTitleProps_ as QToolbarTitleProps };
|
|
19
|
-
export type QToolbarTitleEvents = typeof __propDef.events;
|
|
20
|
-
export type QToolbarTitleSlots = typeof __propDef.slots;
|
|
21
|
-
export default class QToolbarTitle extends SvelteComponent<QToolbarTitleProps, QToolbarTitleEvents, QToolbarTitleSlots> {
|
|
22
|
-
}
|
|
2
|
+
declare const QToolbarTitle: import("svelte").Component<QToolbarTitleProps, {}, "">;
|
|
3
|
+
export default QToolbarTitle;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// AUTO GENERATED FILE - DO NOT MODIFY OR DELETE
|
|
2
|
-
// @quaffHash
|
|
2
|
+
// @quaffHash beedaeb7026ad26756370f4342f7a11e
|
|
3
3
|
export const QToolbarDocsProps = [
|
|
4
4
|
{
|
|
5
5
|
name: "inset",
|
|
@@ -27,11 +27,11 @@ export const QToolbarDocsProps = [
|
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
name: "height",
|
|
30
|
-
type: "
|
|
30
|
+
type: "number",
|
|
31
31
|
optional: true,
|
|
32
|
-
clickableType:
|
|
32
|
+
clickableType: false,
|
|
33
33
|
description: "",
|
|
34
|
-
default: "
|
|
34
|
+
default: "64",
|
|
35
35
|
},
|
|
36
36
|
];
|
|
37
37
|
export const QToolbarTitleDocsProps = [
|