@soroush.tech/design-system 1.3.3 → 2.0.0-alpha.1

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 (218) hide show
  1. package/README.md +45 -7
  2. package/dist/AppBar.d.cts +3 -3
  3. package/dist/AppBar.d.mts +3 -3
  4. package/dist/Avatar.cjs +1 -1
  5. package/dist/Avatar.d.cts +3 -3
  6. package/dist/Avatar.d.mts +3 -3
  7. package/dist/Avatar.mjs +1 -1
  8. package/dist/Backdrop.d.cts +1 -1
  9. package/dist/Backdrop.d.mts +1 -1
  10. package/dist/Button.cjs +1 -1
  11. package/dist/Button.d.cts +1 -1
  12. package/dist/Button.d.mts +1 -1
  13. package/dist/Button.mjs +1 -1
  14. package/dist/ButtonGroup.d.cts +1 -1
  15. package/dist/ButtonGroup.d.mts +1 -1
  16. package/dist/Card.cjs +2 -2
  17. package/dist/Card.d.cts +3 -3
  18. package/dist/Card.d.mts +3 -3
  19. package/dist/Card.mjs +2 -2
  20. package/dist/Checkbox.d.cts +2 -2
  21. package/dist/Checkbox.d.mts +2 -2
  22. package/dist/CircularProgress.d.cts +3 -3
  23. package/dist/CircularProgress.d.mts +3 -3
  24. package/dist/Drawer.cjs +109 -17
  25. package/dist/Drawer.d.cts +43 -7
  26. package/dist/Drawer.d.mts +43 -7
  27. package/dist/Drawer.mjs +109 -18
  28. package/dist/Flex.cjs +6 -2
  29. package/dist/Flex.d.cts +1 -1
  30. package/dist/Flex.d.mts +1 -1
  31. package/dist/Flex.mjs +6 -2
  32. package/dist/Form.d.cts +1 -1
  33. package/dist/Form.d.mts +1 -1
  34. package/dist/FormControl.cjs +1 -1
  35. package/dist/FormControl.d.cts +2 -2
  36. package/dist/FormControl.d.mts +2 -2
  37. package/dist/FormControl.mjs +1 -1
  38. package/dist/FormHelperText.d.cts +1 -1
  39. package/dist/FormHelperText.d.mts +1 -1
  40. package/dist/FormLabel.d.cts +1 -1
  41. package/dist/FormLabel.d.mts +1 -1
  42. package/dist/Grid.cjs +7 -2
  43. package/dist/Grid.d.cts +9 -5
  44. package/dist/Grid.d.mts +9 -5
  45. package/dist/Grid.mjs +7 -2
  46. package/dist/{Icon-gSiGgU13.mjs → Icon-BGcd6yy0.mjs} +1 -1
  47. package/dist/{Icon-BAMpe9SO.cjs → Icon-Cn6Zx8wb.cjs} +1 -1
  48. package/dist/Icon.cjs +1 -1
  49. package/dist/Icon.d.cts +1 -1
  50. package/dist/Icon.d.mts +1 -1
  51. package/dist/Icon.mjs +1 -1
  52. package/dist/Image.d.cts +2 -2
  53. package/dist/Image.d.mts +2 -2
  54. package/dist/LinearProgress.d.cts +3 -3
  55. package/dist/LinearProgress.d.mts +3 -3
  56. package/dist/Link.cjs +1 -1
  57. package/dist/Link.d.cts +1 -1
  58. package/dist/Link.d.mts +1 -1
  59. package/dist/Link.mjs +1 -1
  60. package/dist/MenuItem.cjs +2 -2
  61. package/dist/MenuItem.d.cts +2 -2
  62. package/dist/MenuItem.d.mts +2 -2
  63. package/dist/MenuItem.mjs +2 -2
  64. package/dist/Modal.cjs +1 -1
  65. package/dist/Modal.d.cts +1 -1
  66. package/dist/Modal.d.mts +1 -1
  67. package/dist/Modal.mjs +1 -1
  68. package/dist/NativeSelect.cjs +2 -2
  69. package/dist/NativeSelect.d.cts +3 -3
  70. package/dist/NativeSelect.d.mts +3 -3
  71. package/dist/NativeSelect.mjs +2 -2
  72. package/dist/Pagination/PaginationItem.cjs +1 -1
  73. package/dist/Pagination/PaginationItem.d.cts +1 -1
  74. package/dist/Pagination/PaginationItem.d.mts +1 -1
  75. package/dist/Pagination/PaginationItem.mjs +1 -1
  76. package/dist/Pagination.d.cts +2 -2
  77. package/dist/Pagination.d.mts +2 -2
  78. package/dist/Paper.cjs +1 -1
  79. package/dist/Paper.d.cts +1 -1
  80. package/dist/Paper.d.mts +1 -1
  81. package/dist/Paper.mjs +1 -1
  82. package/dist/{Popover-gg44qzwo.cjs → Popover-CrSABgRk.cjs} +2 -2
  83. package/dist/{Popover-Bq31OTEl.mjs → Popover-DlpXdcwt.mjs} +2 -2
  84. package/dist/Popover.cjs +1 -1
  85. package/dist/Popover.d.cts +4 -4
  86. package/dist/Popover.d.mts +4 -4
  87. package/dist/Popover.mjs +1 -1
  88. package/dist/Pressable.cjs +1 -1
  89. package/dist/Pressable.d.cts +1 -1
  90. package/dist/Pressable.d.mts +1 -1
  91. package/dist/Pressable.mjs +1 -1
  92. package/dist/Quote.d.cts +4 -4
  93. package/dist/Quote.d.mts +4 -4
  94. package/dist/Radio.d.cts +2 -2
  95. package/dist/Radio.d.mts +2 -2
  96. package/dist/Select.cjs +3 -3
  97. package/dist/Select.d.cts +3 -3
  98. package/dist/Select.d.mts +3 -3
  99. package/dist/Select.mjs +3 -3
  100. package/dist/Sidebar/Sidebar.d.cts +1 -1
  101. package/dist/Sidebar/Sidebar.d.mts +1 -1
  102. package/dist/Sidebar/SidebarItem.cjs +1 -1
  103. package/dist/Sidebar/SidebarItem.d.cts +4 -4
  104. package/dist/Sidebar/SidebarItem.d.mts +4 -4
  105. package/dist/Sidebar/SidebarItem.mjs +1 -1
  106. package/dist/Skeleton.d.cts +2 -2
  107. package/dist/Skeleton.d.mts +2 -2
  108. package/dist/Switch.cjs +1 -1
  109. package/dist/Switch.d.cts +2 -2
  110. package/dist/Switch.d.mts +2 -2
  111. package/dist/Switch.mjs +1 -1
  112. package/dist/Table/Table.d.cts +3 -3
  113. package/dist/Table/Table.d.mts +3 -3
  114. package/dist/Table/TableBody.d.cts +2 -2
  115. package/dist/Table/TableBody.d.mts +2 -2
  116. package/dist/Table/TableCell.d.cts +1 -1
  117. package/dist/Table/TableCell.d.mts +1 -1
  118. package/dist/Table/TableContainer.d.cts +4 -4
  119. package/dist/Table/TableContainer.d.mts +4 -4
  120. package/dist/Table/TableControl.d.cts +1 -1
  121. package/dist/Table/TableControl.d.mts +1 -1
  122. package/dist/Table/TableFooter.d.cts +2 -2
  123. package/dist/Table/TableFooter.d.mts +2 -2
  124. package/dist/Table/TableHead.d.cts +2 -2
  125. package/dist/Table/TableHead.d.mts +2 -2
  126. package/dist/Table/TablePagination.d.cts +2 -2
  127. package/dist/Table/TablePagination.d.mts +2 -2
  128. package/dist/Table/TablePaginationActions.cjs +1 -1
  129. package/dist/Table/TablePaginationActions.d.cts +1 -1
  130. package/dist/Table/TablePaginationActions.d.mts +1 -1
  131. package/dist/Table/TablePaginationActions.mjs +1 -1
  132. package/dist/Table/TableRow.d.cts +2 -2
  133. package/dist/Table/TableRow.d.mts +2 -2
  134. package/dist/Table/TableSortLabel.cjs +1 -1
  135. package/dist/Table/TableSortLabel.d.cts +1 -1
  136. package/dist/Table/TableSortLabel.d.mts +1 -1
  137. package/dist/Table/TableSortLabel.mjs +1 -1
  138. package/dist/Table/hooks.d.cts +1 -1
  139. package/dist/Table/hooks.d.mts +1 -1
  140. package/dist/Table.d.cts +5 -5
  141. package/dist/Table.d.mts +5 -5
  142. package/dist/{TableContext-BrIREKe7.d.mts → TableContext-98M9MAm7.d.cts} +1 -1
  143. package/dist/{TableContext-DXzUQ4-a.d.cts → TableContext-BwK_fB9Q.d.mts} +1 -1
  144. package/dist/TextInput.cjs +1 -1
  145. package/dist/TextInput.d.cts +2 -2
  146. package/dist/TextInput.d.mts +2 -2
  147. package/dist/TextInput.mjs +1 -1
  148. package/dist/ToggleButton/ToggleButton.cjs +1 -1
  149. package/dist/ToggleButton/ToggleButton.d.cts +1 -1
  150. package/dist/ToggleButton/ToggleButton.d.mts +1 -1
  151. package/dist/ToggleButton/ToggleButton.mjs +1 -1
  152. package/dist/ToggleButton/ToggleButtonGroup.cjs +1 -1
  153. package/dist/ToggleButton/ToggleButtonGroup.d.cts +1 -1
  154. package/dist/ToggleButton/ToggleButtonGroup.d.mts +1 -1
  155. package/dist/ToggleButton/ToggleButtonGroup.mjs +1 -1
  156. package/dist/Typography.cjs +1 -1
  157. package/dist/Typography.d.cts +2 -2
  158. package/dist/Typography.d.mts +2 -2
  159. package/dist/Typography.mjs +1 -1
  160. package/dist/View.cjs +2 -1
  161. package/dist/View.d.cts +1 -1
  162. package/dist/View.d.mts +1 -1
  163. package/dist/View.mjs +2 -1
  164. package/dist/engine.d.cts +1 -1
  165. package/dist/engine.d.mts +1 -1
  166. package/dist/{index-C-2VKPcp.d.mts → index-6BHvkjdp.d.cts} +3 -3
  167. package/dist/{index-DQ16ijxx.d.mts → index-AlVOmB-K.d.mts} +4 -4
  168. package/dist/{index-Btmdtbpb.d.cts → index-B2LR3Y5d.d.cts} +4 -4
  169. package/dist/{index-XZDPGJ_h.d.mts → index-BAKGyLEF.d.mts} +2 -2
  170. package/dist/{index-vuPAf55D.d.cts → index-BAb24XNa.d.cts} +3 -3
  171. package/dist/{index-BoIi-XoB.d.mts → index-BC98RYwO.d.mts} +3 -3
  172. package/dist/{index-DdBeSvit.d.mts → index-BS5dkngf.d.mts} +2 -2
  173. package/dist/{index-d6gR2x8j.d.cts → index-BfOZMmZA.d.cts} +2 -2
  174. package/dist/{index-CHRAYSwH.d.cts → index-BjMQ1Sfq.d.cts} +3 -3
  175. package/dist/{index-D9CwTcnr.d.cts → index-BvLNPm5C.d.cts} +2 -2
  176. package/dist/index-C-ACdUhw.d.mts +20 -0
  177. package/dist/{index-D3iQQ0L3.d.cts → index-C2e925FY.d.cts} +1 -1
  178. package/dist/{index-D-QRCHiS.d.cts → index-CHr4HUzH.d.mts} +2 -2
  179. package/dist/{index-C5-ZM7lt.d.cts → index-CJWXZFFZ.d.cts} +3 -3
  180. package/dist/{index-h36rcOy8.d.mts → index-COKAN6-s.d.mts} +3 -3
  181. package/dist/{index-Csp1Wzbz.d.cts → index-COYl2TN0.d.mts} +3 -3
  182. package/dist/{index-DhMAwR96.d.mts → index-CaCfFN31.d.mts} +3 -3
  183. package/dist/{index-jmy5eXpx.d.cts → index-CkYiijiE.d.cts} +1 -1
  184. package/dist/{index-Cf7w9Lod.d.cts → index-CorVAOY7.d.mts} +3 -3
  185. package/dist/{index-Br2gDSme.d.cts → index-D3kNrl9W.d.cts} +3 -3
  186. package/dist/{index-COYxtrc0.d.mts → index-D4M18wt_.d.mts} +2 -2
  187. package/dist/{index-DzuXwDCW.d.cts → index-D8jHpwh5.d.cts} +2 -2
  188. package/dist/{index-BWECJgSb.d.mts → index-DClEfecw.d.cts} +3 -3
  189. package/dist/{index-Oxx0z4dS.d.cts → index-DLtzp-Mg.d.mts} +3 -3
  190. package/dist/{index-v_otepCe.d.mts → index-DVG64KQ4.d.mts} +1 -1
  191. package/dist/index-Da9Sr6v7.d.cts +20 -0
  192. package/dist/{index-76XH-GEc.d.mts → index-Dyfu-Otn.d.mts} +1 -1
  193. package/dist/{index-CTVFwvju.d.mts → index-FTr8Mn3p.d.cts} +2 -2
  194. package/dist/{index-ggLhNdZV.d.mts → index-Fcf_SOl_.d.mts} +3 -3
  195. package/dist/{index-BCvkP5R1.d.mts → index-OWbQXOvw.d.cts} +3 -3
  196. package/dist/{index-NBVilQuP.d.mts → index-iHyGhLkM.d.mts} +1 -1
  197. package/dist/{index-DCu7qjpa.d.cts → index-wJbUPxSk.d.cts} +1 -1
  198. package/dist/index.d.cts +2 -2
  199. package/dist/index.d.mts +2 -2
  200. package/dist/style.cjs +1 -1
  201. package/dist/style.d.cts +2 -2
  202. package/dist/style.d.mts +2 -2
  203. package/dist/style.mjs +1 -1
  204. package/dist/{theme-BuqqFbsz.mjs → theme-C1o9qa2E.mjs} +99 -3
  205. package/dist/{theme-Bnc03K83.cjs → theme-DfAqr7qo.cjs} +152 -2
  206. package/dist/theme.cjs +10 -1
  207. package/dist/theme.d.cts +3 -3
  208. package/dist/theme.d.mts +3 -3
  209. package/dist/theme.mjs +2 -2
  210. package/dist/{themes-kbuYiwCi.d.mts → themes-CCguU8uo.d.mts} +111 -1
  211. package/dist/{themes-kbuYiwCi.d.cts → themes-CtTQTVqe.d.cts} +111 -1
  212. package/dist/{useTablePagination-BpMOVLsR.d.cts → useTablePagination-BG93T2Od.d.cts} +1 -1
  213. package/dist/{useTablePagination-DebYZ6vN.d.mts → useTablePagination-jBWK8cmx.d.mts} +1 -1
  214. package/package.json +4 -4
  215. package/dist/index-DOLA1VFD.d.cts +0 -16
  216. package/dist/index-KZKeZDAF.d.mts +0 -16
  217. package/dist/{Modal-CYNcPk-2.mjs → Modal-BcsyrrpH.mjs} +1 -1
  218. package/dist/{Modal-CApyh_V5.cjs → Modal-CM3osOqj.cjs} +1 -1
