dce-reactkit 5.0.2 → 5.0.4
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 +37 -7
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/SimpleDateChooser.d.ts +1 -0
- package/dist/cjs/types/components/SimpleMonthChooser.d.ts +23 -0
- package/dist/cjs/types/index.d.ts +3 -2
- package/dist/esm/index.js +34 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/SimpleDateChooser.d.ts +1 -0
- package/dist/esm/types/components/SimpleMonthChooser.d.ts +23 -0
- package/dist/esm/types/index.d.ts +3 -2
- package/dist/index.d.ts +40 -16
- package/package.json +2 -2
- package/src/components/SimpleDateChooser.tsx +31 -22
- package/src/components/SimpleMonthChooser.tsx +98 -0
- package/src/index.ts +4 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A very simple, lightweight month chooser
|
|
3
|
+
* @author Gabe Abrams
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
type Props = {
|
|
7
|
+
ariaLabel: string;
|
|
8
|
+
name: string;
|
|
9
|
+
month: number;
|
|
10
|
+
year: number;
|
|
11
|
+
/**
|
|
12
|
+
* Handler for when month changes
|
|
13
|
+
* @param month new 1-indexed month number
|
|
14
|
+
* @param year new full year number
|
|
15
|
+
*/
|
|
16
|
+
onChange: (month: number, year: number) => void;
|
|
17
|
+
numMonthsToShow?: number;
|
|
18
|
+
dontAllowPast?: boolean;
|
|
19
|
+
dontAllowFuture?: boolean;
|
|
20
|
+
isDisabled?: boolean;
|
|
21
|
+
};
|
|
22
|
+
declare const SimpleMonthChooser: React.FC<Props>;
|
|
23
|
+
export default SimpleMonthChooser;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_ROUTE_PATH, LOG_REVIEW_STATUS_ROUTE, LOG_REVIEW_GET_LOGS_ROUTE, SELECT_ADMIN_CHECK_ROUTE, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, extractProp, compareArraysByProp, getLocalTimeInfo, genCommaList, validateEmail, validatePhoneNumber, validateString, idify, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, getWordCount, cloneDeep, getTimestampFromTimeInfoInET, ParamType, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, LogTypeSpecificInfo, LogMainInfo, LogSourceSpecificInfo, LogLevel, CommonKitErrorCode, LogReviewerFilterState } from 'dce-commonkit';
|
|
1
|
+
import { ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_ROUTE_PATH, LOG_REVIEW_STATUS_ROUTE, LOG_REVIEW_GET_LOGS_ROUTE, SELECT_ADMIN_CHECK_ROUTE, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, extractProp, compareArraysByProp, getLocalTimeInfo, genCommaList, validateEmail, validatePhoneNumber, validateString, idify, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, getWordCount, cloneDeep, getTimestampFromTimeInfoInET, spaceAtCapitals, ParamType, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, LogTypeSpecificInfo, LogMainInfo, LogSourceSpecificInfo, LogLevel, CommonKitErrorCode, LogReviewerFilterState } from 'dce-commonkit';
|
|
2
2
|
import AppWrapper, { alert, prompt, confirm, showFatalError, addFatalErrorHandler, leaveToURL } from './components/AppWrapper';
|
|
3
3
|
import LoadingSpinner from './components/LoadingSpinner';
|
|
4
4
|
import ErrorBox from './components/ErrorBox';
|
|
@@ -8,6 +8,7 @@ import RadioButton from './components/RadioButton';
|
|
|
8
8
|
import CheckboxButton from './components/CheckboxButton';
|
|
9
9
|
import ButtonInputGroup from './components/ButtonInputGroup';
|
|
10
10
|
import SimpleDateChooser from './components/SimpleDateChooser';
|
|
11
|
+
import SimpleMonthChooser from './components/SimpleMonthChooser';
|
|
11
12
|
import SimpleTimeChooser from './components/SimpleTimeChooser';
|
|
12
13
|
import Drawer from './components/Drawer';
|
|
13
14
|
import PopSuccessMark from './components/PopSuccessMark';
|
|
@@ -48,4 +49,4 @@ import PickableItem from './components/ItemPicker/types/PickableItem';
|
|
|
48
49
|
import DBEntry from './components/DBEntryManagerPanel/types/DBEntry';
|
|
49
50
|
import DBEntryField from './components/DBEntryManagerPanel/types/DBEntryField';
|
|
50
51
|
import DBEntryFieldType from './components/DBEntryManagerPanel/types/DBEntryFieldType';
|
|
51
|
-
export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, SimpleTimeChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, DBEntryManagerPanel, Tooltip, ToggleSwitch, AutoscrollToBottomContainer, MultiSwitch, Dropdown, ProgressBar, FakeProgressBar, alert, prompt, confirm, showFatalError, DynamicWord, stubServerEndpoint, canReviewLogs, isMobileOrTablet, makeLinksClickable, isSelectAdmin, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, leaveToURL, combineClassNames, useForceRender, setClientEventMetadataPopulator, ModalButtonType, ModalSize, ModalType, Variant, IntelliTableColumn, DropdownItemType, LogReviewerFilterState, ProgressBarSize, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_ROUTE_PATH, LOG_REVIEW_STATUS_ROUTE, LOG_REVIEW_GET_LOGS_ROUTE, SELECT_ADMIN_CHECK_ROUTE, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, extractProp, compareArraysByProp, getLocalTimeInfo, genCommaList, validateEmail, validatePhoneNumber, validateString, idify, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, getWordCount, cloneDeep, getTimestampFromTimeInfoInET, ParamType, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, LogTypeSpecificInfo, LogMainInfo, LogSourceSpecificInfo, LogLevel, CommonKitErrorCode, };
|
|
52
|
+
export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, SimpleMonthChooser, SimpleTimeChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, DBEntryManagerPanel, Tooltip, ToggleSwitch, AutoscrollToBottomContainer, MultiSwitch, Dropdown, ProgressBar, FakeProgressBar, alert, prompt, confirm, showFatalError, DynamicWord, stubServerEndpoint, canReviewLogs, isMobileOrTablet, makeLinksClickable, isSelectAdmin, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, leaveToURL, combineClassNames, useForceRender, setClientEventMetadataPopulator, ModalButtonType, ModalSize, ModalType, Variant, IntelliTableColumn, DropdownItemType, LogReviewerFilterState, ProgressBarSize, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_ROUTE_PATH, LOG_REVIEW_STATUS_ROUTE, LOG_REVIEW_GET_LOGS_ROUTE, SELECT_ADMIN_CHECK_ROUTE, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, extractProp, compareArraysByProp, getLocalTimeInfo, genCommaList, validateEmail, validatePhoneNumber, validateString, idify, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, getWordCount, cloneDeep, getTimestampFromTimeInfoInET, spaceAtCapitals, ParamType, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, LogTypeSpecificInfo, LogMainInfo, LogSourceSpecificInfo, LogLevel, CommonKitErrorCode, };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommonKitErrorCode, waitMs, ErrorWithCode, LOG_ROUTE_PATH, LogBuiltInMetadata, LogLevel, getOrdinal, getMonthName, getTimeInfoInET, padZerosLeft, ParamType, roundToNumDecimals, genCSV, LogAction, cloneDeep, LogType, LogSource, getHumanReadableDate, LOG_REVIEW_GET_LOGS_ROUTE, idify, padDecimalZeros, LOG_REVIEW_STATUS_ROUTE, SELECT_ADMIN_CHECK_ROUTE } from 'dce-commonkit';
|
|
2
|
-
export { CommonKitErrorCode, DAY_IN_MS, DayOfWeek, ErrorWithCode, HOUR_IN_MS, LOG_REVIEW_GET_LOGS_ROUTE, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_REVIEW_STATUS_ROUTE, LOG_ROUTE_PATH, LogAction, LogBuiltInMetadata, LogLevel, LogSource, LogType, MINUTE_IN_MS, ParamType, SELECT_ADMIN_CHECK_ROUTE, abbreviate, avg, capitalize, ceilToNumDecimals, cloneDeep, compareArraysByProp, everyAsync, extractProp, filterAsync, floorToNumDecimals, forEachAsync, forceNumIntoBounds, genCSV, genCommaList, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, getTimestampFromTimeInfoInET, getWordCount, idify, mapAsync, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, prefixWithAOrAn, roundToNumDecimals, shuffleArray, someAsync, startMinWait, stringsToHumanReadableList, sum, validateEmail, validatePhoneNumber, validateString, waitMs } from 'dce-commonkit';
|
|
2
|
+
export { CommonKitErrorCode, DAY_IN_MS, DayOfWeek, ErrorWithCode, HOUR_IN_MS, LOG_REVIEW_GET_LOGS_ROUTE, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_REVIEW_STATUS_ROUTE, LOG_ROUTE_PATH, LogAction, LogBuiltInMetadata, LogLevel, LogSource, LogType, MINUTE_IN_MS, ParamType, SELECT_ADMIN_CHECK_ROUTE, abbreviate, avg, capitalize, ceilToNumDecimals, cloneDeep, compareArraysByProp, everyAsync, extractProp, filterAsync, floorToNumDecimals, forEachAsync, forceNumIntoBounds, genCSV, genCommaList, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, getTimestampFromTimeInfoInET, getWordCount, idify, mapAsync, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, prefixWithAOrAn, roundToNumDecimals, shuffleArray, someAsync, spaceAtCapitals, startMinWait, stringsToHumanReadableList, sum, validateEmail, validatePhoneNumber, validateString, waitMs } from 'dce-commonkit';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { useState, useRef, useEffect, useReducer, forwardRef, useContext, useLayoutEffect, createContext, useMemo, useCallback, Component, Fragment } from 'react';
|
|
5
5
|
import { faExclamationTriangle, faCircle, faHourglassEnd, faDotCircle, faCheckSquare, faHourglass, faClipboard, faChevronDown, faChevronRight, faCloudDownloadAlt, faMinus, faCheckCircle, faXmarkCircle, faSort, faSortDown, faSortUp, faArrowLeft, faArrowRight, faCalendar, faTag, faHammer, faList, faTimes, faSearch, faSave, faTrash, faCog, faPlus } from '@fortawesome/free-solid-svg-icons';
|
|
@@ -1904,7 +1904,7 @@ const SimpleDateChooser = (props) => {
|
|
|
1904
1904
|
/* -------------------------------- Setup ------------------------------- */
|
|
1905
1905
|
/*------------------------------------------------------------------------*/
|
|
1906
1906
|
/* -------------- Props ------------- */
|
|
1907
|
-
const { ariaLabel, name, dontAllowPast, dontAllowFuture, numMonthsToShow, onChange, month, day, year, isDisabled = false, } = props;
|
|
1907
|
+
const { ariaLabel, name, dontAllowPast, dontAllowFuture, numMonthsToShow, onChange, month, day, year, isDisabled = false, hideDay, } = props;
|
|
1908
1908
|
// Get choices
|
|
1909
1909
|
const choices = getChoices({
|
|
1910
1910
|
numMonthsToShow,
|
|
@@ -1990,20 +1990,21 @@ const SimpleDateChooser = (props) => {
|
|
|
1990
1990
|
// Change day, month, and year
|
|
1991
1991
|
onChange(choice.month, choice.days[0], choice.year);
|
|
1992
1992
|
}, disabled: isDisabled }, monthOptions),
|
|
1993
|
-
React__default.createElement("select", { "aria-label": `day for ${ariaLabel}`, className: "custom-select form-select d-inline-block", style: { width: 'auto' }, id: `SimpleDateChooser-${name}-day`, value: day, onChange: (e) => {
|
|
1993
|
+
!hideDay && (React__default.createElement("select", { "aria-label": `day for ${ariaLabel}`, className: "custom-select form-select d-inline-block", style: { width: 'auto' }, id: `SimpleDateChooser-${name}-day`, value: day, onChange: (e) => {
|
|
1994
1994
|
// Only change the day
|
|
1995
1995
|
onChange(month, Number.parseInt(e.target.value, 10), year);
|
|
1996
|
-
}, disabled: isDisabled }, dayOptions)));
|
|
1996
|
+
}, disabled: isDisabled }, dayOptions))));
|
|
1997
1997
|
}
|
|
1998
1998
|
/* --------- DateOutOfRange --------- */
|
|
1999
1999
|
if (view === View.InvalidDate) {
|
|
2000
2000
|
body = (React__default.createElement("div", { className: "SimpleDateChooser-inner-container d-inline-block" },
|
|
2001
2001
|
React__default.createElement("button", { type: "button", className: "btn btn-light", onClick: askToEditInvalidDate, "aria-label": `edit date for ${ariaLabel}` },
|
|
2002
2002
|
getMonthName(month).full,
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2003
|
+
!hideDay && (React__default.createElement(React__default.Fragment, null,
|
|
2004
|
+
' ',
|
|
2005
|
+
day,
|
|
2006
|
+
getOrdinal(day),
|
|
2007
|
+
",")),
|
|
2007
2008
|
' ',
|
|
2008
2009
|
year),
|
|
2009
2010
|
React__default.createElement("button", { type: "button", className: "btn btn-secondary", onClick: askToEditInvalidDate, "aria-label": `edit date for ${ariaLabel}` }, "Edit")));
|
|
@@ -2014,6 +2015,30 @@ const SimpleDateChooser = (props) => {
|
|
|
2014
2015
|
return (React__default.createElement("span", { className: "SimpleDateChooser-outer-container" }, body));
|
|
2015
2016
|
};
|
|
2016
2017
|
|
|
2018
|
+
/**
|
|
2019
|
+
* A very simple, lightweight month chooser
|
|
2020
|
+
* @author Gabe Abrams
|
|
2021
|
+
*/
|
|
2022
|
+
/*------------------------------------------------------------------------*/
|
|
2023
|
+
/* ------------------------------ Component ----------------------------- */
|
|
2024
|
+
/*------------------------------------------------------------------------*/
|
|
2025
|
+
const SimpleMonthChooser = (props) => {
|
|
2026
|
+
/*------------------------------------------------------------------------*/
|
|
2027
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
2028
|
+
/*------------------------------------------------------------------------*/
|
|
2029
|
+
/* -------------- Props ------------- */
|
|
2030
|
+
const { ariaLabel, name, dontAllowPast, dontAllowFuture, numMonthsToShow, onChange, month, year, isDisabled, } = props;
|
|
2031
|
+
/*------------------------------------------------------------------------*/
|
|
2032
|
+
/* ------------------------------- Render ------------------------------- */
|
|
2033
|
+
/*------------------------------------------------------------------------*/
|
|
2034
|
+
/*----------------------------------------*/
|
|
2035
|
+
/* --------------- Main UI -------------- */
|
|
2036
|
+
/*----------------------------------------*/
|
|
2037
|
+
return (React__default.createElement(SimpleDateChooser, { ariaLabel: ariaLabel, name: name, month: month, day: 1, year: year, numMonthsToShow: numMonthsToShow, dontAllowPast: dontAllowPast, dontAllowFuture: dontAllowFuture, isDisabled: isDisabled, hideDay: true, onChange: (newMonth, newDay, newYear) => {
|
|
2038
|
+
onChange(newMonth, newYear);
|
|
2039
|
+
} }));
|
|
2040
|
+
};
|
|
2041
|
+
|
|
2017
2042
|
/**
|
|
2018
2043
|
* A very simple, lightweight time chooser
|
|
2019
2044
|
* @author Gardenia Liu
|
|
@@ -14734,5 +14759,5 @@ const isSelectAdmin = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
14734
14759
|
}
|
|
14735
14760
|
});
|
|
14736
14761
|
|
|
14737
|
-
export { AppWrapper, AutoscrollToBottomContainer, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DBEntryFieldType$1 as DBEntryFieldType, DBEntryManagerPanel, Drawer, Dropdown, DropdownItemType$1 as DropdownItemType, DynamicWord, ErrorBox, FakeProgressBar, IntelliTable, ItemPicker, LoadingSpinner, LogReviewer, Modal, ModalButtonType$1 as ModalButtonType, ModalSize$1 as ModalSize, ModalType$1 as ModalType, MultiSwitch, PopFailureMark, PopPendingMark, PopSuccessMark, ProgressBar, ProgressBarSize$1 as ProgressBarSize, RadioButton, SimpleDateChooser, SimpleTimeChooser, TabBox, ToggleSwitch, Tooltip, Variant$1 as Variant, addFatalErrorHandler, alert, canReviewLogs, combineClassNames, confirm, initClient, isMobileOrTablet, isSelectAdmin, leaveToURL, logClientEvent, makeLinksClickable, prompt, setClientEventMetadataPopulator, showFatalError, stubServerEndpoint, useForceRender, visitServerEndpoint };
|
|
14762
|
+
export { AppWrapper, AutoscrollToBottomContainer, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DBEntryFieldType$1 as DBEntryFieldType, DBEntryManagerPanel, Drawer, Dropdown, DropdownItemType$1 as DropdownItemType, DynamicWord, ErrorBox, FakeProgressBar, IntelliTable, ItemPicker, LoadingSpinner, LogReviewer, Modal, ModalButtonType$1 as ModalButtonType, ModalSize$1 as ModalSize, ModalType$1 as ModalType, MultiSwitch, PopFailureMark, PopPendingMark, PopSuccessMark, ProgressBar, ProgressBarSize$1 as ProgressBarSize, RadioButton, SimpleDateChooser, SimpleMonthChooser, SimpleTimeChooser, TabBox, ToggleSwitch, Tooltip, Variant$1 as Variant, addFatalErrorHandler, alert, canReviewLogs, combineClassNames, confirm, initClient, isMobileOrTablet, isSelectAdmin, leaveToURL, logClientEvent, makeLinksClickable, prompt, setClientEventMetadataPopulator, showFatalError, stubServerEndpoint, useForceRender, visitServerEndpoint };
|
|
14738
14763
|
//# sourceMappingURL=index.js.map
|