dce-reactkit 3.2.2-beta.50 → 3.2.2-beta.52
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/cjs/index.js +15 -15
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +15 -15
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/SimpleDateChooser.tsx +3 -7
package/dist/cjs/index.js
CHANGED
|
@@ -1307,18 +1307,6 @@ const getTimeInfoInET = (dateOrTimestamp) => {
|
|
|
1307
1307
|
};
|
|
1308
1308
|
};
|
|
1309
1309
|
|
|
1310
|
-
/**
|
|
1311
|
-
* Force a number to stay within specific bounds
|
|
1312
|
-
* @author Gabe Abrams
|
|
1313
|
-
* @param num the number to move into the bounds
|
|
1314
|
-
* @param min the minimum number in the bound
|
|
1315
|
-
* @param max the maximum number in the bound
|
|
1316
|
-
* @returns bounded number
|
|
1317
|
-
*/
|
|
1318
|
-
const forceNumIntoBounds = (num, min, max) => {
|
|
1319
|
-
return Math.max(min, Math.min(max, num));
|
|
1320
|
-
};
|
|
1321
|
-
|
|
1322
1310
|
/**
|
|
1323
1311
|
* A very simple, lightweight date chooser
|
|
1324
1312
|
* @author Gabe Abrams
|
|
@@ -1333,7 +1321,7 @@ const SimpleDateChooser = (props) => {
|
|
|
1333
1321
|
var _a;
|
|
1334
1322
|
/* -------------- Props ------------- */
|
|
1335
1323
|
const { ariaLabel, name, month, day, year, onChange, chooseFromPast, } = props;
|
|
1336
|
-
|
|
1324
|
+
const numMonthsToShow = ((_a = props.numMonthsToShow) !== null && _a !== void 0 ? _a : 6);
|
|
1337
1325
|
/*------------------------------------------------------------------------*/
|
|
1338
1326
|
/* Render */
|
|
1339
1327
|
/*------------------------------------------------------------------------*/
|
|
@@ -1397,7 +1385,7 @@ const SimpleDateChooser = (props) => {
|
|
|
1397
1385
|
const dayOptions = [];
|
|
1398
1386
|
choices.forEach((choice) => {
|
|
1399
1387
|
// Create month option
|
|
1400
|
-
monthOptions.push(React__default["default"].createElement("option", { key: choice.month, value: choice.month
|
|
1388
|
+
monthOptions.push(React__default["default"].createElement("option", { key: choice.month, value: `${choice.month}-${choice.year}`, "aria-label": `choose ${choice.choiceName}`, onSelect: () => {
|
|
1401
1389
|
onChange(choice.month, choice.days[0], choice.year);
|
|
1402
1390
|
} }, choice.choiceName));
|
|
1403
1391
|
if (month === choice.month) {
|
|
@@ -1412,7 +1400,7 @@ const SimpleDateChooser = (props) => {
|
|
|
1412
1400
|
}
|
|
1413
1401
|
});
|
|
1414
1402
|
return (React__default["default"].createElement("div", { className: "SimpleDateChooser d-inline-block", "aria-label": `date chooser with selected date: ${month} ${day}, ${year}` },
|
|
1415
|
-
React__default["default"].createElement("select", { "aria-label": `month for ${ariaLabel}`, className: "custom-select d-inline-block mr-1", style: { width: 'auto' }, id: `SimpleDateChooser-${name}-month`, value: month
|
|
1403
|
+
React__default["default"].createElement("select", { "aria-label": `month for ${ariaLabel}`, className: "custom-select d-inline-block mr-1", style: { width: 'auto' }, id: `SimpleDateChooser-${name}-month`, value: `${month}-${year}`, onChange: (e) => {
|
|
1416
1404
|
const choice = choices[e.target.selectedIndex];
|
|
1417
1405
|
// Change day, month, and year
|
|
1418
1406
|
onChange(choice.month, choice.days[0], choice.year);
|
|
@@ -4171,6 +4159,18 @@ const floorToNumDecimals = (num, numDecimals) => {
|
|
|
4171
4159
|
return (Math.floor(num * rounder) / rounder);
|
|
4172
4160
|
};
|
|
4173
4161
|
|
|
4162
|
+
/**
|
|
4163
|
+
* Force a number to stay within specific bounds
|
|
4164
|
+
* @author Gabe Abrams
|
|
4165
|
+
* @param num the number to move into the bounds
|
|
4166
|
+
* @param min the minimum number in the bound
|
|
4167
|
+
* @param max the maximum number in the bound
|
|
4168
|
+
* @returns bounded number
|
|
4169
|
+
*/
|
|
4170
|
+
const forceNumIntoBounds = (num, min, max) => {
|
|
4171
|
+
return Math.max(min, Math.min(max, num));
|
|
4172
|
+
};
|
|
4173
|
+
|
|
4174
4174
|
/**
|
|
4175
4175
|
* Pad a number's decimal with zeros on the right
|
|
4176
4176
|
* (e.g. 5.2 becomes 5.20 with 2 digit padding)
|