dce-reactkit 5.0.2 → 5.0.3

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.
@@ -21,6 +21,7 @@ type Props = {
21
21
  dontAllowPast?: boolean;
22
22
  dontAllowFuture?: boolean;
23
23
  isDisabled?: boolean;
24
+ hideDay?: boolean;
24
25
  };
25
26
  declare const SimpleDateChooser: React.FC<Props>;
26
27
  export default SimpleDateChooser;
@@ -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;
@@ -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, ParamType, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, LogTypeSpecificInfo, LogMainInfo, LogSourceSpecificInfo, LogLevel, CommonKitErrorCode, };
package/dist/esm/index.js CHANGED
@@ -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
- day,
2005
- getOrdinal(day),
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