@quaffui/quaff 1.0.0-beta1 → 1.0.0-beta12
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 +2 -0
- package/dist/classes/QScrollObserver.svelte.d.ts +4 -4
- package/dist/classes/QScrollObserver.svelte.js +26 -13
- package/dist/components/avatar/QAvatar.svelte +4 -0
- package/dist/components/avatar/QAvatar.svelte.d.ts +4 -14
- package/dist/components/breadcrumbs/QBreadcrumbs.scss +9 -5
- package/dist/components/breadcrumbs/QBreadcrumbs.svelte +46 -16
- package/dist/components/breadcrumbs/QBreadcrumbs.svelte.d.ts +24 -12
- package/dist/components/breadcrumbs/QBreadcrumbsEl.scss +22 -3
- package/dist/components/breadcrumbs/QBreadcrumbsEl.svelte +50 -38
- package/dist/components/breadcrumbs/QBreadcrumbsEl.svelte.d.ts +4 -14
- package/dist/components/breadcrumbs/props.d.ts +4 -4
- package/dist/components/button/QBtn.scss +3 -1
- package/dist/components/button/QBtn.svelte +38 -22
- package/dist/components/button/QBtn.svelte.d.ts +4 -14
- package/dist/components/button/props.d.ts +9 -2
- package/dist/components/card/QCard.svelte +9 -5
- package/dist/components/card/QCard.svelte.d.ts +4 -14
- package/dist/components/card/QCardActions.svelte +4 -0
- package/dist/components/card/QCardActions.svelte.d.ts +4 -14
- package/dist/components/card/QCardSection.svelte +2 -0
- package/dist/components/card/QCardSection.svelte.d.ts +4 -14
- package/dist/components/checkbox/QCheckbox.svelte +6 -4
- package/dist/components/checkbox/QCheckbox.svelte.d.ts +4 -14
- package/dist/components/checkbox/props.d.ts +1 -1
- package/dist/components/chip/QChip.scss +3 -1
- package/dist/components/chip/QChip.svelte +24 -14
- package/dist/components/chip/QChip.svelte.d.ts +4 -14
- package/dist/components/codeBlock/QCodeBlock.svelte +8 -0
- package/dist/components/codeBlock/QCodeBlock.svelte.d.ts +4 -14
- package/dist/components/dialog/QDialog.scss +17 -0
- package/dist/components/dialog/QDialog.svelte +34 -9
- package/dist/components/dialog/QDialog.svelte.d.ts +8 -21
- package/dist/components/drawer/QDrawer.scss +2 -2
- package/dist/components/drawer/QDrawer.svelte +124 -69
- package/dist/components/drawer/QDrawer.svelte.d.ts +8 -21
- package/dist/components/drawer/props.d.ts +3 -3
- package/dist/components/expansion-item/QExpansionItem.scss +59 -0
- package/dist/components/expansion-item/QExpansionItem.svelte +319 -0
- package/dist/components/expansion-item/QExpansionItem.svelte.d.ts +8 -0
- package/dist/components/expansion-item/docs.d.ts +2 -0
- package/dist/components/expansion-item/docs.js +17 -0
- package/dist/components/expansion-item/props.d.ts +129 -0
- package/dist/components/expansion-item/props.js +1 -0
- package/dist/components/footer/QFooter.scss +1 -1
- package/dist/components/footer/QFooter.svelte +32 -28
- package/dist/components/footer/QFooter.svelte.d.ts +4 -14
- package/dist/components/header/QHeader.scss +1 -1
- package/dist/components/header/QHeader.svelte +41 -33
- package/dist/components/header/QHeader.svelte.d.ts +4 -14
- package/dist/components/icon/QIcon.svelte +6 -4
- package/dist/components/icon/QIcon.svelte.d.ts +4 -14
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.js +3 -1
- package/dist/components/input/QInput.svelte +139 -17
- package/dist/components/input/QInput.svelte.d.ts +4 -14
- package/dist/components/input/docs.js +2 -2
- package/dist/components/input/mask.d.ts +10 -0
- package/dist/components/input/mask.js +204 -0
- package/dist/components/input/props.d.ts +37 -4
- package/dist/components/layout/QLayout.svelte +248 -93
- package/dist/components/layout/QLayout.svelte.d.ts +67 -15
- package/dist/components/layout/props.d.ts +1 -1
- package/dist/components/list/QItem.scss +7 -4
- package/dist/components/list/QItem.svelte +44 -24
- package/dist/components/list/QItem.svelte.d.ts +17 -13
- package/dist/components/list/QItemSection.scss +24 -3
- package/dist/components/list/QItemSection.svelte +19 -21
- package/dist/components/list/QItemSection.svelte.d.ts +4 -14
- package/dist/components/list/QList.scss +17 -4
- package/dist/components/list/QList.svelte +30 -8
- package/dist/components/list/QList.svelte.d.ts +17 -13
- package/dist/components/list/props.d.ts +3 -3
- package/dist/components/menu/QMenu.scss +37 -0
- package/dist/components/menu/QMenu.svelte +314 -0
- package/dist/components/menu/QMenu.svelte.d.ts +8 -0
- package/dist/components/menu/docs.d.ts +2 -0
- package/dist/components/menu/docs.js +27 -0
- package/dist/components/menu/props.d.ts +48 -0
- package/dist/components/menu/props.js +1 -0
- package/dist/components/progress/QCircularProgress.svelte +17 -14
- package/dist/components/progress/QCircularProgress.svelte.d.ts +4 -14
- package/dist/components/progress/QLinearProgress.svelte +15 -15
- package/dist/components/progress/QLinearProgress.svelte.d.ts +4 -14
- package/dist/components/radio/QRadio.svelte +6 -4
- package/dist/components/radio/QRadio.svelte.d.ts +4 -14
- package/dist/components/radio/props.d.ts +1 -1
- package/dist/components/railbar/QRailbar.scss +1 -1
- package/dist/components/railbar/QRailbar.svelte +36 -35
- package/dist/components/railbar/QRailbar.svelte.d.ts +4 -14
- package/dist/components/select/QSelect.svelte +316 -102
- package/dist/components/select/QSelect.svelte.d.ts +4 -14
- package/dist/components/select/filter.d.ts +13 -0
- package/dist/components/select/filter.js +73 -0
- package/dist/components/select/index.scss +28 -27
- package/dist/components/select/option.d.ts +9 -0
- package/dist/components/select/option.js +59 -0
- package/dist/components/select/props.d.ts +40 -7
- package/dist/components/separator/QSeparator.scss +2 -0
- package/dist/components/separator/QSeparator.svelte +9 -8
- package/dist/components/separator/QSeparator.svelte.d.ts +4 -14
- package/dist/components/switch/QSwitch.scss +12 -6
- package/dist/components/switch/QSwitch.svelte +7 -1
- package/dist/components/switch/QSwitch.svelte.d.ts +4 -14
- package/dist/components/table/QTable.svelte +31 -19
- package/dist/components/table/QTable.svelte.d.ts +4 -14
- package/dist/components/table/index.scss +1 -1
- package/dist/components/tabs/QTab.scss +2 -0
- package/dist/components/tabs/QTab.svelte +19 -22
- package/dist/components/tabs/QTab.svelte.d.ts +4 -14
- package/dist/components/tabs/QTabs.svelte +59 -32
- package/dist/components/tabs/QTabs.svelte.d.ts +18 -18
- package/dist/components/toolbar/QToolbar.svelte +2 -0
- package/dist/components/toolbar/QToolbar.svelte.d.ts +4 -14
- package/dist/components/toolbar/QToolbarTitle.svelte +2 -0
- package/dist/components/toolbar/QToolbarTitle.svelte.d.ts +4 -14
- package/dist/components/tooltip/QTooltip.svelte +48 -38
- package/dist/components/tooltip/QTooltip.svelte.d.ts +29 -17
- package/dist/components/tooltip/QTooltipBase.svelte +18 -8
- package/dist/components/tooltip/QTooltipBase.svelte.d.ts +4 -14
- package/dist/composables/index.d.ts +2 -0
- package/dist/composables/index.js +2 -0
- package/dist/composables/useColor.d.ts +1 -0
- package/dist/composables/useColor.js +19 -0
- package/dist/composables/useRevealScrollObserver.svelte.d.ts +9 -0
- package/dist/composables/useRevealScrollObserver.svelte.js +25 -0
- package/dist/composables/useRouterLink.d.ts +3 -2
- package/dist/composables/useRouterLink.js +2 -2
- package/dist/css/_components.scss +2 -0
- package/dist/css/classes/_grid.scss +12 -1
- package/dist/css/index.css +1 -1
- package/dist/css/mixins/_design.scss +1 -1
- package/dist/css/mixins/_field.scss +3 -2
- package/dist/css/mixins/_table.scss +1 -1
- package/dist/css/mixins/_toolbar.scss +1 -1
- package/dist/css/shared/q-field.scss +7 -6
- package/dist/css/theme/_page.scss +8 -6
- package/dist/css/theme/_reset.scss +2 -1
- package/dist/helpers/clickOutside.js +5 -4
- package/dist/helpers/ripple.js +5 -6
- package/dist/helpers/version.d.ts +1 -1
- package/dist/helpers/version.js +1 -1
- package/dist/{components/private/ContextReseter.svelte → internal/ContextResetter.svelte} +2 -3
- package/dist/internal/ContextResetter.svelte.d.ts +8 -0
- package/dist/{components/private → internal}/QIconSnippet.svelte +2 -2
- package/dist/internal/QIconSnippet.svelte.d.ts +10 -0
- package/dist/utils/context.d.ts +49 -32
- package/dist/utils/context.js +82 -33
- package/dist/utils/dom.d.ts +6 -0
- package/dist/utils/dom.js +33 -0
- package/dist/utils/events.d.ts +0 -24
- package/dist/utils/events.js +0 -24
- package/package.json +44 -38
- package/dist/classes/QContext.svelte.d.ts +0 -42
- package/dist/classes/QContext.svelte.js +0 -63
- package/dist/components/avatar/docs.props.d.ts +0 -3
- package/dist/components/avatar/docs.props.js +0 -87
- package/dist/components/breadcrumbs/docs.props.d.ts +0 -5
- package/dist/components/breadcrumbs/docs.props.js +0 -144
- package/dist/components/button/docs.props.d.ts +0 -3
- package/dist/components/button/docs.props.js +0 -227
- package/dist/components/card/docs.props.d.ts +0 -7
- package/dist/components/card/docs.props.js +0 -89
- package/dist/components/checkbox/docs.props.d.ts +0 -3
- package/dist/components/checkbox/docs.props.js +0 -41
- package/dist/components/chip/docs.props.d.ts +0 -3
- package/dist/components/chip/docs.props.js +0 -137
- package/dist/components/codeBlock/docs.props.d.ts +0 -3
- package/dist/components/codeBlock/docs.props.js +0 -83
- package/dist/components/dialog/docs.props.d.ts +0 -3
- package/dist/components/dialog/docs.props.js +0 -65
- package/dist/components/drawer/docs.props.d.ts +0 -3
- package/dist/components/drawer/docs.props.js +0 -149
- package/dist/components/footer/docs.props.d.ts +0 -3
- package/dist/components/footer/docs.props.js +0 -65
- package/dist/components/header/docs.props.d.ts +0 -7
- package/dist/components/header/docs.props.js +0 -131
- package/dist/components/icon/docs.props.d.ts +0 -3
- package/dist/components/icon/docs.props.js +0 -107
- package/dist/components/input/docs.props.d.ts +0 -3
- package/dist/components/input/docs.props.js +0 -162
- package/dist/components/layout/docs.props.d.ts +0 -3
- package/dist/components/layout/docs.props.js +0 -81
- package/dist/components/list/docs.props.d.ts +0 -11
- package/dist/components/list/docs.props.js +0 -434
- package/dist/components/private/ContextReseter.svelte.d.ts +0 -14
- package/dist/components/private/QApi.svelte +0 -296
- package/dist/components/private/QApi.svelte.d.ts +0 -14
- package/dist/components/private/QDocs.svelte +0 -155
- package/dist/components/private/QDocs.svelte.d.ts +0 -14
- package/dist/components/private/QDocsSection.svelte +0 -62
- package/dist/components/private/QDocsSection.svelte.d.ts +0 -14
- package/dist/components/private/QIconSnippet.svelte.d.ts +0 -14
- package/dist/components/private/index.d.ts +0 -6
- package/dist/components/private/index.js +0 -6
- package/dist/components/progress/docs.props.d.ts +0 -5
- package/dist/components/progress/docs.props.js +0 -314
- package/dist/components/radio/docs.props.d.ts +0 -3
- package/dist/components/radio/docs.props.js +0 -53
- package/dist/components/railbar/docs.props.d.ts +0 -3
- package/dist/components/railbar/docs.props.js +0 -47
- package/dist/components/select/docs.props.d.ts +0 -3
- package/dist/components/select/docs.props.js +0 -198
- package/dist/components/separator/docs.props.d.ts +0 -5
- package/dist/components/separator/docs.props.js +0 -196
- package/dist/components/switch/docs.props.d.ts +0 -3
- package/dist/components/switch/docs.props.js +0 -119
- package/dist/components/table/docs.props.d.ts +0 -3
- package/dist/components/table/docs.props.js +0 -94
- package/dist/components/tabs/docs.props.d.ts +0 -5
- package/dist/components/tabs/docs.props.js +0 -86
- package/dist/components/toolbar/docs.props.d.ts +0 -5
- package/dist/components/toolbar/docs.props.js +0 -68
- package/dist/components/tooltip/docs.props.d.ts +0 -3
- package/dist/components/tooltip/docs.props.js +0 -77
- package/dist/utils/types.json +0 -31
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onMount } from "svelte";
|
|
3
3
|
import { QCircularProgress, QIcon } from "../..";
|
|
4
|
-
import { useSize } from "../../composables";
|
|
4
|
+
import { useColor, useSize } from "../../composables";
|
|
5
5
|
import { ripple } from "../../helpers";
|
|
6
6
|
import { isActivationKey, extractImgSrc, type QEvent } from "../../utils";
|
|
7
7
|
import type { MaterialSymbol } from "material-symbols";
|
|
8
8
|
import type { QBtnProps, QBtnVariantOptions } from "./props";
|
|
9
9
|
|
|
10
|
+
type QBtnMouseEvent = QEvent<MouseEvent, typeof qBtn>;
|
|
11
|
+
|
|
12
|
+
// #region: --- Props
|
|
10
13
|
let {
|
|
11
14
|
disabled = false,
|
|
12
15
|
variant,
|
|
16
|
+
color,
|
|
13
17
|
filled = false,
|
|
14
18
|
tonal = false,
|
|
15
19
|
outlined = false,
|
|
@@ -25,27 +29,30 @@
|
|
|
25
29
|
unelevated = false,
|
|
26
30
|
size = "md",
|
|
27
31
|
target,
|
|
32
|
+
tag,
|
|
28
33
|
onclick,
|
|
29
34
|
children,
|
|
30
35
|
...props
|
|
31
36
|
}: QBtnProps = $props();
|
|
37
|
+
// #endregion: --- Props
|
|
32
38
|
|
|
33
|
-
|
|
39
|
+
// #region: --- Non-reactive variables
|
|
40
|
+
let qBtn: HTMLElement;
|
|
34
41
|
let qBtnLabel: HTMLSpanElement;
|
|
42
|
+
// #endregion: --- Non-reactive variables
|
|
35
43
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const tag = $derived(to ? "a" : "button");
|
|
44
|
+
// #region: --- Derived values
|
|
45
|
+
const computedTag = $derived(to ? "a" : tag || "button");
|
|
39
46
|
const qSize = $derived(useSize(size, "q-btn"));
|
|
40
47
|
|
|
41
48
|
const src = $derived(extractImgSrc(icon));
|
|
42
49
|
|
|
43
|
-
const variants: Partial<Record<QBtnVariantOptions, boolean>> = {
|
|
50
|
+
const variants: Partial<Record<QBtnVariantOptions, boolean>> = $derived({
|
|
44
51
|
filled,
|
|
45
52
|
tonal,
|
|
46
53
|
outlined,
|
|
47
54
|
flat,
|
|
48
|
-
};
|
|
55
|
+
});
|
|
49
56
|
|
|
50
57
|
const boolVariant = $derived(
|
|
51
58
|
(Object.keys(variants) as QBtnVariantOptions[]).find(
|
|
@@ -57,11 +64,15 @@
|
|
|
57
64
|
variant || boolVariant || "elevated",
|
|
58
65
|
);
|
|
59
66
|
|
|
60
|
-
const
|
|
67
|
+
const computedColor = $derived.by(() => {
|
|
61
68
|
if (disabled) {
|
|
62
69
|
return undefined;
|
|
63
70
|
}
|
|
64
71
|
|
|
72
|
+
if (color) {
|
|
73
|
+
return color;
|
|
74
|
+
}
|
|
75
|
+
|
|
65
76
|
if (finalVariant === "filled") {
|
|
66
77
|
return "on-primary";
|
|
67
78
|
}
|
|
@@ -73,12 +84,25 @@
|
|
|
73
84
|
return "primary";
|
|
74
85
|
});
|
|
75
86
|
|
|
76
|
-
const colorVar = $derived(
|
|
87
|
+
const colorVar = $derived(computedColor && `var(--${computedColor})`);
|
|
77
88
|
|
|
78
89
|
const rippleColorVar = $derived(
|
|
79
|
-
rippleColor ?
|
|
90
|
+
rippleColor ? useColor(rippleColor) : colorVar,
|
|
80
91
|
);
|
|
92
|
+
// #endregion: --- Derived values
|
|
81
93
|
|
|
94
|
+
// #region: --- Lifecycle
|
|
95
|
+
onMount(() => {
|
|
96
|
+
const { width, height } = qBtnLabel.getBoundingClientRect();
|
|
97
|
+
|
|
98
|
+
// This is required for buttons with no label and with a tooltip to be round
|
|
99
|
+
if (width === 0 && height === 0) {
|
|
100
|
+
qBtn.classList.add("q-btn--round");
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
// #endregion: --- Lifecycle
|
|
104
|
+
|
|
105
|
+
// #region: --- Functions
|
|
82
106
|
function stopIfDisabled(e: QBtnMouseEvent) {
|
|
83
107
|
if (disabled) {
|
|
84
108
|
e.preventDefault();
|
|
@@ -106,19 +130,11 @@
|
|
|
106
130
|
}) as QBtnMouseEvent;
|
|
107
131
|
stopIfDisabled(click);
|
|
108
132
|
}
|
|
109
|
-
|
|
110
|
-
onMount(() => {
|
|
111
|
-
const { width, height } = qBtnLabel.getBoundingClientRect();
|
|
112
|
-
|
|
113
|
-
// This is required for buttons with no label and with a tooltip to be round
|
|
114
|
-
if (width === 0 && height === 0) {
|
|
115
|
-
qBtn.classList.add("q-btn--round");
|
|
116
|
-
}
|
|
117
|
-
});
|
|
133
|
+
// #endregion: --- Functions
|
|
118
134
|
</script>
|
|
119
135
|
|
|
120
136
|
<svelte:element
|
|
121
|
-
this={
|
|
137
|
+
this={computedTag}
|
|
122
138
|
bind:this={qBtn}
|
|
123
139
|
use:ripple={{
|
|
124
140
|
disabled: noRipple || disabled,
|
|
@@ -138,9 +154,9 @@
|
|
|
138
154
|
style:--ripple-color={colorVar}
|
|
139
155
|
{target}
|
|
140
156
|
href={to}
|
|
141
|
-
role={
|
|
157
|
+
role={computedTag === "a" ? "button" : undefined}
|
|
142
158
|
aria-disabled={disabled || undefined}
|
|
143
|
-
tabindex={disabled ? -1 : 0}
|
|
159
|
+
tabindex={disabled ? -1 : props.tabindex || 0}
|
|
144
160
|
{onkeydown}
|
|
145
161
|
onclick={stopIfDisabled}
|
|
146
162
|
data-quaff
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
};
|
|
7
|
-
slots: {};
|
|
8
|
-
};
|
|
9
|
-
type QBtnProps_ = typeof __propDef.props;
|
|
10
|
-
export { QBtnProps_ as QBtnProps };
|
|
11
|
-
export type QBtnEvents = typeof __propDef.events;
|
|
12
|
-
export type QBtnSlots = typeof __propDef.slots;
|
|
13
|
-
export default class QBtn extends SvelteComponentTyped<QBtnProps_, QBtnEvents, QBtnSlots> {
|
|
14
|
-
}
|
|
1
|
+
import type { QBtnProps } from "./props";
|
|
2
|
+
declare const QBtn: import("svelte").Component<QBtnProps, {}, "">;
|
|
3
|
+
type QBtn = ReturnType<typeof QBtn>;
|
|
4
|
+
export default QBtn;
|
|
@@ -8,9 +8,12 @@ export interface QBtnProps extends HTMLAttributes<HTMLButtonElement> {
|
|
|
8
8
|
* @default false
|
|
9
9
|
*/
|
|
10
10
|
disabled?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Sets the color of the button. If a color is specified, it overwrites all other color variants defined with boolean attributes.
|
|
13
|
+
*/
|
|
14
|
+
color?: string;
|
|
11
15
|
/**
|
|
12
16
|
* 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
17
|
*/
|
|
15
18
|
variant?: QBtnVariantOptions;
|
|
16
19
|
/**
|
|
@@ -88,9 +91,13 @@ export interface QBtnProps extends HTMLAttributes<HTMLButtonElement> {
|
|
|
88
91
|
* @default undefined
|
|
89
92
|
*/
|
|
90
93
|
target?: HTMLAnchorAttributes["target"];
|
|
94
|
+
/**
|
|
95
|
+
* The tag to use for the button. If not specified, a button element will be used or, if `to` is specified, an anchor tag will be used.
|
|
96
|
+
*/
|
|
97
|
+
tag?: keyof HTMLElementTagNameMap;
|
|
91
98
|
/**
|
|
92
99
|
* This event is emitted when the button is clicked.
|
|
93
100
|
* @default undefined
|
|
94
101
|
*/
|
|
95
|
-
onclick?: MouseEventHandler<
|
|
102
|
+
onclick?: MouseEventHandler<HTMLElement>;
|
|
96
103
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { QCardProps } from "./props";
|
|
2
|
+
import type { QCardProps, QCardFillColors } from "./props";
|
|
3
3
|
|
|
4
|
+
// #region: --- Props
|
|
4
5
|
let {
|
|
5
6
|
fill = false,
|
|
6
7
|
flat = false,
|
|
@@ -9,24 +10,27 @@
|
|
|
9
10
|
children,
|
|
10
11
|
...props
|
|
11
12
|
}: QCardProps = $props();
|
|
13
|
+
// #endregion: --- Props
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const colorOptions: ColorOptions[] = [
|
|
15
|
+
// #region: --- Non-reactive variables
|
|
16
|
+
const colorOptions: QCardFillColors[] = [
|
|
16
17
|
"primary",
|
|
17
18
|
"secondary",
|
|
18
19
|
"tertiary",
|
|
19
20
|
] as const;
|
|
21
|
+
// #endregion: --- Non-reactive variables
|
|
20
22
|
|
|
23
|
+
// #region: --- Derived values
|
|
21
24
|
const color = $derived.by(() => {
|
|
22
25
|
if (fill) {
|
|
23
|
-
return fill === true || !colorOptions.includes(fill as
|
|
26
|
+
return fill === true || !colorOptions.includes(fill as QCardFillColors)
|
|
24
27
|
? "surface-variant"
|
|
25
28
|
: fill;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
return "surface";
|
|
29
32
|
});
|
|
33
|
+
// #endregion: --- Derived values
|
|
30
34
|
</script>
|
|
31
35
|
|
|
32
36
|
<article
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
};
|
|
7
|
-
slots: {};
|
|
8
|
-
};
|
|
9
|
-
type QCardProps_ = typeof __propDef.props;
|
|
10
|
-
export { QCardProps_ as QCardProps };
|
|
11
|
-
export type QCardEvents = typeof __propDef.events;
|
|
12
|
-
export type QCardSlots = typeof __propDef.slots;
|
|
13
|
-
export default class QCard extends SvelteComponentTyped<QCardProps_, QCardEvents, QCardSlots> {
|
|
14
|
-
}
|
|
1
|
+
import type { QCardProps } from "./props";
|
|
2
|
+
declare const QCard: import("svelte").Component<QCardProps, {}, "">;
|
|
3
|
+
type QCard = ReturnType<typeof QCard>;
|
|
4
|
+
export default QCard;
|
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
import { useAlign } from "../../composables";
|
|
3
3
|
import type { QCardActionsProps } from "./props";
|
|
4
4
|
|
|
5
|
+
// #region: --- Props
|
|
5
6
|
let {
|
|
6
7
|
align,
|
|
7
8
|
vertical = false,
|
|
8
9
|
children,
|
|
9
10
|
...props
|
|
10
11
|
}: QCardActionsProps = $props();
|
|
12
|
+
// #endregion: --- Props
|
|
11
13
|
|
|
14
|
+
// #region: --- Derived values
|
|
12
15
|
const alignClass = $derived(useAlign(align));
|
|
16
|
+
// #endregion: --- Derived values
|
|
13
17
|
</script>
|
|
14
18
|
|
|
15
19
|
<nav
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
};
|
|
7
|
-
slots: {};
|
|
8
|
-
};
|
|
9
|
-
type QCardActionsProps_ = typeof __propDef.props;
|
|
10
|
-
export { QCardActionsProps_ as QCardActionsProps };
|
|
11
|
-
export type QCardActionsEvents = typeof __propDef.events;
|
|
12
|
-
export type QCardActionsSlots = typeof __propDef.slots;
|
|
13
|
-
export default class QCardActions extends SvelteComponentTyped<QCardActionsProps_, QCardActionsEvents, QCardActionsSlots> {
|
|
14
|
-
}
|
|
1
|
+
import type { QCardActionsProps } from "./props";
|
|
2
|
+
declare const QCardActions: import("svelte").Component<QCardActionsProps, {}, "">;
|
|
3
|
+
type QCardActions = ReturnType<typeof QCardActions>;
|
|
4
|
+
export default QCardActions;
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
};
|
|
7
|
-
slots: {};
|
|
8
|
-
};
|
|
9
|
-
type QCardSectionProps_ = typeof __propDef.props;
|
|
10
|
-
export { QCardSectionProps_ as QCardSectionProps };
|
|
11
|
-
export type QCardSectionEvents = typeof __propDef.events;
|
|
12
|
-
export type QCardSectionSlots = typeof __propDef.slots;
|
|
13
|
-
export default class QCardSection extends SvelteComponentTyped<QCardSectionProps_, QCardSectionEvents, QCardSectionSlots> {
|
|
14
|
-
}
|
|
1
|
+
import type { QCardSectionProps } from "./props";
|
|
2
|
+
declare const QCardSection: import("svelte").Component<QCardSectionProps, {}, "">;
|
|
3
|
+
type QCardSection = ReturnType<typeof QCardSection>;
|
|
4
|
+
export default QCardSection;
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { QCheckboxProps } from "./props";
|
|
3
3
|
|
|
4
|
+
// #region: --- Props
|
|
4
5
|
let {
|
|
5
6
|
value = $bindable(),
|
|
6
7
|
label = "",
|
|
7
|
-
|
|
8
|
+
disabled = false,
|
|
8
9
|
...props
|
|
9
10
|
}: QCheckboxProps = $props();
|
|
11
|
+
// #endregion: --- Props
|
|
10
12
|
</script>
|
|
11
13
|
|
|
12
14
|
<label
|
|
13
15
|
{...props}
|
|
14
|
-
class={["q-checkbox", props.class,
|
|
15
|
-
aria-disabled={
|
|
16
|
+
class={["q-checkbox", props.class, disabled && "q-checkbox--disabled"]}
|
|
17
|
+
aria-disabled={disabled || undefined}
|
|
16
18
|
data-quaff
|
|
17
19
|
>
|
|
18
|
-
<input type="checkbox" bind:checked={value} disabled
|
|
20
|
+
<input type="checkbox" bind:checked={value} {disabled} />
|
|
19
21
|
<span>{label}</span>
|
|
20
22
|
</label>
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
}
|
|
1
|
+
import type { QCheckboxProps } from "./props";
|
|
2
|
+
declare const QCheckbox: import("svelte").Component<QCheckboxProps, {}, "value">;
|
|
3
|
+
type QCheckbox = ReturnType<typeof QCheckbox>;
|
|
4
|
+
export default QCheckbox;
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
cursor: pointer;
|
|
20
20
|
user-select: none;
|
|
21
21
|
|
|
22
|
+
isolation: isolate;
|
|
23
|
+
|
|
22
24
|
@include mixins.typography(label-large);
|
|
23
25
|
|
|
24
26
|
&::before {
|
|
@@ -77,7 +79,7 @@
|
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
&.q-chip--outlined {
|
|
80
|
-
outline: 1px solid var(--outline);
|
|
82
|
+
outline: 1px solid var(--outline-variant);
|
|
81
83
|
|
|
82
84
|
&:focus:not([aria-disabled]) {
|
|
83
85
|
outline-color: var(--secondary);
|
|
@@ -7,23 +7,43 @@
|
|
|
7
7
|
|
|
8
8
|
type QChipMouseEvent = QEvent<MouseEvent, HTMLElement>;
|
|
9
9
|
|
|
10
|
+
// #region: --- Props
|
|
10
11
|
let {
|
|
11
12
|
kind = "assist",
|
|
13
|
+
selected = $bindable(kind === "filter" ? false : undefined),
|
|
12
14
|
label,
|
|
13
15
|
icon,
|
|
14
16
|
trailingIcon,
|
|
15
17
|
disabled = false,
|
|
16
18
|
elevated,
|
|
17
19
|
noRipple = false,
|
|
18
|
-
selected = $bindable(kind === "filter" ? false : undefined),
|
|
19
20
|
size = "sm",
|
|
20
21
|
onTrailingIconClick,
|
|
21
22
|
children,
|
|
22
23
|
...props
|
|
23
24
|
}: QChipProps = $props();
|
|
25
|
+
// #endregion: --- Props
|
|
24
26
|
|
|
27
|
+
// #region: --- Non-reactive variables
|
|
25
28
|
let qChip: HTMLDivElement;
|
|
29
|
+
// #endregion: --- Non-reactive variables
|
|
30
|
+
|
|
31
|
+
// #region: --- Derived values
|
|
32
|
+
const trailing = $derived(
|
|
33
|
+
(kind === "assist" || kind === "suggestion") && trailingIcon
|
|
34
|
+
? undefined
|
|
35
|
+
: trailingIcon,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const tabindex = disabled ? -1 : props.tabindex || 0;
|
|
39
|
+
const role = $derived(
|
|
40
|
+
["assist", "filter"].includes(kind) ? "button" : undefined,
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const avatar = $derived(extractImgSrc(icon));
|
|
44
|
+
// #endregion: --- Derived values
|
|
26
45
|
|
|
46
|
+
// #region: --- Effects
|
|
27
47
|
$effect.pre(() => {
|
|
28
48
|
if (selected !== undefined && kind !== "filter") {
|
|
29
49
|
throw new Error(
|
|
@@ -37,20 +57,9 @@
|
|
|
37
57
|
);
|
|
38
58
|
}
|
|
39
59
|
});
|
|
60
|
+
// #endregion: --- Effects
|
|
40
61
|
|
|
41
|
-
|
|
42
|
-
(kind === "assist" || kind === "suggestion") && trailingIcon
|
|
43
|
-
? undefined
|
|
44
|
-
: trailingIcon,
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
const tabindex = disabled ? -1 : props.tabindex || 0;
|
|
48
|
-
const role = $derived(
|
|
49
|
-
["assist", "filter"].includes(kind) ? "button" : undefined,
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
const avatar = $derived(extractImgSrc(icon));
|
|
53
|
-
|
|
62
|
+
// #region: --- Functions
|
|
54
63
|
function stopIfDisabled(e: QChipMouseEvent, iconClick = false) {
|
|
55
64
|
if (disabled) {
|
|
56
65
|
e.preventDefault();
|
|
@@ -87,6 +96,7 @@
|
|
|
87
96
|
}) as QChipMouseEvent;
|
|
88
97
|
stopIfDisabled(click);
|
|
89
98
|
}
|
|
99
|
+
// #endregion: --- Functions
|
|
90
100
|
</script>
|
|
91
101
|
|
|
92
102
|
<div
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
}
|
|
1
|
+
import type { QChipProps } from "./props";
|
|
2
|
+
declare const QChip: import("svelte").Component<QChipProps, {}, "selected">;
|
|
3
|
+
type QChip = ReturnType<typeof QChip>;
|
|
4
|
+
export default QChip;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { copy } from "../../utils";
|
|
4
4
|
import type { QCodeBlockProps } from "./props";
|
|
5
5
|
|
|
6
|
+
// #region: --- Props
|
|
6
7
|
let {
|
|
7
8
|
language,
|
|
8
9
|
lightTheme = "github-light-default",
|
|
@@ -12,12 +13,16 @@
|
|
|
12
13
|
copiable,
|
|
13
14
|
...props
|
|
14
15
|
}: QCodeBlockProps = $props();
|
|
16
|
+
// #endregion: --- Props
|
|
15
17
|
|
|
18
|
+
// #region: --- Reactive variables
|
|
16
19
|
let btnContent = $state("Copy");
|
|
17
20
|
let btnColor = $state("primary");
|
|
18
21
|
|
|
19
22
|
let html = $state("");
|
|
23
|
+
// #endregion: --- Reactive variables
|
|
20
24
|
|
|
25
|
+
// #region: --- Effects
|
|
21
26
|
$effect(() => {
|
|
22
27
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
23
28
|
Quaff.darkMode.isActive;
|
|
@@ -25,7 +30,9 @@
|
|
|
25
30
|
// This is required to have the html updated when the code changes
|
|
26
31
|
getHtml(code);
|
|
27
32
|
});
|
|
33
|
+
// #endregion: --- Effects
|
|
28
34
|
|
|
35
|
+
// #region: --- Functions
|
|
29
36
|
function setBtn(type: "base" | "error" | "success") {
|
|
30
37
|
switch (type) {
|
|
31
38
|
case "error":
|
|
@@ -68,6 +75,7 @@
|
|
|
68
75
|
html = `<pre>${code}</pre>`;
|
|
69
76
|
}
|
|
70
77
|
}
|
|
78
|
+
// #endregion: --- Functions
|
|
71
79
|
</script>
|
|
72
80
|
|
|
73
81
|
<div {...props} class="q-code-block" data-quaff>
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
};
|
|
7
|
-
slots: {};
|
|
8
|
-
};
|
|
9
|
-
type QCodeBlockProps_ = typeof __propDef.props;
|
|
10
|
-
export { QCodeBlockProps_ as QCodeBlockProps };
|
|
11
|
-
export type QCodeBlockEvents = typeof __propDef.events;
|
|
12
|
-
export type QCodeBlockSlots = typeof __propDef.slots;
|
|
13
|
-
export default class QCodeBlock extends SvelteComponentTyped<QCodeBlockProps_, QCodeBlockEvents, QCodeBlockSlots> {
|
|
14
|
-
}
|
|
1
|
+
import type { QCodeBlockProps } from "./props";
|
|
2
|
+
declare const QCodeBlock: import("svelte").Component<QCodeBlockProps, {}, "">;
|
|
3
|
+
type QCodeBlock = ReturnType<typeof QCodeBlock>;
|
|
4
|
+
export default QCodeBlock;
|
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
max-height: 80%;
|
|
20
20
|
overflow-x: hidden;
|
|
21
21
|
overflow-y: auto;
|
|
22
|
+
|
|
23
|
+
&:has([data-quaff-overlay-root] > [data-quaff-overlay])[open] {
|
|
24
|
+
overflow: visible;
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
transition:
|
|
23
28
|
variables.$speed3 all,
|
|
24
29
|
0s background-color;
|
|
@@ -157,6 +162,18 @@
|
|
|
157
162
|
&--animating {
|
|
158
163
|
animation: shake 0.15s;
|
|
159
164
|
}
|
|
165
|
+
|
|
166
|
+
&__overlay-root {
|
|
167
|
+
position: absolute;
|
|
168
|
+
inset: 0;
|
|
169
|
+
overflow: visible;
|
|
170
|
+
z-index: 10001;
|
|
171
|
+
pointer-events: none;
|
|
172
|
+
|
|
173
|
+
> * {
|
|
174
|
+
pointer-events: auto;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
160
177
|
}
|
|
161
178
|
|
|
162
179
|
@keyframes shake {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { on } from "svelte/events";
|
|
2
3
|
import type { QDialogProps } from "./props";
|
|
3
4
|
|
|
5
|
+
// #region: --- Props
|
|
4
6
|
let {
|
|
5
7
|
value = $bindable(false),
|
|
6
8
|
position = "default",
|
|
@@ -10,25 +12,39 @@
|
|
|
10
12
|
children,
|
|
11
13
|
...props
|
|
12
14
|
}: QDialogProps = $props();
|
|
15
|
+
// #endregion: --- Props
|
|
13
16
|
|
|
17
|
+
// #region: --- Reactive variables
|
|
14
18
|
let dialogEl = $state<HTMLDialogElement>();
|
|
19
|
+
// #endregion: --- Reactive variables
|
|
15
20
|
|
|
21
|
+
// #region: --- Derived values
|
|
16
22
|
const canHide = $derived(value && !persistent);
|
|
23
|
+
// #endregion: --- Derived values
|
|
17
24
|
|
|
25
|
+
// #region: --- Effects
|
|
18
26
|
$effect(() => {
|
|
19
|
-
if (value) {
|
|
20
|
-
dialogEl?.[modal ? "showModal" : "show"]();
|
|
21
|
-
|
|
22
|
-
setTimeout(() => {
|
|
23
|
-
window.addEventListener("click", tryCancel);
|
|
24
|
-
}, 150);
|
|
25
|
-
} else {
|
|
27
|
+
if (!value) {
|
|
26
28
|
dialogEl?.close();
|
|
27
|
-
|
|
28
|
-
window.removeEventListener("click", tryCancel);
|
|
29
|
+
return;
|
|
29
30
|
}
|
|
31
|
+
|
|
32
|
+
dialogEl?.[modal ? "showModal" : "show"]();
|
|
33
|
+
|
|
34
|
+
let removeClickListener: (() => void) | undefined;
|
|
35
|
+
|
|
36
|
+
const timeoutId = setTimeout(() => {
|
|
37
|
+
removeClickListener = on(window, "click", tryCancel);
|
|
38
|
+
}, 150);
|
|
39
|
+
|
|
40
|
+
return () => {
|
|
41
|
+
clearTimeout(timeoutId);
|
|
42
|
+
removeClickListener?.();
|
|
43
|
+
};
|
|
30
44
|
});
|
|
45
|
+
// #endregion: --- Effects
|
|
31
46
|
|
|
47
|
+
// #region: --- Methods
|
|
32
48
|
export function hide() {
|
|
33
49
|
if (dialogEl?.open) {
|
|
34
50
|
value = false;
|
|
@@ -48,7 +64,9 @@
|
|
|
48
64
|
show();
|
|
49
65
|
}
|
|
50
66
|
}
|
|
67
|
+
// #endregion: --- Methods
|
|
51
68
|
|
|
69
|
+
// #region: --- Functions
|
|
52
70
|
function addAnimation() {
|
|
53
71
|
if (persistent && value) {
|
|
54
72
|
dialogEl?.classList.add("q-dialog--animating");
|
|
@@ -70,6 +88,11 @@
|
|
|
70
88
|
}
|
|
71
89
|
|
|
72
90
|
function tryCancel(e: Event) {
|
|
91
|
+
const target = e.target;
|
|
92
|
+
if (target instanceof Element && target.closest("[data-quaff-overlay]")) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
73
96
|
if (canHide) {
|
|
74
97
|
hide();
|
|
75
98
|
} else {
|
|
@@ -77,6 +100,7 @@
|
|
|
77
100
|
e.preventDefault();
|
|
78
101
|
}
|
|
79
102
|
}
|
|
103
|
+
// #endregion: --- Functions
|
|
80
104
|
</script>
|
|
81
105
|
|
|
82
106
|
<dialog
|
|
@@ -98,4 +122,5 @@
|
|
|
98
122
|
data-quaff
|
|
99
123
|
>
|
|
100
124
|
{@render children?.()}
|
|
125
|
+
<div class="q-dialog__overlay-root" data-quaff-overlay-root></div>
|
|
101
126
|
</dialog>
|