@teambit/design.buttons.button-link 0.0.0-fff04922c0210ac3083984bc220729aea5fec510

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.
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { Icon } from '@teambit/design.elements.icon';
3
+ import { ButtonLink } from './button-link';
4
+
5
+ export const ButtonLinkWithImage = () => {
6
+ return (
7
+ <ButtonLink
8
+ linkProps={{ external: true, href: 'https://bit.cloud/teambit' }}
9
+ icon={<img src="https://static.bit.cloud/bit-icons/setting.svg" />}
10
+ >
11
+ Settings
12
+ </ButtonLink>
13
+ );
14
+ };
15
+
16
+ export const ButtonLinkWithIcon = () => {
17
+ return (
18
+ <ButtonLink linkProps={{ external: true, href: 'https://bit.cloud/teambit' }} icon={<Icon of="settings" />}>
19
+ Settings
20
+ </ButtonLink>
21
+ );
22
+ };
@@ -0,0 +1,19 @@
1
+ ---
2
+ description: A ButtonLink component.
3
+ labels: ['button', 'link']
4
+ ---
5
+
6
+ import { ButtonLink } from './button-link';
7
+
8
+ A component that renders a [link](https://bit.cloud/teambit/base-react/navigation/link) with a button design.
9
+
10
+ ### Component usage
11
+
12
+ ```js live
13
+ <ButtonLink
14
+ linkProps={{ external: true, href: 'https://bit.cloud/teambit' }}
15
+ icon={<img src="https://static.bit.cloud/cloud/organization.svg" />}
16
+ >
17
+ Teambit
18
+ </ButtonLink>
19
+ ```
@@ -0,0 +1,3 @@
1
+ .link {
2
+ text-decoration: none;
3
+ }
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+ import { ButtonLinkWithImage } from './button-link.composition';
4
+
5
+ it('should render with the correct text', () => {
6
+ const { getByText } = render(<ButtonLinkWithImage />);
7
+ const rendered = getByText('Settings');
8
+
9
+ expect(rendered).toBeTruthy();
10
+ });
11
+ it('should render with image tag', () => {
12
+ const { container } = render(<ButtonLinkWithImage />);
13
+
14
+ expect(container.getElementsByTagName('img').length).toBe(1);
15
+ });
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import classNames from 'classnames';
3
+ import { Link, LinkProps } from '@teambit/base-react.navigation.link';
4
+ import { IconButton, IconButtonProps } from '@teambit/design.ui.icon-button';
5
+ import styles from './button-link.module.scss';
6
+
7
+ export type ButtonLinkProps = {
8
+ /**
9
+ * link props.
10
+ */
11
+ linkProps?: LinkProps;
12
+ } & IconButtonProps;
13
+
14
+ export function ButtonLink({ linkProps, ...rest }: ButtonLinkProps) {
15
+ const { className, ...linkRest } = linkProps;
16
+ return (
17
+ <Link {...linkRest} className={classNames(styles.link, className)}>
18
+ <IconButton {...rest} />
19
+ </Link>
20
+ );
21
+ }
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const ButtonLinkWithImage: () => React.JSX.Element;
3
+ export declare const ButtonLinkWithIcon: () => React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { Icon } from '@teambit/design.elements.icon';
3
+ import { ButtonLink } from './button-link';
4
+ export const ButtonLinkWithImage = () => {
5
+ return (React.createElement(ButtonLink, { linkProps: { external: true, href: 'https://bit.cloud/teambit' }, icon: React.createElement("img", { src: "https://static.bit.cloud/bit-icons/setting.svg" }) }, "Settings"));
6
+ };
7
+ export const ButtonLinkWithIcon = () => {
8
+ return (React.createElement(ButtonLink, { linkProps: { external: true, href: 'https://bit.cloud/teambit' }, icon: React.createElement(Icon, { of: "settings" }) }, "Settings"));
9
+ };
10
+ //# sourceMappingURL=button-link.composition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button-link.composition.js","sourceRoot":"","sources":["../button-link.composition.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,OAAO,CACL,oBAAC,UAAU,IACT,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,2BAA2B,EAAE,EAChE,IAAI,EAAE,6BAAK,GAAG,EAAC,gDAAgD,GAAG,eAGvD,CACd,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,OAAO,CACL,oBAAC,UAAU,IAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,2BAA2B,EAAE,EAAE,IAAI,EAAE,oBAAC,IAAI,IAAC,EAAE,EAAC,UAAU,GAAG,eAE7F,CACd,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { LinkProps } from '@teambit/base-react.navigation.link';
3
+ import { IconButtonProps } from '@teambit/design.ui.icon-button';
4
+ export type ButtonLinkProps = {
5
+ /**
6
+ * link props.
7
+ */
8
+ linkProps?: LinkProps;
9
+ } & IconButtonProps;
10
+ export declare function ButtonLink({ linkProps, ...rest }: ButtonLinkProps): React.JSX.Element;
@@ -0,0 +1,19 @@
1
+ ---
2
+ description: A ButtonLink component.
3
+ labels: ['button', 'link']
4
+ ---
5
+
6
+ import { ButtonLink } from './button-link';
7
+
8
+ A component that renders a [link](https://bit.cloud/teambit/base-react/navigation/link) with a button design.
9
+
10
+ ### Component usage
11
+
12
+ ```js live
13
+ <ButtonLink
14
+ linkProps={{ external: true, href: 'https://bit.cloud/teambit' }}
15
+ icon={<img src="https://static.bit.cloud/cloud/organization.svg" />}
16
+ >
17
+ Teambit
18
+ </ButtonLink>
19
+ ```
@@ -0,0 +1,23 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import React from 'react';
13
+ import classNames from 'classnames';
14
+ import { Link } from '@teambit/base-react.navigation.link';
15
+ import { IconButton } from '@teambit/design.ui.icon-button';
16
+ import styles from './button-link.module.scss';
17
+ export function ButtonLink(_a) {
18
+ var { linkProps } = _a, rest = __rest(_a, ["linkProps"]);
19
+ const { className } = linkProps, linkRest = __rest(linkProps, ["className"]);
20
+ return (React.createElement(Link, Object.assign({}, linkRest, { className: classNames(styles.link, className) }),
21
+ React.createElement(IconButton, Object.assign({}, rest))));
22
+ }
23
+ //# sourceMappingURL=button-link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button-link.js","sourceRoot":"","sources":["../button-link.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,IAAI,EAAa,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAmB,MAAM,gCAAgC,CAAC;AAC7E,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAS/C,MAAM,UAAU,UAAU,CAAC,EAAuC;QAAvC,EAAE,SAAS,OAA4B,EAAvB,IAAI,cAApB,aAAsB,CAAF;IAC7C,MAAM,EAAE,SAAS,KAAkB,SAAS,EAAtB,QAAQ,UAAK,SAAS,EAAtC,aAA0B,CAAY,CAAC;IAC7C,OAAO,CACL,oBAAC,IAAI,oBAAK,QAAQ,IAAE,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC;QAC/D,oBAAC,UAAU,oBAAK,IAAI,EAAI,CACnB,CACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ .link {
2
+ text-decoration: none;
3
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+ import { ButtonLinkWithImage } from './button-link.composition';
4
+ it('should render with the correct text', () => {
5
+ const { getByText } = render(React.createElement(ButtonLinkWithImage, null));
6
+ const rendered = getByText('Settings');
7
+ expect(rendered).toBeTruthy();
8
+ });
9
+ it('should render with image tag', () => {
10
+ const { container } = render(React.createElement(ButtonLinkWithImage, null));
11
+ expect(container.getElementsByTagName('img').length).toBe(1);
12
+ });
13
+ //# sourceMappingURL=button-link.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button-link.spec.js","sourceRoot":"","sources":["../button-link.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;IAC7C,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,oBAAC,mBAAmB,OAAG,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IAEvC,MAAM,CAAC,QAAQ,CAAC,CAAC,UAAU,EAAE,CAAC;AAChC,CAAC,CAAC,CAAC;AACH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;IACtC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,oBAAC,mBAAmB,OAAG,CAAC,CAAC;IAEtD,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/D,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { ButtonLink } from './button-link';
2
+ export type { ButtonLinkProps } from './button-link';
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { ButtonLink } from './button-link';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,7 @@
1
+ import * as compositions_0 from '/tmp/capsules-root/sign-capsules/2025-7-31/1x0ltvo/teambit.design_buttons_button-link@fff04922c0210ac3083984bc220729aea5fec510/dist/button-link.composition.js';
2
+ import * as overview_0 from '/tmp/capsules-root/sign-capsules/2025-7-31/1x0ltvo/teambit.design_buttons_button-link@fff04922c0210ac3083984bc220729aea5fec510/dist/button-link.docs.mdx';
3
+
4
+ export const compositions = [compositions_0];
5
+ export const overview = [overview_0];
6
+
7
+ export const compositions_metadata = {"compositions":[{"displayName":"Button link with image","identifier":"ButtonLinkWithImage"},{"displayName":"Button link with icon","identifier":"ButtonLinkWithIcon"}]};
package/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { ButtonLink } from './button-link';
2
+ export type { ButtonLinkProps } from './button-link';
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@teambit/design.buttons.button-link",
3
+ "version": "0.0.0-fff04922c0210ac3083984bc220729aea5fec510",
4
+ "homepage": "https://bit.cloud/teambit/design/buttons/button-link",
5
+ "main": "dist/index.js",
6
+ "componentId": {
7
+ "scope": "teambit.design",
8
+ "name": "buttons/button-link",
9
+ "version": "fff04922c0210ac3083984bc220729aea5fec510"
10
+ },
11
+ "dependencies": {
12
+ "classnames": "2.3.1",
13
+ "core-js": "^3.0.0",
14
+ "@teambit/design.ui.icon-button": "1.1.28",
15
+ "@teambit/base-react.navigation.link": "2.0.27"
16
+ },
17
+ "devDependencies": {
18
+ "@types/react": "^17.0.8",
19
+ "@types/node": "12.20.4",
20
+ "@types/react-dom": "^17.0.5",
21
+ "@types/jest": "^26.0.0",
22
+ "@babel/runtime": "7.20.0",
23
+ "@types/testing-library__jest-dom": "5.9.5",
24
+ "@teambit/design.elements.icon": "1.0.24",
25
+ "@teambit/community.envs.community-react": "2.1.14"
26
+ },
27
+ "peerDependencies": {
28
+ "@testing-library/react": "^12.1.5",
29
+ "react": "^16.8.0 || ^17.0.0"
30
+ },
31
+ "license": "SEE LICENSE IN UNLICENSED",
32
+ "optionalDependencies": {},
33
+ "peerDependenciesMeta": {},
34
+ "private": false
35
+ }
@@ -0,0 +1,29 @@
1
+ declare module '*.png' {
2
+ const value: any;
3
+ export = value;
4
+ }
5
+ declare module '*.svg' {
6
+ import type { FunctionComponent, SVGProps } from 'react';
7
+
8
+ export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
9
+ const src: string;
10
+ export default src;
11
+ }
12
+
13
+ // @TODO Gilad
14
+ declare module '*.jpg' {
15
+ const value: any;
16
+ export = value;
17
+ }
18
+ declare module '*.jpeg' {
19
+ const value: any;
20
+ export = value;
21
+ }
22
+ declare module '*.gif' {
23
+ const value: any;
24
+ export = value;
25
+ }
26
+ declare module '*.bmp' {
27
+ const value: any;
28
+ export = value;
29
+ }
@@ -0,0 +1,42 @@
1
+ declare module '*.module.css' {
2
+ const classes: { readonly [key: string]: string };
3
+ export default classes;
4
+ }
5
+ declare module '*.module.scss' {
6
+ const classes: { readonly [key: string]: string };
7
+ export default classes;
8
+ }
9
+ declare module '*.module.sass' {
10
+ const classes: { readonly [key: string]: string };
11
+ export default classes;
12
+ }
13
+
14
+ declare module '*.module.less' {
15
+ const classes: { readonly [key: string]: string };
16
+ export default classes;
17
+ }
18
+
19
+ declare module '*.less' {
20
+ const classes: { readonly [key: string]: string };
21
+ export default classes;
22
+ }
23
+
24
+ declare module '*.css' {
25
+ const classes: { readonly [key: string]: string };
26
+ export default classes;
27
+ }
28
+
29
+ declare module '*.sass' {
30
+ const classes: { readonly [key: string]: string };
31
+ export default classes;
32
+ }
33
+
34
+ declare module '*.scss' {
35
+ const classes: { readonly [key: string]: string };
36
+ export default classes;
37
+ }
38
+
39
+ declare module '*.mdx' {
40
+ const component: any;
41
+ export default component;
42
+ }