@wireapp/react-ui-kit 9.51.0 → 9.52.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/lib/Form/Button.d.ts +1 -1
- package/lib/Form/Button.d.ts.map +1 -1
- package/lib/Form/Button.js +3 -2
- package/lib/Form/Button.stories.d.ts +1 -1
- package/lib/Misc/Breadcrumbs/BreadcrumbItem/BreadcrumbItem.d.ts +9 -0
- package/lib/Misc/Breadcrumbs/BreadcrumbItem/BreadcrumbItem.d.ts.map +1 -0
- package/lib/Misc/Breadcrumbs/BreadcrumbItem/BreadcrumbItem.js +9 -0
- package/lib/Misc/Breadcrumbs/BreadcrumbItem/BreadcrumbItem.styles.d.ts +5 -0
- package/lib/Misc/Breadcrumbs/BreadcrumbItem/BreadcrumbItem.styles.d.ts.map +1 -0
- package/lib/Misc/Breadcrumbs/BreadcrumbItem/BreadcrumbItem.styles.js +44 -0
- package/lib/Misc/Breadcrumbs/BreadcrumbLeaf/BreadcrumbLeaf.d.ts +2 -0
- package/lib/Misc/Breadcrumbs/BreadcrumbLeaf/BreadcrumbLeaf.d.ts.map +1 -0
- package/lib/Misc/Breadcrumbs/BreadcrumbLeaf/BreadcrumbLeaf.js +28 -0
- package/lib/Misc/Breadcrumbs/BreadcrumbLeaf/BreadcrumbLeaf.styles.d.ts +3 -0
- package/lib/Misc/Breadcrumbs/BreadcrumbLeaf/BreadcrumbLeaf.styles.d.ts.map +1 -0
- package/lib/Misc/Breadcrumbs/BreadcrumbLeaf/BreadcrumbLeaf.styles.js +24 -0
- package/lib/Misc/Breadcrumbs/Breadcrumbs.d.ts +26 -0
- package/lib/Misc/Breadcrumbs/Breadcrumbs.d.ts.map +1 -0
- package/lib/Misc/Breadcrumbs/Breadcrumbs.js +49 -0
- package/lib/Misc/Breadcrumbs/Breadcrumbs.stories.d.ts +8 -0
- package/lib/Misc/Breadcrumbs/Breadcrumbs.stories.d.ts.map +1 -0
- package/lib/Misc/Breadcrumbs/Breadcrumbs.stories.js +19 -0
- package/lib/Misc/Breadcrumbs/Breadcrumbs.styles.d.ts +3 -0
- package/lib/Misc/Breadcrumbs/Breadcrumbs.styles.d.ts.map +1 -0
- package/lib/Misc/Breadcrumbs/Breadcrumbs.styles.js +30 -0
- package/lib/Misc/Breadcrumbs/CombainedBreadcrumbs/CombainedBreadcrumbs.d.ts +11 -0
- package/lib/Misc/Breadcrumbs/CombainedBreadcrumbs/CombainedBreadcrumbs.d.ts.map +1 -0
- package/lib/Misc/Breadcrumbs/CombainedBreadcrumbs/CombainedBreadcrumbs.js +28 -0
- package/lib/Misc/Breadcrumbs/CombainedBreadcrumbs/CombainedBreadcrumbs.styles.d.ts +3 -0
- package/lib/Misc/Breadcrumbs/CombainedBreadcrumbs/CombainedBreadcrumbs.styles.d.ts.map +1 -0
- package/lib/Misc/Breadcrumbs/CombainedBreadcrumbs/CombainedBreadcrumbs.styles.js +33 -0
- package/lib/Misc/Breadcrumbs/index.d.ts +2 -0
- package/lib/Misc/Breadcrumbs/index.d.ts.map +1 -0
- package/lib/Misc/Breadcrumbs/index.js +35 -0
- package/lib/Misc/ButtonGroup.d.ts +1 -1
- package/lib/Misc/ButtonGroup.d.ts.map +1 -1
- package/lib/Misc/ButtonGroup.js +23 -3
- package/lib/Misc/IconButton.d.ts +1 -1
- package/lib/Misc/IconButton.d.ts.map +1 -1
- package/lib/Misc/IconButton.js +21 -2
- package/lib/Misc/index.d.ts +1 -0
- package/lib/Misc/index.d.ts.map +1 -1
- package/lib/Misc/index.js +1 -0
- package/lib/Modal/DropdownMenu/DropdownMenu.d.ts +52 -0
- package/lib/Modal/DropdownMenu/DropdownMenu.d.ts.map +1 -0
- package/lib/Modal/DropdownMenu/DropdownMenu.js +77 -0
- package/lib/Modal/DropdownMenu/DropdownMenu.stories.d.ts +10 -0
- package/lib/Modal/DropdownMenu/DropdownMenu.stories.d.ts.map +1 -0
- package/lib/Modal/DropdownMenu/DropdownMenu.stories.js +28 -0
- package/lib/Modal/DropdownMenu/DropdownMenu.styles.d.ts +6 -0
- package/lib/Modal/DropdownMenu/DropdownMenu.styles.d.ts.map +1 -0
- package/lib/Modal/DropdownMenu/DropdownMenu.styles.js +122 -0
- package/lib/Modal/DropdownMenu/index.d.ts +2 -0
- package/lib/Modal/DropdownMenu/index.d.ts.map +1 -0
- package/lib/Modal/DropdownMenu/index.js +35 -0
- package/lib/Modal/index.d.ts +1 -0
- package/lib/Modal/index.d.ts.map +1 -1
- package/lib/Modal/index.js +1 -0
- package/lib/Text/Label.stories.d.ts +1 -1
- package/lib/Theme/GlobalCssVariables.d.ts +1 -0
- package/lib/Theme/GlobalCssVariables.d.ts.map +1 -1
- package/lib/Theme/GlobalCssVariables.js +25 -0
- package/lib/util.d.ts +1 -0
- package/lib/util.d.ts.map +1 -1
- package/lib/util.js +7 -1
- package/package.json +3 -2
package/lib/Form/Button.d.ts
CHANGED
|
@@ -16,6 +16,6 @@ export interface ButtonProps<T = HTMLButtonElement> extends TextProps<T> {
|
|
|
16
16
|
showLoading?: boolean;
|
|
17
17
|
isActive?: boolean;
|
|
18
18
|
}
|
|
19
|
-
export declare const Button: (
|
|
19
|
+
export declare const Button: import("react").ForwardRefExoticComponent<Omit<ButtonProps<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
20
20
|
export declare const filterButtonProps: (props: ButtonProps) => Object;
|
|
21
21
|
//# sourceMappingURL=Button.d.ts.map
|
package/lib/Form/Button.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/Form/Button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/Form/Button.tsx"],"names":[],"mappings":"AA0BA,OAAO,EAAC,SAAS,EAAkB,MAAM,SAAS,CAAC;AAGnD,oBAAY,aAAa;IACvB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAED,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,iBAAiB,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IACtE,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,MAAM,2IAMlB,CAAC;AAIF,eAAO,MAAM,iBAAiB,UAAW,WAAW,WAEnD,CAAC"}
|
package/lib/Form/Button.js
CHANGED
|
@@ -20,6 +20,7 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
|
20
20
|
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
+
const react_1 = require("react");
|
|
23
24
|
const Button_styles_1 = require("./Button.styles");
|
|
24
25
|
const Identity_1 = require("../Identity");
|
|
25
26
|
const Misc_1 = require("../Misc");
|
|
@@ -34,8 +35,8 @@ var ButtonVariant;
|
|
|
34
35
|
ButtonVariant["SEND"] = "send";
|
|
35
36
|
ButtonVariant["CANCEL"] = "cancel";
|
|
36
37
|
})(ButtonVariant || (exports.ButtonVariant = ButtonVariant = {}));
|
|
37
|
-
|
|
38
|
-
exports.Button = Button;
|
|
38
|
+
exports.Button = (0, react_1.forwardRef)(({ showLoading, children, loadingColor = Identity_1.COLOR.WHITE, ...props }, ref) => ((0, jsx_runtime_1.jsx)("button", { ref: ref, css: (theme) => (0, Button_styles_1.buttonStyle)(theme, props), ...(0, exports.filterButtonProps)(props), children: showLoading ? (0, jsx_runtime_1.jsx)(Misc_1.Loading, { size: 30, color: loadingColor, style: { display: 'flex', margin: 'auto' } }) : children })));
|
|
39
|
+
exports.Button.displayName = 'Button';
|
|
39
40
|
const filterButtonProps = (props) => {
|
|
40
41
|
return (0, util_1.filterProps)((0, Text_1.filterTextProps)(props), ['backgroundColor', 'noCapital']);
|
|
41
42
|
};
|
|
@@ -2,7 +2,7 @@ import type { StoryObj } from '@storybook/react';
|
|
|
2
2
|
import { ButtonVariant } from './Button';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: (
|
|
5
|
+
component: import("react").ForwardRefExoticComponent<Omit<import("./Button").ButtonProps<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
6
6
|
parameters: {
|
|
7
7
|
layout: string;
|
|
8
8
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MouseEvent as ReactMouseEvent } from 'react';
|
|
2
|
+
interface BreadcrumbItemProps {
|
|
3
|
+
name: string;
|
|
4
|
+
isActive: boolean;
|
|
5
|
+
onClick: (event: ReactMouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const BreadcrumbItem: ({ name, isActive, onClick }: BreadcrumbItemProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=BreadcrumbItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BreadcrumbItem.d.ts","sourceRoot":"","sources":["../../../../src/Misc/Breadcrumbs/BreadcrumbItem/BreadcrumbItem.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,IAAI,eAAe,EAAC,MAAM,OAAO,CAAC;AAIpD,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,iBAAiB,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;CAC1E;AAED,eAAO,MAAM,cAAc,gCAA+B,mBAAmB,qDAY5E,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BreadcrumbItem = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const BreadcrumbItem_styles_1 = require("./BreadcrumbItem.styles");
|
|
6
|
+
const BreadcrumbItem = ({ name, isActive, onClick }) => {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)("li", { css: BreadcrumbItem_styles_1.listItemStyles, children: isActive ? ((0, jsx_runtime_1.jsx)("span", { css: BreadcrumbItem_styles_1.activeItemStyles, children: name })) : ((0, jsx_runtime_1.jsx)("button", { type: "button", css: BreadcrumbItem_styles_1.buttonStyles, onClick: onClick, children: name })) }));
|
|
8
|
+
};
|
|
9
|
+
exports.BreadcrumbItem = BreadcrumbItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BreadcrumbItem.styles.d.ts","sourceRoot":"","sources":["../../../../src/Misc/Breadcrumbs/BreadcrumbItem/BreadcrumbItem.styles.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAIzC,eAAO,MAAM,cAAc,EAAE,SAI5B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,SAW1B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,SAK9B,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Wire
|
|
4
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.activeItemStyles = exports.buttonStyles = exports.listItemStyles = void 0;
|
|
22
|
+
const colors_v2_1 = require("../../../Identity/colors-v2");
|
|
23
|
+
exports.listItemStyles = {
|
|
24
|
+
display: 'flex',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
flexShrink: 0,
|
|
27
|
+
};
|
|
28
|
+
exports.buttonStyles = {
|
|
29
|
+
background: 'none',
|
|
30
|
+
border: 'none',
|
|
31
|
+
padding: '0 8px',
|
|
32
|
+
cursor: 'pointer',
|
|
33
|
+
fontSize: '14px',
|
|
34
|
+
color: colors_v2_1.COLOR_V2.GRAY_70,
|
|
35
|
+
'&:hover': {
|
|
36
|
+
color: 'var(--main-color)',
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
exports.activeItemStyles = {
|
|
40
|
+
display: 'inline-block',
|
|
41
|
+
padding: '0 8px',
|
|
42
|
+
fontSize: '14px',
|
|
43
|
+
color: 'var(--main-color)',
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BreadcrumbLeaf.d.ts","sourceRoot":"","sources":["../../../../src/Misc/Breadcrumbs/BreadcrumbLeaf/BreadcrumbLeaf.tsx"],"names":[],"mappings":"AAuBA,eAAO,MAAM,cAAc,wDAM1B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BreadcrumbLeaf = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
/*
|
|
6
|
+
* Wire
|
|
7
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
8
|
+
*
|
|
9
|
+
* This program is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const BreadcrumbLeaf_styles_1 = require("./BreadcrumbLeaf.styles");
|
|
24
|
+
const Icon_1 = require("../../../Icon");
|
|
25
|
+
const BreadcrumbLeaf = () => {
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)("li", { "aria-hidden": "true", children: (0, jsx_runtime_1.jsx)(Icon_1.ChevronUpIcon, { css: BreadcrumbLeaf_styles_1.iconStyles, width: 12, height: 12 }) }));
|
|
27
|
+
};
|
|
28
|
+
exports.BreadcrumbLeaf = BreadcrumbLeaf;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BreadcrumbLeaf.styles.d.ts","sourceRoot":"","sources":["../../../../src/Misc/Breadcrumbs/BreadcrumbLeaf/BreadcrumbLeaf.styles.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAEzC,eAAO,MAAM,UAAU,EAAE,SAExB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Wire
|
|
4
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.iconStyles = void 0;
|
|
22
|
+
exports.iconStyles = {
|
|
23
|
+
transform: 'rotate(90deg)',
|
|
24
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface BreadcrumbsProps {
|
|
2
|
+
/**
|
|
3
|
+
* Maximum number of items to display before combining middle items into a dropdown.
|
|
4
|
+
* @default 4
|
|
5
|
+
*/
|
|
6
|
+
maxNotCombinedItems?: number;
|
|
7
|
+
items: Array<{
|
|
8
|
+
name: string;
|
|
9
|
+
}>;
|
|
10
|
+
onItemClick: (item: {
|
|
11
|
+
name: string;
|
|
12
|
+
}) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A navigation component that displays a hierarchical path of items, allowing users to navigate through different levels.
|
|
16
|
+
* When the number of items exceeds the maximum visible limit, it combines middle items into a dropdown menu
|
|
17
|
+
* while keeping the first and last two items visible.
|
|
18
|
+
*
|
|
19
|
+
* Example:
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <Breadcrumbs items={[{name: 'Home'}, {name: 'Folder'}, {name: 'Subfolder'}]} onItemClick={() => {}} />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const Breadcrumbs: ({ maxNotCombinedItems, items, onItemClick, }: BreadcrumbsProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=Breadcrumbs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../../src/Misc/Breadcrumbs/Breadcrumbs.tsx"],"names":[],"mappings":"AA0BA,UAAU,gBAAgB;IACxB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B,KAAK,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,CAAC,CAAC;IAE7B,WAAW,EAAE,CAAC,IAAI,EAAE;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,KAAK,IAAI,CAAC;CAC7C;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,iDAIrB,gBAAgB,qDA6ClB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Breadcrumbs = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
/*
|
|
6
|
+
* Wire
|
|
7
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
8
|
+
*
|
|
9
|
+
* This program is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const BreadcrumbItem_1 = require("./BreadcrumbItem/BreadcrumbItem");
|
|
24
|
+
const BreadcrumbLeaf_1 = require("./BreadcrumbLeaf/BreadcrumbLeaf");
|
|
25
|
+
const Breadcrumbs_styles_1 = require("./Breadcrumbs.styles");
|
|
26
|
+
const CombainedBreadcrumbs_1 = require("./CombainedBreadcrumbs/CombainedBreadcrumbs");
|
|
27
|
+
const DEFAULT_MAX_VISIBLE_BREADCRUMBS = 4;
|
|
28
|
+
/**
|
|
29
|
+
* A navigation component that displays a hierarchical path of items, allowing users to navigate through different levels.
|
|
30
|
+
* When the number of items exceeds the maximum visible limit, it combines middle items into a dropdown menu
|
|
31
|
+
* while keeping the first and last two items visible.
|
|
32
|
+
*
|
|
33
|
+
* Example:
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <Breadcrumbs items={[{name: 'Home'}, {name: 'Folder'}, {name: 'Subfolder'}]} onItemClick={() => {}} />
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
const Breadcrumbs = ({ maxNotCombinedItems = DEFAULT_MAX_VISIBLE_BREADCRUMBS, items, onItemClick, }) => {
|
|
39
|
+
if (items.length <= maxNotCombinedItems) {
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)("ol", { css: Breadcrumbs_styles_1.listStyles, children: items.map((crumb, index) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [index > 0 && (0, jsx_runtime_1.jsx)(BreadcrumbLeaf_1.BreadcrumbLeaf, {}), (0, jsx_runtime_1.jsx)(BreadcrumbItem_1.BreadcrumbItem, { name: crumb.name, isActive: index === items.length - 1, onClick: () => onItemClick(crumb) }, crumb.name)] }))) }));
|
|
41
|
+
}
|
|
42
|
+
const firstCrumb = items[0];
|
|
43
|
+
// eslint-disable-next-line no-magic-numbers
|
|
44
|
+
const lastTwoCrumbs = items.slice(-2);
|
|
45
|
+
// eslint-disable-next-line no-magic-numbers
|
|
46
|
+
const middleCrumbs = items.slice(1, -2);
|
|
47
|
+
return ((0, jsx_runtime_1.jsxs)("ol", { css: Breadcrumbs_styles_1.listStyles, children: [(0, jsx_runtime_1.jsx)(BreadcrumbItem_1.BreadcrumbItem, { name: firstCrumb.name, isActive: false, onClick: () => onItemClick(firstCrumb) }), (0, jsx_runtime_1.jsx)(BreadcrumbLeaf_1.BreadcrumbLeaf, {}), (0, jsx_runtime_1.jsx)(CombainedBreadcrumbs_1.CombainedBreadcrumbs, { items: middleCrumbs, onItemClick: onItemClick }), (0, jsx_runtime_1.jsx)(BreadcrumbLeaf_1.BreadcrumbLeaf, {}), lastTwoCrumbs.map((crumb, index) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [index > 0 && (0, jsx_runtime_1.jsx)(BreadcrumbLeaf_1.BreadcrumbLeaf, {}), (0, jsx_runtime_1.jsx)(BreadcrumbItem_1.BreadcrumbItem, { name: crumb.name, isActive: index === lastTwoCrumbs.length - 1, onClick: () => onItemClick(crumb) }, crumb.name)] })))] }));
|
|
48
|
+
};
|
|
49
|
+
exports.Breadcrumbs = Breadcrumbs;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react/*';
|
|
2
|
+
import { Breadcrumbs } from './Breadcrumbs';
|
|
3
|
+
declare const meta: Meta<typeof Breadcrumbs>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Breadcrumbs>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithCombinedItems: Story;
|
|
8
|
+
//# sourceMappingURL=Breadcrumbs.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Breadcrumbs.stories.d.ts","sourceRoot":"","sources":["../../../src/Misc/Breadcrumbs/Breadcrumbs.stories.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAC,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAE1C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,WAAW,CAMlC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAC;AAE1C,eAAO,MAAM,OAAO,EAAE,KAErB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAO/B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WithCombinedItems = exports.Default = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const Breadcrumbs_1 = require("./Breadcrumbs");
|
|
6
|
+
const meta = {
|
|
7
|
+
component: Breadcrumbs_1.Breadcrumbs,
|
|
8
|
+
title: 'Misc/Breadcrumbs',
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
exports.default = meta;
|
|
14
|
+
exports.Default = {
|
|
15
|
+
render: () => (0, jsx_runtime_1.jsx)(Breadcrumbs_1.Breadcrumbs, { items: [{ name: 'Home' }, { name: 'Folder' }, { name: 'Subfolder' }], onItemClick: () => { } }),
|
|
16
|
+
};
|
|
17
|
+
exports.WithCombinedItems = {
|
|
18
|
+
render: () => ((0, jsx_runtime_1.jsx)(Breadcrumbs_1.Breadcrumbs, { items: [{ name: 'Home' }, { name: 'Folder' }, { name: 'Subfolder 1' }, { name: 'Subfolder 2' }, { name: 'Subfolder 3' }], onItemClick: () => { } })),
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Breadcrumbs.styles.d.ts","sourceRoot":"","sources":["../../../src/Misc/Breadcrumbs/Breadcrumbs.styles.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAEzC,eAAO,MAAM,UAAU,EAAE,SAQxB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Wire
|
|
4
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.listStyles = void 0;
|
|
22
|
+
exports.listStyles = {
|
|
23
|
+
display: 'flex',
|
|
24
|
+
padding: '0',
|
|
25
|
+
margin: '0',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
listStyle: 'none',
|
|
28
|
+
flexGrow: 1,
|
|
29
|
+
overflowX: 'auto',
|
|
30
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface CombainedBreadcrumbsProps {
|
|
2
|
+
items: Array<{
|
|
3
|
+
name: string;
|
|
4
|
+
}>;
|
|
5
|
+
onItemClick: (item: {
|
|
6
|
+
name: string;
|
|
7
|
+
}) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const CombainedBreadcrumbs: ({ items, onItemClick }: CombainedBreadcrumbsProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=CombainedBreadcrumbs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CombainedBreadcrumbs.d.ts","sourceRoot":"","sources":["../../../../src/Misc/Breadcrumbs/CombainedBreadcrumbs/CombainedBreadcrumbs.tsx"],"names":[],"mappings":"AAuBA,UAAU,yBAAyB;IACjC,KAAK,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,CAAC,CAAC;IAC7B,WAAW,EAAE,CAAC,IAAI,EAAE;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,KAAK,IAAI,CAAC;CAC7C;AAED,eAAO,MAAM,oBAAoB,2BAA0B,yBAAyB,qDAmBnF,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CombainedBreadcrumbs = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
/*
|
|
6
|
+
* Wire
|
|
7
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
8
|
+
*
|
|
9
|
+
* This program is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const CombainedBreadcrumbs_styles_1 = require("./CombainedBreadcrumbs.styles");
|
|
24
|
+
const DropdownMenu_1 = require("../../../Modal/DropdownMenu");
|
|
25
|
+
const CombainedBreadcrumbs = ({ items, onItemClick }) => {
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(DropdownMenu_1.DropdownMenu, { children: [(0, jsx_runtime_1.jsx)(DropdownMenu_1.DropdownMenu.Trigger, { asChild: true, children: (0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("button", { type: "button", css: CombainedBreadcrumbs_styles_1.buttonStyles, children: "..." }) }) }), (0, jsx_runtime_1.jsx)(DropdownMenu_1.DropdownMenu.Content, { children: items.map(crumb => ((0, jsx_runtime_1.jsx)(DropdownMenu_1.DropdownMenu.Item, { onClick: () => onItemClick(crumb), children: crumb.name }, crumb.name))) })] }));
|
|
27
|
+
};
|
|
28
|
+
exports.CombainedBreadcrumbs = CombainedBreadcrumbs;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CombainedBreadcrumbs.styles.d.ts","sourceRoot":"","sources":["../../../../src/Misc/Breadcrumbs/CombainedBreadcrumbs/CombainedBreadcrumbs.styles.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAIzC,eAAO,MAAM,YAAY,EAAE,SAW1B,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Wire
|
|
4
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.buttonStyles = void 0;
|
|
22
|
+
const colors_v2_1 = require("../../../Identity/colors-v2");
|
|
23
|
+
exports.buttonStyles = {
|
|
24
|
+
background: 'none',
|
|
25
|
+
border: 'none',
|
|
26
|
+
padding: '0 8px',
|
|
27
|
+
cursor: 'pointer',
|
|
28
|
+
fontSize: '14px',
|
|
29
|
+
color: colors_v2_1.COLOR_V2.GRAY_70,
|
|
30
|
+
'&:hover': {
|
|
31
|
+
color: 'var(--main-color)',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Misc/Breadcrumbs/index.ts"],"names":[],"mappings":"AAmBA,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Wire
|
|
4
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
23
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
24
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
25
|
+
}
|
|
26
|
+
Object.defineProperty(o, k2, desc);
|
|
27
|
+
}) : (function(o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
o[k2] = m[k];
|
|
30
|
+
}));
|
|
31
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
32
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
__exportStar(require("./Breadcrumbs"), exports);
|
|
@@ -8,7 +8,7 @@ interface ButtonGroupProps {
|
|
|
8
8
|
}
|
|
9
9
|
declare const ButtonGroup: {
|
|
10
10
|
({ children }: ButtonGroupProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
11
|
-
Button: (
|
|
11
|
+
Button: import("react").ForwardRefExoticComponent<GroupButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
12
12
|
};
|
|
13
13
|
export { ButtonGroup };
|
|
14
14
|
//# sourceMappingURL=ButtonGroup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonGroup.d.ts","sourceRoot":"","sources":["../../src/Misc/ButtonGroup.tsx"],"names":[],"mappings":"AAmBA,OAAO,
|
|
1
|
+
{"version":3,"file":"ButtonGroup.d.ts","sourceRoot":"","sources":["../../src/Misc/ButtonGroup.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAa,SAAS,EAAC,MAAM,OAAO,CAAC;AA0D5C,UAAU,gBAAgB;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,UAAU,gBAAgB;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB;AACD,QAAA,MAAM,WAAW;mBAAgB,gBAAgB;;CAIhD,CAAC;AA2BF,OAAO,EAAC,WAAW,EAAC,CAAC"}
|
package/lib/Misc/ButtonGroup.js
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ButtonGroup = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
/*
|
|
6
|
+
* Wire
|
|
7
|
+
* Copyright (C) 2022 Wire Swiss GmbH
|
|
8
|
+
*
|
|
9
|
+
* This program is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const react_1 = require("react");
|
|
5
24
|
const Identity_1 = require("../Identity");
|
|
6
25
|
const buttonGroupStyle = () => ({
|
|
7
26
|
display: 'flex',
|
|
@@ -52,13 +71,14 @@ const buttonStyle = (_, { disabled = false }) => ({
|
|
|
52
71
|
});
|
|
53
72
|
const ButtonGroup = ({ children }) => ((0, jsx_runtime_1.jsx)("div", { css: (theme) => buttonGroupStyle(theme), role: "group", "aria-label": "Button Group", children: children }));
|
|
54
73
|
exports.ButtonGroup = ButtonGroup;
|
|
55
|
-
const Button = ({ children, icon, ...props }) => {
|
|
56
|
-
return ((0, jsx_runtime_1.jsxs)("button", { css: (theme) => buttonStyle(theme, props), ...props, children: [icon, children && ((0, jsx_runtime_1.jsx)("span", { css: (theme) => ({
|
|
74
|
+
const Button = (0, react_1.forwardRef)(({ children, icon, ...props }, ref) => {
|
|
75
|
+
return ((0, jsx_runtime_1.jsxs)("button", { ref: ref, css: (theme) => buttonStyle(theme, props), ...props, children: [icon, children && ((0, jsx_runtime_1.jsx)("span", { css: (theme) => ({
|
|
57
76
|
marginLeft: !!icon && '6px',
|
|
58
77
|
fontSize: theme.fontSizes.small,
|
|
59
78
|
fontWeight: 'bold',
|
|
60
79
|
lineHeight: '0.875rem',
|
|
61
80
|
letterSpacing: '0.25px',
|
|
62
81
|
}), children: children }))] }));
|
|
63
|
-
};
|
|
82
|
+
});
|
|
83
|
+
Button.displayName = 'Button';
|
|
64
84
|
ButtonGroup.Button = Button;
|
package/lib/Misc/IconButton.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ export interface IconButtonProps<T = HTMLButtonElement> extends TextProps<T> {
|
|
|
11
11
|
backgroundColor?: string;
|
|
12
12
|
}
|
|
13
13
|
export declare const iconButtonStyle: <T>(theme: Theme, props: IconButtonProps<T>) => CSSObject;
|
|
14
|
-
export declare const IconButton: (
|
|
14
|
+
export declare const IconButton: import("react").ForwardRefExoticComponent<Omit<IconButtonProps<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
15
15
|
//# sourceMappingURL=IconButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../src/Misc/IconButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../src/Misc/IconButton.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAGzC,OAAO,EAAC,KAAK,EAAC,MAAM,WAAW,CAAC;AAChC,OAAO,EAAC,SAAS,EAAkB,MAAM,SAAS,CAAC;AAGnD,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,SAAS,cAAc;CACxB;AAED,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,iBAAiB,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IAC1E,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,SAoF5E,CAAC;AAEH,eAAO,MAAM,UAAU,+IAIrB,CAAC"}
|
package/lib/Misc/IconButton.js
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IconButton = exports.iconButtonStyle = exports.IconButtonVariant = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
/*
|
|
6
|
+
* Wire
|
|
7
|
+
* Copyright (C) 2022 Wire Swiss GmbH
|
|
8
|
+
*
|
|
9
|
+
* This program is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const react_1 = require("react");
|
|
5
24
|
const motions_1 = require("../Identity/motions");
|
|
6
25
|
const Text_1 = require("../Text");
|
|
7
26
|
const util_1 = require("../util");
|
|
@@ -91,8 +110,8 @@ const iconButtonStyle = (theme, { variant = IconButtonVariant.PRIMARY, group = f
|
|
|
91
110
|
}),
|
|
92
111
|
});
|
|
93
112
|
exports.iconButtonStyle = iconButtonStyle;
|
|
94
|
-
|
|
95
|
-
exports.IconButton = IconButton;
|
|
113
|
+
exports.IconButton = (0, react_1.forwardRef)(({ children, ...props }, ref) => ((0, jsx_runtime_1.jsx)("button", { ref: ref, css: (theme) => (0, exports.iconButtonStyle)(theme, props), ...filterButtonProps(props), children: children })));
|
|
114
|
+
exports.IconButton.displayName = 'IconButton';
|
|
96
115
|
const filterButtonProps = (props) => {
|
|
97
116
|
return (0, util_1.filterProps)((0, Text_1.filterTextProps)(props), ['backgroundColor']);
|
|
98
117
|
};
|
package/lib/Misc/index.d.ts
CHANGED
package/lib/Misc/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Misc/index.ts"],"names":[],"mappings":"AAmBA,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Misc/index.ts"],"names":[],"mappings":"AAmBA,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
package/lib/Misc/index.js
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { CSSObject } from '@emotion/react';
|
|
3
|
+
/**
|
|
4
|
+
* A dropdown menu component that provides a customizable and accessible dropdown interface.
|
|
5
|
+
* Built on top of accessible primitives, it offers a flexible way to display
|
|
6
|
+
* contextual actions and navigation options.
|
|
7
|
+
*
|
|
8
|
+
* Disclaimer: Custom trigger components (with asChild) must accept id, aria-haspopup, aria-expanded, and data-state props.
|
|
9
|
+
*
|
|
10
|
+
* Example:
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <DropdownMenu>
|
|
13
|
+
* <DropdownMenu.Trigger>Open Menu</DropdownMenu.Trigger>
|
|
14
|
+
* <DropdownMenu.Content>
|
|
15
|
+
* <DropdownMenu.Item>Item 1</DropdownMenu.Item>
|
|
16
|
+
* <DropdownMenu.Item>Item 2</DropdownMenu.Item>
|
|
17
|
+
* </DropdownMenu.Content>
|
|
18
|
+
* </DropdownMenu>
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* With custom trigger:
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <DropdownMenu>
|
|
24
|
+
* <DropdownMenu.Trigger asChild>
|
|
25
|
+
* <Button>Open Menu</Button>
|
|
26
|
+
* </DropdownMenu.Trigger>
|
|
27
|
+
* <DropdownMenu.Content>
|
|
28
|
+
* <DropdownMenu.Item>Item 1</DropdownMenu.Item>
|
|
29
|
+
* <DropdownMenu.Item>Item 2</DropdownMenu.Item>
|
|
30
|
+
* </DropdownMenu.Content>
|
|
31
|
+
* </DropdownMenu>
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
export declare const DropdownMenu: {
|
|
36
|
+
({ children }: {
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
39
|
+
Trigger: ({ children, asChild, cssObj, }: {
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
asChild?: boolean;
|
|
42
|
+
cssObj?: CSSObject;
|
|
43
|
+
}) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
44
|
+
Content: ({ children }: {
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
}) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
47
|
+
Item: ({ children, onClick }: {
|
|
48
|
+
children: ReactNode;
|
|
49
|
+
onClick: () => void;
|
|
50
|
+
}) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=DropdownMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownMenu.d.ts","sourceRoot":"","sources":["../../../src/Modal/DropdownMenu/DropdownMenu.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAKzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,YAAY;mBAAgB;QAAC,QAAQ,EAAE,SAAS,CAAA;KAAC;8CAQ3D;QACD,QAAQ,EAAE,SAAS,CAAC;QACpB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,MAAM,CAAC,EAAE,SAAS,CAAC;KACpB;4BAUwC;QAAC,QAAQ,EAAE,SAAS,CAAA;KAAC;kCAYf;QAAC,QAAQ,EAAE,SAAS,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAA;KAAC;CAhCxF,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.DropdownMenu = void 0;
|
|
27
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
28
|
+
const DropdownMenuPrimitive = __importStar(require("@radix-ui/react-dropdown-menu"));
|
|
29
|
+
const DropdownMenu_styles_1 = require("./DropdownMenu.styles");
|
|
30
|
+
/**
|
|
31
|
+
* A dropdown menu component that provides a customizable and accessible dropdown interface.
|
|
32
|
+
* Built on top of accessible primitives, it offers a flexible way to display
|
|
33
|
+
* contextual actions and navigation options.
|
|
34
|
+
*
|
|
35
|
+
* Disclaimer: Custom trigger components (with asChild) must accept id, aria-haspopup, aria-expanded, and data-state props.
|
|
36
|
+
*
|
|
37
|
+
* Example:
|
|
38
|
+
* ```tsx
|
|
39
|
+
* <DropdownMenu>
|
|
40
|
+
* <DropdownMenu.Trigger>Open Menu</DropdownMenu.Trigger>
|
|
41
|
+
* <DropdownMenu.Content>
|
|
42
|
+
* <DropdownMenu.Item>Item 1</DropdownMenu.Item>
|
|
43
|
+
* <DropdownMenu.Item>Item 2</DropdownMenu.Item>
|
|
44
|
+
* </DropdownMenu.Content>
|
|
45
|
+
* </DropdownMenu>
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* With custom trigger:
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <DropdownMenu>
|
|
51
|
+
* <DropdownMenu.Trigger asChild>
|
|
52
|
+
* <Button>Open Menu</Button>
|
|
53
|
+
* </DropdownMenu.Trigger>
|
|
54
|
+
* <DropdownMenu.Content>
|
|
55
|
+
* <DropdownMenu.Item>Item 1</DropdownMenu.Item>
|
|
56
|
+
* <DropdownMenu.Item>Item 2</DropdownMenu.Item>
|
|
57
|
+
* </DropdownMenu.Content>
|
|
58
|
+
* </DropdownMenu>
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
*/
|
|
62
|
+
const DropdownMenu = ({ children }) => {
|
|
63
|
+
return (0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.Root, { children: children });
|
|
64
|
+
};
|
|
65
|
+
exports.DropdownMenu = DropdownMenu;
|
|
66
|
+
const DropdownMenuTrigger = ({ children, asChild = false, cssObj, }) => {
|
|
67
|
+
return ((0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.Trigger, { asChild: asChild, css: !asChild && { ...DropdownMenu_styles_1.triggerStyles, ...cssObj }, children: children }));
|
|
68
|
+
};
|
|
69
|
+
exports.DropdownMenu.Trigger = DropdownMenuTrigger;
|
|
70
|
+
const DropdownMenuContent = ({ children }) => {
|
|
71
|
+
return ((0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.Portal, { children: (0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.Content, { css: DropdownMenu_styles_1.contentStyle, sideOffset: 6, children: children }) }));
|
|
72
|
+
};
|
|
73
|
+
exports.DropdownMenu.Content = DropdownMenuContent;
|
|
74
|
+
const DropdownMenuItem = ({ children, onClick }) => {
|
|
75
|
+
return ((0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.Item, { css: DropdownMenu_styles_1.itemStyle, onClick: onClick, children: (0, jsx_runtime_1.jsx)("span", { css: DropdownMenu_styles_1.textStyles, children: children }) }));
|
|
76
|
+
};
|
|
77
|
+
exports.DropdownMenu.Item = DropdownMenuItem;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react/*';
|
|
2
|
+
import { DropdownMenu } from './DropdownMenu';
|
|
3
|
+
declare const meta: Meta<typeof DropdownMenu>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof DropdownMenu>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithLongItems: Story;
|
|
8
|
+
export declare const WithCustomButton: Story;
|
|
9
|
+
export declare const WithCustomIconButton: Story;
|
|
10
|
+
//# sourceMappingURL=DropdownMenu.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownMenu.stories.d.ts","sourceRoot":"","sources":["../../../src/Modal/DropdownMenu/DropdownMenu.stories.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAC,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAM5C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAMnC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,YAAY,CAAC,CAAC;AAE3C,eAAO,MAAM,OAAO,EAAE,KAarB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAa3B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAa9B,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,KAelC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WithCustomIconButton = exports.WithCustomButton = exports.WithLongItems = exports.Default = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const DropdownMenu_1 = require("./DropdownMenu");
|
|
6
|
+
const Form_1 = require("../../Form");
|
|
7
|
+
const Icon_1 = require("../../Icon");
|
|
8
|
+
const Misc_1 = require("../../Misc");
|
|
9
|
+
const meta = {
|
|
10
|
+
component: DropdownMenu_1.DropdownMenu,
|
|
11
|
+
title: 'Modal/DropdownMenu',
|
|
12
|
+
parameters: {
|
|
13
|
+
layout: 'centered',
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
exports.default = meta;
|
|
17
|
+
exports.Default = {
|
|
18
|
+
render: () => ((0, jsx_runtime_1.jsxs)(DropdownMenu_1.DropdownMenu, { children: [(0, jsx_runtime_1.jsx)(DropdownMenu_1.DropdownMenu.Trigger, { cssObj: { width: '40px', height: '40px' }, children: (0, jsx_runtime_1.jsx)(Icon_1.PlusIcon, {}) }), (0, jsx_runtime_1.jsxs)(DropdownMenu_1.DropdownMenu.Content, { children: [(0, jsx_runtime_1.jsx)(DropdownMenu_1.DropdownMenu.Item, { onClick: () => { }, children: "Copy" }), (0, jsx_runtime_1.jsx)(DropdownMenu_1.DropdownMenu.Item, { onClick: () => { }, children: "Details" }), (0, jsx_runtime_1.jsx)(DropdownMenu_1.DropdownMenu.Item, { onClick: () => { }, children: "Delete for me" })] })] })),
|
|
19
|
+
};
|
|
20
|
+
exports.WithLongItems = {
|
|
21
|
+
render: () => ((0, jsx_runtime_1.jsxs)(DropdownMenu_1.DropdownMenu, { children: [(0, jsx_runtime_1.jsx)(DropdownMenu_1.DropdownMenu.Trigger, { cssObj: { width: '40px', height: '40px' }, children: (0, jsx_runtime_1.jsx)(Icon_1.PlusIcon, {}) }), (0, jsx_runtime_1.jsxs)(DropdownMenu_1.DropdownMenu.Content, { children: [(0, jsx_runtime_1.jsx)(DropdownMenu_1.DropdownMenu.Item, { onClick: () => { }, children: "Copy the detail of this message" }), (0, jsx_runtime_1.jsx)(DropdownMenu_1.DropdownMenu.Item, { onClick: () => { }, children: "Contact the sender" }), (0, jsx_runtime_1.jsx)(DropdownMenu_1.DropdownMenu.Item, { onClick: () => { }, children: "Delete this message (works only if you are the owner)" })] })] })),
|
|
22
|
+
};
|
|
23
|
+
exports.WithCustomButton = {
|
|
24
|
+
render: () => ((0, jsx_runtime_1.jsxs)(DropdownMenu_1.DropdownMenu, { children: [(0, jsx_runtime_1.jsx)(DropdownMenu_1.DropdownMenu.Trigger, { asChild: true, children: (0, jsx_runtime_1.jsx)(Form_1.Button, { variant: Form_1.ButtonVariant.PRIMARY, children: "Open menu" }) }), (0, jsx_runtime_1.jsxs)(DropdownMenu_1.DropdownMenu.Content, { children: [(0, jsx_runtime_1.jsx)(DropdownMenu_1.DropdownMenu.Item, { onClick: () => { }, children: "Copy" }), (0, jsx_runtime_1.jsx)(DropdownMenu_1.DropdownMenu.Item, { onClick: () => { }, children: "Details" }), (0, jsx_runtime_1.jsx)(DropdownMenu_1.DropdownMenu.Item, { onClick: () => { }, children: "Delete for me" })] })] })),
|
|
25
|
+
};
|
|
26
|
+
exports.WithCustomIconButton = {
|
|
27
|
+
render: () => ((0, jsx_runtime_1.jsxs)(DropdownMenu_1.DropdownMenu, { children: [(0, jsx_runtime_1.jsx)(DropdownMenu_1.DropdownMenu.Trigger, { asChild: true, children: (0, jsx_runtime_1.jsx)(Misc_1.IconButton, { variant: Misc_1.IconButtonVariant.PRIMARY, children: (0, jsx_runtime_1.jsx)(Icon_1.PlusIcon, {}) }) }), (0, jsx_runtime_1.jsxs)(DropdownMenu_1.DropdownMenu.Content, { children: [(0, jsx_runtime_1.jsx)(DropdownMenu_1.DropdownMenu.Item, { onClick: () => { }, children: "Copy" }), (0, jsx_runtime_1.jsx)(DropdownMenu_1.DropdownMenu.Item, { onClick: () => { }, children: "Details" }), (0, jsx_runtime_1.jsx)(DropdownMenu_1.DropdownMenu.Item, { onClick: () => { }, children: "Delete for me" })] })] })),
|
|
28
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CSSObject } from '@emotion/react';
|
|
2
|
+
export declare const contentStyle: CSSObject;
|
|
3
|
+
export declare const itemStyle: CSSObject;
|
|
4
|
+
export declare const textStyles: CSSObject;
|
|
5
|
+
export declare const triggerStyles: CSSObject;
|
|
6
|
+
//# sourceMappingURL=DropdownMenu.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownMenu.styles.d.ts","sourceRoot":"","sources":["../../../src/Modal/DropdownMenu/DropdownMenu.styles.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAY,MAAM,gBAAgB,CAAC;AAkDpD,eAAO,MAAM,YAAY,EAAE,SA0B1B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,SAiBvB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,SAIxB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,SAS3B,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Wire
|
|
4
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.triggerStyles = exports.textStyles = exports.itemStyle = exports.contentStyle = void 0;
|
|
22
|
+
const react_1 = require("@emotion/react");
|
|
23
|
+
const util_1 = require("../../util");
|
|
24
|
+
const slideUpAndFade = (0, react_1.keyframes) `
|
|
25
|
+
from {
|
|
26
|
+
opacity: 0;
|
|
27
|
+
transform: translateY(2px);
|
|
28
|
+
}
|
|
29
|
+
to {
|
|
30
|
+
opacity: 1;
|
|
31
|
+
transform: translateY(0);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
const slideRightAndFade = (0, react_1.keyframes) `
|
|
36
|
+
from {
|
|
37
|
+
opacity: 0;
|
|
38
|
+
transform: translateX(-2px);
|
|
39
|
+
}
|
|
40
|
+
to {
|
|
41
|
+
opacity: 1;
|
|
42
|
+
transform: translateX(0);
|
|
43
|
+
}
|
|
44
|
+
}`;
|
|
45
|
+
const slideDownAndFade = (0, react_1.keyframes) `
|
|
46
|
+
from {
|
|
47
|
+
opacity: 0;
|
|
48
|
+
transform: translateY(-2px);
|
|
49
|
+
}
|
|
50
|
+
to {
|
|
51
|
+
opacity: 1;
|
|
52
|
+
transform: translateY(0);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
const slideLeftAndFade = (0, react_1.keyframes) `
|
|
57
|
+
from {
|
|
58
|
+
opacity: 0;
|
|
59
|
+
transform: translateX(2px);
|
|
60
|
+
}
|
|
61
|
+
to {
|
|
62
|
+
opacity: 1;
|
|
63
|
+
transform: translateX(0);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
exports.contentStyle = {
|
|
68
|
+
minWidth: '160px',
|
|
69
|
+
zIndex: 'var(--z-index-modal)',
|
|
70
|
+
padding: '8px 0',
|
|
71
|
+
borderRadius: '12px',
|
|
72
|
+
backgroundColor: 'var(--modal-bg)',
|
|
73
|
+
boxShadow: '0 0 1px 0 rgba(0, 0, 0, 0.08), 0 8px 24px 0 rgba(0, 0, 0, 0.16)',
|
|
74
|
+
animationDuration: '400ms',
|
|
75
|
+
animationTimingFunction: 'cubic-bezier(0.16, 1, 0.3, 1)',
|
|
76
|
+
willChange: 'transform, opacity',
|
|
77
|
+
outline: 'auto',
|
|
78
|
+
'&[data-side="top"]': {
|
|
79
|
+
animationName: slideDownAndFade,
|
|
80
|
+
},
|
|
81
|
+
'&[data-side="right"]': {
|
|
82
|
+
animationName: slideLeftAndFade,
|
|
83
|
+
},
|
|
84
|
+
'&[data-side="bottom"]': {
|
|
85
|
+
animationName: slideUpAndFade,
|
|
86
|
+
},
|
|
87
|
+
'&[data-side="left"]': {
|
|
88
|
+
animationName: slideRightAndFade,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
exports.itemStyle = {
|
|
92
|
+
fontSize: '12px',
|
|
93
|
+
fontWeight: 400,
|
|
94
|
+
lineHeight: '2rem',
|
|
95
|
+
padding: '0 8px',
|
|
96
|
+
position: 'relative',
|
|
97
|
+
userSelect: 'none',
|
|
98
|
+
outline: 'none',
|
|
99
|
+
cursor: 'pointer',
|
|
100
|
+
display: 'flex',
|
|
101
|
+
overflow: 'hidden',
|
|
102
|
+
maxWidth: '300px',
|
|
103
|
+
alignItems: 'center',
|
|
104
|
+
'&[data-highlighted]': {
|
|
105
|
+
backgroundColor: 'var(--foreground-fade-16)',
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
exports.textStyles = {
|
|
109
|
+
...(0, util_1.ellipsis)(),
|
|
110
|
+
display: 'inline-block',
|
|
111
|
+
flexGrow: 1,
|
|
112
|
+
};
|
|
113
|
+
exports.triggerStyles = {
|
|
114
|
+
display: 'flex',
|
|
115
|
+
alignItems: 'center',
|
|
116
|
+
justifyContent: 'center',
|
|
117
|
+
padding: '0',
|
|
118
|
+
margin: '0',
|
|
119
|
+
border: 'none',
|
|
120
|
+
background: 'none',
|
|
121
|
+
cursor: 'pointer',
|
|
122
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Modal/DropdownMenu/index.ts"],"names":[],"mappings":"AAmBA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Wire
|
|
4
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
23
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
24
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
25
|
+
}
|
|
26
|
+
Object.defineProperty(o, k2, desc);
|
|
27
|
+
}) : (function(o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
o[k2] = m[k];
|
|
30
|
+
}));
|
|
31
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
32
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
__exportStar(require("./DropdownMenu"), exports);
|
package/lib/Modal/index.d.ts
CHANGED
package/lib/Modal/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Modal/index.ts"],"names":[],"mappings":"AAmBA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Modal/index.ts"],"names":[],"mappings":"AAmBA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
|
package/lib/Modal/index.js
CHANGED
|
@@ -36,3 +36,4 @@ exports.Overlay = void 0;
|
|
|
36
36
|
__exportStar(require("./Modal"), exports);
|
|
37
37
|
var Overlay_1 = require("./Overlay");
|
|
38
38
|
Object.defineProperty(exports, "Overlay", { enumerable: true, get: function () { return Overlay_1.Overlay; } });
|
|
39
|
+
__exportStar(require("./DropdownMenu"), exports);
|
|
@@ -42,6 +42,7 @@ declare const meta: {
|
|
|
42
42
|
title?: string | undefined;
|
|
43
43
|
pattern?: string | undefined;
|
|
44
44
|
value?: string | readonly string[] | number | undefined;
|
|
45
|
+
hidden?: boolean | undefined;
|
|
45
46
|
accept?: string | undefined;
|
|
46
47
|
acceptCharset?: string | undefined;
|
|
47
48
|
action?: string | undefined | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS];
|
|
@@ -144,7 +145,6 @@ declare const meta: {
|
|
|
144
145
|
dir?: string | undefined;
|
|
145
146
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
146
147
|
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
|
|
147
|
-
hidden?: boolean | undefined;
|
|
148
148
|
id?: string | undefined;
|
|
149
149
|
lang?: string | undefined;
|
|
150
150
|
nonce?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalCssVariables.d.ts","sourceRoot":"","sources":["../../src/Theme/GlobalCssVariables.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"GlobalCssVariables.d.ts","sourceRoot":"","sources":["../../src/Theme/GlobalCssVariables.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAqQzC,eAAO,MAAM,kBAAkB;iBAjQZ,SAAS;gBA8GV,SAAS;wBA8GD,SAAS;oBAkBb,SAAS;CAwB9B,CAAC"}
|
|
@@ -61,6 +61,9 @@ const light = () => ({
|
|
|
61
61
|
'--success-color': Identity_1.COLOR_V2.GREEN_LIGHT_500,
|
|
62
62
|
'--app-bg': Identity_1.COLOR_V2.GRAY_10,
|
|
63
63
|
'--main-color': Identity_1.COLOR.BLACK,
|
|
64
|
+
'--modal-bg': '#f8f8f8',
|
|
65
|
+
// Foreground
|
|
66
|
+
'--foreground-fade-16': '#676b7129',
|
|
64
67
|
// Archive File Icon
|
|
65
68
|
'--archive-file-icon-bg': Identity_1.COLOR_V2.AMBER_LIGHT_50,
|
|
66
69
|
'--archive-file-icon-stroke': Identity_1.COLOR_V2.AMBER_LIGHT_700,
|
|
@@ -145,6 +148,9 @@ const dark = () => ({
|
|
|
145
148
|
'--success-color': Identity_1.COLOR_V2.GREEN_DARK_500,
|
|
146
149
|
'--app-bg': Identity_1.COLOR_V2.GRAY_95,
|
|
147
150
|
'--main-color': Identity_1.COLOR.WHITE,
|
|
151
|
+
'--modal-bg': '#26272c',
|
|
152
|
+
// Foreground
|
|
153
|
+
'--foreground-fade-16': '#9fa1a729',
|
|
148
154
|
// Archive File Icon
|
|
149
155
|
'--archive-file-icon-bg': Identity_1.COLOR_V2.AMBER_DARK_50,
|
|
150
156
|
'--archive-file-icon-stroke': Identity_1.COLOR_V2.AMBER_DARK_700,
|
|
@@ -205,8 +211,27 @@ const accentColors = () => ({
|
|
|
205
211
|
'--icon-secondary-active-border': 'transparent',
|
|
206
212
|
'--indicator-range-input-thumb': Identity_1.COLOR_V2.BLUE_LIGHT_700,
|
|
207
213
|
});
|
|
214
|
+
const zIndexes = () => ({
|
|
215
|
+
'--z-index-level-0': 0,
|
|
216
|
+
'--z-index-level-1': 10,
|
|
217
|
+
'--z-index-level-2': 100,
|
|
218
|
+
'--z-index-level-3': 1000,
|
|
219
|
+
'--z-index-level-4': 10000,
|
|
220
|
+
'--z-index-level-5': 100000,
|
|
221
|
+
'--z-index-level-6': 1000000,
|
|
222
|
+
'--z-index-level-7': 10000000,
|
|
223
|
+
'--z-index-badge': 'var(--z-index-level-2)',
|
|
224
|
+
'--z-index-panel': 'var(--z-index-level-3)',
|
|
225
|
+
'--z-index-bubble': 'var(--z-index-level-3)',
|
|
226
|
+
'--z-index-video': 'var(--z-index-level-4)',
|
|
227
|
+
'--z-index-choosescreen': 'var(--z-index-level-5)',
|
|
228
|
+
'--z-index-context': 'var(--z-index-level-5)',
|
|
229
|
+
'--z-index-warnings': 'var(--z-index-level-6)',
|
|
230
|
+
'--z-index-modal': 'var(--z-index-level-7)',
|
|
231
|
+
});
|
|
208
232
|
exports.GlobalCssVariables = {
|
|
209
233
|
light,
|
|
210
234
|
dark,
|
|
211
235
|
accentColors,
|
|
236
|
+
zIndexes,
|
|
212
237
|
};
|
package/lib/util.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export declare const noop: () => void;
|
|
|
3
3
|
export declare const inlineSVG: (svg: string) => string;
|
|
4
4
|
export declare const filterProps: <T extends Record<string, any>>(props: T, propsToFilter: (keyof T)[]) => Object;
|
|
5
5
|
export declare const manySelectors: (selectors: string[], css: CSSObject) => {};
|
|
6
|
+
export declare const ellipsis: () => CSSObject;
|
|
6
7
|
//# sourceMappingURL=util.d.ts.map
|
package/lib/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAEzC,eAAO,MAAM,IAAI,YAAW,CAAC;AAE7B,eAAO,MAAM,SAAS,QAAS,MAAM,WAAyD,CAAC;AAE/F,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,MAQlG,CAAC;AAEF,eAAO,MAAM,aAAa,cAAe,MAAM,EAAE,OAAO,SAAS,OAIzD,CAAC"}
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAEzC,eAAO,MAAM,IAAI,YAAW,CAAC;AAE7B,eAAO,MAAM,SAAS,QAAS,MAAM,WAAyD,CAAC;AAE/F,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,MAQlG,CAAC;AAEF,eAAO,MAAM,aAAa,cAAe,MAAM,EAAE,OAAO,SAAS,OAIzD,CAAC;AAET,eAAO,MAAM,QAAQ,QAAO,SAI1B,CAAC"}
|
package/lib/util.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.manySelectors = exports.filterProps = exports.inlineSVG = exports.noop = void 0;
|
|
21
|
+
exports.ellipsis = exports.manySelectors = exports.filterProps = exports.inlineSVG = exports.noop = void 0;
|
|
22
22
|
const noop = () => { };
|
|
23
23
|
exports.noop = noop;
|
|
24
24
|
const inlineSVG = (svg) => `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`;
|
|
@@ -32,3 +32,9 @@ const manySelectors = (selectors, css) => selectors.reduce((acc, selector) => {
|
|
|
32
32
|
return acc;
|
|
33
33
|
}, {});
|
|
34
34
|
exports.manySelectors = manySelectors;
|
|
35
|
+
const ellipsis = () => ({
|
|
36
|
+
overflow: 'hidden',
|
|
37
|
+
textOverflow: 'ellipsis',
|
|
38
|
+
whiteSpace: 'nowrap',
|
|
39
|
+
});
|
|
40
|
+
exports.ellipsis = ellipsis;
|
package/package.json
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"main": "lib/index",
|
|
9
9
|
"homepage": "https://wire-react-ui-kit.netlify.app/",
|
|
10
10
|
"dependencies": {
|
|
11
|
+
"@radix-ui/react-dropdown-menu": "2.1.14",
|
|
11
12
|
"@types/color": "3.0.6",
|
|
12
13
|
"color": "4.2.3",
|
|
13
14
|
"emotion-normalize": "11.0.1",
|
|
@@ -77,6 +78,6 @@
|
|
|
77
78
|
"test:watch": "jest --watch",
|
|
78
79
|
"test:update": "jest --updateSnapshot"
|
|
79
80
|
},
|
|
80
|
-
"version": "9.
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"version": "9.52.1",
|
|
82
|
+
"gitHead": "567107c5f43d16864e6548c3b61d6a112f238f3d"
|
|
82
83
|
}
|