@pie-lib/config-ui 11.9.25-next.0 → 11.10.0-beta.1

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +13 -115
  2. package/NEXT.CHANGELOG.json +1 -0
  3. package/lib/alert-dialog.js +38 -7
  4. package/lib/alert-dialog.js.map +1 -1
  5. package/lib/checkbox.js +6 -1
  6. package/lib/checkbox.js.map +1 -1
  7. package/lib/choice-configuration/index.js +19 -8
  8. package/lib/choice-configuration/index.js.map +1 -1
  9. package/lib/feedback-config/feedback-selector.js +0 -0
  10. package/lib/inputs.js +8 -2
  11. package/lib/inputs.js.map +1 -1
  12. package/lib/layout/config-layout.js +27 -10
  13. package/lib/layout/config-layout.js.map +1 -1
  14. package/lib/number-text-field-custom.js +134 -43
  15. package/lib/number-text-field-custom.js.map +1 -1
  16. package/lib/number-text-field.js +17 -18
  17. package/lib/number-text-field.js.map +1 -1
  18. package/lib/radio-with-label.js +9 -1
  19. package/lib/radio-with-label.js.map +1 -1
  20. package/lib/settings/index.js +3 -1
  21. package/lib/settings/index.js.map +1 -1
  22. package/lib/settings/panel.js +7 -4
  23. package/lib/settings/panel.js.map +1 -1
  24. package/lib/settings/settings-radio-label.js +9 -1
  25. package/lib/settings/settings-radio-label.js.map +1 -1
  26. package/lib/settings/toggle.js +18 -0
  27. package/lib/settings/toggle.js.map +1 -1
  28. package/package.json +8 -5
  29. package/src/__tests__/__snapshots__/langs.test.jsx.snap +32 -0
  30. package/src/__tests__/__snapshots__/settings-panel.test.js.snap +115 -0
  31. package/src/__tests__/__snapshots__/two-choice.test.js.snap +171 -0
  32. package/src/__tests__/choice-utils.test.js +12 -0
  33. package/src/__tests__/langs.test.jsx +37 -0
  34. package/src/__tests__/number-text-field.test.jsx +148 -0
  35. package/src/__tests__/settings-panel.test.js +204 -0
  36. package/src/__tests__/two-choice.test.js +24 -0
  37. package/src/alert-dialog.jsx +27 -7
  38. package/src/checkbox.jsx +8 -1
  39. package/src/choice-configuration/__tests__/__snapshots__/feedback-menu.test.jsx.snap +51 -0
  40. package/src/choice-configuration/__tests__/__snapshots__/index.test.jsx.snap +519 -0
  41. package/src/choice-configuration/__tests__/feedback-menu.test.jsx +10 -0
  42. package/src/choice-configuration/__tests__/index.test.jsx +92 -0
  43. package/src/choice-configuration/index.jsx +14 -3
  44. package/src/feedback-config/__tests__/__snapshots__/feedback-config.test.jsx.snap +27 -0
  45. package/src/feedback-config/__tests__/__snapshots__/feedback-selector.test.jsx.snap +38 -0
  46. package/src/feedback-config/__tests__/feedback-config.test.jsx +71 -0
  47. package/src/feedback-config/__tests__/feedback-selector.test.jsx +60 -0
  48. package/src/feedback-config/feedback-selector.jsx +0 -0
  49. package/src/inputs.jsx +9 -2
  50. package/src/layout/__tests__/__snapshots__/config.layout.test.jsx.snap +59 -0
  51. package/src/layout/__tests__/config.layout.test.jsx +42 -0
  52. package/src/layout/__tests__/layout-content.test.jsx +3 -0
  53. package/src/layout/config-layout.jsx +16 -8
  54. package/src/number-text-field-custom.jsx +86 -28
  55. package/src/number-text-field.jsx +6 -5
  56. package/src/radio-with-label.jsx +6 -2
  57. package/src/settings/index.js +2 -1
  58. package/src/settings/panel.jsx +5 -2
  59. package/src/settings/settings-radio-label.jsx +6 -2
  60. package/src/settings/toggle.jsx +20 -2
  61. package/src/tags-input/__tests__/__snapshots__/index.test.jsx.snap +170 -0
  62. package/src/tags-input/__tests__/index.test.jsx +62 -0
  63. package/README.md +0 -12
