pebble-web 2.5.0 → 2.5.2
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/components/styles/Date.styles.d.ts +1 -0
- package/dist/components/typings/DateInput.d.ts +1 -0
- package/dist/pebble-web.dev.js +95 -84
- package/dist/pebble-web.dev.js.map +1 -1
- package/dist/pebble-web.es.dev.js +17 -8
- package/dist/pebble-web.es.dev.js.map +1 -1
- package/dist/pebble-web.es.js +13 -4
- package/dist/pebble-web.es.js.map +1 -1
- package/dist/pebble-web.js +91 -80
- package/dist/pebble-web.js.map +1 -1
- package/dist/pebble-web.module.dev.js +95 -84
- package/dist/pebble-web.module.dev.js.map +1 -1
- package/dist/pebble-web.module.js +91 -80
- package/dist/pebble-web.module.js.map +1 -1
- package/dist/pebble-web.umd.dev.js +95 -84
- package/dist/pebble-web.umd.dev.js.map +1 -1
- package/dist/pebble-web.umd.js +91 -80
- package/dist/pebble-web.umd.js.map +1 -1
- package/package.json +3 -3
- package/src/components/DateInput.tsx +19 -14
- package/src/components/__tests__/dateInput.test.tsx +6 -5
- package/src/components/styles/Date.styles.ts +10 -0
- package/src/components/typings/DateInput.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pebble-web",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.2",
|
|
4
4
|
"author": "ritz078 <rkritesh078@gmail.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/pebble-web.js",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"utility-types": "^3.10.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"pebble-shared": "^2.4.
|
|
47
|
+
"pebble-shared": "^2.4.2"
|
|
48
48
|
},
|
|
49
49
|
"greenkeeper": {
|
|
50
50
|
"ignore": [
|
|
51
51
|
"rheostat"
|
|
52
52
|
]
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "3fa42621310b7bb74d97296e741d68c124b0c25e"
|
|
55
55
|
}
|
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
dateClass,
|
|
6
6
|
dropDownClassName,
|
|
7
7
|
inputStyle,
|
|
8
|
-
wrapperStyle
|
|
8
|
+
wrapperStyle,
|
|
9
|
+
errorStyle
|
|
9
10
|
} from "./styles/Date.styles";
|
|
10
11
|
import Calendar from "./Calendar";
|
|
11
12
|
import Input from "./Input";
|
|
@@ -83,7 +84,8 @@ export default class DateInput extends React.PureComponent<
|
|
|
83
84
|
inputProps,
|
|
84
85
|
placeholder,
|
|
85
86
|
value: propsValue,
|
|
86
|
-
disabled
|
|
87
|
+
disabled,
|
|
88
|
+
errorMessage
|
|
87
89
|
} = this.props;
|
|
88
90
|
|
|
89
91
|
return (
|
|
@@ -100,7 +102,7 @@ export default class DateInput extends React.PureComponent<
|
|
|
100
102
|
onChange={noop}
|
|
101
103
|
type={"tel"}
|
|
102
104
|
value={value}
|
|
103
|
-
placeholder={
|
|
105
|
+
placeholder={placeholder}
|
|
104
106
|
onClick={() => {
|
|
105
107
|
if (disabled) return;
|
|
106
108
|
toggleDropdown();
|
|
@@ -123,17 +125,20 @@ export default class DateInput extends React.PureComponent<
|
|
|
123
125
|
modifiers={modifiers}
|
|
124
126
|
>
|
|
125
127
|
{({ toggle }) => (
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
128
|
+
<>
|
|
129
|
+
<Calendar
|
|
130
|
+
hideShadow
|
|
131
|
+
className={dateClass}
|
|
132
|
+
selected={propsValue ? new Date(propsValue) : undefined}
|
|
133
|
+
{...calendarProps}
|
|
134
|
+
range={false}
|
|
135
|
+
onChange={date => {
|
|
136
|
+
this.onCalendarDateChange(date);
|
|
137
|
+
toggle();
|
|
138
|
+
}}
|
|
139
|
+
/>
|
|
140
|
+
{errorMessage && <div className={errorStyle}>{errorMessage}</div>}
|
|
141
|
+
</>
|
|
137
142
|
)}
|
|
138
143
|
</DropDown>
|
|
139
144
|
);
|
|
@@ -12,14 +12,15 @@ describe("DateInput", () => {
|
|
|
12
12
|
const changeSpy = sinon.spy();
|
|
13
13
|
|
|
14
14
|
const dateInput = mount(
|
|
15
|
-
<DateInput
|
|
15
|
+
<DateInput
|
|
16
|
+
placeholder="Select Date DD/MM/YYYY"
|
|
17
|
+
onChange={changeSpy}
|
|
18
|
+
value={date}
|
|
19
|
+
/>
|
|
16
20
|
);
|
|
17
21
|
dateInput.find(Input).simulate("click");
|
|
18
22
|
|
|
19
|
-
dateInput
|
|
20
|
-
.find(".react-calendar__tile")
|
|
21
|
-
.at(0)
|
|
22
|
-
.simulate("click");
|
|
23
|
+
dateInput.find(".react-calendar__tile").at(0).simulate("click");
|
|
23
24
|
|
|
24
25
|
expect(changeSpy.calledOnce).toBeTruthy();
|
|
25
26
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { css } from "emotion";
|
|
2
|
+
import { colors } from "pebble-shared";
|
|
3
|
+
import { typography } from "../../theme";
|
|
2
4
|
import { inputMarginBottom } from "./Input.styles";
|
|
3
5
|
|
|
4
6
|
export const dateClass = css({
|
|
@@ -17,3 +19,11 @@ export const inputStyle = css({
|
|
|
17
19
|
export const wrapperStyle = css({
|
|
18
20
|
marginBottom: 20
|
|
19
21
|
});
|
|
22
|
+
|
|
23
|
+
export const errorStyle = css({
|
|
24
|
+
...typography.s.bold,
|
|
25
|
+
backgroundColor: colors.red.lightest,
|
|
26
|
+
color: colors.red.darker,
|
|
27
|
+
textAlign: "left",
|
|
28
|
+
padding: "11px 30px",
|
|
29
|
+
})
|