pimelon-ui 0.1.21 → 0.1.24

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.md CHANGED
@@ -0,0 +1,8 @@
1
+ The MIT License (MIT)
2
+ Copyright © 2022 Alphamonak Solutions
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+
6
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
+
8
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pimelon-ui",
3
- "version": "0.1.21",
3
+ "version": "0.1.24",
4
4
  "description": "A set of components and utilities for rapid UI development",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -67,7 +67,7 @@
67
67
  "autoprefixer": "^10.4.13",
68
68
  "cross-fetch": "^3.1.5",
69
69
  "histoire": "^0.16.2",
70
- "husky": "^8.0.3",
70
+ "husky": "^9.0.10",
71
71
  "lint-staged": ">=10",
72
72
  "postcss": "^8.4.21",
73
73
  "prettier": "2.7.1",
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <div class="flex justify-between gap-2">
3
+ <slot>
4
+ <slot name="left">
5
+ <TabButtons
6
+ v-model="pageLengthCount"
7
+ :buttons="pageLengthOptions.map((o) => ({ label: o, value: o }))"
8
+ />
9
+ </slot>
10
+ <slot name="right">
11
+ <div class="flex items-center">
12
+ <Button
13
+ v-if="showLoadMore"
14
+ label="Load More"
15
+ @click="emit('loadMore')"
16
+ />
17
+ <div v-if="showLoadMore" class="mx-3 h-[80%] border-l" />
18
+ <div class="flex items-center gap-1 text-base text-gray-600">
19
+ <div>{{ options.rowCount || '0' }}</div>
20
+ <div>of</div>
21
+ <div>{{ options.totalCount || '0' }}</div>
22
+ </div>
23
+ </div>
24
+ </slot>
25
+ </slot>
26
+ </div>
27
+ </template>
28
+ <script setup>
29
+ import TabButtons from '../TabButtons.vue'
30
+ import { ref, computed } from 'vue'
31
+
32
+ const props = defineProps({
33
+ modelValue: {
34
+ type: Number,
35
+ default: 20,
36
+ },
37
+ options: {
38
+ type: Object,
39
+ default: () => ({
40
+ rowCount: 0,
41
+ totalCount: 0,
42
+ pageLengthOptions: [20, 50, 100],
43
+ }),
44
+ },
45
+ })
46
+
47
+ const emit = defineEmits(['update:modelValue', 'loadMore'])
48
+
49
+ const pageLengthCount = computed({
50
+ get: () => props.modelValue,
51
+ set: (value) => emit('update:modelValue', value),
52
+ })
53
+
54
+ const pageLengthOptions = ref(props.options.pageLengthOptions || [20, 50, 100])
55
+
56
+ const showLoadMore = computed(() => {
57
+ return (
58
+ props.options.rowCount &&
59
+ props.options.totalCount &&
60
+ props.options.rowCount < props.options.totalCount
61
+ )
62
+ })
63
+ </script>
@@ -2,11 +2,12 @@
2
2
  <component
3
3
  :is="list.options.getRowRoute ? 'router-link' : 'div'"
4
4
  class="flex cursor-pointer flex-col transition-all duration-300 ease-in-out"
5
- v-bind="
6
- list.options.getRowRoute
7
- ? { to: list.options.getRowRoute(row) }
8
- : { onClick: () => list.options.onRowClick(row) }
9
- "
5
+ v-bind="{
6
+ to: list.options.getRowRoute ? list.options.getRowRoute(row) : undefined,
7
+ onClick: list.options.onRowClick
8
+ ? () => list.options.onRowClick(row)
9
+ : undefined,
10
+ }"
10
11
  >
11
12
  <component
12
13
  :is="list.options.getRowRoute ? 'template' : 'button'"
@@ -6,18 +6,21 @@
6
6
  :selectedIndex="changedIndex"
7
7
  @change="(idx) => (changedIndex = idx)"
8
8
  >
9
- <TabList class="relative flex items-center gap-6 border-b pl-5">
9
+ <TabList
10
+ class="relative flex items-center gap-6 overflow-x-auto border-b pl-5"
11
+ :class="tablistClass"
12
+ >
10
13
  <Tab
11
14
  ref="tabRef"
12
15
  as="template"
13
16
  v-for="(tab, i) in tabs"
14
17
  :key="i"
15
18
  v-slot="{ selected }"
16
- class="focus:outline-none focus:transition-none focus-visible:rounded focus-visible:ring-2 focus-visible:ring-gray-400"
19
+ class="focus:outline-none focus:transition-none"
17
20
  >
18
21
  <slot name="tab" v-bind="{ tab, selected }">
19
22
  <button
20
- class="-mb-px flex items-center gap-2 border-b border-transparent py-2.5 text-base text-gray-600 duration-300 ease-in-out hover:border-gray-400 hover:text-gray-900"
23
+ class="flex items-center gap-2 border-b border-transparent py-2.5 text-base text-gray-600 duration-300 ease-in-out hover:border-gray-400 hover:text-gray-900"
21
24
  :class="{ 'text-gray-900': selected }"
22
25
  >
23
26
  <component v-if="tab.icon" :is="tab.icon" class="h-5" />
@@ -27,12 +30,12 @@
27
30
  </Tab>
28
31
  <div
29
32
  ref="indicator"
30
- class="absolute -bottom-px h-px bg-gray-900"
33
+ class="absolute bottom-0 h-px bg-gray-900"
31
34
  :class="transitionClass"
32
35
  :style="{ left: `${indicatorLeft}px` }"
33
36
  />
34
37
  </TabList>
35
- <TabPanels class="flex flex-1 overflow-hidden">
38
+ <TabPanels class="flex flex-1 overflow-hidden" :class="tabPanelClass">
36
39
  <TabPanel
37
40
  class="flex flex-1 flex-col overflow-y-auto focus:outline-none"
38
41
  v-for="(tab, i) in tabs"
@@ -57,6 +60,14 @@ const props = defineProps({
57
60
  type: Number,
58
61
  default: 0,
59
62
  },
63
+ tablistClass: {
64
+ type: String,
65
+ default: '',
66
+ },
67
+ tabPanelClass: {
68
+ type: String,
69
+ default: '',
70
+ },
60
71
  options: {
61
72
  type: Object,
62
73
  default: () => ({
package/src/index.js CHANGED
@@ -45,6 +45,7 @@ export { default as ListRows } from './components/ListView/ListRows.vue'
45
45
  export { default as ListRow } from './components/ListView/ListRow.vue'
46
46
  export { default as ListRowItem } from './components/ListView/ListRowItem.vue'
47
47
  export { default as ListSelectBanner } from './components/ListView/ListSelectBanner.vue'
48
+ export { default as ListFooter } from './components/ListView/ListFooter.vue'
48
49
  export { default as Toast } from './components/Toast.vue'
49
50
  export { toast, Toasts } from './components/toast.js'
50
51
  export { default as Tooltip } from './components/Tooltip.vue'