@uselets/ui 1.18.1 → 1.18.3

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.
Files changed (62) hide show
  1. package/README.md +2 -2
  2. package/dist/{combobox-fNAIovsN.js → combobox-oMHLoLqV.js} +2 -2
  3. package/dist/{combobox-fNAIovsN.js.map → combobox-oMHLoLqV.js.map} +1 -1
  4. package/dist/{command-0wTb46Ym.js → command-Ce8Ojl-B.js} +2 -2
  5. package/dist/{command-0wTb46Ym.js.map → command-Ce8Ojl-B.js.map} +1 -1
  6. package/dist/components/combobox.js +1 -1
  7. package/dist/components/combobox.spec.js +1 -1
  8. package/dist/components/command.js +1 -1
  9. package/dist/components/command.spec.js +1 -1
  10. package/dist/components/data-table.d.ts +2 -2
  11. package/dist/components/data-table.js +1 -1
  12. package/dist/components/data-table.spec.js +1 -1
  13. package/dist/components/data-table.spec.js.map +1 -1
  14. package/dist/components/date-range-picker.js +1 -1
  15. package/dist/components/date-range-picker.spec.js +1 -1
  16. package/dist/components/field.spec.js +1 -1
  17. package/dist/components/input-group.js +1 -1
  18. package/dist/components/input-group.spec.js +1 -1
  19. package/dist/components/input.js +1 -1
  20. package/dist/components/input.spec.js +1 -1
  21. package/dist/components/logo.js +1 -1
  22. package/dist/components/logo.spec.js +1 -1
  23. package/dist/components/logo.spec.js.map +1 -1
  24. package/dist/components/mask-input.js +1 -1
  25. package/dist/components/mask-input.spec.js +1 -1
  26. package/dist/components/phone-input.js +1 -1
  27. package/dist/components/phone-input.spec.js +1 -1
  28. package/dist/components/sidebar.js +1 -1
  29. package/dist/components/sidebar.spec.js +1 -1
  30. package/dist/data-table-DXNWHN9R.d.ts +4184 -0
  31. package/dist/data-table-tnfPcXqc.js +2 -0
  32. package/dist/data-table-tnfPcXqc.js.map +1 -0
  33. package/dist/{date-range-picker-CJVpTZdT.js → date-range-picker-w3ZVRIII.js} +2 -2
  34. package/dist/{date-range-picker-CJVpTZdT.js.map → date-range-picker-w3ZVRIII.js.map} +1 -1
  35. package/dist/index.d.ts +2 -2
  36. package/dist/index.js +1 -1
  37. package/dist/{input-Cmjl8YdK.js → input-BhEEV_nn.js} +2 -2
  38. package/dist/{input-Cmjl8YdK.js.map → input-BhEEV_nn.js.map} +1 -1
  39. package/dist/{input-group-DsO2W3Lw.js → input-group-BUTp8vYe.js} +2 -2
  40. package/dist/{input-group-DsO2W3Lw.js.map → input-group-BUTp8vYe.js.map} +1 -1
  41. package/dist/logo-BkwNxZNw.js +2 -0
  42. package/dist/logo-BkwNxZNw.js.map +1 -0
  43. package/dist/{mask-input-ssK7U_Pl.js → mask-input-BnifHAsJ.js} +2 -2
  44. package/dist/{mask-input-ssK7U_Pl.js.map → mask-input-BnifHAsJ.js.map} +1 -1
  45. package/dist/{phone-input-D72tVPWH.js → phone-input-ambhiSLO.js} +2 -2
  46. package/dist/{phone-input-D72tVPWH.js.map → phone-input-ambhiSLO.js.map} +1 -1
  47. package/dist/react.esm-BkhVXJ8s.js.map +1 -1
  48. package/dist/{sidebar-B5bEgDy5.js → sidebar-f9maf3VF.js} +2 -2
  49. package/dist/{sidebar-B5bEgDy5.js.map → sidebar-f9maf3VF.js.map} +1 -1
  50. package/dist/skills/uselets-ui/references/component-catalog.md +1 -1
  51. package/dist/skills/uselets-ui/references/package-guide.md +2 -0
  52. package/dist/styles/gomax.css +4 -0
  53. package/dist/styles/max.css +4 -0
  54. package/dist/styles/theme.css +2 -0
  55. package/package.json +7 -7
  56. package/skills/uselets-ui/references/component-catalog.md +1 -1
  57. package/skills/uselets-ui/references/package-guide.md +2 -0
  58. package/dist/data-table-BT75MSO9.d.ts +0 -111
  59. package/dist/data-table-DcyKClKz.js +0 -2
  60. package/dist/data-table-DcyKClKz.js.map +0 -1
  61. package/dist/logo-B0v9bNJH.js +0 -2
  62. package/dist/logo-B0v9bNJH.js.map +0 -1
