From be8e0da0bf3dd632c6bc7c83cfb7e55146c6526b Mon Sep 17 00:00:00 2001 From: Karl Kallavus <232199+karl-kallavus@users.noreply.github.com> Date: Mon, 23 Oct 2023 10:41:47 +0200 Subject: [PATCH] feat: examples of alignment of list controls (#2447) --- next-docs/pages/components/combobox.tsx | 7 + .../examples/combobox/LongNameOptions.tsx | 133 +++ .../__snapshots__/index.test.tsx.snap | 932 ++++++++++++++---- .../combobox/__tests__/index.test.tsx | 9 + 4 files changed, 894 insertions(+), 187 deletions(-) create mode 100644 next-docs/public/examples/combobox/LongNameOptions.tsx diff --git a/next-docs/pages/components/combobox.tsx b/next-docs/pages/components/combobox.tsx index 958af9b2a3..e26da41401 100644 --- a/next-docs/pages/components/combobox.tsx +++ b/next-docs/pages/components/combobox.tsx @@ -9,6 +9,7 @@ import Default from '../../public/examples/combobox/Default'; import InsetMultiSelect from '../../public/examples/combobox/InsetMultiSelect'; import InsetSelect from '../../public/examples/combobox/InsetSelect'; import InsetSelectStates from '../../public/examples/combobox/InsetSelectStates'; +import LongNameOptions from '../../public/examples/combobox/LongNameOptions'; import MultiAllSelect from '../../public/examples/combobox/MultiAllSelect'; import MultiSelect from '../../public/examples/combobox/MultiSelect'; import Select from '../../public/examples/combobox/Select'; @@ -157,6 +158,12 @@ const PageCombobox = () => { code={examples ? examples.VisualMultiSelect : 'Loading'} /> + } + code={examples ? examples.LongNameOptions : 'Loading'} + /> + { + return query === '' + ? people + : people.filter(({ value }) => + value + .toLowerCase() + .replace(/\s+/g, '') + .includes(query.toLowerCase().replace(/\s+/g, '')) + ); +}; + +const Example = () => { + const [selected0, setSelected0] = useState([]); + const [selected1, setSelected1] = useState({}); + + const [query0, setQuery0] = useState(''); + const [query1, setQuery1] = useState(''); + + const filteredPeople0 = filter(query0, books); + const filteredPeople1 = filter(query1, books); + + return ( +
+ setSelected0([]), [setSelected0])} + className="w-full max-w-xs" + multiple + > + {({ open }) => ( + <> + label} + onClose={console.log} + > + + + + + {filteredPeople0.length === 0 && query0 !== '' ? ( +
+ Nothing found. +
+ ) : ( + filteredPeople0.map((person, index) => ( + + {({ selected, active }) => ( + + {person.label} + + + )} + + )) + )} +
+
+ Example with checkboxes + + )} +
+ + + {({ open }) => ( + <> + label} + > + + + + + {filteredPeople1.length === 0 && query1 !== '' ? ( +
+ Nothing found. +
+ ) : ( + filteredPeople1.map((person, index) => ( + + {({ selected, active }) => ( + + {person.label} + + + )} + + )) + )} +
+
+ Example with radio buttons + + )} +
+
+ ); +} + +export default Example; diff --git a/next-docs/public/examples/combobox/__tests__/__snapshots__/index.test.tsx.snap b/next-docs/public/examples/combobox/__tests__/__snapshots__/index.test.tsx.snap index 675bc98288..e1d7e7a523 100644 --- a/next-docs/public/examples/combobox/__tests__/__snapshots__/index.test.tsx.snap +++ b/next-docs/public/examples/combobox/__tests__/__snapshots__/index.test.tsx.snap @@ -23,7 +23,7 @@ Object { aria-expanded="false" class="block w-full max-w-full py-0 m-0 appearance-none text-bulma transition-shadow box-border relative z-[2] shadow-input hover:shadow-input-hov focus:shadow-input-focus focus:outline-none focus-visible::shadow-input-focus focus-visible::outline-none before:box-border after:box-border placeholder:delay-75 placeholder:text-trunks placeholder:opacity-100 placeholder:transition-opacity read-only:outline-0 read-only:border-none read-only:cursor-not-allowed read-only:hover:shadow-input read-only:focus:shadow-input read-only:focus-visible:shadow-input invalid:focus-visible:shadow-input-err invalid:shadow-input-err invalid:hover:shadow-input-err invalid:focus:shadow-input-err rounded-moon-i-sm input-dt-shared flex-grow h-full border-0 !rounded-none bg-transparent px-0 !shadow-none hover:shadow-none focus:shadow-none focus-visible:shadow-none text-moon-16 leading-5" data-headlessui-state="" - id="headlessui-combobox-input-:r24:" + id="headlessui-combobox-input-:r2a:" placeholder="Choose a name..." role="combobox" type="text" @@ -35,7 +35,7 @@ Object { aria-label="Open" class="w-6 h-6 text-moon-24 text-bulma transition-transform flex-grow-0 flex-shrink-0 self-center" data-headlessui-state="" - id="headlessui-combobox-button-:r25:" + id="headlessui-combobox-button-:r2b:" tabindex="-1" type="button" > @@ -74,7 +74,7 @@ Object { aria-expanded="false" class="block w-full max-w-full py-0 m-0 appearance-none text-bulma transition-shadow box-border relative z-[2] shadow-input hover:shadow-input-hov focus:shadow-input-focus focus:outline-none focus-visible::shadow-input-focus focus-visible::outline-none before:box-border after:box-border placeholder:delay-75 placeholder:text-trunks placeholder:opacity-100 placeholder:transition-opacity read-only:outline-0 read-only:border-none read-only:cursor-not-allowed read-only:hover:shadow-input read-only:focus:shadow-input read-only:focus-visible:shadow-input invalid:focus-visible:shadow-input-err invalid:shadow-input-err invalid:hover:shadow-input-err invalid:focus:shadow-input-err rounded-moon-i-sm input-dt-shared flex-grow h-full border-0 !rounded-none bg-transparent px-0 !shadow-none hover:shadow-none focus:shadow-none focus-visible:shadow-none text-moon-16 leading-5" data-headlessui-state="" - id="headlessui-combobox-input-:r26:" + id="headlessui-combobox-input-:r2c:" placeholder="Choose a name..." role="combobox" type="text" @@ -86,7 +86,7 @@ Object { aria-label="Open" class="w-6 h-6 text-moon-24 text-bulma transition-transform flex-grow-0 flex-shrink-0 self-center" data-headlessui-state="" - id="headlessui-combobox-button-:r27:" + id="headlessui-combobox-button-:r2d:" tabindex="-1" type="button" > @@ -136,7 +136,7 @@ Object { aria-expanded="false" class="block w-full max-w-full py-0 m-0 appearance-none text-bulma transition-shadow box-border relative z-[2] shadow-input hover:shadow-input-hov focus:shadow-input-focus focus:outline-none focus-visible::shadow-input-focus focus-visible::outline-none before:box-border after:box-border placeholder:delay-75 placeholder:text-trunks placeholder:opacity-100 placeholder:transition-opacity read-only:outline-0 read-only:border-none read-only:cursor-not-allowed read-only:hover:shadow-input read-only:focus:shadow-input read-only:focus-visible:shadow-input invalid:focus-visible:shadow-input-err invalid:shadow-input-err invalid:hover:shadow-input-err invalid:focus:shadow-input-err rounded-moon-i-sm input-dt-shared flex-grow h-full border-0 !rounded-none bg-transparent px-0 !shadow-none hover:shadow-none focus:shadow-none focus-visible:shadow-none text-moon-16 leading-5" data-headlessui-state="" - id="headlessui-combobox-input-:r24:" + id="headlessui-combobox-input-:r2a:" placeholder="Choose a name..." role="combobox" type="text" @@ -148,7 +148,7 @@ Object { aria-label="Open" class="w-6 h-6 text-moon-24 text-bulma transition-transform flex-grow-0 flex-shrink-0 self-center" data-headlessui-state="" - id="headlessui-combobox-button-:r25:" + id="headlessui-combobox-button-:r2b:" tabindex="-1" type="button" > @@ -187,7 +187,7 @@ Object { aria-expanded="false" class="block w-full max-w-full py-0 m-0 appearance-none text-bulma transition-shadow box-border relative z-[2] shadow-input hover:shadow-input-hov focus:shadow-input-focus focus:outline-none focus-visible::shadow-input-focus focus-visible::outline-none before:box-border after:box-border placeholder:delay-75 placeholder:text-trunks placeholder:opacity-100 placeholder:transition-opacity read-only:outline-0 read-only:border-none read-only:cursor-not-allowed read-only:hover:shadow-input read-only:focus:shadow-input read-only:focus-visible:shadow-input invalid:focus-visible:shadow-input-err invalid:shadow-input-err invalid:hover:shadow-input-err invalid:focus:shadow-input-err rounded-moon-i-sm input-dt-shared flex-grow h-full border-0 !rounded-none bg-transparent px-0 !shadow-none hover:shadow-none focus:shadow-none focus-visible:shadow-none text-moon-16 leading-5" data-headlessui-state="" - id="headlessui-combobox-input-:r26:" + id="headlessui-combobox-input-:r2c:" placeholder="Choose a name..." role="combobox" type="text" @@ -199,7 +199,7 @@ Object { aria-label="Open" class="w-6 h-6 text-moon-24 text-bulma transition-transform flex-grow-0 flex-shrink-0 self-center" data-headlessui-state="" - id="headlessui-combobox-button-:r27:" + id="headlessui-combobox-button-:r2d:" tabindex="-1" type="button" > @@ -309,7 +309,7 @@ Object { aria-expanded="false" class="block w-full max-w-full py-0 m-0 appearance-none text-bulma transition-shadow box-border relative z-[2] shadow-input hover:shadow-input-hov focus:shadow-input-focus focus:outline-none focus-visible::shadow-input-focus focus-visible::outline-none before:box-border after:box-border placeholder:delay-75 placeholder:text-trunks placeholder:opacity-100 placeholder:transition-opacity read-only:outline-0 read-only:border-none read-only:cursor-not-allowed read-only:hover:shadow-input read-only:focus:shadow-input read-only:focus-visible:shadow-input invalid:focus-visible:shadow-input-err invalid:shadow-input-err invalid:hover:shadow-input-err invalid:focus:shadow-input-err rounded-moon-i-sm input-dt-shared flex-grow h-full border-0 !rounded-none bg-transparent px-0 !shadow-none hover:shadow-none focus:shadow-none focus-visible:shadow-none pt-3 input-xl-dt-label text-moon-16 leading-5" data-headlessui-state="" - id="headlessui-combobox-input-:r29:" + id="headlessui-combobox-input-:r2f:" placeholder="Choose an option" role="combobox" type="text" @@ -327,7 +327,7 @@ Object { aria-label="Open" class="w-6 h-6 text-moon-24 text-bulma transition-transform flex-grow-0 flex-shrink-0 self-center" data-headlessui-state="" - id="headlessui-combobox-button-:r2a:" + id="headlessui-combobox-button-:r2g:" tabindex="-1" type="button" > @@ -380,7 +380,7 @@ Object { aria-expanded="false" class="block w-full max-w-full py-0 m-0 appearance-none text-bulma transition-shadow box-border relative z-[2] shadow-input hover:shadow-input-hov focus:shadow-input-focus focus:outline-none focus-visible::shadow-input-focus focus-visible::outline-none before:box-border after:box-border placeholder:delay-75 placeholder:text-trunks placeholder:opacity-100 placeholder:transition-opacity read-only:outline-0 read-only:border-none read-only:cursor-not-allowed read-only:hover:shadow-input read-only:focus:shadow-input read-only:focus-visible:shadow-input invalid:focus-visible:shadow-input-err invalid:shadow-input-err invalid:hover:shadow-input-err invalid:focus:shadow-input-err rounded-moon-i-sm input-dt-shared flex-grow h-full border-0 !rounded-none bg-transparent px-0 !shadow-none hover:shadow-none focus:shadow-none focus-visible:shadow-none pt-3 input-xl-dt-label text-moon-16 leading-5" data-headlessui-state="" - id="headlessui-combobox-input-:r29:" + id="headlessui-combobox-input-:r2f:" placeholder="Choose an option" role="combobox" type="text" @@ -398,7 +398,7 @@ Object { aria-label="Open" class="w-6 h-6 text-moon-24 text-bulma transition-transform flex-grow-0 flex-shrink-0 self-center" data-headlessui-state="" - id="headlessui-combobox-button-:r2a:" + id="headlessui-combobox-button-:r2g:" tabindex="-1" type="button" > @@ -508,7 +508,7 @@ Object { aria-expanded="false" class="block w-full max-w-full py-0 m-0 appearance-none text-bulma transition-shadow box-border relative z-[2] shadow-input hover:shadow-input-hov focus:shadow-input-focus focus:outline-none focus-visible::shadow-input-focus focus-visible::outline-none before:box-border after:box-border placeholder:delay-75 placeholder:text-trunks placeholder:opacity-100 placeholder:transition-opacity read-only:outline-0 read-only:border-none read-only:cursor-not-allowed read-only:hover:shadow-input read-only:focus:shadow-input read-only:focus-visible:shadow-input invalid:focus-visible:shadow-input-err invalid:shadow-input-err invalid:hover:shadow-input-err invalid:focus:shadow-input-err rounded-moon-i-sm input-dt-shared flex-grow h-full border-0 !rounded-none bg-transparent px-0 !shadow-none hover:shadow-none focus:shadow-none focus-visible:shadow-none pt-3 input-xl-dt-label text-moon-16 leading-5" data-headlessui-state="" - id="headlessui-combobox-input-:r2c:" + id="headlessui-combobox-input-:r2i:" placeholder="Choose an option" role="combobox" type="text" @@ -526,7 +526,7 @@ Object { aria-label="Open" class="w-6 h-6 text-moon-24 text-bulma transition-transform flex-grow-0 flex-shrink-0 self-center" data-headlessui-state="" - id="headlessui-combobox-button-:r2d:" + id="headlessui-combobox-button-:r2j:" tabindex="-1" type="button" > @@ -579,7 +579,7 @@ Object { aria-expanded="false" class="block w-full max-w-full py-0 m-0 appearance-none text-bulma transition-shadow box-border relative z-[2] shadow-input hover:shadow-input-hov focus:shadow-input-focus focus:outline-none focus-visible::shadow-input-focus focus-visible::outline-none before:box-border after:box-border placeholder:delay-75 placeholder:text-trunks placeholder:opacity-100 placeholder:transition-opacity read-only:outline-0 read-only:border-none read-only:cursor-not-allowed read-only:hover:shadow-input read-only:focus:shadow-input read-only:focus-visible:shadow-input invalid:focus-visible:shadow-input-err invalid:shadow-input-err invalid:hover:shadow-input-err invalid:focus:shadow-input-err rounded-moon-i-sm input-dt-shared flex-grow h-full border-0 !rounded-none bg-transparent px-0 !shadow-none hover:shadow-none focus:shadow-none focus-visible:shadow-none pt-3 input-xl-dt-label text-moon-16 leading-5" data-headlessui-state="" - id="headlessui-combobox-input-:r2c:" + id="headlessui-combobox-input-:r2i:" placeholder="Choose an option" role="combobox" type="text" @@ -597,7 +597,7 @@ Object { aria-label="Open" class="w-6 h-6 text-moon-24 text-bulma transition-transform flex-grow-0 flex-shrink-0 self-center" data-headlessui-state="" - id="headlessui-combobox-button-:r2d:" + id="headlessui-combobox-button-:r2j:" tabindex="-1" type="button" > @@ -707,7 +707,7 @@ Object { aria-expanded="false" class="block w-full max-w-full py-0 m-0 appearance-none text-bulma transition-shadow box-border relative z-[2] focus:outline-none focus-visible::shadow-input-focus focus-visible::outline-none before:box-border after:box-border placeholder:delay-75 placeholder:text-trunks placeholder:opacity-100 placeholder:transition-opacity read-only:outline-0 read-only:border-none read-only:cursor-not-allowed read-only:hover:shadow-input read-only:focus:shadow-input read-only:focus-visible:shadow-input invalid:focus-visible:shadow-input-err invalid:shadow-input-err invalid:hover:shadow-input-err invalid:focus:shadow-input-err rounded-moon-i-sm input-dt-shared shadow-input-err hover:shadow-input-err focus:shadow-input-err focus-visible:shadow-input-err flex-grow h-full border-0 !rounded-none bg-transparent px-0 !shadow-none hover:shadow-none focus:shadow-none focus-visible:shadow-none pt-3 input-xl-dt-label text-moon-16 leading-5" data-headlessui-state="" - id="headlessui-combobox-input-:r2f:" + id="headlessui-combobox-input-:r2l:" placeholder="Choose an option" role="combobox" type="text" @@ -725,7 +725,7 @@ Object { aria-label="Open" class="w-6 h-6 text-moon-24 text-bulma transition-transform flex-grow-0 flex-shrink-0 self-center" data-headlessui-state="" - id="headlessui-combobox-button-:r2g:" + id="headlessui-combobox-button-:r2m:" tabindex="-1" type="button" > @@ -768,7 +768,7 @@ Object { class="block w-full max-w-full py-0 m-0 appearance-none text-bulma transition-shadow box-border relative z-[2] shadow-input hover:shadow-input-hov focus:shadow-input-focus focus:outline-none focus-visible::shadow-input-focus focus-visible::outline-none before:box-border after:box-border placeholder:delay-75 placeholder:text-trunks placeholder:opacity-100 placeholder:transition-opacity read-only:outline-0 read-only:border-none read-only:cursor-not-allowed read-only:hover:shadow-input read-only:focus:shadow-input read-only:focus-visible:shadow-input invalid:focus-visible:shadow-input-err invalid:shadow-input-err invalid:hover:shadow-input-err invalid:focus:shadow-input-err rounded-moon-i-sm input-dt-shared opacity-60 cursor-not-allowed flex-grow h-full border-0 !rounded-none bg-transparent px-0 !shadow-none hover:shadow-none focus:shadow-none focus-visible:shadow-none pt-3 input-xl-dt-label text-moon-16 leading-5" data-headlessui-state="disabled" disabled="" - id="headlessui-combobox-input-:r2i:" + id="headlessui-combobox-input-:r2o:" placeholder="Choose an option" role="combobox" type="text" @@ -787,7 +787,7 @@ Object { class="w-6 h-6 text-moon-24 text-bulma transition-transform flex-grow-0 flex-shrink-0 self-center cursor-not-allowed" data-headlessui-state="disabled" disabled="" - id="headlessui-combobox-button-:r2j:" + id="headlessui-combobox-button-:r2p:" tabindex="-1" type="button" > @@ -830,7 +830,7 @@ Object { aria-label="Without placeholder" class="block w-full max-w-full py-0 m-0 appearance-none text-bulma transition-shadow box-border relative z-[2] shadow-input hover:shadow-input-hov focus:shadow-input-focus focus:outline-none focus-visible::shadow-input-focus focus-visible::outline-none before:box-border after:box-border placeholder:delay-75 placeholder:text-trunks placeholder:opacity-100 placeholder:transition-opacity read-only:outline-0 read-only:border-none read-only:cursor-not-allowed read-only:hover:shadow-input read-only:focus:shadow-input read-only:focus-visible:shadow-input invalid:focus-visible:shadow-input-err invalid:shadow-input-err invalid:hover:shadow-input-err invalid:focus:shadow-input-err rounded-moon-i-sm input-dt-shared flex-grow h-full border-0 !rounded-none bg-transparent px-0 !shadow-none hover:shadow-none focus:shadow-none focus-visible:shadow-none input-xl pt-3 input-xl-dt-label text-moon-16 leading-5" data-headlessui-state="" - id="headlessui-combobox-input-:r2l:" + id="headlessui-combobox-input-:r2r:" placeholder="" role="combobox" type="text" @@ -848,7 +848,7 @@ Object { aria-label="Open" class="w-6 h-6 text-moon-24 text-bulma transition-transform flex-grow-0 flex-shrink-0 self-center" data-headlessui-state="" - id="headlessui-combobox-button-:r2m:" + id="headlessui-combobox-button-:r2s:" tabindex="-1" type="button" > @@ -890,7 +890,7 @@ Object { aria-expanded="false" class="block w-full max-w-full py-0 m-0 appearance-none text-bulma transition-shadow box-border relative z-[2] shadow-input hover:shadow-input-hov focus:shadow-input-focus focus:outline-none focus-visible::shadow-input-focus focus-visible::outline-none before:box-border after:box-border placeholder:delay-75 placeholder:text-trunks placeholder:opacity-100 placeholder:transition-opacity read-only:outline-0 read-only:border-none read-only:cursor-not-allowed read-only:hover:shadow-input read-only:focus:shadow-input read-only:focus-visible:shadow-input invalid:focus-visible:shadow-input-err invalid:shadow-input-err invalid:hover:shadow-input-err invalid:focus:shadow-input-err rounded-moon-i-sm input-dt-shared flex-grow h-full border-0 !rounded-none bg-transparent px-0 !shadow-none hover:shadow-none focus:shadow-none focus-visible:shadow-none pt-3 input-xl-dt-label text-moon-16 leading-5" data-headlessui-state="" - id="headlessui-combobox-input-:r2o:" + id="headlessui-combobox-input-:r2u:" placeholder="Choose an option" role="combobox" type="text" @@ -908,7 +908,7 @@ Object { aria-label="Open" class="w-6 h-6 text-moon-24 text-bulma transition-transform flex-grow-0 flex-shrink-0 self-center" data-headlessui-state="" - id="headlessui-combobox-button-:r2p:" + id="headlessui-combobox-button-:r2v:" tabindex="-1" type="button" > @@ -961,7 +961,7 @@ Object { aria-expanded="false" class="block w-full max-w-full py-0 m-0 appearance-none text-bulma transition-shadow box-border relative z-[2] focus:outline-none focus-visible::shadow-input-focus focus-visible::outline-none before:box-border after:box-border placeholder:delay-75 placeholder:text-trunks placeholder:opacity-100 placeholder:transition-opacity read-only:outline-0 read-only:border-none read-only:cursor-not-allowed read-only:hover:shadow-input read-only:focus:shadow-input read-only:focus-visible:shadow-input invalid:focus-visible:shadow-input-err invalid:shadow-input-err invalid:hover:shadow-input-err invalid:focus:shadow-input-err rounded-moon-i-sm input-dt-shared shadow-input-err hover:shadow-input-err focus:shadow-input-err focus-visible:shadow-input-err flex-grow h-full border-0 !rounded-none bg-transparent px-0 !shadow-none hover:shadow-none focus:shadow-none focus-visible:shadow-none pt-3 input-xl-dt-label text-moon-16 leading-5" data-headlessui-state="" - id="headlessui-combobox-input-:r2f:" + id="headlessui-combobox-input-:r2l:" placeholder="Choose an option" role="combobox" type="text" @@ -979,7 +979,7 @@ Object { aria-label="Open" class="w-6 h-6 text-moon-24 text-bulma transition-transform flex-grow-0 flex-shrink-0 self-center" data-headlessui-state="" - id="headlessui-combobox-button-:r2g:" + id="headlessui-combobox-button-:r2m:" tabindex="-1" type="button" > @@ -1022,7 +1022,7 @@ Object { class="block w-full max-w-full py-0 m-0 appearance-none text-bulma transition-shadow box-border relative z-[2] shadow-input hover:shadow-input-hov focus:shadow-input-focus focus:outline-none focus-visible::shadow-input-focus focus-visible::outline-none before:box-border after:box-border placeholder:delay-75 placeholder:text-trunks placeholder:opacity-100 placeholder:transition-opacity read-only:outline-0 read-only:border-none read-only:cursor-not-allowed read-only:hover:shadow-input read-only:focus:shadow-input read-only:focus-visible:shadow-input invalid:focus-visible:shadow-input-err invalid:shadow-input-err invalid:hover:shadow-input-err invalid:focus:shadow-input-err rounded-moon-i-sm input-dt-shared opacity-60 cursor-not-allowed flex-grow h-full border-0 !rounded-none bg-transparent px-0 !shadow-none hover:shadow-none focus:shadow-none focus-visible:shadow-none pt-3 input-xl-dt-label text-moon-16 leading-5" data-headlessui-state="disabled" disabled="" - id="headlessui-combobox-input-:r2i:" + id="headlessui-combobox-input-:r2o:" placeholder="Choose an option" role="combobox" type="text" @@ -1041,7 +1041,7 @@ Object { class="w-6 h-6 text-moon-24 text-bulma transition-transform flex-grow-0 flex-shrink-0 self-center cursor-not-allowed" data-headlessui-state="disabled" disabled="" - id="headlessui-combobox-button-:r2j:" + id="headlessui-combobox-button-:r2p:" tabindex="-1" type="button" > @@ -1084,7 +1084,7 @@ Object { aria-label="Without placeholder" class="block w-full max-w-full py-0 m-0 appearance-none text-bulma transition-shadow box-border relative z-[2] shadow-input hover:shadow-input-hov focus:shadow-input-focus focus:outline-none focus-visible::shadow-input-focus focus-visible::outline-none before:box-border after:box-border placeholder:delay-75 placeholder:text-trunks placeholder:opacity-100 placeholder:transition-opacity read-only:outline-0 read-only:border-none read-only:cursor-not-allowed read-only:hover:shadow-input read-only:focus:shadow-input read-only:focus-visible:shadow-input invalid:focus-visible:shadow-input-err invalid:shadow-input-err invalid:hover:shadow-input-err invalid:focus:shadow-input-err rounded-moon-i-sm input-dt-shared flex-grow h-full border-0 !rounded-none bg-transparent px-0 !shadow-none hover:shadow-none focus:shadow-none focus-visible:shadow-none input-xl pt-3 input-xl-dt-label text-moon-16 leading-5" data-headlessui-state="" - id="headlessui-combobox-input-:r2l:" + id="headlessui-combobox-input-:r2r:" placeholder="" role="combobox" type="text" @@ -1102,7 +1102,7 @@ Object { aria-label="Open" class="w-6 h-6 text-moon-24 text-bulma transition-transform flex-grow-0 flex-shrink-0 self-center" data-headlessui-state="" - id="headlessui-combobox-button-:r2m:" + id="headlessui-combobox-button-:r2s:" tabindex="-1" type="button" > @@ -1144,7 +1144,7 @@ Object { aria-expanded="false" class="block w-full max-w-full py-0 m-0 appearance-none text-bulma transition-shadow box-border relative z-[2] shadow-input hover:shadow-input-hov focus:shadow-input-focus focus:outline-none focus-visible::shadow-input-focus focus-visible::outline-none before:box-border after:box-border placeholder:delay-75 placeholder:text-trunks placeholder:opacity-100 placeholder:transition-opacity read-only:outline-0 read-only:border-none read-only:cursor-not-allowed read-only:hover:shadow-input read-only:focus:shadow-input read-only:focus-visible:shadow-input invalid:focus-visible:shadow-input-err invalid:shadow-input-err invalid:hover:shadow-input-err invalid:focus:shadow-input-err rounded-moon-i-sm input-dt-shared flex-grow h-full border-0 !rounded-none bg-transparent px-0 !shadow-none hover:shadow-none focus:shadow-none focus-visible:shadow-none pt-3 input-xl-dt-label text-moon-16 leading-5" data-headlessui-state="" - id="headlessui-combobox-input-:r2o:" + id="headlessui-combobox-input-:r2u:" placeholder="Choose an option" role="combobox" type="text" @@ -1162,7 +1162,7 @@ Object { aria-label="Open" class="w-6 h-6 text-moon-24 text-bulma transition-transform flex-grow-0 flex-shrink-0 self-center" data-headlessui-state="" - id="headlessui-combobox-button-:r2p:" + id="headlessui-combobox-button-:r2v:" tabindex="-1" type="button" > @@ -1246,7 +1246,7 @@ Object { } `; -exports[`Combobox in RTL renders MultiAllSelect 1`] = ` +exports[`Combobox in RTL renders LongNameOptions 1`] = ` Object { "asFragment": [Function], "baseElement": @@ -1255,7 +1255,7 @@ Object { dir="rtl" >
+
+
+ + +
+
@@ -1317,7 +1368,7 @@ Object { dir="rtl" >
+
+
+ + +
+
@@ -1427,7 +1529,7 @@ Object { } `; -exports[`Combobox in RTL renders MultiSelect 1`] = ` +exports[`Combobox in RTL renders MultiAllSelect 1`] = ` Object { "asFragment": [Function], "baseElement": @@ -1441,71 +1543,6 @@ Object {
- -
- - -
- -
-
- +
+ + + , + "container":
+
+
+
- -
+ +
+ +
+
+
+
, + "debug": [Function], + "findAllByAltText": [Function], + "findAllByDisplayValue": [Function], + "findAllByLabelText": [Function], + "findAllByPlaceholderText": [Function], + "findAllByRole": [Function], + "findAllByTestId": [Function], + "findAllByText": [Function], + "findAllByTitle": [Function], + "findByAltText": [Function], + "findByDisplayValue": [Function], + "findByLabelText": [Function], + "findByPlaceholderText": [Function], + "findByRole": [Function], + "findByTestId": [Function], + "findByText": [Function], + "findByTitle": [Function], + "getAllByAltText": [Function], + "getAllByDisplayValue": [Function], + "getAllByLabelText": [Function], + "getAllByPlaceholderText": [Function], + "getAllByRole": [Function], + "getAllByTestId": [Function], + "getAllByText": [Function], + "getAllByTitle": [Function], + "getByAltText": [Function], + "getByDisplayValue": [Function], + "getByLabelText": [Function], + "getByPlaceholderText": [Function], + "getByRole": [Function], + "getByTestId": [Function], + "getByText": [Function], + "getByTitle": [Function], + "queryAllByAltText": [Function], + "queryAllByDisplayValue": [Function], + "queryAllByLabelText": [Function], + "queryAllByPlaceholderText": [Function], + "queryAllByRole": [Function], + "queryAllByTestId": [Function], + "queryAllByText": [Function], + "queryAllByTitle": [Function], + "queryByAltText": [Function], + "queryByDisplayValue": [Function], + "queryByLabelText": [Function], + "queryByPlaceholderText": [Function], + "queryByRole": [Function], + "queryByTestId": [Function], + "queryByText": [Function], + "queryByTitle": [Function], + "rerender": [Function], + "unmount": [Function], +} +`; + +exports[`Combobox in RTL renders MultiSelect 1`] = ` +Object { + "asFragment": [Function], + "baseElement": +
+
+
+
+ +
+ + +
+ +
+
+ +
+ + +
+ +
+
+ +
+ + +
+ +
+
+
+ + +
+ +
+
+
+ , + "container":
+
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
, + "debug": [Function], + "findAllByAltText": [Function], + "findAllByDisplayValue": [Function], + "findAllByLabelText": [Function], + "findAllByPlaceholderText": [Function], + "findAllByRole": [Function], + "findAllByTestId": [Function], + "findAllByText": [Function], + "findAllByTitle": [Function], + "findByAltText": [Function], + "findByDisplayValue": [Function], + "findByLabelText": [Function], + "findByPlaceholderText": [Function], + "findByRole": [Function], + "findByTestId": [Function], + "findByText": [Function], + "findByTitle": [Function], + "getAllByAltText": [Function], + "getAllByDisplayValue": [Function], + "getAllByLabelText": [Function], + "getAllByPlaceholderText": [Function], + "getAllByRole": [Function], + "getAllByTestId": [Function], + "getAllByText": [Function], + "getAllByTitle": [Function], + "getByAltText": [Function], + "getByDisplayValue": [Function], + "getByLabelText": [Function], + "getByPlaceholderText": [Function], + "getByRole": [Function], + "getByTestId": [Function], + "getByText": [Function], + "getByTitle": [Function], + "queryAllByAltText": [Function], + "queryAllByDisplayValue": [Function], + "queryAllByLabelText": [Function], + "queryAllByPlaceholderText": [Function], + "queryAllByRole": [Function], + "queryAllByTestId": [Function], + "queryAllByText": [Function], + "queryAllByTitle": [Function], + "queryByAltText": [Function], + "queryByDisplayValue": [Function], + "queryByLabelText": [Function], + "queryByPlaceholderText": [Function], + "queryByRole": [Function], + "queryByTestId": [Function], + "queryByText": [Function], + "queryByTitle": [Function], + "rerender": [Function], + "unmount": [Function], +} +`; + exports[`Combobox renders MultiAllSelect 1`] = ` Object { "asFragment": [Function], diff --git a/next-docs/public/examples/combobox/__tests__/index.test.tsx b/next-docs/public/examples/combobox/__tests__/index.test.tsx index 622cb844cd..fa3ff217ef 100644 --- a/next-docs/public/examples/combobox/__tests__/index.test.tsx +++ b/next-docs/public/examples/combobox/__tests__/index.test.tsx @@ -7,6 +7,7 @@ import Default from '../Default'; import InsetMultiSelect from '../InsetMultiSelect'; import InsetSelect from '../InsetSelect'; import InsetSelectStates from '../InsetSelectStates'; +import LongNameOptions from '../LongNameOptions'; import MultiAllSelect from '../MultiAllSelect'; import MultiSelect from '../MultiSelect'; import Select from '../Select'; @@ -53,6 +54,10 @@ describe('Combobox', () => { const tree = render(); expect(tree).toMatchSnapshot(); }); + it('renders LongNameOptions', () => { + const tree = render(); + expect(tree).toMatchSnapshot(); + }); }); describe('Combobox in RTL', () => { @@ -93,4 +98,8 @@ describe('Combobox in RTL', () => { const tree = render(withRtl()); expect(tree).toMatchSnapshot(); }); + it('renders LongNameOptions', () => { + const tree = render(withRtl()); + expect(tree).toMatchSnapshot(); + }); });