@lerianstudio/sindarian-ui 2.0.0-beta.2 → 2.0.0-beta.21

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 (227) hide show
  1. package/LICENSE +93 -0
  2. package/README.md +52 -1
  3. package/dist/components/breadcrumb/index.d.ts.map +1 -1
  4. package/dist/components/breadcrumb/index.js +25 -1
  5. package/dist/components/card/account-card/index.js +5 -5
  6. package/dist/components/card/basic-card/index.d.ts.map +1 -1
  7. package/dist/components/card/basic-card/index.js +2 -2
  8. package/dist/components/card/entity-card/index.js +1 -1
  9. package/dist/components/dialog/confirmation-dialog/index.d.ts.map +1 -1
  10. package/dist/components/dialog/confirmation-dialog/index.js +4 -1
  11. package/dist/components/entity-box/index.d.ts +18 -2
  12. package/dist/components/entity-box/index.d.ts.map +1 -1
  13. package/dist/components/entity-box/index.js +32 -4
  14. package/dist/components/form/date-picker-field/index.js +1 -1
  15. package/dist/components/form/date-range-field/index.js +1 -1
  16. package/dist/components/form/date-time-picker-field/index.js +1 -1
  17. package/dist/components/form/password-field/index.d.ts +5 -1
  18. package/dist/components/form/password-field/index.d.ts.map +1 -1
  19. package/dist/components/form/password-field/index.js +2 -2
  20. package/dist/components/form/select-field/index.d.ts +15 -1
  21. package/dist/components/form/select-field/index.d.ts.map +1 -1
  22. package/dist/components/form/select-field/index.js +28 -3
  23. package/dist/components/form/switch-field/index.d.ts.map +1 -1
  24. package/dist/components/form/switch-field/index.js +6 -1
  25. package/dist/components/page/index.d.ts +35 -1
  26. package/dist/components/page/index.d.ts.map +1 -1
  27. package/dist/components/page/index.js +6 -2
  28. package/dist/components/page-header/index.js +1 -1
  29. package/dist/components/table/id-table-cell.d.ts +13 -1
  30. package/dist/components/table/id-table-cell.d.ts.map +1 -1
  31. package/dist/components/table/id-table-cell.js +99 -9
  32. package/dist/components/table/index.d.ts +1 -0
  33. package/dist/components/table/index.d.ts.map +1 -1
  34. package/dist/components/table/index.js +1 -0
  35. package/dist/components/table/locked-table-actions.d.ts +24 -0
  36. package/dist/components/table/locked-table-actions.d.ts.map +1 -1
  37. package/dist/components/table/locked-table-actions.js +31 -1
  38. package/dist/components/table/name-table-cell.d.ts +57 -4
  39. package/dist/components/table/name-table-cell.d.ts.map +1 -1
  40. package/dist/components/table/name-table-cell.js +50 -2
  41. package/dist/components/ui/autocomplete/index.d.ts +24 -0
  42. package/dist/components/ui/autocomplete/index.d.ts.map +1 -1
  43. package/dist/components/ui/autocomplete/index.js +24 -0
  44. package/dist/components/ui/badge/index.d.ts +11 -7
  45. package/dist/components/ui/badge/index.d.ts.map +1 -1
  46. package/dist/components/ui/badge/index.js +20 -8
  47. package/dist/components/ui/button/index.d.ts +3 -3
  48. package/dist/components/ui/copy-field/index.d.ts +25 -1
  49. package/dist/components/ui/copy-field/index.d.ts.map +1 -1
  50. package/dist/components/ui/copy-field/index.js +16 -8
  51. package/dist/components/ui/dialog/index.d.ts +1 -1
  52. package/dist/components/ui/dialog/index.d.ts.map +1 -1
  53. package/dist/components/ui/dialog/index.js +2 -2
  54. package/dist/components/ui/file-upload/index.d.ts +159 -0
  55. package/dist/components/ui/file-upload/index.d.ts.map +1 -1
  56. package/dist/components/ui/file-upload/index.js +308 -6
  57. package/dist/components/ui/icon-button/index.d.ts +1 -1
  58. package/dist/components/ui/icon-button/styles.css +42 -0
  59. package/dist/components/ui/input/styles.css +79 -4
  60. package/dist/components/ui/lerian-wordmark/index.d.ts +6 -0
  61. package/dist/components/ui/lerian-wordmark/index.d.ts.map +1 -0
  62. package/dist/components/ui/lerian-wordmark/index.js +7 -0
  63. package/dist/components/ui/otp-input/index.js +1 -1
  64. package/dist/components/ui/radio-group/index.js +1 -1
  65. package/dist/components/ui/select/index.d.ts.map +1 -1
  66. package/dist/components/ui/select/index.js +8 -4
  67. package/dist/components/ui/select/styles.css +1 -1
  68. package/dist/components/ui/sheet/index.d.ts +42 -0
  69. package/dist/components/ui/sheet/index.d.ts.map +1 -1
  70. package/dist/components/ui/sheet/index.js +47 -14
  71. package/dist/components/ui/sidebar/index.d.ts +1 -0
  72. package/dist/components/ui/sidebar/index.d.ts.map +1 -1
  73. package/dist/components/ui/sidebar/index.js +1 -0
  74. package/dist/components/ui/sidebar/sidebar-expand-button.d.ts +1 -1
  75. package/dist/components/ui/sidebar/sidebar-expand-button.d.ts.map +1 -1
  76. package/dist/components/ui/sidebar/sidebar-expand-button.js +15 -1
  77. package/dist/components/ui/sidebar/sidebar-item.d.ts +1 -1
  78. package/dist/components/ui/sidebar/sidebar-item.d.ts.map +1 -1
  79. package/dist/components/ui/sidebar/sidebar-item.js +28 -4
  80. package/dist/components/ui/sidebar/sidebar-provider.d.ts +58 -0
  81. package/dist/components/ui/sidebar/sidebar-provider.d.ts.map +1 -1
  82. package/dist/components/ui/sidebar/sidebar-provider.js +146 -4
  83. package/dist/components/ui/sidebar/sidebar-root.d.ts +38 -1
  84. package/dist/components/ui/sidebar/sidebar-root.d.ts.map +1 -1
  85. package/dist/components/ui/sidebar/sidebar-root.js +111 -5
  86. package/dist/components/ui/sidebar/sidebar-trigger.d.ts +45 -0
  87. package/dist/components/ui/sidebar/sidebar-trigger.d.ts.map +1 -0
  88. package/dist/components/ui/sidebar/sidebar-trigger.js +57 -0
  89. package/dist/components/ui/textarea/index.js +1 -1
  90. package/dist/components/ui/toast/toaster.d.ts +5 -1
  91. package/dist/components/ui/toast/toaster.d.ts.map +1 -1
  92. package/dist/components/ui/toast/toaster.js +3 -2
  93. package/dist/enterprise/data-table/index.d.ts +77 -7
  94. package/dist/enterprise/data-table/index.d.ts.map +1 -1
  95. package/dist/enterprise/data-table/index.js +56 -11
  96. package/dist/enterprise/date-range-picker/index.js +4 -4
  97. package/dist/enterprise/number-input/index.d.ts.map +1 -1
  98. package/dist/enterprise/number-input/index.js +1 -1
  99. package/dist/esm/components/breadcrumb/index.d.ts.map +1 -1
  100. package/dist/esm/components/breadcrumb/index.js +25 -1
  101. package/dist/esm/components/card/account-card/index.js +5 -5
  102. package/dist/esm/components/card/basic-card/index.d.ts.map +1 -1
  103. package/dist/esm/components/card/basic-card/index.js +2 -2
  104. package/dist/esm/components/card/entity-card/index.js +1 -1
  105. package/dist/esm/components/dialog/confirmation-dialog/index.d.ts.map +1 -1
  106. package/dist/esm/components/dialog/confirmation-dialog/index.js +4 -1
  107. package/dist/esm/components/entity-box/index.d.ts +18 -2
  108. package/dist/esm/components/entity-box/index.d.ts.map +1 -1
  109. package/dist/esm/components/entity-box/index.js +29 -4
  110. package/dist/esm/components/form/date-picker-field/index.js +1 -1
  111. package/dist/esm/components/form/date-range-field/index.js +1 -1
  112. package/dist/esm/components/form/date-time-picker-field/index.js +1 -1
  113. package/dist/esm/components/form/password-field/index.d.ts +5 -1
  114. package/dist/esm/components/form/password-field/index.d.ts.map +1 -1
  115. package/dist/esm/components/form/password-field/index.js +2 -2
  116. package/dist/esm/components/form/select-field/index.d.ts +15 -1
  117. package/dist/esm/components/form/select-field/index.d.ts.map +1 -1
  118. package/dist/esm/components/form/select-field/index.js +29 -4
  119. package/dist/esm/components/form/switch-field/index.d.ts.map +1 -1
  120. package/dist/esm/components/form/switch-field/index.js +7 -2
  121. package/dist/esm/components/page/index.d.ts +35 -1
  122. package/dist/esm/components/page/index.d.ts.map +1 -1
  123. package/dist/esm/components/page/index.js +6 -2
  124. package/dist/esm/components/page-header/index.js +1 -1
  125. package/dist/esm/components/table/id-table-cell.d.ts +13 -1
  126. package/dist/esm/components/table/id-table-cell.d.ts.map +1 -1
  127. package/dist/esm/components/table/id-table-cell.js +100 -7
  128. package/dist/esm/components/table/index.d.ts +1 -0
  129. package/dist/esm/components/table/index.d.ts.map +1 -1
  130. package/dist/esm/components/table/index.js +1 -0
  131. package/dist/esm/components/table/locked-table-actions.d.ts +24 -0
  132. package/dist/esm/components/table/locked-table-actions.d.ts.map +1 -1
  133. package/dist/esm/components/table/locked-table-actions.js +31 -1
  134. package/dist/esm/components/table/name-table-cell.d.ts +57 -4
  135. package/dist/esm/components/table/name-table-cell.d.ts.map +1 -1
  136. package/dist/esm/components/table/name-table-cell.js +50 -2
  137. package/dist/esm/components/ui/autocomplete/index.d.ts +24 -0
  138. package/dist/esm/components/ui/autocomplete/index.d.ts.map +1 -1
  139. package/dist/esm/components/ui/autocomplete/index.js +24 -0
  140. package/dist/esm/components/ui/badge/index.d.ts +11 -7
  141. package/dist/esm/components/ui/badge/index.d.ts.map +1 -1
  142. package/dist/esm/components/ui/badge/index.js +20 -8
  143. package/dist/esm/components/ui/button/index.d.ts +3 -3
  144. package/dist/esm/components/ui/copy-field/index.d.ts +25 -1
  145. package/dist/esm/components/ui/copy-field/index.d.ts.map +1 -1
  146. package/dist/esm/components/ui/copy-field/index.js +16 -8
  147. package/dist/esm/components/ui/dialog/index.d.ts +1 -1
  148. package/dist/esm/components/ui/dialog/index.d.ts.map +1 -1
  149. package/dist/esm/components/ui/dialog/index.js +3 -3
  150. package/dist/esm/components/ui/file-upload/index.d.ts +159 -0
  151. package/dist/esm/components/ui/file-upload/index.d.ts.map +1 -1
  152. package/dist/esm/components/ui/file-upload/index.js +307 -5
  153. package/dist/esm/components/ui/icon-button/index.d.ts +1 -1
  154. package/dist/esm/components/ui/lerian-wordmark/index.d.ts +6 -0
  155. package/dist/esm/components/ui/lerian-wordmark/index.d.ts.map +1 -0
  156. package/dist/esm/components/ui/lerian-wordmark/index.js +4 -0
  157. package/dist/esm/components/ui/otp-input/index.js +1 -1
  158. package/dist/esm/components/ui/radio-group/index.js +1 -1
  159. package/dist/esm/components/ui/select/index.d.ts.map +1 -1
  160. package/dist/esm/components/ui/select/index.js +8 -4
  161. package/dist/esm/components/ui/sheet/index.d.ts +42 -0
  162. package/dist/esm/components/ui/sheet/index.d.ts.map +1 -1
  163. package/dist/esm/components/ui/sheet/index.js +48 -15
  164. package/dist/esm/components/ui/sidebar/index.d.ts +1 -0
  165. package/dist/esm/components/ui/sidebar/index.d.ts.map +1 -1
  166. package/dist/esm/components/ui/sidebar/index.js +1 -0
  167. package/dist/esm/components/ui/sidebar/sidebar-expand-button.d.ts +1 -1
  168. package/dist/esm/components/ui/sidebar/sidebar-expand-button.d.ts.map +1 -1
  169. package/dist/esm/components/ui/sidebar/sidebar-expand-button.js +15 -1
  170. package/dist/esm/components/ui/sidebar/sidebar-item.d.ts +1 -1
  171. package/dist/esm/components/ui/sidebar/sidebar-item.d.ts.map +1 -1
  172. package/dist/esm/components/ui/sidebar/sidebar-item.js +28 -4
  173. package/dist/esm/components/ui/sidebar/sidebar-provider.d.ts +58 -0
  174. package/dist/esm/components/ui/sidebar/sidebar-provider.d.ts.map +1 -1
  175. package/dist/esm/components/ui/sidebar/sidebar-provider.js +143 -1
  176. package/dist/esm/components/ui/sidebar/sidebar-root.d.ts +38 -1
  177. package/dist/esm/components/ui/sidebar/sidebar-root.d.ts.map +1 -1
  178. package/dist/esm/components/ui/sidebar/sidebar-root.js +113 -7
  179. package/dist/esm/components/ui/sidebar/sidebar-trigger.d.ts +45 -0
  180. package/dist/esm/components/ui/sidebar/sidebar-trigger.d.ts.map +1 -0
  181. package/dist/esm/components/ui/sidebar/sidebar-trigger.js +53 -0
  182. package/dist/esm/components/ui/textarea/index.js +1 -1
  183. package/dist/esm/components/ui/toast/toaster.d.ts +5 -1
  184. package/dist/esm/components/ui/toast/toaster.d.ts.map +1 -1
  185. package/dist/esm/components/ui/toast/toaster.js +3 -2
  186. package/dist/esm/enterprise/data-table/index.d.ts +77 -7
  187. package/dist/esm/enterprise/data-table/index.d.ts.map +1 -1
  188. package/dist/esm/enterprise/data-table/index.js +57 -12
  189. package/dist/esm/enterprise/date-range-picker/index.js +4 -4
  190. package/dist/esm/enterprise/number-input/index.d.ts.map +1 -1
  191. package/dist/esm/enterprise/number-input/index.js +1 -1
  192. package/dist/esm/hooks/use-toast.d.ts +18 -2
  193. package/dist/esm/hooks/use-toast.d.ts.map +1 -1
  194. package/dist/esm/hooks/use-toast.js +60 -16
  195. package/dist/esm/index.d.ts +3 -0
  196. package/dist/esm/index.d.ts.map +1 -1
  197. package/dist/esm/index.js +3 -0
  198. package/dist/esm/lib/utils.d.ts +2 -0
  199. package/dist/esm/lib/utils.d.ts.map +1 -1
  200. package/dist/esm/lib/utils.js +10 -0
  201. package/dist/esm/toast/helpers.d.ts +13 -0
  202. package/dist/esm/toast/helpers.d.ts.map +1 -1
  203. package/dist/esm/toast/helpers.js +8 -1
  204. package/dist/fonts/OFL.txt +96 -0
  205. package/dist/fonts/ibm-plex-mono-latin-400.woff2 +0 -0
  206. package/dist/fonts/ibm-plex-mono-latin-500.woff2 +0 -0
  207. package/dist/fonts/ibm-plex-serif-latin-400.woff2 +0 -0
  208. package/dist/fonts/ibm-plex-serif-latin-500.woff2 +0 -0
  209. package/dist/fonts/inter-latin.woff2 +0 -0
  210. package/dist/fonts.css +46 -0
  211. package/dist/globals.css +62 -362
  212. package/dist/hooks/use-toast.d.ts +18 -2
  213. package/dist/hooks/use-toast.d.ts.map +1 -1
  214. package/dist/hooks/use-toast.js +61 -16
  215. package/dist/index.d.ts +3 -0
  216. package/dist/index.d.ts.map +1 -1
  217. package/dist/index.js +3 -0
  218. package/dist/lib/utils.d.ts +2 -0
  219. package/dist/lib/utils.d.ts.map +1 -1
  220. package/dist/lib/utils.js +11 -0
  221. package/dist/public/wordmark.svg +1 -0
  222. package/dist/standalone.css +10 -0
  223. package/dist/toast/helpers.d.ts +13 -0
  224. package/dist/toast/helpers.d.ts.map +1 -1
  225. package/dist/toast/helpers.js +8 -1
  226. package/dist/tokens.css +367 -0
  227. package/package.json +9 -6
