renusify 2.5.2 → 3.0.0
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/components/app/index.vue +74 -22
- package/components/app/toast/index.vue +76 -71
- package/components/app/toast/toast.vue +62 -44
- package/components/avatar/index.vue +208 -84
- package/components/button/buttonConfirm.vue +53 -26
- package/components/button/buttonGroup.js +0 -2
- package/components/button/buttonGroup.vue +310 -62
- package/components/button/index.vue +584 -100
- package/components/calendar/index.js +0 -2
- package/components/calendar/index.vue +326 -262
- package/components/calendar/month.vue +64 -55
- package/components/calendar/year.vue +30 -25
- package/components/card/index.vue +139 -59
- package/components/codeEditor/highlightCss.vue +38 -39
- package/components/codeEditor/highlightHtml.vue +64 -64
- package/components/codeEditor/highlightJs.vue +37 -38
- package/components/codeEditor/index.vue +129 -79
- package/components/codeEditor/run.vue +225 -39
- package/components/codeEditor/useCodeFormatter.js +150 -0
- package/components/confirm/index.vue +139 -80
- package/components/container/col.vue +5 -4
- package/components/container/divider.vue +28 -19
- package/components/container/index.vue +34 -15
- package/components/container/row.vue +26 -9
- package/components/container/spacer.vue +2 -4
- package/components/container/style.scss +3 -0
- package/components/content/index.vue +49 -32
- package/components/cropper/index.vue +401 -244
- package/components/float/index.vue +542 -415
- package/components/form/addressInput/index.vue +184 -109
- package/components/form/camInput/index.vue +370 -244
- package/components/form/checkInput/index.vue +138 -71
- package/components/form/checkboxInput/index.vue +87 -47
- package/components/form/colorInput/Alpha.vue +81 -83
- package/components/form/colorInput/Hue.vue +91 -68
- package/components/form/colorInput/Preview.vue +43 -47
- package/components/form/colorInput/Saturation.vue +101 -86
- package/components/form/colorInput/index.vue +71 -39
- package/components/form/colorInput/picker.vue +111 -106
- package/components/form/colorInput/useColor.js +153 -0
- package/components/form/dateInput/index.vue +691 -356
- package/components/form/dateInput/month.vue +63 -54
- package/components/form/dateInput/year.vue +35 -25
- package/components/form/fileInput/index.js +0 -1
- package/components/form/fileInput/index.vue +263 -106
- package/components/form/fileInput/single.vue +323 -164
- package/components/form/groupInput/index.vue +199 -101
- package/components/form/index.vue +189 -83
- package/components/form/input/index.vue +416 -377
- package/components/form/jsonInput/JsonView.vue +54 -56
- package/components/form/jsonInput/index.vue +247 -165
- package/components/form/maskInput/index.vue +252 -132
- package/components/form/numberInput/index.js +0 -1
- package/components/form/numberInput/index.vue +226 -117
- package/components/form/passwordInput/index.js +2 -1
- package/components/form/passwordInput/index.vue +269 -102
- package/components/form/radioInput/index.vue +143 -72
- package/components/form/rangeInput/index.vue +280 -167
- package/components/form/ratingInput/index.vue +57 -57
- package/components/form/selectInput/index.js +1 -3
- package/components/form/selectInput/index.vue +584 -296
- package/components/form/switchInput/index.vue +73 -59
- package/components/form/telInput/index.js +0 -1
- package/components/form/telInput/index.vue +238 -135
- package/components/form/textArea/index.vue +72 -35
- package/components/form/textEditor/index.vue +739 -0
- package/components/form/{text-editor → textEditor}/style.scss +8 -16
- package/components/form/textInput/index.vue +54 -32
- package/components/form/timeInput/index.vue +82 -55
- package/components/form/timeInput/range.vue +115 -94
- package/components/form/timeInput/timepicker.vue +382 -449
- package/components/form/uniqueInput/index.vue +105 -48
- package/components/form/unitInput/index.vue +139 -84
- package/components/formCreator/index.js +0 -1
- package/components/formCreator/index.vue +314 -148
- package/components/highlight/index.vue +41 -25
- package/components/highlight/style.scss +2 -2
- package/components/highlight/{mixin.js → useHighlight.js} +181 -160
- package/components/icon/index.vue +79 -33
- package/components/img/index.vue +249 -147
- package/components/img/preview.vue +180 -198
- package/components/img/svgImg.vue +42 -39
- package/components/index.js +5 -20
- package/components/infinite/index.js +1 -2
- package/components/infinite/index.vue +248 -66
- package/components/map/index.vue +428 -261
- package/components/map/route.vue +794 -487
- package/components/map/select.vue +118 -58
- package/components/menu/index.vue +201 -91
- package/components/meta/meta.js +26 -3
- package/components/modal/index.vue +382 -156
- package/components/notify/index.vue +204 -86
- package/components/notify/notification.vue +38 -55
- package/components/progress/circle.vue +189 -70
- package/components/progress/line.vue +266 -46
- package/components/searchBox/index.js +1 -3
- package/components/searchBox/index.vue +194 -101
- package/components/skeleton/index.vue +45 -20
- package/components/slider/index.vue +318 -156
- package/components/swiper/index.vue +254 -106
- package/components/table/crud/footer.vue +77 -53
- package/components/table/crud/header.vue +71 -72
- package/components/table/crud/index.vue +629 -399
- package/components/table/index.vue +721 -278
- package/components/timeAgo/index.vue +145 -96
- package/components/tour/index.vue +338 -235
- package/components/tree/index.vue +235 -89
- package/components/tree/tree-element.vue +106 -106
- package/directive/animate/index.js +77 -0
- package/directive/clickOutSide/index.js +98 -0
- package/directive/drag/index.js +153 -0
- package/directive/index.js +11 -13
- package/directive/intersect/index.js +263 -0
- package/directive/mask/index.js +67 -0
- package/directive/parallax/index.js +78 -0
- package/directive/ripple/index.js +14 -0
- package/directive/scroll/index.js +244 -0
- package/directive/sortable/index.js +274 -0
- package/directive/title/index.js +75 -0
- package/directive/touch/index.js +268 -0
- package/index.js +10 -8
- package/package.json +5 -2
- package/plugins/validation/Validate.js +88 -79
- package/scripts/generate-docs.mjs +226 -0
- package/scripts/menu.mjs +240 -0
- package/scripts/parser.mjs +1086 -0
- package/style/_index.scss +7 -0
- package/style/app.scss +13 -65
- package/style/colors.scss +5 -22
- package/style/functions/index.scss +8 -0
- package/style/mixins/index.scss +17 -5
- package/style/variables/base.scss +154 -175
- package/style/variables/color.scss +0 -12
- package/style/variables/utilities.scss +0 -180
- package/tools/helper.js +0 -8
- package/tools/icons.js +6 -1
- package/tools/root.js +71 -0
- package/components/app/style.scss +0 -41
- package/components/app/toast/style.scss +0 -20
- package/components/avatar/style.scss +0 -32
- package/components/bar/bottomNav.js +0 -1
- package/components/bar/bottomNav.vue +0 -28
- package/components/bar/bottomNavigationCircle.js +0 -2
- package/components/bar/bottomNavigationCircle.vue +0 -99
- package/components/bar/scss/bottomNav.scss +0 -67
- package/components/bar/scss/toolbar.scss +0 -174
- package/components/bar/toolbar/index.js +0 -8
- package/components/bar/toolbar/index.vue +0 -35
- package/components/bar/toolbar/laptop.vue +0 -33
- package/components/bar/toolbar/menuChilds.vue +0 -41
- package/components/bar/toolbar/menuLaptop.vue +0 -41
- package/components/bar/toolbar/menuMob.vue +0 -39
- package/components/bar/toolbar/mixin.js +0 -43
- package/components/bar/toolbar/mobile.vue +0 -34
- package/components/breadcrumb/bredcrumbItem.vue +0 -39
- package/components/breadcrumb/index.js +0 -3
- package/components/breadcrumb/index.vue +0 -71
- package/components/breadcrumb/style.scss +0 -51
- package/components/button/style.scss +0 -411
- package/components/card/style.scss +0 -86
- package/components/chart/chart.js +0 -1
- package/components/chart/chart.vue +0 -69
- package/components/chart/worldMap.js +0 -2
- package/components/chart/worldMap.vue +0 -1112
- package/components/chat/MessageList.vue +0 -163
- package/components/chat/chatInput.vue +0 -150
- package/components/chat/chatMsg.vue +0 -276
- package/components/chat/index.js +0 -11
- package/components/chat/index.vue +0 -113
- package/components/chip/index.js +0 -3
- package/components/chip/index.vue +0 -77
- package/components/chip/style.scss +0 -199
- package/components/codeEditor/mixin.js +0 -145
- package/components/countdown/index.js +0 -1
- package/components/countdown/index.vue +0 -105
- package/components/form/colorInput/mixin.js +0 -132
- package/components/form/fileInput/file.js +0 -148
- package/components/form/telInput/assets/flags.png +0 -0
- package/components/form/telInput/assets/flags@2x.png +0 -0
- package/components/form/text-editor/index.vue +0 -705
- package/components/icon/style.scss +0 -17
- package/components/infinite/div.js +0 -6
- package/components/infinite/div.vue +0 -193
- package/components/infinite/page.js +0 -3
- package/components/infinite/page.vue +0 -105
- package/components/list/index.js +0 -3
- package/components/list/index.vue +0 -122
- package/components/list/style.scss +0 -66
- package/components/message/index.js +0 -4
- package/components/message/index.vue +0 -40
- package/components/modal/style.scss +0 -146
- package/components/nestable/NestableItem.vue +0 -307
- package/components/nestable/editable.js +0 -44
- package/components/nestable/index.js +0 -1
- package/components/nestable/index.vue +0 -226
- package/components/nestable/methods.js +0 -416
- package/components/progress/style.scss +0 -229
- package/components/table/style.scss +0 -338
- package/components/tabs/index.js +0 -3
- package/components/tabs/index.vue +0 -151
- package/components/timeline/index.js +0 -6
- package/components/timeline/index.vue +0 -76
- package/directive/resize/index.js +0 -30
- package/directive/skeleton/index.js +0 -27
- package/directive/skeleton/style.scss +0 -37
- package/plugins/request/Request.js +0 -68
- package/style/animation.scss +0 -94
- package/style/style.scss +0 -8
- package/tools/rootable.js +0 -75
- /package/components/form/{text-editor → textEditor}/index.js +0 -0
- /package/components/form/{text-editor → textEditor}/preview.js +0 -0
- /package/components/form/{text-editor → textEditor}/preview.vue +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<r-btn v-bind="$attrs" @click.prevent.stop="show=true">
|
|
3
|
+
<!-- Default slot for button content
|
|
4
|
+
@example Click Me-->
|
|
3
5
|
<slot></slot>
|
|
4
6
|
</r-btn>
|
|
5
7
|
<r-confirm
|
|
@@ -14,31 +16,56 @@
|
|
|
14
16
|
/>
|
|
15
17
|
</template>
|
|
16
18
|
|
|
17
|
-
<script>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
</script>
|
|
19
|
+
<script setup>
|
|
20
|
+
import {ref} from 'vue'
|
|
21
|
+
|
|
22
|
+
const props = defineProps({
|
|
23
|
+
/**
|
|
24
|
+
* Makes the dialog persistent (cannot be closed by clicking outside)
|
|
25
|
+
* @type {Boolean}
|
|
26
|
+
*/
|
|
27
|
+
hard: Boolean,
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Title text displayed in the dialog header
|
|
31
|
+
* @type {String}
|
|
32
|
+
*/
|
|
33
|
+
title: String,
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Body text displayed in the dialog content area
|
|
37
|
+
* @type {String}
|
|
38
|
+
*/
|
|
39
|
+
body: String,
|
|
41
40
|
|
|
42
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Text for the cancel button
|
|
43
|
+
* @type {String}
|
|
44
|
+
*/
|
|
45
|
+
cancelText: String,
|
|
43
46
|
|
|
44
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Text for the confirm/accept button
|
|
49
|
+
* @type {String}
|
|
50
|
+
*/
|
|
51
|
+
confirmText: String,
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const emit = defineEmits([
|
|
55
|
+
/**
|
|
56
|
+
* Emitted when the confirm button is clicked
|
|
57
|
+
* @param {Boolean} confirmed - Always true indicating confirmation
|
|
58
|
+
*/
|
|
59
|
+
'click'
|
|
60
|
+
])
|
|
61
|
+
|
|
62
|
+
const show = ref(false)
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Handles confirmation action
|
|
66
|
+
*/
|
|
67
|
+
const accept = () => {
|
|
68
|
+
emit('click', true)
|
|
69
|
+
show.value = false
|
|
70
|
+
}
|
|
71
|
+
</script>
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export * as rBtnGroup from './buttonGroup.vue'
|
|
2
2
|
export * as l_btn from './index.js'
|
|
3
3
|
export * as l_icon from '../icon/index.js'
|
|
4
|
-
export * as l_card from '../card/index.js'
|
|
5
|
-
export * as l_list from '../list/index.js'
|
|
6
4
|
|
|
7
5
|
export * as d_clickOutside from '../../directive/clickOutSide/index.js'
|
|
@@ -1,72 +1,320 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<transition name="slide-down">
|
|
13
|
-
<r-card v-if="open" class="button-group-select text-center"
|
|
14
|
-
>
|
|
15
|
-
<r-list :items="items[selected]['items']"
|
|
16
|
-
@update:modelValue="listInput"
|
|
17
|
-
checked>
|
|
18
|
-
<template v-slot="{item}">
|
|
19
|
-
<slot name="list" :item="item">
|
|
20
|
-
<div class="list-title">{{item['name']}}</div>
|
|
21
|
-
</slot>
|
|
22
|
-
</template>
|
|
23
|
-
</r-list>
|
|
24
|
-
|
|
25
|
-
</r-card>
|
|
26
|
-
|
|
27
|
-
</transition>
|
|
2
|
+
<div v-click-outside="handleClose" :class="classes">
|
|
3
|
+
<div class="btn-container">
|
|
4
|
+
<r-btn v-for="(item,k) in items"
|
|
5
|
+
:key="k" :class="{'button-group-active':k===modelValue}" :icon="icon" text @click.prevent="emitValue(k)">
|
|
6
|
+
<!-- Default slot for custom button content. Provides item scoped prop -->
|
|
7
|
+
<slot :item="item">
|
|
8
|
+
<r-icon v-if="icon" exact v-html="isSelect?item['icon']:item"></r-icon>
|
|
9
|
+
<span v-else>{{ item }}</span>
|
|
10
|
+
</slot>
|
|
11
|
+
</r-btn>
|
|
28
12
|
</div>
|
|
13
|
+
<transition name="slide-down">
|
|
14
|
+
<div v-if="open" class="button-group-select text-center"
|
|
15
|
+
>
|
|
16
|
+
<div v-for="(item,i) in items[selected]['items']" :key="i"
|
|
17
|
+
class="list-item"
|
|
18
|
+
@click="listInput(item)">
|
|
19
|
+
<!-- Named slot for custom list item content. Provides item scoped prop -->
|
|
20
|
+
<slot :item="item" name="list">
|
|
21
|
+
<div class="list-title">{{ item['name'] }}</div>
|
|
22
|
+
</slot>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
</transition>
|
|
27
|
+
</div>
|
|
29
28
|
</template>
|
|
30
29
|
|
|
31
|
-
<script>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
30
|
+
<script setup>
|
|
31
|
+
import {ref, computed, inject} from 'vue'
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @example // button group usage
|
|
35
|
+
* <template>
|
|
36
|
+
* <r-btn-group
|
|
37
|
+
* :items="buttonItems"
|
|
38
|
+
* :icon="showIcon"
|
|
39
|
+
* :is-select="isSelect"
|
|
40
|
+
* :exact="exact"
|
|
41
|
+
* v-model="selectedValue"
|
|
42
|
+
* @open="log('open', $event)"
|
|
43
|
+
* @update:model-Value="log('update:modelValue', $event)"
|
|
44
|
+
* ></r-btn-group>
|
|
45
|
+
* </template>
|
|
46
|
+
*
|
|
47
|
+
* <script>
|
|
48
|
+
* import { ref } from 'vue'
|
|
49
|
+
*
|
|
50
|
+
* // Button items with descriptive SVG icons
|
|
51
|
+
* const buttonItems = ref({
|
|
52
|
+
* insertOrderedList: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M7 13v-2h14v2H7m0 6v-2h14v2H7M7 7V5h14v2H7M3 8V5H2V4h2v4H3m-1 9v-1h3v4H2v-1h2v-.5H3v-1h1V17H2m2.25-7a.75.75 0 0 1 .75.75c0 .2-.08.39-.21.52L3.12 13H5v1H2v-.92L4 11H2v-1h2.25Z"/></svg>`,
|
|
53
|
+
* insertUnorderedList: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M3 4h4v4H3V4m6 1v2h12V5H9m-6 5h4v4H3v-4m6 1v2h12v-2H9m-6 5h4v4H3v-4m6 1v2h12v-2H9"/></svg>`,
|
|
54
|
+
* subscript: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M16 7.41L11.41 12L16 16.59L14.59 18L10 13.41L5.41 18L4 16.59L8.59 12L4 7.41L5.41 6L10 10.59L14.59 6L16 7.41m5.85 13.62h-4.88v-1l.89-.8c.76-.65 1.32-1.19 1.7-1.63c.37-.44.56-.85.57-1.24a.898.898 0 0 0-.27-.7c-.18-.16-.47-.28-.86-.28c-.31 0-.58.06-.84.18l-.66.38l-.45-1.17c.27-.21.59-.39.98-.53s.82-.24 1.29-.24c.78.04 1.38.25 1.78.66c.4.41.62.93.62 1.57c-.01.56-.19 1.08-.54 1.55c-.34.47-.76.92-1.27 1.36l-.64.52v.02h2.58v1.35Z"/></svg>`,
|
|
55
|
+
* superscript: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M16 7.41L11.41 12L16 16.59L14.59 18L10 13.41L5.41 18L4 16.59L8.59 12L4 7.41L5.41 6L10 10.59L14.59 6L16 7.41M21.85 9h-4.88V8l.89-.82c.76-.64 1.32-1.18 1.7-1.63c.37-.44.56-.85.57-1.23a.884.884 0 0 0-.27-.7c-.18-.19-.47-.28-.86-.29c-.31.01-.58.07-.84.17l-.66.39l-.45-1.17c.27-.22.59-.39.98-.53S18.85 2 19.32 2c.78 0 1.38.2 1.78.61c.4.39.62.93.62 1.57c-.01.56-.19 1.08-.54 1.55c-.34.48-.76.93-1.27 1.36l-.64.52v.02h2.58V9Z"/></svg>`,
|
|
56
|
+
* bold: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M13.5 15.5H10v-3h3.5A1.5 1.5 0 0 1 15 14a1.5 1.5 0 0 1-1.5 1.5m-3.5-9h3A1.5 1.5 0 0 1 14.5 8A1.5 1.5 0 0 1 13 9.5h-3m5.6 1.29c.97-.68 1.65-1.79 1.65-2.79c0-2.26-1.75-4-4-4H7v14h7.04c2.1 0 3.71-1.7 3.71-3.79c0-1.52-.86-2.82-2.15-3.42Z"/></svg>`,
|
|
57
|
+
* italic: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4h-8Z"/></svg>`,
|
|
58
|
+
* strikeThrough: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M3 14h18v-2H3m2-8v3h5v3h4V7h5V4m-9 15h4v-3h-4v3Z"/></svg>`,
|
|
59
|
+
* underline: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M5 21h14v-2H5v2m7-4a6 6 0 0 0 6-6V3h-2.5v8a3.5 3.5 0 0 1-3.5 3.5A3.5 3.5 0 0 1 8.5 11V3H6v8a6 6 0 0 0 6 6Z"/></svg>`,
|
|
60
|
+
* insertHorizontalRule: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M0 24h24v-4H0v4Z"/></svg>`,
|
|
61
|
+
* removeFormat: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M6 5v.18L8.82 8h2.4l-.72 1.68l2.1 2.1L14.21 8H20V5H6M3.27 5L2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21L18 19.73L3.55 5.27L3.27 5Z"/></svg>`
|
|
62
|
+
* })
|
|
63
|
+
*
|
|
64
|
+
* const showIcon = ref(true) // Whether to show icons
|
|
65
|
+
* const isSelect = ref(false) // Selection mode
|
|
66
|
+
* const exact = ref(false) // Exact matching
|
|
67
|
+
* const selectedValue = ref(null) // Currently selected value
|
|
68
|
+
*
|
|
69
|
+
* const log = (name, event) => {
|
|
70
|
+
* console.log(name, event)
|
|
71
|
+
* }
|
|
72
|
+
* <//script>
|
|
73
|
+
*
|
|
74
|
+
* */
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
const props = defineProps({
|
|
78
|
+
/**
|
|
79
|
+
* Array or object of items to display in the button group.
|
|
80
|
+
* When isSelect is true, items should be objects with 'icon' and 'items' properties.
|
|
81
|
+
* @type {Array|Object}
|
|
82
|
+
*/
|
|
83
|
+
items: [Array, Object],
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Whether to display items as icons
|
|
87
|
+
* @type {Boolean}
|
|
88
|
+
* @default true
|
|
89
|
+
*/
|
|
90
|
+
icon: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
default: true
|
|
44
93
|
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Enables select mode with dropdown list
|
|
97
|
+
* @type {Boolean}
|
|
98
|
+
*/
|
|
99
|
+
isSelect: Boolean,
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Exact matching for selection
|
|
103
|
+
* @type {Boolean}
|
|
104
|
+
*/
|
|
105
|
+
exact: Boolean,
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Currently selected item index
|
|
109
|
+
* @type {Number|String}
|
|
110
|
+
*/
|
|
111
|
+
modelValue: [Number, String]
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
const emit = defineEmits([
|
|
115
|
+
/**
|
|
116
|
+
* Emitted when the dropdown is opened or closed
|
|
117
|
+
* @param {Boolean} isOpen - Whether dropdown is open
|
|
118
|
+
*/
|
|
119
|
+
'open',
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Emitted when selection changes
|
|
123
|
+
* @param {Number|String|Object} value - Selected value
|
|
124
|
+
* @param {Number} value.menu - Menu index (for select mode)
|
|
125
|
+
* @param {Object} value.item - Selected item (for select mode)
|
|
126
|
+
*/
|
|
127
|
+
'update:modelValue'
|
|
128
|
+
])
|
|
129
|
+
|
|
130
|
+
const $r = inject('renusify').$r
|
|
131
|
+
|
|
132
|
+
// Reactive data
|
|
133
|
+
const open = ref(false)
|
|
134
|
+
const selected = ref(null)
|
|
135
|
+
|
|
136
|
+
// Computed
|
|
137
|
+
const classes = computed(() => [
|
|
138
|
+
`${$r.prefix}button-group`,
|
|
139
|
+
{'button-group-open': open.value},
|
|
140
|
+
'd-flex',
|
|
141
|
+
'h-center'
|
|
142
|
+
])
|
|
143
|
+
|
|
144
|
+
// Methods
|
|
145
|
+
/**
|
|
146
|
+
* Closes the dropdown when clicking outside
|
|
147
|
+
*/
|
|
148
|
+
const handleClose = () => {
|
|
149
|
+
open.value = false
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Handles button click to select item or open dropdown
|
|
154
|
+
* @param {Number} k - Item index
|
|
155
|
+
*/
|
|
156
|
+
const emitValue = (k) => {
|
|
157
|
+
if (props.isSelect) {
|
|
158
|
+
selected.value = k
|
|
159
|
+
emit('open', true)
|
|
160
|
+
open.value = true
|
|
161
|
+
} else {
|
|
162
|
+
emit('update:modelValue', k)
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Handles list item selection in dropdown
|
|
168
|
+
* @param {Object} e - Selected item
|
|
169
|
+
*/
|
|
170
|
+
const listInput = (e) => {
|
|
171
|
+
emit('open', false)
|
|
172
|
+
emit('update:modelValue', {menu: selected.value, item: e})
|
|
173
|
+
open.value = false
|
|
174
|
+
}
|
|
175
|
+
</script>
|
|
176
|
+
<style lang="scss">
|
|
177
|
+
@use "sass:map";
|
|
178
|
+
@use "../../style" as *;
|
|
179
|
+
|
|
180
|
+
.#{$prefix}button-group {
|
|
181
|
+
position: relative;
|
|
182
|
+
color: var(--color-on-sheet);
|
|
183
|
+
background-color: var(--color-sheet-container);
|
|
184
|
+
border-radius: map.get($borders, 'lg');
|
|
185
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
|
186
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
187
|
+
|
|
188
|
+
.list-item {
|
|
189
|
+
padding: 12px;
|
|
190
|
+
border-bottom: 1px solid var(--color-sheet);
|
|
191
|
+
cursor: pointer;
|
|
192
|
+
text-align: center;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
&.button-group-open {
|
|
196
|
+
z-index: map.get($z-index, 'default');
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
&:hover {
|
|
200
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
|
|
201
|
+
transform: translateY(-1px);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.btn-container {
|
|
205
|
+
display: inline-flex;
|
|
206
|
+
flex: 0 0 auto;
|
|
207
|
+
align-items: center;
|
|
208
|
+
border-radius: map.get($borders, 'lg');
|
|
209
|
+
justify-content: center;
|
|
210
|
+
max-width: 100%;
|
|
211
|
+
outline: 0;
|
|
212
|
+
position: relative;
|
|
213
|
+
text-decoration: none;
|
|
214
|
+
transition-property: box-shadow, transform, opacity;
|
|
215
|
+
user-select: none;
|
|
216
|
+
vertical-align: middle;
|
|
217
|
+
white-space: nowrap;
|
|
218
|
+
overflow: hidden;
|
|
219
|
+
|
|
220
|
+
.#{$prefix}btn {
|
|
221
|
+
border-radius: 0;
|
|
222
|
+
position: relative;
|
|
223
|
+
transition: all 0.2s ease;
|
|
224
|
+
padding: 10px 16px;
|
|
225
|
+
font-weight: 500;
|
|
226
|
+
letter-spacing: 0.025em;
|
|
227
|
+
|
|
228
|
+
&:not(:last-child) {
|
|
229
|
+
margin-right: 1px;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
&.button-group-active {
|
|
234
|
+
font-weight: 600;
|
|
235
|
+
|
|
236
|
+
&::after {
|
|
237
|
+
content: '';
|
|
238
|
+
position: absolute;
|
|
239
|
+
bottom: 0;
|
|
240
|
+
left: 0;
|
|
241
|
+
right: 0;
|
|
242
|
+
height: 2px;
|
|
243
|
+
background-color: var(--color-one);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
&.btn-pressed {
|
|
248
|
+
transform: scale(0.96);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
&:focus-visible {
|
|
252
|
+
outline: 2px solid var(--color-one);
|
|
253
|
+
outline-offset: -2px;
|
|
254
|
+
z-index: 2;
|
|
255
|
+
}
|
|
50
256
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
257
|
+
|
|
258
|
+
@include rtl() {
|
|
259
|
+
.#{$prefix}btn:not(:first-child):not(:last-child) {
|
|
260
|
+
border-left: 1px solid var(--color-border-low);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.#{$prefix}btn:first-child {
|
|
264
|
+
border-left: 1px solid var(--color-border-low);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
@include ltr() {
|
|
268
|
+
.#{$prefix}btn:not(:first-child):not(:last-child) {
|
|
269
|
+
border-right: 1px solid var(--color-border-low);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.#{$prefix}btn:first-child {
|
|
273
|
+
border-right: 1px solid var(--color-border-low);
|
|
63
274
|
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.button-group-select {
|
|
279
|
+
position: absolute;
|
|
280
|
+
top: calc(100% + 8px);
|
|
281
|
+
width: 100%;
|
|
282
|
+
z-index: map.get($z-index, 'default');
|
|
283
|
+
max-height: 320px;
|
|
284
|
+
overflow: auto;
|
|
285
|
+
border-radius: map.get($borders, 'lg');
|
|
286
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
|
|
287
|
+
backdrop-filter: blur(10px);
|
|
288
|
+
background-color: transparent;
|
|
289
|
+
color: var(--color-on-sheet);
|
|
290
|
+
animation: fadeIn 0.3s ease-out;
|
|
291
|
+
|
|
292
|
+
.list-item {
|
|
293
|
+
padding: 12px 16px;
|
|
294
|
+
transition: all 0.2s ease;
|
|
295
|
+
|
|
296
|
+
&:last-child {
|
|
297
|
+
border-bottom: none;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.list-title {
|
|
302
|
+
font-weight: 500;
|
|
303
|
+
font-size: 0.95rem;
|
|
304
|
+
margin-bottom: 4px;
|
|
305
|
+
color: var(--color-on-sheet);
|
|
69
306
|
}
|
|
70
307
|
}
|
|
71
308
|
}
|
|
72
|
-
|
|
309
|
+
|
|
310
|
+
@keyframes fadeIn {
|
|
311
|
+
from {
|
|
312
|
+
opacity: 0;
|
|
313
|
+
transform: translateY(-10px);
|
|
314
|
+
}
|
|
315
|
+
to {
|
|
316
|
+
opacity: 1;
|
|
317
|
+
transform: translateY(0);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
</style>
|