@soroush.tech/design-system 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +278 -0
- package/dist/AppBar.cjs +71 -0
- package/dist/AppBar.d.cts +23 -0
- package/dist/AppBar.d.mts +23 -0
- package/dist/AppBar.mjs +69 -0
- package/dist/Avatar.cjs +106 -0
- package/dist/Avatar.d.cts +28 -0
- package/dist/Avatar.d.mts +28 -0
- package/dist/Avatar.mjs +103 -0
- package/dist/Backdrop.cjs +26 -0
- package/dist/Backdrop.d.cts +10 -0
- package/dist/Backdrop.d.mts +10 -0
- package/dist/Backdrop.mjs +25 -0
- package/dist/Button.cjs +178 -0
- package/dist/Button.d.cts +2 -0
- package/dist/Button.d.mts +2 -0
- package/dist/Button.mjs +175 -0
- package/dist/ButtonGroup.cjs +110 -0
- package/dist/ButtonGroup.d.cts +2 -0
- package/dist/ButtonGroup.d.mts +2 -0
- package/dist/ButtonGroup.mjs +107 -0
- package/dist/ButtonGroupContext-DS-kl9lG.mjs +5 -0
- package/dist/ButtonGroupContext-NtkVeDVE.cjs +9 -0
- package/dist/Card.cjs +95 -0
- package/dist/Card.d.cts +18 -0
- package/dist/Card.d.mts +18 -0
- package/dist/Card.mjs +93 -0
- package/dist/Checkbox.cjs +192 -0
- package/dist/Checkbox.d.cts +2 -0
- package/dist/Checkbox.d.mts +2 -0
- package/dist/Checkbox.mjs +190 -0
- package/dist/CircularProgress.cjs +136 -0
- package/dist/CircularProgress.d.cts +34 -0
- package/dist/CircularProgress.d.mts +34 -0
- package/dist/CircularProgress.mjs +133 -0
- package/dist/CodeBlock.cjs +101 -0
- package/dist/CodeBlock.d.cts +2 -0
- package/dist/CodeBlock.d.mts +2 -0
- package/dist/CodeBlock.mjs +100 -0
- package/dist/Drawer.cjs +69 -0
- package/dist/Drawer.d.cts +22 -0
- package/dist/Drawer.d.mts +22 -0
- package/dist/Drawer.mjs +66 -0
- package/dist/Field.cjs +59 -0
- package/dist/Field.d.cts +36 -0
- package/dist/Field.d.mts +36 -0
- package/dist/Field.mjs +58 -0
- package/dist/Flex.cjs +21 -0
- package/dist/Flex.d.cts +2 -0
- package/dist/Flex.d.mts +2 -0
- package/dist/Flex.mjs +19 -0
- package/dist/FocusTrap.cjs +82 -0
- package/dist/FocusTrap.d.cts +24 -0
- package/dist/FocusTrap.d.mts +24 -0
- package/dist/FocusTrap.mjs +81 -0
- package/dist/Form.cjs +44 -0
- package/dist/Form.d.cts +41 -0
- package/dist/Form.d.mts +41 -0
- package/dist/Form.mjs +42 -0
- package/dist/FormContext-CRmRgDgu.cjs +10 -0
- package/dist/FormContext-_G3sxJyQ.mjs +6 -0
- package/dist/FormControl.cjs +84 -0
- package/dist/FormControl.d.cts +78 -0
- package/dist/FormControl.d.mts +78 -0
- package/dist/FormControl.mjs +81 -0
- package/dist/FormControlContext-CyxdOxdN.mjs +6 -0
- package/dist/FormControlContext-aeKTjRKY.cjs +10 -0
- package/dist/FormHelperText.cjs +40 -0
- package/dist/FormHelperText.d.cts +16 -0
- package/dist/FormHelperText.d.mts +16 -0
- package/dist/FormHelperText.mjs +39 -0
- package/dist/FormLabel.cjs +34 -0
- package/dist/FormLabel.d.cts +2 -0
- package/dist/FormLabel.d.mts +2 -0
- package/dist/FormLabel.mjs +33 -0
- package/dist/Grid.cjs +37 -0
- package/dist/Grid.d.cts +21 -0
- package/dist/Grid.d.mts +21 -0
- package/dist/Grid.mjs +32 -0
- package/dist/Icon-1YtNCUKo.cjs +755 -0
- package/dist/Icon-CAKRmFz3.mjs +742 -0
- package/dist/Icon.cjs +4 -0
- package/dist/Icon.d.cts +2 -0
- package/dist/Icon.d.mts +2 -0
- package/dist/Icon.mjs +2 -0
- package/dist/Image.cjs +82 -0
- package/dist/Image.d.cts +2 -0
- package/dist/Image.d.mts +2 -0
- package/dist/Image.mjs +80 -0
- package/dist/LinearProgress.cjs +217 -0
- package/dist/LinearProgress.d.cts +36 -0
- package/dist/LinearProgress.d.mts +36 -0
- package/dist/LinearProgress.mjs +214 -0
- package/dist/Link.cjs +64 -0
- package/dist/Link.d.cts +2 -0
- package/dist/Link.d.mts +2 -0
- package/dist/Link.mjs +62 -0
- package/dist/Markdown/Control.cjs +61 -0
- package/dist/Markdown/Control.d.cts +18 -0
- package/dist/Markdown/Control.d.mts +18 -0
- package/dist/Markdown/Control.mjs +60 -0
- package/dist/Markdown/Editor.cjs +130 -0
- package/dist/Markdown/Editor.d.cts +40 -0
- package/dist/Markdown/Editor.d.mts +40 -0
- package/dist/Markdown/Editor.mjs +128 -0
- package/dist/Markdown/Preview.cjs +241 -0
- package/dist/Markdown/Preview.d.cts +55 -0
- package/dist/Markdown/Preview.d.mts +55 -0
- package/dist/Markdown/Preview.mjs +236 -0
- package/dist/Markdown/Toolbar.cjs +4 -0
- package/dist/Markdown/Toolbar.d.cts +13 -0
- package/dist/Markdown/Toolbar.d.mts +13 -0
- package/dist/Markdown/Toolbar.mjs +2 -0
- package/dist/Markdown.cjs +13 -0
- package/dist/Markdown.d.cts +80 -0
- package/dist/Markdown.d.mts +80 -0
- package/dist/Markdown.mjs +6 -0
- package/dist/MarkdownContext-BN8A3W-J.mjs +11 -0
- package/dist/MarkdownContext-DSwjzpH8.cjs +22 -0
- package/dist/MenuItem.cjs +150 -0
- package/dist/MenuItem.d.cts +51 -0
- package/dist/MenuItem.d.mts +51 -0
- package/dist/MenuItem.mjs +147 -0
- package/dist/Modal-BDMPTSXv.cjs +351 -0
- package/dist/Modal-DR60peRg.mjs +327 -0
- package/dist/Modal.cjs +6 -0
- package/dist/Modal.d.cts +2 -0
- package/dist/Modal.d.mts +2 -0
- package/dist/Modal.mjs +2 -0
- package/dist/NativeSelect.cjs +189 -0
- package/dist/NativeSelect.d.cts +62 -0
- package/dist/NativeSelect.d.mts +62 -0
- package/dist/NativeSelect.mjs +186 -0
- package/dist/Pagination/PaginationItem.cjs +116 -0
- package/dist/Pagination/PaginationItem.d.cts +2 -0
- package/dist/Pagination/PaginationItem.d.mts +2 -0
- package/dist/Pagination/PaginationItem.mjs +114 -0
- package/dist/Pagination.cjs +134 -0
- package/dist/Pagination.d.cts +23 -0
- package/dist/Pagination.d.mts +23 -0
- package/dist/Pagination.mjs +130 -0
- package/dist/Paper.cjs +51 -0
- package/dist/Paper.d.cts +2 -0
- package/dist/Paper.d.mts +2 -0
- package/dist/Paper.mjs +48 -0
- package/dist/Popover-B61J7C79.mjs +252 -0
- package/dist/Popover-CRDLmywF.cjs +259 -0
- package/dist/Popover.cjs +3 -0
- package/dist/Popover.d.cts +84 -0
- package/dist/Popover.d.mts +84 -0
- package/dist/Popover.mjs +2 -0
- package/dist/Portal.cjs +20 -0
- package/dist/Portal.d.cts +18 -0
- package/dist/Portal.d.mts +18 -0
- package/dist/Portal.mjs +19 -0
- package/dist/Quote.cjs +11 -0
- package/dist/Quote.d.cts +2 -0
- package/dist/Quote.d.mts +2 -0
- package/dist/Quote.mjs +10 -0
- package/dist/Radio.cjs +143 -0
- package/dist/Radio.d.cts +38 -0
- package/dist/Radio.d.mts +38 -0
- package/dist/Radio.mjs +141 -0
- package/dist/Select.cjs +528 -0
- package/dist/Select.d.cts +68 -0
- package/dist/Select.d.mts +68 -0
- package/dist/Select.mjs +525 -0
- package/dist/Skeleton.cjs +82 -0
- package/dist/Skeleton.d.cts +21 -0
- package/dist/Skeleton.d.mts +21 -0
- package/dist/Skeleton.mjs +79 -0
- package/dist/Switch.cjs +332 -0
- package/dist/Switch.d.cts +40 -0
- package/dist/Switch.d.mts +40 -0
- package/dist/Switch.mjs +329 -0
- package/dist/Table/Table.cjs +65 -0
- package/dist/Table/Table.d.cts +2 -0
- package/dist/Table/Table.d.mts +2 -0
- package/dist/Table/Table.mjs +63 -0
- package/dist/Table/TableBody.cjs +42 -0
- package/dist/Table/TableBody.d.cts +2 -0
- package/dist/Table/TableBody.d.mts +2 -0
- package/dist/Table/TableBody.mjs +40 -0
- package/dist/Table/TableCell.cjs +93 -0
- package/dist/Table/TableCell.d.cts +2 -0
- package/dist/Table/TableCell.d.mts +2 -0
- package/dist/Table/TableCell.mjs +91 -0
- package/dist/Table/TableContainer.cjs +15 -0
- package/dist/Table/TableContainer.d.cts +2 -0
- package/dist/Table/TableContainer.d.mts +2 -0
- package/dist/Table/TableContainer.mjs +14 -0
- package/dist/Table/TableControl.cjs +42 -0
- package/dist/Table/TableControl.d.cts +2 -0
- package/dist/Table/TableControl.d.mts +2 -0
- package/dist/Table/TableControl.mjs +41 -0
- package/dist/Table/TableFooter.cjs +42 -0
- package/dist/Table/TableFooter.d.cts +2 -0
- package/dist/Table/TableFooter.d.mts +2 -0
- package/dist/Table/TableFooter.mjs +40 -0
- package/dist/Table/TableHead.cjs +42 -0
- package/dist/Table/TableHead.d.cts +2 -0
- package/dist/Table/TableHead.d.mts +2 -0
- package/dist/Table/TableHead.mjs +40 -0
- package/dist/Table/TablePagination.cjs +89 -0
- package/dist/Table/TablePagination.d.cts +2 -0
- package/dist/Table/TablePagination.d.mts +2 -0
- package/dist/Table/TablePagination.mjs +88 -0
- package/dist/Table/TablePaginationActions.cjs +65 -0
- package/dist/Table/TablePaginationActions.d.cts +2 -0
- package/dist/Table/TablePaginationActions.d.mts +2 -0
- package/dist/Table/TablePaginationActions.mjs +63 -0
- package/dist/Table/TableRow.cjs +56 -0
- package/dist/Table/TableRow.d.cts +2 -0
- package/dist/Table/TableRow.d.mts +2 -0
- package/dist/Table/TableRow.mjs +54 -0
- package/dist/Table/TableSortLabel.cjs +62 -0
- package/dist/Table/TableSortLabel.d.cts +2 -0
- package/dist/Table/TableSortLabel.d.mts +2 -0
- package/dist/Table/TableSortLabel.mjs +60 -0
- package/dist/Table/hooks.cjs +112 -0
- package/dist/Table/hooks.d.cts +3 -0
- package/dist/Table/hooks.d.mts +3 -0
- package/dist/Table/hooks.mjs +109 -0
- package/dist/Table.cjs +31 -0
- package/dist/Table.d.cts +16 -0
- package/dist/Table.d.mts +16 -0
- package/dist/Table.mjs +15 -0
- package/dist/TableContext-2qH7XYJB.d.cts +19 -0
- package/dist/TableContext-2qH7XYJB.d.mts +19 -0
- package/dist/TableContext-BRWPghAI.mjs +6 -0
- package/dist/TableContext-qqp35o8z.cjs +10 -0
- package/dist/TableSectionContext-meIG4lFZ.mjs +5 -0
- package/dist/TableSectionContext-pYlJ-duI.cjs +9 -0
- package/dist/TextInput-6o37Zddp.cjs +231 -0
- package/dist/TextInput-D_lHYJlL.mjs +224 -0
- package/dist/TextInput.cjs +3 -0
- package/dist/TextInput.d.cts +2 -0
- package/dist/TextInput.d.mts +2 -0
- package/dist/TextInput.mjs +2 -0
- package/dist/ThemeProvider.cjs +15 -0
- package/dist/ThemeProvider.d.cts +20 -0
- package/dist/ThemeProvider.d.mts +20 -0
- package/dist/ThemeProvider.mjs +14 -0
- package/dist/ToggleButton/ToggleButton.cjs +58 -0
- package/dist/ToggleButton/ToggleButton.d.cts +14 -0
- package/dist/ToggleButton/ToggleButton.d.mts +14 -0
- package/dist/ToggleButton/ToggleButton.mjs +56 -0
- package/dist/ToggleButton/ToggleButtonGroup.cjs +54 -0
- package/dist/ToggleButton/ToggleButtonGroup.d.cts +23 -0
- package/dist/ToggleButton/ToggleButtonGroup.d.mts +23 -0
- package/dist/ToggleButton/ToggleButtonGroup.mjs +52 -0
- package/dist/ToggleButton.cjs +7 -0
- package/dist/ToggleButton.d.cts +4 -0
- package/dist/ToggleButton.d.mts +4 -0
- package/dist/ToggleButton.mjs +4 -0
- package/dist/ToggleButtonGroupContext-CqD-Afho.d.cts +15 -0
- package/dist/ToggleButtonGroupContext-CqD-Afho.d.mts +15 -0
- package/dist/ToggleButtonGroupContext-DxIyy8ze.mjs +5 -0
- package/dist/ToggleButtonGroupContext-Ewc5Ixas.cjs +9 -0
- package/dist/Toolbar-B-W22Sk4.cjs +459 -0
- package/dist/Toolbar-KbR97iJS.mjs +448 -0
- package/dist/Typography.cjs +64 -0
- package/dist/Typography.d.cts +3 -0
- package/dist/Typography.d.mts +3 -0
- package/dist/Typography.mjs +61 -0
- package/dist/View.cjs +40 -0
- package/dist/View.d.cts +2 -0
- package/dist/View.d.mts +2 -0
- package/dist/View.mjs +38 -0
- package/dist/applyAction-B2B-hnP3.mjs +98 -0
- package/dist/applyAction-B2uVHxOE.cjs +103 -0
- package/dist/createTheme-Dts2F4R_.d.cts +21 -0
- package/dist/createTheme-Dts2F4R_.d.mts +21 -0
- package/dist/hooks/useCopyToClipboard.cjs +33 -0
- package/dist/hooks/useCopyToClipboard.d.cts +16 -0
- package/dist/hooks/useCopyToClipboard.d.mts +16 -0
- package/dist/hooks/useCopyToClipboard.mjs +31 -0
- package/dist/hooks.cjs +52 -0
- package/dist/hooks.d.cts +40 -0
- package/dist/hooks.d.mts +40 -0
- package/dist/hooks.mjs +41 -0
- package/dist/index-4rC2j7fR.d.cts +46 -0
- package/dist/index-8dzWTpFp.d.cts +24 -0
- package/dist/index-B1rCD6Oo.d.cts +17 -0
- package/dist/index-BH8jQOdF.d.mts +46 -0
- package/dist/index-BLRMuO_x.d.mts +24 -0
- package/dist/index-BLfFycfJ.d.mts +72 -0
- package/dist/index-BPrjvi7B.d.cts +13 -0
- package/dist/index-BX5-NfbX.d.cts +94 -0
- package/dist/index-Bihpwn75.d.cts +64 -0
- package/dist/index-BlfIbAMs.d.cts +45 -0
- package/dist/index-BnzUumAC2.d.mts +30 -0
- package/dist/index-BoqlPb3Z.d.mts +13 -0
- package/dist/index-BqVgv2B_.d.mts +42 -0
- package/dist/index-Bwi4kRpf.d.mts +79 -0
- package/dist/index-Bx24ZnOV.d.mts +43 -0
- package/dist/index-C-P_hipv.d.mts +21 -0
- package/dist/index-C0xMvDjL.d.mts +49 -0
- package/dist/index-C5_ciaeo.d.cts +79 -0
- package/dist/index-CDVnvjIE.d.cts +27 -0
- package/dist/index-CDcGTGR4.d.cts +21 -0
- package/dist/index-CEOZI-6L.d.mts +48 -0
- package/dist/index-CLU39rUS2.d.mts +30 -0
- package/dist/index-CM_KCTee.d.cts +48 -0
- package/dist/index-CT9uGKrs.d.cts +30 -0
- package/dist/index-CcYSvIJi.d.cts +21 -0
- package/dist/index-CdF_4ckE.d.mts +11 -0
- package/dist/index-CeYkEXU2.d.cts +68 -0
- package/dist/index-Cl_yBpzW2.d.mts +13 -0
- package/dist/index-Cv_UOfYx.d.mts +18 -0
- package/dist/index-CxSNNzBT2.d.mts +68 -0
- package/dist/index-CyZYXDn0.d.cts +42 -0
- package/dist/index-DASvoACZ.d.cts +49 -0
- package/dist/index-DBGE6yKw.d.mts +16 -0
- package/dist/index-DCQ2fsDu.d.mts +40 -0
- package/dist/index-DD2AVtiR.d.cts +16 -0
- package/dist/index-DE5PtzPn.d.mts +27 -0
- package/dist/index-DOPXpr2J.d.cts +43 -0
- package/dist/index-DSCMXFTn.d.cts +30 -0
- package/dist/index-DTkQSXQD.d.cts +11 -0
- package/dist/index-DeJWkpf9.d.cts +16 -0
- package/dist/index-DeiZHSwA.d.cts +12 -0
- package/dist/index-Des8BisQ.d.mts +12 -0
- package/dist/index-Dg8-CPOO.d.cts +18 -0
- package/dist/index-DgRS5Aqv.d.mts +16 -0
- package/dist/index-Dm9HfgV6.d.mts +63 -0
- package/dist/index-DmJIuQJj.d.mts +24 -0
- package/dist/index-Dp81rWM1.d.cts +72 -0
- package/dist/index-Dtzj8X58.d.cts +40 -0
- package/dist/index-DvW2eETV.d.mts +21 -0
- package/dist/index-Dy03o__A.d.mts +94 -0
- package/dist/index-FwTocqhP.d.cts +34 -0
- package/dist/index-GVsFY00r.d.cts +21 -0
- package/dist/index-Nqco3fsM.d.cts +13 -0
- package/dist/index-g-9DZ_KQ.d.cts +28 -0
- package/dist/index-g9EThkSg.d.mts +21 -0
- package/dist/index-kpk9e3xM2.d.mts +45 -0
- package/dist/index-pX7tBQdJ.d.mts +34 -0
- package/dist/index-u57CbuAU2.d.mts +28 -0
- package/dist/index-x80UG39F.d.cts +24 -0
- package/dist/index-z35LEYG8.d.mts +17 -0
- package/dist/index.cjs +68 -0
- package/dist/index.d.cts +4 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.mjs +3 -0
- package/dist/inputVariantStyles-BBkkYQtE.cjs +32 -0
- package/dist/inputVariantStyles-CcqpGfuP.mjs +28 -0
- package/dist/rolldown-runtime-BBjsoOtd.mjs +27 -0
- package/dist/rolldown-runtime-DDXJien1.cjs +50 -0
- package/dist/src-BiocWFSR.cjs +60 -0
- package/dist/src-DcNT2aIK.mjs +49 -0
- package/dist/themeDefault-B-QjpGEO.cjs +16 -0
- package/dist/themeDefault-CjXaY3ok.mjs +11 -0
- package/dist/themes-D1SAp3SL.d.mts +500 -0
- package/dist/themes-D81JYbqm.d.cts +500 -0
- package/dist/themes.cjs +318 -0
- package/dist/themes.d.cts +3 -0
- package/dist/themes.d.mts +3 -0
- package/dist/themes.mjs +303 -0
- package/dist/useDefaultProps-Cb-5FNok.cjs +19 -0
- package/dist/useDefaultProps-CoApb4KT.mjs +14 -0
- package/dist/useTableSort--XMWjujs.d.cts +51 -0
- package/dist/useTableSort-CpDs4cGq.d.mts +51 -0
- package/dist/utils/styleCache.cjs +7 -0
- package/dist/utils/styleCache.d.cts +3 -0
- package/dist/utils/styleCache.d.mts +4 -0
- package/dist/utils/styleCache.mjs +5 -0
- package/dist/utils.cjs +65 -0
- package/dist/utils.d.cts +39 -0
- package/dist/utils.d.mts +39 -0
- package/dist/utils.mjs +58 -0
- package/package.json +125 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
const require_src = require("./src-BiocWFSR.cjs");
|
|
2
|
+
const require_Paper = require("./Paper.cjs");
|
|
3
|
+
const require_Modal = require("./Modal-BDMPTSXv.cjs");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
let _soroush_tech_styled_system_should_forward_prop = require("@soroush.tech/styled-system/should-forward-prop");
|
|
7
|
+
let _emotion_react = require("@emotion/react");
|
|
8
|
+
//#region src/Popover/utils/resolveAnchorEl.ts
|
|
9
|
+
/** Resolves the `anchorEl` prop, which may be an element or a function returning one. */
|
|
10
|
+
function resolveAnchorEl(anchorEl) {
|
|
11
|
+
return (typeof anchorEl === "function" ? anchorEl() : anchorEl) ?? null;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/Popover/utils/getOffset.ts
|
|
15
|
+
/** Vertical offset within a rect for an anchor/transform origin keyword or explicit px. */
|
|
16
|
+
function getOffsetTop(rect, vertical) {
|
|
17
|
+
if (typeof vertical === "number") return vertical;
|
|
18
|
+
if (vertical === "center") return rect.height / 2;
|
|
19
|
+
if (vertical === "bottom") return rect.height;
|
|
20
|
+
return 0;
|
|
21
|
+
}
|
|
22
|
+
/** Horizontal offset within a rect for an anchor/transform origin keyword or explicit px. */
|
|
23
|
+
function getOffsetLeft(rect, horizontal) {
|
|
24
|
+
if (typeof horizontal === "number") return horizontal;
|
|
25
|
+
if (horizontal === "center") return rect.width / 2;
|
|
26
|
+
if (horizontal === "right") return rect.width;
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/Popover/utils/getTransformOriginValue.ts
|
|
31
|
+
/** Serializes a resolved transform origin (in px) to a CSS `transform-origin` value. */
|
|
32
|
+
function getTransformOriginValue(origin) {
|
|
33
|
+
return `${origin.horizontal}px ${origin.vertical}px`;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/Popover/utils/computePopoverPosition.ts
|
|
37
|
+
/** Mirrors a keyword origin to the opposite edge; numbers and `center` are unchanged. */
|
|
38
|
+
function flipVertical(origin) {
|
|
39
|
+
if (origin === "top") return "bottom";
|
|
40
|
+
if (origin === "bottom") return "top";
|
|
41
|
+
return origin;
|
|
42
|
+
}
|
|
43
|
+
function flipHorizontal(origin) {
|
|
44
|
+
if (origin === "left") return "right";
|
|
45
|
+
if (origin === "right") return "left";
|
|
46
|
+
return origin;
|
|
47
|
+
}
|
|
48
|
+
function resolveAxis({ anchorStart, anchorSize, anchorOrigin, transformOrigin, paperSize, viewportSize, margin, offset, flip }) {
|
|
49
|
+
const preferredTransform = offset(paperSize, transformOrigin);
|
|
50
|
+
const preferredPosition = anchorStart + offset(anchorSize, anchorOrigin) - preferredTransform;
|
|
51
|
+
let position = preferredPosition;
|
|
52
|
+
let transformOffset = preferredTransform;
|
|
53
|
+
if (margin != null) {
|
|
54
|
+
const fits = (candidate) => candidate >= margin && candidate + paperSize <= viewportSize - margin;
|
|
55
|
+
if (!fits(preferredPosition)) {
|
|
56
|
+
const flippedTransform = offset(paperSize, flip(transformOrigin));
|
|
57
|
+
const flippedPosition = anchorStart + offset(anchorSize, flip(anchorOrigin)) - flippedTransform;
|
|
58
|
+
if (fits(flippedPosition)) {
|
|
59
|
+
position = flippedPosition;
|
|
60
|
+
transformOffset = flippedTransform;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (position < margin) {
|
|
64
|
+
const diff = position - margin;
|
|
65
|
+
position -= diff;
|
|
66
|
+
transformOffset += diff;
|
|
67
|
+
} else if (position + paperSize > viewportSize - margin) {
|
|
68
|
+
const diff = position + paperSize - (viewportSize - margin);
|
|
69
|
+
position -= diff;
|
|
70
|
+
transformOffset += diff;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
position,
|
|
75
|
+
transformOffset
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Places the paper so its `transformOrigin` meets the anchor's `anchorOrigin`, flipping
|
|
80
|
+
* to the opposite side at a viewport edge and clamping as a fallback. Returns `null`
|
|
81
|
+
* coordinates for `anchorReference === 'none'`.
|
|
82
|
+
*/
|
|
83
|
+
function computePopoverPosition(params) {
|
|
84
|
+
const { anchorReference, anchorRect, anchorPosition, paperRect, anchorOrigin, transformOrigin, viewport, marginThreshold } = params;
|
|
85
|
+
if (anchorReference === "none") return {
|
|
86
|
+
top: null,
|
|
87
|
+
left: null,
|
|
88
|
+
transformOrigin: getTransformOriginValue({
|
|
89
|
+
vertical: getOffsetTop(paperRect, transformOrigin.vertical),
|
|
90
|
+
horizontal: getOffsetLeft(paperRect, transformOrigin.horizontal)
|
|
91
|
+
})
|
|
92
|
+
};
|
|
93
|
+
const rect = anchorReference === "anchorPosition" ? {
|
|
94
|
+
top: anchorPosition?.top ?? 0,
|
|
95
|
+
left: anchorPosition?.left ?? 0,
|
|
96
|
+
width: 0,
|
|
97
|
+
height: 0
|
|
98
|
+
} : anchorRect ?? {
|
|
99
|
+
top: 0,
|
|
100
|
+
left: 0,
|
|
101
|
+
width: 0,
|
|
102
|
+
height: 0
|
|
103
|
+
};
|
|
104
|
+
const vertical = resolveAxis({
|
|
105
|
+
anchorStart: rect.top,
|
|
106
|
+
anchorSize: rect.height,
|
|
107
|
+
anchorOrigin: anchorOrigin.vertical,
|
|
108
|
+
transformOrigin: transformOrigin.vertical,
|
|
109
|
+
paperSize: paperRect.height,
|
|
110
|
+
viewportSize: viewport.height,
|
|
111
|
+
margin: marginThreshold,
|
|
112
|
+
offset: (size, origin) => getOffsetTop({ height: size }, origin),
|
|
113
|
+
flip: (origin) => flipVertical(origin)
|
|
114
|
+
});
|
|
115
|
+
const horizontal = resolveAxis({
|
|
116
|
+
anchorStart: rect.left,
|
|
117
|
+
anchorSize: rect.width,
|
|
118
|
+
anchorOrigin: anchorOrigin.horizontal,
|
|
119
|
+
transformOrigin: transformOrigin.horizontal,
|
|
120
|
+
paperSize: paperRect.width,
|
|
121
|
+
viewportSize: viewport.width,
|
|
122
|
+
margin: marginThreshold,
|
|
123
|
+
offset: (size, origin) => getOffsetLeft({ width: size }, origin),
|
|
124
|
+
flip: (origin) => flipHorizontal(origin)
|
|
125
|
+
});
|
|
126
|
+
return {
|
|
127
|
+
top: Math.floor(vertical.position),
|
|
128
|
+
left: Math.floor(horizontal.position),
|
|
129
|
+
transformOrigin: getTransformOriginValue({
|
|
130
|
+
vertical: vertical.transformOffset,
|
|
131
|
+
horizontal: horizontal.transformOffset
|
|
132
|
+
})
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/Popover/Popover.tsx
|
|
137
|
+
const ANCHOR_ORIGIN_DEFAULT = {
|
|
138
|
+
vertical: "top",
|
|
139
|
+
horizontal: "left"
|
|
140
|
+
};
|
|
141
|
+
const Positioner = require_src.styled("div", {
|
|
142
|
+
name: "Popover",
|
|
143
|
+
slot: "positioner",
|
|
144
|
+
label: "PopoverPositioner",
|
|
145
|
+
shouldForwardProp: (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)(["isPositioned"])
|
|
146
|
+
})(({ isPositioned }) => ({
|
|
147
|
+
position: "absolute",
|
|
148
|
+
...isPositioned ? {} : { opacity: 0 }
|
|
149
|
+
}));
|
|
150
|
+
const Surface = require_src.styled(require_Paper.Paper, {
|
|
151
|
+
name: "Popover",
|
|
152
|
+
label: "Popover"
|
|
153
|
+
})({
|
|
154
|
+
overflowY: "auto",
|
|
155
|
+
overflowX: "hidden",
|
|
156
|
+
minWidth: 16,
|
|
157
|
+
minHeight: 16,
|
|
158
|
+
maxWidth: "calc(100vw - 32px)",
|
|
159
|
+
maxHeight: "calc(100vh - 32px)",
|
|
160
|
+
outline: 0
|
|
161
|
+
});
|
|
162
|
+
/**
|
|
163
|
+
* @description Positions its content next to an anchor, portaled above the page.
|
|
164
|
+
* Built on `Modal`, so it inherits the portal, optional backdrop, focus management,
|
|
165
|
+
* scroll lock, and Escape/click-away close — then adds anchor positioning
|
|
166
|
+
* (`anchorOrigin`/`transformOrigin`/`marginThreshold`).
|
|
167
|
+
*/
|
|
168
|
+
function Popover({ open, children, anchorEl = null, anchorReference = "anchorEl", anchorPosition, anchorOrigin = ANCHOR_ORIGIN_DEFAULT, transformOrigin = ANCHOR_ORIGIN_DEFAULT, onClose, elevation = 8, marginThreshold = 2, container, action, slotProps, hasBackdrop = false, disableScrollLock = false, disableAriaHidden = false, shouldAutoFocus = true, shouldTrapFocus = true, shouldEnforceFocus = true, shouldRestoreFocus = true, shouldKeepMounted = false, layer = "modal" }) {
|
|
169
|
+
const theme = (0, _emotion_react.useTheme)();
|
|
170
|
+
const positionerRef = (0, react.useRef)(null);
|
|
171
|
+
const [isPositioned, setIsPositioned] = (0, react.useState)(false);
|
|
172
|
+
const anchorTop = anchorPosition?.top;
|
|
173
|
+
const anchorLeft = anchorPosition?.left;
|
|
174
|
+
const marginThresholdPx = marginThreshold == null ? null : Number.parseFloat(String(theme.space[marginThreshold]));
|
|
175
|
+
const setPositioningStyles = (0, react.useCallback)(() => {
|
|
176
|
+
const element = positionerRef.current;
|
|
177
|
+
if (!element) return;
|
|
178
|
+
const resolved = resolveAnchorEl(anchorEl);
|
|
179
|
+
const positioning = computePopoverPosition({
|
|
180
|
+
anchorReference,
|
|
181
|
+
anchorRect: anchorReference === "anchorEl" && resolved ? resolved.getBoundingClientRect() : null,
|
|
182
|
+
anchorPosition: anchorTop != null && anchorLeft != null ? {
|
|
183
|
+
top: anchorTop,
|
|
184
|
+
left: anchorLeft
|
|
185
|
+
} : void 0,
|
|
186
|
+
paperRect: {
|
|
187
|
+
width: element.offsetWidth,
|
|
188
|
+
height: element.offsetHeight
|
|
189
|
+
},
|
|
190
|
+
anchorOrigin,
|
|
191
|
+
transformOrigin,
|
|
192
|
+
viewport: {
|
|
193
|
+
width: window.innerWidth,
|
|
194
|
+
height: window.innerHeight
|
|
195
|
+
},
|
|
196
|
+
marginThreshold: marginThresholdPx
|
|
197
|
+
});
|
|
198
|
+
if (positioning.top !== null) element.style.top = `${positioning.top}px`;
|
|
199
|
+
if (positioning.left !== null) element.style.left = `${positioning.left}px`;
|
|
200
|
+
element.style.transformOrigin = positioning.transformOrigin;
|
|
201
|
+
setIsPositioned(true);
|
|
202
|
+
}, [
|
|
203
|
+
anchorEl,
|
|
204
|
+
anchorReference,
|
|
205
|
+
anchorTop,
|
|
206
|
+
anchorLeft,
|
|
207
|
+
anchorOrigin,
|
|
208
|
+
transformOrigin,
|
|
209
|
+
marginThresholdPx
|
|
210
|
+
]);
|
|
211
|
+
(0, react.useLayoutEffect)(() => {
|
|
212
|
+
if (open) setPositioningStyles();
|
|
213
|
+
});
|
|
214
|
+
(0, react.useEffect)(() => {
|
|
215
|
+
if (!open) return;
|
|
216
|
+
const handle = () => setPositioningStyles();
|
|
217
|
+
window.addEventListener("resize", handle);
|
|
218
|
+
if (disableScrollLock) window.addEventListener("scroll", handle, true);
|
|
219
|
+
return () => {
|
|
220
|
+
window.removeEventListener("resize", handle);
|
|
221
|
+
window.removeEventListener("scroll", handle, true);
|
|
222
|
+
};
|
|
223
|
+
}, [
|
|
224
|
+
open,
|
|
225
|
+
disableScrollLock,
|
|
226
|
+
setPositioningStyles
|
|
227
|
+
]);
|
|
228
|
+
(0, react.useImperativeHandle)(action, () => ({ updatePosition: setPositioningStyles }), [setPositioningStyles]);
|
|
229
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Modal.Modal, {
|
|
230
|
+
isOpen: open,
|
|
231
|
+
onClose,
|
|
232
|
+
hasBackdrop,
|
|
233
|
+
shouldKeepMounted,
|
|
234
|
+
shouldLockScroll: !disableScrollLock,
|
|
235
|
+
disableAriaHidden,
|
|
236
|
+
shouldAutoFocus,
|
|
237
|
+
shouldTrapFocus,
|
|
238
|
+
shouldEnforceFocus,
|
|
239
|
+
shouldRestoreFocus,
|
|
240
|
+
portalContainer: container,
|
|
241
|
+
layer,
|
|
242
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Positioner, {
|
|
243
|
+
ref: positionerRef,
|
|
244
|
+
isPositioned,
|
|
245
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Surface, {
|
|
246
|
+
elevation,
|
|
247
|
+
...slotProps?.paper,
|
|
248
|
+
children
|
|
249
|
+
})
|
|
250
|
+
})
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
//#endregion
|
|
254
|
+
Object.defineProperty(exports, "Popover", {
|
|
255
|
+
enumerable: true,
|
|
256
|
+
get: function() {
|
|
257
|
+
return Popover;
|
|
258
|
+
}
|
|
259
|
+
});
|
package/dist/Popover.cjs
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { o as Theme } from "./index-Bihpwn75.cjs";
|
|
2
|
+
import { n as PaperElevation, r as PaperProps } from "./index-x80UG39F.cjs";
|
|
3
|
+
import { c as ModalCloseReason } from "./index-BX5-NfbX.cjs";
|
|
4
|
+
import { ReactNode, Ref } from "react";
|
|
5
|
+
//#region src/Popover/utils/resolveAnchorEl.d.ts
|
|
6
|
+
type PopoverAnchorEl = HTMLElement | (() => HTMLElement | null) | null;
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/Popover/utils/getOffset.d.ts
|
|
9
|
+
type PopoverVerticalOrigin = 'top' | 'center' | 'bottom' | number;
|
|
10
|
+
type PopoverHorizontalOrigin = 'left' | 'center' | 'right' | number;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/Popover/utils/computePopoverPosition.d.ts
|
|
13
|
+
interface PopoverOrigin {
|
|
14
|
+
vertical: PopoverVerticalOrigin;
|
|
15
|
+
horizontal: PopoverHorizontalOrigin;
|
|
16
|
+
}
|
|
17
|
+
type PopoverReference = 'anchorEl' | 'anchorPosition' | 'none';
|
|
18
|
+
interface PopoverPosition {
|
|
19
|
+
top: number;
|
|
20
|
+
left: number;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/Popover/Popover.d.ts
|
|
24
|
+
interface PopoverActions {
|
|
25
|
+
/** Recomputes the popover's position against its anchor. */
|
|
26
|
+
updatePosition: () => void;
|
|
27
|
+
}
|
|
28
|
+
interface PopoverProps {
|
|
29
|
+
/** If true, the popover is shown. */
|
|
30
|
+
open: boolean;
|
|
31
|
+
/** The content of the popover. */
|
|
32
|
+
children: ReactNode;
|
|
33
|
+
/** An element, or a function returning one, used to position the popover. */
|
|
34
|
+
anchorEl?: PopoverAnchorEl;
|
|
35
|
+
/** Which anchor to position against. Default: `'anchorEl'`. */
|
|
36
|
+
anchorReference?: PopoverReference;
|
|
37
|
+
/** Client coordinates used when `anchorReference` is `'anchorPosition'`. */
|
|
38
|
+
anchorPosition?: PopoverPosition;
|
|
39
|
+
/** The point on the anchor the popover attaches to. Default: `{ vertical: 'top', horizontal: 'left' }`. */
|
|
40
|
+
anchorOrigin?: PopoverOrigin;
|
|
41
|
+
/** The point on the popover that meets the anchor. Default: `{ vertical: 'top', horizontal: 'left' }`. */
|
|
42
|
+
transformOrigin?: PopoverOrigin;
|
|
43
|
+
/** Fired on Escape (top layer) or a click outside the surface. */
|
|
44
|
+
onClose?: (event: Event | React.SyntheticEvent, reason: ModalCloseReason) => void;
|
|
45
|
+
/** Shadow depth of the surface. Default: 8. */
|
|
46
|
+
elevation?: PaperElevation;
|
|
47
|
+
/** Minimum gap from the viewport edge as a spacing token (resolved against `theme.space`, e.g. `2` → 16px); `null` disables clamping/flipping. Default: `2`. */
|
|
48
|
+
marginThreshold?: Exclude<keyof Theme['space'], 'auto'> | null;
|
|
49
|
+
/** Portal target passed to the underlying Modal. */
|
|
50
|
+
container?: HTMLElement | (() => HTMLElement | null) | null;
|
|
51
|
+
/** Ref for imperative actions — currently `updatePosition()`. */
|
|
52
|
+
action?: Ref<PopoverActions>;
|
|
53
|
+
/** Props for the paper slot (the surface). */
|
|
54
|
+
slotProps?: {
|
|
55
|
+
paper?: PaperProps;
|
|
56
|
+
};
|
|
57
|
+
/** Render the dimmed backdrop. Default: false (an invisible click-away layer via the Modal root). */
|
|
58
|
+
hasBackdrop?: boolean;
|
|
59
|
+
/** Disable body scroll-lock. When true, the popover re-positions on scroll. Default: false. */
|
|
60
|
+
disableScrollLock?: boolean;
|
|
61
|
+
/** Skip `aria-hidden` on background content — for non-modal popovers whose trigger stays focused. Default: false. */
|
|
62
|
+
disableAriaHidden?: boolean;
|
|
63
|
+
/** Move focus into the popover on open. Default: true. */
|
|
64
|
+
shouldAutoFocus?: boolean;
|
|
65
|
+
/** Trap Tab focus within the popover. Default: true. */
|
|
66
|
+
shouldTrapFocus?: boolean;
|
|
67
|
+
/** Pull focus back whenever it escapes. Default: true. */
|
|
68
|
+
shouldEnforceFocus?: boolean;
|
|
69
|
+
/** Restore focus to the trigger on close. Default: true. */
|
|
70
|
+
shouldRestoreFocus?: boolean;
|
|
71
|
+
/** Keep the content mounted while closed. Default: false. */
|
|
72
|
+
shouldKeepMounted?: boolean;
|
|
73
|
+
/** Stacking layer from `theme.zOrder`. Default: 'modal'. */
|
|
74
|
+
layer?: keyof Theme['zOrder'];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @description Positions its content next to an anchor, portaled above the page.
|
|
78
|
+
* Built on `Modal`, so it inherits the portal, optional backdrop, focus management,
|
|
79
|
+
* scroll lock, and Escape/click-away close — then adds anchor positioning
|
|
80
|
+
* (`anchorOrigin`/`transformOrigin`/`marginThreshold`).
|
|
81
|
+
*/
|
|
82
|
+
declare function Popover({ open, children, anchorEl, anchorReference, anchorPosition, anchorOrigin, transformOrigin, onClose, elevation, marginThreshold, container, action, slotProps, hasBackdrop, disableScrollLock, disableAriaHidden, shouldAutoFocus, shouldTrapFocus, shouldEnforceFocus, shouldRestoreFocus, shouldKeepMounted, layer }: Readonly<PopoverProps>): import("react").JSX.Element;
|
|
83
|
+
//#endregion
|
|
84
|
+
export { Popover, PopoverActions, type PopoverAnchorEl, type PopoverOrigin, type PopoverPosition, PopoverProps, type PopoverReference };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { o as Theme } from "./index-Dm9HfgV6.mjs";
|
|
2
|
+
import { n as PaperElevation, r as PaperProps } from "./index-BLRMuO_x.mjs";
|
|
3
|
+
import { c as ModalCloseReason } from "./index-Dy03o__A.mjs";
|
|
4
|
+
import { ReactNode, Ref } from "react";
|
|
5
|
+
//#region src/Popover/utils/resolveAnchorEl.d.ts
|
|
6
|
+
type PopoverAnchorEl = HTMLElement | (() => HTMLElement | null) | null;
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/Popover/utils/getOffset.d.ts
|
|
9
|
+
type PopoverVerticalOrigin = 'top' | 'center' | 'bottom' | number;
|
|
10
|
+
type PopoverHorizontalOrigin = 'left' | 'center' | 'right' | number;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/Popover/utils/computePopoverPosition.d.ts
|
|
13
|
+
interface PopoverOrigin {
|
|
14
|
+
vertical: PopoverVerticalOrigin;
|
|
15
|
+
horizontal: PopoverHorizontalOrigin;
|
|
16
|
+
}
|
|
17
|
+
type PopoverReference = 'anchorEl' | 'anchorPosition' | 'none';
|
|
18
|
+
interface PopoverPosition {
|
|
19
|
+
top: number;
|
|
20
|
+
left: number;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/Popover/Popover.d.ts
|
|
24
|
+
interface PopoverActions {
|
|
25
|
+
/** Recomputes the popover's position against its anchor. */
|
|
26
|
+
updatePosition: () => void;
|
|
27
|
+
}
|
|
28
|
+
interface PopoverProps {
|
|
29
|
+
/** If true, the popover is shown. */
|
|
30
|
+
open: boolean;
|
|
31
|
+
/** The content of the popover. */
|
|
32
|
+
children: ReactNode;
|
|
33
|
+
/** An element, or a function returning one, used to position the popover. */
|
|
34
|
+
anchorEl?: PopoverAnchorEl;
|
|
35
|
+
/** Which anchor to position against. Default: `'anchorEl'`. */
|
|
36
|
+
anchorReference?: PopoverReference;
|
|
37
|
+
/** Client coordinates used when `anchorReference` is `'anchorPosition'`. */
|
|
38
|
+
anchorPosition?: PopoverPosition;
|
|
39
|
+
/** The point on the anchor the popover attaches to. Default: `{ vertical: 'top', horizontal: 'left' }`. */
|
|
40
|
+
anchorOrigin?: PopoverOrigin;
|
|
41
|
+
/** The point on the popover that meets the anchor. Default: `{ vertical: 'top', horizontal: 'left' }`. */
|
|
42
|
+
transformOrigin?: PopoverOrigin;
|
|
43
|
+
/** Fired on Escape (top layer) or a click outside the surface. */
|
|
44
|
+
onClose?: (event: Event | React.SyntheticEvent, reason: ModalCloseReason) => void;
|
|
45
|
+
/** Shadow depth of the surface. Default: 8. */
|
|
46
|
+
elevation?: PaperElevation;
|
|
47
|
+
/** Minimum gap from the viewport edge as a spacing token (resolved against `theme.space`, e.g. `2` → 16px); `null` disables clamping/flipping. Default: `2`. */
|
|
48
|
+
marginThreshold?: Exclude<keyof Theme['space'], 'auto'> | null;
|
|
49
|
+
/** Portal target passed to the underlying Modal. */
|
|
50
|
+
container?: HTMLElement | (() => HTMLElement | null) | null;
|
|
51
|
+
/** Ref for imperative actions — currently `updatePosition()`. */
|
|
52
|
+
action?: Ref<PopoverActions>;
|
|
53
|
+
/** Props for the paper slot (the surface). */
|
|
54
|
+
slotProps?: {
|
|
55
|
+
paper?: PaperProps;
|
|
56
|
+
};
|
|
57
|
+
/** Render the dimmed backdrop. Default: false (an invisible click-away layer via the Modal root). */
|
|
58
|
+
hasBackdrop?: boolean;
|
|
59
|
+
/** Disable body scroll-lock. When true, the popover re-positions on scroll. Default: false. */
|
|
60
|
+
disableScrollLock?: boolean;
|
|
61
|
+
/** Skip `aria-hidden` on background content — for non-modal popovers whose trigger stays focused. Default: false. */
|
|
62
|
+
disableAriaHidden?: boolean;
|
|
63
|
+
/** Move focus into the popover on open. Default: true. */
|
|
64
|
+
shouldAutoFocus?: boolean;
|
|
65
|
+
/** Trap Tab focus within the popover. Default: true. */
|
|
66
|
+
shouldTrapFocus?: boolean;
|
|
67
|
+
/** Pull focus back whenever it escapes. Default: true. */
|
|
68
|
+
shouldEnforceFocus?: boolean;
|
|
69
|
+
/** Restore focus to the trigger on close. Default: true. */
|
|
70
|
+
shouldRestoreFocus?: boolean;
|
|
71
|
+
/** Keep the content mounted while closed. Default: false. */
|
|
72
|
+
shouldKeepMounted?: boolean;
|
|
73
|
+
/** Stacking layer from `theme.zOrder`. Default: 'modal'. */
|
|
74
|
+
layer?: keyof Theme['zOrder'];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @description Positions its content next to an anchor, portaled above the page.
|
|
78
|
+
* Built on `Modal`, so it inherits the portal, optional backdrop, focus management,
|
|
79
|
+
* scroll lock, and Escape/click-away close — then adds anchor positioning
|
|
80
|
+
* (`anchorOrigin`/`transformOrigin`/`marginThreshold`).
|
|
81
|
+
*/
|
|
82
|
+
declare function Popover({ open, children, anchorEl, anchorReference, anchorPosition, anchorOrigin, transformOrigin, onClose, elevation, marginThreshold, container, action, slotProps, hasBackdrop, disableScrollLock, disableAriaHidden, shouldAutoFocus, shouldTrapFocus, shouldEnforceFocus, shouldRestoreFocus, shouldKeepMounted, layer }: Readonly<PopoverProps>): import("react").JSX.Element;
|
|
83
|
+
//#endregion
|
|
84
|
+
export { Popover, PopoverActions, type PopoverAnchorEl, type PopoverOrigin, type PopoverPosition, PopoverProps, type PopoverReference };
|
package/dist/Popover.mjs
ADDED
package/dist/Portal.cjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("react");
|
|
3
|
+
let react_dom = require("react-dom");
|
|
4
|
+
//#region src/Portal/Portal.tsx
|
|
5
|
+
function resolveContainer(container) {
|
|
6
|
+
return (typeof container === "function" ? container() : container) ?? null;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Renders its children into a DOM node outside the parent hierarchy (the document
|
|
10
|
+
* body by default). Resolves the container synchronously during render, so the
|
|
11
|
+
* portaled content mounts in the same commit — consumers like Modal can rely on
|
|
12
|
+
* their root ref being attached before their effects run. Renders nothing during
|
|
13
|
+
* server rendering.
|
|
14
|
+
*/
|
|
15
|
+
function Portal({ children, container }) {
|
|
16
|
+
if (typeof document === "undefined") return null;
|
|
17
|
+
return (0, react_dom.createPortal)(children, resolveContainer(container) ?? document.body);
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
exports.Portal = Portal;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/Portal/Portal.d.ts
|
|
3
|
+
interface PortalProps {
|
|
4
|
+
/** Content to render into the container. */
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
/** Target node, or a function returning one. Defaults to `document.body`. */
|
|
7
|
+
container?: HTMLElement | (() => HTMLElement | null) | null;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Renders its children into a DOM node outside the parent hierarchy (the document
|
|
11
|
+
* body by default). Resolves the container synchronously during render, so the
|
|
12
|
+
* portaled content mounts in the same commit — consumers like Modal can rely on
|
|
13
|
+
* their root ref being attached before their effects run. Renders nothing during
|
|
14
|
+
* server rendering.
|
|
15
|
+
*/
|
|
16
|
+
declare function Portal({ children, container }: Readonly<PortalProps>): import("react").ReactPortal | null;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Portal, PortalProps };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/Portal/Portal.d.ts
|
|
3
|
+
interface PortalProps {
|
|
4
|
+
/** Content to render into the container. */
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
/** Target node, or a function returning one. Defaults to `document.body`. */
|
|
7
|
+
container?: HTMLElement | (() => HTMLElement | null) | null;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Renders its children into a DOM node outside the parent hierarchy (the document
|
|
11
|
+
* body by default). Resolves the container synchronously during render, so the
|
|
12
|
+
* portaled content mounts in the same commit — consumers like Modal can rely on
|
|
13
|
+
* their root ref being attached before their effects run. Renders nothing during
|
|
14
|
+
* server rendering.
|
|
15
|
+
*/
|
|
16
|
+
declare function Portal({ children, container }: Readonly<PortalProps>): import("react").ReactPortal | null;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Portal, PortalProps };
|
package/dist/Portal.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { createPortal } from "react-dom";
|
|
3
|
+
//#region src/Portal/Portal.tsx
|
|
4
|
+
function resolveContainer(container) {
|
|
5
|
+
return (typeof container === "function" ? container() : container) ?? null;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Renders its children into a DOM node outside the parent hierarchy (the document
|
|
9
|
+
* body by default). Resolves the container synchronously during render, so the
|
|
10
|
+
* portaled content mounts in the same commit — consumers like Modal can rely on
|
|
11
|
+
* their root ref being attached before their effects run. Renders nothing during
|
|
12
|
+
* server rendering.
|
|
13
|
+
*/
|
|
14
|
+
function Portal({ children, container }) {
|
|
15
|
+
if (typeof document === "undefined") return null;
|
|
16
|
+
return createPortal(children, resolveContainer(container) ?? document.body);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { Portal };
|
package/dist/Quote.cjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_src = require("./src-BiocWFSR.cjs");
|
|
3
|
+
const require_View = require("./View.cjs");
|
|
4
|
+
//#region src/Quote/Quote.tsx
|
|
5
|
+
/** A View with a 2px primary left-border — used for terminal readouts and markdown blockquotes. */
|
|
6
|
+
const Quote = require_src.styled(require_View.View, {
|
|
7
|
+
name: "Quote",
|
|
8
|
+
label: "Quote"
|
|
9
|
+
})(({ theme }) => ({ borderLeft: `2px solid ${theme.border.primary}` }));
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.Quote = Quote;
|
package/dist/Quote.d.cts
ADDED
package/dist/Quote.d.mts
ADDED
package/dist/Quote.mjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { d as styled } from "./src-DcNT2aIK.mjs";
|
|
2
|
+
import { View } from "./View.mjs";
|
|
3
|
+
//#region src/Quote/Quote.tsx
|
|
4
|
+
/** A View with a 2px primary left-border — used for terminal readouts and markdown blockquotes. */
|
|
5
|
+
const Quote = styled(View, {
|
|
6
|
+
name: "Quote",
|
|
7
|
+
label: "Quote"
|
|
8
|
+
})(({ theme }) => ({ borderLeft: `2px solid ${theme.border.primary}` }));
|
|
9
|
+
//#endregion
|
|
10
|
+
export { Quote };
|