npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

custom-component-lib-vue

v1.0.12

Published

This is a custom npm component library based on Vue 3 + Vite + Shadcn. It provides a collection of reusable components that can be easily integrated into Vue projects. With the power of Vue 3, the lightning-fast build tool Vite, and the shader language Sh

Downloads

47

Readme

Custom Components Library based on Vue 3 + Vite + Shadcn

This is a custom npm component library based on Vue 3 + Vite + Shadcn. It provides a collection of reusable components that can be easily integrated into Vue projects. With the power of Vue 3, the lightning-fast build tool Vite, and the shader language Shadcn, this library offers a seamless development experience and stunning visual effects. Whether you're building a web application or a creative project, this library has got you covered.

To get started, simply install the library via npm:

npm install custom-component-lib-vue

Then, import the components you need in your Vue project:

import { EButton, ECard, EModal } from 'custom-component-lib-vue';

export default {
    components: {
        EButton,
        ECard,
        EModal
    },
    // ...
}

Then, import the styles in main.js of your Vue project:

import 'custom-component-lib-vue/style.css';
    // ...

You can now use these components in your templates:

<template>
    <div>
        <EButton>Click me</EButton>
        <ECard title="Hello">This is a card component</Card>
        <EModal :visible="showModal" @close="showModal = false">This is a modal component</EModal>
    </div>
</template>

ESidebar Component

The ESidebar component is a versatile and customizable sidebar component for your application. It provides a navigational menu, which can be toggled open or closed, and optionally displays a sign-out button.

Props

The table below outlines the props that can be passed to the ESidebar component:

| Prop Name | Type | Required | Default | Description | |-----------------|----------|----------|----------------|--------------------------------------------------| | title | String | Yes | 'Menu Title' | The title displayed at the top of the sidebar. | | isOpen | Boolean | Yes | false | Determines if the sidebar is open or closed. | | displaySignout| Boolean | No | true | Option to display the sign-out button. | | menuList | Array | Yes | N/A | Array of menu items to be displayed in the sidebar. | | pathname | String | Yes | N/A | Current pathname used to highlight active menu item. | | toggleSidebar | Function | Yes | N/A | Function to toggle the open/close state of the sidebar. |

Usage

Below is an example of how to use the ESidebar component in your application:

<template>
  <div id="app">
    <ESidebar
      :title="'My Menu'"
      :isOpen="true"
      :displaySignout="true"
      :menuList="menuList"
      :pathname="pathname"
      :toggleSidebar="toggleSidebar"
    />
  </div>
</template>

<script setup>
import ESidebar from './components/ESidebar.vue';

const getMenuList = (pathname) => {
  return [
    {
      groupLabel: '',
      menus: [
        {
          href: '/dashboard',
          label: 'Dashboard',
          active: pathname.includes('/dashboard'),
          icon: LayoutGrid,
          submenus: []
        }
      ]
    },
    {
      groupLabel: 'Contents',
      menus: [
        {
          href: '',
          label: 'Posts',
          active: pathname.includes('/posts'),
          icon: SquarePen,
          submenus: [
            {
              href: '/posts',
              label: 'All Posts',
              active: pathname === '/posts'
            },
            {
              href: '/posts/new',
              label: 'New Post',
              active: pathname === '/posts/new'
            }
          ]
        },
        {
          href: '/categories',
          label: 'Categories',
          active: pathname.includes('/categories'),
          icon: Bookmark,
          submenus: []
        },
        {
          href: '/tags',
          label: 'Tags',
          active: pathname.includes('/tags'),
          icon: Tag,
          submenus: []
        }
      ]
    },
  ]
}

const pathname = '/dashboard'

const menuList = getMenuList(pathname)

const toggleSidebar = () => {
  // Your toggle logic here
}
</script>

EMultiSelect custom component from the Custom Components Library, follow these steps:

  1. Install the library via npm:
npm install custom-component-lib-vue
  1. Import the EMultiSelect component in your Vue project:
import { EMultiSelect } from 'custom-component-lib-vue';

import { useForm } from 'vee-validate'
import { toTypedSchema } from '@vee-validate/zod'
import * as zod from 'zod'
import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '@/shadcn-components/ui/form'

import { Icons } from '@/shadcn-components/ui/icons/icons'
import { Button } from '@/shadcn-components/ui/button'
import { Card } from '@/shadcn-components/ui/card'
  1. Difine Form Schema
const FormSchema = toTypedSchema(
  zod.object({
    frameworks: zod.array(zod.string()).min(1, { message: 'Please select at least one framework.' })
  })
)

const form = useForm({
  validationSchema: FormSchema,
  initialValues: {
    frameworks: ['sveltekit', 'nuxt.js']
  }
})

const handleChildEvent = (message) => {
  form.setFieldValue('frameworks', message)
}

const onSubmit = form.handleSubmit((values) => {
  console.log('Form submitted!', values.frameworks)
})
  1. Set Field options which need to be used
const frameworksList = [
  {
    value: 'next.js',
    label: 'Next.js',
    icon: Icons.dog
  },
  {
    value: 'sveltekit',
    label: 'SvelteKit',
    icon: Icons.cat
  },
  {
    value: 'nuxt.js',
    label: 'Nuxt.js',
    icon: Icons.turtle
  },
  {
    value: 'remix',
    label: 'Remix',
    icon: Icons.rabbit
  },
  {
    value: 'astro',
    label: 'Astro',
    icon: Icons.fish
  }
]
  1. Use the EMultiSelect component in your templates inside of the form:
<template>
  <div class="min-h-screen:calc(100vh - 3rem) flex flex-col items-center justify-start space-y-3 p-3">
    <Card class="w-full max-w-2xl p-5">
      <form @submit="onSubmit" class="space-y-8">
        <FormField name="frameworks" :control="form.control" v-slot="{ field }">
          <FormItem>
            <FormLabel>Frameworks</FormLabel>
            <FormControl>
              <EMultiSelect
                :options="frameworksList"
                placeholder="Select frameworks"
                @onValueChange="handleChildEvent"
                :defaultValue="field.value"
                variant="secondary"
                :maxCount="3" />
            </FormControl>
            <FormDescription> Choose the frameworks you are interested in. </FormDescription>
            <FormMessage />
          </FormItem>
        </FormField>
        <Button type="submit"> Submit </Button>
      </form>
    </Card>
  </div>
</template>
  1. Handle the selected options by accessing the handleChildEvent function in your Vue component's methods.

That's it! You can now use the EMultiSelect custom component in your Vue project to enable multi-select functionality.

Happy coding with Custom Components Library! For more information on how to use each component, please refer to the documentation.

Happy coding with Custom Components Library!