package/README.md CHANGED
@@ -22,6 +22,30 @@ npm i @soroush.tech/design-system
22
22
 
23
23
  ---
24
24
 
25
+ ## Use it with AI tools
26
+
27
+ An MCP server serves this library's component inventory, every component's props
28
+ reference, and the live token contract, so an AI assistant writes against the real API
29
+ instead of guessing:
30
+
31
+ ```sh
32
+ claude mcp add --transport http soroush https://mcp.soroush.tech/mcp
33
+ ```
34
+
35
+ It also runs locally over stdio (`npx -y @soroush.tech/mcp`). Claude Code users can
36
+ install the plugin instead, which adds a house-style skill and a UI review agent on top
37
+ of the same server:
38
+
39
+ ```sh
40
+ claude plugin marketplace add soroush-tech/design-system
41
+ claude plugin install soroush-design-system@soroush-tech
42
+ ```
43
+
44
+ Any other tool can read [docs.soroush.tech/llms.txt](https://docs.soroush.tech/llms.txt).
45
+ See [`@soroush.tech/mcp`](../mcp) for the full tool list.
46
+
47
+ ---
48
+
25
49
  ## Importing
26
50
 
27
51
  Import components by subpath, styling primitives from the barrel:
@@ -124,13 +148,14 @@ SSR critical-CSS extraction (e.g. with `@emotion/server`) is a separate, opt-in
124
148
 
125
149
  Components never hardcode colors or sizes - props resolve against scales on the `Theme` object:
126
150
 
127
- | Group | Scales |
128
- | ------------------ | ----------------------------------------------------------------------------------------------------- |
129
- | Color | `palette` (main/light/dark/contrastText per color) · `text` · `background` · `border` · `colorScheme` |
130
- | Typography | `typography` (variant map) · `fonts` · `fontSizes` · `fontWeights` · `lineHeights` · `letterSpacings` |
131
- | Space & shape | `space` · `sizes` · `radii` · `borderWidths` · `shadows` |
132
- | Component scales | `avatar` (size steps) · `skeleton` (wave highlight) |
133
- | Layering & effects | `zOrder` (appBar/drawer/modal) · `blur` · `logoFilter` · `portraitBlend` · `portraitOpacity` |
151
+ | Group | Scales |
152
+ | ------------------ | ------------------------------------------------------------------------------------------------------ |
153
+ | Color | `palette` (main/light/dark/contrastText per color) · `text` · `background` · `border` · `colorScheme` |
154
+ | Typography | `typography` (variant map) · `fonts` · `fontSizes` · `fontWeights` · `lineHeights` · `letterSpacings` |
155
+ | Space & shape | `space` · `sizes` · `radii` · `borderWidths` · `shadows` |
156
+ | Layout | `breakpoints` (xs/sm/md/lg/xl window classes) · `layout` (columns, margins, panels, top bar per class) |
157
+ | Component scales | `avatar` (size steps) · `skeleton` (wave highlight) |
158
+ | Layering & effects | `zOrder` (appBar/drawer/modal) · `blur` · `logoFilter` · `portraitBlend` · `portraitOpacity` |
134
159
 
135
160
  Prop types are derived from the interface (`keyof Theme['text']`), so adding a token to `themes.ts` propagates everywhere automatically. See [`design-system.md`](./design-system.md) for the full scale table and the palette rules.
136
161
 
@@ -162,6 +187,19 @@ const [isDark, setIsDark] = useState(true)
162
187
 
163
188
  `createTheme(base, overrides)` (exported from `@soroush.tech/design-system/theme`) is the merge primitive: plain objects recurse, arrays (`shadows`, `fontSizes`) and functions replace wholesale, `undefined` values are ignored - keys are added or replaced, never removed.
164
189
 
190
+ ### Breakpoints and layout
191
+
192
+ `theme.breakpoints` are Material 3's window classes, each a range from its start until the next:
193
+ `xs` 0-599px (compact, the base), `sm` 600-839 (medium), `md` 840-1199 (expanded), `lg`
194
+ 1200-1599 (large), `xl` 1600+ (extra-large). Responsive props use them by name or position -
195
+ `p={{ xs: 2, md: 4 }}`, `p={[2, 3, 4]}` - and `cqSm`-style keys write container queries;
196
+ `theme.breakpoints.up('md')` and its siblings write queries for hand-written styles. Everything is
197
+ CSS, so pages work with JavaScript off. `theme.layout` holds the layout tokens per class (columns,
198
+ margins, gutters, side panels, top bar); `Grid` and `Flex` apply the column grid with
199
+ `layout` / `layout={{ lg: { columns: 16 } }}`, and apps place `AppBar`, `Sidebar` and `Drawer`
200
+ themselves. The full guide is the
201
+ [Breakpoints and layout](./docs/theming.md#breakpoints-and-layout) section of the theming guide.
202
+
165
203
  ### Component defaults
166
204
 
167
205
  Components carry visible literal fallbacks (`size = 'md'`, `variant = 'outside'`, ...) resolved through `themeDefault(theme, key, fallback)` - so every default, including behavioral variants, is overridable via the optional `theme.defaults` map or the provider's `defaults` prop:
package/dist/AppBar.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { h as Theme } from "./themes-kbuYiwCi.cjs";
2
- import "./index-jmy5eXpx.cjs";
3
- import { n as FlexProps } from "./index-DOLA1VFD.cjs";
1
+ import { T as Theme } from "./themes-CtTQTVqe.cjs";
2
+ import "./index-CkYiijiE.cjs";
3
+ import { n as FlexProps } from "./index-Da9Sr6v7.cjs";
4
4
  //#region src/AppBar/AppBar.d.ts
5
5
  /** Valid values for the color prop - derived from theme.background keys. */
6
6
  type AppBarColor = keyof Theme['background'];
package/dist/AppBar.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { h as Theme } from "./themes-kbuYiwCi.mjs";
2
- import "./index-v_otepCe.mjs";
3
- import { n as FlexProps } from "./index-KZKeZDAF.mjs";
1
+ import { T as Theme } from "./themes-CCguU8uo.mjs";
2
+ import "./index-DVG64KQ4.mjs";
3
+ import { n as FlexProps } from "./index-C-ACdUhw.mjs";
4
4
  //#region src/AppBar/AppBar.d.ts
5
5
  /** Valid values for the color prop - derived from theme.background keys. */
6
6
  type AppBarColor = keyof Theme['background'];
package/dist/Avatar.cjs CHANGED
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_src = require("./src-DU81aGy9.cjs");
3
3
  const require_Flex = require("./Flex.cjs");
4
4
  const require_themeDefault = require("./themeDefault-Cebi08Cv.cjs");
5
- const require_theme = require("./theme-Bnc03K83.cjs");
5
+ const require_theme = require("./theme-DfAqr7qo.cjs");
6
6
  let react = require("react");
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
8
  let _soroush_tech_styled_system_should_forward_prop = require("@soroush.tech/styled-system/should-forward-prop");
package/dist/Avatar.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { h as Theme } from "./themes-kbuYiwCi.cjs";
2
- import "./index-jmy5eXpx.cjs";
3
- import { n as FlexProps } from "./index-DOLA1VFD.cjs";
1
+ import { T as Theme } from "./themes-CtTQTVqe.cjs";
2
+ import "./index-CkYiijiE.cjs";
3
+ import { n as FlexProps } from "./index-Da9Sr6v7.cjs";
4
4
  //#region src/Avatar/Avatar.d.ts
5
5
  type AvatarVariant = 'circular' | 'rounded' | 'square';
6
6
  type AvatarSize = keyof Theme['avatar'];
package/dist/Avatar.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { h as Theme } from "./themes-kbuYiwCi.mjs";
2
- import "./index-v_otepCe.mjs";
3
- import { n as FlexProps } from "./index-KZKeZDAF.mjs";
1
+ import { T as Theme } from "./themes-CCguU8uo.mjs";
2
+ import "./index-DVG64KQ4.mjs";
3
+ import { n as FlexProps } from "./index-C-ACdUhw.mjs";
4
4
  //#region src/Avatar/Avatar.d.ts
5
5
  type AvatarVariant = 'circular' | 'rounded' | 'square';
6
6
  type AvatarSize = keyof Theme['avatar'];
package/dist/Avatar.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as src_exports, i as props, o as styled, t as createShouldForwardProp } from "./src-DLGYOJMh.mjs";
2
2
  import { Flex } from "./Flex.mjs";
3
3
  import { t as themeDefault } from "./themeDefault-Z3KmyIbm.mjs";
4
- import { r as useTheme } from "./theme-BuqqFbsz.mjs";
4
+ import { r as useTheme } from "./theme-C1o9qa2E.mjs";
5
5
  import { useState } from "react";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  //#region src/Avatar/Avatar.tsx
@@ -1,4 +1,4 @@
1
- import { s as ViewProps } from "./index-Btmdtbpb.cjs";
1
+ import { s as ViewProps } from "./index-B2LR3Y5d.cjs";
2
2
  //#region src/Backdrop/Backdrop.d.ts
3
3
  type BackdropProps = ViewProps;
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { s as ViewProps } from "./index-DQ16ijxx.mjs";
1
+ import { s as ViewProps } from "./index-AlVOmB-K.mjs";
2
2
  //#region src/Backdrop/Backdrop.d.ts
3
3
  type BackdropProps = ViewProps;
4
4
  /**
package/dist/Button.cjs CHANGED
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_src = require("./src-DU81aGy9.cjs");
3
3
  const require_themeDefault = require("./themeDefault-Cebi08Cv.cjs");
4
4
  const require_utils = require("./utils.cjs");
5
- const require_theme = require("./theme-Bnc03K83.cjs");
5
+ const require_theme = require("./theme-DfAqr7qo.cjs");
6
6
  const require_CircularProgress = require("./CircularProgress.cjs");
7
7
  const require_ButtonGroupContext = require("./ButtonGroupContext-NtkVeDVE.cjs");
8
8
  let react = require("react");
package/dist/Button.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as ButtonShape, c as GapToken, i as ButtonProps, n as ButtonColor, o as ButtonSize, r as ButtonLoadingPosition, s as ButtonVariant, t as Button } from "./index-Oxx0z4dS.cjs";
1
+ import { a as ButtonShape, c as GapToken, i as ButtonProps, n as ButtonColor, o as ButtonSize, r as ButtonLoadingPosition, s as ButtonVariant, t as Button } from "./index-6BHvkjdp.cjs";
2
2
  export { Button, ButtonColor, ButtonLoadingPosition, ButtonProps, ButtonShape, ButtonSize, ButtonVariant, GapToken };
package/dist/Button.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as ButtonShape, c as GapToken, i as ButtonProps, n as ButtonColor, o as ButtonSize, r as ButtonLoadingPosition, s as ButtonVariant, t as Button } from "./index-C-2VKPcp.mjs";
1
+ import { a as ButtonShape, c as GapToken, i as ButtonProps, n as ButtonColor, o as ButtonSize, r as ButtonLoadingPosition, s as ButtonVariant, t as Button } from "./index-DLtzp-Mg.mjs";
2
2
  export { Button, ButtonColor, ButtonLoadingPosition, ButtonProps, ButtonShape, ButtonSize, ButtonVariant, GapToken };
package/dist/Button.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as src_exports, i as props, o as styled, t as createShouldForwardProp } from "./src-DLGYOJMh.mjs";
2
2
  import { t as themeDefault } from "./themeDefault-Z3KmyIbm.mjs";
3
3
  import { alpha } from "./utils.mjs";
4
- import { n as useDefaultProps, r as useTheme } from "./theme-BuqqFbsz.mjs";
4
+ import { n as useDefaultProps, r as useTheme } from "./theme-C1o9qa2E.mjs";
5
5
  import { CircularProgress } from "./CircularProgress.mjs";
6
6
  import { t as ButtonGroupContext } from "./ButtonGroupContext-DS-kl9lG.mjs";
7
7
  import { useContext } from "react";
@@ -1,2 +1,2 @@
1
- import { a as ButtonGroupProps, i as ButtonGroupOrientation, n as ButtonGroupContextValue, o as ButtonGroupRadius, r as ButtonGroup, t as ButtonGroupContext } from "./index-C5-ZM7lt.cjs";
1
+ import { a as ButtonGroupProps, i as ButtonGroupOrientation, n as ButtonGroupContextValue, o as ButtonGroupRadius, r as ButtonGroup, t as ButtonGroupContext } from "./index-CJWXZFFZ.cjs";
2
2
  export { ButtonGroup, ButtonGroupContext, ButtonGroupContextValue, ButtonGroupOrientation, ButtonGroupProps, ButtonGroupRadius };
@@ -1,2 +1,2 @@
1
- import { a as ButtonGroupProps, i as ButtonGroupOrientation, n as ButtonGroupContextValue, o as ButtonGroupRadius, r as ButtonGroup, t as ButtonGroupContext } from "./index-DhMAwR96.mjs";
1
+ import { a as ButtonGroupProps, i as ButtonGroupOrientation, n as ButtonGroupContextValue, o as ButtonGroupRadius, r as ButtonGroup, t as ButtonGroupContext } from "./index-CaCfFN31.mjs";
2
2
  export { ButtonGroup, ButtonGroupContext, ButtonGroupContextValue, ButtonGroupOrientation, ButtonGroupProps, ButtonGroupRadius };
package/dist/Card.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_src = require("./src-DU81aGy9.cjs");
3
3
  const require_themeDefault = require("./themeDefault-Cebi08Cv.cjs");
4
- const require_theme = require("./theme-Bnc03K83.cjs");
4
+ const require_theme = require("./theme-DfAqr7qo.cjs");
5
5
  const require_Paper = require("./Paper.cjs");
6
6
  const require_Typography = require("./Typography.cjs");
7
- const require_Icon = require("./Icon-BAMpe9SO.cjs");
7
+ const require_Icon = require("./Icon-Cn6Zx8wb.cjs");
8
8
  require("react");
9
9
  let react_jsx_runtime = require("react/jsx-runtime");
10
10
  //#region src/Card/Card.tsx
package/dist/Card.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { r as PaperProps } from "./index-Cf7w9Lod.cjs";
2
- import { a as TypographyProps } from "./index-Csp1Wzbz.cjs";
3
- import { n as IconProps, r as IconName } from "./index-DCu7qjpa.cjs";
1
+ import { r as PaperProps } from "./index-OWbQXOvw.cjs";
2
+ import { a as TypographyProps } from "./index-DClEfecw.cjs";
3
+ import { n as IconProps, r as IconName } from "./index-wJbUPxSk.cjs";
4
4
  import { ReactNode } from "react";
5
5
  //#region src/Card/Card.d.ts
6
6
  type CardVariant = 'paper' | 'bracketBox' | 'interactive';
package/dist/Card.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { r as PaperProps } from "./index-BCvkP5R1.mjs";
2
- import { a as TypographyProps } from "./index-BWECJgSb.mjs";
3
- import { n as IconProps, r as IconName } from "./index-76XH-GEc.mjs";
1
+ import { r as PaperProps } from "./index-CorVAOY7.mjs";
2
+ import { a as TypographyProps } from "./index-COYl2TN0.mjs";
3
+ import { n as IconProps, r as IconName } from "./index-Dyfu-Otn.mjs";
4
4
  import { ReactNode } from "react";
5
5
  //#region src/Card/Card.d.ts
6
6
  type CardVariant = 'paper' | 'bracketBox' | 'interactive';
package/dist/Card.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { o as styled } from "./src-DLGYOJMh.mjs";
2
2
  import { t as themeDefault } from "./themeDefault-Z3KmyIbm.mjs";
3
- import { n as useDefaultProps, r as useTheme } from "./theme-BuqqFbsz.mjs";
3
+ import { n as useDefaultProps, r as useTheme } from "./theme-C1o9qa2E.mjs";
4
4
  import { Paper } from "./Paper.mjs";
5
5
  import { Typography } from "./Typography.mjs";
6
- import { t as Icon } from "./Icon-gSiGgU13.mjs";
6
+ import { t as Icon } from "./Icon-BGcd6yy0.mjs";
7
7
  import "react";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
9
  //#region src/Card/Card.tsx
@@ -1,5 +1,5 @@
1
- import { d as PaletteColor, h as Theme } from "./themes-kbuYiwCi.cjs";
2
- import "./index-jmy5eXpx.cjs";
1
+ import { T as Theme, x as PaletteColor } from "./themes-CtTQTVqe.cjs";
2
+ import "./index-CkYiijiE.cjs";
3
3
  import { ChangeEvent, ReactNode } from "react";
4
4
  import { SpaceProps } from "@soroush.tech/styled-system";
5
5
  //#region src/Checkbox/Checkbox.d.ts
@@ -1,5 +1,5 @@
1
- import { d as PaletteColor, h as Theme } from "./themes-kbuYiwCi.mjs";
2
- import "./index-v_otepCe.mjs";
1
+ import { T as Theme, x as PaletteColor } from "./themes-CCguU8uo.mjs";
2
+ import "./index-DVG64KQ4.mjs";
3
3
  import { SpaceProps } from "@soroush.tech/styled-system";
4
4
  import { ChangeEvent, ReactNode } from "react";
5
5
  //#region src/Checkbox/Checkbox.d.ts
@@ -1,6 +1,6 @@
1
- import { h as Theme } from "./themes-kbuYiwCi.cjs";
2
- import "./index-jmy5eXpx.cjs";
3
- import { n as ButtonColor } from "./index-Oxx0z4dS.cjs";
1
+ import { T as Theme } from "./themes-CtTQTVqe.cjs";
2
+ import "./index-CkYiijiE.cjs";
3
+ import { n as ButtonColor } from "./index-6BHvkjdp.cjs";
4
4
  import { HTMLAttributes } from "react";
5
5
  import { LayoutProps, PaddingProps, SpaceProps } from "@soroush.tech/styled-system";
6
6
  //#region src/CircularProgress/CircularProgress.d.ts
@@ -1,6 +1,6 @@
1
- import { h as Theme } from "./themes-kbuYiwCi.mjs";
2
- import "./index-v_otepCe.mjs";
3
- import { n as ButtonColor } from "./index-C-2VKPcp.mjs";
1
+ import { T as Theme } from "./themes-CCguU8uo.mjs";
2
+ import "./index-DVG64KQ4.mjs";
3
+ import { n as ButtonColor } from "./index-DLtzp-Mg.mjs";
4
4
  import { LayoutProps, PaddingProps, SpaceProps } from "@soroush.tech/styled-system";
5
5
  import { HTMLAttributes } from "react";
6
6
  //#region src/CircularProgress/CircularProgress.d.ts
package/dist/Drawer.cjs CHANGED
@@ -1,8 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_src = require("./src-DU81aGy9.cjs");
3
+ const require_Button = require("./Button.cjs");
3
4
  const require_Paper = require("./Paper.cjs");
4
- const require_Modal = require("./Modal-CApyh_V5.cjs");
5
- require("react");
5
+ const require_FocusTrap = require("./FocusTrap.cjs");
6
+ let react = require("react");
6
7
  let react_jsx_runtime = require("react/jsx-runtime");
7
8
  let _emotion_react = require("@emotion/react");
8
9
  let _soroush_tech_styled_system_should_forward_prop = require("@soroush.tech/styled-system/should-forward-prop");
@@ -39,32 +40,123 @@ const anchorPosition = {
39
40
  width: "100%"
40
41
  }
41
42
  };
42
- const shouldForwardProp = (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)(["anchor", "duration"]);
43
- const DrawerPanel = require_src.styled(require_Paper.Paper, {
43
+ const shouldForwardProp = (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)([
44
+ "anchor",
45
+ "duration",
46
+ "hasBackdrop"
47
+ ]);
48
+ const DrawerPanel = require_src.styled("div", {
44
49
  name: "Drawer",
45
50
  label: "Drawer",
46
51
  shouldForwardProp
47
- })(({ anchor, duration }) => ({
52
+ })(({ theme, anchor, duration, hasBackdrop }) => ({
48
53
  position: "fixed",
54
+ inset: "auto",
55
+ margin: 0,
56
+ padding: 0,
57
+ border: "none",
58
+ background: "transparent",
59
+ color: "inherit",
60
+ maxWidth: "100%",
61
+ maxHeight: "100%",
62
+ overflow: "visible",
49
63
  ...anchorPosition[anchor],
50
- animation: `${slideIn[anchor]} ${duration}ms ease-out`,
51
- "@media (prefers-reduced-motion: reduce)": { animation: "none" }
64
+ "&:popover-open": { animation: `${slideIn[anchor]} ${duration}ms ease-out` },
65
+ "&::backdrop": { backgroundColor: hasBackdrop ? theme.background.backdrop : "transparent" },
66
+ "@media (prefers-reduced-motion: reduce)": { "&:popover-open": { animation: "none" } }
52
67
  }));
53
68
  /**
54
- * @description A panel that slides in from a screen edge, built on Modal. Portals,
55
- * dims the page, traps focus, locks scroll, and closes on Escape or backdrop click.
69
+ * @description A panel that slides in from a screen edge. It is an HTML `popover`: a
70
+ * `DrawerToggle` opens it, and Escape or a click outside closes it - all without JavaScript,
71
+ * so it works on a prerendered page with scripts off. With JavaScript it can be controlled with
72
+ * `isOpen` / `onClose`, and it moves focus in, traps Tab and locks scroll while open.
56
73
  */
57
- function Drawer({ children, anchor = "left", elevation = 16, transitionDuration = 225, ...modalProps }) {
58
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Modal.Modal, {
59
- ...modalProps,
60
- layer: "drawer",
61
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DrawerPanel, {
62
- anchor,
63
- duration: transitionDuration,
74
+ function Drawer({ id, children, isOpen, onClose, anchor = "left", elevation = 16, transitionDuration = 225, hasBackdrop = true, shouldLockScroll = true, shouldAutoFocus = true, shouldTrapFocus = true, shouldRestoreFocus = true }) {
75
+ const panelRef = (0, react.useRef)(null);
76
+ const [isShown, setIsShown] = (0, react.useState)(false);
77
+ const isShownRef = (0, react.useRef)(false);
78
+ const closingByProp = (0, react.useRef)(false);
79
+ const onCloseRef = (0, react.useRef)(onClose);
80
+ (0, react.useEffect)(() => {
81
+ onCloseRef.current = onClose;
82
+ }, [onClose]);
83
+ (0, react.useEffect)(() => {
84
+ const panel = panelRef.current;
85
+ let escaped = false;
86
+ const handleKeyDown = (event) => {
87
+ escaped = event.key === "Escape" && isShownRef.current;
88
+ };
89
+ const handleToggle = (event) => {
90
+ const open = event.newState === "open";
91
+ isShownRef.current = open;
92
+ setIsShown(open);
93
+ if (!open && !closingByProp.current) onCloseRef.current?.(event, escaped ? "escapeKey" : "dismiss");
94
+ closingByProp.current = false;
95
+ escaped = false;
96
+ };
97
+ const doc = panel.ownerDocument;
98
+ doc.addEventListener("keydown", handleKeyDown, true);
99
+ panel.addEventListener("toggle", handleToggle);
100
+ return () => {
101
+ doc.removeEventListener("keydown", handleKeyDown, true);
102
+ panel.removeEventListener("toggle", handleToggle);
103
+ };
104
+ }, []);
105
+ (0, react.useEffect)(() => {
106
+ if (isOpen === void 0 || isOpen === isShownRef.current) return;
107
+ const panel = panelRef.current;
108
+ isShownRef.current = isOpen;
109
+ if (isOpen) panel.showPopover();
110
+ else {
111
+ closingByProp.current = true;
112
+ panel.hidePopover();
113
+ }
114
+ }, [isOpen]);
115
+ (0, react.useEffect)(() => {
116
+ if (!isShown || !shouldLockScroll) return;
117
+ const { body } = panelRef.current.ownerDocument;
118
+ const previous = body.style.overflow;
119
+ body.style.overflow = "hidden";
120
+ return () => {
121
+ body.style.overflow = previous;
122
+ };
123
+ }, [isShown, shouldLockScroll]);
124
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DrawerPanel, {
125
+ ref: panelRef,
126
+ id,
127
+ popover: "auto",
128
+ anchor,
129
+ duration: transitionDuration,
130
+ hasBackdrop,
131
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Paper.Paper, {
64
132
  elevation,
65
- children
133
+ width: "100%",
134
+ height: "100%",
135
+ overflow: "auto",
136
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FocusTrap.FocusTrap, {
137
+ isEnabled: isShown,
138
+ shouldAutoFocus,
139
+ shouldTrapFocus,
140
+ shouldEnforceFocus: false,
141
+ shouldRestoreFocus,
142
+ children
143
+ })
66
144
  })
67
145
  });
68
146
  }
69
147
  //#endregion
148
+ //#region src/Drawer/DrawerToggle.tsx
149
+ /**
150
+ * @description The button that opens and closes a `Drawer`, through the HTML
151
+ * `popovertarget` attribute - it works without JavaScript. Takes every `Button` prop.
152
+ */
153
+ function DrawerToggle({ drawer, action = "toggle", ...rest }) {
154
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Button.Button, {
155
+ popoverTarget: drawer,
156
+ popoverTargetAction: action,
157
+ ...rest
158
+ });
159
+ }
160
+ //#endregion
70
161
  exports.Drawer = Drawer;
