@teambit/design.buttons.button-link 0.0.4

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,5 @@
1
+ .link {
2
+ &:hover {
3
+ text-decoration: none;
4
+ }
5
+ }
@@ -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/design.ui.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 linkClassName = linkProps?.className;
16
+ return (
17
+ <Link {...linkProps} className={classNames(styles.link, linkClassName)}>
18
+ <IconButton {...rest} />
19
+ </Link>
20
+ );
21
+ }
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const ButtonLinkWithImage: () => JSX.Element;
3
+ export declare const ButtonLinkWithIcon: () => JSX.Element;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ButtonLinkWithIcon = exports.ButtonLinkWithImage = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const design_elements_icon_1 = require("@teambit/design.elements.icon");
9
+ const button_link_1 = require("./button-link");
10
+ const ButtonLinkWithImage = () => {
11
+ return (react_1.default.createElement(button_link_1.ButtonLink, { linkProps: { external: true, href: 'https://bit.cloud/teambit' }, icon: react_1.default.createElement("img", { src: "https://static.bit.cloud/bit-icons/setting.svg" }) }, "Settings"));
12
+ };
13
+ exports.ButtonLinkWithImage = ButtonLinkWithImage;
14
+ const ButtonLinkWithIcon = () => {
15
+ return (react_1.default.createElement(button_link_1.ButtonLink, { linkProps: { external: true, href: 'https://bit.cloud/teambit' }, icon: react_1.default.createElement(design_elements_icon_1.Icon, { of: "settings" }) }, "Settings"));
16
+ };
17
+ exports.ButtonLinkWithIcon = ButtonLinkWithIcon;
18
+ //# 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,kDAA0B;AAC1B,wEAAqD;AACrD,+CAA2C;AAEpC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,OAAO,CACL,8BAAC,wBAAU,IACT,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,2BAA2B,EAAE,EAChE,IAAI,EAAE,uCAAK,GAAG,EAAC,gDAAgD,GAAG,eAGvD,CACd,CAAC;AACJ,CAAC,CAAC;AATW,QAAA,mBAAmB,uBAS9B;AAEK,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,OAAO,CACL,8BAAC,wBAAU,IAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,2BAA2B,EAAE,EAAE,IAAI,EAAE,8BAAC,2BAAI,IAAC,EAAE,EAAC,UAAU,GAAG,eAE7F,CACd,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,kBAAkB,sBAM7B"}
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { LinkProps } from '@teambit/design.ui.navigation.link';
3
+ import { IconButtonProps } from '@teambit/design.ui.icon-button';
4
+ export declare type ButtonLinkProps = {
5
+ /**
6
+ * link props.
7
+ */
8
+ linkProps?: LinkProps;
9
+ } & IconButtonProps;
10
+ export declare function ButtonLink({ linkProps, ...rest }: ButtonLinkProps): 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,30 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ButtonLink = void 0;
18
+ const react_1 = __importDefault(require("react"));
19
+ const classnames_1 = __importDefault(require("classnames"));
20
+ const design_ui_navigation_link_1 = require("@teambit/design.ui.navigation.link");
21
+ const design_ui_icon_button_1 = require("@teambit/design.ui.icon-button");
22
+ const button_link_module_scss_1 = __importDefault(require("./button-link.module.scss"));
23
+ function ButtonLink(_a) {
24
+ var { linkProps } = _a, rest = __rest(_a, ["linkProps"]);
25
+ const linkClassName = linkProps === null || linkProps === void 0 ? void 0 : linkProps.className;
26
+ return (react_1.default.createElement(design_ui_navigation_link_1.Link, Object.assign({}, linkProps, { className: (0, classnames_1.default)(button_link_module_scss_1.default.link, linkClassName) }),
27
+ react_1.default.createElement(design_ui_icon_button_1.IconButton, Object.assign({}, rest))));
28
+ }
29
+ exports.ButtonLink = ButtonLink;
30
+ //# sourceMappingURL=button-link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button-link.js","sourceRoot":"","sources":["../button-link.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,4DAAoC;AACpC,kFAAqE;AACrE,0EAA6E;AAC7E,wFAA+C;AAS/C,SAAgB,UAAU,CAAC,EAAuC;QAAvC,EAAE,SAAS,OAA4B,EAAvB,IAAI,cAApB,aAAsB,CAAF;IAC7C,MAAM,aAAa,GAAG,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,SAAS,CAAC;IAC3C,OAAO,CACL,8BAAC,gCAAI,oBAAK,SAAS,IAAE,SAAS,EAAE,IAAA,oBAAU,EAAC,iCAAM,CAAC,IAAI,EAAE,aAAa,CAAC;QACpE,8BAAC,kCAAU,oBAAK,IAAI,EAAI,CACnB,CACR,CAAC;AACJ,CAAC;AAPD,gCAOC"}
@@ -0,0 +1,5 @@
1
+ .link {
2
+ &:hover {
3
+ text-decoration: none;
4
+ }
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const react_2 = require("@testing-library/react");
8
+ const button_link_composition_1 = require("./button-link.composition");
9
+ it('should render with the correct text', () => {
10
+ const { getByText } = (0, react_2.render)(react_1.default.createElement(button_link_composition_1.ButtonLinkWithImage, null));
11
+ const rendered = getByText('Settings');
12
+ expect(rendered).toBeTruthy();
13
+ });
14
+ it('should render with image tag', () => {
15
+ const { container } = (0, react_2.render)(react_1.default.createElement(button_link_composition_1.ButtonLinkWithImage, null));
16
+ expect(container.getElementsByTagName('img').length).toBe(1);
17
+ });
18
+ //# 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,kDAA0B;AAC1B,kDAAgD;AAChD,uEAAgE;AAEhE,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;IAC7C,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,cAAM,EAAC,8BAAC,6CAAmB,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,IAAA,cAAM,EAAC,8BAAC,6CAAmB,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,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ButtonLink = void 0;
4
+ var button_link_1 = require("./button-link");
5
+ Object.defineProperty(exports, "ButtonLink", { enumerable: true, get: function () { return button_link_1.ButtonLink; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAAlC,yGAAA,UAAU,OAAA"}
@@ -0,0 +1,32 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": [
4
+ "es2019",
5
+ "DOM",
6
+ "ES6",
7
+ "DOM.Iterable"
8
+ ],
9
+ "target": "es2015",
10
+ "module": "CommonJS",
11
+ "jsx": "react",
12
+ "allowJs": true,
13
+ "composite": true,
14
+ "declaration": true,
15
+ "sourceMap": true,
16
+ "skipLibCheck": true,
17
+ "experimentalDecorators": true,
18
+ "outDir": "dist",
19
+ "moduleResolution": "node",
20
+ "esModuleInterop": true,
21
+ "rootDir": ".",
22
+ "resolveJsonModule": true
23
+ },
24
+ "exclude": [
25
+ "dist",
26
+ "package.json"
27
+ ],
28
+ "include": [
29
+ "**/*",
30
+ "**/*.json"
31
+ ]
32
+ }
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,60 @@
1
+ {
2
+ "name": "@teambit/design.buttons.button-link",
3
+ "version": "0.0.4",
4
+ "homepage": "https://bit.dev/teambit/design/buttons/button-link",
5
+ "main": "dist/index.js",
6
+ "componentId": {
7
+ "scope": "teambit.design",
8
+ "name": "buttons/button-link",
9
+ "version": "0.0.4"
10
+ },
11
+ "dependencies": {
12
+ "classnames": "^2.2.6",
13
+ "core-js": "^3.0.0",
14
+ "@teambit/design.ui.icon-button": "1.1.7",
15
+ "@teambit/design.ui.navigation.link": "1.96.5"
16
+ },
17
+ "devDependencies": {
18
+ "@types/react": "^17.0.8",
19
+ "@testing-library/react": "11.2.2",
20
+ "@types/testing-library__jest-dom": "5.9.5",
21
+ "@babel/runtime": "7.12.18",
22
+ "@types/jest": "^26.0.0",
23
+ "@types/react-dom": "^17.0.5",
24
+ "@types/node": "12.20.4",
25
+ "@teambit/design.elements.icon": "1.0.15",
26
+ "@teambit/design.envs.react": "2.0.1"
27
+ },
28
+ "peerDependencies": {
29
+ "react-dom": "^16.8.0 || ^17.0.0",
30
+ "react": "^16.8.0 || ^17.0.0"
31
+ },
32
+ "license": "SEE LICENSE IN LICENSE",
33
+ "bit": {
34
+ "bindingPrefix": "@teambit",
35
+ "env": {},
36
+ "overrides": {
37
+ "dependencies": {
38
+ "core-js": "^3.0.0",
39
+ "react-dom": "-",
40
+ "react": "-"
41
+ },
42
+ "devDependencies": {
43
+ "@types/testing-library__jest-dom": "5.9.5",
44
+ "@babel/runtime": "7.12.18",
45
+ "@types/jest": "^26.0.0",
46
+ "@types/react-dom": "^17.0.5",
47
+ "@types/react": "^17.0.8",
48
+ "@types/node": "12.20.4",
49
+ "@types/mocha": "-",
50
+ "react-dom": "-",
51
+ "react": "-"
52
+ },
53
+ "peerDependencies": {
54
+ "react-dom": "^16.8.0 || ^17.0.0",
55
+ "react": "^16.8.0 || ^17.0.0"
56
+ }
57
+ }
58
+ },
59
+ "private": false
60
+ }
@@ -0,0 +1,5 @@
1
+ import * as compositions_0 from '/Users/yoshuakuttler/Library/Caches/Bit/capsules/9ef7c8a91102326f83259a520cf828d4bf50a645/teambit.design_buttons_button-link@0.0.4/dist/button-link.composition.js';
2
+ import * as overview_0 from '/Users/yoshuakuttler/Library/Caches/Bit/capsules/9ef7c8a91102326f83259a520cf828d4bf50a645/teambit.design_buttons_button-link@0.0.4/dist/button-link.docs.mdx';
3
+
4
+ export const compositions = [compositions_0];
5
+ export const overview = [overview_0];
package/tsconfig.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": [
4
+ "es2019",
5
+ "DOM",
6
+ "ES6",
7
+ "DOM.Iterable"
8
+ ],
9
+ "target": "es2015",
10
+ "module": "CommonJS",
11
+ "jsx": "react",
12
+ "allowJs": true,
13
+ "composite": true,
14
+ "declaration": true,
15
+ "sourceMap": true,
16
+ "skipLibCheck": true,
17
+ "experimentalDecorators": true,
18
+ "outDir": "dist",
19
+ "moduleResolution": "node",
20
+ "esModuleInterop": true,
21
+ "rootDir": ".",
22
+ "resolveJsonModule": true
23
+ },
24
+ "exclude": [
25
+ "dist",
26
+ "package.json"
27
+ ],
28
+ "include": [
29
+ "**/*",
30
+ "**/*.json"
31
+ ]
32
+ }
@@ -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
+ }