@soroush.tech/design-system 2.0.0-alpha.0 → 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 (240) hide show
  1. package/README.md +27 -24
  2. package/dist/AppBar.cjs +0 -4
  3. package/dist/AppBar.d.cts +3 -3
  4. package/dist/AppBar.d.mts +3 -3
  5. package/dist/AppBar.mjs +0 -4
  6. package/dist/Avatar.cjs +1 -1
  7. package/dist/Avatar.d.cts +3 -3
  8. package/dist/Avatar.d.mts +3 -3
  9. package/dist/Avatar.mjs +1 -1
  10. package/dist/Backdrop.d.cts +1 -1
  11. package/dist/Backdrop.d.mts +1 -1
  12. package/dist/Button.cjs +1 -1
  13. package/dist/Button.d.cts +1 -1
  14. package/dist/Button.d.mts +1 -1
  15. package/dist/Button.mjs +1 -1
  16. package/dist/ButtonGroup.d.cts +1 -1
  17. package/dist/ButtonGroup.d.mts +1 -1
  18. package/dist/Card.cjs +2 -2
  19. package/dist/Card.d.cts +3 -3
  20. package/dist/Card.d.mts +3 -3
  21. package/dist/Card.mjs +2 -2
  22. package/dist/Checkbox.d.cts +2 -2
  23. package/dist/Checkbox.d.mts +2 -2
  24. package/dist/CircularProgress.d.cts +3 -3
  25. package/dist/CircularProgress.d.mts +3 -3
  26. package/dist/Drawer.cjs +109 -17
  27. package/dist/Drawer.d.cts +43 -7
  28. package/dist/Drawer.d.mts +43 -7
  29. package/dist/Drawer.mjs +109 -18
  30. package/dist/Flex.cjs +6 -2
  31. package/dist/Flex.d.cts +1 -1
  32. package/dist/Flex.d.mts +1 -1
  33. package/dist/Flex.mjs +6 -2
  34. package/dist/Form.d.cts +1 -1
  35. package/dist/Form.d.mts +1 -1
  36. package/dist/FormControl.cjs +1 -1
  37. package/dist/FormControl.d.cts +2 -2
  38. package/dist/FormControl.d.mts +2 -2
  39. package/dist/FormControl.mjs +1 -1
  40. package/dist/FormHelperText.d.cts +1 -1
  41. package/dist/FormHelperText.d.mts +1 -1
  42. package/dist/FormLabel.d.cts +1 -1
  43. package/dist/FormLabel.d.mts +1 -1
  44. package/dist/Grid.cjs +7 -2
  45. package/dist/Grid.d.cts +19 -1
  46. package/dist/Grid.d.mts +19 -1
  47. package/dist/Grid.mjs +7 -2
  48. package/dist/{Icon-CkQGOBmm.mjs → Icon-BGcd6yy0.mjs} +1 -1
  49. package/dist/{Icon-CKLBJ7CC.cjs → Icon-Cn6Zx8wb.cjs} +1 -1
  50. package/dist/Icon.cjs +1 -1
  51. package/dist/Icon.d.cts +1 -1
  52. package/dist/Icon.d.mts +1 -1
  53. package/dist/Icon.mjs +1 -1
  54. package/dist/Image.d.cts +2 -2
  55. package/dist/Image.d.mts +2 -2
  56. package/dist/LinearProgress.d.cts +3 -3
  57. package/dist/LinearProgress.d.mts +3 -3
  58. package/dist/Link.cjs +1 -1
  59. package/dist/Link.d.cts +1 -1
  60. package/dist/Link.d.mts +1 -1
  61. package/dist/Link.mjs +1 -1
  62. package/dist/MenuItem.cjs +2 -2
  63. package/dist/MenuItem.d.cts +2 -2
  64. package/dist/MenuItem.d.mts +2 -2
  65. package/dist/MenuItem.mjs +2 -2
  66. package/dist/Modal.cjs +1 -1
  67. package/dist/Modal.d.cts +1 -1
  68. package/dist/Modal.d.mts +1 -1
  69. package/dist/Modal.mjs +1 -1
  70. package/dist/NativeSelect.cjs +2 -2
  71. package/dist/NativeSelect.d.cts +3 -3
  72. package/dist/NativeSelect.d.mts +3 -3
  73. package/dist/NativeSelect.mjs +2 -2
  74. package/dist/Pagination/PaginationItem.cjs +1 -1
  75. package/dist/Pagination/PaginationItem.d.cts +1 -1
  76. package/dist/Pagination/PaginationItem.d.mts +1 -1
  77. package/dist/Pagination/PaginationItem.mjs +1 -1
  78. package/dist/Pagination.d.cts +2 -2
  79. package/dist/Pagination.d.mts +2 -2
  80. package/dist/Paper.cjs +1 -1
  81. package/dist/Paper.d.cts +1 -1
  82. package/dist/Paper.d.mts +1 -1
  83. package/dist/Paper.mjs +1 -1
  84. package/dist/{Popover-Dz6h3A_9.cjs → Popover-CrSABgRk.cjs} +2 -2
  85. package/dist/{Popover-DWOrf7sy.mjs → Popover-DlpXdcwt.mjs} +2 -2
  86. package/dist/Popover.cjs +1 -1
  87. package/dist/Popover.d.cts +4 -4
  88. package/dist/Popover.d.mts +4 -4
  89. package/dist/Popover.mjs +1 -1
  90. package/dist/Pressable.cjs +1 -1
  91. package/dist/Pressable.d.cts +1 -1
  92. package/dist/Pressable.d.mts +1 -1
  93. package/dist/Pressable.mjs +1 -1
  94. package/dist/Quote.d.cts +4 -4
  95. package/dist/Quote.d.mts +4 -4
  96. package/dist/Radio.d.cts +2 -2
  97. package/dist/Radio.d.mts +2 -2
  98. package/dist/Select.cjs +3 -3
  99. package/dist/Select.d.cts +3 -3
  100. package/dist/Select.d.mts +3 -3
  101. package/dist/Select.mjs +3 -3
  102. package/dist/Sidebar/Sidebar.cjs +6 -25
  103. package/dist/Sidebar/Sidebar.d.cts +2 -5
  104. package/dist/Sidebar/Sidebar.d.mts +2 -5
  105. package/dist/Sidebar/Sidebar.mjs +7 -26
  106. package/dist/Sidebar/SidebarItem.cjs +1 -2
  107. package/dist/Sidebar/SidebarItem.d.cts +4 -4
  108. package/dist/Sidebar/SidebarItem.d.mts +4 -4
  109. package/dist/Sidebar/SidebarItem.mjs +1 -2
  110. package/dist/Skeleton.d.cts +2 -2
  111. package/dist/Skeleton.d.mts +2 -2
  112. package/dist/Switch.cjs +1 -1
  113. package/dist/Switch.d.cts +2 -2
  114. package/dist/Switch.d.mts +2 -2
  115. package/dist/Switch.mjs +1 -1
  116. package/dist/Table/Table.d.cts +3 -3
  117. package/dist/Table/Table.d.mts +3 -3
  118. package/dist/Table/TableBody.d.cts +2 -2
  119. package/dist/Table/TableBody.d.mts +2 -2
  120. package/dist/Table/TableCell.d.cts +1 -1
  121. package/dist/Table/TableCell.d.mts +1 -1
  122. package/dist/Table/TableContainer.d.cts +4 -4
  123. package/dist/Table/TableContainer.d.mts +4 -4
  124. package/dist/Table/TableControl.d.cts +1 -1
  125. package/dist/Table/TableControl.d.mts +1 -1
  126. package/dist/Table/TableFooter.d.cts +2 -2
  127. package/dist/Table/TableFooter.d.mts +2 -2
  128. package/dist/Table/TableHead.d.cts +2 -2
  129. package/dist/Table/TableHead.d.mts +2 -2
  130. package/dist/Table/TablePagination.d.cts +2 -2
  131. package/dist/Table/TablePagination.d.mts +2 -2
  132. package/dist/Table/TablePaginationActions.cjs +1 -1
  133. package/dist/Table/TablePaginationActions.d.cts +1 -1
  134. package/dist/Table/TablePaginationActions.d.mts +1 -1
  135. package/dist/Table/TablePaginationActions.mjs +1 -1
  136. package/dist/Table/TableRow.d.cts +2 -2
  137. package/dist/Table/TableRow.d.mts +2 -2
  138. package/dist/Table/TableSortLabel.cjs +1 -1
  139. package/dist/Table/TableSortLabel.d.cts +1 -1
  140. package/dist/Table/TableSortLabel.d.mts +1 -1
  141. package/dist/Table/TableSortLabel.mjs +1 -1
  142. package/dist/Table/hooks.d.cts +1 -1
  143. package/dist/Table/hooks.d.mts +1 -1
  144. package/dist/Table.d.cts +5 -5
  145. package/dist/Table.d.mts +5 -5
  146. package/dist/{TableContext-DRAhXvq3.d.cts → TableContext-98M9MAm7.d.cts} +1 -1
  147. package/dist/{TableContext-DBOk01Xl.d.mts → TableContext-BwK_fB9Q.d.mts} +1 -1
  148. package/dist/TextInput.cjs +1 -1
  149. package/dist/TextInput.d.cts +2 -2
  150. package/dist/TextInput.d.mts +2 -2
  151. package/dist/TextInput.mjs +1 -1
  152. package/dist/ToggleButton/ToggleButton.cjs +1 -1
  153. package/dist/ToggleButton/ToggleButton.d.cts +1 -1
  154. package/dist/ToggleButton/ToggleButton.d.mts +1 -1
  155. package/dist/ToggleButton/ToggleButton.mjs +1 -1
  156. package/dist/ToggleButton/ToggleButtonGroup.cjs +1 -1
  157. package/dist/ToggleButton/ToggleButtonGroup.d.cts +1 -1
  158. package/dist/ToggleButton/ToggleButtonGroup.d.mts +1 -1
  159. package/dist/ToggleButton/ToggleButtonGroup.mjs +1 -1
  160. package/dist/Typography.cjs +1 -1
  161. package/dist/Typography.d.cts +2 -2
  162. package/dist/Typography.d.mts +2 -2
  163. package/dist/Typography.mjs +1 -1
  164. package/dist/View.cjs +2 -1
  165. package/dist/View.d.cts +1 -1
  166. package/dist/View.d.mts +1 -1
  167. package/dist/View.mjs +2 -1
  168. package/dist/engine.d.cts +1 -1
  169. package/dist/engine.d.mts +1 -1
  170. package/dist/{index-D4i9vrQM.d.mts → index-6BHvkjdp.d.cts} +3 -3
  171. package/dist/{index-CvWslVk6.d.cts → index-AlVOmB-K.d.mts} +4 -4
  172. package/dist/{index-tv-TGYSG.d.mts → index-B2LR3Y5d.d.cts} +4 -4
  173. package/dist/{index-EYR0z1Qv.d.cts → index-BAKGyLEF.d.mts} +2 -2
  174. package/dist/{index-DNNg9RoR.d.cts → index-BAb24XNa.d.cts} +3 -3
  175. package/dist/{index-CVb5zbas.d.mts → index-BC98RYwO.d.mts} +3 -3
  176. package/dist/{index-CzmA09Yf.d.mts → index-BS5dkngf.d.mts} +2 -2
  177. package/dist/{index-CLttbRhG.d.cts → index-BfOZMmZA.d.cts} +2 -2
  178. package/dist/{index-B6vxRNLt.d.cts → index-BjMQ1Sfq.d.cts} +3 -3
  179. package/dist/{index-Cjlax0-f.d.mts → index-BvLNPm5C.d.cts} +2 -2
  180. package/dist/index-C-ACdUhw.d.mts +20 -0
  181. package/dist/{index-CoHrw2p7.d.mts → index-C2e925FY.d.cts} +1 -1
  182. package/dist/{index-qtKJ56yu.d.mts → index-CHr4HUzH.d.mts} +2 -2
  183. package/dist/{index-BNpkmtaM.d.mts → index-CJWXZFFZ.d.cts} +4 -4
  184. package/dist/{index-DsKd9VW5.d.mts → index-COKAN6-s.d.mts} +3 -3
  185. package/dist/{index-bN91IhZi.d.cts → index-COYl2TN0.d.mts} +3 -3
  186. package/dist/{index-CCrocxBL.d.cts → index-CaCfFN31.d.mts} +4 -4
  187. package/dist/{index-DkJzi96w.d.cts → index-CkYiijiE.d.cts} +1 -1
  188. package/dist/{index-BSR9zrAA.d.mts → index-CorVAOY7.d.mts} +3 -3
  189. package/dist/{index-CohgpyUj.d.cts → index-D3kNrl9W.d.cts} +3 -3
  190. package/dist/{index-8mHoIUt5.d.mts → index-D4M18wt_.d.mts} +2 -2
  191. package/dist/{index-CtrxW81j.d.cts → index-D8jHpwh5.d.cts} +2 -2
  192. package/dist/{index-DuefjNlC.d.mts → index-DClEfecw.d.cts} +3 -3
  193. package/dist/{index-S3NZS-Qp.d.cts → index-DLtzp-Mg.d.mts} +3 -3
  194. package/dist/{index-CEqa8xx8.d.mts → index-DVG64KQ4.d.mts} +1 -1
  195. package/dist/index-Da9Sr6v7.d.cts +20 -0
  196. package/dist/{index-DPHwCZYf.d.cts → index-Dyfu-Otn.d.mts} +2 -2
  197. package/dist/{index-B8KscJic.d.cts → index-FTr8Mn3p.d.cts} +2 -2
  198. package/dist/{index-IEvuh6Cd.d.mts → index-Fcf_SOl_.d.mts} +3 -3
  199. package/dist/{index-BGD4OzzG.d.cts → index-OWbQXOvw.d.cts} +3 -3
  200. package/dist/{index-BDD-L8uL.d.cts → index-iHyGhLkM.d.mts} +1 -1
  201. package/dist/{index-r2avCy1z.d.mts → index-wJbUPxSk.d.cts} +2 -2
  202. package/dist/index.d.cts +2 -2
  203. package/dist/index.d.mts +2 -2
  204. package/dist/style.cjs +1 -1
  205. package/dist/style.d.cts +2 -2
  206. package/dist/style.d.mts +2 -2
  207. package/dist/style.mjs +1 -1
  208. package/dist/{theme-BQGlZoma.mjs → theme-C1o9qa2E.mjs} +75 -27
  209. package/dist/{theme-BmEAXmwh.cjs → theme-DfAqr7qo.cjs} +116 -26
  210. package/dist/theme.cjs +8 -1
  211. package/dist/theme.d.cts +3 -3
  212. package/dist/theme.d.mts +3 -3
  213. package/dist/theme.mjs +2 -2
  214. package/dist/{themes-9YNnlVyY.d.mts → themes-CCguU8uo.d.mts} +62 -21
  215. package/dist/{themes-9YNnlVyY.d.cts → themes-CtTQTVqe.d.cts} +62 -21
  216. package/dist/{useTablePagination-CLoac5oX.d.cts → useTablePagination-BG93T2Od.d.cts} +1 -1
  217. package/dist/{useTablePagination-RelVsdMR.d.mts → useTablePagination-jBWK8cmx.d.mts} +1 -1
  218. package/package.json +2 -12
  219. package/dist/PageLayout/LayoutGrid.cjs +0 -21
  220. package/dist/PageLayout/LayoutGrid.d.cts +0 -22
  221. package/dist/PageLayout/LayoutGrid.d.mts +0 -22
  222. package/dist/PageLayout/LayoutGrid.mjs +0 -20
  223. package/dist/PageLayout/PageLayout.cjs +0 -148
  224. package/dist/PageLayout/PageLayout.d.cts +0 -31
  225. package/dist/PageLayout/PageLayout.d.mts +0 -31
  226. package/dist/PageLayout/PageLayout.mjs +0 -147
  227. package/dist/PageLayout.cjs +0 -7
  228. package/dist/PageLayout.d.cts +0 -19
  229. package/dist/PageLayout.d.mts +0 -19
  230. package/dist/PageLayout.mjs +0 -4
  231. package/dist/PageLayoutContext-DjJ1_7Xc.mjs +0 -5
  232. package/dist/PageLayoutContext-agXGhegE.cjs +0 -9
  233. package/dist/index-B41OXLX8.d.mts +0 -16
  234. package/dist/index-BJ5Tsf7u.d.cts +0 -16
  235. package/dist/index-BMJ3tyIw.d.cts +0 -16
  236. package/dist/index-BnFxdnEL.d.mts +0 -16
  237. package/dist/layoutStyles-B4Z1K6HZ.cjs +0 -67
  238. package/dist/layoutStyles-f0ISNjsC.mjs +0 -56
  239. package/dist/{Modal-CYNcPk-2.mjs → Modal-BcsyrrpH.mjs} +1 -1
  240. package/dist/{Modal-CApyh_V5.cjs → Modal-CM3osOqj.cjs} +1 -1
