Releases: qwikifiers/qwik-ui
@qwik-ui/[email protected]
Minor Changes
-
tailwind.config.cjs (by @maiieul in #753)
tailwindcss-animate
The tailwind config now uses tailwindcss-animate
plugins: [ require('tailwindcss-animate'), ... ],
Instead of manually defined animations through a custom plugin like
plugins: [ plugin(function ({ addUtilities }) { addUtilities({ '.appear': { opacity: 1, }, '.disappear': { opacity: 0, }, }); }), ];
New keyframes
We added
animation: { 'accordion-up': 'collapsible-up 0.2s ease-out 0s 1 normal forwards', 'accordion-down': 'collapsible-down 0.2s ease-out 0s 1 normal forwards', }, keyframes: { 'collapsible-down': { from: { height: '0' }, to: { height: 'var(--qwikui-collapsible-content-height)' }, }, 'collapsible-up': { from: { height: 'var(--qwikui-collapsible-content-height)' }, to: { height: '0' }, }, },
to the tailwind config. You will need those for the styled accordion to be animated.
Modal refactor
Modal.Panel
The Panel now uses tailwindcss-animate and comes built-in with 5
position
variant propsexport const panelVariants = cva( [ 'fixed w-full bg-background p-6 text-foreground transition-all backdrop:brightness-50 backdrop:backdrop-blur-sm', 'data-[closing]:duration-300 data-[open]:duration-300 data-[open]:animate-in data-[closing]:animate-out', 'backdrop:data-[closing]:duration-300 backdrop:data-[open]:duration-300 backdrop:data-[open]:animate-in backdrop:data-[closing]:animate-out backdrop:data-[closing]:fade-out backdrop:data-[open]:fade-in', ], { variants: { position: { center: 'max-w-lg rounded-base shadow-lg data-[state=closed]:fade-out data-[state=open]:fade-in data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-bottom-2 backdrop:data-[closing]:fade-out backdrop:data-[open]:fade-in', top: 'inset-x-0 top-0 mt-0 rounded-b-base border-b data-[closing]:slide-out-to-top data-[open]:slide-in-from-top', bottom: 'inset-x-0 bottom-0 mb-0 rounded-t-base border-t data-[closing]:slide-out-to-bottom data-[open]:slide-in-from-bottom', left: 'inset-y-0 left-0 ml-0 h-full max-w-sm rounded-r-base border-r data-[closing]:slide-out-to-left data-[open]:slide-in-from-left', right: 'inset-y-0 right-0 mr-0 h-full max-w-sm rounded-l-base border-l data-[closing]:slide-out-to-right data-[open]:slide-in-from-right', }, }, defaultVariants: { position: 'center', }, }, ); type PanelProps = PropsOf<typeof HeadlessModal.Panel> & VariantProps<typeof panelVariants>; const Panel = component$<PanelProps>(({ position, ...props }) => { return ( <HeadlessModal.Panel {...props} class={cn(panelVariants({ position }), props.class)} > <Slot /> </HeadlessModal.Panel> ); });
over previous tailwind.config.js home-made plugin
'.appear': { opacity: 1, }, '.disappear': { opacity: 0, },
to avoid re-inventing the wheel.
Modal.Title
Title now holds
text-lg font-semibold
classes.Modal.Description
Description now holds
text-muted-foreground
class.Accordion
We changed the accordion animations. So make sure to update your taiwind config accordingly (explained at the beginning of the changeset!).
Patch Changes
@qwik-ui/[email protected]
Minor Changes
-
100% Lazy execution (by @thejackshelton in #737)
The entire Qwik UI library does not execute code until interaction. Your components are HTML, until the user decides to interact with them.
Bundling improvements
We have reduced the bundle size significantly of the headless library. If you are a Qwik library author, please refer to this issue as it may impact your bundle size as well.
Dot notation
The biggest change of v0.4 is the addition of dot notation to the API. Also known as "namespaced components".
This includes our largest breaking change to Qwik UI yet. We hope it is the largest ever, and want to ensure a much smoother transition going forward. Before we can do that, we need to make sure the API's are consistent across the library.
The component API's have been updated to use dot notation.
We believe that dot notation will significantly improve the developer experience. Below are some of the benefits of dot notation.
Simple Imports
In previous versions, imports needed to be defined for each component.
import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '@qwik-ui/headless';
While this is trivial with three components, it can be a pain with the more "pieces" a component has.
import { Combobox, ComboboxControl, ComboboxIcon, ComboboxInput, ComboboxLabel, ComboboxListbox, ComboboxOption, ComboboxPopover, ComboboxTrigger, ResolvedOption, } from '@qwik-ui/headless';
In v0.4, the new import syntax is the following:
import { Collapsible, Combobox } from '@qwik-ui/headless';
TypeScript Autocomplete
The searchability of available components has also been improved. You can now use the autocomplete feature to find a specific sub-component.
Improved legibility
For longer component names, the dot notation is arguably more legible. For example,
Combobox.Listbox
vs.ComboboxListbox
.Migration Cheat Sheet
As an easier way to migrate, we've created a mini cheat sheet below. If you have any questions, or need help migrating, don't hesistate to reach out to us on Discord.
Components named , like are now <Accordion.Root />
Except for and , which is now <Modal.Panel /> and <Popover.Panel /> respectively.
With new root components, the main props have been moved to the root component. (for example, props previously on the Popover and Modal panels).
Ex:
<Modal bind:show> -> <Modal.Root bind:show>
For further reference, read the RFC on dot notation.
Popover Refactor
Based on feedback we have received from the community, we have also improved the developer experience of the Popover component.
import { component$ } from '@builder.io/qwik'; import { Popover } from '@qwik-ui/headless'; export default component$(() => { return ( <Popover.Root gutter={4}> <Popover.Trigger class="popover-trigger">Click me</Popover.Trigger> <Popover.Panel class="popover-panel"> I am anchored to the popover trigger! </Popover.Panel> </Popover.Root> ); });
- By default, the popover is now anchored to its trigger. The API surface should also be simpler.
- A new
hover
prop has also been introduced on the root, useful for things like tooltips. - Programmatically toggling the popover is still possible, make sure to put the same id on the
<Popover.Root />
that is passed to theusePopover
hook. Refer to the docs for more info. - popover-showing and popover-closing classes have been deprecated. Please use the
data-open
and `data-closing
attributes instead. - The
data-open
,data-closing
, anddata-closed
data attributes have been added to the popover.
<Popover.Root />
There is a new root compomnent. Configurable props have been moved to the root component.
Deprecated Props
- You no longer need to style the popover open state with
:popover-open
. Instead, use thedata-open
attribute for it to style across browsers.
.popover-panel[data-open] { background: green; }
- You no longer need to pass a
popovertarget
prop to the<Popover.Trigger />
component. Same with an id prop on the<Popover.Panel />
component. - The
placement
prop has been deprecated, and combined with thefloating
prop.
For example,
floating="right
will now float the popover to the right.Opting out of the floating library
To opt-out of the floating library, set the
floating={false}
on the<Popover.Root />
component.May 2024, Chrome will be adding support for the CSS anchor API. This will allow us to remove the floating UI library entirely when that gains more support across browsers.
Docs Improvements
A couple of docs improvements have been made:
- The docs have been updated to reflect the new API.
- The headless docs no longer include styles in the examples. There is an example CSS section in each component page. If you do not find one, please open an issue on GitHub.
- Part of the Accordion and Modal docs have been simplified
- The examples now include icons from the
qwikest/icons
package rather than an abstract component you could not use.
-
Modal API Changes (by @thejackshelton in #734)
In a previous release, the following components have been deprecated:
- ModalHeader
- ModalContent
- ModalFooter
These components were native header, div, and footer elements and did nothing special under the hood. We are deprecating them in order to simplify the API and make it more consistent with the rest of the components.
The new components are:
<Modal.Root>
This is the main container of the modal, and now holds the major props and configuration. Examples include:
- 'bind:show'?: Signal;
- closeOnBackdropClick?: boolean;
- alert?: boolean;
- onShow$?: QRL<() => void>;
- onClose$?: QRL<() => void>;
<Modal.Panel>
Previously
<Modal />
the modal panel is the dialog element that is rendered on top of the page. Its props have since been moved to the<Modal.Root />
component, please refer to the docs for more information.<Modal.Trigger>
The modal now comes with a default trigger, which will open the modal when clicked.
<Modal.Title>
This computes the accessible name from the string children of the modal.
<Modal.Description>
This computes the accessible description from the string children of the modal.
<Modal.Close>
This is a button that closes the modal when clicked.
-
Select API Changes (by @thejackshelton in #724)
<SelectOption />
has been renamed to<Select.ItemLabel />
.<Select.Value />
has been renamed to<Select.DisplayValue />
.
<Select.Item />
A new component that allows for customize of the list item.
<Select.ItemIndicator />
This component is used to render an icon or other visual element that is displayed next to the
<Select.ItemLabel />
whenever an item is selected.Multi-select
To opt-in to the multi-select mode, set the
multiple
prop totrue
. Please refer to theMultiple Selections
section in the docs for more information.The previous API did not allow for customization of list items. The new API introduces a couple new components:
<Select.Item> <Select.ItemLabel>My Display Option!</Select.ItemLabel> <Select.ItemIndicator> {/* anything goes here */} </Select.ItemIndicator> <Select.Item>
You can now put anything you'd like in your
<Select.Item />
, just like a normal li tag!There is a new reactive signal called
bind:displayValue
that can be used to read the value of the display text. There is a new docs example that shows this in action with item pills.bind syntax
We have been exploring more with the
bind
syntax.bind:x
is a convention based onbind:value
andbind:checked
, where a signal is passed and two way data binding is enabled.This is much more performant than previous two way data binding, thanks to signals.
As a general note:
name -> initial value
anything that does not start with
bind:
is a static value.bind:name -> reactive signal
anything that starts with
bind:
is a reactive signal.If you find yourself curious to explore the bind syntax more, try typing
bind:
on a root component in Qwik UI, you should see a list of available things you can reactively customize! -
Tooltip (by @thejackshelton in #733)
The Tooltip component has been refactored from the ground up to be more accessible and performant.
It is now built on top of the popover primitive, and has a similar API.
It remains in
draft
status, and is not yet ready for production use. We will be working on it more deeply in the near future.Accordion
The Accordion has been refactored from the ground up to be more accessible and performant.
...
@qwik-ui/[email protected]
Patch Changes
-
🐞🩹 popover opening immediately in CSR (by @thejackshelton in #717)
-
🐞🩹 regression with popover polyfill executing unnecessary code (by @thejackshelton in #717)
@qwik-ui/[email protected]
Patch Changes
-
🐞🩹 race condition in the popover when programmatically opening on supported browsers (by @thejackshelton in #716)
-
✨ Adding the bind:open signal prop to the select component can now reactively control the select listbox open state (by @thejackshelton in #707)
@qwik-ui/[email protected]
@qwik-ui/[email protected]
Patch Changes
-
🐞🩹 modal does not close unless the dialog backdrop is clicked (including dangling content) (by @thejackshelton in #702)
fix: polyfilled popovers render correctly inside of modals.
fix: nested modals will now close the current modal when the backdrop is clicked.
fix: nested modals will now close the current modal when the escape key is pressed.
fix: select does not execute code until interaction (including core).
tests: larger test suite for modals.
deprecated:
ModalHeader
,ModalContent
,ModalFooter
have been deprecated, as they do not pose significant a11y advantages.feat: Two new Modal component pieces.
ModalTitle
andModalDescription
. These help give our modal an accessible name and supporting description (optional).feat: Modal now uses the following CSS as a default inside of an @layer
@layer qwik-ui { /* browsers automatically set an interesting max-width and max-height for dialogs https://twitter.com/t3dotgg/status/1774350919133691936 */ dialog:modal { max-width: unset; max-height: unset; } }
The default browser styles:
Make it difficult to style a dialog element full-screen, which has led to some confusion recently both in this repo and across the web. The above change strips the responsible browser styles from the dialog eleemnt (which is used by Qwik UI's modal component).
For more info, feel free to check out the link in the code snippet above.
Note: In the future, we intend to use the dot notation for the
Modal
component.Note: In the future, we intend to change the modal API to include a trigger. The proposed API is as follows:
Syntax Proposal
<Modal.Root> <Modal.Trigger>Trigger</Modal.Trigger> <Modal.Panel> {/* This is the current <Modal /> */} <Modal.Title>Edit Profile</Modal.Title> <Modal.Description>You can update your profile here.</Modal.Description> </Modal.Panel> </Modal.Root>
Let us know your thoughts on this potential API change in the Qwik UI discord!
-
✨ deprecate
modal-showing
andmodal-closing
classes in favor ofdata-open
,data-closing
, anddata-closed
data attributes. (by @thejackshelton in #702)These classes will still work at the moment, but will be removed in a near future release.
-
refactor: popover listbox class deprecated and set as a default when in floating mode. (by @thejackshelton in #691)
@qwik-ui/[email protected]
Patch Changes
-
refactor: strip browser user agent styles relating to max-width (by @thejackshelton in #676)
-
🐞🩹 collapsible renders correctly on CSR (by @thejackshelton in #681)
-
✨ headless label hits draft status! (by @thejackshelton in #688)
@qwik-ui/[email protected]
@qwik-ui/[email protected]
Patch Changes
-
✨ collapsible hits beta! (by @thejackshelton in #669)
-
fixed dark mode for combobox and added basic a11y test (by @cwoolum in #662)