@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,448 @@
|
|
|
1
|
+
import { d as styled } from "./src-DcNT2aIK.mjs";
|
|
2
|
+
import { t as themeDefault } from "./themeDefault-CjXaY3ok.mjs";
|
|
3
|
+
import { Flex } from "./Flex.mjs";
|
|
4
|
+
import { Button } from "./Button.mjs";
|
|
5
|
+
import { ButtonGroup } from "./ButtonGroup.mjs";
|
|
6
|
+
import { Typography } from "./Typography.mjs";
|
|
7
|
+
import { t as Icon } from "./Icon-CAKRmFz3.mjs";
|
|
8
|
+
import { n as useMarkdownContext } from "./MarkdownContext-BN8A3W-J.mjs";
|
|
9
|
+
import { NativeSelect } from "./NativeSelect.mjs";
|
|
10
|
+
import { t as Popover } from "./Popover-B61J7C79.mjs";
|
|
11
|
+
import { useState } from "react";
|
|
12
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
//#region src/Markdown/utils/buildTableSnippet.ts
|
|
14
|
+
/**
|
|
15
|
+
* Builds a GFM table snippet with `rows` total rows (a header row plus `rows - 1` body rows)
|
|
16
|
+
* and `cols` columns, wrapped in blank lines so it sits on its own block.
|
|
17
|
+
*/
|
|
18
|
+
function buildTableSnippet(rows, cols) {
|
|
19
|
+
const row = (cell) => `| ${Array.from({ length: cols }, (_, index) => cell(index)).join(" | ")} |`;
|
|
20
|
+
return `\n${[
|
|
21
|
+
row((index) => `Column ${index + 1}`),
|
|
22
|
+
row(() => "---"),
|
|
23
|
+
...Array.from({ length: rows - 1 }, () => row(() => "Cell"))
|
|
24
|
+
].join("\n")}\n`;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/Markdown/utils/groupToolbarActions.ts
|
|
28
|
+
/**
|
|
29
|
+
* Splits actions into render segments: consecutive actions sharing a `group` id collapse into
|
|
30
|
+
* one segment (rendered as a joined `ButtonGroup`); ungrouped actions each get their own.
|
|
31
|
+
*/
|
|
32
|
+
function groupToolbarActions(actions) {
|
|
33
|
+
const segments = [];
|
|
34
|
+
actions.forEach((action) => {
|
|
35
|
+
const current = segments.at(-1);
|
|
36
|
+
if (current && action.group !== void 0 && current[0].group === action.group) current.push(action);
|
|
37
|
+
else segments.push([action]);
|
|
38
|
+
});
|
|
39
|
+
return segments;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/Markdown/const.ts
|
|
43
|
+
const LIST_MARKER = /^(?:- \[[ xX]\] |- |\d+\. )/;
|
|
44
|
+
/**
|
|
45
|
+
* Every formatting action the toolbar exposes — one per markdown feature the `Markdown`
|
|
46
|
+
* renderer supports (GFM + the component map in `Markdown.Preview`). Data-driven so the
|
|
47
|
+
* toolbar and the transform logic stay in sync.
|
|
48
|
+
*/
|
|
49
|
+
const TOOLBAR_ACTIONS = [
|
|
50
|
+
{
|
|
51
|
+
id: "bold",
|
|
52
|
+
label: "B",
|
|
53
|
+
ariaLabel: "Bold",
|
|
54
|
+
emphasis: "bold",
|
|
55
|
+
group: "inline",
|
|
56
|
+
kind: "wrap",
|
|
57
|
+
prefix: "**",
|
|
58
|
+
suffix: "**",
|
|
59
|
+
placeholder: "bold text"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "italic",
|
|
63
|
+
label: "I",
|
|
64
|
+
ariaLabel: "Italic",
|
|
65
|
+
emphasis: "italic",
|
|
66
|
+
group: "inline",
|
|
67
|
+
kind: "wrap",
|
|
68
|
+
prefix: "_",
|
|
69
|
+
suffix: "_",
|
|
70
|
+
placeholder: "italic text"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "strikethrough",
|
|
74
|
+
label: "S",
|
|
75
|
+
ariaLabel: "Strikethrough",
|
|
76
|
+
emphasis: "strike",
|
|
77
|
+
group: "inline",
|
|
78
|
+
kind: "wrap",
|
|
79
|
+
prefix: "~~",
|
|
80
|
+
suffix: "~~",
|
|
81
|
+
placeholder: "struck text"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "quote",
|
|
85
|
+
label: "Quote",
|
|
86
|
+
ariaLabel: "Blockquote",
|
|
87
|
+
icon: "format_quote",
|
|
88
|
+
kind: "linePrefix",
|
|
89
|
+
linePrefix: "> ",
|
|
90
|
+
family: /^> /
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: "ul",
|
|
94
|
+
label: "List",
|
|
95
|
+
ariaLabel: "Bulleted list",
|
|
96
|
+
icon: "format_list_bulleted",
|
|
97
|
+
group: "list",
|
|
98
|
+
kind: "linePrefix",
|
|
99
|
+
linePrefix: "- ",
|
|
100
|
+
family: LIST_MARKER
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: "ol",
|
|
104
|
+
label: "Ordered",
|
|
105
|
+
ariaLabel: "Numbered list",
|
|
106
|
+
icon: "format_list_numbered",
|
|
107
|
+
group: "list",
|
|
108
|
+
kind: "linePrefix",
|
|
109
|
+
linePrefix: "1. ",
|
|
110
|
+
family: LIST_MARKER
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: "task",
|
|
114
|
+
label: "Task",
|
|
115
|
+
ariaLabel: "Task list",
|
|
116
|
+
icon: "checklist",
|
|
117
|
+
group: "list",
|
|
118
|
+
kind: "linePrefix",
|
|
119
|
+
linePrefix: "- [ ] ",
|
|
120
|
+
family: LIST_MARKER
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: "link",
|
|
124
|
+
label: "Link",
|
|
125
|
+
ariaLabel: "Link",
|
|
126
|
+
icon: "link",
|
|
127
|
+
kind: "wrap",
|
|
128
|
+
prefix: "[",
|
|
129
|
+
suffix: "](url)",
|
|
130
|
+
placeholder: "link text"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
id: "image",
|
|
134
|
+
label: "Image",
|
|
135
|
+
ariaLabel: "Image",
|
|
136
|
+
icon: "image",
|
|
137
|
+
kind: "wrap",
|
|
138
|
+
prefix: "",
|
|
140
|
+
placeholder: "alt text"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
id: "hr",
|
|
144
|
+
label: "HR",
|
|
145
|
+
ariaLabel: "Horizontal rule",
|
|
146
|
+
kind: "insert",
|
|
147
|
+
snippet: "\n\n---\n\n"
|
|
148
|
+
}
|
|
149
|
+
];
|
|
150
|
+
/** Fence languages offered by the code-block select; `value` is appended after the opening ```. */
|
|
151
|
+
const CODE_LANGUAGES = [
|
|
152
|
+
{
|
|
153
|
+
label: "Plain",
|
|
154
|
+
value: "text"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
label: "HTML",
|
|
158
|
+
value: "html"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
label: "CSS",
|
|
162
|
+
value: "css"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
label: "JavaScript",
|
|
166
|
+
value: "js"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
label: "TypeScript",
|
|
170
|
+
value: "ts"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
label: "JSON",
|
|
174
|
+
value: "json"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
label: "Bash",
|
|
178
|
+
value: "bash"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
label: "Python",
|
|
182
|
+
value: "python"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
label: "Markdown",
|
|
186
|
+
value: "md"
|
|
187
|
+
}
|
|
188
|
+
];
|
|
189
|
+
/** Inline `code` — rendered next to the code-block select so both code controls sit together. */
|
|
190
|
+
const INLINE_CODE_ACTION = {
|
|
191
|
+
id: "inline-code",
|
|
192
|
+
label: "Code",
|
|
193
|
+
ariaLabel: "Inline code",
|
|
194
|
+
icon: "code",
|
|
195
|
+
kind: "wrap",
|
|
196
|
+
prefix: "`",
|
|
197
|
+
suffix: "`",
|
|
198
|
+
placeholder: "code"
|
|
199
|
+
};
|
|
200
|
+
/** Builds the fenced-code-block wrap action for a chosen `language`. */
|
|
201
|
+
const codeBlockAction = (language) => ({
|
|
202
|
+
id: "code-block",
|
|
203
|
+
label: "Code block",
|
|
204
|
+
ariaLabel: "Code block",
|
|
205
|
+
kind: "wrap",
|
|
206
|
+
prefix: `\`\`\`${language}\n`,
|
|
207
|
+
suffix: "\n```",
|
|
208
|
+
placeholder: "code",
|
|
209
|
+
block: true
|
|
210
|
+
});
|
|
211
|
+
const HEADING_MARKER = /^#{1,6} /;
|
|
212
|
+
const headingAction = (level) => ({
|
|
213
|
+
id: `h${level}`,
|
|
214
|
+
label: `H${level}`,
|
|
215
|
+
ariaLabel: `Heading ${level}`,
|
|
216
|
+
kind: "linePrefix",
|
|
217
|
+
linePrefix: `${"#".repeat(level)} `,
|
|
218
|
+
family: HEADING_MARKER,
|
|
219
|
+
toggle: false
|
|
220
|
+
});
|
|
221
|
+
/** Every heading level the `Markdown` renderer supports (h1–h6) — offered via the toolbar select. */
|
|
222
|
+
const HEADING_ACTIONS = [
|
|
223
|
+
1,
|
|
224
|
+
2,
|
|
225
|
+
3,
|
|
226
|
+
4,
|
|
227
|
+
5,
|
|
228
|
+
6
|
|
229
|
+
].map(headingAction);
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region src/Markdown/Toolbar/TablePicker.tsx
|
|
232
|
+
/** Smallest grid shown, and the hard cap it grows to as the hover nears the edge. */
|
|
233
|
+
const MIN_EXTENT = 8;
|
|
234
|
+
const MAX_EXTENT = 20;
|
|
235
|
+
const DEFAULT_EXTENT = {
|
|
236
|
+
rows: MIN_EXTENT,
|
|
237
|
+
cols: MIN_EXTENT
|
|
238
|
+
};
|
|
239
|
+
const growExtent = (current, hovered) => Math.min(MAX_EXTENT, Math.max(current, hovered + 1));
|
|
240
|
+
const Cell = styled("button", {
|
|
241
|
+
name: "MarkdownToolbar",
|
|
242
|
+
slot: "tablePickerCell",
|
|
243
|
+
label: "MarkdownEditorTableCell",
|
|
244
|
+
shouldForwardProp: (prop) => prop !== "isActive"
|
|
245
|
+
})(({ theme, isActive }) => ({
|
|
246
|
+
width: 16,
|
|
247
|
+
height: 16,
|
|
248
|
+
padding: 0,
|
|
249
|
+
margin: 0,
|
|
250
|
+
appearance: "none",
|
|
251
|
+
cursor: "pointer",
|
|
252
|
+
borderRadius: theme.radii.sm,
|
|
253
|
+
border: `${theme.borderWidths.thin} solid ${theme.border.light}`,
|
|
254
|
+
backgroundColor: isActive ? theme.palette[themeDefault(theme, "color", "primary")].main : theme.background[themeDefault(theme, "inputBg", "terminal")]
|
|
255
|
+
}));
|
|
256
|
+
/** A "Table" trigger that opens a hover grid for choosing table dimensions. */
|
|
257
|
+
function TablePicker({ onSelect }) {
|
|
258
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
259
|
+
const [hover, setHover] = useState({
|
|
260
|
+
rows: 0,
|
|
261
|
+
cols: 0
|
|
262
|
+
});
|
|
263
|
+
const [extent, setExtent] = useState(DEFAULT_EXTENT);
|
|
264
|
+
const open = anchorEl !== null;
|
|
265
|
+
const close = () => {
|
|
266
|
+
setAnchorEl(null);
|
|
267
|
+
setHover({
|
|
268
|
+
rows: 0,
|
|
269
|
+
cols: 0
|
|
270
|
+
});
|
|
271
|
+
setExtent(DEFAULT_EXTENT);
|
|
272
|
+
};
|
|
273
|
+
const hoverCell = (rows, cols) => {
|
|
274
|
+
setHover({
|
|
275
|
+
rows,
|
|
276
|
+
cols
|
|
277
|
+
});
|
|
278
|
+
setExtent((prev) => ({
|
|
279
|
+
rows: growExtent(prev.rows, rows),
|
|
280
|
+
cols: growExtent(prev.cols, cols)
|
|
281
|
+
}));
|
|
282
|
+
};
|
|
283
|
+
const pick = (rows, cols) => {
|
|
284
|
+
onSelect(rows, cols);
|
|
285
|
+
close();
|
|
286
|
+
};
|
|
287
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Button, {
|
|
288
|
+
type: "button",
|
|
289
|
+
variant: "outlined",
|
|
290
|
+
size: "sm",
|
|
291
|
+
"aria-label": "Table",
|
|
292
|
+
"aria-haspopup": "grid",
|
|
293
|
+
"aria-expanded": open,
|
|
294
|
+
onClick: (event) => setAnchorEl(event.currentTarget),
|
|
295
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
296
|
+
name: "table",
|
|
297
|
+
size: "1.1rem"
|
|
298
|
+
})
|
|
299
|
+
}), /* @__PURE__ */ jsx(Popover, {
|
|
300
|
+
open,
|
|
301
|
+
anchorEl,
|
|
302
|
+
onClose: close,
|
|
303
|
+
anchorOrigin: {
|
|
304
|
+
vertical: "bottom",
|
|
305
|
+
horizontal: "left"
|
|
306
|
+
},
|
|
307
|
+
transformOrigin: {
|
|
308
|
+
vertical: "top",
|
|
309
|
+
horizontal: "left"
|
|
310
|
+
},
|
|
311
|
+
disableAriaHidden: true,
|
|
312
|
+
children: /* @__PURE__ */ jsxs(Flex, {
|
|
313
|
+
flexDirection: "column",
|
|
314
|
+
gap: 2,
|
|
315
|
+
p: 2,
|
|
316
|
+
children: [/* @__PURE__ */ jsx(Flex, {
|
|
317
|
+
flexDirection: "column",
|
|
318
|
+
gap: 1,
|
|
319
|
+
role: "grid",
|
|
320
|
+
"aria-label": "Table size",
|
|
321
|
+
children: Array.from({ length: extent.rows }, (_, r) => /* @__PURE__ */ jsx(Flex, {
|
|
322
|
+
flexDirection: "row",
|
|
323
|
+
gap: 1,
|
|
324
|
+
role: "row",
|
|
325
|
+
children: Array.from({ length: extent.cols }, (_, c) => {
|
|
326
|
+
const rows = r + 1;
|
|
327
|
+
const cols = c + 1;
|
|
328
|
+
return /* @__PURE__ */ jsx(Cell, {
|
|
329
|
+
type: "button",
|
|
330
|
+
role: "gridcell",
|
|
331
|
+
isActive: rows <= hover.rows && cols <= hover.cols,
|
|
332
|
+
"aria-label": `${rows} by ${cols}`,
|
|
333
|
+
onMouseEnter: () => hoverCell(rows, cols),
|
|
334
|
+
onFocus: () => hoverCell(rows, cols),
|
|
335
|
+
onClick: () => pick(rows, cols)
|
|
336
|
+
}, c);
|
|
337
|
+
})
|
|
338
|
+
}, r))
|
|
339
|
+
}), /* @__PURE__ */ jsx(Typography, {
|
|
340
|
+
variant: "caption",
|
|
341
|
+
color: "secondary",
|
|
342
|
+
align: "center",
|
|
343
|
+
m: 0,
|
|
344
|
+
children: hover.rows > 0 ? `${hover.rows} × ${hover.cols}` : "Select size"
|
|
345
|
+
})]
|
|
346
|
+
})
|
|
347
|
+
})] });
|
|
348
|
+
}
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region src/Markdown/Toolbar/Toolbar.tsx
|
|
351
|
+
const HEADING_OPTIONS = HEADING_ACTIONS.map((action) => ({
|
|
352
|
+
label: action.label,
|
|
353
|
+
value: action.id
|
|
354
|
+
}));
|
|
355
|
+
const HEADING_BY_ID = Object.fromEntries(HEADING_ACTIONS.map((action) => [action.id, action]));
|
|
356
|
+
const ToolbarRoot = styled(Flex, {
|
|
357
|
+
name: "MarkdownToolbar",
|
|
358
|
+
label: "MarkdownToolbar"
|
|
359
|
+
})();
|
|
360
|
+
const StrikeLabel = styled(Typography, {
|
|
361
|
+
name: "MarkdownToolbar",
|
|
362
|
+
slot: "strike",
|
|
363
|
+
label: "MarkdownStrike"
|
|
364
|
+
})({ textDecoration: "line-through" });
|
|
365
|
+
/** Renders a button's content: an icon, an emphasis-styled letter, or the plain label. */
|
|
366
|
+
function ActionLabel({ action }) {
|
|
367
|
+
if (action.icon) return /* @__PURE__ */ jsx(Icon, {
|
|
368
|
+
name: action.icon,
|
|
369
|
+
size: "1.1rem"
|
|
370
|
+
});
|
|
371
|
+
if (action.emphasis === "bold") return /* @__PURE__ */ jsx(Typography, {
|
|
372
|
+
as: "span",
|
|
373
|
+
variant: "inherit",
|
|
374
|
+
fontWeight: "extraBold",
|
|
375
|
+
children: action.label
|
|
376
|
+
});
|
|
377
|
+
if (action.emphasis === "italic") return /* @__PURE__ */ jsx(Typography, {
|
|
378
|
+
as: "span",
|
|
379
|
+
variant: "inherit",
|
|
380
|
+
fontStyle: "italic",
|
|
381
|
+
children: action.label
|
|
382
|
+
});
|
|
383
|
+
if (action.emphasis === "strike") return /* @__PURE__ */ jsx(StrikeLabel, {
|
|
384
|
+
as: "span",
|
|
385
|
+
variant: "inherit",
|
|
386
|
+
children: action.label
|
|
387
|
+
});
|
|
388
|
+
return /* @__PURE__ */ jsx(Fragment, { children: action.label });
|
|
389
|
+
}
|
|
390
|
+
/** Formatting buttons, heading + code-language selects, and the table-size picker. */
|
|
391
|
+
function Toolbar() {
|
|
392
|
+
const { dispatch } = useMarkdownContext();
|
|
393
|
+
const renderButton = (action) => /* @__PURE__ */ jsx(Button, {
|
|
394
|
+
type: "button",
|
|
395
|
+
variant: "outlined",
|
|
396
|
+
size: "sm",
|
|
397
|
+
"aria-label": action.ariaLabel,
|
|
398
|
+
onClick: () => dispatch(action),
|
|
399
|
+
children: /* @__PURE__ */ jsx(ActionLabel, { action })
|
|
400
|
+
}, action.id);
|
|
401
|
+
return /* @__PURE__ */ jsxs(ToolbarRoot, {
|
|
402
|
+
flexDirection: "row",
|
|
403
|
+
flexWrap: "wrap",
|
|
404
|
+
gap: 1,
|
|
405
|
+
role: "toolbar",
|
|
406
|
+
"aria-label": "Markdown formatting",
|
|
407
|
+
children: [
|
|
408
|
+
/* @__PURE__ */ jsx(NativeSelect, {
|
|
409
|
+
size: "sm",
|
|
410
|
+
variant: "outlined",
|
|
411
|
+
placeholder: "Heading",
|
|
412
|
+
value: "",
|
|
413
|
+
options: HEADING_OPTIONS,
|
|
414
|
+
onChange: (value) => dispatch(HEADING_BY_ID[String(value)]),
|
|
415
|
+
selectProps: { "aria-label": "Heading level" }
|
|
416
|
+
}),
|
|
417
|
+
groupToolbarActions(TOOLBAR_ACTIONS).map((segment) => segment.length > 1 ? /* @__PURE__ */ jsx(ButtonGroup, {
|
|
418
|
+
borderRadius: "sq",
|
|
419
|
+
size: "sm",
|
|
420
|
+
variant: "outlined",
|
|
421
|
+
children: segment.map(renderButton)
|
|
422
|
+
}, segment[0].id) : renderButton(segment[0])),
|
|
423
|
+
/* @__PURE__ */ jsx(TablePicker, { onSelect: (rows, cols) => dispatch({
|
|
424
|
+
id: "table",
|
|
425
|
+
label: "Table",
|
|
426
|
+
ariaLabel: "Table",
|
|
427
|
+
kind: "insert",
|
|
428
|
+
snippet: buildTableSnippet(rows, cols)
|
|
429
|
+
}) }),
|
|
430
|
+
/* @__PURE__ */ jsxs(Flex, {
|
|
431
|
+
flexDirection: "row",
|
|
432
|
+
gap: 0,
|
|
433
|
+
alignItems: "stretch",
|
|
434
|
+
children: [renderButton(INLINE_CODE_ACTION), /* @__PURE__ */ jsx(NativeSelect, {
|
|
435
|
+
size: "sm",
|
|
436
|
+
variant: "outlined",
|
|
437
|
+
placeholder: "Code",
|
|
438
|
+
value: "",
|
|
439
|
+
options: CODE_LANGUAGES,
|
|
440
|
+
onChange: (value) => dispatch(codeBlockAction(String(value))),
|
|
441
|
+
selectProps: { "aria-label": "Code block language" }
|
|
442
|
+
})]
|
|
443
|
+
})
|
|
444
|
+
]
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
//#endregion
|
|
448
|
+
export { TablePicker as n, Toolbar as t };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_src = require("./src-BiocWFSR.cjs");
|
|
3
|
+
require("react");
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
let _soroush_tech_styled_system_should_forward_prop = require("@soroush.tech/styled-system/should-forward-prop");
|
|
6
|
+
let _emotion_react = require("@emotion/react");
|
|
7
|
+
//#region src/Typography/Typography.tsx
|
|
8
|
+
const shouldForwardProp = (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)([
|
|
9
|
+
..._soroush_tech_styled_system_should_forward_prop.props,
|
|
10
|
+
"noWrap",
|
|
11
|
+
"gutterBottom",
|
|
12
|
+
"align",
|
|
13
|
+
"textTransform"
|
|
14
|
+
]);
|
|
15
|
+
const colorSystem = (0, require_src.src_exports.system)({
|
|
16
|
+
color: {
|
|
17
|
+
property: "color",
|
|
18
|
+
scale: "text"
|
|
19
|
+
},
|
|
20
|
+
bg: {
|
|
21
|
+
property: "backgroundColor",
|
|
22
|
+
scale: "background"
|
|
23
|
+
},
|
|
24
|
+
opacity: { property: "opacity" },
|
|
25
|
+
textTransform: { property: "textTransform" }
|
|
26
|
+
});
|
|
27
|
+
const typographyVariants = ({ variant = "body1", theme }) => {
|
|
28
|
+
const { fontSize, fontWeight, letterSpacing, textTransform } = theme.typography[variant];
|
|
29
|
+
return {
|
|
30
|
+
...fontSize !== void 0 && { fontSize: theme.fontSizes[fontSize] },
|
|
31
|
+
...fontWeight && { fontWeight: theme.fontWeights[fontWeight] },
|
|
32
|
+
...letterSpacing && { letterSpacing: theme.letterSpacings[letterSpacing] },
|
|
33
|
+
...textTransform && { textTransform }
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
const TypographyBase = require_src.styled("p", {
|
|
37
|
+
name: "Typography",
|
|
38
|
+
label: "Typography",
|
|
39
|
+
shouldForwardProp,
|
|
40
|
+
systemProps: [
|
|
41
|
+
require_src.src_exports.space,
|
|
42
|
+
require_src.src_exports.layout,
|
|
43
|
+
colorSystem,
|
|
44
|
+
require_src.src_exports.typography,
|
|
45
|
+
require_src.src_exports.flexbox,
|
|
46
|
+
require_src.src_exports.border,
|
|
47
|
+
require_src.src_exports.position
|
|
48
|
+
]
|
|
49
|
+
})(typographyVariants, ({ align }) => align ? { textAlign: align } : {}, ({ gutterBottom }) => gutterBottom ? { marginBottom: "0.5em" } : {}, ({ noWrap }) => noWrap ? {
|
|
50
|
+
overflow: "hidden",
|
|
51
|
+
textOverflow: "ellipsis",
|
|
52
|
+
whiteSpace: "nowrap"
|
|
53
|
+
} : {});
|
|
54
|
+
function Typography({ variant = "body1", as, ...rest }) {
|
|
55
|
+
const theme = (0, _emotion_react.useTheme)();
|
|
56
|
+
const element = as ?? theme.typography[variant].element;
|
|
57
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TypographyBase, {
|
|
58
|
+
as: element,
|
|
59
|
+
variant,
|
|
60
|
+
...rest
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
exports.Typography = Typography;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { F as TypographyVariant } from "./themes-D81JYbqm.cjs";
|
|
2
|
+
import { a as TypographyProps, i as TypographyAlign, n as TextColorToken, r as Typography, t as BackgroundToken } from "./index-CDVnvjIE.cjs";
|
|
3
|
+
export { BackgroundToken, TextColorToken, Typography, TypographyAlign, TypographyProps, type TypographyVariant };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { F as TypographyVariant } from "./themes-D1SAp3SL.mjs";
|
|
2
|
+
import { a as TypographyProps, i as TypographyAlign, n as TextColorToken, r as Typography, t as BackgroundToken } from "./index-DE5PtzPn.mjs";
|
|
3
|
+
export { BackgroundToken, TextColorToken, Typography, TypographyAlign, TypographyProps, type TypographyVariant };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { a as createShouldForwardProp, c as props, d as styled, l as src_exports, u as useTheme } from "./src-DcNT2aIK.mjs";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/Typography/Typography.tsx
|
|
5
|
+
const shouldForwardProp = createShouldForwardProp([
|
|
6
|
+
...props,
|
|
7
|
+
"noWrap",
|
|
8
|
+
"gutterBottom",
|
|
9
|
+
"align",
|
|
10
|
+
"textTransform"
|
|
11
|
+
]);
|
|
12
|
+
const colorSystem = (0, src_exports.system)({
|
|
13
|
+
color: {
|
|
14
|
+
property: "color",
|
|
15
|
+
scale: "text"
|
|
16
|
+
},
|
|
17
|
+
bg: {
|
|
18
|
+
property: "backgroundColor",
|
|
19
|
+
scale: "background"
|
|
20
|
+
},
|
|
21
|
+
opacity: { property: "opacity" },
|
|
22
|
+
textTransform: { property: "textTransform" }
|
|
23
|
+
});
|
|
24
|
+
const typographyVariants = ({ variant = "body1", theme }) => {
|
|
25
|
+
const { fontSize, fontWeight, letterSpacing, textTransform } = theme.typography[variant];
|
|
26
|
+
return {
|
|
27
|
+
...fontSize !== void 0 && { fontSize: theme.fontSizes[fontSize] },
|
|
28
|
+
...fontWeight && { fontWeight: theme.fontWeights[fontWeight] },
|
|
29
|
+
...letterSpacing && { letterSpacing: theme.letterSpacings[letterSpacing] },
|
|
30
|
+
...textTransform && { textTransform }
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
const TypographyBase = styled("p", {
|
|
34
|
+
name: "Typography",
|
|
35
|
+
label: "Typography",
|
|
36
|
+
shouldForwardProp,
|
|
37
|
+
systemProps: [
|
|
38
|
+
src_exports.space,
|
|
39
|
+
src_exports.layout,
|
|
40
|
+
colorSystem,
|
|
41
|
+
src_exports.typography,
|
|
42
|
+
src_exports.flexbox,
|
|
43
|
+
src_exports.border,
|
|
44
|
+
src_exports.position
|
|
45
|
+
]
|
|
46
|
+
})(typographyVariants, ({ align }) => align ? { textAlign: align } : {}, ({ gutterBottom }) => gutterBottom ? { marginBottom: "0.5em" } : {}, ({ noWrap }) => noWrap ? {
|
|
47
|
+
overflow: "hidden",
|
|
48
|
+
textOverflow: "ellipsis",
|
|
49
|
+
whiteSpace: "nowrap"
|
|
50
|
+
} : {});
|
|
51
|
+
function Typography({ variant = "body1", as, ...rest }) {
|
|
52
|
+
const theme = useTheme();
|
|
53
|
+
const element = as ?? theme.typography[variant].element;
|
|
54
|
+
return /* @__PURE__ */ jsx(TypographyBase, {
|
|
55
|
+
as: element,
|
|
56
|
+
variant,
|
|
57
|
+
...rest
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { Typography };
|
package/dist/View.cjs
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_src = require("./src-BiocWFSR.cjs");
|
|
3
|
+
require("react");
|
|
4
|
+
let _soroush_tech_styled_system_should_forward_prop = require("@soroush.tech/styled-system/should-forward-prop");
|
|
5
|
+
//#region src/View/View.tsx
|
|
6
|
+
const shouldForwardProp = (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)([
|
|
7
|
+
..._soroush_tech_styled_system_should_forward_prop.props,
|
|
8
|
+
"cursor",
|
|
9
|
+
"aspectRatio",
|
|
10
|
+
"order"
|
|
11
|
+
]);
|
|
12
|
+
const colorSystem = (0, require_src.src_exports.system)({
|
|
13
|
+
bg: {
|
|
14
|
+
property: "backgroundColor",
|
|
15
|
+
scale: "background"
|
|
16
|
+
},
|
|
17
|
+
borderColor: {
|
|
18
|
+
property: "borderColor",
|
|
19
|
+
scale: "border"
|
|
20
|
+
},
|
|
21
|
+
opacity: { property: "opacity" },
|
|
22
|
+
cursor: { property: "cursor" },
|
|
23
|
+
aspectRatio: { property: "aspectRatio" },
|
|
24
|
+
order: { property: "order" }
|
|
25
|
+
});
|
|
26
|
+
const View = require_src.styled("div", {
|
|
27
|
+
name: "View",
|
|
28
|
+
label: "View",
|
|
29
|
+
shouldForwardProp,
|
|
30
|
+
systemProps: [
|
|
31
|
+
require_src.src_exports.space,
|
|
32
|
+
require_src.src_exports.layout,
|
|
33
|
+
colorSystem,
|
|
34
|
+
require_src.src_exports.typography,
|
|
35
|
+
require_src.src_exports.border,
|
|
36
|
+
require_src.src_exports.position
|
|
37
|
+
]
|
|
38
|
+
})();
|
|
39
|
+
//#endregion
|
|
40
|
+
exports.View = View;
|
package/dist/View.d.cts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as ViewBorderWidthToken, i as ViewBorderRadiusToken, n as ViewBackgroundToken, o as ViewColorToken, r as ViewBorderColorToken, s as ViewProps, t as View } from "./index-FwTocqhP.cjs";
|
|
2
|
+
export { View, ViewBackgroundToken, ViewBorderColorToken, ViewBorderRadiusToken, ViewBorderWidthToken, ViewColorToken, ViewProps };
|
package/dist/View.d.mts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as ViewBorderWidthToken, i as ViewBorderRadiusToken, n as ViewBackgroundToken, o as ViewColorToken, r as ViewBorderColorToken, s as ViewProps, t as View } from "./index-pX7tBQdJ.mjs";
|
|
2
|
+
export { View, ViewBackgroundToken, ViewBorderColorToken, ViewBorderRadiusToken, ViewBorderWidthToken, ViewColorToken, ViewProps };
|
package/dist/View.mjs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { a as createShouldForwardProp, c as props, d as styled, l as src_exports } from "./src-DcNT2aIK.mjs";
|
|
2
|
+
import "react";
|
|
3
|
+
//#region src/View/View.tsx
|
|
4
|
+
const shouldForwardProp = createShouldForwardProp([
|
|
5
|
+
...props,
|
|
6
|
+
"cursor",
|
|
7
|
+
"aspectRatio",
|
|
8
|
+
"order"
|
|
9
|
+
]);
|
|
10
|
+
const colorSystem = (0, src_exports.system)({
|
|
11
|
+
bg: {
|
|
12
|
+
property: "backgroundColor",
|
|
13
|
+
scale: "background"
|
|
14
|
+
},
|
|
15
|
+
borderColor: {
|
|
16
|
+
property: "borderColor",
|
|
17
|
+
scale: "border"
|
|
18
|
+
},
|
|
19
|
+
opacity: { property: "opacity" },
|
|
20
|
+
cursor: { property: "cursor" },
|
|
21
|
+
aspectRatio: { property: "aspectRatio" },
|
|
22
|
+
order: { property: "order" }
|
|
23
|
+
});
|
|
24
|
+
const View = styled("div", {
|
|
25
|
+
name: "View",
|
|
26
|
+
label: "View",
|
|
27
|
+
shouldForwardProp,
|
|
28
|
+
systemProps: [
|
|
29
|
+
src_exports.space,
|
|
30
|
+
src_exports.layout,
|
|
31
|
+
colorSystem,
|
|
32
|
+
src_exports.typography,
|
|
33
|
+
src_exports.border,
|
|
34
|
+
src_exports.position
|
|
35
|
+
]
|
|
36
|
+
})();
|
|
37
|
+
//#endregion
|
|
38
|
+
export { View };
|