Skip to content
This repository was archived by the owner on Mar 8, 2023. It is now read-only.

Commit 08e1c81

Browse files
committed
merge
2 parents f677796 + 959e5fe commit 08e1c81

File tree

47 files changed

+336
-100
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+336
-100
lines changed

docs/.storybook/webpack.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = async ({ config }) => {
2+
config.resolve.mainFields = ['main'];
3+
4+
return config;
5+
};

docs/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "docs",
3-
"version": "1.0.6",
3+
"version": "1.1.0",
44
"private": true,
55
"description": "Buffetjs Documentation",
66
"main": "index.js",
@@ -12,10 +12,10 @@
1212
"author": "",
1313
"license": "MIT",
1414
"dependencies": {
15-
"@buffetjs/core": "1.0.6",
16-
"@buffetjs/custom": "1.0.6",
17-
"@buffetjs/icons": "1.0.6",
18-
"@buffetjs/styles": "1.0.5",
15+
"@buffetjs/core": "1.1.0",
16+
"@buffetjs/custom": "1.1.0",
17+
"@buffetjs/icons": "1.1.0",
18+
"@buffetjs/styles": "1.1.0",
1919
"@fortawesome/free-solid-svg-icons": "^5.11.2",
2020
"@fortawesome/react-fontawesome": "^0.1.4",
2121
"bootstrap": "^4.3.1",

docs/stories/components/AttributeIcon.stories.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function AttributeIconStory() {
2424
'boolean',
2525
'date',
2626
'component',
27-
'contenttype',
27+
'contentType',
2828
'dynamiczone',
2929
'email',
3030
'enum',
@@ -56,7 +56,7 @@ const Example = () => (
5656
'boolean',
5757
'date',
5858
'component',
59-
'contentype',
59+
'contentType',
6060
'dynamiczone',
6161
'email',
6262
'enum',

docs/stories/customComponents/Inputs.stories.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ function InputStory() {
135135
<form onSubmit={() => {}}>
136136
<div className="row">
137137
{Object.keys(form).map(input => (
138-
<div className={form[input].styleName} key={input}>
138+
<div
139+
className={form[input].styleName}
140+
key={input}
141+
style={{ marginBottom: 4 }}
142+
>
139143
<Inputs
140144
customInputs={{ custom: Foo }}
141145
name={input}

docs/stories/icons/icons.stories.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import React, { useState } from 'react';
1+
import React from 'react';
22
/* eslint-disable import/no-extraneous-dependencies */
33
import { storiesOf } from '@storybook/react';
44
import {
5+
Arrow,
56
Grab,
67
GrabLarge,
78
Pencil,
@@ -27,6 +28,10 @@ import Pre from '../ui/Pre';
2728

2829
const IconsStory = () => {
2930
const icons = [
31+
{
32+
name: 'arrow',
33+
Compo: Arrow,
34+
},
3035
{
3136
name: 'bool',
3237
Compo: Bool,

docs/stories/ui/Global.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ body {
1616
}
1717
section div {
1818
&.row {
19-
margin-bottom: ${sizes.margin * 1.8}px;
19+
margin-bottom: ${sizes.margin * 2}px;
2020
}
2121
&.btn-wrapper {
2222
display: inline-block;

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.0.6",
2+
"version": "1.1.0",
33
"npmClient": "yarn",
44
"useWorkspaces": true
55
}

packages/buffetjs-core/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@buffetjs/core",
3-
"version": "1.0.6",
3+
"version": "1.1.0",
44
"description": "Buffetjs Core Components",
55
"main": "dist/index.js",
66
"module": "src/index.js",
@@ -15,9 +15,9 @@
1515
"watch": "babel --config-file ../../.babelrc src --watch --out-dir dist --copy-files --no-comments && rimraf dist/**/**/tests"
1616
},
1717
"dependencies": {
18-
"@buffetjs/icons": "1.0.6",
19-
"@buffetjs/styles": "1.0.5",
20-
"@buffetjs/utils": "1.0.5",
18+
"@buffetjs/icons": "1.1.0",
19+
"@buffetjs/styles": "1.1.0",
20+
"@buffetjs/utils": "1.1.0",
2121
"@fortawesome/fontawesome-svg-core": "^1.2.25",
2222
"@fortawesome/free-regular-svg-icons": "^5.11.2",
2323
"@fortawesome/free-solid-svg-icons": "^5.11.2",

packages/buffetjs-core/src/components/AttributeIcon/Div.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const Div = styled.div`
2121
return '#1c8ee2';
2222
case 'component':
2323
return '#666666';
24-
case 'contenttype':
24+
case 'contentType':
2525
return '#ff6458';
2626
case 'dynamiczone':
2727
return '#333333';

packages/buffetjs-core/src/components/AttributeIcon/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const types = {
2323
boolean: Bool,
2424
biginteger: NumberIcon,
2525
component: Component,
26-
contenttype: ContentType,
26+
contentType: ContentType,
2727
date: Calendar,
2828
datetime: Calendar,
2929
decimal: NumberIcon,

packages/buffetjs-core/src/components/Button/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import PrefixIcon from '../PrefixIcon';
1212

1313
function Button(props) {
1414
const content = props.label ? props.label : props.children;
15+
const { disabled } = props;
1516
const icon =
1617
props.icon === true ? (
1718
<PrefixIcon icon="plus" />
@@ -20,7 +21,7 @@ function Button(props) {
2021
);
2122

2223
return (
23-
<StyledButton {...omit(props, ['icon'])}>
24+
<StyledButton {...omit(props, ['icon'])} disabled={disabled}>
2425
{icon}
2526
{content}
2627
</StyledButton>
@@ -30,6 +31,7 @@ function Button(props) {
3031
Button.defaultProps = {
3132
children: null,
3233
color: 'primary',
34+
disabled: false,
3335
icon: false,
3436
label: null,
3537
type: 'button',
@@ -38,6 +40,7 @@ Button.defaultProps = {
3840
Button.propTypes = {
3941
children: PropTypes.node,
4042
color: PropTypes.string,
43+
disabled: PropTypes.bool,
4144
icon: PropTypes.oneOfType([PropTypes.node, PropTypes.bool]),
4245
label: PropTypes.string,
4346
type: PropTypes.oneOf(['submit', 'reset', 'button', 'menu']),

packages/buffetjs-core/src/components/DatePicker/index.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,21 @@ class DatePicker extends React.PureComponent {
6868
};
6969

7070
render() {
71-
const { className, displayFormat, id, name, tabIndex } = this.props;
71+
const {
72+
className,
73+
disabled,
74+
displayFormat,
75+
id,
76+
name,
77+
tabIndex,
78+
} = this.props;
7279
const { date, isFocused, visible } = this.state;
7380

7481
return (
7582
<StyledDatepicker className={className}>
7683
<div>
7784
<Input
85+
disabled={disabled}
7886
type="text"
7987
name="start_date"
8088
id={id || name}
@@ -90,6 +98,7 @@ class DatePicker extends React.PureComponent {
9098
{visible && (
9199
<DayPickerSingleDateController
92100
date={date}
101+
disabled={disabled}
93102
focused={isFocused}
94103
numberOfMonths={1}
95104
onFocusChange={this.handleFocusChange}
@@ -104,16 +113,18 @@ class DatePicker extends React.PureComponent {
104113

105114
DatePicker.defaultProps = {
106115
className: null,
116+
disabled: false,
107117
displayFormat: 'MMMM DD, YY',
108118
id: 'date',
109119
onChange: () => {},
110120
tabIndex: '0',
111121
value: null,
112-
withDefaultValue: true,
122+
withDefaultValue: false,
113123
};
114124

115125
DatePicker.propTypes = {
116126
className: PropTypes.string,
127+
disabled: PropTypes.bool,
117128
displayFormat: PropTypes.string,
118129
id: PropTypes.string,
119130
name: PropTypes.string.isRequired,

packages/buffetjs-core/src/components/Enumeration/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,14 @@ Enumeration.propTypes = {
4747
options: PropTypes.arrayOf(
4848
PropTypes.shape({
4949
label: PropTypes.string,
50-
value: PropTypes.string,
50+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
5151
})
5252
),
53-
value: PropTypes.string,
53+
value: PropTypes.oneOfType([
54+
PropTypes.string,
55+
PropTypes.bool,
56+
PropTypes.object,
57+
]),
5458
};
5559

5660
export default Enumeration;

packages/buffetjs-core/src/components/Error/index.js

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
*/
66

7-
import { useEffect, useReducer } from 'react';
7+
import React, { useEffect, useReducer, useRef } from 'react';
88
import PropTypes from 'prop-types';
99
import { isEmpty } from 'lodash';
1010

@@ -24,25 +24,33 @@ function Error({
2424
canCheck: !isEmpty(value),
2525
});
2626

27+
const ref = useRef();
28+
2729
useEffect(() => {
28-
if (!isEmpty(inputError)) {
29-
dispatch({
30-
type: 'SET_ERROR',
31-
error: inputError,
32-
});
33-
}
30+
dispatch({
31+
type: 'SET_ERROR',
32+
error: inputError,
33+
});
3434
}, [inputError]);
3535

3636
const { error, canCheck } = state;
3737

3838
const resetError = () => {
39+
if (!ref.current) {
40+
return;
41+
}
42+
3943
dispatch({
4044
type: 'SET_ERROR',
4145
error: null,
4246
});
4347
};
4448

4549
const setError = message => {
50+
if (!ref.current) {
51+
return;
52+
}
53+
4654
dispatch({
4755
type: 'SET_ERROR',
4856
error: message,
@@ -64,12 +72,17 @@ function Error({
6472
};
6573

6674
if (children) {
67-
return children({
68-
canCheck,
69-
dispatch,
70-
error,
71-
onBlur: handleBlur,
72-
});
75+
return (
76+
<>
77+
{children({
78+
canCheck,
79+
dispatch,
80+
error,
81+
onBlur: handleBlur,
82+
})}
83+
<span style={{ display: 'none' }} ref={ref}></span>
84+
</>
85+
);
7386
}
7487
}
7588

packages/buffetjs-core/src/components/HeaderActions/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@ function HeaderActions({ actions }) {
1414
return (
1515
<Wrapper>
1616
{actions.map(action => {
17-
const { title, onClick } = action;
17+
const { disabled, title, onClick } = action;
1818

1919
return (
20-
<Button key={title} onClick={onClick} {...action}>
20+
<Button
21+
key={title}
22+
onClick={onClick}
23+
disabled={disabled || false}
24+
{...action}
25+
>
2126
{title}
2227
</Button>
2328
);
@@ -33,6 +38,7 @@ HeaderActions.defaultProps = {
3338
HeaderActions.propTypes = {
3439
actions: PropTypes.arrayOf(
3540
PropTypes.shape({
41+
disabled: PropTypes.bool,
3642
onClick: PropTypes.func,
3743
title: PropTypes.string,
3844
})

packages/buffetjs-custom/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@buffetjs/custom",
3-
"version": "1.0.6",
3+
"version": "1.1.0",
44
"description": "Buffetjs Custom Components",
55
"main": "dist/index.js",
66
"module": "src/index.js",
@@ -15,9 +15,9 @@
1515
"watch": "babel --config-file ../../.babelrc src --watch --out-dir dist --copy-files --no-comments && rimraf dist/**/**/tests"
1616
},
1717
"dependencies": {
18-
"@buffetjs/core": "1.0.6",
19-
"@buffetjs/styles": "1.0.5",
20-
"@buffetjs/utils": "1.0.5",
18+
"@buffetjs/core": "1.1.0",
19+
"@buffetjs/styles": "1.1.0",
20+
"@buffetjs/utils": "1.1.0",
2121
"moment": "^2.24.0",
2222
"react-moment-proptypes": "^1.7.0"
2323
},

0 commit comments

Comments
 (0)