@soroush.tech/design-system 2.0.0-rc.1 → 2.0.0-rc.3
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/README.md +30 -10
- package/dist/AppBar.d.cts +1 -3
- package/dist/AppBar.d.mts +1 -3
- package/dist/Avatar.cjs +1 -1
- package/dist/Avatar.d.cts +1 -3
- package/dist/Avatar.d.mts +1 -3
- package/dist/Avatar.mjs +1 -1
- package/dist/Backdrop.d.cts +1 -1
- package/dist/Backdrop.d.mts +1 -1
- package/dist/Breadcrumbs.cjs +132 -0
- package/dist/Breadcrumbs.d.cts +40 -0
- package/dist/Breadcrumbs.d.mts +40 -0
- package/dist/Breadcrumbs.mjs +131 -0
- package/dist/Button.cjs +1 -1
- package/dist/Button.d.cts +1 -1
- package/dist/Button.d.mts +1 -1
- package/dist/Button.mjs +1 -1
- package/dist/ButtonGroup.d.cts +1 -1
- package/dist/ButtonGroup.d.mts +1 -1
- package/dist/Card.cjs +3 -3
- package/dist/Card.d.cts +4 -3
- package/dist/Card.d.mts +4 -3
- package/dist/Card.mjs +3 -3
- package/dist/Checkbox.d.cts +1 -2
- package/dist/Checkbox.d.mts +1 -2
- package/dist/CircularProgress.d.cts +2 -3
- package/dist/CircularProgress.d.mts +2 -3
- package/dist/Drawer.d.cts +3 -2
- package/dist/Drawer.d.mts +3 -2
- package/dist/Flex.d.cts +1 -1
- package/dist/Flex.d.mts +1 -1
- package/dist/Form.d.cts +1 -1
- package/dist/Form.d.mts +1 -1
- package/dist/FormControl.cjs +10 -2
- package/dist/FormControl.d.cts +9 -2
- package/dist/FormControl.d.mts +9 -2
- package/dist/FormControl.mjs +10 -2
- package/dist/FormHelperText.d.cts +1 -1
- package/dist/FormHelperText.d.mts +1 -1
- package/dist/FormLabel.cjs +9 -1
- package/dist/FormLabel.d.cts +2 -2
- package/dist/FormLabel.d.mts +2 -2
- package/dist/FormLabel.mjs +10 -2
- package/dist/Grid.d.cts +1 -3
- package/dist/Grid.d.mts +1 -3
- package/dist/{Icon-CH3asUJu.mjs → Icon-BihOAP4u.mjs} +52 -2
- package/dist/{Icon-CI6q2Eyi.cjs → Icon-D-EWsBVg.cjs} +52 -2
- package/dist/Icon.cjs +1 -1
- package/dist/Icon.d.cts +1 -1
- package/dist/Icon.d.mts +1 -1
- package/dist/Icon.mjs +1 -1
- package/dist/Image.d.cts +1 -2
- package/dist/Image.d.mts +1 -2
- package/dist/InputRange.cjs +675 -0
- package/dist/InputRange.d.cts +79 -0
- package/dist/InputRange.d.mts +79 -0
- package/dist/InputRange.mjs +673 -0
- package/dist/LinearProgress.d.cts +2 -3
- package/dist/LinearProgress.d.mts +2 -3
- package/dist/Link.cjs +1 -1
- package/dist/Link.d.cts +1 -1
- package/dist/Link.d.mts +1 -1
- package/dist/Link.mjs +1 -1
- package/dist/Menu/ContextMenu.cjs +146 -0
- package/dist/Menu/ContextMenu.d.cts +52 -0
- package/dist/Menu/ContextMenu.d.mts +52 -0
- package/dist/Menu/ContextMenu.mjs +145 -0
- package/dist/Menu/Menu.cjs +3 -0
- package/dist/Menu/Menu.d.cts +2 -0
- package/dist/Menu/Menu.d.mts +2 -0
- package/dist/Menu/Menu.mjs +2 -0
- package/dist/Menu/MenuDivider.cjs +29 -0
- package/dist/Menu/MenuDivider.d.cts +12 -0
- package/dist/Menu/MenuDivider.d.mts +12 -0
- package/dist/Menu/MenuDivider.mjs +28 -0
- package/dist/Menu/MenuItems.cjs +29 -0
- package/dist/Menu/MenuItems.d.cts +2 -0
- package/dist/Menu/MenuItems.d.mts +2 -0
- package/dist/Menu/MenuItems.mjs +28 -0
- package/dist/Menu/MenuList.cjs +3 -0
- package/dist/Menu/MenuList.d.cts +38 -0
- package/dist/Menu/MenuList.d.mts +38 -0
- package/dist/Menu/MenuList.mjs +2 -0
- package/dist/Menu-Cgg-sX4W.cjs +173 -0
- package/dist/Menu-CrzHc_cn.mjs +168 -0
- package/dist/Menu.cjs +13 -0
- package/dist/Menu.d.cts +7 -0
- package/dist/Menu.d.mts +7 -0
- package/dist/Menu.mjs +6 -0
- package/dist/MenuItem-BTP7Ijwi.cjs +673 -0
- package/dist/MenuItem-DUn4IZKK.mjs +649 -0
- package/dist/MenuItem.cjs +2 -148
- package/dist/MenuItem.d.cts +2 -52
- package/dist/MenuItem.d.mts +2 -52
- package/dist/MenuItem.mjs +1 -147
- package/dist/MenuList-B7msJ1IG.mjs +187 -0
- package/dist/MenuList-D4imLXAa.cjs +223 -0
- package/dist/MenuListContext-DKUOhNyw.d.cts +21 -0
- package/dist/MenuListContext-x-7lH4CH.d.mts +21 -0
- package/dist/Modal.d.cts +1 -1
- package/dist/Modal.d.mts +1 -1
- package/dist/NativeSelect.cjs +9 -8
- package/dist/NativeSelect.d.cts +3 -4
- package/dist/NativeSelect.d.mts +3 -4
- package/dist/NativeSelect.mjs +9 -8
- package/dist/NumberField.cjs +476 -0
- package/dist/NumberField.d.cts +74 -0
- package/dist/NumberField.d.mts +74 -0
- package/dist/NumberField.mjs +474 -0
- package/dist/Pagination/PaginationItem.cjs +1 -1
- package/dist/Pagination/PaginationItem.d.cts +1 -1
- package/dist/Pagination/PaginationItem.d.mts +1 -1
- package/dist/Pagination/PaginationItem.mjs +1 -1
- package/dist/Pagination.d.cts +2 -2
- package/dist/Pagination.d.mts +2 -2
- package/dist/Paper.cjs +1 -1
- package/dist/Paper.d.cts +2 -1
- package/dist/Paper.d.mts +2 -1
- package/dist/Paper.mjs +1 -1
- package/dist/{Popover-TpwRSORC.cjs → Popover-CiZfgiKE.cjs} +5 -125
- package/dist/Popover-QjM5Z1CR.mjs +133 -0
- package/dist/Popover.cjs +1 -1
- package/dist/Popover.d.cts +6 -7
- package/dist/Popover.d.mts +6 -7
- package/dist/Popover.mjs +1 -1
- package/dist/Pressable.cjs +1 -1
- package/dist/Pressable.d.cts +1 -1
- package/dist/Pressable.d.mts +1 -1
- package/dist/Pressable.mjs +1 -1
- package/dist/Quote.d.cts +2 -3
- package/dist/Quote.d.mts +2 -3
- package/dist/Radio.d.cts +1 -2
- package/dist/Radio.d.mts +1 -2
- package/dist/Rating.cjs +373 -0
- package/dist/Rating.d.cts +57 -0
- package/dist/Rating.d.mts +57 -0
- package/dist/Rating.mjs +371 -0
- package/dist/Select.cjs +5 -4
- package/dist/Select.d.cts +3 -4
- package/dist/Select.d.mts +3 -4
- package/dist/Select.mjs +7 -6
- package/dist/Sidebar/Sidebar.d.cts +1 -1
- package/dist/Sidebar/Sidebar.d.mts +1 -1
- package/dist/Sidebar/SidebarItem.cjs +1 -1
- package/dist/Sidebar/SidebarItem.d.cts +3 -4
- package/dist/Sidebar/SidebarItem.d.mts +3 -4
- package/dist/Sidebar/SidebarItem.mjs +3 -3
- package/dist/Skeleton.d.cts +1 -2
- package/dist/Skeleton.d.mts +1 -2
- package/dist/Switch.cjs +23 -16
- package/dist/Switch.d.cts +2 -3
- package/dist/Switch.d.mts +2 -3
- package/dist/Switch.mjs +25 -18
- package/dist/Table/Table.d.cts +2 -3
- package/dist/Table/Table.d.mts +2 -3
- package/dist/Table/TableBody.d.cts +1 -2
- package/dist/Table/TableBody.d.mts +1 -2
- package/dist/Table/TableCell.d.cts +1 -1
- package/dist/Table/TableCell.d.mts +1 -1
- package/dist/Table/TableContainer.d.cts +1 -3
- package/dist/Table/TableContainer.d.mts +1 -3
- package/dist/Table/TableControl.d.cts +1 -1
- package/dist/Table/TableControl.d.mts +1 -1
- package/dist/Table/TableControl.mjs +2 -2
- package/dist/Table/TableFooter.d.cts +1 -2
- package/dist/Table/TableFooter.d.mts +1 -2
- package/dist/Table/TableHead.d.cts +1 -2
- package/dist/Table/TableHead.d.mts +1 -2
- package/dist/Table/TablePagination.d.cts +2 -2
- package/dist/Table/TablePagination.d.mts +2 -2
- package/dist/Table/TablePaginationActions.cjs +1 -1
- package/dist/Table/TablePaginationActions.d.cts +1 -1
- package/dist/Table/TablePaginationActions.d.mts +1 -1
- package/dist/Table/TablePaginationActions.mjs +1 -1
- package/dist/Table/TableRow.d.cts +1 -2
- package/dist/Table/TableRow.d.mts +1 -2
- package/dist/Table/TableSortLabel.cjs +1 -1
- package/dist/Table/TableSortLabel.d.cts +1 -1
- package/dist/Table/TableSortLabel.d.mts +1 -1
- package/dist/Table/TableSortLabel.mjs +1 -1
- package/dist/Table/hooks.d.cts +1 -1
- package/dist/Table/hooks.d.mts +1 -1
- package/dist/Table.d.cts +5 -5
- package/dist/Table.d.mts +5 -5
- package/dist/{TableContext-BeCxbtHH.d.cts → TableContext-DhuRf6Wy.d.mts} +1 -1
- package/dist/{TableContext-BiRiYkVZ.d.mts → TableContext-Duj1nVG7.d.cts} +1 -1
- package/dist/Tabs/Tab.cjs +306 -0
- package/dist/Tabs/Tab.d.cts +62 -0
- package/dist/Tabs/Tab.d.mts +62 -0
- package/dist/Tabs/Tab.mjs +305 -0
- package/dist/Tabs/TabContext.cjs +34 -0
- package/dist/Tabs/TabContext.d.cts +20 -0
- package/dist/Tabs/TabContext.d.mts +20 -0
- package/dist/Tabs/TabContext.mjs +33 -0
- package/dist/Tabs/TabList.cjs +31 -0
- package/dist/Tabs/TabList.d.cts +11 -0
- package/dist/Tabs/TabList.d.mts +11 -0
- package/dist/Tabs/TabList.mjs +30 -0
- package/dist/Tabs/TabPanel.cjs +40 -0
- package/dist/Tabs/TabPanel.d.cts +27 -0
- package/dist/Tabs/TabPanel.d.mts +27 -0
- package/dist/Tabs/TabPanel.mjs +38 -0
- package/dist/Tabs/TabScrollButton.cjs +93 -0
- package/dist/Tabs/TabScrollButton.d.cts +2 -0
- package/dist/Tabs/TabScrollButton.d.mts +2 -0
- package/dist/Tabs/TabScrollButton.mjs +91 -0
- package/dist/Tabs/Tabs.cjs +3 -0
- package/dist/Tabs/Tabs.d.cts +3 -0
- package/dist/Tabs/Tabs.d.mts +3 -0
- package/dist/Tabs/Tabs.mjs +2 -0
- package/dist/Tabs-BTNOJx5v.mjs +634 -0
- package/dist/Tabs-D4tWCq78.cjs +646 -0
- package/dist/Tabs.cjs +13 -0
- package/dist/Tabs.d.cts +8 -0
- package/dist/Tabs.d.mts +8 -0
- package/dist/Tabs.mjs +7 -0
- package/dist/TabsContext-B_XHbjcS.d.cts +6 -0
- package/dist/TabsContext-Dn2kqUwr.d.mts +6 -0
- package/dist/TabsValueContext-D40zGCpE.cjs +19 -0
- package/dist/TabsValueContext-DvL3inf7.mjs +8 -0
- package/dist/TextInput.cjs +4 -4
- package/dist/TextInput.d.cts +2 -3
- package/dist/TextInput.d.mts +2 -3
- package/dist/TextInput.mjs +4 -4
- package/dist/ToggleButton/ToggleButton.cjs +1 -1
- package/dist/ToggleButton/ToggleButton.d.cts +1 -1
- package/dist/ToggleButton/ToggleButton.d.mts +1 -1
- package/dist/ToggleButton/ToggleButton.mjs +1 -1
- package/dist/ToggleButton/ToggleButtonGroup.cjs +1 -1
- package/dist/ToggleButton/ToggleButtonGroup.d.cts +1 -1
- package/dist/ToggleButton/ToggleButtonGroup.d.mts +1 -1
- package/dist/ToggleButton/ToggleButtonGroup.mjs +1 -1
- package/dist/TransferList.cjs +356 -0
- package/dist/TransferList.d.cts +67 -0
- package/dist/TransferList.d.mts +67 -0
- package/dist/TransferList.mjs +354 -0
- package/dist/Typography.cjs +1 -1
- package/dist/Typography.d.cts +2 -2
- package/dist/Typography.d.mts +2 -2
- package/dist/Typography.mjs +1 -1
- package/dist/View.d.cts +1 -1
- package/dist/View.d.mts +1 -1
- package/dist/catalog.cjs +4568 -0
- package/dist/catalog.d.cts +90 -0
- package/dist/catalog.d.mts +90 -0
- package/dist/catalog.mjs +4567 -0
- package/dist/computePopoverPosition-BIprs_xo.mjs +123 -0
- package/dist/computePopoverPosition-DiyEOHnU.cjs +128 -0
- package/dist/dividerLine-BNljcGlv.cjs +66 -0
- package/dist/dividerLine-FahY-M6_.mjs +31 -0
- package/dist/engine.d.cts +1 -1
- package/dist/engine.d.mts +1 -1
- package/dist/index-B1RFybA_.d.mts +72 -0
- package/dist/index-B4TeaB7b.d.cts +72 -0
- package/dist/{index-BUoVTCqX.d.mts → index-BGbTuHP9.d.mts} +1 -2
- package/dist/{index-Celm-8iN.d.cts → index-BHKgEOZJ.d.cts} +2 -3
- package/dist/{index-Chg6pSrr.d.mts → index-BQWjh4rK.d.mts} +2 -3
- package/dist/{index-B78VkB0-.d.cts → index-BelFIizY.d.cts} +2 -3
- package/dist/index-BkzZxHVj.d.mts +35 -0
- package/dist/{index-DbEnSf2m.d.cts → index-BrgwkY6z.d.mts} +3 -4
- package/dist/{index-Wnv6jCR3.d.mts → index-Bx0-6yeX.d.mts} +1 -2
- package/dist/index-BxVTIMnB.d.cts +1 -0
- package/dist/{index-BfZuh9c2.d.mts → index-ByYxVl9O.d.mts} +2 -3
- package/dist/index-CE5JG1us.d.mts +34 -0
- package/dist/{index-BhibLnZ0.d.cts → index-CG_1uPrD.d.mts} +2 -3
- package/dist/{themes-RX2UX5gD.d.mts → index-CJhK7JND.d.mts} +265 -8
- package/dist/{index-BB-dLv5V.d.mts → index-CQfJZADG.d.cts} +3 -4
- package/dist/{index-CxUsrlg1.d.cts → index-CUz2h5xY.d.mts} +2 -3
- package/dist/{index-Bid71KeF.d.cts → index-CbFaWtjK.d.mts} +2 -2
- package/dist/{index-DdqdSOct.d.cts → index-ChXeKJCk.d.cts} +1 -2
- package/dist/index-CknoXDLQ.d.cts +35 -0
- package/dist/{index-BSqet8aO.d.cts → index-ClZyaZrR.d.mts} +2 -3
- package/dist/{index-DXvQ-JVZ.d.mts → index-DAwcmIjN.d.cts} +2 -3
- package/dist/index-DGnXJwLj.d.mts +72 -0
- package/dist/{themes-Kbk9h5cN.d.cts → index-DJ0f69wh.d.cts} +262 -5
- package/dist/index-DWjz5ZzG.d.cts +72 -0
- package/dist/{index-DNwF3DUX.d.cts → index-DYF8sRE-.d.cts} +2 -3
- package/dist/index-DaIIo5QU.d.mts +1 -0
- package/dist/{index-CrN4MSUF.d.cts → index-DchHf5cF.d.cts} +1 -1
- package/dist/{index-S-ClM6WM.d.mts → index-DtYjdBvO.d.cts} +2 -2
- package/dist/{index-Ctqajtac.d.cts → index-Dv_fk1_F.d.cts} +27 -3
- package/dist/{index-smqjMLAZ.d.mts → index-K5exjvnX.d.cts} +2 -3
- package/dist/index-KnXhlKMr.d.cts +34 -0
- package/dist/index-WHFhjfgy.d.cts +98 -0
- package/dist/{index-GpnmW6vu.d.mts → index-YKrfFC_I.d.cts} +2 -3
- package/dist/index-bpnLB_4K.d.mts +98 -0
- package/dist/{index-VOsBSWEu.d.mts → index-h4dYtVrp.d.mts} +1 -1
- package/dist/{index-DO9J-Fla.d.mts → index-ha1WjSZ5.d.mts} +27 -3
- package/dist/{index-Belxmt1X.d.cts → index-nqUA_6J_.d.cts} +1 -2
- package/dist/{index-nc4Sxiy9.d.mts → index-pTNq3iQn.d.mts} +2 -3
- package/dist/index.d.cts +1 -2
- package/dist/index.d.mts +1 -2
- package/dist/isRtl-BJDtm86G.mjs +7 -0
- package/dist/isRtl-DTkYHRPo.cjs +12 -0
- package/dist/precision-B1lhxnnO.mjs +25 -0
- package/dist/precision-B58cTPB2.cjs +48 -0
- package/dist/style.cjs +1 -1
- package/dist/style.d.cts +2 -2
- package/dist/style.d.mts +2 -2
- package/dist/style.mjs +1 -1
- package/dist/surfaceSystem-BGQBoXv_.cjs +38 -0
- package/dist/surfaceSystem-D8TbmKy3.mjs +21 -0
- package/dist/theme-BxXuXRgQ.cjs +137 -0
- package/dist/theme-Z9_QludW.mjs +102 -0
- package/dist/theme.cjs +25 -24
- package/dist/theme.d.cts +3 -3
- package/dist/theme.d.mts +3 -3
- package/dist/theme.mjs +2 -1
- package/dist/{theme-CDVxig_g.mjs → themes-L-dE7_ck.mjs} +10 -110
- package/dist/{theme-BXlAP3xf.cjs → themes-gd6tcmqS.cjs} +0 -136
- package/dist/useControlled-C666KpQ0.cjs +18 -0
- package/dist/useControlled-CBRLsO-H.mjs +13 -0
- package/dist/{useTablePagination-COTiNH_8.d.mts → useTablePagination-C-u3ru4N.d.cts} +1 -1
- package/dist/{useTablePagination-WFkaUZu8.d.cts → useTablePagination-D-39ZmQh.d.mts} +1 -1
- package/package.json +83 -2
- package/dist/Popover-DwnSLpp1.mjs +0 -253
- package/dist/index-B_dKjEDR.d.mts +0 -23
- package/dist/index-C1WqEDtQ.d.mts +0 -69
- package/dist/index-CA7HnbtH.d.cts +0 -21
- package/dist/index-CKZaErxJ.d.mts +0 -21
- package/dist/index-DBUwu65Z.d.cts +0 -69
- package/dist/index-DzQJSYIh.d.cts +0 -23
- package/dist/index-cuv3o-L7.d.mts +0 -34
- package/dist/index-nB94D7UM.d.cts +0 -34
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
//#region src/Popover/utils/getOffset.ts
|
|
2
|
+
/** Vertical offset within a rect for an anchor/transform origin keyword or explicit px. */
|
|
3
|
+
function getOffsetTop(rect, vertical) {
|
|
4
|
+
if (typeof vertical === "number") return vertical;
|
|
5
|
+
if (vertical === "center") return rect.height / 2;
|
|
6
|
+
if (vertical === "bottom") return rect.height;
|
|
7
|
+
return 0;
|
|
8
|
+
}
|
|
9
|
+
/** Horizontal offset within a rect for an anchor/transform origin keyword or explicit px. */
|
|
10
|
+
function getOffsetLeft(rect, horizontal) {
|
|
11
|
+
if (typeof horizontal === "number") return horizontal;
|
|
12
|
+
if (horizontal === "center") return rect.width / 2;
|
|
13
|
+
if (horizontal === "right") return rect.width;
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/Popover/utils/getTransformOriginValue.ts
|
|
18
|
+
/** Serializes a resolved transform origin (in px) to a CSS `transform-origin` value. */
|
|
19
|
+
function getTransformOriginValue(origin) {
|
|
20
|
+
return `${origin.horizontal}px ${origin.vertical}px`;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/Popover/utils/computePopoverPosition.ts
|
|
24
|
+
/** Mirrors a keyword origin to the opposite edge; numbers and `center` are unchanged. */
|
|
25
|
+
function flipVertical(origin) {
|
|
26
|
+
if (origin === "top") return "bottom";
|
|
27
|
+
if (origin === "bottom") return "top";
|
|
28
|
+
return origin;
|
|
29
|
+
}
|
|
30
|
+
function flipHorizontal(origin) {
|
|
31
|
+
if (origin === "left") return "right";
|
|
32
|
+
if (origin === "right") return "left";
|
|
33
|
+
return origin;
|
|
34
|
+
}
|
|
35
|
+
function resolveAxis({ anchorStart, anchorSize, anchorOrigin, transformOrigin, paperSize, viewportSize, margin, offset, flip }) {
|
|
36
|
+
const preferredTransform = offset(paperSize, transformOrigin);
|
|
37
|
+
const preferredPosition = anchorStart + offset(anchorSize, anchorOrigin) - preferredTransform;
|
|
38
|
+
let position = preferredPosition;
|
|
39
|
+
let transformOffset = preferredTransform;
|
|
40
|
+
if (margin != null) {
|
|
41
|
+
const fits = (candidate) => candidate >= margin && candidate + paperSize <= viewportSize - margin;
|
|
42
|
+
if (!fits(preferredPosition)) {
|
|
43
|
+
const flippedTransform = offset(paperSize, flip(transformOrigin));
|
|
44
|
+
const flippedPosition = anchorStart + offset(anchorSize, flip(anchorOrigin)) - flippedTransform;
|
|
45
|
+
if (fits(flippedPosition)) {
|
|
46
|
+
position = flippedPosition;
|
|
47
|
+
transformOffset = flippedTransform;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (position < margin) {
|
|
51
|
+
const diff = position - margin;
|
|
52
|
+
position -= diff;
|
|
53
|
+
transformOffset += diff;
|
|
54
|
+
} else if (position + paperSize > viewportSize - margin) {
|
|
55
|
+
const diff = position + paperSize - (viewportSize - margin);
|
|
56
|
+
position -= diff;
|
|
57
|
+
transformOffset += diff;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
position,
|
|
62
|
+
transformOffset
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Places the paper so its `transformOrigin` meets the anchor's `anchorOrigin`, flipping
|
|
67
|
+
* to the opposite side at a viewport edge and clamping as a fallback. Returns `null`
|
|
68
|
+
* coordinates for `anchorReference === 'none'`.
|
|
69
|
+
*/
|
|
70
|
+
function computePopoverPosition(params) {
|
|
71
|
+
const { anchorReference, anchorRect, anchorPosition, paperRect, anchorOrigin, transformOrigin, viewport, marginThreshold } = params;
|
|
72
|
+
if (anchorReference === "none") return {
|
|
73
|
+
top: null,
|
|
74
|
+
left: null,
|
|
75
|
+
transformOrigin: getTransformOriginValue({
|
|
76
|
+
vertical: getOffsetTop(paperRect, transformOrigin.vertical),
|
|
77
|
+
horizontal: getOffsetLeft(paperRect, transformOrigin.horizontal)
|
|
78
|
+
})
|
|
79
|
+
};
|
|
80
|
+
const rect = anchorReference === "anchorPosition" ? {
|
|
81
|
+
top: anchorPosition?.top ?? 0,
|
|
82
|
+
left: anchorPosition?.left ?? 0,
|
|
83
|
+
width: 0,
|
|
84
|
+
height: 0
|
|
85
|
+
} : anchorRect ?? {
|
|
86
|
+
top: 0,
|
|
87
|
+
left: 0,
|
|
88
|
+
width: 0,
|
|
89
|
+
height: 0
|
|
90
|
+
};
|
|
91
|
+
const vertical = resolveAxis({
|
|
92
|
+
anchorStart: rect.top,
|
|
93
|
+
anchorSize: rect.height,
|
|
94
|
+
anchorOrigin: anchorOrigin.vertical,
|
|
95
|
+
transformOrigin: transformOrigin.vertical,
|
|
96
|
+
paperSize: paperRect.height,
|
|
97
|
+
viewportSize: viewport.height,
|
|
98
|
+
margin: marginThreshold,
|
|
99
|
+
offset: (size, origin) => getOffsetTop({ height: size }, origin),
|
|
100
|
+
flip: (origin) => flipVertical(origin)
|
|
101
|
+
});
|
|
102
|
+
const horizontal = resolveAxis({
|
|
103
|
+
anchorStart: rect.left,
|
|
104
|
+
anchorSize: rect.width,
|
|
105
|
+
anchorOrigin: anchorOrigin.horizontal,
|
|
106
|
+
transformOrigin: transformOrigin.horizontal,
|
|
107
|
+
paperSize: paperRect.width,
|
|
108
|
+
viewportSize: viewport.width,
|
|
109
|
+
margin: marginThreshold,
|
|
110
|
+
offset: (size, origin) => getOffsetLeft({ width: size }, origin),
|
|
111
|
+
flip: (origin) => flipHorizontal(origin)
|
|
112
|
+
});
|
|
113
|
+
return {
|
|
114
|
+
top: Math.floor(vertical.position),
|
|
115
|
+
left: Math.floor(horizontal.position),
|
|
116
|
+
transformOrigin: getTransformOriginValue({
|
|
117
|
+
vertical: vertical.transformOffset,
|
|
118
|
+
horizontal: horizontal.transformOffset
|
|
119
|
+
})
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
export { computePopoverPosition as t };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
//#region src/Popover/utils/getOffset.ts
|
|
2
|
+
/** Vertical offset within a rect for an anchor/transform origin keyword or explicit px. */
|
|
3
|
+
function getOffsetTop(rect, vertical) {
|
|
4
|
+
if (typeof vertical === "number") return vertical;
|
|
5
|
+
if (vertical === "center") return rect.height / 2;
|
|
6
|
+
if (vertical === "bottom") return rect.height;
|
|
7
|
+
return 0;
|
|
8
|
+
}
|
|
9
|
+
/** Horizontal offset within a rect for an anchor/transform origin keyword or explicit px. */
|
|
10
|
+
function getOffsetLeft(rect, horizontal) {
|
|
11
|
+
if (typeof horizontal === "number") return horizontal;
|
|
12
|
+
if (horizontal === "center") return rect.width / 2;
|
|
13
|
+
if (horizontal === "right") return rect.width;
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/Popover/utils/getTransformOriginValue.ts
|
|
18
|
+
/** Serializes a resolved transform origin (in px) to a CSS `transform-origin` value. */
|
|
19
|
+
function getTransformOriginValue(origin) {
|
|
20
|
+
return `${origin.horizontal}px ${origin.vertical}px`;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/Popover/utils/computePopoverPosition.ts
|
|
24
|
+
/** Mirrors a keyword origin to the opposite edge; numbers and `center` are unchanged. */
|
|
25
|
+
function flipVertical(origin) {
|
|
26
|
+
if (origin === "top") return "bottom";
|
|
27
|
+
if (origin === "bottom") return "top";
|
|
28
|
+
return origin;
|
|
29
|
+
}
|
|
30
|
+
function flipHorizontal(origin) {
|
|
31
|
+
if (origin === "left") return "right";
|
|
32
|
+
if (origin === "right") return "left";
|
|
33
|
+
return origin;
|
|
34
|
+
}
|
|
35
|
+
function resolveAxis({ anchorStart, anchorSize, anchorOrigin, transformOrigin, paperSize, viewportSize, margin, offset, flip }) {
|
|
36
|
+
const preferredTransform = offset(paperSize, transformOrigin);
|
|
37
|
+
const preferredPosition = anchorStart + offset(anchorSize, anchorOrigin) - preferredTransform;
|
|
38
|
+
let position = preferredPosition;
|
|
39
|
+
let transformOffset = preferredTransform;
|
|
40
|
+
if (margin != null) {
|
|
41
|
+
const fits = (candidate) => candidate >= margin && candidate + paperSize <= viewportSize - margin;
|
|
42
|
+
if (!fits(preferredPosition)) {
|
|
43
|
+
const flippedTransform = offset(paperSize, flip(transformOrigin));
|
|
44
|
+
const flippedPosition = anchorStart + offset(anchorSize, flip(anchorOrigin)) - flippedTransform;
|
|
45
|
+
if (fits(flippedPosition)) {
|
|
46
|
+
position = flippedPosition;
|
|
47
|
+
transformOffset = flippedTransform;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (position < margin) {
|
|
51
|
+
const diff = position - margin;
|
|
52
|
+
position -= diff;
|
|
53
|
+
transformOffset += diff;
|
|
54
|
+
} else if (position + paperSize > viewportSize - margin) {
|
|
55
|
+
const diff = position + paperSize - (viewportSize - margin);
|
|
56
|
+
position -= diff;
|
|
57
|
+
transformOffset += diff;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
position,
|
|
62
|
+
transformOffset
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Places the paper so its `transformOrigin` meets the anchor's `anchorOrigin`, flipping
|
|
67
|
+
* to the opposite side at a viewport edge and clamping as a fallback. Returns `null`
|
|
68
|
+
* coordinates for `anchorReference === 'none'`.
|
|
69
|
+
*/
|
|
70
|
+
function computePopoverPosition(params) {
|
|
71
|
+
const { anchorReference, anchorRect, anchorPosition, paperRect, anchorOrigin, transformOrigin, viewport, marginThreshold } = params;
|
|
72
|
+
if (anchorReference === "none") return {
|
|
73
|
+
top: null,
|
|
74
|
+
left: null,
|
|
75
|
+
transformOrigin: getTransformOriginValue({
|
|
76
|
+
vertical: getOffsetTop(paperRect, transformOrigin.vertical),
|
|
77
|
+
horizontal: getOffsetLeft(paperRect, transformOrigin.horizontal)
|
|
78
|
+
})
|
|
79
|
+
};
|
|
80
|
+
const rect = anchorReference === "anchorPosition" ? {
|
|
81
|
+
top: anchorPosition?.top ?? 0,
|
|
82
|
+
left: anchorPosition?.left ?? 0,
|
|
83
|
+
width: 0,
|
|
84
|
+
height: 0
|
|
85
|
+
} : anchorRect ?? {
|
|
86
|
+
top: 0,
|
|
87
|
+
left: 0,
|
|
88
|
+
width: 0,
|
|
89
|
+
height: 0
|
|
90
|
+
};
|
|
91
|
+
const vertical = resolveAxis({
|
|
92
|
+
anchorStart: rect.top,
|
|
93
|
+
anchorSize: rect.height,
|
|
94
|
+
anchorOrigin: anchorOrigin.vertical,
|
|
95
|
+
transformOrigin: transformOrigin.vertical,
|
|
96
|
+
paperSize: paperRect.height,
|
|
97
|
+
viewportSize: viewport.height,
|
|
98
|
+
margin: marginThreshold,
|
|
99
|
+
offset: (size, origin) => getOffsetTop({ height: size }, origin),
|
|
100
|
+
flip: (origin) => flipVertical(origin)
|
|
101
|
+
});
|
|
102
|
+
const horizontal = resolveAxis({
|
|
103
|
+
anchorStart: rect.left,
|
|
104
|
+
anchorSize: rect.width,
|
|
105
|
+
anchorOrigin: anchorOrigin.horizontal,
|
|
106
|
+
transformOrigin: transformOrigin.horizontal,
|
|
107
|
+
paperSize: paperRect.width,
|
|
108
|
+
viewportSize: viewport.width,
|
|
109
|
+
margin: marginThreshold,
|
|
110
|
+
offset: (size, origin) => getOffsetLeft({ width: size }, origin),
|
|
111
|
+
flip: (origin) => flipHorizontal(origin)
|
|
112
|
+
});
|
|
113
|
+
return {
|
|
114
|
+
top: Math.floor(vertical.position),
|
|
115
|
+
left: Math.floor(horizontal.position),
|
|
116
|
+
transformOrigin: getTransformOriginValue({
|
|
117
|
+
vertical: vertical.transformOffset,
|
|
118
|
+
horizontal: horizontal.transformOffset
|
|
119
|
+
})
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
Object.defineProperty(exports, "computePopoverPosition", {
|
|
124
|
+
enumerable: true,
|
|
125
|
+
get: function() {
|
|
126
|
+
return computePopoverPosition;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const require_src = require("./src-DU81aGy9.cjs");
|
|
2
|
+
let react = require("react");
|
|
3
|
+
//#region src/Tabs/TabsContext.ts
|
|
4
|
+
const TabsContext = (0, react.createContext)(null);
|
|
5
|
+
/** Each tab's position among its siblings - its value when it has none of its own. */
|
|
6
|
+
const TabIndexContext = (0, react.createContext)(0);
|
|
7
|
+
function useTabsContext() {
|
|
8
|
+
const tabs = (0, react.useContext)(TabsContext);
|
|
9
|
+
if (!tabs) throw new Error("A Tab must be inside Tabs.");
|
|
10
|
+
return tabs;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/Tabs/utils/dividerLine.ts
|
|
14
|
+
/**
|
|
15
|
+
* The divider - the line along a row of tabs' foot, a column's end side - as an inset shadow,
|
|
16
|
+
* so it adds no size and runs unbroken across the pieces that each draw a stretch of it.
|
|
17
|
+
*/
|
|
18
|
+
const getDividerShadow = (theme, isVertical, color) => {
|
|
19
|
+
const thin = theme.borderWidths.thin;
|
|
20
|
+
return `inset ${isVertical ? `-${thin} 0` : `0 -${thin}`} 0 ${color}`;
|
|
21
|
+
};
|
|
22
|
+
/** The divider's color: the accent in the enclosed look, which outlines the tab in it too. */
|
|
23
|
+
const getDividerColor = (theme, variant, color) => variant === "enclosed" ? (0, require_src.src_exports.get)(theme, `palette.${color}.main`) : (0, require_src.src_exports.get)(theme, "border.light");
|
|
24
|
+
/**
|
|
25
|
+
* The stretch of the divider an enclosed row's piece draws - its content, a scroll button, an
|
|
26
|
+
* end of the list. The enclosed look draws the line piece by piece, so the selected tab can
|
|
27
|
+
* leave its own piece out.
|
|
28
|
+
*/
|
|
29
|
+
const getEnclosedPieceStyle = (theme, { variant, color, orientation, hasDivider }) => hasDivider && variant === "enclosed" ? { boxShadow: getDividerShadow(theme, orientation === "vertical", getDividerColor(theme, variant, color)) } : {};
|
|
30
|
+
//#endregion
|
|
31
|
+
Object.defineProperty(exports, "TabIndexContext", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function() {
|
|
34
|
+
return TabIndexContext;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "TabsContext", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function() {
|
|
40
|
+
return TabsContext;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "getDividerColor", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function() {
|
|
46
|
+
return getDividerColor;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, "getDividerShadow", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function() {
|
|
52
|
+
return getDividerShadow;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "getEnclosedPieceStyle", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function() {
|
|
58
|
+
return getEnclosedPieceStyle;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(exports, "useTabsContext", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function() {
|
|
64
|
+
return useTabsContext;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { a as src_exports } from "./src-DLGYOJMh.mjs";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
//#region src/Tabs/TabsContext.ts
|
|
4
|
+
const TabsContext = createContext(null);
|
|
5
|
+
/** Each tab's position among its siblings - its value when it has none of its own. */
|
|
6
|
+
const TabIndexContext = createContext(0);
|
|
7
|
+
function useTabsContext() {
|
|
8
|
+
const tabs = useContext(TabsContext);
|
|
9
|
+
if (!tabs) throw new Error("A Tab must be inside Tabs.");
|
|
10
|
+
return tabs;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/Tabs/utils/dividerLine.ts
|
|
14
|
+
/**
|
|
15
|
+
* The divider - the line along a row of tabs' foot, a column's end side - as an inset shadow,
|
|
16
|
+
* so it adds no size and runs unbroken across the pieces that each draw a stretch of it.
|
|
17
|
+
*/
|
|
18
|
+
const getDividerShadow = (theme, isVertical, color) => {
|
|
19
|
+
const thin = theme.borderWidths.thin;
|
|
20
|
+
return `inset ${isVertical ? `-${thin} 0` : `0 -${thin}`} 0 ${color}`;
|
|
21
|
+
};
|
|
22
|
+
/** The divider's color: the accent in the enclosed look, which outlines the tab in it too. */
|
|
23
|
+
const getDividerColor = (theme, variant, color) => variant === "enclosed" ? (0, src_exports.get)(theme, `palette.${color}.main`) : (0, src_exports.get)(theme, "border.light");
|
|
24
|
+
/**
|
|
25
|
+
* The stretch of the divider an enclosed row's piece draws - its content, a scroll button, an
|
|
26
|
+
* end of the list. The enclosed look draws the line piece by piece, so the selected tab can
|
|
27
|
+
* leave its own piece out.
|
|
28
|
+
*/
|
|
29
|
+
const getEnclosedPieceStyle = (theme, { variant, color, orientation, hasDivider }) => hasDivider && variant === "enclosed" ? { boxShadow: getDividerShadow(theme, orientation === "vertical", getDividerColor(theme, variant, color)) } : {};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { TabsContext as a, TabIndexContext as i, getDividerShadow as n, useTabsContext as o, getEnclosedPieceStyle as r, getDividerColor as t };
|
package/dist/engine.d.cts
CHANGED
package/dist/engine.d.mts
CHANGED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { W as Theme } from "./index-CJhK7JND.mjs";
|
|
2
|
+
import { t as MenuItemValue } from "./MenuListContext-x-7lH4CH.mjs";
|
|
3
|
+
import { ElementType, KeyboardEvent, MouseEvent, ReactNode } from "react";
|
|
4
|
+
//#region src/MenuItem/MenuItem.d.ts
|
|
5
|
+
type MenuItemColor = keyof Theme['palette'];
|
|
6
|
+
type MenuItemSize = keyof Theme['sizes'];
|
|
7
|
+
type MenuItemTextColor = keyof Theme['text'];
|
|
8
|
+
/** A menu row's role: a command, the current choice of a group, or an on/off setting. */
|
|
9
|
+
type MenuItemRole = 'menuitem' | 'menuitemradio' | 'menuitemcheckbox';
|
|
10
|
+
interface MenuItemProps {
|
|
11
|
+
/** The value this row represents - reported to `Select`'s `onChange`, or `MenuList`'s `onSelect`. Required inside a `Select`. */
|
|
12
|
+
value?: MenuItemValue;
|
|
13
|
+
/** The row label. */
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
/** The element used for the root node - a tag name or a component. Default: `'li'`. */
|
|
16
|
+
as?: ElementType;
|
|
17
|
+
/** Disables the row - it cannot be highlighted or chosen. In a menu the keys skip it. */
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/** Marks the row as the current selection. Injected by `Select`; in a menu it sets `aria-checked` on `menuitemradio` / `menuitemcheckbox` rows. */
|
|
20
|
+
selected?: boolean;
|
|
21
|
+
/** Marks the option as the keyboard-highlighted row. Injected by `Select`. */
|
|
22
|
+
highlighted?: boolean;
|
|
23
|
+
/** Reserves a leading checkmark slot for multi-select menus. Injected by `Select`. */
|
|
24
|
+
multiple?: boolean;
|
|
25
|
+
/** Accent color - resolves to `theme.palette[color]`. Injected by `Select` or `MenuList`; the item's own value wins. Default: 'primary', overridable via `theme.defaults.color`. */
|
|
26
|
+
color?: MenuItemColor;
|
|
27
|
+
/** Base text color of the row - resolves against `theme.text`. When unset, falls back to the accent color's `main`. Injected by `Select` or `MenuList`; the item's own value wins. */
|
|
28
|
+
textColor?: MenuItemTextColor;
|
|
29
|
+
/** Density token - resolves against `theme.sizes`. Injected by `Select` or `MenuList`. Default: 'md', overridable via `theme.defaults.size`. */
|
|
30
|
+
size?: MenuItemSize;
|
|
31
|
+
/** Compact vertical padding, independent of `size`. Default: `false`. */
|
|
32
|
+
dense?: boolean;
|
|
33
|
+
/** Remove the left and right padding. Default: `false`. */
|
|
34
|
+
disableGutters?: boolean;
|
|
35
|
+
/** Add a 1px bottom border to separate the row. Default: `false`. */
|
|
36
|
+
divider?: boolean;
|
|
37
|
+
/** Focus the row on first mount, and whenever `autoFocus` flips from `false` to `true`. Default: `false`. */
|
|
38
|
+
autoFocus?: boolean;
|
|
39
|
+
/** Class applied only while the row has keyboard focus - a `:focus-visible` hook. */
|
|
40
|
+
focusVisibleClassName?: string;
|
|
41
|
+
/** Fired with `value` when the option is chosen. Injected by `Select`. */
|
|
42
|
+
onSelect?: (value: MenuItemValue) => void;
|
|
43
|
+
/** Menu only: the row's role. Default: `'menuitem'`. */
|
|
44
|
+
role?: MenuItemRole;
|
|
45
|
+
/** Menu only: an icon in the leading column. Every row keeps the column, so labels line up; a selected checkable row shows a tick there. */
|
|
46
|
+
startIcon?: ReactNode;
|
|
47
|
+
/** Menu only: the row's keyboard shortcut, shown at its end. A string is also given to the row as `aria-keyshortcuts`. */
|
|
48
|
+
shortcut?: ReactNode;
|
|
49
|
+
/** Menu only: why the row is off - its tooltip and accessible description. */
|
|
50
|
+
note?: string;
|
|
51
|
+
/** Menu only: fired when the row is chosen, by a click, Enter or Space. */
|
|
52
|
+
onClick?: (event: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;
|
|
53
|
+
/** Menu only: the rows of a submenu this row opens. `null` or `[]` is a submenu with nothing in it yet - see `emptyLabel`. */
|
|
54
|
+
submenu?: ReactNode;
|
|
55
|
+
/** Menu only: shown as one disabled row in an empty submenu ("Coming soon"). Without it, the submenu stays empty. */
|
|
56
|
+
emptyLabel?: ReactNode;
|
|
57
|
+
/** Menu only: a control of the row's own beside it - a close button. It sits in the row's `role="none"` entry, out of the arrow keys and hidden from assistive technology (a menu owns rows alone), so it is the pointer's: give it `tabIndex={-1}`, and the row a key of its own through `MenuList`'s `onKeyDown`. */
|
|
58
|
+
secondaryAction?: ReactNode;
|
|
59
|
+
id?: string;
|
|
60
|
+
className?: string;
|
|
61
|
+
'data-testid'?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @description A row of a list. Inside a `MenuList` it is a menu row - a `menuitem`
|
|
65
|
+
* (or `menuitemradio` / `menuitemcheckbox`) with a leading icon column, its label and a
|
|
66
|
+
* trailing shortcut, chosen by a click, Enter or Space. Anywhere else it is `Select`'s
|
|
67
|
+
* `<li role="option">` (override via `as`), whose selection, highlight and density props
|
|
68
|
+
* `Select` injects; used on its own it renders a static, styled row.
|
|
69
|
+
*/
|
|
70
|
+
declare function MenuItem({ value, children, as, disabled, selected, highlighted, multiple, color: colorProp, textColor: textColorProp, size: sizeProp, dense: denseProp, disableGutters, divider, autoFocus, focusVisibleClassName, onSelect, role, startIcon, shortcut, note, onClick, submenu, emptyLabel, secondaryAction, id, className, 'data-testid': dataTestid }: Readonly<MenuItemProps>): import("react").JSX.Element;
|
|
71
|
+
//#endregion
|
|
72
|
+
export { MenuItemSize as a, MenuItemRole as i, MenuItemColor as n, MenuItemTextColor as o, MenuItemProps as r, MenuItem as t };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { W as Theme } from "./index-DJ0f69wh.cjs";
|
|
2
|
+
import { t as MenuItemValue } from "./MenuListContext-DKUOhNyw.cjs";
|
|
3
|
+
import { ElementType, KeyboardEvent, MouseEvent, ReactNode } from "react";
|
|
4
|
+
//#region src/MenuItem/MenuItem.d.ts
|
|
5
|
+
type MenuItemColor = keyof Theme['palette'];
|
|
6
|
+
type MenuItemSize = keyof Theme['sizes'];
|
|
7
|
+
type MenuItemTextColor = keyof Theme['text'];
|
|
8
|
+
/** A menu row's role: a command, the current choice of a group, or an on/off setting. */
|
|
9
|
+
type MenuItemRole = 'menuitem' | 'menuitemradio' | 'menuitemcheckbox';
|
|
10
|
+
interface MenuItemProps {
|
|
11
|
+
/** The value this row represents - reported to `Select`'s `onChange`, or `MenuList`'s `onSelect`. Required inside a `Select`. */
|
|
12
|
+
value?: MenuItemValue;
|
|
13
|
+
/** The row label. */
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
/** The element used for the root node - a tag name or a component. Default: `'li'`. */
|
|
16
|
+
as?: ElementType;
|
|
17
|
+
/** Disables the row - it cannot be highlighted or chosen. In a menu the keys skip it. */
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/** Marks the row as the current selection. Injected by `Select`; in a menu it sets `aria-checked` on `menuitemradio` / `menuitemcheckbox` rows. */
|
|
20
|
+
selected?: boolean;
|
|
21
|
+
/** Marks the option as the keyboard-highlighted row. Injected by `Select`. */
|
|
22
|
+
highlighted?: boolean;
|
|
23
|
+
/** Reserves a leading checkmark slot for multi-select menus. Injected by `Select`. */
|
|
24
|
+
multiple?: boolean;
|
|
25
|
+
/** Accent color - resolves to `theme.palette[color]`. Injected by `Select` or `MenuList`; the item's own value wins. Default: 'primary', overridable via `theme.defaults.color`. */
|
|
26
|
+
color?: MenuItemColor;
|
|
27
|
+
/** Base text color of the row - resolves against `theme.text`. When unset, falls back to the accent color's `main`. Injected by `Select` or `MenuList`; the item's own value wins. */
|
|
28
|
+
textColor?: MenuItemTextColor;
|
|
29
|
+
/** Density token - resolves against `theme.sizes`. Injected by `Select` or `MenuList`. Default: 'md', overridable via `theme.defaults.size`. */
|
|
30
|
+
size?: MenuItemSize;
|
|
31
|
+
/** Compact vertical padding, independent of `size`. Default: `false`. */
|
|
32
|
+
dense?: boolean;
|
|
33
|
+
/** Remove the left and right padding. Default: `false`. */
|
|
34
|
+
disableGutters?: boolean;
|
|
35
|
+
/** Add a 1px bottom border to separate the row. Default: `false`. */
|
|
36
|
+
divider?: boolean;
|
|
37
|
+
/** Focus the row on first mount, and whenever `autoFocus` flips from `false` to `true`. Default: `false`. */
|
|
38
|
+
autoFocus?: boolean;
|
|
39
|
+
/** Class applied only while the row has keyboard focus - a `:focus-visible` hook. */
|
|
40
|
+
focusVisibleClassName?: string;
|
|
41
|
+
/** Fired with `value` when the option is chosen. Injected by `Select`. */
|
|
42
|
+
onSelect?: (value: MenuItemValue) => void;
|
|
43
|
+
/** Menu only: the row's role. Default: `'menuitem'`. */
|
|
44
|
+
role?: MenuItemRole;
|
|
45
|
+
/** Menu only: an icon in the leading column. Every row keeps the column, so labels line up; a selected checkable row shows a tick there. */
|
|
46
|
+
startIcon?: ReactNode;
|
|
47
|
+
/** Menu only: the row's keyboard shortcut, shown at its end. A string is also given to the row as `aria-keyshortcuts`. */
|
|
48
|
+
shortcut?: ReactNode;
|
|
49
|
+
/** Menu only: why the row is off - its tooltip and accessible description. */
|
|
50
|
+
note?: string;
|
|
51
|
+
/** Menu only: fired when the row is chosen, by a click, Enter or Space. */
|
|
52
|
+
onClick?: (event: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;
|
|
53
|
+
/** Menu only: the rows of a submenu this row opens. `null` or `[]` is a submenu with nothing in it yet - see `emptyLabel`. */
|
|
54
|
+
submenu?: ReactNode;
|
|
55
|
+
/** Menu only: shown as one disabled row in an empty submenu ("Coming soon"). Without it, the submenu stays empty. */
|
|
56
|
+
emptyLabel?: ReactNode;
|
|
57
|
+
/** Menu only: a control of the row's own beside it - a close button. It sits in the row's `role="none"` entry, out of the arrow keys and hidden from assistive technology (a menu owns rows alone), so it is the pointer's: give it `tabIndex={-1}`, and the row a key of its own through `MenuList`'s `onKeyDown`. */
|
|
58
|
+
secondaryAction?: ReactNode;
|
|
59
|
+
id?: string;
|
|
60
|
+
className?: string;
|
|
61
|
+
'data-testid'?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @description A row of a list. Inside a `MenuList` it is a menu row - a `menuitem`
|
|
65
|
+
* (or `menuitemradio` / `menuitemcheckbox`) with a leading icon column, its label and a
|
|
66
|
+
* trailing shortcut, chosen by a click, Enter or Space. Anywhere else it is `Select`'s
|
|
67
|
+
* `<li role="option">` (override via `as`), whose selection, highlight and density props
|
|
68
|
+
* `Select` injects; used on its own it renders a static, styled row.
|
|
69
|
+
*/
|
|
70
|
+
declare function MenuItem({ value, children, as, disabled, selected, highlighted, multiple, color: colorProp, textColor: textColorProp, size: sizeProp, dense: denseProp, disableGutters, divider, autoFocus, focusVisibleClassName, onSelect, role, startIcon, shortcut, note, onClick, submenu, emptyLabel, secondaryAction, id, className, 'data-testid': dataTestid }: Readonly<MenuItemProps>): import("react").JSX.Element;
|
|
71
|
+
//#endregion
|
|
72
|
+
export { MenuItemSize as a, MenuItemRole as i, MenuItemColor as n, MenuItemTextColor as o, MenuItemProps as r, MenuItem as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./index-C1WqEDtQ.mjs";
|
|
1
|
+
import { P as PaletteColor, W as Theme } from "./index-CJhK7JND.mjs";
|
|
3
2
|
import { SpaceProps } from "@soroush.tech/styled-system";
|
|
4
3
|
import { ButtonHTMLAttributes, ElementType, ReactNode } from "react";
|
|
5
4
|
//#region src/Pagination/hooks/usePagination.d.ts
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./index-
|
|
3
|
-
import { a as PaginationItemSize, i as PaginationItemShape, l as UsePaginationProps, n as PaginationItemColor, o as PaginationItemVariant, s as PaginationItemType } from "./index-DdqdSOct.cjs";
|
|
1
|
+
import { W as Theme } from "./index-DJ0f69wh.cjs";
|
|
2
|
+
import { a as PaginationItemSize, i as PaginationItemShape, l as UsePaginationProps, n as PaginationItemColor, o as PaginationItemVariant, s as PaginationItemType } from "./index-ChXeKJCk.cjs";
|
|
4
3
|
import { HTMLAttributes } from "react";
|
|
5
4
|
import { SpaceProps } from "@soroush.tech/styled-system";
|
|
6
5
|
//#region src/Pagination/Pagination.d.ts
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./index-
|
|
3
|
-
import { a as PaginationItemSize, i as PaginationItemShape, l as UsePaginationProps, n as PaginationItemColor, o as PaginationItemVariant, s as PaginationItemType } from "./index-BUoVTCqX.mjs";
|
|
1
|
+
import { W as Theme } from "./index-CJhK7JND.mjs";
|
|
2
|
+
import { a as PaginationItemSize, i as PaginationItemShape, l as UsePaginationProps, n as PaginationItemColor, o as PaginationItemVariant, s as PaginationItemType } from "./index-BGbTuHP9.mjs";
|
|
4
3
|
import { SpaceProps } from "@soroush.tech/styled-system";
|
|
5
4
|
import { HTMLAttributes } from "react";
|
|
6
5
|
//#region src/Pagination/Pagination.d.ts
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./
|
|
3
|
-
import { t as TableCellPadding } from "./TableContext-BeCxbtHH.cjs";
|
|
1
|
+
import { W as Theme } from "./index-DJ0f69wh.cjs";
|
|
2
|
+
import { t as TableCellPadding } from "./TableContext-Duj1nVG7.cjs";
|
|
4
3
|
import { ElementType, ThHTMLAttributes } from "react";
|
|
5
4
|
import { BorderProps, SpaceProps, TypographyProps } from "@soroush.tech/styled-system";
|
|
6
5
|
//#region src/Table/TableSectionContext.d.ts
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { t as MenuItemValue } from "./MenuListContext-x-7lH4CH.mjs";
|
|
2
|
+
import { i as MenuItemRole } from "./index-B1RFybA_.mjs";
|
|
3
|
+
import { KeyboardEvent, MouseEvent, ReactNode } from "react";
|
|
4
|
+
//#region src/Menu/MenuItems/MenuItems.d.ts
|
|
5
|
+
/** A menu row as data - what a `MenuItem` takes, with its label as `label`. */
|
|
6
|
+
interface MenuItemRowData {
|
|
7
|
+
value?: MenuItemValue;
|
|
8
|
+
label: ReactNode;
|
|
9
|
+
role?: MenuItemRole;
|
|
10
|
+
selected?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
startIcon?: ReactNode;
|
|
13
|
+
shortcut?: ReactNode;
|
|
14
|
+
note?: string;
|
|
15
|
+
onClick?: (event: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;
|
|
16
|
+
/** The rows of this row's submenu; `null` or `[]` is an empty one. */
|
|
17
|
+
submenu?: MenuItemData[] | null;
|
|
18
|
+
emptyLabel?: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
/** A divider between groups of rows. */
|
|
21
|
+
interface MenuDividerData {
|
|
22
|
+
type: 'divider';
|
|
23
|
+
}
|
|
24
|
+
type MenuItemData = MenuItemRowData | MenuDividerData;
|
|
25
|
+
interface MenuItemsProps {
|
|
26
|
+
items: readonly MenuItemData[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @description Menu rows from data: each entry a `MenuItem` (its label as `label`, its
|
|
30
|
+
* submenu as more entries) or `{ type: 'divider' }`. It renders the same rows JSX children
|
|
31
|
+
* would, so the two behave alike - inside a `MenuList`, a `Menu` or a `ContextMenu`.
|
|
32
|
+
*/
|
|
33
|
+
declare function MenuItems({ items }: Readonly<MenuItemsProps>): import("react").JSX.Element[];
|
|
34
|
+
//#endregion
|
|
35
|
+
export { MenuItemsProps as a, MenuItems as i, MenuItemData as n, MenuItemRowData as r, MenuDividerData as t };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./index-
|
|
3
|
-
import { n as ButtonColor, o as ButtonSize, s as ButtonVariant } from "./index-BhibLnZ0.cjs";
|
|
4
|
-
import { ElementType, HTMLAttributes } from "react";
|
|
1
|
+
import { W as Theme } from "./index-CJhK7JND.mjs";
|
|
2
|
+
import { n as ButtonColor, o as ButtonSize, s as ButtonVariant } from "./index-CG_1uPrD.mjs";
|
|
5
3
|
import { SpaceProps } from "@soroush.tech/styled-system";
|
|
4
|
+
import { ElementType, HTMLAttributes } from "react";
|
|
6
5
|
//#region src/ButtonGroup/ButtonGroup.d.ts
|
|
7
6
|
type ButtonGroupOrientation = 'horizontal' | 'vertical';
|
|
8
7
|
type ButtonGroupRadius = keyof Theme['radii'];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./index-C1WqEDtQ.mjs";
|
|
1
|
+
import { W as Theme } from "./index-CJhK7JND.mjs";
|
|
3
2
|
import { KeyboardEvent, MouseEvent, ReactNode, Ref, RefCallback, SyntheticEvent } from "react";
|
|
4
3
|
//#region src/Modal/useModal.d.ts
|
|
5
4
|
type ModalCloseReason = 'escapeKey' | 'backdropClick';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index-DJ0f69wh.cjs";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./
|
|
3
|
-
import { t as TableCellPadding } from "./TableContext-BiRiYkVZ.mjs";
|
|
1
|
+
import { W as Theme } from "./index-CJhK7JND.mjs";
|
|
2
|
+
import { t as TableCellPadding } from "./TableContext-DhuRf6Wy.mjs";
|
|
4
3
|
import { BorderProps, SpaceProps, TypographyProps } from "@soroush.tech/styled-system";
|
|
5
4
|
import { ElementType, ThHTMLAttributes } from "react";
|
|
6
5
|
//#region src/Table/TableSectionContext.d.ts
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { W as Theme } from "./index-CJhK7JND.mjs";
|
|
2
|
+
import { MouseEvent, ReactNode } from "react";
|
|
3
|
+
//#region src/Tabs/TabScrollButton/TabScrollButton.d.ts
|
|
4
|
+
/** Which way a scroll button scrolls a row of tabs: towards its start, or its end. */
|
|
5
|
+
type TabScrollDirection = 'start' | 'end';
|
|
6
|
+
interface TabScrollButtonProps {
|
|
7
|
+
/** Which way it scrolls the row: towards its start, or its end. */
|
|
8
|
+
direction: TabScrollDirection;
|
|
9
|
+
/** The row's orientation. Default: its `Tabs`', else `'horizontal'`. */
|
|
10
|
+
orientation?: 'horizontal' | 'vertical';
|
|
11
|
+
/** There is nowhere further to scroll this way - kept, but off. */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** There is nowhere further to scroll this way - hidden, keeping its room. */
|
|
14
|
+
isHidden?: boolean;
|
|
15
|
+
/** Its stretch of an enclosed row's divider - resolves to `theme.palette`. Default: the row's line, the selected tab's color. */
|
|
16
|
+
color?: keyof Theme['palette'];
|
|
17
|
+
/** The chevron's color - resolves against `theme.text`. Default: its `Tabs`' `textColor`, else `'primary'`. */
|
|
18
|
+
textColor?: keyof Theme['text'];
|
|
19
|
+
/** Fired when it is pressed. In a `Tabs`, it scrolls the row by its visible size. */
|
|
20
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
21
|
+
/** What it shows. Default: a chevron pointing the way it scrolls. */
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
className?: string;
|
|
24
|
+
'data-testid'?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @description The button that scrolls a row of tabs - a `Tabs` shows one at each end while its
|
|
28
|
+
* tabs overflow (`overflowBehavior="scroll"`). Out of the tab order and hidden from assistive
|
|
29
|
+
* technology: the arrow keys already reach every tab. A `Tabs` takes another in its place with
|
|
30
|
+
* `slots={{ scrollButton }}`, given these same props.
|
|
31
|
+
*/
|
|
32
|
+
declare function TabScrollButton({ direction, orientation, disabled, isHidden, color: colorProp, textColor: textColorProp, onClick, children, className, 'data-testid': dataTestid }: Readonly<TabScrollButtonProps>): import("react").JSX.Element;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { TabScrollButtonProps as n, TabScrollDirection as r, TabScrollButton as t };
|