Skip to content

Commit ce0a37b

Browse files
authored
Merge pull request mondaycom#20 from mondaycom/fix/orr/consistant-import-naming
Fix/orr/consistant import naming
2 parents a52d7ba + 8215bf6 commit ce0a37b

File tree

9 files changed

+69
-65
lines changed

9 files changed

+69
-65
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "monday-ui-react-core",
3-
"version": "0.0.16",
3+
"version": "0.0.17",
44
"description": "Official monday.com UI resources for application development in React.js",
55
"main": "dist/main.js",
66
"scripts": {

src/components/Search/Search.jsx

+9-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from "react";
22
import PropTypes from "prop-types";
33
import classNames from "classnames";
44
import "./Search.scss";
5-
import InputField from "../TextField/InputField";
5+
import TextField from "../TextField/TextField";
66
import { SIZES, TYPES } from "./SearchConstats";
77

88
const NOOP = () => {};
@@ -16,12 +16,13 @@ const TYPE_CLASSES = {
1616
function getType(type) {
1717
return TYPE_CLASSES[type] || "";
1818
}
19+
1920
const ICON_NAMES = {
2021
primary: "Search",
2122
secondary: "Clear Search"
2223
};
2324

24-
export const SearchComponent = ({
25+
const Search = ({
2526
secondaryIconName,
2627
iconName,
2728
onChange,
@@ -45,7 +46,7 @@ export const SearchComponent = ({
4546
iconNames
4647
}) => {
4748
return (
48-
<InputField
49+
<TextField
4950
id={id}
5051
iconName={iconName}
5152
value={value}
@@ -75,10 +76,10 @@ export const SearchComponent = ({
7576
);
7677
};
7778

78-
SearchComponent.sizes = SIZES;
79-
SearchComponent.types = TYPES;
79+
Search.sizes = SIZES;
80+
Search.types = TYPES;
8081

81-
SearchComponent.propTypes = {
82+
Search.propTypes = {
8283
secondaryIconName: PropTypes.string,
8384
iconName: PropTypes.string,
8485
onChange: PropTypes.func,
@@ -112,7 +113,7 @@ SearchComponent.propTypes = {
112113
})
113114
};
114115

115-
SearchComponent.defaultProps = {
116+
Search.defaultProps = {
116117
secondaryIconName: "icon-dapulse-close",
117118
iconName: "icon-v2-search",
118119
onChange: NOOP,
@@ -136,4 +137,4 @@ SearchComponent.defaultProps = {
136137
iconNames: ICON_NAMES
137138
};
138139

139-
export default SearchComponent;
140+
export default Search;

src/components/Search/__stories__/search.stories.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React from "react";
22
import { action } from "@storybook/addon-actions";
33
import { text, boolean, number, select } from "@storybook/addon-knobs";
4-
import Search from "../Search";
54
import SearchStoryLine from "./SearchStoryLine";
5+
66
import { FlexLayout } from "../../storybook-helpers";
7+
import Search from "../Search";
78

89
export const Sandbox = () => {
910
return (

src/components/TextField/InputField-test.js renamed to src/components/TextField/TextField-test.js

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from "react";
22
import { sinon, expect } from "../../test/test-helpers";
3-
import InputField, { ARIA_LABELS } from "./InputField";
3+
import TextField, { ARIA_LABELS } from "./TextField";
44
import {
55
render,
66
fireEvent,
@@ -9,7 +9,7 @@ import {
99
act
1010
} from "@testing-library/react";
1111

12-
describe("InputField Tests", () => {
12+
describe("TextField Tests", () => {
1313
let inputComponent;
1414
let onChangeStub;
1515
let defaultPlaceHolder = "Place Holder Text";
@@ -20,7 +20,7 @@ describe("InputField Tests", () => {
2020
clock = sinon.useFakeTimers();
2121
act(() => {
2222
inputComponent = render(
23-
<InputField
23+
<TextField
2424
placeholder={defaultPlaceHolder}
2525
onChange={onChangeStub}
2626
id="test"
@@ -60,7 +60,7 @@ describe("InputField Tests", () => {
6060
const { rerender } = inputComponent;
6161
act(() => {
6262
inputComponent = rerender(
63-
<InputField
63+
<TextField
6464
placeholder={defaultPlaceHolder}
6565
onChange={onChangeStub}
6666
id="test"
@@ -83,7 +83,7 @@ describe("InputField Tests", () => {
8383
const debounceTime = 200;
8484
act(() => {
8585
inputComponent = rerender(
86-
<InputField
86+
<TextField
8787
placeholder={defaultPlaceHolder}
8888
onChange={onChangeStub}
8989
id="test"
@@ -105,7 +105,7 @@ describe("InputField Tests", () => {
105105
const { rerender } = inputComponent;
106106
act(() => {
107107
inputComponent = rerender(
108-
<InputField
108+
<TextField
109109
placeholder={defaultPlaceHolder}
110110
onChange={onChangeStub}
111111
id="test"
@@ -122,7 +122,7 @@ describe("InputField Tests", () => {
122122
const title = "Title";
123123
act(() => {
124124
rerender(
125-
<InputField
125+
<TextField
126126
placeholder={defaultPlaceHolder}
127127
onChange={onChangeStub}
128128
id="test"
@@ -140,7 +140,7 @@ describe("InputField Tests", () => {
140140
const title = "My Awesome Title";
141141
act(() => {
142142
rerender(
143-
<InputField
143+
<TextField
144144
placeholder={defaultPlaceHolder}
145145
onChange={onChangeStub}
146146
id="test"
@@ -157,7 +157,7 @@ describe("InputField Tests", () => {
157157
const { rerender, queryByLabelText } = inputComponent;
158158
act(() => {
159159
rerender(
160-
<InputField
160+
<TextField
161161
placeholder={defaultPlaceHolder}
162162
onChange={onChangeStub}
163163
id="test"
@@ -175,7 +175,7 @@ describe("InputField Tests", () => {
175175
const { rerender, queryByLabelText } = inputComponent;
176176
act(() => {
177177
rerender(
178-
<InputField
178+
<TextField
179179
placeholder={defaultPlaceHolder}
180180
onChange={onChangeStub}
181181
id="test"
@@ -193,7 +193,7 @@ describe("InputField Tests", () => {
193193
const value = "hello";
194194
act(() => {
195195
rerender(
196-
<InputField
196+
<TextField
197197
placeholder={defaultPlaceHolder}
198198
onChange={onChangeStub}
199199
id="char-count-test"
@@ -212,7 +212,7 @@ describe("InputField Tests", () => {
212212
let value = "hello";
213213
act(() => {
214214
rerender(
215-
<InputField
215+
<TextField
216216
placeholder={defaultPlaceHolder}
217217
onChange={onChangeStub}
218218
id="char-count-test"
@@ -244,29 +244,29 @@ describe("InputField Tests", () => {
244244
describe("types", () => {
245245
it("default type should be text", () => {
246246
const input = screen.getByPlaceholderText(defaultPlaceHolder);
247-
expect(input.type).to.equal(InputField.types.TEXT);
247+
expect(input.type).to.equal(TextField.types.TEXT);
248248
});
249249

250250
it("type should be password", () => {
251251
const { rerender } = inputComponent;
252252
act(() => {
253253
inputComponent = rerender(
254-
<InputField
254+
<TextField
255255
placeholder={defaultPlaceHolder}
256256
onChange={onChangeStub}
257257
id="test"
258-
type={InputField.types.PASSWORD}
258+
type={TextField.types.PASSWORD}
259259
/>
260260
);
261261
});
262262
const input = screen.getByPlaceholderText(defaultPlaceHolder);
263-
expect(input.type).to.equal(InputField.types.PASSWORD);
263+
expect(input.type).to.equal(TextField.types.PASSWORD);
264264
});
265265
});
266266
describe("autocomplete", () => {
267267
it("should add autocomplete attr and set it to on", () => {
268268
const { container } = render(
269-
<InputField
269+
<TextField
270270
placeholder={defaultPlaceHolder}
271271
onChange={onChangeStub}
272272
id="test"
@@ -279,7 +279,7 @@ describe("InputField Tests", () => {
279279

280280
it("should add autocomplete attr and set it to off", () => {
281281
const { container } = render(
282-
<InputField
282+
<TextField
283283
placeholder={defaultPlaceHolder}
284284
onChange={onChangeStub}
285285
id="test"
@@ -295,7 +295,7 @@ describe("InputField Tests", () => {
295295
const { rerender } = inputComponent;
296296
act(() => {
297297
inputComponent = rerender(
298-
<InputField
298+
<TextField
299299
placeholder={defaultPlaceHolder}
300300
onChange={onChangeStub}
301301
id="test"

src/components/TextField/InputField.jsx renamed to src/components/TextField/TextField.jsx

+14-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { useRef, useEffect, useMemo, useCallback } from "react";
33
import PropTypes from "prop-types";
44
import classNames from "classnames";
55
import useDebounceEvent from "../../hooks/useDebounceEvent";
6-
import "./InputField.scss";
6+
import "./TextField.scss";
77
import Icon from "../Icon/Icon";
88
import {
99
FEEDBACK_CLASSES,
@@ -16,7 +16,7 @@ import { TEXT_FIELD_SIZE, TEXT_TYPES } from "./TextFieldConstants";
1616
const NOOP = () => {};
1717

1818
const EMPTY_OBJECT = { primary: "", secondary: "", label: "" };
19-
const InputField = ({
19+
const TextField = ({
2020
className,
2121
placeholder,
2222
autoComplete,
@@ -203,7 +203,7 @@ const InputField = ({
203203
);
204204
};
205205

206-
InputField.propTypes = {
206+
TextField.propTypes = {
207207
className: PropTypes.string,
208208
placeholder: PropTypes.string,
209209
/* See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete for all of the available options */
@@ -245,12 +245,16 @@ InputField.propTypes = {
245245
secondary: PropTypes.string
246246
}),
247247
/* TEXT_TYPES is exposed on the component itself */
248-
type: PropTypes.oneOf([TEXT_TYPES.TEXT, TEXT_TYPES.PASSWORD, TEXT_TYPES.SEARCH]),
248+
type: PropTypes.oneOf([
249+
TEXT_TYPES.TEXT,
250+
TEXT_TYPES.PASSWORD,
251+
TEXT_TYPES.SEARCH
252+
]),
249253
maxLength: PropTypes.number,
250254
trim: PropTypes.bool
251255
};
252256

253-
InputField.defaultProps = {
257+
TextField.defaultProps = {
254258
className: "",
255259
placeholder: "",
256260
autoComplete: "off",
@@ -287,7 +291,8 @@ export const ARIA_LABELS = {
287291
VALIDATION_TEXT: "Additional helper text"
288292
};
289293

290-
InputField.sizes = TEXT_FIELD_SIZE;
291-
InputField.feedbacks = FEEDBACK_STATES;
292-
InputField.types = TEXT_TYPES;
293-
export default InputField;
294+
TextField.sizes = TEXT_FIELD_SIZE;
295+
TextField.feedbacks = FEEDBACK_STATES;
296+
TextField.types = TEXT_TYPES;
297+
298+
export default TextField;

0 commit comments

Comments
 (0)