@firstnoodle-ui/bui 0.0.13 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bui.css +1 -1
- package/dist/components/checkbox/Checkbox.vue.d.ts +5 -9
- package/dist/components/checkbox/CircleIndicator.vue.d.ts +3 -2
- package/dist/components/checkbox/DefaultIndicator.vue.d.ts +3 -2
- package/dist/components/collapse/Collapse.vue.d.ts +0 -2
- package/dist/components/confirm-cancel/ConfirmCancel.vue.d.ts +7 -21
- package/dist/components/confirm-cancel/types.d.ts +17 -0
- package/dist/components/input/Input.vue.d.ts +3 -1
- package/dist/components/pagination/Pagination.vue.d.ts +4 -4
- package/dist/components/pop-confirm/PopConfirm.vue.d.ts +5 -13
- package/dist/components/text-editor/components/InsertLinkDialog.vue.d.ts +5 -2
- package/dist/components/text-editor/components/InsertTextDialog.vue.d.ts +5 -2
- package/dist/components/types.d.ts +2 -0
- package/dist/index.mjs +4759 -4763
- package/package.json +9 -2
- package/dist/components/scrollbar/scrollbarWidth.d.ts +0 -1
- package/src/components/application-wrapper/ApplicationWrapper.vue +0 -8
- package/src/components/application-wrapper/index.ts +0 -1
- package/src/components/aside-section-label/AsideSectionLabel.vue +0 -16
- package/src/components/aside-section-label/index.ts +0 -1
- package/src/components/button/Button.vue +0 -245
- package/src/components/button/NotificationBadge.vue +0 -15
- package/src/components/button/index.ts +0 -1
- package/src/components/button-group/ButtonGroup.vue +0 -97
- package/src/components/button-group/index.ts +0 -1
- package/src/components/checkbox/Checkbox.vue +0 -52
- package/src/components/checkbox/CircleIndicator.vue +0 -27
- package/src/components/checkbox/DefaultIndicator.vue +0 -22
- package/src/components/checkbox/index.ts +0 -1
- package/src/components/collapse/Collapse.vue +0 -120
- package/src/components/collapse/index.ts +0 -1
- package/src/components/confirm-cancel/ConfirmCancel.vue +0 -79
- package/src/components/confirm-cancel/index.ts +0 -1
- package/src/components/data-point/DataPoint.vue +0 -5
- package/src/components/data-point/index.ts +0 -1
- package/src/components/dialog/Dialog.vue +0 -70
- package/src/components/dialog/index.ts +0 -1
- package/src/components/fade-in-up/FadeInUp.vue +0 -17
- package/src/components/fade-in-up/index.ts +0 -1
- package/src/components/first-paint/FirstPaint.vue +0 -21
- package/src/components/first-paint/index.ts +0 -1
- package/src/components/first-paint/style.scss +0 -23
- package/src/components/flexbox/Flexbox.vue +0 -50
- package/src/components/flexbox/index.ts +0 -1
- package/src/components/horizontal-layout/Aside.vue +0 -113
- package/src/components/horizontal-layout/HorizontalLayout.vue +0 -118
- package/src/components/horizontal-layout/index.ts +0 -2
- package/src/components/icon/Icon.vue +0 -1159
- package/src/components/icon/index.ts +0 -1
- package/src/components/icon/utils/combine-svgs.cjs +0 -55
- package/src/components/icon/utils/combined-svgs.txt +0 -1150
- package/src/components/icon/utils/svgs/admin.svg +0 -16
- package/src/components/icon/utils/svgs/arrow-deviate.svg +0 -3
- package/src/components/icon/utils/svgs/arrow-down-plus.svg +0 -4
- package/src/components/icon/utils/svgs/arrow-down.svg +0 -3
- package/src/components/icon/utils/svgs/arrow-from.svg +0 -3
- package/src/components/icon/utils/svgs/arrow-left.svg +0 -3
- package/src/components/icon/utils/svgs/arrow-move.svg +0 -15
- package/src/components/icon/utils/svgs/arrow-right.svg +0 -3
- package/src/components/icon/utils/svgs/arrow-sub.svg +0 -3
- package/src/components/icon/utils/svgs/arrow-trend.svg +0 -15
- package/src/components/icon/utils/svgs/arrow-up-plus.svg +0 -4
- package/src/components/icon/utils/svgs/arrow-up.svg +0 -3
- package/src/components/icon/utils/svgs/authority.svg +0 -5
- package/src/components/icon/utils/svgs/beams.svg +0 -5
- package/src/components/icon/utils/svgs/bell.svg +0 -15
- package/src/components/icon/utils/svgs/bold.svg +0 -3
- package/src/components/icon/utils/svgs/box.svg +0 -5
- package/src/components/icon/utils/svgs/building.svg +0 -15
- package/src/components/icon/utils/svgs/bullet-list.svg +0 -8
- package/src/components/icon/utils/svgs/calendar.svg +0 -21
- package/src/components/icon/utils/svgs/camera.svg +0 -5
- package/src/components/icon/utils/svgs/categories.svg +0 -3
- package/src/components/icon/utils/svgs/check-circled.svg +0 -16
- package/src/components/icon/utils/svgs/check-outline.svg +0 -15
- package/src/components/icon/utils/svgs/check.svg +0 -3
- package/src/components/icon/utils/svgs/chevron-down.svg +0 -3
- package/src/components/icon/utils/svgs/chevron-left-double.svg +0 -4
- package/src/components/icon/utils/svgs/chevron-left.svg +0 -3
- package/src/components/icon/utils/svgs/chevron-right-double.svg +0 -4
- package/src/components/icon/utils/svgs/chevron-right.svg +0 -3
- package/src/components/icon/utils/svgs/chevron-up.svg +0 -3
- package/src/components/icon/utils/svgs/clock.svg +0 -4
- package/src/components/icon/utils/svgs/close-outline.svg +0 -3
- package/src/components/icon/utils/svgs/close.svg +0 -3
- package/src/components/icon/utils/svgs/columns.svg +0 -3
- package/src/components/icon/utils/svgs/conclusion.svg +0 -17
- package/src/components/icon/utils/svgs/copy.svg +0 -16
- package/src/components/icon/utils/svgs/crosshair.svg +0 -15
- package/src/components/icon/utils/svgs/dash.svg +0 -3
- package/src/components/icon/utils/svgs/dashboard.svg +0 -3
- package/src/components/icon/utils/svgs/delete.svg +0 -4
- package/src/components/icon/utils/svgs/delta.svg +0 -3
- package/src/components/icon/utils/svgs/download.svg +0 -3
- package/src/components/icon/utils/svgs/drag.svg +0 -8
- package/src/components/icon/utils/svgs/drilldown.svg +0 -8
- package/src/components/icon/utils/svgs/edit.svg +0 -16
- package/src/components/icon/utils/svgs/envelope.svg +0 -3
- package/src/components/icon/utils/svgs/error.svg +0 -3
- package/src/components/icon/utils/svgs/export-document.svg +0 -16
- package/src/components/icon/utils/svgs/filter.svg +0 -6
- package/src/components/icon/utils/svgs/filters.svg +0 -4
- package/src/components/icon/utils/svgs/flag.svg +0 -3
- package/src/components/icon/utils/svgs/folder.svg +0 -15
- package/src/components/icon/utils/svgs/frequency.svg +0 -3
- package/src/components/icon/utils/svgs/fullscreen-off.svg +0 -3
- package/src/components/icon/utils/svgs/fullscreen-on.svg +0 -3
- package/src/components/icon/utils/svgs/graduate.svg +0 -3
- package/src/components/icon/utils/svgs/hamburger.svg +0 -5
- package/src/components/icon/utils/svgs/handshake.svg +0 -15
- package/src/components/icon/utils/svgs/heading-1.svg +0 -4
- package/src/components/icon/utils/svgs/heading-2.svg +0 -4
- package/src/components/icon/utils/svgs/heading.svg +0 -3
- package/src/components/icon/utils/svgs/home.svg +0 -3
- package/src/components/icon/utils/svgs/id-card.svg +0 -6
- package/src/components/icon/utils/svgs/id.svg +0 -4
- package/src/components/icon/utils/svgs/indent-left.svg +0 -7
- package/src/components/icon/utils/svgs/indent-right.svg +0 -7
- package/src/components/icon/utils/svgs/information.svg +0 -17
- package/src/components/icon/utils/svgs/italics.svg +0 -3
- package/src/components/icon/utils/svgs/itenary.svg +0 -11
- package/src/components/icon/utils/svgs/keyboard.svg +0 -11
- package/src/components/icon/utils/svgs/lightning.svg +0 -15
- package/src/components/icon/utils/svgs/link.svg +0 -4
- package/src/components/icon/utils/svgs/list-collapse.svg +0 -6
- package/src/components/icon/utils/svgs/list-expand.svg +0 -6
- package/src/components/icon/utils/svgs/location.svg +0 -4
- package/src/components/icon/utils/svgs/lock-locked.svg +0 -4
- package/src/components/icon/utils/svgs/lock-unlocked.svg +0 -4
- package/src/components/icon/utils/svgs/magnifying-glass.svg +0 -15
- package/src/components/icon/utils/svgs/map.svg +0 -3
- package/src/components/icon/utils/svgs/megaphone.svg +0 -3
- package/src/components/icon/utils/svgs/message.svg +0 -15
- package/src/components/icon/utils/svgs/microscope.svg +0 -3
- package/src/components/icon/utils/svgs/moon.svg +0 -3
- package/src/components/icon/utils/svgs/new-document.svg +0 -4
- package/src/components/icon/utils/svgs/news.svg +0 -15
- package/src/components/icon/utils/svgs/numbered-list.svg +0 -7
- package/src/components/icon/utils/svgs/open-link.svg +0 -16
- package/src/components/icon/utils/svgs/options.svg +0 -5
- package/src/components/icon/utils/svgs/page.svg +0 -7
- package/src/components/icon/utils/svgs/paper-plane.svg +0 -15
- package/src/components/icon/utils/svgs/paper.svg +0 -3
- package/src/components/icon/utils/svgs/pen-and-paper.svg +0 -4
- package/src/components/icon/utils/svgs/phase.svg +0 -15
- package/src/components/icon/utils/svgs/photo.svg +0 -4
- package/src/components/icon/utils/svgs/pie-chart.svg +0 -3
- package/src/components/icon/utils/svgs/plus.svg +0 -3
- package/src/components/icon/utils/svgs/point-left.svg +0 -3
- package/src/components/icon/utils/svgs/point-up.svg +0 -3
- package/src/components/icon/utils/svgs/popup.svg +0 -16
- package/src/components/icon/utils/svgs/question.svg +0 -17
- package/src/components/icon/utils/svgs/radio-tower.svg +0 -3
- package/src/components/icon/utils/svgs/recycle.svg +0 -3
- package/src/components/icon/utils/svgs/redo.svg +0 -3
- package/src/components/icon/utils/svgs/refresh.svg +0 -3
- package/src/components/icon/utils/svgs/route.svg +0 -3
- package/src/components/icon/utils/svgs/rows.svg +0 -3
- package/src/components/icon/utils/svgs/scope.svg +0 -7
- package/src/components/icon/utils/svgs/settings.svg +0 -16
- package/src/components/icon/utils/svgs/share.svg +0 -11
- package/src/components/icon/utils/svgs/sign-in.svg +0 -4
- package/src/components/icon/utils/svgs/sign-up.svg +0 -3
- package/src/components/icon/utils/svgs/sort-down.svg +0 -20
- package/src/components/icon/utils/svgs/sort-up.svg +0 -20
- package/src/components/icon/utils/svgs/sort.svg +0 -7
- package/src/components/icon/utils/svgs/square-solid.svg +0 -3
- package/src/components/icon/utils/svgs/star-solid.svg +0 -15
- package/src/components/icon/utils/svgs/star.svg +0 -15
- package/src/components/icon/utils/svgs/stop-watch.svg +0 -5
- package/src/components/icon/utils/svgs/structure.svg +0 -3
- package/src/components/icon/utils/svgs/sun.svg +0 -23
- package/src/components/icon/utils/svgs/table.svg +0 -3
- package/src/components/icon/utils/svgs/tag.svg +0 -15
- package/src/components/icon/utils/svgs/team.svg +0 -15
- package/src/components/icon/utils/svgs/telescope.svg +0 -15
- package/src/components/icon/utils/svgs/trash.svg +0 -6
- package/src/components/icon/utils/svgs/triangle-angle.svg +0 -3
- package/src/components/icon/utils/svgs/triangle-side.svg +0 -3
- package/src/components/icon/utils/svgs/underline.svg +0 -4
- package/src/components/icon/utils/svgs/undo.svg +0 -3
- package/src/components/icon/utils/svgs/user.svg +0 -16
- package/src/components/icon/utils/svgs/venn.svg +0 -3
- package/src/components/icon/utils/svgs/video.svg +0 -3
- package/src/components/icon/utils/svgs/visibility-off-alt.svg +0 -19
- package/src/components/icon/utils/svgs/visibility-off.svg +0 -3
- package/src/components/icon/utils/svgs/visibility-on.svg +0 -16
- package/src/components/icon/utils/svgs/warning.svg +0 -5
- package/src/components/index.ts +0 -38
- package/src/components/input/Input.vue +0 -87
- package/src/components/input/index.ts +0 -1
- package/src/components/load-spinner/LoadSpinner.vue +0 -13
- package/src/components/load-spinner/index.ts +0 -1
- package/src/components/modal/Modal.vue +0 -111
- package/src/components/modal/index.ts +0 -1
- package/src/components/nav-item/NavItem.vue +0 -62
- package/src/components/nav-item/index.ts +0 -1
- package/src/components/notification/Notification.vue +0 -34
- package/src/components/notification/index.ts +0 -1
- package/src/components/pagination/Pagination.vue +0 -72
- package/src/components/pagination/index.ts +0 -1
- package/src/components/pill/Pill.vue +0 -52
- package/src/components/pill/index.ts +0 -2
- package/src/components/pill/pill-types.ts +0 -2
- package/src/components/pop-confirm/PopConfirm.vue +0 -69
- package/src/components/pop-confirm/index.ts +0 -1
- package/src/components/pop-select/FooterButton.vue +0 -5
- package/src/components/pop-select/PopSelect.vue +0 -346
- package/src/components/pop-select/ResultFilters.vue +0 -31
- package/src/components/pop-select/enums.ts +0 -7
- package/src/components/pop-select/index.ts +0 -2
- package/src/components/pop-select/option.vue +0 -51
- package/src/components/popper/Popper.vue +0 -239
- package/src/components/popper/PopperContent.vue +0 -5
- package/src/components/popper/index.ts +0 -2
- package/src/components/popper/middleware.ts +0 -19
- package/src/components/screen-overlay/ScreenOverlay.vue +0 -53
- package/src/components/screen-overlay/index.ts +0 -1
- package/src/components/scrollbar/Bar.vue +0 -106
- package/src/components/scrollbar/ScrollBottomLoader.vue +0 -25
- package/src/components/scrollbar/Scrollbar.vue +0 -220
- package/src/components/scrollbar/enums.ts +0 -23
- package/src/components/scrollbar/index.ts +0 -2
- package/src/components/scrollbar/scrollbarWidth.ts +0 -26
- package/src/components/scrollbar/style.scss +0 -75
- package/src/components/scrollbar/types.ts +0 -32
- package/src/components/side-over/SideOver.vue +0 -87
- package/src/components/side-over/index.ts +0 -1
- package/src/components/status-select/StatusIndicator.vue +0 -78
- package/src/components/status-select/StatusSelect.vue +0 -62
- package/src/components/status-select/index.ts +0 -1
- package/src/components/switch/Switch.vue +0 -52
- package/src/components/switch/index.ts +0 -1
- package/src/components/tab/Tab.vue +0 -59
- package/src/components/tab/index.ts +0 -1
- package/src/components/tag/Tag.vue +0 -34
- package/src/components/tag/index.ts +0 -1
- package/src/components/text-editor/TextEditor.vue +0 -399
- package/src/components/text-editor/components/Dialog.vue +0 -11
- package/src/components/text-editor/components/FormattingButton.vue +0 -46
- package/src/components/text-editor/components/InsertLinkDialog.vue +0 -81
- package/src/components/text-editor/components/InsertTextDialog.vue +0 -36
- package/src/components/text-editor/components/index.ts +0 -3
- package/src/components/text-editor/index.ts +0 -1
- package/src/components/text-highlight/TextHighlight.vue +0 -113
- package/src/components/text-highlight/index.ts +0 -1
- package/src/components/text-viewer/TextViewer.vue +0 -5
- package/src/components/text-viewer/index.ts +0 -1
- package/src/components/tooltip/Tooltip.vue +0 -54
- package/src/components/tooltip/index.ts +0 -1
- package/src/components/types.ts +0 -221
- package/src/components/vertical-layout/RunningSection.vue +0 -54
- package/src/components/vertical-layout/VerticalLayout.vue +0 -37
- package/src/components/vertical-layout/index.ts +0 -3
- package/src/components/vertical-layout/types.ts +0 -2
- package/src/components/window-frame/WindowFrame.vue +0 -20
- package/src/components/window-frame/index.ts +0 -1
- package/src/composables/index.ts +0 -5
- package/src/composables/useClickOutside.ts +0 -48
- package/src/composables/useEscapeKey.ts +0 -12
- package/src/composables/useMounted.ts +0 -7
- package/src/composables/useNextFrame.ts +0 -10
- package/src/composables/useTrapFocus.ts +0 -61
- package/src/index.ts +0 -5
- package/src/main.css +0 -116
- package/src/utils/array.ts +0 -11
- package/src/utils/clamp.ts +0 -1
- package/src/utils/debounce.ts +0 -8
- package/src/utils/index.ts +0 -5
- package/src/utils/scrollIntoView.ts +0 -25
- package/src/utils/scrollbarWidth.ts +0 -27
- package/tsconfig.app.json +0 -4
- package/tsconfig.json +0 -11
- package/tsconfig.node.json +0 -21
- package/vite.config.ts +0 -27
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firstnoodle-ui/bui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.15",
|
|
5
5
|
"private": false,
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -11,10 +11,17 @@
|
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
13
|
"import": "./dist/index.mjs"
|
|
14
|
+
},
|
|
15
|
+
"./bui.css": {
|
|
16
|
+
"default": "./dist/bui.css"
|
|
14
17
|
}
|
|
15
18
|
},
|
|
16
19
|
"main": "./dist/index.mjs",
|
|
17
20
|
"types": "dist/index.d.ts",
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"dist/bui.css"
|
|
24
|
+
],
|
|
18
25
|
"peerDependencies": {
|
|
19
26
|
"tailwindcss": "^4.1.1",
|
|
20
27
|
"vue": "^3.5.13"
|
|
@@ -60,6 +67,6 @@
|
|
|
60
67
|
"build": "vite build",
|
|
61
68
|
"typecheck": "vue-tsc -p tsconfig.app.json --noEmit",
|
|
62
69
|
"watch": "vite build --watch",
|
|
63
|
-
"release:publish": "pnpm publish --access public --otp=
|
|
70
|
+
"release:publish": "pnpm publish --access public --otp=553919 --no-git-checks"
|
|
64
71
|
}
|
|
65
72
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const scrollbarWidth: () => number;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<main class="fixed top-0 left-0 w-screen h-screen overflow-hidden text-primary">
|
|
3
|
-
<slot />
|
|
4
|
-
<div id="modals" class="z-10 fixed w-screen h-screen top-0 left-0 pointer-events-none" />
|
|
5
|
-
<div id="notifications" class="z-10 fixed w-screen h-screen top-0 left-0 pointer-events-none flex items-end justify-center p-12" />
|
|
6
|
-
<div id="poppers" class="z-10 fixed w-screen h-screen top-0 left-0 pointer-events-none" />
|
|
7
|
-
</main>
|
|
8
|
-
</template>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as BApplicationWrapper } from "./ApplicationWrapper.vue";
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
defineProps<{ label: string }>();
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
<template>
|
|
6
|
-
<section class="w-full space-y-4">
|
|
7
|
-
<div class="w-full h-12 flex items-center">
|
|
8
|
-
<p class="flex-none pr-2 text-xs leading-none font-medium text-secondary">
|
|
9
|
-
{{ label }}
|
|
10
|
-
</p>
|
|
11
|
-
<div class="flex-1 h-full">
|
|
12
|
-
<div class="w-full border-b border-default" style="height: 54%" />
|
|
13
|
-
</div>
|
|
14
|
-
</div>
|
|
15
|
-
</section>
|
|
16
|
-
</template>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as BAsideSectionLabel } from "./AsideSectionLabel.vue";
|
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { Placement } from "@floating-ui/dom";
|
|
3
|
-
import type { ButtonVariant, TIcon } from "../types";
|
|
4
|
-
import { computed, ref } from "vue";
|
|
5
|
-
import { BIcon, BLoadSpinner, BTooltip } from "../";
|
|
6
|
-
import NotificationBadge from "./NotificationBadge.vue";
|
|
7
|
-
|
|
8
|
-
const props = withDefaults(
|
|
9
|
-
defineProps<{
|
|
10
|
-
variant?: ButtonVariant;
|
|
11
|
-
classes?: string;
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
fullwidth?: boolean;
|
|
14
|
-
href?: string;
|
|
15
|
-
icon?: TIcon;
|
|
16
|
-
iconAfter?: TIcon;
|
|
17
|
-
label?: string;
|
|
18
|
-
linkTarget?: string;
|
|
19
|
-
loading?: boolean;
|
|
20
|
-
mailto?: string;
|
|
21
|
-
notification?: boolean;
|
|
22
|
-
rounded?: boolean;
|
|
23
|
-
routerLinkTo?: string | { path: string } | { name: string };
|
|
24
|
-
small?: boolean;
|
|
25
|
-
focus?: boolean;
|
|
26
|
-
stopPropagation?: boolean;
|
|
27
|
-
tooltip?: string;
|
|
28
|
-
tooltipDelay?: number;
|
|
29
|
-
tooltipPlacement?: Placement;
|
|
30
|
-
}>(),
|
|
31
|
-
{
|
|
32
|
-
variant: "fill",
|
|
33
|
-
disabled: false,
|
|
34
|
-
focus: false,
|
|
35
|
-
fullwidth: false,
|
|
36
|
-
loading: false,
|
|
37
|
-
notification: false,
|
|
38
|
-
rounded: false,
|
|
39
|
-
small: false,
|
|
40
|
-
stopPropagation: false,
|
|
41
|
-
tooltipDelay: 500,
|
|
42
|
-
tooltipPlacement: "top",
|
|
43
|
-
},
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
const emit = defineEmits(["click", "blur"]);
|
|
47
|
-
|
|
48
|
-
const component = ref<string>(props.routerLinkTo ? "router-link" : "button");
|
|
49
|
-
const buttonRef = ref<HTMLButtonElement>();
|
|
50
|
-
|
|
51
|
-
const loadSpinnerClass = computed(() => {
|
|
52
|
-
const classes = ["w-4 h-4"];
|
|
53
|
-
if (props.variant === "fill" || props.variant === "destructive") {
|
|
54
|
-
classes.push("text-light");
|
|
55
|
-
}
|
|
56
|
-
else if (props.variant === "outline" || props.variant === "text") {
|
|
57
|
-
classes.push("text-blue-500");
|
|
58
|
-
}
|
|
59
|
-
else if (props.variant === "outlineSubtle" || props.variant === "textSubtle") {
|
|
60
|
-
classes.push("text-slate-700 dark:text-slate-200");
|
|
61
|
-
}
|
|
62
|
-
return classes.join(" ");
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
const buttonClasses = computed(() => {
|
|
66
|
-
const result = [];
|
|
67
|
-
|
|
68
|
-
// Set padding x.
|
|
69
|
-
// Add extra if rounded and there is a label
|
|
70
|
-
props.rounded && props.label
|
|
71
|
-
? result.push(props.small ? "px-2" : "px-3")
|
|
72
|
-
: result.push(props.loading && props.icon && !props.label ? "px-0" : "px-2");
|
|
73
|
-
|
|
74
|
-
props.small ? result.push("h-6") : result.push("h-8");
|
|
75
|
-
|
|
76
|
-
if (props.icon && !props.label) {
|
|
77
|
-
props.small ? result.push("w-6") : result.push("w-8");
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
props.disabled ? result.push("opacity-75 cursor-not-allowed") : result.push("cursor-pointer");
|
|
81
|
-
props.fullwidth && result.push("w-full");
|
|
82
|
-
|
|
83
|
-
if (props.rounded) result.push("rounded-full");
|
|
84
|
-
else result.push("rounded-lg");
|
|
85
|
-
|
|
86
|
-
switch (props.variant) {
|
|
87
|
-
case "fill":
|
|
88
|
-
result.push(
|
|
89
|
-
...(props.focus
|
|
90
|
-
? [""]
|
|
91
|
-
: [
|
|
92
|
-
"bg-blue-500 hover:bg-blue-600 focus-visible:bg-blue-600 active:bg-blue-700",
|
|
93
|
-
"border border-blue-500 hover:border-blue-600 focus-visible:border-blue-600 active:border-blue-700",
|
|
94
|
-
"text-white focus-visible:outline",
|
|
95
|
-
"dark:bg-blue-700 dark:hover:bg-blue-600 focus-visible:bg-blue-600 dark:active:bg-blue-500",
|
|
96
|
-
"border dark:border-blue-700 dark:hover:border-blue-600 focus-visible:border-blue-600 dark:active:border-blue-500",
|
|
97
|
-
]
|
|
98
|
-
),
|
|
99
|
-
);
|
|
100
|
-
break;
|
|
101
|
-
case "outline":
|
|
102
|
-
result.push(
|
|
103
|
-
...(props.focus
|
|
104
|
-
? [""]
|
|
105
|
-
: [
|
|
106
|
-
"hover:bg-blue-100 focus-visible:bg-blue-100 active:bg-blue-200",
|
|
107
|
-
"border border-blue-500 hover:border-blue-600 focus-visible:border-blue-600 active:border-blue-700",
|
|
108
|
-
"text-blue-500 hover:text-blue-600 focus-visible:text-blue-600 active:text-blue-700",
|
|
109
|
-
"dark:hover:bg-blue-900 dark:focus-visible:bg-blue-900 dark:active:bg-blue-700",
|
|
110
|
-
"dark:border-blue-500 dark:hover:border-blue-500 dark:focus-visible:border-blue-500 dark:active:border-blue-600",
|
|
111
|
-
"dark:text-blue-500 dark:hover:text-blue-100 focus-visible:text-blue-100 dark:active:text-white",
|
|
112
|
-
]
|
|
113
|
-
),
|
|
114
|
-
);
|
|
115
|
-
break;
|
|
116
|
-
case "outlineSubtle":
|
|
117
|
-
result.push(
|
|
118
|
-
...(props.focus
|
|
119
|
-
? [""]
|
|
120
|
-
: [
|
|
121
|
-
"hover:bg-slate-100 focus-visible:bg-slate-100 active:bg-slate-200",
|
|
122
|
-
"border border-stone-300 hover:border-stone-400 focus-visible:border-stone-400 active:border-stone-500",
|
|
123
|
-
"text-slate-700 hover:text-slate-800 focus-visible:text-slate-800 active:text-slate-900",
|
|
124
|
-
"dark:hover:bg-neutral-700 focus-visible:bg-neutral-700 dark:active:bg-neutral-600",
|
|
125
|
-
"dark:border-stone-700 dark:hover:border-stone-600 focus-visible:border-stone-600 dark:active:border-stone-500",
|
|
126
|
-
"dark:text-slate-200 dark:hover:text-slate-100 focus-visible:text-slate-100 dark:active:text-white",
|
|
127
|
-
]
|
|
128
|
-
),
|
|
129
|
-
);
|
|
130
|
-
break;
|
|
131
|
-
case "text":
|
|
132
|
-
result.push(
|
|
133
|
-
...(props.focus
|
|
134
|
-
? [""]
|
|
135
|
-
: [
|
|
136
|
-
"hover:bg-blue-100 focus-visible:bg-blue-100 active:bg-blue-200",
|
|
137
|
-
"border-none",
|
|
138
|
-
"text-blue-500 hover:text-blue-600 focus-visible:text-blue-600 active:text-blue-700",
|
|
139
|
-
"dark:hover:bg-blue-900 dark:focus-visible:bg-blue-900 dark:active:bg-blue-700",
|
|
140
|
-
"dark:text-blue-500 dark:hover:text-blue-100 focus-visible:text-blue-100 dark:active:text-white",
|
|
141
|
-
]
|
|
142
|
-
),
|
|
143
|
-
);
|
|
144
|
-
break;
|
|
145
|
-
case "textSubtle":
|
|
146
|
-
result.push(
|
|
147
|
-
...(props.focus
|
|
148
|
-
? ["bg-slate-200 text-slate-900 dark:bg-neutral-600 dark:text-white"]
|
|
149
|
-
: [
|
|
150
|
-
"hover:bg-slate-100 focus-visible:bg-slate-100 active:bg-slate-200",
|
|
151
|
-
"border-none",
|
|
152
|
-
"text-slate-700 hover:text-slate-800 focus-visible:text-slate-800 active:text-slate-900",
|
|
153
|
-
"dark:hover:bg-neutral-700 focus-visible:bg-neutral-700 dark:active:bg-neutral-600",
|
|
154
|
-
"dark:text-slate-200 dark:hover:text-slate-100 focus-visible:text-slate-100 dark:active:text-white",
|
|
155
|
-
]
|
|
156
|
-
),
|
|
157
|
-
);
|
|
158
|
-
break;
|
|
159
|
-
case "destructive":
|
|
160
|
-
result.push(
|
|
161
|
-
...(props.focus
|
|
162
|
-
? ["bg-red-800 border-red-800 text-white"]
|
|
163
|
-
: [
|
|
164
|
-
"bg-red-600 hover:bg-red-700 focus-visible:bg-red-700 active:bg-red-800",
|
|
165
|
-
"border border-red-600 hover:border-red-700 focus-visible:border-red-700 active:border-red-800",
|
|
166
|
-
"text-white",
|
|
167
|
-
]
|
|
168
|
-
),
|
|
169
|
-
);
|
|
170
|
-
break;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (props.classes) result.push(props.classes);
|
|
174
|
-
|
|
175
|
-
return result.filter(i => i).join(" ");
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
const disabledStyle = computed(() => {
|
|
179
|
-
if (props.disabled) {
|
|
180
|
-
return props.variant === "fill" || props.variant === "destructive" ? { filter: "grayscale(50%)" } : { background: "hsl(0 0% 90%)" };
|
|
181
|
-
}
|
|
182
|
-
return {};
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
const onClick = (event: MouseEvent) => {
|
|
186
|
-
props.stopPropagation && event.stopPropagation();
|
|
187
|
-
|
|
188
|
-
if (!props.disabled && !props.loading) {
|
|
189
|
-
if (props.href) {
|
|
190
|
-
window.open(props.href, "_blank");
|
|
191
|
-
}
|
|
192
|
-
if (props.mailto) window.open(`mailto:${props.mailto}`);
|
|
193
|
-
emit("click");
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
const focus = () => buttonRef.value!.focus();
|
|
198
|
-
|
|
199
|
-
defineExpose({ focus });
|
|
200
|
-
</script>
|
|
201
|
-
|
|
202
|
-
<template>
|
|
203
|
-
<BTooltip v-if="tooltip" hover :text="tooltip" :delay="tooltipDelay" :placement="tooltipPlacement" :trigger-full-width="fullwidth">
|
|
204
|
-
<component
|
|
205
|
-
:is="component"
|
|
206
|
-
ref="buttonRef"
|
|
207
|
-
:to="routerLinkTo"
|
|
208
|
-
class="z-0 relative inline-flex items-center justify-center space-x-1 leading-none text-sm border focus:z-10 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-black dark:focus-visible:outline-white"
|
|
209
|
-
:class="buttonClasses"
|
|
210
|
-
:disabled="disabled || loading"
|
|
211
|
-
:style="disabledStyle"
|
|
212
|
-
@click="onClick"
|
|
213
|
-
@blur="emit('blur')"
|
|
214
|
-
>
|
|
215
|
-
<BLoadSpinner v-if="loading" :class="loadSpinnerClass" />
|
|
216
|
-
<BIcon v-else-if="icon" :name="icon" />
|
|
217
|
-
<div v-if="label">
|
|
218
|
-
{{ label }}
|
|
219
|
-
</div>
|
|
220
|
-
<BIcon v-if="iconAfter" :name="iconAfter" class="opacity-75" />
|
|
221
|
-
<NotificationBadge v-if="notification" :inside="variant === 'text' || variant === 'textSubtle'" />
|
|
222
|
-
</component>
|
|
223
|
-
</BTooltip>
|
|
224
|
-
<component
|
|
225
|
-
:is="component"
|
|
226
|
-
v-else
|
|
227
|
-
ref="buttonRef"
|
|
228
|
-
:to="routerLinkTo"
|
|
229
|
-
:target="props.linkTarget"
|
|
230
|
-
class="z-0 relative inline-flex items-center justify-center space-x-1 leading-none text-sm border focus:z-10 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-black dark:focus-visible:outline-white"
|
|
231
|
-
:class="buttonClasses"
|
|
232
|
-
:disabled="disabled || loading"
|
|
233
|
-
:style="disabledStyle"
|
|
234
|
-
@click="onClick"
|
|
235
|
-
@blur="emit('blur')"
|
|
236
|
-
>
|
|
237
|
-
<BLoadSpinner v-if="loading" :class="loadSpinnerClass" />
|
|
238
|
-
<BIcon v-else-if="icon" :name="icon" />
|
|
239
|
-
<div v-if="label">
|
|
240
|
-
{{ label }}
|
|
241
|
-
</div>
|
|
242
|
-
<BIcon v-if="iconAfter" :name="iconAfter" />
|
|
243
|
-
<NotificationBadge v-if="notification" :inside="variant === 'text' || variant === 'textSubtle'" />
|
|
244
|
-
</component>
|
|
245
|
-
</template>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
defineProps<{ inside?: boolean }>();
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
<template>
|
|
6
|
-
<div
|
|
7
|
-
class="absolute"
|
|
8
|
-
:style="{
|
|
9
|
-
top: inside ? '0.15em' : '-0.3em',
|
|
10
|
-
right: inside ? '0.15em' : '-0.3em',
|
|
11
|
-
}"
|
|
12
|
-
>
|
|
13
|
-
<div class="w-3 h-3 bg-orange-500 rounded-full border border-white" />
|
|
14
|
-
</div>
|
|
15
|
-
</template>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as BButton } from "./Button.vue";
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { TButtonGroupOrientation } from "../types";
|
|
3
|
-
import { onMounted, provide, ref } from "vue";
|
|
4
|
-
|
|
5
|
-
const props = withDefaults(
|
|
6
|
-
defineProps<{
|
|
7
|
-
direction?: TButtonGroupOrientation;
|
|
8
|
-
fullwidth?: boolean;
|
|
9
|
-
}>(),
|
|
10
|
-
{
|
|
11
|
-
direction: "horizontal",
|
|
12
|
-
fullwidth: false,
|
|
13
|
-
},
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
const classes = ref<string>("");
|
|
17
|
-
const buttonGroupRef = ref<HTMLDivElement>();
|
|
18
|
-
|
|
19
|
-
provide("childOfButtonGroup", true);
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* We need to update (reapply) the classes whenever a button in the group is clicked,
|
|
23
|
-
* as its classes from within the button component might be updated and thus the classes applied here will be overwritten
|
|
24
|
-
*/
|
|
25
|
-
const update = () => {
|
|
26
|
-
const result = [];
|
|
27
|
-
|
|
28
|
-
props.fullwidth ? result.push("flex w-full") : result.push("inline-flex");
|
|
29
|
-
|
|
30
|
-
if (props.direction === "vertical") {
|
|
31
|
-
result.push("flex-col items-stretch");
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
result.push("items-center");
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
classes.value = result.join(" ");
|
|
38
|
-
|
|
39
|
-
// add classes to immediate children of button group
|
|
40
|
-
// the buttons inside the group might be wrapped in other elements if tooltip or popper is used
|
|
41
|
-
if (buttonGroupRef.value) {
|
|
42
|
-
Array.from(buttonGroupRef.value.children).forEach((child: Element, index: number) => {
|
|
43
|
-
if (props.direction === "vertical") {
|
|
44
|
-
child.classList.add("-mt-px");
|
|
45
|
-
child.classList.add("first:mt-0");
|
|
46
|
-
|
|
47
|
-
if (index === 0) {
|
|
48
|
-
if (child.nodeName === "BUTTON") {
|
|
49
|
-
child.classList.add("rounded-t-md");
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
child.querySelector("button")?.classList.add("rounded-t-md");
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
else if (index === buttonGroupRef.value!.children.length - 1) {
|
|
56
|
-
if (child.nodeName === "BUTTON") {
|
|
57
|
-
child.classList.add("rounded-b-md");
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
child.querySelector("button")?.classList.add("rounded-b-md");
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
child.classList.add("-ml-px");
|
|
66
|
-
child.classList.add("first:ml-0");
|
|
67
|
-
|
|
68
|
-
// TODO: if child is button, do not query for it
|
|
69
|
-
if (index === 0) {
|
|
70
|
-
if (child.nodeName === "BUTTON") {
|
|
71
|
-
child.classList.add("rounded-l-md");
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
child.querySelector("button")?.classList.add("rounded-l-md");
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
else if (index === buttonGroupRef.value!.children.length - 1) {
|
|
78
|
-
if (child.nodeName === "BUTTON") {
|
|
79
|
-
child.classList.add("rounded-r-md");
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
child.querySelector("button")?.classList.add("rounded-r-md");
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
onMounted(update);
|
|
91
|
-
</script>
|
|
92
|
-
|
|
93
|
-
<template>
|
|
94
|
-
<div ref="buttonGroupRef" :class="classes" @click.stop.prevent="update">
|
|
95
|
-
<slot />
|
|
96
|
-
</div>
|
|
97
|
-
</template>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as BButtonGroup } from "./ButtonGroup.vue";
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import CircleIndicator from "./CircleIndicator.vue";
|
|
3
|
-
import DefaultIndicator from "./DefaultIndicator.vue";
|
|
4
|
-
|
|
5
|
-
withDefaults(
|
|
6
|
-
defineProps<{
|
|
7
|
-
button?: boolean;
|
|
8
|
-
label?: string;
|
|
9
|
-
type?: "default" | "circle";
|
|
10
|
-
value?: number;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
}>(),
|
|
13
|
-
{
|
|
14
|
-
button: false,
|
|
15
|
-
type: "default",
|
|
16
|
-
value: 0,
|
|
17
|
-
disabled: false,
|
|
18
|
-
},
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
const emit = defineEmits(["click"]);
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<template>
|
|
25
|
-
<div
|
|
26
|
-
class="items-center space-x-2"
|
|
27
|
-
:class="{
|
|
28
|
-
'flex': !button,
|
|
29
|
-
'inline-flex border rounded-md h-8 px-3': button,
|
|
30
|
-
'border-action': value && !disabled,
|
|
31
|
-
'border-default': !value && !disabled,
|
|
32
|
-
'border-subtle cursor-default': disabled,
|
|
33
|
-
'cursor-pointer': !disabled,
|
|
34
|
-
}"
|
|
35
|
-
@click.stop.prevent="!disabled && emit('click')"
|
|
36
|
-
>
|
|
37
|
-
<DefaultIndicator v-if="type === 'default'" :value="value" :disabled="disabled" />
|
|
38
|
-
<CircleIndicator v-else :value="value" :disabled="disabled" />
|
|
39
|
-
<span
|
|
40
|
-
v-if="label"
|
|
41
|
-
class="block text-sm leading-tight select-none"
|
|
42
|
-
:class="{
|
|
43
|
-
'text-action': button && value,
|
|
44
|
-
'text-secondary': button && !value && !disabled,
|
|
45
|
-
'hover:underline': !button && !disabled,
|
|
46
|
-
'text-tertiary': disabled,
|
|
47
|
-
}"
|
|
48
|
-
>
|
|
49
|
-
{{ label }}
|
|
50
|
-
</span>
|
|
51
|
-
</div>
|
|
52
|
-
</template>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed } from "vue";
|
|
3
|
-
import { BIcon } from "../";
|
|
4
|
-
|
|
5
|
-
const { value, disabled } = defineProps<{ value: number; disabled: boolean }>();
|
|
6
|
-
|
|
7
|
-
const icon = computed(() => {
|
|
8
|
-
if (value) {
|
|
9
|
-
return value === 1 ? "check" : "dash";
|
|
10
|
-
}
|
|
11
|
-
return null;
|
|
12
|
-
});
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<template>
|
|
16
|
-
<button
|
|
17
|
-
class="group inline-flex items-center justify-center w-6 h-6 rounded-full border focus:outline-hidden focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-black dark:focus-visible:outline-white"
|
|
18
|
-
:class="{
|
|
19
|
-
'border-action bg-action text-white': !disabled && value,
|
|
20
|
-
'border-strong bg-tertiary text-white cursor-default': disabled && value,
|
|
21
|
-
'border-default bg-secondary hover:bg-secondary cursor-pointer': disabled && !value,
|
|
22
|
-
'border-default bg-primary hover:bg-amber-300 cursor-pointer': !disabled && !value,
|
|
23
|
-
}"
|
|
24
|
-
>
|
|
25
|
-
<BIcon v-if="icon" :name="icon" class="text-white group-hover:text-muted" />
|
|
26
|
-
</button>
|
|
27
|
-
</template>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
defineProps<{ value: number; disabled: boolean }>();
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
<template>
|
|
6
|
-
<button
|
|
7
|
-
class="flex items-center justify-center w-4 h-4 border rounded focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-black dark:focus-visible:outline-white"
|
|
8
|
-
:class="{
|
|
9
|
-
'border-action bg-action': value && !disabled,
|
|
10
|
-
'bg-primary border-default': !value && !disabled,
|
|
11
|
-
'border-default bg-secondary': disabled && value,
|
|
12
|
-
'border-subtle bg-tertiary': disabled && !value,
|
|
13
|
-
'cursor-default': disabled,
|
|
14
|
-
'hover:border-action focus:border-actionLightActive focus:outline-hidden': !disabled,
|
|
15
|
-
}"
|
|
16
|
-
>
|
|
17
|
-
<svg v-if="value === 1" width="10" height="8" viewBox="0 0 10 8" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
18
|
-
<path d="M8.41166 0.5L10 2.0417L4.01353 7.5L0 3.57411L1.60557 2.04932L4.02897 4.39988L8.41166 0.5Z" fill="white" />
|
|
19
|
-
</svg>
|
|
20
|
-
<div v-if="value === 2" class="w-2 bg-primary" style="height: 2px" />
|
|
21
|
-
</button>
|
|
22
|
-
</template>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as BCheckbox } from "./Checkbox.vue";
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
|
3
|
-
import { BIcon } from "../";
|
|
4
|
-
|
|
5
|
-
const props = withDefaults(
|
|
6
|
-
defineProps<{
|
|
7
|
-
alignment?: "left" | "right";
|
|
8
|
-
borderClassOpen?: string;
|
|
9
|
-
borderClassClosed?: string;
|
|
10
|
-
headerBgClass?: string;
|
|
11
|
-
id?: string | number;
|
|
12
|
-
open?: boolean;
|
|
13
|
-
sticky?: boolean;
|
|
14
|
-
}>(),
|
|
15
|
-
{
|
|
16
|
-
alignment: "right",
|
|
17
|
-
borderClassOpen: "border-strong",
|
|
18
|
-
borderClassClosed: "border-default",
|
|
19
|
-
headerBgClass: "bg-primary",
|
|
20
|
-
id: "",
|
|
21
|
-
open: false,
|
|
22
|
-
sticky: false,
|
|
23
|
-
},
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
const emit = defineEmits(["toggle"]);
|
|
27
|
-
|
|
28
|
-
const buttonRef = ref<HTMLButtonElement>();
|
|
29
|
-
const headerRef = ref<HTMLHeadElement>();
|
|
30
|
-
const isSticky = ref(false);
|
|
31
|
-
|
|
32
|
-
const styles = computed(() => {
|
|
33
|
-
return isSticky.value
|
|
34
|
-
? {
|
|
35
|
-
top: "-1px",
|
|
36
|
-
paddingTop: "1px",
|
|
37
|
-
}
|
|
38
|
-
: {};
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
watch(
|
|
42
|
-
() => props.open,
|
|
43
|
-
(newValue) => {
|
|
44
|
-
if (!newValue) isSticky.value = false;
|
|
45
|
-
},
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
watch(isSticky, (newValue) => {
|
|
49
|
-
if (newValue) buttonRef.value!.blur();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
const observer = ref<IntersectionObserver | null>(null);
|
|
53
|
-
onMounted(() => {
|
|
54
|
-
if (props.sticky) {
|
|
55
|
-
observer.value = new IntersectionObserver(
|
|
56
|
-
([e]) => {
|
|
57
|
-
if (props.open) {
|
|
58
|
-
isSticky.value = e.intersectionRatio < 1;
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
threshold: [1],
|
|
63
|
-
},
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
observer.value.observe(headerRef.value!);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
onBeforeUnmount(() => {
|
|
70
|
-
if (observer.value) {
|
|
71
|
-
observer.value.disconnect();
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
</script>
|
|
75
|
-
|
|
76
|
-
<template>
|
|
77
|
-
<section class="w-full">
|
|
78
|
-
<header
|
|
79
|
-
ref="headerRef"
|
|
80
|
-
class="w-full border-b"
|
|
81
|
-
:style="styles"
|
|
82
|
-
:class="[
|
|
83
|
-
{
|
|
84
|
-
[props.borderClassOpen]: open,
|
|
85
|
-
[props.borderClassClosed]: !open,
|
|
86
|
-
'shadow-sm-xs border-brand': isSticky,
|
|
87
|
-
'sticky z-10': isSticky,
|
|
88
|
-
'relative': !isSticky,
|
|
89
|
-
},
|
|
90
|
-
headerBgClass,
|
|
91
|
-
]"
|
|
92
|
-
>
|
|
93
|
-
<div class="flex items-center w-full h-10">
|
|
94
|
-
<div v-if="alignment === 'left'" class="relative flex-1 min-w-0 flex items-center text-sm">
|
|
95
|
-
<slot name="header" :sticky="isSticky" />
|
|
96
|
-
</div>
|
|
97
|
-
<div class="flex-none w-8 h-8 flex items-center justify-center">
|
|
98
|
-
<button
|
|
99
|
-
v-if="$slots.content"
|
|
100
|
-
ref="buttonRef"
|
|
101
|
-
class="w-6 h-6 flex items-center justify-center rounded-lg hover:bg-black/10 focus:outline-hidden focus-visible:bg-black/10"
|
|
102
|
-
@click="emit('toggle', id)"
|
|
103
|
-
>
|
|
104
|
-
<BIcon
|
|
105
|
-
:name="alignment === 'right' ? 'chevron-right' : 'chevron-up'"
|
|
106
|
-
class="transform transition-all duration-100"
|
|
107
|
-
:class="{ [alignment === 'right' ? 'rotate-90' : 'rotate-180']: open }"
|
|
108
|
-
/>
|
|
109
|
-
</button>
|
|
110
|
-
</div>
|
|
111
|
-
<div v-if="alignment === 'right'" class="relative flex-1 min-w-0 flex items-center text-sm">
|
|
112
|
-
<slot name="header" :sticky="isSticky" />
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
</header>
|
|
116
|
-
<main v-if="open" class="relative">
|
|
117
|
-
<slot name="content" />
|
|
118
|
-
</main>
|
|
119
|
-
</section>
|
|
120
|
-
</template>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as BCollapse } from "./Collapse.vue";
|