@@ -6,6 +6,48 @@ declare function SheetTrigger({ ...props }: React.ComponentProps<typeof SheetPri
6
6
  declare function SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimitive.Close>): React.JSX.Element;
7
7
  declare function SheetPortal({ ...props }: React.ComponentProps<typeof SheetPrimitive.Portal>): React.JSX.Element;
8
8
  declare function SheetOverlay({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Overlay>): React.JSX.Element;
9
+ /**
10
+ * ⛔ A PANEL BUILT FOR A DESKTOP HAS TO STOP BEING TWO FIFTHS ON A PHONE.
11
+ *
12
+ * `w-2/5` and `p-12` were unconditional. At a 390px viewport that is a 156px
13
+ * panel with 59px of usable width, and a form field inside it measures 9px of
14
+ * text — a sheet that cannot be read, let alone filled in. At 320px the panel
15
+ * is 128px and the field has NOTHING: its own padding is wider than its box.
16
+ * Thirteen product-console routes opened a sheet that looked like that, which
17
+ * is why that console has carried a rule against `[data-slot='sheet-content']`
18
+ * since its M10 lane; this is that rule brought home, and the console can drop
19
+ * its copy.
20
+ *
21
+ * ⚠️ THE PHONE VALUES CARRY THE MODIFIER, THE DESKTOP ONES DO NOT, AND THAT
22
+ * ASYMMETRY IS THE WHOLE MECHANISM. `cn` resolves these through tailwind-merge
23
+ * before the cascade sees them, and tailwind-merge only drops a conflicting
24
+ * class carrying the SAME modifiers. So a caller's `w-[594px]` replaces
25
+ * `w-2/5` and leaves `max-sm:w-full` standing: the fifteen product-console
26
+ * sheets that declare a pixel width of their own — and the two that declare
27
+ * `w-full` — all still fill a phone, with no edit at the call site. Written
28
+ * the other way round — `w-full sm:w-2/5` — the caller's bare `w-[594px]`
29
+ * would have been overruled by `sm:w-2/5` at every desktop width instead,
30
+ * which is the same bug pointing the other way.
31
+ *
32
+ * ⚠️ IT CUTS BOTH WAYS, AND THE PADDING IS WHERE THAT IS FELT. A caller's bare
33
+ * `p-0` drops `p-12` and cannot reach `max-sm:px-4` either, so a panel that
34
+ * asked for no padding gets 16px a side below 40rem. That is deliberate — it
35
+ * is what makes the phone step reach the call sites that need it most — and it
36
+ * is what product-console's own unlayered rule already did to those five
37
+ * sheets, so nothing there moves. For any other consumer it is a behaviour
38
+ * change from 2.0.0-beta.11, and the way out is one token.
39
+ *
40
+ * A call site that genuinely wants its own phone width or padding says so with
41
+ * the modifier (`max-sm:w-[320px]`, `max-sm:p-0`), which is one token and
42
+ * strictly more than the console's unlayered rule allowed anyone.
43
+ *
44
+ * 40rem rather than 768px, unlike `SidebarTrigger` next door: nothing here is
45
+ * paired with a pixel media query in JavaScript. This is a reading-width
46
+ * decision and it is the complement of `sm:`, so it moves with the reader's
47
+ * font exactly as the rest of the package's responsive steps do. The one panel
48
+ * that IS coupled to the pixel breakpoint is the navigation drawer, and
49
+ * `SidebarRoot` opts it out by restating both tokens under `max-sm:`.
50
+ */
9
51
  declare const sheetVariants: (props?: ({
10
52
  side?: "bottom" | "left" | "right" | "top" | null | undefined;
11
53
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/sheet/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,cAAc,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,iBAAS,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,qBAE5E;AAED,iBAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,qBAErD;AAED,iBAAS,UAAU,CAAC,EAClB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,qBAEnD;AAED,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,MAAM,CAAC,qBAEpD;AAED,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,qBAWrD;AAED,QAAA,MAAM,aAAa;;8EAiBlB,CAAA;AAED,KAAK,iBAAiB,GAAG,KAAK,CAAC,cAAc,CA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L,KAAK,EACL,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,EACjB,CAAA"}
@@ -45,7 +45,6 @@ exports.SheetFooter = SheetFooter;
45
45
  exports.SheetTitle = SheetTitle;
46
46
  exports.SheetDescription = SheetDescription;
47
47
  const jsx_runtime_1 = require("react/jsx-runtime");
48
- const React = __importStar(require("react"));
49
48
  const SheetPrimitive = __importStar(require("@radix-ui/react-dialog"));
50
49
  const class_variance_authority_1 = require("class-variance-authority");
51
50
  const lucide_react_1 = require("lucide-react");
@@ -65,13 +64,55 @@ function SheetPortal({ ...props }) {
65
64
  function SheetOverlay({ className, ...props }) {
66
65
  return ((0, jsx_runtime_1.jsx)(SheetPrimitive.Overlay, { "data-slot": "sheet-overlay", className: (0, utils_1.cn)('motion-safe:data-[state=open]:animate-in motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80', className), ...props }));
67
66
  }
68
- const sheetVariants = (0, class_variance_authority_1.cva)('fixed z-50 gap-4 bg-background p-12 shadow-lg transition ease-in-out motion-safe:data-[state=open]:animate-in motion-safe:data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500', {
67
+ /**
68
+ * ⛔ A PANEL BUILT FOR A DESKTOP HAS TO STOP BEING TWO FIFTHS ON A PHONE.
69
+ *
70
+ * `w-2/5` and `p-12` were unconditional. At a 390px viewport that is a 156px
71
+ * panel with 59px of usable width, and a form field inside it measures 9px of
72
+ * text — a sheet that cannot be read, let alone filled in. At 320px the panel
73
+ * is 128px and the field has NOTHING: its own padding is wider than its box.
74
+ * Thirteen product-console routes opened a sheet that looked like that, which
75
+ * is why that console has carried a rule against `[data-slot='sheet-content']`
76
+ * since its M10 lane; this is that rule brought home, and the console can drop
77
+ * its copy.
78
+ *
79
+ * ⚠️ THE PHONE VALUES CARRY THE MODIFIER, THE DESKTOP ONES DO NOT, AND THAT
80
+ * ASYMMETRY IS THE WHOLE MECHANISM. `cn` resolves these through tailwind-merge
81
+ * before the cascade sees them, and tailwind-merge only drops a conflicting
82
+ * class carrying the SAME modifiers. So a caller's `w-[594px]` replaces
83
+ * `w-2/5` and leaves `max-sm:w-full` standing: the fifteen product-console
84
+ * sheets that declare a pixel width of their own — and the two that declare
85
+ * `w-full` — all still fill a phone, with no edit at the call site. Written
86
+ * the other way round — `w-full sm:w-2/5` — the caller's bare `w-[594px]`
87
+ * would have been overruled by `sm:w-2/5` at every desktop width instead,
88
+ * which is the same bug pointing the other way.
89
+ *
90
+ * ⚠️ IT CUTS BOTH WAYS, AND THE PADDING IS WHERE THAT IS FELT. A caller's bare
91
+ * `p-0` drops `p-12` and cannot reach `max-sm:px-4` either, so a panel that
92
+ * asked for no padding gets 16px a side below 40rem. That is deliberate — it
93
+ * is what makes the phone step reach the call sites that need it most — and it
94
+ * is what product-console's own unlayered rule already did to those five
95
+ * sheets, so nothing there moves. For any other consumer it is a behaviour
96
+ * change from 2.0.0-beta.11, and the way out is one token.
97
+ *
98
+ * A call site that genuinely wants its own phone width or padding says so with
99
+ * the modifier (`max-sm:w-[320px]`, `max-sm:p-0`), which is one token and
100
+ * strictly more than the console's unlayered rule allowed anyone.
101
+ *
102
+ * 40rem rather than 768px, unlike `SidebarTrigger` next door: nothing here is
103
+ * paired with a pixel media query in JavaScript. This is a reading-width
104
+ * decision and it is the complement of `sm:`, so it moves with the reader's
105
+ * font exactly as the rest of the package's responsive steps do. The one panel
106
+ * that IS coupled to the pixel breakpoint is the navigation drawer, and
107
+ * `SidebarRoot` opts it out by restating both tokens under `max-sm:`.
108
+ */
109
+ const sheetVariants = (0, class_variance_authority_1.cva)('fixed z-50 gap-4 bg-background p-12 max-sm:px-4 shadow-lg transition ease-in-out motion-safe:data-[state=open]:animate-in motion-safe:data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500', {
69
110
  variants: {
70
111
  side: {
71
112
  top: 'inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top',
72
113
  bottom: 'inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom',
73
- left: 'inset-y-0 left-0 h-full w-2/5 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left',
74
- right: 'inset-y-0 right-0 h-full w-2/5 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right'
114
+ left: 'inset-y-0 left-0 h-full w-2/5 max-sm:w-full border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left',
115
+ right: 'inset-y-0 right-0 h-full w-2/5 max-sm:w-full border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right'
75
116
  }
76
117
  },
77
118
  defaultVariants: {
@@ -79,15 +120,7 @@ const sheetVariants = (0, class_variance_authority_1.cva)('fixed z-50 gap-4 bg-b
79
120
  }
80
121
  });
81
122
  function SheetContent({ side = 'right', className, children, onInteractOutside, ...props }) {
82
- const handleInteractOutside = React.useCallback((event) => {
83
- const target = event.target;
84
- if (target?.closest('[data-sonner-toaster]')) {
85
- event.preventDefault();
86
- return;
87
- }
88
- onInteractOutside?.(event);
89
- }, [onInteractOutside]);
90
- return ((0, jsx_runtime_1.jsxs)(SheetPortal, { children: [(0, jsx_runtime_1.jsx)(SheetOverlay, {}), (0, jsx_runtime_1.jsxs)(SheetPrimitive.Content, { "data-slot": "sheet-content", className: (0, utils_1.cn)('flex max-h-screen flex-col overflow-x-auto px-8 pb-0', sheetVariants({ side }), className), onInteractOutside: handleInteractOutside, ...props, children: [children, (0, jsx_runtime_1.jsxs)(SheetPrimitive.Close, { className: "data-[state=open]:bg-secondary absolute top-7 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-hidden disabled:pointer-events-none", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-6 w-6" }), (0, jsx_runtime_1.jsx)("span", { className: "sr-only", children: "Close" })] })] })] }));
123
+ return ((0, jsx_runtime_1.jsxs)(SheetPortal, { children: [(0, jsx_runtime_1.jsx)(SheetOverlay, {}), (0, jsx_runtime_1.jsxs)(SheetPrimitive.Content, { "data-slot": "sheet-content", className: (0, utils_1.cn)('flex max-h-screen flex-col overflow-x-auto px-8 pb-0', sheetVariants({ side }), className), onInteractOutside: (0, utils_1.keepOpenOnToast)(onInteractOutside), ...props, children: [children, (0, jsx_runtime_1.jsxs)(SheetPrimitive.Close, { className: "data-[state=open]:bg-secondary ring-offset-background focus-visible:ring-ring absolute top-7 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-6 w-6" }), (0, jsx_runtime_1.jsx)("span", { className: "sr-only", children: "Close" })] })] })] }));
91
124
  }
92
125
  function SheetHeader({ className, ...props }) {
93
126
  return ((0, jsx_runtime_1.jsx)("div", { "data-slot": "sheet-header", className: (0, utils_1.cn)('mb-4 flex flex-col space-y-2 text-center sm:text-left', className), ...props }));
@@ -99,5 +132,5 @@ function SheetTitle({ className, ...props }) {
99
132
  return ((0, jsx_runtime_1.jsx)(SheetPrimitive.Title, { "data-slot": "sheet-title", className: (0, utils_1.cn)('text-muted-foreground mb-2 flex text-xl font-bold', className), ...props }));
100
133
  }
101
134
  function SheetDescription({ className, ...props }) {
102
- return ((0, jsx_runtime_1.jsx)(SheetPrimitive.Description, { "data-slot": "sheet-description", className: (0, utils_1.cn)('text-shadcn-500 text-sm font-medium', className), ...props }));
135
+ return ((0, jsx_runtime_1.jsx)(SheetPrimitive.Description, { "data-slot": "sheet-description", className: (0, utils_1.cn)('text-muted-foreground text-sm font-medium', className), ...props }));
103
136
  }
@@ -4,6 +4,7 @@ export * from './sidebar-item-icon-button';
4
4
  export * from './sidebar-item-button';
5
5
  export * from './sidebar-item';
6
6
  export * from './sidebar-expand-button';
7
+ export * from './sidebar-trigger';
7
8
  export * from './sidebar-back-button';
8
9
  export * from './sidebar-provider';
9
10
  export * from './sidebar-item-collapsible';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/sidebar/index.tsx"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/sidebar/index.tsx"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,kBAAkB,CAAA"}
@@ -20,6 +20,7 @@ __exportStar(require("./sidebar-item-icon-button"), exports);
20
20
  __exportStar(require("./sidebar-item-button"), exports);
21
21
  __exportStar(require("./sidebar-item"), exports);
22
22
  __exportStar(require("./sidebar-expand-button"), exports);
23
+ __exportStar(require("./sidebar-trigger"), exports);
23
24
  __exportStar(require("./sidebar-back-button"), exports);
24
25
  __exportStar(require("./sidebar-provider"), exports);
25
26
  __exportStar(require("./sidebar-item-collapsible"), exports);
@@ -7,6 +7,6 @@ type SidebarExpandButtonProps = {
7
7
  */
8
8
  tooltip?: string;
9
9
  };
10
- export declare const SidebarExpandButton: ({ tooltip }: SidebarExpandButtonProps) => React.JSX.Element;
10
+ export declare const SidebarExpandButton: ({ tooltip }: SidebarExpandButtonProps) => React.JSX.Element | null;
11
11
  export {};
12
12
  //# sourceMappingURL=sidebar-expand-button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar-expand-button.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/sidebar/sidebar-expand-button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAYzB,KAAK,wBAAwB,GAAG;IAC9B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,aAAa,wBAAwB,sBAyDxE,CAAA"}
1
+ {"version":3,"file":"sidebar-expand-button.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/sidebar/sidebar-expand-button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAYzB,KAAK,wBAAwB,GAAG;IAC9B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,aAAa,wBAAwB,6BAwExE,CAAA"}
@@ -13,7 +13,21 @@ const sidebar_components_1 = require("./sidebar-components");
13
13
  const tooltip_1 = require("../../ui/tooltip");
14
14
  const icon_button_1 = require("../icon-button");
15
15
  const SidebarExpandButton = ({ tooltip }) => {
16
- const { isCollapsed, toggleSidebar } = (0, sidebar_provider_1.useSidebar)();
16
+ const { isCollapsed, isDrawer, toggleSidebar } = (0, sidebar_provider_1.useSidebar)();
17
+ /**
18
+ * Nothing to collapse in a drawer. The expanded branch below hangs its button
19
+ * at `right-[-20px]`, twenty pixels outside the rail — off the canvas of an
20
+ * overlay that has no page beside it — and collapsing to a 72px strip inside
21
+ * a 244px sheet is not a state worth reaching. The drawer's own close control
22
+ * and the backdrop are how it is dismissed.
23
+ *
24
+ * ⚠️ `isDrawer`, NOT `isMobile`. A consumer left on the default
25
+ * `mobile="inline"` still has a real rail below 768px, and its collapse
26
+ * control has to come with it.
27
+ */
28
+ if (isDrawer) {
29
+ return null;
30
+ }
17
31
  return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [!isCollapsed && ((0, jsx_runtime_1.jsx)("div", { "data-slot": "sidebar-expand-button", className: "border-border bg-card flex w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "absolute right-[-20px] bottom-4", children: (0, jsx_runtime_1.jsx)(icon_button_1.IconButton, { variant: "secondary", rounded: true, onClick: toggleSidebar, "aria-label": tooltip || 'Collapse sidebar', "aria-expanded": true, children: (0, jsx_runtime_1.jsx)(lucide_react_1.PanelLeftClose, { className: "text-muted-foreground" }) }) }) })), isCollapsed && ((0, jsx_runtime_1.jsx)(sidebar_components_1.SidebarFooter, { children: (0, jsx_runtime_1.jsx)(tooltip_1.TooltipProvider, { children: (0, jsx_runtime_1.jsxs)(tooltip_1.Tooltip, { children: [(0, jsx_runtime_1.jsx)(tooltip_1.TooltipTrigger
18
32
  // `hover:text-accent-foreground` on the TRIGGER, not only on
19
33
  // the glyph below. The base ink here used to be base/400, which
@@ -9,5 +9,5 @@ export type SidebarItemProps = React.ComponentProps<typeof SidebarItemButton> &
9
9
  disabled?: boolean;
10
10
  children?: React.ReactNode;
11
11
  };
12
- export declare const SidebarItem: ({ active, href, children: _children, ...props }: SidebarItemProps) => React.JSX.Element;
12
+ export declare const SidebarItem: ({ active, href, children: _children, onClick, ...props }: SidebarItemProps) => React.JSX.Element;
13
13
  //# sourceMappingURL=sidebar-item.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar-item.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/sidebar/sidebar-item.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAIlE,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,GAC3E,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,GAAG;IACnD,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CAAA;AAEH,eAAO,MAAM,WAAW,GAAI,iDAKzB,gBAAgB,sBA0BlB,CAAA"}
1
+ {"version":3,"file":"sidebar-item.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/sidebar/sidebar-item.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAIlE,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,GAC3E,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,GAAG;IACnD,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CAAA;AAEH,eAAO,MAAM,WAAW,GAAI,0DAMzB,gBAAgB,sBAsDlB,CAAA"}
@@ -7,14 +7,38 @@ const sidebar_item_button_1 = require("./sidebar-item-button");
7
7
  const sidebar_item_icon_button_1 = require("./sidebar-item-icon-button");
8
8
  const sidebar_provider_1 = require("./sidebar-provider");
9
9
  const sidebar_router_1 = require("./sidebar-router");
10
- const SidebarItem = ({ active, href, children: _children, ...props }) => {
10
+ const SidebarItem = ({ active, href, children: _children, onClick, ...props }) => {
11
11
  const { usePathname } = (0, sidebar_router_1.useSidebarRouter)();
12
12
  const pathname = usePathname();
13
- const { isCollapsed } = (0, sidebar_provider_1.useSidebar)();
13
+ const { isCollapsed, isDrawer, setOpenMobile } = (0, sidebar_provider_1.useSidebar)();
14
14
  const isActive = (href) => pathname === href;
15
+ /**
16
+ * ⛔ ACTIVATING A DESTINATION CLOSES THE DRAWER. It is the whole point of the
17
+ * drawer and it was the one interaction that left it open: Escape, the
18
+ * backdrop and the X all dismissed it, a navigation link did not.
19
+ *
20
+ * The overlay is modal, so `document.body` carries `pointer-events: none`
21
+ * while it is up, and a consumer's `SidebarItem` is a client-side `Link`
22
+ * under a provider that survives the route change — so the reader landed on
23
+ * the new page rendered INERT behind a drawer they had to dismiss a second
24
+ * time, on a phone.
25
+ *
26
+ * Here rather than in `SidebarRoot`, because this is the component that knows
27
+ * an activation happened; `SidebarBackButton` and every
28
+ * `SidebarItemCollapsibleContent` leaf render through it, so they are covered
29
+ * by construction. Guarded on `isDrawer` so an inline rail — where nothing is
30
+ * covering the page — behaves exactly as before, and the consumer's own
31
+ * handler still runs either way.
32
+ */
33
+ const handleClick = (event) => {
34
+ onClick?.(event);
35
+ if (isDrawer) {
36
+ setOpenMobile(false);
37
+ }
38
+ };
15
39
  if (isCollapsed) {
16
- return ((0, jsx_runtime_1.jsx)(sidebar_item_icon_button_1.SidebarItemIconButton, { "data-slot": "sidebar-item", href: href, active: isActive(href) || active, ...props }));
40
+ return ((0, jsx_runtime_1.jsx)(sidebar_item_icon_button_1.SidebarItemIconButton, { "data-slot": "sidebar-item", href: href, active: isActive(href) || active, onClick: handleClick, ...props }));
17
41
  }
18
- return ((0, jsx_runtime_1.jsx)(sidebar_item_button_1.SidebarItemButton, { "data-slot": "sidebar-item", href: href, active: isActive(href) || active, ...props }));
42
+ return ((0, jsx_runtime_1.jsx)(sidebar_item_button_1.SidebarItemButton, { "data-slot": "sidebar-item", href: href, active: isActive(href) || active, onClick: handleClick, ...props }));
19
43
  };
20
44
  exports.SidebarItem = SidebarItem;
@@ -1,12 +1,70 @@
1
1
  import React from 'react';
2
+ /**
3
+ * The viewport below which the rail stops being a layout and becomes a drawer.
4
+ *
5
+ * ⛔ THE NEGATION OF THE TRIGGER'S QUERY, SPELLED AS A NEGATION.
6
+ *
7
+ * `SidebarTrigger` hides itself at `min-[768px]`, which is `width >= 768`. This
8
+ * is its exact complement AT ANY PRECISION, which `(max-width: 767px)` was not:
9
+ * that pair leaves the open interval (767, 768) matched by neither rule, and a
10
+ * viewport there draws the rail AND a hamburger that opens nothing — with the
11
+ * rail inline, `SidebarRoot` mounts no `Sheet`, so the control is dead. Chromium
12
+ * snaps its layout viewport to a whole pixel and never lands there, measured at
13
+ * four zoom levels; that is a rounding behaviour to rely on, not a boundary.
14
+ *
15
+ * ⚠️ THE PAIR HAS TO BE IN THE SAME UNIT. It used to be `md:hidden` over there,
16
+ * and `md` is 48rem: rem in a media query follows the BROWSER'S default font
17
+ * size, so at Chrome's "Small" setting that class hid the hamburger from 576px
18
+ * while this query still asked for a drawer up to 767px — a band of viewports
19
+ * with no navigation at all. Anything else that hides or shows a control at
20
+ * this boundary states it in pixels for the same reason.
21
+ *
22
+ * Media Queries Level 4 boolean logic, which is not a new requirement here:
23
+ * Tailwind v4 emits MQ4 RANGE syntax for everything this package ships —
24
+ * `min-[768px]` on the trigger compiles to `@media (width >= 768px)` and
25
+ * `max-sm:` on `SheetContent` to `@media (width < 40rem)` — and range syntax
26
+ * and boolean `not` landed in the same browsers (Chrome 88, Firefox 64,
27
+ * Safari 16.4). `(width < 768px)` is the equivalent range spelling of this
28
+ * line, should a reader prefer the pair to match character for character.
29
+ */
30
+ export declare const SIDEBAR_MOBILE_QUERY = "not (min-width: 768px)";
2
31
  export type SidebarContextProps = {
3
32
  isCollapsed: boolean;
33
+ /**
34
+ * True only inside a drawer that `SidebarRoot` is actually rendering, which
35
+ * needs `mobile="drawer"` as well as a narrow viewport. `SidebarRoot`
36
+ * re-provides the context for that subtree; nothing else sets it.
37
+ */
38
+ isDrawer: boolean;
39
+ /**
40
+ * True while the viewport is narrow enough for a drawer. Reported in BOTH
41
+ * modes, so a consumer still on `mobile="inline"` can build its own
42
+ * responsive behaviour from it.
43
+ */
44
+ isMobile: boolean;
45
+ /** Whether the mobile drawer is showing. Meaningless while `isMobile` is false. */
46
+ openMobile: boolean;
47
+ setOpenMobile: (open: boolean) => void;
48
+ /**
49
+ * Puts focus back on whatever opened the drawer. `SidebarRoot` calls it when
50
+ * the drawer closes; nothing else should need it.
51
+ */
52
+ restoreDrawerFocus: () => void;
53
+ /** The drawer's DOM id, so `SidebarTrigger` can point `aria-controls` at it. */
54
+ sidebarId: string;
4
55
  items: Record<string, boolean>;
5
56
  setItems: React.Dispatch<React.SetStateAction<Record<string, boolean>>>;
6
57
  getItemCollapsed: (key: string) => boolean;
7
58
  setItemCollapsed: (key: string, value: boolean) => void;
8
59
  toggleSidebar: () => void;
9
60
  };
61
+ /**
62
+ * Exported so `SidebarRoot` can re-provide it for the drawer's subtree. That
63
+ * subtree is the only place `isCollapsed` and `isDrawer` differ from the
64
+ * provider's own values, and scoping the override to it is what keeps a
65
+ * consumer on `mobile="inline"` seeing exactly today's rail.
66
+ */
67
+ export declare const SidebarContext: React.Context<SidebarContextProps | undefined>;
10
68
  export declare const useSidebar: () => SidebarContextProps;
11
69
  export declare const SidebarProvider: ({ children }: React.PropsWithChildren) => React.JSX.Element;
12
70
  //# sourceMappingURL=sidebar-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar-provider.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/sidebar/sidebar-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,EAAE,O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AE,OAAO,CAAC,CAAC,CAAC,CAAA;IACvE,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAA;IAC1C,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IACvD,aAAa,EAAE,MAAM,IAAI,CAAA;CAC1B,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,gDAEf,CAAA;AAEZ,eAAO,MAAM,UAAU,2BAMtB,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,cAAc,KAAK,CAAC,iBAAiB,sBAkKpE,CAAA"}
@@ -4,13 +4,55 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.SidebarProvider = exports.useSidebar = void 0;
7
+ exports.SidebarProvider = exports.useSidebar = exports.SidebarContext = exports.SIDEBAR_MOBILE_QUERY = void 0;
8
8
  const jsx_runtime_1 = require("react/jsx-runtime");
9
9
  const react_1 = __importDefault(require("react"));
10
10
  const storage_1 = require("../../../lib/storage");
11
- const SidebarContext = react_1.default.createContext(undefined);
11
+ /**
12
+ * The viewport below which the rail stops being a layout and becomes a drawer.
13
+ *
14
+ * ⛔ THE NEGATION OF THE TRIGGER'S QUERY, SPELLED AS A NEGATION.
15
+ *
16
+ * `SidebarTrigger` hides itself at `min-[768px]`, which is `width >= 768`. This
17
+ * is its exact complement AT ANY PRECISION, which `(max-width: 767px)` was not:
18
+ * that pair leaves the open interval (767, 768) matched by neither rule, and a
19
+ * viewport there draws the rail AND a hamburger that opens nothing — with the
20
+ * rail inline, `SidebarRoot` mounts no `Sheet`, so the control is dead. Chromium
21
+ * snaps its layout viewport to a whole pixel and never lands there, measured at
22
+ * four zoom levels; that is a rounding behaviour to rely on, not a boundary.
23
+ *
24
+ * ⚠️ THE PAIR HAS TO BE IN THE SAME UNIT. It used to be `md:hidden` over there,
25
+ * and `md` is 48rem: rem in a media query follows the BROWSER'S default font
26
+ * size, so at Chrome's "Small" setting that class hid the hamburger from 576px
27
+ * while this query still asked for a drawer up to 767px — a band of viewports
28
+ * with no navigation at all. Anything else that hides or shows a control at
29
+ * this boundary states it in pixels for the same reason.
30
+ *
31
+ * Media Queries Level 4 boolean logic, which is not a new requirement here:
32
+ * Tailwind v4 emits MQ4 RANGE syntax for everything this package ships —
33
+ * `min-[768px]` on the trigger compiles to `@media (width >= 768px)` and
34
+ * `max-sm:` on `SheetContent` to `@media (width < 40rem)` — and range syntax
35
+ * and boolean `not` landed in the same browsers (Chrome 88, Firefox 64,
36
+ * Safari 16.4). `(width < 768px)` is the equivalent range spelling of this
37
+ * line, should a reader prefer the pair to match character for character.
38
+ */
39
+ exports.SIDEBAR_MOBILE_QUERY = 'not (min-width: 768px)';
40
+ /**
41
+ * Where focus goes when the rail has to receive it. The rail's own content is
42
+ * links and buttons, so this is deliberately the short list rather than the
43
+ * full tabbable grammar: a `[tabindex]` sweep would have to exclude `-1`, and
44
+ * nothing in a sidebar carries one.
45
+ */
46
+ const FOCUSABLE = 'a[href], button:not([disabled])';
47
+ /**
48
+ * Exported so `SidebarRoot` can re-provide it for the drawer's subtree. That
49
+ * subtree is the only place `isCollapsed` and `isDrawer` differ from the
50
+ * provider's own values, and scoping the override to it is what keeps a
51
+ * consumer on `mobile="inline"` seeing exactly today's rail.
52
+ */
53
+ exports.SidebarContext = react_1.default.createContext(undefined);
12
54
  const useSidebar = () => {
13
- const context = react_1.default.useContext(SidebarContext);
55
+ const context = react_1.default.useContext(exports.SidebarContext);
14
56
  if (!context) {
15
57
  throw new Error('useSidebar must be used within a SidebarProvider');
16
58
  }
@@ -21,6 +63,61 @@ const SidebarProvider = ({ children }) => {
21
63
  const [hydrated, setHydrated] = react_1.default.useState(false);
22
64
  const [collapsed, setCollapsed] = react_1.default.useState(false);
23
65
  const [items, _setItems] = react_1.default.useState({});
66
+ const [isMobile, setIsMobile] = react_1.default.useState(false);
67
+ const [openMobile, _setOpenMobile] = react_1.default.useState(false);
68
+ const sidebarId = react_1.default.useId();
69
+ /**
70
+ * ⛔ RADIX CANNOT RESTORE THIS FOCUS BY ITSELF. `DialogContent` preventDefaults
71
+ * the focus scope's own restore and focuses `triggerRef.current` instead —
72
+ * the ref a `SheetTrigger` would have filled. The drawer is opened from this
73
+ * state rather than from a trigger inside the dialog, so that ref is null and
74
+ * closing dropped focus onto `<body>`: a keyboard reader who opened the
75
+ * navigation and pressed Escape was returned to the top of the document.
76
+ *
77
+ * Captured here rather than in `SidebarTrigger` so that a consumer opening
78
+ * the drawer from its own control gets the same behaviour.
79
+ */
80
+ const opener = react_1.default.useRef(null);
81
+ const setOpenMobile = react_1.default.useCallback((open) => {
82
+ if (open && typeof document !== 'undefined') {
83
+ opener.current = document.activeElement;
84
+ }
85
+ _setOpenMobile(open);
86
+ }, []);
87
+ /**
88
+ * ⛔ THE VIEWPORT AT THE MOMENT FOCUS MOVES, NOT AT THE MOMENT IT OPENED.
89
+ *
90
+ * Radix calls `restoreDrawerFocus` from the focus scope's UNMOUNT handler,
91
+ * which is the last thing in the commit to touch focus — later than any
92
+ * effect in this provider, so the decision has to be made inside the handler
93
+ * rather than beside it. By then `isMobile` has already flipped.
94
+ */
95
+ const isMobileRef = react_1.default.useRef(false);
96
+ isMobileRef.current = isMobile;
97
+ const restoreDrawerFocus = react_1.default.useCallback(() => {
98
+ // `isConnected`: the control that opened the drawer may itself have been
99
+ // unmounted by whatever the reader did inside it.
100
+ //
101
+ // ⛔ AND NOT AT ALL WHEN THE VIEWPORT IS THE ONE THAT DISMISSED IT. A
102
+ // tablet rotated from portrait to landscape with the navigation open
103
+ // crosses 768px, so the drawer is replaced by the rail and the opener is
104
+ // `SidebarTrigger` — which the same breakpoint just hid.
105
+ // `.focus()` on a `display: none` element is a silent no-op, and Radix's
106
+ // own restore is already `preventDefault()`ed, so focus fell to `<body>`
107
+ // and the reader lost their place (SC 2.4.3). Measured in Chromium at
108
+ // 390 → 1280: `{"rails":1,"triggerDisplay":"none","focus":"BODY:"}`.
109
+ if (isMobileRef.current && opener.current?.isConnected) {
110
+ opener.current.focus();
111
+ return;
112
+ }
113
+ // The rail is what the drawer became, so that is where the reader goes.
114
+ // Below the breakpoint there is nothing here to find — a closed drawer
115
+ // leaves no navigation in the DOM — and focus stays where Radix left it.
116
+ document
117
+ .getElementById(sidebarId)
118
+ ?.querySelector(FOCUSABLE)
119
+ ?.focus();
120
+ }, [sidebarId]);
24
121
  const toggleSidebar = () => setCollapsed((collapsed) => !collapsed);
25
122
  const getItemCollapsed = (key) => {
26
123
  return items[key] || false;
@@ -34,6 +131,37 @@ const SidebarProvider = ({ children }) => {
34
131
  _setItems((0, storage_1.getStorageObject)('sidebar-items', {}));
35
132
  setHydrated(true);
36
133
  }, []);
134
+ /**
135
+ * ⚠️ FALSE UNTIL THE CLIENT SAYS OTHERWISE. There is no viewport on the
136
+ * server, so the first paint is always the rail and the drawer appears on
137
+ * hydration; starting from a guess would make the markup differ between the
138
+ * two renders. The `matchMedia` guard is the one `theme-provider.tsx` next
139
+ * door already carries: jsdom and some embedded runtimes ship without it, and
140
+ * a missing media API is a desktop, not a crash.
141
+ */
142
+ react_1.default.useEffect(() => {
143
+ if (typeof window.matchMedia !== 'function') {
144
+ return;
145
+ }
146
+ const media = window.matchMedia(exports.SIDEBAR_MOBILE_QUERY);
147
+ const sync = () => setIsMobile(media.matches);
148
+ sync();
149
+ media.addEventListener('change', sync);
150
+ return () => media.removeEventListener('change', sync);
151
+ }, []);
152
+ /**
153
+ * A drawer left open while the viewport grows back would keep an overlay and
154
+ * a focus trap over a layout that is already showing its rail, with nothing
155
+ * on screen to dismiss them.
156
+ *
157
+ * Where focus goes afterwards is `restoreDrawerFocus`'s decision, not this
158
+ * effect's: Radix's unmount handler runs later than anything here.
159
+ */
160
+ react_1.default.useEffect(() => {
161
+ if (!isMobile) {
162
+ _setOpenMobile(false);
163
+ }
164
+ }, [isMobile]);
37
165
  // Only persist to localStorage after hydration to avoid overwriting stored values
38
166
  react_1.default.useEffect(() => {
39
167
  if (!hydrated) {
@@ -47,8 +175,22 @@ const SidebarProvider = ({ children }) => {
47
175
  }
48
176
  localStorage.setItem('sidebar-items', JSON.stringify(items));
49
177
  }, [items, hydrated]);
50
- return ((0, jsx_runtime_1.jsx)(SidebarContext.Provider, { value: {
178
+ return ((0, jsx_runtime_1.jsx)(exports.SidebarContext.Provider, { value: {
179
+ /**
180
+ * ⚠️ A NARROW VIEWPORT DOES NOT TOUCH THIS. It used to be forced false
181
+ * whenever `isMobile`, which silently changed the rail for every
182
+ * consumer — including the ones that never asked for a drawer.
183
+ * `SidebarRoot` overrides it for the drawer's own subtree instead, so
184
+ * the stored preference reaches an inline rail unchanged at every
185
+ * viewport.
186
+ */
51
187
  isCollapsed: collapsed,
188
+ isDrawer: false,
189
+ isMobile,
190
+ openMobile,
191
+ setOpenMobile,
192
+ restoreDrawerFocus,
193
+ sidebarId,
52
194
  items,
53
195
  setItems: _setItems,
54
196
  getItemCollapsed,
@@ -1,3 +1,40 @@
1
1
  import React from 'react';
2
- export declare const SidebarRoot: ({ className, ...props }: React.ComponentProps<"nav">) => React.JSX.Element;
2
+ export type SidebarRootProps = React.ComponentProps<'nav'> & {
3
+ /**
4
+ * What this rail becomes below 768px.
5
+ *
6
+ * - `'inline'` (default): nothing changes. The rail renders at every
7
+ * viewport exactly as it always has, and the reader's collapsed preference
8
+ * is untouched.
9
+ * - `'drawer'`: the inline rail is not rendered below the breakpoint and the
10
+ * navigation moves into an overlay drawer that `SidebarTrigger` opens.
11
+ *
12
+ * ⛔ THE DEFAULT IS NOT A TASTE, IT IS A CONSUMER-SAFETY RULE. `SidebarTrigger`
13
+ * is the only way back into the drawer and it must render inside
14
+ * `SidebarProvider`. A consumer that has not placed one yet — which is every
15
+ * consumer at the moment this shipped — would get a phone with NO navigation
16
+ * rather than a rail that takes 63% of it, and that is strictly worse. Opt in
17
+ * once there is somewhere to put the trigger.
18
+ */
19
+ mobile?: 'inline' | 'drawer';
20
+ /**
21
+ * The drawer's accessible name. A dialog needs one, and it is read out when
22
+ * the drawer opens. Unused while `mobile` is `'inline'`.
23
+ */
24
+ mobileTitle?: string;
25
+ };
26
+ /**
27
+ * ⛔ BELOW 768px A RAIL IS NOT A LAYOUT — once a consumer opts in.
28
+ *
29
+ * The widths above are a fixed share of a flex row, so at 390px the expanded
30
+ * rail took 63% of the screen and left the page 146px, and the only affordance
31
+ * — `SidebarExpandButton` — shrinks it to 72px, which is still 18% and still
32
+ * permanently on screen. There was nothing that removed it.
33
+ *
34
+ * With `mobile="drawer"` the rail is replaced below the breakpoint by an
35
+ * overlay drawer. Escape, the backdrop click, the focus trap and returning
36
+ * focus to whatever opened it are Radix Dialog's, through the kit's own
37
+ * `Sheet`; none of that is re-implemented here.
38
+ */
39
+ export declare const SidebarRoot: ({ className, id, mobile, mobileTitle, ...props }: SidebarRootProps) => React.JSX.Element;
3
40
  //# sourceMappingURL=sidebar-root.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar-root.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/sidebar/sidebar-root.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAoBzB,eAAO,MAAM,WAAW,GAAI,yBAGzB,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,sBAW7B,CAAA"}
1
+ {"version":3,"file":"sidebar-root.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/sidebar/sidebar-root.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAqEzB,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAC3D;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC5B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,GAAI,kDAMzB,gBAAgB,sBAqHlB,CAAA"}