@scm-manager/ui-buttons 2.40.2-SNAPSHOT
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/build/index.d.ts +33 -0
- package/build/index.js +85 -0
- package/build/index.mjs +49 -0
- package/package.json +84 -0
package/README.md
ADDED
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LinkProps } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
/** @Beta */
|
|
5
|
+
declare const ButtonVariants: {
|
|
6
|
+
readonly PRIMARY: "primary";
|
|
7
|
+
readonly SECONDARY: "secondary";
|
|
8
|
+
readonly TERTIARY: "tertiary";
|
|
9
|
+
readonly SIGNAL: "signal";
|
|
10
|
+
};
|
|
11
|
+
declare type ButtonVariant = typeof ButtonVariants[keyof typeof ButtonVariants];
|
|
12
|
+
declare type BaseButtonProps = {
|
|
13
|
+
variant?: ButtonVariant;
|
|
14
|
+
isLoading?: boolean;
|
|
15
|
+
testId?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Styled html button
|
|
19
|
+
* @Beta
|
|
20
|
+
*/
|
|
21
|
+
declare const Button: React.ForwardRefExoticComponent<BaseButtonProps & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
|
22
|
+
/**
|
|
23
|
+
* Styled react router link
|
|
24
|
+
* @Beta
|
|
25
|
+
*/
|
|
26
|
+
declare const LinkButton: React.ForwardRefExoticComponent<BaseButtonProps & LinkProps<unknown> & React.RefAttributes<HTMLAnchorElement>>;
|
|
27
|
+
/**
|
|
28
|
+
* Styled html anchor
|
|
29
|
+
* @Beta
|
|
30
|
+
*/
|
|
31
|
+
declare const ExternalLinkButton: React.ForwardRefExoticComponent<BaseButtonProps & React.AnchorHTMLAttributes<HTMLAnchorElement> & React.RefAttributes<HTMLAnchorElement>>;
|
|
32
|
+
|
|
33
|
+
export { Button, ButtonVariants, ExternalLinkButton, LinkButton };
|
package/build/index.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
|
|
26
|
+
// src/index.ts
|
|
27
|
+
var src_exports = {};
|
|
28
|
+
__export(src_exports, {
|
|
29
|
+
Button: () => Button,
|
|
30
|
+
ButtonVariants: () => ButtonVariants,
|
|
31
|
+
ExternalLinkButton: () => ExternalLinkButton,
|
|
32
|
+
LinkButton: () => LinkButton
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(src_exports);
|
|
35
|
+
|
|
36
|
+
// src/Button.tsx
|
|
37
|
+
var import_react = __toESM(require("react"));
|
|
38
|
+
var import_react_router_dom = require("react-router-dom");
|
|
39
|
+
var import_classnames = __toESM(require("classnames"));
|
|
40
|
+
var import_ui_components = require("@scm-manager/ui-components");
|
|
41
|
+
var ButtonVariants = {
|
|
42
|
+
PRIMARY: "primary",
|
|
43
|
+
SECONDARY: "secondary",
|
|
44
|
+
TERTIARY: "tertiary",
|
|
45
|
+
SIGNAL: "signal"
|
|
46
|
+
};
|
|
47
|
+
var ButtonVariantList = Object.values(ButtonVariants);
|
|
48
|
+
var createButtonClasses = (variant, isLoading) => (0, import_classnames.default)("button", {
|
|
49
|
+
"is-primary": variant === "primary",
|
|
50
|
+
"is-primary is-outlined": variant === "secondary",
|
|
51
|
+
"is-primary is-inverted": variant === "tertiary",
|
|
52
|
+
"is-warning": variant === "signal",
|
|
53
|
+
"is-loading": isLoading
|
|
54
|
+
});
|
|
55
|
+
var Button = import_react.default.forwardRef(
|
|
56
|
+
({ className, variant, isLoading, testId, children, ...props }, ref) => /* @__PURE__ */ import_react.default.createElement("button", {
|
|
57
|
+
...props,
|
|
58
|
+
className: (0, import_classnames.default)(createButtonClasses(variant, isLoading), className),
|
|
59
|
+
ref,
|
|
60
|
+
...(0, import_ui_components.createAttributesForTesting)(testId)
|
|
61
|
+
}, children)
|
|
62
|
+
);
|
|
63
|
+
var LinkButton = import_react.default.forwardRef(
|
|
64
|
+
({ className, variant, isLoading, testId, children, ...props }, ref) => /* @__PURE__ */ import_react.default.createElement(import_react_router_dom.Link, {
|
|
65
|
+
...props,
|
|
66
|
+
className: (0, import_classnames.default)(createButtonClasses(variant, isLoading), className),
|
|
67
|
+
ref,
|
|
68
|
+
...(0, import_ui_components.createAttributesForTesting)(testId)
|
|
69
|
+
}, children)
|
|
70
|
+
);
|
|
71
|
+
var ExternalLinkButton = import_react.default.forwardRef(
|
|
72
|
+
({ className, variant, isLoading, testId, children, ...props }, ref) => /* @__PURE__ */ import_react.default.createElement("a", {
|
|
73
|
+
...props,
|
|
74
|
+
className: (0, import_classnames.default)(createButtonClasses(variant, isLoading), className),
|
|
75
|
+
ref,
|
|
76
|
+
...(0, import_ui_components.createAttributesForTesting)(testId)
|
|
77
|
+
}, children)
|
|
78
|
+
);
|
|
79
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
80
|
+
0 && (module.exports = {
|
|
81
|
+
Button,
|
|
82
|
+
ButtonVariants,
|
|
83
|
+
ExternalLinkButton,
|
|
84
|
+
LinkButton
|
|
85
|
+
});
|
package/build/index.mjs
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// src/Button.tsx
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Link as ReactRouterLink } from "react-router-dom";
|
|
4
|
+
import classNames from "classnames";
|
|
5
|
+
import { createAttributesForTesting } from "@scm-manager/ui-components";
|
|
6
|
+
var ButtonVariants = {
|
|
7
|
+
PRIMARY: "primary",
|
|
8
|
+
SECONDARY: "secondary",
|
|
9
|
+
TERTIARY: "tertiary",
|
|
10
|
+
SIGNAL: "signal"
|
|
11
|
+
};
|
|
12
|
+
var ButtonVariantList = Object.values(ButtonVariants);
|
|
13
|
+
var createButtonClasses = (variant, isLoading) => classNames("button", {
|
|
14
|
+
"is-primary": variant === "primary",
|
|
15
|
+
"is-primary is-outlined": variant === "secondary",
|
|
16
|
+
"is-primary is-inverted": variant === "tertiary",
|
|
17
|
+
"is-warning": variant === "signal",
|
|
18
|
+
"is-loading": isLoading
|
|
19
|
+
});
|
|
20
|
+
var Button = React.forwardRef(
|
|
21
|
+
({ className, variant, isLoading, testId, children, ...props }, ref) => /* @__PURE__ */ React.createElement("button", {
|
|
22
|
+
...props,
|
|
23
|
+
className: classNames(createButtonClasses(variant, isLoading), className),
|
|
24
|
+
ref,
|
|
25
|
+
...createAttributesForTesting(testId)
|
|
26
|
+
}, children)
|
|
27
|
+
);
|
|
28
|
+
var LinkButton = React.forwardRef(
|
|
29
|
+
({ className, variant, isLoading, testId, children, ...props }, ref) => /* @__PURE__ */ React.createElement(ReactRouterLink, {
|
|
30
|
+
...props,
|
|
31
|
+
className: classNames(createButtonClasses(variant, isLoading), className),
|
|
32
|
+
ref,
|
|
33
|
+
...createAttributesForTesting(testId)
|
|
34
|
+
}, children)
|
|
35
|
+
);
|
|
36
|
+
var ExternalLinkButton = React.forwardRef(
|
|
37
|
+
({ className, variant, isLoading, testId, children, ...props }, ref) => /* @__PURE__ */ React.createElement("a", {
|
|
38
|
+
...props,
|
|
39
|
+
className: classNames(createButtonClasses(variant, isLoading), className),
|
|
40
|
+
ref,
|
|
41
|
+
...createAttributesForTesting(testId)
|
|
42
|
+
}, children)
|
|
43
|
+
);
|
|
44
|
+
export {
|
|
45
|
+
Button,
|
|
46
|
+
ButtonVariants,
|
|
47
|
+
ExternalLinkButton,
|
|
48
|
+
LinkButton
|
|
49
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@scm-manager/ui-buttons",
|
|
3
|
+
"version": "2.40.2-SNAPSHOT",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"module": "build/index.mjs",
|
|
7
|
+
"types": "build/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"build"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsup ./src/index.ts -d build --format esm,cjs --dts",
|
|
13
|
+
"dev": "tsup ./src/index.ts -d build --format esm,cjs --dts --watch",
|
|
14
|
+
"lint": "eslint src",
|
|
15
|
+
"typecheck": "tsc",
|
|
16
|
+
"storybook": "start-storybook -p 6006 -s ../ui-webapp/public",
|
|
17
|
+
"build-storybook": "build-storybook",
|
|
18
|
+
"image-snapshots": "jest \"image-snapshot.test.ts\"",
|
|
19
|
+
"a11y-check": "jest \"a11y.test.ts\"",
|
|
20
|
+
"depcheck": "depcheck"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"react": "^17.0.1",
|
|
24
|
+
"react-dom": "^17.0.1",
|
|
25
|
+
"react-router-dom": "^5.3.1",
|
|
26
|
+
"classnames": "^2.2.6",
|
|
27
|
+
"@scm-manager/ui-components": "2.40.2-SNAPSHOT"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@scm-manager/prettier-config": "^2.11.1",
|
|
31
|
+
"@scm-manager/ui-api": "2.40.2-SNAPSHOT",
|
|
32
|
+
"@scm-manager/eslint-config": "^2.17.0",
|
|
33
|
+
"@babel/core": "^7.17.8",
|
|
34
|
+
"@scm-manager/tsconfig": "^2.12.0",
|
|
35
|
+
"@storybook/addon-essentials": "^6.4.20",
|
|
36
|
+
"@storybook/addon-interactions": "^6.4.20",
|
|
37
|
+
"@storybook/addon-a11y": "^6.4.20",
|
|
38
|
+
"@storybook/addon-links": "^6.4.20",
|
|
39
|
+
"@storybook/builder-webpack5": "^6.4.20",
|
|
40
|
+
"@storybook/manager-webpack5": "^6.4.20",
|
|
41
|
+
"@storybook/react": "^6.4.20",
|
|
42
|
+
"@storybook/addon-storyshots-puppeteer": "^6.4.20",
|
|
43
|
+
"@storybook/addon-storyshots": "^6.4.20",
|
|
44
|
+
"@storybook/testing-library": "^0.0.9",
|
|
45
|
+
"jest-transform-css": "^4.0.1",
|
|
46
|
+
"puppeteer": "^15.5.0",
|
|
47
|
+
"storybook-addon-pseudo-states": "^1.15.1",
|
|
48
|
+
"storybook-react-router": "^1.0.8",
|
|
49
|
+
"@types/storybook-react-router": "^1.0.2",
|
|
50
|
+
"sass-loader": "^12.3.0",
|
|
51
|
+
"storybook-addon-themes": "^6.1.0",
|
|
52
|
+
"babel-loader": "^8.2.4",
|
|
53
|
+
"postcss": "^8.4.12",
|
|
54
|
+
"postcss-loader": "^6.2.1",
|
|
55
|
+
"webpack": "5",
|
|
56
|
+
"tsup": "^6.1.2",
|
|
57
|
+
"mini-css-extract-plugin": "^1.6.2",
|
|
58
|
+
"html-webpack-plugin": "^5.5.0",
|
|
59
|
+
"react-query": "^3.25.1",
|
|
60
|
+
"i18next": "^19.9.2",
|
|
61
|
+
"react-i18next": "11",
|
|
62
|
+
"i18next-fetch-backend": "^2.3.1",
|
|
63
|
+
"depcheck": "^1.4.3"
|
|
64
|
+
},
|
|
65
|
+
"babel": {
|
|
66
|
+
"presets": [
|
|
67
|
+
"@scm-manager/babel-preset"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
"jest": {
|
|
71
|
+
"transform": {
|
|
72
|
+
"^.+\\.[tj]sx?$": "babel-jest",
|
|
73
|
+
"^.+\\.(css|less|scss)$": "jest-transform-css",
|
|
74
|
+
"^.+\\.mdx?$": "@storybook/addon-docs/jest-transform-mdx"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"prettier": "@scm-manager/prettier-config",
|
|
78
|
+
"eslintConfig": {
|
|
79
|
+
"extends": "@scm-manager/eslint-config"
|
|
80
|
+
},
|
|
81
|
+
"publishConfig": {
|
|
82
|
+
"access": "restricted"
|
|
83
|
+
}
|
|
84
|
+
}
|