@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,78 +1,107 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import { onMount, onDestroy } from "svelte";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount, onDestroy } from "svelte";
|
|
3
|
+
import { browser } from "$app/environment";
|
|
4
|
+
import { QIcon } from "../..";
|
|
5
|
+
let {
|
|
6
|
+
options,
|
|
7
|
+
multiple = false,
|
|
8
|
+
dense = false,
|
|
9
|
+
disable = false,
|
|
10
|
+
error = false,
|
|
11
|
+
errorMessage = void 0,
|
|
12
|
+
filled = false,
|
|
13
|
+
hint = void 0,
|
|
14
|
+
label = void 0,
|
|
15
|
+
outlined = false,
|
|
16
|
+
rounded = false,
|
|
17
|
+
displayValue,
|
|
18
|
+
before = void 0,
|
|
19
|
+
prepend = void 0,
|
|
20
|
+
append = void 0,
|
|
21
|
+
after = void 0,
|
|
22
|
+
value = $bindable(),
|
|
23
|
+
...props
|
|
24
|
+
} = $props();
|
|
25
|
+
let focus = $state(false);
|
|
26
|
+
const currentDisplayValue = $derived.by(() => {
|
|
27
|
+
if (displayValue !== void 0) {
|
|
28
|
+
return displayValue;
|
|
29
|
+
}
|
|
30
|
+
if (!multiple) {
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
return value.join(", ");
|
|
34
|
+
});
|
|
35
|
+
const active = $derived(currentDisplayValue || focus);
|
|
36
|
+
let wrapper = $state(null);
|
|
37
|
+
let isMenuOpen = $state(false);
|
|
38
|
+
let wasClicked = $state(false);
|
|
39
|
+
let preventClose = $state(false);
|
|
40
|
+
function handleMousedown(e) {
|
|
41
|
+
isMenuOpen = !isMenuOpen;
|
|
42
|
+
wasClicked = true;
|
|
43
|
+
props.onmousedown?.(e);
|
|
22
44
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
45
|
+
function handleFocus(e) {
|
|
46
|
+
focus = true;
|
|
47
|
+
if (!wasClicked) {
|
|
48
|
+
isMenuOpen = true;
|
|
49
|
+
}
|
|
50
|
+
wasClicked = false;
|
|
51
|
+
props.onfocus?.(e);
|
|
29
52
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
selectedOptions = options.map((option) => isSelected(option), value);
|
|
35
|
-
let slotPrependWidth = 0;
|
|
36
|
-
function isSelected(option) {
|
|
37
|
-
const optionValue = typeof option === "string" ? option : option.value;
|
|
38
|
-
return multiple ? value.includes(optionValue) : value === optionValue;
|
|
39
|
-
}
|
|
40
|
-
function select(evt, option) {
|
|
41
|
-
evt.preventDefault();
|
|
42
|
-
const optionValue = typeof option === "string" ? option : option.value;
|
|
43
|
-
if (multiple) {
|
|
44
|
-
const hasItem = value.some((entry) => entry === optionValue);
|
|
45
|
-
if (hasItem) {
|
|
46
|
-
value = value.filter(
|
|
47
|
-
(val) => val !== optionValue
|
|
48
|
-
);
|
|
49
|
-
} else {
|
|
50
|
-
value = [...value, optionValue];
|
|
53
|
+
function handleBlur(e) {
|
|
54
|
+
focus = false;
|
|
55
|
+
if (!multiple && !preventClose) {
|
|
56
|
+
isMenuOpen = false;
|
|
51
57
|
}
|
|
52
|
-
|
|
58
|
+
preventClose = false;
|
|
59
|
+
props.onblur?.(e);
|
|
53
60
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
const selectedOptions = $derived(
|
|
62
|
+
options.map((option) => isSelected(option), value),
|
|
63
|
+
);
|
|
64
|
+
let snippetPrependWidth = $state(0);
|
|
65
|
+
function isSelected(option) {
|
|
66
|
+
const optionValue = typeof option === "string" ? option : option.value;
|
|
67
|
+
return multiple ? value.includes(optionValue) : value === optionValue;
|
|
60
68
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
function select(evt, option) {
|
|
70
|
+
evt.preventDefault();
|
|
71
|
+
const optionValue = typeof option === "string" ? option : option.value;
|
|
72
|
+
if (multiple) {
|
|
73
|
+
const hasItem = value.some((entry) => entry === optionValue);
|
|
74
|
+
if (hasItem) {
|
|
75
|
+
value = value.filter((val) => val !== optionValue);
|
|
76
|
+
} else {
|
|
77
|
+
value = [...value, optionValue];
|
|
78
|
+
}
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
value = optionValue;
|
|
82
|
+
isMenuOpen = false;
|
|
65
83
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
84
|
+
function handleClickOutside(event) {
|
|
85
|
+
if (wrapper && !wrapper.contains(event.target)) {
|
|
86
|
+
isMenuOpen = false;
|
|
87
|
+
}
|
|
70
88
|
}
|
|
71
|
-
|
|
89
|
+
onMount(() => {
|
|
90
|
+
if (browser) {
|
|
91
|
+
window.document.addEventListener("click", handleClickOutside);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
onDestroy(() => {
|
|
95
|
+
if (browser) {
|
|
96
|
+
document.removeEventListener("click", handleClickOutside);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
72
99
|
</script>
|
|
73
100
|
|
|
74
101
|
<div
|
|
75
|
-
|
|
102
|
+
bind:this={wrapper}
|
|
103
|
+
{...props}
|
|
104
|
+
class="q-field{props.class ? ` ${props.class}` : ''} q-select"
|
|
76
105
|
class:q-field--default={!outlined && !rounded && !filled}
|
|
77
106
|
class:q-field--outlined={outlined}
|
|
78
107
|
class:q-field--rounded={rounded}
|
|
@@ -82,35 +111,37 @@ onDestroy(() => {
|
|
|
82
111
|
class:q-field--active={active}
|
|
83
112
|
class:q-field--focus={focus}
|
|
84
113
|
class:q-field--label={label}
|
|
85
|
-
class:q-field--
|
|
86
|
-
class:q-field--
|
|
114
|
+
class:q-field--snippet-append={!!append}
|
|
115
|
+
class:q-field--snippet-prepend={!!prepend}
|
|
87
116
|
class:q-field--disable={disable}
|
|
88
117
|
class:q-field--error={error}
|
|
89
118
|
class:q-field--bottom-space={hint || (error && errorMessage)}
|
|
90
|
-
style:--
|
|
91
|
-
{...$$restProps}
|
|
119
|
+
style:--snippet-prepend-width="{snippetPrependWidth}px"
|
|
92
120
|
>
|
|
93
|
-
{#if
|
|
94
|
-
<div class="q-
|
|
95
|
-
|
|
121
|
+
{#if before}
|
|
122
|
+
<div class="q-field__snippet-before">
|
|
123
|
+
{@render before()}
|
|
96
124
|
</div>
|
|
97
125
|
{/if}
|
|
98
126
|
|
|
99
127
|
<div class="q-field__inner">
|
|
100
128
|
<label class="q-field__wrapper">
|
|
101
|
-
{#if
|
|
102
|
-
<div
|
|
103
|
-
|
|
129
|
+
{#if prepend}
|
|
130
|
+
<div
|
|
131
|
+
class="q-field__snippet-prepend"
|
|
132
|
+
bind:clientWidth={snippetPrependWidth}
|
|
133
|
+
>
|
|
134
|
+
{@render prepend()}
|
|
104
135
|
</div>
|
|
105
136
|
{/if}
|
|
106
137
|
|
|
107
138
|
<input
|
|
108
139
|
class="q-field__input"
|
|
109
|
-
|
|
140
|
+
value={currentDisplayValue}
|
|
110
141
|
placeholder=""
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
142
|
+
onfocus={handleFocus}
|
|
143
|
+
onblur={handleBlur}
|
|
144
|
+
onmousedown={handleMousedown}
|
|
114
145
|
disabled={disable}
|
|
115
146
|
tabindex={disable === true ? -1 : 0}
|
|
116
147
|
readonly
|
|
@@ -118,11 +149,11 @@ onDestroy(() => {
|
|
|
118
149
|
|
|
119
150
|
<span class="q-field__label">{label}</span>
|
|
120
151
|
|
|
121
|
-
<div class="q-
|
|
122
|
-
|
|
152
|
+
<div class="q-field__snippet-append">
|
|
153
|
+
{@render append?.()}
|
|
123
154
|
|
|
124
155
|
<QIcon
|
|
125
|
-
class="q-select__arrow-toggle {
|
|
156
|
+
class="q-select__arrow-toggle {append
|
|
126
157
|
? 'q-select__arrow-toggle--has-append'
|
|
127
158
|
: ''}"
|
|
128
159
|
name={`arrow_drop_${isMenuOpen ? "up" : "down"}`}
|
|
@@ -134,9 +165,11 @@ onDestroy(() => {
|
|
|
134
165
|
{#each options as option, idx}
|
|
135
166
|
<a
|
|
136
167
|
href={multiple ? "javascript:void(0)" : undefined}
|
|
137
|
-
class="q-select__option {selectedOptions[idx]
|
|
138
|
-
|
|
139
|
-
|
|
168
|
+
class="q-select__option {selectedOptions[idx]
|
|
169
|
+
? 'q-select__option--selected'
|
|
170
|
+
: ''}"
|
|
171
|
+
onmousedown={() => (preventClose = true)}
|
|
172
|
+
onclick={(e) => select(e, option)}
|
|
140
173
|
>{typeof option === "string" ? option : option.value}</a
|
|
141
174
|
>
|
|
142
175
|
{/each}
|
|
@@ -149,9 +182,9 @@ onDestroy(() => {
|
|
|
149
182
|
{/if}
|
|
150
183
|
</div>
|
|
151
184
|
|
|
152
|
-
{#if
|
|
153
|
-
<div class="q-
|
|
154
|
-
|
|
185
|
+
{#if after}
|
|
186
|
+
<div class="q-field__snippet-after">
|
|
187
|
+
{@render after()}
|
|
155
188
|
</div>
|
|
156
189
|
{/if}
|
|
157
190
|
</div>
|
|
@@ -1,35 +1,3 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { QSelectProps } from "./props";
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
[x: string]: any;
|
|
6
|
-
options: QSelectProps["options"];
|
|
7
|
-
multiple?: QSelectProps["multiple"];
|
|
8
|
-
dense?: QSelectProps["dense"];
|
|
9
|
-
disable?: QSelectProps["disable"];
|
|
10
|
-
error?: QSelectProps["error"];
|
|
11
|
-
errorMessage?: QSelectProps["errorMessage"];
|
|
12
|
-
filled?: QSelectProps["filled"];
|
|
13
|
-
hint?: QSelectProps["hint"];
|
|
14
|
-
label?: QSelectProps["label"];
|
|
15
|
-
outlined?: QSelectProps["outlined"];
|
|
16
|
-
rounded?: QSelectProps["rounded"];
|
|
17
|
-
value: QSelectProps["value"];
|
|
18
|
-
class?: string | null | undefined;
|
|
19
|
-
};
|
|
20
|
-
events: {
|
|
21
|
-
[evt: string]: CustomEvent<any>;
|
|
22
|
-
};
|
|
23
|
-
slots: {
|
|
24
|
-
before: {};
|
|
25
|
-
prepend: {};
|
|
26
|
-
append: {};
|
|
27
|
-
after: {};
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
type QSelectProps_ = typeof __propDef.props;
|
|
31
|
-
export { QSelectProps_ as QSelectProps };
|
|
32
|
-
export type QSelectEvents = typeof __propDef.events;
|
|
33
|
-
export type QSelectSlots = typeof __propDef.slots;
|
|
34
|
-
export default class QSelect extends SvelteComponent<QSelectProps, QSelectEvents, QSelectSlots> {
|
|
35
|
-
}
|
|
2
|
+
declare const QSelect: import("svelte").Component<QSelectProps, {}, "value">;
|
|
3
|
+
export default QSelect;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { QComponentDocs } from "../../utils";
|
|
2
|
-
export declare
|
|
2
|
+
export declare const QSelectDocs: QComponentDocs;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const QSelectDocs = {
|
|
2
2
|
name: "QSelect",
|
|
3
3
|
description: "QSelect is a form component that allows users to choose from multiple options in a dropdown list. It supports single and multiple selection, as well as different visual styles such as filled, outlined, and rounded.",
|
|
4
4
|
docs: {
|
|
@@ -27,6 +27,13 @@ export let QSelectDocs = {
|
|
|
27
27
|
default: false,
|
|
28
28
|
description: "Whether the select component is disabled.",
|
|
29
29
|
},
|
|
30
|
+
{
|
|
31
|
+
name: "displayValue",
|
|
32
|
+
type: "string",
|
|
33
|
+
default: undefined,
|
|
34
|
+
optional: true,
|
|
35
|
+
description: "Custom display value to show instead of the plain option(s).",
|
|
36
|
+
},
|
|
30
37
|
{
|
|
31
38
|
name: "error",
|
|
32
39
|
type: "boolean",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// AUTO GENERATED FILE - DO NOT MODIFY OR DELETE
|
|
2
|
-
// @quaffHash
|
|
2
|
+
// @quaffHash 052485ca1338f87a8ffcdfe3b6718e97
|
|
3
3
|
export const QSelectDocsProps = [
|
|
4
4
|
{
|
|
5
5
|
name: "value",
|
|
@@ -97,4 +97,44 @@ export const QSelectDocsProps = [
|
|
|
97
97
|
description: "",
|
|
98
98
|
default: "",
|
|
99
99
|
},
|
|
100
|
+
{
|
|
101
|
+
name: "displayValue",
|
|
102
|
+
type: "string",
|
|
103
|
+
optional: true,
|
|
104
|
+
clickableType: false,
|
|
105
|
+
description: "",
|
|
106
|
+
default: "",
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: "before",
|
|
110
|
+
type: "Snippet",
|
|
111
|
+
optional: true,
|
|
112
|
+
clickableType: true,
|
|
113
|
+
description: "",
|
|
114
|
+
default: "",
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "prepend",
|
|
118
|
+
type: "Snippet",
|
|
119
|
+
optional: true,
|
|
120
|
+
clickableType: true,
|
|
121
|
+
description: "",
|
|
122
|
+
default: "",
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "append",
|
|
126
|
+
type: "Snippet",
|
|
127
|
+
optional: true,
|
|
128
|
+
clickableType: true,
|
|
129
|
+
description: "",
|
|
130
|
+
default: "",
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: "after",
|
|
134
|
+
type: "Snippet",
|
|
135
|
+
optional: true,
|
|
136
|
+
clickableType: true,
|
|
137
|
+
description: "",
|
|
138
|
+
default: "",
|
|
139
|
+
},
|
|
100
140
|
];
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use "$css/mixins";
|
|
2
|
+
@use "$css/variables";
|
|
1
3
|
@import "$css/shared/q-field.scss";
|
|
2
4
|
|
|
3
5
|
.q-select {
|
|
@@ -11,22 +13,22 @@
|
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
&__menu {
|
|
14
|
-
@include menu;
|
|
16
|
+
@include mixins.menu;
|
|
15
17
|
opacity: 0;
|
|
16
18
|
visibility: hidden;
|
|
17
19
|
transform: scale(0.8) translateY(120%);
|
|
18
20
|
transition:
|
|
19
|
-
opacity
|
|
20
|
-
transform
|
|
21
|
-
visibility 0s
|
|
21
|
+
opacity variables.$speed2,
|
|
22
|
+
transform variables.$speed2,
|
|
23
|
+
visibility 0s variables.$speed2;
|
|
22
24
|
|
|
23
25
|
&--active {
|
|
24
26
|
opacity: 1;
|
|
25
27
|
visibility: visible;
|
|
26
28
|
transform: scale(1) translateY(100%);
|
|
27
29
|
transition:
|
|
28
|
-
opacity
|
|
29
|
-
transform
|
|
30
|
+
opacity variables.$speed2,
|
|
31
|
+
transform variables.$speed2,
|
|
30
32
|
visibility 0s 0s;
|
|
31
33
|
}
|
|
32
34
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { NativeProps } from "../../utils";
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
2
3
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
4
|
export type QSelectOption = string | {
|
|
4
5
|
label: string;
|
|
@@ -20,16 +21,9 @@ export interface QSelectProps extends NativeProps, HTMLAttributes<HTMLDivElement
|
|
|
20
21
|
label?: string;
|
|
21
22
|
outlined?: boolean;
|
|
22
23
|
rounded?: boolean;
|
|
24
|
+
displayValue?: string;
|
|
25
|
+
before?: Snippet;
|
|
26
|
+
prepend?: Snippet;
|
|
27
|
+
append?: Snippet;
|
|
28
|
+
after?: Snippet;
|
|
23
29
|
}
|
|
24
|
-
export declare const QSelectPropsDefaults: {
|
|
25
|
-
dense: boolean;
|
|
26
|
-
disable: boolean;
|
|
27
|
-
error: boolean;
|
|
28
|
-
errorMessage: undefined;
|
|
29
|
-
filled: boolean;
|
|
30
|
-
hint: undefined;
|
|
31
|
-
label: undefined;
|
|
32
|
-
outlined: boolean;
|
|
33
|
-
rounded: boolean;
|
|
34
|
-
value: string;
|
|
35
|
-
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
@use "$css/variables";
|
|
2
|
+
|
|
3
|
+
.q-separator__wrapper {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
opacity: 0.75;
|
|
8
|
+
|
|
9
|
+
&--inset {
|
|
10
|
+
padding: 0 1rem;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&--vertical {
|
|
14
|
+
height: 100%;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
|
|
17
|
+
&.q-separator__wrapper--inset {
|
|
18
|
+
padding: 1rem 0;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&:not(.vertical) {
|
|
23
|
+
width: 100%;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.q-separator {
|
|
28
|
+
border: none;
|
|
29
|
+
flex: 1 1 auto;
|
|
30
|
+
|
|
31
|
+
&--vertical {
|
|
32
|
+
width: var(--q-separator--size, 0.0625rem);
|
|
33
|
+
|
|
34
|
+
@each $space, $val in variables.$spaces {
|
|
35
|
+
@if $space != "none" and $space != "auto" {
|
|
36
|
+
&.q-separator__spacing--#{$space} {
|
|
37
|
+
margin-inline: $val;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&:not(&--vertical) {
|
|
44
|
+
height: var(--q-separator--size, 0.0625rem);
|
|
45
|
+
|
|
46
|
+
@each $space, $val in variables.$spaces {
|
|
47
|
+
@if $space != "auto" {
|
|
48
|
+
&.q-separator__spacing--#{$space} {
|
|
49
|
+
margin-block: $val;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -1,52 +1,45 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { useSize } from "../../composables/useSize";
|
|
3
|
+
let {
|
|
4
|
+
spacing = "none",
|
|
5
|
+
inset = false,
|
|
6
|
+
vertical = false,
|
|
7
|
+
color = "outline",
|
|
8
|
+
size,
|
|
9
|
+
text,
|
|
10
|
+
textAlign = vertical ? "middle" : "center",
|
|
11
|
+
...props
|
|
12
|
+
} = $props();
|
|
13
|
+
const orientation = $derived(vertical ? "vertical" : "horizontal");
|
|
14
|
+
const qSize = $derived(useSize(spacing, "q-separator__spacing"));
|
|
11
15
|
</script>
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
<div
|
|
18
|
+
{...props}
|
|
19
|
+
class="q-separator__wrapper{props.class ? ` ${props.class}` : ''}"
|
|
20
|
+
class:q-separator__wrapper--vertical={vertical}
|
|
21
|
+
class:q-separator__wrapper--inset={inset}
|
|
22
|
+
>
|
|
23
|
+
{#if text}
|
|
20
24
|
{#if (vertical && textAlign !== "top") || (!vertical && textAlign !== "left")}
|
|
21
|
-
|
|
22
|
-
class="q-separator {spacingClass} {colorClass}"
|
|
23
|
-
class:q-separator--vertical={vertical}
|
|
24
|
-
style:--q-separator--size={size}
|
|
25
|
-
aria-orientation={orientation}
|
|
26
|
-
/>
|
|
25
|
+
{@render hr()}
|
|
27
26
|
{/if}
|
|
27
|
+
|
|
28
28
|
<div class={vertical ? "q-py-sm" : "q-px-sm"}>{text}</div>
|
|
29
|
+
|
|
29
30
|
{#if (vertical && textAlign !== "bottom") || (!vertical && textAlign !== "right")}
|
|
30
|
-
|
|
31
|
-
class="q-separator {spacingClass} {colorClass}"
|
|
32
|
-
class:q-separator--vertical={vertical}
|
|
33
|
-
style:--q-separator--size={size}
|
|
34
|
-
aria-orientation={orientation}
|
|
35
|
-
/>
|
|
31
|
+
{@render hr()}
|
|
36
32
|
{/if}
|
|
37
|
-
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
/>
|
|
51
|
-
</div>
|
|
52
|
-
{/if}
|
|
33
|
+
{:else}
|
|
34
|
+
{@render hr()}
|
|
35
|
+
{/if}
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
{#snippet hr()}
|
|
39
|
+
<hr
|
|
40
|
+
class="q-separator bg-{color}{qSize.class ? ` ${qSize.class}` : ''}"
|
|
41
|
+
class:q-separator--vertical={vertical}
|
|
42
|
+
style:--q-separator-size={size}
|
|
43
|
+
aria-orientation={orientation}
|
|
44
|
+
/>
|
|
45
|
+
{/snippet}
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { QSeparatorProps } from "./props";
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
[x: string]: any;
|
|
6
|
-
spacing?: QSeparatorProps["spacing"];
|
|
7
|
-
inset?: QSeparatorProps["inset"];
|
|
8
|
-
vertical?: QSeparatorProps["vertical"];
|
|
9
|
-
color?: QSeparatorProps["color"];
|
|
10
|
-
size?: QSeparatorProps["size"];
|
|
11
|
-
text?: QSeparatorProps["text"];
|
|
12
|
-
textAlign?: QSeparatorProps["textAlign"];
|
|
13
|
-
class?: string | null | undefined;
|
|
14
|
-
};
|
|
15
|
-
events: {
|
|
16
|
-
[evt: string]: CustomEvent<any>;
|
|
17
|
-
};
|
|
18
|
-
slots: {};
|
|
19
|
-
};
|
|
20
|
-
type QSeparatorProps_ = typeof __propDef.props;
|
|
21
|
-
export { QSeparatorProps_ as QSeparatorProps };
|
|
22
|
-
export type QSeparatorEvents = typeof __propDef.events;
|
|
23
|
-
export type QSeparatorSlots = typeof __propDef.slots;
|
|
24
|
-
export default class QSeparator extends SvelteComponent<QSeparatorProps, QSeparatorEvents, QSeparatorSlots> {
|
|
25
|
-
}
|
|
2
|
+
declare const QSeparator: import("svelte").Component<QSeparatorProps, {}, "">;
|
|
3
|
+
export default QSeparator;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { QComponentDocs } from "../../utils";
|
|
2
|
-
export declare
|
|
2
|
+
export declare const QSeparatorDocs: QComponentDocs;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { QSeparatorPropsVertical } from "./docs.props";
|
|
2
|
-
export
|
|
2
|
+
export const QSeparatorDocs = {
|
|
3
3
|
name: "QSeparator",
|
|
4
4
|
description: "Separators can be used to create a dividing line or space between elements within a layout, offering visual separation and organization.",
|
|
5
5
|
docs: {
|