@@ -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"../input-group-DsO2W3Lw.js";import{a as c,n as l,r as u}from"../react.esm-BkhVXJ8s.js";import{jsx as d,jsxs as f}from"react/jsx-runtime";describe(`InputGroup`,()=>{it(`renders the root container with its data-slot and base classes`,()=>{let{container:e}=u(d(s,{children:`content`})),t=e.querySelector(`[data-slot="input-group"]`);expect(t).not.toBeNull(),expect(t?.className).toContain(`rounded-lg`),expect(t?.className).toContain(`border`)}),describe(`InputGroupAddon`,()=>{it(`defaults to the inline-start alignment`,()=>{let{container:e}=u(d(i,{children:`$`})),t=e.querySelector(`[data-slot="input-group-addon"]`);expect(t?.getAttribute(`data-align`)).toBe(`inline-start`),expect(t?.className).toContain(`order-first`)}),it(`applies the inline-end alignment classes`,()=>{let{container:e}=u(d(i,{align:`inline-end`,children:`USD`})),t=e.querySelector(`[data-slot="input-group-addon"]`);expect(t?.getAttribute(`data-align`)).toBe(`inline-end`),expect(t?.className).toContain(`order-last`)})}),describe(`InputGroupButton`,()=>{it(`renders as a button with the forwarded variant, color and custom size attributes`,()=>{let e=vi.fn();u(d(o,{size:`icon-sm`,color:`primary`,onClick:e,children:`Action`}));let t=c.getByRole(`button`,{name:`Action`});expect(t.getAttribute(`type`)).toBe(`button`),expect(t.getAttribute(`data-variant`)).toBe(`ghost`),expect(t.getAttribute(`data-color`)).toBe(`primary`),expect(t.getAttribute(`data-size`)).toBe(`icon-sm`),expect(t.className).toContain(`size-8`),l.click(t),expect(e).toHaveBeenCalledTimes(1)}),it(`defaults to the xs size classes`,()=>{u(d(o,{children:`Small`}));let e=c.getByRole(`button`,{name:`Small`});expect(e.getAttribute(`data-size`)).toBe(`xs`),expect(e.className).toContain(`h-6`)})}),it(`renders InputGroupText with its icon-adjacent typography classes`,()=>{u(d(n,{children:`Hint`}));let e=c.getByText(`Hint`);expect(e.tagName).toBe(`SPAN`),expect(e.className).toContain(`text-muted-foreground`)}),describe(`InputGroupInput`,()=>{it(`renders with the input-group-control data-slot and accepts typed input`,()=>{let{container:e}=u(d(r,{placeholder:`Email`})),t=e.querySelector(`[data-slot="input-group-control"]`);expect(t).not.toBeNull(),expect(t.tagName).toBe(`INPUT`),expect(t.className).toContain(`border-0`),l.change(t,{target:{value:`hello@example.com`}}),expect(t.value).toBe(`hello@example.com`)}),it(`reads the Field control id when rendered inside a Field`,()=>{u(f(t,{children:[d(e,{children:`Email`}),d(s,{children:d(r,{})})]}));let n=c.getByLabelText(`Email`),i=c.getByText(`Email`);expect(n.getAttribute(`id`)).toBeTruthy(),expect(i.getAttribute(`for`)).toBe(n.getAttribute(`id`))})}),describe(`InputGroupTextarea`,()=>{it(`renders with the input-group-control data-slot and accepts typed input`,()=>{let{container:e}=u(d(a,{placeholder:`Message`})),t=e.querySelector(`[data-slot="input-group-control"]`);expect(t).not.toBeNull(),expect(t.tagName).toBe(`TEXTAREA`),expect(t.className).toContain(`resize-none`),l.change(t,{target:{value:`Hello there`}}),expect(t.value).toBe(`Hello there`)})}),it(`composes an addon, input and button together`,()=>{let{container:e}=u(f(s,{children:[d(i,{children:d(n,{children:`$`})}),d(r,{placeholder:`Amount`}),d(i,{align:`inline-end`,children:d(o,{children:`Clear`})})]})),t=e.querySelector(`[data-slot="input-group"]`);expect(t?.querySelector(`[data-slot="input-group-addon"]`)).not.toBeNull(),expect(t?.querySelector(`[data-slot="input-group-control"]`)).not.toBeNull(),expect(c.getByRole(`button`,{name:`Clear`})).not.toBeNull()})});
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"../input-group-BUTp8vYe.js";import{a as c,n as l,r as u}from"../react.esm-BkhVXJ8s.js";import{jsx as d,jsxs as f}from"react/jsx-runtime";describe(`InputGroup`,()=>{it(`renders the root container with its data-slot and base classes`,()=>{let{container:e}=u(d(s,{children:`content`})),t=e.querySelector(`[data-slot="input-group"]`);expect(t).not.toBeNull(),expect(t?.className).toContain(`rounded-lg`),expect(t?.className).toContain(`border`)}),describe(`InputGroupAddon`,()=>{it(`defaults to the inline-start alignment`,()=>{let{container:e}=u(d(i,{children:`$`})),t=e.querySelector(`[data-slot="input-group-addon"]`);expect(t?.getAttribute(`data-align`)).toBe(`inline-start`),expect(t?.className).toContain(`order-first`)}),it(`applies the inline-end alignment classes`,()=>{let{container:e}=u(d(i,{align:`inline-end`,children:`USD`})),t=e.querySelector(`[data-slot="input-group-addon"]`);expect(t?.getAttribute(`data-align`)).toBe(`inline-end`),expect(t?.className).toContain(`order-last`)})}),describe(`InputGroupButton`,()=>{it(`renders as a button with the forwarded variant, color and custom size attributes`,()=>{let e=vi.fn();u(d(o,{size:`icon-sm`,color:`primary`,onClick:e,children:`Action`}));let t=c.getByRole(`button`,{name:`Action`});expect(t.getAttribute(`type`)).toBe(`button`),expect(t.getAttribute(`data-variant`)).toBe(`ghost`),expect(t.getAttribute(`data-color`)).toBe(`primary`),expect(t.getAttribute(`data-size`)).toBe(`icon-sm`),expect(t.className).toContain(`size-8`),l.click(t),expect(e).toHaveBeenCalledTimes(1)}),it(`defaults to the xs size classes`,()=>{u(d(o,{children:`Small`}));let e=c.getByRole(`button`,{name:`Small`});expect(e.getAttribute(`data-size`)).toBe(`xs`),expect(e.className).toContain(`h-6`)})}),it(`renders InputGroupText with its icon-adjacent typography classes`,()=>{u(d(n,{children:`Hint`}));let e=c.getByText(`Hint`);expect(e.tagName).toBe(`SPAN`),expect(e.className).toContain(`text-muted-foreground`)}),describe(`InputGroupInput`,()=>{it(`renders with the input-group-control data-slot and accepts typed input`,()=>{let{container:e}=u(d(r,{placeholder:`Email`})),t=e.querySelector(`[data-slot="input-group-control"]`);expect(t).not.toBeNull(),expect(t.tagName).toBe(`INPUT`),expect(t.className).toContain(`border-0`),l.change(t,{target:{value:`hello@example.com`}}),expect(t.value).toBe(`hello@example.com`)}),it(`reads the Field control id when rendered inside a Field`,()=>{u(f(t,{children:[d(e,{children:`Email`}),d(s,{children:d(r,{})})]}));let n=c.getByLabelText(`Email`),i=c.getByText(`Email`);expect(n.getAttribute(`id`)).toBeTruthy(),expect(i.getAttribute(`for`)).toBe(n.getAttribute(`id`))})}),describe(`InputGroupTextarea`,()=>{it(`renders with the input-group-control data-slot and accepts typed input`,()=>{let{container:e}=u(d(a,{placeholder:`Message`})),t=e.querySelector(`[data-slot="input-group-control"]`);expect(t).not.toBeNull(),expect(t.tagName).toBe(`TEXTAREA`),expect(t.className).toContain(`resize-none`),l.change(t,{target:{value:`Hello there`}}),expect(t.value).toBe(`Hello there`)})}),it(`composes an addon, input and button together`,()=>{let{container:e}=u(f(s,{children:[d(i,{children:d(n,{children:`$`})}),d(r,{placeholder:`Amount`}),d(i,{align:`inline-end`,children:d(o,{children:`Clear`})})]})),t=e.querySelector(`[data-slot="input-group"]`);expect(t?.querySelector(`[data-slot="input-group-addon"]`)).not.toBeNull(),expect(t?.querySelector(`[data-slot="input-group-control"]`)).not.toBeNull(),expect(c.getByRole(`button`,{name:`Clear`})).not.toBeNull()})});
2
2
  //# sourceMappingURL=input-group.spec.js.map
