@khanacademy/wonder-blocks-birthday-picker 2.0.5 → 2.0.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @khanacademy/wonder-blocks-birthday-picker
2
2
 
3
+ ## 2.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - @khanacademy/wonder-blocks-dropdown@3.0.7
8
+ - @khanacademy/wonder-blocks-icon@2.0.7
9
+ - @khanacademy/wonder-blocks-layout@2.0.7
10
+ - @khanacademy/wonder-blocks-typography@2.0.7
11
+
12
+ ## 2.0.6
13
+
14
+ ### Patch Changes
15
+
16
+ - c20f48f3: Don't transpile classes when building bundles
17
+ - Updated dependencies [c20f48f3]
18
+ - @khanacademy/wonder-blocks-core@5.0.4
19
+ - @khanacademy/wonder-blocks-dropdown@3.0.6
20
+ - @khanacademy/wonder-blocks-icon@2.0.6
21
+ - @khanacademy/wonder-blocks-layout@2.0.6
22
+ - @khanacademy/wonder-blocks-typography@2.0.6
23
+
3
24
  ## 2.0.5
4
25
 
5
26
  ### Patch Changes
package/dist/es/index.js CHANGED
@@ -23,20 +23,6 @@ function _extends() {
23
23
  return _extends.apply(this, arguments);
24
24
  }
25
25
 
26
- function _setPrototypeOf(o, p) {
27
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
28
- o.__proto__ = p;
29
- return o;
30
- };
31
- return _setPrototypeOf(o, p);
32
- }
33
-
34
- function _inheritsLoose(subClass, superClass) {
35
- subClass.prototype = Object.create(superClass.prototype);
36
- subClass.prototype.constructor = subClass;
37
- _setPrototypeOf(subClass, superClass);
38
- }
39
-
40
26
  const CUR_YEAR = new Date().getYear() + 1900;