@@ -0,0 +1,171 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`NChoice renders n choice radio buttons vertical correctly 1`] = `
4
+ <div
5
+ className="MuiFormControl-root-5 RawInputContainer-formControl-3"
6
+ >
7
+ <label
8
+ className="MuiFormLabel-root-20 MuiInputLabel-root-9 MuiInputLabel-formControl-14 MuiInputLabel-animated-17 MuiInputLabel-shrink-16 RawInputContainer-label-4"
9
+ data-shrink={true}
10
+ >
11
+ n-choice-vertical
12
+ </label>
13
+ <div
14
+ className="RawNChoice-group-1 RawNChoice-vertical-2"
15
+ >
16
+ <label
17
+ className="MuiFormControlLabel-root-29"
18
+ >
19
+ <span
20
+ className="MuiButtonBase-root-50 MuiIconButton-root-44 MuiPrivateSwitchBase-root-40 MuiRadio-root-35 MuiRadio-colorSecondary-39 MuiPrivateSwitchBase-checked-41 MuiRadio-checked-36 Component-customColor-28"
21
+ onBlur={[Function]}
22
+ onContextMenu={[Function]}
23
+ onFocus={[Function]}
24
+ onKeyDown={[Function]}
25
+ onKeyUp={[Function]}
26
+ onMouseDown={[Function]}
27
+ onMouseLeave={[Function]}
28
+ onMouseUp={[Function]}
29
+ onTouchEnd={[Function]}
30
+ onTouchMove={[Function]}
31
+ onTouchStart={[Function]}
32
+ tabIndex={null}
33
+ >
34
+ <span
35
+ className="MuiIconButton-label-49"
36
+ >
37
+ <svg
38
+ aria-hidden="true"
39
+ className="MuiSvgIcon-root-53"
40
+ focusable="false"
41
+ role="presentation"
42
+ viewBox="0 0 24 24"
43
+ >
44
+ <path
45
+ d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
46
+ />
47
+ </svg>
48
+ <input
49
+ checked={true}
50
+ className="MuiPrivateSwitchBase-input-43"
51
+ disabled={false}
52
+ onChange={[Function]}
53
+ type="radio"
54
+ value="left"
55
+ />
56
+ </span>
57
+ <span
58
+ className="MuiTouchRipple-root-98"
59
+ />
60
+ </span>
61
+ <span
62
+ className="MuiTypography-root-62 MuiTypography-body1-71 MuiFormControlLabel-label-34 Component-label-27"
63
+ >
64
+ left
65
+ </span>
66
+ </label>
67
+ <label
68
+ className="MuiFormControlLabel-root-29"
69
+ >
70
+ <span
71
+ className="MuiButtonBase-root-50 MuiIconButton-root-44 MuiPrivateSwitchBase-root-40 MuiRadio-root-35 MuiRadio-colorSecondary-39 Component-customColor-28"
72
+ onBlur={[Function]}
73
+ onContextMenu={[Function]}
74
+ onFocus={[Function]}
75
+ onKeyDown={[Function]}
76
+ onKeyUp={[Function]}
77
+ onMouseDown={[Function]}
78
+ onMouseLeave={[Function]}
79
+ onMouseUp={[Function]}
80
+ onTouchEnd={[Function]}
81
+ onTouchMove={[Function]}
82
+ onTouchStart={[Function]}
83
+ tabIndex={null}
84
+ >
85
+ <span
86
+ className="MuiIconButton-label-49"
87
+ >
88
+ <svg
89
+ aria-hidden="true"
90
+ className="MuiSvgIcon-root-53"
91
+ focusable="false"
92
+ role="presentation"
93
+ viewBox="0 0 24 24"
94
+ >
95
+ <path
96
+ d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
97
+ />
98
+ </svg>
99
+ <input
100
+ checked={false}
101
+ className="MuiPrivateSwitchBase-input-43"
102
+ disabled={false}
103
+ onChange={[Function]}
104
+ type="radio"
105
+ value="center"
106
+ />
107
+ </span>
108
+ <span
109
+ className="MuiTouchRipple-root-98"
110
+ />
111
+ </span>
112
+ <span
113
+ className="MuiTypography-root-62 MuiTypography-body1-71 MuiFormControlLabel-label-34 Component-label-27"
114
+ >
115
+ center
116
+ </span>
117
+ </label>
118
+ <label
119
+ className="MuiFormControlLabel-root-29"
120
+ >
121
+ <span
122
+ className="MuiButtonBase-root-50 MuiIconButton-root-44 MuiPrivateSwitchBase-root-40 MuiRadio-root-35 MuiRadio-colorSecondary-39 Component-customColor-28"
123
+ onBlur={[Function]}
124
+ onContextMenu={[Function]}
125
+ onFocus={[Function]}
126
+ onKeyDown={[Function]}
127
+ onKeyUp={[Function]}
128
+ onMouseDown={[Function]}
129
+ onMouseLeave={[Function]}
130
+ onMouseUp={[Function]}
131
+ onTouchEnd={[Function]}
132
+ onTouchMove={[Function]}
133
+ onTouchStart={[Function]}
134
+ tabIndex={null}
135
+ >
136
+ <span
137
+ className="MuiIconButton-label-49"
138
+ >
139
+ <svg
140
+ aria-hidden="true"
141
+ className="MuiSvgIcon-root-53"
142
+ focusable="false"
143
+ role="presentation"
144
+ viewBox="0 0 24 24"
145
+ >
146
+ <path
147
+ d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
148
+ />
149
+ </svg>
150
+ <input
151
+ checked={false}
152
+ className="MuiPrivateSwitchBase-input-43"
153
+ disabled={false}
154
+ onChange={[Function]}
155
+ type="radio"
156
+ value="right"
157
+ />
158
+ </span>
159
+ <span
160
+ className="MuiTouchRipple-root-98"
161
+ />
162
+ </span>
163
+ <span
164
+ className="MuiTypography-root-62 MuiTypography-body1-71 MuiFormControlLabel-label-34 Component-label-27"
165
+ >
166
+ right
167
+ </span>
168
+ </label>
169
+ </div>
170
+ </div>
171
+ `;
@@ -0,0 +1,12 @@
1
+ import { firstAvailableIndex } from '../choice-utils';
2
+
3
+ describe('firstAvailableIndex', () => {
4
+ const assert = (values, index, expected) => {
5
+ it(`[${values.join(',')}], ${index} ==> ${expected}`, () => {
6
+ expect(firstAvailableIndex(['0'], 0)).toEqual('1');
7
+ });
8
+ };
9
+ assert(['0'], 0, '1');
10
+ assert(['0', '1', '2'], 0, '3');
11
+ assert(['0', '1', '2'], 100, '100');
12
+ });
@@ -0,0 +1,37 @@
1
+ import { shallow } from 'enzyme';
2
+ import React from 'react';
3
+ import { RawLangs } from '../langs';
4
+
5
+ describe('langs', () => {
6
+ let onChange;
7
+ const wrapper = (extras) => {
8
+ const defaults = {
9
+ uid: '1',
10
+ onChange,
11
+ classes: {},
12
+ langs: ['en-US', 'es-ES'],
13
+ };
14
+ const props = { ...defaults, ...extras };
15
+ return shallow(<RawLangs {...props} />);
16
+ };
17
+
18
+ beforeEach(() => {
19
+ onChange = jest.fn();
20
+ });
21
+
22
+ describe('snapshot', () => {
23
+ it('renders', () => {
24
+ expect(wrapper()).toMatchSnapshot();
25
+ });
26
+ });
27
+
28
+ describe('logic', () => {
29
+ describe('choose', () => {
30
+ it('calls onChange', () => {
31
+ const w = wrapper();
32
+ w.instance().choose({ target: { value: 'en-US' } });
33
+ expect(onChange).toBeCalledWith('en-US');
34
+ });
35
+ });
36
+ });
37
+ });
@@ -0,0 +1,148 @@
1
+ import React from 'react';
2
+ import { shallow } from 'enzyme';
3
+ import { NumberTextField } from '../number-text-field';
4
+ import TextField from '@material-ui/core/TextField';
5
+
6
+ describe('NumberTextField', () => {
7
+ describe('render', () => {
8
+ let value = 1;
9
+ let onChange, component, textField, onBlur;
10
+ let min = 1;
11
+ let max = 10;
12
+
13
+ describe('TextField', () => {
14
+ beforeEach(() => {
15
+ onChange = jest.fn();
16
+ onBlur = jest.fn();
17
+ component = shallow(
18
+ <NumberTextField value={value} min={min} max={max} classes={{}} onChange={onChange} onBlur={onBlur} />,
19
+ );
20
+ textField = component.find(TextField);
21
+ });
22
+
23
+ it('should render mui TextField', () => {
24
+ expect(textField.length).toEqual(1);
25
+ });
26
+
27
+ describe('props', () => {
28
+ let props;
29
+
30
+ beforeEach(() => {
31
+ props = textField.props();
32
+ });
33
+
34
+ it('should contain value', () => {
35
+ expect(props.value).toEqual(value);
36
+ });
37
+ });
38
+
39
+ describe('logic', () => {
40
+ describe('clamp', () => {
41
+ const assertClamp = (input, expected) => {
42
+ it(`${input} => ${expected}`, () => {
43
+ const result = component.instance().clamp(input);
44
+ expect(result).toEqual(expected);
45
+ });
46
+ };
47
+
48
+ assertClamp('foo', 1);
49
+ assertClamp(1, 1);
50
+ assertClamp(2, 2);
51
+ assertClamp(0, 1);
52
+ assertClamp(-1, 1);
53
+ assertClamp(10, 10);
54
+ assertClamp(11, 10);
55
+ });
56
+
57
+ describe('onBlur', () => {
58
+ const event = (value) => ({
59
+ target: { value },
60
+ });
61
+
62
+ describe('called with valid string representation of int', () => {
63
+ it('should be called with parsed int', () => {
64
+ const e = event('1');
65
+
66
+ textField.simulate('change', e);
67
+
68
+ expect(component.state('value')).toEqual('1');
69
+
70
+ e.target.value = '100';
71
+
72
+ textField.simulate('change', e);
73
+
74
+ expect(component.state('value')).toEqual('100');
75
+
76
+ const beforeMax = (max - 1).toString();
77
+ e.target.value = beforeMax;
78
+
79
+ textField.simulate('blur', e);
80
+
81
+ expect(component.state('value')).toEqual(beforeMax);
82
+ });
83
+ });
84
+
85
+ describe('called with invalid string representation of int', () => {
86
+ it('should be called with min value', () => {
87
+ const e = event('aa');
88
+
89
+ textField.simulate('change', e);
90
+
91
+ expect(component.state('value')).toEqual('aa');
92
+
93
+ textField.simulate('blur', e);
94
+
95
+ expect(component.state('value')).toEqual(min.toString());
96
+ });
97
+ });
98
+
99
+ describe('called with empty string', () => {
100
+ it('should be called with min value', () => {
101
+ const e = event('');
102
+
103
+ textField.simulate('change', e);
104
+
105
+ expect(component.state('value')).toEqual('');
106
+
107
+ textField.simulate('blur', e);
108
+
109
+ expect(component.state('value')).toEqual(min.toString());
110
+ });
111
+ });
112
+
113
+ describe('string int less than min', () => {
114
+ const value = (min - 1).toString();
115
+
116
+ it('should be called with value of min', () => {
117
+ const e = event(value);
118
+
119
+ textField.simulate('change', e);
120
+
121
+ expect(component.state('value')).toEqual(value);
122
+
123
+ textField.simulate('blur', e);
124
+
125
+ expect(component.state('value')).toEqual(min.toString());
126
+ });
127
+ });
128
+
129
+ describe('string int exceeds max', () => {
130
+ const value = (max + 1).toString();
131
+
132
+ it('should be called with value of max', () => {
133
+ const e = event(value);
134
+
135
+ textField.simulate('change', e);
136
+
137
+ expect(component.state('value')).toEqual(value);
138
+
139
+ textField.simulate('blur', e);
140
+
141
+ expect(component.state('value')).toEqual(max.toString());
142
+ });
143
+ });
144
+ });
145
+ });
146
+ });
147
+ });
148
+ });
@@ -0,0 +1,204 @@
1
+ import React from 'react';
2
+ import { shallow } from 'enzyme';
3
+ import { Panel } from '../settings/panel';
4
+ import { toggle, radio, dropdown, numberField, numberFields } from '../settings';
5
+
6
+ describe('Settings Panel', () => {
7
+ let w;
8
+ let onChange = jest.fn();
9
+ let configure = {
10
+ orientationLabel: 'Orientation',
11
+
12
+ settingsOrientation: true,
13
+ editChoiceLabel: false,
14
+ };
15
+ let model = {
16
+ choiceAreaLayout: 'vertical',
17
+ };
18
+
19
+ let groups = ({ configure }) => ({
20
+ 'Group 1': {
21
+ choiceAreaLayout: configure.settingsOrientation && {
22
+ type: 'radio',
23
+ label: configure.orientationLabel,
24
+ choices: [
25
+ { label: 'opt1', value: 'opt1' },
26
+ { label: 'opt2', value: 'opt2' },
27
+ ],
28
+ equationEditor: dropdown('Dropdown', ['geometry', 'advanced-algebra', 'statistics', 'miscellaneous']),
29
+ graph: numberFields('Graph Display Size', {
30
+ domain: {
31
+ label: 'Domain',
32
+ suffix: 'px',
33
+ },
34
+ range: {
35
+ label: 'Range',
36
+ suffix: 'px',
37
+ },
38
+ width: {
39
+ label: 'Width',
40
+ suffix: 'px',
41
+ min: 50,
42
+ max: 250,
43
+ },
44
+ }),
45
+ },
46
+ editChoiceLabel: { type: 'toggle', label: 'Edit choice label', isConfigProperty: true },
47
+ },
48
+ });
49
+
50
+ const wrapper = (extras) => {
51
+ return shallow(
52
+ <Panel
53
+ model={model}
54
+ configuration={configure}
55
+ onChangeModel={onChange}
56
+ onChangeConfiguration={onChange}
57
+ groups={groups({ configure })}
58
+ {...extras}
59
+ />,
60
+ );
61
+ };
62
+
63
+ describe('snapshot', () => {
64
+ it('renders', () => {
65
+ w = wrapper();
66
+
67
+ expect(w).toMatchSnapshot();
68
+ });
69
+
70
+ it('does not render radio buttons', () => {
71
+ w = wrapper({
72
+ groups: groups({
73
+ configure: {
74
+ ...configure,
75
+ settingsOrientation: false,
76
+ },
77
+ }),
78
+ });
79
+
80
+ expect(w).toMatchSnapshot();
81
+ });
82
+ });
83
+
84
+ describe('logic', () => {
85
+ describe('onChange gets called', () => {
86
+ it('updates model props', () => {
87
+ w.instance().change('test', false);
88
+
89
+ expect(onChange).toBeCalledWith(
90
+ {
91
+ ...model,
92
+ test: false,
93
+ },
94
+ 'test',
95
+ );
96
+ });
97
+
98
+ it('updates configuration props', () => {
99
+ w.instance().change('test.test', true, true);
100
+
101
+ expect(onChange).toBeCalledWith(
102
+ {
103
+ ...configure,
104
+ test: {
105
+ test: true,
106
+ },
107
+ },
108
+ 'test.test',
109
+ );
110
+ });
111
+ });
112
+ });
113
+ });
114
+
115
+ describe('toggle', () => {
116
+ it('returns a toggle type object', () => {
117
+ const setting = toggle('Label');
118
+
119
+ expect(setting).toEqual({
120
+ label: 'Label',
121
+ type: 'toggle',
122
+ isConfigProperty: false,
123
+ disabled: false,
124
+ });
125
+ });
126
+ });
127
+
128
+ describe('radio', () => {
129
+ it('returns a radio type object', () => {
130
+ const setting = radio('Radio', ['one', 'two']);
131
+
132
+ expect(setting).toEqual({
133
+ label: 'Radio',
134
+ type: 'radio',
135
+ isConfigProperty: false,
136
+ choices: [
137
+ {
138
+ label: 'one',
139
+ value: 'one',
140
+ },
141
+ {
142
+ label: 'two',
143
+ value: 'two',
144
+ },
145
+ ],
146
+ });
147
+ });
148
+ });
149
+
150
+ describe('dropdown', () => {
151
+ it('returns a dropdown type object', () => {
152
+ const setting = dropdown('Dropdown', ['one', 'two']);
153
+
154
+ expect(setting).toEqual({
155
+ label: 'Dropdown',
156
+ type: 'dropdown',
157
+ isConfigProperty: false,
158
+ choices: ['one', 'two'],
159
+ });
160
+ });
161
+ });
162
+
163
+ describe('numberField', () => {
164
+ it('returns a numberField type object', () => {
165
+ const setting = numberField('Number Field', { max: 12 }, true);
166
+
167
+ expect(setting).toEqual({
168
+ label: 'Number Field',
169
+ type: 'numberField',
170
+ isConfigProperty: true,
171
+ max: 12,
172
+ });
173
+ });
174
+ });
175
+
176
+ describe('numberFields', () => {
177
+ it('returns a numberFields type object', () => {
178
+ const setting = numberFields('Number Fields', {
179
+ one: {
180
+ label: 'One',
181
+ },
182
+ two: {
183
+ label: 'Two',
184
+ },
185
+ });
186
+
187
+ expect(setting).toEqual({
188
+ label: 'Number Fields',
189
+ type: 'numberFields',
190
+ fields: {
191
+ one: {
192
+ type: 'numberField',
193
+ label: 'One',
194
+ isConfigProperty: false,
195
+ },
196
+ two: {
197
+ type: 'numberField',
198
+ label: 'Two',
199
+ isConfigProperty: false,
200
+ },
201
+ },
202
+ });
203
+ });
204
+ });
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import renderer from 'react-test-renderer';
3
+ import { NChoice } from '../two-choice';
4
+
5
+ describe('NChoice', () => {
6
+ it('renders n choice radio buttons vertical correctly', () => {
7
+ const tree = renderer
8
+ .create(
9
+ <NChoice
10
+ direction="vertical"
11
+ header="n-choice-vertical"
12
+ value={'left'}
13
+ onChange={jest.fn()}
14
+ opts={[
15
+ { label: 'left', value: 'left' },
16
+ { label: 'center', value: 'center' },
17
+ { label: 'right', value: 'right' },
18
+ ]}
19
+ />,
20
+ )
21
+ .toJSON();
22
+ expect(tree).toMatchSnapshot();
23
+ });
24
+ });
@@ -1,36 +1,56 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@material-ui/core';
4
+ import { withStyles } from '@material-ui/core/styles';
4
5
 
