@firstnoodle-ui/bui 0.0.27 → 0.0.28
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/LICENSE +21 -21
- package/dist/bui.css +1 -1
- package/dist/components/calendar-view/CalendarView.vue.d.ts +21 -0
- package/dist/components/calendar-view/components/DateButton.vue.d.ts +10 -0
- package/dist/components/calendar-view/components/DecadeView.vue.d.ts +12 -0
- package/dist/components/calendar-view/components/MonthView.vue.d.ts +17 -0
- package/dist/components/calendar-view/components/YearView.vue.d.ts +13 -0
- package/dist/components/calendar-view/composables/useCalendar.d.ts +44 -0
- package/dist/components/calendar-view/index.d.ts +1 -0
- package/dist/components/calendar-view/utils/enums.d.ts +29 -0
- package/dist/components/calendar-view/utils/index.d.ts +23 -0
- package/dist/components/calendar-view/utils/types.d.ts +12 -0
- package/dist/components/calendar-view/utils/utils/calendar.d.ts +22 -0
- package/dist/components/calendar-view/utils/utils/date.d.ts +15 -0
- package/dist/components/calendar-view/utils/utils/format.d.ts +18 -0
- package/dist/components/calendar-view/utils/utils/time.d.ts +35 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/notification-badge/NotificationBadge.vue.d.ts +5 -0
- package/dist/components/notification-badge/index.d.ts +1 -0
- package/dist/components/select-list/components/option-group/OptionGroup.vue.d.ts +1 -0
- package/dist/components/select-list/components/select-list-option/SelectListOption.vue.d.ts +1 -0
- package/dist/components/select-list/types.d.ts +1 -0
- package/dist/components/types.d.ts +1 -1
- package/dist/index.mjs +7056 -6465
- package/dist/utils/capitalizeFirstLetter.d.ts +1 -0
- package/package.json +4 -3
- package/src/components/application-wrapper/ApplicationWrapper.vue +8 -0
- package/src/components/application-wrapper/index.ts +1 -0
- package/src/components/aside-section-label/AsideSectionLabel.vue +16 -0
- package/src/components/aside-section-label/index.ts +1 -0
- package/src/components/button/Button.vue +246 -0
- package/src/components/button/NotificationBadge.vue +15 -0
- package/src/components/button/components/button-label/ButtonLabel.vue +9 -0
- package/src/components/button/components/button-label/index.ts +1 -0
- package/src/components/button/components/index.ts +3 -0
- package/src/components/button/components/left-group/LeftGroup.vue +5 -0
- package/src/components/button/components/left-group/index.ts +1 -0
- package/src/components/button/components/notification-badge/NotificationBadge.vue +17 -0
- package/src/components/button/components/notification-badge/index.ts +1 -0
- package/src/components/button/index.ts +1 -0
- package/src/components/button-group/ButtonGroup.vue +97 -0
- package/src/components/button-group/index.ts +1 -0
- package/src/components/calendar-view/CalendarView.vue +106 -0
- package/src/components/calendar-view/components/DateButton.vue +23 -0
- package/src/components/calendar-view/components/DecadeView.vue +50 -0
- package/src/components/calendar-view/components/MonthView.vue +72 -0
- package/src/components/calendar-view/components/NavButton.vue +16 -0
- package/src/components/calendar-view/components/YearView.vue +52 -0
- package/src/components/calendar-view/composables/useCalendar.ts +138 -0
- package/src/components/calendar-view/index.ts +1 -0
- package/src/components/calendar-view/utils/enums.ts +31 -0
- package/src/components/calendar-view/utils/index.ts +240 -0
- package/src/components/calendar-view/utils/types.ts +13 -0
- package/src/components/calendar-view/utils/utils/calendar.ts +70 -0
- package/src/components/calendar-view/utils/utils/date.ts +130 -0
- package/src/components/calendar-view/utils/utils/format.ts +61 -0
- package/src/components/calendar-view/utils/utils/time.ts +70 -0
- package/src/components/checkbox/Checkbox.vue +51 -0
- package/src/components/checkbox/CircleIndicator.vue +26 -0
- package/src/components/checkbox/DefaultIndicator.vue +19 -0
- package/src/components/checkbox/index.ts +1 -0
- package/src/components/collapse/Collapse.vue +114 -0
- package/src/components/collapse/index.ts +1 -0
- package/src/components/confirm-cancel/ConfirmCancel.vue +66 -0
- package/src/components/confirm-cancel/index.ts +1 -0
- package/src/components/confirm-cancel/types.ts +18 -0
- package/src/components/content-slider/ContentSlider.vue +79 -0
- package/src/components/content-slider/index.ts +1 -0
- package/src/components/data-point/DataPoint.vue +5 -0
- package/src/components/data-point/index.ts +1 -0
- package/src/components/delete-button/DeleteButton.vue +19 -0
- package/src/components/delete-button/index.ts +1 -0
- package/src/components/dialog/Dialog.vue +70 -0
- package/src/components/dialog/index.ts +1 -0
- package/src/components/fade-in-up/FadeInUp.vue +17 -0
- package/src/components/fade-in-up/index.ts +1 -0
- package/src/components/filter-chip/FilterChip.vue +28 -0
- package/src/components/filter-chip/index.ts +1 -0
- package/src/components/first-paint/FirstPaint.vue +21 -0
- package/src/components/first-paint/index.ts +1 -0
- package/src/components/first-paint/style.scss +23 -0
- package/src/components/flexbox/Flexbox.vue +51 -0
- package/src/components/flexbox/index.ts +1 -0
- package/src/components/horizontal-layout/Aside.vue +114 -0
- package/src/components/horizontal-layout/HorizontalLayout.vue +118 -0
- package/src/components/horizontal-layout/index.ts +2 -0
- package/src/components/icon/Icon.vue +1263 -0
- package/src/components/icon/index.ts +1 -0
- package/src/components/icon/utils/combine-svgs.cjs +55 -0
- package/src/components/icon/utils/combined-svgs.txt +1150 -0
- package/src/components/icon/utils/svgs/admin.svg +16 -0
- package/src/components/icon/utils/svgs/arrow-deviate.svg +3 -0
- package/src/components/icon/utils/svgs/arrow-down-plus.svg +4 -0
- package/src/components/icon/utils/svgs/arrow-down.svg +3 -0
- package/src/components/icon/utils/svgs/arrow-from.svg +3 -0
- package/src/components/icon/utils/svgs/arrow-left.svg +3 -0
- package/src/components/icon/utils/svgs/arrow-move.svg +15 -0
- package/src/components/icon/utils/svgs/arrow-right.svg +3 -0
- package/src/components/icon/utils/svgs/arrow-sub.svg +3 -0
- package/src/components/icon/utils/svgs/arrow-trend.svg +15 -0
- package/src/components/icon/utils/svgs/arrow-up-plus.svg +4 -0
- package/src/components/icon/utils/svgs/arrow-up.svg +3 -0
- package/src/components/icon/utils/svgs/authority.svg +5 -0
- package/src/components/icon/utils/svgs/beams.svg +5 -0
- package/src/components/icon/utils/svgs/bell.svg +15 -0
- package/src/components/icon/utils/svgs/bold.svg +3 -0
- package/src/components/icon/utils/svgs/box.svg +5 -0
- package/src/components/icon/utils/svgs/building.svg +15 -0
- package/src/components/icon/utils/svgs/bullet-list.svg +8 -0
- package/src/components/icon/utils/svgs/calendar.svg +21 -0
- package/src/components/icon/utils/svgs/camera.svg +5 -0
- package/src/components/icon/utils/svgs/categories.svg +3 -0
- package/src/components/icon/utils/svgs/check-circled.svg +16 -0
- package/src/components/icon/utils/svgs/check-outline.svg +15 -0
- package/src/components/icon/utils/svgs/check.svg +3 -0
- package/src/components/icon/utils/svgs/chevron-down.svg +3 -0
- package/src/components/icon/utils/svgs/chevron-left-double.svg +4 -0
- package/src/components/icon/utils/svgs/chevron-left.svg +3 -0
- package/src/components/icon/utils/svgs/chevron-right-double.svg +4 -0
- package/src/components/icon/utils/svgs/chevron-right.svg +3 -0
- package/src/components/icon/utils/svgs/chevron-up.svg +3 -0
- package/src/components/icon/utils/svgs/clock.svg +4 -0
- package/src/components/icon/utils/svgs/close-outline.svg +3 -0
- package/src/components/icon/utils/svgs/close.svg +3 -0
- package/src/components/icon/utils/svgs/columns.svg +3 -0
- package/src/components/icon/utils/svgs/conclusion.svg +17 -0
- package/src/components/icon/utils/svgs/copy.svg +16 -0
- package/src/components/icon/utils/svgs/crosshair.svg +15 -0
- package/src/components/icon/utils/svgs/dash.svg +3 -0
- package/src/components/icon/utils/svgs/dashboard.svg +3 -0
- package/src/components/icon/utils/svgs/delete.svg +4 -0
- package/src/components/icon/utils/svgs/delta.svg +3 -0
- package/src/components/icon/utils/svgs/download.svg +3 -0
- package/src/components/icon/utils/svgs/drag.svg +8 -0
- package/src/components/icon/utils/svgs/drilldown.svg +8 -0
- package/src/components/icon/utils/svgs/edit.svg +16 -0
- package/src/components/icon/utils/svgs/envelope.svg +3 -0
- package/src/components/icon/utils/svgs/error.svg +3 -0
- package/src/components/icon/utils/svgs/export-document.svg +16 -0
- package/src/components/icon/utils/svgs/filter.svg +6 -0
- package/src/components/icon/utils/svgs/filters.svg +4 -0
- package/src/components/icon/utils/svgs/flag.svg +3 -0
- package/src/components/icon/utils/svgs/folder.svg +15 -0
- package/src/components/icon/utils/svgs/frequency.svg +3 -0
- package/src/components/icon/utils/svgs/fullscreen-off.svg +3 -0
- package/src/components/icon/utils/svgs/fullscreen-on.svg +3 -0
- package/src/components/icon/utils/svgs/graduate.svg +3 -0
- package/src/components/icon/utils/svgs/hamburger.svg +5 -0
- package/src/components/icon/utils/svgs/handshake.svg +15 -0
- package/src/components/icon/utils/svgs/heading-1.svg +4 -0
- package/src/components/icon/utils/svgs/heading-2.svg +4 -0
- package/src/components/icon/utils/svgs/heading.svg +3 -0
- package/src/components/icon/utils/svgs/home.svg +3 -0
- package/src/components/icon/utils/svgs/id-card.svg +6 -0
- package/src/components/icon/utils/svgs/id.svg +4 -0
- package/src/components/icon/utils/svgs/indent-left.svg +7 -0
- package/src/components/icon/utils/svgs/indent-right.svg +7 -0
- package/src/components/icon/utils/svgs/information.svg +17 -0
- package/src/components/icon/utils/svgs/italics.svg +3 -0
- package/src/components/icon/utils/svgs/itenary.svg +11 -0
- package/src/components/icon/utils/svgs/keyboard.svg +11 -0
- package/src/components/icon/utils/svgs/lightning.svg +15 -0
- package/src/components/icon/utils/svgs/link.svg +4 -0
- package/src/components/icon/utils/svgs/list-collapse.svg +6 -0
- package/src/components/icon/utils/svgs/list-expand.svg +6 -0
- package/src/components/icon/utils/svgs/location.svg +4 -0
- package/src/components/icon/utils/svgs/lock-locked.svg +4 -0
- package/src/components/icon/utils/svgs/lock-unlocked.svg +4 -0
- package/src/components/icon/utils/svgs/magnifying-glass.svg +15 -0
- package/src/components/icon/utils/svgs/map.svg +3 -0
- package/src/components/icon/utils/svgs/megaphone.svg +3 -0
- package/src/components/icon/utils/svgs/message.svg +15 -0
- package/src/components/icon/utils/svgs/microscope.svg +3 -0
- package/src/components/icon/utils/svgs/moon.svg +3 -0
- package/src/components/icon/utils/svgs/new-document.svg +4 -0
- package/src/components/icon/utils/svgs/news.svg +15 -0
- package/src/components/icon/utils/svgs/numbered-list.svg +7 -0
- package/src/components/icon/utils/svgs/open-link.svg +16 -0
- package/src/components/icon/utils/svgs/options.svg +5 -0
- package/src/components/icon/utils/svgs/page.svg +7 -0
- package/src/components/icon/utils/svgs/paper-plane.svg +15 -0
- package/src/components/icon/utils/svgs/paper.svg +3 -0
- package/src/components/icon/utils/svgs/pen-and-paper.svg +4 -0
- package/src/components/icon/utils/svgs/phase.svg +15 -0
- package/src/components/icon/utils/svgs/photo.svg +4 -0
- package/src/components/icon/utils/svgs/pie-chart.svg +3 -0
- package/src/components/icon/utils/svgs/plus.svg +3 -0
- package/src/components/icon/utils/svgs/point-left.svg +3 -0
- package/src/components/icon/utils/svgs/point-up.svg +3 -0
- package/src/components/icon/utils/svgs/popup.svg +16 -0
- package/src/components/icon/utils/svgs/question.svg +17 -0
- package/src/components/icon/utils/svgs/radio-tower.svg +3 -0
- package/src/components/icon/utils/svgs/recycle.svg +3 -0
- package/src/components/icon/utils/svgs/redo.svg +3 -0
- package/src/components/icon/utils/svgs/refresh.svg +3 -0
- package/src/components/icon/utils/svgs/route.svg +3 -0
- package/src/components/icon/utils/svgs/rows.svg +3 -0
- package/src/components/icon/utils/svgs/scope.svg +7 -0
- package/src/components/icon/utils/svgs/settings.svg +16 -0
- package/src/components/icon/utils/svgs/share.svg +11 -0
- package/src/components/icon/utils/svgs/sign-in.svg +4 -0
- package/src/components/icon/utils/svgs/sign-up.svg +3 -0
- package/src/components/icon/utils/svgs/sort-down.svg +20 -0
- package/src/components/icon/utils/svgs/sort-up.svg +20 -0
- package/src/components/icon/utils/svgs/sort.svg +7 -0
- package/src/components/icon/utils/svgs/square-solid.svg +3 -0
- package/src/components/icon/utils/svgs/star-solid.svg +15 -0
- package/src/components/icon/utils/svgs/star.svg +15 -0
- package/src/components/icon/utils/svgs/stop-watch.svg +5 -0
- package/src/components/icon/utils/svgs/structure.svg +3 -0
- package/src/components/icon/utils/svgs/sun.svg +23 -0
- package/src/components/icon/utils/svgs/table.svg +3 -0
- package/src/components/icon/utils/svgs/tag.svg +15 -0
- package/src/components/icon/utils/svgs/team.svg +15 -0
- package/src/components/icon/utils/svgs/telescope.svg +15 -0
- package/src/components/icon/utils/svgs/trash.svg +6 -0
- package/src/components/icon/utils/svgs/triangle-angle.svg +3 -0
- package/src/components/icon/utils/svgs/triangle-side.svg +3 -0
- package/src/components/icon/utils/svgs/underline.svg +4 -0
- package/src/components/icon/utils/svgs/undo.svg +3 -0
- package/src/components/icon/utils/svgs/user.svg +16 -0
- package/src/components/icon/utils/svgs/venn.svg +3 -0
- package/src/components/icon/utils/svgs/video.svg +3 -0
- package/src/components/icon/utils/svgs/visibility-off-alt.svg +19 -0
- package/src/components/icon/utils/svgs/visibility-off.svg +3 -0
- package/src/components/icon/utils/svgs/visibility-on.svg +16 -0
- package/src/components/icon/utils/svgs/warning.svg +5 -0
- package/src/components/index.ts +45 -0
- package/src/components/input/Input.vue +118 -0
- package/src/components/input/index.ts +1 -0
- package/src/components/input-number/InputNumber.vue +112 -0
- package/src/components/input-number/StepButton.vue +23 -0
- package/src/components/input-number/index.ts +1 -0
- package/src/components/load-spinner/LoadSpinner.vue +13 -0
- package/src/components/load-spinner/index.ts +1 -0
- package/src/components/modal/Modal.vue +111 -0
- package/src/components/modal/index.ts +1 -0
- package/src/components/nav-item/NavItem.vue +62 -0
- package/src/components/nav-item/index.ts +1 -0
- package/src/components/notification/Notification.vue +53 -0
- package/src/components/notification/index.ts +1 -0
- package/src/components/notification-badge/NotificationBadge.vue +7 -0
- package/src/components/notification-badge/index.ts +1 -0
- package/src/components/pagination/Pagination.vue +65 -0
- package/src/components/pagination/index.ts +1 -0
- package/src/components/pop-confirm/PopConfirm.vue +90 -0
- package/src/components/pop-confirm/index.ts +1 -0
- package/src/components/pop-select/FooterButton.vue +5 -0
- package/src/components/pop-select/PopSelect.vue +346 -0
- package/src/components/pop-select/ResultFilters.vue +28 -0
- package/src/components/pop-select/enums.ts +7 -0
- package/src/components/pop-select/index.ts +2 -0
- package/src/components/pop-select/option.vue +51 -0
- package/src/components/popper/Popper.vue +239 -0
- package/src/components/popper/PopperContent.vue +5 -0
- package/src/components/popper/index.ts +2 -0
- package/src/components/popper/middleware.ts +19 -0
- package/src/components/screen-overlay/ScreenOverlay.vue +53 -0
- package/src/components/screen-overlay/index.ts +1 -0
- package/src/components/scrollbar/Bar.vue +106 -0
- package/src/components/scrollbar/ScrollBottomLoader.vue +25 -0
- package/src/components/scrollbar/Scrollbar.vue +219 -0
- package/src/components/scrollbar/enums.ts +23 -0
- package/src/components/scrollbar/index.ts +3 -0
- package/src/components/scrollbar/style.scss +77 -0
- package/src/components/scrollbar/types.ts +32 -0
- package/src/components/select-list/SelectList.vue +476 -0
- package/src/components/select-list/components/SelectListFilterChip.vue +34 -0
- package/src/components/select-list/components/index.ts +3 -0
- package/src/components/select-list/components/option-group/OptionGroup.vue +20 -0
- package/src/components/select-list/components/option-group/index.ts +1 -0
- package/src/components/select-list/components/select-list-option/SelectListOption.vue +83 -0
- package/src/components/select-list/components/select-list-option/index.ts +1 -0
- package/src/components/select-list/components/status-cards/error-card/ErrorCard.vue +17 -0
- package/src/components/select-list/components/status-cards/error-card/index.ts +1 -0
- package/src/components/select-list/components/status-cards/idle-card/IdleCard.vue +11 -0
- package/src/components/select-list/components/status-cards/idle-card/index.ts +1 -0
- package/src/components/select-list/components/status-cards/index.ts +4 -0
- package/src/components/select-list/components/status-cards/loading-card/LoadingCard.vue +10 -0
- package/src/components/select-list/components/status-cards/loading-card/index.ts +1 -0
- package/src/components/select-list/components/status-cards/no-match-card/NoMatchCard.vue +15 -0
- package/src/components/select-list/components/status-cards/no-match-card/index.ts +1 -0
- package/src/components/select-list/components/status-cards/status-card/StatusCard.vue +25 -0
- package/src/components/select-list/components/status-cards/status-card/index.ts +1 -0
- package/src/components/select-list/index.ts +5 -0
- package/src/components/select-list/types.ts +49 -0
- package/src/components/side-over/SideOver.vue +87 -0
- package/src/components/side-over/index.ts +1 -0
- package/src/components/status-select/StatusIndicator.vue +78 -0
- package/src/components/status-select/StatusSelect.vue +62 -0
- package/src/components/status-select/index.ts +1 -0
- package/src/components/switch/Switch.vue +52 -0
- package/src/components/switch/index.ts +1 -0
- package/src/components/tab/Tab.vue +65 -0
- package/src/components/tab/index.ts +1 -0
- package/src/components/tag/Tag.vue +34 -0
- package/src/components/tag/index.ts +1 -0
- package/src/components/text-editor/TextEditor.vue +399 -0
- package/src/components/text-editor/components/Dialog.vue +11 -0
- package/src/components/text-editor/components/FormattingButton.vue +46 -0
- package/src/components/text-editor/components/InsertLinkDialog.vue +81 -0
- package/src/components/text-editor/components/InsertTextDialog.vue +36 -0
- package/src/components/text-editor/components/index.ts +3 -0
- package/src/components/text-editor/index.ts +1 -0
- package/src/components/text-highlight/TextHighlight.vue +113 -0
- package/src/components/text-highlight/index.ts +1 -0
- package/src/components/text-viewer/TextViewer.vue +5 -0
- package/src/components/text-viewer/index.ts +1 -0
- package/src/components/toggle-button/ToggleButton.vue +105 -0
- package/src/components/toggle-button/index.ts +1 -0
- package/src/components/tooltip/Tooltip.vue +54 -0
- package/src/components/tooltip/index.ts +1 -0
- package/src/components/types.ts +232 -0
- package/src/components/vertical-layout/RunningSection.vue +54 -0
- package/src/components/vertical-layout/VerticalLayout.vue +37 -0
- package/src/components/vertical-layout/index.ts +3 -0
- package/src/components/vertical-layout/types.ts +2 -0
- package/src/components/window-frame/WindowFrame.vue +20 -0
- package/src/components/window-frame/index.ts +1 -0
- package/src/composables/index.ts +5 -0
- package/src/composables/useClickOutside.ts +48 -0
- package/src/composables/useEscapeKey.ts +12 -0
- package/src/composables/useMounted.ts +7 -0
- package/src/composables/useNextFrame.ts +10 -0
- package/src/composables/useTrapFocus.ts +61 -0
- package/src/index.ts +5 -0
- package/src/main.css +140 -0
- package/src/utils/array.ts +11 -0
- package/src/utils/capitalizeFirstLetter.ts +4 -0
- package/src/utils/clamp.ts +9 -0
- package/src/utils/debounce.ts +8 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/scrollIntoView.ts +25 -0
- package/src/utils/scrollbarWidth.ts +27 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function capitalizeFirstLetter(str: string): string;
|
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.28",
|
|
5
5
|
"private": false,
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"types": "dist/index.d.ts",
|
|
21
21
|
"files": [
|
|
22
22
|
"dist",
|
|
23
|
-
"dist/bui.css"
|
|
23
|
+
"dist/bui.css",
|
|
24
|
+
"src"
|
|
24
25
|
],
|
|
25
26
|
"peerDependencies": {
|
|
26
27
|
"tailwindcss": "^4.1.1",
|
|
@@ -67,6 +68,6 @@
|
|
|
67
68
|
"build": "vite build",
|
|
68
69
|
"typecheck": "vue-tsc -p tsconfig.app.json --noEmit",
|
|
69
70
|
"watch": "vite build --watch",
|
|
70
|
-
"release:publish": "pnpm publish --access public --otp=
|
|
71
|
+
"release:publish": "pnpm publish --access public --otp=753040 --no-git-checks"
|
|
71
72
|
}
|
|
72
73
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
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>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BApplicationWrapper } from "./ApplicationWrapper.vue";
|
|
@@ -0,0 +1,16 @@
|
|
|
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>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BAsideSectionLabel } from "./AsideSectionLabel.vue";
|
|
@@ -0,0 +1,246 @@
|
|
|
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 { ButtonLabel, LeftGroup, NotificationBadge } from "./components";
|
|
7
|
+
|
|
8
|
+
const props = withDefaults(
|
|
9
|
+
defineProps<{
|
|
10
|
+
variant?: ButtonVariant;
|
|
11
|
+
classes?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
fullwidth?: boolean;
|
|
14
|
+
spaceBetween?: boolean;
|
|
15
|
+
href?: string;
|
|
16
|
+
icon?: TIcon;
|
|
17
|
+
iconAfter?: TIcon;
|
|
18
|
+
label?: string;
|
|
19
|
+
linkTarget?: string;
|
|
20
|
+
loading?: boolean;
|
|
21
|
+
mailto?: string;
|
|
22
|
+
notification?: boolean;
|
|
23
|
+
rounded?: boolean;
|
|
24
|
+
routerLinkTo?: string | { path: string } | { name: string };
|
|
25
|
+
small?: boolean;
|
|
26
|
+
focus?: boolean;
|
|
27
|
+
stopPropagation?: boolean;
|
|
28
|
+
tooltip?: string;
|
|
29
|
+
tooltipDelay?: number;
|
|
30
|
+
tooltipPlacement?: Placement;
|
|
31
|
+
}>(),
|
|
32
|
+
{
|
|
33
|
+
variant: "fill",
|
|
34
|
+
disabled: false,
|
|
35
|
+
focus: false,
|
|
36
|
+
fullwidth: false,
|
|
37
|
+
spaceBetween: false,
|
|
38
|
+
loading: false,
|
|
39
|
+
notification: false,
|
|
40
|
+
rounded: false,
|
|
41
|
+
small: false,
|
|
42
|
+
stopPropagation: false,
|
|
43
|
+
tooltipDelay: 500,
|
|
44
|
+
tooltipPlacement: "top",
|
|
45
|
+
},
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const emit = defineEmits(["click", "blur"]);
|
|
49
|
+
|
|
50
|
+
const component = ref<string>(props.routerLinkTo ? "router-link" : "button");
|
|
51
|
+
const buttonRef = ref<HTMLButtonElement>();
|
|
52
|
+
|
|
53
|
+
const loadSpinnerClass = computed(() => {
|
|
54
|
+
const classes = ["w-4 h-4"];
|
|
55
|
+
if (props.variant === "fill" || props.variant === "destructive") {
|
|
56
|
+
classes.push("text-light");
|
|
57
|
+
}
|
|
58
|
+
else if (props.variant === "outline" || props.variant === "text") {
|
|
59
|
+
classes.push("text-blue-500");
|
|
60
|
+
}
|
|
61
|
+
else if (props.variant === "outlineSubtle" || props.variant === "textSubtle") {
|
|
62
|
+
classes.push("text-slate-700 dark:text-slate-200");
|
|
63
|
+
}
|
|
64
|
+
return classes.join(" ");
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const buttonClasses = computed(() => {
|
|
68
|
+
const result = ["z-0 relative inline-flex items-center gap-1 leading-none border focus:z-10 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-black dark:focus-visible:outline-white"];
|
|
69
|
+
|
|
70
|
+
// Set padding x.
|
|
71
|
+
// Add extra if rounded and there is a label
|
|
72
|
+
props.rounded && props.label
|
|
73
|
+
? result.push(props.small ? "px-2" : "px-3")
|
|
74
|
+
: result.push((props.loading || props.icon) && !props.label ? "px-0" : "px-2");
|
|
75
|
+
|
|
76
|
+
props.small ? result.push("h-6 text-xs") : result.push("h-8 text-sm");
|
|
77
|
+
|
|
78
|
+
if (props.icon && !props.label) {
|
|
79
|
+
props.small ? result.push("w-6") : result.push("w-8");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
props.disabled ? result.push("opacity-75 cursor-not-allowed") : result.push("cursor-pointer");
|
|
83
|
+
props.fullwidth && result.push("w-full");
|
|
84
|
+
result.push(props.spaceBetween ? "justify-between" : "justify-center");
|
|
85
|
+
|
|
86
|
+
if (props.rounded) result.push("rounded-full");
|
|
87
|
+
else result.push(props.small ? "rounded" : "rounded-lg");
|
|
88
|
+
|
|
89
|
+
switch (props.variant) {
|
|
90
|
+
case "fill":
|
|
91
|
+
result.push(
|
|
92
|
+
...(props.focus
|
|
93
|
+
? ["text-white bg-blue-700 border-blue-700 dark:bg-blue-500 dark:border-blue-500"]
|
|
94
|
+
: [
|
|
95
|
+
"bg-blue-500 hover:bg-blue-600 focus-visible:bg-blue-600 active:bg-blue-700",
|
|
96
|
+
"border border-blue-500 hover:border-blue-600 focus-visible:border-blue-600 active:border-blue-700",
|
|
97
|
+
"text-white focus-visible:outline",
|
|
98
|
+
"dark:bg-blue-700 dark:hover:bg-blue-600 focus-visible:bg-blue-600 dark:active:bg-blue-500",
|
|
99
|
+
"border dark:border-blue-700 dark:hover:border-blue-600 focus-visible:border-blue-600 dark:active:border-blue-500",
|
|
100
|
+
]
|
|
101
|
+
),
|
|
102
|
+
);
|
|
103
|
+
break;
|
|
104
|
+
case "outline":
|
|
105
|
+
result.push(
|
|
106
|
+
...(props.focus
|
|
107
|
+
? ["bg-blue-200 border-blue-700 text-blue-700 dark:bg-blue-700 dark:border-blue-600 dark:text-white"]
|
|
108
|
+
: [
|
|
109
|
+
"hover:bg-blue-100 focus-visible:bg-blue-100 active:bg-blue-200",
|
|
110
|
+
"border border-blue-500 hover:border-blue-600 focus-visible:border-blue-600 active:border-blue-700",
|
|
111
|
+
"text-blue-500 hover:text-blue-600 focus-visible:text-blue-600 active:text-blue-700",
|
|
112
|
+
"dark:hover:bg-blue-900 dark:focus-visible:bg-blue-900 dark:active:bg-blue-700",
|
|
113
|
+
"dark:border-blue-500 dark:hover:border-blue-500 dark:focus-visible:border-blue-500 dark:active:border-blue-600",
|
|
114
|
+
"dark:text-blue-500 dark:hover:text-blue-100 focus-visible:text-blue-100 dark:active:text-white",
|
|
115
|
+
]
|
|
116
|
+
),
|
|
117
|
+
);
|
|
118
|
+
break;
|
|
119
|
+
case "outlineSubtle":
|
|
120
|
+
result.push(
|
|
121
|
+
...(props.focus
|
|
122
|
+
? ["bg-slate-200 border-stone-500 text-slate-900 dark:bg-neutral-600 dark:border-stone-500 dark:text-white"]
|
|
123
|
+
: [
|
|
124
|
+
"hover:bg-slate-100 focus-visible:bg-slate-100 active:bg-slate-200",
|
|
125
|
+
"border border-stone-300 hover:border-stone-400 focus-visible:border-stone-400 active:border-stone-500",
|
|
126
|
+
"text-slate-700 hover:text-slate-800 focus-visible:text-slate-800 active:text-slate-900",
|
|
127
|
+
"dark:hover:bg-neutral-700 focus-visible:bg-neutral-700 dark:active:bg-neutral-600",
|
|
128
|
+
"dark:border-stone-700 dark:hover:border-stone-600 focus-visible:border-stone-600 dark:active:border-stone-500",
|
|
129
|
+
"dark:text-slate-200 dark:hover:text-slate-100 focus-visible:text-slate-100 dark:active:text-white",
|
|
130
|
+
]
|
|
131
|
+
),
|
|
132
|
+
);
|
|
133
|
+
break;
|
|
134
|
+
case "text":
|
|
135
|
+
result.push(
|
|
136
|
+
...(props.focus
|
|
137
|
+
? ["border-none bg-blue-200 text-blue-700 dark:bg-blue-700 dark:text-white"]
|
|
138
|
+
: [
|
|
139
|
+
"hover:bg-blue-100 focus-visible:bg-blue-100 active:bg-blue-200",
|
|
140
|
+
"border-none",
|
|
141
|
+
"text-blue-500 hover:text-blue-600 focus-visible:text-blue-600 active:text-blue-700",
|
|
142
|
+
"dark:hover:bg-blue-900 dark:focus-visible:bg-blue-900 dark:active:bg-blue-700",
|
|
143
|
+
"dark:text-blue-500 dark:hover:text-blue-100 focus-visible:text-blue-100 dark:active:text-white",
|
|
144
|
+
]
|
|
145
|
+
),
|
|
146
|
+
);
|
|
147
|
+
break;
|
|
148
|
+
case "textSubtle":
|
|
149
|
+
result.push(
|
|
150
|
+
...(props.focus
|
|
151
|
+
? ["border-none bg-slate-200 text-slate-900 dark:bg-neutral-600 dark:text-white"]
|
|
152
|
+
: [
|
|
153
|
+
"hover:bg-slate-100 focus-visible:bg-slate-100 active:bg-slate-200",
|
|
154
|
+
"border-none",
|
|
155
|
+
"text-slate-700 hover:text-slate-800 focus-visible:text-slate-800 active:text-slate-900",
|
|
156
|
+
"dark:hover:bg-neutral-700 focus-visible:bg-neutral-700 dark:active:bg-neutral-600",
|
|
157
|
+
"dark:text-slate-200 dark:hover:text-slate-100 focus-visible:text-slate-100 dark:active:text-white",
|
|
158
|
+
]
|
|
159
|
+
),
|
|
160
|
+
);
|
|
161
|
+
break;
|
|
162
|
+
case "destructive":
|
|
163
|
+
result.push(
|
|
164
|
+
...(props.focus
|
|
165
|
+
? ["bg-red-800 border-red-800 text-white"]
|
|
166
|
+
: [
|
|
167
|
+
"bg-red-600 hover:bg-red-700 focus-visible:bg-red-700 active:bg-red-800",
|
|
168
|
+
"border border-red-600 hover:border-red-700 focus-visible:border-red-700 active:border-red-800",
|
|
169
|
+
"text-white",
|
|
170
|
+
]
|
|
171
|
+
),
|
|
172
|
+
);
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (props.classes) result.push(props.classes);
|
|
177
|
+
|
|
178
|
+
return result.filter(i => i).join(" ");
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
const disabledStyle = computed(() => {
|
|
182
|
+
if (props.disabled) {
|
|
183
|
+
return props.variant === "fill" || props.variant === "destructive" ? { filter: "grayscale(50%)" } : { background: "hsl(0 0% 90%)" };
|
|
184
|
+
}
|
|
185
|
+
return {};
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
const onClick = (event: MouseEvent) => {
|
|
189
|
+
props.stopPropagation && event.stopPropagation();
|
|
190
|
+
|
|
191
|
+
if (!props.disabled && !props.loading) {
|
|
192
|
+
if (props.href) {
|
|
193
|
+
window.open(props.href, "_blank");
|
|
194
|
+
}
|
|
195
|
+
if (props.mailto) window.open(`mailto:${props.mailto}`);
|
|
196
|
+
emit("click");
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const focus = () => buttonRef.value!.focus();
|
|
201
|
+
|
|
202
|
+
defineExpose({ focus });
|
|
203
|
+
</script>
|
|
204
|
+
|
|
205
|
+
<template>
|
|
206
|
+
<BTooltip v-if="tooltip" hover :text="tooltip" :delay="tooltipDelay" :placement="tooltipPlacement" :trigger-full-width="fullwidth">
|
|
207
|
+
<component
|
|
208
|
+
:is="component"
|
|
209
|
+
ref="buttonRef"
|
|
210
|
+
:to="routerLinkTo"
|
|
211
|
+
:class="buttonClasses"
|
|
212
|
+
:disabled="disabled || loading"
|
|
213
|
+
:style="disabledStyle"
|
|
214
|
+
@click="onClick"
|
|
215
|
+
@blur="emit('blur')"
|
|
216
|
+
>
|
|
217
|
+
<LeftGroup>
|
|
218
|
+
<BLoadSpinner v-if="loading" :class="loadSpinnerClass" />
|
|
219
|
+
<BIcon v-else-if="icon" :name="icon" />
|
|
220
|
+
<ButtonLabel v-if="label" :label="label" />
|
|
221
|
+
</LeftGroup>
|
|
222
|
+
<BIcon v-if="iconAfter" :name="iconAfter" class="opacity-75" />
|
|
223
|
+
<NotificationBadge v-if="notification" :inside="variant === 'text' || variant === 'textSubtle'" />
|
|
224
|
+
</component>
|
|
225
|
+
</BTooltip>
|
|
226
|
+
<component
|
|
227
|
+
:is="component"
|
|
228
|
+
v-else
|
|
229
|
+
ref="buttonRef"
|
|
230
|
+
:to="routerLinkTo"
|
|
231
|
+
:target="props.linkTarget"
|
|
232
|
+
:class="buttonClasses"
|
|
233
|
+
:disabled="disabled || loading"
|
|
234
|
+
:style="disabledStyle"
|
|
235
|
+
@click="onClick"
|
|
236
|
+
@blur="emit('blur')"
|
|
237
|
+
>
|
|
238
|
+
<LeftGroup>
|
|
239
|
+
<BLoadSpinner v-if="loading" :class="loadSpinnerClass" />
|
|
240
|
+
<BIcon v-else-if="icon" :name="icon" />
|
|
241
|
+
<ButtonLabel v-if="label" :label="label" />
|
|
242
|
+
</LeftGroup>
|
|
243
|
+
<BIcon v-if="iconAfter" :name="iconAfter" />
|
|
244
|
+
<NotificationBadge v-if="notification" :inside="variant === 'text' || variant === 'textSubtle'" />
|
|
245
|
+
</component>
|
|
246
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
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 dark:border-[var(--color-bg-primary)]" />
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ButtonLabel } from "./ButtonLabel.vue";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as LeftGroup } from "./LeftGroup.vue";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { BNotificationBadge } from "../../../notification-badge";
|
|
3
|
+
|
|
4
|
+
defineProps<{ inside?: boolean }>();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<div
|
|
9
|
+
class="absolute"
|
|
10
|
+
:style="{
|
|
11
|
+
top: inside ? '0.15em' : '-0.3em',
|
|
12
|
+
right: inside ? '0.15em' : '-0.3em',
|
|
13
|
+
}"
|
|
14
|
+
>
|
|
15
|
+
<BNotificationBadge />
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NotificationBadge } from "./NotificationBadge.vue";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BButton } from "./Button.vue";
|
|
@@ -0,0 +1,97 @@
|
|
|
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>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BButtonGroup } from "./ButtonGroup.vue";
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { CalendarGridItem } from "./utils/types.ts";
|
|
3
|
+
import type { ReadableDateFormat } from "./utils/utils/format.ts";
|
|
4
|
+
import { ref, toRef, watch } from "vue";
|
|
5
|
+
import { loopRange } from "../../utils/array.ts";
|
|
6
|
+
import { BButton } from "../button/index.ts";
|
|
7
|
+
import DecadeView from "./components/DecadeView.vue";
|
|
8
|
+
import MonthView from "./components/MonthView.vue";
|
|
9
|
+
import YearView from "./components/YearView.vue";
|
|
10
|
+
import { useCalendar, ViewType } from "./composables/useCalendar.ts";
|
|
11
|
+
|
|
12
|
+
import { Weekday } from "./utils/enums.ts";
|
|
13
|
+
import { formatDate } from "./utils/utils/format.ts";
|
|
14
|
+
|
|
15
|
+
const props = withDefaults(defineProps<{
|
|
16
|
+
value?: string | Date | null;
|
|
17
|
+
clearable?: boolean;
|
|
18
|
+
type?: "date" | "datetime";
|
|
19
|
+
format?: ReadableDateFormat;
|
|
20
|
+
weekStart?: number;
|
|
21
|
+
disabledDates?: ((date: Date) => boolean)[];
|
|
22
|
+
}>(), {
|
|
23
|
+
value: null,
|
|
24
|
+
clearable: false,
|
|
25
|
+
type: "date",
|
|
26
|
+
format: "readableDateWithDay",
|
|
27
|
+
weekStart: 1,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const emit = defineEmits(["change"]);
|
|
31
|
+
|
|
32
|
+
const {
|
|
33
|
+
viewData,
|
|
34
|
+
viewType,
|
|
35
|
+
viewMonth,
|
|
36
|
+
viewYear,
|
|
37
|
+
changeView,
|
|
38
|
+
moveViewDate,
|
|
39
|
+
setSelectedDate,
|
|
40
|
+
setViewDateAndChangeView,
|
|
41
|
+
} = useCalendar(props.value, { weekStart: props.weekStart, disabledDates: props.disabledDates });
|
|
42
|
+
|
|
43
|
+
watch(() => props.value, newValue => setSelectedDate(newValue));
|
|
44
|
+
|
|
45
|
+
const currentMonth = toRef(viewMonth);
|
|
46
|
+
|
|
47
|
+
// 'rotate' the weekdays to start on the weekStart day
|
|
48
|
+
const weekdays = ref(Object.values(Weekday).map((_day, index) => {
|
|
49
|
+
return Object.values(Weekday)[
|
|
50
|
+
loopRange(index + props.weekStart, Object.values(Weekday).length)
|
|
51
|
+
];
|
|
52
|
+
}));
|
|
53
|
+
|
|
54
|
+
const onDateClick = (date: CalendarGridItem | null) => {
|
|
55
|
+
if (!date) {
|
|
56
|
+
emit("change", null);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (date.disabled) return;
|
|
61
|
+
if (!date.date) return;
|
|
62
|
+
|
|
63
|
+
emit("change", formatDate[props.format](date.date));
|
|
64
|
+
};
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<template>
|
|
68
|
+
<section class="flex flex-col">
|
|
69
|
+
<main class="p-4">
|
|
70
|
+
<MonthView
|
|
71
|
+
v-if="viewType === ViewType.MONTH"
|
|
72
|
+
:current-month="currentMonth"
|
|
73
|
+
:current-year="viewYear"
|
|
74
|
+
:view-data="viewData"
|
|
75
|
+
:weekdays="weekdays"
|
|
76
|
+
@move="moveViewDate"
|
|
77
|
+
@change-view="changeView"
|
|
78
|
+
@select="onDateClick"
|
|
79
|
+
/>
|
|
80
|
+
<YearView
|
|
81
|
+
v-if="viewType === ViewType.YEAR"
|
|
82
|
+
:current-year="viewYear"
|
|
83
|
+
:view-data="viewData"
|
|
84
|
+
@move="moveViewDate"
|
|
85
|
+
@select="setViewDateAndChangeView"
|
|
86
|
+
/>
|
|
87
|
+
<DecadeView
|
|
88
|
+
v-if="viewType === ViewType.DECADE"
|
|
89
|
+
:view-data="viewData"
|
|
90
|
+
@move="moveViewDate"
|
|
91
|
+
@select="setViewDateAndChangeView"
|
|
92
|
+
/>
|
|
93
|
+
</main>
|
|
94
|
+
<footer v-if="clearable" class="flex items-center justify-end p-4 border-t border-default">
|
|
95
|
+
<BButton
|
|
96
|
+
square
|
|
97
|
+
size="tiny"
|
|
98
|
+
variant="outlineSubtle"
|
|
99
|
+
leading-icon="trash"
|
|
100
|
+
label="Clear"
|
|
101
|
+
:disabled="!value"
|
|
102
|
+
@click="onDateClick(null)"
|
|
103
|
+
/>
|
|
104
|
+
</footer>
|
|
105
|
+
</section>
|
|
106
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { CalendarGridItem } from "../utils/types";
|
|
3
|
+
|
|
4
|
+
defineProps<{ date: CalendarGridItem }>();
|
|
5
|
+
const emit = defineEmits(["click"]);
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<button
|
|
10
|
+
class="flex items-center justify-center w-8 h-8 rounded text-sm font-medium cursor-pointer"
|
|
11
|
+
:class="{
|
|
12
|
+
'bg-secondary text-tertiary rounded-none cursor-not-allowed': date.disabled,
|
|
13
|
+
'text-muted hover:text-secondary hover:bg-tertiary': date.inactive,
|
|
14
|
+
'bg-action text-white': date.selected,
|
|
15
|
+
'text-primary hover:bg-tertiary active:bg-tertiary focus:outline-none focus:shadow-outline focus:bg-blue-200': !date.selected && !date.disabled && !date.inactive,
|
|
16
|
+
'text-xs text-primary': date.current && !date.selected,
|
|
17
|
+
'text-xs font-bold text-white': date.current && date.selected,
|
|
18
|
+
}"
|
|
19
|
+
@click.stop="emit('click', date)"
|
|
20
|
+
>
|
|
21
|
+
{{ date.label }}
|
|
22
|
+
</button>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { CalendarGridItem } from "../utils/types";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
import { BButton } from "../../button";
|
|
5
|
+
import { TimeUnit } from "../utils/utils/time";
|
|
6
|
+
|
|
7
|
+
const props = defineProps<{ viewData: CalendarGridItem[] }>();
|
|
8
|
+
const emit = defineEmits(["move", "select"]);
|
|
9
|
+
const label = computed(() => {
|
|
10
|
+
return `${props.viewData[0].label} - ${props.viewData[props.viewData.length - 1].label}`;
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div>
|
|
16
|
+
<nav class="w-56 grid grid-cols-7">
|
|
17
|
+
<BButton
|
|
18
|
+
icon="chevron-left"
|
|
19
|
+
variant="textSubtle"
|
|
20
|
+
@click="emit('move', { amount: -10, unit: TimeUnit.YEAR })"
|
|
21
|
+
/>
|
|
22
|
+
<div class="col-span-5 flex items-center justify-center text-sm">
|
|
23
|
+
{{ label }}
|
|
24
|
+
</div>
|
|
25
|
+
<BButton
|
|
26
|
+
icon="chevron-right"
|
|
27
|
+
variant="textSubtle"
|
|
28
|
+
@click="emit('move', { amount: 10, unit: TimeUnit.YEAR })"
|
|
29
|
+
/>
|
|
30
|
+
</nav>
|
|
31
|
+
<main class="w-56 grid grid-cols-2 py-8">
|
|
32
|
+
<BButton
|
|
33
|
+
v-for="year in viewData"
|
|
34
|
+
:key="year.label"
|
|
35
|
+
:variant="year.selected ? 'fill' : (year.current ? 'text' : 'textSubtle')"
|
|
36
|
+
:label="year.label.toString()"
|
|
37
|
+
@mouseup.stop="
|
|
38
|
+
emit(
|
|
39
|
+
'select',
|
|
40
|
+
{
|
|
41
|
+
value: year.label,
|
|
42
|
+
unit: TimeUnit.YEAR,
|
|
43
|
+
view: TimeUnit.MONTH,
|
|
44
|
+
},
|
|
45
|
+
)
|
|
46
|
+
"
|
|
47
|
+
/>
|
|
48
|
+
</main>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|