@@ -1 +1 @@
1
- import{t as e}from"../input-Cmjl8YdK.js";export{e as Input};
1
+ import{t as e}from"../input-BhEEV_nn.js";export{e as Input};
@@ -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"../input-Cmjl8YdK.js";import{a as r,n as i,r as a}from"../react.esm-BkhVXJ8s.js";import{jsx as o,jsxs as s}from"react/jsx-runtime";describe(`Input`,()=>{it(`renders an input with the input data-slot and base classes`,()=>{let{container:e}=a(o(n,{placeholder:`Email`})),t=e.querySelector(`[data-slot="input"]`);expect(t?.tagName).toBe(`INPUT`),expect(t?.className).toContain(`rounded-lg`),expect(t?.getAttribute(`placeholder`)).toBe(`Email`)}),it(`does not assign an id when rendered outside a Field and no id is given`,()=>{let{container:e}=a(o(n,{}));expect(e.querySelector(`[data-slot="input"]`)?.getAttribute(`id`)).toBeNull()}),it(`adopts the Field generated control id when no explicit id is provided`,()=>{a(s(t,{children:[o(e,{children:`Email`}),o(n,{})]}));let i=r.getByLabelText(`Email`);expect(i.getAttribute(`id`)).toBeTruthy()}),it(`keeps an explicit id even when rendered inside a Field`,()=>{let{container:e}=a(o(t,{children:o(n,{id:`explicit-input`})}));expect(e.querySelector(`[data-slot="input"]`)?.getAttribute(`id`)).toBe(`explicit-input`)}),it(`fires onChange with the typed value`,()=>{let e=vi.fn();a(o(n,{onChange:e})),i.change(r.getByRole(`textbox`),{target:{value:`hello`}}),expect(e).toHaveBeenCalledTimes(1),expect(r.getByRole(`textbox`).value).toBe(`hello`)}),it(`forwards a ref to the underlying input element`,()=>{let e={current:null};a(o(n,{ref:e})),expect(e.current).toBeInstanceOf(HTMLInputElement)})});
1
+ import"../rolldown-runtime-Bdj-bS2b.js";import{o as e,t}from"../field-DzR-XrO7.js";import{t as n}from"../input-BhEEV_nn.js";import{a as r,n as i,r as a}from"../react.esm-BkhVXJ8s.js";import{jsx as o,jsxs as s}from"react/jsx-runtime";describe(`Input`,()=>{it(`renders an input with the input data-slot and base classes`,()=>{let{container:e}=a(o(n,{placeholder:`Email`})),t=e.querySelector(`[data-slot="input"]`);expect(t?.tagName).toBe(`INPUT`),expect(t?.className).toContain(`rounded-lg`),expect(t?.getAttribute(`placeholder`)).toBe(`Email`)}),it(`does not assign an id when rendered outside a Field and no id is given`,()=>{let{container:e}=a(o(n,{}));expect(e.querySelector(`[data-slot="input"]`)?.getAttribute(`id`)).toBeNull()}),it(`adopts the Field generated control id when no explicit id is provided`,()=>{a(s(t,{children:[o(e,{children:`Email`}),o(n,{})]}));let i=r.getByLabelText(`Email`);expect(i.getAttribute(`id`)).toBeTruthy()}),it(`keeps an explicit id even when rendered inside a Field`,()=>{let{container:e}=a(o(t,{children:o(n,{id:`explicit-input`})}));expect(e.querySelector(`[data-slot="input"]`)?.getAttribute(`id`)).toBe(`explicit-input`)}),it(`fires onChange with the typed value`,()=>{let e=vi.fn();a(o(n,{onChange:e})),i.change(r.getByRole(`textbox`),{target:{value:`hello`}}),expect(e).toHaveBeenCalledTimes(1),expect(r.getByRole(`textbox`).value).toBe(`hello`)}),it(`forwards a ref to the underlying input element`,()=>{let e={current:null};a(o(n,{ref:e})),expect(e.current).toBeInstanceOf(HTMLInputElement)})});
2
2
  //# sourceMappingURL=input.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}from"../logo-B0v9bNJH.js";export{c as BippiLogo,i as FibonashLogo,o as GomaxLogo,n as IntelitrackLogo,e as KovraLogo,a as LetsLogo,s as MaxLogo,t as NeutraLogo,r as RdLogo};
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}from"../logo-BkwNxZNw.js";export{c as BippiLogo,i as FibonashLogo,o as GomaxLogo,n as IntelitrackLogo,e as KovraLogo,a as LetsLogo,s as MaxLogo,t as NeutraLogo,r as RdLogo};
@@ -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"../logo-B0v9bNJH.js";import{r as l}from"../react.esm-BkhVXJ8s.js";import{jsx as u}from"react/jsx-runtime";const d=[{Component:c,slot:`bippi-logo`,supportsVariant:!0},{Component:i,slot:`fibonash-logo`,supportsVariant:!0},{Component:o,slot:`gomax-logo`,supportsVariant:!0},{Component:n,slot:`intelitrack-logo`,supportsVariant:!0},{Component:e,slot:`kovra-logo`,supportsVariant:!0},{Component:a,slot:`lets-logo`,supportsVariant:!1},{Component:s,slot:`max-logo`,supportsVariant:!0},{Component:t,slot:`neutra-logo`,supportsVariant:!0},{Component:r,slot:`rd-logo`,supportsVariant:!0}];describe(`Logo`,()=>{it(`mounts every exported logo component without throwing`,()=>{for(let{Component:e}of d)expect(()=>l(u(e,{}))).not.toThrow()}),it(`renders each logo as an svg element with its expected data-slot`,()=>{for(let{Component:e,slot:t}of d){let{container:n,unmount:r}=l(u(e,{})),i=n.querySelector(`[data-slot="${t}"]`);expect(i).not.toBeNull(),expect(i?.tagName.toLowerCase()).toBe(`svg`),r()}}),it(`applies the mono tone to every logo`,()=>{for(let{Component:e,slot:t}of d){let{container:n,unmount:r}=l(u(e,{tone:`mono`})),i=n.querySelector(`[data-slot="${t}"]`);expect(i?.getAttribute(`data-tone`)).toBe(`mono`),r()}}),it(`applies the icon variant for logos that support a variant prop`,()=>{for(let{Component:e,slot:t,supportsVariant:n}of d){if(!n)continue;let{container:r,unmount:i}=l(u(e,{variant:`icon`})),a=r.querySelector(`[data-slot="${t}"]`);expect(a?.getAttribute(`data-variant`)).toBe(`icon`),i()}})});
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"../logo-BkwNxZNw.js";import{r as l}from"../react.esm-BkhVXJ8s.js";import{jsx as u}from"react/jsx-runtime";const d=[{Component:c,slot:`bippi-logo`,supportsVariant:!0},{Component:i,slot:`fibonash-logo`,supportsVariant:!0},{Component:o,slot:`gomax-logo`,supportsVariant:!0},{Component:n,slot:`intelitrack-logo`,supportsVariant:!0},{Component:e,slot:`kovra-logo`,supportsVariant:!0},{Component:a,slot:`lets-logo`,supportsVariant:!1},{Component:s,slot:`max-logo`,supportsVariant:!0},{Component:t,slot:`neutra-logo`,supportsVariant:!0},{Component:r,slot:`rd-logo`,supportsVariant:!0}];describe(`Logo`,()=>{it(`mounts every exported logo component without throwing`,()=>{for(let{Component:e}of d)expect(()=>l(u(e,{}))).not.toThrow()}),it(`renders each logo as an svg element with its expected data-slot`,()=>{for(let{Component:e,slot:t}of d){let{container:n,unmount:r}=l(u(e,{})),i=n.querySelector(`[data-slot="${t}"]`);expect(i).not.toBeNull(),expect(i?.tagName.toLowerCase()).toBe(`svg`),r()}}),it(`applies the mono tone to every logo`,()=>{for(let{Component:e,slot:t}of d){let{container:n,unmount:r}=l(u(e,{tone:`mono`})),i=n.querySelector(`[data-slot="${t}"]`);expect(i?.getAttribute(`data-tone`)).toBe(`mono`),r()}}),it(`applies the icon variant for logos that support a variant prop`,()=>{for(let{Component:e,slot:t,supportsVariant:n}of d){if(!n)continue;let{container:r,unmount:i}=l(u(e,{variant:`icon`})),a=r.querySelector(`[data-slot="${t}"]`);expect(a?.getAttribute(`data-variant`)).toBe(`icon`),i()}}),it(`uses the logo-foreground token instead of a hardcoded hex fill for color tone`,()=>{let a=[{Component:n,slot:`intelitrack-logo`},{Component:t,slot:`neutra-logo`},{Component:e,slot:`kovra-logo`},{Component:i,slot:`fibonash-logo`}];for(let{Component:e,slot:t}of a){let{container:n,unmount:r}=l(u(e,{tone:`color`})),i=n.querySelector(`[data-slot="${t}"]`);expect(i?.innerHTML).toContain(`var(--logo-foreground)`),expect(i?.innerHTML).not.toContain(`1D2436`),r()}let{container:o,unmount:s}=l(u(r,{tone:`color`})),c=o.querySelector(`[data-slot="rd-logo"]`);expect(c?.innerHTML).toContain(`var(--rd-logo-foreground)`),expect(c?.innerHTML).not.toContain(`0A2F2A`),s()})});
2
2
  //# sourceMappingURL=logo.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logo.spec.js","names":[],"sources":["../../src/components/logo.spec.tsx"],"sourcesContent":["import { render } from '@testing-library/react'\n\nimport {\n BippiLogo,\n FibonashLogo,\n GomaxLogo,\n IntelitrackLogo,\n KovraLogo,\n LetsLogo,\n MaxLogo,\n NeutraLogo,\n RdLogo\n} from './logo'\n\nconst logos = [\n { Component: BippiLogo, slot: 'bippi-logo', supportsVariant: true },\n { Component: FibonashLogo, slot: 'fibonash-logo', supportsVariant: true },\n { Component: GomaxLogo, slot: 'gomax-logo', supportsVariant: true },\n { Component: IntelitrackLogo, slot: 'intelitrack-logo', supportsVariant: true },\n { Component: KovraLogo, slot: 'kovra-logo', supportsVariant: true },\n { Component: LetsLogo, slot: 'lets-logo', supportsVariant: false },\n { Component: MaxLogo, slot: 'max-logo', supportsVariant: true },\n { Component: NeutraLogo, slot: 'neutra-logo', supportsVariant: true },\n { Component: RdLogo, slot: 'rd-logo', supportsVariant: true }\n] as const\n\ndescribe('Logo', () => {\n it('mounts every exported logo component without throwing', () => {\n for (const { Component } of logos) {\n expect(() => render(<Component />)).not.toThrow()\n }\n })\n\n it('renders each logo as an svg element with its expected data-slot', () => {\n for (const { Component, slot } of logos) {\n const { container, unmount } = render(<Component />)\n\n const svg = container.querySelector(`[data-slot=\"${slot}\"]`)\n\n expect(svg).not.toBeNull()\n expect(svg?.tagName.toLowerCase()).toBe('svg')\n\n unmount()\n }\n })\n\n it('applies the mono tone to every logo', () => {\n for (const { Component, slot } of logos) {\n const { container, unmount } = render(<Component tone=\"mono\" />)\n\n const svg = container.querySelector(`[data-slot=\"${slot}\"]`)\n\n expect(svg?.getAttribute('data-tone')).toBe('mono')\n\n unmount()\n }\n })\n\n it('applies the icon variant for logos that support a variant prop', () => {\n for (const { Component, slot, supportsVariant } of logos) {\n if (!supportsVariant) {\n continue\n }\n\n const { container, unmount } = render(<Component variant=\"icon\" />)\n\n const svg = container.querySelector(`[data-slot=\"${slot}\"]`)\n\n expect(svg?.getAttribute('data-variant')).toBe('icon')\n\n unmount()\n }\n })\n})\n"],"mappings":"wNAcA,MAAM,EAAQ,CACZ,CAAE,UAAW,EAAW,KAAM,aAAc,gBAAiB,EAAK,EAClE,CAAE,UAAW,EAAc,KAAM,gBAAiB,gBAAiB,EAAK,EACxE,CAAE,UAAW,EAAW,KAAM,aAAc,gBAAiB,EAAK,EAClE,CAAE,UAAW,EAAiB,KAAM,mBAAoB,gBAAiB,EAAK,EAC9E,CAAE,UAAW,EAAW,KAAM,aAAc,gBAAiB,EAAK,EAClE,CAAE,UAAW,EAAU,KAAM,YAAa,gBAAiB,EAAM,EACjE,CAAE,UAAW,EAAS,KAAM,WAAY,gBAAiB,EAAK,EAC9D,CAAE,UAAW,EAAY,KAAM,cAAe,gBAAiB,EAAK,EACpE,CAAE,UAAW,EAAQ,KAAM,UAAW,gBAAiB,EAAK,CAC9D,EAEA,SAAS,WAAc,CACrB,GAAG,4DAA+D,CAChE,IAAK,GAAM,CAAE,eAAe,EAC1B,WAAa,EAAO,EAAC,EAAD,CAAY,CAAA,CAAC,CAAC,CAAC,CAAC,IAAI,QAAQ,CAEpD,CAAC,EAED,GAAG,sEAAyE,CAC1E,IAAK,GAAM,CAAE,YAAW,UAAU,EAAO,CACvC,GAAM,CAAE,YAAW,WAAY,EAAO,EAAC,EAAD,CAAY,CAAA,CAAC,EAE7C,EAAM,EAAU,cAAc,eAAe,EAAK,GAAG,EAE3D,OAAO,CAAG,CAAC,CAAC,IAAI,SAAS,EACzB,OAAO,GAAK,QAAQ,YAAY,CAAC,CAAC,CAAC,KAAK,KAAK,EAE7C,EAAQ,CACV,CACF,CAAC,EAED,GAAG,0CAA6C,CAC9C,IAAK,GAAM,CAAE,YAAW,UAAU,EAAO,CACvC,GAAM,CAAE,YAAW,WAAY,EAAO,EAAC,EAAD,CAAW,KAAK,MAAQ,CAAA,CAAC,EAEzD,EAAM,EAAU,cAAc,eAAe,EAAK,GAAG,EAE3D,OAAO,GAAK,aAAa,WAAW,CAAC,CAAC,CAAC,KAAK,MAAM,EAElD,EAAQ,CACV,CACF,CAAC,EAED,GAAG,qEAAwE,CACzE,IAAK,GAAM,CAAE,YAAW,OAAM,qBAAqB,EAAO,CACxD,GAAI,CAAC,EACH,SAGF,GAAM,CAAE,YAAW,WAAY,EAAO,EAAC,EAAD,CAAW,QAAQ,MAAQ,CAAA,CAAC,EAE5D,EAAM,EAAU,cAAc,eAAe,EAAK,GAAG,EAE3D,OAAO,GAAK,aAAa,cAAc,CAAC,CAAC,CAAC,KAAK,MAAM,EAErD,EAAQ,CACV,CACF,CAAC,CACH,CAAC"}
