@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,236 @@
|
|
|
1
|
+
import { d as styled } from "../src-DcNT2aIK.mjs";
|
|
2
|
+
import { View } from "../View.mjs";
|
|
3
|
+
import { Typography } from "../Typography.mjs";
|
|
4
|
+
import { Checkbox } from "../Checkbox.mjs";
|
|
5
|
+
import { CodeBlock } from "../CodeBlock.mjs";
|
|
6
|
+
import { Image } from "../Image.mjs";
|
|
7
|
+
import { Link } from "../Link.mjs";
|
|
8
|
+
import { Quote } from "../Quote.mjs";
|
|
9
|
+
import { Table } from "../Table/Table.mjs";
|
|
10
|
+
import { TableBody } from "../Table/TableBody.mjs";
|
|
11
|
+
import { TableCell } from "../Table/TableCell.mjs";
|
|
12
|
+
import { TableContainer } from "../Table/TableContainer.mjs";
|
|
13
|
+
import { TableHead } from "../Table/TableHead.mjs";
|
|
14
|
+
import { TableRow } from "../Table/TableRow.mjs";
|
|
15
|
+
import { createContext, useContext } from "react";
|
|
16
|
+
import { jsx } from "react/jsx-runtime";
|
|
17
|
+
import ReactMarkdown from "react-markdown";
|
|
18
|
+
import remarkGfm from "remark-gfm";
|
|
19
|
+
import rehypeHighlight from "rehype-highlight";
|
|
20
|
+
//#region src/Markdown/Preview/Preview.tsx
|
|
21
|
+
const remarkPlugins = [remarkGfm];
|
|
22
|
+
const rehypePlugins = [[rehypeHighlight, { ignoreMissing: true }]];
|
|
23
|
+
const PreviewRoot = styled(View, {
|
|
24
|
+
name: "MarkdownPreview",
|
|
25
|
+
label: "MarkdownPreview"
|
|
26
|
+
})({
|
|
27
|
+
minWidth: 0,
|
|
28
|
+
maxWidth: "100%",
|
|
29
|
+
overflowWrap: "break-word"
|
|
30
|
+
});
|
|
31
|
+
const EMPTY_SLOT_PROPS = {};
|
|
32
|
+
const SlotPropsContext = createContext(EMPTY_SLOT_PROPS);
|
|
33
|
+
function slotted(render) {
|
|
34
|
+
function Slotted(props) {
|
|
35
|
+
return render(useContext(SlotPropsContext), props);
|
|
36
|
+
}
|
|
37
|
+
return Slotted;
|
|
38
|
+
}
|
|
39
|
+
const components = {
|
|
40
|
+
h1: slotted(({ h1 }, { children }) => /* @__PURE__ */ jsx(Typography, {
|
|
41
|
+
mt: 2,
|
|
42
|
+
variant: "h1",
|
|
43
|
+
color: "primary",
|
|
44
|
+
gutterBottom: true,
|
|
45
|
+
...h1,
|
|
46
|
+
children
|
|
47
|
+
})),
|
|
48
|
+
h2: slotted(({ h2 }, { children }) => /* @__PURE__ */ jsx(Typography, {
|
|
49
|
+
mt: 2,
|
|
50
|
+
variant: "h2",
|
|
51
|
+
color: "primary",
|
|
52
|
+
gutterBottom: true,
|
|
53
|
+
...h2,
|
|
54
|
+
children
|
|
55
|
+
})),
|
|
56
|
+
h3: slotted(({ h3 }, { children }) => /* @__PURE__ */ jsx(Typography, {
|
|
57
|
+
mt: 2,
|
|
58
|
+
variant: "h3",
|
|
59
|
+
color: "primary",
|
|
60
|
+
gutterBottom: true,
|
|
61
|
+
...h3,
|
|
62
|
+
children
|
|
63
|
+
})),
|
|
64
|
+
h4: slotted(({ h4 }, { children }) => /* @__PURE__ */ jsx(Typography, {
|
|
65
|
+
mt: 2,
|
|
66
|
+
variant: "h4",
|
|
67
|
+
gutterBottom: true,
|
|
68
|
+
...h4,
|
|
69
|
+
children
|
|
70
|
+
})),
|
|
71
|
+
h5: slotted(({ h5 }, { children }) => /* @__PURE__ */ jsx(Typography, {
|
|
72
|
+
mt: 2,
|
|
73
|
+
variant: "h5",
|
|
74
|
+
gutterBottom: true,
|
|
75
|
+
...h5,
|
|
76
|
+
children
|
|
77
|
+
})),
|
|
78
|
+
h6: slotted(({ h6 }, { children }) => /* @__PURE__ */ jsx(Typography, {
|
|
79
|
+
mt: 2,
|
|
80
|
+
variant: "h6",
|
|
81
|
+
gutterBottom: true,
|
|
82
|
+
...h6,
|
|
83
|
+
children
|
|
84
|
+
})),
|
|
85
|
+
p: slotted(({ p }, { children }) => /* @__PURE__ */ jsx(Typography, {
|
|
86
|
+
variant: "body1",
|
|
87
|
+
color: "secondary",
|
|
88
|
+
mb: 2,
|
|
89
|
+
lineHeight: "relaxed",
|
|
90
|
+
...p,
|
|
91
|
+
children
|
|
92
|
+
})),
|
|
93
|
+
a: slotted(({ a }, { href, children }) => /* @__PURE__ */ jsx(Link, {
|
|
94
|
+
href,
|
|
95
|
+
underline: "hover",
|
|
96
|
+
...a,
|
|
97
|
+
children
|
|
98
|
+
})),
|
|
99
|
+
strong: slotted(({ strong }, { children }) => /* @__PURE__ */ jsx(Typography, {
|
|
100
|
+
as: "strong",
|
|
101
|
+
variant: "inherit",
|
|
102
|
+
fontWeight: "extraBold",
|
|
103
|
+
...strong,
|
|
104
|
+
children
|
|
105
|
+
})),
|
|
106
|
+
em: slotted(({ em }, { children }) => /* @__PURE__ */ jsx(Typography, {
|
|
107
|
+
as: "em",
|
|
108
|
+
variant: "inherit",
|
|
109
|
+
fontStyle: "italic",
|
|
110
|
+
...em,
|
|
111
|
+
children
|
|
112
|
+
})),
|
|
113
|
+
ul: slotted(({ ul }, { children }) => /* @__PURE__ */ jsx(View, {
|
|
114
|
+
as: "ul",
|
|
115
|
+
pl: 3,
|
|
116
|
+
mb: 2,
|
|
117
|
+
...ul,
|
|
118
|
+
children
|
|
119
|
+
})),
|
|
120
|
+
ol: slotted(({ ol }, { children }) => /* @__PURE__ */ jsx(View, {
|
|
121
|
+
as: "ol",
|
|
122
|
+
pl: 3,
|
|
123
|
+
mb: 2,
|
|
124
|
+
...ol,
|
|
125
|
+
children
|
|
126
|
+
})),
|
|
127
|
+
li: slotted(({ li }, { children, className }) => /* @__PURE__ */ jsx(Typography, {
|
|
128
|
+
as: "li",
|
|
129
|
+
color: "secondary",
|
|
130
|
+
lineHeight: "base",
|
|
131
|
+
variant: "body1",
|
|
132
|
+
gutterBottom: true,
|
|
133
|
+
style: className?.includes("task-list-item") ? { listStyleType: "none" } : void 0,
|
|
134
|
+
...li,
|
|
135
|
+
children
|
|
136
|
+
})),
|
|
137
|
+
input: slotted(({ input }, { checked }) => /* @__PURE__ */ jsx(Checkbox, {
|
|
138
|
+
checked: Boolean(checked),
|
|
139
|
+
disabled: true,
|
|
140
|
+
color: "primary",
|
|
141
|
+
size: "sm",
|
|
142
|
+
"aria-label": "Task item",
|
|
143
|
+
mr: 1,
|
|
144
|
+
...input
|
|
145
|
+
})),
|
|
146
|
+
blockquote: slotted(({ blockquote }, { children }) => /* @__PURE__ */ jsx(Quote, {
|
|
147
|
+
as: "blockquote",
|
|
148
|
+
pl: 3,
|
|
149
|
+
py: 1,
|
|
150
|
+
my: 2,
|
|
151
|
+
...blockquote,
|
|
152
|
+
children
|
|
153
|
+
})),
|
|
154
|
+
code: slotted(({ code }, { className, children }) => {
|
|
155
|
+
const isBlock = (className ?? "").includes("language-");
|
|
156
|
+
return /* @__PURE__ */ jsx(Typography, {
|
|
157
|
+
as: "code",
|
|
158
|
+
color: "initial",
|
|
159
|
+
variant: "inherit",
|
|
160
|
+
fontFamily: "mono",
|
|
161
|
+
display: isBlock ? "block" : "inline",
|
|
162
|
+
bg: isBlock ? "transparent" : "paper",
|
|
163
|
+
px: isBlock ? 0 : 1,
|
|
164
|
+
borderRadius: "sm",
|
|
165
|
+
...code,
|
|
166
|
+
children
|
|
167
|
+
});
|
|
168
|
+
}),
|
|
169
|
+
pre: slotted(({ pre }, { children }) => /* @__PURE__ */ jsx(CodeBlock, {
|
|
170
|
+
...pre,
|
|
171
|
+
children
|
|
172
|
+
})),
|
|
173
|
+
table: slotted(({ table }, { children }) => /* @__PURE__ */ jsx(TableContainer, {
|
|
174
|
+
my: 2,
|
|
175
|
+
children: /* @__PURE__ */ jsx(Table, {
|
|
176
|
+
bg: "terminal",
|
|
177
|
+
borderRadius: "md",
|
|
178
|
+
...table,
|
|
179
|
+
children
|
|
180
|
+
})
|
|
181
|
+
})),
|
|
182
|
+
thead: slotted(({ thead }, { children }) => /* @__PURE__ */ jsx(TableHead, {
|
|
183
|
+
bg: "grid",
|
|
184
|
+
color: "primary",
|
|
185
|
+
...thead,
|
|
186
|
+
children
|
|
187
|
+
})),
|
|
188
|
+
tbody: slotted(({ tbody }, { children }) => /* @__PURE__ */ jsx(TableBody, {
|
|
189
|
+
...tbody,
|
|
190
|
+
children
|
|
191
|
+
})),
|
|
192
|
+
tr: slotted(({ tr }, { children }) => /* @__PURE__ */ jsx(TableRow, {
|
|
193
|
+
isHoverable: true,
|
|
194
|
+
...tr,
|
|
195
|
+
children
|
|
196
|
+
})),
|
|
197
|
+
th: slotted(({ th }, { children, style }) => /* @__PURE__ */ jsx(TableCell, {
|
|
198
|
+
style,
|
|
199
|
+
...th,
|
|
200
|
+
children
|
|
201
|
+
})),
|
|
202
|
+
td: slotted(({ td }, { children, style }) => /* @__PURE__ */ jsx(TableCell, {
|
|
203
|
+
style,
|
|
204
|
+
...td,
|
|
205
|
+
children
|
|
206
|
+
})),
|
|
207
|
+
hr: slotted(({ hr }) => /* @__PURE__ */ jsx(View, {
|
|
208
|
+
as: "hr",
|
|
209
|
+
my: 2,
|
|
210
|
+
height: "1px",
|
|
211
|
+
bg: "grid",
|
|
212
|
+
width: "100%",
|
|
213
|
+
border: "none",
|
|
214
|
+
...hr
|
|
215
|
+
})),
|
|
216
|
+
img: slotted(({ img }, { src, alt }) => /* @__PURE__ */ jsx(Image, {
|
|
217
|
+
src,
|
|
218
|
+
alt,
|
|
219
|
+
maxWidth: "100%",
|
|
220
|
+
...img
|
|
221
|
+
}))
|
|
222
|
+
};
|
|
223
|
+
/** Renders a markdown string with every element mapped to a design-system primitive. */
|
|
224
|
+
function Preview({ children, slotProps }) {
|
|
225
|
+
return /* @__PURE__ */ jsx(PreviewRoot, { children: /* @__PURE__ */ jsx(SlotPropsContext.Provider, {
|
|
226
|
+
value: slotProps ?? EMPTY_SLOT_PROPS,
|
|
227
|
+
children: /* @__PURE__ */ jsx(ReactMarkdown, {
|
|
228
|
+
components,
|
|
229
|
+
remarkPlugins,
|
|
230
|
+
rehypePlugins,
|
|
231
|
+
children
|
|
232
|
+
})
|
|
233
|
+
}) });
|
|
234
|
+
}
|
|
235
|
+
//#endregion
|
|
236
|
+
export { Preview };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/Markdown/Toolbar/Toolbar.d.ts
|
|
2
|
+
/** Formatting buttons, heading + code-language selects, and the table-size picker. */
|
|
3
|
+
declare function Toolbar(): import("react").JSX.Element;
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/Markdown/Toolbar/TablePicker.d.ts
|
|
6
|
+
interface TablePickerProps {
|
|
7
|
+
/** Fired with the chosen (rows, cols) when a grid cell is picked. */
|
|
8
|
+
onSelect: (rows: number, cols: number) => void;
|
|
9
|
+
}
|
|
10
|
+
/** A "Table" trigger that opens a hover grid for choosing table dimensions. */
|
|
11
|
+
declare function TablePicker({ onSelect }: Readonly<TablePickerProps>): import("react").JSX.Element;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { TablePicker, TablePickerProps, Toolbar };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/Markdown/Toolbar/Toolbar.d.ts
|
|
2
|
+
/** Formatting buttons, heading + code-language selects, and the table-size picker. */
|
|
3
|
+
declare function Toolbar(): import("react").JSX.Element;
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/Markdown/Toolbar/TablePicker.d.ts
|
|
6
|
+
interface TablePickerProps {
|
|
7
|
+
/** Fired with the chosen (rows, cols) when a grid cell is picked. */
|
|
8
|
+
onSelect: (rows: number, cols: number) => void;
|
|
9
|
+
}
|
|
10
|
+
/** A "Table" trigger that opens a hover grid for choosing table dimensions. */
|
|
11
|
+
declare function TablePicker({ onSelect }: Readonly<TablePickerProps>): import("react").JSX.Element;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { TablePicker, TablePickerProps, Toolbar };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_MarkdownContext = require("./MarkdownContext-DSwjzpH8.cjs");
|
|
3
|
+
const require_Markdown_Control = require("./Markdown/Control.cjs");
|
|
4
|
+
const require_Toolbar = require("./Toolbar-B-W22Sk4.cjs");
|
|
5
|
+
const require_Markdown_Editor = require("./Markdown/Editor.cjs");
|
|
6
|
+
const require_Markdown_Preview = require("./Markdown/Preview.cjs");
|
|
7
|
+
exports.Control = require_Markdown_Control.Control;
|
|
8
|
+
exports.Editor = require_Markdown_Editor.Editor;
|
|
9
|
+
exports.MarkdownContext = require_MarkdownContext.MarkdownContext;
|
|
10
|
+
exports.Preview = require_Markdown_Preview.Preview;
|
|
11
|
+
exports.TablePicker = require_Toolbar.TablePicker;
|
|
12
|
+
exports.Toolbar = require_Toolbar.Toolbar;
|
|
13
|
+
exports.useMarkdownContext = require_MarkdownContext.useMarkdownContext;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { r as IconName } from "./index-Dp81rWM1.cjs";
|
|
2
|
+
import { Control, ControlProps } from "./Markdown/Control.cjs";
|
|
3
|
+
import { Editor, EditorProps } from "./Markdown/Editor.cjs";
|
|
4
|
+
import { Preview, PreviewProps, PreviewSlotProps } from "./Markdown/Preview.cjs";
|
|
5
|
+
import { TablePicker, TablePickerProps, Toolbar } from "./Markdown/Toolbar.cjs";
|
|
6
|
+
//#region src/Markdown/const.d.ts
|
|
7
|
+
/** How a text label is rendered — mirrors the mark it inserts. */
|
|
8
|
+
type ToolbarLabelEmphasis = 'bold' | 'italic' | 'strike';
|
|
9
|
+
/** Shared presentation for a toolbar control. */
|
|
10
|
+
interface BaseAction {
|
|
11
|
+
id: string;
|
|
12
|
+
/** Text label shown when no `icon` is set. */
|
|
13
|
+
label: string;
|
|
14
|
+
/** Accessible name — always the control's aria-label. */
|
|
15
|
+
ariaLabel: string;
|
|
16
|
+
/** Registry icon shown instead of the text label. */
|
|
17
|
+
icon?: IconName;
|
|
18
|
+
/** Styles the text label to mirror the mark (e.g. bold `B`). Ignored when `icon` is set. */
|
|
19
|
+
emphasis?: ToolbarLabelEmphasis;
|
|
20
|
+
/** Consecutive actions sharing a group id render as one joined button cluster. */
|
|
21
|
+
group?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Wraps the selection (or a placeholder) in a leading/trailing marker — bold, links, code blocks. */
|
|
24
|
+
interface WrapAction extends BaseAction {
|
|
25
|
+
kind: 'wrap';
|
|
26
|
+
prefix: string;
|
|
27
|
+
suffix: string;
|
|
28
|
+
placeholder: string;
|
|
29
|
+
/** Block-level fence (e.g. code block): separated by newlines and never toggled off. */
|
|
30
|
+
block?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** Prepends a marker to every line the selection touches — headings, quotes, lists. */
|
|
33
|
+
interface LinePrefixAction extends BaseAction {
|
|
34
|
+
kind: 'linePrefix';
|
|
35
|
+
linePrefix: string;
|
|
36
|
+
/**
|
|
37
|
+
* Line-start pattern for a family of mutually-exclusive markers (e.g. all list types). When
|
|
38
|
+
* set, applying the action strips any matching marker first, then toggles its own off or
|
|
39
|
+
* replaces a sibling's — so the list/ordered/task buttons swap and toggle instead of stacking.
|
|
40
|
+
*/
|
|
41
|
+
family?: RegExp;
|
|
42
|
+
/**
|
|
43
|
+
* Whether re-applying an action that already owns the line's marker removes it. Defaults to
|
|
44
|
+
* toggling off; set `false` for replace-only families (e.g. heading levels from a select,
|
|
45
|
+
* where picking a level should set it, not toggle it away).
|
|
46
|
+
*/
|
|
47
|
+
toggle?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/** Inserts a standalone snippet at the caret, ignoring the selection — tables, rules. */
|
|
50
|
+
interface InsertAction extends BaseAction {
|
|
51
|
+
kind: 'insert';
|
|
52
|
+
snippet: string;
|
|
53
|
+
}
|
|
54
|
+
type ToolbarAction = WrapAction | LinePrefixAction | InsertAction;
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/Markdown/MarkdownContext.d.ts
|
|
57
|
+
/** A textarea selection range shared between the Editor and the Toolbar. */
|
|
58
|
+
interface MarkdownSelection {
|
|
59
|
+
start: number;
|
|
60
|
+
end: number;
|
|
61
|
+
}
|
|
62
|
+
interface MarkdownContextValue {
|
|
63
|
+
/** Current markdown source. */
|
|
64
|
+
value: string;
|
|
65
|
+
/** Called with the next source on edit or a toolbar action. */
|
|
66
|
+
onChange: (value: string) => void;
|
|
67
|
+
/** Applies a toolbar action at the last remembered selection and queues the caret to restore. */
|
|
68
|
+
dispatch: (action: ToolbarAction) => void;
|
|
69
|
+
/** Records the current textarea selection — the Editor calls this on select/blur. */
|
|
70
|
+
rememberSelection: (selection: MarkdownSelection) => void;
|
|
71
|
+
/** Queues a selection to restore after the next value change (e.g. after Tab). */
|
|
72
|
+
queueSelection: (selection: MarkdownSelection) => void;
|
|
73
|
+
/** Returns and clears the queued selection — the Editor's effect calls this to restore focus. */
|
|
74
|
+
takeQueuedSelection: () => MarkdownSelection | null;
|
|
75
|
+
}
|
|
76
|
+
declare const MarkdownContext: import("react").Context<MarkdownContextValue | null>;
|
|
77
|
+
/** Reads the Markdown compound context; throws if used outside `<Markdown.Control>`. */
|
|
78
|
+
declare function useMarkdownContext(): MarkdownContextValue;
|
|
79
|
+
//#endregion
|
|
80
|
+
export { Control, ControlProps, Editor, EditorProps, MarkdownContext, MarkdownContextValue, MarkdownSelection, Preview, PreviewProps, PreviewSlotProps, TablePicker, TablePickerProps, Toolbar, useMarkdownContext };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { r as IconName } from "./index-BLfFycfJ.mjs";
|
|
2
|
+
import { Control, ControlProps } from "./Markdown/Control.mjs";
|
|
3
|
+
import { Editor, EditorProps } from "./Markdown/Editor.mjs";
|
|
4
|
+
import { Preview, PreviewProps, PreviewSlotProps } from "./Markdown/Preview.mjs";
|
|
5
|
+
import { TablePicker, TablePickerProps, Toolbar } from "./Markdown/Toolbar.mjs";
|
|
6
|
+
//#region src/Markdown/const.d.ts
|
|
7
|
+
/** How a text label is rendered — mirrors the mark it inserts. */
|
|
8
|
+
type ToolbarLabelEmphasis = 'bold' | 'italic' | 'strike';
|
|
9
|
+
/** Shared presentation for a toolbar control. */
|
|
10
|
+
interface BaseAction {
|
|
11
|
+
id: string;
|
|
12
|
+
/** Text label shown when no `icon` is set. */
|
|
13
|
+
label: string;
|
|
14
|
+
/** Accessible name — always the control's aria-label. */
|
|
15
|
+
ariaLabel: string;
|
|
16
|
+
/** Registry icon shown instead of the text label. */
|
|
17
|
+
icon?: IconName;
|
|
18
|
+
/** Styles the text label to mirror the mark (e.g. bold `B`). Ignored when `icon` is set. */
|
|
19
|
+
emphasis?: ToolbarLabelEmphasis;
|
|
20
|
+
/** Consecutive actions sharing a group id render as one joined button cluster. */
|
|
21
|
+
group?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Wraps the selection (or a placeholder) in a leading/trailing marker — bold, links, code blocks. */
|
|
24
|
+
interface WrapAction extends BaseAction {
|
|
25
|
+
kind: 'wrap';
|
|
26
|
+
prefix: string;
|
|
27
|
+
suffix: string;
|
|
28
|
+
placeholder: string;
|
|
29
|
+
/** Block-level fence (e.g. code block): separated by newlines and never toggled off. */
|
|
30
|
+
block?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** Prepends a marker to every line the selection touches — headings, quotes, lists. */
|
|
33
|
+
interface LinePrefixAction extends BaseAction {
|
|
34
|
+
kind: 'linePrefix';
|
|
35
|
+
linePrefix: string;
|
|
36
|
+
/**
|
|
37
|
+
* Line-start pattern for a family of mutually-exclusive markers (e.g. all list types). When
|
|
38
|
+
* set, applying the action strips any matching marker first, then toggles its own off or
|
|
39
|
+
* replaces a sibling's — so the list/ordered/task buttons swap and toggle instead of stacking.
|
|
40
|
+
*/
|
|
41
|
+
family?: RegExp;
|
|
42
|
+
/**
|
|
43
|
+
* Whether re-applying an action that already owns the line's marker removes it. Defaults to
|
|
44
|
+
* toggling off; set `false` for replace-only families (e.g. heading levels from a select,
|
|
45
|
+
* where picking a level should set it, not toggle it away).
|
|
46
|
+
*/
|
|
47
|
+
toggle?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/** Inserts a standalone snippet at the caret, ignoring the selection — tables, rules. */
|
|
50
|
+
interface InsertAction extends BaseAction {
|
|
51
|
+
kind: 'insert';
|
|
52
|
+
snippet: string;
|
|
53
|
+
}
|
|
54
|
+
type ToolbarAction = WrapAction | LinePrefixAction | InsertAction;
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/Markdown/MarkdownContext.d.ts
|
|
57
|
+
/** A textarea selection range shared between the Editor and the Toolbar. */
|
|
58
|
+
interface MarkdownSelection {
|
|
59
|
+
start: number;
|
|
60
|
+
end: number;
|
|
61
|
+
}
|
|
62
|
+
interface MarkdownContextValue {
|
|
63
|
+
/** Current markdown source. */
|
|
64
|
+
value: string;
|
|
65
|
+
/** Called with the next source on edit or a toolbar action. */
|
|
66
|
+
onChange: (value: string) => void;
|
|
67
|
+
/** Applies a toolbar action at the last remembered selection and queues the caret to restore. */
|
|
68
|
+
dispatch: (action: ToolbarAction) => void;
|
|
69
|
+
/** Records the current textarea selection — the Editor calls this on select/blur. */
|
|
70
|
+
rememberSelection: (selection: MarkdownSelection) => void;
|
|
71
|
+
/** Queues a selection to restore after the next value change (e.g. after Tab). */
|
|
72
|
+
queueSelection: (selection: MarkdownSelection) => void;
|
|
73
|
+
/** Returns and clears the queued selection — the Editor's effect calls this to restore focus. */
|
|
74
|
+
takeQueuedSelection: () => MarkdownSelection | null;
|
|
75
|
+
}
|
|
76
|
+
declare const MarkdownContext: import("react").Context<MarkdownContextValue | null>;
|
|
77
|
+
/** Reads the Markdown compound context; throws if used outside `<Markdown.Control>`. */
|
|
78
|
+
declare function useMarkdownContext(): MarkdownContextValue;
|
|
79
|
+
//#endregion
|
|
80
|
+
export { Control, ControlProps, Editor, EditorProps, MarkdownContext, MarkdownContextValue, MarkdownSelection, Preview, PreviewProps, PreviewSlotProps, TablePicker, TablePickerProps, Toolbar, useMarkdownContext };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { n as useMarkdownContext, t as MarkdownContext } from "./MarkdownContext-BN8A3W-J.mjs";
|
|
2
|
+
import { Control } from "./Markdown/Control.mjs";
|
|
3
|
+
import { n as TablePicker, t as Toolbar } from "./Toolbar-KbR97iJS.mjs";
|
|
4
|
+
import { Editor } from "./Markdown/Editor.mjs";
|
|
5
|
+
import { Preview } from "./Markdown/Preview.mjs";
|
|
6
|
+
export { Control, Editor, MarkdownContext, Preview, TablePicker, Toolbar, useMarkdownContext };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
//#region src/Markdown/MarkdownContext.ts
|
|
3
|
+
const MarkdownContext = createContext(null);
|
|
4
|
+
/** Reads the Markdown compound context; throws if used outside `<Markdown.Control>`. */
|
|
5
|
+
function useMarkdownContext() {
|
|
6
|
+
const context = useContext(MarkdownContext);
|
|
7
|
+
if (!context) throw new Error("Markdown parts must be rendered inside <Markdown.Control>");
|
|
8
|
+
return context;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { useMarkdownContext as n, MarkdownContext as t };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
let react = require("react");
|
|
2
|
+
//#region src/Markdown/MarkdownContext.ts
|
|
3
|
+
const MarkdownContext = (0, react.createContext)(null);
|
|
4
|
+
/** Reads the Markdown compound context; throws if used outside `<Markdown.Control>`. */
|
|
5
|
+
function useMarkdownContext() {
|
|
6
|
+
const context = (0, react.useContext)(MarkdownContext);
|
|
7
|
+
if (!context) throw new Error("Markdown parts must be rendered inside <Markdown.Control>");
|
|
8
|
+
return context;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
Object.defineProperty(exports, "MarkdownContext", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function() {
|
|
14
|
+
return MarkdownContext;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "useMarkdownContext", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return useMarkdownContext;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_src = require("./src-BiocWFSR.cjs");
|
|
3
|
+
const require_themeDefault = require("./themeDefault-B-QjpGEO.cjs");
|
|
4
|
+
const require_Icon = require("./Icon-1YtNCUKo.cjs");
|
|
5
|
+
let react = require("react");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let _soroush_tech_styled_system_should_forward_prop = require("@soroush.tech/styled-system/should-forward-prop");
|
|
8
|
+
let _emotion_react = require("@emotion/react");
|
|
9
|
+
//#region src/MenuItem/MenuItem.tsx
|
|
10
|
+
const shouldForwardProp = (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)([
|
|
11
|
+
"color",
|
|
12
|
+
"textColor",
|
|
13
|
+
"sizeToken",
|
|
14
|
+
"selected",
|
|
15
|
+
"highlighted",
|
|
16
|
+
"disabled",
|
|
17
|
+
"dense",
|
|
18
|
+
"disableGutters",
|
|
19
|
+
"divider"
|
|
20
|
+
]);
|
|
21
|
+
const baseStyle = ({ theme }) => ({
|
|
22
|
+
display: "flex",
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
gap: theme.space[1],
|
|
25
|
+
cursor: "pointer",
|
|
26
|
+
fontFamily: theme.fonts.body,
|
|
27
|
+
lineHeight: theme.lineHeights.base,
|
|
28
|
+
listStyle: "none",
|
|
29
|
+
userSelect: "none",
|
|
30
|
+
whiteSpace: "nowrap",
|
|
31
|
+
transition: "background-color 0.12s ease",
|
|
32
|
+
outline: "none"
|
|
33
|
+
});
|
|
34
|
+
const sizeVariants = ({ theme, sizeToken, dense, disableGutters }) => {
|
|
35
|
+
const s = theme.sizes[sizeToken];
|
|
36
|
+
const verticalPadding = dense ? theme.space[.5] : void 0;
|
|
37
|
+
return {
|
|
38
|
+
paddingTop: verticalPadding ?? theme.space[s.paddingTop],
|
|
39
|
+
paddingBottom: verticalPadding ?? theme.space[s.paddingBottom],
|
|
40
|
+
paddingLeft: disableGutters ? 0 : theme.space[s.paddingLeft],
|
|
41
|
+
paddingRight: disableGutters ? 0 : theme.space[s.paddingRight],
|
|
42
|
+
fontSize: theme.fontSizes[s.fontSize]
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
const dividerStyle = ({ theme, divider }) => divider ? {
|
|
46
|
+
borderBottomWidth: theme.borderWidths.thin,
|
|
47
|
+
borderBottomStyle: "solid",
|
|
48
|
+
borderBottomColor: (0, require_src.src_exports.get)(theme, "border.light")
|
|
49
|
+
} : {};
|
|
50
|
+
const interactionStyles = ({ theme, color, textColor, selected, highlighted, disabled }) => {
|
|
51
|
+
const main = (0, require_src.src_exports.get)(theme, `palette.${color}.main`);
|
|
52
|
+
const hoverBg = `${main}1F`;
|
|
53
|
+
const selectedBg = `${main}29`;
|
|
54
|
+
const activeSelectedBg = `${main}3D`;
|
|
55
|
+
if (disabled) return {
|
|
56
|
+
color: (0, require_src.src_exports.get)(theme, "text.disabled"),
|
|
57
|
+
cursor: "not-allowed",
|
|
58
|
+
pointerEvents: "none"
|
|
59
|
+
};
|
|
60
|
+
const baseColor = textColor ? (0, require_src.src_exports.get)(theme, `text.${textColor}`) : main;
|
|
61
|
+
return {
|
|
62
|
+
color: selected ? main : baseColor,
|
|
63
|
+
backgroundColor: selected ? highlighted ? activeSelectedBg : selectedBg : highlighted ? hoverBg : "transparent",
|
|
64
|
+
"&:hover": { backgroundColor: selected ? activeSelectedBg : hoverBg }
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
const MenuItemRoot = require_src.styled("li", {
|
|
68
|
+
name: "MenuItem",
|
|
69
|
+
label: "MenuItem",
|
|
70
|
+
shouldForwardProp
|
|
71
|
+
})(baseStyle, sizeVariants, dividerStyle, interactionStyles);
|
|
72
|
+
const CheckSlot = require_src.styled("span", {
|
|
73
|
+
name: "MenuItem",
|
|
74
|
+
slot: "check",
|
|
75
|
+
label: "MenuItemCheck"
|
|
76
|
+
})({
|
|
77
|
+
display: "inline-flex",
|
|
78
|
+
width: "1.125rem",
|
|
79
|
+
flexShrink: 0
|
|
80
|
+
});
|
|
81
|
+
function isKeyboardFocus(element) {
|
|
82
|
+
try {
|
|
83
|
+
return element.matches(":focus-visible");
|
|
84
|
+
} catch {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @description A single option row for `Select`'s listbox. Rendered as a semantic
|
|
90
|
+
* `<li role="option">` (override via `as`). Selection/highlight/density props are
|
|
91
|
+
* injected by `Select`; used on its own it renders a static, styled row.
|
|
92
|
+
*/
|
|
93
|
+
function MenuItem({ value, children, as, disabled = false, selected = false, highlighted = false, multiple = false, color: colorProp, textColor, size: sizeProp, dense = false, disableGutters = false, divider = false, autoFocus = false, focusVisibleClassName, onSelect, id, className, "data-testid": dataTestid }) {
|
|
94
|
+
const theme = (0, _emotion_react.useTheme)();
|
|
95
|
+
const color = colorProp ?? require_themeDefault.themeDefault(theme, "color", "primary");
|
|
96
|
+
const size = sizeProp ?? require_themeDefault.themeDefault(theme, "size", "md");
|
|
97
|
+
const rootRef = (0, react.useRef)(null);
|
|
98
|
+
const [isFocusVisible, setIsFocusVisible] = (0, react.useState)(false);
|
|
99
|
+
(0, react.useEffect)(() => {
|
|
100
|
+
if (autoFocus) rootRef.current?.focus();
|
|
101
|
+
}, [autoFocus]);
|
|
102
|
+
const handleClick = () => {
|
|
103
|
+
if (!disabled) onSelect?.(value);
|
|
104
|
+
};
|
|
105
|
+
const handleMouseDown = (event) => {
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
};
|
|
108
|
+
const handleFocus = (event) => {
|
|
109
|
+
if (focusVisibleClassName && isKeyboardFocus(event.currentTarget)) setIsFocusVisible(true);
|
|
110
|
+
};
|
|
111
|
+
const handleBlur = () => {
|
|
112
|
+
setIsFocusVisible(false);
|
|
113
|
+
};
|
|
114
|
+
const rootClassName = [className, isFocusVisible ? focusVisibleClassName : void 0].filter(Boolean).join(" ") || void 0;
|
|
115
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(MenuItemRoot, {
|
|
116
|
+
as,
|
|
117
|
+
ref: rootRef,
|
|
118
|
+
id,
|
|
119
|
+
role: "option",
|
|
120
|
+
tabIndex: -1,
|
|
121
|
+
"aria-selected": selected,
|
|
122
|
+
"aria-disabled": disabled || void 0,
|
|
123
|
+
"data-value": value,
|
|
124
|
+
color,
|
|
125
|
+
textColor,
|
|
126
|
+
sizeToken: size,
|
|
127
|
+
selected,
|
|
128
|
+
highlighted,
|
|
129
|
+
disabled,
|
|
130
|
+
dense,
|
|
131
|
+
disableGutters,
|
|
132
|
+
divider,
|
|
133
|
+
className: rootClassName,
|
|
134
|
+
"data-testid": dataTestid,
|
|
135
|
+
onMouseDown: handleMouseDown,
|
|
136
|
+
onClick: handleClick,
|
|
137
|
+
onFocus: handleFocus,
|
|
138
|
+
onBlur: handleBlur,
|
|
139
|
+
children: [multiple && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckSlot, {
|
|
140
|
+
"aria-hidden": true,
|
|
141
|
+
children: selected && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
142
|
+
name: "check",
|
|
143
|
+
size: "1.125rem",
|
|
144
|
+
color: "inherit"
|
|
145
|
+
})
|
|
146
|
+
}), children]
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
150
|
+
exports.MenuItem = MenuItem;
|