Commit Graph

64 Commits

Author SHA1 Message Date
Robin Malfait a73007388f Ensure playgrounds work + switch to npm workspaces (#2907)
* bump Next in playground

* convert legacy Link after Next.js bump

* update yarn.lock

* switch to npm workspaces

* move `packages/playground-*` to `playgrounds/*`

* use `npm` instead of `yarn`

* sync package-lock.json

* use node 20 for insiders releases
2024-01-03 14:26:12 +01:00
Robin Malfait e662f12398 2.0.0 Alpha prep (#2887)
* bump React & React DOM dependencies

* fix typo `TOmitableProps` → `TOmittableProps`

* bump prettier

* run prettier after prettier version bump

* bump TypeScript

* run prettier after TypeScript version bump

* enable `verbatimModuleSyntax`

This ensures all imported types are using the `type` keyword.

* add `type` to type related imports

* add common testing scenarios

Will be used in the new and existing components.

* add script to make Next.js happy

Right now Next.js does barrel file optimization and re-writing imports
to a real path in the `dist` folder. Most of those rewrites don't
actually exist because they have an assumption:

```js
import { FooBar } from '@headlessui/react'
```

is rewritten as:
```js
import { FooBar } from '@headlessui/react/dist/components/foo-bar/foo-bar'
```

This script will make sure these paths exist...

* improve `by` prop, introduce `useByComparator`

This hook has a default implementation when comparing objects. If the
object contains an `id`, then we will compare the objects by their
`id`'s without the user of the library needing to specify `by="id"`.

If the objects don't have an `id` prop, then the default is still to
compare by reference (unless specicified otherwise).

* sync yarn.lock

* rename `Features` to `HiddenFeatures` for `Hidden` component

* rename `Features` to `FocusTrapFeatures` in `FocusTrap` component

* rename `Features` to `RenderFeatures` in `render` util

* add `floating-ui` as a dependency + introduce internal floating related components

* bump Vue dependencies

* ensure scroll bar calculations can't go negative

* improve types in `@headlessui/vue`

* use snapshot tests for `Transition` tests in `@headlessui/vue`

* use snapshot tests for `portal` tests in `@headlessui/vue`

* rename `src/components/transitions/` to `src/components/transition/` (singular)

This is so that we can be consistent with the other components.

* drop custom `toMatchFormattedCss`, prefer snapshot tests instead

* use snapshot tests for `Label` tests in `@headlessui/vue`

* use snapshot tests for `Description` tests in `@headlessui/vue`

* sort exported components in tests for `@headlessui/vue`

* use snapshot tests in `@headlessui/tailwindcss`

* rename `mergeProps` to `mergePropsAdvanced`

This is a more complex version of a soon to be exported `mergeProps`
that we will be using in our components.

* do not expose `aria-labelledby` if it is only referencing itself

* expose boolean state as `kebab-case` instead of `camelCase`

These are the ones being exposed inside `data-headlessui-state="..."`

* expose boolean data attributes

A slot with `{active,focus,hover}` will be exposed as:
```html
<span data-headlessui-state="active focus hover"></span>
```

But also as boolean attributes:
```html
<span data-active data-focus data-hover></span>
```

* improve internal types for `className` in `render` util

* ensure we keep exposed data attributes into account when trying to forward them to the component inside the `Fragment`

* add small typescript type fix

This is internal code, and the public API is not influenced by this
`:any`. It does make TypeScript happy.

* introduce `mergeProps` util to be used in our components

This will help us to merge props, when event handlers are available they
will be merged by wrapping them in a function such that both (or more)
event handlers are called for the same `event`.

* add new internal `Modal` component

* fix: when using `Focus.Previous` with `activeIndex = -1` should start at the end

* prefer `window.scrollY` instead of `window.pageYOffset`

Because `window.pageYOffset` is deprecated.

* add `'use client'` directives on client only components

These components use hooks that won't work in server components and you
will receive an error otherwise.

* drop `import 'client-only'` in favor of the `'use client'` directive

* add React Aria dependencies

* pin beta dependencies

* prettier bump formatting

* improve TypeScript types in tests

* use new Jest matchers instead of deprecated ones

* improve typescript types in Vue

* prefer `useLabelledBy` and `useDescribedBy`

* add internal `DisabledProvider`

* add internal `IdProvider`

* add internal `useDidElementMove` hook

* add internal `useElementSize` hook

* add internal `useIsTouchDevice` hook

* add internal `useActivePress` hook

* use snapshot tests for `Description` tests

* use snapshot tests for `Label` tests

* use snapshot tests for `Portal` tests

* use snapshot tests for `render` tests

* add (private) `Tooltip` component

Currently this one is not ready yet, so its not publicly exposed yet.

* add internal `FormFields` component

This one adds a component to render (hidden) inputs for native form
support. It also ensures that form fields can be hoisted to the end of
the nearest `Field`. If the components are not inside a `Field` they
will be rendered in place.

* add new `Button` component

* add new `Checkbox` component

* add new `DataInteractive` component

* add new `Field` component

* add new `Fieldset` component

* add new `Legend` component

* add new `Input` component

* add new `Select` component

* add new `Textarea` component

* export new components

* WIP

* remove `within: true`

This only makes sense if anything inside the current element receives
focus, which is not the case for `input`, `select`, `textarea` or
`Radio/RadioOption`.

* group focus/hover/active hooks together

* conditionally link anchor panel

* immediately focus the container

* prevent premature disabling of `Listbox`'s floating integration

+ Track whether the button moved or not when disabling such that we can
  disable the transitions earlier.

* improve scroll locking on iOS

* skip hydration tests for now

* skip certain focus trap tests for now

* update CHANGELOG.md

* add missing requires

* drop unused `@ts-expect-error`

* ignore type issues in playgrounds

These playgrounds are mainly test playgrounds. Lower priority for now,
we will get back to them.

* add yarn resolutions to solve swc bug
2023-12-20 19:57:57 +01:00
Jordan Pittman c25e2e6036 Fix CJS types (#2880)
* Fix Vue type error

* Add separate CTS types

* Add “Are The Types Wrong” CLI

* wip

* Bump node versions in workflows

* wip

* wip

* wip

* yolo

* yolo (again?)

* wip

* wip
2023-12-12 11:43:34 -05:00
Robin Malfait f016dc51db Add virtual prop to Combobox component (#2740)
* type timezones in playground data

* add `@tanstack/react-virtual` and `@tanstack/vue-virtual`

* use latest stable Tailwind CSS version

* add Combobox with virtual prop example

* add `virtual` prop to `Combobox`

Co-authored-by: Jordan Pittman <jordan@cryptica.me>

* add tests for `virtual` prop

- Also wrap `click` helpers in `act` for React (use `rawClick` without
  `act` in tests related to `Transition`)

* update changelog

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2023-09-15 14:29:18 +02:00
Jordan Pittman 8505d7a944 1.7.16 - @headlessui/vue 2023-08-17 10:59:05 -04:00
Robin Malfait e4fc1b0836 1.7.15 - @headlessui/vue 2023-07-27 16:23:47 +02:00
Robin Malfait 14b8c56226 1.7.14 - @headlessui/vue 2023-06-01 12:40:01 +02:00
Mateusz Burzyński 0505e92b83 Move types condition to the front (#2469)
* move `types` condition to the front

* Update changelog

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2023-05-01 12:21:28 -04:00
Robin Malfait 095ec18f6c 1.7.13 - @headlessui/vue 2023-04-12 19:05:05 +02:00
Robin Malfait 9a7dcfc76d 1.7.12 - @headlessui/vue 2023-03-03 21:09:06 +01:00
Robin Malfait 7794d563e1 1.7.11 - @headlessui/vue 2023-02-24 16:29:15 +01:00
Robin Malfait d6d6c20432 1.7.10 - @headlessui/vue 2023-02-15 15:10:40 +01:00
Robin Malfait fc908a1034 1.7.9 - @headlessui/vue 2023-02-03 17:40:08 +01:00
Robin Malfait 63fb14d28f 1.7.8 - @headlessui/vue 2023-01-27 17:24:04 +01:00
Robin Malfait 404c5093e8 1.7.7 - @headlessui/vue 2022-12-16 17:38:33 +01:00
Robin Malfait 79818fc75a 1.7.6 - @headlessui/vue 2022-12-15 17:35:18 +01:00
Robin Malfait 426cbf34c5 1.7.5 - @headlessui/vue 2022-12-08 23:17:02 +01:00
Robin Malfait 74e7b43781 1.7.4 2022-11-03 16:21:15 +01:00
Jordan Pittman fdccf0767a 1.7.3 2022-09-30 11:54:08 -04:00
Robin Malfait dd2feefb9e 1.7.2 2022-09-15 18:31:27 +02:00
Robin Malfait e926d693c5 1.7.1 2022-09-12 21:09:38 +02:00
Robin Malfait b93b7463bc 1.7.0 2022-09-06 16:22:42 +02:00
Robin Malfait 0bdd4b472e 1.6.7 2022-07-12 16:00:55 +02:00
Robin Malfait 3799d6f438 1.6.6 2022-07-07 23:02:52 +02:00
Robin Malfait f4d1acb5d7 1.6.5 2022-06-20 17:57:56 +02:00
Robin Malfait 655107962f 1.6.4 2022-05-29 14:54:44 +02:00
Robin Malfait 3c32369851 1.6.3 2022-05-25 15:18:01 +02:00
Robin Malfait 5f42488439 1.6.2 - @headlessui/vue 2022-05-19 16:33:23 +02:00
Robin Malfait ecdebf3d59 1.6.1 - @headlessui/vue 2022-05-03 13:19:18 +02:00
Robin Malfait 1e14d5159c 1.6.0 2022-04-25 15:58:55 +02:00
Robin Malfait ead5ff851a 1.5.0 2022-02-17 21:51:15 +01:00
Robin Malfait c65b87ee68 improve build files
Based on: https://nodejs.org/api/packages.html#conditional-exports
2022-01-31 00:10:06 +01:00
Jordan Pittman 89fd4b202e Update minimum Vue to 3.2 (#1072)
* Remove vercel json file

* Don't use provide/inject outside of setup

* Upgrade minimum vue version

* Mark vue as an external

* Update lockfile

* WIP move render functions into setup

* WIP

* WIP

* Use setup returning render fns for tests
2022-01-27 13:49:26 -05:00
Robin Malfait fdd2629795 Improve overal codebase, use modern tech like esbuild and TypeScript 4! (#1055)
* use esbuild for React instead of tsdx

* remove tsdx from Vue

* use consistent names

* add jest and prettier

* update scripts

* ignore some folders for prettier

* run lint script instead of tsdx lint

* run prettier en-masse

This has a few changes because of the new prettier version.

* bump typescript to latest version

* make typescript happy

* cleanup playground package.json

* make esbuild a dev dependency

* make scripts consistent

* fix husky hooks

* add dedicated watch script

* add `yarn playground-react` and `yarn react-playground` (alias)

This will make sure to run a watcher for the actual @headlessui/react
package, and start a development server in the playground-react package.

* ignore formatting in the .next folder

* run prettier on playground-react package

* setup playground-vue

Still not 100% working, but getting there!

* add playground aliases in @headlessui/vue and @headlessui/react

This allows you to run `yarn react playground` or `yarn vue playground`
from the root.

* add `clean` script

* move examples folder in playground-vue to root

* ensure new lines for consistency in scripts

* fix typescript issue

* fix typescript issues in playgrounds

* make sure to run prettier on everything it can

* run prettier on all files

* improve error output

If you minify the code, then it could happen that the errors are a bit
obscure. This will hardcode the component name to improve errors.

* add the `prettier-plugin-tailwindcss` plugin, party!

* update changelog
2022-01-27 17:07:38 +01:00
Robin Malfait cae976a18b Remove playground (#1053)
* remove local testing playgrounds

* bump outdated packages
2022-01-19 16:51:09 +01:00
Robin Malfait 147963424a 1.4.3 2022-01-14 18:44:12 +01:00
Robin Malfait 2f987be5b9 bump to 1.4.2 2021-11-08 11:15:43 +01:00
Vemund Santi c57eb60a26 Enable tree shaking in Vue package (#859) 2021-10-29 11:32:16 +02:00
Robin Malfait 452b2c2852 bump version to 1.4.1 2021-08-30 14:23:52 +02:00
Robin Malfait d25f80ae9d bump version to 1.4.0 2021-07-29 12:56:11 +02:00
Robin Malfait da314b6b79 bump version to 1.3.0 2021-06-21 11:47:06 +02:00
Robin Malfait a8bbd0ecee bump versions 2021-05-10 12:08:05 +02:00
Robin Malfait 7d517f6413 bump versions 2021-04-28 10:34:50 +02:00
Robin Malfait 719db69123 bump version to 1.1.0 2021-04-26 15:47:43 +02:00
Robin Malfait 6722e9e79f bump version to 1.0! 2021-04-14 17:42:58 +02:00
Robin Malfait c88b53eac1 provide description in package.json
Also making sure that the README is being published.
2021-04-14 17:41:48 +02:00
Robin Malfait 67d09e1c27 bump versions 2021-04-02 15:22:35 +02:00
Robin Malfait 5da253b831 backfill fixes (#299)
* fix unique symbol error (#248)

* Vue breaking change (#279)

* bump Vue

* ensure we reference the vite.config.js

* fix event name casing

Vue broke this in a 3.0.5 release, it still worked in 3.0.4.

Fixes: #267

* handle throwing while rendering a better in tests
2021-04-02 15:18:47 +02:00
Robin Malfait 43effbbe29 v0.3.0 2021-02-06 16:30:08 +01:00
Robin Malfait 9b0d9e136a bump dependencies (#177)
* bump root dependencies

* bump react related dependencies

* update browserslist db

* remove obsolete shared dependency
2021-01-29 15:14:59 +01:00