Home
Softono
x

xiaoluoboding

Professional software vendor delivering innovative solutions on the Softono platform. Specialized in both open-source and proprietary software development.

Total Products
2

Software by xiaoluoboding

vue-frimousse
Open Source

vue-frimousse

# Vue Frimousse [![NPM][npmBadge]][npmUrl] [![Minzip Package][bundlePhobiaBadge]][bundlePhobiaUrl] [![NPM Download][npmDtBadge]][npmDtUrl] [npmBadge]: https://img.shields.io/npm/v/vue-frimousse.svg?maxAge=2592000 [npmUrl]: https://www.npmjs.com/package/vue-frimousse [npmDtBadge]: https://img.shields.io/npm/dt/vue-frimousse.svg [npmDtUrl]: https://www.npmjs.com/package/vue-frimousse [bundlePhobiaBadge]: https://img.shields.io/bundlephobia/minzip/vue-frimousse [bundlePhobiaUrl]: https://bundlephobia.com/package/vue-frimousse@latest > A Vue 3 emoji picker component library - 1:1 port of the React Frimousse emoji picker ## Features - 🎯 **1:1 React Port**: Complete feature parity with the React Frimousse emoji picker - 🚀 **Vue 3 Composition API**: Built with modern Vue 3 patterns and TypeScript - ⚡️ **Lightweight and fast**: Dependency-free, tree-shakable, and virtualized with minimal re-renders - 🎨 **Unstyled and composable**: Bring your own styles and compose parts as you want - 🔄 **Always up-to-date**: Latest emoji data is fetched when needed and cached locally - 🔣 **No � symbols**: Unsupported emojis are automatically hidden - ♿️ **Accessible**: Keyboard navigable and screen reader-friendly ## Installation ```bash npm install vue-frimousse # or pnpm add vue-frimousse # or yarn add vue-frimousse ``` If you are using [shadcn/vue](https://www.shadcn-vue.com), you can also install it as a pre-built component via the [shadcn CLI](https://www.shadcn-vue.com/docs/cli.html). ```bash npx shadcn-vue@latest add https://vue-frimousse.robertshaw.id/r/emoji-picker.json ``` Learn more in the [shadcn/vue](#shadcnvue) section. ## Usage Import the `EmojiPicker` parts and create your own component by composing them. ```vue <template> <EmojiPicker.Root> <EmojiPicker.Search /> <EmojiPicker.Viewport> <EmojiPicker.Loading>Loading…</EmojiPicker.Loading> <EmojiPicker.Empty>No emoji found.</EmojiPicker.Empty> <EmojiPicker.List /> </EmojiPicker.Viewport> </EmojiPicker.Root> </template> <script setup lang="ts"> import { default as EmojiPicker } from "vue-frimousse"; </script> ``` Apart from a few sizing and overflow defaults, the parts don’t have any styles out-of-the-box. Being composable, you can bring your own styles and apply them however you want: [Tailwind CSS](https://tailwindcss.com/), CSS-in-JS, vanilla CSS via inline styles, classes, or by targeting the `[frimousse-*]` attributes present on each part. You might want to use it in a popover rather than on its own. Frimousse only provides the emoji picker itself so if you don’t have a popover component in your app yet, there are several libraries available: [Reka UI](https://reka-ui.com/docs/components/popover), [Base UI](https://www.shadcn-vue.com/docs/components/popover.html), [shadcn/vue](https://headlessui.com/react/popover), and [Nuxt UI](https://ui.nuxt.com/components/popover), to name a few. ### shadcn/vue If you are using [shadcn/vue](https://www.shadcn-vue.com), you can install a pre-built version which integrates with the existing shadcn/vue variables via the [shadcn/vue CLI](https://www.shadcn-vue.com/docs/cli.html). ```bash npx shadcn-vue@latest add https://vue-frimousse.robertshaw.id/r/emoji-picker.json ``` It can be composed and combined with other shadcn/ui components like [Popover](https://ui.shadcn.com/docs/components/popover). ## Documentation Find the full documentation and examples on [vue-frimousse.robertshaw.id](https://vue-frimousse.robertshaw.id). ## Compatibility - Vue 3+ or Nuxt 3+ - TypeScript 5.1 and above ## Miscellaneous The name [“frimousse”](https://en.wiktionary.org/wiki/frimousse) means “little face” in French, and it can also refer to smileys and emoticons. The emoji picker component was originally created for the [Liveblocks Comments](https://liveblocks.io/comments) default components, within [`@liveblocks/react-ui`](https://github.com/liveblocks/liveblocks/tree/main/packages/liveblocks-react-ui). This project is a Vue port of the [frimousse](https://github.com/liveblocks/frimousse) ## Credits The emoji data is based on [Emojibase](https://emojibase.dev/). ## Contributing All contributions are welcome! If you find a bug or have a feature request, feel free to create an [issue](https://github.com/xiaoluoboding/vue-frimousse/issues) or a [PR](https://github.com/xiaoluoboding/vue-frimousse/pulls). The project is setup as a monorepo with the `vue-frimousse` package at the root and [vue-frimousse.robertshaw.id](https://vue-frimousse.robertshaw.id) in the `app` directory. ### Development Install dependencies and start development builds from the root. ```bash npm i npm run dev ``` Test the Nuxt package ```bash npm run dev:nuxt ``` ### Tests The package has 95%+ test coverage with [Vitest](https://vitest.dev/). ```bash npm run test:unit ``` ## License MIT [@xiaoluoboding](https://github.com/xiaoluoboding)

