@khanacademy/wonder-blocks-birthday-picker 3.0.14 → 3.2.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Khan Academy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/es/index.js CHANGED
@@ -40,7 +40,7 @@ const defaultStyles = StyleSheet.create({
40
40
  class BirthdayPicker extends React.Component {
41
41
  constructor(props) {
42
42
  super(props);
43
- this.labels = void 0;
43
+ this.labels = undefined;
44
44
  this.lastChangeValue = null;
45
45
  this.reportChange = value => {
46
46
  if (value !== this.lastChangeValue) {
@@ -153,6 +153,7 @@ class BirthdayPicker extends React.Component {
153
153
  } = this.state;
154
154
  const minWidth = this.getMonthYearWidth(monthYearOnly);
155
155
  return React.createElement(SingleSelect, {
156
+ "aria-label": this.labels.month,
156
157
  "aria-invalid": !!this.state.error,
157
158
  error: !!this.state.error,
158
159
  disabled: disabled,
@@ -184,6 +185,7 @@ class BirthdayPicker extends React.Component {
184
185
  return React.createElement(React.Fragment, null, React.createElement(Strut, {
185
186
  size: spacing.xSmall_8
186
187
  }), React.createElement(SingleSelect, {
188
+ "aria-label": this.labels.day,
187
189
  "aria-invalid": !!this.state.error,
188
190
  error: !!this.state.error,
189
191
  disabled: disabled,
@@ -214,6 +216,7 @@ class BirthdayPicker extends React.Component {
214
216
  } = this.state;
215
217
  const minWidth = this.getMonthYearWidth(monthYearOnly);
216
218
  return React.createElement(SingleSelect, {
219
+ "aria-label": this.labels.year,
217
220
  "aria-invalid": !!this.state.error,
218
221
  error: !!this.state.error,
219
222
  disabled: disabled,
package/dist/index.js CHANGED
@@ -12,10 +12,7 @@ var wonderBlocksIcon = require('@khanacademy/wonder-blocks-icon');
12
12
  var wonderBlocksDropdown = require('@khanacademy/wonder-blocks-dropdown');
13
13
  var infoIcon = require('@phosphor-icons/core/bold/info-bold.svg');
14
14
 
15
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
-
17
- function _interopNamespace(e) {
18
- if (e && e.__esModule) return e;
15
+ function _interopNamespaceDefault(e) {
19
16
  var n = Object.create(null);
20
17
  if (e) {
21
18
  Object.keys(e).forEach(function (k) {
@@ -28,14 +25,11 @@ function _interopNamespace(e) {
28
25
  }
29
26
  });
30
27
  }
31
- n["default"] = e;
28
+ n.default = e;
32
29
  return Object.freeze(n);
33
30
  }
34
31
 
35
- var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
36
- var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
37
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
38
- var infoIcon__default = /*#__PURE__*/_interopDefaultLegacy(infoIcon);
32
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
39
33
 
40
34
  const CUR_YEAR = new Date().getYear() + 1900;
41
35
  const defaultLabels = Object.freeze({
@@ -67,7 +61,7 @@ const defaultStyles = aphrodite.StyleSheet.create({
67
61
  class BirthdayPicker extends React__namespace.Component {
68
62
  constructor(props) {
69
63
  super(props);
70
- this.labels = void 0;
64
+ this.labels = undefined;
71
65
  this.lastChangeValue = null;
72
66
  this.reportChange = value => {
73
67
  if (value !== this.lastChangeValue) {
@@ -85,7 +79,7 @@ class BirthdayPicker extends React__namespace.Component {
85
79
  this.reportChange(null);
86
80
  return;
87
81
  }
88
- const date = moment__default["default"]([year, month, day]);
82
+ const date = moment([year, month, day]);
89
83
  if (date.isAfter() || !date.isValid()) {
90
84
  this.setState({
91
85
  error: this.labels.errorMessage
@@ -127,9 +121,9 @@ class BirthdayPicker extends React__namespace.Component {
127
121
  year: null,
128
122
  error: null
129
123
  };
130
- this.labels = _extends__default["default"]({}, defaultLabels, this.props.labels);
124
+ this.labels = _extends({}, defaultLabels, this.props.labels);
131
125
  if (defaultValue) {
132
- const date = moment__default["default"](defaultValue);
126
+ const date = moment(defaultValue);
133
127
  if (date.isValid()) {
134
128
  initialState.month = String(date.month());
135
129
  initialState.day = String(date.date());
@@ -158,7 +152,7 @@ class BirthdayPicker extends React__namespace.Component {
158
152
  role: "alert"
159
153
  }, React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
160
154
  size: "small",
161
- icon: infoIcon__default["default"],
155
+ icon: infoIcon,
162
156
  color: wonderBlocksTokens.semanticColor.icon.destructive,
163
157
  "aria-hidden": "true"
164
158
  }), React__namespace.createElement(wonderBlocksLayout.Strut, {
@@ -180,6 +174,7 @@ class BirthdayPicker extends React__namespace.Component {
180
174
  } = this.state;
181
175
  const minWidth = this.getMonthYearWidth(monthYearOnly);
182
176
  return React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
177
+ "aria-label": this.labels.month,
183
178
  "aria-invalid": !!this.state.error,
184
179
  error: !!this.state.error,
185
180
  disabled: disabled,
@@ -190,7 +185,7 @@ class BirthdayPicker extends React__namespace.Component {
190
185
  minWidth
191
186
  }, defaultStyles.input, dropdownStyle],
192
187
  testId: "birthday-picker-month"
193
- }, moment__default["default"].monthsShort().map((month, i) => React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
188
+ }, moment.monthsShort().map((month, i) => React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
194
189
  key: month,
195
190
  label: month,
196
191
  value: String(i)
@@ -211,6 +206,7 @@ class BirthdayPicker extends React__namespace.Component {
211
206
  return React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement(wonderBlocksLayout.Strut, {
212
207
  size: wonderBlocksTokens.spacing.xSmall_8
213
208
  }), React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
209
+ "aria-label": this.labels.day,
214
210
  "aria-invalid": !!this.state.error,
215
211
  error: !!this.state.error,
216
212
  disabled: disabled,
@@ -241,6 +237,7 @@ class BirthdayPicker extends React__namespace.Component {
241
237
  } = this.state;
242
238
  const minWidth = this.getMonthYearWidth(monthYearOnly);
243
239
  return React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
240
+ "aria-label": this.labels.year,
244
241
  "aria-invalid": !!this.state.error,
245
242
  error: !!this.state.error,
246
243
  disabled: disabled,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-birthday-picker",
3
- "version": "3.0.14",
3
+ "version": "3.2.0",
4
4
  "design": "v1",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -9,18 +9,14 @@
9
9
  "main": "dist/index.js",
10
10
  "module": "dist/es/index.js",
11
11
  "types": "dist/index.d.ts",
12
- "scripts": {
13
- "test": "echo \"Error: no test specified\" && exit 1",
14
- "prepublishOnly": "../../utils/publish/package-pre-publish-check.sh"
15
- },
16
12
  "dependencies": {
17
- "@babel/runtime": "^7.18.6",
18
- "@khanacademy/wonder-blocks-core": "^12.0.0",
19
- "@khanacademy/wonder-blocks-dropdown": "^9.0.0",
20
- "@khanacademy/wonder-blocks-icon": "^5.0.6",
21
- "@khanacademy/wonder-blocks-layout": "^3.0.8",
22
- "@khanacademy/wonder-blocks-tokens": "^4.1.0",
23
- "@khanacademy/wonder-blocks-typography": "^3.0.6"
13
+ "@babel/runtime": "^7.24.5",
14
+ "@khanacademy/wonder-blocks-core": "12.1.0",
15
+ "@khanacademy/wonder-blocks-dropdown": "9.1.0",
16
+ "@khanacademy/wonder-blocks-icon": "5.1.0",
17
+ "@khanacademy/wonder-blocks-layout": "3.1.0",
18
+ "@khanacademy/wonder-blocks-tokens": "4.2.0",
19
+ "@khanacademy/wonder-blocks-typography": "3.1.0"
24
20
  },
25
21
  "peerDependencies": {
26
22
  "@phosphor-icons/core": "^2.0.2",
@@ -29,8 +25,11 @@
29
25
  "react": "18.2.0"
30
26
  },
31
27
  "devDependencies": {
32
- "@khanacademy/wb-dev-build-settings": "^2.0.0"
28
+ "@khanacademy/wb-dev-build-settings": "2.1.0"
33
29
  },
34
30
  "author": "",
35
- "license": "MIT"
31
+ "license": "MIT",
32
+ "scripts": {
33
+ "test": "echo \"Error: no test specified\" && exit 1"
34
+ }
36
35
  }