@soroush.tech/design-system 2.0.0 → 2.1.0-alpha.1
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/dist/Accordion/Accordion.d.cts +2 -2
- package/dist/Accordion/Accordion.d.mts +2 -2
- package/dist/Accordion/AccordionGroup.d.cts +1 -1
- package/dist/Accordion/AccordionGroup.d.mts +1 -1
- package/dist/Alert/Alert.d.cts +1 -1
- package/dist/Alert/Alert.d.mts +1 -1
- package/dist/AppBar.d.cts +1 -1
- package/dist/AppBar.d.mts +1 -1
- package/dist/Autocomplete.cjs +1 -1
- package/dist/Autocomplete.d.cts +1 -1
- package/dist/Autocomplete.d.mts +1 -1
- package/dist/Autocomplete.mjs +1 -1
- package/dist/Avatar.d.cts +1 -1
- package/dist/Avatar.d.mts +1 -1
- package/dist/Backdrop.d.cts +1 -1
- package/dist/Backdrop.d.mts +1 -1
- package/dist/Badge.d.cts +1 -1
- package/dist/Badge.d.mts +1 -1
- package/dist/Breadcrumbs.d.cts +3 -3
- package/dist/Breadcrumbs.d.mts +3 -3
- package/dist/Button.d.cts +1 -1
- package/dist/Button.d.mts +1 -1
- package/dist/ButtonGroup.d.cts +1 -1
- package/dist/ButtonGroup.d.mts +1 -1
- package/dist/Card.d.cts +4 -4
- package/dist/Card.d.mts +4 -4
- package/dist/Checkbox.d.cts +1 -1
- package/dist/Checkbox.d.mts +1 -1
- package/dist/Chip.d.cts +1 -1
- package/dist/Chip.d.mts +1 -1
- package/dist/CircularProgress.d.cts +2 -2
- package/dist/CircularProgress.d.mts +2 -2
- package/dist/Collapse.d.cts +1 -1
- package/dist/Collapse.d.mts +1 -1
- package/dist/Drawer.d.cts +3 -3
- package/dist/Drawer.d.mts +3 -3
- package/dist/Fab.d.cts +1 -1
- package/dist/Fab.d.mts +1 -1
- package/dist/FabMenu/FabMenu.d.cts +1 -1
- package/dist/FabMenu/FabMenu.d.mts +1 -1
- package/dist/FabMenu/FabMenuItem.d.cts +1 -1
- package/dist/FabMenu/FabMenuItem.d.mts +1 -1
- package/dist/Fade.d.cts +1 -1
- package/dist/Fade.d.mts +1 -1
- 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.d.cts +1 -1
- package/dist/FormControl.d.mts +1 -1
- package/dist/FormHelperText.d.cts +1 -1
- package/dist/FormHelperText.d.mts +1 -1
- package/dist/FormLabel.d.cts +1 -1
- package/dist/FormLabel.d.mts +1 -1
- package/dist/Grid.d.cts +1 -1
- package/dist/Grid.d.mts +1 -1
- package/dist/Grow.d.cts +1 -1
- package/dist/Grow.d.mts +1 -1
- package/dist/Icon.d.cts +1 -1
- package/dist/Icon.d.mts +1 -1
- package/dist/Image.d.cts +1 -1
- package/dist/Image.d.mts +1 -1
- package/dist/LinearProgress.d.cts +2 -2
- package/dist/LinearProgress.d.mts +2 -2
- package/dist/Link.d.cts +1 -1
- package/dist/Link.d.mts +1 -1
- package/dist/Menu/ContextMenu.cjs +23 -14
- package/dist/Menu/ContextMenu.d.cts +18 -8
- package/dist/Menu/ContextMenu.d.mts +18 -8
- package/dist/Menu/ContextMenu.mjs +24 -15
- package/dist/Menu/Menu.cjs +1 -1
- package/dist/Menu/Menu.d.cts +1 -1
- package/dist/Menu/Menu.d.mts +1 -1
- package/dist/Menu/Menu.mjs +1 -1
- package/dist/Menu/MenuItems.cjs +1 -1
- package/dist/Menu/MenuItems.d.cts +1 -1
- package/dist/Menu/MenuItems.d.mts +1 -1
- package/dist/Menu/MenuItems.mjs +1 -1
- package/dist/Menu/MenuList.cjs +1 -1
- package/dist/Menu/MenuList.d.cts +3 -36
- package/dist/Menu/MenuList.d.mts +3 -36
- package/dist/Menu/MenuList.mjs +1 -1
- package/dist/{Menu-Bx9jaHOy.cjs → Menu-C6eIdA1J.cjs} +8 -5
- package/dist/{Menu-D4AIpdJv.mjs → Menu-C_4jYHWE.mjs} +8 -5
- package/dist/Menu.cjs +2 -2
- package/dist/Menu.d.cts +5 -5
- package/dist/Menu.d.mts +5 -5
- package/dist/Menu.mjs +2 -2
- package/dist/{MenuItem-DXRw3Yca.cjs → MenuItem-Bg4iRvVe.cjs} +29 -26
- package/dist/{MenuItem-vXHGPK8g.mjs → MenuItem-kRGVRI6G.mjs} +29 -26
- package/dist/MenuItem.cjs +1 -1
- package/dist/MenuItem.d.cts +1 -1
- package/dist/MenuItem.d.mts +1 -1
- package/dist/MenuItem.mjs +1 -1
- package/dist/{MenuList-DsJmxNPu.cjs → MenuList-CSaaR3jt.cjs} +2 -1
- package/dist/{MenuList-CGZgfBno.mjs → MenuList-D7Pvpn_K.mjs} +2 -1
- package/dist/{MenuListContext-BwgQHUu9.d.cts → MenuListContext-AnAxu0he.d.cts} +2 -2
- package/dist/{MenuListContext-DbnAoUdJ.d.mts → MenuListContext-DURKFg_T.d.mts} +2 -2
- package/dist/Modal.d.cts +1 -1
- package/dist/Modal.d.mts +1 -1
- package/dist/NativeSelect.d.cts +2 -2
- package/dist/NativeSelect.d.mts +2 -2
- package/dist/NavTree/NavLink.d.cts +1 -1
- package/dist/NavTree/NavLink.d.mts +1 -1
- package/dist/NavTree/NavTree.d.cts +1 -1
- package/dist/NavTree/NavTree.d.mts +1 -1
- package/dist/NumberInput.d.cts +1 -1
- package/dist/NumberInput.d.mts +1 -1
- package/dist/Pagination/PaginationItem.d.cts +1 -1
- package/dist/Pagination/PaginationItem.d.mts +1 -1
- package/dist/Pagination.d.cts +2 -2
- package/dist/Pagination.d.mts +2 -2
- package/dist/Paper.d.cts +2 -2
- package/dist/Paper.d.mts +2 -2
- package/dist/Popover.d.cts +4 -14
- package/dist/Popover.d.mts +4 -14
- package/dist/Pressable.d.cts +1 -1
- package/dist/Pressable.d.mts +1 -1
- package/dist/Quote.d.cts +2 -2
- package/dist/Quote.d.mts +2 -2
- package/dist/Radio.d.cts +1 -1
- package/dist/Radio.d.mts +1 -1
- package/dist/RangeInput.d.cts +1 -1
- package/dist/RangeInput.d.mts +1 -1
- package/dist/Rating.d.cts +1 -1
- package/dist/Rating.d.mts +1 -1
- package/dist/ScrollArea.d.cts +1 -1
- package/dist/ScrollArea.d.mts +1 -1
- package/dist/Select.d.cts +2 -2
- package/dist/Select.d.mts +2 -2
- package/dist/Sidebar/Sidebar.d.cts +1 -1
- package/dist/Sidebar/Sidebar.d.mts +1 -1
- package/dist/Sidebar/SidebarItem.d.cts +3 -3
- package/dist/Sidebar/SidebarItem.d.mts +3 -3
- package/dist/Skeleton.d.cts +1 -1
- package/dist/Skeleton.d.mts +1 -1
- package/dist/Slide.d.cts +1 -1
- package/dist/Slide.d.mts +1 -1
- package/dist/Snackbar.d.cts +2 -2
- package/dist/Snackbar.d.mts +2 -2
- package/dist/Switch.d.cts +1 -1
- package/dist/Switch.d.mts +1 -1
- package/dist/Table/Table.d.cts +2 -2
- package/dist/Table/Table.d.mts +2 -2
- package/dist/Table/TableBody.d.cts +1 -1
- package/dist/Table/TableBody.d.mts +1 -1
- package/dist/Table/TableCell.d.cts +1 -1
- package/dist/Table/TableCell.d.mts +1 -1
- package/dist/Table/TableContainer.d.cts +1 -1
- package/dist/Table/TableContainer.d.mts +1 -1
- package/dist/Table/TableControl.d.cts +1 -1
- package/dist/Table/TableControl.d.mts +1 -1
- package/dist/Table/TableFooter.d.cts +1 -1
- package/dist/Table/TableFooter.d.mts +1 -1
- package/dist/Table/TableHead.d.cts +1 -1
- package/dist/Table/TableHead.d.mts +1 -1
- package/dist/Table/TablePagination.d.cts +2 -2
- package/dist/Table/TablePagination.d.mts +2 -2
- package/dist/Table/TablePaginationActions.d.cts +1 -1
- package/dist/Table/TablePaginationActions.d.mts +1 -1
- package/dist/Table/TableRow.d.cts +1 -1
- package/dist/Table/TableRow.d.mts +1 -1
- package/dist/Table/TableSortLabel.d.cts +1 -1
- package/dist/Table/TableSortLabel.d.mts +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-0hifLOKH.d.mts → TableContext-CPxH920f.d.mts} +1 -1
- package/dist/{TableContext-fIyMD_Bj.d.cts → TableContext-VuMFtVNr.d.cts} +1 -1
- package/dist/Tabs/Tab.cjs +18 -14
- package/dist/Tabs/Tab.d.cts +2 -2
- package/dist/Tabs/Tab.d.mts +2 -2
- package/dist/Tabs/Tab.mjs +18 -14
- package/dist/Tabs/TabContext.d.cts +1 -1
- package/dist/Tabs/TabContext.d.mts +1 -1
- package/dist/Tabs/TabList.cjs +1 -1
- package/dist/Tabs/TabList.d.cts +1 -1
- package/dist/Tabs/TabList.d.mts +1 -1
- package/dist/Tabs/TabList.mjs +1 -1
- package/dist/Tabs/TabPanel.d.cts +2 -2
- package/dist/Tabs/TabPanel.d.mts +2 -2
- package/dist/Tabs/TabScrollButton.d.cts +1 -1
- package/dist/Tabs/TabScrollButton.d.mts +1 -1
- package/dist/Tabs/Tabs.cjs +1 -1
- package/dist/Tabs/Tabs.d.cts +2 -2
- package/dist/Tabs/Tabs.d.mts +2 -2
- package/dist/Tabs/Tabs.mjs +1 -1
- package/dist/{Tabs-JvjuCU8m.mjs → Tabs-C_qe9d4p.mjs} +28 -21
- package/dist/{Tabs-BsbX0jFL.cjs → Tabs-DmiA1J--.cjs} +28 -21
- package/dist/Tabs.cjs +1 -1
- package/dist/Tabs.d.cts +3 -3
- package/dist/Tabs.d.mts +3 -3
- package/dist/Tabs.mjs +1 -1
- package/dist/{TabsContext-0ZtedNyH.d.mts → TabsContext-DeP8oJpC.d.cts} +1 -1
- package/dist/{TabsContext-MpMEEVuB.d.cts → TabsContext-VJcdZQOf.d.mts} +1 -1
- package/dist/TextInput.d.cts +1 -1
- package/dist/TextInput.d.mts +1 -1
- package/dist/ToggleButton/ToggleButton.d.cts +1 -1
- package/dist/ToggleButton/ToggleButton.d.mts +1 -1
- package/dist/ToggleButton/ToggleButtonGroup.d.cts +1 -1
- package/dist/ToggleButton/ToggleButtonGroup.d.mts +1 -1
- package/dist/Tooltip-CrPRvmj3.cjs +338 -0
- package/dist/Tooltip-CwbuEQzf.mjs +332 -0
- package/dist/Tooltip.cjs +2 -267
- package/dist/Tooltip.d.cts +42 -7
- package/dist/Tooltip.d.mts +42 -7
- package/dist/Tooltip.mjs +1 -266
- package/dist/TransferList.d.cts +1 -1
- package/dist/TransferList.d.mts +1 -1
- package/dist/Typography.d.cts +2 -2
- package/dist/Typography.d.mts +2 -2
- package/dist/View.d.cts +1 -1
- package/dist/View.d.mts +1 -1
- package/dist/Zoom.d.cts +1 -1
- package/dist/Zoom.d.mts +1 -1
- package/dist/catalog.cjs +12 -0
- package/dist/catalog.d.cts +1 -1
- package/dist/catalog.d.mts +1 -1
- package/dist/catalog.mjs +12 -0
- package/dist/computePopoverPosition-JgOwCM7k.d.cts +12 -0
- package/dist/computePopoverPosition-JgOwCM7k.d.mts +12 -0
- package/dist/engine.d.cts +1 -1
- package/dist/engine.d.mts +1 -1
- package/dist/{index-4maWM1H8.d.mts → index-2jMSUeji.d.cts} +1 -1
- package/dist/{index-76zijQoi.d.mts → index-3Xe5X6Ny.d.mts} +2 -2
- package/dist/{index-C7EUYyom.d.cts → index-B-p51b0z.d.cts} +2 -2
- package/dist/index-B2XL_zZY.d.mts +44 -0
- package/dist/{index-D4PcgL-c.d.cts → index-B5_-Bxoo.d.cts} +2 -2
- package/dist/{index-DBF5n3ey.d.cts → index-BFUn2EWp.d.mts} +3 -3
- package/dist/{index-Byk1_ms9.d.cts → index-BKM4d_F4.d.cts} +2 -2
- package/dist/index-BL5Kj3Ka.d.mts +1 -0
- package/dist/{index-SotXsXXb.d.mts → index-BLypGp0N.d.mts} +4 -4
- package/dist/{index-hoHPfsc1.d.cts → index-BVDN2XbT.d.mts} +3 -3
- package/dist/{index-CLTFsCYC.d.cts → index-Bhb0bFxe.d.mts} +2 -2
- package/dist/index-Biqpy7c9.d.cts +44 -0
- package/dist/{index-CKywwIep.d.mts → index-C-ebcNOc.d.mts} +1 -1
- package/dist/{index-Lsm4v8fB.d.cts → index-C6a3kDn2.d.cts} +3 -0
- package/dist/{index-RaDENVX_.d.cts → index-C9nnnfhd.d.cts} +2 -2
- package/dist/{index-BuAKhHMs.d.cts → index-CBHCGizS.d.mts} +1 -1
- package/dist/{index-BChRNCld.d.mts → index-CCEfrBNN.d.mts} +1 -1
- package/dist/{index-Dxu6Ks2A.d.cts → index-CHWMSBhQ.d.cts} +1 -1
- package/dist/index-CJMvoc8h.d.cts +1 -0
- package/dist/{index-C2a-5yop.d.mts → index-COgZvhXQ.d.mts} +1 -1
- package/dist/{index-BC9S8Fpr.d.cts → index-CP55_Zs2.d.mts} +1 -1
- package/dist/{index-Dm7vQHor.d.cts → index-CgyyM3ty.d.cts} +10 -5
- package/dist/{index-CfB7OceY.d.cts → index-CtwlReZi.d.cts} +1 -1
- package/dist/{index-CnVvfG9_.d.mts → index-D0skdQEK.d.mts} +1 -1
- package/dist/{index-Cjh607-v.d.cts → index-D2tfsNPw.d.cts} +1 -1
- package/dist/{index-B3Bdupj3.d.mts → index-D7h8qFS1.d.cts} +2 -2
- package/dist/{index-BV5BvdeN.d.mts → index-DACdQ7-d.d.cts} +1 -1
- package/dist/{index-CAt0-L4i.d.cts → index-DAJ5DVHh.d.cts} +2 -2
- package/dist/{index-CGyIuCRh.d.cts → index-DMysZsti.d.cts} +1 -1
- package/dist/{index-CR8qkP8U.d.mts → index-DOH6uskj.d.mts} +3 -0
- package/dist/{index-C2tTbEBS.d.mts → index-DQo4XtH4.d.mts} +2 -2
- package/dist/{index-CQeTS_zL.d.cts → index-DTJN6JL2.d.cts} +1 -1
- package/dist/{index-Dt274Ngt.d.mts → index-DbKYSbLs.d.mts} +2 -2
- package/dist/{index-CJYWGPVO.d.mts → index-Dg0FPoms.d.mts} +2 -2
- package/dist/{index-C_J58B_n.d.mts → index-DlNBgVwb.d.mts} +1 -1
- package/dist/{index-UiyZAKID.d.mts → index-DsBOpK8T.d.mts} +2 -2
- package/dist/{index-DbgrItbx.d.cts → index-Dvx5TRET.d.cts} +2 -2
- package/dist/{index-tOrd12AJ.d.mts → index-Sq75GwA2.d.cts} +3 -3
- package/dist/{index-BAzMLTVi.d.mts → index-ZyigJMkV.d.mts} +10 -5
- package/dist/{index-Bo45R0nD.d.cts → index-gHMydoIS.d.cts} +4 -4
- package/dist/{index-BzQze7eY.d.cts → index-gxBafJdz.d.cts} +1 -1
- package/dist/{index-D48qVo1X.d.mts → index-hTgl9zwe.d.mts} +2 -2
- package/dist/{index-CF_pl72E.d.mts → index-i8BxMDEC.d.mts} +1 -1
- package/dist/{index-BXlBouWV.d.mts → index-v1I6VA9w.d.cts} +3 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/style.d.cts +2 -2
- package/dist/style.d.mts +2 -2
- package/dist/theme.d.cts +2 -2
- package/dist/theme.d.mts +2 -2
- package/dist/{useAnchoredPlacement-ee6KzG3t.cjs → useAnchoredPlacement-BSfjNMut.cjs} +10 -5
- package/dist/{useAnchoredPlacement-COrXZxhm.mjs → useAnchoredPlacement-txSaWzfk.mjs} +10 -5
- package/dist/{useTablePagination-BlD8mK8k.d.mts → useTablePagination-CUsagS5T.d.mts} +1 -1
- package/dist/{useTablePagination-CGjb_jPX.d.cts → useTablePagination-jpEfHKUh.d.cts} +1 -1
- package/dist/{useTransition-3EoagwIe.d.mts → useTransition-BJ375Sto.d.cts} +1 -1
- package/dist/{useTransition-C89K0mS7.d.cts → useTransition-DDGpvgci.d.mts} +1 -1
- package/package.json +1 -1
- package/dist/index-1Xzj0iAs.d.mts +0 -1
- package/dist/index-323PrYLR.d.cts +0 -1
|
@@ -4,8 +4,9 @@ import { t as themeDefault } from "./themeDefault-BeZJzqJj.mjs";
|
|
|
4
4
|
import { t as Icon } from "./Icon-XpXU-SuF.mjs";
|
|
5
5
|
import { View } from "./View.mjs";
|
|
6
6
|
import { t as isRtl } from "./isRtl-DN-EdUlg.mjs";
|
|
7
|
-
import { t as
|
|
8
|
-
import { t as
|
|
7
|
+
import { t as Tooltip } from "./Tooltip-CwbuEQzf.mjs";
|
|
8
|
+
import { t as MenuItem } from "./MenuItem-kRGVRI6G.mjs";
|
|
9
|
+
import { t as Menu } from "./Menu-C_4jYHWE.mjs";
|
|
9
10
|
import { a as TabsContext, i as TabIndexContext, n as getDividerShadow, r as getEnclosedPieceStyle, t as getDividerColor } from "./dividerLine-BC8E38Ed.mjs";
|
|
10
11
|
import "./tonalRadius-CvXRueqT.mjs";
|
|
11
12
|
import { TabScrollButton } from "./Tabs/TabScrollButton.mjs";
|
|
@@ -594,33 +595,39 @@ function Tabs({ children, value: valueProp, defaultValue, onChange, onTabClose,
|
|
|
594
595
|
children: /* @__PURE__ */ jsx(Menu, {
|
|
595
596
|
align: "end",
|
|
596
597
|
onSelect: select,
|
|
597
|
-
trigger: /* @__PURE__ */ jsx(
|
|
598
|
-
type: "button",
|
|
599
|
-
...styleProps,
|
|
600
|
-
"aria-label": overflowLabel,
|
|
598
|
+
trigger: /* @__PURE__ */ jsx(Tooltip, {
|
|
601
599
|
title: overflowLabel,
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
600
|
+
isInteractive: false,
|
|
601
|
+
children: /* @__PURE__ */ jsx(OverflowButton, {
|
|
602
|
+
type: "button",
|
|
603
|
+
...styleProps,
|
|
604
|
+
"aria-label": overflowLabel,
|
|
605
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
606
|
+
name: "expand_more",
|
|
607
|
+
size: "sm",
|
|
608
|
+
color: "inherit"
|
|
609
|
+
})
|
|
606
610
|
})
|
|
607
611
|
}),
|
|
608
612
|
children: hiddenTabs.map((tab) => /* @__PURE__ */ jsx(MenuItem, {
|
|
609
613
|
value: tab.value,
|
|
610
614
|
disabled: tab.disabled,
|
|
611
615
|
shouldAnnounceSecondaryAction: shouldAnnounceClose,
|
|
612
|
-
secondaryAction: tab.closeLabel === void 0 ? void 0 : /* @__PURE__ */ jsx(
|
|
613
|
-
type: "button",
|
|
614
|
-
color: selectedColor,
|
|
615
|
-
"aria-hidden": shouldAnnounceClose ? void 0 : true,
|
|
616
|
-
"aria-label": shouldAnnounceClose ? tab.closeLabel : void 0,
|
|
616
|
+
secondaryAction: tab.closeLabel === void 0 ? void 0 : /* @__PURE__ */ jsx(Tooltip, {
|
|
617
617
|
title: tab.closeLabel,
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
618
|
+
isInteractive: false,
|
|
619
|
+
children: /* @__PURE__ */ jsx(OverflowClose, {
|
|
620
|
+
type: "button",
|
|
621
|
+
color: selectedColor,
|
|
622
|
+
"aria-hidden": shouldAnnounceClose ? void 0 : true,
|
|
623
|
+
"aria-label": shouldAnnounceClose ? tab.closeLabel : void 0,
|
|
624
|
+
tabIndex: -1,
|
|
625
|
+
onClick: () => onTabClose?.(tab.value),
|
|
626
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
627
|
+
name: "close",
|
|
628
|
+
size: "0.75rem",
|
|
629
|
+
color: "inherit"
|
|
630
|
+
})
|
|
624
631
|
})
|
|
625
632
|
}),
|
|
626
633
|
children: tab.label ?? tab.icon
|
|
@@ -4,8 +4,9 @@ const require_themeDefault = require("./themeDefault-DbPHBbNO.cjs");
|
|
|
4
4
|
const require_Icon = require("./Icon-C5Iz5ekp.cjs");
|
|
5
5
|
const require_View = require("./View.cjs");
|
|
6
6
|
const require_isRtl = require("./isRtl-Dl6QQWib.cjs");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const require_Tooltip = require("./Tooltip-CrPRvmj3.cjs");
|
|
8
|
+
const require_MenuItem = require("./MenuItem-Bg4iRvVe.cjs");
|
|
9
|
+
const require_Menu = require("./Menu-C6eIdA1J.cjs");
|
|
9
10
|
const require_dividerLine = require("./dividerLine-DFuLn1zU.cjs");
|
|
10
11
|
require("./tonalRadius-CU9GHoHx.cjs");
|
|
11
12
|
const require_Tabs_TabScrollButton = require("./Tabs/TabScrollButton.cjs");
|
|
@@ -595,33 +596,39 @@ function Tabs({ children, value: valueProp, defaultValue, onChange, onTabClose,
|
|
|
595
596
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Menu.Menu, {
|
|
596
597
|
align: "end",
|
|
597
598
|
onSelect: select,
|
|
598
|
-
trigger: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
599
|
-
type: "button",
|
|
600
|
-
...styleProps,
|
|
601
|
-
"aria-label": overflowLabel,
|
|
599
|
+
trigger: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Tooltip.Tooltip, {
|
|
602
600
|
title: overflowLabel,
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
601
|
+
isInteractive: false,
|
|
602
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OverflowButton, {
|
|
603
|
+
type: "button",
|
|
604
|
+
...styleProps,
|
|
605
|
+
"aria-label": overflowLabel,
|
|
606
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
607
|
+
name: "expand_more",
|
|
608
|
+
size: "sm",
|
|
609
|
+
color: "inherit"
|
|
610
|
+
})
|
|
607
611
|
})
|
|
608
612
|
}),
|
|
609
613
|
children: hiddenTabs.map((tab) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MenuItem.MenuItem, {
|
|
610
614
|
value: tab.value,
|
|
611
615
|
disabled: tab.disabled,
|
|
612
616
|
shouldAnnounceSecondaryAction: shouldAnnounceClose,
|
|
613
|
-
secondaryAction: tab.closeLabel === void 0 ? void 0 : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
614
|
-
type: "button",
|
|
615
|
-
color: selectedColor,
|
|
616
|
-
"aria-hidden": shouldAnnounceClose ? void 0 : true,
|
|
617
|
-
"aria-label": shouldAnnounceClose ? tab.closeLabel : void 0,
|
|
617
|
+
secondaryAction: tab.closeLabel === void 0 ? void 0 : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Tooltip.Tooltip, {
|
|
618
618
|
title: tab.closeLabel,
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
619
|
+
isInteractive: false,
|
|
620
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OverflowClose, {
|
|
621
|
+
type: "button",
|
|
622
|
+
color: selectedColor,
|
|
623
|
+
"aria-hidden": shouldAnnounceClose ? void 0 : true,
|
|
624
|
+
"aria-label": shouldAnnounceClose ? tab.closeLabel : void 0,
|
|
625
|
+
tabIndex: -1,
|
|
626
|
+
onClick: () => onTabClose?.(tab.value),
|
|
627
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
628
|
+
name: "close",
|
|
629
|
+
size: "0.75rem",
|
|
630
|
+
color: "inherit"
|
|
631
|
+
})
|
|
625
632
|
})
|
|
626
633
|
}),
|
|
627
634
|
children: tab.label ?? tab.icon
|
package/dist/Tabs.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_Tabs_Tab = require("./Tabs/Tab.cjs");
|
|
3
3
|
const require_Tabs_TabContext = require("./Tabs/TabContext.cjs");
|
|
4
4
|
const require_Tabs_TabScrollButton = require("./Tabs/TabScrollButton.cjs");
|
|
5
|
-
const require_Tabs = require("./Tabs-
|
|
5
|
+
const require_Tabs = require("./Tabs-DmiA1J--.cjs");
|
|
6
6
|
const require_Tabs_TabList = require("./Tabs/TabList.cjs");
|
|
7
7
|
const require_Tabs_TabPanel = require("./Tabs/TabPanel.cjs");
|
|
8
8
|
exports.Tab = require_Tabs_Tab.Tab;
|
package/dist/Tabs.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as TabValue } from "./TabsContext-
|
|
1
|
+
import { t as TabValue } from "./TabsContext-DeP8oJpC.cjs";
|
|
2
2
|
import { Tab, TabIconPosition, TabProps } from "./Tabs/Tab.cjs";
|
|
3
3
|
import { TabContext, TabContextProps } from "./Tabs/TabContext.cjs";
|
|
4
|
-
import { n as TabScrollButtonProps, r as TabScrollDirection, t as TabScrollButton } from "./index-
|
|
5
|
-
import { a as TabsProps, i as TabsOverflowBehavior, n as TabsActions, o as TabsScrollButtons, r as TabsOrientation, s as TabsVariant, t as Tabs } from "./index-
|
|
4
|
+
import { n as TabScrollButtonProps, r as TabScrollDirection, t as TabScrollButton } from "./index-DTJN6JL2.cjs";
|
|
5
|
+
import { a as TabsProps, i as TabsOverflowBehavior, n as TabsActions, o as TabsScrollButtons, r as TabsOrientation, s as TabsVariant, t as Tabs } from "./index-gHMydoIS.cjs";
|
|
6
6
|
import { TabList, TabListProps } from "./Tabs/TabList.cjs";
|
|
7
7
|
import { TabPanel, TabPanelProps } from "./Tabs/TabPanel.cjs";
|
|
8
8
|
export { Tab, TabContext, TabContextProps, TabIconPosition, TabList, TabListProps, TabPanel, TabPanelProps, TabProps, TabScrollButton, TabScrollButtonProps, TabScrollDirection, type TabValue, Tabs, TabsActions, TabsOrientation, TabsOverflowBehavior, TabsProps, TabsScrollButtons, TabsVariant };
|
package/dist/Tabs.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as TabValue } from "./TabsContext-
|
|
1
|
+
import { t as TabValue } from "./TabsContext-VJcdZQOf.mjs";
|
|
2
2
|
import { Tab, TabIconPosition, TabProps } from "./Tabs/Tab.mjs";
|
|
3
3
|
import { TabContext, TabContextProps } from "./Tabs/TabContext.mjs";
|
|
4
|
-
import { n as TabScrollButtonProps, r as TabScrollDirection, t as TabScrollButton } from "./index-
|
|
5
|
-
import { a as TabsProps, i as TabsOverflowBehavior, n as TabsActions, o as TabsScrollButtons, r as TabsOrientation, s as TabsVariant, t as Tabs } from "./index-
|
|
4
|
+
import { n as TabScrollButtonProps, r as TabScrollDirection, t as TabScrollButton } from "./index-DlNBgVwb.mjs";
|
|
5
|
+
import { a as TabsProps, i as TabsOverflowBehavior, n as TabsActions, o as TabsScrollButtons, r as TabsOrientation, s as TabsVariant, t as Tabs } from "./index-BLypGp0N.mjs";
|
|
6
6
|
import { TabList, TabListProps } from "./Tabs/TabList.mjs";
|
|
7
7
|
import { TabPanel, TabPanelProps } from "./Tabs/TabPanel.mjs";
|
|
8
8
|
export { Tab, TabContext, TabContextProps, TabIconPosition, TabList, TabListProps, TabPanel, TabPanelProps, TabProps, TabScrollButton, TabScrollButtonProps, TabScrollDirection, type TabValue, Tabs, TabsActions, TabsOrientation, TabsOverflowBehavior, TabsProps, TabsScrollButtons, TabsVariant };
|
package/dist/Tabs.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Tab } from "./Tabs/Tab.mjs";
|
|
2
2
|
import { TabContext } from "./Tabs/TabContext.mjs";
|
|
3
3
|
import { TabScrollButton } from "./Tabs/TabScrollButton.mjs";
|
|
4
|
-
import { t as Tabs } from "./Tabs-
|
|
4
|
+
import { t as Tabs } from "./Tabs-C_qe9d4p.mjs";
|
|
5
5
|
import { TabList } from "./Tabs/TabList.mjs";
|
|
6
6
|
import { TabPanel } from "./Tabs/TabPanel.mjs";
|
|
7
7
|
export { Tab, TabContext, TabList, TabPanel, TabScrollButton, Tabs };
|
package/dist/TextInput.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { nt as Theme } from "./index-
|
|
1
|
+
import { nt as Theme } from "./index-C6a3kDn2.cjs";
|
|
2
2
|
import { ChangeEventHandler, ElementType, InputHTMLAttributes, TextareaHTMLAttributes } from "react";
|
|
3
3
|
import { LayoutProps, SpaceProps } from "@soroush.tech/styled-system";
|
|
4
4
|
type TextInputColor = keyof Theme['palette'];
|
package/dist/TextInput.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { nt as Theme } from "./index-
|
|
1
|
+
import { nt as Theme } from "./index-DOH6uskj.mjs";
|
|
2
2
|
import { LayoutProps, SpaceProps } from "@soroush.tech/styled-system";
|
|
3
3
|
import { ChangeEventHandler, ElementType, InputHTMLAttributes, TextareaHTMLAttributes } from "react";
|
|
4
4
|
type TextInputColor = keyof Theme['palette'];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as ButtonProps } from "../index-
|
|
1
|
+
import { i as ButtonProps } from "../index-gxBafJdz.cjs";
|
|
2
2
|
import { r as ToggleButtonValue } from "../ToggleButtonGroupContext-CA-4EgZL.cjs";
|
|
3
3
|
interface ToggleButtonProps extends Omit<ButtonProps, 'variant' | 'href' | 'target' | 'rel' | 'value' | 'onChange'> {
|
|
4
4
|
/** The value associated with the button inside a `ToggleButtonGroup`. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as ButtonProps } from "../index-
|
|
1
|
+
import { i as ButtonProps } from "../index-CCEfrBNN.mjs";
|
|
2
2
|
import { r as ToggleButtonValue } from "../ToggleButtonGroupContext-CA-4EgZL.mjs";
|
|
3
3
|
interface ToggleButtonProps extends Omit<ButtonProps, 'variant' | 'href' | 'target' | 'rel' | 'value' | 'onChange'> {
|
|
4
4
|
/** The value associated with the button inside a `ToggleButtonGroup`. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ButtonGroupProps } from "../index-
|
|
1
|
+
import { a as ButtonGroupProps } from "../index-Sq75GwA2.cjs";
|
|
2
2
|
import { r as ToggleButtonValue } from "../ToggleButtonGroupContext-CA-4EgZL.cjs";
|
|
3
3
|
interface ToggleButtonGroupProps extends Omit<ButtonGroupProps, 'variant' | 'onChange'> {
|
|
4
4
|
/** Selected value(s) - single when `isExclusive`, array otherwise. Controlled. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ButtonGroupProps } from "../index-
|
|
1
|
+
import { a as ButtonGroupProps } from "../index-BVDN2XbT.mjs";
|
|
2
2
|
import { r as ToggleButtonValue } from "../ToggleButtonGroupContext-CA-4EgZL.mjs";
|
|
3
3
|
interface ToggleButtonGroupProps extends Omit<ButtonGroupProps, 'variant' | 'onChange'> {
|
|
4
4
|
/** Selected value(s) - single when `isExclusive`, array otherwise. Controlled. */
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
const require_src = require("./src-yC1f5WR2.cjs");
|
|
2
|
+
const require_theme = require("./theme-XJvMdOnY.cjs");
|
|
3
|
+
const require_themeDefault = require("./themeDefault-DbPHBbNO.cjs");
|
|
4
|
+
const require_getSurfaceRadius = require("./getSurfaceRadius-DwOn3ALC.cjs");
|
|
5
|
+
const require_useControlled = require("./useControlled-CzCxM4J3.cjs");
|
|
6
|
+
const require_Portal = require("./Portal.cjs");
|
|
7
|
+
const require_useAnchoredPlacement = require("./useAnchoredPlacement-BSfjNMut.cjs");
|
|
8
|
+
const require_useMergedRefs = require("./useMergedRefs-BtctsnmX.cjs");
|
|
9
|
+
const require_getTooltipOrigins = require("./getTooltipOrigins-8b5zQafY.cjs");
|
|
10
|
+
let react = require("react");
|
|
11
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
|
+
let _soroush_tech_styled_system_should_forward_prop = require("@soroush.tech/styled-system/should-forward-prop");
|
|
13
|
+
// src/Tooltip/hooks/useTooltip.ts
|
|
14
|
+
const isKeyboardFocus = (event) => {
|
|
15
|
+
try {
|
|
16
|
+
return event.target.matches(":focus-visible");
|
|
17
|
+
} catch {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The state of a tooltip: whether it is open (its own, or its owner's), the timers that open and
|
|
23
|
+
* close it, and the handlers its child and the tooltip itself take. Opening and closing are
|
|
24
|
+
* delayed; moving from the child onto the tooltip does not close it, so its text can be read and
|
|
25
|
+
* selected (WCAG 1.4.13); Escape closes it at once.
|
|
26
|
+
*/
|
|
27
|
+
function useTooltip({ isOpen: isOpenProp, defaultOpen, isAtPoint = false, onOpen, onClose, enterDelay, leaveDelay, enterTouchDelay, leaveTouchDelay, shouldOpenOnHover, shouldOpenOnFocus, shouldOpenOnTouch }) {
|
|
28
|
+
const [isOpen, setIsOpen] = require_useControlled.useControlled({
|
|
29
|
+
controlled: isOpenProp,
|
|
30
|
+
default: defaultOpen
|
|
31
|
+
});
|
|
32
|
+
const timer = (0, react.useRef)(void 0);
|
|
33
|
+
const latest = (0, react.useRef)({
|
|
34
|
+
isOpen,
|
|
35
|
+
isOpenProp,
|
|
36
|
+
isAtPoint,
|
|
37
|
+
onOpen,
|
|
38
|
+
onClose
|
|
39
|
+
});
|
|
40
|
+
(0, react.useEffect)(() => {
|
|
41
|
+
latest.current = {
|
|
42
|
+
isOpen,
|
|
43
|
+
isOpenProp,
|
|
44
|
+
isAtPoint,
|
|
45
|
+
onOpen,
|
|
46
|
+
onClose
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
const clear = (0, react.useCallback)(() => window.clearTimeout(timer.current), []);
|
|
50
|
+
const ask = (0, react.useCallback)((next, event, delay) => {
|
|
51
|
+
clear();
|
|
52
|
+
timer.current = window.setTimeout(() => {
|
|
53
|
+
const current = latest.current;
|
|
54
|
+
if (current.isOpen === next) return;
|
|
55
|
+
if (next && current.isAtPoint) return;
|
|
56
|
+
if (current.isOpenProp === void 0) setIsOpen(next);
|
|
57
|
+
(next ? current.onOpen : current.onClose)?.(event);
|
|
58
|
+
}, delay);
|
|
59
|
+
}, [clear, setIsOpen]);
|
|
60
|
+
(0, react.useEffect)(() => clear, [clear]);
|
|
61
|
+
(0, react.useEffect)(() => {
|
|
62
|
+
if (!isOpen) return void 0;
|
|
63
|
+
const handleKeyDown = (event) => {
|
|
64
|
+
if (event.key === "Escape") ask(false, event, 0);
|
|
65
|
+
};
|
|
66
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
67
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
68
|
+
}, [isOpen, ask]);
|
|
69
|
+
return {
|
|
70
|
+
isOpen,
|
|
71
|
+
childHandlers: {
|
|
72
|
+
onMouseEnter: (event) => {
|
|
73
|
+
if (shouldOpenOnHover) ask(true, event, enterDelay);
|
|
74
|
+
},
|
|
75
|
+
onMouseLeave: (event) => {
|
|
76
|
+
if (shouldOpenOnHover) ask(false, event, leaveDelay);
|
|
77
|
+
},
|
|
78
|
+
onFocus: (event) => {
|
|
79
|
+
if (shouldOpenOnFocus && isKeyboardFocus(event)) ask(true, event, enterDelay);
|
|
80
|
+
},
|
|
81
|
+
onBlur: (event) => {
|
|
82
|
+
if (shouldOpenOnFocus) ask(false, event, leaveDelay);
|
|
83
|
+
},
|
|
84
|
+
onTouchStart: (event) => {
|
|
85
|
+
if (shouldOpenOnTouch) ask(true, event, enterTouchDelay);
|
|
86
|
+
},
|
|
87
|
+
onTouchEnd: (event) => {
|
|
88
|
+
if (shouldOpenOnTouch) ask(false, event, leaveTouchDelay);
|
|
89
|
+
},
|
|
90
|
+
onTouchCancel: (event) => {
|
|
91
|
+
if (shouldOpenOnTouch) ask(false, event, leaveTouchDelay);
|
|
92
|
+
},
|
|
93
|
+
onPointerDown: (event) => {
|
|
94
|
+
if (event.pointerType !== "touch") ask(false, event, 0);
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
surfaceHandlers: {
|
|
98
|
+
onMouseEnter: () => {
|
|
99
|
+
if (shouldOpenOnHover) clear();
|
|
100
|
+
},
|
|
101
|
+
onMouseLeave: (event) => {
|
|
102
|
+
if (shouldOpenOnHover) ask(false, event, leaveDelay);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
// src/Tooltip/Tooltip.tsx
|
|
108
|
+
const MARGIN = 8;
|
|
109
|
+
const GAP = 8;
|
|
110
|
+
const ARROW = 8;
|
|
111
|
+
const TooltipSurface = require_src.styled("div", {
|
|
112
|
+
name: "Tooltip",
|
|
113
|
+
label: "Tooltip",
|
|
114
|
+
shouldForwardProp: (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)([
|
|
115
|
+
"layer",
|
|
116
|
+
"isInteractive",
|
|
117
|
+
"borderRadius",
|
|
118
|
+
"bg",
|
|
119
|
+
"textColor"
|
|
120
|
+
])
|
|
121
|
+
})(({ theme, layer, isInteractive, borderRadius, bg, textColor }) => ({
|
|
122
|
+
position: "fixed",
|
|
123
|
+
...!isInteractive && { pointerEvents: "none" },
|
|
124
|
+
top: 0,
|
|
125
|
+
left: 0,
|
|
126
|
+
visibility: "hidden",
|
|
127
|
+
zIndex: theme.zOrder[layer],
|
|
128
|
+
boxSizing: "border-box",
|
|
129
|
+
maxWidth: "20rem",
|
|
130
|
+
padding: `${theme.space[.5]} ${theme.space[1]}`,
|
|
131
|
+
borderRadius: require_getSurfaceRadius.getSurfaceRadius(theme, borderRadius),
|
|
132
|
+
boxShadow: theme.shadows[4],
|
|
133
|
+
backgroundColor: (0, require_src.src_exports.get)(theme, `background.${bg ?? "modal"}`),
|
|
134
|
+
color: (0, require_src.src_exports.get)(theme, `text.${textColor ?? require_themeDefault.themeDefault(theme, "textColor", "initial")}`),
|
|
135
|
+
fontFamily: (0, require_src.src_exports.get)(theme, "fonts.body"),
|
|
136
|
+
fontSize: theme.fontSizes[0],
|
|
137
|
+
lineHeight: (0, require_src.src_exports.get)(theme, "lineHeights.base"),
|
|
138
|
+
overflowWrap: "break-word"
|
|
139
|
+
}));
|
|
140
|
+
const TooltipDescription = require_src.styled("span", { label: "TooltipDescription" })({
|
|
141
|
+
position: "absolute",
|
|
142
|
+
width: 1,
|
|
143
|
+
height: 1,
|
|
144
|
+
margin: -1,
|
|
145
|
+
padding: 0,
|
|
146
|
+
border: 0,
|
|
147
|
+
overflow: "hidden",
|
|
148
|
+
clip: "rect(0 0 0 0)",
|
|
149
|
+
whiteSpace: "nowrap"
|
|
150
|
+
});
|
|
151
|
+
const TooltipTarget = require_src.styled("span", { label: "TooltipTarget" })({ display: "inline-grid" });
|
|
152
|
+
const TooltipArrow = require_src.styled("span", {
|
|
153
|
+
name: "Tooltip",
|
|
154
|
+
slot: "arrow",
|
|
155
|
+
label: "TooltipArrow"
|
|
156
|
+
})({
|
|
157
|
+
position: "absolute",
|
|
158
|
+
width: ARROW,
|
|
159
|
+
height: ARROW,
|
|
160
|
+
backgroundColor: "inherit",
|
|
161
|
+
transform: "rotate(45deg)",
|
|
162
|
+
pointerEvents: "none"
|
|
163
|
+
});
|
|
164
|
+
const getArrow = ({ anchorRect, surfaceSize, top, left }) => {
|
|
165
|
+
const { width, height } = surfaceSize;
|
|
166
|
+
if (top + height <= anchorRect.top + 1 || top >= anchorRect.bottom - 1) {
|
|
167
|
+
const side = top + height <= anchorRect.top + 1 ? "top" : "bottom";
|
|
168
|
+
const middle = anchorRect.left + anchorRect.width / 2 - left;
|
|
169
|
+
return {
|
|
170
|
+
side,
|
|
171
|
+
offset: Math.min(Math.max(middle, ARROW), width - ARROW)
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
const side = left + width <= anchorRect.left + 1 ? "left" : "right";
|
|
175
|
+
const middle = anchorRect.top + anchorRect.height / 2 - top;
|
|
176
|
+
return {
|
|
177
|
+
side,
|
|
178
|
+
offset: Math.min(Math.max(middle, ARROW), height - ARROW)
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
const isSameArrow = (a, b) => a !== null && a.side === b.side && a.offset === b.offset;
|
|
182
|
+
const getArrowStyle = ({ side, offset }) => {
|
|
183
|
+
const half = ARROW / 2;
|
|
184
|
+
if (side === "top") return {
|
|
185
|
+
bottom: -4,
|
|
186
|
+
left: offset - half
|
|
187
|
+
};
|
|
188
|
+
if (side === "bottom") return {
|
|
189
|
+
top: -4,
|
|
190
|
+
left: offset - half
|
|
191
|
+
};
|
|
192
|
+
if (side === "left") return {
|
|
193
|
+
right: -4,
|
|
194
|
+
top: offset - half
|
|
195
|
+
};
|
|
196
|
+
return {
|
|
197
|
+
left: -4,
|
|
198
|
+
top: offset - half
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
const mergeForwarded = (own, forwarded) => Object.fromEntries(Object.entries(forwarded).filter(([, value]) => value !== void 0).map(([name, value]) => {
|
|
202
|
+
const current = own[name];
|
|
203
|
+
if (typeof value === "function" && typeof current === "function") return [name, (...args) => {
|
|
204
|
+
current(...args);
|
|
205
|
+
value(...args);
|
|
206
|
+
}];
|
|
207
|
+
if (name === "aria-describedby" && current) return [name, `${String(current)} ${String(value)}`];
|
|
208
|
+
return [name, value];
|
|
209
|
+
}));
|
|
210
|
+
const getChildName = (title, own) => {
|
|
211
|
+
const isHidden = own["aria-hidden"] === true || own["aria-hidden"] === "true";
|
|
212
|
+
const isNamed = own["aria-label"] !== void 0 || own["aria-labelledby"] !== void 0;
|
|
213
|
+
return typeof title === "string" && !isHidden && !isNamed ? { "aria-label": title } : {};
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* @description A short description of one child, shown on hover, keyboard focus and a long touch -
|
|
217
|
+
* a `role="tooltip"` in a `Portal`, placed beside its child and flipped for want of room. The
|
|
218
|
+
* child is named by it (`aria-label`) or described by it (`aria-describedby`, with
|
|
219
|
+
* `shouldDescribeChild`). It opens and closes after their delays, stays open while the pointer is
|
|
220
|
+
* on the tooltip itself, closes on Escape, and never takes or traps the focus.
|
|
221
|
+
*/
|
|
222
|
+
function Tooltip({ children, anchorPosition, title, placement: placementProp, hasArrow: hasArrowProp, enterDelay: enterDelayProp, leaveDelay: leaveDelayProp, enterTouchDelay: enterTouchDelayProp, leaveTouchDelay: leaveTouchDelayProp, shouldDescribeChild: shouldDescribeChildProp, isDescriptionPersistent: isDescriptionPersistentProp, isOpen: isOpenProp, defaultOpen = false, onOpen, onClose, isInteractive: isInteractiveProp, shouldWrapDisabledChild: shouldWrapDisabledChildProp, shouldOpenOnHover: shouldOpenOnHoverProp, shouldOpenOnFocus: shouldOpenOnFocusProp, shouldOpenOnTouch: shouldOpenOnTouchProp, slots, slotProps, layer: layerProp, borderRadius: borderRadiusProp, bg: bgProp, textColor: textColorProp, className, "data-testid": dataTestid, ref: forwardedRef, ...forwarded }) {
|
|
223
|
+
const dp = require_theme.useDefaultProps("Tooltip");
|
|
224
|
+
const placement = placementProp ?? dp.placement ?? "top";
|
|
225
|
+
const hasArrow = hasArrowProp ?? dp.hasArrow ?? false;
|
|
226
|
+
const shouldDescribeChild = shouldDescribeChildProp ?? dp.shouldDescribeChild ?? false;
|
|
227
|
+
const isDescriptionPersistent = isDescriptionPersistentProp ?? dp.isDescriptionPersistent ?? false;
|
|
228
|
+
const isInteractive = isInteractiveProp ?? dp.isInteractive ?? true;
|
|
229
|
+
const shouldWrapDisabledChild = shouldWrapDisabledChildProp ?? dp.shouldWrapDisabledChild ?? true;
|
|
230
|
+
const layer = layerProp ?? dp.layer ?? "tooltip";
|
|
231
|
+
const borderRadius = borderRadiusProp ?? dp.borderRadius;
|
|
232
|
+
const bg = bgProp ?? dp.bg;
|
|
233
|
+
const textColor = textColorProp ?? dp.textColor;
|
|
234
|
+
const id = (0, react.useId)();
|
|
235
|
+
const isAtPoint = anchorPosition !== void 0;
|
|
236
|
+
const { isOpen, childHandlers, surfaceHandlers } = useTooltip({
|
|
237
|
+
isOpen: isOpenProp,
|
|
238
|
+
defaultOpen,
|
|
239
|
+
isAtPoint,
|
|
240
|
+
onOpen,
|
|
241
|
+
onClose,
|
|
242
|
+
enterDelay: enterDelayProp ?? dp.enterDelay ?? 100,
|
|
243
|
+
leaveDelay: leaveDelayProp ?? dp.leaveDelay ?? 0,
|
|
244
|
+
enterTouchDelay: enterTouchDelayProp ?? dp.enterTouchDelay ?? 700,
|
|
245
|
+
leaveTouchDelay: leaveTouchDelayProp ?? dp.leaveTouchDelay ?? 1500,
|
|
246
|
+
shouldOpenOnHover: shouldOpenOnHoverProp ?? dp.shouldOpenOnHover ?? true,
|
|
247
|
+
shouldOpenOnFocus: shouldOpenOnFocusProp ?? dp.shouldOpenOnFocus ?? true,
|
|
248
|
+
shouldOpenOnTouch: shouldOpenOnTouchProp ?? dp.shouldOpenOnTouch ?? true
|
|
249
|
+
});
|
|
250
|
+
const hasTitle = title !== void 0 && title !== null && title !== "";
|
|
251
|
+
const isShown = isOpen && hasTitle;
|
|
252
|
+
const anchorRef = (0, react.useRef)(null);
|
|
253
|
+
const noAnchorRef = (0, react.useRef)(null);
|
|
254
|
+
const surfaceRef = (0, react.useRef)(null);
|
|
255
|
+
const childProps = children?.props ?? {};
|
|
256
|
+
const forwardedProps = mergeForwarded(childProps, forwarded);
|
|
257
|
+
const own = {
|
|
258
|
+
...childProps,
|
|
259
|
+
...forwardedProps
|
|
260
|
+
};
|
|
261
|
+
const isChildDisabled = shouldWrapDisabledChild && own.disabled === true;
|
|
262
|
+
const childRef = require_useMergedRefs.useMergedRefs(childProps.ref, forwardedRef);
|
|
263
|
+
const ref = require_useMergedRefs.useMergedRefs(isChildDisabled ? void 0 : anchorRef, childRef);
|
|
264
|
+
const [arrow, setArrow] = (0, react.useState)(null);
|
|
265
|
+
const getOrigins = (0, react.useCallback)((context) => require_getTooltipOrigins.getTooltipOrigins(require_getTooltipOrigins.resolveTooltipPlacement(placement, context), context.isRtl), [placement]);
|
|
266
|
+
const onPlaced = (0, react.useCallback)((placed) => {
|
|
267
|
+
if (!hasArrow) return;
|
|
268
|
+
const next = getArrow(placed);
|
|
269
|
+
setArrow((current) => isSameArrow(current, next) ? current : next);
|
|
270
|
+
}, [hasArrow]);
|
|
271
|
+
require_useAnchoredPlacement.useAnchoredPlacement({
|
|
272
|
+
isOpen: isShown,
|
|
273
|
+
anchorRef: anchorPosition ? noAnchorRef : anchorRef,
|
|
274
|
+
anchorPosition,
|
|
275
|
+
surfaceRef,
|
|
276
|
+
getOrigins,
|
|
277
|
+
margin: MARGIN,
|
|
278
|
+
gap: GAP,
|
|
279
|
+
onPlaced
|
|
280
|
+
});
|
|
281
|
+
const handlers = Object.fromEntries(Object.entries(childHandlers).map(([name, handler]) => [name, (event) => {
|
|
282
|
+
own[name]?.(event);
|
|
283
|
+
handler(event);
|
|
284
|
+
}]));
|
|
285
|
+
const ownDescription = own["aria-describedby"];
|
|
286
|
+
const names = getChildName(title, own);
|
|
287
|
+
const descriptionId = `${id}-description`;
|
|
288
|
+
const hasPersistentDescription = children !== void 0 && shouldDescribeChild && isDescriptionPersistent && hasTitle;
|
|
289
|
+
const describedBy = (shown) => hasPersistentDescription ? [ownDescription, descriptionId].filter(Boolean).join(" ") : [ownDescription, shown ? id : void 0].filter(Boolean).join(" ") || void 0;
|
|
290
|
+
const ariaProps = shouldDescribeChild ? { "aria-describedby": describedBy(isShown) } : names;
|
|
291
|
+
const child = children ? (0, react.cloneElement)(children, {
|
|
292
|
+
...forwardedProps,
|
|
293
|
+
...isChildDisabled || isAtPoint ? {} : handlers,
|
|
294
|
+
...ariaProps,
|
|
295
|
+
ref
|
|
296
|
+
}) : null;
|
|
297
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
298
|
+
isChildDisabled && !isAtPoint ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipTarget, {
|
|
299
|
+
ref: anchorRef,
|
|
300
|
+
...handlers,
|
|
301
|
+
children: child
|
|
302
|
+
}) : child,
|
|
303
|
+
hasPersistentDescription && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipDescription, {
|
|
304
|
+
id: descriptionId,
|
|
305
|
+
children: title
|
|
306
|
+
}),
|
|
307
|
+
isShown && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Portal.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TooltipSurface, {
|
|
308
|
+
...slotProps?.root,
|
|
309
|
+
as: slots?.root,
|
|
310
|
+
ref: surfaceRef,
|
|
311
|
+
id,
|
|
312
|
+
role: "tooltip",
|
|
313
|
+
layer,
|
|
314
|
+
isInteractive,
|
|
315
|
+
borderRadius,
|
|
316
|
+
bg,
|
|
317
|
+
textColor,
|
|
318
|
+
className: [slotProps?.root?.className, className].filter(Boolean).join(" ") || void 0,
|
|
319
|
+
"data-testid": dataTestid ?? slotProps?.root?.["data-testid"],
|
|
320
|
+
...isAtPoint || !isInteractive ? {} : surfaceHandlers,
|
|
321
|
+
children: [title, hasArrow && arrow ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipArrow, {
|
|
322
|
+
...slotProps?.arrow,
|
|
323
|
+
as: slots?.arrow,
|
|
324
|
+
style: {
|
|
325
|
+
...slotProps?.arrow?.style,
|
|
326
|
+
...getArrowStyle(arrow)
|
|
327
|
+
},
|
|
328
|
+
"aria-hidden": "true"
|
|
329
|
+
}) : null]
|
|
330
|
+
}) })
|
|
331
|
+
] });
|
|
332
|
+
}
|
|
333
|
+
Object.defineProperty(exports, "Tooltip", {
|
|
334
|
+
enumerable: true,
|
|
335
|
+
get: function() {
|
|
336
|
+
return Tooltip;
|
|
337
|
+
}
|
|
338
|
+
});
|