package/README.md CHANGED
@@ -89,17 +89,16 @@ SSR critical-CSS extraction (e.g. with `@emotion/server`) is a separate, opt-in
89
89
 
90
90
  ### Layout & surfaces
91
91
 
92
- | Component | Purpose |
93
- | ------------ | ----------------------------------------------------------------------------------------- |
94
- | `View` | Styled `div` primitive - the base building block |
95
- | `Flex` | `View` with flexbox defaults |
96
- | `Grid` | CSS grid container |
97
- | `PageLayout` | Page frame (bars, side panels, content) from `theme.layout`; `LayoutGrid` for its columns |
98
- | `Paper` | Elevated surface with background and shadow |
99
- | `Card` | Content container built on `Paper` |
100
- | `Quote` | Bordered quote / terminal-panel surface on `View` |
101
- | `AppBar` | Top application bar |
102
- | `Drawer` | Slide-in side panel |
92
+ | Component | Purpose |
93
+ | --------- | ------------------------------------------------- |
94
+ | `View` | Styled `div` primitive - the base building block |
95
+ | `Flex` | `View` with flexbox defaults |
96
+ | `Grid` | CSS grid container |
97
+ | `Paper` | Elevated surface with background and shadow |
98
+ | `Card` | Content container built on `Paper` |
99
+ | `Quote` | Bordered quote / terminal-panel surface on `View` |
100
+ | `AppBar` | Top application bar |
101
+ | `Drawer` | Slide-in side panel |
103
102
 
