@dev-crew-berlin/enter-js-utils 0.6.3 → 0.7.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/dist/ui/button.d.ts +2 -1
- package/dist/ui/button.js +9 -5
- package/dist/ui/button.stories.d.ts +22 -5
- package/dist/ui/button.stories.js +15 -0
- package/dist/ui/form-elements/input.d.ts +6 -0
- package/dist/ui/form-elements/input.js +22 -0
- package/dist/ui/form-elements/input.stories.d.ts +15 -0
- package/dist/ui/form-elements/input.stories.js +33 -0
- package/dist/ui/form-elements/label.d.ts +4 -0
- package/dist/ui/form-elements/label.js +14 -0
- package/dist/ui/form-elements/label.stories.d.ts +5 -0
- package/dist/ui/form-elements/label.stories.js +13 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.js +2 -0
- package/dist/ui/tag.stories.d.ts +9 -0
- package/dist/ui/tag.stories.js +13 -0
- package/package.json +1 -1
package/dist/ui/button.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ButtonHTMLAttributes, FunctionComponent } from 'react';
|
|
2
2
|
import 'styled-jsx';
|
|
3
3
|
declare type Props = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'className' | 'color'> & {
|
|
4
|
-
appearance?: 'default' | 'primary' | 'danger' | 'green';
|
|
4
|
+
appearance?: 'default' | 'primary' | 'danger' | 'green' | 'ghost' | 'borderless';
|
|
5
|
+
fullWidth?: boolean;
|
|
5
6
|
};
|
|
6
7
|
export declare const Button: FunctionComponent<Props>;
|
|
7
8
|
export {};
|
package/dist/ui/button.js
CHANGED
|
@@ -4,15 +4,19 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import 'styled-jsx';
|
|
7
|
-
import { theme } from '../lib';
|
|
7
|
+
import { theme, classNames } from '../lib';
|
|
8
8
|
export const Button = ({
|
|
9
9
|
appearance = 'default',
|
|
10
10
|
...props
|
|
11
11
|
}) => {
|
|
12
12
|
return /*#__PURE__*/React.createElement("button", _extends({}, props, {
|
|
13
|
-
className: _JSXStyle.dynamic([["
|
|
13
|
+
className: _JSXStyle.dynamic([["3649919407", [theme.fonts.secondary, theme.colors.enterBackground, theme.colors.enterDarkGrey, theme.colors.enterGrey, theme.colors.enterBackground, theme.colors.enterError, theme.colors.enterGrey, theme.colors.enterDarkGrey, theme.colors.enterDarkGrey, theme.colors.enterGreen, theme.colors.enterGreen, theme.colors.enterDarkGrey, theme.colors.enterDarkGrey, theme.colors.enterDarkGrey]]]) + " " + (classNames({
|
|
14
|
+
button: true,
|
|
15
|
+
[appearance]: true,
|
|
16
|
+
'full-width': props.fullWidth
|
|
17
|
+
}) || "")
|
|
14
18
|
}), props.children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
15
|
-
id: "
|
|
16
|
-
dynamic: [theme.fonts.secondary, theme.colors.enterBackground, theme.colors.enterDarkGrey, theme.colors.enterGrey, theme.colors.enterBackground, theme.colors.enterError, theme.colors.enterGrey, theme.colors.enterDarkGrey, theme.colors.enterDarkGrey, theme.colors.enterGreen, theme.colors.enterGreen]
|
|
17
|
-
}, `.button.__jsx-style-dynamic-selector{font-family:${theme.fonts.secondary};margin:1em 0;padding:0.8em 1.5em;min-width:150px;font-size:1em;font-weight:500;white-space:nowrap;text-align:center;-webkit-text-decoration:none;text-decoration:none;text-transform:uppercase;-webkit-letter-spacing:0.06em;-moz-letter-spacing:0.06em;-ms-letter-spacing:0.06em;letter-spacing:0.06em;line-height:1;cursor:pointer;border-radius:2px;background-color:${theme.colors.enterBackground};color:${theme.colors.enterDarkGrey};border:1px solid ${theme.colors.enterGrey};box-shadow:0px 0px 2px 0px rgba(0,0,0,0.12), 0px 1px 2px 0px rgba(0,0,0,0.24);}.danger.__jsx-style-dynamic-selector{background-color:${theme.colors.enterBackground};color:${theme.colors.enterError};border:1px solid ${theme.colors.enterGrey};}.primary.__jsx-style-dynamic-selector{background-color:${theme.colors.enterDarkGrey};color:white;border:1px solid ${theme.colors.enterDarkGrey};}.green.__jsx-style-dynamic-selector{background-color:${theme.colors.enterGreen};color:white;border:1px solid ${theme.colors.enterGreen};}`));
|
|
19
|
+
id: "3649919407",
|
|
20
|
+
dynamic: [theme.fonts.secondary, theme.colors.enterBackground, theme.colors.enterDarkGrey, theme.colors.enterGrey, theme.colors.enterBackground, theme.colors.enterError, theme.colors.enterGrey, theme.colors.enterDarkGrey, theme.colors.enterDarkGrey, theme.colors.enterGreen, theme.colors.enterGreen, theme.colors.enterDarkGrey, theme.colors.enterDarkGrey, theme.colors.enterDarkGrey]
|
|
21
|
+
}, `.button.__jsx-style-dynamic-selector{font-family:${theme.fonts.secondary};margin:1em 0;padding:0.8em 1.5em;min-width:150px;font-size:1em;font-weight:500;white-space:nowrap;text-align:center;-webkit-text-decoration:none;text-decoration:none;text-transform:uppercase;-webkit-letter-spacing:0.06em;-moz-letter-spacing:0.06em;-ms-letter-spacing:0.06em;letter-spacing:0.06em;line-height:1;cursor:pointer;border-radius:2px;background-color:${theme.colors.enterBackground};color:${theme.colors.enterDarkGrey};border:1px solid ${theme.colors.enterGrey};box-shadow:0px 0px 2px 0px rgba(0,0,0,0.12), 0px 1px 2px 0px rgba(0,0,0,0.24);}.full-width.__jsx-style-dynamic-selector{display:block;width:100%;}.danger.__jsx-style-dynamic-selector{background-color:${theme.colors.enterBackground};color:${theme.colors.enterError};border:1px solid ${theme.colors.enterGrey};}.primary.__jsx-style-dynamic-selector{background-color:${theme.colors.enterDarkGrey};color:white;border:1px solid ${theme.colors.enterDarkGrey};}.green.__jsx-style-dynamic-selector{background-color:${theme.colors.enterGreen};color:white;border:1px solid ${theme.colors.enterGreen};}.ghost.__jsx-style-dynamic-selector{background-color:transparent;color:${theme.colors.enterDarkGrey};border:1px solid ${theme.colors.enterDarkGrey};box-shadow:none;}.borderless.__jsx-style-dynamic-selector{background-color:transparent;color:${theme.colors.enterDarkGrey};border:0;box-shadow:none;}`));
|
|
18
22
|
};
|
|
@@ -1,18 +1,35 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
3
|
declare const _default: ComponentMeta<React.FunctionComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "color"> & {
|
|
4
|
-
appearance?: "default" | "primary" | "danger" | "green" | undefined;
|
|
4
|
+
appearance?: "default" | "primary" | "danger" | "green" | "ghost" | "borderless" | undefined;
|
|
5
|
+
fullWidth?: boolean | undefined;
|
|
5
6
|
}>>;
|
|
6
7
|
export default _default;
|
|
7
8
|
export declare const Basic: ComponentStory<React.FunctionComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "color"> & {
|
|
8
|
-
appearance?: "default" | "primary" | "danger" | "green" | undefined;
|
|
9
|
+
appearance?: "default" | "primary" | "danger" | "green" | "ghost" | "borderless" | undefined;
|
|
10
|
+
fullWidth?: boolean | undefined;
|
|
11
|
+
}>>;
|
|
12
|
+
export declare const FullWidth: ComponentStory<React.FunctionComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "color"> & {
|
|
13
|
+
appearance?: "default" | "primary" | "danger" | "green" | "ghost" | "borderless" | undefined;
|
|
14
|
+
fullWidth?: boolean | undefined;
|
|
9
15
|
}>>;
|
|
10
16
|
export declare const Primary: ComponentStory<React.FunctionComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "color"> & {
|
|
11
|
-
appearance?: "default" | "primary" | "danger" | "green" | undefined;
|
|
17
|
+
appearance?: "default" | "primary" | "danger" | "green" | "ghost" | "borderless" | undefined;
|
|
18
|
+
fullWidth?: boolean | undefined;
|
|
12
19
|
}>>;
|
|
13
20
|
export declare const Danger: ComponentStory<React.FunctionComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "color"> & {
|
|
14
|
-
appearance?: "default" | "primary" | "danger" | "green" | undefined;
|
|
21
|
+
appearance?: "default" | "primary" | "danger" | "green" | "ghost" | "borderless" | undefined;
|
|
22
|
+
fullWidth?: boolean | undefined;
|
|
15
23
|
}>>;
|
|
16
24
|
export declare const Green: ComponentStory<React.FunctionComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "color"> & {
|
|
17
|
-
appearance?: "default" | "primary" | "danger" | "green" | undefined;
|
|
25
|
+
appearance?: "default" | "primary" | "danger" | "green" | "ghost" | "borderless" | undefined;
|
|
26
|
+
fullWidth?: boolean | undefined;
|
|
27
|
+
}>>;
|
|
28
|
+
export declare const Ghost: ComponentStory<React.FunctionComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "color"> & {
|
|
29
|
+
appearance?: "default" | "primary" | "danger" | "green" | "ghost" | "borderless" | undefined;
|
|
30
|
+
fullWidth?: boolean | undefined;
|
|
31
|
+
}>>;
|
|
32
|
+
export declare const Borderless: ComponentStory<React.FunctionComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "color"> & {
|
|
33
|
+
appearance?: "default" | "primary" | "danger" | "green" | "ghost" | "borderless" | undefined;
|
|
34
|
+
fullWidth?: boolean | undefined;
|
|
18
35
|
}>>;
|
|
@@ -11,6 +11,11 @@ export const Basic = Template.bind({});
|
|
|
11
11
|
Basic.args = {
|
|
12
12
|
children: 'default'
|
|
13
13
|
};
|
|
14
|
+
export const FullWidth = Template.bind({});
|
|
15
|
+
FullWidth.args = {
|
|
16
|
+
children: 'full width',
|
|
17
|
+
fullWidth: true
|
|
18
|
+
};
|
|
14
19
|
export const Primary = Template.bind({});
|
|
15
20
|
Primary.args = {
|
|
16
21
|
children: 'primary',
|
|
@@ -25,4 +30,14 @@ export const Green = Template.bind({});
|
|
|
25
30
|
Green.args = {
|
|
26
31
|
children: 'green',
|
|
27
32
|
appearance: 'green'
|
|
33
|
+
};
|
|
34
|
+
export const Ghost = Template.bind({});
|
|
35
|
+
Ghost.args = {
|
|
36
|
+
children: 'ghost',
|
|
37
|
+
appearance: 'ghost'
|
|
38
|
+
};
|
|
39
|
+
export const Borderless = Template.bind({});
|
|
40
|
+
Borderless.args = {
|
|
41
|
+
children: 'borderless',
|
|
42
|
+
appearance: 'borderless'
|
|
28
43
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { theme } from '../../lib';
|
|
7
|
+
import { Label } from './label';
|
|
8
|
+
export const Input = ({
|
|
9
|
+
label,
|
|
10
|
+
...props
|
|
11
|
+
}) => {
|
|
12
|
+
const id = props.id ?? label;
|
|
13
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Label, {
|
|
14
|
+
htmlFor: id
|
|
15
|
+
}, label), /*#__PURE__*/React.createElement("input", _extends({}, props, {
|
|
16
|
+
id: id,
|
|
17
|
+
className: _JSXStyle.dynamic([["3631038054", [theme.fonts.primary, theme.colors.enterDarkGrey, theme.colors.enterMediumGrey, theme.colors.enterRed]]]) + " " + (props && props.className != null && props.className || "")
|
|
18
|
+
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
19
|
+
id: "3631038054",
|
|
20
|
+
dynamic: [theme.fonts.primary, theme.colors.enterDarkGrey, theme.colors.enterMediumGrey, theme.colors.enterRed]
|
|
21
|
+
}, `input.__jsx-style-dynamic-selector{font-family:${theme.fonts.primary};font-size:1.1em;display:block;width:100%;padding:0.2em 0;margin-bottom:1.1em;border:none;outline:none;background-color:transparent;color:${theme.colors.enterDarkGrey};border-bottom:1px solid ${theme.colors.enterMediumGrey};border-radius:0;-webkit-transition:border-color 0.2s;transition:border-color 0.2s;}input.__jsx-style-dynamic-selector:focus{border-color:${theme.colors.enterRed};}`));
|
|
22
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
+
declare const _default: ComponentMeta<React.FunctionComponent<React.InputHTMLAttributes<HTMLInputElement> & {
|
|
4
|
+
label: string;
|
|
5
|
+
}>>;
|
|
6
|
+
export default _default;
|
|
7
|
+
export declare const Basic: ComponentStory<React.FunctionComponent<React.InputHTMLAttributes<HTMLInputElement> & {
|
|
8
|
+
label: string;
|
|
9
|
+
}>>;
|
|
10
|
+
export declare const NumberInput: ComponentStory<React.FunctionComponent<React.InputHTMLAttributes<HTMLInputElement> & {
|
|
11
|
+
label: string;
|
|
12
|
+
}>>;
|
|
13
|
+
export declare const WithValue: ComponentStory<React.FunctionComponent<React.InputHTMLAttributes<HTMLInputElement> & {
|
|
14
|
+
label: string;
|
|
15
|
+
}>>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Input } from './input';
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Form Elements/Input',
|
|
5
|
+
component: Input
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const Template = args => /*#__PURE__*/React.createElement(Input, args);
|
|
9
|
+
|
|
10
|
+
export const Basic = Template.bind({});
|
|
11
|
+
Basic.args = {
|
|
12
|
+
type: 'text',
|
|
13
|
+
label: 'Text input',
|
|
14
|
+
placeholder: 'Enter text here',
|
|
15
|
+
value: '',
|
|
16
|
+
onClick: () => undefined
|
|
17
|
+
};
|
|
18
|
+
export const NumberInput = Template.bind({});
|
|
19
|
+
NumberInput.args = {
|
|
20
|
+
type: 'number',
|
|
21
|
+
label: 'Number input',
|
|
22
|
+
placeholder: 'Enter number here',
|
|
23
|
+
value: '',
|
|
24
|
+
onClick: () => undefined
|
|
25
|
+
};
|
|
26
|
+
export const WithValue = Template.bind({});
|
|
27
|
+
WithValue.args = {
|
|
28
|
+
type: 'text',
|
|
29
|
+
label: 'Text input',
|
|
30
|
+
placeholder: 'Enter text here',
|
|
31
|
+
value: 'Text value',
|
|
32
|
+
onClick: () => undefined
|
|
33
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { theme } from '../../lib';
|
|
7
|
+
export const Label = props => {
|
|
8
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("label", _extends({}, props, {
|
|
9
|
+
className: _JSXStyle.dynamic([["2896178063", [theme.fonts.secondary, theme.colors.enterDarkGrey]]]) + " " + (props && props.className != null && props.className || "")
|
|
10
|
+
}), props.children), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
11
|
+
id: "2896178063",
|
|
12
|
+
dynamic: [theme.fonts.secondary, theme.colors.enterDarkGrey]
|
|
13
|
+
}, `label.__jsx-style-dynamic-selector{font-family:${theme.fonts.secondary};font-weight:400;font-size:0.9em;color:${theme.colors.enterDarkGrey};-webkit-letter-spacing:0.05em;-moz-letter-spacing:0.05em;-ms-letter-spacing:0.05em;letter-spacing:0.05em;margin-bottom:0.6em;}`));
|
|
14
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
+
declare const _default: ComponentMeta<React.FunctionComponent<React.LabelHTMLAttributes<HTMLLabelElement>>>;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Basic: ComponentStory<React.FunctionComponent<React.LabelHTMLAttributes<HTMLLabelElement>>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Label } from './label';
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Form Elements/Label',
|
|
5
|
+
component: Label
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const Template = args => /*#__PURE__*/React.createElement(Label, args);
|
|
9
|
+
|
|
10
|
+
export const Basic = Template.bind({});
|
|
11
|
+
Basic.args = {
|
|
12
|
+
children: 'Label text'
|
|
13
|
+
};
|
package/dist/ui/index.d.ts
CHANGED
package/dist/ui/index.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
+
declare const _default: ComponentMeta<React.FunctionComponent<{
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}>>;
|
|
6
|
+
export default _default;
|
|
7
|
+
export declare const Basic: ComponentStory<React.FunctionComponent<{
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tag } from './tag';
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Tag',
|
|
5
|
+
component: Tag
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const Template = args => /*#__PURE__*/React.createElement(Tag, args);
|
|
9
|
+
|
|
10
|
+
export const Basic = Template.bind({});
|
|
11
|
+
Basic.args = {
|
|
12
|
+
children: 'my tag'
|
|
13
|
+
};
|