@fiscozen/navbar 0.1.3 → 0.1.5

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": "@fiscozen/navbar",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Design System Navbar Component",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
@@ -9,7 +9,7 @@
9
9
  "peerDependencies": {
10
10
  "tailwindcss": "^3.4.1",
11
11
  "vue": "^3.4.13",
12
- "@fiscozen/button": "^0.1.8"
12
+ "@fiscozen/button": "^1.0.1-next.1"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@rushstack/eslint-patch": "^1.3.3",
@@ -19,12 +19,12 @@
19
19
  "@vitest/coverage-v8": "^1.2.1",
20
20
  "@vue/test-utils": "^2.4.3",
21
21
  "@vue/tsconfig": "^0.5.0",
22
- "vite-plugin-dts": "^3.8.3",
23
22
  "eslint": "^8.49.0",
24
23
  "jsdom": "^23.0.1",
25
24
  "prettier": "^3.0.3",
26
25
  "typescript": "~5.3.0",
27
26
  "vite": "^5.0.10",
27
+ "vite-plugin-dts": "^3.8.3",
28
28
  "vitest": "^1.2.0",
29
29
  "vue-tsc": "^1.8.25",
30
30
  "@fiscozen/tsconfig": "^0.1.0",
@@ -32,6 +32,10 @@
32
32
  "@fiscozen/eslint-config": "^0.1.0"
33
33
  },
34
34
  "license": "ISC",
35
+ "dependencies": {
36
+ "@fiscozen/style": "^0.1.8-next.0",
37
+ "@fiscozen/composables": "^0.1.38"
38
+ },
35
39
  "scripts": {
36
40
  "coverage": "vitest run --coverage",
37
41
  "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts",
package/src/FzNavbar.vue CHANGED
@@ -1,38 +1,34 @@
1
1
  <script lang="ts" setup>
2
- import { ref, onBeforeMount, onMounted, onUnmounted, computed } from 'vue'
2
+ import { computed } from 'vue'
3
3
  import { FzIconButton } from '@fiscozen/button'
4
4
  import { FzNavbarEmits, FzNavbarProps } from './types'
5
+ import { breakpoints } from '@fiscozen/style'
6
+ import { useBreakpoints } from '@fiscozen/composables'
5
7
 
6
8
  const props = withDefaults(defineProps<FzNavbarProps>(), {
7
- variant: 'horizontal'
9
+ variant: 'horizontal',
10
+ breakpoints: undefined
8
11
  })
9
12
 
10
- const emit = defineEmits<FzNavbarEmits>()
11
-
12
- const width = ref(0)
13
-
14
- const onResize = () => {
15
- width.value = window.innerWidth
16
- }
17
- onBeforeMount(() => {
18
- onResize()
13
+ const computedBreakpoints = computed(() => {
14
+ return {
15
+ ...breakpoints,
16
+ ...(props.breakpoints ?? {})
17
+ }
19
18
  })
20
19
 
21
- onMounted(() => {
22
- window.addEventListener('resize', onResize)
23
- })
24
- onUnmounted(() => {
25
- window.removeEventListener('resize', onResize)
26
- })
20
+ const emit = defineEmits<FzNavbarEmits>()
27
21
 
28
- const isMobile = computed(() => Boolean(width.value <= 1024))
22
+ const { isGreater } = useBreakpoints(computedBreakpoints.value)
23
+ const isGreaterThanLg = isGreater('lg')
24
+ const isMobile = computed(() => !isGreaterThanLg.value)
29
25
  const isVertical = computed(() => Boolean(props.variant === 'vertical'))
30
26
  const isHorizontal = computed(() => Boolean(props.variant === 'horizontal'))
31
27
  </script>
32
28
 
33
29
  <template>
34
30
  <header
35
- class="flex p-12 shadow z-10"
31
+ class="z-10 flex p-12 shadow"
36
32
  :class="{
37
33
  'justify-between': isMobile,
38
34
  'h-full w-56 flex-col': isVertical && !isMobile,
package/src/types.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { Breakpoint } from '@fiscozen/style'
2
+
1
3
  export type FzNavbarVariant = 'horizontal' | 'vertical'
2
4
 
3
5
  interface FzNavbarProps {
@@ -9,6 +11,10 @@ interface FzNavbarProps {
9
11
  * Whether the main navigation menu is open (mobile)
10
12
  */
11
13
  isMenuOpen?: boolean
14
+ /**
15
+ * Override breakpoint for manage custom size inside navbar
16
+ */
17
+ breakpoints?: Partial<Record<Breakpoint, `${number}px`>>
12
18
  }
13
19
 
14
20
  type FzNavbarEmits = {