@gears-frontx/ui-kit 0.4.0-alpha.5 → 0.4.0-alpha.7

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 (50) hide show
  1. package/dist/button.js +60 -57
  2. package/dist/button.js.map +1 -1
  3. package/dist/carousel.js.map +1 -1
  4. package/dist/chart.js +184 -122
  5. package/dist/chart.js.map +1 -1
  6. package/dist/chunks/button.BWdRnIvz.css +1 -0
  7. package/dist/chunks/combobox.CKhQGu5a.css +1 -0
  8. package/dist/chunks/pagination.CKDEuWt6.css +1 -0
  9. package/dist/chunks/spinner.CLQsj9Ky.css +1 -0
  10. package/dist/chunks/table.CMm41tvy.css +1 -0
  11. package/dist/combobox.js +135 -116
  12. package/dist/combobox.js.map +1 -1
  13. package/dist/components/button/button.d.ts +18 -5
  14. package/dist/components/button/button.d.ts.map +1 -1
  15. package/dist/components/carousel/carousel.d.ts +2 -2
  16. package/dist/components/carousel/carousel.d.ts.map +1 -1
  17. package/dist/components/chart/chart.d.ts +7 -6
  18. package/dist/components/chart/chart.d.ts.map +1 -1
  19. package/dist/components/combobox/combobox.d.ts +12 -1
  20. package/dist/components/combobox/combobox.d.ts.map +1 -1
  21. package/dist/components/pagination/pagination.d.ts +33 -2
  22. package/dist/components/pagination/pagination.d.ts.map +1 -1
  23. package/dist/components/pagination/public.d.ts +1 -1
  24. package/dist/components/pagination/public.d.ts.map +1 -1
  25. package/dist/components/sidebar/sidebar.d.ts +1 -1
  26. package/dist/components/sidebar/sidebar.d.ts.map +1 -1
  27. package/dist/components/spinner/spinner.d.ts +11 -1
  28. package/dist/components/spinner/spinner.d.ts.map +1 -1
  29. package/dist/components/table/table.d.ts +18 -2
  30. package/dist/components/table/table.d.ts.map +1 -1
  31. package/dist/docs/button.md +24 -4
  32. package/dist/docs/combobox.md +147 -0
  33. package/dist/docs/pagination.md +84 -5
  34. package/dist/docs/spinner.md +5 -1
  35. package/dist/docs/table.md +95 -11
  36. package/dist/index.js +198 -195
  37. package/dist/pagination.js +96 -52
  38. package/dist/pagination.js.map +1 -1
  39. package/dist/sidebar.js.map +1 -1
  40. package/dist/spinner.js +30 -27
  41. package/dist/spinner.js.map +1 -1
  42. package/dist/table.js +106 -97
  43. package/dist/table.js.map +1 -1
  44. package/llms.txt +27 -9
  45. package/package.json +1 -1
  46. package/dist/chunks/button.DgUTlW0_.css +0 -1
  47. package/dist/chunks/combobox.DZZ3tHP_.css +0 -1
  48. package/dist/chunks/pagination.bFb5us_w.css +0 -1
  49. package/dist/chunks/spinner.sH6x_1Uf.css +0 -1
  50. package/dist/chunks/table.DR2nFT0x.css +0 -1
