dce-reactkit 4.0.0 → 4.0.2-beta-simple-date-chooser.1

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.
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * A very simple, lightweight date chooser
3
3
  * @author Gabe Abrams
4
+ * @author Gardenia Liu
4
5
  */
5
6
  import React from 'react';
6
7
  type Props = {
@@ -17,7 +18,8 @@ type Props = {
17
18
  */
18
19
  onChange: (month: number, day: number, year: number) => void;
19
20
  numMonthsToShow?: number;
20
- chooseFromPast?: boolean;
21
+ dontAllowPast?: boolean;
22
+ dontAllowFuture?: boolean;
21
23
  };
22
24
  declare const SimpleDateChooser: React.FC<Props>;
23
25
  export default SimpleDateChooser;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * A very simple, lightweight time chooser
3
+ * @author Gardenia Liu
4
+ */
5
+ import React from 'react';
6
+ type Props = {
7
+ ariaLabel: string;
8
+ name: string;
9
+ hour: number;
10
+ minute: number;
11
+ /**
12
+ * Handler for when time changes
13
+ * @param hour new 24hr hour number
14
+ * @param minute new minute number
15
+ */
16
+ onChange: (hour: number, minute: number) => void;
17
+ intervalMin?: number;
18
+ };
19
+ declare const SimpleTimeChooser: React.FC<Props>;
20
+ export default SimpleTimeChooser;
@@ -7,6 +7,7 @@ import RadioButton from './components/RadioButton';
7
7
  import CheckboxButton from './components/CheckboxButton';
8
8
  import ButtonInputGroup from './components/ButtonInputGroup';
9
9
  import SimpleDateChooser from './components/SimpleDateChooser';
10
+ import SimpleTimeChooser from './components/SimpleTimeChooser';
10
11
  import Drawer from './components/Drawer';
11
12
  import PopSuccessMark from './components/PopSuccessMark';
12
13
  import PopFailureMark from './components/PopFailureMark';
@@ -100,4 +101,4 @@ import PickableItem from './components/ItemPicker/types/PickableItem';
100
101
  import DBEntry from './components/DBEntryManagerPanel/types/DBEntry';
101
102
  import DBEntryField from './components/DBEntryManagerPanel/types/DBEntryField';
102
103
  import DBEntryFieldType from './components/DBEntryManagerPanel/types/DBEntryFieldType';
103
- export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, DBEntryManagerPanel, Tooltip, ToggleSwitch, AutoscrollToBottomContainer, MultiSwitch, Dropdown, alert, prompt, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_ROUTE_PATH, LOG_REVIEW_STATUS_ROUTE, DynamicWord, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, canReviewLogs, isMobileOrTablet, extractProp, compareArraysByProp, genCommaList, validateEmail, validatePhoneNumber, validateString, getLocalTimeInfo, idify, makeLinksClickable, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, getWordCount, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, leaveToURL, combineClassNames, useForceRender, setClientEventMetadataPopulator, ParamType, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, LogTypeSpecificInfo, LogMainInfo, LogSourceSpecificInfo, LogLevel, IntelliTableColumn, DropdownItemType, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, };
104
+ 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, alert, prompt, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_ROUTE_PATH, LOG_REVIEW_STATUS_ROUTE, DynamicWord, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, canReviewLogs, isMobileOrTablet, extractProp, compareArraysByProp, genCommaList, validateEmail, validatePhoneNumber, validateString, getLocalTimeInfo, idify, makeLinksClickable, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, getWordCount, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, leaveToURL, combineClassNames, useForceRender, setClientEventMetadataPopulator, ParamType, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, LogTypeSpecificInfo, LogMainInfo, LogSourceSpecificInfo, LogLevel, IntelliTableColumn, DropdownItemType, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, };
@@ -6,6 +6,8 @@ declare enum ReactKitErrorCode {
6
6
  NoResponse = "DRK1",
7
7
  NoCode = "DRK2",
8
8
  SessionExpired = "DRK3",
9
- NoCACCLSendRequestFunction = "DRK7"
9
+ NoCACCLSendRequestFunction = "DRK7",
10
+ SimpleDateChooserInvalidDateRange = "DRK35",
11
+ SimpleDateChooserInvalidNumMonths = "DRK36"
10
12
  }
