@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Masoud Soroush <https://soroush.tech>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
# @soroush.tech/design-system
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@soroush.tech/design-system)
|
|
4
|
+
[](https://www.npmjs.com/package/@soroush.tech/design-system)
|
|
5
|
+
[](https://app.codecov.io/gh/soroush-tech/core?flags%5B0%5D=design-system)
|
|
6
|
+
[](https://www.npmjs.com/package/@soroush.tech/design-system)
|
|
7
|
+
[](https://www.npmjs.com/package/@soroush.tech/design-system)
|
|
8
|
+
[](./LICENSE)
|
|
9
|
+
|
|
10
|
+
An Emotion + [@soroush.tech/styled-system](https://www.npmjs.com/package/@soroush.tech/styled-system) React component library with a token-driven, consumer-extensible theme — layout primitives, forms, overlays, data display, and a headless markdown editor/renderer.
|
|
11
|
+
|
|
12
|
+
The library takes inspiration from [Material UI](https://mui.com/) — its component vocabulary and prop conventions will feel familiar — but it is written entirely in house. It is not a clone or a fork: every component is built from scratch on our own engine and token system, and the API is free to diverge wherever it serves its consumers better.
|
|
13
|
+
|
|
14
|
+
For the conventions every component must follow (prop typing, `system()` wiring, `shouldForwardProp`, Storybook rules, testing), read **[`design-system.md`](./design-system.md)** — this README is the map, that file is the law.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npm i @soroush.tech/design-system
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`react`, `react-dom`, `@emotion/react`, and `@emotion/styled` are peer dependencies.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Importing
|
|
27
|
+
|
|
28
|
+
Import components by subpath, styling primitives from the barrel:
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { Typography } from '@soroush.tech/design-system/Typography'
|
|
32
|
+
import { Flex } from '@soroush.tech/design-system/Flex'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Styling primitives (the engine) come from the barrel `@soroush.tech/design-system` — `styled`, `css`, `keyframes`, `useTheme`, the `Theme` type, styled-system functions, and `createShouldForwardProp`. The barrel (`src/index.ts`) is the engine abstraction layer: to swap the CSS-in-JS engine, only that file changes.
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { styled, css, useTheme, type Theme } from '@soroush.tech/design-system'
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Folder map
|
|
44
|
+
|
|
45
|
+
| Path | What it is |
|
|
46
|
+
| ------------------ | -------------------------------------------------------------------------------------------------------------------------- |
|
|
47
|
+
| `index.ts` | Engine barrel — the themed `styled`, Emotion + `@soroush.tech/styled-system` re-exports |
|
|
48
|
+
| `styled.ts` | The themed `styled` wrapper — `name`/`slot` options enable `theme.components` customization |
|
|
49
|
+
| `themes.ts` | `baseTheme` (the complete default theme — the only place hex values live), the `Theme` type layer, `createTheme` |
|
|
50
|
+
| `hooks/` | `useTheme`, `useDefaultProps`, `useStyle`, `useCopyToClipboard`, `withTheme`, `withStyles`, `StylesConsumer` |
|
|
51
|
+
| `utils/` | Style helpers — `alpha`, `spacing`, `clamp`, `luminance`, `generateBoxShadow`, `styleCache`, `createTheme`, `themeDefault` |
|
|
52
|
+
| `utils/test/` | `storiesOptions.ts` (token option arrays) and `storiesArgs.ts` (pre-built argTypes) for Storybook |
|
|
53
|
+
| `docs/` | Guides — [`theming.md`](./docs/theming.md) and [`customization.md`](./docs/customization.md) |
|
|
54
|
+
| `design-system.md` | Architecture and conventions for building components |
|
|
55
|
+
| `ComponentName/` | One folder per component (see inventory below) |
|
|
56
|
+
|
|
57
|
+
Every component folder contains `index.ts` (barrel), `ComponentName.tsx`, `README.md` (prop reference), `ComponentName.stories.tsx`, and `ComponentName.test.tsx`. Each component's own README documents its full prop API.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Component inventory
|
|
62
|
+
|
|
63
|
+
### Layout & surfaces
|
|
64
|
+
|
|
65
|
+
| Component | Purpose |
|
|
66
|
+
| --------- | ------------------------------------------------- |
|
|
67
|
+
| `View` | Styled `div` primitive — the base building block |
|
|
68
|
+
| `Flex` | `View` with flexbox defaults |
|
|
69
|
+
| `Grid` | CSS grid container |
|
|
70
|
+
| `Paper` | Elevated surface with background and shadow |
|
|
71
|
+
| `Card` | Content container built on `Paper` |
|
|
72
|
+
| `Quote` | Bordered quote / terminal-panel surface on `View` |
|
|
73
|
+
| `AppBar` | Top application bar |
|
|
74
|
+
| `Drawer` | Slide-in side panel |
|
|
75
|
+
|
|
76
|
+
### Content & data display
|
|
77
|
+
|
|
78
|
+
| Component | Purpose |
|
|
79
|
+
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
80
|
+
| `Typography` | Text with variant → element mapping — the reference implementation for all components |
|
|
81
|
+
| `Link` | Anchor with theme-aware styling |
|
|
82
|
+
| `Icon` | Icon renderer |
|
|
83
|
+
| `Image` | Image with styled-system props |
|
|
84
|
+
| `Avatar` | User/entity avatar |
|
|
85
|
+
| `Table` | Compound data table — exports `TableContainer`, `TableHead`, `TableBody`, `TableFooter`, `TableRow`, `TableCell`, `TablePagination`, `TablePaginationActions`, `TableSortLabel`, and `TableControl` from `@soroush.tech/design-system/Table` |
|
|
86
|
+
| `CodeBlock` | Scrollable fenced-code surface with a copy-to-clipboard button |
|
|
87
|
+
| `Markdown` | Headless markdown editor + renderer — exports `Control`, `Toolbar`, `Editor`, and `Preview` from `@soroush.tech/design-system/Markdown` |
|
|
88
|
+
|
|
89
|
+
### Inputs & forms
|
|
90
|
+
|
|
91
|
+
| Component | Purpose |
|
|
92
|
+
| ---------------------------------------------------- | --------------------------------------------- |
|
|
93
|
+
| `Button`, `ButtonGroup`, `ToggleButton` | Actions and toggles |
|
|
94
|
+
| `TextInput` | Text field |
|
|
95
|
+
| `Checkbox`, `Radio`, `Switch` | Selection controls |
|
|
96
|
+
| `NativeSelect` | Platform `<select>` |
|
|
97
|
+
| `Select` | Custom select built on `Popover` + `MenuItem` |
|
|
98
|
+
| `MenuItem` | Option row for `Select`'s listbox |
|
|
99
|
+
| `Field` | Composed input field |
|
|
100
|
+
| `Form`, `FormControl`, `FormLabel`, `FormHelperText` | Form composition and labeling |
|
|
101
|
+
| `Pagination` | Page navigation control |
|
|
102
|
+
|
|
103
|
+
### Feedback
|
|
104
|
+
|
|
105
|
+
| Component | Purpose |
|
|
106
|
+
| ------------------------------------ | ---------------------------------------------- |
|
|
107
|
+
| `CircularProgress`, `LinearProgress` | Determinate/indeterminate progress indicators |
|
|
108
|
+
| `Skeleton` | Loading placeholder with pulse/wave animations |
|
|
109
|
+
| `Backdrop` | Dimmed overlay behind modal surfaces |
|
|
110
|
+
|
|
111
|
+
### Overlay & behavior primitives
|
|
112
|
+
|
|
113
|
+
| Component | Purpose |
|
|
114
|
+
| --------------- | ---------------------------------------------------------------- |
|
|
115
|
+
| `Portal` | Renders children into a DOM node outside the parent hierarchy |
|
|
116
|
+
| `FocusTrap` | Keeps focus inside a subtree |
|
|
117
|
+
| `Modal` | Dialog primitive composing `Portal`, `Backdrop`, and `FocusTrap` |
|
|
118
|
+
| `Popover` | Anchored floating surface built on `Modal` |
|
|
119
|
+
| `ThemeProvider` | Supplies the theme and global styles to the app |
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Theme tokens
|
|
124
|
+
|
|
125
|
+
Components never hardcode colors or sizes — props resolve against scales on the `Theme` object:
|
|
126
|
+
|
|
127
|
+
| Group | Scales |
|
|
128
|
+
| ------------------ | ----------------------------------------------------------------------------------------------------- |
|
|
129
|
+
| Color | `palette` (main/light/dark/contrastText per color) · `text` · `background` · `border` · `colorScheme` |
|
|
130
|
+
| Typography | `typography` (variant map) · `fonts` · `fontSizes` · `fontWeights` · `lineHeights` · `letterSpacings` |
|
|
131
|
+
| Space & shape | `space` · `sizes` · `radii` · `borderWidths` · `shadows` |
|
|
132
|
+
| Component scales | `avatar` (size steps) · `skeleton` (wave highlight) |
|
|
133
|
+
| Layering & effects | `zOrder` (appBar/drawer/modal) · `blur` · `logoFilter` · `portraitBlend` · `portraitOpacity` |
|
|
134
|
+
|
|
135
|
+
Prop types are derived from the interface (`keyof Theme['text']`), so adding a token to `themes.ts` propagates everywhere automatically. See [`design-system.md`](./design-system.md) for the full scale table and the palette rules.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Theming
|
|
140
|
+
|
|
141
|
+
The theme belongs to you — the package only ships defaults. This section is the overview; the full guides are [`docs/theming.md`](./docs/theming.md) and [`docs/customization.md`](./docs/customization.md).
|
|
142
|
+
|
|
143
|
+
### One theme, yours
|
|
144
|
+
|
|
145
|
+
`ThemeProvider` provides exactly one theme — the built-in dark theme when you pass nothing. Bring one theme, or as many as you like: switching between them is your state, not the provider's.
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
import { ThemeProvider } from '@soroush.tech/design-system/ThemeProvider'
|
|
149
|
+
import { baseTheme, createTheme } from '@soroush.tech/design-system/themes'
|
|
150
|
+
|
|
151
|
+
// Zero-config: the built-in `baseTheme`.
|
|
152
|
+
<ThemeProvider>{app}</ThemeProvider>
|
|
153
|
+
|
|
154
|
+
// Your theme — written from scratch or extended from the base.
|
|
155
|
+
const brand = createTheme(baseTheme, { palette: { primary: { main: '#00ff88' } } })
|
|
156
|
+
<ThemeProvider theme={brand}>{app}</ThemeProvider>
|
|
157
|
+
|
|
158
|
+
// Mode switching is app policy — own the state and pass the active theme:
|
|
159
|
+
const [isDark, setIsDark] = useState(true)
|
|
160
|
+
<ThemeProvider theme={isDark ? brandDark : brandLight}>{app}</ThemeProvider>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
`createTheme(base, overrides)` (exported from `…/themes` and `…/utils`) is the merge primitive: plain objects recurse, arrays (`shadows`, `fontSizes`) and functions replace wholesale, `undefined` values are ignored — keys are added or replaced, never removed.
|
|
164
|
+
|
|
165
|
+
### Component defaults
|
|
166
|
+
|
|
167
|
+
Components carry visible literal fallbacks (`size = 'md'`, `variant = 'outside'`, …) resolved through `themeDefault(theme, key, fallback)` — so every default, including behavioral variants, is overridable via the optional `theme.defaults` map or the provider's `defaults` prop:
|
|
168
|
+
|
|
169
|
+
| Key | Fallback | Drives |
|
|
170
|
+
| -------------------------------------------- | ---------------------------------- | -------------------------------------- |
|
|
171
|
+
| `size` / `compactSize` | `'md'` / `'sm'` | sized components / dense table actions |
|
|
172
|
+
| `color` / `neutralColor` | `'primary'` / `'default'` | accent controls / toggle controls |
|
|
173
|
+
| `textColor` / `accentTextColor` | `'initial'` / `'primary'` | body text / icons + input labels |
|
|
174
|
+
| `bg` / `surfaceBg` / `inputBg` | `'default'`/`'paper'`/`'terminal'` | switch track / paper surfaces / inputs |
|
|
175
|
+
| `borderRadius` / `surfaceRadius` | `'md'` / `'sq'` | grouped controls / surfaces |
|
|
176
|
+
| `avatarSize` / `borderColor` / `borderWidth` | `'md'` / `'primary'` / `'thin'` | avatars and rings |
|
|
177
|
+
| `iconSize` | `'lg'` | Icon default glyph size (`theme.icon`) |
|
|
178
|
+
| `buttonVariant` / `switchVariant` | `'contained'` / `'outside'` | Button / Switch visual variants |
|
|
179
|
+
| `inputVariant` | `'default'` | TextInput, Select, NativeSelect frames |
|
|
180
|
+
| `avatarVariant` / `cardVariant` | `'circular'` / `'paper'` | Avatar shape / Card treatment |
|
|
181
|
+
| `linkUnderline` | `'always'` | Link underline behavior |
|
|
182
|
+
| `paginationVariant` / `paginationShape` | `'text'` / `'circular'` | Pagination items |
|
|
183
|
+
|
|
184
|
+
The built-in themes carry no `defaults` — the literals apply. A theme with entirely different size or palette keys stays valid by pointing the keys at its own tokens:
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
<ThemeProvider defaults={{ size: 'compact', color: 'brand', switchVariant: 'inside' }}>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Per-component customization (`theme.components`)
|
|
191
|
+
|
|
192
|
+
Customize one component for the whole app — default prop values, per-slot CSS, and new variant values — without wrapping or forking:
|
|
193
|
+
|
|
194
|
+
```tsx
|
|
195
|
+
const brand = createTheme(baseTheme, {
|
|
196
|
+
components: {
|
|
197
|
+
Button: {
|
|
198
|
+
// Buttons default to sm + rounded; explicit props and ButtonGroup still win.
|
|
199
|
+
defaultProps: { size: 'sm', shape: 'rounded' },
|
|
200
|
+
|
|
201
|
+
// Per-slot CSS merged after Button's own styles — the theme wins the cascade,
|
|
202
|
+
// but per-instance props (m, p, width, …) still beat the theme.
|
|
203
|
+
styleOverrides: {
|
|
204
|
+
root: ({ theme, ownerState }) => ({
|
|
205
|
+
letterSpacing: theme.letterSpacings.wide,
|
|
206
|
+
...(ownerState.variant === 'contained' && { textTransform: 'none' }),
|
|
207
|
+
}),
|
|
208
|
+
label: { fontStyle: 'italic' },
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
// A new variant value — register it first so it typechecks:
|
|
212
|
+
// declare module '@emotion/react' { interface ButtonVariants { dashed: true } }
|
|
213
|
+
variants: [
|
|
214
|
+
{
|
|
215
|
+
props: { variant: 'dashed' },
|
|
216
|
+
style: ({ theme }) => ({
|
|
217
|
+
backgroundColor: 'transparent',
|
|
218
|
+
border: `${theme.borderWidths.thin} dashed ${theme.border.primary}`,
|
|
219
|
+
}),
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
})
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Style callbacks receive `{ theme, ownerState }`, where `ownerState` is the styled root's **resolved** props (after group context, `defaultProps`, and `theme.defaults`). `defaultProps` sits in the standard precedence chain: explicit prop → group context → `defaultProps` → `theme.defaults.*` → the component's literal fallback. `variants` arrays are replaced wholesale by `createTheme`, never merged.
|
|
228
|
+
|
|
229
|
+
Your own components can join the same mechanism: create their roots with this package's `styled(tag, { name: 'MyWidget', slot: 'root' })` and register the name by augmenting `ThemeComponents`. Zero-config themes pay nothing — the resolver bails out on the first check when `theme.components` is absent.
|
|
230
|
+
|
|
231
|
+
### Extending tokens (declaration merging)
|
|
232
|
+
|
|
233
|
+
Every scale is an open interface declared on `@emotion/react`, so you can add palette colors, tokens, or whole scales — and every component prop union (`color`, `bg`, `size`, …) widens automatically:
|
|
234
|
+
|
|
235
|
+
```ts
|
|
236
|
+
import type { PaletteEntry } from '@soroush.tech/design-system/themes'
|
|
237
|
+
|
|
238
|
+
declare module '@emotion/react' {
|
|
239
|
+
interface ThemePalette {
|
|
240
|
+
brand: PaletteEntry // new palette color
|
|
241
|
+
}
|
|
242
|
+
interface ThemeBackground {
|
|
243
|
+
tertiary: string // new background token
|
|
244
|
+
}
|
|
245
|
+
interface Theme {
|
|
246
|
+
elevations: Record<'low' | 'mid' | 'high', string> // whole new scale
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Then supply the values with `createTheme` and use the new keys:
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
const brandDark = createTheme(baseTheme, {
|
|
255
|
+
palette: { brand: { main: '#00ff88', light: '#66ffb2', dark: '#00b25f', contrastText: '#000' } },
|
|
256
|
+
background: { tertiary: '#101418' },
|
|
257
|
+
elevations: { low: '0 1px 2px', mid: '0 2px 6px', high: '0 6px 18px' },
|
|
258
|
+
})
|
|
259
|
+
|
|
260
|
+
<ThemeProvider theme={brandDark}>
|
|
261
|
+
<Button color="brand" />
|
|
262
|
+
<View bg="tertiary" />
|
|
263
|
+
</ThemeProvider>
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Notes: new object-valued keys (like a `PaletteEntry`) must be supplied complete — components read `.main`/`.contrastText` at runtime; and TypeScript cannot verify at runtime that an augmented token was actually supplied, so always pair an augmentation with the matching override.
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Adding a component
|
|
271
|
+
|
|
272
|
+
Scaffold with the skill — it reads the live `Typography` files and `design-system.md` so output matches the codebase:
|
|
273
|
+
|
|
274
|
+
```
|
|
275
|
+
/new_theme_component ComponentName
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Then work through the checklist at the bottom of [`design-system.md`](./design-system.md).
|
package/dist/AppBar.cjs
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
let _soroush_tech_styled_system_should_forward_prop = require("@soroush.tech/styled-system/should-forward-prop");
|
|
7
|
+
//#region src/AppBar/AppBar.tsx
|
|
8
|
+
const shouldForwardProp = (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)([
|
|
9
|
+
..._soroush_tech_styled_system_should_forward_prop.props,
|
|
10
|
+
"elevation",
|
|
11
|
+
"size",
|
|
12
|
+
"blur"
|
|
13
|
+
]);
|
|
14
|
+
const colorSystem = (0, require_src.src_exports.system)({ color: {
|
|
15
|
+
property: "backgroundColor",
|
|
16
|
+
scale: "background"
|
|
17
|
+
} });
|
|
18
|
+
const elevationVariant = (0, require_src.src_exports.system)({ elevation: {
|
|
19
|
+
property: "boxShadow",
|
|
20
|
+
scale: "shadows"
|
|
21
|
+
} });
|
|
22
|
+
const blurSystem = ({ blur, theme }) => blur ? {
|
|
23
|
+
backdropFilter: `blur(${theme.blur})`,
|
|
24
|
+
WebkitBackdropFilter: `blur(${theme.blur})`
|
|
25
|
+
} : void 0;
|
|
26
|
+
const zOrderDefault = ({ theme }) => ({ zIndex: theme.zOrder.appBar });
|
|
27
|
+
const sizeVariants = ({ theme, size }) => {
|
|
28
|
+
const s = theme.sizes[size ?? require_themeDefault.themeDefault(theme, "size", "md")];
|
|
29
|
+
return {
|
|
30
|
+
paddingTop: theme.space[s.paddingTop],
|
|
31
|
+
paddingBottom: theme.space[s.paddingBottom],
|
|
32
|
+
paddingLeft: theme.space[s.paddingLeft],
|
|
33
|
+
paddingRight: theme.space[s.paddingRight],
|
|
34
|
+
fontSize: theme.fontSizes[s.fontSize]
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const AppBarBase = require_src.styled(require_Flex.Flex, {
|
|
38
|
+
name: "AppBar",
|
|
39
|
+
label: "AppBar",
|
|
40
|
+
shouldForwardProp,
|
|
41
|
+
systemProps: [
|
|
42
|
+
colorSystem,
|
|
43
|
+
blurSystem,
|
|
44
|
+
require_src.src_exports.border,
|
|
45
|
+
require_src.src_exports.borderTop,
|
|
46
|
+
require_src.src_exports.borderRight,
|
|
47
|
+
require_src.src_exports.borderBottom,
|
|
48
|
+
require_src.src_exports.borderLeft,
|
|
49
|
+
require_src.src_exports.borderWidth,
|
|
50
|
+
require_src.src_exports.borderStyle,
|
|
51
|
+
require_src.src_exports.borderColor,
|
|
52
|
+
require_src.src_exports.flexbox,
|
|
53
|
+
require_src.src_exports.space,
|
|
54
|
+
require_src.src_exports.layout,
|
|
55
|
+
zOrderDefault,
|
|
56
|
+
require_src.src_exports.position
|
|
57
|
+
]
|
|
58
|
+
})({
|
|
59
|
+
flexShrink: 0,
|
|
60
|
+
width: "100%"
|
|
61
|
+
}, elevationVariant, sizeVariants);
|
|
62
|
+
function AppBar({ elevation = 4, size, ...rest }) {
|
|
63
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AppBarBase, {
|
|
64
|
+
as: "header",
|
|
65
|
+
elevation,
|
|
66
|
+
size,
|
|
67
|
+
...rest
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
exports.AppBar = AppBar;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { o as Theme } from "./index-Bihpwn75.cjs";
|
|
2
|
+
import { n as FlexProps } from "./index-B1rCD6Oo.cjs";
|
|
3
|
+
//#region src/AppBar/AppBar.d.ts
|
|
4
|
+
/** Valid values for the color prop — derived from theme.background keys. */
|
|
5
|
+
type AppBarColor = keyof Theme['background'];
|
|
6
|
+
type AppBarPosition = 'absolute' | 'fixed' | 'relative' | 'static' | 'sticky';
|
|
7
|
+
/** Padding preset from theme.sizes. Default: 'md', overridable via `theme.defaults.size`. */
|
|
8
|
+
type AppBarSize = keyof Theme['sizes'];
|
|
9
|
+
interface AppBarProps extends Omit<FlexProps, 'position' | 'bg'> {
|
|
10
|
+
/** Resolves against theme.background — sets the AppBar background color. */
|
|
11
|
+
color?: AppBarColor;
|
|
12
|
+
/** CSS position value for layout placement. Default: browser default (static). */
|
|
13
|
+
position?: AppBarPosition;
|
|
14
|
+
/** Box-shadow elevation (index into theme.shadows, 0–24). Default: `4`; use `0` for no shadow. */
|
|
15
|
+
elevation?: number;
|
|
16
|
+
/** Padding preset from theme.sizes. Default: 'md', overridable via `theme.defaults.size`. */
|
|
17
|
+
size?: AppBarSize;
|
|
18
|
+
/** Applies backdrop-filter: blur(theme.blur) + webkit prefix for frosted-glass effect. */
|
|
19
|
+
blur?: boolean;
|
|
20
|
+
}
|
|
21
|
+
declare function AppBar({ elevation, size, ...rest }: Readonly<AppBarProps>): import("react").JSX.Element;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { AppBar, AppBarColor, AppBarPosition, AppBarProps, AppBarSize };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { o as Theme } from "./index-Dm9HfgV6.mjs";
|
|
2
|
+
import { n as FlexProps } from "./index-z35LEYG8.mjs";
|
|
3
|
+
//#region src/AppBar/AppBar.d.ts
|
|
4
|
+
/** Valid values for the color prop — derived from theme.background keys. */
|
|
5
|
+
type AppBarColor = keyof Theme['background'];
|
|
6
|
+
type AppBarPosition = 'absolute' | 'fixed' | 'relative' | 'static' | 'sticky';
|
|
7
|
+
/** Padding preset from theme.sizes. Default: 'md', overridable via `theme.defaults.size`. */
|
|
8
|
+
type AppBarSize = keyof Theme['sizes'];
|
|
9
|
+
interface AppBarProps extends Omit<FlexProps, 'position' | 'bg'> {
|
|
10
|
+
/** Resolves against theme.background — sets the AppBar background color. */
|
|
11
|
+
color?: AppBarColor;
|
|
12
|
+
/** CSS position value for layout placement. Default: browser default (static). */
|
|
13
|
+
position?: AppBarPosition;
|
|
14
|
+
/** Box-shadow elevation (index into theme.shadows, 0–24). Default: `4`; use `0` for no shadow. */
|
|
15
|
+
elevation?: number;
|
|
16
|
+
/** Padding preset from theme.sizes. Default: 'md', overridable via `theme.defaults.size`. */
|
|
17
|
+
size?: AppBarSize;
|
|
18
|
+
/** Applies backdrop-filter: blur(theme.blur) + webkit prefix for frosted-glass effect. */
|
|
19
|
+
blur?: boolean;
|
|
20
|
+
}
|
|
21
|
+
declare function AppBar({ elevation, size, ...rest }: Readonly<AppBarProps>): import("react").JSX.Element;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { AppBar, AppBarColor, AppBarPosition, AppBarProps, AppBarSize };
|
package/dist/AppBar.mjs
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { a as createShouldForwardProp, c as props, d as styled, l as src_exports } from "./src-DcNT2aIK.mjs";
|
|
2
|
+
import { t as themeDefault } from "./themeDefault-CjXaY3ok.mjs";
|
|
3
|
+
import { Flex } from "./Flex.mjs";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/AppBar/AppBar.tsx
|
|
6
|
+
const shouldForwardProp = createShouldForwardProp([
|
|
7
|
+
...props,
|
|
8
|
+
"elevation",
|
|
9
|
+
"size",
|
|
10
|
+
"blur"
|
|
11
|
+
]);
|
|
12
|
+
const colorSystem = (0, src_exports.system)({ color: {
|
|
13
|
+
property: "backgroundColor",
|
|
14
|
+
scale: "background"
|
|
15
|
+
} });
|
|
16
|
+
const elevationVariant = (0, src_exports.system)({ elevation: {
|
|
17
|
+
property: "boxShadow",
|
|
18
|
+
scale: "shadows"
|
|
19
|
+
} });
|
|
20
|
+
const blurSystem = ({ blur, theme }) => blur ? {
|
|
21
|
+
backdropFilter: `blur(${theme.blur})`,
|
|
22
|
+
WebkitBackdropFilter: `blur(${theme.blur})`
|
|
23
|
+
} : void 0;
|
|
24
|
+
const zOrderDefault = ({ theme }) => ({ zIndex: theme.zOrder.appBar });
|
|
25
|
+
const sizeVariants = ({ theme, size }) => {
|
|
26
|
+
const s = theme.sizes[size ?? themeDefault(theme, "size", "md")];
|
|
27
|
+
return {
|
|
28
|
+
paddingTop: theme.space[s.paddingTop],
|
|
29
|
+
paddingBottom: theme.space[s.paddingBottom],
|
|
30
|
+
paddingLeft: theme.space[s.paddingLeft],
|
|
31
|
+
paddingRight: theme.space[s.paddingRight],
|
|
32
|
+
fontSize: theme.fontSizes[s.fontSize]
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
const AppBarBase = styled(Flex, {
|
|
36
|
+
name: "AppBar",
|
|
37
|
+
label: "AppBar",
|
|
38
|
+
shouldForwardProp,
|
|
39
|
+
systemProps: [
|
|
40
|
+
colorSystem,
|
|
41
|
+
blurSystem,
|
|
42
|
+
src_exports.border,
|
|
43
|
+
src_exports.borderTop,
|
|
44
|
+
src_exports.borderRight,
|
|
45
|
+
src_exports.borderBottom,
|
|
46
|
+
src_exports.borderLeft,
|
|
47
|
+
src_exports.borderWidth,
|
|
48
|
+
src_exports.borderStyle,
|
|
49
|
+
src_exports.borderColor,
|
|
50
|
+
src_exports.flexbox,
|
|
51
|
+
src_exports.space,
|
|
52
|
+
src_exports.layout,
|
|
53
|
+
zOrderDefault,
|
|
54
|
+
src_exports.position
|
|
55
|
+
]
|
|
56
|
+
})({
|
|
57
|
+
flexShrink: 0,
|
|
58
|
+
width: "100%"
|
|
59
|
+
}, elevationVariant, sizeVariants);
|
|
60
|
+
function AppBar({ elevation = 4, size, ...rest }) {
|
|
61
|
+
return /* @__PURE__ */ jsx(AppBarBase, {
|
|
62
|
+
as: "header",
|
|
63
|
+
elevation,
|
|
64
|
+
size,
|
|
65
|
+
...rest
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
export { AppBar };
|
package/dist/Avatar.cjs
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
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
|
+
let react = require("react");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let _soroush_tech_styled_system_should_forward_prop = require("@soroush.tech/styled-system/should-forward-prop");
|
|
8
|
+
let _emotion_react = require("@emotion/react");
|
|
9
|
+
//#region src/Avatar/Avatar.tsx
|
|
10
|
+
const shouldForwardProp = (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)([
|
|
11
|
+
..._soroush_tech_styled_system_should_forward_prop.props,
|
|
12
|
+
"variant",
|
|
13
|
+
"size",
|
|
14
|
+
"ring",
|
|
15
|
+
"ringColor",
|
|
16
|
+
"ringWidth"
|
|
17
|
+
]);
|
|
18
|
+
const avatarSizeSystem = (0, require_src.src_exports.system)({ size: {
|
|
19
|
+
properties: ["width", "height"],
|
|
20
|
+
scale: "avatar"
|
|
21
|
+
} });
|
|
22
|
+
const avatarVariants = (0, require_src.src_exports.variant)({
|
|
23
|
+
prop: "variant",
|
|
24
|
+
variants: {
|
|
25
|
+
circular: { borderRadius: "50%" },
|
|
26
|
+
rounded: { borderRadius: "md" },
|
|
27
|
+
square: { borderRadius: 0 }
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
const ringSystem = (0, require_src.src_exports.system)({
|
|
31
|
+
ringColor: {
|
|
32
|
+
property: "outlineColor",
|
|
33
|
+
scale: "border"
|
|
34
|
+
},
|
|
35
|
+
ringWidth: {
|
|
36
|
+
property: "outlineWidth",
|
|
37
|
+
scale: "borderWidths"
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
const AvatarRoot = require_src.styled(require_Flex.Flex, {
|
|
41
|
+
name: "Avatar",
|
|
42
|
+
label: "avatar",
|
|
43
|
+
shouldForwardProp
|
|
44
|
+
})({
|
|
45
|
+
overflow: "hidden",
|
|
46
|
+
flexShrink: 0,
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
justifyContent: "center",
|
|
49
|
+
flexDirection: "row"
|
|
50
|
+
}, avatarSizeSystem, avatarVariants, ({ ring }) => ring ? {
|
|
51
|
+
outlineStyle: "solid",
|
|
52
|
+
outlineOffset: "2px"
|
|
53
|
+
} : {}, ringSystem);
|
|
54
|
+
const AvatarImg = require_src.styled("img", {
|
|
55
|
+
name: "Avatar",
|
|
56
|
+
slot: "img",
|
|
57
|
+
label: "AvatarImg"
|
|
58
|
+
})({
|
|
59
|
+
width: "100%",
|
|
60
|
+
height: "100%",
|
|
61
|
+
objectFit: "cover",
|
|
62
|
+
display: "block"
|
|
63
|
+
});
|
|
64
|
+
function Avatar({ src, srcSet, alt, fallback, children, variant: variantProp, size: sizeProp, ring, ringColor: ringColorProp, ringWidth: ringWidthProp, ...rest }) {
|
|
65
|
+
const theme = (0, _emotion_react.useTheme)();
|
|
66
|
+
const variant = variantProp ?? require_themeDefault.themeDefault(theme, "avatarVariant", "circular");
|
|
67
|
+
const size = sizeProp ?? require_themeDefault.themeDefault(theme, "avatarSize", "md");
|
|
68
|
+
const ringColor = ringColorProp ?? require_themeDefault.themeDefault(theme, "borderColor", "primary");
|
|
69
|
+
const ringWidth = ringWidthProp ?? require_themeDefault.themeDefault(theme, "borderWidth", "thin");
|
|
70
|
+
const [prevSrc, setPrevSrc] = (0, react.useState)(src);
|
|
71
|
+
const [prevSrcSet, setPrevSrcSet] = (0, react.useState)(srcSet);
|
|
72
|
+
const [prevFallback, setPrevFallback] = (0, react.useState)(fallback);
|
|
73
|
+
const [failed, setFailed] = (0, react.useState)(false);
|
|
74
|
+
const [useFallback, setUseFallback] = (0, react.useState)(false);
|
|
75
|
+
if (prevSrc !== src || prevSrcSet !== srcSet || prevFallback !== fallback) {
|
|
76
|
+
setPrevSrc(src);
|
|
77
|
+
setPrevSrcSet(srcSet);
|
|
78
|
+
setPrevFallback(fallback);
|
|
79
|
+
setFailed(false);
|
|
80
|
+
setUseFallback(false);
|
|
81
|
+
}
|
|
82
|
+
const hasPrimary = !!(src || srcSet);
|
|
83
|
+
const hasAnyImage = hasPrimary || !!fallback;
|
|
84
|
+
const handleError = () => {
|
|
85
|
+
if (!useFallback && fallback && hasPrimary) setUseFallback(true);
|
|
86
|
+
else setFailed(true);
|
|
87
|
+
};
|
|
88
|
+
const currentSrc = useFallback ? fallback : src ?? (srcSet ? void 0 : fallback);
|
|
89
|
+
const currentSrcSet = useFallback ? void 0 : srcSet;
|
|
90
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AvatarRoot, {
|
|
91
|
+
variant,
|
|
92
|
+
size,
|
|
93
|
+
ring,
|
|
94
|
+
ringColor: ring ? ringColor : void 0,
|
|
95
|
+
ringWidth: ring ? ringWidth : void 0,
|
|
96
|
+
...rest,
|
|
97
|
+
children: hasAnyImage && !failed ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AvatarImg, {
|
|
98
|
+
src: currentSrc,
|
|
99
|
+
srcSet: currentSrcSet,
|
|
100
|
+
alt,
|
|
101
|
+
onError: handleError
|
|
102
|
+
}) : children
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
exports.Avatar = Avatar;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { o as Theme } from "./index-Bihpwn75.cjs";
|
|
2
|
+
import { n as FlexProps } from "./index-B1rCD6Oo.cjs";
|
|
3
|
+
//#region src/Avatar/Avatar.d.ts
|
|
4
|
+
type AvatarVariant = 'circular' | 'rounded' | 'square';
|
|
5
|
+
type AvatarSize = keyof Theme['avatar'];
|
|
6
|
+
type AvatarRingColor = keyof Theme['border'];
|
|
7
|
+
type AvatarRingWidth = keyof Theme['borderWidths'];
|
|
8
|
+
type OmittedProps = 'p' | 'pt' | 'pr' | 'pb' | 'pl' | 'px' | 'py' | 'size';
|
|
9
|
+
interface AvatarProps extends Omit<FlexProps, OmittedProps> {
|
|
10
|
+
src?: string;
|
|
11
|
+
srcSet?: string;
|
|
12
|
+
alt?: string;
|
|
13
|
+
/** Fallback image URL shown when src/srcSet fail. Children are shown when all sources fail. */
|
|
14
|
+
fallback?: string;
|
|
15
|
+
/** Shape of the avatar. Default: 'circular'. */
|
|
16
|
+
variant?: AvatarVariant;
|
|
17
|
+
/** Preset size — resolves against theme.avatar. Default: 'md', overridable via `theme.defaults.size`. */
|
|
18
|
+
size?: AvatarSize;
|
|
19
|
+
/** Adds a CSS outline ring around the avatar. */
|
|
20
|
+
ring?: boolean;
|
|
21
|
+
/** Ring color — resolves against theme.border. */
|
|
22
|
+
ringColor?: AvatarRingColor;
|
|
23
|
+
/** Ring width — resolves against theme.borderWidths. */
|
|
24
|
+
ringWidth?: AvatarRingWidth;
|
|
25
|
+
}
|
|
26
|
+
declare function Avatar({ src, srcSet, alt, fallback, children, variant: variantProp, size: sizeProp, ring, ringColor: ringColorProp, ringWidth: ringWidthProp, ...rest }: Readonly<AvatarProps>): import("react").JSX.Element;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { Avatar, AvatarProps, AvatarRingColor, AvatarRingWidth, AvatarSize, AvatarVariant };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { o as Theme } from "./index-Dm9HfgV6.mjs";
|
|
2
|
+
import { n as FlexProps } from "./index-z35LEYG8.mjs";
|
|
3
|
+
//#region src/Avatar/Avatar.d.ts
|
|
4
|
+
type AvatarVariant = 'circular' | 'rounded' | 'square';
|
|
5
|
+
type AvatarSize = keyof Theme['avatar'];
|
|
6
|
+
type AvatarRingColor = keyof Theme['border'];
|
|
7
|
+
type AvatarRingWidth = keyof Theme['borderWidths'];
|
|
8
|
+
type OmittedProps = 'p' | 'pt' | 'pr' | 'pb' | 'pl' | 'px' | 'py' | 'size';
|
|
9
|
+
interface AvatarProps extends Omit<FlexProps, OmittedProps> {
|
|
10
|
+
src?: string;
|
|
11
|
+
srcSet?: string;
|
|
12
|
+
alt?: string;
|
|
13
|
+
/** Fallback image URL shown when src/srcSet fail. Children are shown when all sources fail. */
|
|
14
|
+
fallback?: string;
|
|
15
|
+
/** Shape of the avatar. Default: 'circular'. */
|
|
16
|
+
variant?: AvatarVariant;
|
|
17
|
+
/** Preset size — resolves against theme.avatar. Default: 'md', overridable via `theme.defaults.size`. */
|
|
18
|
+
size?: AvatarSize;
|
|
19
|
+
/** Adds a CSS outline ring around the avatar. */
|
|
20
|
+
ring?: boolean;
|
|
21
|
+
/** Ring color — resolves against theme.border. */
|
|
22
|
+
ringColor?: AvatarRingColor;
|
|
23
|
+
/** Ring width — resolves against theme.borderWidths. */
|
|
24
|
+
ringWidth?: AvatarRingWidth;
|
|
25
|
+
}
|
|
26
|
+
declare function Avatar({ src, srcSet, alt, fallback, children, variant: variantProp, size: sizeProp, ring, ringColor: ringColorProp, ringWidth: ringWidthProp, ...rest }: Readonly<AvatarProps>): import("react").JSX.Element;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { Avatar, AvatarProps, AvatarRingColor, AvatarRingWidth, AvatarSize, AvatarVariant };
|