@khanacademy/wonder-blocks-birthday-picker 3.1.0 → 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/CHANGELOG.md +594 -571
- package/LICENSE +21 -0
- package/dist/es/index.js +1 -1
- package/dist/index.js +9 -15
- package/package.json +13 -14
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 =
|
|
43
|
+
this.labels = undefined;
|
|
44
44
|
this.lastChangeValue = null;
|
|
45
45
|
this.reportChange = value => {
|
|
46
46
|
if (value !== this.lastChangeValue) {
|
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
|
|
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
|
|
28
|
+
n.default = e;
|
|
32
29
|
return Object.freeze(n);
|
|
33
30
|
}
|
|
34
31
|
|
|
35
|
-
var
|
|
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 =
|
|
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 =
|
|
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 =
|
|
124
|
+
this.labels = _extends({}, defaultLabels, this.props.labels);
|
|
131
125
|
if (defaultValue) {
|
|
132
|
-
const date =
|
|
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:
|
|
155
|
+
icon: infoIcon,
|
|
162
156
|
color: wonderBlocksTokens.semanticColor.icon.destructive,
|
|
163
157
|
"aria-hidden": "true"
|
|
164
158
|
}), React__namespace.createElement(wonderBlocksLayout.Strut, {
|
|
@@ -191,7 +185,7 @@ class BirthdayPicker extends React__namespace.Component {
|
|
|
191
185
|
minWidth
|
|
192
186
|
}, defaultStyles.input, dropdownStyle],
|
|
193
187
|
testId: "birthday-picker-month"
|
|
194
|
-
},
|
|
188
|
+
}, moment.monthsShort().map((month, i) => React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
195
189
|
key: month,
|
|
196
190
|
label: month,
|
|
197
191
|
value: String(i)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-birthday-picker",
|
|
3
|
-
"version": "3.
|
|
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
|
-
"@khanacademy/wonder-blocks-core": "
|
|
19
|
-
"@khanacademy/wonder-blocks-dropdown": "
|
|
20
|
-
"@khanacademy/wonder-blocks-icon": "
|
|
21
|
-
"@khanacademy/wonder-blocks-layout": "
|
|
22
|
-
"@khanacademy/wonder-blocks-tokens": "
|
|
23
|
-
"@khanacademy/wonder-blocks-typography": "
|
|
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": "
|
|
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
|
}
|