@dev-crew-berlin/enter-js-utils 0.7.0 → 0.8.0
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/segmented-control.d.ts +7 -0
- package/dist/ui/form-elements/segmented-control.js +23 -0
- package/dist/ui/form-elements/segmented-control.stories.d.ts +11 -0
- package/dist/ui/form-elements/segmented-control.stories.js +14 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.js +1 -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,23 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { theme } from '../../lib';
|
|
4
|
+
export const SegmentedConrol = props => {
|
|
5
|
+
const name = props.segments.join('');
|
|
6
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
7
|
+
className: _JSXStyle.dynamic([["235524868", [theme.fonts.secondary, theme.colors.enterLightGrey, theme.colors.enterMediumGrey, theme.colors.enterDarkGrey]]]) + " " + 'segmented-controll'
|
|
8
|
+
}, props.segments.map(segment => /*#__PURE__*/React.createElement("div", {
|
|
9
|
+
className: _JSXStyle.dynamic([["235524868", [theme.fonts.secondary, theme.colors.enterLightGrey, theme.colors.enterMediumGrey, theme.colors.enterDarkGrey]]]) + " " + 'segment'
|
|
10
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
11
|
+
type: "radio",
|
|
12
|
+
id: segment,
|
|
13
|
+
name: name,
|
|
14
|
+
checked: segment === props.activeSegment,
|
|
15
|
+
className: _JSXStyle.dynamic([["235524868", [theme.fonts.secondary, theme.colors.enterLightGrey, theme.colors.enterMediumGrey, theme.colors.enterDarkGrey]]])
|
|
16
|
+
}), /*#__PURE__*/React.createElement("label", {
|
|
17
|
+
htmlFor: segment,
|
|
18
|
+
className: _JSXStyle.dynamic([["235524868", [theme.fonts.secondary, theme.colors.enterLightGrey, theme.colors.enterMediumGrey, theme.colors.enterDarkGrey]]])
|
|
19
|
+
}, segment))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
20
|
+
id: "235524868",
|
|
21
|
+
dynamic: [theme.fonts.secondary, theme.colors.enterLightGrey, theme.colors.enterMediumGrey, theme.colors.enterDarkGrey]
|
|
22
|
+
}, `.segmented-controll.__jsx-style-dynamic-selector{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;grid-gap:2px;}.segment.__jsx-style-dynamic-selector{position:relative;}.segment.__jsx-style-dynamic-selector:first-child label.__jsx-style-dynamic-selector,.segment.__jsx-style-dynamic-selector:first-child input.__jsx-style-dynamic-selector{border-radius:2px 0 0 2px;}.segment.__jsx-style-dynamic-selector:last-child label.__jsx-style-dynamic-selector,.segment.__jsx-style-dynamic-selector:last-child input.__jsx-style-dynamic-selector{border-radius:0 2px 2px 0;}label.__jsx-style-dynamic-selector{font-family:${theme.fonts.secondary};text-transform:uppercase;font-size:0.9em;-webkit-letter-spacing:0.05em;-moz-letter-spacing:0.05em;-ms-letter-spacing:0.05em;letter-spacing:0.05em;padding:0.7em 0.5em;text-align:center;background-color:${theme.colors.enterLightGrey};box-sizing:border-box;display:block;width:100%;height:100%;-webkit-transition:background-color 0.1s;transition:background-color 0.1s;cursor:pointer;}label.__jsx-style-dynamic-selector:hover{background-color:${theme.colors.enterMediumGrey};color:white;}input.__jsx-style-dynamic-selector:checked+label.__jsx-style-dynamic-selector{background-color:${theme.colors.enterDarkGrey};color:white;}input.__jsx-style-dynamic-selector{-webkit-appearance:none;-moz-appearance:none;appearance:none;position:absolute;left:0;top:0;margin:0;width:100%;height:100%;background-color:transparent;pointer-events:none;}`));
|
|
23
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
+
declare const _default: ComponentMeta<React.FunctionComponent<{
|
|
4
|
+
segments: string[];
|
|
5
|
+
activeSegment?: string | undefined;
|
|
6
|
+
}>>;
|
|
7
|
+
export default _default;
|
|
8
|
+
export declare const Basic: ComponentStory<React.FunctionComponent<{
|
|
9
|
+
segments: string[];
|
|
10
|
+
activeSegment?: string | undefined;
|
|
11
|
+
}>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SegmentedConrol } from './segmented-control';
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Form Elements/Segmented Conrol',
|
|
5
|
+
component: SegmentedConrol
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const Template = args => /*#__PURE__*/React.createElement(SegmentedConrol, args);
|
|
9
|
+
|
|
10
|
+
export const Basic = Template.bind({});
|
|
11
|
+
Basic.args = {
|
|
12
|
+
segments: ['One', 'Two', 'Three'],
|
|
13
|
+
activeSegment: 'One'
|
|
14
|
+
};
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { Input } from './form-elements/input';
|
|
2
2
|
export { Label } from './form-elements/label';
|
|
3
|
+
export { SegmentedConrol } from './form-elements/segmented-control';
|
|
3
4
|
export { Button } from './button';
|
|
4
5
|
export { CheckinCountIndicator } from './checkin-count-indicator';
|
|
5
6
|
export { CompanionInfo } from './companion-info';
|
package/dist/ui/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { Input } from './form-elements/input';
|
|
2
2
|
export { Label } from './form-elements/label';
|
|
3
|
+
export { SegmentedConrol } from './form-elements/segmented-control';
|
|
3
4
|
export { Button } from './button';
|
|
4
5
|
export { CheckinCountIndicator } from './checkin-count-indicator';
|
|
5
6
|
export { CompanionInfo } from './companion-info';
|