@soroush.tech/design-system 2.0.0-rc.2 → 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 +14 -10
- package/dist/AppBar.d.cts +1 -1
- package/dist/AppBar.d.mts +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/Breadcrumbs.cjs +1 -1
- package/dist/Breadcrumbs.d.cts +3 -3
- package/dist/Breadcrumbs.d.mts +3 -3
- package/dist/Breadcrumbs.mjs +1 -1
- 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.cjs +1 -1
- package/dist/Card.d.cts +4 -4
- package/dist/Card.d.mts +4 -4
- package/dist/Card.mjs +1 -1
- package/dist/Checkbox.d.cts +1 -1
- package/dist/Checkbox.d.mts +1 -1
- package/dist/CircularProgress.d.cts +2 -2
- package/dist/CircularProgress.d.mts +2 -2
- package/dist/Drawer.d.cts +3 -3
- package/dist/Drawer.d.mts +3 -3
- 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 +9 -1
- package/dist/FormControl.d.cts +9 -1
- package/dist/FormControl.d.mts +9 -1
- package/dist/FormControl.mjs +9 -1
- 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 -1
- package/dist/Grid.d.mts +1 -1
- package/dist/{Icon-DlheCTJb.mjs → Icon-BihOAP4u.mjs} +40 -0
- package/dist/{Icon-Cvuhp9ek.cjs → Icon-D-EWsBVg.cjs} +40 -0
- 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 -1
- package/dist/Image.d.mts +1 -1
- 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 -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 +1 -1
- package/dist/Menu/ContextMenu.d.cts +5 -5
- package/dist/Menu/ContextMenu.d.mts +5 -5
- package/dist/Menu/ContextMenu.mjs +1 -1
- 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.d.cts +2 -2
- package/dist/Menu/MenuList.d.mts +2 -2
- package/dist/{Menu-BkKPTOfh.cjs → Menu-Cgg-sX4W.cjs} +3 -2
- package/dist/{Menu-tECbAEFj.mjs → Menu-CrzHc_cn.mjs} +2 -1
- package/dist/Menu.cjs +1 -1
- package/dist/Menu.d.cts +3 -3
- package/dist/Menu.d.mts +3 -3
- package/dist/Menu.mjs +1 -1
- package/dist/{MenuItem-CfdN4axw.cjs → MenuItem-BTP7Ijwi.cjs} +6 -17
- package/dist/{MenuItem-BR7ingQx.mjs → MenuItem-DUn4IZKK.mjs} +3 -8
- 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/{MenuListContext-Dml16k0X.d.mts → MenuListContext-DKUOhNyw.d.cts} +2 -2
- package/dist/{MenuListContext-vujGcRk9.d.cts → MenuListContext-x-7lH4CH.d.mts} +2 -2
- package/dist/Modal.d.cts +1 -1
- package/dist/Modal.d.mts +1 -1
- package/dist/NativeSelect.cjs +8 -7
- package/dist/NativeSelect.d.cts +3 -3
- package/dist/NativeSelect.d.mts +3 -3
- package/dist/NativeSelect.mjs +8 -7
- 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.d.cts +2 -2
- package/dist/Paper.d.mts +2 -2
- package/dist/Popover.d.cts +3 -3
- package/dist/Popover.d.mts +3 -3
- 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/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 +3 -2
- package/dist/Select.d.cts +3 -3
- package/dist/Select.d.mts +3 -3
- package/dist/Select.mjs +5 -4
- 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 -3
- package/dist/Sidebar/SidebarItem.d.mts +3 -3
- package/dist/Sidebar/SidebarItem.mjs +3 -3
- package/dist/Skeleton.d.cts +1 -1
- package/dist/Skeleton.d.mts +1 -1
- package/dist/Switch.cjs +22 -15
- package/dist/Switch.d.cts +2 -2
- package/dist/Switch.d.mts +2 -2
- package/dist/Switch.mjs +24 -17
- 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/TableControl.mjs +2 -2
- 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.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-6PgGpUzM.d.mts → TableContext-DhuRf6Wy.d.mts} +1 -1
- package/dist/{TableContext-CBGk-Lh8.d.cts → TableContext-Duj1nVG7.d.cts} +1 -1
- package/dist/Tabs/Tab.cjs +1 -1
- package/dist/Tabs/Tab.d.cts +2 -2
- package/dist/Tabs/Tab.d.mts +2 -2
- package/dist/Tabs/Tab.mjs +1 -1
- 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.cjs +1 -1
- package/dist/Tabs/TabScrollButton.d.cts +1 -1
- package/dist/Tabs/TabScrollButton.d.mts +1 -1
- package/dist/Tabs/TabScrollButton.mjs +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-YfCUbkQV.mjs → Tabs-BTNOJx5v.mjs} +4 -3
- package/dist/{Tabs-D_wkX-Jb.cjs → Tabs-D4tWCq78.cjs} +7 -6
- 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-C2agsLBN.d.cts → TabsContext-B_XHbjcS.d.cts} +1 -1
- package/dist/{TabsContext-DqyxdmGW.d.mts → TabsContext-Dn2kqUwr.d.mts} +1 -1
- package/dist/TextInput.cjs +3 -3
- package/dist/TextInput.d.cts +2 -2
- package/dist/TextInput.d.mts +2 -2
- package/dist/TextInput.mjs +3 -3
- 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/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.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/catalog.cjs +476 -18
- package/dist/catalog.d.cts +1 -1
- package/dist/catalog.d.mts +1 -1
- package/dist/catalog.mjs +476 -18
- package/dist/engine.d.cts +1 -1
- package/dist/engine.d.mts +1 -1
- package/dist/{index-DCmH5f9I.d.cts → index-B1RFybA_.d.mts} +2 -2
- package/dist/{index-Cj5Rhh_9.d.mts → index-B4TeaB7b.d.cts} +2 -2
- package/dist/{index-DIC7HKpP.d.mts → index-BGbTuHP9.d.mts} +1 -1
- package/dist/{index-BiVvxOvj.d.cts → index-BHKgEOZJ.d.cts} +2 -2
- package/dist/{index-BbgFYfX_.d.mts → index-BQWjh4rK.d.mts} +2 -2
- package/dist/{index-DJCpnTH3.d.mts → index-BelFIizY.d.cts} +3 -3
- package/dist/{index-C3KrFPCj.d.mts → index-BkzZxHVj.d.mts} +2 -2
- package/dist/{index-B8DNxyEw.d.mts → index-BrgwkY6z.d.mts} +2 -2
- package/dist/{index-DqjXDutI.d.mts → index-Bx0-6yeX.d.mts} +1 -1
- package/dist/index-BxVTIMnB.d.cts +1 -0
- package/dist/{index-Bhdn4KTy.d.cts → index-ByYxVl9O.d.mts} +3 -3
- package/dist/{index-gnh-Oe0n.d.cts → index-CE5JG1us.d.mts} +1 -1
- package/dist/{index-XxydXX8l.d.cts → index-CG_1uPrD.d.mts} +2 -2
- package/dist/{index-CVNJEUwJ.d.mts → index-CJhK7JND.d.mts} +49 -1
- package/dist/{index-BjfPEP_5.d.cts → index-CQfJZADG.d.cts} +2 -2
- package/dist/{index-DrVYWt-X.d.mts → index-CUz2h5xY.d.mts} +1 -1
- package/dist/{index-CrIxI8Na.d.mts → index-CbFaWtjK.d.mts} +2 -2
- package/dist/{index-BFruxTHv.d.cts → index-ChXeKJCk.d.cts} +1 -1
- package/dist/{index-DQcnJ5H4.d.cts → index-CknoXDLQ.d.cts} +2 -2
- package/dist/{index-IdMqR82e.d.cts → index-ClZyaZrR.d.mts} +2 -2
- package/dist/{index-Bxd9NOWb.d.mts → index-DAwcmIjN.d.cts} +2 -2
- package/dist/{index-CWnbCxgw.d.cts → index-DGnXJwLj.d.mts} +4 -4
- package/dist/{index-DmJ7yWWi.d.cts → index-DJ0f69wh.d.cts} +49 -1
- package/dist/{index-DckSub2J.d.mts → index-DWjz5ZzG.d.cts} +4 -4
- package/dist/{index-DXhMkjQ6.d.cts → index-DYF8sRE-.d.cts} +2 -2
- package/dist/index-DaIIo5QU.d.mts +1 -0
- package/dist/{index-BVPrG1L0.d.mts → index-DchHf5cF.d.cts} +1 -1
- package/dist/{index-BlLH6rlE.d.cts → index-DtYjdBvO.d.cts} +2 -2
- package/dist/{index-BqpS_Huq.d.mts → index-Dv_fk1_F.d.cts} +19 -3
- package/dist/{index-BSA6SKao.d.mts → index-K5exjvnX.d.cts} +2 -2
- package/dist/{index-BjPX49XA.d.mts → index-KnXhlKMr.d.cts} +1 -1
- package/dist/{index-B3LIhqHR.d.cts → index-WHFhjfgy.d.cts} +4 -4
- package/dist/{index-BCnKYNlZ.d.cts → index-YKrfFC_I.d.cts} +1 -1
- package/dist/{index-CoEqjFYn.d.mts → index-bpnLB_4K.d.mts} +4 -4
- package/dist/{index-DDJuUfL5.d.cts → index-h4dYtVrp.d.mts} +1 -1
- package/dist/{index-qlfNErNd.d.cts → index-ha1WjSZ5.d.mts} +19 -3
- package/dist/{index-DuVNRXP4.d.cts → index-nqUA_6J_.d.cts} +1 -1
- package/dist/{index-DeDxYlSQ.d.mts → index-pTNq3iQn.d.mts} +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- 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.d.cts +2 -2
- package/dist/style.d.mts +2 -2
- package/dist/theme.d.cts +3 -3
- package/dist/theme.d.mts +3 -3
- package/dist/useControlled-C666KpQ0.cjs +18 -0
- package/dist/useControlled-CBRLsO-H.mjs +13 -0
- package/dist/{useTablePagination-C5VKtqDp.d.cts → useTablePagination-C-u3ru4N.d.cts} +1 -1
- package/dist/{useTablePagination-C6LSlt3w.d.mts → useTablePagination-D-39ZmQh.d.mts} +1 -1
- package/package.json +42 -2
- package/dist/index-DBteSahY.d.cts +0 -1
- package/dist/index-_G1osn09.d.mts +0 -1
|
@@ -2,9 +2,10 @@ const require_src = require("./src-DU81aGy9.cjs");
|
|
|
2
2
|
const require_View = require("./View.cjs");
|
|
3
3
|
const require_themeDefault = require("./themeDefault-Cebi08Cv.cjs");
|
|
4
4
|
const require_theme = require("./theme-BxXuXRgQ.cjs");
|
|
5
|
-
const require_Icon = require("./Icon-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const require_Icon = require("./Icon-D-EWsBVg.cjs");
|
|
6
|
+
const require_isRtl = require("./isRtl-DTkYHRPo.cjs");
|
|
7
|
+
const require_MenuItem = require("./MenuItem-BTP7Ijwi.cjs");
|
|
8
|
+
const require_Menu = require("./Menu-Cgg-sX4W.cjs");
|
|
8
9
|
const require_dividerLine = require("./dividerLine-BNljcGlv.cjs");
|
|
9
10
|
const require_Tabs_TabScrollButton = require("./Tabs/TabScrollButton.cjs");
|
|
10
11
|
const require_surfaceSystem = require("./surfaceSystem-BGQBoXv_.cjs");
|
|
@@ -139,7 +140,7 @@ function useTabsScroll(listRef, isEnabled, isVertical) {
|
|
|
139
140
|
const scrollByView = (direction) => {
|
|
140
141
|
const list = listRef.current;
|
|
141
142
|
const isReduced = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
|
|
142
|
-
const distance = (!isVertical &&
|
|
143
|
+
const distance = (!isVertical && require_isRtl.isRtl(list) ? -direction : direction) * (isVertical ? list.clientHeight : list.clientWidth);
|
|
143
144
|
list.scrollBy({
|
|
144
145
|
[isVertical ? "top" : "left"]: distance,
|
|
145
146
|
behavior: isReduced ? "auto" : "smooth"
|
|
@@ -521,8 +522,8 @@ function Tabs({ children, value: valueProp, defaultValue, onChange, onTabClose,
|
|
|
521
522
|
const handleKeyDown = (event) => {
|
|
522
523
|
if (isNavigation || event.target.dataset.tab === void 0) return;
|
|
523
524
|
const list = event.currentTarget;
|
|
524
|
-
const forward =
|
|
525
|
-
const backward =
|
|
525
|
+
const forward = require_isRtl.isRtl(list) ? "ArrowLeft" : "ArrowRight";
|
|
526
|
+
const backward = require_isRtl.isRtl(list) ? "ArrowRight" : "ArrowLeft";
|
|
526
527
|
const nextKey = isVertical ? "ArrowDown" : forward;
|
|
527
528
|
const previousKey = isVertical ? "ArrowUp" : backward;
|
|
528
529
|
let step = STEP_BY_KEY[event.key];
|
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-D4tWCq78.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-B_XHbjcS.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-KnXhlKMr.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-WHFhjfgy.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-Dn2kqUwr.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-CE5JG1us.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-bpnLB_4K.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-BTNOJx5v.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.cjs
CHANGED
|
@@ -65,10 +65,10 @@ const baseStyle = {
|
|
|
65
65
|
alignItems: "center",
|
|
66
66
|
transition: "border-color 0.15s ease"
|
|
67
67
|
};
|
|
68
|
-
const backgroundStyle = ({ theme, textColor = require_themeDefault.themeDefault(theme, "
|
|
68
|
+
const backgroundStyle = ({ theme, textColor, color = require_themeDefault.themeDefault(theme, "color", "primary") }) => {
|
|
69
69
|
return {
|
|
70
70
|
backgroundColor: (0, require_src.src_exports.get)(theme, `background.${require_themeDefault.themeDefault(theme, "inputBg", "terminal")}`),
|
|
71
|
-
color: (0, require_src.src_exports.get)(theme, `text.${textColor}`),
|
|
71
|
+
color: textColor ? (0, require_src.src_exports.get)(theme, `text.${textColor}`) : (0, require_src.src_exports.get)(theme, `palette.${color}.main`),
|
|
72
72
|
fontFamily: (0, require_src.src_exports.get)(theme, "fonts.body"),
|
|
73
73
|
fontSize: (0, require_src.src_exports.get)(theme, "fontSizes.1"),
|
|
74
74
|
lineHeight: (0, require_src.src_exports.get)(theme, "lineHeights.base")
|
|
@@ -178,7 +178,7 @@ function TextInput({ autoComplete, autoFocus, borderRadius, classes, components,
|
|
|
178
178
|
const { id, error, disabled, required, size, fullWidth } = fc;
|
|
179
179
|
const theme = require_theme.useTheme();
|
|
180
180
|
const color = fc.color ?? require_themeDefault.themeDefault(theme, "color", "primary");
|
|
181
|
-
const textColor = fc.textColor
|
|
181
|
+
const textColor = fc.textColor;
|
|
182
182
|
const variant = variantProp ?? require_themeDefault.themeDefault(theme, "inputVariant", "default");
|
|
183
183
|
const isAutoResize = resize;
|
|
184
184
|
const isMultiline = multiline || rows !== void 0 && Number(rows) > 1;
|
package/dist/TextInput.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { W as Theme } from "./index-DJ0f69wh.cjs";
|
|
2
2
|
import { ChangeEventHandler, ElementType, InputHTMLAttributes, TextareaHTMLAttributes } from "react";
|
|
3
3
|
import { LayoutProps, SpaceProps } from "@soroush.tech/styled-system";
|
|
4
4
|
//#region src/TextInput/TextInput.d.ts
|
|
@@ -24,7 +24,7 @@ interface TextInputProps extends SpaceProps<Theme>, Pick<LayoutProps<Theme>, 'wi
|
|
|
24
24
|
};
|
|
25
25
|
/** Focus/active border color - resolves to `theme.palette[color].main`. Default: 'primary', overridable via `theme.defaults.color`. */
|
|
26
26
|
color?: TextInputColor;
|
|
27
|
-
/** Text color of the typed value - resolves against `theme.text`. Default:
|
|
27
|
+
/** Text color of the typed value - resolves against `theme.text`. Default: the accent `color`'s `main`. */
|
|
28
28
|
textColor?: TextInputTextColor;
|
|
29
29
|
/** Disables the input. */
|
|
30
30
|
disabled?: boolean;
|
package/dist/TextInput.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { W as Theme } from "./index-CJhK7JND.mjs";
|
|
2
2
|
import { LayoutProps, SpaceProps } from "@soroush.tech/styled-system";
|
|
3
3
|
import { ChangeEventHandler, ElementType, InputHTMLAttributes, TextareaHTMLAttributes } from "react";
|
|
4
4
|
//#region src/TextInput/TextInput.d.ts
|
|
@@ -24,7 +24,7 @@ interface TextInputProps extends SpaceProps<Theme>, Pick<LayoutProps<Theme>, 'wi
|
|
|
24
24
|
};
|
|
25
25
|
/** Focus/active border color - resolves to `theme.palette[color].main`. Default: 'primary', overridable via `theme.defaults.color`. */
|
|
26
26
|
color?: TextInputColor;
|
|
27
|
-
/** Text color of the typed value - resolves against `theme.text`. Default:
|
|
27
|
+
/** Text color of the typed value - resolves against `theme.text`. Default: the accent `color`'s `main`. */
|
|
28
28
|
textColor?: TextInputTextColor;
|
|
29
29
|
/** Disables the input. */
|
|
30
30
|
disabled?: boolean;
|
package/dist/TextInput.mjs
CHANGED
|
@@ -63,10 +63,10 @@ const baseStyle = {
|
|
|
63
63
|
alignItems: "center",
|
|
64
64
|
transition: "border-color 0.15s ease"
|
|
65
65
|
};
|
|
66
|
-
const backgroundStyle = ({ theme, textColor = themeDefault(theme, "
|
|
66
|
+
const backgroundStyle = ({ theme, textColor, color = themeDefault(theme, "color", "primary") }) => {
|
|
67
67
|
return {
|
|
68
68
|
backgroundColor: (0, src_exports.get)(theme, `background.${themeDefault(theme, "inputBg", "terminal")}`),
|
|
69
|
-
color: (0, src_exports.get)(theme, `text.${textColor}`),
|
|
69
|
+
color: textColor ? (0, src_exports.get)(theme, `text.${textColor}`) : (0, src_exports.get)(theme, `palette.${color}.main`),
|
|
70
70
|
fontFamily: (0, src_exports.get)(theme, "fonts.body"),
|
|
71
71
|
fontSize: (0, src_exports.get)(theme, "fontSizes.1"),
|
|
72
72
|
lineHeight: (0, src_exports.get)(theme, "lineHeights.base")
|
|
@@ -176,7 +176,7 @@ function TextInput({ autoComplete, autoFocus, borderRadius, classes, components,
|
|
|
176
176
|
const { id, error, disabled, required, size, fullWidth } = fc;
|
|
177
177
|
const theme = useTheme();
|
|
178
178
|
const color = fc.color ?? themeDefault(theme, "color", "primary");
|
|
179
|
-
const textColor = fc.textColor
|
|
179
|
+
const textColor = fc.textColor;
|
|
180
180
|
const variant = variantProp ?? themeDefault(theme, "inputVariant", "default");
|
|
181
181
|
const isAutoResize = resize;
|
|
182
182
|
const isMultiline = multiline || rows !== void 0 && Number(rows) > 1;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as ButtonProps } from "../index-
|
|
1
|
+
import { i as ButtonProps } from "../index-DAwcmIjN.cjs";
|
|
2
2
|
import { r as ToggleButtonValue } from "../ToggleButtonGroupContext-10jEsQdg.cjs";
|
|
3
3
|
//#region src/ToggleButton/ToggleButton/ToggleButton.d.ts
|
|
4
4
|
interface ToggleButtonProps extends Omit<ButtonProps, 'variant' | 'href' | 'target' | 'rel' | 'value' | 'onChange'> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as ButtonProps } from "../index-
|
|
1
|
+
import { i as ButtonProps } from "../index-CG_1uPrD.mjs";
|
|
2
2
|
import { r as ToggleButtonValue } from "../ToggleButtonGroupContext-10jEsQdg.mjs";
|
|
3
3
|
//#region src/ToggleButton/ToggleButton/ToggleButton.d.ts
|
|
4
4
|
interface ToggleButtonProps extends Omit<ButtonProps, 'variant' | 'href' | 'target' | 'rel' | 'value' | 'onChange'> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ButtonGroupProps } from "../index-
|
|
1
|
+
import { a as ButtonGroupProps } from "../index-CQfJZADG.cjs";
|
|
2
2
|
import { r as ToggleButtonValue } from "../ToggleButtonGroupContext-10jEsQdg.cjs";
|
|
3
3
|
//#region src/ToggleButton/ToggleButtonGroup/ToggleButtonGroup.d.ts
|
|
4
4
|
interface ToggleButtonGroupProps extends Omit<ButtonGroupProps, 'variant' | 'onChange'> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ButtonGroupProps } from "../index-
|
|
1
|
+
import { a as ButtonGroupProps } from "../index-BrgwkY6z.mjs";
|
|
2
2
|
import { r as ToggleButtonValue } from "../ToggleButtonGroupContext-10jEsQdg.mjs";
|
|
3
3
|
//#region src/ToggleButton/ToggleButtonGroup/ToggleButtonGroup.d.ts
|
|
4
4
|
interface ToggleButtonGroupProps extends Omit<ButtonGroupProps, 'variant' | 'onChange'> {
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_src = require("./src-DU81aGy9.cjs");
|
|
3
|
+
const require_theme = require("./theme-BxXuXRgQ.cjs");
|
|
4
|
+
const require_Typography = require("./Typography.cjs");
|
|
5
|
+
const require_Icon = require("./Icon-D-EWsBVg.cjs");
|
|
6
|
+
const require_Button = require("./Button.cjs");
|
|
7
|
+
const require_Paper = require("./Paper.cjs");
|
|
8
|
+
const require_FormControl = require("./FormControl.cjs");
|
|
9
|
+
const require_Checkbox = require("./Checkbox.cjs");
|
|
10
|
+
const require_useControlled = require("./useControlled-C666KpQ0.cjs");
|
|
11
|
+
let react = require("react");
|
|
12
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
13
|
+
let _soroush_tech_styled_system_should_forward_prop = require("@soroush.tech/styled-system/should-forward-prop");
|
|
14
|
+
//#region src/TransferList/hooks/useTransferList.ts
|
|
15
|
+
const isEnabled = (item) => !item.disabled;
|
|
16
|
+
/**
|
|
17
|
+
* A transfer list's state: which items are on the right (controlled or not), which are checked,
|
|
18
|
+
* and the moves between the sides. A move takes the checked, enabled items of its source - or all
|
|
19
|
+
* the enabled ones, which its button is off without - and unchecks what it moves; the items keep their own order on each side.
|
|
20
|
+
*/
|
|
21
|
+
function useTransferList({ items, value, defaultValue, onChange }) {
|
|
22
|
+
const [rightValues, setRightValues] = require_useControlled.useControlled({
|
|
23
|
+
controlled: value,
|
|
24
|
+
default: defaultValue ?? []
|
|
25
|
+
});
|
|
26
|
+
const [checked, setChecked] = (0, react.useState)([]);
|
|
27
|
+
const isRight = (item) => rightValues.includes(item.value);
|
|
28
|
+
const left = items.filter((item) => !isRight(item));
|
|
29
|
+
const right = items.filter(isRight);
|
|
30
|
+
const sides = {
|
|
31
|
+
left,
|
|
32
|
+
right
|
|
33
|
+
};
|
|
34
|
+
const isChecked = (item) => !item.disabled && checked.includes(item.value);
|
|
35
|
+
const getChecked = (side) => sides[side].filter(isChecked);
|
|
36
|
+
const getEnabled = (side) => sides[side].filter(isEnabled);
|
|
37
|
+
const commit = (next) => {
|
|
38
|
+
setRightValues(next);
|
|
39
|
+
onChange?.(next);
|
|
40
|
+
};
|
|
41
|
+
const toggle = (item) => {
|
|
42
|
+
setChecked((current) => current.includes(item.value) ? current.filter((entry) => entry !== item.value) : [...current, item.value]);
|
|
43
|
+
};
|
|
44
|
+
const toggleAll = (side) => {
|
|
45
|
+
const enabled = getEnabled(side).map((item) => item.value);
|
|
46
|
+
setChecked((current) => {
|
|
47
|
+
const isAll = enabled.every((entry) => current.includes(entry));
|
|
48
|
+
const rest = current.filter((entry) => !enabled.includes(entry));
|
|
49
|
+
return isAll ? rest : [...rest, ...enabled];
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
const move = (to, moving) => {
|
|
53
|
+
const moved = moving.map((item) => item.value);
|
|
54
|
+
setChecked((current) => current.filter((entry) => !moved.includes(entry)));
|
|
55
|
+
commit(to === "right" ? [...rightValues, ...moved] : rightValues.filter((entry) => !moved.includes(entry)));
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
items,
|
|
59
|
+
left,
|
|
60
|
+
right,
|
|
61
|
+
isChecked,
|
|
62
|
+
getChecked,
|
|
63
|
+
getEnabled,
|
|
64
|
+
toggle,
|
|
65
|
+
toggleAll,
|
|
66
|
+
moveRight: () => move("right", getChecked("left")),
|
|
67
|
+
moveLeft: () => move("left", getChecked("right")),
|
|
68
|
+
moveAllRight: () => move("right", getEnabled("left")),
|
|
69
|
+
moveAllLeft: () => move("left", getEnabled("right"))
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/TransferList/TransferList.tsx
|
|
74
|
+
const TransferListRoot = require_src.styled("div", {
|
|
75
|
+
name: "TransferList",
|
|
76
|
+
label: "TransferList",
|
|
77
|
+
shouldForwardProp: (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)([..._soroush_tech_styled_system_should_forward_prop.props, "isDisabled"]),
|
|
78
|
+
systemProps: [require_src.src_exports.space]
|
|
79
|
+
})(({ theme, isDisabled }) => ({
|
|
80
|
+
display: "flex",
|
|
81
|
+
alignItems: "stretch",
|
|
82
|
+
gap: theme.space[2],
|
|
83
|
+
...isDisabled && { opacity: .5 }
|
|
84
|
+
}));
|
|
85
|
+
const TransferListList = require_src.styled(require_Paper.Paper, {
|
|
86
|
+
name: "TransferList",
|
|
87
|
+
slot: "list",
|
|
88
|
+
label: "TransferListList",
|
|
89
|
+
shouldForwardProp: (0, _soroush_tech_styled_system_should_forward_prop.createShouldForwardProp)(["isError"])
|
|
90
|
+
})(({ theme, isError }) => ({
|
|
91
|
+
flex: "1 1 0",
|
|
92
|
+
minWidth: 0,
|
|
93
|
+
overflow: "hidden",
|
|
94
|
+
border: `${theme.borderWidths.thin} solid ${(0, require_src.src_exports.get)(theme, isError ? "palette.error.main" : "border.default")}`
|
|
95
|
+
}));
|
|
96
|
+
const TransferListHeader = require_src.styled("div", {
|
|
97
|
+
name: "TransferList",
|
|
98
|
+
slot: "header",
|
|
99
|
+
label: "TransferListHeader"
|
|
100
|
+
})(({ theme }) => ({
|
|
101
|
+
display: "flex",
|
|
102
|
+
alignItems: "center",
|
|
103
|
+
gap: theme.space[1],
|
|
104
|
+
padding: `${theme.space[1]} ${theme.space[2]}`,
|
|
105
|
+
borderBottom: `${theme.borderWidths.thin} solid ${(0, require_src.src_exports.get)(theme, "border.default")}`
|
|
106
|
+
}));
|
|
107
|
+
const TransferListTitle = require_src.styled("span", {
|
|
108
|
+
name: "TransferList",
|
|
109
|
+
slot: "title",
|
|
110
|
+
label: "TransferListTitle"
|
|
111
|
+
})({
|
|
112
|
+
flex: 1,
|
|
113
|
+
minWidth: 0
|
|
114
|
+
});
|
|
115
|
+
const TransferListCount = require_src.styled("span", {
|
|
116
|
+
name: "TransferList",
|
|
117
|
+
slot: "count",
|
|
118
|
+
label: "TransferListCount"
|
|
119
|
+
})(({ theme }) => ({
|
|
120
|
+
color: theme.text.secondary,
|
|
121
|
+
whiteSpace: "nowrap"
|
|
122
|
+
}));
|
|
123
|
+
const TransferListItems = require_src.styled("div", {
|
|
124
|
+
name: "TransferList",
|
|
125
|
+
slot: "items",
|
|
126
|
+
label: "TransferListItems"
|
|
127
|
+
})({
|
|
128
|
+
height: "14rem",
|
|
129
|
+
overflowY: "auto"
|
|
130
|
+
});
|
|
131
|
+
const TransferListRow = require_src.styled("div", {
|
|
132
|
+
name: "TransferList",
|
|
133
|
+
slot: "item",
|
|
134
|
+
label: "TransferListItem"
|
|
135
|
+
})(({ theme }) => ({
|
|
136
|
+
display: "flex",
|
|
137
|
+
"&:hover": { backgroundColor: (0, require_src.src_exports.get)(theme, "background.secondary") },
|
|
138
|
+
"& > label": {
|
|
139
|
+
flex: 1,
|
|
140
|
+
padding: `${theme.space[1]} ${theme.space[2]}`,
|
|
141
|
+
boxSizing: "border-box"
|
|
142
|
+
}
|
|
143
|
+
}));
|
|
144
|
+
const TransferListControls = require_src.styled("div", {
|
|
145
|
+
name: "TransferList",
|
|
146
|
+
slot: "controls",
|
|
147
|
+
label: "TransferListControls"
|
|
148
|
+
})(({ theme }) => ({
|
|
149
|
+
display: "flex",
|
|
150
|
+
flexDirection: "column",
|
|
151
|
+
justifyContent: "center",
|
|
152
|
+
alignItems: "stretch",
|
|
153
|
+
gap: theme.space[1]
|
|
154
|
+
}));
|
|
155
|
+
const TransferListIcon = require_src.styled("span", {
|
|
156
|
+
name: "TransferList",
|
|
157
|
+
slot: "icon",
|
|
158
|
+
label: "TransferListIcon"
|
|
159
|
+
})({
|
|
160
|
+
display: "inline-flex",
|
|
161
|
+
alignItems: "center",
|
|
162
|
+
"[dir=\"rtl\"] &": { transform: "scaleX(-1)" },
|
|
163
|
+
"& > :nth-of-type(2)": { marginInlineStart: "-0.5em" }
|
|
164
|
+
});
|
|
165
|
+
function List({ side, title, baseId, state, hasSelectAll, getCountLabel, size, color, disabled, isError }) {
|
|
166
|
+
const items = state[side];
|
|
167
|
+
const titleId = `${baseId}-${side}-title`;
|
|
168
|
+
const enabledCount = state.getEnabled(side).length;
|
|
169
|
+
const checkedCount = state.getChecked(side).length;
|
|
170
|
+
const isAll = enabledCount > 0 && checkedCount === enabledCount;
|
|
171
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TransferListList, {
|
|
172
|
+
elevation: 0,
|
|
173
|
+
p: 0,
|
|
174
|
+
isError,
|
|
175
|
+
"data-side": side,
|
|
176
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TransferListHeader, { children: [
|
|
177
|
+
hasSelectAll && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.Checkbox, {
|
|
178
|
+
id: `${baseId}-${side}-all`,
|
|
179
|
+
"aria-labelledby": titleId,
|
|
180
|
+
size,
|
|
181
|
+
color,
|
|
182
|
+
disabled: disabled || enabledCount === 0,
|
|
183
|
+
checked: isAll,
|
|
184
|
+
indeterminate: checkedCount > 0 && !isAll,
|
|
185
|
+
onChange: () => state.toggleAll(side)
|
|
186
|
+
}),
|
|
187
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TransferListTitle, {
|
|
188
|
+
id: titleId,
|
|
189
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.Typography, {
|
|
190
|
+
variant: "subtitle2",
|
|
191
|
+
as: "span",
|
|
192
|
+
children: title
|
|
193
|
+
})
|
|
194
|
+
}),
|
|
195
|
+
hasSelectAll && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TransferListCount, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.Typography, {
|
|
196
|
+
variant: "caption",
|
|
197
|
+
children: getCountLabel(checkedCount, items.length)
|
|
198
|
+
}) })
|
|
199
|
+
] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TransferListItems, {
|
|
200
|
+
role: "list",
|
|
201
|
+
"aria-labelledby": title ? titleId : void 0,
|
|
202
|
+
children: items.map((item) => {
|
|
203
|
+
const position = state.items.indexOf(item);
|
|
204
|
+
const labelId = `${baseId}-${position}-label`;
|
|
205
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TransferListRow, {
|
|
206
|
+
role: "listitem",
|
|
207
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Checkbox.Checkbox, {
|
|
208
|
+
id: `${baseId}-${position}`,
|
|
209
|
+
"aria-labelledby": labelId,
|
|
210
|
+
size,
|
|
211
|
+
color,
|
|
212
|
+
disabled: disabled || item.disabled,
|
|
213
|
+
checked: state.isChecked(item),
|
|
214
|
+
onChange: () => state.toggle(item),
|
|
215
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.Typography, {
|
|
216
|
+
variant: "body2",
|
|
217
|
+
as: "span",
|
|
218
|
+
id: labelId,
|
|
219
|
+
children: item.label
|
|
220
|
+
})
|
|
221
|
+
})
|
|
222
|
+
}, item.value);
|
|
223
|
+
})
|
|
224
|
+
})]
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* @description A transfer list: two lists, and the buttons that move the checked items from one
|
|
229
|
+
* to the other. Each list is a list of rows whose checkbox is the row, so it is one tab stop and
|
|
230
|
+
* the label toggles it. The value is the values on the right; the items keep their own order on
|
|
231
|
+
* each side. A disabled item stays where it is. Every name - the lists' titles, the four buttons -
|
|
232
|
+
* is the app's, so it carries no language of its own. In a `FormControl` it takes the field's
|
|
233
|
+
* size, color, error and disabled state, and its `FormLabel` names the group.
|
|
234
|
+
*/
|
|
235
|
+
function TransferList({ items, value, defaultValue, onChange, leftLabel, rightLabel, moveAllRightLabel: moveAllRightLabelProp, moveRightLabel: moveRightLabelProp, moveLeftLabel: moveLeftLabelProp, moveAllLeftLabel: moveAllLeftLabelProp, shouldShowMoveAll: shouldShowMoveAllProp, hasSelectAll: hasSelectAllProp, getCountLabel = (checked, total) => `${checked}/${total}`, size: sizeProp, color: colorProp, disabled: disabledProp, error: errorProp, id: idProp, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "data-testid": dataTestid, ...spaceProps }) {
|
|
236
|
+
const dp = require_theme.useDefaultProps("TransferList");
|
|
237
|
+
const fc = require_FormControl.useFormControl({
|
|
238
|
+
id: idProp,
|
|
239
|
+
error: errorProp,
|
|
240
|
+
disabled: disabledProp,
|
|
241
|
+
size: sizeProp ?? dp.size,
|
|
242
|
+
color: colorProp ?? dp.color
|
|
243
|
+
});
|
|
244
|
+
const baseId = (0, react.useId)();
|
|
245
|
+
const moveAllRightLabel = moveAllRightLabelProp ?? dp.moveAllRightLabel;
|
|
246
|
+
const moveRightLabel = moveRightLabelProp ?? dp.moveRightLabel;
|
|
247
|
+
const moveLeftLabel = moveLeftLabelProp ?? dp.moveLeftLabel;
|
|
248
|
+
const moveAllLeftLabel = moveAllLeftLabelProp ?? dp.moveAllLeftLabel;
|
|
249
|
+
const shouldShowMoveAll = shouldShowMoveAllProp ?? dp.shouldShowMoveAll ?? false;
|
|
250
|
+
const hasSelectAll = hasSelectAllProp ?? dp.hasSelectAll ?? false;
|
|
251
|
+
const state = useTransferList({
|
|
252
|
+
items,
|
|
253
|
+
value,
|
|
254
|
+
defaultValue,
|
|
255
|
+
onChange
|
|
256
|
+
});
|
|
257
|
+
const buttonProps = {
|
|
258
|
+
variant: "outlined",
|
|
259
|
+
size: fc.size,
|
|
260
|
+
color: fc.color
|
|
261
|
+
};
|
|
262
|
+
const isOff = (side, ofChecked) => fc.disabled || (ofChecked ? state.getChecked(side).length === 0 : state.getEnabled(side).length === 0);
|
|
263
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TransferListRoot, {
|
|
264
|
+
id: fc.id,
|
|
265
|
+
role: "group",
|
|
266
|
+
isDisabled: fc.disabled,
|
|
267
|
+
className,
|
|
268
|
+
"data-testid": dataTestid,
|
|
269
|
+
"aria-label": ariaLabel,
|
|
270
|
+
"aria-labelledby": ariaLabelledby ?? fc.labelId,
|
|
271
|
+
"aria-describedby": ariaDescribedby ?? fc["aria-describedby"],
|
|
272
|
+
...spaceProps,
|
|
273
|
+
children: [
|
|
274
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(List, {
|
|
275
|
+
side: "left",
|
|
276
|
+
title: leftLabel,
|
|
277
|
+
baseId,
|
|
278
|
+
state,
|
|
279
|
+
hasSelectAll,
|
|
280
|
+
getCountLabel,
|
|
281
|
+
size: fc.size,
|
|
282
|
+
color: fc.color,
|
|
283
|
+
disabled: fc.disabled,
|
|
284
|
+
isError: fc.error
|
|
285
|
+
}),
|
|
286
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TransferListControls, { children: [
|
|
287
|
+
shouldShowMoveAll && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Button.Button, {
|
|
288
|
+
...buttonProps,
|
|
289
|
+
"aria-label": moveAllRightLabel,
|
|
290
|
+
disabled: isOff("left", false),
|
|
291
|
+
onClick: state.moveAllRight,
|
|
292
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TransferListIcon, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
293
|
+
name: "chevron_right",
|
|
294
|
+
size: "1em",
|
|
295
|
+
color: "inherit"
|
|
296
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
297
|
+
name: "chevron_right",
|
|
298
|
+
size: "1em",
|
|
299
|
+
color: "inherit"
|
|
300
|
+
})] })
|
|
301
|
+
}),
|
|
302
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Button.Button, {
|
|
303
|
+
...buttonProps,
|
|
304
|
+
"aria-label": moveRightLabel,
|
|
305
|
+
disabled: isOff("left", true),
|
|
306
|
+
onClick: state.moveRight,
|
|
307
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TransferListIcon, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
308
|
+
name: "chevron_right",
|
|
309
|
+
size: "1em",
|
|
310
|
+
color: "inherit"
|
|
311
|
+
}) })
|
|
312
|
+
}),
|
|
313
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Button.Button, {
|
|
314
|
+
...buttonProps,
|
|
315
|
+
"aria-label": moveLeftLabel,
|
|
316
|
+
disabled: isOff("right", true),
|
|
317
|
+
onClick: state.moveLeft,
|
|
318
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TransferListIcon, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
319
|
+
name: "chevron_left",
|
|
320
|
+
size: "1em",
|
|
321
|
+
color: "inherit"
|
|
322
|
+
}) })
|
|
323
|
+
}),
|
|
324
|
+
shouldShowMoveAll && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Button.Button, {
|
|
325
|
+
...buttonProps,
|
|
326
|
+
"aria-label": moveAllLeftLabel,
|
|
327
|
+
disabled: isOff("right", false),
|
|
328
|
+
onClick: state.moveAllLeft,
|
|
329
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TransferListIcon, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
330
|
+
name: "chevron_left",
|
|
331
|
+
size: "1em",
|
|
332
|
+
color: "inherit"
|
|
333
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
334
|
+
name: "chevron_left",
|
|
335
|
+
size: "1em",
|
|
336
|
+
color: "inherit"
|
|
337
|
+
})] })
|
|
338
|
+
})
|
|
339
|
+
] }),
|
|
340
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(List, {
|
|
341
|
+
side: "right",
|
|
342
|
+
title: rightLabel,
|
|
343
|
+
baseId,
|
|
344
|
+
state,
|
|
345
|
+
hasSelectAll,
|
|
346
|
+
getCountLabel,
|
|
347
|
+
size: fc.size,
|
|
348
|
+
color: fc.color,
|
|
349
|
+
disabled: fc.disabled,
|
|
350
|
+
isError: fc.error
|
|
351
|
+
})
|
|
352
|
+
]
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
//#endregion
|
|
356
|
+
exports.TransferList = TransferList;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { W as Theme } from "./index-DJ0f69wh.cjs";
|
|
2
|
+
import { SpaceProps } from "@soroush.tech/styled-system";
|
|
3
|
+
//#region src/TransferList/hooks/useTransferList.d.ts
|
|
4
|
+
type TransferListValue = string | number;
|
|
5
|
+
interface TransferListItem {
|
|
6
|
+
/** What `value` holds for it - unique among the items. */
|
|
7
|
+
value: TransferListValue;
|
|
8
|
+
/** What the row says, and what names its checkbox. */
|
|
9
|
+
label: string;
|
|
10
|
+
/** Stays where it is and can't be checked. */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/TransferList/TransferList.d.ts
|
|
15
|
+
interface TransferListProps extends SpaceProps<Theme> {
|
|
16
|
+
/** Every item, on either side. */
|
|
17
|
+
items: readonly TransferListItem[];
|
|
18
|
+
/** The values on the right. Controlled with `onChange`. */
|
|
19
|
+
value?: readonly TransferListValue[];
|
|
20
|
+
/** The values on the right at first, when uncontrolled. Default: none. */
|
|
21
|
+
defaultValue?: readonly TransferListValue[];
|
|
22
|
+
/** Fired as items move, with the values now on the right. */
|
|
23
|
+
onChange?: (value: TransferListValue[]) => void;
|
|
24
|
+
/** The left list's title, which names it. */
|
|
25
|
+
leftLabel?: string;
|
|
26
|
+
/** The right list's title, which names it. */
|
|
27
|
+
rightLabel?: string;
|
|
28
|
+
/** Names the button that moves every item right. */
|
|
29
|
+
moveAllRightLabel?: string;
|
|
30
|
+
/** Names the button that moves the checked items right. */
|
|
31
|
+
moveRightLabel?: string;
|
|
32
|
+
/** Names the button that moves the checked items left. */
|
|
33
|
+
moveLeftLabel?: string;
|
|
34
|
+
/** Names the button that moves every item left. */
|
|
35
|
+
moveAllLeftLabel?: string;
|
|
36
|
+
/** Adds the buttons that move every enabled item at once. Default: `false`. */
|
|
37
|
+
shouldShowMoveAll?: boolean;
|
|
38
|
+
/** A checkbox in each list's header - all, some or none checked - and the count beside it. Default: `false`. */
|
|
39
|
+
hasSelectAll?: boolean;
|
|
40
|
+
/** The count in a header: what is checked, of how many. Default: `n/total`. */
|
|
41
|
+
getCountLabel?: (checked: number, total: number) => string;
|
|
42
|
+
/** The checkboxes' and buttons' size. Default: its `FormControl`'s, else `'md'`. */
|
|
43
|
+
size?: keyof Theme['sizes'];
|
|
44
|
+
/** The checkboxes' and buttons' color - resolves to `theme.palette`. Default: its `FormControl`'s. */
|
|
45
|
+
color?: keyof Theme['palette'];
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/** The lists take the error color. */
|
|
48
|
+
error?: boolean;
|
|
49
|
+
/** On the group, which a `FormLabel` names it by. Default: its `FormControl`'s. */
|
|
50
|
+
id?: string;
|
|
51
|
+
className?: string;
|
|
52
|
+
'aria-label'?: string;
|
|
53
|
+
'aria-labelledby'?: string;
|
|
54
|
+
'aria-describedby'?: string;
|
|
55
|
+
'data-testid'?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @description A transfer list: two lists, and the buttons that move the checked items from one
|
|
59
|
+
* to the other. Each list is a list of rows whose checkbox is the row, so it is one tab stop and
|
|
60
|
+
* the label toggles it. The value is the values on the right; the items keep their own order on
|
|
61
|
+
* each side. A disabled item stays where it is. Every name - the lists' titles, the four buttons -
|
|
62
|
+
* is the app's, so it carries no language of its own. In a `FormControl` it takes the field's
|
|
63
|
+
* size, color, error and disabled state, and its `FormLabel` names the group.
|
|
64
|
+
*/
|
|
65
|
+
declare function TransferList({ items, value, defaultValue, onChange, leftLabel, rightLabel, moveAllRightLabel: moveAllRightLabelProp, moveRightLabel: moveRightLabelProp, moveLeftLabel: moveLeftLabelProp, moveAllLeftLabel: moveAllLeftLabelProp, shouldShowMoveAll: shouldShowMoveAllProp, hasSelectAll: hasSelectAllProp, getCountLabel, size: sizeProp, color: colorProp, disabled: disabledProp, error: errorProp, id: idProp, className, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, 'data-testid': dataTestid, ...spaceProps }: Readonly<TransferListProps>): import("react").JSX.Element;
|
|
66
|
+
//#endregion
|
|
67
|
+
export { TransferList, type TransferListItem, TransferListProps, type TransferListValue };
|