@mackin.com/styleguide 9.11.4 → 9.12.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/index.d.ts CHANGED
@@ -328,6 +328,8 @@ interface DateInputProps extends BaseProps$4 {
328
328
  max?: number;
329
329
  /** Whether to move the popover on collision with the parent's bounds. Default is true. */
330
330
  reposition?: boolean;
331
+ /** If `true`, the paging buttons for the years will be shown. Default is only the month pagers. */
332
+ pageYear?: boolean;
331
333
  onValueChange: (value: number | undefined) => void;
332
334
  }
333
335
  declare const DateInput: React.ForwardRefExoticComponent<DateInputProps & React.RefAttributes<HTMLInputElement>>;
package/index.esm.js CHANGED
@@ -3,10 +3,10 @@ import React__default, { createContext, useContext, useEffect, useState, useRef,
3
3
  import { cx, css, keyframes, injectGlobal } from '@emotion/css';
4
4
  import { faCheckCircle, faCircle, faChevronDown, faChevronUp, faSquare, faTimesCircle } from '@fortawesome/pro-regular-svg-icons';
5
5
  import { faPlus, faTrashAlt, faSave, faCrow, faTimes, faSync, faCheckSquare } from '@fortawesome/pro-solid-svg-icons';
6
- import { faWifi, faWifiSlash, faBars, faSearch, faQuestionCircle, faNarwhal, faChevronRight, faChevronLeft, faCloudDownload, faCloudUpload, faCalendarAlt, faCopy, faPaste, faEyeSlash, faEye } from '@fortawesome/pro-light-svg-icons';
6
+ import { faWifi, faWifiSlash, faBars, faSearch, faQuestionCircle, faNarwhal, faChevronRight, faChevronLeft, faCloudDownload, faCloudUpload, faChevronDoubleLeft, faChevronDoubleRight, faCalendarAlt, faCopy, faPaste, faEyeSlash, faEye } from '@fortawesome/pro-light-svg-icons';
7
7
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
8
8
  import { uniqueId, sumBy, orderBy, get } from 'lodash';
9
- import { getDaysInMonth, getDay, isSameMonth, isBefore, isAfter, isSameDay, format, endOfMonth, addMonths, startOfMonth, isExists } from 'date-fns';
9
+ import { getDaysInMonth, getDay, isSameMonth, isBefore, isAfter, isSameDay, format, endOfYear, addYears, endOfMonth, addMonths, startOfMonth, startOfYear, isExists } from 'date-fns';
10
10
  import { createPortal } from 'react-dom';
11
11
  import { Popover as Popover$1, ArrowContainer } from 'react-tiny-popover';
12
12
  import { Link as Link$1 } from 'react-router-dom';
@@ -67,6 +67,8 @@ const ICONS = {
67
67
  unselected: faSquare,
68
68
  pagerLeft: faChevronLeft,
69
69
  pagerRight: faChevronRight,
70
+ pagerDoubleLeft: faChevronDoubleLeft,
71
+ pagerDoubleRight: faChevronDoubleRight,
70
72
  sortAsc: faChevronUp,
71
73
  sortDesc: faChevronDown,
72
74
  pickDate: faCalendarAlt,
@@ -2390,7 +2392,7 @@ const DateInput = React.forwardRef((props, ref) => {
2390
2392
  }
2391
2393
  }, [dateValue, showCalendar]);
2392
2394
  const popover = React.useRef(null);
2393
- const nativeProps = __rest(props, ["customError", "reposition", "onValueChange", "allowUpdateOnFocus"]);
2395
+ const nativeProps = __rest(props, ["customError", "reposition", "onValueChange", "allowUpdateOnFocus", "pageYear"]);
2394
2396
  useIgnoreMount(() => {
2395
2397
  var _a;
2396
2398
  /*
@@ -2467,6 +2469,8 @@ const DateInput = React.forwardRef((props, ref) => {
2467
2469
  justifyContent: 'space-between',
2468
2470
  alignItems: 'center'
2469
2471
  }) },
2472
+ props.pageYear && (React.createElement(Button, { disabled: !!props.min && isBefore(endOfYear(addYears(calendarDate, -1)), props.min), small: true, variant: "icon", onClick: () => setCalendarDate(addYears(calendarDate, -1)) },
2473
+ React.createElement(Icon, { id: "pagerDoubleLeft" }))),
2470
2474
  React.createElement(Button, { disabled: !!props.min && isBefore(endOfMonth(addMonths(calendarDate, -1)), props.min), small: true, variant: "icon", onClick: () => setCalendarDate(addMonths(calendarDate, -1)) },
2471
2475
  React.createElement(Icon, { id: "pagerLeft" })),
2472
2476
  React.createElement(Text, { align: "center" },
@@ -2474,7 +2478,9 @@ const DateInput = React.forwardRef((props, ref) => {
2474
2478
  " ",
2475
2479
  calendarDate.getFullYear()),
2476
2480
  React.createElement(Button, { disabled: !!props.max && isAfter(startOfMonth(addMonths(calendarDate, 1)), props.max), small: true, variant: "icon", onClick: () => setCalendarDate(addMonths(calendarDate, 1)) },
2477
- React.createElement(Icon, { id: "pagerRight" }))), month: calendarDate.getMonth() + 1, year: calendarDate.getFullYear(), showCurrent: true, smallHeader: true, selectedValue: dateValue, cellSize: '2rem', min: props.min, max: props.max }))) }));
2481
+ React.createElement(Icon, { id: "pagerRight" })),
2482
+ props.pageYear && (React.createElement(Button, { disabled: !!props.max && isAfter(startOfYear(addYears(calendarDate, 1)), props.max), small: true, variant: "icon", onClick: () => setCalendarDate(addYears(calendarDate, 1)) },
2483
+ React.createElement(Icon, { id: "pagerDoubleRight" })))), month: calendarDate.getMonth() + 1, year: calendarDate.getFullYear(), showCurrent: true, smallHeader: true, selectedValue: dateValue, cellSize: '2rem', min: props.min, max: props.max }))) }));
2478
2484
  });
2479
2485
  const parseDateNumber = (rawValue) => {
2480
2486
  if (!rawValue) {
package/index.js CHANGED
@@ -94,6 +94,8 @@ const ICONS = {
94
94
  unselected: proRegularSvgIcons.faSquare,
95
95
  pagerLeft: proLightSvgIcons.faChevronLeft,
96
96
  pagerRight: proLightSvgIcons.faChevronRight,
97
+ pagerDoubleLeft: proLightSvgIcons.faChevronDoubleLeft,
98
+ pagerDoubleRight: proLightSvgIcons.faChevronDoubleRight,
97
99
  sortAsc: proRegularSvgIcons.faChevronUp,
98
100
  sortDesc: proRegularSvgIcons.faChevronDown,
99
101
  pickDate: proLightSvgIcons.faCalendarAlt,
@@ -2417,7 +2419,7 @@ const DateInput = React__namespace.forwardRef((props, ref) => {
2417
2419
  }
2418
2420
  }, [dateValue, showCalendar]);
2419
2421
  const popover = React__namespace.useRef(null);
2420
- const nativeProps = __rest(props, ["customError", "reposition", "onValueChange", "allowUpdateOnFocus"]);
2422
+ const nativeProps = __rest(props, ["customError", "reposition", "onValueChange", "allowUpdateOnFocus", "pageYear"]);
2421
2423
  useIgnoreMount(() => {
2422
2424
  var _a;
2423
2425
  /*
@@ -2494,6 +2496,8 @@ const DateInput = React__namespace.forwardRef((props, ref) => {
2494
2496
  justifyContent: 'space-between',
2495
2497
  alignItems: 'center'
2496
2498
  }) },
2499
+ props.pageYear && (React__namespace.createElement(Button, { disabled: !!props.min && dateFns.isBefore(dateFns.endOfYear(dateFns.addYears(calendarDate, -1)), props.min), small: true, variant: "icon", onClick: () => setCalendarDate(dateFns.addYears(calendarDate, -1)) },
2500
+ React__namespace.createElement(Icon, { id: "pagerDoubleLeft" }))),
2497
2501
  React__namespace.createElement(Button, { disabled: !!props.min && dateFns.isBefore(dateFns.endOfMonth(dateFns.addMonths(calendarDate, -1)), props.min), small: true, variant: "icon", onClick: () => setCalendarDate(dateFns.addMonths(calendarDate, -1)) },
2498
2502
  React__namespace.createElement(Icon, { id: "pagerLeft" })),
2499
2503
  React__namespace.createElement(Text, { align: "center" },
@@ -2501,7 +2505,9 @@ const DateInput = React__namespace.forwardRef((props, ref) => {
2501
2505
  " ",
2502
2506
  calendarDate.getFullYear()),
2503
2507
  React__namespace.createElement(Button, { disabled: !!props.max && dateFns.isAfter(dateFns.startOfMonth(dateFns.addMonths(calendarDate, 1)), props.max), small: true, variant: "icon", onClick: () => setCalendarDate(dateFns.addMonths(calendarDate, 1)) },
2504
- React__namespace.createElement(Icon, { id: "pagerRight" }))), month: calendarDate.getMonth() + 1, year: calendarDate.getFullYear(), showCurrent: true, smallHeader: true, selectedValue: dateValue, cellSize: '2rem', min: props.min, max: props.max }))) }));
2508
+ React__namespace.createElement(Icon, { id: "pagerRight" })),
2509
+ props.pageYear && (React__namespace.createElement(Button, { disabled: !!props.max && dateFns.isAfter(dateFns.startOfYear(dateFns.addYears(calendarDate, 1)), props.max), small: true, variant: "icon", onClick: () => setCalendarDate(dateFns.addYears(calendarDate, 1)) },
2510
+ React__namespace.createElement(Icon, { id: "pagerDoubleRight" })))), month: calendarDate.getMonth() + 1, year: calendarDate.getFullYear(), showCurrent: true, smallHeader: true, selectedValue: dateValue, cellSize: '2rem', min: props.min, max: props.max }))) }));
2505
2511
  });
2506
2512
  const parseDateNumber = (rawValue) => {
2507
2513
  if (!rawValue) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mackin.com/styleguide",
3
- "version": "9.11.4",
3
+ "version": "9.12.0",
4
4
  "description": "",
5
5
  "main": "./index.js",
6
6
  "module": "./index.esm.js",