pimelon-ui 0.1.75 → 0.1.77

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pimelon-ui",
3
- "version": "0.1.75",
3
+ "version": "0.1.77",
4
4
  "description": "A set of components and utilities for rapid UI development",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -54,10 +54,11 @@
54
54
  "radix-vue": "^1.5.3",
55
55
  "showdown": "^2.1.0",
56
56
  "socket.io-client": "^4.5.1",
57
- "tippy.js": "^6.3.7"
57
+ "tippy.js": "^6.3.7",
58
+ "typescript": "^5.0.2"
58
59
  },
59
60
  "peerDependencies": {
60
- "vue": "^3.2.45",
61
+ "vue": ">=3.3.0",
61
62
  "vue-router": "^4.1.6"
62
63
  },
63
64
  "devDependencies": {
@@ -70,9 +71,8 @@
70
71
  "postcss": "^8.4.21",
71
72
  "prettier-plugin-tailwindcss": "^0.1.13",
72
73
  "tailwindcss": "^3.2.7",
73
- "typescript": "^5.0.2",
74
74
  "vite": "^4.1.0",
75
- "vue": "^3.2.45",
75
+ "vue": "^3.3.0",
76
76
  "vue-router": "^4.1.6"
77
77
  },
78
78
  "lint-staged": {
@@ -10,12 +10,6 @@ It is an array of objects which contains the following attributes:
10
10
  3. You can add more attributes which can be used for custom rendering in the tab
11
11
  header or content.
12
12
 
13
- ### Options
14
-
15
- Currently, it has only one option `indicatorLeft` which is used to set the left
16
- position of the indicator in case of custom rendering. It is optional and
17
- default value is `20`.
18
-
19
13
  ## v-model
20
14
 
21
15
  It is used to set the active tab or change the active tab. It is required.
@@ -1,13 +1,15 @@
1
1
  <template>
2
2
  <TabGroup
3
3
  as="div"
4
- class="flex flex-1 flex-col"
4
+ class="flex flex-1 flex-col overflow-y-hidden"
5
+ :style="`height: calc(100vh - ${tabListRef?.$el.offsetTop}px)`"
5
6
  :defaultIndex="changedIndex"
6
7
  :selectedIndex="changedIndex"
7
8
  @change="(idx) => (changedIndex = idx)"
8
9
  >
9
10
  <TabList
10
- class="relative flex items-center gap-7.5 overflow-x-auto border-b pl-5"
11
+ ref="tabListRef"
12
+ class="relative flex items-center gap-7.5 overflow-x-auto border-b px-5"
11
13
  :class="tablistClass"
12
14
  >
13
15
  <Tab
@@ -30,9 +32,8 @@
30
32
  </Tab>
31
33
  <div
32
34
  ref="indicator"
33
- class="absolute bottom-0 h-px bg-gray-900"
35
+ class="tab-indicator absolute bottom-0 h-px bg-gray-900"
34
36
  :class="transitionClass"
35
- :style="{ left: `${indicatorLeft}px` }"
36
37
  />
37
38
  </TabList>
38
39
  <TabPanels class="flex flex-1 overflow-hidden" :class="tabPanelClass">
@@ -68,12 +69,6 @@ const props = defineProps({
68
69
  type: String,
69
70
  default: '',
70
71
  },
71
- options: {
72
- type: Object,
73
- default: () => ({
74
- indicatorLeft: 20,
75
- }),
76
- },
77
72
  })
78
73
 
79
74
  const emit = defineEmits(['update:modelValue'])
@@ -83,11 +78,11 @@ const changedIndex = computed({
83
78
  set: (index) => emit('update:modelValue', index),
84
79
  })
85
80
 
81
+ const tabListRef = ref(null)
86
82
  const tabRef = ref([])
87
83
  const indicator = ref(null)
88
84
  const tabsLength = computed(() => props.tabs?.length)
89
85
 
90
- const indicatorLeft = ref(props.options?.indicatorLeft)
91
86
  const transitionClass = ref('')
92
87
 
93
88
  function moveIndicator(index) {
@@ -96,20 +91,20 @@ function moveIndicator(index) {
96
91
  }
97
92
  const selectedTab = tabRef.value[index].el
98
93
  indicator.value.style.width = `${selectedTab.offsetWidth}px`
99
- indicatorLeft.value = selectedTab.offsetLeft
94
+ indicator.value.style.left = `${selectedTab.offsetLeft}px`
100
95
  }
101
96
 
102
97
  watch(changedIndex, (index) => {
103
98
  if (index >= tabsLength.value) {
104
99
  changedIndex.value = tabsLength.value - 1
105
100
  }
101
+ transitionClass.value = 'transition-all duration-300 ease-in-out'
106
102
  nextTick(() => moveIndicator(index))
107
103
  })
108
104
 
109
105
  onMounted(() => {
110
- moveIndicator(changedIndex.value)
111
- nextTick(() => {
112
- transitionClass.value = 'transition-all duration-300 ease-in-out'
113
- })
106
+ nextTick(() => moveIndicator(changedIndex.value))
107
+ // Fix for indicator not moving on initial load
108
+ setTimeout(() => moveIndicator(changedIndex.value), 100)
114
109
  })
115
110
  </script>