162
+ exports.DrawerToggle = DrawerToggle;
package/dist/Drawer.d.cts CHANGED
@@ -1,22 +1,58 @@
1
- import { n as PaperElevation } from "./index-Cf7w9Lod.cjs";
2
- import { s as ModalProps } from "./index-D-QRCHiS.cjs";
1
+ import { i as ButtonProps } from "./index-6BHvkjdp.cjs";
2
+ import { n as PaperElevation } from "./index-OWbQXOvw.cjs";
3
3
  import { ReactNode } from "react";
4
4
  //#region src/Drawer/Drawer.d.ts
5
5
  type DrawerAnchor = 'left' | 'right' | 'top' | 'bottom';
6
- interface DrawerProps extends Pick<ModalProps, 'isOpen' | 'onClose' | 'hasBackdrop' | 'shouldKeepMounted' | 'shouldUsePortal' | 'portalContainer' | 'shouldLockScroll' | 'shouldAutoFocus' | 'shouldTrapFocus' | 'shouldRestoreFocus'> {
6
+ /** Why the drawer closed: the Escape key, or any other dismissal (a click outside, its toggle). */
7
+ type DrawerCloseReason = 'escapeKey' | 'dismiss';
8
+ interface DrawerProps {
9
+ /** The element id a `DrawerToggle`'s `drawer` names. */
10
+ id: string;
7
11
  /** The content of the drawer. */
8
12
  children: ReactNode;
13
+ /**
14
+ * Open state, for controlled use with JavaScript. Leave it out and the drawer opens and
15
+ * closes from its `DrawerToggle` alone - which also works with JavaScript disabled.
16
+ */
17
+ isOpen?: boolean;
18
+ /** Fired when the drawer closes by itself: Escape, a click outside, or its toggle. */
19
+ onClose?: (event: Event, reason: DrawerCloseReason) => void;
9
20
  /** Edge the drawer slides in from. Default: 'left'. */
10
21
  anchor?: DrawerAnchor;
11
22
  /** Shadow depth of the panel (0-24), forwarded to Paper. Default: 16. */
12
23
  elevation?: PaperElevation;
13
24
  /** Slide duration in milliseconds. Default: 225. */
14
25
  transitionDuration?: number;
26
+ /** Dim the page behind the open drawer. Default: true. */
27
+ hasBackdrop?: boolean;
28
+ /** With JavaScript: lock body scroll while open. Default: true. */
29
+ shouldLockScroll?: boolean;
30
+ /** With JavaScript: move focus into the drawer when it opens. Default: true. */
31
+ shouldAutoFocus?: boolean;
32
+ /** With JavaScript: keep Tab cycling within the open drawer. Default: true. */
33
+ shouldTrapFocus?: boolean;
34
+ /** With JavaScript: return focus to where it was when the drawer closes. Default: true. */
35
+ shouldRestoreFocus?: boolean;
15
36
  }
16
37
  /**
17
- * @description A panel that slides in from a screen edge, built on Modal. Portals,
18
- * dims the page, traps focus, locks scroll, and closes on Escape or backdrop click.
38
+ * @description A panel that slides in from a screen edge. It is an HTML `popover`: a
39
+ * `DrawerToggle` opens it, and Escape or a click outside closes it - all without JavaScript,
40
+ * so it works on a prerendered page with scripts off. With JavaScript it can be controlled with
41
+ * `isOpen` / `onClose`, and it moves focus in, traps Tab and locks scroll while open.
19
42
  */
20
- declare function Drawer({ children, anchor, elevation, transitionDuration, ...modalProps }: Readonly<DrawerProps>): import("react").JSX.Element;
43
+ declare function Drawer({ id, children, isOpen, onClose, anchor, elevation, transitionDuration, hasBackdrop, shouldLockScroll, shouldAutoFocus, shouldTrapFocus, shouldRestoreFocus }: Readonly<DrawerProps>): import("react").JSX.Element;
21
44
  //#endregion
22
- export { Drawer, DrawerAnchor, DrawerProps };
45
+ //#region src/Drawer/DrawerToggle.d.ts
46
+ interface DrawerToggleProps extends Omit<ButtonProps, 'href'> {
47
+ /** The `id` of the `Drawer` this button opens and closes. */
48
+ drawer: string;
49
+ /** What a click does to the drawer. Default: 'toggle'. */
50
+ action?: 'toggle' | 'show' | 'hide';
51
+ }
52
+ /**
53
+ * @description The button that opens and closes a `Drawer`, through the HTML
54
+ * `popovertarget` attribute - it works without JavaScript. Takes every `Button` prop.
55
+ */
56
+ declare function DrawerToggle({ drawer, action, ...rest }: Readonly<DrawerToggleProps>): import("react").JSX.Element;
57
+ //#endregion
58
+ export { Drawer, DrawerAnchor, DrawerCloseReason, DrawerProps, DrawerToggle, DrawerToggleProps };
package/dist/Drawer.d.mts CHANGED
@@ -1,22 +1,58 @@
1
- import { n as PaperElevation } from "./index-BCvkP5R1.mjs";
2
- import { s as ModalProps } from "./index-CTVFwvju.mjs";
1
+ import { i as ButtonProps } from "./index-DLtzp-Mg.mjs";
2
+ import { n as PaperElevation } from "./index-CorVAOY7.mjs";
3
3
  import { ReactNode } from "react";
4
4
  //#region src/Drawer/Drawer.d.ts
5
5
  type DrawerAnchor = 'left' | 'right' | 'top' | 'bottom';
6
- interface DrawerProps extends Pick<ModalProps, 'isOpen' | 'onClose' | 'hasBackdrop' | 'shouldKeepMounted' | 'shouldUsePortal' | 'portalContainer' | 'shouldLockScroll' | 'shouldAutoFocus' | 'shouldTrapFocus' | 'shouldRestoreFocus'> {
6
+ /** Why the drawer closed: the Escape key, or any other dismissal (a click outside, its toggle). */
7
+ type DrawerCloseReason = 'escapeKey' | 'dismiss';
8
+ interface DrawerProps {
9
+ /** The element id a `DrawerToggle`'s `drawer` names. */
10
+ id: string;
7
11
  /** The content of the drawer. */
8
12
  children: ReactNode;
13
+ /**
14
+ * Open state, for controlled use with JavaScript. Leave it out and the drawer opens and
15
+ * closes from its `DrawerToggle` alone - which also works with JavaScript disabled.
16
+ */
17
+ isOpen?: boolean;
18
+ /** Fired when the drawer closes by itself: Escape, a click outside, or its toggle. */
19
+ onClose?: (event: Event, reason: DrawerCloseReason) => void;
9
20
  /** Edge the drawer slides in from. Default: 'left'. */
10
21
  anchor?: DrawerAnchor;
11
22
  /** Shadow depth of the panel (0-24), forwarded to Paper. Default: 16. */
12
23
  elevation?: PaperElevation;
13
24
  /** Slide duration in milliseconds. Default: 225. */
14
25
  transitionDuration?: number;
26
+ /** Dim the page behind the open drawer. Default: true. */
27
+ hasBackdrop?: boolean;
28
+ /** With JavaScript: lock body scroll while open. Default: true. */
29
+ shouldLockScroll?: boolean;
30
+ /** With JavaScript: move focus into the drawer when it opens. Default: true. */
31
+ shouldAutoFocus?: boolean;
32
+ /** With JavaScript: keep Tab cycling within the open drawer. Default: true. */
33
+ shouldTrapFocus?: boolean;
34
+ /** With JavaScript: return focus to where it was when the drawer closes. Default: true. */
35
+ shouldRestoreFocus?: boolean;
15
36
  }
16
37
  /**
17
- * @description A panel that slides in from a screen edge, built on Modal. Portals,
18
- * dims the page, traps focus, locks scroll, and closes on Escape or backdrop click.
38
+ * @description A panel that slides in from a screen edge. It is an HTML `popover`: a
39
+ * `DrawerToggle` opens it, and Escape or a click outside closes it - all without JavaScript,
40
+ * so it works on a prerendered page with scripts off. With JavaScript it can be controlled with
41
+ * `isOpen` / `onClose`, and it moves focus in, traps Tab and locks scroll while open.
19
42
  */
20
- declare function Drawer({ children, anchor, elevation, transitionDuration, ...modalProps }: Readonly<DrawerProps>): import("react").JSX.Element;
43
+ declare function Drawer({ id, children, isOpen, onClose, anchor, elevation, transitionDuration, hasBackdrop, shouldLockScroll, shouldAutoFocus, shouldTrapFocus, shouldRestoreFocus }: Readonly<DrawerProps>): import("react").JSX.Element;
21
44
  //#endregion
22
- export { Drawer, DrawerAnchor, DrawerProps };
45
+ //#region src/Drawer/DrawerToggle.d.ts
46
+ interface DrawerToggleProps extends Omit<ButtonProps, 'href'> {
47
+ /** The `id` of the `Drawer` this button opens and closes. */
48
+ drawer: string;
49
+ /** What a click does to the drawer. Default: 'toggle'. */
50
+ action?: 'toggle' | 'show' | 'hide';
51
+ }
52
+ /**
53
+ * @description The button that opens and closes a `Drawer`, through the HTML
54
+ * `popovertarget` attribute - it works without JavaScript. Takes every `Button` prop.
55
+ */
56
+ declare function DrawerToggle({ drawer, action, ...rest }: Readonly<DrawerToggleProps>): import("react").JSX.Element;
57
+ //#endregion
58
+ export { Drawer, DrawerAnchor, DrawerCloseReason, DrawerProps, DrawerToggle, DrawerToggleProps };