@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,42 +1,36 @@
|
|
|
1
|
-
import type { UseAlignProps } from "../../composables";
|
|
2
|
-
import type { NativeProps } from "../../utils";
|
|
1
|
+
import type { UseAlignProps } from "../../composables/useAlign";
|
|
3
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
4
3
|
export type QCardFillColors = "primary" | "secondary" | "tertiary";
|
|
5
|
-
export interface QCardProps extends
|
|
4
|
+
export interface QCardProps extends HTMLAttributes<HTMLElement> {
|
|
6
5
|
/**
|
|
7
|
-
*
|
|
6
|
+
* Adds a border around the card.
|
|
8
7
|
* @default false
|
|
9
8
|
*/
|
|
10
9
|
bordered?: boolean;
|
|
11
10
|
/**
|
|
12
11
|
* Defines the fill color of the card.
|
|
13
|
-
* @default
|
|
12
|
+
* @default false
|
|
14
13
|
*/
|
|
15
14
|
fill?: boolean | QCardFillColors;
|
|
16
15
|
/**
|
|
17
|
-
*
|
|
16
|
+
* Use the flat design for the card, removing its elevation.
|
|
18
17
|
* @default false
|
|
19
18
|
*/
|
|
20
19
|
flat?: boolean;
|
|
21
20
|
/**
|
|
22
|
-
* Adds
|
|
21
|
+
* Adds border radius to the card to round its corners.
|
|
23
22
|
* @default false
|
|
24
23
|
*/
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Sets the title of the card.
|
|
28
|
-
* @default undefined
|
|
29
|
-
*/
|
|
30
|
-
title?: string;
|
|
24
|
+
rounded?: boolean;
|
|
31
25
|
}
|
|
32
|
-
export interface QCardSectionProps extends
|
|
26
|
+
export interface QCardSectionProps extends HTMLAttributes<HTMLDivElement> {
|
|
33
27
|
/**
|
|
34
28
|
* Lays out the section content horizontally.
|
|
35
29
|
* @default false
|
|
36
30
|
*/
|
|
37
31
|
horizontal?: boolean;
|
|
38
32
|
}
|
|
39
|
-
export interface QCardActionsProps extends UseAlignProps,
|
|
33
|
+
export interface QCardActionsProps extends UseAlignProps, HTMLAttributes<HTMLElement> {
|
|
40
34
|
/**
|
|
41
35
|
* Lays out the action items vertically.
|
|
42
36
|
* @default false
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let { value = $bindable(), label = "", disable = false, ...props } = $props();
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
|
-
<label
|
|
5
|
+
<label
|
|
6
|
+
{...props}
|
|
7
|
+
class="q-checkbox{props.class ? ` ${props.class}` : ''}"
|
|
8
|
+
class:q-checkbox--disabled={disable}
|
|
9
|
+
aria-disabled={disable || undefined}
|
|
10
|
+
>
|
|
6
11
|
<input type="checkbox" bind:checked={value} disabled={disable} />
|
|
7
12
|
<span>{label}</span>
|
|
8
13
|
</label>
|
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { QCheckboxProps } from "./props";
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
[x: string]: any;
|
|
6
|
-
value?: boolean | undefined;
|
|
7
|
-
label?: QCheckboxProps["label"];
|
|
8
|
-
disable?: QCheckboxProps["disable"];
|
|
9
|
-
class?: string | null | undefined;
|
|
10
|
-
};
|
|
11
|
-
events: {
|
|
12
|
-
[evt: string]: CustomEvent<any>;
|
|
13
|
-
};
|
|
14
|
-
slots: {};
|
|
15
|
-
};
|
|
16
|
-
type QCheckboxProps_ = typeof __propDef.props;
|
|
17
|
-
export { QCheckboxProps_ as QCheckboxProps };
|
|
18
|
-
export type QCheckboxEvents = typeof __propDef.events;
|
|
19
|
-
export type QCheckboxSlots = typeof __propDef.slots;
|
|
20
|
-
export default class QCheckbox extends SvelteComponent<QCheckboxProps, QCheckboxEvents, QCheckboxSlots> {
|
|
21
|
-
}
|
|
2
|
+
declare const QCheckbox: import("svelte").Component<QCheckboxProps, {}, "value">;
|
|
3
|
+
export default QCheckbox;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { NativeProps } from "../../utils";
|
|
2
1
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
-
export interface QCheckboxProps extends
|
|
2
|
+
export interface QCheckboxProps extends HTMLAttributes<HTMLLabelElement> {
|
|
4
3
|
/**
|
|
5
4
|
* Controls the checked state of the checkbox.
|
|
6
5
|
*/
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
@use "$css/mixins";
|
|
2
|
+
@use "$css/disabled";
|
|
3
|
+
|
|
4
|
+
@layer q-chip {
|
|
5
|
+
.q-chip {
|
|
6
|
+
$state-layer-opacity: 0;
|
|
7
|
+
padding-inline: 1rem;
|
|
8
|
+
border-radius: 0.5rem;
|
|
9
|
+
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: start;
|
|
13
|
+
gap: 0.5rem;
|
|
14
|
+
width: fit-content;
|
|
15
|
+
|
|
16
|
+
background-color: transparent;
|
|
17
|
+
color: var(--on-surface);
|
|
18
|
+
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
user-select: none;
|
|
21
|
+
|
|
22
|
+
@include mixins.typography(label-large);
|
|
23
|
+
|
|
24
|
+
&::before {
|
|
25
|
+
content: "";
|
|
26
|
+
position: absolute;
|
|
27
|
+
top: 0;
|
|
28
|
+
right: 0;
|
|
29
|
+
bottom: 0;
|
|
30
|
+
left: 0;
|
|
31
|
+
|
|
32
|
+
border-radius: inherit;
|
|
33
|
+
background-color: mixins.with-alpha(
|
|
34
|
+
var(--state-layer-color, transparent),
|
|
35
|
+
var(--state-layer-opacity, 0)
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&:hover:not([aria-disabled]) {
|
|
40
|
+
--state-layer-opacity: 8%;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&:focus:not([aria-disabled]) {
|
|
44
|
+
--state-layer-opacity: 10%;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&.q-chip--sm {
|
|
48
|
+
height: 2rem;
|
|
49
|
+
|
|
50
|
+
& > :is(.q-icon, .q-avatar) {
|
|
51
|
+
--size: 1.125rem;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&.q-chip--md {
|
|
56
|
+
height: 2.5rem;
|
|
57
|
+
|
|
58
|
+
& > :is(.q-icon, .q-avatar) {
|
|
59
|
+
--size: 1.40625rem;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&.q-chip--lg {
|
|
64
|
+
height: 3rem;
|
|
65
|
+
|
|
66
|
+
& > :is(.q-icon, .q-avatar) {
|
|
67
|
+
--size: 1.6875rem;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&:focus:not([aria-disabled]) {
|
|
72
|
+
outline: 1px solid var(--secondary);
|
|
73
|
+
|
|
74
|
+
& > .q-icon {
|
|
75
|
+
color: var(--on-secondary-container);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&.q-chip--outlined {
|
|
80
|
+
outline: 1px solid var(--outline);
|
|
81
|
+
|
|
82
|
+
&:focus:not([aria-disabled]) {
|
|
83
|
+
outline-color: var(--secondary);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&.q-chip--elevated {
|
|
88
|
+
@include mixins.elevate(0.5);
|
|
89
|
+
|
|
90
|
+
&:hover:not([aria-disabled]) {
|
|
91
|
+
@include mixins.elevate(1);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
background-color: var(--surface-container-low);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&.q-chip--assist {
|
|
98
|
+
--state-layer-color: var(--on-surface);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&.q-chip--filter {
|
|
102
|
+
--state-layer-color: var(--on-surface-variant);
|
|
103
|
+
|
|
104
|
+
&:focus:not([aria-disabled]) {
|
|
105
|
+
outline-color: var(--on-surface-variant);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&.q-chip--selected {
|
|
109
|
+
--state-layer-color: var(--on-secondary-container);
|
|
110
|
+
|
|
111
|
+
outline-color: var(--secondary-container);
|
|
112
|
+
outline-width: 0;
|
|
113
|
+
|
|
114
|
+
background-color: var(--secondary-container);
|
|
115
|
+
|
|
116
|
+
&.q-chip--elevated {
|
|
117
|
+
color: var(--on-secondary-container);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&:hover:not([aria-disabled]):not([aria-disabled]) {
|
|
121
|
+
@include mixins.elevate(0.5);
|
|
122
|
+
color: var(--on-secondary-container);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&.q-chip--input {
|
|
128
|
+
--state-layer-color: var(--on-surface-variant);
|
|
129
|
+
|
|
130
|
+
padding-inline: 0.75rem;
|
|
131
|
+
color: var(--on-surface-variant);
|
|
132
|
+
|
|
133
|
+
& > .q-icon {
|
|
134
|
+
color: var(--on-surface-variant);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&.q-chip--suggestion {
|
|
139
|
+
--state-layer-color: var(--on-surface-variant);
|
|
140
|
+
|
|
141
|
+
color: var(--on-surface-variant);
|
|
142
|
+
|
|
143
|
+
&:focus:not([aria-disabled]) {
|
|
144
|
+
outline-color: var(--secondary);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.q-chip > .q-icon {
|
|
150
|
+
color: var(--primary);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.q-chip > :is(.q-icon.q-chip__leading-icon, .q-avatar.q-chip__avatar) {
|
|
154
|
+
margin-left: -0.5rem;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.q-chip > .q-icon.q-chip__trailing-icon {
|
|
158
|
+
margin-right: -0.5rem;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.q-chip.q-chip--input > .q-avatar.q-chip__avatar {
|
|
162
|
+
--size: 1.5rem;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Disabled
|
|
167
|
+
@layer q-chip--disabled {
|
|
168
|
+
.q-chip[aria-disabled] {
|
|
169
|
+
@include disabled.base();
|
|
170
|
+
|
|
171
|
+
&.q-chip--outlined {
|
|
172
|
+
outline-color: disabled.rest-color();
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
& .q-icon {
|
|
176
|
+
color: disabled.font-color();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -1,80 +1,105 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import { ripple } from "../../helpers";
|
|
3
|
-
import { isActivationKey } from "../../utils";
|
|
4
|
-
import { QIcon } from "../..";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ripple } from "../../helpers";
|
|
3
|
+
import { extractImgSrc, isActivationKey } from "../../utils";
|
|
4
|
+
import { QAvatar, QIcon } from "../..";
|
|
5
|
+
let {
|
|
6
|
+
kind = "assist",
|
|
7
|
+
label,
|
|
8
|
+
icon,
|
|
9
|
+
trailingIcon,
|
|
10
|
+
disabled = false,
|
|
11
|
+
elevated,
|
|
12
|
+
noRipple = false,
|
|
13
|
+
selected = $bindable(kind === "filter" ? false : void 0),
|
|
14
|
+
size = "sm",
|
|
15
|
+
children,
|
|
16
|
+
...props
|
|
17
|
+
} = $props();
|
|
18
|
+
let qChip;
|
|
19
|
+
$effect.pre(() => {
|
|
20
|
+
if (selected !== void 0 && kind !== "filter") {
|
|
21
|
+
throw new Error(
|
|
22
|
+
'Only QChips of kind "filter" can use the "selected" prop.',
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
if ((kind === "assist" || kind === "suggestion") && trailingIcon) {
|
|
26
|
+
console.warn(
|
|
27
|
+
'QChips of kind "assist" and "suggestion" should not have a trailing icon. It will thus be ignored.',
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const trailing = $derived(
|
|
32
|
+
(kind === "assist" || kind === "suggestion") && trailingIcon
|
|
33
|
+
? void 0
|
|
34
|
+
: trailingIcon,
|
|
35
|
+
);
|
|
36
|
+
const tabindex = disabled ? -1 : props.tabindex || 0;
|
|
37
|
+
const role = $derived(
|
|
38
|
+
["assist", "filter"].includes(kind) ? "button" : void 0,
|
|
39
|
+
);
|
|
40
|
+
const avatar = $derived(extractImgSrc(icon));
|
|
41
|
+
function stopIfDisabled(e) {
|
|
42
|
+
if (disabled) {
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
e.stopImmediatePropagation();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (kind === "filter") {
|
|
48
|
+
selected = !selected;
|
|
49
|
+
}
|
|
50
|
+
e.stopPropagation();
|
|
51
|
+
props.onclick?.(e);
|
|
52
|
+
}
|
|
53
|
+
function onkeydown(e) {
|
|
54
|
+
if (e.key === "Escape") {
|
|
55
|
+
qChip?.blur();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (!isActivationKey(e)) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
18
61
|
e.preventDefault();
|
|
19
|
-
|
|
62
|
+
const click = new MouseEvent("click", { relatedTarget: qChip });
|
|
63
|
+
stopIfDisabled(click);
|
|
20
64
|
}
|
|
21
|
-
}
|
|
22
|
-
function onKeyDown(e) {
|
|
23
|
-
if (!isActivationKey(e))
|
|
24
|
-
return;
|
|
25
|
-
e.preventDefault();
|
|
26
|
-
let click = new MouseEvent("click");
|
|
27
|
-
qChip.dispatchEvent(click);
|
|
28
|
-
}
|
|
29
65
|
</script>
|
|
30
66
|
|
|
31
|
-
<
|
|
67
|
+
<div
|
|
32
68
|
bind:this={qChip}
|
|
33
69
|
use:ripple={{
|
|
34
|
-
|
|
35
|
-
color:
|
|
70
|
+
disabled: noRipple || disabled,
|
|
71
|
+
color: elevated ? "var(--on-surface-variant)" : undefined,
|
|
36
72
|
}}
|
|
37
|
-
|
|
38
|
-
class="q-chip
|
|
39
|
-
? `
|
|
40
|
-
: ''} {
|
|
41
|
-
class:q-chip--
|
|
42
|
-
class:q-chip--
|
|
43
|
-
class:q-chip--
|
|
44
|
-
{
|
|
45
|
-
tabindex
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
{...$$restProps}
|
|
73
|
+
{...props}
|
|
74
|
+
class="q-chip{props.class
|
|
75
|
+
? ` ${props.class}`
|
|
76
|
+
: ''} q-chip--{kind} q-chip--{size}"
|
|
77
|
+
class:q-chip--selected={selected}
|
|
78
|
+
class:q-chip--elevated={elevated}
|
|
79
|
+
class:q-chip--outlined={!elevated}
|
|
80
|
+
aria-disabled={disabled || undefined}
|
|
81
|
+
{tabindex}
|
|
82
|
+
{role}
|
|
83
|
+
onclick={stopIfDisabled}
|
|
84
|
+
{onkeydown}
|
|
50
85
|
>
|
|
51
|
-
{#if
|
|
52
|
-
<
|
|
53
|
-
{:else if
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
src={img}
|
|
58
|
-
alt="{content || 'Slotted'} chip"
|
|
59
|
-
/>
|
|
60
|
-
{:else if icon}
|
|
61
|
-
<QIcon name={icon} class="q-chip__icon" />
|
|
62
|
-
{/if}
|
|
63
|
-
{#if content}
|
|
64
|
-
{content}
|
|
65
|
-
{:else}
|
|
66
|
-
<slot />
|
|
86
|
+
{#if icon && !selected && !avatar}
|
|
87
|
+
<QIcon class="q-chip__leading-icon" name={icon as MaterialSymbol} />
|
|
88
|
+
{:else if avatar && !selected}
|
|
89
|
+
<QAvatar class="q-chip__avatar" src={avatar} />
|
|
90
|
+
{:else if selected}
|
|
91
|
+
<QIcon class="q-chip__leading-icon" name="check" />
|
|
67
92
|
{/if}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
{
|
|
78
|
-
<QIcon
|
|
93
|
+
|
|
94
|
+
<div class="q-chip__label">
|
|
95
|
+
{#if label}
|
|
96
|
+
{label}
|
|
97
|
+
{:else}
|
|
98
|
+
{@render children?.()}
|
|
99
|
+
{/if}
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
{#if trailing}
|
|
103
|
+
<QIcon class="q-chip__trailing-icon" name={trailing} />
|
|
79
104
|
{/if}
|
|
80
|
-
</
|
|
105
|
+
</div>
|
|
@@ -1,36 +1,3 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { QChipProps } from "./props";
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
[x: string]: any;
|
|
6
|
-
content?: QChipProps["content"];
|
|
7
|
-
icon?: QChipProps["icon"];
|
|
8
|
-
iconRight?: QChipProps["iconRight"];
|
|
9
|
-
disable?: QChipProps["disable"];
|
|
10
|
-
responsive?: QChipProps["responsive"];
|
|
11
|
-
vertical?: QChipProps["vertical"];
|
|
12
|
-
round?: QChipProps["round"];
|
|
13
|
-
outlined?: QChipProps["outlined"];
|
|
14
|
-
noRipple?: QChipProps["noRipple"];
|
|
15
|
-
size?: QChipProps["size"];
|
|
16
|
-
tabindex?: QChipProps["tabindex"];
|
|
17
|
-
href?: QChipProps["href"];
|
|
18
|
-
class?: string | null | undefined;
|
|
19
|
-
};
|
|
20
|
-
events: {
|
|
21
|
-
click: MouseEvent;
|
|
22
|
-
} & {
|
|
23
|
-
[evt: string]: CustomEvent<any>;
|
|
24
|
-
};
|
|
25
|
-
slots: {
|
|
26
|
-
leading: {};
|
|
27
|
-
default: {};
|
|
28
|
-
trailing: {};
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
type QChipProps_ = typeof __propDef.props;
|
|
32
|
-
export { QChipProps_ as QChipProps };
|
|
33
|
-
export type QChipEvents = typeof __propDef.events;
|
|
34
|
-
export type QChipSlots = typeof __propDef.slots;
|
|
35
|
-
export default class QChip extends SvelteComponent<QChipProps, QChipEvents, QChipSlots> {
|
|
36
|
-
}
|
|
2
|
+
declare const QChip: import("svelte").Component<QChipProps, {}, "selected">;
|
|
3
|
+
export default QChip;
|
|
@@ -1,68 +1,60 @@
|
|
|
1
1
|
// AUTO GENERATED FILE - DO NOT MODIFY OR DELETE
|
|
2
|
-
// @quaffHash
|
|
2
|
+
// @quaffHash b77ea0d9cbe2991add2f2dccab50f658
|
|
3
3
|
export const QChipDocsProps = [
|
|
4
4
|
{
|
|
5
|
-
name: "
|
|
6
|
-
type: "
|
|
5
|
+
name: "kind",
|
|
6
|
+
type: "QChipKindOptions",
|
|
7
7
|
optional: true,
|
|
8
|
-
clickableType:
|
|
9
|
-
description: "The
|
|
8
|
+
clickableType: true,
|
|
9
|
+
description: "The chip's kind. It will control the chip's style and behavior.",
|
|
10
10
|
default: "undefined",
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
|
-
name: "
|
|
13
|
+
name: "label",
|
|
14
14
|
type: "string",
|
|
15
15
|
optional: true,
|
|
16
16
|
clickableType: false,
|
|
17
|
-
description: '
|
|
17
|
+
description: "The chip's text content. Will overwrite the default slot.",
|
|
18
18
|
default: "undefined",
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
name: "
|
|
22
|
-
type: "string",
|
|
21
|
+
name: "icon",
|
|
22
|
+
type: "MaterialSymbol | `img:${string}`",
|
|
23
23
|
optional: true,
|
|
24
|
-
clickableType:
|
|
25
|
-
description: 'Name of the
|
|
24
|
+
clickableType: true,
|
|
25
|
+
description: 'Name of the leading icon to use for the chip. If starts with "img:", will be used as an image src instead.',
|
|
26
26
|
default: "undefined",
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
|
-
name: "
|
|
30
|
-
type: "
|
|
31
|
-
optional: true,
|
|
32
|
-
clickableType: false,
|
|
33
|
-
description: "Puts the chip in a disabled state, making it unclickable.",
|
|
34
|
-
default: "false",
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: "responsive",
|
|
38
|
-
type: "boolean",
|
|
29
|
+
name: "trailingIcon",
|
|
30
|
+
type: "MaterialSymbol | `img:${string}`",
|
|
39
31
|
optional: true,
|
|
40
|
-
clickableType:
|
|
41
|
-
description: "
|
|
42
|
-
default: "
|
|
32
|
+
clickableType: true,
|
|
33
|
+
description: "Only for filter and input chips. Name of the trailing icon to use for the chip.",
|
|
34
|
+
default: "undefined",
|
|
43
35
|
},
|
|
44
36
|
{
|
|
45
|
-
name: "
|
|
37
|
+
name: "disabled",
|
|
46
38
|
type: "boolean",
|
|
47
39
|
optional: true,
|
|
48
40
|
clickableType: false,
|
|
49
|
-
description: "
|
|
41
|
+
description: "Puts the chip in a disabled state, making it unactivable.",
|
|
50
42
|
default: "false",
|
|
51
43
|
},
|
|
52
44
|
{
|
|
53
|
-
name: "
|
|
45
|
+
name: "selected",
|
|
54
46
|
type: "boolean",
|
|
55
47
|
optional: true,
|
|
56
48
|
clickableType: false,
|
|
57
|
-
description: "
|
|
49
|
+
description: "Only for filter chips. Controls wether the chip is selected or not.",
|
|
58
50
|
default: "false",
|
|
59
51
|
},
|
|
60
52
|
{
|
|
61
|
-
name: "
|
|
53
|
+
name: "elevated",
|
|
62
54
|
type: "boolean",
|
|
63
55
|
optional: true,
|
|
64
56
|
clickableType: false,
|
|
65
|
-
description: "
|
|
57
|
+
description: "Elevates the button, giving it box-shadow and a background color.",
|
|
66
58
|
default: "false",
|
|
67
59
|
},
|
|
68
60
|
{
|
|
@@ -79,22 +71,6 @@ export const QChipDocsProps = [
|
|
|
79
71
|
optional: true,
|
|
80
72
|
clickableType: true,
|
|
81
73
|
description: "Size of the chip.",
|
|
82
|
-
default: "
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: "tabindex",
|
|
86
|
-
type: "number",
|
|
87
|
-
optional: true,
|
|
88
|
-
clickableType: false,
|
|
89
|
-
description: "Tabindex of the chip.",
|
|
90
|
-
default: "undefined",
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: "href",
|
|
94
|
-
type: "string",
|
|
95
|
-
optional: true,
|
|
96
|
-
clickableType: false,
|
|
97
|
-
description: 'Makes the chip navigational. Can be used with the router (e.g to="/home") or as a normal href attribute (e.g to="#section-id").',
|
|
98
|
-
default: "undefined",
|
|
74
|
+
default: "sm",
|
|
99
75
|
},
|
|
100
76
|
];
|