@invoicebox/ui 0.1.0-alpha.2
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 +1 -0
- package/build/index.js +1 -0
- package/build/stories/Button.d.ts +26 -0
- package/build/stories/Button.js +37 -0
- package/build/stories/Button.stories.d.ts +21 -0
- package/build/stories/Button.stories.js +41 -0
- package/build/stories/styles.d.ts +30 -0
- package/build/stories/styles.js +30 -0
- package/package.json +54 -0
package/README.md
ADDED
package/build/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Button } from './stories/Button';
|
package/build/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Button } from './stories/Button';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface ButtonProps {
|
|
2
|
+
/**
|
|
3
|
+
* Is this the principal call to action on the page?
|
|
4
|
+
*/
|
|
5
|
+
primary?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* What background color to use
|
|
8
|
+
*/
|
|
9
|
+
backgroundColor?: string;
|
|
10
|
+
/**
|
|
11
|
+
* How large should the button be?
|
|
12
|
+
*/
|
|
13
|
+
size?: 'small' | 'medium' | 'large';
|
|
14
|
+
/**
|
|
15
|
+
* Button contents
|
|
16
|
+
*/
|
|
17
|
+
label: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optional click handler
|
|
20
|
+
*/
|
|
21
|
+
onClick?: () => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Primary UI component for user interaction
|
|
25
|
+
*/
|
|
26
|
+
export declare const Button: ({ primary, size, backgroundColor, label, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import { largeStyles, mediumStyles, primaryStyles, secondaryStyles, smallStyles, wrapperStyles, } from './styles';
|
|
25
|
+
/**
|
|
26
|
+
* Primary UI component for user interaction
|
|
27
|
+
*/
|
|
28
|
+
export var Button = function (_a) {
|
|
29
|
+
var _b = _a.primary, primary = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? 'medium' : _c, backgroundColor = _a.backgroundColor, label = _a.label, props = __rest(_a, ["primary", "size", "backgroundColor", "label"]);
|
|
30
|
+
var modeStyles = primary ? primaryStyles : secondaryStyles;
|
|
31
|
+
var sizeStyles = {
|
|
32
|
+
small: smallStyles,
|
|
33
|
+
medium: mediumStyles,
|
|
34
|
+
large: largeStyles,
|
|
35
|
+
}[size];
|
|
36
|
+
return (_jsx("button", __assign({ type: "button", style: __assign(__assign(__assign(__assign({}, wrapperStyles), modeStyles), sizeStyles), (backgroundColor ? { backgroundColor: backgroundColor } : {})) }, props, { children: label })));
|
|
37
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import { ButtonProps } from './Button';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: ({ primary, size, backgroundColor, label, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
tags: string[];
|
|
10
|
+
argTypes: {
|
|
11
|
+
backgroundColor: {
|
|
12
|
+
control: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export default meta;
|
|
17
|
+
type Story = StoryObj<typeof meta>;
|
|
18
|
+
export declare const Primary: Story;
|
|
19
|
+
export declare const Secondary: Story;
|
|
20
|
+
export declare const Large: Story;
|
|
21
|
+
export declare const Small: Story;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Button } from './Button';
|
|
2
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
3
|
+
var meta = {
|
|
4
|
+
title: 'Example/Button',
|
|
5
|
+
component: Button,
|
|
6
|
+
parameters: {
|
|
7
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
},
|
|
10
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
|
13
|
+
argTypes: {
|
|
14
|
+
backgroundColor: { control: 'color' },
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export default meta;
|
|
18
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
19
|
+
export var Primary = {
|
|
20
|
+
args: {
|
|
21
|
+
primary: true,
|
|
22
|
+
label: 'Button',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
export var Secondary = {
|
|
26
|
+
args: {
|
|
27
|
+
label: 'Button',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
export var Large = {
|
|
31
|
+
args: {
|
|
32
|
+
size: 'large',
|
|
33
|
+
label: 'Button',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
export var Small = {
|
|
37
|
+
args: {
|
|
38
|
+
size: 'small',
|
|
39
|
+
label: 'Button',
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const wrapperStyles: {
|
|
2
|
+
fontFamily: string;
|
|
3
|
+
fontWeight: number;
|
|
4
|
+
border: number;
|
|
5
|
+
borderRadius: string;
|
|
6
|
+
cursor: string;
|
|
7
|
+
display: string;
|
|
8
|
+
lineHeight: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const primaryStyles: {
|
|
11
|
+
color: string;
|
|
12
|
+
backgroundColor: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const secondaryStyles: {
|
|
15
|
+
color: string;
|
|
16
|
+
backgroundColor: string;
|
|
17
|
+
boxShadow: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const smallStyles: {
|
|
20
|
+
fontSize: string;
|
|
21
|
+
padding: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const mediumStyles: {
|
|
24
|
+
fontSize: string;
|
|
25
|
+
padding: string;
|
|
26
|
+
};
|
|
27
|
+
export declare const largeStyles: {
|
|
28
|
+
fontSize: string;
|
|
29
|
+
padding: string;
|
|
30
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export var wrapperStyles = {
|
|
2
|
+
fontFamily: "'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif",
|
|
3
|
+
fontWeight: 700,
|
|
4
|
+
border: 0,
|
|
5
|
+
borderRadius: '3em',
|
|
6
|
+
cursor: 'pointer',
|
|
7
|
+
display: 'inline-block',
|
|
8
|
+
lineHeight: 1,
|
|
9
|
+
};
|
|
10
|
+
export var primaryStyles = {
|
|
11
|
+
color: 'white',
|
|
12
|
+
backgroundColor: '#1ea7fd',
|
|
13
|
+
};
|
|
14
|
+
export var secondaryStyles = {
|
|
15
|
+
color: '#333',
|
|
16
|
+
backgroundColor: 'transparent',
|
|
17
|
+
boxShadow: 'rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset',
|
|
18
|
+
};
|
|
19
|
+
export var smallStyles = {
|
|
20
|
+
fontSize: '12px',
|
|
21
|
+
padding: '10px 16px',
|
|
22
|
+
};
|
|
23
|
+
export var mediumStyles = {
|
|
24
|
+
fontSize: '14px',
|
|
25
|
+
padding: '11px 20px',
|
|
26
|
+
};
|
|
27
|
+
export var largeStyles = {
|
|
28
|
+
fontSize: '16px',
|
|
29
|
+
padding: '12px 24px',
|
|
30
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@invoicebox/ui",
|
|
3
|
+
"version": "0.1.0-alpha.2",
|
|
4
|
+
"description": "Invoicebox UI",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"storybook": "storybook dev -p 6006",
|
|
8
|
+
"build-storybook": "storybook build",
|
|
9
|
+
"build": "tsc --project tsconfig.json"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/InvoiceBox/invoicebox-ui/issues"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/InvoiceBox/invoicebox-ui.git"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/InvoiceBox/invoicebox-ui#readme",
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
|
21
|
+
"@storybook/addon-essentials": "^7.6.13",
|
|
22
|
+
"@storybook/addon-interactions": "^7.6.13",
|
|
23
|
+
"@storybook/addon-links": "^7.6.13",
|
|
24
|
+
"@storybook/addon-onboarding": "^1.0.11",
|
|
25
|
+
"@storybook/blocks": "^7.6.13",
|
|
26
|
+
"@storybook/preset-create-react-app": "^7.6.13",
|
|
27
|
+
"@storybook/react": "^7.6.13",
|
|
28
|
+
"@storybook/react-webpack5": "^7.6.13",
|
|
29
|
+
"@storybook/test": "^7.6.13",
|
|
30
|
+
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
31
|
+
"@typescript-eslint/parser": "^5.62.0",
|
|
32
|
+
"eslint": "^8.56.0",
|
|
33
|
+
"eslint-config-prettier": "^9.1.0",
|
|
34
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
35
|
+
"eslint-plugin-storybook": "^0.6.15",
|
|
36
|
+
"prettier": "^3.2.5",
|
|
37
|
+
"prop-types": "^15.8.1",
|
|
38
|
+
"storybook": "^7.6.13",
|
|
39
|
+
"typescript": "^4.9.5",
|
|
40
|
+
"webpack": "^5.90.1"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": "^16.17.1"
|
|
44
|
+
},
|
|
45
|
+
"files": [
|
|
46
|
+
"build"
|
|
47
|
+
],
|
|
48
|
+
"type": "module",
|
|
49
|
+
"types": "./build/index.d.ts",
|
|
50
|
+
"module": "./build/index.js",
|
|
51
|
+
"exports": {
|
|
52
|
+
"import": "./build/index.js"
|
|
53
|
+
}
|
|
54
|
+
}
|