@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,186 @@
|
|
|
1
|
+
import { a as createShouldForwardProp, c as props, d as styled, l as src_exports, u as useTheme } from "./src-DcNT2aIK.mjs";
|
|
2
|
+
import { t as themeDefault } from "./themeDefault-CjXaY3ok.mjs";
|
|
3
|
+
import { t as Icon } from "./Icon-CAKRmFz3.mjs";
|
|
4
|
+
import { useFormControl } from "./FormControl.mjs";
|
|
5
|
+
import { t as inputVariantStyles } from "./inputVariantStyles-CcqpGfuP.mjs";
|
|
6
|
+
import "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/NativeSelect/NativeSelect.tsx
|
|
9
|
+
const shouldForwardProp = createShouldForwardProp([
|
|
10
|
+
...props,
|
|
11
|
+
"color",
|
|
12
|
+
"textColor",
|
|
13
|
+
"variant",
|
|
14
|
+
"error",
|
|
15
|
+
"disabled",
|
|
16
|
+
"fullWidth"
|
|
17
|
+
]);
|
|
18
|
+
const baseStyle = {
|
|
19
|
+
position: "relative",
|
|
20
|
+
display: "inline-flex",
|
|
21
|
+
alignItems: "center",
|
|
22
|
+
transition: "border-color 0.15s ease"
|
|
23
|
+
};
|
|
24
|
+
const backgroundStyle = ({ theme, textColor = themeDefault(theme, "accentTextColor", "primary"), bg = themeDefault(theme, "inputBg", "terminal") }) => {
|
|
25
|
+
return {
|
|
26
|
+
backgroundColor: (0, src_exports.get)(theme, `background.${bg}`),
|
|
27
|
+
color: (0, src_exports.get)(theme, `text.${textColor}`),
|
|
28
|
+
fontFamily: (0, src_exports.get)(theme, "fonts.body"),
|
|
29
|
+
fontSize: (0, src_exports.get)(theme, "fontSizes.1"),
|
|
30
|
+
lineHeight: (0, src_exports.get)(theme, "lineHeights.base")
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
const colorBorder = ({ theme, color = themeDefault(theme, "color", "primary"), error }) => {
|
|
34
|
+
return { borderColor: error ? (0, src_exports.get)(theme, "palette.error.main") : (0, src_exports.get)(theme, `palette.${color}.light`) };
|
|
35
|
+
};
|
|
36
|
+
const focusWithinColor = ({ theme, color = themeDefault(theme, "color", "primary"), error }) => {
|
|
37
|
+
return { "&:focus-within": { borderColor: error ? (0, src_exports.get)(theme, "palette.error.main") : (0, src_exports.get)(theme, `palette.${color}.main`) } };
|
|
38
|
+
};
|
|
39
|
+
const focusVisibleRing = ({ theme, color = themeDefault(theme, "color", "primary"), error }) => {
|
|
40
|
+
return { "&:has(:focus-visible)": {
|
|
41
|
+
outline: `2px solid ${error ? (0, src_exports.get)(theme, "palette.error.main") : (0, src_exports.get)(theme, `palette.${color}.main`)}`,
|
|
42
|
+
outlineOffset: "2px"
|
|
43
|
+
} };
|
|
44
|
+
};
|
|
45
|
+
const borderRadiusStyle = ({ variant: v = "default", borderRadius, theme }) => {
|
|
46
|
+
if (v === "underline" || v === "text" || !borderRadius) return {};
|
|
47
|
+
return { borderRadius: (0, src_exports.get)(theme, `radii.${borderRadius}`) };
|
|
48
|
+
};
|
|
49
|
+
const layoutStyles = ({ fullWidth, disabled }) => ({
|
|
50
|
+
...fullWidth ? {
|
|
51
|
+
display: "flex",
|
|
52
|
+
width: "100%"
|
|
53
|
+
} : {},
|
|
54
|
+
...disabled ? {
|
|
55
|
+
opacity: .5,
|
|
56
|
+
cursor: "not-allowed",
|
|
57
|
+
pointerEvents: "none"
|
|
58
|
+
} : {}
|
|
59
|
+
});
|
|
60
|
+
const NativeSelectRoot = styled("div", {
|
|
61
|
+
name: "NativeSelect",
|
|
62
|
+
label: "NativeSelect",
|
|
63
|
+
shouldForwardProp,
|
|
64
|
+
systemProps: [src_exports.space, (0, src_exports.system)({
|
|
65
|
+
width: true,
|
|
66
|
+
minWidth: true,
|
|
67
|
+
maxWidth: true
|
|
68
|
+
})]
|
|
69
|
+
})(baseStyle, inputVariantStyles, borderRadiusStyle, colorBorder, focusWithinColor, focusVisibleRing, backgroundStyle, layoutStyles);
|
|
70
|
+
const shouldForwardNativeSelectProps = (prop) => prop !== "sizeToken" && prop !== "bg" && prop !== "textColor";
|
|
71
|
+
const sizeVariants = ({ theme, sizeToken }) => {
|
|
72
|
+
const s = theme.sizes[sizeToken];
|
|
73
|
+
return {
|
|
74
|
+
paddingTop: theme.space[s.paddingTop],
|
|
75
|
+
paddingBottom: theme.space[s.paddingBottom],
|
|
76
|
+
paddingLeft: theme.space[s.paddingLeft],
|
|
77
|
+
paddingRight: `calc(${theme.space[s.paddingRight]} + 1.5rem)`,
|
|
78
|
+
fontSize: theme.fontSizes[s.fontSize]
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
const selectSurface = ({ theme, bg = themeDefault(theme, "inputBg", "terminal"), textColor }) => {
|
|
82
|
+
const backgroundColor = (0, src_exports.get)(theme, `background.${bg}`);
|
|
83
|
+
const color = (0, src_exports.get)(theme, `text.${textColor}`);
|
|
84
|
+
return {
|
|
85
|
+
backgroundColor,
|
|
86
|
+
color,
|
|
87
|
+
"& option": {
|
|
88
|
+
backgroundColor,
|
|
89
|
+
color
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
const StyledNativeSelect = styled("select", {
|
|
94
|
+
name: "NativeSelect",
|
|
95
|
+
slot: "select",
|
|
96
|
+
label: "NativeSelectSelect",
|
|
97
|
+
shouldForwardProp: shouldForwardNativeSelectProps
|
|
98
|
+
})({
|
|
99
|
+
appearance: "none",
|
|
100
|
+
flex: 1,
|
|
101
|
+
minWidth: 0,
|
|
102
|
+
width: "100%",
|
|
103
|
+
border: "none",
|
|
104
|
+
borderRadius: "inherit",
|
|
105
|
+
outline: "none",
|
|
106
|
+
fontFamily: "inherit",
|
|
107
|
+
lineHeight: "inherit",
|
|
108
|
+
cursor: "pointer",
|
|
109
|
+
"&:disabled": { cursor: "not-allowed" }
|
|
110
|
+
}, sizeVariants, selectSurface);
|
|
111
|
+
const DropdownIcon = styled(Icon, {
|
|
112
|
+
name: "NativeSelect",
|
|
113
|
+
slot: "icon",
|
|
114
|
+
label: "NativeSelectIcon"
|
|
115
|
+
})({
|
|
116
|
+
position: "absolute",
|
|
117
|
+
right: "0.375rem",
|
|
118
|
+
top: "50%",
|
|
119
|
+
transform: "translateY(-50%)",
|
|
120
|
+
pointerEvents: "none"
|
|
121
|
+
});
|
|
122
|
+
function NativeSelect({ options, value, defaultValue, onChange, placeholder, borderRadius, color: colorProp, textColor: textColorProp, bg, disabled: disabledProp, error: errorProp, fullWidth: fullWidthProp, iconName = "expand_more", iconProps, selectProps, id: idProp, name, required: requiredProp, size: sizeProp, variant: variantProp, className, "data-testid": dataTestid, ...spaceProps }) {
|
|
123
|
+
const fc = useFormControl({
|
|
124
|
+
id: idProp,
|
|
125
|
+
error: errorProp,
|
|
126
|
+
disabled: disabledProp,
|
|
127
|
+
required: requiredProp,
|
|
128
|
+
size: sizeProp,
|
|
129
|
+
fullWidth: fullWidthProp,
|
|
130
|
+
color: colorProp,
|
|
131
|
+
textColor: textColorProp
|
|
132
|
+
});
|
|
133
|
+
const { id, error, disabled, required, size, fullWidth } = fc;
|
|
134
|
+
const theme = useTheme();
|
|
135
|
+
const color = fc.color ?? themeDefault(theme, "color", "primary");
|
|
136
|
+
const textColor = fc.textColor ?? themeDefault(theme, "accentTextColor", "primary");
|
|
137
|
+
const variant = variantProp ?? themeDefault(theme, "inputVariant", "default");
|
|
138
|
+
const handleChange = (event) => {
|
|
139
|
+
const match = options.find((option) => String(option.value) === event.target.value);
|
|
140
|
+
onChange?.(match ? match.value : event.target.value);
|
|
141
|
+
};
|
|
142
|
+
const uncontrolledDefault = value === void 0 ? defaultValue ?? (placeholder !== void 0 ? "" : void 0) : void 0;
|
|
143
|
+
return /* @__PURE__ */ jsxs(NativeSelectRoot, {
|
|
144
|
+
color,
|
|
145
|
+
textColor,
|
|
146
|
+
bg,
|
|
147
|
+
variant,
|
|
148
|
+
error,
|
|
149
|
+
disabled,
|
|
150
|
+
fullWidth,
|
|
151
|
+
borderRadius,
|
|
152
|
+
className,
|
|
153
|
+
"data-testid": dataTestid,
|
|
154
|
+
...spaceProps,
|
|
155
|
+
children: [/* @__PURE__ */ jsxs(StyledNativeSelect, {
|
|
156
|
+
...selectProps,
|
|
157
|
+
id,
|
|
158
|
+
name,
|
|
159
|
+
disabled,
|
|
160
|
+
required,
|
|
161
|
+
sizeToken: size,
|
|
162
|
+
bg,
|
|
163
|
+
textColor,
|
|
164
|
+
value,
|
|
165
|
+
defaultValue: uncontrolledDefault,
|
|
166
|
+
onChange: handleChange,
|
|
167
|
+
"aria-describedby": selectProps?.["aria-describedby"] ?? fc["aria-describedby"],
|
|
168
|
+
children: [placeholder !== void 0 && /* @__PURE__ */ jsx("option", {
|
|
169
|
+
value: "",
|
|
170
|
+
disabled: true,
|
|
171
|
+
hidden: true,
|
|
172
|
+
children: placeholder
|
|
173
|
+
}), options.map((option) => /* @__PURE__ */ jsx("option", {
|
|
174
|
+
value: String(option.value),
|
|
175
|
+
children: option.label
|
|
176
|
+
}, String(option.value)))]
|
|
177
|
+
}), /* @__PURE__ */ jsx(DropdownIcon, {
|
|
178
|
+
name: iconName,
|
|
179
|
+
size: "1.25rem",
|
|
180
|
+
color: "secondary",
|
|
181
|
+
...iconProps
|
|
182
|
+
})]
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
//#endregion
|
|
186
|
+
export { NativeSelect };
|
|
@@ -0,0 +1,116 @@
|
|
|
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_utils = require("../utils.cjs");
|
|
5
|
+
const require_Icon = require("../Icon-1YtNCUKo.cjs");
|
|
6
|
+
require("react");
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let _soroush_tech_styled_system_should_forward_prop = require("@soroush.tech/styled-system/should-forward-prop");
|
|
9
|
+
//#region src/Pagination/PaginationItem/PaginationItem.tsx
|
|
10
|
+
/** Nav item type → registry icon. */
|
|
11
|
+
const NAV_ICONS = {
|
|
12
|
+
first: "first_page",
|
|
13
|
+
previous: "chevron_left",
|
|
14
|
+
next: "chevron_right",
|
|
15
|
+
last: "last_page"
|
|
16
|
+
};
|
|
17
|
+
const shouldForwardProp = (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)([
|
|
18
|
+
..._soroush_tech_styled_system_should_forward_prop.props,
|
|
19
|
+
"isSelected",
|
|
20
|
+
"variant",
|
|
21
|
+
"shape",
|
|
22
|
+
"size"
|
|
23
|
+
]);
|
|
24
|
+
const ITEM_DIMENSIONS = {
|
|
25
|
+
sm: "1.75rem",
|
|
26
|
+
md: "2rem",
|
|
27
|
+
lg: "2.5rem"
|
|
28
|
+
};
|
|
29
|
+
const baseStyles = {
|
|
30
|
+
appearance: "none",
|
|
31
|
+
display: "inline-flex",
|
|
32
|
+
alignItems: "center",
|
|
33
|
+
justifyContent: "center",
|
|
34
|
+
padding: 0,
|
|
35
|
+
outline: "none",
|
|
36
|
+
cursor: "pointer",
|
|
37
|
+
backgroundColor: "transparent",
|
|
38
|
+
fontFamily: "inherit",
|
|
39
|
+
transition: "background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease",
|
|
40
|
+
"&:disabled": {
|
|
41
|
+
cursor: "not-allowed",
|
|
42
|
+
opacity: .5
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const sizeStyles = ({ theme, size = require_themeDefault.themeDefault(theme, "size", "md") }) => {
|
|
46
|
+
return {
|
|
47
|
+
minWidth: ITEM_DIMENSIONS[size] ?? ITEM_DIMENSIONS.md,
|
|
48
|
+
height: ITEM_DIMENSIONS[size] ?? ITEM_DIMENSIONS.md,
|
|
49
|
+
fontSize: theme.fontSizes[theme.sizes[size].fontSize]
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
const shapeStyles = ({ theme, shape = require_themeDefault.themeDefault(theme, "paginationShape", "circular") }) => shape === "rounded" ? { borderRadius: theme.radii[require_themeDefault.themeDefault(theme, "borderRadius", "md")] } : { borderRadius: "9999px" };
|
|
53
|
+
const colorStyles = ({ theme, variant: v = require_themeDefault.themeDefault(theme, "paginationVariant", "text"), color = require_themeDefault.themeDefault(theme, "color", "primary"), isSelected }) => {
|
|
54
|
+
const c = theme.palette[color];
|
|
55
|
+
if (isSelected) return {
|
|
56
|
+
backgroundColor: c.main,
|
|
57
|
+
color: c.contrastText,
|
|
58
|
+
border: `${theme.borderWidths.thin} solid ${v === "outlined" ? c.main : "transparent"}`,
|
|
59
|
+
"&:hover:not(:disabled)": { backgroundColor: c.dark }
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
color: (0, require_src.src_exports.get)(theme, "text.primary"),
|
|
63
|
+
border: `${theme.borderWidths.thin} solid ${v === "outlined" ? (0, require_src.src_exports.get)(theme, "border.light") : "transparent"}`,
|
|
64
|
+
"&:hover:not(:disabled)": { backgroundColor: require_utils.alpha(c.main, .08) }
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
const focusVisibleStyles = ({ theme }) => ({ "&:focus-visible": {
|
|
68
|
+
outline: `2px solid ${theme.palette.primary.main}`,
|
|
69
|
+
outlineOffset: "2px"
|
|
70
|
+
} });
|
|
71
|
+
const ItemRoot = require_src.styled("button", {
|
|
72
|
+
name: "PaginationItem",
|
|
73
|
+
label: "PaginationItem",
|
|
74
|
+
shouldForwardProp,
|
|
75
|
+
systemProps: [require_src.src_exports.space]
|
|
76
|
+
})(baseStyles, sizeStyles, shapeStyles, colorStyles, focusVisibleStyles);
|
|
77
|
+
const Ellipsis = require_src.styled("span", {
|
|
78
|
+
name: "PaginationItem",
|
|
79
|
+
slot: "ellipsis",
|
|
80
|
+
label: "PaginationEllipsis",
|
|
81
|
+
shouldForwardProp,
|
|
82
|
+
systemProps: [require_src.src_exports.space]
|
|
83
|
+
})({
|
|
84
|
+
display: "inline-flex",
|
|
85
|
+
alignItems: "center",
|
|
86
|
+
justifyContent: "center"
|
|
87
|
+
}, sizeStyles, ({ theme }) => ({ color: (0, require_src.src_exports.get)(theme, "text.secondary") }));
|
|
88
|
+
function PaginationItem({ type = "page", page, isSelected = false, color, variant, shape, size, as, ...rest }) {
|
|
89
|
+
if (type === "start-ellipsis" || type === "end-ellipsis") {
|
|
90
|
+
const { disabled: _disabled, onClick: _onClick, ...ellipsisRest } = rest;
|
|
91
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Ellipsis, {
|
|
92
|
+
as,
|
|
93
|
+
size,
|
|
94
|
+
...ellipsisRest,
|
|
95
|
+
children: "…"
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ItemRoot, {
|
|
99
|
+
as,
|
|
100
|
+
type: as === void 0 ? "button" : void 0,
|
|
101
|
+
isSelected,
|
|
102
|
+
color,
|
|
103
|
+
variant,
|
|
104
|
+
shape,
|
|
105
|
+
size,
|
|
106
|
+
"aria-current": isSelected ? "page" : void 0,
|
|
107
|
+
...rest,
|
|
108
|
+
children: type === "page" ? page : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
109
|
+
name: NAV_ICONS[type],
|
|
110
|
+
size: "1.25em",
|
|
111
|
+
color: "inherit"
|
|
112
|
+
})
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
exports.PaginationItem = PaginationItem;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as PaginationItemSize, i as PaginationItemShape, n as PaginationItemColor, o as PaginationItemVariant, r as PaginationItemProps, t as PaginationItem } from "../index-CeYkEXU2.cjs";
|
|
2
|
+
export { PaginationItem, PaginationItemColor, PaginationItemProps, PaginationItemShape, PaginationItemSize, PaginationItemVariant };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as PaginationItemSize, i as PaginationItemShape, n as PaginationItemColor, o as PaginationItemVariant, r as PaginationItemProps, t as PaginationItem } from "../index-CxSNNzBT2.mjs";
|
|
2
|
+
export { PaginationItem, PaginationItemColor, PaginationItemProps, PaginationItemShape, PaginationItemSize, PaginationItemVariant };
|
|
@@ -0,0 +1,114 @@
|
|
|
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 { alpha } from "../utils.mjs";
|
|
4
|
+
import { t as Icon } from "../Icon-CAKRmFz3.mjs";
|
|
5
|
+
import "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
//#region src/Pagination/PaginationItem/PaginationItem.tsx
|
|
8
|
+
/** Nav item type → registry icon. */
|
|
9
|
+
const NAV_ICONS = {
|
|
10
|
+
first: "first_page",
|
|
11
|
+
previous: "chevron_left",
|
|
12
|
+
next: "chevron_right",
|
|
13
|
+
last: "last_page"
|
|
14
|
+
};
|
|
15
|
+
const shouldForwardProp = createShouldForwardProp([
|
|
16
|
+
...props,
|
|
17
|
+
"isSelected",
|
|
18
|
+
"variant",
|
|
19
|
+
"shape",
|
|
20
|
+
"size"
|
|
21
|
+
]);
|
|
22
|
+
const ITEM_DIMENSIONS = {
|
|
23
|
+
sm: "1.75rem",
|
|
24
|
+
md: "2rem",
|
|
25
|
+
lg: "2.5rem"
|
|
26
|
+
};
|
|
27
|
+
const baseStyles = {
|
|
28
|
+
appearance: "none",
|
|
29
|
+
display: "inline-flex",
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
justifyContent: "center",
|
|
32
|
+
padding: 0,
|
|
33
|
+
outline: "none",
|
|
34
|
+
cursor: "pointer",
|
|
35
|
+
backgroundColor: "transparent",
|
|
36
|
+
fontFamily: "inherit",
|
|
37
|
+
transition: "background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease",
|
|
38
|
+
"&:disabled": {
|
|
39
|
+
cursor: "not-allowed",
|
|
40
|
+
opacity: .5
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const sizeStyles = ({ theme, size = themeDefault(theme, "size", "md") }) => {
|
|
44
|
+
return {
|
|
45
|
+
minWidth: ITEM_DIMENSIONS[size] ?? ITEM_DIMENSIONS.md,
|
|
46
|
+
height: ITEM_DIMENSIONS[size] ?? ITEM_DIMENSIONS.md,
|
|
47
|
+
fontSize: theme.fontSizes[theme.sizes[size].fontSize]
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
const shapeStyles = ({ theme, shape = themeDefault(theme, "paginationShape", "circular") }) => shape === "rounded" ? { borderRadius: theme.radii[themeDefault(theme, "borderRadius", "md")] } : { borderRadius: "9999px" };
|
|
51
|
+
const colorStyles = ({ theme, variant: v = themeDefault(theme, "paginationVariant", "text"), color = themeDefault(theme, "color", "primary"), isSelected }) => {
|
|
52
|
+
const c = theme.palette[color];
|
|
53
|
+
if (isSelected) return {
|
|
54
|
+
backgroundColor: c.main,
|
|
55
|
+
color: c.contrastText,
|
|
56
|
+
border: `${theme.borderWidths.thin} solid ${v === "outlined" ? c.main : "transparent"}`,
|
|
57
|
+
"&:hover:not(:disabled)": { backgroundColor: c.dark }
|
|
58
|
+
};
|
|
59
|
+
return {
|
|
60
|
+
color: (0, src_exports.get)(theme, "text.primary"),
|
|
61
|
+
border: `${theme.borderWidths.thin} solid ${v === "outlined" ? (0, src_exports.get)(theme, "border.light") : "transparent"}`,
|
|
62
|
+
"&:hover:not(:disabled)": { backgroundColor: alpha(c.main, .08) }
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
const focusVisibleStyles = ({ theme }) => ({ "&:focus-visible": {
|
|
66
|
+
outline: `2px solid ${theme.palette.primary.main}`,
|
|
67
|
+
outlineOffset: "2px"
|
|
68
|
+
} });
|
|
69
|
+
const ItemRoot = styled("button", {
|
|
70
|
+
name: "PaginationItem",
|
|
71
|
+
label: "PaginationItem",
|
|
72
|
+
shouldForwardProp,
|
|
73
|
+
systemProps: [src_exports.space]
|
|
74
|
+
})(baseStyles, sizeStyles, shapeStyles, colorStyles, focusVisibleStyles);
|
|
75
|
+
const Ellipsis = styled("span", {
|
|
76
|
+
name: "PaginationItem",
|
|
77
|
+
slot: "ellipsis",
|
|
78
|
+
label: "PaginationEllipsis",
|
|
79
|
+
shouldForwardProp,
|
|
80
|
+
systemProps: [src_exports.space]
|
|
81
|
+
})({
|
|
82
|
+
display: "inline-flex",
|
|
83
|
+
alignItems: "center",
|
|
84
|
+
justifyContent: "center"
|
|
85
|
+
}, sizeStyles, ({ theme }) => ({ color: (0, src_exports.get)(theme, "text.secondary") }));
|
|
86
|
+
function PaginationItem({ type = "page", page, isSelected = false, color, variant, shape, size, as, ...rest }) {
|
|
87
|
+
if (type === "start-ellipsis" || type === "end-ellipsis") {
|
|
88
|
+
const { disabled: _disabled, onClick: _onClick, ...ellipsisRest } = rest;
|
|
89
|
+
return /* @__PURE__ */ jsx(Ellipsis, {
|
|
90
|
+
as,
|
|
91
|
+
size,
|
|
92
|
+
...ellipsisRest,
|
|
93
|
+
children: "…"
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
return /* @__PURE__ */ jsx(ItemRoot, {
|
|
97
|
+
as,
|
|
98
|
+
type: as === void 0 ? "button" : void 0,
|
|
99
|
+
isSelected,
|
|
100
|
+
color,
|
|
101
|
+
variant,
|
|
102
|
+
shape,
|
|
103
|
+
size,
|
|
104
|
+
"aria-current": isSelected ? "page" : void 0,
|
|
105
|
+
...rest,
|
|
106
|
+
children: type === "page" ? page : /* @__PURE__ */ jsx(Icon, {
|
|
107
|
+
name: NAV_ICONS[type],
|
|
108
|
+
size: "1.25em",
|
|
109
|
+
color: "inherit"
|
|
110
|
+
})
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { PaginationItem };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_src = require("./src-BiocWFSR.cjs");
|
|
3
|
+
const require_Pagination_PaginationItem = require("./Pagination/PaginationItem.cjs");
|
|
4
|
+
let react = require("react");
|
|
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/Pagination/hooks/usePagination.ts
|
|
8
|
+
const range = (start, end) => Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
9
|
+
/**
|
|
10
|
+
* Headless pagination model — computes the item list (nav buttons, page numbers,
|
|
11
|
+
* ellipses) with selection, boundary disabling, and controlled/uncontrolled paging.
|
|
12
|
+
*/
|
|
13
|
+
function usePagination({ count, page: pageProp, defaultPage = 1, siblingCount = 1, boundaryCount = 1, disabled = false, shouldShowFirstButton = false, shouldShowLastButton = false, shouldHidePrevButton = false, shouldHideNextButton = false, onChange }) {
|
|
14
|
+
const [pageState, setPageState] = (0, react.useState)(defaultPage);
|
|
15
|
+
const page = pageProp ?? pageState;
|
|
16
|
+
const handleClick = (value) => {
|
|
17
|
+
if (pageProp === void 0) setPageState(value);
|
|
18
|
+
onChange?.(value);
|
|
19
|
+
};
|
|
20
|
+
const startPages = range(1, Math.min(boundaryCount, count));
|
|
21
|
+
const endPages = range(Math.max(count - boundaryCount + 1, boundaryCount + 1), count);
|
|
22
|
+
const siblingsStart = Math.max(Math.min(page - siblingCount, count - boundaryCount - siblingCount * 2 - 1), boundaryCount + 2);
|
|
23
|
+
const siblingsEnd = Math.min(Math.max(page + siblingCount, boundaryCount + siblingCount * 2 + 2), endPages.length > 0 ? endPages[0] - 2 : count - 1);
|
|
24
|
+
const startEllipsisFallback = boundaryCount + 1 < count - boundaryCount ? [boundaryCount + 1] : [];
|
|
25
|
+
const endEllipsisFallback = count - boundaryCount > boundaryCount ? [count - boundaryCount] : [];
|
|
26
|
+
const itemList = [
|
|
27
|
+
...shouldShowFirstButton ? ["first"] : [],
|
|
28
|
+
...shouldHidePrevButton ? [] : ["previous"],
|
|
29
|
+
...startPages,
|
|
30
|
+
...siblingsStart > boundaryCount + 2 ? ["start-ellipsis"] : startEllipsisFallback,
|
|
31
|
+
...range(siblingsStart, siblingsEnd),
|
|
32
|
+
...siblingsEnd < count - boundaryCount - 1 ? ["end-ellipsis"] : endEllipsisFallback,
|
|
33
|
+
...endPages,
|
|
34
|
+
...shouldHideNextButton ? [] : ["next"],
|
|
35
|
+
...shouldShowLastButton ? ["last"] : []
|
|
36
|
+
];
|
|
37
|
+
const navTargets = {
|
|
38
|
+
first: 1,
|
|
39
|
+
previous: page - 1,
|
|
40
|
+
next: page + 1,
|
|
41
|
+
last: count
|
|
42
|
+
};
|
|
43
|
+
return { items: itemList.map((item) => {
|
|
44
|
+
if (typeof item === "number") return {
|
|
45
|
+
type: "page",
|
|
46
|
+
page: item,
|
|
47
|
+
isSelected: item === page,
|
|
48
|
+
isDisabled: disabled,
|
|
49
|
+
onClick: () => handleClick(item)
|
|
50
|
+
};
|
|
51
|
+
if (item === "start-ellipsis" || item === "end-ellipsis") return {
|
|
52
|
+
type: item,
|
|
53
|
+
page: null,
|
|
54
|
+
isSelected: false,
|
|
55
|
+
isDisabled: true
|
|
56
|
+
};
|
|
57
|
+
const target = navTargets[item];
|
|
58
|
+
return {
|
|
59
|
+
type: item,
|
|
60
|
+
page: target,
|
|
61
|
+
isSelected: false,
|
|
62
|
+
isDisabled: disabled || (item === "first" || item === "previous" ? page <= 1 : page >= count),
|
|
63
|
+
onClick: () => handleClick(target)
|
|
64
|
+
};
|
|
65
|
+
}) };
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/Pagination/Pagination.tsx
|
|
69
|
+
const defaultGetItemAriaLabel = (type, page, isSelected) => {
|
|
70
|
+
if (type === "page") return isSelected ? `page ${page}` : `Go to page ${page}`;
|
|
71
|
+
return `Go to ${type} page`;
|
|
72
|
+
};
|
|
73
|
+
const shouldForwardProp = (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)([..._soroush_tech_styled_system_should_forward_prop.props]);
|
|
74
|
+
const PaginationNav = require_src.styled("nav", {
|
|
75
|
+
name: "Pagination",
|
|
76
|
+
label: "PaginationNav",
|
|
77
|
+
shouldForwardProp,
|
|
78
|
+
systemProps: [require_src.src_exports.space]
|
|
79
|
+
})();
|
|
80
|
+
const PaginationList = require_src.styled("ul", {
|
|
81
|
+
name: "Pagination",
|
|
82
|
+
slot: "list",
|
|
83
|
+
label: "Pagination",
|
|
84
|
+
shouldForwardProp
|
|
85
|
+
})({
|
|
86
|
+
display: "flex",
|
|
87
|
+
flexWrap: "wrap",
|
|
88
|
+
alignItems: "center",
|
|
89
|
+
gap: "0.25rem",
|
|
90
|
+
listStyle: "none",
|
|
91
|
+
margin: 0,
|
|
92
|
+
padding: 0
|
|
93
|
+
});
|
|
94
|
+
function Pagination({ count, page, defaultPage, siblingCount, boundaryCount, disabled, shouldShowFirstButton, shouldShowLastButton, shouldHidePrevButton, shouldHideNextButton, onChange, color, variant, shape, size, getItemAriaLabel = defaultGetItemAriaLabel, "aria-label": ariaLabel = "pagination navigation", ...rest }) {
|
|
95
|
+
const { items } = usePagination({
|
|
96
|
+
count,
|
|
97
|
+
page,
|
|
98
|
+
defaultPage,
|
|
99
|
+
siblingCount,
|
|
100
|
+
boundaryCount,
|
|
101
|
+
disabled,
|
|
102
|
+
shouldShowFirstButton,
|
|
103
|
+
shouldShowLastButton,
|
|
104
|
+
shouldHidePrevButton,
|
|
105
|
+
shouldHideNextButton,
|
|
106
|
+
onChange
|
|
107
|
+
});
|
|
108
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationNav, {
|
|
109
|
+
"aria-label": ariaLabel,
|
|
110
|
+
...rest,
|
|
111
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationList, { children: items.map((item, index) => {
|
|
112
|
+
const isEllipsis = item.type === "start-ellipsis" || item.type === "end-ellipsis";
|
|
113
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
|
|
114
|
+
"aria-hidden": isEllipsis || void 0,
|
|
115
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Pagination_PaginationItem.PaginationItem, {
|
|
116
|
+
type: item.type,
|
|
117
|
+
page: item.page,
|
|
118
|
+
isSelected: item.isSelected,
|
|
119
|
+
disabled: item.isDisabled,
|
|
120
|
+
onClick: item.onClick,
|
|
121
|
+
color,
|
|
122
|
+
variant,
|
|
123
|
+
shape,
|
|
124
|
+
size,
|
|
125
|
+
"aria-label": isEllipsis ? void 0 : getItemAriaLabel(item.type, item.page, item.isSelected)
|
|
126
|
+
})
|
|
127
|
+
}, `${item.type}-${item.page ?? index}`);
|
|
128
|
+
}) })
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
exports.Pagination = Pagination;
|
|
133
|
+
exports.PaginationItem = require_Pagination_PaginationItem.PaginationItem;
|
|
134
|
+
exports.usePagination = usePagination;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { l as index_d_exports, o as Theme } from "./index-Bihpwn75.cjs";
|
|
2
|
+
import { a as PaginationItemSize, c as UsePaginationItem, i as PaginationItemShape, l as UsePaginationProps, n as PaginationItemColor, o as PaginationItemVariant, r as PaginationItemProps, s as PaginationItemType, t as PaginationItem, u as usePagination } from "./index-CeYkEXU2.cjs";
|
|
3
|
+
import { HTMLAttributes } from "react";
|
|
4
|
+
//#region src/Pagination/Pagination.d.ts
|
|
5
|
+
type PaginationColor = PaginationItemColor;
|
|
6
|
+
type PaginationVariant = PaginationItemVariant;
|
|
7
|
+
type PaginationShape = PaginationItemShape;
|
|
8
|
+
type PaginationSize = PaginationItemSize;
|
|
9
|
+
interface PaginationProps extends Omit<HTMLAttributes<HTMLElement>, 'color' | 'onChange'>, UsePaginationProps, index_d_exports.SpaceProps<Theme> {
|
|
10
|
+
/** Selected-item color — resolves against `theme.palette`. Default: 'primary', overridable via `theme.defaults.color`. */
|
|
11
|
+
color?: PaginationColor;
|
|
12
|
+
/** Item style — `text` or `outlined`. Default: `'text'`. */
|
|
13
|
+
variant?: PaginationVariant;
|
|
14
|
+
/** Item corner shape. Default: `'circular'`. */
|
|
15
|
+
shape?: PaginationShape;
|
|
16
|
+
/** Item density — resolves against `theme.sizes`. Default: 'md', overridable via `theme.defaults.size`. */
|
|
17
|
+
size?: PaginationSize;
|
|
18
|
+
/** Accessible name per item — important for screen readers. A sensible default is provided. */
|
|
19
|
+
getItemAriaLabel?: (type: PaginationItemType, page: number | null, isSelected: boolean) => string;
|
|
20
|
+
}
|
|
21
|
+
declare function Pagination({ count, page, defaultPage, siblingCount, boundaryCount, disabled, shouldShowFirstButton, shouldShowLastButton, shouldHidePrevButton, shouldHideNextButton, onChange, color, variant, shape, size, getItemAriaLabel, 'aria-label': ariaLabel, ...rest }: Readonly<PaginationProps>): import("react").JSX.Element;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { Pagination, PaginationColor, PaginationItem, PaginationItemColor, PaginationItemProps, PaginationItemShape, PaginationItemSize, PaginationItemType, PaginationItemVariant, PaginationProps, PaginationShape, PaginationSize, PaginationVariant, UsePaginationItem, UsePaginationProps, usePagination };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { l as index_d_exports, o as Theme } from "./index-Dm9HfgV6.mjs";
|
|
2
|
+
import { a as PaginationItemSize, c as UsePaginationItem, i as PaginationItemShape, l as UsePaginationProps, n as PaginationItemColor, o as PaginationItemVariant, r as PaginationItemProps, s as PaginationItemType, t as PaginationItem, u as usePagination } from "./index-CxSNNzBT2.mjs";
|
|
3
|
+
import { HTMLAttributes } from "react";
|
|
4
|
+
//#region src/Pagination/Pagination.d.ts
|
|
5
|
+
type PaginationColor = PaginationItemColor;
|
|
6
|
+
type PaginationVariant = PaginationItemVariant;
|
|
7
|
+
type PaginationShape = PaginationItemShape;
|
|
8
|
+
type PaginationSize = PaginationItemSize;
|
|
9
|
+
interface PaginationProps extends Omit<HTMLAttributes<HTMLElement>, 'color' | 'onChange'>, UsePaginationProps, index_d_exports.SpaceProps<Theme> {
|
|
10
|
+
/** Selected-item color — resolves against `theme.palette`. Default: 'primary', overridable via `theme.defaults.color`. */
|
|
11
|
+
color?: PaginationColor;
|
|
12
|
+
/** Item style — `text` or `outlined`. Default: `'text'`. */
|
|
13
|
+
variant?: PaginationVariant;
|
|
14
|
+
/** Item corner shape. Default: `'circular'`. */
|
|
15
|
+
shape?: PaginationShape;
|
|
16
|
+
/** Item density — resolves against `theme.sizes`. Default: 'md', overridable via `theme.defaults.size`. */
|
|
17
|
+
size?: PaginationSize;
|
|
18
|
+
/** Accessible name per item — important for screen readers. A sensible default is provided. */
|
|
19
|
+
getItemAriaLabel?: (type: PaginationItemType, page: number | null, isSelected: boolean) => string;
|
|
20
|
+
}
|
|
21
|
+
declare function Pagination({ count, page, defaultPage, siblingCount, boundaryCount, disabled, shouldShowFirstButton, shouldShowLastButton, shouldHidePrevButton, shouldHideNextButton, onChange, color, variant, shape, size, getItemAriaLabel, 'aria-label': ariaLabel, ...rest }: Readonly<PaginationProps>): import("react").JSX.Element;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { Pagination, PaginationColor, PaginationItem, PaginationItemColor, PaginationItemProps, PaginationItemShape, PaginationItemSize, PaginationItemType, PaginationItemVariant, PaginationProps, PaginationShape, PaginationSize, PaginationVariant, UsePaginationItem, UsePaginationProps, usePagination };
|