@quaffui/quaff 0.1.0-prealpha21 → 0.1.0-prealpha22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/avatar/QAvatar.svelte +4 -1
- package/dist/components/avatar/QAvatar.svelte.d.ts +14 -2
- package/dist/components/breadcrumbs/QBreadcrumbs.svelte +7 -2
- package/dist/components/breadcrumbs/QBreadcrumbs.svelte.d.ts +14 -2
- package/dist/components/breadcrumbs/QBreadcrumbsEl.svelte +16 -5
- package/dist/components/breadcrumbs/QBreadcrumbsEl.svelte.d.ts +14 -2
- package/dist/components/button/QBtn.svelte +61 -11
- package/dist/components/button/QBtn.svelte.d.ts +14 -2
- package/dist/components/button/docs.props.js +37 -5
- package/dist/components/button/props.d.ts +24 -4
- package/dist/components/card/QCard.svelte +6 -2
- package/dist/components/card/QCard.svelte.d.ts +14 -2
- package/dist/components/card/QCardActions.svelte +9 -1
- package/dist/components/card/QCardActions.svelte.d.ts +14 -2
- package/dist/components/card/QCardSection.svelte +3 -1
- package/dist/components/card/QCardSection.svelte.d.ts +14 -2
- package/dist/components/checkbox/QCheckbox.svelte +8 -1
- package/dist/components/checkbox/QCheckbox.svelte.d.ts +14 -3
- package/dist/components/chip/QChip.svelte +30 -9
- package/dist/components/chip/QChip.svelte.d.ts +14 -3
- package/dist/components/codeBlock/QCodeBlock.svelte +25 -10
- package/dist/components/codeBlock/QCodeBlock.svelte.d.ts +14 -3
- package/dist/components/dialog/QDialog.svelte +20 -5
- package/dist/components/dialog/QDialog.svelte.d.ts +21 -7
- package/dist/components/drawer/QDrawer.svelte +36 -7
- package/dist/components/drawer/QDrawer.svelte.d.ts +21 -7
- package/dist/components/footer/QFooter.svelte +24 -6
- package/dist/components/footer/QFooter.svelte.d.ts +14 -3
- package/dist/components/header/QHeader.svelte +19 -6
- package/dist/components/header/QHeader.svelte.d.ts +14 -3
- package/dist/components/icon/QIcon.svelte +6 -1
- package/dist/components/icon/QIcon.svelte.d.ts +14 -2
- package/dist/components/input/QInput.svelte +23 -10
- package/dist/components/input/QInput.svelte.d.ts +14 -3
- package/dist/components/input/index.scss +1 -1
- package/dist/components/layout/QLayout.scss +2 -1
- package/dist/components/layout/QLayout.svelte +50 -8
- package/dist/components/layout/QLayout.svelte.d.ts +14 -3
- package/dist/components/list/QItem.svelte +11 -2
- package/dist/components/list/QItem.svelte.d.ts +14 -3
- package/dist/components/list/QItemSection.svelte +9 -3
- package/dist/components/list/QItemSection.svelte.d.ts +14 -3
- package/dist/components/list/QList.svelte +8 -3
- package/dist/components/list/QList.svelte.d.ts +14 -3
- package/dist/components/private/ContextReseter.svelte +10 -1
- package/dist/components/private/ContextReseter.svelte.d.ts +14 -6
- package/dist/components/private/QApi.svelte +32 -9
- package/dist/components/private/QApi.svelte.d.ts +14 -5
- package/dist/components/private/QDocs.svelte +18 -1
- package/dist/components/private/QDocs.svelte.d.ts +14 -10
- package/dist/components/private/QDocsSection.svelte +14 -2
- package/dist/components/private/QDocsSection.svelte.d.ts +14 -7
- package/dist/components/private/QIconSnippet.svelte +11 -1
- package/dist/components/private/QIconSnippet.svelte.d.ts +14 -8
- package/dist/components/progress/QCircularProgress.svelte +19 -3
- package/dist/components/progress/QCircularProgress.svelte.d.ts +14 -2
- package/dist/components/progress/QLinearProgress.svelte +12 -4
- package/dist/components/progress/QLinearProgress.svelte.d.ts +14 -2
- package/dist/components/radio/QRadio.svelte +3 -1
- package/dist/components/radio/QRadio.svelte.d.ts +14 -3
- package/dist/components/railbar/QRailbar.svelte +17 -4
- package/dist/components/railbar/QRailbar.svelte.d.ts +14 -3
- package/dist/components/select/QSelect.svelte +65 -23
- package/dist/components/select/QSelect.svelte.d.ts +14 -3
- package/dist/components/select/index.scss +1 -1
- package/dist/components/separator/QSeparator.svelte +4 -1
- package/dist/components/separator/QSeparator.svelte.d.ts +14 -3
- package/dist/components/switch/QSwitch.svelte +20 -6
- package/dist/components/switch/QSwitch.svelte.d.ts +14 -3
- package/dist/components/table/QTable.svelte +47 -19
- package/dist/components/table/QTable.svelte.d.ts +14 -3
- package/dist/components/tabs/QTab.svelte +32 -9
- package/dist/components/tabs/QTab.svelte.d.ts +14 -3
- package/dist/components/tabs/QTabs.svelte +58 -16
- package/dist/components/tabs/QTabs.svelte.d.ts +14 -3
- package/dist/components/toolbar/QToolbar.svelte +3 -1
- package/dist/components/toolbar/QToolbar.svelte.d.ts +14 -3
- package/dist/components/toolbar/QToolbarTitle.svelte +3 -1
- package/dist/components/toolbar/QToolbarTitle.svelte.d.ts +14 -3
- package/dist/components/tooltip/QTooltip.svelte +8 -1
- package/dist/components/tooltip/QTooltip.svelte.d.ts +14 -3
- package/dist/css/classes/_index.scss +7 -7
- package/dist/css/fonts.scss +3 -2
- package/dist/css/index.css +1 -1
- package/dist/css/index.scss +7 -5
- package/dist/css/mixins/_design.scss +5 -4
- package/dist/css/mixins/_image.scss +2 -1
- package/dist/css/mixins/_index.scss +9 -9
- package/dist/css/theme/_index.scss +12 -0
- package/dist/css/theme/_page.scss +17 -0
- package/dist/css/theme/{palette.scss → _palette.scss} +5 -3
- package/dist/helpers/version.d.ts +1 -1
- package/dist/helpers/version.js +1 -1
- package/dist/utils/types.json +1 -1
- package/package.json +27 -28
- package/dist/css/flex.scss +0 -41
- package/dist/css/theme/page.scss +0 -16
- package/dist/css/theme/theme.scss +0 -10
- /package/dist/css/theme/{colors.module.scss → _color-classes.scss} +0 -0
- /package/dist/css/theme/{css-variables.scss → _css-variables.scss} +0 -0
- /package/dist/css/theme/{elevate.scss → _elevate.scss} +0 -0
- /package/dist/css/theme/{reset.scss → _reset.scss} +0 -0
- /package/dist/css/theme/{typography.module.scss → _typography-classes.scss} +0 -0
- /package/dist/css/theme/{tokens.scss → _typography-variables.scss} +0 -0
- /package/dist/css/theme/{typography.scss → _typography.scss} +0 -0
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
4
|
import { useSize } from "../../composables/useSize";
|
|
5
|
+
import type { QAvatarProps } from "./props";
|
|
6
|
+
|
|
5
7
|
let {
|
|
6
8
|
alt,
|
|
7
9
|
shape = "circle",
|
|
@@ -11,7 +13,8 @@
|
|
|
11
13
|
children,
|
|
12
14
|
videoAccessibility,
|
|
13
15
|
...props
|
|
14
|
-
} = $props();
|
|
16
|
+
}: QAvatarProps = $props();
|
|
17
|
+
|
|
15
18
|
const qSize = $derived(useSize(size, "q-avatar"));
|
|
16
19
|
const qShape = $derived(`q-avatar--${shape}`);
|
|
17
20
|
</script>
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
1
2
|
import type { QAvatarProps } from "./props";
|
|
2
|
-
declare const
|
|
3
|
-
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: QAvatarProps;
|
|
5
|
+
events: {
|
|
6
|
+
[evt: string]: CustomEvent<any>;
|
|
7
|
+
};
|
|
8
|
+
slots: {};
|
|
9
|
+
};
|
|
10
|
+
type QAvatarProps_ = typeof __propDef.props;
|
|
11
|
+
export { QAvatarProps_ as QAvatarProps };
|
|
12
|
+
export type QAvatarEvents = typeof __propDef.events;
|
|
13
|
+
export type QAvatarSlots = typeof __propDef.slots;
|
|
14
|
+
export default class QAvatar extends SvelteComponentTyped<QAvatarProps_, QAvatarEvents, QAvatarSlots> {
|
|
15
|
+
}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
4
|
import { setContext, untrack } from "svelte";
|
|
5
|
+
import type { QBreadcrumbsProps } from "./props";
|
|
6
|
+
|
|
5
7
|
let {
|
|
6
8
|
activeColor = "primary",
|
|
7
9
|
gutter = "sm",
|
|
@@ -9,11 +11,14 @@
|
|
|
9
11
|
separatorColor = "outline",
|
|
10
12
|
children,
|
|
11
13
|
...props
|
|
12
|
-
} = $props();
|
|
13
|
-
|
|
14
|
+
}: QBreadcrumbsProps = $props();
|
|
15
|
+
|
|
16
|
+
let breadrumbElement: HTMLDivElement;
|
|
17
|
+
|
|
14
18
|
$effect(() => {
|
|
15
19
|
untrack(() => breadrumbElement.firstChild?.remove());
|
|
16
20
|
});
|
|
21
|
+
|
|
17
22
|
setContext("activeColor", activeColor);
|
|
18
23
|
setContext("separator", { type: separator, color: separatorColor, gutter });
|
|
19
24
|
</script>
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
1
2
|
import type { QBreadcrumbsProps } from "./props";
|
|
2
|
-
declare const
|
|
3
|
-
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: QBreadcrumbsProps;
|
|
5
|
+
events: {
|
|
6
|
+
[evt: string]: CustomEvent<any>;
|
|
7
|
+
};
|
|
8
|
+
slots: {};
|
|
9
|
+
};
|
|
10
|
+
type QBreadcrumbsProps_ = typeof __propDef.props;
|
|
11
|
+
export { QBreadcrumbsProps_ as QBreadcrumbsProps };
|
|
12
|
+
export type QBreadcrumbsEvents = typeof __propDef.events;
|
|
13
|
+
export type QBreadcrumbsSlots = typeof __propDef.slots;
|
|
14
|
+
export default class QBreadcrumbs extends SvelteComponentTyped<QBreadcrumbsProps_, QBreadcrumbsEvents, QBreadcrumbsSlots> {
|
|
15
|
+
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
<svelte:options runes={true} />
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
|
-
import { getContext } from "svelte";
|
|
4
|
+
import { getContext, type Snippet } from "svelte";
|
|
5
5
|
import { derived } from "svelte/store";
|
|
6
6
|
import { isRouteActive } from "../../utils/router";
|
|
7
7
|
import QIcon from "../icon/QIcon.svelte";
|
|
8
|
+
import type { MaterialSymbol } from "material-symbols";
|
|
9
|
+
import type { QBreadcrumbsElProps } from "./props";
|
|
10
|
+
|
|
8
11
|
let {
|
|
9
12
|
activeClass = "active",
|
|
10
13
|
href,
|
|
@@ -14,11 +17,19 @@
|
|
|
14
17
|
to,
|
|
15
18
|
children = fallback,
|
|
16
19
|
...props
|
|
17
|
-
} = $props();
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
+
}: QBreadcrumbsElProps = $props();
|
|
21
|
+
|
|
22
|
+
const activeColor = getContext<string>("activeColor");
|
|
23
|
+
const separator = getContext<{
|
|
24
|
+
type: `icon:${MaterialSymbol}` | Snippet;
|
|
25
|
+
color: string;
|
|
26
|
+
gutter: string;
|
|
27
|
+
}>("separator");
|
|
28
|
+
|
|
20
29
|
const classesIfActive = derived(isRouteActive, ($isRouteActive) =>
|
|
21
|
-
$isRouteActive(href || to)
|
|
30
|
+
$isRouteActive(href || to)
|
|
31
|
+
? `${activeClass} text-${activeColor}`
|
|
32
|
+
: undefined,
|
|
22
33
|
);
|
|
23
34
|
</script>
|
|
24
35
|
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
1
2
|
import type { QBreadcrumbsElProps } from "./props";
|
|
2
|
-
declare const
|
|
3
|
-
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: QBreadcrumbsElProps;
|
|
5
|
+
events: {
|
|
6
|
+
[evt: string]: CustomEvent<any>;
|
|
7
|
+
};
|
|
8
|
+
slots: {};
|
|
9
|
+
};
|
|
10
|
+
type QBreadcrumbsElProps_ = typeof __propDef.props;
|
|
11
|
+
export { QBreadcrumbsElProps_ as QBreadcrumbsElProps };
|
|
12
|
+
export type QBreadcrumbsElEvents = typeof __propDef.events;
|
|
13
|
+
export type QBreadcrumbsElSlots = typeof __propDef.slots;
|
|
14
|
+
export default class QBreadcrumbsEl extends SvelteComponentTyped<QBreadcrumbsElProps_, QBreadcrumbsElEvents, QBreadcrumbsElSlots> {
|
|
15
|
+
}
|
|
@@ -5,11 +5,19 @@
|
|
|
5
5
|
import { useSize } from "../../composables/useSize";
|
|
6
6
|
import { ripple } from "../../helpers";
|
|
7
7
|
import { isActivationKey } from "../../utils";
|
|
8
|
+
import type { QEvent } from "../../utils";
|
|
8
9
|
import { extractImgSrc } from "../../utils/string";
|
|
9
10
|
import QIcon from "../icon/QIcon.svelte";
|
|
11
|
+
import type { MaterialSymbol } from "material-symbols";
|
|
12
|
+
import type { QBtnVariantOptions, QBtnProps } from "./props";
|
|
13
|
+
|
|
10
14
|
let {
|
|
11
15
|
disabled = false,
|
|
12
|
-
|
|
16
|
+
variant,
|
|
17
|
+
filled = false,
|
|
18
|
+
tonal = false,
|
|
19
|
+
outlined = false,
|
|
20
|
+
flat = false,
|
|
13
21
|
icon,
|
|
14
22
|
label,
|
|
15
23
|
loading = false,
|
|
@@ -24,35 +32,77 @@
|
|
|
24
32
|
onclick,
|
|
25
33
|
children,
|
|
26
34
|
...props
|
|
27
|
-
} = $props();
|
|
28
|
-
|
|
35
|
+
}: QBtnProps = $props();
|
|
36
|
+
|
|
37
|
+
let qBtn: HTMLButtonElement | HTMLAnchorElement;
|
|
38
|
+
|
|
39
|
+
type QBtnMouseEvent = QEvent<MouseEvent, typeof qBtn>;
|
|
40
|
+
|
|
29
41
|
const tag = $derived(to ? "a" : "button");
|
|
30
42
|
const qSize = $derived(useSize(size, "q-btn"));
|
|
43
|
+
|
|
31
44
|
const src = $derived(extractImgSrc(icon));
|
|
32
|
-
|
|
33
|
-
|
|
45
|
+
|
|
46
|
+
const variants: Partial<Record<QBtnVariantOptions, boolean>> = {
|
|
47
|
+
filled,
|
|
48
|
+
tonal,
|
|
49
|
+
outlined,
|
|
50
|
+
flat,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const boolVariant = $derived(
|
|
54
|
+
(Object.keys(variants) as QBtnVariantOptions[]).find(
|
|
55
|
+
(key) => variants[key],
|
|
56
|
+
),
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const finalVariant = $derived<QBtnVariantOptions>(
|
|
60
|
+
variant || boolVariant || "elevated",
|
|
34
61
|
);
|
|
62
|
+
|
|
63
|
+
const color = $derived.by(() => {
|
|
64
|
+
if (finalVariant === "filled") {
|
|
65
|
+
return "on-primary";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (finalVariant === "tonal") {
|
|
69
|
+
return "on-secondary-container";
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return "primary";
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const colorVar = $derived(`var(--${color})`);
|
|
76
|
+
|
|
35
77
|
const rippleColorVar = $derived(
|
|
36
|
-
rippleColor ? `var(--${rippleColor}, ${rippleColor})` :
|
|
78
|
+
rippleColor ? `var(--${rippleColor}, ${rippleColor})` : colorVar,
|
|
37
79
|
);
|
|
38
|
-
|
|
80
|
+
|
|
81
|
+
function stopIfDisabled(e: QBtnMouseEvent) {
|
|
39
82
|
if (disabled) {
|
|
40
83
|
e.preventDefault();
|
|
41
84
|
e.stopImmediatePropagation();
|
|
42
85
|
return;
|
|
43
86
|
}
|
|
87
|
+
|
|
44
88
|
onclick?.(e);
|
|
45
89
|
}
|
|
46
|
-
|
|
90
|
+
|
|
91
|
+
function onkeydown(e: KeyboardEvent) {
|
|
47
92
|
if (e.key === "Escape") {
|
|
48
93
|
qBtn?.blur();
|
|
49
94
|
return;
|
|
50
95
|
}
|
|
96
|
+
|
|
51
97
|
if (!isActivationKey(e)) {
|
|
52
98
|
return;
|
|
53
99
|
}
|
|
100
|
+
|
|
54
101
|
e.preventDefault();
|
|
55
|
-
|
|
102
|
+
|
|
103
|
+
const click = new MouseEvent("click", {
|
|
104
|
+
relatedTarget: qBtn,
|
|
105
|
+
}) as QBtnMouseEvent;
|
|
56
106
|
stopIfDisabled(click);
|
|
57
107
|
}
|
|
58
108
|
</script>
|
|
@@ -67,12 +117,12 @@
|
|
|
67
117
|
{...props}
|
|
68
118
|
class="q-btn{qSize.class ? ` ${qSize.class}` : ''}{props.class
|
|
69
119
|
? ` ${props.class}`
|
|
70
|
-
: ''} q-btn--{
|
|
120
|
+
: ''} q-btn--{finalVariant}"
|
|
71
121
|
class:q-btn--unelevated={unelevated}
|
|
72
122
|
class:q-btn--rectangle={rectangle}
|
|
73
123
|
class:q-btn--round={round || (!children && !label)}
|
|
74
124
|
style:--q-btn-size={qSize.style}
|
|
75
|
-
style:--ripple-color={
|
|
125
|
+
style:--ripple-color={colorVar}
|
|
76
126
|
{target}
|
|
77
127
|
role={tag === "a" ? "button" : undefined}
|
|
78
128
|
aria-disabled={disabled || undefined}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
1
2
|
import type { QBtnProps } from "./props";
|
|
2
|
-
declare const
|
|
3
|
-
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: QBtnProps;
|
|
5
|
+
events: {
|
|
6
|
+
[evt: string]: CustomEvent<any>;
|
|
7
|
+
};
|
|
8
|
+
slots: {};
|
|
9
|
+
};
|
|
10
|
+
type QBtnProps_ = typeof __propDef.props;
|
|
11
|
+
export { QBtnProps_ as QBtnProps };
|
|
12
|
+
export type QBtnEvents = typeof __propDef.events;
|
|
13
|
+
export type QBtnSlots = typeof __propDef.slots;
|
|
14
|
+
export default class QBtn extends SvelteComponentTyped<QBtnProps_, QBtnEvents, QBtnSlots> {
|
|
15
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// AUTO GENERATED FILE - DO NOT MODIFY OR DELETE
|
|
2
|
-
// @quaffHash
|
|
2
|
+
// @quaffHash 0be24e79cccd1bb68f94fa2bcb3fd8ff
|
|
3
3
|
export const QBtnDocsProps = [
|
|
4
4
|
{
|
|
5
5
|
name: "disabled",
|
|
@@ -10,12 +10,44 @@ export const QBtnDocsProps = [
|
|
|
10
10
|
default: "false",
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
|
-
name: "
|
|
14
|
-
type: "
|
|
13
|
+
name: "variant",
|
|
14
|
+
type: "QBtnVariantOptions",
|
|
15
15
|
optional: true,
|
|
16
16
|
clickableType: true,
|
|
17
|
-
description: "Choose the
|
|
18
|
-
default:
|
|
17
|
+
description: "Choose the variant for the button. If a variant is specified, it overwrites all other variants defined with boolean attributes. If no variant is specified using this prop or boolean props, the `elevated` variant will be used.",
|
|
18
|
+
default: "undefined",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "filled",
|
|
22
|
+
type: "boolean",
|
|
23
|
+
optional: true,
|
|
24
|
+
clickableType: false,
|
|
25
|
+
description: 'Equivalent to `variant="filled"`. Overwritten by `variant` but overwrites `tonal`, `outlined` and `flat`.',
|
|
26
|
+
default: "false",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "tonal",
|
|
30
|
+
type: "boolean",
|
|
31
|
+
optional: true,
|
|
32
|
+
clickableType: false,
|
|
33
|
+
description: 'Equivalent to `variant="tonal"`. Overwritten by `variant` and `filled` but overwrites `outlined` and `flat`.',
|
|
34
|
+
default: "false",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "outlined",
|
|
38
|
+
type: "boolean",
|
|
39
|
+
optional: true,
|
|
40
|
+
clickableType: false,
|
|
41
|
+
description: 'Equivalent to `variant="outlined"`. Overwritten by `variant`, `filled` and `tonal` but overwrites `flat`.',
|
|
42
|
+
default: "false",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "flat",
|
|
46
|
+
type: "boolean",
|
|
47
|
+
optional: true,
|
|
48
|
+
clickableType: false,
|
|
49
|
+
description: 'Equivalent to `variant="flat"`. Overwritten by any other variant if defined with the `variant` prop or other boolean variant props.',
|
|
50
|
+
default: "false",
|
|
19
51
|
},
|
|
20
52
|
{
|
|
21
53
|
name: "icon",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MaterialSymbol } from "material-symbols";
|
|
2
2
|
import type { HTMLAttributes, HTMLAnchorAttributes, MouseEventHandler } from "svelte/elements";
|
|
3
3
|
export type QBtnSizeOptions = Exclude<Q.Size, "xs">;
|
|
4
|
-
export type
|
|
4
|
+
export type QBtnVariantOptions = "elevated" | "filled" | "tonal" | "outlined" | "flat";
|
|
5
5
|
export interface QBtnProps extends HTMLAttributes<HTMLButtonElement> {
|
|
6
6
|
/**
|
|
7
7
|
* Puts the button in a disabled state, making it unclickable.
|
|
@@ -9,10 +9,30 @@ export interface QBtnProps extends HTMLAttributes<HTMLButtonElement> {
|
|
|
9
9
|
*/
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
/**
|
|
12
|
-
* Choose the
|
|
13
|
-
* @default
|
|
12
|
+
* Choose the variant for the button. If a variant is specified, it overwrites all other variants defined with boolean attributes. If no variant is specified using this prop or boolean props, the `elevated` variant will be used.
|
|
13
|
+
* @default undefined
|
|
14
|
+
*/
|
|
15
|
+
variant?: QBtnVariantOptions;
|
|
16
|
+
/**
|
|
17
|
+
* Equivalent to `variant="filled"`. Overwritten by `variant` but overwrites `tonal`, `outlined` and `flat`.
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
filled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Equivalent to `variant="tonal"`. Overwritten by `variant` and `filled` but overwrites `outlined` and `flat`.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
tonal?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Equivalent to `variant="outlined"`. Overwritten by `variant`, `filled` and `tonal` but overwrites `flat`.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
outlined?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Equivalent to `variant="flat"`. Overwritten by any other variant if defined with the `variant` prop or other boolean variant props.
|
|
33
|
+
* @default false
|
|
14
34
|
*/
|
|
15
|
-
|
|
35
|
+
flat?: boolean;
|
|
16
36
|
/**
|
|
17
37
|
* Name of the leading icon to use for the button.
|
|
18
38
|
* @default undefined
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<svelte:options runes={true} />
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
|
+
import type { QCardProps } from "./props";
|
|
5
|
+
|
|
4
6
|
let {
|
|
5
7
|
fill = false,
|
|
6
8
|
flat = false,
|
|
@@ -8,8 +10,10 @@
|
|
|
8
10
|
rounded = false,
|
|
9
11
|
children,
|
|
10
12
|
...props
|
|
11
|
-
} = $props();
|
|
12
|
-
|
|
13
|
+
}: QCardProps = $props();
|
|
14
|
+
|
|
15
|
+
const colorOptions: (typeof fill)[] = ["primary", "secondary", "tertiary"];
|
|
16
|
+
|
|
13
17
|
const color = $derived.by(() => {
|
|
14
18
|
if (fill) {
|
|
15
19
|
return colorOptions.includes(fill)
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
1
2
|
import type { QCardProps } from "./props";
|
|
2
|
-
declare const
|
|
3
|
-
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: QCardProps;
|
|
5
|
+
events: {
|
|
6
|
+
[evt: string]: CustomEvent<any>;
|
|
7
|
+
};
|
|
8
|
+
slots: {};
|
|
9
|
+
};
|
|
10
|
+
type QCardProps_ = typeof __propDef.props;
|
|
11
|
+
export { QCardProps_ as QCardProps };
|
|
12
|
+
export type QCardEvents = typeof __propDef.events;
|
|
13
|
+
export type QCardSlots = typeof __propDef.slots;
|
|
14
|
+
export default class QCard extends SvelteComponentTyped<QCardProps_, QCardEvents, QCardSlots> {
|
|
15
|
+
}
|
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
4
|
import { useAlign } from "../../composables/useAlign";
|
|
5
|
-
|
|
5
|
+
import type { QCardActionsProps } from "./props";
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
align,
|
|
9
|
+
vertical = false,
|
|
10
|
+
children,
|
|
11
|
+
...props
|
|
12
|
+
}: QCardActionsProps = $props();
|
|
13
|
+
|
|
6
14
|
const alignClass = $derived(useAlign(align));
|
|
7
15
|
</script>
|
|
8
16
|
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
1
2
|
import type { QCardActionsProps } from "./props";
|
|
2
|
-
declare const
|
|
3
|
-
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: QCardActionsProps;
|
|
5
|
+
events: {
|
|
6
|
+
[evt: string]: CustomEvent<any>;
|
|
7
|
+
};
|
|
8
|
+
slots: {};
|
|
9
|
+
};
|
|
10
|
+
type QCardActionsProps_ = typeof __propDef.props;
|
|
11
|
+
export { QCardActionsProps_ as QCardActionsProps };
|
|
12
|
+
export type QCardActionsEvents = typeof __propDef.events;
|
|
13
|
+
export type QCardActionsSlots = typeof __propDef.slots;
|
|
14
|
+
export default class QCardActions extends SvelteComponentTyped<QCardActionsProps_, QCardActionsEvents, QCardActionsSlots> {
|
|
15
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<svelte:options runes={true} />
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
|
-
|
|
4
|
+
import type { QCardSectionProps } from "./props";
|
|
5
|
+
|
|
6
|
+
let { horizontal = false, children, ...props }: QCardSectionProps = $props();
|
|
5
7
|
</script>
|
|
6
8
|
|
|
7
9
|
<div
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
1
2
|
import type { QCardSectionProps } from "./props";
|
|
2
|
-
declare const
|
|
3
|
-
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: QCardSectionProps;
|
|
5
|
+
events: {
|
|
6
|
+
[evt: string]: CustomEvent<any>;
|
|
7
|
+
};
|
|
8
|
+
slots: {};
|
|
9
|
+
};
|
|
10
|
+
type QCardSectionProps_ = typeof __propDef.props;
|
|
11
|
+
export { QCardSectionProps_ as QCardSectionProps };
|
|
12
|
+
export type QCardSectionEvents = typeof __propDef.events;
|
|
13
|
+
export type QCardSectionSlots = typeof __propDef.slots;
|
|
14
|
+
export default class QCardSection extends SvelteComponentTyped<QCardSectionProps_, QCardSectionEvents, QCardSectionSlots> {
|
|
15
|
+
}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
2
|
+
import type { QCheckboxProps } from "./props";
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
value = $bindable(),
|
|
6
|
+
label = "",
|
|
7
|
+
disable = false,
|
|
8
|
+
...props
|
|
9
|
+
}: QCheckboxProps = $props();
|
|
3
10
|
</script>
|
|
4
11
|
|
|
5
12
|
<label
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
declare const
|
|
3
|
-
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {};
|
|
8
|
+
};
|
|
9
|
+
type QCheckboxProps_ = typeof __propDef.props;
|
|
10
|
+
export { QCheckboxProps_ as QCheckboxProps };
|
|
11
|
+
export type QCheckboxEvents = typeof __propDef.events;
|
|
12
|
+
export type QCheckboxSlots = typeof __propDef.slots;
|
|
13
|
+
export default class QCheckbox extends SvelteComponentTyped<QCheckboxProps_, QCheckboxEvents, QCheckboxSlots> {
|
|
14
|
+
}
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
import { ripple } from "../../helpers";
|
|
3
3
|
import { extractImgSrc, isActivationKey } from "../../utils";
|
|
4
4
|
import { QAvatar, QIcon } from "../..";
|
|
5
|
+
import type { QEvent } from "../../utils";
|
|
6
|
+
import type { MaterialSymbol } from "material-symbols";
|
|
7
|
+
import type { QChipProps } from "./props";
|
|
8
|
+
|
|
9
|
+
type QChipMouseEvent = QEvent<MouseEvent, HTMLDivElement>;
|
|
10
|
+
|
|
5
11
|
let {
|
|
6
12
|
kind = "assist",
|
|
7
13
|
label,
|
|
@@ -10,56 +16,71 @@
|
|
|
10
16
|
disabled = false,
|
|
11
17
|
elevated,
|
|
12
18
|
noRipple = false,
|
|
13
|
-
selected = $bindable(kind === "filter" ? false :
|
|
19
|
+
selected = $bindable(kind === "filter" ? false : undefined),
|
|
14
20
|
size = "sm",
|
|
15
21
|
children,
|
|
16
22
|
...props
|
|
17
|
-
} = $props();
|
|
18
|
-
|
|
23
|
+
}: QChipProps = $props();
|
|
24
|
+
|
|
25
|
+
let qChip: HTMLDivElement;
|
|
26
|
+
|
|
19
27
|
$effect.pre(() => {
|
|
20
|
-
if (selected !==
|
|
28
|
+
if (selected !== undefined && kind !== "filter") {
|
|
21
29
|
throw new Error(
|
|
22
30
|
'Only QChips of kind "filter" can use the "selected" prop.',
|
|
23
31
|
);
|
|
24
32
|
}
|
|
33
|
+
|
|
25
34
|
if ((kind === "assist" || kind === "suggestion") && trailingIcon) {
|
|
26
35
|
console.warn(
|
|
27
36
|
'QChips of kind "assist" and "suggestion" should not have a trailing icon. It will thus be ignored.',
|
|
28
37
|
);
|
|
29
38
|
}
|
|
30
39
|
});
|
|
40
|
+
|
|
31
41
|
const trailing = $derived(
|
|
32
42
|
(kind === "assist" || kind === "suggestion") && trailingIcon
|
|
33
|
-
?
|
|
43
|
+
? undefined
|
|
34
44
|
: trailingIcon,
|
|
35
45
|
);
|
|
46
|
+
|
|
36
47
|
const tabindex = disabled ? -1 : props.tabindex || 0;
|
|
37
48
|
const role = $derived(
|
|
38
|
-
["assist", "filter"].includes(kind) ? "button" :
|
|
49
|
+
["assist", "filter"].includes(kind) ? "button" : undefined,
|
|
39
50
|
);
|
|
51
|
+
|
|
40
52
|
const avatar = $derived(extractImgSrc(icon));
|
|
41
|
-
|
|
53
|
+
|
|
54
|
+
function stopIfDisabled(e: QChipMouseEvent) {
|
|
42
55
|
if (disabled) {
|
|
43
56
|
e.preventDefault();
|
|
44
57
|
e.stopImmediatePropagation();
|
|
45
58
|
return;
|
|
46
59
|
}
|
|
60
|
+
|
|
47
61
|
if (kind === "filter") {
|
|
48
62
|
selected = !selected;
|
|
49
63
|
}
|
|
64
|
+
|
|
50
65
|
e.stopPropagation();
|
|
51
66
|
props.onclick?.(e);
|
|
52
67
|
}
|
|
53
|
-
|
|
68
|
+
|
|
69
|
+
function onkeydown(e: KeyboardEvent) {
|
|
54
70
|
if (e.key === "Escape") {
|
|
55
71
|
qChip?.blur();
|
|
56
72
|
return;
|
|
57
73
|
}
|
|
74
|
+
|
|
58
75
|
if (!isActivationKey(e)) {
|
|
59
76
|
return;
|
|
60
77
|
}
|
|
78
|
+
|
|
61
79
|
e.preventDefault();
|
|
62
|
-
|
|
80
|
+
|
|
81
|
+
const click = new MouseEvent("click", {
|
|
82
|
+
relatedTarget: qChip,
|
|
83
|
+
}) as QChipMouseEvent;
|
|
63
84
|
stopIfDisabled(click);
|
|
64
85
|
}
|
|
65
86
|
</script>
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
declare const
|
|
3
|
-
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {};
|
|
8
|
+
};
|
|
9
|
+
type QChipProps_ = typeof __propDef.props;
|
|
10
|
+
export { QChipProps_ as QChipProps };
|
|
11
|
+
export type QChipEvents = typeof __propDef.events;
|
|
12
|
+
export type QChipSlots = typeof __propDef.slots;
|
|
13
|
+
export default class QChip extends SvelteComponentTyped<QChipProps_, QChipEvents, QChipSlots> {
|
|
14
|
+
}
|