1
+ {"version":3,"file":"logo.spec.js","names":[],"sources":["../../src/components/logo.spec.tsx"],"sourcesContent":["import { render } from '@testing-library/react'\n\nimport {\n BippiLogo,\n FibonashLogo,\n GomaxLogo,\n IntelitrackLogo,\n KovraLogo,\n LetsLogo,\n MaxLogo,\n NeutraLogo,\n RdLogo\n} from './logo'\n\nconst logos = [\n { Component: BippiLogo, slot: 'bippi-logo', supportsVariant: true },\n { Component: FibonashLogo, slot: 'fibonash-logo', supportsVariant: true },\n { Component: GomaxLogo, slot: 'gomax-logo', supportsVariant: true },\n { Component: IntelitrackLogo, slot: 'intelitrack-logo', supportsVariant: true },\n { Component: KovraLogo, slot: 'kovra-logo', supportsVariant: true },\n { Component: LetsLogo, slot: 'lets-logo', supportsVariant: false },\n { Component: MaxLogo, slot: 'max-logo', supportsVariant: true },\n { Component: NeutraLogo, slot: 'neutra-logo', supportsVariant: true },\n { Component: RdLogo, slot: 'rd-logo', supportsVariant: true }\n] as const\n\ndescribe('Logo', () => {\n it('mounts every exported logo component without throwing', () => {\n for (const { Component } of logos) {\n expect(() => render(<Component />)).not.toThrow()\n }\n })\n\n it('renders each logo as an svg element with its expected data-slot', () => {\n for (const { Component, slot } of logos) {\n const { container, unmount } = render(<Component />)\n\n const svg = container.querySelector(`[data-slot=\"${slot}\"]`)\n\n expect(svg).not.toBeNull()\n expect(svg?.tagName.toLowerCase()).toBe('svg')\n\n unmount()\n }\n })\n\n it('applies the mono tone to every logo', () => {\n for (const { Component, slot } of logos) {\n const { container, unmount } = render(<Component tone=\"mono\" />)\n\n const svg = container.querySelector(`[data-slot=\"${slot}\"]`)\n\n expect(svg?.getAttribute('data-tone')).toBe('mono')\n\n unmount()\n }\n })\n\n it('applies the icon variant for logos that support a variant prop', () => {\n for (const { Component, slot, supportsVariant } of logos) {\n if (!supportsVariant) {\n continue\n }\n\n const { container, unmount } = render(<Component variant=\"icon\" />)\n\n const svg = container.querySelector(`[data-slot=\"${slot}\"]`)\n\n expect(svg?.getAttribute('data-variant')).toBe('icon')\n\n unmount()\n }\n })\n\n it('uses the logo-foreground token instead of a hardcoded hex fill for color tone', () => {\n const colorTokenLogos = [\n { Component: IntelitrackLogo, slot: 'intelitrack-logo' },\n { Component: NeutraLogo, slot: 'neutra-logo' },\n { Component: KovraLogo, slot: 'kovra-logo' },\n { Component: FibonashLogo, slot: 'fibonash-logo' }\n ] as const\n\n for (const { Component, slot } of colorTokenLogos) {\n const { container, unmount } = render(<Component tone=\"color\" />)\n\n const svg = container.querySelector(`[data-slot=\"${slot}\"]`)\n\n expect(svg?.innerHTML).toContain('var(--logo-foreground)')\n expect(svg?.innerHTML).not.toContain('1D2436')\n\n unmount()\n }\n\n const { container: rdContainer, unmount: unmountRd } = render(<RdLogo tone=\"color\" />)\n\n const rdSvg = rdContainer.querySelector('[data-slot=\"rd-logo\"]')\n\n expect(rdSvg?.innerHTML).toContain('var(--rd-logo-foreground)')\n expect(rdSvg?.innerHTML).not.toContain('0A2F2A')\n\n unmountRd()\n })\n})\n"],"mappings":"wNAcA,MAAM,EAAQ,CACZ,CAAE,UAAW,EAAW,KAAM,aAAc,gBAAiB,EAAK,EAClE,CAAE,UAAW,EAAc,KAAM,gBAAiB,gBAAiB,EAAK,EACxE,CAAE,UAAW,EAAW,KAAM,aAAc,gBAAiB,EAAK,EAClE,CAAE,UAAW,EAAiB,KAAM,mBAAoB,gBAAiB,EAAK,EAC9E,CAAE,UAAW,EAAW,KAAM,aAAc,gBAAiB,EAAK,EAClE,CAAE,UAAW,EAAU,KAAM,YAAa,gBAAiB,EAAM,EACjE,CAAE,UAAW,EAAS,KAAM,WAAY,gBAAiB,EAAK,EAC9D,CAAE,UAAW,EAAY,KAAM,cAAe,gBAAiB,EAAK,EACpE,CAAE,UAAW,EAAQ,KAAM,UAAW,gBAAiB,EAAK,CAC9D,EAEA,SAAS,WAAc,CACrB,GAAG,4DAA+D,CAChE,IAAK,GAAM,CAAE,eAAe,EAC1B,WAAa,EAAO,EAAC,EAAD,CAAY,CAAA,CAAC,CAAC,CAAC,CAAC,IAAI,QAAQ,CAEpD,CAAC,EAED,GAAG,sEAAyE,CAC1E,IAAK,GAAM,CAAE,YAAW,UAAU,EAAO,CACvC,GAAM,CAAE,YAAW,WAAY,EAAO,EAAC,EAAD,CAAY,CAAA,CAAC,EAE7C,EAAM,EAAU,cAAc,eAAe,EAAK,GAAG,EAE3D,OAAO,CAAG,CAAC,CAAC,IAAI,SAAS,EACzB,OAAO,GAAK,QAAQ,YAAY,CAAC,CAAC,CAAC,KAAK,KAAK,EAE7C,EAAQ,CACV,CACF,CAAC,EAED,GAAG,0CAA6C,CAC9C,IAAK,GAAM,CAAE,YAAW,UAAU,EAAO,CACvC,GAAM,CAAE,YAAW,WAAY,EAAO,EAAC,EAAD,CAAW,KAAK,MAAQ,CAAA,CAAC,EAEzD,EAAM,EAAU,cAAc,eAAe,EAAK,GAAG,EAE3D,OAAO,GAAK,aAAa,WAAW,CAAC,CAAC,CAAC,KAAK,MAAM,EAElD,EAAQ,CACV,CACF,CAAC,EAED,GAAG,qEAAwE,CACzE,IAAK,GAAM,CAAE,YAAW,OAAM,qBAAqB,EAAO,CACxD,GAAI,CAAC,EACH,SAGF,GAAM,CAAE,YAAW,WAAY,EAAO,EAAC,EAAD,CAAW,QAAQ,MAAQ,CAAA,CAAC,EAE5D,EAAM,EAAU,cAAc,eAAe,EAAK,GAAG,EAE3D,OAAO,GAAK,aAAa,cAAc,CAAC,CAAC,CAAC,KAAK,MAAM,EAErD,EAAQ,CACV,CACF,CAAC,EAED,GAAG,oFAAuF,CACxF,IAAM,EAAkB,CACtB,CAAE,UAAW,EAAiB,KAAM,kBAAmB,EACvD,CAAE,UAAW,EAAY,KAAM,aAAc,EAC7C,CAAE,UAAW,EAAW,KAAM,YAAa,EAC3C,CAAE,UAAW,EAAc,KAAM,eAAgB,CACnD,EAEA,IAAK,GAAM,CAAE,YAAW,UAAU,EAAiB,CACjD,GAAM,CAAE,YAAW,WAAY,EAAO,EAAC,EAAD,CAAW,KAAK,OAAS,CAAA,CAAC,EAE1D,EAAM,EAAU,cAAc,eAAe,EAAK,GAAG,EAE3D,OAAO,GAAK,SAAS,CAAC,CAAC,UAAU,wBAAwB,EACzD,OAAO,GAAK,SAAS,CAAC,CAAC,IAAI,UAAU,QAAQ,EAE7C,EAAQ,CACV,CAEA,GAAM,CAAE,UAAW,EAAa,QAAS,GAAc,EAAO,EAAC,EAAD,CAAQ,KAAK,OAAS,CAAA,CAAC,EAE/E,EAAQ,EAAY,cAAc,uBAAuB,EAE/D,OAAO,GAAO,SAAS,CAAC,CAAC,UAAU,2BAA2B,EAC9D,OAAO,GAAO,SAAS,CAAC,CAAC,IAAI,UAAU,QAAQ,EAE/C,EAAU,CACZ,CAAC,CACH,CAAC"}
@@ -1 +1 @@
1
- import{t as e}from"../mask-input-ssK7U_Pl.js";export{e as MaskInput};
1
+ import{t as e}from"../mask-input-BnifHAsJ.js";export{e as MaskInput};
@@ -1,2 +1,2 @@
1
- import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../use-mask-DBvFShXA.js";import{t}from"../mask-input-ssK7U_Pl.js";import{r as n}from"../react.esm-BkhVXJ8s.js";import{jsx as r}from"react/jsx-runtime";const i=vi.hoisted(()=>({ref:vi.fn(),useMask:vi.fn()}));vi.mock(`../hooks/use-mask`,()=>({useMask:i.useMask})),describe(`MaskInput`,()=>{beforeEach(()=>{i.useMask.mockReturnValue(i.ref)}),it(`renders an input with the mask-input data-slot`,()=>{let{container:e}=n(r(t,{mask:`___-___`}));expect(e.querySelector(`[data-slot="mask-input"]`)).not.toBeNull()}),it(`wires the mask hook with the mask prop and related options`,()=>{n(r(t,{mask:`(___) ___-____`,replacement:{_:/\d/},showMask:!0,separate:!0})),expect(e).toHaveBeenCalledWith({mask:`(___) ___-____`,replacement:{_:/\d/},showMask:!0,separate:!0,track:void 0,modify:void 0})}),it(`attaches the mask ref returned by the hook to the rendered input element`,()=>{let{container:e}=n(r(t,{mask:`___-___`})),a=e.querySelector(`[data-slot="mask-input"]`);expect(i.ref).toHaveBeenCalledWith(a)}),it(`forwards standard input props such as placeholder and disabled`,()=>{let{container:e}=n(r(t,{mask:`___-___`,placeholder:`Enter code`,disabled:!0})),i=e.querySelector(`[data-slot="mask-input"]`);expect(i.placeholder).toBe(`Enter code`),expect(i.disabled).toBe(!0)}),it(`forwards an external ref alongside the mask ref`,()=>{let e={current:null},{container:i}=n(r(t,{mask:`___-___`,ref:e}));expect(e.current).toBe(i.querySelector(`[data-slot="mask-input"]`))})});
1
+ import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../use-mask-DBvFShXA.js";import{t}from"../mask-input-BnifHAsJ.js";import{r as n}from"../react.esm-BkhVXJ8s.js";import{jsx as r}from"react/jsx-runtime";const i=vi.hoisted(()=>({ref:vi.fn(),useMask:vi.fn()}));vi.mock(`../hooks/use-mask`,()=>({useMask:i.useMask})),describe(`MaskInput`,()=>{beforeEach(()=>{i.useMask.mockReturnValue(i.ref)}),it(`renders an input with the mask-input data-slot`,()=>{let{container:e}=n(r(t,{mask:`___-___`}));expect(e.querySelector(`[data-slot="mask-input"]`)).not.toBeNull()}),it(`wires the mask hook with the mask prop and related options`,()=>{n(r(t,{mask:`(___) ___-____`,replacement:{_:/\d/},showMask:!0,separate:!0})),expect(e).toHaveBeenCalledWith({mask:`(___) ___-____`,replacement:{_:/\d/},showMask:!0,separate:!0,track:void 0,modify:void 0})}),it(`attaches the mask ref returned by the hook to the rendered input element`,()=>{let{container:e}=n(r(t,{mask:`___-___`})),a=e.querySelector(`[data-slot="mask-input"]`);expect(i.ref).toHaveBeenCalledWith(a)}),it(`forwards standard input props such as placeholder and disabled`,()=>{let{container:e}=n(r(t,{mask:`___-___`,placeholder:`Enter code`,disabled:!0})),i=e.querySelector(`[data-slot="mask-input"]`);expect(i.placeholder).toBe(`Enter code`),expect(i.disabled).toBe(!0)}),it(`forwards an external ref alongside the mask ref`,()=>{let e={current:null},{container:i}=n(r(t,{mask:`___-___`,ref:e}));expect(e.current).toBe(i.querySelector(`[data-slot="mask-input"]`))})});
2
2
  //# sourceMappingURL=mask-input.spec.js.map
@@ -1 +1 @@
1
- import{t as e}from"../phone-input-D72tVPWH.js";export{e as PhoneInput};
1
+ import{t as e}from"../phone-input-ambhiSLO.js";export{e as PhoneInput};
@@ -1,2 +1,2 @@
1
- import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../phone-input-D72tVPWH.js";import{n as t,r as n}from"../react.esm-BkhVXJ8s.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`)})});
1
+ import"../rolldown-runtime-Bdj-bS2b.js";import{t as e}from"../phone-input-ambhiSLO.js";import{n as t,r as n}from"../react.esm-BkhVXJ8s.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 +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-B5bEgDy5.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
+ 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-f9maf3VF.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-B5bEgDy5.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-f9maf3VF.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()})});
2
2
  //# sourceMappingURL=sidebar.spec.js.map