@uselets/ui 1.18.4 → 1.18.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{combobox-D-WRdpkq.js → combobox-ITDBYTtM.js} +2 -2
- package/dist/{combobox-D-WRdpkq.js.map → combobox-ITDBYTtM.js.map} +1 -1
- package/dist/{command-BjWXeORj.js → command-BxkAy8PP.js} +2 -2
- package/dist/{command-BjWXeORj.js.map → command-BxkAy8PP.js.map} +1 -1
- package/dist/components/accordion.spec.js +1 -1
- package/dist/components/alert-dialog.spec.js +1 -1
- package/dist/components/alert.spec.js +1 -1
- package/dist/components/anchor.spec.js +1 -1
- package/dist/components/area-chart.spec.js +1 -1
- package/dist/components/avatar.spec.js +1 -1
- package/dist/components/badge.spec.js +1 -1
- package/dist/components/bar-chart.spec.js +1 -1
- package/dist/components/breadcrumb.spec.js +1 -1
- package/dist/components/button-group.spec.js +1 -1
- package/dist/components/button.spec.js +1 -1
- package/dist/components/calendar.spec.js +1 -1
- package/dist/components/card.spec.js +1 -1
- package/dist/components/carousel.spec.js +1 -1
- package/dist/components/center.spec.js +1 -1
- package/dist/components/chart.spec.js +1 -1
- package/dist/components/checkbox.spec.js +1 -1
- package/dist/components/code.spec.js +1 -1
- package/dist/components/collapsible.spec.js +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/combobox.spec.js +1 -1
- package/dist/components/command.js +1 -1
- package/dist/components/command.spec.js +1 -1
- package/dist/components/container.spec.js +1 -1
- package/dist/components/data-table.js +1 -1
- package/dist/components/data-table.spec.js +1 -1
- package/dist/components/date-range-picker.js +1 -1
- package/dist/components/date-range-picker.spec.js +1 -1
- package/dist/components/dialog.spec.js +1 -1
- package/dist/components/donut-chart.spec.js +1 -1
- package/dist/components/drawer.spec.js +1 -1
- package/dist/components/dropdown-menu.spec.js +1 -1
- package/dist/components/dropzone.spec.js +1 -1
- package/dist/components/empty.spec.js +1 -1
- package/dist/components/field.spec.js +1 -1
- package/dist/components/flex.spec.js +1 -1
- package/dist/components/grid.spec.js +1 -1
- package/dist/components/group.spec.js +1 -1
- package/dist/components/heading.spec.js +1 -1
- package/dist/components/hover-card.spec.js +1 -1
- package/dist/components/input-group.js +1 -1
- package/dist/components/input-group.spec.js +1 -1
- package/dist/components/input-otp.spec.js +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/input.spec.js +1 -1
- package/dist/components/kbd.spec.js +1 -1
- package/dist/components/label.spec.js +1 -1
- package/dist/components/list.spec.js +1 -1
- package/dist/components/logo.spec.js +1 -1
- package/dist/components/marker.spec.js +1 -1
- package/dist/components/mask-input.js +1 -1
- package/dist/components/mask-input.spec.js +1 -1
- package/dist/components/native-select.js +1 -1
- package/dist/components/native-select.spec.js +1 -1
- package/dist/components/navigation-menu.spec.js +1 -1
- package/dist/components/number-field.spec.js +1 -1
- package/dist/components/pagination.spec.js +1 -1
- package/dist/components/phone-input.js +1 -1
- package/dist/components/phone-input.spec.js +1 -1
- package/dist/components/pie-chart.spec.js +1 -1
- package/dist/components/popover.spec.js +1 -1
- package/dist/components/progress.spec.js +1 -1
- package/dist/components/radio-group.spec.js +1 -1
- package/dist/components/resizable.spec.js +1 -1
- package/dist/components/ring-progress.spec.js +1 -1
- package/dist/components/scroll-area.spec.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/select.spec.js +1 -1
- package/dist/components/separator.spec.js +1 -1
- package/dist/components/sidebar.js +1 -1
- package/dist/components/sidebar.spec.js +1 -1
- package/dist/components/simple-grid.spec.js +1 -1
- package/dist/components/skeleton.spec.js +1 -1
- package/dist/components/slider.spec.js +1 -1
- package/dist/components/sonner.spec.js +1 -1
- package/dist/components/spinner.spec.js +1 -1
- package/dist/components/stack.spec.js +1 -1
- package/dist/components/stepper.spec.js +1 -1
- package/dist/components/switch.spec.js +1 -1
- package/dist/components/table.spec.js +1 -1
- package/dist/components/tabs.spec.js +1 -1
- package/dist/components/text.spec.js +1 -1
- package/dist/components/textarea.js +1 -1
- package/dist/components/textarea.spec.js +1 -1
- package/dist/components/theme.spec.js +1 -1
- package/dist/components/timeline.spec.js +1 -1
- package/dist/components/toggle-group.spec.js +1 -1
- package/dist/components/toggle.spec.js +1 -1
- package/dist/components/tooltip.spec.js +1 -1
- package/dist/components/unstyled-button.spec.js +1 -1
- package/dist/components/visibility.spec.js +1 -1
- package/dist/{data-table-D-ce4ZKz.js → data-table-BGfSiHDT.js} +2 -2
- package/dist/{data-table-D-ce4ZKz.js.map → data-table-BGfSiHDT.js.map} +1 -1
- package/dist/{date-range-picker-BnRt_P9y.js → date-range-picker-BjkVzFWQ.js} +2 -2
- package/dist/{date-range-picker-BnRt_P9y.js.map → date-range-picker-BjkVzFWQ.js.map} +1 -1
- package/dist/hooks/use-breakpoint-value.spec.js +1 -1
- package/dist/hooks/use-breakpoint-value.spec.js.map +1 -1
- package/dist/hooks/use-breakpoint.spec.js +1 -1
- package/dist/hooks/use-disclosure.spec.js +1 -1
- package/dist/hooks/use-document-visibility.spec.js +1 -1
- package/dist/hooks/use-hotkeys.spec.js +1 -1
- package/dist/hooks/use-idle.spec.js +1 -1
- package/dist/hooks/use-interval.spec.js +1 -1
- package/dist/hooks/use-local-storage.spec.js +1 -1
- package/dist/hooks/use-mask.spec.js +1 -1
- package/dist/hooks/use-mobile.spec.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{input-BgjvSP_s.js → input-CJLsPlXh.js} +2 -2
- package/dist/input-CJLsPlXh.js.map +1 -0
- package/dist/{input-group-Dx06pcPt.js → input-group-mcar-tED.js} +2 -2
- package/dist/{input-group-Dx06pcPt.js.map → input-group-mcar-tED.js.map} +1 -1
- package/dist/{mask-input-D66mRep_.js → mask-input-cCmVKrHj.js} +2 -2
- package/dist/{mask-input-D66mRep_.js.map → mask-input-cCmVKrHj.js.map} +1 -1
- package/dist/{native-select-DZW3Y7nq.js → native-select-Iq25QUH-.js} +2 -2
- package/dist/native-select-Iq25QUH-.js.map +1 -0
- package/dist/{phone-input-DUubOpNH.js → phone-input-DqgYa1un.js} +2 -2
- package/dist/{phone-input-DUubOpNH.js.map → phone-input-DqgYa1un.js.map} +1 -1
- package/dist/{react.esm-BkhVXJ8s.js → react.esm-dE9nuHcL.js} +2 -2
- package/dist/{react.esm-BkhVXJ8s.js.map → react.esm-dE9nuHcL.js.map} +1 -1
- package/dist/select-CVwVLyWt.js +2 -0
- package/dist/select-CVwVLyWt.js.map +1 -0
- package/dist/{sidebar-DemayEyw.js → sidebar-CJriMotD.js} +2 -2
- package/dist/{sidebar-DemayEyw.js.map → sidebar-CJriMotD.js.map} +1 -1
- package/dist/skills/uselets-ui/references/package-guide.md +1 -1
- package/dist/styles/gomax.css +2 -0
- package/dist/styles/max.css +2 -0
- package/dist/styles/theme.css +1 -0
- package/dist/textarea-eJQTMC_d.js +2 -0
- package/dist/textarea-eJQTMC_d.js.map +1 -0
- package/package.json +13 -13
- package/skills/uselets-ui/references/package-guide.md +1 -1
- package/dist/input-BgjvSP_s.js.map +0 -1
- package/dist/native-select-DZW3Y7nq.js.map +0 -1
- package/dist/select-C3QYNv4t.js +0 -2
- package/dist/select-C3QYNv4t.js.map +0 -1
- package/dist/textarea-C8zrf9Rz.js +0 -2
- package/dist/textarea-C8zrf9Rz.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,i as t,l as n,n as r,o as i,r as a,s as o,t as s}from"../navigation-menu-B6drNL1-.js";import{a as c,n as l,r as u}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,i as t,l as n,n as r,o as i,r as a,s as o,t as s}from"../navigation-menu-B6drNL1-.js";import{a as c,n as l,r as u}from"../react.esm-dE9nuHcL.js";import{jsx as d,jsxs as f}from"react/jsx-runtime";if(globalThis.ResizeObserver===void 0){class ResizeObserverStub{observe(){}unobserve(){}disconnect(){}}globalThis.ResizeObserver=ResizeObserverStub}describe(`NavigationMenu`,()=>{it(`renders the root with its data-slot and data-viewport attribute`,()=>{let{container:n}=u(d(s,{children:d(i,{children:d(t,{children:d(e,{href:`#`,children:`Home`})})})})),r=n.querySelector(`[data-slot="navigation-menu"]`);expect(r?.getAttribute(`data-viewport`)).toBe(`true`)}),it(`mounts the viewport once an item opens when viewport defaults to true`,async()=>{let{container:n}=u(d(s,{children:d(i,{children:f(t,{children:[d(o,{children:`Products`}),d(r,{children:d(e,{href:`/widgets`,children:`Widgets`})})]})})}));expect(n.querySelector(`[data-slot="navigation-menu-viewport"]`)).toBeNull(),l.click(c.getByRole(`button`,{name:/Products/})),await c.findByText(`Widgets`),expect(n.querySelector(`[data-slot="navigation-menu-viewport"]`)).not.toBeNull()}),it(`never mounts a viewport when viewport is false, even once an item opens`,async()=>{let{container:n}=u(d(s,{viewport:!1,children:d(i,{children:f(t,{children:[d(o,{children:`Products`}),d(r,{children:d(e,{href:`/widgets`,children:`Widgets`})})]})})})),a=n.querySelector(`[data-slot="navigation-menu"]`);expect(a?.getAttribute(`data-viewport`)).toBe(`false`),l.click(c.getByRole(`button`,{name:/Products/})),await c.findByText(`Widgets`),expect(n.querySelector(`[data-slot="navigation-menu-viewport"]`)).toBeNull()}),describe(`NavigationMenuTrigger`,()=>{it(`opens its content when clicked and exposes the open state`,async()=>{u(d(s,{children:d(i,{children:f(t,{children:[d(o,{children:`Products`}),d(r,{children:d(e,{href:`/widgets`,children:`Widgets`})})]})})}));let n=c.getByRole(`button`,{name:/Products/});expect(n.getAttribute(`aria-expanded`)).toBe(`false`),expect(n.getAttribute(`data-slot`)).toBe(`navigation-menu-trigger`),l.click(n),expect(n.getAttribute(`aria-expanded`)).toBe(`true`),expect(await c.findByText(`Widgets`)).not.toBeNull()}),it(`renders inline content (no viewport) when viewport is false`,async()=>{let{container:n}=u(d(s,{viewport:!1,children:d(i,{children:f(t,{children:[d(o,{children:`Products`}),d(r,{children:d(e,{href:`/widgets`,children:`Widgets`})})]})})}));l.click(c.getByRole(`button`,{name:/Products/}));let a=await c.findByText(`Widgets`);expect(a.closest(`[data-slot="navigation-menu-content"]`)).not.toBeNull(),expect(n.querySelector(`[data-slot="navigation-menu-viewport"]`)).toBeNull()})}),it(`renders NavigationMenuLink with data-active and its focus/hover classes`,()=>{u(d(s,{viewport:!1,children:d(i,{children:d(t,{children:d(e,{href:`#`,active:!0,children:`Current page`})})})}));let n=c.getByRole(`link`,{name:`Current page`});expect(n.getAttribute(`data-slot`)).toBe(`navigation-menu-link`),expect(n.getAttribute(`data-active`)).toBe(``),expect(n.getAttribute(`aria-current`)).toBe(`page`),expect(n.className).toContain(`rounded-lg`)}),it(`renders NavigationMenuItem and NavigationMenuList with their data-slots`,()=>{let{container:n}=u(d(s,{viewport:!1,children:d(i,{children:d(t,{children:d(e,{href:`#`,children:`Home`})})})}));expect(n.querySelector(`[data-slot="navigation-menu-list"]`)).not.toBeNull(),expect(n.querySelector(`[data-slot="navigation-menu-item"]`)).not.toBeNull()}),it(`renders NavigationMenuIndicator without throwing`,()=>{let{container:n}=u(d(s,{viewport:!1,children:f(i,{children:[d(t,{children:d(e,{href:`#`,children:`Home`})}),d(a,{})]})}));expect(n.querySelector(`[data-slot="navigation-menu-list"]`)).not.toBeNull()}),it(`exposes navigationMenuTriggerStyle as a reusable class string`,()=>{expect(n()).toContain(`inline-flex`)})});
|
|
2
2
|
//# sourceMappingURL=navigation-menu.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{o as e,t}from"../field-DzR-XrO7.js";import{a as n,i as r,n as i,o as a,r as o,t as s}from"../number-field-rEMfZa6A.js";import{a as c,n as l,r as u}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{o as e,t}from"../field-DzR-XrO7.js";import{a as n,i as r,n as i,o as a,r as o,t as s}from"../number-field-rEMfZa6A.js";import{a as c,n as l,r as u}from"../react.esm-dE9nuHcL.js";import{jsx as d,jsxs as f}from"react/jsx-runtime";function renderNumberField(e={}){return u(d(s,{...e,children:f(o,{children:[d(i,{}),d(n,{}),d(r,{})]})}))}describe(`NumberField`,()=>{it(`renders the root with its data-slot and default size`,()=>{let{container:e}=renderNumberField({defaultValue:0}),t=e.querySelector(`[data-slot="number-field"]`);expect(t).not.toBeNull(),expect(t?.getAttribute(`data-size`)).toBe(`md`)}),it(`increments and decrements the value via the stepper buttons`,()=>{let e=vi.fn();renderNumberField({defaultValue:5,onValueChange:e});let t=c.getByRole(`textbox`),n=c.getByRole(`button`,{name:`Increase`}),r=c.getByRole(`button`,{name:`Decrease`});l.click(n),expect(t.value).toBe(`6`),expect(e).toHaveBeenLastCalledWith(6,expect.anything()),l.click(r),l.click(r),expect(t.value).toBe(`4`)}),it(`respects min/max boundaries when stepping`,()=>{renderNumberField({defaultValue:10,min:0,max:10});let e=c.getByRole(`textbox`),t=c.getByRole(`button`,{name:`Increase`});l.click(t),expect(e.value).toBe(`10`)}),it(`disables the stepper buttons and input when disabled`,()=>{renderNumberField({defaultValue:0,disabled:!0}),expect(c.getByRole(`button`,{name:`Increase`}).disabled).toBe(!0),expect(c.getByRole(`button`,{name:`Decrease`}).disabled).toBe(!0),expect(c.getByRole(`textbox`).disabled).toBe(!0)}),describe(`NumberFieldGroup`,()=>{it(`applies the size variant classes`,()=>{let{container:e}=u(d(s,{defaultValue:0,size:`lg`,children:d(o,{children:d(n,{})})})),t=e.querySelector(`[data-slot="number-field-group"]`);expect(t?.className).toContain(`h-9`)}),it(`throws when rendered outside a NumberField`,()=>{let e=vi.spyOn(console,`error`).mockImplementation(()=>{});expect(()=>u(d(o,{}))).toThrow(`NumberFieldGroup must be used within a NumberField component.`),e.mockRestore()})}),describe(`NumberFieldIncrement / NumberFieldDecrement`,()=>{it(`throw when rendered outside a NumberField`,()=>{let e=vi.spyOn(console,`error`).mockImplementation(()=>{});expect(()=>u(d(r,{}))).toThrow(`NumberFieldIncrement must be used within a NumberField component.`),expect(()=>u(d(i,{}))).toThrow(`NumberFieldDecrement must be used within a NumberField component.`),e.mockRestore()})}),describe(`NumberFieldInput`,()=>{it(`throws when rendered outside a NumberField`,()=>{let e=vi.spyOn(console,`error`).mockImplementation(()=>{});expect(()=>u(d(n,{}))).toThrow(`NumberFieldInput must be used within a NumberField component.`),e.mockRestore()}),it(`wires the generated Field control id when used inside a Field`,()=>{u(f(t,{children:[d(e,{children:`Quantity`}),d(s,{defaultValue:1,children:d(o,{children:d(n,{})})})]}));let r=c.getByLabelText(`Quantity`),i=c.getByText(`Quantity`);expect(r.getAttribute(`id`)).toBeTruthy(),expect(i.getAttribute(`for`)).toBe(r.getAttribute(`id`))})}),describe(`NumberFieldScrubArea`,()=>{it(`renders a label wired to the field id and throws outside a NumberField`,()=>{let{container:e}=u(f(s,{defaultValue:0,children:[d(a,{label:`Drag to scrub`}),d(o,{children:d(n,{})})]})),t=c.getByText(`Drag to scrub`),r=e.querySelector(`[data-slot="number-field-input"]`);expect(t.getAttribute(`for`)).toBe(r?.getAttribute(`id`));let i=vi.spyOn(console,`error`).mockImplementation(()=>{});expect(()=>u(d(a,{label:`Standalone`}))).toThrow(`NumberFieldScrubArea must be used within a NumberField component for accessibility.`),i.mockRestore()})})});
|
|
2
2
|
//# sourceMappingURL=number-field.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"../pagination-gnUKddCN.js";import{a as s,n as c,r as l}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"../pagination-gnUKddCN.js";import{a as s,n as c,r as l}from"../react.esm-dE9nuHcL.js";import{jsx as u,jsxs as d}from"react/jsx-runtime";describe(`Pagination`,()=>{it(`renders the nav landmark with its data-slot and aria-label`,()=>{l(u(o,{color:`brand`,children:u(n,{})}));let e=s.getByRole(`navigation`,{name:`pagination`});expect(e.getAttribute(`data-slot`)).toBe(`pagination`),expect(e.getAttribute(`data-color`)).toBe(`brand`)}),it(`renders PaginationContent and PaginationItem with their data-slots`,()=>{let{container:r}=l(u(o,{children:u(n,{children:u(t,{children:u(e,{href:`#`,children:`1`})})})}));expect(r.querySelector(`[data-slot="pagination-content"]`)?.tagName).toBe(`UL`),expect(r.querySelector(`[data-slot="pagination-item"]`)?.tagName).toBe(`LI`)}),describe(`PaginationLink`,()=>{it(`marks the active page and falls back to the secondary variant otherwise`,()=>{l(u(o,{children:d(n,{children:[u(t,{children:u(e,{href:`#`,isActive:!0,children:`1`})}),u(t,{children:u(e,{href:`#`,children:`2`})})]})}));let r=s.getByText(`1`),i=s.getByText(`2`);expect(r.getAttribute(`aria-current`)).toBe(`page`),expect(r.getAttribute(`data-active`)).toBe(`true`),expect(r.getAttribute(`data-variant`)).toBe(`solid`),expect(i.getAttribute(`aria-current`)).toBeNull(),expect(i.getAttribute(`data-variant`)).toBe(`secondary`)}),it(`fires a click handler for page navigation`,()=>{let r=vi.fn();l(u(o,{children:u(n,{children:u(t,{children:u(e,{href:`#`,onClick:r,children:`2`})})})})),c.click(s.getByText(`2`)),expect(r).toHaveBeenCalledTimes(1)}),it(`uses the color from the surrounding Pagination context over its own default`,()=>{l(u(o,{color:`brand`,children:u(n,{children:u(t,{children:u(e,{href:`#`,children:`1`})})})})),expect(s.getByText(`1`).getAttribute(`data-color`)).toBe(`brand`)})}),it(`renders PaginationPrevious with its icon and aria-label`,()=>{l(u(o,{children:u(n,{children:u(t,{children:u(a,{href:`#`})})})}));let e=s.getByRole(`link`,{name:`Go to previous page`});expect(e.querySelector(`[data-icon="inline-start"]`)).not.toBeNull()}),it(`renders PaginationNext with optional visible text alongside its icon`,()=>{l(u(o,{children:u(n,{children:u(t,{children:u(r,{href:`#`,text:`Next`})})})}));let e=s.getByRole(`link`,{name:`Go to next page`});expect(e.querySelector(`[data-icon="inline-end"]`)).not.toBeNull();let i=s.getByText(`Next`);expect(i.className).toContain(`hidden`),expect(i.className).toContain(`sm:block`)}),it(`renders PaginationEllipsis with a visually hidden label`,()=>{let{container:e}=l(u(i,{})),t=e.querySelector(`[data-slot="pagination-ellipsis"]`);expect(t?.getAttribute(`aria-hidden`)).toBe(`true`),expect(s.getByText(`More pages`).className).toContain(`sr-only`)}),it(`composes a full pagination list with previous, pages, an ellipsis and next`,()=>{l(u(o,{children:d(n,{children:[u(t,{children:u(a,{href:`#`})}),u(t,{children:u(e,{href:`#`,isActive:!0,children:`1`})}),u(t,{children:u(i,{})}),u(t,{children:u(r,{href:`#`})})]})})),expect(s.getAllByRole(`link`)).toHaveLength(3),expect(s.getByText(`More pages`)).not.toBeNull()})});
|
|
2
2
|
//# sourceMappingURL=pagination.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"../phone-input-
|
|
1
|
+
import{t as e}from"../phone-input-DqgYa1un.js";export{e as PhoneInput};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../phone-input-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../phone-input-DqgYa1un.js";import{n as t,r as n}from"../react.esm-dE9nuHcL.js";import{jsx as r}from"react/jsx-runtime";describe(`PhoneInput`,()=>{it(`renders a tel input defaulting to Brazil as the selected country`,()=>{let{container:t}=n(r(e,{})),i=t.querySelector(`input[type="tel"]`),a=t.querySelector(`[data-slot="combobox-trigger"]`);expect(i).not.toBeNull(),expect(i.value).toBe(``),expect(a.textContent).toContain(`Brazil`),expect(a.querySelector(`title`)?.textContent).toBe(`BR`)}),it(`renders the underlying input with the shared input styles and no rounded start`,()=>{let{container:t}=n(r(e,{})),i=t.querySelector(`[data-slot="input"]`);expect(i.className).toContain(`rounded-s-none`),expect(i.className).toContain(`focus:z-1`)}),it(`formats a typed number and reports the E.164 value through onChange`,()=>{let i=vi.fn(),{container:a}=n(r(e,{onChange:i})),o=a.querySelector(`input[type="tel"]`);t.change(o,{target:{value:`11987654321`}}),expect(o.value).toBe(`(11) 98765-4321`),expect(i).toHaveBeenCalledWith(`+5511987654321`)}),it(`renders a controlled value formatted for display`,()=>{let{container:t}=n(r(e,{value:`+5511987654321`})),i=t.querySelector(`input[type="tel"]`);expect(i.value).toBe(`+55 11 98765 4321`)}),it(`calls onChange with an empty string when the value is cleared`,()=>{let i=vi.fn(),{container:a}=n(r(e,{value:`+5511987654321`,onChange:i})),o=a.querySelector(`input[type="tel"]`);t.change(o,{target:{value:``}}),expect(i).toHaveBeenCalledWith(``)}),it(`propagates aria-invalid to the wrapper so the nested combobox trigger gets destructive styling`,()=>{let{container:t}=n(r(e,{"aria-invalid":!0})),i=t.firstElementChild,a=t.querySelector(`input[type="tel"]`);expect(i.className).toContain(`[&_*[data-slot=combobox-trigger]]:border-destructive`),expect(i.className).toContain(`[&_*[data-slot=combobox-trigger]]:ring-destructive/50`),expect(a.getAttribute(`aria-invalid`)).toBe(`true`)}),it(`does not add destructive wrapper classes when aria-invalid is absent`,()=>{let{container:t}=n(r(e,{})),i=t.firstElementChild;expect(i.className).not.toContain(`border-destructive`)}),it(`opens the country popup when the trigger is clicked and lists country options with dial codes`,()=>{let{container:i}=n(r(e,{})),a=i.querySelector(`[data-slot="combobox-trigger"]`);t.click(a),expect(a.getAttribute(`aria-expanded`)).toBe(`true`);let o=document.querySelector(`[data-slot="combobox-content"]`);expect(o).not.toBeNull();let s=document.querySelectorAll(`[data-slot="combobox-item"]`);expect(s.length).toBeGreaterThan(1);let c=Array.from(s).find(e=>e.textContent?.includes(`United States`));expect(c?.textContent).toContain(`+1`)}),it(`selecting a country updates the trigger flag/name and closes the popup`,()=>{let{container:i}=n(r(e,{})),a=i.querySelector(`[data-slot="combobox-trigger"]`);t.click(a);let o=document.querySelectorAll(`[data-slot="combobox-item"]`),s=Array.from(o).find(e=>e.textContent?.includes(`United States`));t.click(s),expect(a.getAttribute(`aria-expanded`)).toBe(`false`),expect(a.textContent).toContain(`United States`),expect(a.querySelector(`title`)?.textContent).toBe(`US`)}),it(`selecting a different country changes the dial-code prefix applied to typed numbers`,()=>{let i=vi.fn(),{container:a}=n(r(e,{onChange:i})),o=a.querySelector(`[data-slot="combobox-trigger"]`);t.click(o);let s=document.querySelectorAll(`[data-slot="combobox-item"]`),c=Array.from(s).find(e=>e.textContent?.includes(`United States`));t.click(c);let l=a.querySelector(`input[type="tel"]`);t.change(l,{target:{value:`2015550123`}}),expect(i).toHaveBeenCalledWith(`+12015550123`)}),it(`filters the country list using the popup search input`,()=>{let{container:i}=n(r(e,{})),a=i.querySelector(`[data-slot="combobox-trigger"]`);t.click(a);let o=document.querySelector(`input[placeholder="e.g. United States"]`);t.change(o,{target:{value:`Portugal`}});let s=document.querySelectorAll(`[data-slot="combobox-item"]`);expect(s.length).toBe(1),expect(s[0]?.textContent).toContain(`Portugal`)}),it(`shows the empty state message when no country matches the search`,()=>{let{container:i}=n(r(e,{})),a=i.querySelector(`[data-slot="combobox-trigger"]`);t.click(a);let o=document.querySelector(`input[placeholder="e.g. United States"]`);t.change(o,{target:{value:`not-a-real-country`}}),expect(document.querySelector(`[data-slot="combobox-empty"]`)?.textContent).toBe(`Nenhum país encontrado.`)}),it(`forwards a custom popupClassName to the popup content`,()=>{let{container:i}=n(r(e,{popupClassName:`my-popup-class`})),a=i.querySelector(`[data-slot="combobox-trigger"]`);t.click(a);let o=document.querySelector(`[data-slot="combobox-content"]`);expect(o.className).toContain(`my-popup-class`)})});
|
|
2
2
|
//# sourceMappingURL=phone-input.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{n as e,r as t,t as n}from"../pie-chart-S4nMKbsW.js";import{a as r,r as i}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{n as e,r as t,t as n}from"../pie-chart-S4nMKbsW.js";import{a as r,r as i}from"../react.esm-dE9nuHcL.js";import{jsx as a}from"react/jsx-runtime";beforeAll(()=>{vi.stubGlobal(`ResizeObserver`,class{observe(){}unobserve(){}disconnect(){}}),Object.defineProperty(HTMLElement.prototype,"offsetWidth",{configurable:!0,value:500}),Object.defineProperty(HTMLElement.prototype,"offsetHeight",{configurable:!0,value:300}),HTMLElement.prototype.getBoundingClientRect=()=>({width:500,height:300,top:0,left:0,right:500,bottom:300,x:0,y:0,toJSON(){}})});const o=[{name:`chrome`,value:275},{name:`safari`,value:200},{name:`firefox`,value:187}];describe(`PieChart`,()=>{it(`renders with data-slot="pie-chart" on the chart wrapper`,()=>{let{container:e}=i(a(n,{data:o}));expect(e.querySelector(`[data-slot="pie-chart"]`)).not.toBeNull()}),it(`accepts a data array without throwing`,()=>{expect(()=>i(a(n,{data:o}))).not.toThrow()}),it(`renders one recharts pie sector per data entry`,()=>{let{container:e}=i(a(n,{data:o}));expect(e.querySelectorAll(`.recharts-pie-sector`).length).toBe(o.length)}),it(`renders a tooltip wrapper by default and omits it when withTooltip is false`,()=>{let{container:e}=i(a(n,{data:o}));expect(e.querySelectorAll(`.recharts-tooltip-wrapper`).length).toBe(1);let{container:t}=i(a(n,{data:o,withTooltip:!1}));expect(t.querySelectorAll(`.recharts-tooltip-wrapper`).length).toBe(0)}),it(`omits the legend by default and renders it when withLegend is true`,async()=>{let{container:e}=i(a(n,{data:o}));expect(e.querySelectorAll(`.recharts-legend-wrapper`).length).toBe(0);let{container:t}=i(a(n,{data:o,withLegend:!0}));expect(t.querySelectorAll(`.recharts-legend-wrapper`).length).toBe(1),expect((await r.findAllByText(`chrome`)).length).toBeGreaterThan(0)}),it(`omits slice labels by default and renders them when withLabels is true`,()=>{let{container:e}=i(a(n,{data:o,animationDuration:0}));expect(e.querySelectorAll(`.recharts-pie-label-text`).length).toBe(0);let{container:t}=i(a(n,{data:o,withLabels:!0,animationDuration:0}));expect(t.querySelectorAll(`.recharts-pie-label-text`).length).toBe(o.length)}),describe(`PieChartBase`,()=>{it(`uses the provided dataSlot instead of the default "pie-chart" slot`,()=>{let{container:t}=i(a(e,{dataSlot:`donut-chart`,data:o}));expect(t.querySelector(`[data-slot="donut-chart"]`)).not.toBeNull(),expect(t.querySelector(`[data-slot="pie-chart"]`)).toBeNull()}),it(`renders an arbitrary centerSlot node inside the pie`,()=>{let{container:t}=i(a(e,{dataSlot:`pie-chart`,data:o,centerSlot:a(`text`,{"data-testid":`center`,children:`Center`})}));expect(t.querySelector(`[data-testid="center"]`)).not.toBeNull()}),it(`does not render a centerSlot when none is provided`,()=>{let{container:t}=i(a(e,{dataSlot:`pie-chart`,data:o}));expect(t.querySelector(`[data-testid="center"]`)).toBeNull()})})}),describe(`buildPieConfig`,()=>{it(`builds one config entry per data item keyed by its name`,()=>{let e=t(o);expect(Object.keys(e)).toEqual([`chrome`,`safari`,`firefox`])}),it(`uses the item name as the label`,()=>{let e=t(o);expect(e.chrome?.label).toBe(`chrome`),expect(e.safari?.label).toBe(`safari`)}),it(`assigns colors from the default palette by index when no color/colorKey is provided`,()=>{let e=t(o);expect(e.chrome?.color).toBe(`var(--chart-1)`),expect(e.safari?.color).toBe(`var(--chart-2)`),expect(e.firefox?.color).toBe(`var(--chart-3)`)}),it(`prefers an explicit color over a colorKey and the default palette`,()=>{let e=t([{name:`a`,value:1,color:`#123456`,colorKey:`red`}]);expect(e.a?.color).toBe(`#123456`)}),it(`resolves a colorKey to its CSS variable when no explicit color is set`,()=>{let e=t([{name:`a`,value:1,colorKey:`red`}]);expect(e.a?.color).toBe(`var(--red)`)}),it(`cycles through the default palette once there are more items than palette colors`,()=>{let e=t(Array.from({length:6},(e,t)=>({name:`item-${t}`,value:t+1})));expect(e[`item-0`]?.color).toBe(`var(--chart-1)`),expect(e[`item-4`]?.color).toBe(`var(--chart-5)`),expect(e[`item-5`]?.color).toBe(`var(--chart-1)`)}),it(`returns an empty config for an empty data array`,()=>{expect(t([])).toEqual({})})});
|
|
2
2
|
//# sourceMappingURL=pie-chart.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"../popover-BtX3tX8M.js";import{a as s,n as c,r as l}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"../popover-BtX3tX8M.js";import{a as s,n as c,r as l}from"../react.esm-dE9nuHcL.js";import{jsx as u,jsxs as d}from"react/jsx-runtime";function renderPopover(){return l(d(o,{children:[u(a,{children:`Open settings`}),u(i,{children:d(e,{children:[u(r,{children:`Settings`}),u(t,{children:`Manage your preferences`})]})})]}))}describe(`Popover`,()=>{it(`does not render the content until the trigger opens it`,()=>{renderPopover(),expect(s.queryByRole(`dialog`)).toBeNull()}),it(`opens the content when the trigger is clicked`,async()=>{renderPopover(),c.click(s.getByText(`Open settings`));let e=await s.findByRole(`dialog`);expect(e.getAttribute(`data-slot`)).toBe(`popover-content`),expect(e.className).toContain(`bg-popover`),expect(e.className).toContain(`w-72`)}),it(`renders the header, title and description inside the open content`,async()=>{renderPopover(),c.click(s.getByText(`Open settings`)),await s.findByRole(`dialog`);let e=s.getByText(`Settings`),t=s.getByText(`Manage your preferences`);expect(e.getAttribute(`data-slot`)).toBe(`popover-title`),expect(e.className).toContain(`font-medium`),expect(t.getAttribute(`data-slot`)).toBe(`popover-description`),expect(t.className).toContain(`text-muted-foreground`),expect(s.getByText(`Settings`).closest(`[data-slot="popover-header"]`)).not.toBeNull()}),it(`closes the content when the trigger is clicked again`,async()=>{renderPopover();let e=s.getByText(`Open settings`);c.click(e),await s.findByRole(`dialog`),c.click(e),expect(s.queryByRole(`dialog`)).toBeNull()}),it(`accepts custom align and sideOffset props and still renders the content`,async()=>{l(d(o,{defaultOpen:!0,children:[u(a,{children:`Open`}),u(i,{align:`start`,sideOffset:12,children:`Body`})]}));let e=await s.findByRole(`dialog`);expect(e.textContent).toBe(`Body`),expect(e.hasAttribute(`data-align`)).toBe(!0)}),it(`renders the anchor with its data-slot without opening a portal`,()=>{let{container:e}=l(d(o,{children:[u(n,{"data-testid":`anchor`,children:`Anchor point`}),u(a,{children:`Open`}),u(i,{children:`Body`})]})),t=e.querySelector(`[data-slot="popover-anchor"]`);expect(t).not.toBeNull(),expect(t?.textContent).toBe(`Anchor point`),expect(s.queryByRole(`dialog`)).toBeNull()})});
|
|
2
2
|
//# sourceMappingURL=popover.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../progress-QvpY7tiy.js";import{r as t}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../progress-QvpY7tiy.js";import{r as t}from"../react.esm-dE9nuHcL.js";import{jsx as n}from"react/jsx-runtime";describe(`Progress`,()=>{it(`renders the progress root and indicator with default size and color`,()=>{let{container:r}=t(n(e,{value:50})),i=r.querySelector(`[data-slot="progress"]`),a=r.querySelector(`[data-slot="progress-indicator"]`);expect(i?.getAttribute(`data-size`)).toBe(`md`),expect(i?.getAttribute(`data-color`)).toBe(`primary`),expect(i?.className).toContain(`rounded-full`),expect(a?.className).toContain(`bg-(--progress-color)`)}),it(`applies size and color variants and their data attributes`,()=>{let{container:r}=t(n(e,{value:20,size:`lg`,color:`green`})),i=r.querySelector(`[data-slot="progress"]`);expect(i?.getAttribute(`data-size`)).toBe(`lg`),expect(i?.getAttribute(`data-color`)).toBe(`green`),expect(i?.className).toContain(`h-1.5`)}),it(`translates the indicator based on the value`,()=>{let{container:r}=t(n(e,{value:30})),i=r.querySelector(`[data-slot="progress-indicator"]`);expect(i.style.transform).toBe(`translateX(-70%)`)}),it(`defaults the indicator transform to fully hidden when value is omitted`,()=>{let{container:r}=t(n(e,{})),i=r.querySelector(`[data-slot="progress-indicator"]`);expect(i.style.transform).toBe(`translateX(-100%)`)}),it(`merges a custom className with the variant classes`,()=>{let{container:r}=t(n(e,{value:10,className:`custom-class`}));expect(r.querySelector(`[data-slot="progress"]`)?.className).toContain(`custom-class`)})});
|
|
2
2
|
//# sourceMappingURL=progress.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{n as e,t}from"../radio-group-DM8n0XPS.js";import{a as n,n as r,r as i}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{n as e,t}from"../radio-group-DM8n0XPS.js";import{a as n,n as r,r as i}from"../react.esm-dE9nuHcL.js";import{jsx as a,jsxs as o}from"react/jsx-runtime";describe(`RadioGroup`,()=>{it(`renders the root with the default color and grid layout classes`,()=>{let{container:n}=i(a(t,{children:a(e,{value:`a`,label:`Option A`})})),r=n.querySelector(`[data-slot="radio-group"]`);expect(r).not.toBeNull(),expect(r?.getAttribute(`data-color`)).toBe(`primary`),expect(r?.className).toContain(`grid`)}),it(`applies a custom color to the root`,()=>{let{container:n}=i(a(t,{color:`red`,children:a(e,{value:`a`,label:`Option A`})})),r=n.querySelector(`[data-slot="radio-group"]`);expect(r?.getAttribute(`data-color`)).toBe(`red`),expect(r?.className).toContain(`[--selection-control:var(--red)]`)}),it(`applies its own independent color prop to an item`,()=>{let{container:n}=i(a(t,{children:a(e,{value:`a`,label:`Option A`,color:`red`})})),r=n.querySelector(`[data-slot="radio-group-item"]`);expect(r?.getAttribute(`data-color`)).toBe(`red`),expect(r?.className).toContain(`[--selection-control:var(--red)]`)}),it(`renders a label associated with the item and generates an id when none is provided`,()=>{i(a(t,{children:a(e,{value:`a`,label:`Option A`})}));let r=n.getByLabelText(`Option A`);expect(r.getAttribute(`id`)).toBeTruthy(),expect(n.getByText(`Option A`).getAttribute(`for`)).toBe(r.getAttribute(`id`))}),it(`does not wrap the item in a label field when no label is provided`,()=>{let{container:n}=i(a(t,{children:a(e,{value:`a`})}));expect(n.querySelector(`[data-slot="radio-group-item-field"]`)).toBeNull(),expect(n.querySelector(`[data-slot="radio-group-item"]`)?.getAttribute(`id`)).toBeNull()}),it(`respects an explicit id over the generated one`,()=>{i(a(t,{children:a(e,{value:`a`,label:`Option A`,id:`custom-id`})})),expect(n.getByLabelText(`Option A`).getAttribute(`id`)).toBe(`custom-id`)}),it(`applies the requested size to the item, indicator and label`,()=>{let{container:r}=i(a(t,{children:a(e,{value:`a`,label:`Option A`,size:`lg`})})),o=r.querySelector(`[data-slot="radio-group-item"]`),s=n.getByText(`Option A`);expect(o?.getAttribute(`data-size`)).toBe(`lg`),expect(o?.className).toContain(`size-5.5`),expect(s.className).toContain(`text-xl`)}),it(`selects an item when clicked and calls onValueChange, keeping the group single-select`,()=>{let s=vi.fn();i(o(t,{onValueChange:s,children:[a(e,{value:`a`,label:`Option A`}),a(e,{value:`b`,label:`Option B`})]}));let c=n.getByLabelText(`Option A`),l=n.getByLabelText(`Option B`);r.click(c),expect(s).toHaveBeenCalledWith(`a`),expect(c.getAttribute(`data-state`)).toBe(`checked`),expect(l.getAttribute(`data-state`)).toBe(`unchecked`),r.click(l),expect(s).toHaveBeenCalledWith(`b`),expect(l.getAttribute(`data-state`)).toBe(`checked`),expect(c.getAttribute(`data-state`)).toBe(`unchecked`)}),it(`renders as a controlled group reflecting the given value`,()=>{i(o(t,{value:`b`,children:[a(e,{value:`a`,label:`Option A`}),a(e,{value:`b`,label:`Option B`})]})),expect(n.getByLabelText(`Option A`).getAttribute(`data-state`)).toBe(`unchecked`),expect(n.getByLabelText(`Option B`).getAttribute(`data-state`)).toBe(`checked`)}),it(`marks a disabled item as disabled and prevents selection`,()=>{let o=vi.fn();i(a(t,{onValueChange:o,children:a(e,{value:`a`,label:`Option A`,disabled:!0})}));let s=n.getByLabelText(`Option A`);expect(s.disabled).toBe(!0),r.click(s),expect(o).not.toHaveBeenCalled()})});
|
|
2
2
|
//# sourceMappingURL=radio-group.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{n as e,r as t,t as n}from"../resizable-Dbg7r7nF.js";import{a as r,r as i}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{n as e,r as t,t as n}from"../resizable-Dbg7r7nF.js";import{a as r,r as i}from"../react.esm-dE9nuHcL.js";import{jsx as a,jsxs as o}from"react/jsx-runtime";var ResizeObserverStub=class{observe(){}unobserve(){}disconnect(){}};beforeAll(()=>{window.ResizeObserver=ResizeObserverStub}),describe(`ResizablePanelGroup`,()=>{it(`renders the group with its data-slot and layout classes`,()=>{let{container:r}=i(o(t,{children:[a(e,{children:`Left`}),a(n,{}),a(e,{children:`Right`})]})),s=r.querySelector(`[data-slot="resizable-panel-group"]`);expect(s).not.toBeNull(),expect(s?.className).toContain(`flex`),expect(s?.className).toContain(`h-full`),expect(s?.className).toContain(`w-full`)}),it(`renders each panel with its own data-slot and content`,()=>{let{container:s}=i(o(t,{children:[a(e,{children:`Left panel`}),a(n,{}),a(e,{children:`Right panel`})]})),c=s.querySelectorAll(`[data-slot="resizable-panel"]`);expect(c).toHaveLength(2),expect(r.getByText(`Left panel`)).not.toBeNull(),expect(r.getByText(`Right panel`)).not.toBeNull()}),it(`lays out panels in a row by default`,()=>{let{container:r}=i(o(t,{children:[a(e,{children:`Left`}),a(n,{}),a(e,{children:`Right`})]})),s=r.querySelector(`[data-slot="resizable-panel-group"]`);expect(s.style.flexDirection).toBe(`row`)}),it(`switches to a column layout and flips the handle orientation when vertical`,()=>{let{container:s}=i(o(t,{orientation:`vertical`,children:[a(e,{children:`Top`}),a(n,{}),a(e,{children:`Bottom`})]})),c=s.querySelector(`[data-slot="resizable-panel-group"]`),l=r.getByRole(`separator`);expect(c.style.flexDirection).toBe(`column`),expect(l.getAttribute(`aria-orientation`)).toBe(`horizontal`)})}),describe(`ResizableHandle`,()=>{it(`renders as a separator with its data-slot`,()=>{let{container:s}=i(o(t,{children:[a(e,{children:`Left`}),a(n,{}),a(e,{children:`Right`})]})),c=r.getByRole(`separator`);expect(c.getAttribute(`data-slot`)).toBe(`resizable-handle`),expect(s.querySelector(`[data-slot="resizable-handle"]`)).toBe(c)}),it(`does not render a visible grip by default`,()=>{i(o(t,{children:[a(e,{children:`Left`}),a(n,{}),a(e,{children:`Right`})]})),expect(r.getByRole(`separator`).querySelector(`div`)).toBeNull()}),it(`renders a visible grip element when withHandle is set`,()=>{i(o(t,{children:[a(e,{children:`Left`}),a(n,{withHandle:!0}),a(e,{children:`Right`})]}));let s=r.getByRole(`separator`).querySelector(`div`);expect(s).not.toBeNull(),expect(s?.className).toContain(`rounded-lg`)})});
|
|
2
2
|
//# sourceMappingURL=resizable.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../ring-progress-Bfqq_HHA.js";import{r as t}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../ring-progress-Bfqq_HHA.js";import{r as t}from"../react.esm-dE9nuHcL.js";import{jsx as n}from"react/jsx-runtime";describe(`RingProgress`,()=>{it(`renders an svg with the ring-progress data-slot and default size, color, and thickness`,()=>{let{container:r}=t(n(e,{value:40})),i=r.querySelector(`[data-slot="ring-progress"]`);expect(i?.tagName).toBe(`svg`),expect(i?.getAttribute(`data-size`)).toBe(`md`),expect(i?.getAttribute(`data-color`)).toBe(`primary`),expect(i?.getAttribute(`data-thickness`)).toBe(`md`),expect(i?.getAttribute(`role`)).toBe(`progressbar`),expect(i?.getAttribute(`aria-valuenow`)).toBe(`40`)}),it(`clamps out-of-range values and defaults to 0 when omitted`,()=>{let{container:r}=t(n(e,{value:-20})),{container:i}=t(n(e,{value:150})),{container:a}=t(n(e,{}));expect(r.querySelector(`[data-slot="ring-progress"]`)?.getAttribute(`aria-valuenow`)).toBe(`0`),expect(i.querySelector(`[data-slot="ring-progress"]`)?.getAttribute(`aria-valuenow`)).toBe(`100`),expect(a.querySelector(`[data-slot="ring-progress"]`)?.getAttribute(`aria-valuenow`)).toBe(`0`)}),it(`adjusts the stroke width of both circles based on the thickness variant`,()=>{let{container:r}=t(n(e,{value:50,thickness:`thick`})),i=r.querySelectorAll(`circle`);expect(i).toHaveLength(2),expect(i[0]?.getAttribute(`stroke-width`)).toBe(`16`),expect(i[1]?.getAttribute(`stroke-width`)).toBe(`16`)}),it(`applies the size and color variant classes alongside a custom className`,()=>{let{container:r}=t(n(e,{value:50,size:`lg`,color:`green`,className:`custom-class`})),i=r.querySelector(`[data-slot="ring-progress"]`)?.getAttribute(`class`);expect(i).toContain(`size-12`),expect(i).toContain(`custom-class`)}),it(`forwards a ref to the underlying svg element`,()=>{let r={current:null};t(n(e,{ref:r,value:20})),expect(r.current).toBeInstanceOf(SVGSVGElement)})});
|
|
2
2
|
//# sourceMappingURL=ring-progress.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{n as e,t}from"../scroll-area-DKS4QPHg.js";import{a as n,r}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{n as e,t}from"../scroll-area-DKS4QPHg.js";import{a as n,r}from"../react.esm-dE9nuHcL.js";import{ScrollArea as i}from"radix-ui";import{jsx as a,jsxs as o}from"react/jsx-runtime";var ResizeObserverStub=class{observe(){}unobserve(){}disconnect(){}};globalThis.ResizeObserver=globalThis.ResizeObserver??ResizeObserverStub,describe(`ScrollArea`,()=>{it(`renders the root and viewport with their data-slots and the given children`,()=>{let{container:e}=r(a(t,{children:a(`div`,{children:`Scrollable content`})}));expect(e.querySelector(`[data-slot="scroll-area"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="scroll-area-viewport"]`)).not.toBeNull(),expect(n.getByText(`Scrollable content`)).not.toBeNull()}),it(`renders a vertical scrollbar with its orientation classes once visible`,()=>{let{container:e}=r(a(t,{type:`always`,children:a(`div`,{children:`Scrollable content`})})),n=e.querySelector(`[data-slot="scroll-area-scrollbar"]`);expect(n?.getAttribute(`data-orientation`)).toBe(`vertical`),expect(n?.className).toContain(`data-vertical:w-2.5`)}),it(`merges a custom className on the root`,()=>{let{container:e}=r(a(t,{className:`custom-class`,children:`content`}));expect(e.querySelector(`[data-slot="scroll-area"]`)?.className).toContain(`custom-class`)}),it(`renders a standalone ScrollBar with the requested orientation`,()=>{let{container:t}=r(o(i.Root,{type:`always`,children:[a(i.Viewport,{children:`content`}),a(e,{orientation:`horizontal`})]})),n=t.querySelector(`[data-slot="scroll-area-scrollbar"]`);expect(n?.getAttribute(`data-orientation`)).toBe(`horizontal`),expect(n?.className).toContain(`data-horizontal:h-2.5`)}),it(`merges a custom className on the scrollbar`,()=>{let{container:t}=r(o(i.Root,{type:`always`,children:[a(i.Viewport,{children:`content`}),a(e,{className:`custom-class`})]}));expect(t.querySelector(`[data-slot="scroll-area-scrollbar"]`)?.className).toContain(`custom-class`)})});
|
|
2
2
|
//# sourceMappingURL=scroll-area.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c,u as l}from"../select-
|
|
1
|
+
import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c,u as l}from"../select-CVwVLyWt.js";export{c as Select,i as SelectContent,o as SelectGroup,n as SelectItem,e as SelectLabel,a as SelectScrollDownButton,s as SelectScrollUpButton,t as SelectSeparator,r as SelectTrigger,l as SelectValue};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,c as t,i as n,l as r,n as i,r as a,t as o,u as s}from"../select-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,c as t,i as n,l as r,n as i,r as a,t as o,u as s}from"../select-CVwVLyWt.js";import{a as c,n as l,r as u}from"../react.esm-dE9nuHcL.js";import{jsx as d,jsxs as f}from"react/jsx-runtime";beforeAll(()=>{window.HTMLElement.prototype.scrollIntoView=vi.fn(),window.HTMLElement.prototype.hasPointerCapture=vi.fn(()=>!1),window.HTMLElement.prototype.setPointerCapture=vi.fn(),window.HTMLElement.prototype.releasePointerCapture=vi.fn()});function renderSelect(c){return u(f(o,{onValueChange:c?.onValueChange,defaultValue:c?.defaultValue,children:[d(r,{children:d(s,{placeholder:`Pick a fruit`})}),f(i,{children:[f(a,{children:[d(e,{children:`Fruits`}),d(n,{value:`apple`,children:`Apple`}),d(n,{value:`banana`,children:`Banana`}),d(n,{value:`cherry`,disabled:!0,children:`Cherry`})]}),d(t,{})]})]}))}describe(`Select`,()=>{it(`renders the trigger with the placeholder and does not render the listbox until opened`,()=>{let{container:e}=renderSelect(),t=e.querySelector(`[data-slot="select-trigger"]`);expect(t).not.toBeNull(),expect(t?.getAttribute(`data-size`)).toBe(`md`),expect(c.getByText(`Pick a fruit`)).not.toBeNull(),expect(c.queryByRole(`listbox`)).toBeNull()}),it(`opens the listbox with its options when the trigger is clicked`,async()=>{renderSelect(),l.click(c.getByRole(`combobox`));let e=await c.findByRole(`listbox`);expect(e.getAttribute(`data-slot`)).toBe(`select-content`),expect(c.getByRole(`option`,{name:`Apple`})).not.toBeNull(),expect(c.getByRole(`option`,{name:`Banana`})).not.toBeNull(),expect(c.getByText(`Fruits`).getAttribute(`data-slot`)).toBe(`select-label`)}),it(`selects an item on click, calls onValueChange and closes the listbox`,async()=>{let e=vi.fn();renderSelect({onValueChange:e}),l.click(c.getByRole(`combobox`)),l.click(await c.findByRole(`option`,{name:`Banana`})),expect(e).toHaveBeenCalledWith(`banana`),expect(c.queryByRole(`listbox`)).toBeNull()}),it(`does not select a disabled item`,async()=>{let e=vi.fn();renderSelect({onValueChange:e}),l.click(c.getByRole(`combobox`));let t=await c.findByRole(`option`,{name:`Cherry`});expect(t.getAttribute(`data-disabled`)).toBe(``),l.click(t),expect(e).not.toHaveBeenCalled(),expect(c.getByRole(`listbox`)).not.toBeNull()}),it(`opens the listbox with the keyboard when the trigger is focused`,async()=>{renderSelect();let e=c.getByRole(`combobox`);e.focus(),l.keyDown(e,{key:`Enter`}),expect(await c.findByRole(`listbox`)).not.toBeNull()}),it(`applies the sm size to the trigger`,()=>{let{container:e}=u(f(o,{children:[d(r,{size:`sm`,children:d(s,{placeholder:`Pick`})}),d(i,{children:d(n,{value:`a`,children:`A`})})]}));expect(e.querySelector(`[data-slot="select-trigger"]`)?.getAttribute(`data-size`)).toBe(`sm`)}),it(`opens with a single item and renders the content without throwing`,async()=>{u(f(o,{defaultOpen:!0,children:[d(r,{children:d(s,{placeholder:`Pick`})}),d(i,{children:d(n,{value:`a`,children:`A`})})]}));let e=await c.findByRole(`listbox`);expect(e).not.toBeNull(),expect(c.getByRole(`option`,{name:`A`})).not.toBeNull()})});
|
|
2
2
|
//# sourceMappingURL=select.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../separator-CCMmbXL0.js";import{r as t}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../separator-CCMmbXL0.js";import{r as t}from"../react.esm-dE9nuHcL.js";import{jsx as n}from"react/jsx-runtime";describe(`Separator`,()=>{it(`renders a horizontal, decorative separator with the separator data-slot by default`,()=>{let{container:r}=t(n(e,{})),i=r.querySelector(`[data-slot="separator"]`);expect(i?.getAttribute(`data-orientation`)).toBe(`horizontal`),expect(i?.getAttribute(`role`)).toBe(`none`),expect(i?.className).toContain(`bg-border`)}),it(`supports the vertical orientation`,()=>{let{container:r}=t(n(e,{orientation:`vertical`})),i=r.querySelector(`[data-slot="separator"]`);expect(i?.getAttribute(`data-orientation`)).toBe(`vertical`),expect(i?.className).toContain(`data-vertical:w-px`)}),it(`exposes a separator role and aria-orientation when not decorative`,()=>{let{container:r}=t(n(e,{decorative:!1,orientation:`vertical`})),i=r.querySelector(`[data-slot="separator"]`);expect(i?.getAttribute(`role`)).toBe(`separator`),expect(i?.getAttribute(`aria-orientation`)).toBe(`vertical`)}),it(`merges a custom className with the base classes`,()=>{let{container:r}=t(n(e,{className:`custom-class`}));expect(r.querySelector(`[data-slot="separator"]`)?.className).toContain(`custom-class`)}),it(`forwards a ref to the underlying element`,()=>{let r={current:null};t(n(e,{ref:r})),expect(r.current).toBeInstanceOf(HTMLDivElement)})});
|
|
2
2
|
//# sourceMappingURL=separator.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,S as t,_ as n,a as r,b as i,c as a,d as o,f as s,g as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,u as y,v as b,w as x,x as S,y as C}from"../sidebar-
|
|
1
|
+
import{C as e,S as t,_ as n,a as r,b as i,c as a,d as o,f as s,g as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,u as y,v as b,w as x,x as S,y as C}from"../sidebar-CJriMotD.js";export{v as Sidebar,p as SidebarContent,g as SidebarFooter,u as SidebarGroup,r as SidebarGroupAction,m as SidebarGroupContent,_ as SidebarGroupLabel,a as SidebarHeader,d as SidebarInput,y as SidebarInset,o as SidebarMenu,s as SidebarMenuAction,h as SidebarMenuBadge,f as SidebarMenuButton,l as SidebarMenuItem,c as SidebarMenuSkeleton,n as SidebarMenuSub,b as SidebarMenuSubButton,C as SidebarMenuSubItem,i as SidebarProvider,S as SidebarRail,t as SidebarSeparator,e as SidebarTrigger,x as useSidebar};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{r as e}from"../tooltip-CNUNWZvs.js";import{C as t,S as n,_ as r,a as i,b as a,c as o,d as s,f as c,g as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,r as _,s as v,t as y,u as b,v as x,w as S,x as C,y as w}from"../sidebar-DemayEyw.js";import{a as T,i as E,n as D,r as O,t as k}from"../react.esm-BkhVXJ8s.js";import{Fragment as A,jsx as j,jsxs as M}from"react/jsx-runtime";import*as N from"react";if(globalThis.ResizeObserver===void 0){class ResizeObserverStub{observe(){}unobserve(){}disconnect(){}}globalThis.ResizeObserver=ResizeObserverStub}function clearSidebarCookie(){document.cookie=`sidebar_state=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`}function readSidebarCookie(){return document.cookie.split(`; `).find(e=>e.startsWith(`sidebar_state=`))?.split(`=`)[1]}function SidebarStateProbe(){let{state:e,open:t,isMobile:n,openMobile:r}=S();return j(`div`,{"data-testid":`probe`,"data-state":e,"data-open":t,"data-mobile":n,"data-open-mobile":r})}beforeEach(()=>{clearSidebarCookie()}),describe(`SidebarProvider`,()=>{it(`renders its children`,()=>{O(j(a,{children:j(`div`,{children:`sidebar content`})})),expect(T.getByText(`sidebar content`)).not.toBeNull()}),it(`renders a wrapper exposing the sidebar css variables and merges custom style/className`,()=>{let{container:e}=O(j(a,{className:`custom-wrapper`,style:{"--custom":`1px`},children:j(`div`,{children:`content`})})),t=e.querySelector(`[data-slot="sidebar-wrapper"]`);expect(t).not.toBeNull(),expect(t.className).toContain(`custom-wrapper`),expect(t.style.getPropertyValue(`--sidebar-width`)).toBe(`16rem`),expect(t.style.getPropertyValue(`--sidebar-width-icon`)).toBe(`3rem`),expect(t.style.getPropertyValue(`--custom`)).toBe(`1px`)}),it(`defaults to an expanded/open state`,()=>{O(j(a,{children:j(SidebarStateProbe,{})}));let e=T.getByTestId(`probe`);expect(e.getAttribute(`data-state`)).toBe(`expanded`),expect(e.getAttribute(`data-open`)).toBe(`true`)}),it(`honors defaultOpen={false}`,()=>{O(j(a,{defaultOpen:!1,children:j(SidebarStateProbe,{})})),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`collapsed`)}),it(`toggles open state via the trigger and persists it to the sidebar_state cookie`,()=>{O(M(a,{children:[j(SidebarStateProbe,{}),j(t,{})]})),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`expanded`),D.click(T.getByRole(`button`)),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`collapsed`),expect(readSidebarCookie()).toBe(`false`),D.click(T.getByRole(`button`)),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`expanded`),expect(readSidebarCookie()).toBe(`true`)}),it(`supports a controlled open state via open/onOpenChange`,()=>{let e=vi.fn();function Controlled(){let[n,r]=N.useState(!1);return M(a,{open:n,onOpenChange:t=>{r(t),e(t)},children:[j(SidebarStateProbe,{}),j(t,{})]})}O(j(Controlled,{})),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`collapsed`),D.click(T.getByRole(`button`)),expect(e).toHaveBeenCalledWith(!0),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`expanded`),expect(readSidebarCookie()).toBe(`true`)}),it(`toggles the sidebar with the Cmd/Ctrl+B keyboard shortcut`,()=>{O(j(a,{children:j(SidebarStateProbe,{})})),D.keyDown(window,{key:`b`,metaKey:!0}),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`collapsed`),D.keyDown(window,{key:`b`,ctrlKey:!0}),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`expanded`)}),it(`ignores the shortcut key without a meta/ctrl modifier`,()=>{O(j(a,{children:j(SidebarStateProbe,{})})),D.keyDown(window,{key:`b`}),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`expanded`)}),it(`reports isMobile from the current viewport width`,()=>{setTestViewportWidth(500),O(j(a,{children:j(SidebarStateProbe,{})}));let e=T.getByTestId(`probe`);expect(e.getAttribute(`data-mobile`)).toBe(`true`),expect(e.getAttribute(`data-open-mobile`)).toBe(`false`)}),it(`toggles openMobile instead of open on a mobile viewport, without writing the cookie`,()=>{setTestViewportWidth(500),O(M(a,{children:[j(SidebarStateProbe,{}),j(t,{})]})),D.click(T.getByRole(`button`));let e=T.getByTestId(`probe`);expect(e.getAttribute(`data-open-mobile`)).toBe(`true`),expect(e.getAttribute(`data-open`)).toBe(`true`),expect(readSidebarCookie()).toBeUndefined()})}),describe(`useSidebar`,()=>{it(`throws when used outside of a SidebarProvider`,()=>{expect(()=>E(()=>S())).toThrow(`useSidebar must be used within a SidebarProvider.`)}),it(`exposes state, open, isMobile, openMobile and toggleSidebar to consumers`,()=>{let{result:e}=E(()=>S(),{wrapper:({children:e})=>j(a,{children:e})});expect(e.current.state).toBe(`expanded`),expect(e.current.open).toBe(!0),expect(e.current.isMobile).toBe(!1),expect(e.current.openMobile).toBe(!1),k(()=>{e.current.toggleSidebar()}),expect(e.current.open).toBe(!1),expect(e.current.state).toBe(`collapsed`)})}),describe(`Sidebar`,()=>{it(`renders a plain wrapper when collapsible="none"`,()=>{let{container:e}=O(j(a,{children:j(y,{collapsible:`none`,children:`plain content`})})),t=e.querySelector(`[data-slot="sidebar"]`);expect(t).not.toBeNull(),expect(t.className).toContain(`w-(--sidebar-width)`),expect(t.getAttribute(`data-state`)).toBeNull(),expect(T.getByText(`plain content`)).not.toBeNull()}),it(`renders the desktop layout with gap/container/inner elements reflecting side/variant/state`,()=>{let{container:e}=O(j(a,{defaultOpen:!1,children:j(y,{side:`right`,variant:`floating`,collapsible:`icon`,children:`desktop content`})})),t=e.querySelector(`[data-slot="sidebar"]`);expect(t.getAttribute(`data-state`)).toBe(`collapsed`),expect(t.getAttribute(`data-collapsible`)).toBe(`icon`),expect(t.getAttribute(`data-variant`)).toBe(`floating`),expect(t.getAttribute(`data-side`)).toBe(`right`),expect(e.querySelector(`[data-slot="sidebar-gap"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="sidebar-container"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="sidebar-inner"]`)).not.toBeNull()}),it(`clears data-collapsible while expanded`,()=>{let{container:e}=O(j(a,{children:j(y,{collapsible:`icon`,children:`content`})}));expect(e.querySelector(`[data-slot="sidebar"]`)?.getAttribute(`data-collapsible`)).toBe(``)}),it(`is not rendered on mobile until openMobile is toggled, then renders inside a Drawer`,()=>{setTestViewportWidth(500);let{container:e,baseElement:n}=O(M(a,{children:[j(y,{children:j(`span`,{children:`mobile content`})}),j(t,{})]}));expect(e.querySelector(`[data-slot="sidebar"]`)).toBeNull(),expect(n.querySelector(`[data-slot="sidebar"]`)).toBeNull(),D.click(T.getByRole(`button`));let r=n.querySelector(`[data-slot="sidebar"]`);expect(r).not.toBeNull(),expect(r.getAttribute(`data-mobile`)).toBe(`true`),expect(T.getByText(`mobile content`)).not.toBeNull()})}),describe(`SidebarTrigger`,()=>{it(`renders with the sidebar-trigger slot and an accessible label`,()=>{let{container:e}=O(j(a,{children:j(t,{})}));expect(e.querySelector(`[data-slot="sidebar-trigger"]`)).not.toBeNull(),expect(T.getByRole(`button`,{name:`Toggle Sidebar`})).not.toBeNull()}),it(`calls a provided onClick handler in addition to toggling the sidebar`,()=>{let e=vi.fn();O(M(a,{children:[j(SidebarStateProbe,{}),j(t,{onClick:e})]})),D.click(T.getByRole(`button`)),expect(e).toHaveBeenCalledTimes(1),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`collapsed`)})}),describe(`SidebarRail`,()=>{it(`renders a rail button with the expected slot, label and tabIndex`,()=>{let{container:e}=O(j(a,{children:j(C,{})})),t=e.querySelector(`[data-slot="sidebar-rail"]`);expect(t).not.toBeNull(),expect(t.getAttribute(`aria-label`)).toBe(`Toggle Sidebar`),expect(t.getAttribute(`tabIndex`)).toBe(`-1`)}),it(`toggles the sidebar when clicked`,()=>{O(M(a,{children:[j(SidebarStateProbe,{}),j(C,{})]})),D.click(T.getByTitle(`Toggle Sidebar`)),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`collapsed`)})}),describe(`static layout subcomponents`,()=>{it(`renders SidebarInset as a main element`,()=>{let{container:e}=O(j(b,{children:`inset content`}));expect(e.querySelector(`[data-slot="sidebar-inset"]`)?.tagName).toBe(`MAIN`)}),it(`renders SidebarInput as a styled text input`,()=>{O(j(f,{placeholder:`Search`}));let e=T.getByPlaceholderText(`Search`);expect(e.getAttribute(`data-slot`)).toBe(`sidebar-input`),expect(e.className).toContain(`h-8`)}),it(`renders SidebarHeader, SidebarFooter, SidebarSeparator and SidebarContent with their slots`,()=>{let{container:e}=O(M(A,{children:[j(o,{children:`header`}),j(_,{children:`footer`}),j(n,{}),j(m,{children:`content`})]}));expect(e.querySelector(`[data-slot="sidebar-header"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="sidebar-footer"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="sidebar-separator"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="sidebar-content"]`)).not.toBeNull()}),it(`renders SidebarGroup, SidebarGroupContent, SidebarMenu, SidebarMenuItem, SidebarMenuBadge, SidebarMenuSub and SidebarMenuSubItem with their slots`,()=>{let{container:e}=O(j(d,{children:j(h,{children:j(s,{children:M(u,{children:[`item`,j(g,{children:`1`}),j(r,{children:j(w,{children:`sub item`})})]})})})}));expect(e.querySelector(`[data-slot="sidebar-group"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="sidebar-group-content"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="sidebar-menu"]`)?.tagName).toBe(`UL`),expect(e.querySelector(`[data-slot="sidebar-menu-item"]`)?.tagName).toBe(`LI`),expect(e.querySelector(`[data-slot="sidebar-menu-badge"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="sidebar-menu-sub"]`)?.tagName).toBe(`UL`),expect(e.querySelector(`[data-slot="sidebar-menu-sub-item"]`)?.tagName).toBe(`LI`)})}),describe(`SidebarGroupLabel`,()=>{it(`renders as a div by default`,()=>{let{container:e}=O(j(v,{children:`Label`}));expect(e.querySelector(`[data-slot="sidebar-group-label"]`)?.tagName).toBe(`DIV`)}),it(`renders as the child element when asChild is set`,()=>{let{container:e}=O(j(v,{asChild:!0,children:j(`span`,{children:`Label`})}));expect(e.querySelector(`[data-slot="sidebar-group-label"]`)?.tagName).toBe(`SPAN`)})}),describe(`SidebarGroupAction`,()=>{it(`renders as a button by default`,()=>{let{container:e}=O(j(i,{children:`Add`}));expect(e.querySelector(`[data-slot="sidebar-group-action"]`)?.tagName).toBe(`BUTTON`)}),it(`renders as the child element when asChild is set and forwards click handlers`,()=>{let e=vi.fn();O(j(i,{asChild:!0,onClick:e,children:j(`a`,{href:`#action`,children:`Add`})}));let t=T.getByText(`Add`);expect(t.tagName).toBe(`A`),D.click(t),expect(e).toHaveBeenCalledTimes(1)})}),describe(`SidebarMenuButton`,()=>{it(`renders default size/active data attributes`,()=>{let{container:e}=O(j(a,{children:j(p,{children:`Item`})})),t=e.querySelector(`[data-slot="sidebar-menu-button"]`);expect(t.getAttribute(`data-size`)).toBe(`md`),expect(t.getAttribute(`data-active`)).toBe(`false`)}),it(`reflects isActive and a custom size`,()=>{let{container:e}=O(j(a,{children:j(p,{isActive:!0,size:`lg`,children:`Item`})})),t=e.querySelector(`[data-slot="sidebar-menu-button"]`);expect(t.getAttribute(`data-active`)).toBe(`true`),expect(t.getAttribute(`data-size`)).toBe(`lg`)}),it(`renders as the child element when asChild is set`,()=>{O(j(a,{children:j(p,{asChild:!0,children:j(`a`,{href:`#item`,children:`Item`})})})),expect(T.getByRole(`link`,{name:`Item`})).not.toBeNull()}),it(`renders without a tooltip wrapper when no tooltip is provided`,()=>{let{container:e}=O(j(a,{children:j(p,{children:`Item`})}));expect(e.querySelector(`[data-slot="tooltip-trigger"]`)).toBeNull()}),it(`wraps the button in a Tooltip when a string tooltip is provided`,()=>{let{baseElement:t}=O(j(e,{children:j(a,{defaultOpen:!1,children:j(p,{tooltip:`Item tooltip`,children:`Item`})})}));expect(t.querySelector(`[data-slot="tooltip-content"]`)).toBeNull(),D.focus(T.getByText(`Item`)),expect(t.querySelector(`[data-slot="tooltip-content"]`)?.textContent).toBe(`Item tooltip`)}),it(`accepts an object tooltip with custom content props`,()=>{let{baseElement:t}=O(j(e,{children:j(a,{defaultOpen:!1,children:j(p,{tooltip:{children:`Custom tooltip`,side:`bottom`},children:`Item`})})}));D.focus(T.getByText(`Item`));let n=t.querySelector(`[data-slot="tooltip-content"]`);expect(n?.textContent).toBe(`Custom tooltip`),expect(n?.getAttribute(`data-side`)).toBe(`bottom`)}),it(`hides the tooltip content while expanded and shows it while collapsed on desktop`,()=>{let{baseElement:n}=O(j(e,{children:M(a,{defaultOpen:!0,children:[j(p,{tooltip:`Item tooltip`,children:`Item`}),j(t,{})]})}));D.focus(T.getByText(`Item`));let r=n.querySelector(`[data-slot="tooltip-content"]`);expect(r.hidden).toBe(!0),D.click(T.getByRole(`button`,{name:`Toggle Sidebar`})),expect(r.hidden).toBe(!1)})}),describe(`SidebarMenuAction`,()=>{it(`renders as a button with the menu-action slot`,()=>{let{container:e}=O(j(c,{children:`Action`}));expect(e.querySelector(`[data-slot="sidebar-menu-action"]`)?.tagName).toBe(`BUTTON`)}),it(`applies the showOnHover classes when requested`,()=>{let{container:e}=O(j(c,{showOnHover:!0,children:`Action`})),t=e.querySelector(`[data-slot="sidebar-menu-action"]`);expect(t.className).toContain(`md:opacity-0`)}),it(`renders as the child element when asChild is set`,()=>{O(j(c,{asChild:!0,children:j(`a`,{href:`#action`,children:`Action`})})),expect(T.getByRole(`link`,{name:`Action`})).not.toBeNull()})}),describe(`SidebarMenuSkeleton`,()=>{it(`renders a text placeholder without an icon by default`,()=>{let{container:e}=O(j(l,{}));expect(e.querySelector(`[data-sidebar="menu-skeleton-icon"]`)).toBeNull(),expect(e.querySelector(`[data-sidebar="menu-skeleton-text"]`)).not.toBeNull()}),it(`renders an icon skeleton when showIcon is set`,()=>{let{container:e}=O(j(l,{showIcon:!0}));expect(e.querySelector(`[data-sidebar="menu-skeleton-icon"]`)).not.toBeNull()}),it(`assigns a random text width between 50% and 90%`,()=>{let{container:e}=O(j(l,{})),t=e.querySelector(`[data-sidebar="menu-skeleton-text"]`),n=Number(t.style.getPropertyValue(`--skeleton-width`).replace(`%`,``));expect(n).toBeGreaterThanOrEqual(50),expect(n).toBeLessThanOrEqual(90)})}),describe(`SidebarMenuSubButton`,()=>{it(`renders as an anchor by default with size and active data attributes`,()=>{let{container:e}=O(j(x,{href:`#sub`,children:`Sub item`})),t=e.querySelector(`[data-slot="sidebar-menu-sub-button"]`);expect(t.tagName).toBe(`A`),expect(t.getAttribute(`data-size`)).toBe(`md`),expect(t.getAttribute(`data-active`)).toBe(`false`)}),it(`reflects isActive and a custom size`,()=>{let{container:e}=O(j(x,{isActive:!0,size:`sm`,children:`Sub item`})),t=e.querySelector(`[data-slot="sidebar-menu-sub-button"]`);expect(t.getAttribute(`data-active`)).toBe(`true`),expect(t.getAttribute(`data-size`)).toBe(`sm`)}),it(`renders as the child element when asChild is set`,()=>{O(j(x,{asChild:!0,children:j(`button`,{type:`button`,children:`Sub item`})})),expect(T.getByRole(`button`,{name:`Sub item`})).not.toBeNull()})});
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{r as e}from"../tooltip-CNUNWZvs.js";import{C as t,S as n,_ as r,a as i,b as a,c as o,d as s,f as c,g as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,r as _,s as v,t as y,u as b,v as x,w as S,x as C,y as w}from"../sidebar-CJriMotD.js";import{a as T,i as E,n as D,r as O,t as k}from"../react.esm-dE9nuHcL.js";import{Fragment as A,jsx as j,jsxs as M}from"react/jsx-runtime";import*as N from"react";if(globalThis.ResizeObserver===void 0){class ResizeObserverStub{observe(){}unobserve(){}disconnect(){}}globalThis.ResizeObserver=ResizeObserverStub}function clearSidebarCookie(){document.cookie=`sidebar_state=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`}function readSidebarCookie(){return document.cookie.split(`; `).find(e=>e.startsWith(`sidebar_state=`))?.split(`=`)[1]}function SidebarStateProbe(){let{state:e,open:t,isMobile:n,openMobile:r}=S();return j(`div`,{"data-testid":`probe`,"data-state":e,"data-open":t,"data-mobile":n,"data-open-mobile":r})}beforeEach(()=>{clearSidebarCookie()}),describe(`SidebarProvider`,()=>{it(`renders its children`,()=>{O(j(a,{children:j(`div`,{children:`sidebar content`})})),expect(T.getByText(`sidebar content`)).not.toBeNull()}),it(`renders a wrapper exposing the sidebar css variables and merges custom style/className`,()=>{let{container:e}=O(j(a,{className:`custom-wrapper`,style:{"--custom":`1px`},children:j(`div`,{children:`content`})})),t=e.querySelector(`[data-slot="sidebar-wrapper"]`);expect(t).not.toBeNull(),expect(t.className).toContain(`custom-wrapper`),expect(t.style.getPropertyValue(`--sidebar-width`)).toBe(`16rem`),expect(t.style.getPropertyValue(`--sidebar-width-icon`)).toBe(`3rem`),expect(t.style.getPropertyValue(`--custom`)).toBe(`1px`)}),it(`defaults to an expanded/open state`,()=>{O(j(a,{children:j(SidebarStateProbe,{})}));let e=T.getByTestId(`probe`);expect(e.getAttribute(`data-state`)).toBe(`expanded`),expect(e.getAttribute(`data-open`)).toBe(`true`)}),it(`honors defaultOpen={false}`,()=>{O(j(a,{defaultOpen:!1,children:j(SidebarStateProbe,{})})),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`collapsed`)}),it(`toggles open state via the trigger and persists it to the sidebar_state cookie`,()=>{O(M(a,{children:[j(SidebarStateProbe,{}),j(t,{})]})),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`expanded`),D.click(T.getByRole(`button`)),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`collapsed`),expect(readSidebarCookie()).toBe(`false`),D.click(T.getByRole(`button`)),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`expanded`),expect(readSidebarCookie()).toBe(`true`)}),it(`supports a controlled open state via open/onOpenChange`,()=>{let e=vi.fn();function Controlled(){let[n,r]=N.useState(!1);return M(a,{open:n,onOpenChange:t=>{r(t),e(t)},children:[j(SidebarStateProbe,{}),j(t,{})]})}O(j(Controlled,{})),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`collapsed`),D.click(T.getByRole(`button`)),expect(e).toHaveBeenCalledWith(!0),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`expanded`),expect(readSidebarCookie()).toBe(`true`)}),it(`toggles the sidebar with the Cmd/Ctrl+B keyboard shortcut`,()=>{O(j(a,{children:j(SidebarStateProbe,{})})),D.keyDown(window,{key:`b`,metaKey:!0}),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`collapsed`),D.keyDown(window,{key:`b`,ctrlKey:!0}),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`expanded`)}),it(`ignores the shortcut key without a meta/ctrl modifier`,()=>{O(j(a,{children:j(SidebarStateProbe,{})})),D.keyDown(window,{key:`b`}),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`expanded`)}),it(`reports isMobile from the current viewport width`,()=>{setTestViewportWidth(500),O(j(a,{children:j(SidebarStateProbe,{})}));let e=T.getByTestId(`probe`);expect(e.getAttribute(`data-mobile`)).toBe(`true`),expect(e.getAttribute(`data-open-mobile`)).toBe(`false`)}),it(`toggles openMobile instead of open on a mobile viewport, without writing the cookie`,()=>{setTestViewportWidth(500),O(M(a,{children:[j(SidebarStateProbe,{}),j(t,{})]})),D.click(T.getByRole(`button`));let e=T.getByTestId(`probe`);expect(e.getAttribute(`data-open-mobile`)).toBe(`true`),expect(e.getAttribute(`data-open`)).toBe(`true`),expect(readSidebarCookie()).toBeUndefined()})}),describe(`useSidebar`,()=>{it(`throws when used outside of a SidebarProvider`,()=>{expect(()=>E(()=>S())).toThrow(`useSidebar must be used within a SidebarProvider.`)}),it(`exposes state, open, isMobile, openMobile and toggleSidebar to consumers`,()=>{let{result:e}=E(()=>S(),{wrapper:({children:e})=>j(a,{children:e})});expect(e.current.state).toBe(`expanded`),expect(e.current.open).toBe(!0),expect(e.current.isMobile).toBe(!1),expect(e.current.openMobile).toBe(!1),k(()=>{e.current.toggleSidebar()}),expect(e.current.open).toBe(!1),expect(e.current.state).toBe(`collapsed`)})}),describe(`Sidebar`,()=>{it(`renders a plain wrapper when collapsible="none"`,()=>{let{container:e}=O(j(a,{children:j(y,{collapsible:`none`,children:`plain content`})})),t=e.querySelector(`[data-slot="sidebar"]`);expect(t).not.toBeNull(),expect(t.className).toContain(`w-(--sidebar-width)`),expect(t.getAttribute(`data-state`)).toBeNull(),expect(T.getByText(`plain content`)).not.toBeNull()}),it(`renders the desktop layout with gap/container/inner elements reflecting side/variant/state`,()=>{let{container:e}=O(j(a,{defaultOpen:!1,children:j(y,{side:`right`,variant:`floating`,collapsible:`icon`,children:`desktop content`})})),t=e.querySelector(`[data-slot="sidebar"]`);expect(t.getAttribute(`data-state`)).toBe(`collapsed`),expect(t.getAttribute(`data-collapsible`)).toBe(`icon`),expect(t.getAttribute(`data-variant`)).toBe(`floating`),expect(t.getAttribute(`data-side`)).toBe(`right`),expect(e.querySelector(`[data-slot="sidebar-gap"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="sidebar-container"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="sidebar-inner"]`)).not.toBeNull()}),it(`clears data-collapsible while expanded`,()=>{let{container:e}=O(j(a,{children:j(y,{collapsible:`icon`,children:`content`})}));expect(e.querySelector(`[data-slot="sidebar"]`)?.getAttribute(`data-collapsible`)).toBe(``)}),it(`is not rendered on mobile until openMobile is toggled, then renders inside a Drawer`,()=>{setTestViewportWidth(500);let{container:e,baseElement:n}=O(M(a,{children:[j(y,{children:j(`span`,{children:`mobile content`})}),j(t,{})]}));expect(e.querySelector(`[data-slot="sidebar"]`)).toBeNull(),expect(n.querySelector(`[data-slot="sidebar"]`)).toBeNull(),D.click(T.getByRole(`button`));let r=n.querySelector(`[data-slot="sidebar"]`);expect(r).not.toBeNull(),expect(r.getAttribute(`data-mobile`)).toBe(`true`),expect(T.getByText(`mobile content`)).not.toBeNull()})}),describe(`SidebarTrigger`,()=>{it(`renders with the sidebar-trigger slot and an accessible label`,()=>{let{container:e}=O(j(a,{children:j(t,{})}));expect(e.querySelector(`[data-slot="sidebar-trigger"]`)).not.toBeNull(),expect(T.getByRole(`button`,{name:`Toggle Sidebar`})).not.toBeNull()}),it(`calls a provided onClick handler in addition to toggling the sidebar`,()=>{let e=vi.fn();O(M(a,{children:[j(SidebarStateProbe,{}),j(t,{onClick:e})]})),D.click(T.getByRole(`button`)),expect(e).toHaveBeenCalledTimes(1),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`collapsed`)})}),describe(`SidebarRail`,()=>{it(`renders a rail button with the expected slot, label and tabIndex`,()=>{let{container:e}=O(j(a,{children:j(C,{})})),t=e.querySelector(`[data-slot="sidebar-rail"]`);expect(t).not.toBeNull(),expect(t.getAttribute(`aria-label`)).toBe(`Toggle Sidebar`),expect(t.getAttribute(`tabIndex`)).toBe(`-1`)}),it(`toggles the sidebar when clicked`,()=>{O(M(a,{children:[j(SidebarStateProbe,{}),j(C,{})]})),D.click(T.getByTitle(`Toggle Sidebar`)),expect(T.getByTestId(`probe`).getAttribute(`data-state`)).toBe(`collapsed`)})}),describe(`static layout subcomponents`,()=>{it(`renders SidebarInset as a main element`,()=>{let{container:e}=O(j(b,{children:`inset content`}));expect(e.querySelector(`[data-slot="sidebar-inset"]`)?.tagName).toBe(`MAIN`)}),it(`renders SidebarInput as a styled text input`,()=>{O(j(f,{placeholder:`Search`}));let e=T.getByPlaceholderText(`Search`);expect(e.getAttribute(`data-slot`)).toBe(`sidebar-input`),expect(e.className).toContain(`h-8`)}),it(`renders SidebarHeader, SidebarFooter, SidebarSeparator and SidebarContent with their slots`,()=>{let{container:e}=O(M(A,{children:[j(o,{children:`header`}),j(_,{children:`footer`}),j(n,{}),j(m,{children:`content`})]}));expect(e.querySelector(`[data-slot="sidebar-header"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="sidebar-footer"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="sidebar-separator"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="sidebar-content"]`)).not.toBeNull()}),it(`renders SidebarGroup, SidebarGroupContent, SidebarMenu, SidebarMenuItem, SidebarMenuBadge, SidebarMenuSub and SidebarMenuSubItem with their slots`,()=>{let{container:e}=O(j(d,{children:j(h,{children:j(s,{children:M(u,{children:[`item`,j(g,{children:`1`}),j(r,{children:j(w,{children:`sub item`})})]})})})}));expect(e.querySelector(`[data-slot="sidebar-group"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="sidebar-group-content"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="sidebar-menu"]`)?.tagName).toBe(`UL`),expect(e.querySelector(`[data-slot="sidebar-menu-item"]`)?.tagName).toBe(`LI`),expect(e.querySelector(`[data-slot="sidebar-menu-badge"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="sidebar-menu-sub"]`)?.tagName).toBe(`UL`),expect(e.querySelector(`[data-slot="sidebar-menu-sub-item"]`)?.tagName).toBe(`LI`)})}),describe(`SidebarGroupLabel`,()=>{it(`renders as a div by default`,()=>{let{container:e}=O(j(v,{children:`Label`}));expect(e.querySelector(`[data-slot="sidebar-group-label"]`)?.tagName).toBe(`DIV`)}),it(`renders as the child element when asChild is set`,()=>{let{container:e}=O(j(v,{asChild:!0,children:j(`span`,{children:`Label`})}));expect(e.querySelector(`[data-slot="sidebar-group-label"]`)?.tagName).toBe(`SPAN`)})}),describe(`SidebarGroupAction`,()=>{it(`renders as a button by default`,()=>{let{container:e}=O(j(i,{children:`Add`}));expect(e.querySelector(`[data-slot="sidebar-group-action"]`)?.tagName).toBe(`BUTTON`)}),it(`renders as the child element when asChild is set and forwards click handlers`,()=>{let e=vi.fn();O(j(i,{asChild:!0,onClick:e,children:j(`a`,{href:`#action`,children:`Add`})}));let t=T.getByText(`Add`);expect(t.tagName).toBe(`A`),D.click(t),expect(e).toHaveBeenCalledTimes(1)})}),describe(`SidebarMenuButton`,()=>{it(`renders default size/active data attributes`,()=>{let{container:e}=O(j(a,{children:j(p,{children:`Item`})})),t=e.querySelector(`[data-slot="sidebar-menu-button"]`);expect(t.getAttribute(`data-size`)).toBe(`md`),expect(t.getAttribute(`data-active`)).toBe(`false`)}),it(`reflects isActive and a custom size`,()=>{let{container:e}=O(j(a,{children:j(p,{isActive:!0,size:`lg`,children:`Item`})})),t=e.querySelector(`[data-slot="sidebar-menu-button"]`);expect(t.getAttribute(`data-active`)).toBe(`true`),expect(t.getAttribute(`data-size`)).toBe(`lg`)}),it(`renders as the child element when asChild is set`,()=>{O(j(a,{children:j(p,{asChild:!0,children:j(`a`,{href:`#item`,children:`Item`})})})),expect(T.getByRole(`link`,{name:`Item`})).not.toBeNull()}),it(`renders without a tooltip wrapper when no tooltip is provided`,()=>{let{container:e}=O(j(a,{children:j(p,{children:`Item`})}));expect(e.querySelector(`[data-slot="tooltip-trigger"]`)).toBeNull()}),it(`wraps the button in a Tooltip when a string tooltip is provided`,()=>{let{baseElement:t}=O(j(e,{children:j(a,{defaultOpen:!1,children:j(p,{tooltip:`Item tooltip`,children:`Item`})})}));expect(t.querySelector(`[data-slot="tooltip-content"]`)).toBeNull(),D.focus(T.getByText(`Item`)),expect(t.querySelector(`[data-slot="tooltip-content"]`)?.textContent).toBe(`Item tooltip`)}),it(`accepts an object tooltip with custom content props`,()=>{let{baseElement:t}=O(j(e,{children:j(a,{defaultOpen:!1,children:j(p,{tooltip:{children:`Custom tooltip`,side:`bottom`},children:`Item`})})}));D.focus(T.getByText(`Item`));let n=t.querySelector(`[data-slot="tooltip-content"]`);expect(n?.textContent).toBe(`Custom tooltip`),expect(n?.getAttribute(`data-side`)).toBe(`bottom`)}),it(`hides the tooltip content while expanded and shows it while collapsed on desktop`,()=>{let{baseElement:n}=O(j(e,{children:M(a,{defaultOpen:!0,children:[j(p,{tooltip:`Item tooltip`,children:`Item`}),j(t,{})]})}));D.focus(T.getByText(`Item`));let r=n.querySelector(`[data-slot="tooltip-content"]`);expect(r.hidden).toBe(!0),D.click(T.getByRole(`button`,{name:`Toggle Sidebar`})),expect(r.hidden).toBe(!1)})}),describe(`SidebarMenuAction`,()=>{it(`renders as a button with the menu-action slot`,()=>{let{container:e}=O(j(c,{children:`Action`}));expect(e.querySelector(`[data-slot="sidebar-menu-action"]`)?.tagName).toBe(`BUTTON`)}),it(`applies the showOnHover classes when requested`,()=>{let{container:e}=O(j(c,{showOnHover:!0,children:`Action`})),t=e.querySelector(`[data-slot="sidebar-menu-action"]`);expect(t.className).toContain(`md:opacity-0`)}),it(`renders as the child element when asChild is set`,()=>{O(j(c,{asChild:!0,children:j(`a`,{href:`#action`,children:`Action`})})),expect(T.getByRole(`link`,{name:`Action`})).not.toBeNull()})}),describe(`SidebarMenuSkeleton`,()=>{it(`renders a text placeholder without an icon by default`,()=>{let{container:e}=O(j(l,{}));expect(e.querySelector(`[data-sidebar="menu-skeleton-icon"]`)).toBeNull(),expect(e.querySelector(`[data-sidebar="menu-skeleton-text"]`)).not.toBeNull()}),it(`renders an icon skeleton when showIcon is set`,()=>{let{container:e}=O(j(l,{showIcon:!0}));expect(e.querySelector(`[data-sidebar="menu-skeleton-icon"]`)).not.toBeNull()}),it(`assigns a random text width between 50% and 90%`,()=>{let{container:e}=O(j(l,{})),t=e.querySelector(`[data-sidebar="menu-skeleton-text"]`),n=Number(t.style.getPropertyValue(`--skeleton-width`).replace(`%`,``));expect(n).toBeGreaterThanOrEqual(50),expect(n).toBeLessThanOrEqual(90)})}),describe(`SidebarMenuSubButton`,()=>{it(`renders as an anchor by default with size and active data attributes`,()=>{let{container:e}=O(j(x,{href:`#sub`,children:`Sub item`})),t=e.querySelector(`[data-slot="sidebar-menu-sub-button"]`);expect(t.tagName).toBe(`A`),expect(t.getAttribute(`data-size`)).toBe(`md`),expect(t.getAttribute(`data-active`)).toBe(`false`)}),it(`reflects isActive and a custom size`,()=>{let{container:e}=O(j(x,{isActive:!0,size:`sm`,children:`Sub item`})),t=e.querySelector(`[data-slot="sidebar-menu-sub-button"]`);expect(t.getAttribute(`data-active`)).toBe(`true`),expect(t.getAttribute(`data-size`)).toBe(`sm`)}),it(`renders as the child element when asChild is set`,()=>{O(j(x,{asChild:!0,children:j(`button`,{type:`button`,children:`Sub item`})})),expect(T.getByRole(`button`,{name:`Sub item`})).not.toBeNull()})});
|
|
2
2
|
//# sourceMappingURL=sidebar.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../simple-grid-9EryoUWI.js";import{r as t}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../simple-grid-9EryoUWI.js";import{r as t}from"../react.esm-dE9nuHcL.js";import{jsx as n}from"react/jsx-runtime";describe(`SimpleGrid`,()=>{it(`renders with data-slot, base grid classes and a single default column`,()=>{let{container:r}=t(n(e,{})),i=r.querySelector(`[data-slot="simple-grid"]`);expect(i).not.toBeNull(),expect(i.className).toContain(`grid`),expect(i.className).toContain(`min-w-0`),expect(i.style.getPropertyValue(`--simple-grid-cols`)).toBe(`1`),expect(i.style.getPropertyValue(`--simple-grid-gap`)).toBe(`0px`)}),it(`sets the cols and gap css variables from the cols and gap props`,()=>{let{container:r}=t(n(e,{cols:3,gap:`lg`})),i=r.querySelector(`[data-slot="simple-grid"]`);expect(i.style.getPropertyValue(`--simple-grid-cols`)).toBe(`3`),expect(i.style.getPropertyValue(`--simple-grid-gap`)).toBe(`calc(var(--spacing) * 6)`),expect(i.style.getPropertyValue(`--simple-grid-row-gap`)).toBe(`var(--simple-grid-gap)`),expect(i.style.getPropertyValue(`--simple-grid-column-gap`)).toBe(`var(--simple-grid-gap)`)}),it(`overrides row and column gaps independently from gap`,()=>{let{container:r}=t(n(e,{gap:`sm`,rowGap:`xl`,columnGap:`xs`})),i=r.querySelector(`[data-slot="simple-grid"]`);expect(i.style.getPropertyValue(`--simple-grid-gap`)).toBe(`calc(var(--spacing) * 2)`),expect(i.style.getPropertyValue(`--simple-grid-row-gap`)).toBe(`calc(var(--spacing) * 8)`),expect(i.style.getPropertyValue(`--simple-grid-column-gap`)).toBe(`calc(var(--spacing) * 1)`)}),it(`merges a custom className with the base classes`,()=>{let{container:r}=t(n(e,{className:`custom-grid`}));expect(r.querySelector(`[data-slot="simple-grid"]`)?.className).toContain(`custom-grid`)}),it(`forwards ref to the underlying div element`,()=>{let r={current:null};t(n(e,{ref:r})),expect(r.current).toBeInstanceOf(HTMLDivElement)})});
|
|
2
2
|
//# sourceMappingURL=simple-grid.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../skeleton-Cn3zBJRe.js";import{a as t,r as n}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../skeleton-Cn3zBJRe.js";import{a as t,r as n}from"../react.esm-dE9nuHcL.js";import{jsx as r}from"react/jsx-runtime";describe(`Skeleton`,()=>{it(`renders the legacy placeholder when children are not provided`,()=>{let{container:t}=n(r(e,{className:`h-4 w-48`})),i=t.querySelector(`[data-slot="skeleton"]`);expect(i).not.toBeNull(),expect(i?.className).toContain(`bg-muted`),expect(i?.className).toContain(`animate-pulse`),expect(i?.className).toContain(`h-4`),expect(t.querySelector(`[data-slot="skeleton-overlay"]`)).toBeNull()}),it(`keeps children in the DOM and renders an overlay when visible`,()=>{let{container:i}=n(r(e,{visible:!0,children:r(`button`,{type:`button`,children:`Save changes`})})),a=i.querySelector(`[data-slot="skeleton-content"]`),o=i.querySelector(`[data-slot="skeleton-overlay"]`);expect(t.getByRole(`button`,{hidden:!0,name:`Save changes`})).not.toBeNull(),expect(a?.className).toContain(`invisible`),expect(a?.getAttribute(`aria-hidden`)).toBe(`true`),expect(o).not.toBeNull(),expect(o?.className).toContain(`absolute`),expect(o?.className).toContain(`inset-0`)}),it(`shows children and does not render an overlay when hidden`,()=>{let{container:i}=n(r(e,{visible:!1,children:r(`button`,{type:`button`,children:`Save changes`})})),a=i.querySelector(`[data-slot="skeleton-content"]`);expect(t.getByRole(`button`,{name:`Save changes`})).not.toBeNull(),expect(a?.className).not.toContain(`invisible`),expect(a?.getAttribute(`aria-hidden`)).toBeNull(),expect(i.querySelector(`[data-slot="skeleton-overlay"]`)).toBeNull()})});
|
|
2
2
|
//# sourceMappingURL=skeleton.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{o as e,t}from"../field-DzR-XrO7.js";import{t as n}from"../slider-CC-gQawq.js";import{r}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{o as e,t}from"../field-DzR-XrO7.js";import{t as n}from"../slider-CC-gQawq.js";import{r}from"../react.esm-dE9nuHcL.js";import{jsx as i,jsxs as a}from"react/jsx-runtime";var ResizeObserverStub=class{observe(){}unobserve(){}disconnect(){}};globalThis.ResizeObserver=ResizeObserverStub,describe(`Slider`,()=>{it(`renders the track, range and one thumb per default min/max value`,()=>{let{container:e}=r(i(n,{}));expect(e.querySelector(`[data-slot="slider"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="slider-track"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="slider-range"]`)).not.toBeNull(),expect(e.querySelectorAll(`[data-slot="slider-thumb"]`)).toHaveLength(2)}),it(`renders a single thumb when defaultValue has one value`,()=>{let{container:e}=r(i(n,{defaultValue:[40]}));expect(e.querySelectorAll(`[data-slot="slider-thumb"]`)).toHaveLength(1)}),it(`renders one thumb per value when the value prop is controlled`,()=>{let{container:e}=r(i(n,{value:[10,50,90],onValueChange:()=>{}}));expect(e.querySelectorAll(`[data-slot="slider-thumb"]`)).toHaveLength(3)}),it(`assigns an explicit id to the root element`,()=>{let{container:e}=r(i(n,{id:`volume`}));expect(e.querySelector(`[data-slot="slider"]`)?.getAttribute(`id`)).toBe(`volume`)}),it(`wires the field control id when rendered inside Field`,()=>{let{container:o}=r(a(t,{children:[i(e,{children:`Volume`}),i(n,{})]})),s=o.querySelector(`[data-slot="field-label"]`),c=o.querySelector(`[data-slot="slider"]`);expect(s?.getAttribute(`for`)).toBe(c?.getAttribute(`id`)),expect(c?.getAttribute(`id`)).toBeTruthy()}),it(`merges a custom className onto the root`,()=>{let{container:e}=r(i(n,{className:`custom-slider`}));expect(e.querySelector(`[data-slot="slider"]`)?.className).toContain(`custom-slider`)})});
|
|
2
2
|
//# sourceMappingURL=slider.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{r as e}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{r as e}from"../react.esm-dE9nuHcL.js";import{jsx as t}from"react/jsx-runtime";const{SonnerMock:n,useThemeMock:r}=vi.hoisted(()=>({SonnerMock:vi.fn(e=>null),useThemeMock:vi.fn(()=>({theme:`system`}))}));vi.mock(`sonner`,()=>({Toaster:n,toast:{message:vi.fn()}})),vi.mock(`next-themes`,()=>({useTheme:r}));const{Toaster:i,toast:a}=await import(`./sonner.js`);function lastSonnerProps(){let e=n.mock.calls.at(-1)?.[0];if(!e)throw Error(`Toaster (mocked Sonner) was not rendered`);return e}describe(`Toaster`,()=>{it(`defaults to the system theme when next-themes reports none`,()=>{r.mockReturnValueOnce({theme:void 0}),e(t(i,{})),expect(lastSonnerProps().theme).toBe(`system`)}),it(`forwards the resolved theme from next-themes`,()=>{r.mockReturnValueOnce({theme:`dark`}),e(t(i,{})),expect(lastSonnerProps().theme).toBe(`dark`)}),it(`configures richColors, base className, and the CSS variable style block`,()=>{e(t(i,{}));let n=lastSonnerProps();expect(n.richColors).toBe(!0),expect(n.className).toBe(`toaster group`),expect(n.style[`--normal-bg`]).toBe(`var(--popover)`),expect(n.style[`--normal-text`]).toBe(`var(--popover-foreground)`),expect(n.style[`--normal-border`]).toBe(`var(--border)`),expect(n.style[`--border-radius`]).toBe(`var(--radius)`)}),it(`provides an icon for every toast type`,()=>{e(t(i,{}));let{icons:n}=lastSonnerProps();for(let e of[`success`,`info`,`warning`,`error`,`loading`])expect(n?.[e]).toBeTruthy()}),it(`sets the shared toast className via toastOptions`,()=>{e(t(i,{})),expect(lastSonnerProps().toastOptions?.classNames?.toast).toBe(`cn-toast`)}),it(`lets consumer props override the defaults through prop spreading`,()=>{e(t(i,{position:`top-center`,richColors:!1}));let n=lastSonnerProps();expect(n.position).toBe(`top-center`),expect(n.richColors).toBe(!1)}),it(`re-exports the sonner toast function`,()=>{expect(a).toBeDefined()})});
|
|
2
2
|
//# sourceMappingURL=sonner.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../spinner-ntLrcDLN.js";import{a as t,r as n}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../spinner-ntLrcDLN.js";import{a as t,r as n}from"../react.esm-dE9nuHcL.js";import{jsx as r}from"react/jsx-runtime";describe(`Spinner`,()=>{it(`renders with the status role, a loading label and the default medium size`,()=>{let{container:t}=n(r(e,{})),i=t.querySelector(`[data-slot="spinner"]`);expect(i).not.toBeNull(),expect(i?.getAttribute(`role`)).toBe(`status`),expect(i?.getAttribute(`aria-label`)).toBe(`Loading`),expect(i?.getAttribute(`data-size`)).toBe(`md`),expect(i?.getAttribute(`class`)).toContain(`animate-spin`),expect(i?.getAttribute(`class`)).toContain(`size-4`)}),it(`applies the small and large size variant classes`,()=>{let{container:t}=n(r(e,{size:`sm`})),i=t.querySelector(`[data-slot="spinner"]`);expect(i?.getAttribute(`data-size`)).toBe(`sm`),expect(i?.getAttribute(`class`)).toContain(`size-3`);let{container:a}=n(r(e,{size:`lg`})),o=a.querySelector(`[data-slot="spinner"]`);expect(o?.getAttribute(`data-size`)).toBe(`lg`),expect(o?.getAttribute(`class`)).toContain(`size-5`)}),it(`merges a custom className with the variant classes`,()=>{let{container:t}=n(r(e,{className:`text-primary`})),i=t.querySelector(`[data-slot="spinner"]`);expect(i?.getAttribute(`class`)).toContain(`text-primary`),expect(i?.getAttribute(`class`)).toContain(`animate-spin`)}),it(`is discoverable through the status role`,()=>{n(r(e,{})),expect(t.getByRole(`status`,{name:`Loading`})).not.toBeNull()})});
|
|
2
2
|
//# sourceMappingURL=spinner.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../stack-BbLllsqk.js";import{r as t}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../stack-BbLllsqk.js";import{r as t}from"../react.esm-dE9nuHcL.js";import{jsx as n}from"react/jsx-runtime";describe(`Stack`,()=>{it(`renders with data-slot, flex-col layout and the default md gap`,()=>{let{container:r}=t(n(e,{})),i=r.querySelector(`[data-slot="stack"]`);expect(i).not.toBeNull(),expect(i?.className).toContain(`flex`),expect(i?.className).toContain(`flex-col`),expect(i?.className).toContain(`gap-4`),expect(i?.getAttribute(`data-gap`)).toBe(`md`),expect(i?.getAttribute(`data-align`)).toBeNull(),expect(i?.getAttribute(`data-justify`)).toBeNull()}),it(`applies the align, justify and gap variant classes and data attributes`,()=>{let{container:r}=t(n(e,{align:`center`,justify:`between`,gap:`xl`})),i=r.querySelector(`[data-slot="stack"]`);expect(i?.getAttribute(`data-align`)).toBe(`center`),expect(i?.getAttribute(`data-justify`)).toBe(`between`),expect(i?.getAttribute(`data-gap`)).toBe(`xl`),expect(i?.className).toContain(`items-center`),expect(i?.className).toContain(`justify-between`),expect(i?.className).toContain(`gap-8`)}),it(`merges a custom className with the variant classes`,()=>{let{container:r}=t(n(e,{className:`custom-stack`}));expect(r.querySelector(`[data-slot="stack"]`)?.className).toContain(`custom-stack`)}),it(`forwards ref to the underlying div element`,()=>{let r={current:null};t(n(e,{ref:r})),expect(r.current).toBeInstanceOf(HTMLDivElement)})});
|
|
2
2
|
//# sourceMappingURL=stack.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"../stepper-BQ-59_UO.js";import{i as f,n as p,r as m,t as h}from"../react.esm-BkhVXJ8s.js";import{jsx as g,jsxs as _}from"react/jsx-runtime";function ThreeStepStepper({children:n,...r}={}){return _(u,{defaultValue:2,...r,children:[n,_(s,{children:[_(e,{step:1,"data-testid":`item-1`,children:[_(d,{children:[g(i,{children:`1`}),g(a,{children:`Step one`}),g(c,{children:`First`})]}),g(t,{})]}),_(e,{step:2,"data-testid":`item-2`,children:[_(d,{children:[g(i,{children:`2`}),g(a,{children:`Step two`})]}),g(t,{})]}),g(e,{step:3,"data-testid":`item-3`,children:_(d,{children:[g(i,{children:`3`}),g(a,{children:`Step three`})]})})]}),_(l,{children:[g(o,{value:1,children:`First content`}),g(o,{value:2,children:`Second content`}),g(o,{value:3,children:`Third content`})]})]})}describe(`Stepper`,()=>{it(`renders the root as a tablist wired with the horizontal orientation by default`,()=>{let{container:e}=m(g(u,{})),t=e.querySelector(`[data-slot="stepper"]`);expect(t.getAttribute(`role`)).toBe(`tablist`),expect(t.getAttribute(`aria-orientation`)).toBe(`horizontal`),expect(t.getAttribute(`data-orientation`)).toBe(`horizontal`),expect(t.className).toContain(`w-full`)}),it(`respects an explicit vertical orientation`,()=>{let{container:e}=m(g(u,{orientation:`vertical`})),t=e.querySelector(`[data-slot="stepper"]`);expect(t.getAttribute(`aria-orientation`)).toBe(`vertical`),expect(t.getAttribute(`data-orientation`)).toBe(`vertical`)}),it(`shows correct active, completed, and upcoming state across three steps`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:2}));expect(e(`item-1`).getAttribute(`data-state`)).toBe(`completed`),expect(e(`item-2`).getAttribute(`data-state`)).toBe(`active`),expect(e(`item-3`).getAttribute(`data-state`)).toBe(`inactive`)}),it(`advances the active step when a trigger is clicked (uncontrolled)`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:1}));p.click(e(`item-3`).querySelector(`[data-slot="stepper-trigger"]`)),expect(e(`item-1`).getAttribute(`data-state`)).toBe(`completed`),expect(e(`item-2`).getAttribute(`data-state`)).toBe(`completed`),expect(e(`item-3`).getAttribute(`data-state`)).toBe(`active`)}),it(`stays on the controlled value and calls onValueChange instead of updating internal state`,()=>{let e=vi.fn(),{getByTestId:t}=m(g(ThreeStepStepper,{value:1,onValueChange:e}));p.click(t(`item-3`).querySelector(`[data-slot="stepper-trigger"]`)),expect(e).toHaveBeenCalledWith(3),expect(t(`item-1`).getAttribute(`data-state`)).toBe(`active`),expect(t(`item-3`).getAttribute(`data-state`)).toBe(`inactive`)}),it(`forces a step to completed via the completed prop regardless of its position`,()=>{let{container:t}=m(g(u,{defaultValue:1,children:g(e,{step:2,completed:!0,"data-testid":`forced`,children:g(d,{children:`Two`})})}));expect(t.querySelector(`[data-testid="forced"]`)?.getAttribute(`data-state`)).toBe(`completed`)}),it(`marks the active step as loading via data-loading when the loading prop is set`,()=>{let{container:t}=m(g(u,{defaultValue:1,children:g(e,{step:1,loading:!0,"data-testid":`loading-item`,children:g(d,{children:`One`})})}));expect(t.querySelector(`[data-testid="loading-item"]`)?.getAttribute(`data-loading`)).toBe(`true`)}),it(`does not mark an inactive step as loading even when the loading prop is set`,()=>{let{container:t}=m(g(u,{defaultValue:2,children:g(e,{step:1,loading:!0,"data-testid":`loading-item`,children:g(d,{children:`One`})})}));expect(t.querySelector(`[data-testid="loading-item"]`)?.hasAttribute(`data-loading`)).toBe(!1)})}),describe(`useStepper`,()=>{it(`throws when used outside a Stepper`,()=>{expect(()=>f(()=>r())).toThrow(`useStepper must be used within a Stepper`)}),it(`exposes the active step, orientation, and setActiveStep from context`,()=>{let wrapper=({children:e})=>g(u,{defaultValue:2,children:e}),{result:e}=f(()=>r(),{wrapper});expect(e.current.activeStep).toBe(2),expect(e.current.orientation).toBe(`horizontal`),expect(typeof e.current.setActiveStep).toBe(`function`)}),it(`stepsCount stays 0 even with StepperItem children, since StepperItem has no displayName set`,()=>{let wrapper=({children:t})=>_(u,{defaultValue:1,children:[g(e,{step:1,children:g(d,{children:`One`})}),g(e,{step:2,children:g(d,{children:`Two`})}),t]}),{result:t}=f(()=>r(),{wrapper});expect(t.current.stepsCount).toBe(0)}),it(`updates the active step across the tree when setActiveStep is called`,()=>{let e={};function Capture(){return e.current=r(),null}let{getByTestId:t}=m(g(ThreeStepStepper,{defaultValue:1,children:g(Capture,{})}));h(()=>e.current?.setActiveStep(3)),expect(t(`item-3`).getAttribute(`data-state`)).toBe(`active`)})}),describe(`useStepItem`,()=>{it(`throws when used outside a StepperItem`,()=>{expect(()=>f(()=>n())).toThrow(`useStepItem must be used within a StepperItem`)}),it(`exposes step, state, isDisabled, and isLoading from context`,()=>{let wrapper=({children:t})=>g(u,{defaultValue:1,children:g(e,{step:1,disabled:!0,children:t})}),{result:t}=f(()=>n(),{wrapper});expect(t.current.step).toBe(1),expect(t.current.state).toBe(`active`),expect(t.current.isDisabled).toBe(!0),expect(t.current.isLoading).toBe(!1)})}),describe(`StepperItem`,()=>{it(`renders with data-slot stepper-item and the group/step class`,()=>{let{container:t}=m(g(u,{children:g(e,{step:1,children:g(d,{children:`One`})})})),n=t.querySelector(`[data-slot="stepper-item"]`);expect(n.className).toContain(`group/step`)})}),describe(`StepperTrigger`,()=>{it(`renders a tab button with the expected aria wiring for the active step`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:2})),t=e(`item-2`).querySelector(`[data-slot="stepper-trigger"]`);expect(t.tagName).toBe(`BUTTON`),expect(t.getAttribute(`role`)).toBe(`tab`),expect(t.getAttribute(`aria-selected`)).toBe(`true`),expect(t.getAttribute(`aria-controls`)).toBe(`stepper-panel-2`),expect(t.tabIndex).toBe(0)}),it(`gives inactive step triggers a tabIndex of -1`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:2})),t=e(`item-1`).querySelector(`[data-slot="stepper-trigger"]`);expect(t.tabIndex).toBe(-1)}),it(`sets the active step when clicked`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:1}));p.click(e(`item-2`).querySelector(`[data-slot="stepper-trigger"]`)),expect(e(`item-2`).getAttribute(`data-state`)).toBe(`active`)}),it(`disables the button and blocks activation when the StepperItem is disabled`,()=>{let{container:t}=m(_(u,{defaultValue:1,children:[g(e,{step:1,children:g(d,{children:`One`})}),g(e,{step:2,disabled:!0,"data-testid":`disabled-item`,children:g(d,{children:`Two`})})]})),n=t.querySelector(`[data-testid="disabled-item"] [data-slot="stepper-trigger"]`);expect(n.disabled).toBe(!0)}),it(`moves focus to the next trigger on ArrowRight and to the previous on ArrowLeft`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:1})),t=e(`item-1`).querySelector(`[data-slot="stepper-trigger"]`),n=e(`item-2`).querySelector(`[data-slot="stepper-trigger"]`);t.focus(),p.keyDown(t,{key:`ArrowRight`}),expect(document.activeElement).toBe(n),p.keyDown(n,{key:`ArrowLeft`}),expect(document.activeElement).toBe(t)}),it(`moves focus to the first/last trigger on Home/End`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:1})),t=e(`item-1`).querySelector(`[data-slot="stepper-trigger"]`),n=e(`item-2`).querySelector(`[data-slot="stepper-trigger"]`),r=e(`item-3`).querySelector(`[data-slot="stepper-trigger"]`);n.focus(),p.keyDown(n,{key:`End`}),expect(document.activeElement).toBe(r),p.keyDown(r,{key:`Home`}),expect(document.activeElement).toBe(t)}),it(`activates the focused step on Enter and Space`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:1})),t=e(`item-3`).querySelector(`[data-slot="stepper-trigger"]`);p.keyDown(t,{key:`Enter`}),expect(e(`item-3`).getAttribute(`data-state`)).toBe(`active`)}),it(`renders a span instead of a button when asChild is set`,()=>{let{container:t}=m(g(u,{defaultValue:1,children:g(e,{step:1,children:g(d,{asChild:!0,children:`Custom`})})})),n=t.querySelector(`[data-slot="stepper-trigger"]`);expect(n.tagName).toBe(`SPAN`),expect(n.getAttribute(`data-state`)).toBe(`active`),expect(n.textContent).toBe(`Custom`)})}),describe(`StepperIndicator`,()=>{it(`renders its children by default and reflects the step state`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:2})),t=e(`item-2`).querySelector(`[data-slot="stepper-indicator"]`);expect(t.getAttribute(`data-state`)).toBe(`active`),expect(t.textContent).toBe(`2`)}),it(`swaps in a custom indicator node for the matching state`,()=>{let{container:t}=m(g(u,{defaultValue:1,indicators:{active:g(`span`,{"data-testid":`custom-active`,children:`*`})},children:g(e,{step:1,children:g(i,{children:`1`})})}));expect(t.querySelector(`[data-testid="custom-active"]`)).not.toBeNull()}),it(`prefers the loading indicator when the active step is loading`,()=>{let{container:t}=m(g(u,{defaultValue:1,indicators:{loading:g(`span`,{"data-testid":`custom-loading`,children:`…`})},children:g(e,{step:1,loading:!0,children:g(i,{children:`1`})})}));expect(t.querySelector(`[data-testid="custom-loading"]`)).not.toBeNull()})}),describe(`StepperSeparator`,()=>{it(`renders with data-slot stepper-separator and mirrors the item state`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:2})),t=e(`item-1`).querySelector(`[data-slot="stepper-separator"]`);expect(t.getAttribute(`data-state`)).toBe(`completed`)})}),describe(`StepperTitle`,()=>{it(`renders its children with data-slot stepper-title`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:2})),t=e(`item-1`).querySelector(`[data-slot="stepper-title"]`);expect(t.tagName).toBe(`H3`),expect(t.textContent).toBe(`Step one`),expect(t.getAttribute(`data-state`)).toBe(`completed`)})}),describe(`StepperDescription`,()=>{it(`renders its children with data-slot stepper-description`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:2})),t=e(`item-1`).querySelector(`[data-slot="stepper-description"]`);expect(t.textContent).toBe(`First`),expect(t.getAttribute(`data-state`)).toBe(`completed`)})}),describe(`StepperNav`,()=>{it(`renders with data-slot stepper-nav and mirrors orientation and active step`,()=>{let{container:e}=m(g(ThreeStepStepper,{defaultValue:2,orientation:`vertical`})),t=e.querySelector(`[data-slot="stepper-nav"]`);expect(t.tagName).toBe(`NAV`),expect(t.getAttribute(`data-orientation`)).toBe(`vertical`),expect(t.getAttribute(`data-state`)).toBe(`2`)})}),describe(`StepperPanel`,()=>{it(`renders with data-slot stepper-panel and mirrors the active step`,()=>{let{container:e}=m(g(ThreeStepStepper,{defaultValue:2})),t=e.querySelector(`[data-slot="stepper-panel"]`);expect(t.getAttribute(`data-state`)).toBe(`2`)})}),describe(`StepperContent`,()=>{it(`renders only the content for the active step by default`,()=>{let{container:e}=m(g(ThreeStepStepper,{defaultValue:2})),t=e.querySelectorAll(`[data-slot="stepper-content"]`);expect(t.length).toBe(1),expect(t[0]?.textContent).toBe(`Second content`)}),it(`keeps inactive content mounted but hidden when forceMount is set`,()=>{let{container:e}=m(_(u,{defaultValue:1,children:[g(o,{value:1,children:`Active`}),g(o,{value:2,forceMount:!0,children:`Inactive but mounted`})]})),t=Array.from(e.querySelectorAll(`[data-slot="stepper-content"]`)).find(e=>e.textContent===`Inactive but mounted`);expect(t).not.toBeUndefined(),expect(t.hasAttribute(`hidden`)).toBe(!0),expect(t.className).toContain(`hidden`)})});
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"../stepper-BQ-59_UO.js";import{i as f,n as p,r as m,t as h}from"../react.esm-dE9nuHcL.js";import{jsx as g,jsxs as _}from"react/jsx-runtime";function ThreeStepStepper({children:n,...r}={}){return _(u,{defaultValue:2,...r,children:[n,_(s,{children:[_(e,{step:1,"data-testid":`item-1`,children:[_(d,{children:[g(i,{children:`1`}),g(a,{children:`Step one`}),g(c,{children:`First`})]}),g(t,{})]}),_(e,{step:2,"data-testid":`item-2`,children:[_(d,{children:[g(i,{children:`2`}),g(a,{children:`Step two`})]}),g(t,{})]}),g(e,{step:3,"data-testid":`item-3`,children:_(d,{children:[g(i,{children:`3`}),g(a,{children:`Step three`})]})})]}),_(l,{children:[g(o,{value:1,children:`First content`}),g(o,{value:2,children:`Second content`}),g(o,{value:3,children:`Third content`})]})]})}describe(`Stepper`,()=>{it(`renders the root as a tablist wired with the horizontal orientation by default`,()=>{let{container:e}=m(g(u,{})),t=e.querySelector(`[data-slot="stepper"]`);expect(t.getAttribute(`role`)).toBe(`tablist`),expect(t.getAttribute(`aria-orientation`)).toBe(`horizontal`),expect(t.getAttribute(`data-orientation`)).toBe(`horizontal`),expect(t.className).toContain(`w-full`)}),it(`respects an explicit vertical orientation`,()=>{let{container:e}=m(g(u,{orientation:`vertical`})),t=e.querySelector(`[data-slot="stepper"]`);expect(t.getAttribute(`aria-orientation`)).toBe(`vertical`),expect(t.getAttribute(`data-orientation`)).toBe(`vertical`)}),it(`shows correct active, completed, and upcoming state across three steps`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:2}));expect(e(`item-1`).getAttribute(`data-state`)).toBe(`completed`),expect(e(`item-2`).getAttribute(`data-state`)).toBe(`active`),expect(e(`item-3`).getAttribute(`data-state`)).toBe(`inactive`)}),it(`advances the active step when a trigger is clicked (uncontrolled)`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:1}));p.click(e(`item-3`).querySelector(`[data-slot="stepper-trigger"]`)),expect(e(`item-1`).getAttribute(`data-state`)).toBe(`completed`),expect(e(`item-2`).getAttribute(`data-state`)).toBe(`completed`),expect(e(`item-3`).getAttribute(`data-state`)).toBe(`active`)}),it(`stays on the controlled value and calls onValueChange instead of updating internal state`,()=>{let e=vi.fn(),{getByTestId:t}=m(g(ThreeStepStepper,{value:1,onValueChange:e}));p.click(t(`item-3`).querySelector(`[data-slot="stepper-trigger"]`)),expect(e).toHaveBeenCalledWith(3),expect(t(`item-1`).getAttribute(`data-state`)).toBe(`active`),expect(t(`item-3`).getAttribute(`data-state`)).toBe(`inactive`)}),it(`forces a step to completed via the completed prop regardless of its position`,()=>{let{container:t}=m(g(u,{defaultValue:1,children:g(e,{step:2,completed:!0,"data-testid":`forced`,children:g(d,{children:`Two`})})}));expect(t.querySelector(`[data-testid="forced"]`)?.getAttribute(`data-state`)).toBe(`completed`)}),it(`marks the active step as loading via data-loading when the loading prop is set`,()=>{let{container:t}=m(g(u,{defaultValue:1,children:g(e,{step:1,loading:!0,"data-testid":`loading-item`,children:g(d,{children:`One`})})}));expect(t.querySelector(`[data-testid="loading-item"]`)?.getAttribute(`data-loading`)).toBe(`true`)}),it(`does not mark an inactive step as loading even when the loading prop is set`,()=>{let{container:t}=m(g(u,{defaultValue:2,children:g(e,{step:1,loading:!0,"data-testid":`loading-item`,children:g(d,{children:`One`})})}));expect(t.querySelector(`[data-testid="loading-item"]`)?.hasAttribute(`data-loading`)).toBe(!1)})}),describe(`useStepper`,()=>{it(`throws when used outside a Stepper`,()=>{expect(()=>f(()=>r())).toThrow(`useStepper must be used within a Stepper`)}),it(`exposes the active step, orientation, and setActiveStep from context`,()=>{let wrapper=({children:e})=>g(u,{defaultValue:2,children:e}),{result:e}=f(()=>r(),{wrapper});expect(e.current.activeStep).toBe(2),expect(e.current.orientation).toBe(`horizontal`),expect(typeof e.current.setActiveStep).toBe(`function`)}),it(`stepsCount stays 0 even with StepperItem children, since StepperItem has no displayName set`,()=>{let wrapper=({children:t})=>_(u,{defaultValue:1,children:[g(e,{step:1,children:g(d,{children:`One`})}),g(e,{step:2,children:g(d,{children:`Two`})}),t]}),{result:t}=f(()=>r(),{wrapper});expect(t.current.stepsCount).toBe(0)}),it(`updates the active step across the tree when setActiveStep is called`,()=>{let e={};function Capture(){return e.current=r(),null}let{getByTestId:t}=m(g(ThreeStepStepper,{defaultValue:1,children:g(Capture,{})}));h(()=>e.current?.setActiveStep(3)),expect(t(`item-3`).getAttribute(`data-state`)).toBe(`active`)})}),describe(`useStepItem`,()=>{it(`throws when used outside a StepperItem`,()=>{expect(()=>f(()=>n())).toThrow(`useStepItem must be used within a StepperItem`)}),it(`exposes step, state, isDisabled, and isLoading from context`,()=>{let wrapper=({children:t})=>g(u,{defaultValue:1,children:g(e,{step:1,disabled:!0,children:t})}),{result:t}=f(()=>n(),{wrapper});expect(t.current.step).toBe(1),expect(t.current.state).toBe(`active`),expect(t.current.isDisabled).toBe(!0),expect(t.current.isLoading).toBe(!1)})}),describe(`StepperItem`,()=>{it(`renders with data-slot stepper-item and the group/step class`,()=>{let{container:t}=m(g(u,{children:g(e,{step:1,children:g(d,{children:`One`})})})),n=t.querySelector(`[data-slot="stepper-item"]`);expect(n.className).toContain(`group/step`)})}),describe(`StepperTrigger`,()=>{it(`renders a tab button with the expected aria wiring for the active step`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:2})),t=e(`item-2`).querySelector(`[data-slot="stepper-trigger"]`);expect(t.tagName).toBe(`BUTTON`),expect(t.getAttribute(`role`)).toBe(`tab`),expect(t.getAttribute(`aria-selected`)).toBe(`true`),expect(t.getAttribute(`aria-controls`)).toBe(`stepper-panel-2`),expect(t.tabIndex).toBe(0)}),it(`gives inactive step triggers a tabIndex of -1`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:2})),t=e(`item-1`).querySelector(`[data-slot="stepper-trigger"]`);expect(t.tabIndex).toBe(-1)}),it(`sets the active step when clicked`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:1}));p.click(e(`item-2`).querySelector(`[data-slot="stepper-trigger"]`)),expect(e(`item-2`).getAttribute(`data-state`)).toBe(`active`)}),it(`disables the button and blocks activation when the StepperItem is disabled`,()=>{let{container:t}=m(_(u,{defaultValue:1,children:[g(e,{step:1,children:g(d,{children:`One`})}),g(e,{step:2,disabled:!0,"data-testid":`disabled-item`,children:g(d,{children:`Two`})})]})),n=t.querySelector(`[data-testid="disabled-item"] [data-slot="stepper-trigger"]`);expect(n.disabled).toBe(!0)}),it(`moves focus to the next trigger on ArrowRight and to the previous on ArrowLeft`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:1})),t=e(`item-1`).querySelector(`[data-slot="stepper-trigger"]`),n=e(`item-2`).querySelector(`[data-slot="stepper-trigger"]`);t.focus(),p.keyDown(t,{key:`ArrowRight`}),expect(document.activeElement).toBe(n),p.keyDown(n,{key:`ArrowLeft`}),expect(document.activeElement).toBe(t)}),it(`moves focus to the first/last trigger on Home/End`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:1})),t=e(`item-1`).querySelector(`[data-slot="stepper-trigger"]`),n=e(`item-2`).querySelector(`[data-slot="stepper-trigger"]`),r=e(`item-3`).querySelector(`[data-slot="stepper-trigger"]`);n.focus(),p.keyDown(n,{key:`End`}),expect(document.activeElement).toBe(r),p.keyDown(r,{key:`Home`}),expect(document.activeElement).toBe(t)}),it(`activates the focused step on Enter and Space`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:1})),t=e(`item-3`).querySelector(`[data-slot="stepper-trigger"]`);p.keyDown(t,{key:`Enter`}),expect(e(`item-3`).getAttribute(`data-state`)).toBe(`active`)}),it(`renders a span instead of a button when asChild is set`,()=>{let{container:t}=m(g(u,{defaultValue:1,children:g(e,{step:1,children:g(d,{asChild:!0,children:`Custom`})})})),n=t.querySelector(`[data-slot="stepper-trigger"]`);expect(n.tagName).toBe(`SPAN`),expect(n.getAttribute(`data-state`)).toBe(`active`),expect(n.textContent).toBe(`Custom`)})}),describe(`StepperIndicator`,()=>{it(`renders its children by default and reflects the step state`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:2})),t=e(`item-2`).querySelector(`[data-slot="stepper-indicator"]`);expect(t.getAttribute(`data-state`)).toBe(`active`),expect(t.textContent).toBe(`2`)}),it(`swaps in a custom indicator node for the matching state`,()=>{let{container:t}=m(g(u,{defaultValue:1,indicators:{active:g(`span`,{"data-testid":`custom-active`,children:`*`})},children:g(e,{step:1,children:g(i,{children:`1`})})}));expect(t.querySelector(`[data-testid="custom-active"]`)).not.toBeNull()}),it(`prefers the loading indicator when the active step is loading`,()=>{let{container:t}=m(g(u,{defaultValue:1,indicators:{loading:g(`span`,{"data-testid":`custom-loading`,children:`…`})},children:g(e,{step:1,loading:!0,children:g(i,{children:`1`})})}));expect(t.querySelector(`[data-testid="custom-loading"]`)).not.toBeNull()})}),describe(`StepperSeparator`,()=>{it(`renders with data-slot stepper-separator and mirrors the item state`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:2})),t=e(`item-1`).querySelector(`[data-slot="stepper-separator"]`);expect(t.getAttribute(`data-state`)).toBe(`completed`)})}),describe(`StepperTitle`,()=>{it(`renders its children with data-slot stepper-title`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:2})),t=e(`item-1`).querySelector(`[data-slot="stepper-title"]`);expect(t.tagName).toBe(`H3`),expect(t.textContent).toBe(`Step one`),expect(t.getAttribute(`data-state`)).toBe(`completed`)})}),describe(`StepperDescription`,()=>{it(`renders its children with data-slot stepper-description`,()=>{let{getByTestId:e}=m(g(ThreeStepStepper,{defaultValue:2})),t=e(`item-1`).querySelector(`[data-slot="stepper-description"]`);expect(t.textContent).toBe(`First`),expect(t.getAttribute(`data-state`)).toBe(`completed`)})}),describe(`StepperNav`,()=>{it(`renders with data-slot stepper-nav and mirrors orientation and active step`,()=>{let{container:e}=m(g(ThreeStepStepper,{defaultValue:2,orientation:`vertical`})),t=e.querySelector(`[data-slot="stepper-nav"]`);expect(t.tagName).toBe(`NAV`),expect(t.getAttribute(`data-orientation`)).toBe(`vertical`),expect(t.getAttribute(`data-state`)).toBe(`2`)})}),describe(`StepperPanel`,()=>{it(`renders with data-slot stepper-panel and mirrors the active step`,()=>{let{container:e}=m(g(ThreeStepStepper,{defaultValue:2})),t=e.querySelector(`[data-slot="stepper-panel"]`);expect(t.getAttribute(`data-state`)).toBe(`2`)})}),describe(`StepperContent`,()=>{it(`renders only the content for the active step by default`,()=>{let{container:e}=m(g(ThreeStepStepper,{defaultValue:2})),t=e.querySelectorAll(`[data-slot="stepper-content"]`);expect(t.length).toBe(1),expect(t[0]?.textContent).toBe(`Second content`)}),it(`keeps inactive content mounted but hidden when forceMount is set`,()=>{let{container:e}=m(_(u,{defaultValue:1,children:[g(o,{value:1,children:`Active`}),g(o,{value:2,forceMount:!0,children:`Inactive but mounted`})]})),t=Array.from(e.querySelectorAll(`[data-slot="stepper-content"]`)).find(e=>e.textContent===`Inactive but mounted`);expect(t).not.toBeUndefined(),expect(t.hasAttribute(`hidden`)).toBe(!0),expect(t.className).toContain(`hidden`)})});
|
|
2
2
|
//# sourceMappingURL=stepper.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{o as e,t}from"../field-DzR-XrO7.js";import{t as n}from"../switch-DjdOGECT.js";import{a as r,n as i,r as a}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{o as e,t}from"../field-DzR-XrO7.js";import{t as n}from"../switch-DjdOGECT.js";import{a as r,n as i,r as a}from"../react.esm-dE9nuHcL.js";import{jsx as o,jsxs as s}from"react/jsx-runtime";describe(`Switch`,()=>{it(`renders as a switch with the default color and size and no wrapping label`,()=>{let{container:e}=a(o(n,{})),t=e.querySelector(`[data-slot="switch"]`);expect(t).not.toBeNull(),expect(t?.getAttribute(`role`)).toBe(`switch`),expect(t?.getAttribute(`data-color`)).toBe(`green`),expect(t?.getAttribute(`data-size`)).toBe(`md`),expect(t?.getAttribute(`id`)).toBeNull(),expect(e.querySelector(`[data-slot="switch-field"]`)).toBeNull()}),it(`toggles the checked state when clicked`,()=>{a(o(n,{}));let e=r.getByRole(`switch`);expect(e.getAttribute(`aria-checked`)).toBe(`false`),i.click(e),expect(e.getAttribute(`aria-checked`)).toBe(`true`),expect(e.getAttribute(`data-state`)).toBe(`checked`)}),it(`renders a wired label and generates a shared id when label is provided`,()=>{a(o(n,{label:`Enable notifications`}));let e=r.getByRole(`switch`),t=r.getByText(`Enable notifications`);expect(e.getAttribute(`id`)).toBeTruthy(),expect(t.getAttribute(`for`)).toBe(e.getAttribute(`id`))}),it(`applies custom color and size variants`,()=>{let{container:e}=a(o(n,{color:`blue`,size:`lg`})),t=e.querySelector(`[data-slot="switch"]`);expect(t?.getAttribute(`data-color`)).toBe(`blue`),expect(t?.getAttribute(`data-size`)).toBe(`lg`),expect(t?.className).toContain(`[--switch-checked:var(--blue)]`)}),it(`wires the field control id when rendered inside Field`,()=>{a(s(t,{children:[o(e,{children:`Terms`}),o(n,{})]}));let i=r.getByText(`Terms`),c=r.getByRole(`switch`);expect(i.getAttribute(`for`)).toBe(c.getAttribute(`id`))})});
|
|
2
2
|
//# sourceMappingURL=switch.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"../table-CuE0Aenj.js";import{a as l,r as u}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"../table-CuE0Aenj.js";import{a as l,r as u}from"../react.esm-dE9nuHcL.js";import{jsx as d,jsxs as f}from"react/jsx-runtime";function renderTable(l){return u(d(e,{children:f(c,{...l,children:[d(o,{children:`A list of recent invoices`}),d(t,{children:f(r,{children:[d(s,{children:`Invoice`}),d(s,{children:`Status`})]})}),f(i,{children:[f(r,{children:[d(n,{children:`INV001`}),d(n,{children:`Paid`})]}),f(r,{"data-state":`selected`,children:[d(n,{children:`INV002`}),d(n,{children:`Pending`})]})]}),d(a,{children:f(r,{children:[d(n,{children:`Total`}),d(n,{children:`2 invoices`})]})})]})}))}describe(`Table`,()=>{it(`renders every subcomponent with its own data-slot`,()=>{let{container:e}=renderTable();expect(e.querySelector(`[data-slot="table-container"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="table"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="table-caption"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="table-header"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="table-body"]`)).not.toBeNull(),expect(e.querySelector(`[data-slot="table-footer"]`)).not.toBeNull(),expect(e.querySelectorAll(`[data-slot="table-row"]`)).toHaveLength(4),expect(e.querySelectorAll(`[data-slot="table-head"]`)).toHaveLength(2),expect(e.querySelectorAll(`[data-slot="table-cell"]`)).toHaveLength(6)}),it(`renders real table semantics that are queryable by role`,()=>{renderTable(),expect(l.getByRole(`table`)).not.toBeNull(),expect(l.getAllByRole(`columnheader`)).toHaveLength(2),expect(l.getAllByRole(`row`)).toHaveLength(4),expect(l.getByText(`A list of recent invoices`)).not.toBeNull()}),it(`defaults to the line variant, striped rows and no sticky header`,()=>{let{container:e}=renderTable(),t=e.querySelector(`[data-slot="table"]`);expect(t?.getAttribute(`data-variant`)).toBe(`line`),expect(t?.getAttribute(`data-striped`)).toBe(`true`),expect(t?.getAttribute(`data-sticky-header`)).toBe(`false`)}),it(`applies the outline variant classes when requested`,()=>{let{container:e}=renderTable({variant:`outline`}),t=e.querySelector(`[data-slot="table"]`);expect(t?.getAttribute(`data-variant`)).toBe(`outline`),expect(t?.className).toContain(`border-separate`)}),it(`disables striping and enables the sticky header via data attributes`,()=>{let{container:e}=renderTable({striped:!1,stickyHeader:!0}),t=e.querySelector(`[data-slot="table"]`);expect(t?.getAttribute(`data-striped`)).toBe(`false`),expect(t?.getAttribute(`data-sticky-header`)).toBe(`true`)}),it(`marks a row as selected via data-state`,()=>{renderTable();let e=l.getByText(`INV002`).closest(`[data-slot="table-row"]`);expect(e?.getAttribute(`data-state`)).toBe(`selected`)}),it(`applies a numeric minWidth as a pixel value on the container style`,()=>{let{container:t}=u(d(e,{minWidth:640,children:d(c,{children:d(i,{children:d(r,{children:d(n,{children:`Cell`})})})})})),a=t.querySelector(`[data-slot="table-container"]`);expect(a.style.minWidth).toBe(`640px`)}),it(`leaves the style untouched when no minWidth is provided`,()=>{let{container:t}=u(d(e,{style:{color:`red`},children:d(c,{children:d(i,{children:d(r,{children:d(n,{children:`Cell`})})})})})),a=t.querySelector(`[data-slot="table-container"]`);expect(a.style.minWidth).toBe(``),expect(a.style.color).toBe(`red`)})});
|
|
2
2
|
//# sourceMappingURL=table.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{i as e,n as t,r as n,t as r}from"../tabs-DK9-RHkP.js";import{a as i,n as a,r as o}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{i as e,n as t,r as n,t as r}from"../tabs-DK9-RHkP.js";import{a as i,n as a,r as o}from"../react.esm-dE9nuHcL.js";import{jsx as s,jsxs as c}from"react/jsx-runtime";function renderTabs(i){return o(c(r,{defaultValue:`account`,orientation:i?.orientation,children:[c(n,{variant:i?.variant,children:[s(e,{value:`account`,children:`Account`}),s(e,{value:`password`,children:`Password`})]}),s(t,{value:`account`,children:`Account settings`}),s(t,{value:`password`,children:`Password settings`})]}))}describe(`Tabs`,()=>{it(`renders the root with data-slot and the default horizontal orientation`,()=>{let{container:e}=renderTabs(),t=e.querySelector(`[data-slot="tabs"]`);expect(t).not.toBeNull(),expect(t?.getAttribute(`data-orientation`)).toBe(`horizontal`),expect(t?.className).toContain(`data-horizontal:flex-col`)}),it(`shows only the active tab content and marks the active trigger`,()=>{renderTabs(),expect(i.getByText(`Account settings`)).not.toBeNull(),expect(i.queryByText(`Password settings`)).toBeNull();let e=i.getByRole(`tab`,{name:`Account`}),t=i.getByRole(`tab`,{name:`Password`});expect(e.getAttribute(`data-state`)).toBe(`active`),expect(t.getAttribute(`data-state`)).toBe(`inactive`)}),it(`switches the active tab content when a different trigger is clicked`,()=>{renderTabs(),a.mouseDown(i.getByRole(`tab`,{name:`Password`})),expect(i.getByText(`Password settings`)).not.toBeNull(),expect(i.queryByText(`Account settings`)).toBeNull(),expect(i.getByRole(`tab`,{name:`Password`}).getAttribute(`data-state`)).toBe(`active`)}),it(`calls onValueChange when a trigger is activated`,()=>{let l=vi.fn();o(c(r,{defaultValue:`account`,onValueChange:l,children:[c(n,{children:[s(e,{value:`account`,children:`Account`}),s(e,{value:`password`,children:`Password`})]}),s(t,{value:`account`,children:`Account settings`}),s(t,{value:`password`,children:`Password settings`})]})),a.mouseDown(i.getByRole(`tab`,{name:`Password`})),expect(l).toHaveBeenCalledWith(`password`)}),it(`applies the vertical orientation data attribute and class to the root`,()=>{let{container:e}=renderTabs({orientation:`vertical`}),t=e.querySelector(`[data-slot="tabs"]`);expect(t?.getAttribute(`data-orientation`)).toBe(`vertical`)}),it(`defaults the list variant to line and lets it be switched to enclosed`,()=>{let{container:i,rerender:a}=renderTabs(),o=i.querySelector(`[data-slot="tabs-list"]`);expect(o?.getAttribute(`data-variant`)).toBe(`line`),expect(o?.className).toContain(`bg-transparent`),a(c(r,{defaultValue:`account`,children:[s(n,{variant:`enclosed`,children:s(e,{value:`account`,children:`Account`})}),s(t,{value:`account`,children:`Account settings`})]})),o=i.querySelector(`[data-slot="tabs-list"]`),expect(o?.getAttribute(`data-variant`)).toBe(`enclosed`),expect(o?.className).toContain(`bg-muted`)}),it(`marks the list as growing when the grow prop is set`,()=>{o(c(r,{defaultValue:`account`,children:[s(n,{grow:!0,children:s(e,{value:`account`,children:`Account`})}),s(t,{value:`account`,children:`Account settings`})]})),expect(i.getByRole(`tablist`).getAttribute(`data-grow`)).toBe(`true`)}),it(`disables a trigger and keeps it inactive when clicked`,()=>{let l=vi.fn();o(c(r,{defaultValue:`account`,onValueChange:l,children:[c(n,{children:[s(e,{value:`account`,children:`Account`}),s(e,{value:`password`,disabled:!0,children:`Password`})]}),s(t,{value:`account`,children:`Account settings`}),s(t,{value:`password`,children:`Password settings`})]})),a.mouseDown(i.getByRole(`tab`,{name:`Password`})),expect(l).not.toHaveBeenCalled(),expect(i.getByText(`Account settings`)).not.toBeNull()})});
|
|
2
2
|
//# sourceMappingURL=tabs.spec.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../text-Kg1xuinT.js";import{r as t}from"../react.esm-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../text-Kg1xuinT.js";import{r as t}from"../react.esm-dE9nuHcL.js";import{jsx as n}from"react/jsx-runtime";describe(`Text`,()=>{it(`renders a paragraph with data-slot and the default md size classes`,()=>{let{container:r}=t(n(e,{children:`Hello`})),i=r.querySelector(`[data-slot="text"]`);expect(i?.tagName).toBe(`P`),expect(i?.getAttribute(`data-size`)).toBe(`md`),expect(i?.className).toContain(`text-base`),expect(i?.className).toContain(`text-foreground`)}),it(`applies the requested size variant classes`,()=>{let{container:r}=t(n(e,{size:`xl`,children:`Big`})),i=r.querySelector(`[data-slot="text"]`);expect(i?.getAttribute(`data-size`)).toBe(`xl`),expect(i?.className).toContain(`text-xl`)}),it(`merges a custom className with the variant classes`,()=>{let{container:r}=t(n(e,{className:`italic`,children:`Styled`}));expect(r.querySelector(`[data-slot="text"]`)?.className).toContain(`italic`)}),it(`renders the child element directly when asChild is true`,()=>{let{container:r}=t(n(e,{asChild:!0,size:`sm`,children:n(`span`,{children:`Inline text`})})),i=r.querySelector(`[data-slot="text"]`);expect(i?.tagName).toBe(`SPAN`),expect(i?.getAttribute(`data-size`)).toBe(`sm`)}),it(`forwards ref to the underlying paragraph element`,()=>{let r={current:null};t(n(e,{ref:r,children:`Ref target`})),expect(r.current).toBeInstanceOf(HTMLParagraphElement)})});
|
|
2
2
|
//# sourceMappingURL=text.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"../textarea-
|
|
1
|
+
import{t as e}from"../textarea-eJQTMC_d.js";export{e as Textarea};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../rolldown-runtime-Bdj-bS2b.js";import{o as e,t}from"../field-DzR-XrO7.js";import{t as n}from"../textarea-
|
|
1
|
+
import"../rolldown-runtime-Bdj-bS2b.js";import{o as e,t}from"../field-DzR-XrO7.js";import{t as n}from"../textarea-eJQTMC_d.js";import{a as r,n as i,r as a}from"../react.esm-dE9nuHcL.js";import{jsx as o,jsxs as s}from"react/jsx-runtime";describe(`Textarea`,()=>{it(`renders a textarea with data-slot and the default classes`,()=>{let{container:e}=a(o(n,{placeholder:`Write something`})),t=e.querySelector(`[data-slot="textarea"]`);expect(t).not.toBeNull(),expect(t?.tagName).toBe(`TEXTAREA`),expect(t?.className).toContain(`min-h-16`),expect(t?.getAttribute(`placeholder`)).toBe(`Write something`)}),it(`preserves an explicit id without requiring Field context`,()=>{let{container:e}=a(o(n,{id:`bio`}));expect(e.querySelector(`[data-slot="textarea"]`)?.getAttribute(`id`)).toBe(`bio`)}),it(`does not assign an id outside Field when none is provided`,()=>{let{container:e}=a(o(n,{}));expect(e.querySelector(`[data-slot="textarea"]`)?.getAttribute(`id`)).toBeNull()}),it(`wires the field control id when rendered inside Field`,()=>{a(s(t,{children:[o(e,{children:`Message`}),o(n,{})]}));let i=r.getByLabelText(`Message`);expect(i.getAttribute(`id`)).toBeTruthy()}),it(`updates its value when the user types`,()=>{a(o(n,{"aria-label":`Comment`}));let e=r.getByLabelText(`Comment`);i.change(e,{target:{value:`Hello world`}}),expect(e.value).toBe(`Hello world`)}),it(`forwards ref to the underlying textarea element`,()=>{let e={current:null};a(o(n,{ref:e})),expect(e.current).toBeInstanceOf(HTMLTextAreaElement)})});
|
|
2
2
|
//# sourceMappingURL=textarea.spec.js.map
|