Skip to content

Commit

Permalink
Merge pull request #91 from yummy-recipes/renovate/headlessui-react-2.x
Browse files Browse the repository at this point in the history
Update dependency @headlessui/react to v2
  • Loading branch information
ertrzyiks authored Jan 4, 2025
2 parents 18d9fd7 + 1e78208 commit e23e751
Show file tree
Hide file tree
Showing 3 changed files with 175 additions and 33 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"prepare": "husky"
},
"dependencies": {
"@headlessui/react": "1.7.19",
"@headlessui/react": "2.2.0",
"@heroicons/react": "2.2.0",
"@prisma/client": "6.1.0",
"@tanstack/react-query": "4.36.1",
Expand Down
39 changes: 19 additions & 20 deletions src/components/search/search.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
"use client";
import { Fragment, useState } from "react";
import { Combobox, Transition } from "@headlessui/react";
import {
Combobox,
ComboboxInput,
ComboboxButton,
ComboboxOptions,
ComboboxOption,
Transition,
} from "@headlessui/react";
import { useRouter } from "next/navigation";
import {
useQuery,
Expand Down Expand Up @@ -42,12 +49,13 @@ function SearchForm({
}: Props) {
return (
<div className="top-16 w-full">
<Combobox
onChange={(recipe: { value: string }) => onSelected(recipe.value)}
<Combobox<null | { value: string }>
value={null}
onChange={(recipe) => recipe && onSelected(recipe.value)}
>
<div className="relative mt-1">
<div className="relative w-full cursor-default bg-white text-left focus:outline-none focus-visible:ring-3 focus-visible:ring-sky-300 focus-visible:ring-opacity-75 focus-visible:ring-offset-2 focus-visible:ring-offset-teal-300 sm:text-sm">
<Combobox.Input
<ComboboxInput
className="w-full rounded-full border border-solid border-gray-200 py-2 pl-3 pr-10 text-sm leading-5 text-gray-900 focus:ring-0"
displayValue={(person: { name: string } | null) =>
person ? person.name : ""
Expand All @@ -56,12 +64,12 @@ function SearchForm({
autoComplete="off"
placeholder="Szukaj"
/>
<Combobox.Button className="absolute inset-y-0 right-0 flex items-center pr-2">
<ComboboxButton className="absolute inset-y-0 right-0 flex items-center pr-2">
<MagnifyingGlassIcon
className="h-5 w-5 text-gray-400"
aria-hidden="true"
/>
</Combobox.Button>
</ComboboxButton>
</div>
<Transition
as={Fragment}
Expand All @@ -70,17 +78,17 @@ function SearchForm({
leaveTo="opacity-0"
afterLeave={() => onChange("")}
>
<Combobox.Options className="empty:hidden absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm">
<ComboboxOptions className="empty:hidden absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm">
{results?.length === 0 && query.length > 2 && !loading ? (
<div className="relative cursor-default select-none py-2 px-4 text-gray-700">
Brak wyników
</div>
) : (
(results ?? []).map((recipe) => (
<Combobox.Option
<ComboboxOption
key={recipe.id}
className={({ active }) =>
`relative cursor-default select-none py-2 pl-10 pr-4 ${
`relative cursor-default select-none py-2 px-4 ${
active ? "bg-teal-600 text-white" : "text-gray-900"
}`
}
Expand All @@ -95,21 +103,12 @@ function SearchForm({
>
{recipe.label}
</span>
{selected ? (
<span
className={`absolute inset-y-0 left-0 flex items-center pl-3 ${
active ? "text-white" : "text-teal-600"
}`}
>
<CheckIcon className="h-5 w-5" aria-hidden="true" />
</span>
) : null}
</>
)}
</Combobox.Option>
</ComboboxOption>
))
)}
</Combobox.Options>
</ComboboxOptions>
</Transition>
</div>
</Combobox>
Expand Down
167 changes: 155 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2207,6 +2207,25 @@ __metadata:
languageName: node
linkType: hard

"@floating-ui/core@npm:^1.6.0":
version: 1.6.8
resolution: "@floating-ui/core@npm:1.6.8"
dependencies:
"@floating-ui/utils": "npm:^0.2.8"
checksum: 10/87d52989c3d2cc80373bc153b7a40814db3206ce7d0b2a2bdfb63e2ff39ffb8b999b1b0ccf28e548000ebf863bf16e2bed45eab4c4d287a5dbe974ef22368d82
languageName: node
linkType: hard

"@floating-ui/dom@npm:^1.0.0":
version: 1.6.12
resolution: "@floating-ui/dom@npm:1.6.12"
dependencies:
"@floating-ui/core": "npm:^1.6.0"
"@floating-ui/utils": "npm:^0.2.8"
checksum: 10/5c8e5fdcd3843140a606ab6dc6c12ad740f44e66b898966ef877393faaede0bbe14586e1049e2c2f08856437da8847e884a2762e78275fefa65a5a9cd71e580d
languageName: node
linkType: hard

"@floating-ui/dom@npm:^1.3.0":
version: 1.5.1
resolution: "@floating-ui/dom@npm:1.5.1"
Expand All @@ -2229,23 +2248,58 @@ __metadata:
languageName: node
linkType: hard

"@floating-ui/react-dom@npm:^2.1.2":
version: 2.1.2
resolution: "@floating-ui/react-dom@npm:2.1.2"
dependencies:
"@floating-ui/dom": "npm:^1.0.0"
peerDependencies:
react: ">=16.8.0"
react-dom: ">=16.8.0"
checksum: 10/2a67dc8499674e42ff32c7246bded185bb0fdd492150067caf9568569557ac4756a67787421d8604b0f241e5337de10762aee270d9aeef106d078a0ff13596c4
languageName: node
linkType: hard

"@floating-ui/react@npm:^0.26.16":
version: 0.26.28
resolution: "@floating-ui/react@npm:0.26.28"
dependencies:
"@floating-ui/react-dom": "npm:^2.1.2"
"@floating-ui/utils": "npm:^0.2.8"
tabbable: "npm:^6.0.0"
peerDependencies:
react: ">=16.8.0"
react-dom: ">=16.8.0"
checksum: 10/7f8e6b27db48b68ca94756687af21857be04e7360ac922d7c8e22411f2895df6384af7bd40f4b48663d3cc5809bb5c6574cd9c9ea15543ec747b9a8e1c8c3008
languageName: node
linkType: hard

"@floating-ui/utils@npm:^0.1.1":
version: 0.1.1
resolution: "@floating-ui/utils@npm:0.1.1"
checksum: 10/ba1a6d073f8af4290f9d0ecf2ca73f97a742ed9bae060bf4aec604db5642a6cc7aa38041c2c1a1ffb0dd1c99549bbfde3dc61202ad7cb91a963d2b2eea747719
languageName: node
linkType: hard

"@headlessui/react@npm:1.7.19":
version: 1.7.19
resolution: "@headlessui/react@npm:1.7.19"
"@floating-ui/utils@npm:^0.2.8":
version: 0.2.8
resolution: "@floating-ui/utils@npm:0.2.8"
checksum: 10/3e3ea3b2de06badc4baebdf358b3dbd77ccd9474a257a6ef237277895943db2acbae756477ec64de65a2a1436d94aea3107129a1feeef6370675bf2b161c1abc
languageName: node
linkType: hard

"@headlessui/react@npm:2.2.0":
version: 2.2.0
resolution: "@headlessui/react@npm:2.2.0"
dependencies:
"@tanstack/react-virtual": "npm:^3.0.0-beta.60"
client-only: "npm:^0.0.1"
"@floating-ui/react": "npm:^0.26.16"
"@react-aria/focus": "npm:^3.17.1"
"@react-aria/interactions": "npm:^3.21.3"
"@tanstack/react-virtual": "npm:^3.8.1"
peerDependencies:
react: ^16 || ^17 || ^18
react-dom: ^16 || ^17 || ^18
checksum: 10/682dddfb53e4dc1e457f47fa3ee3a35ad02255b552eec90e703a2b4cb6b07428da7c392844c24ac846e8061cd0fb840e1933b6b91b5416fde3d2648f075a6765
react: ^18 || ^19 || ^19.0.0-rc
react-dom: ^18 || ^19 || ^19.0.0-rc
checksum: 10/baaa65f2cadf87d6ef5a15de5c8e532b79f491258166af6f3fe7b05a9196de4db9f3414b62192b4588c610786acb6623e3d775fc23d9001f6b31d13c4a5854c1
languageName: node
linkType: hard

Expand Down Expand Up @@ -3275,6 +3329,81 @@ __metadata:
languageName: node
linkType: hard

"@react-aria/focus@npm:^3.17.1":
version: 3.19.0
resolution: "@react-aria/focus@npm:3.19.0"
dependencies:
"@react-aria/interactions": "npm:^3.22.5"
"@react-aria/utils": "npm:^3.26.0"
"@react-types/shared": "npm:^3.26.0"
"@swc/helpers": "npm:^0.5.0"
clsx: "npm:^2.0.0"
peerDependencies:
react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
checksum: 10/4b507c382ce83b698637464094257af23abdfa1a096486cdf898d0e8db120dcd87035b59dab8855180cc1671e89d410b8812936100a1502ead01f80b52dfa4e9
languageName: node
linkType: hard

"@react-aria/interactions@npm:^3.21.3, @react-aria/interactions@npm:^3.22.5":
version: 3.22.5
resolution: "@react-aria/interactions@npm:3.22.5"
dependencies:
"@react-aria/ssr": "npm:^3.9.7"
"@react-aria/utils": "npm:^3.26.0"
"@react-types/shared": "npm:^3.26.0"
"@swc/helpers": "npm:^0.5.0"
peerDependencies:
react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
checksum: 10/058fbbfd295471bde94cbe6501d5ebb64d1371c455e43c8c55daf6edd02983f73eb1eb716dd03b96c275aed26fa16a355a35f3daffefc54904576d5d26b4458e
languageName: node
linkType: hard

"@react-aria/ssr@npm:^3.9.7":
version: 3.9.7
resolution: "@react-aria/ssr@npm:3.9.7"
dependencies:
"@swc/helpers": "npm:^0.5.0"
peerDependencies:
react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
checksum: 10/a5c8e9ffee1dfd3c5b9f66051a7faab11d53ba001ac7f476b61fa4b38fd8b4835c1a85ff2157ec25fb5b63beb88fbae9e80610fa065a30cbe30875fcbca3114b
languageName: node
linkType: hard

"@react-aria/utils@npm:^3.26.0":
version: 3.26.0
resolution: "@react-aria/utils@npm:3.26.0"
dependencies:
"@react-aria/ssr": "npm:^3.9.7"
"@react-stately/utils": "npm:^3.10.5"
"@react-types/shared": "npm:^3.26.0"
"@swc/helpers": "npm:^0.5.0"
clsx: "npm:^2.0.0"
peerDependencies:
react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
checksum: 10/484cfbc553b3313d291a78bbfd3fcc435ce36b7fc5408935be027f22f41e73b69306d67aa0bcf5e010f0059d4a6776217110f95012001699fc9d37da54963c7b
languageName: node
linkType: hard

"@react-stately/utils@npm:^3.10.5":
version: 3.10.5
resolution: "@react-stately/utils@npm:3.10.5"
dependencies:
"@swc/helpers": "npm:^0.5.0"
peerDependencies:
react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
checksum: 10/76133eb64fa945216e51d8a81a0ebd06eeb78aa2d9c91d79eeb80ff44c70a6b0d6d940618b31b499fee8216640b3bf6183391151dc1769e756b56ff6b5e167ec
languageName: node
linkType: hard

"@react-types/shared@npm:^3.26.0":
version: 3.26.0
resolution: "@react-types/shared@npm:3.26.0"
peerDependencies:
react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
checksum: 10/82d212b1712faf86141b3993204b7155f8a053c3c8091de095889097c0f923519c4e5eb26285c0e8764ab1540f495235c7b3fbdc39f38b1a8711661eee43cbf4
languageName: node
linkType: hard

"@rollup/rollup-android-arm-eabi@npm:4.29.1":
version: 4.29.1
resolution: "@rollup/rollup-android-arm-eabi@npm:4.29.1"
Expand Down Expand Up @@ -4203,7 +4332,7 @@ __metadata:
languageName: node
linkType: hard

"@swc/helpers@npm:0.5.15":
"@swc/helpers@npm:0.5.15, @swc/helpers@npm:^0.5.0":
version: 0.5.15
resolution: "@swc/helpers@npm:0.5.15"
dependencies:
Expand Down Expand Up @@ -4238,7 +4367,7 @@ __metadata:
languageName: node
linkType: hard

"@tanstack/react-virtual@npm:^3.0.0-beta.60":
"@tanstack/react-virtual@npm:^3.8.1":
version: 3.11.2
resolution: "@tanstack/react-virtual@npm:3.11.2"
dependencies:
Expand Down Expand Up @@ -6227,13 +6356,20 @@ __metadata:
languageName: node
linkType: hard

"client-only@npm:0.0.1, client-only@npm:^0.0.1":
"client-only@npm:0.0.1":
version: 0.0.1
resolution: "client-only@npm:0.0.1"
checksum: 10/0c16bf660dadb90610553c1d8946a7fdfb81d624adea073b8440b7d795d5b5b08beb3c950c6a2cf16279365a3265158a236876d92bce16423c485c322d7dfaf8
languageName: node
linkType: hard

"clsx@npm:^2.0.0":
version: 2.1.1
resolution: "clsx@npm:2.1.1"
checksum: 10/cdfb57fa6c7649bbff98d9028c2f0de2f91c86f551179541cf784b1cfdc1562dcb951955f46d54d930a3879931a980e32a46b598acaea274728dbe068deca919
languageName: node
linkType: hard

"color-convert@npm:^1.9.0":
version: 1.9.3
resolution: "color-convert@npm:1.9.3"
Expand Down Expand Up @@ -13159,6 +13295,13 @@ __metadata:
languageName: node
linkType: hard

"tabbable@npm:^6.0.0":
version: 6.2.0
resolution: "tabbable@npm:6.2.0"
checksum: 10/980fa73476026e99dcacfc0d6e000d41d42c8e670faf4682496d30c625495e412c4369694f2a15cf1e5252d22de3c396f2b62edbe8d60b5dadc40d09e3f2dde3
languageName: node
linkType: hard

"tailwindcss@npm:3.4.17":
version: 3.4.17
resolution: "tailwindcss@npm:3.4.17"
Expand Down Expand Up @@ -14330,7 +14473,7 @@ __metadata:
resolution: "yummy@workspace:."
dependencies:
"@chromatic-com/storybook": "npm:3.2.3"
"@headlessui/react": "npm:1.7.19"
"@headlessui/react": "npm:2.2.0"
"@heroicons/react": "npm:2.2.0"
"@prisma/client": "npm:6.1.0"
"@storybook/addon-essentials": "npm:8.4.7"
Expand Down

0 comments on commit e23e751

Please sign in to comment.