@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,100 @@
|
|
|
1
|
+
import { d as styled } from "./src-DcNT2aIK.mjs";
|
|
2
|
+
import { useCopyToClipboard } from "./hooks/useCopyToClipboard.mjs";
|
|
3
|
+
import { View } from "./View.mjs";
|
|
4
|
+
import { Button } from "./Button.mjs";
|
|
5
|
+
import { t as Icon } from "./Icon-CAKRmFz3.mjs";
|
|
6
|
+
import { useRef } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/CodeBlock/CodeBlock.tsx
|
|
9
|
+
const syntaxStyles = ({ theme }) => ({
|
|
10
|
+
color: theme.syntax.base,
|
|
11
|
+
fontFamily: theme.fonts.mono,
|
|
12
|
+
"& .hljs-comment, & .hljs-quote, & .hljs-doctag, & .hljs-meta.prompt_": {
|
|
13
|
+
color: theme.syntax.comment,
|
|
14
|
+
fontStyle: "italic"
|
|
15
|
+
},
|
|
16
|
+
"& .hljs-keyword, & .hljs-built_in, & .hljs-literal, & .hljs-selector-tag, & .hljs-selector-pseudo, & .hljs-selector-attr": { color: theme.syntax.keyword },
|
|
17
|
+
"& .hljs-type, & .hljs-title.class_": { color: theme.syntax.type },
|
|
18
|
+
"& .hljs-string, & .hljs-regexp, & .hljs-char, & .hljs-meta .hljs-string, & .hljs-addition": { color: theme.syntax.string },
|
|
19
|
+
"& .hljs-number, & .hljs-symbol, & .hljs-bullet, & .hljs-link": { color: theme.syntax.number },
|
|
20
|
+
"& .hljs-variable.constant_, & .hljs-property": { color: theme.syntax.constant },
|
|
21
|
+
"& .hljs-title, & .hljs-section, & .hljs-attr, & .hljs-attribute, & .hljs-selector-id": { color: theme.syntax.title },
|
|
22
|
+
"& .hljs-tag, & .hljs-name, & .hljs-meta, & .hljs-variable, & .hljs-selector-class, & .hljs-deletion": { color: theme.syntax.tag },
|
|
23
|
+
"& .hljs-emphasis": { fontStyle: "italic" },
|
|
24
|
+
"& .hljs-strong": { fontWeight: "bold" }
|
|
25
|
+
});
|
|
26
|
+
const CodeSurface = styled(View, {
|
|
27
|
+
name: "CodeBlock",
|
|
28
|
+
slot: "surface",
|
|
29
|
+
label: "CodeSurface"
|
|
30
|
+
})(syntaxStyles);
|
|
31
|
+
const Wrapper = styled(View, {
|
|
32
|
+
name: "CodeBlock",
|
|
33
|
+
label: "CodeBlock"
|
|
34
|
+
})({
|
|
35
|
+
display: "grid",
|
|
36
|
+
gridTemplateColumns: "minmax(0, 1fr)",
|
|
37
|
+
"& .code-copy": {
|
|
38
|
+
opacity: 0,
|
|
39
|
+
transition: "opacity 120ms ease"
|
|
40
|
+
},
|
|
41
|
+
"&:hover .code-copy, &:focus-within .code-copy": { opacity: 1 },
|
|
42
|
+
"@media (hover: none)": { "& .code-copy": { opacity: 1 } }
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* Fenced-code block: a horizontally scrollable, syntax-highlighted surface with a
|
|
46
|
+
* copy-to-clipboard button that sticks to the top-right while the block is in view.
|
|
47
|
+
*/
|
|
48
|
+
function CodeBlock({ children, ...rest }) {
|
|
49
|
+
const surfaceRef = useRef(null);
|
|
50
|
+
const { copied, copy } = useCopyToClipboard();
|
|
51
|
+
const handleCopy = () => {
|
|
52
|
+
const raw = surfaceRef.current.textContent;
|
|
53
|
+
let end = raw.length;
|
|
54
|
+
while (end > 0 && raw[end - 1] === "\n") end--;
|
|
55
|
+
const text = raw.slice(0, end);
|
|
56
|
+
if (text) copy(text);
|
|
57
|
+
};
|
|
58
|
+
return /* @__PURE__ */ jsxs(Wrapper, {
|
|
59
|
+
my: 2,
|
|
60
|
+
position: "relative",
|
|
61
|
+
...rest,
|
|
62
|
+
children: [/* @__PURE__ */ jsx(View, {
|
|
63
|
+
position: "absolute",
|
|
64
|
+
top: "8px",
|
|
65
|
+
right: "8px",
|
|
66
|
+
zIndex: 1,
|
|
67
|
+
bg: "paper",
|
|
68
|
+
borderRadius: "sm",
|
|
69
|
+
className: "code-copy",
|
|
70
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
71
|
+
type: "button",
|
|
72
|
+
variant: "outlined",
|
|
73
|
+
color: "default",
|
|
74
|
+
size: "sm",
|
|
75
|
+
borderRadius: "sm",
|
|
76
|
+
onClick: handleCopy,
|
|
77
|
+
"aria-label": copied ? "Copied" : "Copy code",
|
|
78
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
79
|
+
name: copied ? "check" : "content_copy",
|
|
80
|
+
color: copied ? "success" : "primary",
|
|
81
|
+
size: "1.1rem"
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
}), /* @__PURE__ */ jsx(CodeSurface, {
|
|
85
|
+
as: "pre",
|
|
86
|
+
tabIndex: 0,
|
|
87
|
+
ref: surfaceRef,
|
|
88
|
+
bg: "terminal",
|
|
89
|
+
p: 3,
|
|
90
|
+
borderRadius: "md",
|
|
91
|
+
borderColor: "light",
|
|
92
|
+
borderWidth: "thin",
|
|
93
|
+
maxWidth: "100%",
|
|
94
|
+
overflow: "auto",
|
|
95
|
+
children
|
|
96
|
+
})]
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
export { CodeBlock };
|
package/dist/Drawer.cjs
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_src = require("./src-BiocWFSR.cjs");
|
|
3
|
+
const require_Paper = require("./Paper.cjs");
|
|
4
|
+
const require_Modal = require("./Modal-BDMPTSXv.cjs");
|
|
5
|
+
require("react");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let _emotion_react = require("@emotion/react");
|
|
8
|
+
let _soroush_tech_styled_system_should_forward_prop = require("@soroush.tech/styled-system/should-forward-prop");
|
|
9
|
+
//#region src/Drawer/Drawer.tsx
|
|
10
|
+
const slideIn = {
|
|
11
|
+
left: _emotion_react.keyframes`from { transform: translateX(-100%); } to { transform: translateX(0); }`,
|
|
12
|
+
right: _emotion_react.keyframes`from { transform: translateX(100%); } to { transform: translateX(0); }`,
|
|
13
|
+
top: _emotion_react.keyframes`from { transform: translateY(-100%); } to { transform: translateY(0); }`,
|
|
14
|
+
bottom: _emotion_react.keyframes`from { transform: translateY(100%); } to { transform: translateY(0); }`
|
|
15
|
+
};
|
|
16
|
+
const anchorPosition = {
|
|
17
|
+
left: {
|
|
18
|
+
top: 0,
|
|
19
|
+
left: 0,
|
|
20
|
+
bottom: 0,
|
|
21
|
+
height: "100%"
|
|
22
|
+
},
|
|
23
|
+
right: {
|
|
24
|
+
top: 0,
|
|
25
|
+
right: 0,
|
|
26
|
+
bottom: 0,
|
|
27
|
+
height: "100%"
|
|
28
|
+
},
|
|
29
|
+
top: {
|
|
30
|
+
top: 0,
|
|
31
|
+
left: 0,
|
|
32
|
+
right: 0,
|
|
33
|
+
width: "100%"
|
|
34
|
+
},
|
|
35
|
+
bottom: {
|
|
36
|
+
bottom: 0,
|
|
37
|
+
left: 0,
|
|
38
|
+
right: 0,
|
|
39
|
+
width: "100%"
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const DrawerPanel = require_src.styled(require_Paper.Paper, {
|
|
43
|
+
name: "Drawer",
|
|
44
|
+
label: "Drawer",
|
|
45
|
+
shouldForwardProp: (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)(["anchor", "duration"])
|
|
46
|
+
})(({ anchor, duration }) => ({
|
|
47
|
+
position: "fixed",
|
|
48
|
+
...anchorPosition[anchor],
|
|
49
|
+
animation: `${slideIn[anchor]} ${duration}ms ease-out`,
|
|
50
|
+
"@media (prefers-reduced-motion: reduce)": { animation: "none" }
|
|
51
|
+
}));
|
|
52
|
+
/**
|
|
53
|
+
* @description A panel that slides in from a screen edge, built on Modal. Portals,
|
|
54
|
+
* dims the page, traps focus, locks scroll, and closes on Escape or backdrop click.
|
|
55
|
+
*/
|
|
56
|
+
function Drawer({ children, anchor = "left", elevation = 16, transitionDuration = 225, ...modalProps }) {
|
|
57
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Modal.Modal, {
|
|
58
|
+
...modalProps,
|
|
59
|
+
layer: "drawer",
|
|
60
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DrawerPanel, {
|
|
61
|
+
anchor,
|
|
62
|
+
duration: transitionDuration,
|
|
63
|
+
elevation,
|
|
64
|
+
children
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
exports.Drawer = Drawer;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { n as PaperElevation } from "./index-x80UG39F.cjs";
|
|
2
|
+
import { o as ModalProps } from "./index-BX5-NfbX.cjs";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
//#region src/Drawer/Drawer.d.ts
|
|
5
|
+
type DrawerAnchor = 'left' | 'right' | 'top' | 'bottom';
|
|
6
|
+
interface DrawerProps extends Pick<ModalProps, 'isOpen' | 'onClose' | 'hasBackdrop' | 'shouldKeepMounted' | 'shouldUsePortal' | 'portalContainer' | 'shouldLockScroll' | 'shouldAutoFocus' | 'shouldTrapFocus' | 'shouldRestoreFocus'> {
|
|
7
|
+
/** The content of the drawer. */
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/** Edge the drawer slides in from. Default: 'left'. */
|
|
10
|
+
anchor?: DrawerAnchor;
|
|
11
|
+
/** Shadow depth of the panel (0–24), forwarded to Paper. Default: 16. */
|
|
12
|
+
elevation?: PaperElevation;
|
|
13
|
+
/** Slide duration in milliseconds. Default: 225. */
|
|
14
|
+
transitionDuration?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @description A panel that slides in from a screen edge, built on Modal. Portals,
|
|
18
|
+
* dims the page, traps focus, locks scroll, and closes on Escape or backdrop click.
|
|
19
|
+
*/
|
|
20
|
+
declare function Drawer({ children, anchor, elevation, transitionDuration, ...modalProps }: Readonly<DrawerProps>): import("react").JSX.Element;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Drawer, DrawerAnchor, DrawerProps };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { n as PaperElevation } from "./index-BLRMuO_x.mjs";
|
|
2
|
+
import { o as ModalProps } from "./index-Dy03o__A.mjs";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
//#region src/Drawer/Drawer.d.ts
|
|
5
|
+
type DrawerAnchor = 'left' | 'right' | 'top' | 'bottom';
|
|
6
|
+
interface DrawerProps extends Pick<ModalProps, 'isOpen' | 'onClose' | 'hasBackdrop' | 'shouldKeepMounted' | 'shouldUsePortal' | 'portalContainer' | 'shouldLockScroll' | 'shouldAutoFocus' | 'shouldTrapFocus' | 'shouldRestoreFocus'> {
|
|
7
|
+
/** The content of the drawer. */
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/** Edge the drawer slides in from. Default: 'left'. */
|
|
10
|
+
anchor?: DrawerAnchor;
|
|
11
|
+
/** Shadow depth of the panel (0–24), forwarded to Paper. Default: 16. */
|
|
12
|
+
elevation?: PaperElevation;
|
|
13
|
+
/** Slide duration in milliseconds. Default: 225. */
|
|
14
|
+
transitionDuration?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @description A panel that slides in from a screen edge, built on Modal. Portals,
|
|
18
|
+
* dims the page, traps focus, locks scroll, and closes on Escape or backdrop click.
|
|
19
|
+
*/
|
|
20
|
+
declare function Drawer({ children, anchor, elevation, transitionDuration, ...modalProps }: Readonly<DrawerProps>): import("react").JSX.Element;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Drawer, DrawerAnchor, DrawerProps };
|
package/dist/Drawer.mjs
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { a as createShouldForwardProp, d as styled, s as keyframes } from "./src-DcNT2aIK.mjs";
|
|
2
|
+
import { Paper } from "./Paper.mjs";
|
|
3
|
+
import { t as Modal } from "./Modal-DR60peRg.mjs";
|
|
4
|
+
import "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/Drawer/Drawer.tsx
|
|
7
|
+
const slideIn = {
|
|
8
|
+
left: keyframes`from { transform: translateX(-100%); } to { transform: translateX(0); }`,
|
|
9
|
+
right: keyframes`from { transform: translateX(100%); } to { transform: translateX(0); }`,
|
|
10
|
+
top: keyframes`from { transform: translateY(-100%); } to { transform: translateY(0); }`,
|
|
11
|
+
bottom: keyframes`from { transform: translateY(100%); } to { transform: translateY(0); }`
|
|
12
|
+
};
|
|
13
|
+
const anchorPosition = {
|
|
14
|
+
left: {
|
|
15
|
+
top: 0,
|
|
16
|
+
left: 0,
|
|
17
|
+
bottom: 0,
|
|
18
|
+
height: "100%"
|
|
19
|
+
},
|
|
20
|
+
right: {
|
|
21
|
+
top: 0,
|
|
22
|
+
right: 0,
|
|
23
|
+
bottom: 0,
|
|
24
|
+
height: "100%"
|
|
25
|
+
},
|
|
26
|
+
top: {
|
|
27
|
+
top: 0,
|
|
28
|
+
left: 0,
|
|
29
|
+
right: 0,
|
|
30
|
+
width: "100%"
|
|
31
|
+
},
|
|
32
|
+
bottom: {
|
|
33
|
+
bottom: 0,
|
|
34
|
+
left: 0,
|
|
35
|
+
right: 0,
|
|
36
|
+
width: "100%"
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const DrawerPanel = styled(Paper, {
|
|
40
|
+
name: "Drawer",
|
|
41
|
+
label: "Drawer",
|
|
42
|
+
shouldForwardProp: createShouldForwardProp(["anchor", "duration"])
|
|
43
|
+
})(({ anchor, duration }) => ({
|
|
44
|
+
position: "fixed",
|
|
45
|
+
...anchorPosition[anchor],
|
|
46
|
+
animation: `${slideIn[anchor]} ${duration}ms ease-out`,
|
|
47
|
+
"@media (prefers-reduced-motion: reduce)": { animation: "none" }
|
|
48
|
+
}));
|
|
49
|
+
/**
|
|
50
|
+
* @description A panel that slides in from a screen edge, built on Modal. Portals,
|
|
51
|
+
* dims the page, traps focus, locks scroll, and closes on Escape or backdrop click.
|
|
52
|
+
*/
|
|
53
|
+
function Drawer({ children, anchor = "left", elevation = 16, transitionDuration = 225, ...modalProps }) {
|
|
54
|
+
return /* @__PURE__ */ jsx(Modal, {
|
|
55
|
+
...modalProps,
|
|
56
|
+
layer: "drawer",
|
|
57
|
+
children: /* @__PURE__ */ jsx(DrawerPanel, {
|
|
58
|
+
anchor,
|
|
59
|
+
duration: transitionDuration,
|
|
60
|
+
elevation,
|
|
61
|
+
children
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
export { Drawer };
|
package/dist/Field.cjs
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_Flex = require("./Flex.cjs");
|
|
3
|
+
const require_FormControl = require("./FormControl.cjs");
|
|
4
|
+
const require_FormLabel = require("./FormLabel.cjs");
|
|
5
|
+
const require_FormHelperText = require("./FormHelperText.cjs");
|
|
6
|
+
require("@emotion/react");
|
|
7
|
+
let react = require("react");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
require("@tanstack/react-form");
|
|
10
|
+
//#region src/Field/Field.tsx
|
|
11
|
+
/**
|
|
12
|
+
* The single bridge between the design-system form layer and TanStack Form.
|
|
13
|
+
* Wraps `form.Field`, derives the error-display flag, and composes
|
|
14
|
+
* FormControl / FormLabel / FormHelperText so id and aria wiring are automatic.
|
|
15
|
+
*
|
|
16
|
+
* Error UX: shown only once the field is touched or after a submit attempt — never on
|
|
17
|
+
* initial render — and only the first error message is displayed.
|
|
18
|
+
*/
|
|
19
|
+
function Field({ form, name, label, labelProps, helperText, required, size, fullWidth, children }) {
|
|
20
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(form.Field, {
|
|
21
|
+
name,
|
|
22
|
+
children: (field) => {
|
|
23
|
+
const api = field;
|
|
24
|
+
const message = api.state.meta.errors[0]?.message;
|
|
25
|
+
const hasError = (api.state.meta.isTouched || form.state.isSubmitted) && Boolean(message);
|
|
26
|
+
const helper = hasError ? message : helperText;
|
|
27
|
+
const child = children;
|
|
28
|
+
const control = (0, react.cloneElement)(child, {
|
|
29
|
+
name: api.name,
|
|
30
|
+
value: api.state.value,
|
|
31
|
+
onChange: (event) => api.handleChange(event.target.value),
|
|
32
|
+
inputProps: {
|
|
33
|
+
...child.props.inputProps,
|
|
34
|
+
onBlur: api.handleBlur
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FormControl.FormControl, {
|
|
38
|
+
error: hasError,
|
|
39
|
+
required,
|
|
40
|
+
size,
|
|
41
|
+
fullWidth,
|
|
42
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Flex.Flex, {
|
|
43
|
+
flexDirection: "column",
|
|
44
|
+
gap: 2,
|
|
45
|
+
children: [
|
|
46
|
+
label == null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FormLabel.FormLabel, {
|
|
47
|
+
...labelProps,
|
|
48
|
+
children: label
|
|
49
|
+
}),
|
|
50
|
+
control,
|
|
51
|
+
helper == null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FormHelperText.FormHelperText, { children: helper })
|
|
52
|
+
]
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
exports.Field = Field;
|
package/dist/Field.d.cts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { n as FormLabelProps } from "./index-Dg8-CPOO.cjs";
|
|
2
|
+
import { Theme } from "@emotion/react";
|
|
3
|
+
import { ReactElement, ReactNode } from "react";
|
|
4
|
+
import { DeepKeys, FormAsyncValidateOrFn, FormValidateOrFn, ReactFormExtendedApi } from "@tanstack/react-form";
|
|
5
|
+
//#region src/Field/Field.d.ts
|
|
6
|
+
interface FieldProps<TFormData, TOnMount extends undefined | FormValidateOrFn<TFormData>, TOnChange extends undefined | FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>, TSubmitMeta, TName extends DeepKeys<TFormData> = DeepKeys<TFormData>> {
|
|
7
|
+
form: ReactFormExtendedApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>;
|
|
8
|
+
/** Type-safe field name — checked against the form's value schema. */
|
|
9
|
+
name: TName;
|
|
10
|
+
/** Optional label; rendered as a FormLabel above the control. */
|
|
11
|
+
label?: ReactNode;
|
|
12
|
+
/** Typography props forwarded to the FormLabel — restyle the label without losing the wiring. */
|
|
13
|
+
labelProps?: Omit<FormLabelProps, 'children' | 'required' | 'htmlFor'>;
|
|
14
|
+
/** Optional helper text; replaced by the error message while the field is invalid. */
|
|
15
|
+
helperText?: ReactNode;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
size?: keyof Theme['sizes'];
|
|
18
|
+
fullWidth?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The control element, e.g. `<TextInput />`. Field clones it and injects the binding
|
|
21
|
+
* from the TanStack field — `name`, `value`, `onChange`, and `inputProps.onBlur` — so the
|
|
22
|
+
* call site stays declarative and the control never imports the form library.
|
|
23
|
+
*/
|
|
24
|
+
children: ReactElement;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The single bridge between the design-system form layer and TanStack Form.
|
|
28
|
+
* Wraps `form.Field`, derives the error-display flag, and composes
|
|
29
|
+
* FormControl / FormLabel / FormHelperText so id and aria wiring are automatic.
|
|
30
|
+
*
|
|
31
|
+
* Error UX: shown only once the field is touched or after a submit attempt — never on
|
|
32
|
+
* initial render — and only the first error message is displayed.
|
|
33
|
+
*/
|
|
34
|
+
declare function Field<TFormData, TOnMount extends undefined | FormValidateOrFn<TFormData>, TOnChange extends undefined | FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>, TSubmitMeta, TName extends DeepKeys<TFormData> = DeepKeys<TFormData>>({ form, name, label, labelProps, helperText, required, size, fullWidth, children }: Readonly<FieldProps<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, TName>>): import("react").JSX.Element;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { Field, FieldProps };
|
package/dist/Field.d.mts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { n as FormLabelProps } from "./index-Cv_UOfYx.mjs";
|
|
2
|
+
import { Theme } from "@emotion/react";
|
|
3
|
+
import { ReactElement, ReactNode } from "react";
|
|
4
|
+
import { DeepKeys, FormAsyncValidateOrFn, FormValidateOrFn, ReactFormExtendedApi } from "@tanstack/react-form";
|
|
5
|
+
//#region src/Field/Field.d.ts
|
|
6
|
+
interface FieldProps<TFormData, TOnMount extends undefined | FormValidateOrFn<TFormData>, TOnChange extends undefined | FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>, TSubmitMeta, TName extends DeepKeys<TFormData> = DeepKeys<TFormData>> {
|
|
7
|
+
form: ReactFormExtendedApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>;
|
|
8
|
+
/** Type-safe field name — checked against the form's value schema. */
|
|
9
|
+
name: TName;
|
|
10
|
+
/** Optional label; rendered as a FormLabel above the control. */
|
|
11
|
+
label?: ReactNode;
|
|
12
|
+
/** Typography props forwarded to the FormLabel — restyle the label without losing the wiring. */
|
|
13
|
+
labelProps?: Omit<FormLabelProps, 'children' | 'required' | 'htmlFor'>;
|
|
14
|
+
/** Optional helper text; replaced by the error message while the field is invalid. */
|
|
15
|
+
helperText?: ReactNode;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
size?: keyof Theme['sizes'];
|
|
18
|
+
fullWidth?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The control element, e.g. `<TextInput />`. Field clones it and injects the binding
|
|
21
|
+
* from the TanStack field — `name`, `value`, `onChange`, and `inputProps.onBlur` — so the
|
|
22
|
+
* call site stays declarative and the control never imports the form library.
|
|
23
|
+
*/
|
|
24
|
+
children: ReactElement;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The single bridge between the design-system form layer and TanStack Form.
|
|
28
|
+
* Wraps `form.Field`, derives the error-display flag, and composes
|
|
29
|
+
* FormControl / FormLabel / FormHelperText so id and aria wiring are automatic.
|
|
30
|
+
*
|
|
31
|
+
* Error UX: shown only once the field is touched or after a submit attempt — never on
|
|
32
|
+
* initial render — and only the first error message is displayed.
|
|
33
|
+
*/
|
|
34
|
+
declare function Field<TFormData, TOnMount extends undefined | FormValidateOrFn<TFormData>, TOnChange extends undefined | FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>, TSubmitMeta, TName extends DeepKeys<TFormData> = DeepKeys<TFormData>>({ form, name, label, labelProps, helperText, required, size, fullWidth, children }: Readonly<FieldProps<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, TName>>): import("react").JSX.Element;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { Field, FieldProps };
|
package/dist/Field.mjs
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Flex } from "./Flex.mjs";
|
|
2
|
+
import { FormControl } from "./FormControl.mjs";
|
|
3
|
+
import { FormLabel } from "./FormLabel.mjs";
|
|
4
|
+
import { FormHelperText } from "./FormHelperText.mjs";
|
|
5
|
+
import "@emotion/react";
|
|
6
|
+
import { cloneElement } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import "@tanstack/react-form";
|
|
9
|
+
//#region src/Field/Field.tsx
|
|
10
|
+
/**
|
|
11
|
+
* The single bridge between the design-system form layer and TanStack Form.
|
|
12
|
+
* Wraps `form.Field`, derives the error-display flag, and composes
|
|
13
|
+
* FormControl / FormLabel / FormHelperText so id and aria wiring are automatic.
|
|
14
|
+
*
|
|
15
|
+
* Error UX: shown only once the field is touched or after a submit attempt — never on
|
|
16
|
+
* initial render — and only the first error message is displayed.
|
|
17
|
+
*/
|
|
18
|
+
function Field({ form, name, label, labelProps, helperText, required, size, fullWidth, children }) {
|
|
19
|
+
return /* @__PURE__ */ jsx(form.Field, {
|
|
20
|
+
name,
|
|
21
|
+
children: (field) => {
|
|
22
|
+
const api = field;
|
|
23
|
+
const message = api.state.meta.errors[0]?.message;
|
|
24
|
+
const hasError = (api.state.meta.isTouched || form.state.isSubmitted) && Boolean(message);
|
|
25
|
+
const helper = hasError ? message : helperText;
|
|
26
|
+
const child = children;
|
|
27
|
+
const control = cloneElement(child, {
|
|
28
|
+
name: api.name,
|
|
29
|
+
value: api.state.value,
|
|
30
|
+
onChange: (event) => api.handleChange(event.target.value),
|
|
31
|
+
inputProps: {
|
|
32
|
+
...child.props.inputProps,
|
|
33
|
+
onBlur: api.handleBlur
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return /* @__PURE__ */ jsx(FormControl, {
|
|
37
|
+
error: hasError,
|
|
38
|
+
required,
|
|
39
|
+
size,
|
|
40
|
+
fullWidth,
|
|
41
|
+
children: /* @__PURE__ */ jsxs(Flex, {
|
|
42
|
+
flexDirection: "column",
|
|
43
|
+
gap: 2,
|
|
44
|
+
children: [
|
|
45
|
+
label == null ? null : /* @__PURE__ */ jsx(FormLabel, {
|
|
46
|
+
...labelProps,
|
|
47
|
+
children: label
|
|
48
|
+
}),
|
|
49
|
+
control,
|
|
50
|
+
helper == null ? null : /* @__PURE__ */ jsx(FormHelperText, { children: helper })
|
|
51
|
+
]
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { Field };
|
package/dist/Flex.cjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_src = require("./src-BiocWFSR.cjs");
|
|
3
|
+
const require_View = require("./View.cjs");
|
|
4
|
+
let _soroush_tech_styled_system_should_forward_prop = require("@soroush.tech/styled-system/should-forward-prop");
|
|
5
|
+
//#region src/Flex/Flex.tsx
|
|
6
|
+
const shouldForwardProp = (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)([..._soroush_tech_styled_system_should_forward_prop.props, "gap"]);
|
|
7
|
+
const gapSystem = (0, require_src.src_exports.system)({ gap: {
|
|
8
|
+
property: "gap",
|
|
9
|
+
scale: "space"
|
|
10
|
+
} });
|
|
11
|
+
const Flex = require_src.styled(require_View.View, {
|
|
12
|
+
name: "Flex",
|
|
13
|
+
label: "flex",
|
|
14
|
+
shouldForwardProp,
|
|
15
|
+
systemProps: [require_src.src_exports.flexbox, gapSystem]
|
|
16
|
+
})({
|
|
17
|
+
display: "flex",
|
|
18
|
+
flexDirection: "column"
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.Flex = Flex;
|
package/dist/Flex.d.cts
ADDED
package/dist/Flex.d.mts
ADDED
package/dist/Flex.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { a as createShouldForwardProp, c as props, d as styled, l as src_exports } from "./src-DcNT2aIK.mjs";
|
|
2
|
+
import { View } from "./View.mjs";
|
|
3
|
+
//#region src/Flex/Flex.tsx
|
|
4
|
+
const shouldForwardProp = createShouldForwardProp([...props, "gap"]);
|
|
5
|
+
const gapSystem = (0, src_exports.system)({ gap: {
|
|
6
|
+
property: "gap",
|
|
7
|
+
scale: "space"
|
|
8
|
+
} });
|
|
9
|
+
const Flex = styled(View, {
|
|
10
|
+
name: "Flex",
|
|
11
|
+
label: "flex",
|
|
12
|
+
shouldForwardProp,
|
|
13
|
+
systemProps: [src_exports.flexbox, gapSystem]
|
|
14
|
+
})({
|
|
15
|
+
display: "flex",
|
|
16
|
+
flexDirection: "column"
|
|
17
|
+
});
|
|
18
|
+
//#endregion
|
|
19
|
+
export { Flex };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_src = require("./src-BiocWFSR.cjs");
|
|
3
|
+
let react = require("react");
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
//#region src/FocusTrap/FocusTrap.tsx
|
|
6
|
+
const FocusTrapRoot = require_src.styled("div", {
|
|
7
|
+
name: "FocusTrap",
|
|
8
|
+
label: "FocusTrap"
|
|
9
|
+
})({ outline: "none" });
|
|
10
|
+
const FOCUSABLE_SELECTOR = [
|
|
11
|
+
"a[href]",
|
|
12
|
+
"button:not([disabled])",
|
|
13
|
+
"textarea:not([disabled])",
|
|
14
|
+
"input:not([disabled])",
|
|
15
|
+
"select:not([disabled])",
|
|
16
|
+
"[tabindex]:not([tabindex=\"-1\"])"
|
|
17
|
+
].join(",");
|
|
18
|
+
function getFocusable(node) {
|
|
19
|
+
return Array.from(node.querySelectorAll(FOCUSABLE_SELECTOR)).filter((element) => element.tabIndex >= 0);
|
|
20
|
+
}
|
|
21
|
+
/** Move focus to the first focusable descendant, or the node itself when there is none. */
|
|
22
|
+
function focusFirst(node) {
|
|
23
|
+
const [first] = getFocusable(node);
|
|
24
|
+
(first ?? node).focus();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @description Keeps keyboard focus within its children while active. Moves focus
|
|
28
|
+
* in on activation, cycles Tab / Shift+Tab at the boundaries, pulls focus back when
|
|
29
|
+
* it escapes, and restores focus to the previously focused element on deactivation.
|
|
30
|
+
*/
|
|
31
|
+
function FocusTrap({ children, isEnabled = true, shouldAutoFocus = true, shouldTrapFocus = true, shouldEnforceFocus = true, shouldRestoreFocus = true }) {
|
|
32
|
+
const rootRef = (0, react.useRef)(null);
|
|
33
|
+
const previouslyFocused = (0, react.useRef)(null);
|
|
34
|
+
(0, react.useEffect)(() => {
|
|
35
|
+
if (!isEnabled) return;
|
|
36
|
+
const node = rootRef.current;
|
|
37
|
+
const doc = node.ownerDocument;
|
|
38
|
+
previouslyFocused.current = doc.activeElement;
|
|
39
|
+
if (shouldAutoFocus) focusFirst(node);
|
|
40
|
+
const handleFocusIn = (event) => {
|
|
41
|
+
if (!node.contains(event.target)) focusFirst(node);
|
|
42
|
+
};
|
|
43
|
+
if (shouldEnforceFocus) doc.addEventListener("focusin", handleFocusIn);
|
|
44
|
+
const handleKeyDown = (event) => {
|
|
45
|
+
if (!shouldTrapFocus || event.key !== "Tab") return;
|
|
46
|
+
const focusable = getFocusable(node);
|
|
47
|
+
if (focusable.length === 0) {
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const first = focusable[0];
|
|
52
|
+
const last = focusable.at(-1);
|
|
53
|
+
const active = doc.activeElement;
|
|
54
|
+
if (event.shiftKey && active === first) {
|
|
55
|
+
event.preventDefault();
|
|
56
|
+
last.focus();
|
|
57
|
+
} else if (!event.shiftKey && active === last) {
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
first.focus();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
node.addEventListener("keydown", handleKeyDown);
|
|
63
|
+
return () => {
|
|
64
|
+
doc.removeEventListener("focusin", handleFocusIn);
|
|
65
|
+
node.removeEventListener("keydown", handleKeyDown);
|
|
66
|
+
if (shouldRestoreFocus) previouslyFocused.current.focus();
|
|
67
|
+
};
|
|
68
|
+
}, [
|
|
69
|
+
isEnabled,
|
|
70
|
+
shouldAutoFocus,
|
|
71
|
+
shouldEnforceFocus,
|
|
72
|
+
shouldRestoreFocus,
|
|
73
|
+
shouldTrapFocus
|
|
74
|
+
]);
|
|
75
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FocusTrapRoot, {
|
|
76
|
+
ref: rootRef,
|
|
77
|
+
tabIndex: -1,
|
|
78
|
+
children
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
exports.FocusTrap = FocusTrap;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/FocusTrap/FocusTrap.d.ts
|
|
3
|
+
interface FocusTrapProps {
|
|
4
|
+
/** The content whose focusable descendants are trapped. */
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
/** When false, focus is neither moved nor trapped (e.g. a non-top modal). */
|
|
7
|
+
isEnabled?: boolean;
|
|
8
|
+
/** Move focus into the trap when it activates. */
|
|
9
|
+
shouldAutoFocus?: boolean;
|
|
10
|
+
/** Keep Tab / Shift+Tab cycling within the trap. */
|
|
11
|
+
shouldTrapFocus?: boolean;
|
|
12
|
+
/** Pull focus back inside whenever it escapes the trap (e.g. a click outside). */
|
|
13
|
+
shouldEnforceFocus?: boolean;
|
|
14
|
+
/** Restore focus to the previously focused element when the trap deactivates. */
|
|
15
|
+
shouldRestoreFocus?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @description Keeps keyboard focus within its children while active. Moves focus
|
|
19
|
+
* in on activation, cycles Tab / Shift+Tab at the boundaries, pulls focus back when
|
|
20
|
+
* it escapes, and restores focus to the previously focused element on deactivation.
|
|
21
|
+
*/
|
|
22
|
+
declare function FocusTrap({ children, isEnabled, shouldAutoFocus, shouldTrapFocus, shouldEnforceFocus, shouldRestoreFocus }: Readonly<FocusTrapProps>): import("react").JSX.Element;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { FocusTrap, FocusTrapProps };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/FocusTrap/FocusTrap.d.ts
|
|
3
|
+
interface FocusTrapProps {
|
|
4
|
+
/** The content whose focusable descendants are trapped. */
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
/** When false, focus is neither moved nor trapped (e.g. a non-top modal). */
|
|
7
|
+
isEnabled?: boolean;
|
|
8
|
+
/** Move focus into the trap when it activates. */
|
|
9
|
+
shouldAutoFocus?: boolean;
|
|
10
|
+
/** Keep Tab / Shift+Tab cycling within the trap. */
|
|
11
|
+
shouldTrapFocus?: boolean;
|
|
12
|
+
/** Pull focus back inside whenever it escapes the trap (e.g. a click outside). */
|
|
13
|
+
shouldEnforceFocus?: boolean;
|
|
14
|
+
/** Restore focus to the previously focused element when the trap deactivates. */
|
|
15
|
+
shouldRestoreFocus?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @description Keeps keyboard focus within its children while active. Moves focus
|
|
19
|
+
* in on activation, cycles Tab / Shift+Tab at the boundaries, pulls focus back when
|
|
20
|
+
* it escapes, and restores focus to the previously focused element on deactivation.
|
|
21
|
+
*/
|
|
22
|
+
declare function FocusTrap({ children, isEnabled, shouldAutoFocus, shouldTrapFocus, shouldEnforceFocus, shouldRestoreFocus }: Readonly<FocusTrapProps>): import("react").JSX.Element;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { FocusTrap, FocusTrapProps };
|