Code Monkey home page Code Monkey logo

nuxt-headlessui's People

Contributors

danielroe avatar husayt avatar p4sca1 avatar renovate[bot] avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nuxt-headlessui's Issues

Cannot destructure property 'active' of 'undefined' as it is undefined Nuxt 3 nuxt-headlessui

Nuxt Config Details:

export default defineNuxtConfig({
devtools: { enabled: true },
modules: [
'@nuxtjs/tailwindcss',
'nuxt-headlessui',
],
css: [
'@/assets/main.css',
],

})

Package Details:

"devDependencies": {
"@nuxt/devtools": "latest",
"@nuxtjs/tailwindcss": "^6.7.0",
"@types/node": "^18",
"nuxt": "^3.5.2",
"nuxt-headlessui": "^1.1.4"
}

Following errors I'm getting:

[Vue warn]: Failed to resolve component: Combobox 8:29:55 PM
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
[Vue warn]: Failed to resolve component: ComboboxButton 8:29:55 PM
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
[Vue warn]: Failed to resolve component: ComboboxInput 8:29:55 PM
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
[Vue warn]: Failed to resolve component: TransitionRoot 8:29:55 PM
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
[Vue warn]: Failed to resolve component: ComboboxOptions 8:29:55 PM
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
[Vue warn]: Failed to resolve component: ComboboxOption 8:29:55 PM
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
[8:29:55 PM] [nuxt] [request error] [unhandled] [500] Cannot destructure property 'selected' of 'undefined' as it is undefined.

Implementation/usage of @headlessui-tailwindcss

How to implement @headlessui-tailwindcss?

I'm fairly new to nuxt and jamstacks in general, so I'm happy to learn and help with testing.

I've just discovered healdess ui and since I'm using nuxt I've found this repo, but one tool that would be usefull is @headlessui-tailwind. Basically it lets me style based on the state of the component using tailwind's utility classes.

Even if I change plugins: [require('@headlessui/tailwindcss')], to plugins: [require('nuxt-headlessui',)], inside tailwind.config.js

List of client only components

Is there a list of client only components. With big components, it's hard to find out which part of the component should be wrapped in the tag.

1.1.0 broke Dialog component

Hi there,

I am having an issue with the Dialog component in version 1.1.0. When I try to import it in my pages/index.vue and build the project, I get the following error:

 ERROR  'Dialog' is not exported by node_modules/.pnpm/[email protected][email protected]/node_modules/nuxt/dist/app/components/server-placeholder.mjs, imported by pages/index.vue?vue&type=script&setup=true&lang.ts                                                                                                                                                                                                              02:19:33
file: /home/dreamingcodes/Desktop/event-scheduler/pages/index.vue?vue&type=script&setup=true&lang.ts:9:9
 7: import { default as __nuxt_component_6 } from "/home/dreamingcodes/Desktop/event-scheduler/node_modules/.pnpm/[email protected][email protected]/node_modules/nuxt/dist/app/components/client-only";
 8: import { TransitionRoot as __nuxt_component_7 } from "/home/dreamingcodes/Desktop/event-scheduler/node_modules/.pnpm/@[email protected]/node_modules/@headlessui/vue/dist/components/transitions/transition.js";
 9: import { Dialog as __nuxt_component_8 } from "/home/dreamingcodes/Desktop/event-scheduler/node_modules/.pnpm/[email protected][email protected]/node_modules/nuxt/dist/app/components/server-placeholder";
             ^
10: import { TransitionChild as __nuxt_component_9 } from "/home/dreamingcodes/Desktop/event-scheduler/node_modules/.pnpm/@[email protected]/node_modules/@headlessui/vue/dist/components/transitions/transition.js";
11: import { DialogPanel as __nuxt_component_10 } from "/home/dreamingcodes/Desktop/event-scheduler/node_modules/.pnpm/[email protected][email protected]/node_modules/nuxt/dist/app/components/server-placeholder";


 ERROR  'Dialog' is not exported by node_modules/.pnpm/[email protected][email protected]/node_modules/nuxt/dist/app/components/server-placeholder.mjs, imported by pages/index.vue?vue&type=script&setup=true&lang.ts                                                                                                                                                                                                              02:19:33

  at error (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:1858:30)
  at Module.error (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:12429:16)
  at Module.traceVariable (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:12788:29)
  at ModuleScope.findVariable (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:11440:39)
  at FunctionScope.findVariable (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:6372:38)
  at ChildScope.findVariable (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:6372:38)
  at ReturnValueScope.findVariable (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:6372:38)
  at ChildScope.findVariable (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:6372:38)
  at Identifier.bind (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:7439:40)
  at VariableDeclarator.bind (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:5269:23)

My project deps:

  "devDependencies": {
    "@morev/vue-transitions": "^2.3.5",
    "@nuxt/image-edge": "1.0.0-27840416.dc1ed65",
    "@nuxtjs/color-mode": "^3.2.0",
    "@nuxtjs/robots": "^3.0.0",
    "@nuxtjs/tailwindcss": "^6.2.0",
    "@prisma/client": "^4.8.1",
    "@sidebase/nuxt-auth": "^0.3.3",
    "@types/animejs": "^3.1.6",
    "animejs": "^3.2.1",
    "nuxt": "3.0.0",
    "nuxt-headlessui": "^1.1.0",
    "prisma": "^4.8.1",
    "sass": "^1.57.1"
  }

This error did not occur in previous versions.

[Vue warn]: Unknown custom element: <HeadlessDialog> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

