@quaffui/quaff 0.1.0-prealpha15 → 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 -50
- package/dist/components/avatar/QAvatar.svelte.d.ts +2 -25
- package/dist/components/avatar/docs.d.ts +1 -1
- package/dist/components/avatar/docs.js +1 -1
- 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 -10
- package/dist/components/breadcrumbs/QBreadcrumbs.svelte.d.ts +2 -22
- package/dist/components/breadcrumbs/QBreadcrumbsEl.scss +10 -0
- package/dist/components/breadcrumbs/QBreadcrumbsEl.svelte +62 -38
- package/dist/components/breadcrumbs/QBreadcrumbsEl.svelte.d.ts +2 -25
- package/dist/components/breadcrumbs/docs.d.ts +1 -1
- package/dist/components/breadcrumbs/docs.js +1 -1
- 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 +89 -46
- package/dist/components/button/QBtn.svelte.d.ts +2 -33
- package/dist/components/button/docs.d.ts +1 -1
- package/dist/components/button/docs.js +1 -1
- 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 +26 -17
- 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 +9 -7
- package/dist/components/card/QCardSection.svelte.d.ts +2 -22
- package/dist/components/card/docs.d.ts +3 -3
- package/dist/components/card/docs.js +3 -3
- package/dist/components/card/docs.props.js +6 -14
- package/dist/components/card/props.d.ts +9 -15
- package/dist/components/checkbox/QCheckbox.svelte +6 -5
- package/dist/components/checkbox/QCheckbox.svelte.d.ts +2 -20
- package/dist/components/checkbox/docs.d.ts +1 -1
- package/dist/components/checkbox/docs.js +1 -1
- 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 +97 -69
- package/dist/components/chip/QChip.svelte.d.ts +2 -35
- package/dist/components/chip/docs.d.ts +1 -1
- package/dist/components/chip/docs.js +1 -1
- package/dist/components/chip/docs.props.js +23 -47
- package/dist/components/chip/props.d.ts +21 -34
- package/dist/components/codeBlock/QCodeBlock.svelte +63 -45
- package/dist/components/codeBlock/QCodeBlock.svelte.d.ts +2 -19
- 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.d.ts +1 -1
- package/dist/components/dialog/docs.js +1 -1
- 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 -94
- package/dist/components/drawer/QDrawer.svelte.d.ts +6 -39
- package/dist/components/drawer/docs.d.ts +1 -1
- package/dist/components/drawer/docs.js +1 -1
- 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 +65 -24
- package/dist/components/footer/QFooter.svelte.d.ts +2 -23
- package/dist/components/footer/docs.d.ts +1 -1
- package/dist/components/footer/docs.js +1 -1
- 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.d.ts +1 -1
- package/dist/components/icon/docs.js +1 -1
- package/dist/components/icon/docs.props.js +5 -5
- package/dist/components/icon/props.d.ts +6 -6
- 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.d.ts +1 -1
- package/dist/components/input/docs.js +1 -1
- 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.d.ts +1 -1
- package/dist/components/layout/docs.js +1 -1
- 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 +46 -34
- package/dist/components/list/QItemSection.svelte.d.ts +2 -24
- package/dist/components/list/QList.scss +30 -0
- package/dist/components/list/QList.svelte +28 -16
- package/dist/components/list/QList.svelte.d.ts +2 -28
- package/dist/components/list/docs.d.ts +1 -1
- package/dist/components/list/docs.js +1 -1
- 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 +118 -97
- package/dist/components/private/QApi.svelte.d.ts +4 -16
- package/dist/components/private/QDocs.svelte +67 -58
- package/dist/components/private/QDocs.svelte.d.ts +9 -20
- package/dist/components/private/QDocsSection.svelte +15 -22
- package/dist/components/private/QDocsSection.svelte.d.ts +7 -29
- 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.d.ts +1 -1
- package/dist/components/progress/docs.js +1 -1
- 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.d.ts +1 -1
- package/dist/components/radio/docs.js +1 -1
- package/dist/components/radio/docs.props.js +2 -2
- package/dist/components/radio/index.scss +3 -1
- package/dist/components/radio/props.d.ts +2 -4
- 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.d.ts +1 -1
- package/dist/components/railbar/docs.js +1 -1
- 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.d.ts +1 -1
- package/dist/components/select/docs.js +8 -1
- 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.d.ts +1 -1
- package/dist/components/separator/docs.js +1 -1
- 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.d.ts +1 -1
- package/dist/components/table/docs.js +1 -1
- 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 +75 -96
- package/dist/components/tabs/QTab.svelte.d.ts +2 -25
- package/dist/components/tabs/QTabs.scss +40 -0
- package/dist/components/tabs/QTabs.svelte +107 -59
- package/dist/components/tabs/QTabs.svelte.d.ts +6 -31
- package/dist/components/tabs/docs.d.ts +1 -1
- package/dist/components/tabs/docs.js +1 -1
- 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/tabs/props.js +1 -1
- 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.d.ts +1 -1
- package/dist/components/toolbar/docs.js +1 -1
- 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.d.ts +1 -1
- package/dist/components/tooltip/docs.js +1 -1
- 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 +3 -3
- package/dist/composables/index.js +3 -3
- package/dist/composables/useSize.d.ts +10 -0
- package/dist/composables/useSize.js +37 -0
- package/dist/composables/{use-size.d.ts → useSizeLegacy.d.ts} +2 -2
- package/dist/composables/{use-size.js → useSizeLegacy.js} +5 -5
- 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/fonts.scss +16 -3
- 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/global.d.ts +1 -1
- package/dist/helpers/clickOutside.d.ts +2 -2
- package/dist/helpers/clickOutside.js +5 -4
- package/dist/helpers/ripple.d.ts +1 -1
- package/dist/helpers/ripple.js +14 -5
- 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/clipboard.js +2 -2
- package/dist/utils/colors.d.ts +71 -0
- package/dist/utils/colors.js +103 -15
- package/dist/utils/dom.d.ts +2 -0
- package/dist/utils/dom.js +10 -4
- package/dist/utils/number.d.ts +2 -0
- package/dist/utils/number.js +9 -0
- package/dist/utils/props.d.ts +2 -2
- package/dist/utils/props.js +8 -6
- 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 +4 -1
- package/dist/utils/types.d.ts +7 -2
- package/dist/utils/types.js +0 -3
- package/dist/utils/types.json +8 -5
- package/dist/utils/watchable.d.ts +0 -1
- package/dist/utils/watchable.js +1 -1
- package/package.json +42 -39
- package/dist/components/breadcrumbs/index.scss +0 -20
- package/dist/components/button/index.scss +0 -98
- 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 -60
- package/dist/stores/Quaff.d.ts +0 -32
- package/dist/stores/Quaff.js +0 -58
- /package/dist/composables/{use-align.d.ts → useAlign.d.ts} +0 -0
- /package/dist/composables/{use-align.js → useAlign.js} +0 -0
- /package/dist/composables/{use-router-link.d.ts → useRouterLink.d.ts} +0 -0
- /package/dist/composables/{use-router-link.js → useRouterLink.js} +0 -0
- /package/dist/css/mixins/{table.scss → _table.scss} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// AUTO GENERATED FILE - DO NOT MODIFY OR DELETE
|
|
2
|
-
// @quaffHash
|
|
2
|
+
// @quaffHash c1abfb6f47a067eca5b1a3da885e61e2
|
|
3
3
|
export const QSeparatorPropsVertical = [
|
|
4
4
|
{
|
|
5
5
|
name: "spacing",
|
|
6
|
-
type: "
|
|
6
|
+
type: "Q.Size",
|
|
7
7
|
optional: true,
|
|
8
8
|
clickableType: true,
|
|
9
9
|
description: "",
|
|
@@ -36,7 +36,7 @@ export const QSeparatorPropsVertical = [
|
|
|
36
36
|
{
|
|
37
37
|
name: "size",
|
|
38
38
|
type: "string",
|
|
39
|
-
optional:
|
|
39
|
+
optional: true,
|
|
40
40
|
clickableType: false,
|
|
41
41
|
description: "",
|
|
42
42
|
default: "",
|
|
@@ -61,7 +61,7 @@ export const QSeparatorPropsVertical = [
|
|
|
61
61
|
export const QSeparatorPropsHorizontal = [
|
|
62
62
|
{
|
|
63
63
|
name: "spacing",
|
|
64
|
-
type: "
|
|
64
|
+
type: "Q.Size",
|
|
65
65
|
optional: true,
|
|
66
66
|
clickableType: true,
|
|
67
67
|
description: "",
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import type { NativeProps, QuaffSizes } from "../../utils";
|
|
2
1
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
-
interface QSeparatorPropsVertical extends
|
|
4
|
-
spacing?:
|
|
2
|
+
interface QSeparatorPropsVertical extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
spacing?: Q.Size;
|
|
5
4
|
inset?: boolean;
|
|
6
5
|
vertical?: true;
|
|
7
6
|
color?: string;
|
|
8
|
-
size
|
|
7
|
+
size?: string;
|
|
9
8
|
text?: string;
|
|
10
9
|
textAlign?: "top" | "middle" | "bottom";
|
|
11
10
|
}
|
|
12
|
-
interface QSeparatorPropsHorizontal extends
|
|
13
|
-
spacing?:
|
|
11
|
+
interface QSeparatorPropsHorizontal extends HTMLAttributes<HTMLDivElement> {
|
|
12
|
+
spacing?: Q.Size;
|
|
14
13
|
inset?: boolean;
|
|
15
14
|
vertical?: false;
|
|
16
15
|
color?: string;
|
|
@@ -19,5 +18,4 @@ interface QSeparatorPropsHorizontal extends NativeProps, HTMLAttributes<HTMLDivE
|
|
|
19
18
|
textAlign?: "left" | "center" | "right";
|
|
20
19
|
}
|
|
21
20
|
export type QSeparatorProps = QSeparatorPropsHorizontal | QSeparatorPropsVertical;
|
|
22
|
-
export declare const QSeparatorPropsDefaults: QSeparatorProps;
|
|
23
21
|
export {};
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
@use "sass:list";
|
|
2
|
+
@use "$css/mixins";
|
|
3
|
+
@use "$css/disabled";
|
|
4
|
+
|
|
5
|
+
$root: ".q-switch";
|
|
6
|
+
$track: "#{$root}__track";
|
|
7
|
+
$handle: "#{$root}__handle";
|
|
8
|
+
$icon: "#{$root}__icon";
|
|
9
|
+
|
|
10
|
+
$checked: "[aria-checked]";
|
|
11
|
+
$unchecked: ":not([aria-checked])";
|
|
12
|
+
|
|
13
|
+
$check-map: (
|
|
14
|
+
"checked": "[aria-checked]",
|
|
15
|
+
"unchecked": ":not([aria-checked])",
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
@function getColor($el, $checked: false, $hovered: null) {
|
|
19
|
+
@if $el == "track" {
|
|
20
|
+
@return if($checked, var(--primary), var(--surface-container-highest));
|
|
21
|
+
} @else if $el == "icon" {
|
|
22
|
+
@return if($checked, var(--on-primary-container), var(--surface-container-highest));
|
|
23
|
+
} @else if $el == "handle" {
|
|
24
|
+
@if ($checked) {
|
|
25
|
+
@return if($hovered, var(--primary-container), var(--on-primary));
|
|
26
|
+
} @else {
|
|
27
|
+
@return if($hovered, var(--on-surface-variant), var(--outline));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@error "The given element #{$el} is not supported.";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@layer q-switch {
|
|
35
|
+
.q-switch {
|
|
36
|
+
position: relative;
|
|
37
|
+
|
|
38
|
+
display: inline-flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
flex-shrink: 0; // Stop from collapsing in flex containers
|
|
41
|
+
gap: 0.8rem;
|
|
42
|
+
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
|
|
45
|
+
outline: none;
|
|
46
|
+
|
|
47
|
+
&--reversed {
|
|
48
|
+
flex-direction: row-reverse;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&__inner {
|
|
52
|
+
width: 3.25rem;
|
|
53
|
+
height: 2rem;
|
|
54
|
+
border-radius: 10rem;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
& input {
|
|
58
|
+
appearance: none;
|
|
59
|
+
outline: none;
|
|
60
|
+
margin: 0;
|
|
61
|
+
position: absolute;
|
|
62
|
+
width: 100%;
|
|
63
|
+
z-index: 1;
|
|
64
|
+
cursor: inherit;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Track
|
|
69
|
+
.q-switch {
|
|
70
|
+
& #{$track} {
|
|
71
|
+
position: absolute;
|
|
72
|
+
width: 100%;
|
|
73
|
+
height: 100%;
|
|
74
|
+
box-sizing: border-box;
|
|
75
|
+
|
|
76
|
+
display: flex;
|
|
77
|
+
justify-content: center;
|
|
78
|
+
align-items: center;
|
|
79
|
+
|
|
80
|
+
border-radius: 10rem;
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
|
|
83
|
+
&::before {
|
|
84
|
+
content: "";
|
|
85
|
+
position: absolute;
|
|
86
|
+
height: 100%;
|
|
87
|
+
width: 100%;
|
|
88
|
+
|
|
89
|
+
display: flex;
|
|
90
|
+
|
|
91
|
+
border-radius: inherit;
|
|
92
|
+
box-sizing: border-box;
|
|
93
|
+
transition-property: opacity, background-color;
|
|
94
|
+
transition-timing-function: linear;
|
|
95
|
+
transition-duration: 67ms;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@each $state, $selector in $check-map {
|
|
100
|
+
&#{$selector} #{$track}::before {
|
|
101
|
+
background-color: getColor("track", $state == "checked");
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&#{$checked} #{$track} {
|
|
106
|
+
background-color: transparent;
|
|
107
|
+
border-color: transparent;
|
|
108
|
+
|
|
109
|
+
&::before {
|
|
110
|
+
background-clip: content-box;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&#{$unchecked} #{$track}::before {
|
|
115
|
+
border-color: var(--outline);
|
|
116
|
+
border-style: solid;
|
|
117
|
+
border-width: 0.125rem;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&[aria-disabled] #{$track}:is(::before, ::after) {
|
|
121
|
+
transition: none;
|
|
122
|
+
opacity: 38%;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Handle container
|
|
127
|
+
.q-switch {
|
|
128
|
+
& #{$handle}-container {
|
|
129
|
+
position: relative;
|
|
130
|
+
|
|
131
|
+
display: flex;
|
|
132
|
+
place-content: center;
|
|
133
|
+
place-items: center;
|
|
134
|
+
|
|
135
|
+
// cubic-bezier(0.13, 0.78, 0.33, 1.15) for little bounce
|
|
136
|
+
transition: margin 200ms ease;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&#{$checked} #{$handle}-container {
|
|
140
|
+
margin-inline-start: 1.25rem;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&#{$unchecked} #{$handle}-container {
|
|
144
|
+
margin-inline-end: 1.25rem;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&[aria-disabled] #{$handle}-container {
|
|
148
|
+
transition: none;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Handle
|
|
153
|
+
.q-switch {
|
|
154
|
+
& #{$handle} {
|
|
155
|
+
height: 1rem;
|
|
156
|
+
width: 1rem;
|
|
157
|
+
|
|
158
|
+
border-radius: 100%;
|
|
159
|
+
|
|
160
|
+
transform-origin: center;
|
|
161
|
+
transition-property: height, width;
|
|
162
|
+
transition-duration: 250ms, 250ms;
|
|
163
|
+
transition-timing-function: cubic-bezier(0.2, 0, 0, 1), cubic-bezier(0.2, 0, 0, 1);
|
|
164
|
+
z-index: 0;
|
|
165
|
+
|
|
166
|
+
&::before {
|
|
167
|
+
content: "";
|
|
168
|
+
position: absolute;
|
|
169
|
+
inset: 0;
|
|
170
|
+
|
|
171
|
+
display: flex;
|
|
172
|
+
border-radius: inherit;
|
|
173
|
+
box-sizing: border-box;
|
|
174
|
+
transition: background-color 67ms linear;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&::after {
|
|
178
|
+
content: "";
|
|
179
|
+
position: absolute;
|
|
180
|
+
inset: -0.5rem;
|
|
181
|
+
border-radius: inherit;
|
|
182
|
+
|
|
183
|
+
background-color: transparent;
|
|
184
|
+
opacity: 0.08;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
&:not([aria-disabled])#{$checked}:is(:hover, :focus-within) #{$handle}::after {
|
|
189
|
+
background-color: var(--primary);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
&:not([aria-disabled])#{$unchecked}:is(:hover, :focus-within) #{$handle}::after {
|
|
193
|
+
background-color: var(--on-surface);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
& #{$handle}--with-icon,
|
|
197
|
+
&#{$checked} #{$handle} {
|
|
198
|
+
height: 1.5rem;
|
|
199
|
+
width: 1.5rem;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
&:not([aria-disabled]):active #{$handle} {
|
|
203
|
+
height: 1.75rem;
|
|
204
|
+
width: 1.75rem;
|
|
205
|
+
transition-timing-function: linear;
|
|
206
|
+
transition-duration: 100ms;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
@each $state, $selector in $check-map {
|
|
210
|
+
&#{$selector}:not([aria-disabled]) {
|
|
211
|
+
& #{$handle}::before {
|
|
212
|
+
background-color: getColor("handle", $state == "checked", false);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
&:is(:hover, :focus-within, :active) #{$handle}::before {
|
|
216
|
+
background-color: getColor("handle", $state == "checked", true);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Icon
|
|
223
|
+
.q-switch {
|
|
224
|
+
& #{$icon} {
|
|
225
|
+
position: absolute;
|
|
226
|
+
// Equivalent to top, right, bottom and left set to 0
|
|
227
|
+
inset: 0;
|
|
228
|
+
margin: auto;
|
|
229
|
+
display: flex;
|
|
230
|
+
align-items: center;
|
|
231
|
+
justify-content: center;
|
|
232
|
+
color: currentColor;
|
|
233
|
+
|
|
234
|
+
transition:
|
|
235
|
+
opacity 33ms linear,
|
|
236
|
+
transform 167ms cubic-bezier(0.2, 0, 0, 1);
|
|
237
|
+
opacity: 0;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
&[aria-checked] #{$icon}--checked,
|
|
241
|
+
&:not([aria-checked]) #{$icon}--unchecked {
|
|
242
|
+
opacity: 1;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// rotate checked icon into view when there is no unchecked icon
|
|
246
|
+
&:not([aria-checked]) #{$handle}:not(#{$handle}--with-icon) #{icon}--checked {
|
|
247
|
+
transform: rotate(-45deg);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
&#{$checked} {
|
|
251
|
+
& #{$icon} {
|
|
252
|
+
transition: none;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
@each $state, $selector in $check-map {
|
|
257
|
+
&#{$selector} {
|
|
258
|
+
& #{$icon}--#{$state} {
|
|
259
|
+
color: getColor("icon", $state == "checked");
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Disabled
|
|
267
|
+
@layer q-switch--disabled {
|
|
268
|
+
.q-switch[aria-disabled] {
|
|
269
|
+
&,
|
|
270
|
+
& * {
|
|
271
|
+
@include disabled.base();
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
& #{$track}::before {
|
|
275
|
+
background-color: disabled.rest-color("surface-container-high");
|
|
276
|
+
border-color: disabled.rest-color("on-surface");
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
& #{$handle} {
|
|
280
|
+
background-color: disabled.font-color();
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
& #{$icon} {
|
|
284
|
+
color: disabled.font-color("surface-container-high");
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
&#{$checked} {
|
|
288
|
+
& #{$track}::before {
|
|
289
|
+
background-color: disabled.rest-color();
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
& #{$handle} {
|
|
293
|
+
background-color: var(--surface);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
& #{$icon} {
|
|
297
|
+
color: disabled.font-color();
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
& :is(#{$handle}, #{$handle}::before) {
|
|
302
|
+
transition: none;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import QIconSnippet from "../private/QIconSnippet.svelte";
|
|
3
|
+
import { ripple } from "../../helpers";
|
|
4
|
+
import { isActivationKey } from "../../utils";
|
|
5
|
+
let {
|
|
6
|
+
value = $bindable(),
|
|
7
|
+
label = void 0,
|
|
8
|
+
labelPosition = "right",
|
|
9
|
+
disabled = false,
|
|
10
|
+
icons = false,
|
|
11
|
+
showOnlyCheckedIcon = false,
|
|
12
|
+
checkedIcon,
|
|
13
|
+
uncheckedIcon,
|
|
14
|
+
...props
|
|
15
|
+
} = $props();
|
|
16
|
+
let qSwitch;
|
|
17
|
+
let qSwitchInput;
|
|
18
|
+
function toggle() {
|
|
19
|
+
value = !value;
|
|
20
|
+
}
|
|
21
|
+
function onclick(event) {
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
if (!qSwitchInput || disabled) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
props.onclick?.(event);
|
|
27
|
+
qSwitchInput.focus();
|
|
28
|
+
toggle();
|
|
29
|
+
}
|
|
30
|
+
function onkeydown(event) {
|
|
31
|
+
if (!qSwitch || disabled || !isActivationKey(event)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
props.onkeydown?.(event);
|
|
35
|
+
if (event.defaultPrevented) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
qSwitch.click();
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<div
|
|
44
|
+
bind:this={qSwitch}
|
|
45
|
+
{...props}
|
|
46
|
+
class="q-switch{props.class ? ` ${props.class}` : ''}"
|
|
47
|
+
class:q-switch--disabled={disabled}
|
|
48
|
+
class:q-switch--reversed={labelPosition === "left"}
|
|
49
|
+
{onclick}
|
|
50
|
+
{onkeydown}
|
|
51
|
+
aria-disabled={disabled || undefined}
|
|
52
|
+
role="switch"
|
|
53
|
+
aria-checked={value || undefined}
|
|
54
|
+
tabindex={disabled ? -1 : 0}
|
|
55
|
+
>
|
|
56
|
+
<label class="q-switch__inner">
|
|
57
|
+
<input
|
|
58
|
+
bind:checked={value}
|
|
59
|
+
bind:this={qSwitchInput}
|
|
60
|
+
type="checkbox"
|
|
61
|
+
disabled={disabled || undefined}
|
|
62
|
+
/>
|
|
63
|
+
<span class="q-switch__track">
|
|
64
|
+
<span class="q-switch__touch"></span>
|
|
65
|
+
<span class="q-switch__handle-container" use:ripple={{ disabled }}>
|
|
66
|
+
<span
|
|
67
|
+
class="q-switch__handle"
|
|
68
|
+
class:q-switch__handle--with-icon={showOnlyCheckedIcon
|
|
69
|
+
? !!value
|
|
70
|
+
: icons || uncheckedIcon}
|
|
71
|
+
>
|
|
72
|
+
{#if (uncheckedIcon || icons) && !showOnlyCheckedIcon}
|
|
73
|
+
{@render icon("unchecked")}
|
|
74
|
+
{/if}
|
|
75
|
+
{#if checkedIcon || icons || showOnlyCheckedIcon}
|
|
76
|
+
{@render icon("checked")}
|
|
77
|
+
{/if}
|
|
78
|
+
</span>
|
|
79
|
+
</span>
|
|
80
|
+
</span>
|
|
81
|
+
</label>
|
|
82
|
+
{#if label}
|
|
83
|
+
<span class="q-switch__label">
|
|
84
|
+
{label}
|
|
85
|
+
</span>
|
|
86
|
+
{/if}
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
{#snippet icon(type: "unchecked" | "checked")}
|
|
90
|
+
<QIconSnippet
|
|
91
|
+
icon={type === "unchecked" ? uncheckedIcon : checkedIcon}
|
|
92
|
+
defaultIcon={type === "unchecked" ? "close" : "check"}
|
|
93
|
+
size="1rem"
|
|
94
|
+
class="q-switch__icon q-switch__icon--{type}"
|
|
95
|
+
/>
|
|
96
|
+
{/snippet}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { QComponentDocs } from "../../utils";
|
|
2
|
-
export declare
|
|
2
|
+
export declare const QSwitchDocs: QComponentDocs;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
name: "
|
|
3
|
-
description: "
|
|
1
|
+
export const QSwitchDocs = {
|
|
2
|
+
name: "QSwitch",
|
|
3
|
+
description: "QSwitch is a switch-like checkbox which offers binary choices. It supports labels, icons and different positioning of the labels.",
|
|
4
4
|
docs: {
|
|
5
5
|
props: [
|
|
6
6
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// AUTO GENERATED FILE - DO NOT MODIFY OR DELETE
|
|
2
|
-
// @quaffHash
|
|
3
|
-
export const
|
|
2
|
+
// @quaffHash 1f6e8500a10f28d00338bc8232a16447
|
|
3
|
+
export const QSwitchDocsProps = [
|
|
4
4
|
{
|
|
5
5
|
name: "value",
|
|
6
6
|
type: "boolean",
|
|
@@ -18,7 +18,15 @@ export const QToggleDocsProps = [
|
|
|
18
18
|
default: "",
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
name: "
|
|
21
|
+
name: "labelPosition",
|
|
22
|
+
type: '"left" | "right"',
|
|
23
|
+
optional: true,
|
|
24
|
+
clickableType: false,
|
|
25
|
+
description: "",
|
|
26
|
+
default: "",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "icons",
|
|
22
30
|
type: "boolean",
|
|
23
31
|
optional: true,
|
|
24
32
|
clickableType: false,
|
|
@@ -26,15 +34,31 @@ export const QToggleDocsProps = [
|
|
|
26
34
|
default: "",
|
|
27
35
|
},
|
|
28
36
|
{
|
|
29
|
-
name: "
|
|
30
|
-
type: "
|
|
37
|
+
name: "showOnlyCheckedIcon",
|
|
38
|
+
type: "boolean",
|
|
31
39
|
optional: true,
|
|
32
40
|
clickableType: false,
|
|
33
41
|
description: "",
|
|
34
42
|
default: "",
|
|
35
43
|
},
|
|
36
44
|
{
|
|
37
|
-
name: "
|
|
45
|
+
name: "checkedIcon",
|
|
46
|
+
type: "MaterialSymbol | Snippet",
|
|
47
|
+
optional: true,
|
|
48
|
+
clickableType: true,
|
|
49
|
+
description: "",
|
|
50
|
+
default: "",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "uncheckedIcon",
|
|
54
|
+
type: "MaterialSymbol | Snippet",
|
|
55
|
+
optional: true,
|
|
56
|
+
clickableType: true,
|
|
57
|
+
description: "",
|
|
58
|
+
default: "",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "disabled",
|
|
38
62
|
type: "boolean",
|
|
39
63
|
optional: true,
|
|
40
64
|
clickableType: false,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MaterialSymbol } from "material-symbols";
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
export interface QSwitchProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
value?: boolean;
|
|
6
|
+
label?: string;
|
|
7
|
+
labelPosition?: "left" | "right";
|
|
8
|
+
icons?: boolean;
|
|
9
|
+
showOnlyCheckedIcon?: boolean;
|
|
10
|
+
checkedIcon?: MaterialSymbol | Snippet;
|
|
11
|
+
uncheckedIcon?: MaterialSymbol | Snippet;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|