11
13
  export default ReactKitErrorCode;
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ declare enum Variant {
23
23
  * @author Gabe Abrams
24
24
  */
25
25
 
26
- type Props$l = {
26
+ type Props$m = {
27
27
  children: React$1.ReactNode;
28
28
  };
29
29
  /**
@@ -106,7 +106,7 @@ declare const showFatalError: (error: any, errorTitle?: string) => Promise<void>
106
106
  * @author Gabe Abrams
107
107
  */
108
108
  declare const addFatalErrorHandler: (handler: () => void) => void;
109
- declare const AppWrapper: React$1.FC<Props$l>;
109
+ declare const AppWrapper: React$1.FC<Props$m>;
110
110
 
111
111
  /**
112
112
  * Loading spinner/indicator
@@ -120,14 +120,14 @@ declare const LoadingSpinner: () => React$1.JSX.Element;
120
120
  * @author Gabe Abrams
121
121
  */
122
122
 
123
- type Props$k = {
123
+ type Props$l = {
124
124
  error: any;
125
125
  title?: string;
126
126
  onClose?: () => void;
127
127
  variant?: Variant;
128
128
  icon?: IconProp;
129
129
  };
130
- declare const ErrorBox: React$1.FC<Props$k>;
130
+ declare const ErrorBox: React$1.FC<Props$l>;
131
131
 
132
132
  /**
133
133
  * Types of buttons in the modal
@@ -226,21 +226,21 @@ declare const Modal: React$1.FC<ModalProps>;
226
226
  * @author Gabe Abrams
227
227
  */
228
228
 
229
- type Props$j = {
229
+ type Props$k = {
230
230
  title: React$1.ReactNode;
231
231
  children: React$1.ReactNode;
232
232
  topRightChildren?: React$1.ReactNode;
233
233
  noBottomMargin?: boolean;
234
234
  noBottomPadding?: boolean;
235
235
  };
236
- declare const TabBox: React$1.FC<Props$j>;
236
+ declare const TabBox: React$1.FC<Props$k>;
237
237
 
238
238
  /**
239
239
  * A radio selection button
240
240
  * @author Gabe Abrams
241
241
  */
242
242
 
243
- type Props$i = {
243
+ type Props$j = {
244
244
  text: React$1.ReactNode;
245
245
  onSelected: () => void;
246
246
  ariaLabel: string;
@@ -254,14 +254,14 @@ type Props$i = {
254
254
  small?: boolean;
255
255
  useComplexFormatting?: boolean;
256
256
  };
257
- declare const RadioButton: React$1.FC<Props$i>;
257
+ declare const RadioButton: React$1.FC<Props$j>;
258
258
 
259
259
  /**
260
260
  * A checkbox button
261
261
  * @author Gabe Abrams
262
262
  */
263
263
 
264
- type Props$h = {
264
+ type Props$i = {
265
265
  text: React$1.ReactNode;
266
266
  onChanged: (checked: boolean) => void;
267
267
  ariaLabel: string;
@@ -276,14 +276,14 @@ type Props$h = {
276
276
  dashed?: boolean;
277
277
  useComplexFormatting?: boolean;
278
278
  };
279
- declare const CheckboxButton: React$1.FC<Props$h>;
279
+ declare const CheckboxButton: React$1.FC<Props$i>;
280
280
 
281
281
  /**
282
282
  * Input group with a title and space for buttons
283
283
  * @author Gabe Abrams
284
284
  */
285
285
 
286
- type Props$g = {
286
+ type Props$h = {
287
287
  label: React$1.ReactNode;
288
288
  minLabelWidth?: string;
289
289
  children: React$1.ReactNode;
@@ -292,14 +292,15 @@ type Props$g = {
292
292
  isAdminFeature?: boolean;
293
293
  noMarginOnBottom?: boolean;
294
294
  };
295
- declare const ButtonInputGroup: React$1.FC<Props$g>;
295
+ declare const ButtonInputGroup: React$1.FC<Props$h>;
296
296
 
297
297
  /**
298
298
  * A very simple, lightweight date chooser
299
299
  * @author Gabe Abrams
300
+ * @author Gardenia Liu
300
301
  */
301
302
 
302
- type Props$f = {
303
+ type Props$g = {
303
304
  ariaLabel: string;
304
305
  name: string;
305
306
  month: number;
@@ -313,9 +314,30 @@ type Props$f = {
313
314
  */
314
315
  onChange: (month: number, day: number, year: number) => void;
315
316
  numMonthsToShow?: number;
316
- chooseFromPast?: boolean;
317
+ dontAllowPast?: boolean;
318
+ dontAllowFuture?: boolean;
319
+ };
320
+ declare const SimpleDateChooser: React$1.FC<Props$g>;
321
+
322
+ /**
323
+ * A very simple, lightweight time chooser
324
+ * @author Gardenia Liu
325
+ */
326
+
327
+ type Props$f = {
328
+ ariaLabel: string;
329
+ name: string;
330
+ hour: number;
331
+ minute: number;
332
+ /**
333
+ * Handler for when time changes
334
+ * @param hour new 24hr hour number
335
+ * @param minute new minute number
336
+ */
337
+ onChange: (hour: number, minute: number) => void;
338
+ intervalMin?: number;
317
339
  };
318
- declare const SimpleDateChooser: React$1.FC<Props$f>;
340
+ declare const SimpleTimeChooser: React$1.FC<Props$f>;
319
341
 
320
342
  /**
321
343
  * Drawer container
@@ -1550,7 +1572,9 @@ declare enum ReactKitErrorCode {
1550
1572
  NoResponse = "DRK1",
1551
1573
  NoCode = "DRK2",
1552
1574
  SessionExpired = "DRK3",
1553
- NoCACCLSendRequestFunction = "DRK7"
1575
+ NoCACCLSendRequestFunction = "DRK7",
1576
+ SimpleDateChooserInvalidDateRange = "DRK35",
1577
+ SimpleDateChooserInvalidNumMonths = "DRK36"
1554
1578
  }
1555
1579
 
1556
- export { AppWrapper, AutoscrollToBottomContainer, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntry, DBEntryField, DBEntryFieldType, DBEntryManagerPanel, DayOfWeek, Drawer, Dropdown, DropdownItemType, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, IntelliTableColumn, ItemPicker, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_REVIEW_STATUS_ROUTE, LOG_ROUTE_PATH, LoadingSpinner, Log, LogAction, LogBuiltInMetadata, LogFunction, LogLevel, LogMainInfo, LogMetadataType, LogReviewer, LogSource, LogSourceSpecificInfo, LogType, LogTypeSpecificInfo, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, MultiSwitch, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, TabBox, ToggleSwitch, Tooltip, Variant, abbreviate, addFatalErrorHandler, alert, avg, canReviewLogs, capitalize, ceilToNumDecimals, combineClassNames, compareArraysByProp, confirm, everyAsync, extractProp, filterAsync, floorToNumDecimals, forEachAsync, forceNumIntoBounds, genCSV, genCommaList, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, getWordCount, idify, initClient, isMobileOrTablet, leaveToURL, logClientEvent, makeLinksClickable, mapAsync, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, prefixWithAOrAn, prompt, roundToNumDecimals, setClientEventMetadataPopulator, showFatalError, shuffleArray, someAsync, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, useForceRender, validateEmail, validatePhoneNumber, validateString, visitServerEndpoint, waitMs };
1580
+ export { AppWrapper, AutoscrollToBottomContainer, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntry, DBEntryField, DBEntryFieldType, DBEntryManagerPanel, DayOfWeek, Drawer, Dropdown, DropdownItemType, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, IntelliTableColumn, ItemPicker, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_REVIEW_STATUS_ROUTE, LOG_ROUTE_PATH, LoadingSpinner, Log, LogAction, LogBuiltInMetadata, LogFunction, LogLevel, LogMainInfo, LogMetadataType, LogReviewer, LogSource, LogSourceSpecificInfo, LogType, LogTypeSpecificInfo, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, MultiSwitch, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, SimpleTimeChooser, TabBox, ToggleSwitch, Tooltip, Variant, abbreviate, addFatalErrorHandler, alert, avg, canReviewLogs, capitalize, ceilToNumDecimals, combineClassNames, compareArraysByProp, confirm, everyAsync, extractProp, filterAsync, floorToNumDecimals, forEachAsync, forceNumIntoBounds, genCSV, genCommaList, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, getWordCount, idify, initClient, isMobileOrTablet, leaveToURL, logClientEvent, makeLinksClickable, mapAsync, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, prefixWithAOrAn, prompt, roundToNumDecimals, setClientEventMetadataPopulator, showFatalError, shuffleArray, someAsync, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, useForceRender, validateEmail, validatePhoneNumber, validateString, visitServerEndpoint, waitMs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "4.0.0",
3
+ "version": "4.0.2-beta-simple-date-chooser.1",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -1182,7 +1182,7 @@ const LogReviewer: React.FC<Props> = (props) => {
1182
1182
  year={dateFilterState.startDate.year}
1183
1183
  month={dateFilterState.startDate.month}
1184
1184
  day={dateFilterState.startDate.day}
1185
- chooseFromPast
1185
+ dontAllowFuture
1186
1186
  numMonthsToShow={36}
1187
1187
  onChange={(month, day, year) => {
1188
1188
  dateFilterState.startDate = { month, day, year };
@@ -1198,7 +1198,7 @@ const LogReviewer: React.FC<Props> = (props) => {
1198
1198
  year={dateFilterState.endDate.year}
1199
1199
  month={dateFilterState.endDate.month}
1200
1200
  day={dateFilterState.endDate.day}
1201
- chooseFromPast
1201
+ dontAllowFuture
1202
1202
  numMonthsToShow={12}
1203
1203
  onChange={(month, day, year) => {
1204
1204
  if (