"nuxt": "^2.15.8",
"nuxt-headlessui": "^1.1.1",



<ClientOnly>
    <HeadlessDialog :open="isOpen" @close="$emit('close')">
      <HeadlessDialogPanel>
        <HeadlessDialogTitle v-if="title">{{ title }}</HeadlessDialogTitle>
        <HeadlessDialogDescription v-if="desc"> {{ desc }} </HeadlessDialogDescription>
        <slot />
      </HeadlessDialogPanel>
    </HeadlessDialog>
  </ClientOnly>



Small improvement suggestions

Hi! Following up nuxt/modules#476, Really nice and minimal module love it! There is only one small issue i could find while doing review. Since @headlessui/vue is a _nested dependency of your module, when calling resolvePath you might need to set second argument paths that includes node_modules/@headlessui actually. Nuxt will by default search in user node_modules which is assumption that users directly added @headlessui/vue to their dependencies as a peer dependency.

Disclosure component hydration missmatch

image
Wrapping it in ClientOnly fixes it but will be better if the generated id matches and the component is rendered server side.


<Disclosure v-slot="{ open }">
    <DisclosureButton
      class="row text-center w-full flex items-center m-0 py-2"
    >
    Button
      <div class="col-md-1 justify-end flex">
        <ChevronUpIcon
          :class="!open ? 'rotate-180 transform' : ''"
          class="h-7 w-7 text-sky-800 self-center flex"
        />
      </div>
    </DisclosureButton>
      <DisclosurePanel
        class="text-gray-500 py-2 text-center"
      >
      Expanded content
      </DisclosurePanel>
  </Disclosure>
  

Hydration children mismatch in <div>: server rendered element contains fewer child nodes than client vdom.

Hydration children mismatch in <div>: server rendered element contains fewer child nodes than client vdom.

This error cause and also flicker when using tabs when using this module and also when using raw headless UI module

If we wrap client only

 <ClientOnly>
  <TabGroup>
    .....
  </TabGroup>
</ClientOnly

or use transpile in config

  build: {
     transpile: ['@headlessui/vue'],
   },

but flicker effect remain same it because of client rendering

Default prefix

Great Nuxt module! โœจ

I wonder whether it would make more sense to set the default prefix to HeadlessUi instead? This makes it more distinctive and whoever reads the code knows immediately where the component comes from. Headless on its own could be, in theory, related to anything (e.g. a component coming from a headless CMS).

Headless Menu showing warnings

Creating a

<HeadlessMenu>
  <HeadlessMenuButton>
    <div class="flex items-center w-full">
      <div>
        <img class="h-8 w-8 rounded-full bg-gray-50"
             src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80"
             alt="" />
      </div>
    </div>
  </HeadlessMenuButton>
  <transition enter-active-class="transition duration-100 ease-out"
              enter-from-class="transform scale-95 opacity-0"
              enter-to-class="transform scale-100 opacity-100"
              leave-active-class="transition duration-75 ease-in"
              leave-from-class="transform scale-100 opacity-100"
              leave-to-class="transform scale-95 opacity-0">
    <HeadlessMenuItems>
      <HeadlessMenuItem v-slot="{ active }">
        <button>
          Edit
        </button>
      </HeadlessMenuItem>
    </HeadlessMenuItems>
  </transition>
</HeadlessMenu>

image

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): lock file maintenance

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

circleci
.circleci/config.yml
  • cimg/node 20.12
npm
package.json
  • @headlessui/vue ^1.7.18
  • @nuxt/kit ^3.11.2
  • pathe ^1.1.2
  • @heroicons/vue 2.1.3
  • @nuxt/eslint-config 0.2.0
  • @nuxt/module-builder 0.5.5
  • @nuxt/schema 3.11.2
  • @nuxtjs/tailwindcss 6.11.4
  • @semantic-release/changelog 6.0.3
  • @semantic-release/git 10.0.1
  • @types/node 20.12.4
  • eslint 8.57.0
  • nuxt 3.11.2
  • semantic-release 23.0.7
  • pnpm 8.15.6
playground/package.json
  • @nuxtjs/tailwindcss ^6.10.1

  • Check this box to trigger a request for Renovate to run again on this repository

warning on console

Captura de tela 2022-11-30 171023

it's giving a warning on the console, I'm using nuxt 3, I've already added the parameter below to my nuxt.config.ts and still the warning.

build: {
analyze: true,
transpile: ['@headlessui/vue']
}

Error: provideHeadlessUseId(() => useId());

I get this error: 500 useId is not defined

When using: provideHeadlessUseId(() => useId()); in app.vue

<template>
  <NuxtLayout>
    <NuxtPage />
  </NuxtLayout>
</template>

<script setup lang="ts">
provideHeadlessUseId(() => useId());
</script>

Inherits Issue 982 from tailwindlabs/headlessui

Using the Menu component (for example) throws a bunch of errors:

Console errors:

[Vue warn]: provide() can only be used inside setup().
[Vue warn]: provide() can only be used inside setup().
[Vue warn]: inject() can only be used inside setup() or functional components.
[Vue warn]: Unhandled error during execution of setup function at

On-Screen Errors:

Cannot read properties of undefined (reading 'buttonRef')

Solution

tailwindlabs/headlessui#982

Adding

build: {
    transpile: ["@headlessui/vue"],
 },

to nuxt.config.js resolves this.

It's just a minor inconvenience but still annoying. Don't know if this is something that can be fixed here or maybe there's another solution.

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.