@dev-crew-berlin/enter-js-utils 0.8.1 → 0.9.3

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.
@@ -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' | 'ghost' | 'borderless';
4
+ appearance?: 'default' | 'primary' | 'danger' | 'green';
5
+ borderless?: boolean;
5
6
  fullWidth?: boolean;
6
7
  };
7
8
  export declare const Button: FunctionComponent<Props>;
package/dist/ui/button.js CHANGED
@@ -10,13 +10,14 @@ export const Button = ({
10
10
  ...props
11
11
  }) => {
12
12
  return /*#__PURE__*/React.createElement("button", _extends({}, props, {
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({
13
+ className: _JSXStyle.dynamic([["4253066945", [theme.fonts.secondary, theme.colors.enterBackground, theme.colors.enterDarkGrey, theme.colors.enterGrey, theme.colors.enterError, theme.colors.enterGrey, theme.colors.enterError, theme.colors.enterDarkGrey, theme.colors.enterDarkGrey, theme.colors.enterDarkGrey, theme.colors.enterGreen, theme.colors.enterGreen, theme.colors.enterGreen]]]) + " " + (classNames({
14
14
  button: true,
15
15
  [appearance]: true,
16
+ borderless: props.borderless,
16
17
  'full-width': props.fullWidth
17
18
  }) || "")
18
19
  }), props.children, /*#__PURE__*/React.createElement(_JSXStyle, {
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;}`));
20
+ id: "4253066945",
21
+ dynamic: [theme.fonts.secondary, theme.colors.enterBackground, theme.colors.enterDarkGrey, theme.colors.enterGrey, theme.colors.enterError, theme.colors.enterGrey, theme.colors.enterError, theme.colors.enterDarkGrey, theme.colors.enterDarkGrey, theme.colors.enterDarkGrey, theme.colors.enterGreen, theme.colors.enterGreen, theme.colors.enterGreen]
22
+ }, `.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);}.button.borderless.__jsx-style-dynamic-selector{background-color:transparent;border:0;box-shadow:none;padding:0;margin:2em 0 1.8em;}.full-width.__jsx-style-dynamic-selector{display:block;width:100%;}.danger.__jsx-style-dynamic-selector{color:${theme.colors.enterError};border:1px solid ${theme.colors.enterGrey};}.danger.borderless.__jsx-style-dynamic-selector{color:${theme.colors.enterError};}.primary.__jsx-style-dynamic-selector{background-color:${theme.colors.enterDarkGrey};color:white;border:1px solid ${theme.colors.enterDarkGrey};}.primary.borderless.__jsx-style-dynamic-selector{color:${theme.colors.enterDarkGrey};font-weight:bold;}.green.__jsx-style-dynamic-selector{background-color:${theme.colors.enterGreen};color:white;border:1px solid ${theme.colors.enterGreen};}.green.borderless.__jsx-style-dynamic-selector{color:${theme.colors.enterGreen};}`));
22
23
  };
@@ -1,35 +1,54 @@
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" | "ghost" | "borderless" | undefined;
4
+ appearance?: "default" | "primary" | "danger" | "green" | undefined;
5
+ borderless?: boolean | undefined;
5
6
  fullWidth?: boolean | undefined;
6
7
  }>>;
7
8
  export default _default;
8
9
  export declare const Basic: ComponentStory<React.FunctionComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "color"> & {
9
- appearance?: "default" | "primary" | "danger" | "green" | "ghost" | "borderless" | undefined;
10
+ appearance?: "default" | "primary" | "danger" | "green" | undefined;
11
+ borderless?: boolean | undefined;
10
12
  fullWidth?: boolean | undefined;
11
13
  }>>;
12
14
  export declare const FullWidth: ComponentStory<React.FunctionComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "color"> & {
13
- appearance?: "default" | "primary" | "danger" | "green" | "ghost" | "borderless" | undefined;
15
+ appearance?: "default" | "primary" | "danger" | "green" | undefined;
16
+ borderless?: boolean | undefined;
14
17
  fullWidth?: boolean | undefined;
15
18
  }>>;
16
19
  export declare const Primary: ComponentStory<React.FunctionComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "color"> & {
17
- appearance?: "default" | "primary" | "danger" | "green" | "ghost" | "borderless" | undefined;
20
+ appearance?: "default" | "primary" | "danger" | "green" | undefined;
21
+ borderless?: boolean | undefined;
18
22
  fullWidth?: boolean | undefined;
19
23
  }>>;
20
24
  export declare const Danger: ComponentStory<React.FunctionComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "color"> & {
21
- appearance?: "default" | "primary" | "danger" | "green" | "ghost" | "borderless" | undefined;
25
+ appearance?: "default" | "primary" | "danger" | "green" | undefined;
26
+ borderless?: boolean | undefined;
22
27
  fullWidth?: boolean | undefined;
23
28
  }>>;
24
29
  export declare const Green: ComponentStory<React.FunctionComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "color"> & {
25
- appearance?: "default" | "primary" | "danger" | "green" | "ghost" | "borderless" | undefined;
30
+ appearance?: "default" | "primary" | "danger" | "green" | undefined;
31
+ borderless?: boolean | undefined;
26
32
  fullWidth?: boolean | undefined;
27
33
  }>>;
28
- export declare const Ghost: ComponentStory<React.FunctionComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "color"> & {
29
- appearance?: "default" | "primary" | "danger" | "green" | "ghost" | "borderless" | undefined;
34
+ export declare const Borderless: ComponentStory<React.FunctionComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "color"> & {
35
+ appearance?: "default" | "primary" | "danger" | "green" | undefined;
36
+ borderless?: boolean | undefined;
30
37
  fullWidth?: boolean | undefined;
31
38
  }>>;
32
- export declare const Borderless: ComponentStory<React.FunctionComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "color"> & {
33
- appearance?: "default" | "primary" | "danger" | "green" | "ghost" | "borderless" | undefined;
39
+ export declare const BorderlessPrimary: ComponentStory<React.FunctionComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "color"> & {
40
+ appearance?: "default" | "primary" | "danger" | "green" | undefined;
41
+ borderless?: boolean | undefined;
42
+ fullWidth?: boolean | undefined;
43
+ }>>;
44
+ export declare const BorderlessDanger: ComponentStory<React.FunctionComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "color"> & {
45
+ appearance?: "default" | "primary" | "danger" | "green" | undefined;
46
+ borderless?: boolean | undefined;
47
+ fullWidth?: boolean | undefined;
48
+ }>>;
49
+ export declare const BorderlessGreen: ComponentStory<React.FunctionComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "className" | "color"> & {
50
+ appearance?: "default" | "primary" | "danger" | "green" | undefined;
51
+ borderless?: boolean | undefined;
34
52
  fullWidth?: boolean | undefined;
35
53
  }>>;
54
+ export declare const OnePrimaryAndTwoBorderless: () => JSX.Element;
@@ -31,13 +31,36 @@ Green.args = {
31
31
  children: 'green',
32
32
  appearance: 'green'
33
33
  };
34
- export const Ghost = Template.bind({});
35
- Ghost.args = {
36
- children: 'ghost',
37
- appearance: 'ghost'
38
- };
39
34
  export const Borderless = Template.bind({});
40
35
  Borderless.args = {
41
36
  children: 'borderless',
42
- appearance: 'borderless'
43
- };
37
+ borderless: true
38
+ };
39
+ export const BorderlessPrimary = Template.bind({});
40
+ BorderlessPrimary.args = {
41
+ children: 'borderless primaray',
42
+ borderless: true,
43
+ appearance: 'primary'
44
+ };
45
+ export const BorderlessDanger = Template.bind({});
46
+ BorderlessDanger.args = {
47
+ children: 'borderless danger',
48
+ borderless: true,
49
+ appearance: 'danger'
50
+ };
51
+ export const BorderlessGreen = Template.bind({});
52
+ BorderlessGreen.args = {
53
+ children: 'borderless green',
54
+ borderless: true,
55
+ appearance: 'green'
56
+ };
57
+ export const OnePrimaryAndTwoBorderless = () => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
58
+ fullWidth: true,
59
+ appearance: "primary"
60
+ }, "Primary"), /*#__PURE__*/React.createElement(Button, {
61
+ fullWidth: true,
62
+ borderless: true
63
+ }, "1st secondary option"), /*#__PURE__*/React.createElement(Button, {
64
+ fullWidth: true,
65
+ borderless: true
66
+ }, "2nd secondary option"));
@@ -6,9 +6,9 @@ import React from 'react';
6
6
  import { theme } from '../../lib';
7
7
  export const Label = props => {
8
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 || "")
9
+ className: _JSXStyle.dynamic([["1848048607", [theme.fonts.secondary, theme.colors.enterDarkGrey]]]) + " " + (props && props.className != null && props.className || "")
10
10
  }), props.children), /*#__PURE__*/React.createElement(_JSXStyle, {
11
- id: "2896178063",
11
+ id: "1848048607",
12
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;}`));
13
+ }, `label.__jsx-style-dynamic-selector{display:block;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
14
  };
@@ -1,7 +1,8 @@
1
- import { FunctionComponent } from 'react';
2
- declare type Props = {
3
- segments: string[];
4
- activeSegment?: string;
1
+ import { ReactElement } from 'react';
2
+ declare type Props<Segment extends string> = {
3
+ segments: Segment[];
4
+ activeSegment?: Segment;
5
+ onChange: (segment: Segment) => void;
5
6
  };
6
- export declare const SegmentedControl: FunctionComponent<Props>;
7
+ export declare const SegmentedControl: <Segment extends string>(props: Props<Segment>) => ReactElement;
7
8
  export {};
@@ -12,6 +12,7 @@ export const SegmentedControl = props => {
12
12
  id: segment,
13
13
  name: name,
14
14
  checked: segment === props.activeSegment,
15
+ onChange: () => props.onChange(segment),
15
16
  className: _JSXStyle.dynamic([["235524868", [theme.fonts.secondary, theme.colors.enterLightGrey, theme.colors.enterMediumGrey, theme.colors.enterDarkGrey]]])
16
17
  }), /*#__PURE__*/React.createElement("label", {
17
18
  htmlFor: segment,
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
2
  import { ComponentStory, ComponentMeta } from '@storybook/react';
3
- declare const _default: ComponentMeta<React.FunctionComponent<{
4
- segments: string[];
5
- activeSegment?: string | undefined;
6
- }>>;
3
+ declare const _default: ComponentMeta<(<Segment extends string>(props: {
4
+ segments: Segment[];
5
+ activeSegment?: Segment | undefined;
6
+ onChange: (segment: Segment) => void;
7
+ }) => React.ReactElement<any, string | React.JSXElementConstructor<any>>)>;
7
8
  export default _default;
8
- export declare const Basic: ComponentStory<React.FunctionComponent<{
9
- segments: string[];
10
- activeSegment?: string | undefined;
11
- }>>;
9
+ export declare const Basic: ComponentStory<(<Segment extends string>(props: {
10
+ segments: Segment[];
11
+ activeSegment?: Segment | undefined;
12
+ onChange: (segment: Segment) => void;
13
+ }) => React.ReactElement<any, string | React.JSXElementConstructor<any>>)>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-crew-berlin/enter-js-utils",
3
- "version": "0.8.1",
3
+ "version": "0.9.3",
4
4
  "description": "utils such as vaildation and other helpers to work with data from the enter app",
5
5
  "files": [
6
6
  "dist",