@@ -1,91 +1,135 @@
1
- import { jsx as i, jsxs as o } from "react/jsx-runtime";
2
- import { cx as t } from "class-variance-authority";
3
- import { MoreHorizontalIcon as l, ChevronRightIcon as u, ChevronLeftIcon as p } from "lucide-react";
4
- import './chunks/pagination.bFb5us_w.css';const _ = "_pagination_u1u2f_16", f = "_content_u1u2f_22", m = "_link_u1u2f_37", N = "_square_u1u2f_101", g = "_previousNextText_u1u2f_106", x = "_icon_u1u2f_119", v = "_ellipsis_u1u2f_126", d = "_srOnly_u1u2f_137", a = {
5
- pagination: _,
6
- content: f,
7
- link: m,
8
- square: N,
9
- previousNextText: g,
10
- icon: x,
11
- ellipsis: v,
12
- srOnly: d
13
- };
14
- function k({ className: n, ...e }) {
1
+ import { jsx as i, jsxs as s, Fragment as c } from "react/jsx-runtime";
2
+ import { Button as f } from "@base-ui/react/button";
3
+ import { cx as o } from "class-variance-authority";
4
+ import { MoreHorizontalIcon as g, ChevronRightIcon as h, ChevronLeftIcon as d } from "lucide-react";
5
+ import './chunks/pagination.CKDEuWt6.css';const q = "_pagination_7mc4q_16", P = "_content_7mc4q_22", x = "_link_7mc4q_37", T = "_square_7mc4q_120", b = "_previousNextText_7mc4q_125", k = "_icon_7mc4q_138", y = "_chevron_7mc4q_147", C = "_ellipsis_7mc4q_153", E = "_srOnly_7mc4q_164", a = {
6
+ pagination: q,
7
+ content: P,
8
+ link: x,
9
+ square: T,
10
+ previousNextText: b,
11
+ icon: k,
12
+ chevron: y,
13
+ ellipsis: C,
14
+ srOnly: E
15
+ }, I = "Previous", O = "Next";
16
+ function l(n) {
17
+ return /* @__PURE__ */ s(c, { children: [
18
+ /* @__PURE__ */ i(d, { className: o(a.icon, a.chevron) }),
19
+ /* @__PURE__ */ i("span", { className: a.previousNextText, children: n })
20
+ ] });
21
+ }
22
+ function u(n) {
23
+ return /* @__PURE__ */ s(c, { children: [
24
+ /* @__PURE__ */ i("span", { className: a.previousNextText, children: n }),
25
+ /* @__PURE__ */ i(h, { className: o(a.icon, a.chevron) })
26
+ ] });
27
+ }
28
+ function m(n) {
29
+ return n.trim() && n !== I ? n : "Go to previous page";
30
+ }
31
+ function p(n) {
32
+ return n.trim() && n !== O ? n : "Go to next page";
33
+ }
34
+ function G({ className: n, ...e }) {
15
35
  return /* @__PURE__ */ i(
16
36
  "nav",
17
37
  {
18
38
  role: "navigation",
19
39
  "aria-label": "pagination",
20
- className: t(a.pagination, n),
40
+ className: o(a.pagination, n),
21
41
  ...e
22
42
  }
23
43
  );
24
44
  }
25
- function y({ className: n, ...e }) {
26
- return /* @__PURE__ */ i("ul", { className: t(a.content, n), ...e });
45
+ function M({ className: n, ...e }) {
46
+ return /* @__PURE__ */ i("ul", { className: o(a.content, n), ...e });
27
47
  }
28
- function T(n) {
48
+ function R(n) {
29
49
  return /* @__PURE__ */ i("li", { ...n });
30
50
  }
31
- function r({ className: n, isActive: e, square: s = !0, ...c }) {
51
+ function _({ className: n, isActive: e, square: t = !0, ...r }) {
32
52
  return /* @__PURE__ */ i(
33
53
  "a",
34
54
  {
35
55
  "aria-current": e ? "page" : void 0,
36
56
  "data-active": e || void 0,
37
- className: t(a.link, s && a.square, n),
38
- ...c
57
+ className: o(a.link, t && a.square, n),
58
+ ...r
39
59
  }
40
60
  );
41
61
  }
42
- function I({
62
+ function z({
43
63
  className: n,
44
64
  text: e = "Previous",
45
- ...s
65
+ ...t
46
66
  }) {
47
- return /* @__PURE__ */ o(
48
- r,
67
+ return /* @__PURE__ */ i(
68
+ _,
49
69
  {
50
- "aria-label": "Go to previous page",
70
+ "aria-label": m(e),
51
71
  square: !1,
52
- className: t(a.previous, n),
53
- ...s,
54
- children: [
55
- /* @__PURE__ */ i(p, { className: a.icon }),
56
- /* @__PURE__ */ i("span", { className: a.previousNextText, children: e })
57
- ]
72
+ className: o(a.previous, n),
73
+ ...t,
74
+ children: l(e)
58
75
  }
59
76
  );
60
77
  }
61
- function O({ className: n, text: e = "Next", ...s }) {
62
- return /* @__PURE__ */ o(
63
- r,
78
+ function F({ className: n, text: e = "Next", ...t }) {
79
+ return /* @__PURE__ */ i(
80
+ _,
64
81
  {
65
- "aria-label": "Go to next page",
82
+ "aria-label": p(e),
66
83
  square: !1,
67
- className: t(a.next, n),
68
- ...s,
69
- children: [
70
- /* @__PURE__ */ i("span", { className: a.previousNextText, children: e }),
71
- /* @__PURE__ */ i(u, { className: a.icon })
72
- ]
84
+ className: o(a.next, n),
85
+ ...t,
86
+ children: u(e)
73
87
  }
74
88
  );
75
89
  }
76
- function b({ className: n, ...e }) {
77
- return /* @__PURE__ */ o("span", { "aria-hidden": "true", className: t(a.ellipsis, n), ...e, children: [
78
- /* @__PURE__ */ i(l, { className: a.icon }),
90
+ function v({
91
+ className: n,
92
+ isActive: e,
93
+ square: t = !0,
94
+ type: r = "button",
95
+ ...N
96
+ }) {
97
+ return /* @__PURE__ */ i(
98
+ f,
99
+ {
100
+ type: r,
101
+ "aria-current": e ? "page" : void 0,
102
+ "data-active": e || void 0,
103
+ className: o(a.link, t && a.square, n),
104
+ ...N
105
+ }
106
+ );
107
+ }
108
+ function H({
109
+ text: n = "Previous",
110
+ ...e
111
+ }) {
112
+ return /* @__PURE__ */ i(v, { "aria-label": m(n), square: !1, ...e, children: l(n) });
113
+ }
114
+ function S({ text: n = "Next", ...e }) {
115
+ return /* @__PURE__ */ i(v, { "aria-label": p(n), square: !1, ...e, children: u(n) });
116
+ }
117
+ function U({ className: n, ...e }) {
118
+ return /* @__PURE__ */ s("span", { "aria-hidden": "true", className: o(a.ellipsis, n), ...e, children: [
119
+ /* @__PURE__ */ i(g, { className: a.icon }),
79
120
  /* @__PURE__ */ i("span", { className: a.srOnly, children: "More pages" })
80
121
  ] });
81
122
  }
82
123
  export {
83
- k as Pagination,
84
- y as PaginationContent,
85
- b as PaginationEllipsis,
86
- T as PaginationItem,
87
- r as PaginationLink,
88
- O as PaginationNext,
89
- I as PaginationPrevious
124
+ G as Pagination,
125
+ v as PaginationButton,
126
+ M as PaginationContent,
127
+ U as PaginationEllipsis,
128
+ R as PaginationItem,
129
+ _ as PaginationLink,
130
+ F as PaginationNext,
131
+ S as PaginationNextButton,
132
+ z as PaginationPrevious,
133
+ H as PaginationPreviousButton
90
134
  };
91
135
  //# sourceMappingURL=pagination.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.js","sources":["../src/components/pagination/pagination.tsx"],"sourcesContent":["import { cx } from 'class-variance-authority';\nimport { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from 'lucide-react';\nimport type { ComponentProps } from 'react';\n\nimport styles from './pagination.module.css';\n\nexport type PaginationProps = ComponentProps<'nav'>;\n\nexport function Pagination({ className, ...props }: PaginationProps) {\n return (\n <nav\n role=\"navigation\"\n aria-label=\"pagination\"\n className={cx(styles.pagination, className)}\n {...props}\n />\n );\n}\n\nexport type PaginationContentProps = ComponentProps<'ul'>;\n\nexport function PaginationContent({ className, ...props }: PaginationContentProps) {\n return <ul className={cx(styles.content, className)} {...props} />;\n}\n\nexport type PaginationItemProps = ComponentProps<'li'>;\n\nexport function PaginationItem(props: PaginationItemProps) {\n return <li {...props} />;\n}\n\nexport interface PaginationLinkProps extends Omit<ComponentProps<'a'>, 'className'> {\n className?: string;\n isActive?: boolean;\n /**\n * Square, icon-sized footprint (aspect-ratio 1, no horizontal padding) —\n * the common case for a bare page number, matching upstream's\n * `size=\"icon\"` default. `PaginationPrevious`/`PaginationNext` opt out\n * (`square={false}`): they carry an icon AND a text label side by side,\n * so a fixed-width square would clip the label.\n * @default true\n */\n square?: boolean;\n}\n\nexport function PaginationLink({ className, isActive, square = true, ...props }: PaginationLinkProps) {\n return (\n <a\n aria-current={isActive ? 'page' : undefined}\n data-active={isActive || undefined}\n className={cx(styles.link, square && styles.square, className)}\n {...props}\n />\n );\n}\n\nexport interface PaginationPreviousProps extends Omit<PaginationLinkProps, 'square'> {\n /** Label text, hidden below the `sm` breakpoint (640px) — matching\n * upstream's `hidden sm:block`. @default 'Previous' */\n text?: string;\n}\n\nexport function PaginationPrevious({\n className,\n text = 'Previous',\n ...props\n}: PaginationPreviousProps) {\n return (\n <PaginationLink\n aria-label=\"Go to previous page\"\n square={false}\n className={cx(styles.previous, className)}\n {...props}\n >\n <ChevronLeftIcon className={styles.icon} />\n <span className={styles.previousNextText}>{text}</span>\n </PaginationLink>\n );\n}\n\nexport interface PaginationNextProps extends Omit<PaginationLinkProps, 'square'> {\n /** @default 'Next' */\n text?: string;\n}\n\nexport function PaginationNext({ className, text = 'Next', ...props }: PaginationNextProps) {\n return (\n <PaginationLink\n aria-label=\"Go to next page\"\n square={false}\n className={cx(styles.next, className)}\n {...props}\n >\n <span className={styles.previousNextText}>{text}</span>\n <ChevronRightIcon className={styles.icon} />\n </PaginationLink>\n );\n}\n\nexport type PaginationEllipsisProps = ComponentProps<'span'>;\n\nexport function PaginationEllipsis({ className, ...props }: PaginationEllipsisProps) {\n return (\n <span aria-hidden=\"true\" className={cx(styles.ellipsis, className)} {...props}>\n <MoreHorizontalIcon className={styles.icon} />\n <span className={styles.srOnly}>More pages</span>\n </span>\n );\n}\n"],"names":["Pagination","className","props","jsx","cx","styles","PaginationContent","PaginationItem","PaginationLink","isActive","square","PaginationPrevious","text","jsxs","ChevronLeftIcon","PaginationNext","ChevronRightIcon","PaginationEllipsis","MoreHorizontalIcon"],"mappings":";;;;;;;;;;;;;AAQO,S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GAAW,MAAAW,IAAO,QAAQ,GAAGV,KAA8B;AAC1F,SACE,gBAAAW;AAAA,IAACL;AAAA,IAAA;AAAA,MACC,cAAW;AAAA,MACX,QAAQ;AAAA,MACR,WAAWJ,EAAGC,EAAO,MAAMJ,CAAS;AAAA,MACnC,GAAGC;AAAA,MAEJ,UAAA;AAAA,QAAA,gBAAAC,EAAC,QAAA,EAAK,WAAWE,EAAO,kBAAmB,UAAAO,GAAK;AAAA,QAChD,gBAAAT,EAACa,GAAA,EAAiB,WAAWX,EAAO,KAAA,CAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGhD;AAIO,SAASY,EAAmB,EAAE,WAAAhB,GAAW,GAAGC,KAAkC;AACnF,SACE,gBAAAW,EAAC,QAAA,EAAK,eAAY,QAAO,WAAWT,EAAGC,EAAO,UAAUJ,CAAS,GAAI,GAAGC,GACtE,UAAA;AAAA,IAAA,gBAAAC,EAACe,GAAA,EAAmB,WAAWb,EAAO,KAAA,CAAM;AAAA,IAC5C,gBAAAF,EAAC,QAAA,EAAK,WAAWE,EAAO,QAAQ,UAAA,aAAA,CAAU;AAAA,EAAA,GAC5C;AAEJ;"}
1
+ {"version":3,"file":"pagination.js","sources":["../src/components/pagination/pagination.tsx"],"sourcesContent":["import { Button as ButtonPrimitive } from '@base-ui/react/button';\nimport { cx } from 'class-variance-authority';\nimport { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from 'lucide-react';\nimport type { ComponentProps } from 'react';\n\nimport styles from './pagination.module.css';\n\n// The default label of each direction, as the name helpers below compare it.\n// The four parts write the same words as the literal default of their `text`\n// prop and not as these constants, on purpose: the contract compiler reads a\n// prop's default from a literal in the destructured parameter and drops it,\n// with a `cannot_extract` note, from one that goes through a constant (tried:\n// `text.default` vanished from four contracts, two of them already shipped).\n// pagination.test.tsx renders every part without `text` and asserts the\n// page-describing name, which is what fails if a literal and a constant part.\nconst PREVIOUS_TEXT = 'Previous';\nconst NEXT_TEXT = 'Next';\n\n// The visible content and the accessible name of the previous/next parts,\n// shared by the anchor and the button forms so the four cannot drift. The\n// chevrons carry `styles.chevron`: it is what mirrors them under a\n// right-to-left direction.\nfunction previousContent(text: string) {\n return (\n <>\n <ChevronLeftIcon className={cx(styles.icon, styles.chevron)} />\n <span className={styles.previousNextText}>{text}</span>\n </>\n );\n}\n\nfunction nextContent(text: string) {\n return (\n <>\n <span className={styles.previousNextText}>{text}</span>\n <ChevronRightIcon className={cx(styles.icon, styles.chevron)} />\n </>\n );\n}\n\n// The default text keeps the longer name that says which page it goes to. A\n// custom text IS the name: the label is hidden below 640px and the chevron is\n// decorative, so a fixed name would leave the words on screen out of it (and\n// out of a voice-control user's reach). An empty or blank text hides the label,\n// which is the icon-only form, so it keeps the default name rather than none (a\n// whitespace-only aria-label is ignored by the accessible name computation).\nfunction previousLabel(text: string) {\n return text.trim() && text !== PREVIOUS_TEXT ? text : 'Go to previous page';\n}\n\nfunction nextLabel(text: string) {\n return text.trim() && text !== NEXT_TEXT ? text : 'Go to next page';\n}\n\nexport type PaginationProps = ComponentProps<'nav'>;\n\nexport function Pagination({ className, ...props }: PaginationProps) {\n return (\n <nav\n role=\"navigation\"\n aria-label=\"pagination\"\n className={cx(styles.pagination, className)}\n {...props}\n />\n );\n}\n\nexport type PaginationContentProps = ComponentProps<'ul'>;\n\nexport function PaginationContent({ className, ...props }: PaginationContentProps) {\n return <ul className={cx(styles.content, className)} {...props} />;\n}\n\nexport type PaginationItemProps = ComponentProps<'li'>;\n\nexport function PaginationItem(props: PaginationItemProps) {\n return <li {...props} />;\n}\n\nexport interface PaginationLinkProps extends Omit<ComponentProps<'a'>, 'className'> {\n className?: string;\n isActive?: boolean;\n /**\n * Square, icon-sized footprint (aspect-ratio 1, no horizontal padding) —\n * the common case for a bare page number, matching upstream's\n * `size=\"icon\"` default. `PaginationPrevious`/`PaginationNext` opt out\n * (`square={false}`): they carry an icon AND a text label side by side,\n * so a fixed-width square would clip the label.\n * @default true\n */\n square?: boolean;\n}\n\nexport function PaginationLink({ className, isActive, square = true, ...props }: PaginationLinkProps) {\n return (\n <a\n aria-current={isActive ? 'page' : undefined}\n data-active={isActive || undefined}\n className={cx(styles.link, square && styles.square, className)}\n {...props}\n />\n );\n}\n\nexport interface PaginationPreviousProps extends Omit<PaginationLinkProps, 'square'> {\n /** Label text, hidden below the `sm` breakpoint (640px) — matching\n * upstream's `hidden sm:block`. Also the accessible name when given, since\n * the label is hidden at that width. @default 'Previous' */\n text?: string;\n}\n\nexport function PaginationPrevious({\n className,\n text = 'Previous',\n ...props\n}: PaginationPreviousProps) {\n return (\n <PaginationLink\n aria-label={previousLabel(text)}\n square={false}\n className={cx(styles.previous, className)}\n {...props}\n >\n {previousContent(text)}\n </PaginationLink>\n );\n}\n\nexport interface PaginationNextProps extends Omit<PaginationLinkProps, 'square'> {\n /** Also the accessible name when given. @default 'Next' */\n text?: string;\n}\n\nexport function PaginationNext({ className, text = 'Next', ...props }: PaginationNextProps) {\n return (\n <PaginationLink\n aria-label={nextLabel(text)}\n square={false}\n className={cx(styles.next, className)}\n {...props}\n >\n {nextContent(text)}\n </PaginationLink>\n );\n}\n\n/*\n * The button forms: the same items for state-driven paging, where a page\n * change is a state update and has no URL of its own. They are separate\n * parts rather than a `render`/`as` on the link because PaginationLink's\n * contract promises a real anchor (see pagination-link.contract.yaml); a\n * button part keeps that promise intact and shares every class with it, so\n * the two forms paint identically.\n */\nexport interface PaginationButtonProps extends Omit<ComponentProps<'button'>, 'className'> {\n className?: string;\n /** Marks the page in view: sets `aria-current=\"page\"` and the active\n * paint, same as PaginationLink's. */\n isActive?: boolean;\n /** Same square footprint as PaginationLink's. @default true */\n square?: boolean;\n /**\n * Keep the button in the tab order while `disabled`, reporting\n * `aria-disabled` instead of the native attribute. Without it a button that\n * holds keyboard focus when it becomes disabled (Previous, paged down to the\n * first page) is blurred by the browser and focus falls to the page. Same\n * name and meaning as Button's, which this renders through the same Base UI\n * primitive.\n * @default false\n */\n focusableWhenDisabled?: boolean;\n}\n\nexport function PaginationButton({\n className,\n isActive,\n square = true,\n type = 'button',\n ...props\n}: PaginationButtonProps) {\n return (\n <ButtonPrimitive\n type={type}\n aria-current={isActive ? 'page' : undefined}\n data-active={isActive || undefined}\n className={cx(styles.link, square && styles.square, className)}\n {...props}\n />\n );\n}\n\nexport interface PaginationPreviousButtonProps extends Omit<PaginationButtonProps, 'square' | 'isActive'> {\n /** Label text, hidden below the `sm` breakpoint (640px). Also the\n * accessible name when given. @default 'Previous' */\n text?: string;\n}\n\nexport function PaginationPreviousButton({\n text = 'Previous',\n ...props\n}: PaginationPreviousButtonProps) {\n return (\n <PaginationButton aria-label={previousLabel(text)} square={false} {...props}>\n {previousContent(text)}\n </PaginationButton>\n );\n}\n\nexport interface PaginationNextButtonProps extends Omit<PaginationButtonProps, 'square' | 'isActive'> {\n /** Also the accessible name when given. @default 'Next' */\n text?: string;\n}\n\nexport function PaginationNextButton({ text = 'Next', ...props }: PaginationNextButtonProps) {\n return (\n <PaginationButton aria-label={nextLabel(text)} square={false} {...props}>\n {nextContent(text)}\n </PaginationButton>\n );\n}\n\nexport type PaginationEllipsisProps = ComponentProps<'span'>;\n\nexport function PaginationEllipsis({ className, ...props }: PaginationEllipsisProps) {\n return (\n <span aria-hidden=\"true\" className={cx(styles.ellipsis, className)} {...props}>\n <MoreHorizontalIcon className={styles.icon} />\n <span className={styles.srOnly}>More pages</span>\n </span>\n );\n}\n"],"names":["PREVIOUS_TEXT","NEXT_TEXT","previousContent","text","jsxs","Fragment","jsx","ChevronLeftIcon","cx","styles","nextContent","ChevronRightIcon","previousLabel","nextLabel","Pagination","className","props","PaginationContent","PaginationItem","PaginationLink","isActive","square","PaginationPrevious","PaginationNext","PaginationButton","type","ButtonPrimitive","PaginationPreviousButton","PaginationNextButton","PaginationEllipsis","MoreHorizontalIcon"],"mappings":";;;;;;;;;;;;;;GAeMA,IAAgB,YAChBC,IAAY;AAMlB,SAASC,EAAgBC,GAAc;AACrC,SACE,gBAAAC,EAAA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ACkB,GAAA,EAAiB,cAAYZ,EAAcT,CAAI,GAAG,QAAQ,IAAQ,GAAGa,GACnE,UAAAd,EAAgBC,CAAI,EAAA,CACvB;AAEJ;AAOO,SAASyB,EAAqB,EAAE,MAAAzB,IAAO,QAAQ,GAAGa,KAAoC;AAC3F,SACE,gBAAAV,EAACkB,GAAA,EAAiB,cAAYX,EAAUV,CAAI,GAAG,QAAQ,IAAQ,GAAGa,GAC/D,UAAAN,EAAYP,CAAI,EAAA,CACnB;AAEJ;AAIO,SAAS0B,EAAmB,EAAE,WAAAd,GAAW,GAAGC,KAAkC;AACnF,SACE,gBAAAZ,EAAC,QAAA,EAAK,eAAY,QAAO,WAAWI,EAAGC,EAAO,UAAUM,CAAS,GAAI,GAAGC,GACtE,UAAA;AAAA,IAAA,gBAAAV,EAACwB,GAAA,EAAmB,WAAWrB,EAAO,KAAA,CAAM;AAAA,IAC5C,gBAAAH,EAAC,QAAA,EAAK,WAAWG,EAAO,QAAQ,UAAA,aAAA,CAAU;AAAA,EAAA,GAC5C;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar.js","sources":["../src/components/sidebar/use-mobile.ts","../src/components/sidebar/sidebar.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nconst MOBILE_BREAKPOINT = 768;\n\n/**\n * SSR-safe mobile-viewport detector, private to Sidebar (see sidebar.md's\n * \"not reproducible\" section — the port brief calls for this to live\n * inside the sidebar directory rather than a shared hooks tree).\n *\n * Starts `false` (assume desktop) rather than upstream's tri-state\n * `undefined`: Sidebar only ever asks \"is this collapsed to the mobile\n * Sheet or not\", a plain boolean either way, so there is no third state for\n * a caller to react to — collapsing it removes a render-time null check\n * every consumer of the hook would otherwise have to carry. The trade-off\n * is the one flash upstream's own `md:block hidden` CSS already exists to\n * paper over: a viewport narrower than `MOBILE_BREAKPOINT` briefly renders\n * the desktop layout for one frame until the effect below measures the\n * real width and flips it — see sidebar.module.css's `.root` media query,\n * which hides that frame the same way upstream's Tailwind classes do.\n */\nexport function useIsMobile(breakpoint: number = MOBILE_BREAKPOINT): boolean {\n const [isMobile, setIsMobile] = useState(false);\n\n useEffect(() => {\n const mediaQuery = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);\n const onChange = () => setIsMobile(window.innerWidth < breakpoint);\n mediaQuery.addEventListener('change', onChange);\n onChange();\n return () => mediaQuery.removeEventListener('change', onChange);\n }, [breakpoint]);\n\n return isMobile;\n}\n","// Load-bearing: SidebarProvider/Sidebar/SidebarMenuButton call useContext\n// (useSidebar) and useState/useEffect directly in their own render body,\n// same shape as DrawerContent's useDrawer() — see that file's own banner\n// comment. Coupled to CLIENT_COMPONENTS in scripts/verify-consumer.sh —\n// keep both in sync if this ever changes.\n'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { useRender } from '@base-ui/react/use-render';\nimport { cva, cx, type VariantProps } from 'class-variance-authority';\nimport { PanelLeftIcon } from 'lucide-react';\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useState,\n type ComponentProps,\n type CSSProperties,\n type Dispatch,\n type SetStateAction,\n} from 'react';\n\nimport { Button, type ButtonProps } from '../button/button.js';\nimport { Input, type InputProps } from '../input/input.js';\nimport { Separator, type SeparatorProps } from '../separator/separator.js';\nimport { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from '../sheet/sheet.js';\nimport { Skeleton } from '../skeleton/skeleton.js';\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n type TooltipContentProps,\n} from '../tooltip/tooltip.js';\nimport { useIsMobile } from './use-mobile.js';\nimport styles from './sidebar.module.css';\n\n/*\n * Upstream (apps/v4/registry/bases/base/ui/sidebar.tsx) has no Base UI\n * primitive of its own — it is the kit's own application-shell state\n * machine (open/collapsed, mobile-vs-desktop, three collapse modes) built\n * ENTIRELY on composed kit parts (Sheet for the mobile drawer, Button,\n * Input, Separator, Skeleton, Tooltip) plus Base UI's headless\n * `useRender`/`mergeProps` render-prop utilities for the parts upstream\n * itself makes polymorphic. See sidebar.md for the parts whose visual\n * design is this port's own (upstream routes them through a marker-class\n * layer the fetched registry file doesn't include).\n */\n\nconst SIDEBAR_COOKIE_NAME = 'sidebar_state';\nconst SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;\nconst SIDEBAR_WIDTH = '16rem';\nconst SIDEBAR_WIDTH_MOBILE = '18rem';\nconst SIDEBAR_WIDTH_ICON = '3rem';\nconst SIDEBAR_KEYBOARD_SHORTCUT = 'b';\n\nfunction readOpenCookie(defaultOpen: boolean): boolean {\n // SSR guard: this is a 'use client' component, but a framework can still\n // render it once on the server before hydration, where `document` does\n // not exist — same defensive shape as use-mobile.ts's effect-only window\n // reads, just at initializer time instead.\n if (typeof document === 'undefined') {\n return defaultOpen;\n }\n const match = document.cookie.match(new RegExp(`(?:^|; )${SIDEBAR_COOKIE_NAME}=([^;]*)`));\n return match ? match[1] === 'true' : defaultOpen;\n}\n\nfunction writeOpenCookie(open: boolean): void {\n if (typeof document === 'undefined') {\n return;\n }\n document.cookie = `${SIDEBAR_COOKIE_NAME}=${open}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;\n}\n\ninterface SidebarContextValue {\n state: 'expanded' | 'collapsed';\n open: boolean;\n setOpen: Dispatch<SetStateAction<boolean>>;\n openMobile: boolean;\n setOpenMobile: Dispatch<SetStateAction<boolean>>;\n isMobile: boolean;\n toggleSidebar: () => void;\n}\n\nconst SidebarContext = createContext<SidebarContextValue | null>(null);\n\n/**\n * Reads the nearest SidebarProvider's open/collapsed state and controls —\n * `SidebarTrigger`/`SidebarRail` are thin wrappers over `toggleSidebar`\n * from this same hook, so any custom trigger a consumer builds (e.g. a\n * command-palette action) uses the exact same call.\n *\n * @throws {Error} outside a `SidebarProvider` — matching upstream's own\n * contract; there is no sensible default state to fall back to (a bare\n * `Sidebar` still needs to know whether it's mobile, and asking the\n * question outside a Provider means no one is answering it).\n */\nexport function useSidebar(): SidebarContextValue {\n const context = useContext(SidebarContext);\n if (!context) {\n throw new Error('useSidebar must be used within a SidebarProvider.');\n }\n return context;\n}\n\nexport interface SidebarProviderProps extends Omit<ComponentProps<'div'>, 'className'> {\n className?: string;\n /**\n * Initial expanded/collapsed state for an uncontrolled Sidebar, and an\n * opt-OUT of the persisted cookie: pass it and it wins outright; omit it\n * and the last persisted state is restored instead (falling back to\n * expanded on a first visit).\n *\n * The distinction matters because the cookie is one global key for the\n * whole document. Without the opt-out, two Providers on one page — a\n * gallery, a split view, a docs page with several examples — would each\n * read the same key and move together, and `defaultOpen={false}` would\n * silently do nothing as soon as anything had ever toggled anything.\n */\n defaultOpen?: boolean;\n /** Controlled desktop open state — pass with `onOpenChange` to own it entirely. */\n open?: boolean;\n /**\n * Fires on every desktop expand/collapse (trigger click, rail click, the\n * Cmd/Ctrl+B shortcut) whether or not `open` is controlled — the cookie\n * write below always runs from here, not from a `useEffect` on `open`,\n * so an external state manager driving `open` still gets the persistence\n * for free by simply passing this through.\n */\n onOpenChange?: (open: boolean) => void;\n}\n\nexport function SidebarProvider({\n defaultOpen,\n open: openProp,\n onOpenChange,\n className,\n style,\n children,\n ...props\n}: SidebarProviderProps) {\n const isMobile = useIsMobile();\n const [openMobile, setOpenMobile] = useState(false);\n\n // Deterministic first render, cookie restored after mount. Reading\n // `document.cookie` in the state initializer instead would make the\n // first client render disagree with the server's (which has no cookie\n // to read and always produced the expanded default) — a hydration\n // mismatch on the one attribute the whole layout keys off,\n // `data-state`. Restoring in an effect keeps render pure and pays for\n // it with one frame of expanded sidebar before a persisted collapsed\n // state applies. An app that owns a server render and wants that frame\n // back reads the cookie there and hands the answer down as\n // `defaultOpen` — upstream's own model, and the opt-out this prop\n // already documents.\n const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen ?? true);\n const open = openProp ?? uncontrolledOpen;\n\n useEffect(() => {\n if (defaultOpen !== undefined) {\n return;\n }\n // Reading a browser-owned store that has no render-time equivalent is\n // the \"subscribe to an external system\" case effects exist for; the\n // lint rule's static heuristic can't tell it apart from derived state\n // (same call, same reasoning, as carousel.tsx's embla snapshot).\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setUncontrolledOpen(readOpenCookie(true));\n }, [defaultOpen]);\n\n const setOpen = useCallback<Dispatch<SetStateAction<boolean>>>(\n (value) => {\n const next = typeof value === 'function' ? value(open) : value;\n onOpenChange?.(next);\n setUncontrolledOpen(next);\n writeOpenCookie(next);\n },\n [open, onOpenChange],\n );\n\n const toggleSidebar = useCallback(() => {\n if (isMobile) {\n setOpenMobile((value) => !value);\n } else {\n setOpen((value) => !value);\n }\n }, [isMobile, setOpen]);\n\n // Cmd/Ctrl+B toggles the sidebar from anywhere in the document —\n // upstream's own shortcut, kept at the same key.\n useEffect(() => {\n function handleKeyDown(event: KeyboardEvent) {\n if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {\n event.preventDefault();\n toggleSidebar();\n }\n }\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [toggleSidebar]);\n\n const state: SidebarContextValue['state'] = open ? 'expanded' : 'collapsed';\n\n const contextValue = useMemo<SidebarContextValue>(\n () => ({ state, open, setOpen, openMobile, setOpenMobile, isMobile, toggleSidebar }),\n [state, open, setOpen, openMobile, isMobile, toggleSidebar],\n );\n\n return (\n <SidebarContext.Provider value={contextValue}>\n {/*\n * delayDuration={0} (upstream's own value) is what makes the icon\n * rail usable: collapsed to 48px the label IS the tooltip, so the\n * default hover delay would leave a nav with no readable names for\n * as long as it lasts. Nesting inside a consumer's own\n * TooltipProvider is fine — Base UI's Provider is scoped, so this\n * only retimes tooltips belonging to this sidebar.\n */}\n <TooltipProvider delay={0}>\n <div\n style={\n {\n '--sidebar-width': SIDEBAR_WIDTH,\n '--sidebar-width-icon': SIDEBAR_WIDTH_ICON,\n ...style,\n } as CSSProperties\n }\n className={cx(styles.wrapper, className)}\n {...props}\n >\n {children}\n </div>\n </TooltipProvider>\n </SidebarContext.Provider>\n );\n}\n\nexport interface SidebarProps extends Omit<ComponentProps<'div'>, 'className'> {\n className?: string;\n /** Which edge the sidebar is anchored to. @default 'left' */\n side?: 'left' | 'right';\n /**\n * `sidebar` sits flush against the edge; `floating` and `inset` add a\n * margin so it (and, for `inset`, the page content in `SidebarInset`)\n * read as a raised card instead. @default 'sidebar'\n */\n variant?: 'sidebar' | 'floating' | 'inset';\n /**\n * How the sidebar behaves when collapsed: `offcanvas` slides fully out\n * of view, `icon` shrinks to an icon-only rail, `none` disables\n * collapsing (and the mobile Sheet behavior) entirely — a fixed-width\n * panel at every viewport. @default 'offcanvas'\n */\n collapsible?: 'offcanvas' | 'icon' | 'none';\n}\n\nexport function Sidebar({\n side = 'left',\n variant = 'sidebar',\n collapsible = 'offcanvas',\n className,\n children,\n ...props\n}: SidebarProps) {\n const { isMobile, state, openMobile, setOpenMobile } = useSidebar();\n\n if (collapsible === 'none') {\n return (\n <div className={cx(styles.none, className)} {...props}>\n {children}\n </div>\n );\n }\n\n if (isMobile) {\n return (\n <Sheet open={openMobile} onOpenChange={setOpenMobile}>\n <SheetContent\n side={side}\n showCloseButton={false}\n className={cx(styles.mobileContent, className)}\n style={{ '--sidebar-width': SIDEBAR_WIDTH_MOBILE } as CSSProperties}\n {...props}\n >\n {/*\n * Required by SheetContent's underlying Dialog (an accessible\n * name is not optional there) but redundant for a sighted user —\n * \"Sidebar\" is the whole panel's own identity, not new\n * information. Visually hidden the same way CommandDialog hides\n * its own title/description (see command.tsx).\n */}\n <SheetHeader className={styles.srOnly}>\n <SheetTitle>Sidebar</SheetTitle>\n <SheetDescription>Displays the mobile sidebar.</SheetDescription>\n </SheetHeader>\n <div className={styles.mobileInner}>{children}</div>\n </SheetContent>\n </Sheet>\n );\n }\n\n return (\n <div\n className={styles.root}\n data-state={state}\n data-collapsible={state === 'collapsed' ? collapsible : ''}\n data-variant={variant}\n data-side={side}\n >\n <div className={styles.gap} />\n {/*\n * No cva here despite `variant` being a real prop: every visual\n * difference between sidebar/floating/inset is a `[data-variant='x']`\n * attribute selector in sidebar.module.css (the \"descendant/attribute\n * selectors keyed off data-state/data-collapsible\" translation of\n * upstream's group-data variants), not a swapped class — a cva call\n * whose every branch adds the same class would be dead ceremony.\n */}\n <div data-side={side} className={cx(styles.container, className)} {...props}>\n <div className={styles.inner}>{children}</div>\n </div>\n </div>\n );\n}\n\nexport interface SidebarTriggerProps extends Omit<ButtonProps, 'icon' | 'children'> {\n /** Accessible name for the icon-only button. @default 'Toggle Sidebar' */\n label?: string;\n}\n\nexport function SidebarTrigger({ className, onClick, label = 'Toggle Sidebar', ...props }: SidebarTriggerProps) {\n const { toggleSidebar } = useSidebar();\n return (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n className={className}\n icon={<PanelLeftIcon className={styles.triggerIcon} />}\n aria-label={label}\n onClick={(event) => {\n onClick?.(event);\n toggleSidebar();\n }}\n {...props}\n />\n );\n}\n\nexport type SidebarRailProps = Omit<ComponentProps<'button'>, 'children'>;\n\n/**\n * An invisible, wide hit-target hugging the sidebar's collapsed edge —\n * `SidebarTrigger`'s alternative for a resize-handle-shaped affordance.\n * Not in the tab order (`tabIndex={-1}`): a keyboard user already has\n * `SidebarTrigger` and the Cmd/Ctrl+B shortcut for the same action, and a\n * near-invisible full-height button in the tab order would be a confusing\n * stop with no visible focus target.\n */\nexport function SidebarRail({ className, onClick, ...props }: SidebarRailProps) {\n const { toggleSidebar } = useSidebar();\n return (\n <button\n type=\"button\"\n aria-label=\"Toggle Sidebar\"\n title=\"Toggle Sidebar\"\n tabIndex={-1}\n className={cx(styles.rail, className)}\n {...props}\n onClick={(event) => {\n onClick?.(event);\n toggleSidebar();\n }}\n />\n );\n}\n\nexport type SidebarInsetProps = ComponentProps<'main'>;\n\nexport function SidebarInset({ className, ...props }: SidebarInsetProps) {\n return <main className={cx(styles.inset, className)} {...props} />;\n}\n\nexport type SidebarInputProps = InputProps;\n\nexport function SidebarInput({ className, ...props }: SidebarInputProps) {\n return <Input className={cx(styles.input, className)} {...props} />;\n}\n\nexport type SidebarHeaderProps = ComponentProps<'div'>;\n\nexport function SidebarHeader({ className, ...props }: SidebarHeaderProps) {\n return <div className={cx(styles.header, className)} {...props} />;\n}\n\nexport type SidebarFooterProps = ComponentProps<'div'>;\n\nexport function SidebarFooter({ className, ...props }: SidebarFooterProps) {\n return <div className={cx(styles.footer, className)} {...props} />;\n}\n\nexport type SidebarSeparatorProps = SeparatorProps;\n\nexport function SidebarSeparator({ className, ...props }: SidebarSeparatorProps) {\n return <Separator className={cx(styles.separator, className)} {...props} />;\n}\n\nexport type SidebarContentProps = ComponentProps<'div'>;\n\nexport function SidebarContent({ className, ...props }: SidebarContentProps) {\n return <div className={cx(styles.content, className)} {...props} />;\n}\n\nexport type SidebarGroupProps = ComponentProps<'div'>;\n\nexport function SidebarGroup({ className, ...props }: SidebarGroupProps) {\n return <div className={cx(styles.group, className)} {...props} />;\n}\n\nexport type SidebarGroupLabelProps = useRender.ComponentProps<'div'>;\n\n/** Polymorphic via `render` (e.g. `render={<label htmlFor=\"...\" />}`) — same\n * `useRender`/`mergeProps` idiom as Badge (see badge.tsx). */\nexport function SidebarGroupLabel({ className, render, ...props }: SidebarGroupLabelProps) {\n return useRender({\n defaultTagName: 'div',\n render,\n props: mergeProps<'div'>({ className: cx(styles.groupLabel, className) }, props),\n });\n}\n\nexport type SidebarGroupActionProps = useRender.ComponentProps<'button'>;\n\nexport function SidebarGroupAction({ className, render, ...props }: SidebarGroupActionProps) {\n return useRender({\n defaultTagName: 'button',\n render,\n props: mergeProps<'button'>({ className: cx(styles.groupAction, className) }, props),\n });\n}\n\nexport type SidebarGroupContentProps = ComponentProps<'div'>;\n\nexport function SidebarGroupContent({ className, ...props }: SidebarGroupContentProps) {\n return <div className={cx(styles.groupContent, className)} {...props} />;\n}\n\nexport type SidebarMenuProps = ComponentProps<'ul'>;\n\nexport function SidebarMenu({ className, ...props }: SidebarMenuProps) {\n return <ul className={cx(styles.menu, className)} {...props} />;\n}\n\nexport type SidebarMenuItemProps = ComponentProps<'li'>;\n\nexport function SidebarMenuItem({ className, ...props }: SidebarMenuItemProps) {\n return <li className={cx(styles.menuItem, className)} {...props} />;\n}\n\nconst sidebarMenuButtonVariants = cva(styles.menuButton, {\n variants: {\n variant: {\n default: styles.variantDefault,\n outline: styles.variantOutline,\n },\n size: {\n default: styles.sizeDefault,\n sm: styles.sizeSm,\n lg: styles.sizeLg,\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n});\n\n/** A string renders as the tooltip's whole content; an object is forwarded\n * to `TooltipContent` as-is (so `side`/`align`/etc. can be overridden). */\nexport type SidebarMenuButtonTooltip = string | TooltipContentProps;\n\nexport interface SidebarMenuButtonProps\n extends useRender.ComponentProps<'button'>,\n VariantProps<typeof sidebarMenuButtonVariants> {\n /** Marks this as the current nav item — accent fill plus `data-active`. @default false */\n isActive?: boolean;\n /**\n * Shows a `Tooltip` with this content — but ONLY while the sidebar is\n * desktop-collapsed to its icon rail (`state === 'collapsed'` and not\n * mobile); expanded or on mobile, the label is already visible next to\n * the icon, so no tooltip is mounted at all. A stricter reproduction of\n * upstream's own intent than its literal mechanism: upstream always\n * mounts `TooltipContent` and toggles a `hidden` attribute on it, which\n * only suppresses paint if something declares `[hidden] { display: none\n * }` for that popup — this kit's own tooltip.module.css (an existing\n * component this port must not edit) declares no such rule, so `hidden`\n * alone would not actually hide it here. Conditionally mounting the\n * `Tooltip` wrapper achieves the same visible behavior without that gap.\n */\n tooltip?: SidebarMenuButtonTooltip;\n}\n\nexport function SidebarMenuButton({\n render,\n isActive = false,\n variant,\n size,\n tooltip,\n className,\n ...props\n}: SidebarMenuButtonProps) {\n const { isMobile, state: sidebarState } = useSidebar();\n const showTooltip = tooltip != null && sidebarState === 'collapsed' && !isMobile;\n\n const button = useRender({\n defaultTagName: 'button',\n render: showTooltip ? <TooltipTrigger render={render} /> : render,\n // `state`/`stateAttributesMapping` (not a plain `data-active` prop,\n // which mergeProps's HTML-attribute typing has no index signature for)\n // is Base UI's own mechanism for reflecting a boolean as a bare\n // `data-active` attribute (see getStateAttributesProps: `true` becomes\n // `''`, `false` is omitted entirely) — same utility item.tsx uses, just\n // NOT suppressed here: unlike Item's variant/size (fully expressed by\n // the CVA class already), `data-active` is the actual mechanism\n // sidebar.module.css's `.menuButton[data-active]` selector reads.\n state: { active: isActive },\n props: mergeProps<'button'>(\n { className: sidebarMenuButtonVariants({ variant, size, className }) },\n props,\n ),\n });\n\n if (!showTooltip) {\n return button;\n }\n\n const content: TooltipContentProps = typeof tooltip === 'string' ? { children: tooltip } : tooltip;\n\n return (\n <Tooltip>\n {button}\n <TooltipContent side=\"right\" align=\"center\" {...content} />\n </Tooltip>\n );\n}\n\nexport { sidebarMenuButtonVariants };\n\nexport interface SidebarMenuActionProps extends useRender.ComponentProps<'button'> {\n /** Only paint on hover/focus-within of the parent `SidebarMenuItem` (or\n * while `aria-expanded`) instead of always-visible. @default false */\n showOnHover?: boolean;\n}\n\nexport function SidebarMenuAction({ className, render, showOnHover = false, ...props }: SidebarMenuActionProps) {\n return useRender({\n defaultTagName: 'button',\n render,\n props: mergeProps<'button'>(\n { className: cx(styles.menuAction, showOnHover && styles.menuActionShowOnHover, className) },\n props,\n ),\n });\n}\n\nexport type SidebarMenuBadgeProps = ComponentProps<'div'>;\n\nexport function SidebarMenuBadge({ className, ...props }: SidebarMenuBadgeProps) {\n return <div className={cx(styles.menuBadge, className)} {...props} />;\n}\n\nexport interface SidebarMenuSkeletonProps extends ComponentProps<'div'> {\n /** Renders a leading icon-shaped placeholder alongside the text one. @default false */\n showIcon?: boolean;\n}\n\n// Spreads a string over the 50-89% width band the skeleton rows vary\n// across. FNV-1a: a few lines, no dependency, and well-enough distributed\n// that neighbouring `useId` values (which differ by one character) land on\n// visibly different widths instead of a near-repeat.\nfunction widthFromKey(key: string): number {\n let hash = 0x811c9dc5;\n for (let index = 0; index < key.length; index += 1) {\n hash ^= key.charCodeAt(index);\n hash = Math.imul(hash, 0x01000193);\n }\n return 50 + (Math.abs(hash) % 40);\n}\n\nexport function SidebarMenuSkeleton({ className, showIcon = false, style, ...props }: SidebarMenuSkeletonProps) {\n // Upstream rolls this width with `Math.random()` in a lazy state\n // initializer. That varies the rows (the point — a column of identical\n // bars reads as one repeated tile, not as loading content) but renders\n // a different number on the server than on the client, so the width\n // lands in the hydration diff. `useId` is the deterministic source of\n // the same per-row variety: React guarantees the same value for the\n // same position in the tree on both sides of hydration, and it differs\n // between sibling rows, which is all the width needs from it.\n const width = `${widthFromKey(useId())}%`;\n return (\n <div className={cx(styles.menuSkeleton, className)} style={style} {...props}>\n {showIcon && <Skeleton className={styles.menuSkeletonIcon} />}\n <Skeleton\n className={styles.menuSkeletonText}\n style={{ '--skeleton-width': width } as CSSProperties}\n />\n </div>\n );\n}\n\nexport type SidebarMenuSubProps = ComponentProps<'ul'>;\n\nexport function SidebarMenuSub({ className, ...props }: SidebarMenuSubProps) {\n return <ul className={cx(styles.menuSub, className)} {...props} />;\n}\n\nexport type SidebarMenuSubItemProps = ComponentProps<'li'>;\n\nexport function SidebarMenuSubItem({ className, ...props }: SidebarMenuSubItemProps) {\n return <li className={cx(styles.menuSubItem, className)} {...props} />;\n}\n\nconst sidebarMenuSubButtonVariants = cva(styles.menuSubButton, {\n variants: {\n size: {\n sm: styles.subSizeSm,\n md: styles.subSizeMd,\n },\n },\n defaultVariants: {\n size: 'md',\n },\n});\n\nexport interface SidebarMenuSubButtonProps\n extends useRender.ComponentProps<'a'>,\n VariantProps<typeof sidebarMenuSubButtonVariants> {\n isActive?: boolean;\n}\n\nexport function SidebarMenuSubButton({\n render,\n size,\n isActive = false,\n className,\n ...props\n}: SidebarMenuSubButtonProps) {\n return useRender({\n defaultTagName: 'a',\n render,\n // See SidebarMenuButton's identical comment on this same mechanism.\n state: { active: isActive },\n props: mergeProps<'a'>(\n { className: sidebarMenuSubButtonVariants({ size, className }) },\n props,\n ),\n });\n}\n"],"names":["MOBILE_BREAKPOINT","useIsMobile","breakpoint","isMobile","setIsMobile","useState","useEffect","mediaQuery","onChange","SIDEBAR_COOKIE_NAME","SIDEBAR_COOKIE_MAX_AGE","SIDEBAR_WIDTH","SIDEBAR_WIDTH_MOBILE","SIDEBAR_WIDTH_ICON","SIDEBAR_KEYBOARD_SHORTCUT","readOpenCookie","defaultOpen","match","writeOpenCookie","open","SidebarContext","createContext","useSidebar","context","useContext","SidebarProvider","openProp","onOpenChange","className","style","children","props","openMobile","setOpenMobile","uncontrolledOpen","setUncontrolledOpen","setOpen","useCallback","value","next","toggleSidebar","handleKeyDown","event","state","contextValue","useMemo","jsx","TooltipProvider","cx","styles","Sidebar","side","variant","collapsible","Sheet","jsxs","SheetContent","SheetHeader","SheetTitle","SheetDescription","SidebarTrigger","onClick","label","Button","PanelLeftIcon","SidebarRail","SidebarInset","SidebarInput","Input","SidebarHeader","SidebarFooter","SidebarSeparator","Separator","SidebarContent","SidebarGroup","SidebarGroupLabel","render","useRender","mergeProps","SidebarGroupAction","SidebarGroupContent","SidebarMenu","SidebarMenuItem","sidebarMenuButtonVariants","cva","SidebarMenuButton","isActive","size","tooltip","sidebarState","showTooltip","button","TooltipTrigger","Tooltip","TooltipContent","SidebarMenuAction","showOnHover","SidebarMenuBadge","widthFromKey","key","hash","index","SidebarMenuSkeleton","showIcon","width","useId","Skeleton","SidebarMenuSub","SidebarMenuSubItem","sidebarMenuSubButtonVariants","SidebarMenuSubButton"],"mappings":";;;;;;;;;;;;;AAIA,MAAMA,IAAoB;AAkBnB,SAASC,EAAYC,IAAqBF,GAA4B;AAC3E,QAAM,CAACG,GAAUC,CAAW,IAAIC,EAAS,EAAK;AAE9C,SAAAC,EAAU,MAAM;AACd,UAAMC,IAAa,OAAO,WAAW,eAAeL,IAAa,CAAC,KAAK,GACjEM,IAAW,MAAMJ,EAAY,OAAO,aAAaF,CAAU;AACjE,WAAAK,EAAW,iBAAiB,UAAUC,CAAQ,GAC9CA,EAAA,GACO,MAAMD,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AAW,EAAA;AAAA,MAC7DG;AAAA,IAAA;AAAA,EACF,CACD;AACH;"}
1
+ {"version":3,"file":"sidebar.js","sources":["../src/components/sidebar/use-mobile.ts","../src/components/sidebar/sidebar.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nconst MOBILE_BREAKPOINT = 768;\n\n/**\n * SSR-safe mobile-viewport detector, private to Sidebar (see sidebar.md's\n * \"not reproducible\" section — the port brief calls for this to live\n * inside the sidebar directory rather than a shared hooks tree).\n *\n * Starts `false` (assume desktop) rather than upstream's tri-state\n * `undefined`: Sidebar only ever asks \"is this collapsed to the mobile\n * Sheet or not\", a plain boolean either way, so there is no third state for\n * a caller to react to — collapsing it removes a render-time null check\n * every consumer of the hook would otherwise have to carry. The trade-off\n * is the one flash upstream's own `md:block hidden` CSS already exists to\n * paper over: a viewport narrower than `MOBILE_BREAKPOINT` briefly renders\n * the desktop layout for one frame until the effect below measures the\n * real width and flips it — see sidebar.module.css's `.root` media query,\n * which hides that frame the same way upstream's Tailwind classes do.\n */\nexport function useIsMobile(breakpoint: number = MOBILE_BREAKPOINT): boolean {\n const [isMobile, setIsMobile] = useState(false);\n\n useEffect(() => {\n const mediaQuery = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);\n const onChange = () => setIsMobile(window.innerWidth < breakpoint);\n mediaQuery.addEventListener('change', onChange);\n onChange();\n return () => mediaQuery.removeEventListener('change', onChange);\n }, [breakpoint]);\n\n return isMobile;\n}\n","// Load-bearing: SidebarProvider/Sidebar/SidebarMenuButton call useContext\n// (useSidebar) and useState/useEffect directly in their own render body,\n// same shape as DrawerContent's useDrawer() — see that file's own banner\n// comment. Coupled to CLIENT_COMPONENTS in scripts/verify-consumer.sh —\n// keep both in sync if this ever changes.\n'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { useRender } from '@base-ui/react/use-render';\nimport { cva, cx, type VariantProps } from 'class-variance-authority';\nimport { PanelLeftIcon } from 'lucide-react';\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useState,\n type ComponentProps,\n type CSSProperties,\n type Dispatch,\n type SetStateAction,\n} from 'react';\n\nimport { Button, type ButtonProps } from '../button/button.js';\nimport { Input, type InputProps } from '../input/input.js';\nimport { Separator, type SeparatorProps } from '../separator/separator.js';\nimport { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from '../sheet/sheet.js';\nimport { Skeleton } from '../skeleton/skeleton.js';\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n type TooltipContentProps,\n} from '../tooltip/tooltip.js';\nimport { useIsMobile } from './use-mobile.js';\nimport styles from './sidebar.module.css';\n\n/*\n * Upstream (apps/v4/registry/bases/base/ui/sidebar.tsx) has no Base UI\n * primitive of its own — it is the kit's own application-shell state\n * machine (open/collapsed, mobile-vs-desktop, three collapse modes) built\n * ENTIRELY on composed kit parts (Sheet for the mobile drawer, Button,\n * Input, Separator, Skeleton, Tooltip) plus Base UI's headless\n * `useRender`/`mergeProps` render-prop utilities for the parts upstream\n * itself makes polymorphic. See sidebar.md for the parts whose visual\n * design is this port's own (upstream routes them through a marker-class\n * layer the fetched registry file doesn't include).\n */\n\nconst SIDEBAR_COOKIE_NAME = 'sidebar_state';\nconst SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;\nconst SIDEBAR_WIDTH = '16rem';\nconst SIDEBAR_WIDTH_MOBILE = '18rem';\nconst SIDEBAR_WIDTH_ICON = '3rem';\nconst SIDEBAR_KEYBOARD_SHORTCUT = 'b';\n\nfunction readOpenCookie(defaultOpen: boolean): boolean {\n // SSR guard: this is a 'use client' component, but a framework can still\n // render it once on the server before hydration, where `document` does\n // not exist — same defensive shape as use-mobile.ts's effect-only window\n // reads, just at initializer time instead.\n if (typeof document === 'undefined') {\n return defaultOpen;\n }\n const match = document.cookie.match(new RegExp(`(?:^|; )${SIDEBAR_COOKIE_NAME}=([^;]*)`));\n return match ? match[1] === 'true' : defaultOpen;\n}\n\nfunction writeOpenCookie(open: boolean): void {\n if (typeof document === 'undefined') {\n return;\n }\n document.cookie = `${SIDEBAR_COOKIE_NAME}=${open}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;\n}\n\ninterface SidebarContextValue {\n state: 'expanded' | 'collapsed';\n open: boolean;\n setOpen: Dispatch<SetStateAction<boolean>>;\n openMobile: boolean;\n setOpenMobile: Dispatch<SetStateAction<boolean>>;\n isMobile: boolean;\n toggleSidebar: () => void;\n}\n\nconst SidebarContext = createContext<SidebarContextValue | null>(null);\n\n/**\n * Reads the nearest SidebarProvider's open/collapsed state and controls —\n * `SidebarTrigger`/`SidebarRail` are thin wrappers over `toggleSidebar`\n * from this same hook, so any custom trigger a consumer builds (e.g. a\n * command-palette action) uses the exact same call.\n *\n * @throws {Error} outside a `SidebarProvider` — matching upstream's own\n * contract; there is no sensible default state to fall back to (a bare\n * `Sidebar` still needs to know whether it's mobile, and asking the\n * question outside a Provider means no one is answering it).\n */\nexport function useSidebar(): SidebarContextValue {\n const context = useContext(SidebarContext);\n if (!context) {\n throw new Error('useSidebar must be used within a SidebarProvider.');\n }\n return context;\n}\n\nexport interface SidebarProviderProps extends Omit<ComponentProps<'div'>, 'className'> {\n className?: string;\n /**\n * Initial expanded/collapsed state for an uncontrolled Sidebar, and an\n * opt-OUT of the persisted cookie: pass it and it wins outright; omit it\n * and the last persisted state is restored instead (falling back to\n * expanded on a first visit).\n *\n * The distinction matters because the cookie is one global key for the\n * whole document. Without the opt-out, two Providers on one page — a\n * gallery, a split view, a docs page with several examples — would each\n * read the same key and move together, and `defaultOpen={false}` would\n * silently do nothing as soon as anything had ever toggled anything.\n */\n defaultOpen?: boolean;\n /** Controlled desktop open state — pass with `onOpenChange` to own it entirely. */\n open?: boolean;\n /**\n * Fires on every desktop expand/collapse (trigger click, rail click, the\n * Cmd/Ctrl+B shortcut) whether or not `open` is controlled — the cookie\n * write below always runs from here, not from a `useEffect` on `open`,\n * so an external state manager driving `open` still gets the persistence\n * for free by simply passing this through.\n */\n onOpenChange?: (open: boolean) => void;\n}\n\nexport function SidebarProvider({\n defaultOpen,\n open: openProp,\n onOpenChange,\n className,\n style,\n children,\n ...props\n}: SidebarProviderProps) {\n const isMobile = useIsMobile();\n const [openMobile, setOpenMobile] = useState(false);\n\n // Deterministic first render, cookie restored after mount. Reading\n // `document.cookie` in the state initializer instead would make the\n // first client render disagree with the server's (which has no cookie\n // to read and always produced the expanded default) — a hydration\n // mismatch on the one attribute the whole layout keys off,\n // `data-state`. Restoring in an effect keeps render pure and pays for\n // it with one frame of expanded sidebar before a persisted collapsed\n // state applies. An app that owns a server render and wants that frame\n // back reads the cookie there and hands the answer down as\n // `defaultOpen` — upstream's own model, and the opt-out this prop\n // already documents.\n const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen ?? true);\n const open = openProp ?? uncontrolledOpen;\n\n useEffect(() => {\n if (defaultOpen !== undefined) {\n return;\n }\n // Reading a browser-owned store that has no render-time equivalent is\n // the \"subscribe to an external system\" case effects exist for; the\n // lint rule's static heuristic can't tell it apart from derived state\n // (same call, same reasoning, as carousel.tsx's embla snapshot).\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setUncontrolledOpen(readOpenCookie(true));\n }, [defaultOpen]);\n\n const setOpen = useCallback<Dispatch<SetStateAction<boolean>>>(\n (value) => {\n const next = typeof value === 'function' ? value(open) : value;\n onOpenChange?.(next);\n setUncontrolledOpen(next);\n writeOpenCookie(next);\n },\n [open, onOpenChange],\n );\n\n const toggleSidebar = useCallback(() => {\n if (isMobile) {\n setOpenMobile((value) => !value);\n } else {\n setOpen((value) => !value);\n }\n }, [isMobile, setOpen]);\n\n // Cmd/Ctrl+B toggles the sidebar from anywhere in the document —\n // upstream's own shortcut, kept at the same key.\n useEffect(() => {\n function handleKeyDown(event: KeyboardEvent) {\n if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {\n event.preventDefault();\n toggleSidebar();\n }\n }\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [toggleSidebar]);\n\n const state: SidebarContextValue['state'] = open ? 'expanded' : 'collapsed';\n\n const contextValue = useMemo<SidebarContextValue>(\n () => ({ state, open, setOpen, openMobile, setOpenMobile, isMobile, toggleSidebar }),\n [state, open, setOpen, openMobile, isMobile, toggleSidebar],\n );\n\n return (\n <SidebarContext.Provider value={contextValue}>\n {/*\n * delayDuration={0} (upstream's own value) is what makes the icon\n * rail usable: collapsed to 48px the label IS the tooltip, so the\n * default hover delay would leave a nav with no readable names for\n * as long as it lasts. Nesting inside a consumer's own\n * TooltipProvider is fine — Base UI's Provider is scoped, so this\n * only retimes tooltips belonging to this sidebar.\n */}\n <TooltipProvider delay={0}>\n <div\n style={\n {\n '--sidebar-width': SIDEBAR_WIDTH,\n '--sidebar-width-icon': SIDEBAR_WIDTH_ICON,\n ...style,\n } as CSSProperties\n }\n className={cx(styles.wrapper, className)}\n {...props}\n >\n {children}\n </div>\n </TooltipProvider>\n </SidebarContext.Provider>\n );\n}\n\nexport interface SidebarProps extends Omit<ComponentProps<'div'>, 'className'> {\n className?: string;\n /** Which edge the sidebar is anchored to. @default 'left' */\n side?: 'left' | 'right';\n /**\n * `sidebar` sits flush against the edge; `floating` and `inset` add a\n * margin so it (and, for `inset`, the page content in `SidebarInset`)\n * read as a raised card instead. @default 'sidebar'\n */\n variant?: 'sidebar' | 'floating' | 'inset';\n /**\n * How the sidebar behaves when collapsed: `offcanvas` slides fully out\n * of view, `icon` shrinks to an icon-only rail, `none` disables\n * collapsing (and the mobile Sheet behavior) entirely — a fixed-width\n * panel at every viewport. @default 'offcanvas'\n */\n collapsible?: 'offcanvas' | 'icon' | 'none';\n}\n\nexport function Sidebar({\n side = 'left',\n variant = 'sidebar',\n collapsible = 'offcanvas',\n className,\n children,\n ...props\n}: SidebarProps) {\n const { isMobile, state, openMobile, setOpenMobile } = useSidebar();\n\n if (collapsible === 'none') {\n return (\n <div className={cx(styles.none, className)} {...props}>\n {children}\n </div>\n );\n }\n\n if (isMobile) {\n return (\n <Sheet open={openMobile} onOpenChange={setOpenMobile}>\n <SheetContent\n side={side}\n showCloseButton={false}\n className={cx(styles.mobileContent, className)}\n style={{ '--sidebar-width': SIDEBAR_WIDTH_MOBILE } as CSSProperties}\n {...props}\n >\n {/*\n * Required by SheetContent's underlying Dialog (an accessible\n * name is not optional there) but redundant for a sighted user —\n * \"Sidebar\" is the whole panel's own identity, not new\n * information. Visually hidden the same way CommandDialog hides\n * its own title/description (see command.tsx).\n */}\n <SheetHeader className={styles.srOnly}>\n <SheetTitle>Sidebar</SheetTitle>\n <SheetDescription>Displays the mobile sidebar.</SheetDescription>\n </SheetHeader>\n <div className={styles.mobileInner}>{children}</div>\n </SheetContent>\n </Sheet>\n );\n }\n\n return (\n <div\n className={styles.root}\n data-state={state}\n data-collapsible={state === 'collapsed' ? collapsible : ''}\n data-variant={variant}\n data-side={side}\n >\n <div className={styles.gap} />\n {/*\n * No cva here despite `variant` being a real prop: every visual\n * difference between sidebar/floating/inset is a `[data-variant='x']`\n * attribute selector in sidebar.module.css (the \"descendant/attribute\n * selectors keyed off data-state/data-collapsible\" translation of\n * upstream's group-data variants), not a swapped class — a cva call\n * whose every branch adds the same class would be dead ceremony.\n */}\n <div data-side={side} className={cx(styles.container, className)} {...props}>\n <div className={styles.inner}>{children}</div>\n </div>\n </div>\n );\n}\n\nexport interface SidebarTriggerProps extends Omit<ButtonProps, 'icon' | 'end' | 'children'> {\n /** Accessible name for the icon-only button. @default 'Toggle Sidebar' */\n label?: string;\n}\n\nexport function SidebarTrigger({ className, onClick, label = 'Toggle Sidebar', ...props }: SidebarTriggerProps) {\n const { toggleSidebar } = useSidebar();\n return (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n className={className}\n icon={<PanelLeftIcon className={styles.triggerIcon} />}\n aria-label={label}\n onClick={(event) => {\n onClick?.(event);\n toggleSidebar();\n }}\n {...props}\n />\n );\n}\n\nexport type SidebarRailProps = Omit<ComponentProps<'button'>, 'children'>;\n\n/**\n * An invisible, wide hit-target hugging the sidebar's collapsed edge —\n * `SidebarTrigger`'s alternative for a resize-handle-shaped affordance.\n * Not in the tab order (`tabIndex={-1}`): a keyboard user already has\n * `SidebarTrigger` and the Cmd/Ctrl+B shortcut for the same action, and a\n * near-invisible full-height button in the tab order would be a confusing\n * stop with no visible focus target.\n */\nexport function SidebarRail({ className, onClick, ...props }: SidebarRailProps) {\n const { toggleSidebar } = useSidebar();\n return (\n <button\n type=\"button\"\n aria-label=\"Toggle Sidebar\"\n title=\"Toggle Sidebar\"\n tabIndex={-1}\n className={cx(styles.rail, className)}\n {...props}\n onClick={(event) => {\n onClick?.(event);\n toggleSidebar();\n }}\n />\n );\n}\n\nexport type SidebarInsetProps = ComponentProps<'main'>;\n\nexport function SidebarInset({ className, ...props }: SidebarInsetProps) {\n return <main className={cx(styles.inset, className)} {...props} />;\n}\n\nexport type SidebarInputProps = InputProps;\n\nexport function SidebarInput({ className, ...props }: SidebarInputProps) {\n return <Input className={cx(styles.input, className)} {...props} />;\n}\n\nexport type SidebarHeaderProps = ComponentProps<'div'>;\n\nexport function SidebarHeader({ className, ...props }: SidebarHeaderProps) {\n return <div className={cx(styles.header, className)} {...props} />;\n}\n\nexport type SidebarFooterProps = ComponentProps<'div'>;\n\nexport function SidebarFooter({ className, ...props }: SidebarFooterProps) {\n return <div className={cx(styles.footer, className)} {...props} />;\n}\n\nexport type SidebarSeparatorProps = SeparatorProps;\n\nexport function SidebarSeparator({ className, ...props }: SidebarSeparatorProps) {\n return <Separator className={cx(styles.separator, className)} {...props} />;\n}\n\nexport type SidebarContentProps = ComponentProps<'div'>;\n\nexport function SidebarContent({ className, ...props }: SidebarContentProps) {\n return <div className={cx(styles.content, className)} {...props} />;\n}\n\nexport type SidebarGroupProps = ComponentProps<'div'>;\n\nexport function SidebarGroup({ className, ...props }: SidebarGroupProps) {\n return <div className={cx(styles.group, className)} {...props} />;\n}\n\nexport type SidebarGroupLabelProps = useRender.ComponentProps<'div'>;\n\n/** Polymorphic via `render` (e.g. `render={<label htmlFor=\"...\" />}`) — same\n * `useRender`/`mergeProps` idiom as Badge (see badge.tsx). */\nexport function SidebarGroupLabel({ className, render, ...props }: SidebarGroupLabelProps) {\n return useRender({\n defaultTagName: 'div',\n render,\n props: mergeProps<'div'>({ className: cx(styles.groupLabel, className) }, props),\n });\n}\n\nexport type SidebarGroupActionProps = useRender.ComponentProps<'button'>;\n\nexport function SidebarGroupAction({ className, render, ...props }: SidebarGroupActionProps) {\n return useRender({\n defaultTagName: 'button',\n render,\n props: mergeProps<'button'>({ className: cx(styles.groupAction, className) }, props),\n });\n}\n\nexport type SidebarGroupContentProps = ComponentProps<'div'>;\n\nexport function SidebarGroupContent({ className, ...props }: SidebarGroupContentProps) {\n return <div className={cx(styles.groupContent, className)} {...props} />;\n}\n\nexport type SidebarMenuProps = ComponentProps<'ul'>;\n\nexport function SidebarMenu({ className, ...props }: SidebarMenuProps) {\n return <ul className={cx(styles.menu, className)} {...props} />;\n}\n\nexport type SidebarMenuItemProps = ComponentProps<'li'>;\n\nexport function SidebarMenuItem({ className, ...props }: SidebarMenuItemProps) {\n return <li className={cx(styles.menuItem, className)} {...props} />;\n}\n\nconst sidebarMenuButtonVariants = cva(styles.menuButton, {\n variants: {\n variant: {\n default: styles.variantDefault,\n outline: styles.variantOutline,\n },\n size: {\n default: styles.sizeDefault,\n sm: styles.sizeSm,\n lg: styles.sizeLg,\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n});\n\n/** A string renders as the tooltip's whole content; an object is forwarded\n * to `TooltipContent` as-is (so `side`/`align`/etc. can be overridden). */\nexport type SidebarMenuButtonTooltip = string | TooltipContentProps;\n\nexport interface SidebarMenuButtonProps\n extends useRender.ComponentProps<'button'>,\n VariantProps<typeof sidebarMenuButtonVariants> {\n /** Marks this as the current nav item — accent fill plus `data-active`. @default false */\n isActive?: boolean;\n /**\n * Shows a `Tooltip` with this content — but ONLY while the sidebar is\n * desktop-collapsed to its icon rail (`state === 'collapsed'` and not\n * mobile); expanded or on mobile, the label is already visible next to\n * the icon, so no tooltip is mounted at all. A stricter reproduction of\n * upstream's own intent than its literal mechanism: upstream always\n * mounts `TooltipContent` and toggles a `hidden` attribute on it, which\n * only suppresses paint if something declares `[hidden] { display: none\n * }` for that popup — this kit's own tooltip.module.css (an existing\n * component this port must not edit) declares no such rule, so `hidden`\n * alone would not actually hide it here. Conditionally mounting the\n * `Tooltip` wrapper achieves the same visible behavior without that gap.\n */\n tooltip?: SidebarMenuButtonTooltip;\n}\n\nexport function SidebarMenuButton({\n render,\n isActive = false,\n variant,\n size,\n tooltip,\n className,\n ...props\n}: SidebarMenuButtonProps) {\n const { isMobile, state: sidebarState } = useSidebar();\n const showTooltip = tooltip != null && sidebarState === 'collapsed' && !isMobile;\n\n const button = useRender({\n defaultTagName: 'button',\n render: showTooltip ? <TooltipTrigger render={render} /> : render,\n // `state`/`stateAttributesMapping` (not a plain `data-active` prop,\n // which mergeProps's HTML-attribute typing has no index signature for)\n // is Base UI's own mechanism for reflecting a boolean as a bare\n // `data-active` attribute (see getStateAttributesProps: `true` becomes\n // `''`, `false` is omitted entirely) — same utility item.tsx uses, just\n // NOT suppressed here: unlike Item's variant/size (fully expressed by\n // the CVA class already), `data-active` is the actual mechanism\n // sidebar.module.css's `.menuButton[data-active]` selector reads.\n state: { active: isActive },\n props: mergeProps<'button'>(\n { className: sidebarMenuButtonVariants({ variant, size, className }) },\n props,\n ),\n });\n\n if (!showTooltip) {\n return button;\n }\n\n const content: TooltipContentProps = typeof tooltip === 'string' ? { children: tooltip } : tooltip;\n\n return (\n <Tooltip>\n {button}\n <TooltipContent side=\"right\" align=\"center\" {...content} />\n </Tooltip>\n );\n}\n\nexport { sidebarMenuButtonVariants };\n\nexport interface SidebarMenuActionProps extends useRender.ComponentProps<'button'> {\n /** Only paint on hover/focus-within of the parent `SidebarMenuItem` (or\n * while `aria-expanded`) instead of always-visible. @default false */\n showOnHover?: boolean;\n}\n\nexport function SidebarMenuAction({ className, render, showOnHover = false, ...props }: SidebarMenuActionProps) {\n return useRender({\n defaultTagName: 'button',\n render,\n props: mergeProps<'button'>(\n { className: cx(styles.menuAction, showOnHover && styles.menuActionShowOnHover, className) },\n props,\n ),\n });\n}\n\nexport type SidebarMenuBadgeProps = ComponentProps<'div'>;\n\nexport function SidebarMenuBadge({ className, ...props }: SidebarMenuBadgeProps) {\n return <div className={cx(styles.menuBadge, className)} {...props} />;\n}\n\nexport interface SidebarMenuSkeletonProps extends ComponentProps<'div'> {\n /** Renders a leading icon-shaped placeholder alongside the text one. @default false */\n showIcon?: boolean;\n}\n\n// Spreads a string over the 50-89% width band the skeleton rows vary\n// across. FNV-1a: a few lines, no dependency, and well-enough distributed\n// that neighbouring `useId` values (which differ by one character) land on\n// visibly different widths instead of a near-repeat.\nfunction widthFromKey(key: string): number {\n let hash = 0x811c9dc5;\n for (let index = 0; index < key.length; index += 1) {\n hash ^= key.charCodeAt(index);\n hash = Math.imul(hash, 0x01000193);\n }\n return 50 + (Math.abs(hash) % 40);\n}\n\nexport function SidebarMenuSkeleton({ className, showIcon = false, style, ...props }: SidebarMenuSkeletonProps) {\n // Upstream rolls this width with `Math.random()` in a lazy state\n // initializer. That varies the rows (the point — a column of identical\n // bars reads as one repeated tile, not as loading content) but renders\n // a different number on the server than on the client, so the width\n // lands in the hydration diff. `useId` is the deterministic source of\n // the same per-row variety: React guarantees the same value for the\n // same position in the tree on both sides of hydration, and it differs\n // between sibling rows, which is all the width needs from it.\n const width = `${widthFromKey(useId())}%`;\n return (\n <div className={cx(styles.menuSkeleton, className)} style={style} {...props}>\n {showIcon && <Skeleton className={styles.menuSkeletonIcon} />}\n <Skeleton\n className={styles.menuSkeletonText}\n style={{ '--skeleton-width': width } as CSSProperties}\n />\n </div>\n );\n}\n\nexport type SidebarMenuSubProps = ComponentProps<'ul'>;\n\nexport function SidebarMenuSub({ className, ...props }: SidebarMenuSubProps) {\n return <ul className={cx(styles.menuSub, className)} {...props} />;\n}\n\nexport type SidebarMenuSubItemProps = ComponentProps<'li'>;\n\nexport function SidebarMenuSubItem({ className, ...props }: SidebarMenuSubItemProps) {\n return <li className={cx(styles.menuSubItem, className)} {...props} />;\n}\n\nconst sidebarMenuSubButtonVariants = cva(styles.menuSubButton, {\n variants: {\n size: {\n sm: styles.subSizeSm,\n md: styles.subSizeMd,\n },\n },\n defaultVariants: {\n size: 'md',\n },\n});\n\nexport interface SidebarMenuSubButtonProps\n extends useRender.ComponentProps<'a'>,\n VariantProps<typeof sidebarMenuSubButtonVariants> {\n isActive?: boolean;\n}\n\nexport function SidebarMenuSubButton({\n render,\n size,\n isActive = false,\n className,\n ...props\n}: SidebarMenuSubButtonProps) {\n return useRender({\n defaultTagName: 'a',\n render,\n // See SidebarMenuButton's identical comment on this same mechanism.\n state: { active: isActive },\n props: mergeProps<'a'>(\n { className: sidebarMenuSubButtonVariants({ size, className }) },\n props,\n ),\n });\n}\n"],"names":["MOBILE_BREAKPOINT","useIsMobile","breakpoint","isMobile","setIsMobile","useState","useEffect","mediaQuery","onChange","SIDEBAR_COOKIE_NAME","SIDEBAR_COOKIE_MAX_AGE","SIDEBAR_WIDTH","SIDEBAR_WIDTH_MOBILE","SIDEBAR_WIDTH_ICON","SIDEBAR_KEYBOARD_SHORTCUT","readOpenCookie","defaultOpen","match","writeOpenCookie","open","SidebarContext","createContext","useSidebar","context","useContext","SidebarProvider","openProp","onOpenChange","className","style","children","props","openMobile","setOpenMobile","uncontrolledOpen","setUncontrolledOpen","setOpen","useCallback","value","next","toggleSidebar","handleKeyDown","event","state","contextValue","useMemo","jsx","TooltipProvider","cx","styles","Sidebar","side","variant","collapsible","Sheet","jsxs","SheetContent","SheetHeader","SheetTitle","SheetDescription","SidebarTrigger","onClick","label","Button","PanelLeftIcon","SidebarRail","SidebarInset","SidebarInput","Input","SidebarHeader","SidebarFooter","SidebarSeparator","Separator","SidebarContent","SidebarGroup","SidebarGroupLabel","render","useRender","mergeProps","SidebarGroupAction","SidebarGroupContent","SidebarMenu","SidebarMenuItem","sidebarMenuButtonVariants","cva","SidebarMenuButton","isActive","size","tooltip","sidebarState","showTooltip","button","TooltipTrigger","Tooltip","TooltipContent","SidebarMenuAction","showOnHover","SidebarMenuBadge","widthFromKey","key","hash","index","SidebarMenuSkeleton","showIcon","width","useId","Skeleton","SidebarMenuSub","SidebarMenuSubItem","sidebarMenuSubButtonVariants","SidebarMenuSubButton"],"mappings":";;;;;;;;;;;;;AAIA,MAAMA,IAAoB;AAkBnB,SAASC,EAAYC,IAAqBF,GAA4B;AAC3E,QAAM,CAACG,GAAUC,CAAW,IAAIC,EAAS,EAAK;AAE9C,SAAAC,EAAU,MAAM;AACd,UAAMC,IAAa,OAAO,WAAW,eAAeL,IAAa,CAAC,KAAK,GACjEM,IAAW,MAAMJ,EAAY,OAAO,aAAaF,CAAU;AACjE,WAAAK,EAAW,iBAAiB,UAAUC,CAAQ,GAC9CA,EAAA,GACO,MAAMD,EAAW,oBAAoB,UAAUC,CAAQ;AAAA,EAChE,GAAG,CAACN,CAAU,CAAC,GAERC;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GCkBMM,IAAsB,iBACtBC,KAAyB,OAAU,KAAK,GACxCC,KAAgB,SAChBC,KAAuB,SACvBC,KAAqB,QACrBC,KAA4B;AAElC,SAASC,GAAeC,GAA+B;AAKrD,MAAI,OAAO,WAAa;AACtB,WAAOA;AAET,QAAMC,IAAQ,SAAS,OAAO,MAAM,IAAI,OAAO,WAAWR,CAAmB,UAAU,CAAC;AACxF,SAAOQ,IAAQA,EAAM,CAAC,MAAM,SAASD;AACvC;AAEA,SAASE,GAAgBC,GAAqB;AAC5C,EAAI,OAAO,WAAa,QAGxB,SAAS,SAAS,GAAGV,CAAmB,IAAIU,CAAI,qBAAqBT,EAAsB;AAC7F;AAYA,MAAMU,IAAiBC,EAA0C,IAAI;AAa9D,SAASC,IAAkC;A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kC;AACnF,SAAO,gBAAAe,EAAC,QAAG,WAAWE,EAAGC,EAAO,aAAarB,CAAS,GAAI,GAAGG,GAAO;AACtE;AAEA,MAAM8E,KAA+BzB,EAAInC,EAAO,eAAe;AAAA,EAC7D,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,IAAIA,EAAO;AAAA,MACX,IAAIA,EAAO;AAAA,IAAA;AAAA,EACb;AAAA,EAEF,iBAAiB;AAAA,IACf,MAAM;AAAA,EAAA;AAEV,CAAC;AAQM,SAAS6D,GAAqB;AAAA,EACnC,QAAAlC;AAAA,EACA,MAAAW;AAAA,EACA,UAAAD,IAAW;AAAA,EACX,WAAA1D;AAAA,EACA,GAAGG;AACL,GAA8B;AAC5B,SAAO8C,EAAU;AAAA,IACf,gBAAgB;AAAA,IAChB,QAAAD;AAAA;AAAA,IAEA,OAAO,EAAE,QAAQU,EAAA;AAAA,IACjB,OAAOR;AAAA,MACL,EAAE,WAAW+B,GAA6B,EAAE,MAAAtB,GAAM,WAAA3D,EAAA,CAAW,EAAA;AAAA,MAC7DG;AAAA,IAAA;AAAA,EACF,CACD;AACH;"}
package/dist/spinner.js CHANGED
@@ -1,45 +1,48 @@
1
- import { jsx as o, jsxs as h } from "react/jsx-runtime";
2
- import { cx as c } from "class-variance-authority";
3
- import { LoaderCircleIcon as l } from "lucide-react";
4
- import './chunks/spinner.sH6x_1Uf.css';const b = "_spinner_1q85o_6", v = "_block_1q85o_28", f = "_indicator_1q85o_44", x = "_label_1q85o_73", q = "_description_1q85o_85", i = {
1
+ import { jsx as n, jsxs as h } from "react/jsx-runtime";
2
+ import { cx as d } from "class-variance-authority";
3
+ import { LoaderCircleIcon as p } from "lucide-react";
4
+ import './chunks/spinner.CLQsj9Ky.css';const b = "_spinner_1avxn_6", f = "_block_1avxn_39", N = "_indicator_1avxn_55", k = "_label_1avxn_96", g = "_description_1avxn_108", i = {
5
5
  spinner: b,
6
- block: v,
7
- indicator: f,
8
- label: x,
9
- description: q
6
+ block: f,
7
+ indicator: N,
8
+ label: k,
9
+ description: g
10
10
  };
11
- function L({ className: a, label: n, description: s, compact: e, ...t }) {
12
- if (!(r(n) || r(s)))
13
- return /* @__PURE__ */ o(
14
- l,
11
+ function z({ className: a, label: s, description: t, compact: o, size: c, ...e }) {
12
+ const l = c === "lg" ? c : void 0;
13
+ if (!(r(s) || r(t)))
14
+ return /* @__PURE__ */ n(
15
+ p,
15
16
  {
16
17
  role: "status",
17
18
  "aria-label": "Loading",
18
- className: c(i.spinner, a),
19
- ...t,
20
- "data-compact": e || void 0
19
+ className: d(i.spinner, a),
20
+ ...e,
21
+ "data-compact": o || void 0,
22
+ "data-size": l
21
23
  }
22
24
  );
23
- const d = Object.prototype.hasOwnProperty.call(t, "role"), { role: p, "aria-live": m, "aria-atomic": _, ...u } = t;
25
+ const m = Object.prototype.hasOwnProperty.call(e, "role"), { role: _, "aria-live": v, "aria-atomic": u, ...x } = e;
24
26
  return /* @__PURE__ */ h(
25
27
  "div",
26
28
  {
27
29
  className: i.block,
28
- role: d ? p : "status",
29
- "aria-live": m,
30
- "aria-atomic": _,
31
- "data-compact": e || void 0,
30
+ role: m ? _ : "status",
31
+ "aria-live": v,
32
+ "aria-atomic": u,
33
+ "data-compact": o || void 0,
34
+ "data-size": l,
32
35
  children: [
33
- /* @__PURE__ */ o("span", { className: i.indicator, children: /* @__PURE__ */ o(
34
- l,
36
+ /* @__PURE__ */ n("span", { className: i.indicator, children: /* @__PURE__ */ n(
37
+ p,
35
38
  {
36
- className: c(i.spinner, a),
37
- ...u,
39
+ className: d(i.spinner, a),
40
+ ...x,
38
41
  "aria-hidden": "true"
39
42
  }
40
43
  ) }),
41
- r(n) ? /* @__PURE__ */ o("span", { className: i.label, children: n }) : null,
42
- r(s) ? /* @__PURE__ */ o("span", { className: i.description, children: s }) : null
44
+ r(s) ? /* @__PURE__ */ n("span", { className: i.label, children: s }) : null,
45
+ r(t) ? /* @__PURE__ */ n("span", { className: i.description, children: t }) : null
43
46
  ]
44
47
  }
45
48
  );
@@ -48,6 +51,6 @@ function r(a) {
48
51
  return a != null && a !== !1 && a !== "";
49
52
  }
50
53
  export {
51
- L as Spinner
54
+ z as Spinner
52
55
  };
53
56
  //# sourceMappingURL=spinner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"spinner.js","sources":["../src/components/spinner/spinner.tsx"],"sourcesContent":["import { cx } from 'class-variance-authority';\nimport { LoaderCircleIcon } from 'lucide-react';\nimport type { ComponentProps, ReactNode } from 'react';\n\nimport styles from './spinner.module.css';\n\n/*\n * Spinner has no Base UI primitive (registry/bases/base/ui/spinner.tsx\n * renders `Loader2Icon` styled `size-4 animate-spin` — lucide's legacy\n * alias for `loader-circle`, spelled canonically here) and no\n * variant axis — a pure styling translation, same shape as Skeleton (no\n * cva, just one class). `animate-spin` is reproduced as this module's own\n * `spin` keyframe (see spinner.module.css).\n *\n * `role=\"status\"` + `aria-label` also suppress lucide's default\n * `aria-hidden=\"true\"`: this icon IS the loading announcement, not decoration.\n *\n * Two shapes, one component. Bare, it is that icon and nothing else, at\n * the kit's small icon step. Given a `label` or a `description`, it\n * becomes the drawn loading block: the glyph centred in an indicator box\n * with its text beneath. The wrapper is then the live region and the\n * glyph turns decorative, so the announcement is the text a reader can\n * also see, rather than a second hardcoded \"Loading\".\n *\n * Props stay the indicator `<svg>`'s at both shapes, `className`\n * included - the layout block the kit adds around it is the kit's, not a\n * second element to configure. A caller who needs to place the whole\n * block wraps it themselves.\n */\nexport interface SpinnerProps extends ComponentProps<'svg'> {\n /**\n * The state, written under the indicator in the drawn micro type. Its\n * presence is what turns the spinner into the composed block, and it\n * becomes the announcement in place of the default \"Loading\".\n */\n label?: ReactNode;\n /** A second line under the label: what is being waited on, or how long\n * it usually takes. Announced with the label. */\n description?: ReactNode;\n /**\n * The drawn tighter block: a 28 indicator around a 14 glyph instead of\n * 36 around 18. On a bare spinner it takes the glyph to that same 14.\n * @default false\n */\n compact?: boolean;\n}\n\nexport function Spinner({ className, label, description, compact, ...props }: SpinnerProps) {\n // Both `false` and `null` are ReactNodes that render nothing, and\n // `label={busy && 'Saving'}` passes one whenever `busy` is false. They\n // must land on the bare shape, not produce an empty live region.\n const hasText = isPresent(label) || isPresent(description);\n\n if (!hasText) {\n return (\n <LoaderCircleIcon\n role=\"status\"\n aria-label=\"Loading\"\n className={cx(styles.spinner, className)}\n {...props}\n data-compact={compact || undefined}\n />\n );\n }\n\n // The block is the live region now, so a consumer-passed `role` (and\n // `aria-live`/`aria-atomic`, if passed) must land here, not on the\n // glyph below - it lets a labelled Spinner nested in another live\n // region opt out with `role={undefined}` or `role=\"presentation\"` to\n // avoid a duplicate announcement, instead of always adding a second one.\n // An own-property check (not a destructuring default) so an explicit\n // `role={undefined}` is still honored as \"no role\", rather than falling\n // back to \"status\". `hasOwnProperty.call`, not `Object.hasOwn` - the root\n // tsconfig's host type-check runs packages/*/src against an ES2020 lib.\n const hasRole = Object.prototype.hasOwnProperty.call(props, 'role');\n const { role, 'aria-live': ariaLive, 'aria-atomic': ariaAtomic, ...svgProps } = props;\n\n return (\n <div\n className={styles.block}\n role={hasRole ? role : 'status'}\n aria-live={ariaLive}\n aria-atomic={ariaAtomic}\n data-compact={compact || undefined}\n >\n <span className={styles.indicator}>\n <LoaderCircleIcon\n className={cx(styles.spinner, className)}\n {...svgProps}\n // After `...svgProps`: the block above is the live region now, so\n // the glyph must be decorative whatever the caller passed.\n aria-hidden=\"true\"\n />\n </span>\n {isPresent(label) ? <span className={styles.label}>{label}</span> : null}\n {isPresent(description) ? <span className={styles.description}>{description}</span> : null}\n </div>\n );\n}\n\nfunction isPresent(node: ReactNode): boolean {\n return node !== undefined && node !== null && node !== false && node !== '';\n}\n"],"names":["Spinner","className","label","description","compact","props","isPresent","jsx","LoaderCircleIcon","cx","styles","hasRole","role","ariaLive","ariaAtomic","svgProps","jsxs","node"],"mappings":";;;;;;;;;;AA+CO,SAASA,EAAQ,EAAE,WAAAC,GAAW,OAAAC,GAAO,aAAAC,GAAa,SAAAC,GAAS,GAAGC,KAAuB;AAM1F,MAAI,EAFYC,EAAUJ,CAAK,KAAKI,EAAUH,CAAW;AAGvD,WACE,gBAAAI;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,cAAW;AAAA,QACX,WAAWC,EAAGC,EAAO,SAAST,CAAS;AAAA,QACtC,GAAGI;AAAA,QACJ,gBAAcD,KAAW;AAAA,MAAA;AAAA,IAAA;AAc/B,QAAMO,IAAU,OAAO,UAAU,eAAe,KAAKN,GAAO,MAAM,GAC5D,EAAE,MAAAO,GAAM,aAAaC,GAAU,eAAeC,GAAY,GAAGC,MAAaV;AAEhF,SACE,gBAAAW;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWN,EAAO;AAAA,MAClB,MAAMC,IAAUC,IAAO;AAAA,MACvB,aAAWC;AAAA,MACX,eAAaC;AAAA,MACb,gBAAcV,KAAW;AAAA,MAEzB,UAAA;AAAA,QAAA,gBAAAG,EAAC,QAAA,EAAK,WAAWG,EAAO,WACtB,UAAA,gBAAAH;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,WAAWC,EAAGC,EAAO,SAAST,CAAS;AAAA,YACtC,GAAGc;AAAA,YAGJ,eAAY;AAAA,UAAA;AAAA,QAAA,GAEhB;AAAA,QACCT,EAAUJ,CAAK,IAAI,gBAAAK,EAAC,UAAK,WAAWG,EAAO,OAAQ,UAAAR,EAAA,CAAM,IAAU;AAAA,QACnEI,EAAUH,CAAW,IAAI,gBAAAI,EAAC,UAAK,WAAWG,EAAO,aAAc,UAAAP,EAAA,CAAY,IAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG5F;AAEA,SAASG,EAAUW,GAA0B;AAC3C,SAA6BA,KAAS,QAAQA,MAAS,MAASA,MAAS;AAC3E;"}
1
+ {"version":3,"file":"spinner.js","sources":["../src/components/spinner/spinner.tsx"],"sourcesContent":["import { cx } from 'class-variance-authority';\nimport { LoaderCircleIcon } from 'lucide-react';\nimport type { ComponentProps, ReactNode } from 'react';\n\nimport styles from './spinner.module.css';\n\n/*\n * Spinner has no Base UI primitive (registry/bases/base/ui/spinner.tsx\n * renders `Loader2Icon` styled `size-4 animate-spin` — lucide's legacy\n * alias for `loader-circle`, spelled canonically here) and no\n * variant axis — a pure styling translation, same shape as Skeleton (no\n * cva, just one class). `animate-spin` is reproduced as this module's own\n * `spin` keyframe (see spinner.module.css).\n *\n * `role=\"status\"` + `aria-label` also suppress lucide's default\n * `aria-hidden=\"true\"`: this icon IS the loading announcement, not decoration.\n *\n * Two shapes, one component. Bare, it is that icon and nothing else, at\n * the kit's small icon step. Given a `label` or a `description`, it\n * becomes the drawn loading block: the glyph centred in an indicator box\n * with its text beneath. The wrapper is then the live region and the\n * glyph turns decorative, so the announcement is the text a reader can\n * also see, rather than a second hardcoded \"Loading\".\n *\n * Props stay the indicator `<svg>`'s at both shapes, `className`\n * included - the layout block the kit adds around it is the kit's, not a\n * second element to configure. A caller who needs to place the whole\n * block wraps it themselves.\n */\nexport interface SpinnerProps extends ComponentProps<'svg'> {\n /**\n * The state, written under the indicator in the drawn micro type. Its\n * presence is what turns the spinner into the composed block, and it\n * becomes the announcement in place of the default \"Loading\".\n */\n label?: ReactNode;\n /** A second line under the label: what is being waited on, or how long\n * it usually takes. Announced with the label. */\n description?: ReactNode;\n /**\n * The drawn tighter block: a 28 indicator around a 14 glyph instead of\n * 36 around 18. On a bare spinner it takes the glyph to that same 14.\n * @default false\n */\n compact?: boolean;\n /**\n * The glyph step. `lg` is the large one: 32 on a bare spinner, and in the\n * composed block a 64 indicator around a 32 glyph (the same 2:1 the\n * 36/18 and 28/14 steps draw). Wins over `compact` when both are passed,\n * so a caller computing either from state never gets a half-and-half.\n * Named `size` and kept to a literal union rather than lucide's\n * number-or-string `size`, which this prop intercepts and never forwards.\n * @default 'default'\n */\n size?: 'default' | 'lg';\n}\n\nexport function Spinner({ className, label, description, compact, size, ...props }: SpinnerProps) {\n const dataSize = size === 'lg' ? size : undefined;\n // Both `false` and `null` are ReactNodes that render nothing, and\n // `label={busy && 'Saving'}` passes one whenever `busy` is false. They\n // must land on the bare shape, not produce an empty live region.\n const hasText = isPresent(label) || isPresent(description);\n\n if (!hasText) {\n return (\n <LoaderCircleIcon\n role=\"status\"\n aria-label=\"Loading\"\n className={cx(styles.spinner, className)}\n {...props}\n data-compact={compact || undefined}\n data-size={dataSize}\n />\n );\n }\n\n // The block is the live region now, so a consumer-passed `role` (and\n // `aria-live`/`aria-atomic`, if passed) must land here, not on the\n // glyph below - it lets a labelled Spinner nested in another live\n // region opt out with `role={undefined}` or `role=\"presentation\"` to\n // avoid a duplicate announcement, instead of always adding a second one.\n // An own-property check (not a destructuring default) so an explicit\n // `role={undefined}` is still honored as \"no role\", rather than falling\n // back to \"status\". `hasOwnProperty.call`, not `Object.hasOwn` - the root\n // tsconfig's host type-check runs packages/*/src against an ES2020 lib.\n const hasRole = Object.prototype.hasOwnProperty.call(props, 'role');\n const { role, 'aria-live': ariaLive, 'aria-atomic': ariaAtomic, ...svgProps } = props;\n\n return (\n <div\n className={styles.block}\n role={hasRole ? role : 'status'}\n aria-live={ariaLive}\n aria-atomic={ariaAtomic}\n data-compact={compact || undefined}\n data-size={dataSize}\n >\n <span className={styles.indicator}>\n <LoaderCircleIcon\n className={cx(styles.spinner, className)}\n {...svgProps}\n // After `...svgProps`: the block above is the live region now, so\n // the glyph must be decorative whatever the caller passed.\n aria-hidden=\"true\"\n />\n </span>\n {isPresent(label) ? <span className={styles.label}>{label}</span> : null}\n {isPresent(description) ? <span className={styles.description}>{description}</span> : null}\n </div>\n );\n}\n\nfunction isPresent(node: ReactNode): boolean {\n return node !== undefined && node !== null && node !== false && node !== '';\n}\n"],"names":["Spinner","className","label","description","compact","size","props","dataSize","isPresent","jsx","LoaderCircleIcon","cx","styles","hasRole","role","ariaLive","ariaAtomic","svgProps","jsxs","node"],"mappings":";;;;;;;;;;AAyDO,SAASA,EAAQ,EAAE,WAAAC,GAAW,OAAAC,GAAO,aAAAC,G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