41
27
  const defaultLabels = Object.freeze({
42
28
  errorMessage: "Please select a valid birthdate.",
@@ -46,63 +32,59 @@ const defaultLabels = Object.freeze({
46
32
  });
47
33
  const FIELD_MIN_WIDTH_FULL = 110;
48
34
  const FIELD_MIN_WIDTH_MONTH_YEAR = 167;
49
- let BirthdayPicker = function (_React$Component) {
50
- _inheritsLoose(BirthdayPicker, _React$Component);
51
- function BirthdayPicker(props) {
52
- var _this;
53
- _this = _React$Component.call(this, props) || this;
54
- _this.labels = void 0;
55
- _this.lastChangeValue = null;
56
- _this.reportChange = value => {
57
- if (value !== _this.lastChangeValue) {
58
- _this.lastChangeValue = value;
59
- _this.props.onChange(value);
35
+ class BirthdayPicker extends React.Component {
36
+ constructor(props) {
37
+ super(props);
38
+ this.labels = void 0;
39
+ this.lastChangeValue = null;
40
+ this.reportChange = value => {
41
+ if (value !== this.lastChangeValue) {
42
+ this.lastChangeValue = value;
43
+ this.props.onChange(value);
60
44
  }
61
45
  };
62
- _this.handleChange = () => {
46
+ this.handleChange = () => {
63
47
  const {
64
48
  month,
65
49
  day,
66
50
  year
67
- } = _this.state;
51
+ } = this.state;
68
52
  if (month === null || day === null || year === null) {
69
- _this.reportChange(null);
53
+ this.reportChange(null);
70
54
  return;
71
55
  }
72
56
  const date = moment([year, month, day]);
73
57
  if (date.isAfter() || !date.isValid()) {
74
- _this.setState({
75
- error: _this.labels.errorMessage
58
+ this.setState({
59
+ error: this.labels.errorMessage
76
60
  });
77
- _this.reportChange(null);
61
+ this.reportChange(null);
78
62
  } else {
79
- _this.setState({
63
+ this.setState({
80
64
  error: null
81
65
  });
82
- _this.reportChange(date.locale("en").format("YYYY-MM-DD"));
66
+ this.reportChange(date.locale("en").format("YYYY-MM-DD"));
83
67
  }
84
68
  };
85
- _this.handleMonthChange = month => {
86
- _this.setState({
69
+ this.handleMonthChange = month => {
70
+ this.setState({
87
71
  month
88
- }, _this.handleChange);
72
+ }, this.handleChange);
89
73
  };
90
- _this.handleDayChange = day => {
91
- _this.setState({
74
+ this.handleDayChange = day => {
75
+ this.setState({
92
76
  day
93
- }, _this.handleChange);
77
+ }, this.handleChange);
94
78
  };
95
- _this.handleYearChange = year => {
96
- _this.setState({
79
+ this.handleYearChange = year => {
80
+ this.setState({
97
81
  year
98
- }, _this.handleChange);
82
+ }, this.handleChange);
99
83
  };
100
- _this.lastChangeValue = props.defaultValue || null;
101
- _this.state = _this.getStateFromDefault();
102
- return _this;
84
+ this.lastChangeValue = props.defaultValue || null;
85
+ this.state = this.getStateFromDefault();
103
86
  }
104
- var _proto = BirthdayPicker.prototype;
105
- _proto.getStateFromDefault = function getStateFromDefault() {
87
+ getStateFromDefault() {
106
88
  const {
107
89
  defaultValue,
108
90
  monthYearOnly
@@ -126,8 +108,8 @@ let BirthdayPicker = function (_React$Component) {
126
108
  }
127
109
  }
128
110
  return initialState;
129
- };
130
- _proto.maybeRenderError = function maybeRenderError() {
111
+ }
112
+ maybeRenderError() {
131
113
  const {
132
114
  error
133
115
  } = this.state;
@@ -156,8 +138,8 @@ let BirthdayPicker = function (_React$Component) {
156
138
  color: Color.red
157
139
  }
158
140
  }, error)));
159
- };
160
- _proto.renderMonth = function renderMonth() {
141
+ }
142
+ renderMonth() {
161
143
  const {
162
144
  disabled,
163
145
  monthYearOnly
@@ -180,8 +162,8 @@ let BirthdayPicker = function (_React$Component) {
180
162
  label: month,
181
163
  value: String(i)
182
164
  })));
183
- };
184
- _proto.maybeRenderDay = function maybeRenderDay() {
165
+ }
166
+ maybeRenderDay() {
185
167
  const {
186
168
  disabled,
187
169
  monthYearOnly
@@ -208,8 +190,8 @@ let BirthdayPicker = function (_React$Component) {
208
190
  label: String(day + 1),
209
191
  value: String(day + 1)
210
192
  }))));
211
- };
212
- _proto.renderYear = function renderYear() {
193
+ }
194
+ renderYear() {
213
195
  const {
214
196
  disabled,
215
197
  monthYearOnly
@@ -232,8 +214,8 @@ let BirthdayPicker = function (_React$Component) {
232
214
  label: String(CUR_YEAR - yearOffset),
233
215
  value: String(CUR_YEAR - yearOffset)
234
216
  })));
235
- };
236
- _proto.render = function render() {
217
+ }
218
+ render() {
237
219
  return React.createElement(React.Fragment, null, React.createElement(View, {
238
220
  testId: "birthday-picker",
239
221
  style: {
@@ -242,8 +224,7 @@ let BirthdayPicker = function (_React$Component) {
242
224
  }, this.renderMonth(), this.maybeRenderDay(), React.createElement(Strut, {
243
225
  size: Spacing.xSmall_8
244
226
  }), this.renderYear()), this.maybeRenderError());
245
- };
246
- return BirthdayPicker;
247
- }(React.Component);
227
+ }
228
+ }
248
229
 
249
230
  export { BirthdayPicker as default };
package/dist/index.js CHANGED
@@ -51,20 +51,6 @@ function _extends() {
51
51
  return _extends.apply(this, arguments);
52
52
  }
53
53
 
54
- function _setPrototypeOf(o, p) {
55
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
56
- o.__proto__ = p;
57
- return o;
58
- };
59
- return _setPrototypeOf(o, p);
60
- }
61
-
62
- function _inheritsLoose(subClass, superClass) {
63
- subClass.prototype = Object.create(superClass.prototype);
64
- subClass.prototype.constructor = subClass;
65
- _setPrototypeOf(subClass, superClass);
66
- }
67
-
68
54
  const CUR_YEAR = new Date().getYear() + 1900;
69
55
  const defaultLabels = Object.freeze({
70
56
  errorMessage: "Please select a valid birthdate.",
@@ -74,63 +60,59 @@ const defaultLabels = Object.freeze({
74
60
  });
75
61
  const FIELD_MIN_WIDTH_FULL = 110;
76
62
  const FIELD_MIN_WIDTH_MONTH_YEAR = 167;
77
- let BirthdayPicker = function (_React$Component) {
78
- _inheritsLoose(BirthdayPicker, _React$Component);
79
- function BirthdayPicker(props) {
80
- var _this;
81
- _this = _React$Component.call(this, props) || this;
82
- _this.labels = void 0;
83
- _this.lastChangeValue = null;
84
- _this.reportChange = value => {
85
- if (value !== _this.lastChangeValue) {
86
- _this.lastChangeValue = value;
87
- _this.props.onChange(value);
63
+ class BirthdayPicker extends React__namespace.Component {
64
+ constructor(props) {
65
+ super(props);
66
+ this.labels = void 0;
67
+ this.lastChangeValue = null;
68
+ this.reportChange = value => {
69
+ if (value !== this.lastChangeValue) {
70
+ this.lastChangeValue = value;
71
+ this.props.onChange(value);
88
72
  }
89
73
  };
90
- _this.handleChange = () => {
74
+ this.handleChange = () => {
91
75
  const {
92
76
  month,
93
77
  day,
94
78
  year
95
- } = _this.state;
79
+ } = this.state;
96
80
  if (month === null || day === null || year === null) {
97
- _this.reportChange(null);
81
+ this.reportChange(null);
98
82
  return;
99
83
  }
100
84
  const date = moment__default["default"]([year, month, day]);
101
85
  if (date.isAfter() || !date.isValid()) {
102
- _this.setState({
103
- error: _this.labels.errorMessage
86
+ this.setState({
87
+ error: this.labels.errorMessage
104
88
  });
105
- _this.reportChange(null);
89
+ this.reportChange(null);
106
90
  } else {
107
- _this.setState({
91
+ this.setState({
108
92
  error: null
109
93
  });
110
- _this.reportChange(date.locale("en").format("YYYY-MM-DD"));
94
+ this.reportChange(date.locale("en").format("YYYY-MM-DD"));
111
95
  }
112
96
  };
113
- _this.handleMonthChange = month => {
114
- _this.setState({
97
+ this.handleMonthChange = month => {
98
+ this.setState({
115
99
  month
116
- }, _this.handleChange);
100
+ }, this.handleChange);
117
101
  };
118
- _this.handleDayChange = day => {
119
- _this.setState({
102
+ this.handleDayChange = day => {
103
+ this.setState({
120
104
  day
121
- }, _this.handleChange);
105
+ }, this.handleChange);
122
106
  };
123
- _this.handleYearChange = year => {
124
- _this.setState({
107
+ this.handleYearChange = year => {
108
+ this.setState({
125
109
  year
126
- }, _this.handleChange);
110
+ }, this.handleChange);
127
111
  };
128
- _this.lastChangeValue = props.defaultValue || null;
129
- _this.state = _this.getStateFromDefault();
130
- return _this;
112
+ this.lastChangeValue = props.defaultValue || null;
113
+ this.state = this.getStateFromDefault();
131
114
  }
132
- var _proto = BirthdayPicker.prototype;
133
- _proto.getStateFromDefault = function getStateFromDefault() {
115
+ getStateFromDefault() {
134
116
  const {
135
117
  defaultValue,
136
118
  monthYearOnly
@@ -154,8 +136,8 @@ let BirthdayPicker = function (_React$Component) {
154
136
  }
155
137
  }
156
138
  return initialState;
157
- };
158
- _proto.maybeRenderError = function maybeRenderError() {
139
+ }
140
+ maybeRenderError() {
159
141
  const {
160
142
  error
161
143
  } = this.state;
@@ -184,8 +166,8 @@ let BirthdayPicker = function (_React$Component) {
184
166
  color: Color__default["default"].red
185
167
  }
186
168
  }, error)));
187
- };
188
- _proto.renderMonth = function renderMonth() {
169
+ }
170
+ renderMonth() {
189
171
  const {
190
172
  disabled,
191
173
  monthYearOnly
@@ -208,8 +190,8 @@ let BirthdayPicker = function (_React$Component) {
208
190
  label: month,
209
191
  value: String(i)
210
192
  })));
211
- };
212
- _proto.maybeRenderDay = function maybeRenderDay() {
193
+ }
194
+ maybeRenderDay() {
213
195
  const {
214
196
  disabled,
215
197
  monthYearOnly
@@ -236,8 +218,8 @@ let BirthdayPicker = function (_React$Component) {
236
218
  label: String(day + 1),
237
219
  value: String(day + 1)
238
220
  }))));
239
- };
240
- _proto.renderYear = function renderYear() {
221
+ }
222
+ renderYear() {
241
223
  const {
242
224
  disabled,
243
225
  monthYearOnly
@@ -260,8 +242,8 @@ let BirthdayPicker = function (_React$Component) {
260
242
  label: String(CUR_YEAR - yearOffset),
261
243
  value: String(CUR_YEAR - yearOffset)
262
244
  })));
263
- };
264
- _proto.render = function render() {
245
+ }
246
+ render() {
265
247
  return React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement(wonderBlocksCore.View, {
266
248
  testId: "birthday-picker",
267
249
  style: {
@@ -270,8 +252,7 @@ let BirthdayPicker = function (_React$Component) {
270
252
  }, this.renderMonth(), this.maybeRenderDay(), React__namespace.createElement(wonderBlocksLayout.Strut, {
271
253
  size: Spacing__default["default"].xSmall_8
272
254
  }), this.renderYear()), this.maybeRenderError());
273
- };
274
- return BirthdayPicker;
275
- }(React__namespace.Component);
255
+ }
256
+ }
276
257
 
277
258
  module.exports = BirthdayPicker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-birthday-picker",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "design": "v1",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -15,12 +15,12 @@
15
15
  "dependencies": {
16
16
  "@babel/runtime": "^7.18.6",
17
17
  "@khanacademy/wonder-blocks-color": "^2.0.1",
18
- "@khanacademy/wonder-blocks-core": "^5.0.3",
19
- "@khanacademy/wonder-blocks-dropdown": "^3.0.5",
20
- "@khanacademy/wonder-blocks-icon": "^2.0.5",
21
- "@khanacademy/wonder-blocks-layout": "^2.0.5",
18
+ "@khanacademy/wonder-blocks-core": "^5.0.4",
19
+ "@khanacademy/wonder-blocks-dropdown": "^3.0.7",
20
+ "@khanacademy/wonder-blocks-icon": "^2.0.7",
21
+ "@khanacademy/wonder-blocks-layout": "^2.0.7",
22
22
  "@khanacademy/wonder-blocks-spacing": "^4.0.1",
23
- "@khanacademy/wonder-blocks-typography": "^2.0.5"
23
+ "@khanacademy/wonder-blocks-typography": "^2.0.7"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "aphrodite": "^1.2.5",
@@ -28,7 +28,7 @@
28
28
  "react": "16.14.0"
29
29
  },
30
30
  "devDependencies": {
31
- "wb-dev-build-settings": "^0.9.4"
31
+ "wb-dev-build-settings": "^0.9.6"
32
32
  },
33
33
  "author": "",
34
34
  "license": "MIT"