@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,214 @@
|
|
|
1
|
+
import { a as createShouldForwardProp, c as props, d as styled, l as src_exports, s as keyframes } from "./src-DcNT2aIK.mjs";
|
|
2
|
+
import { t as themeDefault } from "./themeDefault-CjXaY3ok.mjs";
|
|
3
|
+
import { clamp } from "./utils.mjs";
|
|
4
|
+
import "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/LinearProgress/LinearProgress.tsx
|
|
7
|
+
const shouldForwardProp = createShouldForwardProp([
|
|
8
|
+
...props,
|
|
9
|
+
"color",
|
|
10
|
+
"variant",
|
|
11
|
+
"thickness",
|
|
12
|
+
"value",
|
|
13
|
+
"buffer",
|
|
14
|
+
"valueBuffer",
|
|
15
|
+
"min",
|
|
16
|
+
"max",
|
|
17
|
+
"spinning",
|
|
18
|
+
"easing",
|
|
19
|
+
"showTrack",
|
|
20
|
+
"round"
|
|
21
|
+
]);
|
|
22
|
+
const THICKNESS_DEFAULT = 4;
|
|
23
|
+
const indeterminateBar1 = keyframes({
|
|
24
|
+
"0%": {
|
|
25
|
+
left: "-35%",
|
|
26
|
+
right: "100%"
|
|
27
|
+
},
|
|
28
|
+
"60%": {
|
|
29
|
+
left: "100%",
|
|
30
|
+
right: "-90%"
|
|
31
|
+
},
|
|
32
|
+
"100%": {
|
|
33
|
+
left: "100%",
|
|
34
|
+
right: "-90%"
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const indeterminateBar2 = keyframes({
|
|
38
|
+
"0%": {
|
|
39
|
+
left: "-200%",
|
|
40
|
+
right: "100%"
|
|
41
|
+
},
|
|
42
|
+
"60%": {
|
|
43
|
+
left: "107%",
|
|
44
|
+
right: "-8%"
|
|
45
|
+
},
|
|
46
|
+
"100%": {
|
|
47
|
+
left: "107%",
|
|
48
|
+
right: "-8%"
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const bufferDots = keyframes({
|
|
52
|
+
"0%": {
|
|
53
|
+
opacity: 1,
|
|
54
|
+
backgroundPosition: "0 -23px"
|
|
55
|
+
},
|
|
56
|
+
"60%": {
|
|
57
|
+
opacity: 0,
|
|
58
|
+
backgroundPosition: "0 -23px"
|
|
59
|
+
},
|
|
60
|
+
"100%": {
|
|
61
|
+
opacity: 1,
|
|
62
|
+
backgroundPosition: "-200px -23px"
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const travel = keyframes({
|
|
66
|
+
"0%": { transform: "translateX(0%)" },
|
|
67
|
+
"100%": { transform: "translateX(100%)" }
|
|
68
|
+
});
|
|
69
|
+
const LinearProgressTrack = styled("span", {
|
|
70
|
+
name: "LinearProgress",
|
|
71
|
+
slot: "track",
|
|
72
|
+
label: "LinearProgressTrack"
|
|
73
|
+
})({
|
|
74
|
+
position: "absolute",
|
|
75
|
+
inset: 0,
|
|
76
|
+
backgroundColor: "currentColor",
|
|
77
|
+
opacity: .2
|
|
78
|
+
});
|
|
79
|
+
const LinearProgressDash = styled("span", {
|
|
80
|
+
name: "LinearProgress",
|
|
81
|
+
slot: "dash",
|
|
82
|
+
label: "LinearProgressDash"
|
|
83
|
+
})({
|
|
84
|
+
position: "absolute",
|
|
85
|
+
inset: 0,
|
|
86
|
+
backgroundImage: "radial-gradient(currentColor 0%, currentColor 16%, transparent 42%)",
|
|
87
|
+
backgroundSize: "10px 10px",
|
|
88
|
+
backgroundPosition: "0 -23px",
|
|
89
|
+
opacity: .3,
|
|
90
|
+
animation: `${bufferDots} 3s infinite linear`
|
|
91
|
+
});
|
|
92
|
+
const barShouldForwardProp = (prop) => prop !== "variant" && prop !== "buffer" && prop !== "easing";
|
|
93
|
+
const LinearProgressBar = styled("span", {
|
|
94
|
+
name: "LinearProgress",
|
|
95
|
+
slot: "bar",
|
|
96
|
+
label: "LinearProgressBar",
|
|
97
|
+
shouldForwardProp: barShouldForwardProp
|
|
98
|
+
})(({ variant, easing = "linear" }) => ({
|
|
99
|
+
position: "absolute",
|
|
100
|
+
top: 0,
|
|
101
|
+
bottom: 0,
|
|
102
|
+
left: 0,
|
|
103
|
+
transformOrigin: "left",
|
|
104
|
+
backgroundColor: "currentColor",
|
|
105
|
+
...variant === "determinate" ? {
|
|
106
|
+
width: "100%",
|
|
107
|
+
transition: `transform 0.4s ${easing}`
|
|
108
|
+
} : { animation: `${indeterminateBar1} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite` }
|
|
109
|
+
}));
|
|
110
|
+
const LinearProgressTraveler = styled("span", {
|
|
111
|
+
name: "LinearProgress",
|
|
112
|
+
slot: "traveler",
|
|
113
|
+
label: "LinearProgressTraveler",
|
|
114
|
+
shouldForwardProp: barShouldForwardProp
|
|
115
|
+
})(({ easing = "linear" }) => ({
|
|
116
|
+
position: "absolute",
|
|
117
|
+
inset: 0,
|
|
118
|
+
animation: `${travel} 1.4s ${easing} infinite`
|
|
119
|
+
}));
|
|
120
|
+
const LinearProgressSegment = styled("span", {
|
|
121
|
+
name: "LinearProgress",
|
|
122
|
+
slot: "segment",
|
|
123
|
+
label: "LinearProgressSegment"
|
|
124
|
+
})({
|
|
125
|
+
position: "absolute",
|
|
126
|
+
top: 0,
|
|
127
|
+
bottom: 0,
|
|
128
|
+
left: 0,
|
|
129
|
+
backgroundColor: "currentColor"
|
|
130
|
+
});
|
|
131
|
+
const LinearProgressBarSecondary = styled("span", {
|
|
132
|
+
name: "LinearProgress",
|
|
133
|
+
slot: "secondaryBar",
|
|
134
|
+
label: "LinearProgressBarSecondary",
|
|
135
|
+
shouldForwardProp: barShouldForwardProp
|
|
136
|
+
})(({ buffer, easing = "linear" }) => ({
|
|
137
|
+
position: "absolute",
|
|
138
|
+
top: 0,
|
|
139
|
+
bottom: 0,
|
|
140
|
+
left: 0,
|
|
141
|
+
transformOrigin: "left",
|
|
142
|
+
backgroundColor: "currentColor",
|
|
143
|
+
...buffer ? {
|
|
144
|
+
width: "100%",
|
|
145
|
+
opacity: .4,
|
|
146
|
+
transition: `transform 0.4s ${easing}`
|
|
147
|
+
} : { animation: `${indeterminateBar2} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite` }
|
|
148
|
+
}));
|
|
149
|
+
const colorStyle = ({ color: colorProp, theme }) => {
|
|
150
|
+
const color = colorProp ?? themeDefault(theme, "color", "primary");
|
|
151
|
+
if (color === "inherit") return {};
|
|
152
|
+
return { color: theme.palette[color].main };
|
|
153
|
+
};
|
|
154
|
+
const baseStyle = {
|
|
155
|
+
display: "block",
|
|
156
|
+
position: "relative",
|
|
157
|
+
overflow: "hidden",
|
|
158
|
+
width: "100%"
|
|
159
|
+
};
|
|
160
|
+
const thicknessStyle = ({ thickness = THICKNESS_DEFAULT }) => ({ height: thickness });
|
|
161
|
+
const directionStyle = ({ variant = "indeterminate" }) => variant === "query" ? { transform: "rotate(180deg)" } : {};
|
|
162
|
+
const roundStyle = ({ round }) => round ? { borderRadius: "9999px" } : {};
|
|
163
|
+
const LinearProgressRoot = styled("span", {
|
|
164
|
+
name: "LinearProgress",
|
|
165
|
+
label: "LinearProgress",
|
|
166
|
+
shouldForwardProp,
|
|
167
|
+
systemProps: [src_exports.space, src_exports.layout]
|
|
168
|
+
})(baseStyle, thicknessStyle, colorStyle, directionStyle, roundStyle);
|
|
169
|
+
function LinearProgress({ variant = "indeterminate", color, thickness = THICKNESS_DEFAULT, value, buffer = false, valueBuffer, min = 0, max = 100, spinning = false, easing = "linear", showTrack = true, round = false, ...rest }) {
|
|
170
|
+
const isDeterminate = variant === "determinate";
|
|
171
|
+
const isBuffer = isDeterminate && buffer;
|
|
172
|
+
const isSpinning = isDeterminate && spinning;
|
|
173
|
+
const normalizedValue = clamp(value ?? min, min, max);
|
|
174
|
+
const normalizedBuffer = clamp(valueBuffer ?? min, min, max);
|
|
175
|
+
const toPercent = (n) => max === 0 ? 0 : n / max * 100;
|
|
176
|
+
const valuePercent = toPercent(normalizedValue);
|
|
177
|
+
const barStyle = isDeterminate ? { transform: `translateX(${valuePercent - 100}%)` } : void 0;
|
|
178
|
+
const bufferBarStyle = isBuffer ? { transform: `translateX(${toPercent(normalizedBuffer) - 100}%)` } : void 0;
|
|
179
|
+
return /* @__PURE__ */ jsxs(LinearProgressRoot, {
|
|
180
|
+
role: "progressbar",
|
|
181
|
+
"aria-label": "Loading",
|
|
182
|
+
color,
|
|
183
|
+
variant,
|
|
184
|
+
thickness,
|
|
185
|
+
round,
|
|
186
|
+
...isDeterminate ? {
|
|
187
|
+
"aria-valuenow": normalizedValue,
|
|
188
|
+
"aria-valuemin": min,
|
|
189
|
+
"aria-valuemax": max
|
|
190
|
+
} : {},
|
|
191
|
+
...rest,
|
|
192
|
+
children: [
|
|
193
|
+
showTrack && (isBuffer ? /* @__PURE__ */ jsx(LinearProgressDash, {}) : /* @__PURE__ */ jsx(LinearProgressTrack, {})),
|
|
194
|
+
(!isDeterminate || isBuffer) && /* @__PURE__ */ jsx(LinearProgressBarSecondary, {
|
|
195
|
+
buffer: isBuffer,
|
|
196
|
+
easing,
|
|
197
|
+
style: bufferBarStyle
|
|
198
|
+
}),
|
|
199
|
+
isSpinning ? /* @__PURE__ */ jsxs(LinearProgressTraveler, {
|
|
200
|
+
easing,
|
|
201
|
+
children: [/* @__PURE__ */ jsx(LinearProgressSegment, { style: { width: `${valuePercent}%` } }), /* @__PURE__ */ jsx(LinearProgressSegment, { style: {
|
|
202
|
+
width: `${valuePercent}%`,
|
|
203
|
+
left: "-100%"
|
|
204
|
+
} })]
|
|
205
|
+
}) : /* @__PURE__ */ jsx(LinearProgressBar, {
|
|
206
|
+
variant,
|
|
207
|
+
easing,
|
|
208
|
+
style: barStyle
|
|
209
|
+
})
|
|
210
|
+
]
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
//#endregion
|
|
214
|
+
export { LinearProgress };
|
package/dist/Link.cjs
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
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_Typography = require("./Typography.cjs");
|
|
5
|
+
require("react");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let _emotion_react = require("@emotion/react");
|
|
8
|
+
//#region src/Link/Link.tsx
|
|
9
|
+
const underlineStyles = {
|
|
10
|
+
always: { textDecoration: "underline" },
|
|
11
|
+
none: { textDecoration: "none" },
|
|
12
|
+
hover: {
|
|
13
|
+
textDecoration: "none",
|
|
14
|
+
position: "relative",
|
|
15
|
+
"&::after": {
|
|
16
|
+
content: "\"\"",
|
|
17
|
+
position: "absolute",
|
|
18
|
+
bottom: 0,
|
|
19
|
+
left: 0,
|
|
20
|
+
width: "100%",
|
|
21
|
+
height: "1px",
|
|
22
|
+
background: "currentColor",
|
|
23
|
+
transform: "scaleX(0)",
|
|
24
|
+
transformOrigin: "right",
|
|
25
|
+
transition: "transform 0.2s ease"
|
|
26
|
+
},
|
|
27
|
+
"&:hover::after": {
|
|
28
|
+
transform: "scaleX(1)",
|
|
29
|
+
transformOrigin: "left"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const linkGapSystem = (0, require_src.src_exports.system)({ gap: {
|
|
34
|
+
property: "gap",
|
|
35
|
+
scale: "space"
|
|
36
|
+
} });
|
|
37
|
+
const LinkBase = require_src.styled(require_Typography.Typography, {
|
|
38
|
+
name: "Link",
|
|
39
|
+
label: "Link",
|
|
40
|
+
shouldForwardProp: (prop) => prop !== "underline"
|
|
41
|
+
})(({ underline = "always" }) => underlineStyles[underline], ({ theme }) => ({
|
|
42
|
+
"&:hover": { color: theme.palette[require_themeDefault.themeDefault(theme, "color", "primary")].main },
|
|
43
|
+
"&:focus-visible": {
|
|
44
|
+
outline: `2px solid ${theme.palette[require_themeDefault.themeDefault(theme, "color", "primary")].main}`,
|
|
45
|
+
outlineOffset: "4px",
|
|
46
|
+
borderRadius: theme.radii.sm
|
|
47
|
+
}
|
|
48
|
+
}), linkGapSystem);
|
|
49
|
+
function Link({ underline: underlineProp, color, variant = "inherit", target, rel, ...rest }) {
|
|
50
|
+
const theme = (0, _emotion_react.useTheme)();
|
|
51
|
+
const underline = underlineProp ?? require_themeDefault.themeDefault(theme, "linkUnderline", "always");
|
|
52
|
+
const resolvedRel = target === "_blank" && rel === void 0 ? "noopener noreferrer" : rel;
|
|
53
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LinkBase, {
|
|
54
|
+
as: "a",
|
|
55
|
+
underline,
|
|
56
|
+
color: color ?? require_themeDefault.themeDefault(theme, "accentTextColor", "primary"),
|
|
57
|
+
variant,
|
|
58
|
+
target,
|
|
59
|
+
rel: resolvedRel,
|
|
60
|
+
...rest
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
exports.Link = Link;
|
package/dist/Link.d.cts
ADDED
package/dist/Link.d.mts
ADDED
package/dist/Link.mjs
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { d as styled, l as src_exports, u as useTheme } from "./src-DcNT2aIK.mjs";
|
|
2
|
+
import { t as themeDefault } from "./themeDefault-CjXaY3ok.mjs";
|
|
3
|
+
import { Typography } from "./Typography.mjs";
|
|
4
|
+
import "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/Link/Link.tsx
|
|
7
|
+
const underlineStyles = {
|
|
8
|
+
always: { textDecoration: "underline" },
|
|
9
|
+
none: { textDecoration: "none" },
|
|
10
|
+
hover: {
|
|
11
|
+
textDecoration: "none",
|
|
12
|
+
position: "relative",
|
|
13
|
+
"&::after": {
|
|
14
|
+
content: "\"\"",
|
|
15
|
+
position: "absolute",
|
|
16
|
+
bottom: 0,
|
|
17
|
+
left: 0,
|
|
18
|
+
width: "100%",
|
|
19
|
+
height: "1px",
|
|
20
|
+
background: "currentColor",
|
|
21
|
+
transform: "scaleX(0)",
|
|
22
|
+
transformOrigin: "right",
|
|
23
|
+
transition: "transform 0.2s ease"
|
|
24
|
+
},
|
|
25
|
+
"&:hover::after": {
|
|
26
|
+
transform: "scaleX(1)",
|
|
27
|
+
transformOrigin: "left"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const linkGapSystem = (0, src_exports.system)({ gap: {
|
|
32
|
+
property: "gap",
|
|
33
|
+
scale: "space"
|
|
34
|
+
} });
|
|
35
|
+
const LinkBase = styled(Typography, {
|
|
36
|
+
name: "Link",
|
|
37
|
+
label: "Link",
|
|
38
|
+
shouldForwardProp: (prop) => prop !== "underline"
|
|
39
|
+
})(({ underline = "always" }) => underlineStyles[underline], ({ theme }) => ({
|
|
40
|
+
"&:hover": { color: theme.palette[themeDefault(theme, "color", "primary")].main },
|
|
41
|
+
"&:focus-visible": {
|
|
42
|
+
outline: `2px solid ${theme.palette[themeDefault(theme, "color", "primary")].main}`,
|
|
43
|
+
outlineOffset: "4px",
|
|
44
|
+
borderRadius: theme.radii.sm
|
|
45
|
+
}
|
|
46
|
+
}), linkGapSystem);
|
|
47
|
+
function Link({ underline: underlineProp, color, variant = "inherit", target, rel, ...rest }) {
|
|
48
|
+
const theme = useTheme();
|
|
49
|
+
const underline = underlineProp ?? themeDefault(theme, "linkUnderline", "always");
|
|
50
|
+
const resolvedRel = target === "_blank" && rel === void 0 ? "noopener noreferrer" : rel;
|
|
51
|
+
return /* @__PURE__ */ jsx(LinkBase, {
|
|
52
|
+
as: "a",
|
|
53
|
+
underline,
|
|
54
|
+
color: color ?? themeDefault(theme, "accentTextColor", "primary"),
|
|
55
|
+
variant,
|
|
56
|
+
target,
|
|
57
|
+
rel: resolvedRel,
|
|
58
|
+
...rest
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { Link };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_applyAction = require("../applyAction-B2uVHxOE.cjs");
|
|
3
|
+
const require_MarkdownContext = require("../MarkdownContext-DSwjzpH8.cjs");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
//#region src/Markdown/Control/Control.tsx
|
|
7
|
+
/**
|
|
8
|
+
* The headless root of the Markdown compound: owns the shared value/selection state and exposes
|
|
9
|
+
* it (plus a `dispatch` for toolbar actions) via context. It renders no UI of its own — the
|
|
10
|
+
* consumer arranges the parts and decides which panes to show.
|
|
11
|
+
*/
|
|
12
|
+
function Control({ value, onChange, children }) {
|
|
13
|
+
const lastSelectionRef = (0, react.useRef)(null);
|
|
14
|
+
const pendingSelectionRef = (0, react.useRef)(null);
|
|
15
|
+
const context = (0, react.useMemo)(() => {
|
|
16
|
+
const dispatch = (action) => {
|
|
17
|
+
const { start, end } = lastSelectionRef.current ?? {
|
|
18
|
+
start: value.length,
|
|
19
|
+
end: value.length
|
|
20
|
+
};
|
|
21
|
+
const next = require_applyAction.applyAction(action, {
|
|
22
|
+
value,
|
|
23
|
+
selectionStart: start,
|
|
24
|
+
selectionEnd: end
|
|
25
|
+
});
|
|
26
|
+
const selection = {
|
|
27
|
+
start: next.selectionStart,
|
|
28
|
+
end: next.selectionEnd
|
|
29
|
+
};
|
|
30
|
+
pendingSelectionRef.current = selection;
|
|
31
|
+
lastSelectionRef.current = selection;
|
|
32
|
+
onChange(next.value);
|
|
33
|
+
};
|
|
34
|
+
const rememberSelection = (selection) => {
|
|
35
|
+
lastSelectionRef.current = selection;
|
|
36
|
+
};
|
|
37
|
+
const queueSelection = (selection) => {
|
|
38
|
+
pendingSelectionRef.current = selection;
|
|
39
|
+
lastSelectionRef.current = selection;
|
|
40
|
+
};
|
|
41
|
+
const takeQueuedSelection = () => {
|
|
42
|
+
const selection = pendingSelectionRef.current;
|
|
43
|
+
pendingSelectionRef.current = null;
|
|
44
|
+
return selection;
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
value,
|
|
48
|
+
onChange,
|
|
49
|
+
dispatch,
|
|
50
|
+
rememberSelection,
|
|
51
|
+
queueSelection,
|
|
52
|
+
takeQueuedSelection
|
|
53
|
+
};
|
|
54
|
+
}, [value, onChange]);
|
|
55
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownContext.MarkdownContext.Provider, {
|
|
56
|
+
value: context,
|
|
57
|
+
children
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
exports.Control = Control;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/Markdown/Control/Control.d.ts
|
|
3
|
+
interface ControlProps {
|
|
4
|
+
/** Current markdown source (controlled). */
|
|
5
|
+
value: string;
|
|
6
|
+
/** Called with the next source on edit or a toolbar action. */
|
|
7
|
+
onChange: (value: string) => void;
|
|
8
|
+
/** The composed parts — `Markdown.Toolbar`, `Markdown.Editor`, `Markdown.Preview`, … */
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The headless root of the Markdown compound: owns the shared value/selection state and exposes
|
|
13
|
+
* it (plus a `dispatch` for toolbar actions) via context. It renders no UI of its own — the
|
|
14
|
+
* consumer arranges the parts and decides which panes to show.
|
|
15
|
+
*/
|
|
16
|
+
declare function Control({ value, onChange, children }: Readonly<ControlProps>): import("react").JSX.Element;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Control, ControlProps };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/Markdown/Control/Control.d.ts
|
|
3
|
+
interface ControlProps {
|
|
4
|
+
/** Current markdown source (controlled). */
|
|
5
|
+
value: string;
|
|
6
|
+
/** Called with the next source on edit or a toolbar action. */
|
|
7
|
+
onChange: (value: string) => void;
|
|
8
|
+
/** The composed parts — `Markdown.Toolbar`, `Markdown.Editor`, `Markdown.Preview`, … */
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The headless root of the Markdown compound: owns the shared value/selection state and exposes
|
|
13
|
+
* it (plus a `dispatch` for toolbar actions) via context. It renders no UI of its own — the
|
|
14
|
+
* consumer arranges the parts and decides which panes to show.
|
|
15
|
+
*/
|
|
16
|
+
declare function Control({ value, onChange, children }: Readonly<ControlProps>): import("react").JSX.Element;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Control, ControlProps };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { t as applyAction } from "../applyAction-B2B-hnP3.mjs";
|
|
2
|
+
import { t as MarkdownContext } from "../MarkdownContext-BN8A3W-J.mjs";
|
|
3
|
+
import { useMemo, useRef } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/Markdown/Control/Control.tsx
|
|
6
|
+
/**
|
|
7
|
+
* The headless root of the Markdown compound: owns the shared value/selection state and exposes
|
|
8
|
+
* it (plus a `dispatch` for toolbar actions) via context. It renders no UI of its own — the
|
|
9
|
+
* consumer arranges the parts and decides which panes to show.
|
|
10
|
+
*/
|
|
11
|
+
function Control({ value, onChange, children }) {
|
|
12
|
+
const lastSelectionRef = useRef(null);
|
|
13
|
+
const pendingSelectionRef = useRef(null);
|
|
14
|
+
const context = useMemo(() => {
|
|
15
|
+
const dispatch = (action) => {
|
|
16
|
+
const { start, end } = lastSelectionRef.current ?? {
|
|
17
|
+
start: value.length,
|
|
18
|
+
end: value.length
|
|
19
|
+
};
|
|
20
|
+
const next = applyAction(action, {
|
|
21
|
+
value,
|
|
22
|
+
selectionStart: start,
|
|
23
|
+
selectionEnd: end
|
|
24
|
+
});
|
|
25
|
+
const selection = {
|
|
26
|
+
start: next.selectionStart,
|
|
27
|
+
end: next.selectionEnd
|
|
28
|
+
};
|
|
29
|
+
pendingSelectionRef.current = selection;
|
|
30
|
+
lastSelectionRef.current = selection;
|
|
31
|
+
onChange(next.value);
|
|
32
|
+
};
|
|
33
|
+
const rememberSelection = (selection) => {
|
|
34
|
+
lastSelectionRef.current = selection;
|
|
35
|
+
};
|
|
36
|
+
const queueSelection = (selection) => {
|
|
37
|
+
pendingSelectionRef.current = selection;
|
|
38
|
+
lastSelectionRef.current = selection;
|
|
39
|
+
};
|
|
40
|
+
const takeQueuedSelection = () => {
|
|
41
|
+
const selection = pendingSelectionRef.current;
|
|
42
|
+
pendingSelectionRef.current = null;
|
|
43
|
+
return selection;
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
value,
|
|
47
|
+
onChange,
|
|
48
|
+
dispatch,
|
|
49
|
+
rememberSelection,
|
|
50
|
+
queueSelection,
|
|
51
|
+
takeQueuedSelection
|
|
52
|
+
};
|
|
53
|
+
}, [value, onChange]);
|
|
54
|
+
return /* @__PURE__ */ jsx(MarkdownContext.Provider, {
|
|
55
|
+
value: context,
|
|
56
|
+
children
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { Control };
|
|
@@ -0,0 +1,130 @@
|
|
|
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_Flex = require("../Flex.cjs");
|
|
5
|
+
const require_Typography = require("../Typography.cjs");
|
|
6
|
+
const require_applyAction = require("../applyAction-B2uVHxOE.cjs");
|
|
7
|
+
const require_MarkdownContext = require("../MarkdownContext-DSwjzpH8.cjs");
|
|
8
|
+
const require_TextInput = require("../TextInput-6o37Zddp.cjs");
|
|
9
|
+
let react = require("react");
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
let _emotion_react = require("@emotion/react");
|
|
12
|
+
//#region src/Markdown/Editor/Editor.tsx
|
|
13
|
+
const EditorRoot = require_src.styled(require_Flex.Flex, {
|
|
14
|
+
name: "MarkdownEditor",
|
|
15
|
+
label: "MarkdownEditor"
|
|
16
|
+
})();
|
|
17
|
+
const INDENT_ACTION = {
|
|
18
|
+
id: "indent",
|
|
19
|
+
label: "",
|
|
20
|
+
ariaLabel: "",
|
|
21
|
+
kind: "linePrefix",
|
|
22
|
+
linePrefix: " "
|
|
23
|
+
};
|
|
24
|
+
const noop = () => {};
|
|
25
|
+
/**
|
|
26
|
+
* The source `<textarea>`, with selection tracking and Tab-to-indent. Inside a `Control` it is
|
|
27
|
+
* driven by context (so the `Toolbar` can act on it); on its own it is a plain controlled field
|
|
28
|
+
* via `value`/`onChange`.
|
|
29
|
+
*/
|
|
30
|
+
function Editor({ value: valueProp, onChange: onChangeProp, placeholder = "Write your article in Markdown…", minRows = 16, variant, color, textColor: textColorProp, size, name, id, error, required, disabled, showShortcutHint = true }) {
|
|
31
|
+
const context = (0, react.useContext)(require_MarkdownContext.MarkdownContext);
|
|
32
|
+
const theme = (0, _emotion_react.useTheme)();
|
|
33
|
+
const textColor = textColorProp ?? require_themeDefault.themeDefault(theme, "textColor", "initial");
|
|
34
|
+
const hintId = (0, react.useId)();
|
|
35
|
+
const localPendingRef = (0, react.useRef)(null);
|
|
36
|
+
const value = context?.value ?? valueProp ?? "";
|
|
37
|
+
const onChange = context?.onChange ?? onChangeProp ?? noop;
|
|
38
|
+
const paneRef = (0, react.useRef)(null);
|
|
39
|
+
const queueSelection = (selection) => {
|
|
40
|
+
if (context) context.queueSelection(selection);
|
|
41
|
+
else localPendingRef.current = selection;
|
|
42
|
+
};
|
|
43
|
+
const takeQueuedSelection = () => {
|
|
44
|
+
if (context) return context.takeQueuedSelection();
|
|
45
|
+
const selection = localPendingRef.current;
|
|
46
|
+
localPendingRef.current = null;
|
|
47
|
+
return selection;
|
|
48
|
+
};
|
|
49
|
+
const rememberSelection = (event) => {
|
|
50
|
+
if (!context) return;
|
|
51
|
+
const { selectionStart, selectionEnd } = event.currentTarget;
|
|
52
|
+
context.rememberSelection({
|
|
53
|
+
start: selectionStart,
|
|
54
|
+
end: selectionEnd
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const handleKeyDown = (event) => {
|
|
58
|
+
const el = event.currentTarget;
|
|
59
|
+
if (event.key === "Escape" || (event.metaKey || event.ctrlKey) && event.shiftKey && event.key.toLowerCase() === "m") {
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
el.blur();
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (event.key === "Tab" && !event.shiftKey) {
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
const { selectionStart, selectionEnd } = el;
|
|
67
|
+
const next = value.slice(selectionStart, selectionEnd).includes("\n") ? require_applyAction.applyAction(INDENT_ACTION, {
|
|
68
|
+
value,
|
|
69
|
+
selectionStart,
|
|
70
|
+
selectionEnd
|
|
71
|
+
}) : {
|
|
72
|
+
value: value.slice(0, selectionStart) + " " + value.slice(selectionEnd),
|
|
73
|
+
selectionStart: selectionStart + 1,
|
|
74
|
+
selectionEnd: selectionStart + 1
|
|
75
|
+
};
|
|
76
|
+
queueSelection({
|
|
77
|
+
start: next.selectionStart,
|
|
78
|
+
end: next.selectionEnd
|
|
79
|
+
});
|
|
80
|
+
onChange(next.value);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
(0, react.useLayoutEffect)(() => {
|
|
84
|
+
const selection = takeQueuedSelection();
|
|
85
|
+
if (!selection) return;
|
|
86
|
+
const textarea = paneRef.current.querySelector("textarea");
|
|
87
|
+
textarea.focus();
|
|
88
|
+
textarea.setSelectionRange(selection.start, selection.end);
|
|
89
|
+
});
|
|
90
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(EditorRoot, {
|
|
91
|
+
ref: paneRef,
|
|
92
|
+
flexDirection: "column",
|
|
93
|
+
flex: 1,
|
|
94
|
+
minWidth: 0,
|
|
95
|
+
gap: 1,
|
|
96
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_TextInput.TextInput, {
|
|
97
|
+
multiline: true,
|
|
98
|
+
resize: true,
|
|
99
|
+
fullWidth: true,
|
|
100
|
+
variant,
|
|
101
|
+
color,
|
|
102
|
+
textColor,
|
|
103
|
+
size,
|
|
104
|
+
name,
|
|
105
|
+
id,
|
|
106
|
+
error,
|
|
107
|
+
required,
|
|
108
|
+
disabled,
|
|
109
|
+
minRows,
|
|
110
|
+
value,
|
|
111
|
+
placeholder,
|
|
112
|
+
onChange: (event) => onChange(event.target.value),
|
|
113
|
+
inputProps: {
|
|
114
|
+
"aria-label": "Markdown source",
|
|
115
|
+
"aria-describedby": showShortcutHint ? hintId : void 0,
|
|
116
|
+
onSelect: rememberSelection,
|
|
117
|
+
onBlur: rememberSelection,
|
|
118
|
+
onKeyDown: handleKeyDown
|
|
119
|
+
}
|
|
120
|
+
}), showShortcutHint && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.Typography, {
|
|
121
|
+
id: hintId,
|
|
122
|
+
variant: "caption",
|
|
123
|
+
color: "secondary",
|
|
124
|
+
m: 0,
|
|
125
|
+
children: "Tab inserts a tab · press Escape or Ctrl/Cmd+Shift+M to move focus out."
|
|
126
|
+
})]
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
//#endregion
|
|
130
|
+
exports.Editor = Editor;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { a as TextInputSize, o as TextInputTextColor, r as TextInputColor, s as TextInputVariant } from "../index-C5_ciaeo.cjs";
|
|
2
|
+
//#region src/Markdown/Editor/Editor.d.ts
|
|
3
|
+
interface EditorProps {
|
|
4
|
+
/** Standalone source value — used when rendered outside a `Control`. Ignored inside one. */
|
|
5
|
+
value?: string;
|
|
6
|
+
/** Standalone change handler — used when rendered outside a `Control`. Ignored inside one. */
|
|
7
|
+
onChange?: (value: string) => void;
|
|
8
|
+
/** Placeholder shown while the source is empty. */
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
/** Minimum visible rows of the source textarea. Default: `16`. */
|
|
11
|
+
minRows?: number;
|
|
12
|
+
/** Visual style of the source input — forwarded to `TextInput`. Default: `'default'`. */
|
|
13
|
+
variant?: TextInputVariant;
|
|
14
|
+
/** Focus/active border colour — forwarded to `TextInput`. */
|
|
15
|
+
color?: TextInputColor;
|
|
16
|
+
/** Text colour of the typed source — forwarded to `TextInput`. Default: `'initial'`. */
|
|
17
|
+
textColor?: TextInputTextColor;
|
|
18
|
+
/** Padding/font-size density — forwarded to `TextInput`. */
|
|
19
|
+
size?: TextInputSize;
|
|
20
|
+
/** Native `name` on the textarea — set it for native `<form>` submission / FormData. */
|
|
21
|
+
name?: string;
|
|
22
|
+
/** `id` for label association. Falls back to the enclosing `FormControl`. */
|
|
23
|
+
id?: string;
|
|
24
|
+
/** Marks the field invalid (error border). Falls back to the enclosing `FormControl`. */
|
|
25
|
+
error?: boolean;
|
|
26
|
+
/** Marks the field required. Falls back to the enclosing `FormControl`. */
|
|
27
|
+
required?: boolean;
|
|
28
|
+
/** Disables editing. Falls back to the enclosing `FormControl`. */
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/** Shows a one-line hint about the Tab / focus-release shortcuts under the field. Default: `true`. */
|
|
31
|
+
showShortcutHint?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The source `<textarea>`, with selection tracking and Tab-to-indent. Inside a `Control` it is
|
|
35
|
+
* driven by context (so the `Toolbar` can act on it); on its own it is a plain controlled field
|
|
36
|
+
* via `value`/`onChange`.
|
|
37
|
+
*/
|
|
38
|
+
declare function Editor({ value: valueProp, onChange: onChangeProp, placeholder, minRows, variant, color, textColor: textColorProp, size, name, id, error, required, disabled, showShortcutHint }: Readonly<EditorProps>): import("react").JSX.Element;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { Editor, EditorProps };
|