5
- const AlertDialog = ({ text, title, onClose, onConfirm, open }) => (
6
+ const AlertDialog = ({ text, title, onClose, onConfirm, open, onCloseText, onConfirmText, classes }) => (
6
7
  <Dialog open={open} onClose={onClose}>
7
- {title && <DialogTitle>{title}</DialogTitle>}
8
+ {title && <DialogTitle className={classes.heading}>{title}</DialogTitle>}
8
9
  {text && (
9
10
  <DialogContent>
10
- <DialogContentText>{text}</DialogContentText>
11
+ <DialogContentText className={classes.subheading}>{text}</DialogContentText>
11
12
  </DialogContent>
12
13
  )}
13
14
  <DialogActions>
14
15
  {onClose && (
15
16
  <Button onClick={onClose} color="primary">
16
- CANCEL
17
+ {onCloseText}
17
18
  </Button>
18
19
  )}
19
20
  {onConfirm && (
20
21
  <Button autoFocus onClick={onConfirm} color="primary">
21
- OK
22
+ {onConfirmText}
22
23
  </Button>
23
24
  )}
24
25
  </DialogActions>
25
26
  </Dialog>
26
27
  );
27
28
 
29
+ AlertDialog.defaultProps = {
30
+ onCloseText: 'CANCEL',
31
+ onConfirmText: 'OK',
32
+ };
33
+
28
34
  AlertDialog.propTypes = {
29
- text: PropTypes.string,
35
+ text: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
30
36
  title: PropTypes.string,
31
37
  onClose: PropTypes.func,
32
38
  onConfirm: PropTypes.func,
33
39
  open: PropTypes.bool,
40
+ onConfirmText: PropTypes.string,
41
+ onCloseText: PropTypes.string,
42
+ classes: PropTypes.object,
34
43
  };
35
44
 
36
- export default AlertDialog;
45
+ const styles = () => ({
46
+ heading: {
47
+ '& h2': {
48
+ fontSize: 'max(1.25rem, 18px)',
49
+ },
50
+ },
51
+ subheading: {
52
+ fontSize: 'max(1rem, 14px)',
53
+ },
54
+ });
55
+
56
+ export default withStyles(styles)(AlertDialog);
package/src/checkbox.jsx CHANGED
@@ -5,6 +5,7 @@ import React from 'react';
5
5
  import { withStyles } from '@material-ui/core/styles';
6
6
  import classNames from 'classnames';
7
7
  import grey from '@material-ui/core/colors/grey';
8
+ import { color } from '@pie-lib/render-ui';
8
9
 
9
10
  const Checkbox = ({ mini, checked, onChange, value, label, classes, error }) => (
10
11
  <FormControlLabel
@@ -17,7 +18,10 @@ const Checkbox = ({ mini, checked, onChange, value, label, classes, error }) =>
17
18
  checked={checked}
18
19
  onChange={onChange}
19
20
  value={value}
20
- className={classNames({ [classes.miniCheckbox]: mini, [classes.error]: error })}
21
+ className={classNames(classes.customColor, {
22
+ [classes.miniCheckbox]: mini,
23
+ [classes.error]: error,
24
+ })}
21
25
  />
22
26
  }
23
27
  label={label}
@@ -63,4 +67,7 @@ export default withStyles((theme) => ({
63
67
  error: {
64
68
  color: theme.palette.error.main,
65
69
  },
70
+ customColor: {
71
+ color: `${color.tertiary()} !important`,
72
+ },
66
73
  }))(Checkbox);