JavaScript Libraries & Components
64 Github Stars
vue-sonner
Open Source

vue-sonner

# Sonner for Vue [![NPM][npmBadge]][npmUrl] [![Minzip Package][bundlePhobiaBadge]][bundlePhobiaUrl] [![NPM Download][npmDtBadge]][npmDtUrl] [npmBadge]: https://img.shields.io/npm/v/vue-sonner.svg?maxAge=2592000 [npmUrl]: https://www.npmjs.com/package/vue-sonner [npmDtBadge]: https://img.shields.io/npm/dt/vue-sonner.svg [npmDtUrl]: https://www.npmjs.com/package/vue-sonner [bundlePhobiaBadge]: https://img.shields.io/bundlephobia/minzip/vue-sonner [bundlePhobiaUrl]: https://bundlephobia.com/package/vue-sonner@latest > An opinionated toast component for Vue. It's a Vue port of Sonner ## Preview https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4 ## Introduction `Vue Sonner` is an opinionated toast component for Vue. It's customizable, but styled by default. Comes with a swipe to dismiss animation. ## Table of Contents <details> <summary>TOC</summary> - [Sonner for Vue](#sonner-for-vue) - [Preview](#preview) - [Introduction](#introduction) - [Table of Contents](#table-of-contents) - [Installation](#installation) - [Test](#test) - [Launching the test](#launching-the-test) - [Build and watch for change in order to fix the test](#build-and-watch-for-change-in-order-to-fix-the-test) - [Usage](#usage) - [For Vue 3](#for-vue-3) - [For Nuxt 3](#for-nuxt-3) - [CDN Link](#cdn-link) - [Types](#types) - [Default](#default) - [Success](#success) - [Error](#error) - [Action](#action) - [Promise](#promise) - [Custom Component](#custom-component) - [Customization](#customization) - [Headless](#headless) - [Theme](#theme) - [Position](#position) - [Expanded](#expanded) - [Styling for all toasts](#styling-for-all-toasts) - [Styling for individual toast](#styling-for-individual-toast) - [Tailwind CSS](#tailwind-css) - [Changing Icon](#changing-icon) - [Close button](#close-button) - [Rich colors](#rich-colors) - [Custom offset](#custom-offset) - [On Close Callback](#on-close-callback) - [Persisting toasts](#persisting-toasts) - [Dismissing toasts programmatically](#dismissing-toasts-programmatically) - [Keyboard focus](#keyboard-focus) - [Contributors](#contributors) - [Inspiration](#inspiration) - [License](#license) </details> ## Installation To start using the library, install it in your project: ```bash pnpm install vue-sonner or yarn add vue-sonner ``` ## Test To run the test you need two separate CLI window : ### Launching the test To launch the test, you need to go in the test directory ```bash cd ./test ``` and launch the following command ```bash cd ./test pnpm test:e2e --ui ``` ### Build and watch for change in order to fix the test This command will build the vue-sonner library in lib mode, and add a watch so every time you modify the code of the library, you will have a new bundle and can run the test again. ```bash pnpm build:dev ``` ## Usage ### For Vue 3 ```html <!-- App.vue --> <template> <Toaster /> <button @click="() => toast('My first toast')">Render a toast</button> </template> <script lang="ts" setup> import 'vue-sonner/style.css' import { Toaster, toast } from 'vue-sonner' </script> ``` ### For Nuxt 3 Use `vue-sonner/nuxt` module ```ts // nuxt.config.ts export default defineNuxtConfig({ ... modules: ['vue-sonner/nuxt'] vueSonner: { css: false // true by default to include css file } }) ``` Use `Toaster` component and `$toast` function anywhere in the Vue SFC ```html <!-- app.vue --> <template> <div> <Toaster position="top-right" /> <button @click="() => $toast('My first toast')">Render a toast</button> </div> </template> <script setup lang="ts"> const { $toast } = useNuxtApp() </script> ``` ### CDN Link **EMS version** ```ts https://cdn.jsdelivr.net/npm/vue-sonner/+esm ``` ## Types ### Default Most basic toast. You can customize it (and any other type) by passing an options object as the second argument. ```ts toast('Event has been created') ``` With custom description: ```ts toast('Event has been created', { description: 'Monday, January 3rd at 6:00pm' }) ``` ### Success Renders a checkmark icon in front of the message. ```ts toast.success('Event has been created') ``` ### Error Renders an error icon in front of the message. ```ts toast.error('Event has not been created') ``` ### Action Renders a button. ```ts toast('Event has been created', { action: { label: 'Undo', onClick: () => console.log('Undo') } }) ``` ### Promise Starts in a loading state and will update automatically after the promise resolves or fails. You can pass a function to the success/error messages to incorporate the result/error of the promise. ```ts toast.promise(() => new Promise((resolve) => setTimeout(resolve, 2000)), { loading: 'Loading', success: (data: any) => 'Success', error: (data: any) => 'Error' }) ``` ### Custom Component You can pass a Vue Component as the first argument instead of a string to render custom Component while maintaining default styling. You can use the headless version below for a custom, unstyled toast. ```html <script lang="ts" setup> import { defineComponent, h, markRaw } from 'vue' const CustomDiv = defineComponent({ setup() { return () => h('div', { innerHTML: 'A custom toast with unstyling' }) } }) toast(markRaw(CustomDiv)) </script> ``` ## Customization ### Headless You can use `toast.custom` to render an unstyled toast with custom jsx while maintaining the functionality. ```vue <script lang="ts" setup> import { markRaw } from 'vue' import HeadlessToast from './HeadlessToast.vue' toast.custom(markRaw(HeadlessToast), { duration: 999999 }) </script> ``` ### Theme You can change the theme using the `theme` prop. Default theme is light. ```html <Toaster theme="dark" /> ``` ### Position You can change the position through the `position` prop on the `<Toaster />` component. Default is `top-right`. ```html <!-- Available positions --> <!-- top-left, top-center, top-right, bottom-left, bottom-center, bottom-right --> <Toaster position="top-center" /> ``` ### Expanded Toasts can also be expanded by default through the `expand` prop. You can also change the amount of visible toasts which is 3 by default. ```html <Toaster expand :visibleToasts="9" /> ``` ### Styling for all toasts You can style your toasts globally with the `toastOptions` prop in the `Toaster` component. ```html <Toaster :toastOptions="{ style: { background: 'red' }, class: 'my-toast', descriptionClass: 'my-toast-description' }" /> ``` ### Styling for individual toast ```ts toast('Event has been created', { style: { background: 'red' }, class: 'my-toast', descriptionClass: 'my-toast-description' }) ``` ### Tailwind CSS The preferred way to style the toasts with tailwind is by using the `unstyled` prop. That will give you an unstyled toast which you can then style with tailwind. ```vue <Toaster :toastOptions="{ unstyled: true, classes: { toast: 'bg-blue-400', title: 'text-red-400', description: 'text-red-400', actionButton: 'bg-zinc-400', cancelButton: 'bg-orange-400', closeButton: 'bg-lime-400' } }" /> ``` You can do the same when calling `toast()`. ```ts toast('Hello World', { unstyled: true, classes: { toast: 'bg-blue-400', title: 'text-red-400 text-2xl', description: 'text-red-400', actionButton: 'bg-zinc-400', cancelButton: 'bg-orange-400', closeButton: 'bg-lime-400' } }) ``` Styling per toast type is also possible. ```vue <Toaster :toastOptions="{ unstyled: true, classes: { error: 'bg-red-400', success: 'text-green-400', warning: 'text-yellow-400', info: 'bg-blue-400' } }" /> ``` ### Changing Icon You can change the default icons using slots: ```vue <Toaster> <template #loading-icon> <LoadingIcon /> </template> <template #success-icon> <SuccessIcon /> </template> <template #error-icon> <ErrorIcon /> </template> <template #info-icon> <InfoIcon /> </template> <template #warning-icon> <WarningIcon /> </template> </Toaster> ``` ### Close button Add a close button to all toasts that shows on hover by adding the `closeButton` prop. ```html <Toaster closeButton /> ``` ### Rich colors You can make error and success state more colorful by adding the `richColors` prop. ```html <Toaster richColors /> ``` ### Custom offset Offset from the edges of the screen. ```html <Toaster offset="80px" /> ``` ### On Close Callback You can pass `onDismiss` and `onAutoClose` callbacks. `onDismiss` gets fired when either the close button gets clicked or the toast is swiped. `onAutoClose` fires when the toast disappears automatically after it's timeout (`duration` prop). ```ts toast('Event has been created', { onDismiss: (t) => console.log(`Toast with id ${t.id} has been dismissed`), onAutoClose: (t) => console.log(`Toast with id ${t.id} has been closed automatically`) }) ``` ### Persisting toasts You can change the duration of each toast by using the duration property, or change the duration of all toasts like this: ```html <Toaster :duration="10000" /> ``` ```ts toast('Event has been created', { duration: 10000 }) If you want a toast to stay on screen forever, you can set the duration to `Infinity`. // Persisent toast toast('Event has been created', { duration: Infinity }) ``` ### Dismissing toasts programmatically To remove a toast programmatically use `toast.dismiss(id)`. ```ts const toastId = toast('Event has been created') toast.dismiss(toastId) ``` You can also dismiss all toasts at once by calling `toast.dismiss()` without an id. ```ts toast.dismiss() ``` ### Keyboard focus You can focus on the toast area by pressing ⌥/alt + T. You can override it by providing an array of event.code values for each key. ```html <Toaster hotkey="['KeyC']" /> ``` ## Contributors <a href="https://github.com/xiaoluoboding/vue-sonner/graphs/contributors"> <img src="https://contrib.rocks/image?repo=xiaoluoboding/vue-sonner" /> </a> ## Inspiration - [sonner](https://github.com/emilkowalski/sonner) - An opinionated toast component for React. ## License MIT [@xiaoluoboding](https://github.com/xiaoluoboding)

JavaScript Libraries & Components Web Components & Widgets
1.4K Github Stars