104
103
  ### Content & data display
105
104
 
@@ -149,14 +148,14 @@ SSR critical-CSS extraction (e.g. with `@emotion/server`) is a separate, opt-in
149
148
 
150
149
  Components never hardcode colors or sizes - props resolve against scales on the `Theme` object:
151
150
 
152
- | Group | Scales |
153
- | ------------------ | ----------------------------------------------------------------------------------------------------- |
154
- | Color | `palette` (main/light/dark/contrastText per color) · `text` · `background` · `border` · `colorScheme` |
155
- | Typography | `typography` (variant map) · `fonts` · `fontSizes` · `fontWeights` · `lineHeights` · `letterSpacings` |
156
- | Space & shape | `space` · `sizes` · `radii` · `borderWidths` · `shadows` |
157
- | Layout | `breakpoints` (tablet/web/wide) · `layout` (bars, panels, content columns per breakpoint) |
158
- | Component scales | `avatar` (size steps) · `skeleton` (wave highlight) |
159
- | 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` |
160
159
 
161
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.
162
161
 
@@ -190,11 +189,15 @@ const [isDark, setIsDark] = useState(true)
190
189
 
191
190
  ### Breakpoints and layout
192
191
 
193
- `theme.breakpoints` (`tablet` 600px, `web` 1200px, `wide` 1600px) is where responsive props change -
194
- `p={{ _: 2, web: 4 }}` or `p={[2, 3, 4]}`. `theme.layout` holds the page's columns, margins,
195
- gutters, side panels and bars per breakpoint, merged mobile-first; `PageLayout` and `LayoutGrid`
196
- lay a page out from it. Override both with `createTheme`; a breakpoint you add comes after the
197
- existing ones, so it must be larger. The full guide is the
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
198
201
  [Breakpoints and layout](./docs/theming.md#breakpoints-and-layout) section of the theming guide.
199
202
 
200
203
  ### Component defaults
package/dist/AppBar.cjs CHANGED
@@ -1,9 +1,7 @@
1
1
  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
- const require_PageLayoutContext = require("./PageLayoutContext-agXGhegE.cjs");
5
4
  const require_themeDefault = require("./themeDefault-Cebi08Cv.cjs");
6
- let react = require("react");
7
5
  let react_jsx_runtime = require("react/jsx-runtime");
8
6
  let _soroush_tech_styled_system_should_forward_prop = require("@soroush.tech/styled-system/should-forward-prop");
9
7
  //#region src/AppBar/AppBar.tsx
@@ -62,12 +60,10 @@ const AppBarBase = require_src.styled(require_Flex.Flex, {
62
60
  width: "100%"
63
61
  }, elevationVariant, sizeVariants);
64
62
  function AppBar({ elevation = 4, size, ...rest }) {
65
- const isInBar = (0, react.useContext)(require_PageLayoutContext.PageLayoutContext)?.region === "bar";
66
63
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AppBarBase, {
67
64
  as: "header",
68
65
  elevation,
69
66
  size,
70
- ...isInBar && { height: "100%" },
71
67
  ...rest
72
68
  });
73
69
  }
package/dist/AppBar.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { S as Theme } from "./themes-9YNnlVyY.cjs";
2
- import "./index-DkJzi96w.cjs";
3
- import { n as FlexProps } from "./index-BMJ3tyIw.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 { S as Theme } from "./themes-9YNnlVyY.mjs";
2
- import "./index-CEqa8xx8.mjs";
3
- import { n as FlexProps } from "./index-B41OXLX8.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/AppBar.mjs CHANGED
@@ -1,8 +1,6 @@
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
- import { t as PageLayoutContext } from "./PageLayoutContext-DjJ1_7Xc.mjs";
4
3
  import { t as themeDefault } from "./themeDefault-Z3KmyIbm.mjs";
5
- import { useContext } from "react";
6
4
  import { jsx } from "react/jsx-runtime";
7
5
  //#region src/AppBar/AppBar.tsx
8
6
  const shouldForwardProp = createShouldForwardProp([
@@ -60,12 +58,10 @@ const AppBarBase = styled(Flex, {
60
58
  width: "100%"
61
59
  }, elevationVariant, sizeVariants);
62
60
  function AppBar({ elevation = 4, size, ...rest }) {
63
- const isInBar = useContext(PageLayoutContext)?.region === "bar";
64
61
  return /* @__PURE__ */ jsx(AppBarBase, {
65
62
  as: "header",
66
63
  elevation,
67
64
  size,
68
- ...isInBar && { height: "100%" },
69
65
  ...rest
70
66
  });
71
67
  }
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-BmEAXmwh.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 { S as Theme } from "./themes-9YNnlVyY.cjs";
2
- import "./index-DkJzi96w.cjs";
3
- import { n as FlexProps } from "./index-BMJ3tyIw.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 { S as Theme } from "./themes-9YNnlVyY.mjs";
2
- import "./index-CEqa8xx8.mjs";
3
- import { n as FlexProps } from "./index-B41OXLX8.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-BQGlZoma.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-CvWslVk6.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-tv-TGYSG.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-BmEAXmwh.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-S3NZS-Qp.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-D4i9vrQM.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-BQGlZoma.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-CCrocxBL.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-BNpkmtaM.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-BmEAXmwh.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-CKLBJ7CC.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-BGD4OzzG.cjs";
2
- import { a as TypographyProps } from "./index-bN91IhZi.cjs";
3
- import { n as IconProps, r as IconName } from "./index-DPHwCZYf.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-BSR9zrAA.mjs";
2
- import { a as TypographyProps } from "./index-DuefjNlC.mjs";
3
- import { n as IconProps, r as IconName } from "./index-r2avCy1z.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-BQGlZoma.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-CkQGOBmm.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 { S as Theme, v as PaletteColor } from "./themes-9YNnlVyY.cjs";
2
- import "./index-DkJzi96w.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 { S as Theme, v as PaletteColor } from "./themes-9YNnlVyY.mjs";
2
- import "./index-CEqa8xx8.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 { S as Theme } from "./themes-9YNnlVyY.cjs";
2
- import "./index-DkJzi96w.cjs";
3
- import { n as ButtonColor } from "./index-S3NZS-Qp.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 { S as Theme } from "./themes-9YNnlVyY.mjs";
2
- import "./index-CEqa8xx8.mjs";
3
- import { n as ButtonColor } from "./index-D4i9vrQM.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-BGD4OzzG.cjs";
2
- import { s as ModalProps } from "./index-B8KscJic.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-BSR9zrAA.mjs";
2
- import { s as ModalProps } from "./index-qtKJ56yu.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 };