@activecollab/components 2.0.255 → 2.0.257

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.
Files changed (28) hide show
  1. package/dist/cjs/components/DatePicker/DatePicker.js +40 -16
  2. package/dist/cjs/components/DatePicker/DatePicker.js.map +1 -1
  3. package/dist/cjs/components/Select/Option/Option.js +1 -1
  4. package/dist/cjs/components/Select/Option/Option.js.map +1 -1
  5. package/dist/cjs/components/Select/Option/Styles.js +6 -1
  6. package/dist/cjs/components/Select/Option/Styles.js.map +1 -1
  7. package/dist/cjs/components/SelectDate/SelectDate.js +10 -10
  8. package/dist/cjs/components/SelectDate/SelectDate.js.map +1 -1
  9. package/dist/esm/components/DatePicker/DatePicker.d.ts +6 -6
  10. package/dist/esm/components/DatePicker/DatePicker.d.ts.map +1 -1
  11. package/dist/esm/components/DatePicker/DatePicker.js +37 -13
  12. package/dist/esm/components/DatePicker/DatePicker.js.map +1 -1
  13. package/dist/esm/components/Select/Option/Option.d.ts.map +1 -1
  14. package/dist/esm/components/Select/Option/Option.js +2 -2
  15. package/dist/esm/components/Select/Option/Option.js.map +1 -1
  16. package/dist/esm/components/Select/Option/Styles.d.ts +1 -0
  17. package/dist/esm/components/Select/Option/Styles.d.ts.map +1 -1
  18. package/dist/esm/components/Select/Option/Styles.js +5 -0
  19. package/dist/esm/components/Select/Option/Styles.js.map +1 -1
  20. package/dist/esm/components/SelectDate/SelectDate.d.ts +6 -6
  21. package/dist/esm/components/SelectDate/SelectDate.d.ts.map +1 -1
  22. package/dist/esm/components/SelectDate/SelectDate.js +7 -7
  23. package/dist/esm/components/SelectDate/SelectDate.js.map +1 -1
  24. package/dist/index.js +56 -27
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.min.js +1 -1
  27. package/dist/index.min.js.map +1 -1
  28. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import React, { forwardRef, useCallback } from "react";
2
2
  import classnames from "classnames";
3
- import { StyledOption } from "./Styles";
3
+ import { StyledOption, StyledOptionContent } from "./Styles";
4
4
  export const Option = /*#__PURE__*/forwardRef((_ref, ref) => {
5
5
  let {
6
6
  id,
@@ -25,7 +25,7 @@ export const Option = /*#__PURE__*/forwardRef((_ref, ref) => {
25
25
  className: classnames("c-option", className),
26
26
  hover: hover,
27
27
  onClick: onClick
28
- }, renderOption ? renderOption : name);
28
+ }, /*#__PURE__*/React.createElement(StyledOptionContent, null, renderOption ? renderOption : name));
29
29
  });
30
30
  Option.displayName = "Option";
31
31
  //# sourceMappingURL=Option.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Option.js","names":["React","forwardRef","useCallback","classnames","StyledOption","Option","_ref","ref","id","name","tooltip","hover","className","renderOption","onMouseEnter","onClick","handleOnMouseEnter","createElement","title","onTouchStart","displayName"],"sources":["../../../../../src/components/Select/Option/Option.tsx"],"sourcesContent":["import React, {\n forwardRef,\n MouseEventHandler,\n ReactNode,\n Ref,\n useCallback,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { StyledOption } from \"./Styles\";\n\nexport interface IOptionItemProps {\n /** Value of option */\n id: string | number;\n /** Label of option */\n name: string;\n /** Content for tooltip */\n tooltip?: string;\n /** Additional info right-side of name */\n additionalInfo?: string;\n /** image url for Avatar or MultiAvatar */\n image?: string | string[];\n /** Hex color for label */\n color?: string;\n /** Color for chip label */\n chipColor?: string;\n /** Value of mixed */\n mixed?: boolean;\n /** Hide option */\n hidden?: boolean;\n}\n\ninterface IAdditionalOptionItemProps {\n /** Value of option */\n id?: string | number;\n /** Label of option */\n name: string;\n /** Content for tooltip */\n tooltip?: string;\n /** Hovered state */\n hover?: boolean;\n /** Class name of option */\n className?: string;\n /** Render option function */\n renderOption?: ReactNode;\n /** On mouse enter callback */\n onMouseEnter?: (e: string | number | undefined) => void;\n /** On mouse click */\n onClick?: MouseEventHandler<HTMLLIElement>;\n}\n\nexport const Option = forwardRef(\n (\n {\n id,\n name,\n tooltip = \"\",\n hover,\n className,\n renderOption,\n onMouseEnter,\n onClick = () => null,\n }: IAdditionalOptionItemProps,\n ref: Ref<HTMLLIElement>\n ) => {\n const handleOnMouseEnter = useCallback(() => {\n if (onMouseEnter) {\n onMouseEnter(id);\n }\n }, [onMouseEnter, id]);\n\n return (\n <StyledOption\n ref={hover ? ref : null}\n title={tooltip ? tooltip : name}\n onMouseEnter={handleOnMouseEnter}\n onTouchStart={handleOnMouseEnter}\n className={classnames(\"c-option\", className)}\n hover={hover}\n onClick={onClick}\n >\n {renderOption ? renderOption : name}\n </StyledOption>\n );\n }\n);\n\nOption.displayName = \"Option\";\n"],"mappings":"AAAA,OAAOA,KAAK,IACVC,UAAU,EAIVC,WAAW,QACN,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,YAAY,QAAQ,UAAU;AA0CvC,OAAO,MAAMC,MAAM,gBAAGJ,UAAU,CAC9B,CAAAK,IAAA,EAWEC,GAAuB,KACpB;EAAA,IAXH;IACEC,EAAE;IACFC,IAAI;IACJC,OAAO,GAAG,EAAE;IACZC,KAAK;IACLC,SAAS;IACTC,YAAY;IACZC,YAAY;IACZC,OAAO,GAAGA,CAAA,KAAM;EACU,CAAC,GAAAT,IAAA;EAG7B,MAAMU,kBAAkB,GAAGd,WAAW,CAAC,MAAM;IAC3C,IAAIY,YAAY,EAAE;MAChBA,YAAY,CAACN,EAAE,CAAC;IAClB;EACF,CAAC,EAAE,CAACM,YAAY,EAAEN,EAAE,CAAC,CAAC;EAEtB,oBACER,KAAA,CAAAiB,aAAA,CAACb,YAAY;IACXG,GAAG,EAAEI,KAAK,GAAGJ,GAAG,GAAG,IAAK;IACxBW,KAAK,EAAER,OAAO,GAAGA,OAAO,GAAGD,IAAK;IAChCK,YAAY,EAAEE,kBAAmB;IACjCG,YAAY,EAAEH,kBAAmB;IACjCJ,SAAS,EAAET,UAAU,CAAC,UAAU,EAAES,SAAS,CAAE;IAC7CD,KAAK,EAAEA,KAAM;IACbI,OAAO,EAAEA;EAAQ,GAEhBF,YAAY,GAAGA,YAAY,GAAGJ,IACnB,CAAC;AAEnB,CACF,CAAC;AAEDJ,MAAM,CAACe,WAAW,GAAG,QAAQ"}
1
+ {"version":3,"file":"Option.js","names":["React","forwardRef","useCallback","classnames","StyledOption","StyledOptionContent","Option","_ref","ref","id","name","tooltip","hover","className","renderOption","onMouseEnter","onClick","handleOnMouseEnter","createElement","title","onTouchStart","displayName"],"sources":["../../../../../src/components/Select/Option/Option.tsx"],"sourcesContent":["import React, {\n forwardRef,\n MouseEventHandler,\n ReactNode,\n Ref,\n useCallback,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { StyledOption, StyledOptionContent } from \"./Styles\";\n\nexport interface IOptionItemProps {\n /** Value of option */\n id: string | number;\n /** Label of option */\n name: string;\n /** Content for tooltip */\n tooltip?: string;\n /** Additional info right-side of name */\n additionalInfo?: string;\n /** image url for Avatar or MultiAvatar */\n image?: string | string[];\n /** Hex color for label */\n color?: string;\n /** Color for chip label */\n chipColor?: string;\n /** Value of mixed */\n mixed?: boolean;\n /** Hide option */\n hidden?: boolean;\n}\n\ninterface IAdditionalOptionItemProps {\n /** Value of option */\n id?: string | number;\n /** Label of option */\n name: string;\n /** Content for tooltip */\n tooltip?: string;\n /** Hovered state */\n hover?: boolean;\n /** Class name of option */\n className?: string;\n /** Render option function */\n renderOption?: ReactNode;\n /** On mouse enter callback */\n onMouseEnter?: (e: string | number | undefined) => void;\n /** On mouse click */\n onClick?: MouseEventHandler<HTMLLIElement>;\n}\n\nexport const Option = forwardRef(\n (\n {\n id,\n name,\n tooltip = \"\",\n hover,\n className,\n renderOption,\n onMouseEnter,\n onClick = () => null,\n }: IAdditionalOptionItemProps,\n ref: Ref<HTMLLIElement>\n ) => {\n const handleOnMouseEnter = useCallback(() => {\n if (onMouseEnter) {\n onMouseEnter(id);\n }\n }, [onMouseEnter, id]);\n\n return (\n <StyledOption\n ref={hover ? ref : null}\n title={tooltip ? tooltip : name}\n onMouseEnter={handleOnMouseEnter}\n onTouchStart={handleOnMouseEnter}\n className={classnames(\"c-option\", className)}\n hover={hover}\n onClick={onClick}\n >\n <StyledOptionContent>\n {renderOption ? renderOption : name}\n </StyledOptionContent>\n </StyledOption>\n );\n }\n);\n\nOption.displayName = \"Option\";\n"],"mappings":"AAAA,OAAOA,KAAK,IACVC,UAAU,EAIVC,WAAW,QACN,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,YAAY,EAAEC,mBAAmB,QAAQ,UAAU;AA0C5D,OAAO,MAAMC,MAAM,gBAAGL,UAAU,CAC9B,CAAAM,IAAA,EAWEC,GAAuB,KACpB;EAAA,IAXH;IACEC,EAAE;IACFC,IAAI;IACJC,OAAO,GAAG,EAAE;IACZC,KAAK;IACLC,SAAS;IACTC,YAAY;IACZC,YAAY;IACZC,OAAO,GAAGA,CAAA,KAAM;EACU,CAAC,GAAAT,IAAA;EAG7B,MAAMU,kBAAkB,GAAGf,WAAW,CAAC,MAAM;IAC3C,IAAIa,YAAY,EAAE;MAChBA,YAAY,CAACN,EAAE,CAAC;IAClB;EACF,CAAC,EAAE,CAACM,YAAY,EAAEN,EAAE,CAAC,CAAC;EAEtB,oBACET,KAAA,CAAAkB,aAAA,CAACd,YAAY;IACXI,GAAG,EAAEI,KAAK,GAAGJ,GAAG,GAAG,IAAK;IACxBW,KAAK,EAAER,OAAO,GAAGA,OAAO,GAAGD,IAAK;IAChCK,YAAY,EAAEE,kBAAmB;IACjCG,YAAY,EAAEH,kBAAmB;IACjCJ,SAAS,EAAEV,UAAU,CAAC,UAAU,EAAEU,SAAS,CAAE;IAC7CD,KAAK,EAAEA,KAAM;IACbI,OAAO,EAAEA;EAAQ,gBAEjBhB,KAAA,CAAAkB,aAAA,CAACb,mBAAmB,QACjBS,YAAY,GAAGA,YAAY,GAAGJ,IACZ,CACT,CAAC;AAEnB,CACF,CAAC;AAEDJ,MAAM,CAACe,WAAW,GAAG,QAAQ"}
@@ -1,4 +1,5 @@
1
1
  export declare const StyledOption: import("styled-components").StyledComponent<"li", any, {
2
2
  hover?: boolean | undefined;
3
3
  }, never>;
4
+ export declare const StyledOptionContent: import("styled-components").StyledComponent<"span", any, {}, never>;
4
5
  //# sourceMappingURL=Styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/Select/Option/Styles.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY;;SAyBxB,CAAC"}
1
+ {"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/Select/Option/Styles.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY;;SAyBxB,CAAC;AAIF,eAAO,MAAM,mBAAmB,qEAK/B,CAAC"}
@@ -9,4 +9,9 @@ export const StyledOption = styled.li.withConfig({
9
9
  "fontWeight": "400"
10
10
  }, FontStyle, BoxSizingStyle, props => props.hover && css(["background-color:var(--color-theme-200);"]));
11
11
  StyledOption.displayName = "StyledOption";
12
+ export const StyledOptionContent = styled.span.withConfig({
13
+ displayName: "Styles__StyledOptionContent",
14
+ componentId: "sc-1232l97-1"
15
+ })(["display:flex;align-items:center;width:100%;justify-content:space-between;"]);
16
+ StyledOptionContent.displayName = "StyledOptionContent";
12
17
  //# sourceMappingURL=Styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","FontStyle","StyledOption","li","withConfig","displayName","componentId","props","hover"],"sources":["../../../../../src/components/Select/Option/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport tw from \"twin.macro\";\n\nimport { BoxSizingStyle } from \"../../BoxSizingStyle\";\nimport { FontStyle } from \"../../FontStyle\";\n\nexport const StyledOption = styled.li<{ hover?: boolean }>`\n ${tw`tw-select-none tw-font-normal`}\n font-size: 14px;\n display: flex;\n justify-content: space-between;\n height: 28px;\n padding-left: 16px;\n padding-right: 16px;\n margin-top: 4px;\n margin-bottom: 4px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n transition-duration: 0.1s;\n color: var(--color-theme-900);\n\n ${FontStyle}\n ${BoxSizingStyle}\n\n ${(props) =>\n props.hover &&\n css`\n background-color: var(--color-theme-200);\n `}\n`;\n\nStyledOption.displayName = \"StyledOption\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAG/C,SAASC,cAAc,QAAQ,sBAAsB;AACrD,SAASC,SAAS,QAAQ,iBAAiB;AAE3C,OAAO,MAAMC,YAAY,GAAGJ,MAAM,CAACK,EAAE,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,2SAC/B;EAAA;EAAA;AAA8B,CAAC,EAgBjCL,SAAS,EACTD,cAAc,EAEbO,KAAK,IACNA,KAAK,CAACC,KAAK,IACXT,GAAG,8CAEF,CACJ;AAEDG,YAAY,CAACG,WAAW,GAAG,cAAc"}
1
+ {"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","FontStyle","StyledOption","li","withConfig","displayName","componentId","props","hover","StyledOptionContent","span"],"sources":["../../../../../src/components/Select/Option/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport tw from \"twin.macro\";\n\nimport { BoxSizingStyle } from \"../../BoxSizingStyle\";\nimport { FontStyle } from \"../../FontStyle\";\n\nexport const StyledOption = styled.li<{ hover?: boolean }>`\n ${tw`tw-select-none tw-font-normal`}\n font-size: 14px;\n display: flex;\n justify-content: space-between;\n height: 28px;\n padding-left: 16px;\n padding-right: 16px;\n margin-top: 4px;\n margin-bottom: 4px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n transition-duration: 0.1s;\n color: var(--color-theme-900);\n\n ${FontStyle}\n ${BoxSizingStyle}\n\n ${(props) =>\n props.hover &&\n css`\n background-color: var(--color-theme-200);\n `}\n`;\n\nStyledOption.displayName = \"StyledOption\";\n\nexport const StyledOptionContent = styled.span`\n display: flex;\n align-items: center;\n width: 100%;\n justify-content: space-between;\n`;\n\nStyledOptionContent.displayName = \"StyledOptionContent\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAG/C,SAASC,cAAc,QAAQ,sBAAsB;AACrD,SAASC,SAAS,QAAQ,iBAAiB;AAE3C,OAAO,MAAMC,YAAY,GAAGJ,MAAM,CAACK,EAAE,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,2SAC/B;EAAA;EAAA;AAA8B,CAAC,EAgBjCL,SAAS,EACTD,cAAc,EAEbO,KAAK,IACNA,KAAK,CAACC,KAAK,IACXT,GAAG,8CAEF,CACJ;AAEDG,YAAY,CAACG,WAAW,GAAG,cAAc;AAEzC,OAAO,MAAMI,mBAAmB,GAAGX,MAAM,CAACY,IAAI,CAAAN,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,iFAK7C;AAEDG,mBAAmB,CAACJ,WAAW,GAAG,qBAAqB"}
@@ -16,14 +16,14 @@ export interface ISelectDate {
16
16
  cancelButtonText?: string;
17
17
  /** Clear button text */
18
18
  clearButtonText?: string;
19
- /** Modal header text */
20
- modalHeaderText?: string;
19
+ /** Modal title text */
20
+ modalTitle?: string;
21
+ /** Modal description text */
22
+ modalDescription?: string;
23
+ /** Modal save button text */
24
+ modalSaveBtnText?: string;
21
25
  /** Modal cancel button text */
22
26
  modalCancelBtnText?: string;
23
- /** Modal discard button text */
24
- modalDiscardBtnText?: string;
25
- /** Modal discard message text */
26
- modalDiscardMessage?: string;
27
27
  /** Tooltip text */
28
28
  tooltipText?: string;
29
29
  /** Called when day is clicked */
@@ -1 +1 @@
1
- {"version":3,"file":"SelectDate.d.ts","sourceRoot":"","sources":["../../../../src/components/SelectDate/SelectDate.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,WAAW,EAAE,EAAE,EAAW,aAAa,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,MAAM,EA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AAyC;IACzC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,wCAAwC;IACxC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,2BAA2B;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,yBAAyB;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,WAAW,CAuPtC,CAAC"}
@@ -31,10 +31,10 @@ export const SelectDate = _ref => {
31
31
  saveButtonText = "Save",
32
32
  cancelButtonText = "Cancel",
33
33
  clearButtonText = "Clear",
34
- modalHeaderText = "Discard changes?",
35
- modalDiscardMessage = "All unsaved changes will be lost.",
36
- modalDiscardBtnText = "OK",
37
- modalCancelBtnText = "Cancel",
34
+ modalTitle = "Save Changes",
35
+ modalDescription = "You updated the date. Would you like to save this change?",
36
+ modalSaveBtnText = "Save",
37
+ modalCancelBtnText = "Discard",
38
38
  onDayClick,
39
39
  onSave,
40
40
  onCancel,
@@ -178,9 +178,9 @@ export const SelectDate = _ref => {
178
178
  onChange: onChange,
179
179
  onClose: onCancel,
180
180
  modifiers: modifiers,
181
- modalHeaderText: modalHeaderText,
182
- modalDiscardMessage: modalDiscardMessage,
183
- modalDiscardBtnText: modalDiscardBtnText,
181
+ modalTitle: modalTitle,
182
+ modalDescription: modalDescription,
183
+ modalSaveBtnText: modalSaveBtnText,
184
184
  modalCancelBtnText: modalCancelBtnText,
185
185
  disabledDaysBefore: disableDaysBefore,
186
186
  disabledDaysAfter: disabledDaysAfter,
@@ -1 +1 @@
1
- {"version":3,"file":"SelectDate.js","names":["React","useMemo","classnames","moment","SelectDateTarget","StyledSelectDate","StyledSelectDateButton","formatDate","DatePicker","toMoment","isDayInRange","day","data","fromMoment","unix","from","utc","to","repeating","year","month","date","isSameOrAfter","isSameOrBefore","SelectDate","_ref","changeMode","mode","trigger","labelType","saveButtonText","cancelButtonText","clearButtonText","modalHeaderText","modalDiscardMessage","modalDiscardBtnText","modalCancelBtnText","onDayClick","onSave","onCancel","onToggleDatePicker","required","dateRequired","longDateFormat","defaultShowDatePicker","firstDayOfWeek","selectedDays","selectionMode","menuClassName","targetClassName","icon","defaultLabelText","targetTextClassName","targetIconClassName","backgroundElementClass","dateFormat","forceClose","defaultMonth","daysToModify","weekends","weekendLabel","nonWorkingDaysOfWeek","nonWorkingDaysOfWeekLabel","weekendIsSelectable","tooltipText","popperTooltipClassName","popperClassName","popperTooltipStyle","position","disableDaysBefore","enableYearPicker","disableAnimations","disabledDaysAfter","onChange","labelText","formattedEndDate","formattedStartDate","isSame","modifiers","userAvailabilities","filter","type","globalDaysOff","selectableGlobalDaysOff","userAvailability","matchedData","find","matched","title","weekend","isWeekend","includes","nonWorkingDay","nonWorkingDays","isNonWorkingDay","day_disabled","globalDayOff","renderTargetEl","createElement","className","target","instant","selected","saveLabel","cancelLabel","clearLabel","onClose","disabledDaysBefore","disabled","open","onCalendarToggle","enableConfirmModal","disableYearPicker","showControls","displayName"],"sources":["../../../../src/components/SelectDate/SelectDate.tsx"],"sourcesContent":["import React, { ElementType, FC, useMemo, CSSProperties } from \"react\";\n\nimport { Placement } from \"@popperjs/core\";\nimport classnames from \"classnames\";\nimport { Moment } from \"moment\";\nimport moment from \"moment-timezone\";\n\nimport { SelectDateTarget } from \"./SelectDateTarget\";\nimport { StyledSelectDate, StyledSelectDateButton } from \"./Styles\";\nimport { DaysToModify } from \"./types\";\nimport { formatDate } from \"../../utils/dateUtils\";\nimport {\n ChangeMode,\n DatePicker,\n TimestampDateRange,\n toMoment,\n} from \"../DatePicker/DatePicker\";\n\ntype TriggerStringType = \"text\" | \"icon\" | \"inline\";\ntype TriggerFunctionType = (text: string) => JSX.Element;\n\nconst isDayInRange = (day: Moment, data: DaysToModify): boolean => {\n const fromMoment = moment.unix(data.from).utc();\n const toMoment = moment.unix(data.to).utc();\n\n if (data.repeating) {\n const year = day.year();\n const from = moment.utc({\n year,\n month: fromMoment.month(),\n date: fromMoment.date(),\n });\n const to = moment.utc({\n year,\n month: toMoment.month(),\n date: toMoment.date(),\n });\n\n return day.isSameOrAfter(from, \"day\") && day.isSameOrBefore(to, \"day\");\n }\n\n return (\n day.isSameOrAfter(fromMoment, \"day\") && day.isSameOrBefore(toMoment, \"day\")\n );\n};\n\nexport interface ISelectDate {\n /** Change mode - can be atomic and instant */\n changeMode?: \"atomic\" | \"instant\";\n /** Trigger - can be text, icon, inline, or custom render function */\n trigger?: TriggerStringType | TriggerFunctionType;\n /** Save button text */\n saveButtonText?: string;\n /** Cancel button text */\n cancelButtonText?: string;\n /** Clear button text */\n clearButtonText?: string;\n /** Modal header text */\n modalHeaderText?: string;\n /** Modal cancel button text */\n modalCancelBtnText?: string;\n /** Modal discard button text */\n modalDiscardBtnText?: string;\n /** Modal discard message text */\n modalDiscardMessage?: string;\n /** Tooltip text */\n tooltipText?: string;\n /** Called when day is clicked */\n onDayClick?: (day: Moment, modifiers: string[]) => void;\n /** Save changes callback */\n onSave?: (dates?: TimestampDateRange) => void;\n /** Changing dates callback */\n onChange?: (dates?: TimestampDateRange) => void;\n /** On cancel closes datepicker or opens discard modal in atomic mode */\n onCancel?: () => void;\n /** Clear dates when they are not required */\n onClear?: () => void;\n /** Use this callback to get is picker visible */\n onToggleDatePicker?: (value: boolean) => void;\n /** Force close */\n forceClose?: boolean;\n /** Set selected day or days */\n selectedDays?: TimestampDateRange;\n /** Set month */\n defaultMonth?: Moment;\n /** Set selection range */\n selectionMode?: ChangeMode;\n /** Set is date required */\n required?: boolean;\n /** Set default show on date picker (only for text and icon mode) */\n defaultShowDatePicker?: boolean;\n /** Long date format (Always show year) */\n longDateFormat?: boolean;\n /** Set first day of week */\n firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n /** One of icon types */\n icon?: ElementType;\n /** Default Label text */\n defaultLabelText?: string;\n /** Date format */\n dateFormat?: string;\n /** Menu classes */\n menuClassName?: string;\n /** Target element classes */\n targetClassName?: string;\n /** Target element text classes */\n targetTextClassName?: string;\n /** Target element icon classes */\n targetIconClassName?: string;\n /** Background style for clickable element after the menu is open (opacity, color, etc...) */\n backgroundElementClass?: string;\n /** Days to modify */\n daysToModify?: DaysToModify[];\n /** Array of weekend days */\n weekends?: number[];\n /** Weekend label */\n weekendLabel?: string;\n /** Array of nonworking week days */\n nonWorkingDaysOfWeek?: number[];\n /** Nonworking week days label */\n nonWorkingDaysOfWeekLabel?: string;\n /** Allows weekends to be selected */\n weekendIsSelectable?: boolean;\n /** Popper Tooltip style */\n popperTooltipStyle?: CSSProperties;\n /** Popper Tooltip class name*/\n popperTooltipClassName?: string;\n /** Popper class name*/\n popperClassName?: string;\n /** Position of selectDate menu */\n position?: Placement;\n /** Disable days before specified date */\n disableDaysBefore?: Moment;\n /** Disable days after specified date */\n disabledDaysAfter?: Moment;\n /** Enable year selector */\n enableYearPicker?: boolean;\n /** Disable aniamtions */\n disableAnimations?: boolean;\n}\n\nexport const SelectDate: FC<ISelectDate> = ({\n changeMode: mode = \"instant\",\n trigger: labelType = \"text\",\n saveButtonText = \"Save\",\n cancelButtonText = \"Cancel\",\n clearButtonText = \"Clear\",\n modalHeaderText = \"Discard changes?\",\n modalDiscardMessage = \"All unsaved changes will be lost.\",\n modalDiscardBtnText = \"OK\",\n modalCancelBtnText = \"Cancel\",\n onDayClick,\n onSave,\n onCancel,\n onToggleDatePicker,\n required: dateRequired = false,\n longDateFormat = false,\n defaultShowDatePicker = false,\n firstDayOfWeek = 0,\n selectedDays,\n selectionMode = \"custom\",\n menuClassName,\n targetClassName,\n icon,\n defaultLabelText = \"Set...\",\n targetTextClassName,\n targetIconClassName,\n backgroundElementClass,\n dateFormat,\n forceClose,\n defaultMonth,\n daysToModify = [],\n weekends = [],\n weekendLabel = \"Weekend\",\n nonWorkingDaysOfWeek = [],\n nonWorkingDaysOfWeekLabel = \"Unavailable\",\n weekendIsSelectable = false,\n tooltipText,\n popperTooltipClassName,\n popperClassName,\n popperTooltipStyle,\n position,\n disableDaysBefore,\n enableYearPicker,\n disableAnimations,\n disabledDaysAfter,\n onChange,\n}) => {\n const labelText = useMemo(() => {\n if (!selectedDays) {\n return defaultLabelText;\n } else if (!selectedDays.from && !selectedDays.to) {\n return defaultLabelText;\n } else {\n const formattedEndDate = selectedDays.to\n ? formatDate(toMoment(selectedDays.to), dateFormat, longDateFormat)\n : \"\";\n const formattedStartDate = selectedDays.from\n ? formatDate(toMoment(selectedDays?.from), dateFormat, longDateFormat)\n : \"\";\n\n if (\n selectedDays.to &&\n selectedDays.from &&\n toMoment(selectedDays.from).isSame(toMoment(selectedDays.to))\n ) {\n return formattedEndDate;\n }\n\n if (!selectedDays.to && selectedDays.from) {\n return formattedStartDate;\n }\n\n return `${formattedStartDate} - ${formattedEndDate}`;\n }\n }, [selectedDays, dateFormat, defaultLabelText, longDateFormat]);\n\n const modifiers = useMemo(() => {\n const userAvailabilities = daysToModify.filter(\n (data) => data.type === \"user_day_off\"\n );\n const globalDaysOff = daysToModify.filter(\n (data) => data.type === \"global_day_off\"\n );\n const selectableGlobalDaysOff = daysToModify.filter(\n (data) => data.type === \"selectable_global_day_off\"\n );\n\n return {\n userAvailability: (day: Moment) => {\n const matchedData = userAvailabilities.find((data) =>\n isDayInRange(day, data)\n );\n return {\n matched: !!matchedData,\n title: matchedData ? matchedData.title : null,\n };\n },\n weekend: (day: Moment) => {\n const isWeekend = weekends.includes(day.day());\n return {\n matched: isWeekend,\n title: isWeekend ? weekendLabel : null,\n };\n },\n nonWorkingDay: (day: Moment) => {\n if (weekends.includes(day.day())) {\n return { matched: true, title: \"\" };\n }\n const nonWorkingDays = [...selectableGlobalDaysOff, ...globalDaysOff];\n\n const matchedData = nonWorkingDays.find((data) =>\n isDayInRange(day, data)\n );\n return {\n matched: !!matchedData,\n title: matchedData ? matchedData.title : null,\n };\n },\n nonWorkingDaysOfWeek: (day: Moment) => {\n const isNonWorkingDay = nonWorkingDaysOfWeek.includes(day.day());\n return {\n matched: isNonWorkingDay,\n title: isNonWorkingDay ? nonWorkingDaysOfWeekLabel : null,\n };\n },\n day_disabled: (day: Moment) => {\n const globalDayOff = globalDaysOff.find((data) =>\n isDayInRange(day, data)\n );\n\n return {\n matched: !!globalDayOff,\n title: null,\n };\n },\n };\n }, [\n daysToModify,\n nonWorkingDaysOfWeek,\n nonWorkingDaysOfWeekLabel,\n weekendLabel,\n weekends,\n ]);\n\n const renderTargetEl = useMemo(() => {\n if (labelType === \"icon\" && icon) {\n return (\n <SelectDateTarget\n icon={icon}\n title={tooltipText}\n targetIconClassName={targetIconClassName}\n popperTooltipClassName={popperTooltipClassName}\n popperTooltipStyle={popperTooltipStyle}\n />\n );\n }\n if (typeof labelType === \"function\") {\n return labelType(labelText);\n }\n return (\n <StyledSelectDateButton\n type=\"button\"\n className={classnames(\"date-picker-target\", targetClassName)}\n >\n <span className={targetTextClassName}>{labelText}</span>\n </StyledSelectDateButton>\n );\n }, [\n icon,\n labelText,\n labelType,\n popperTooltipClassName,\n popperTooltipStyle,\n targetClassName,\n targetIconClassName,\n targetTextClassName,\n tooltipText,\n ]);\n\n return (\n <StyledSelectDate className=\"select-date\">\n {labelType !== \"inline\" ? (\n <DatePicker\n target={renderTargetEl}\n position={position}\n menuClassName={menuClassName}\n popperClassName={popperClassName}\n month={defaultMonth}\n instant={mode === \"instant\"}\n mode={selectionMode}\n required={dateRequired}\n selected={selectedDays}\n firstDayOfWeek={firstDayOfWeek}\n saveLabel={saveButtonText}\n cancelLabel={cancelButtonText}\n clearLabel={clearButtonText}\n onSave={onSave}\n onChange={onChange}\n onClose={onCancel}\n modifiers={modifiers}\n modalHeaderText={modalHeaderText}\n modalDiscardMessage={modalDiscardMessage}\n modalDiscardBtnText={modalDiscardBtnText}\n modalCancelBtnText={modalCancelBtnText}\n disabledDaysBefore={disableDaysBefore}\n disabledDaysAfter={disabledDaysAfter}\n backgroundElementClass={backgroundElementClass}\n disabled={weekendIsSelectable ? [] : weekends}\n popperTooltipClassName={popperTooltipClassName}\n popperTooltipStyle={popperTooltipStyle}\n open={defaultShowDatePicker}\n onCalendarToggle={onToggleDatePicker}\n onDayClick={onDayClick}\n enableConfirmModal={mode === \"atomic\" && !dateRequired}\n disableYearPicker={!enableYearPicker}\n disableAnimations={disableAnimations}\n showControls\n forceClose={forceClose}\n />\n ) : (\n <DatePicker\n month={defaultMonth}\n instant={mode === \"instant\"}\n mode={selectionMode}\n required={dateRequired}\n selected={selectedDays}\n firstDayOfWeek={firstDayOfWeek}\n saveLabel={saveButtonText}\n cancelLabel={cancelButtonText}\n clearLabel={clearButtonText}\n disabledDaysBefore={disableDaysBefore}\n disabledDaysAfter={disabledDaysAfter}\n popperTooltipClassName={popperTooltipClassName}\n popperTooltipStyle={popperTooltipStyle}\n disabled={weekendIsSelectable ? [] : weekends}\n onSave={onSave}\n onChange={onChange}\n modifiers={modifiers}\n onDayClick={onDayClick}\n disableYearPicker={!enableYearPicker}\n disableAnimations={disableAnimations}\n showControls\n open\n />\n )}\n </StyledSelectDate>\n );\n};\n\nSelectDate.displayName = \"SelectDate\";\n"],"mappings":"AAAA,OAAOA,KAAK,IAAqBC,OAAO,QAAuB,OAAO;AAGtE,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAOC,MAAM,MAAM,iBAAiB;AAEpC,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,gBAAgB,EAAEC,sBAAsB,QAAQ,UAAU;AAEnE,SAASC,UAAU,QAAQ,uBAAuB;AAClD,SAEEC,UAAU,EAEVC,QAAQ,QACH,0BAA0B;AAKjC,MAAMC,YAAY,GAAGA,CAACC,GAAW,EAAEC,IAAkB,KAAc;EACjE,MAAMC,UAAU,GAAGV,MAAM,CAACW,IAAI,CAACF,IAAI,CAACG,IAAI,CAAC,CAACC,GAAG,CAAC,CAAC;EAC/C,MAAMP,QAAQ,GAAGN,MAAM,CAACW,IAAI,CAACF,IAAI,CAACK,EAAE,CAAC,CAACD,GAAG,CAAC,CAAC;EAE3C,IAAIJ,IAAI,CAACM,SAAS,EAAE;I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iB,EAAE,CAAC1C,gBAAiB;IACrCC,iBAAiB,EAAEA,iBAAkB;IACrC0C,YAAY;IACZJ,IAAI;EAAA,CACL,CAEa,CAAC;AAEvB,CAAC;AAEDrF,UAAU,CAAC0F,WAAW,GAAG,YAAY"}
1
+ {"version":3,"file":"SelectDate.js","names":["React","useMemo","classnames","moment","SelectDateTarget","StyledSelectDate","StyledSelectDateButton","formatDate","DatePicker","toMoment","isDayInRange","day","data","fromMoment","unix","from","utc","to","repeating","year","month","date","isSameOrAfter","isSameOrBefore","SelectDate","_ref","changeMode","mode","trigger","labelType","saveButtonText","cancelButtonText","clearButtonText","modalTitle","modalDescription","modalSaveBtnText","modalCancelBtnText","onDayClick","onSave","onCancel","onToggleDatePicker","required","dateRequired","longDateFormat","defaultShowDatePicker","firstDayOfWeek","selectedDays","selectionMode","menuClassName","targetClassName","icon","defaultLabelText","targetTextClassName","targetIconClassName","backgroundElementClass","dateFormat","forceClose","defaultMonth","daysToModify","weekends","weekendLabel","nonWorkingDaysOfWeek","nonWorkingDaysOfWeekLabel","weekendIsSelectable","tooltipText","popperTooltipClassName","popperClassName","popperTooltipStyle","position","disableDaysBefore","enableYearPicker","disableAnimations","disabledDaysAfter","onChange","labelText","formattedEndDate","formattedStartDate","isSame","modifiers","userAvailabilities","filter","type","globalDaysOff","selectableGlobalDaysOff","userAvailability","matchedData","find","matched","title","weekend","isWeekend","includes","nonWorkingDay","nonWorkingDays","isNonWorkingDay","day_disabled","globalDayOff","renderTargetEl","createElement","className","target","instant","selected","saveLabel","cancelLabel","clearLabel","onClose","disabledDaysBefore","disabled","open","onCalendarToggle","enableConfirmModal","disableYearPicker","showControls","displayName"],"sources":["../../../../src/components/SelectDate/SelectDate.tsx"],"sourcesContent":["import React, { ElementType, FC, useMemo, CSSProperties } from \"react\";\n\nimport { Placement } from \"@popperjs/core\";\nimport classnames from \"classnames\";\nimport { Moment } from \"moment\";\nimport moment from \"moment-timezone\";\n\nimport { SelectDateTarget } from \"./SelectDateTarget\";\nimport { StyledSelectDate, StyledSelectDateButton } from \"./Styles\";\nimport { DaysToModify } from \"./types\";\nimport { formatDate } from \"../../utils/dateUtils\";\nimport {\n ChangeMode,\n DatePicker,\n TimestampDateRange,\n toMoment,\n} from \"../DatePicker/DatePicker\";\n\ntype TriggerStringType = \"text\" | \"icon\" | \"inline\";\ntype TriggerFunctionType = (text: string) => JSX.Element;\n\nconst isDayInRange = (day: Moment, data: DaysToModify): boolean => {\n const fromMoment = moment.unix(data.from).utc();\n const toMoment = moment.unix(data.to).utc();\n\n if (data.repeating) {\n const year = day.year();\n const from = moment.utc({\n year,\n month: fromMoment.month(),\n date: fromMoment.date(),\n });\n const to = moment.utc({\n year,\n month: toMoment.month(),\n date: toMoment.date(),\n });\n\n return day.isSameOrAfter(from, \"day\") && day.isSameOrBefore(to, \"day\");\n }\n\n return (\n day.isSameOrAfter(fromMoment, \"day\") && day.isSameOrBefore(toMoment, \"day\")\n );\n};\n\nexport interface ISelectDate {\n /** Change mode - can be atomic and instant */\n changeMode?: \"atomic\" | \"instant\";\n /** Trigger - can be text, icon, inline, or custom render function */\n trigger?: TriggerStringType | TriggerFunctionType;\n /** Save button text */\n saveButtonText?: string;\n /** Cancel button text */\n cancelButtonText?: string;\n /** Clear button text */\n clearButtonText?: string;\n /** Modal title text */\n modalTitle?: string;\n /** Modal description text */\n modalDescription?: string;\n /** Modal save button text */\n modalSaveBtnText?: string;\n /** Modal cancel button text */\n modalCancelBtnText?: string;\n /** Tooltip text */\n tooltipText?: string;\n /** Called when day is clicked */\n onDayClick?: (day: Moment, modifiers: string[]) => void;\n /** Save changes callback */\n onSave?: (dates?: TimestampDateRange) => void;\n /** Changing dates callback */\n onChange?: (dates?: TimestampDateRange) => void;\n /** On cancel closes datepicker or opens discard modal in atomic mode */\n onCancel?: () => void;\n /** Clear dates when they are not required */\n onClear?: () => void;\n /** Use this callback to get is picker visible */\n onToggleDatePicker?: (value: boolean) => void;\n /** Force close */\n forceClose?: boolean;\n /** Set selected day or days */\n selectedDays?: TimestampDateRange;\n /** Set month */\n defaultMonth?: Moment;\n /** Set selection range */\n selectionMode?: ChangeMode;\n /** Set is date required */\n required?: boolean;\n /** Set default show on date picker (only for text and icon mode) */\n defaultShowDatePicker?: boolean;\n /** Long date format (Always show year) */\n longDateFormat?: boolean;\n /** Set first day of week */\n firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n /** One of icon types */\n icon?: ElementType;\n /** Default Label text */\n defaultLabelText?: string;\n /** Date format */\n dateFormat?: string;\n /** Menu classes */\n menuClassName?: string;\n /** Target element classes */\n targetClassName?: string;\n /** Target element text classes */\n targetTextClassName?: string;\n /** Target element icon classes */\n targetIconClassName?: string;\n /** Background style for clickable element after the menu is open (opacity, color, etc...) */\n backgroundElementClass?: string;\n /** Days to modify */\n daysToModify?: DaysToModify[];\n /** Array of weekend days */\n weekends?: number[];\n /** Weekend label */\n weekendLabel?: string;\n /** Array of nonworking week days */\n nonWorkingDaysOfWeek?: number[];\n /** Nonworking week days label */\n nonWorkingDaysOfWeekLabel?: string;\n /** Allows weekends to be selected */\n weekendIsSelectable?: boolean;\n /** Popper Tooltip style */\n popperTooltipStyle?: CSSProperties;\n /** Popper Tooltip class name*/\n popperTooltipClassName?: string;\n /** Popper class name*/\n popperClassName?: string;\n /** Position of selectDate menu */\n position?: Placement;\n /** Disable days before specified date */\n disableDaysBefore?: Moment;\n /** Disable days after specified date */\n disabledDaysAfter?: Moment;\n /** Enable year selector */\n enableYearPicker?: boolean;\n /** Disable aniamtions */\n disableAnimations?: boolean;\n}\n\nexport const SelectDate: FC<ISelectDate> = ({\n changeMode: mode = \"instant\",\n trigger: labelType = \"text\",\n saveButtonText = \"Save\",\n cancelButtonText = \"Cancel\",\n clearButtonText = \"Clear\",\n modalTitle = \"Save Changes\",\n modalDescription = \"You updated the date. Would you like to save this change?\",\n modalSaveBtnText = \"Save\",\n modalCancelBtnText = \"Discard\",\n onDayClick,\n onSave,\n onCancel,\n onToggleDatePicker,\n required: dateRequired = false,\n longDateFormat = false,\n defaultShowDatePicker = false,\n firstDayOfWeek = 0,\n selectedDays,\n selectionMode = \"custom\",\n menuClassName,\n targetClassName,\n icon,\n defaultLabelText = \"Set...\",\n targetTextClassName,\n targetIconClassName,\n backgroundElementClass,\n dateFormat,\n forceClose,\n defaultMonth,\n daysToModify = [],\n weekends = [],\n weekendLabel = \"Weekend\",\n nonWorkingDaysOfWeek = [],\n nonWorkingDaysOfWeekLabel = \"Unavailable\",\n weekendIsSelectable = false,\n tooltipText,\n popperTooltipClassName,\n popperClassName,\n popperTooltipStyle,\n position,\n disableDaysBefore,\n enableYearPicker,\n disableAnimations,\n disabledDaysAfter,\n onChange,\n}) => {\n const labelText = useMemo(() => {\n if (!selectedDays) {\n return defaultLabelText;\n } else if (!selectedDays.from && !selectedDays.to) {\n return defaultLabelText;\n } else {\n const formattedEndDate = selectedDays.to\n ? formatDate(toMoment(selectedDays.to), dateFormat, longDateFormat)\n : \"\";\n const formattedStartDate = selectedDays.from\n ? formatDate(toMoment(selectedDays?.from), dateFormat, longDateFormat)\n : \"\";\n\n if (\n selectedDays.to &&\n selectedDays.from &&\n toMoment(selectedDays.from).isSame(toMoment(selectedDays.to))\n ) {\n return formattedEndDate;\n }\n\n if (!selectedDays.to && selectedDays.from) {\n return formattedStartDate;\n }\n\n return `${formattedStartDate} - ${formattedEndDate}`;\n }\n }, [selectedDays, dateFormat, defaultLabelText, longDateFormat]);\n\n const modifiers = useMemo(() => {\n const userAvailabilities = daysToModify.filter(\n (data) => data.type === \"user_day_off\"\n );\n const globalDaysOff = daysToModify.filter(\n (data) => data.type === \"global_day_off\"\n );\n const selectableGlobalDaysOff = daysToModify.filter(\n (data) => data.type === \"selectable_global_day_off\"\n );\n\n return {\n userAvailability: (day: Moment) => {\n const matchedData = userAvailabilities.find((data) =>\n isDayInRange(day, data)\n );\n return {\n matched: !!matchedData,\n title: matchedData ? matchedData.title : null,\n };\n },\n weekend: (day: Moment) => {\n const isWeekend = weekends.includes(day.day());\n return {\n matched: isWeekend,\n title: isWeekend ? weekendLabel : null,\n };\n },\n nonWorkingDay: (day: Moment) => {\n if (weekends.includes(day.day())) {\n return { matched: true, title: \"\" };\n }\n const nonWorkingDays = [...selectableGlobalDaysOff, ...globalDaysOff];\n\n const matchedData = nonWorkingDays.find((data) =>\n isDayInRange(day, data)\n );\n return {\n matched: !!matchedData,\n title: matchedData ? matchedData.title : null,\n };\n },\n nonWorkingDaysOfWeek: (day: Moment) => {\n const isNonWorkingDay = nonWorkingDaysOfWeek.includes(day.day());\n return {\n matched: isNonWorkingDay,\n title: isNonWorkingDay ? nonWorkingDaysOfWeekLabel : null,\n };\n },\n day_disabled: (day: Moment) => {\n const globalDayOff = globalDaysOff.find((data) =>\n isDayInRange(day, data)\n );\n\n return {\n matched: !!globalDayOff,\n title: null,\n };\n },\n };\n }, [\n daysToModify,\n nonWorkingDaysOfWeek,\n nonWorkingDaysOfWeekLabel,\n weekendLabel,\n weekends,\n ]);\n\n const renderTargetEl = useMemo(() => {\n if (labelType === \"icon\" && icon) {\n return (\n <SelectDateTarget\n icon={icon}\n title={tooltipText}\n targetIconClassName={targetIconClassName}\n popperTooltipClassName={popperTooltipClassName}\n popperTooltipStyle={popperTooltipStyle}\n />\n );\n }\n if (typeof labelType === \"function\") {\n return labelType(labelText);\n }\n return (\n <StyledSelectDateButton\n type=\"button\"\n className={classnames(\"date-picker-target\", targetClassName)}\n >\n <span className={targetTextClassName}>{labelText}</span>\n </StyledSelectDateButton>\n );\n }, [\n icon,\n labelText,\n labelType,\n popperTooltipClassName,\n popperTooltipStyle,\n targetClassName,\n targetIconClassName,\n targetTextClassName,\n tooltipText,\n ]);\n\n return (\n <StyledSelectDate className=\"select-date\">\n {labelType !== \"inline\" ? (\n <DatePicker\n target={renderTargetEl}\n position={position}\n menuClassName={menuClassName}\n popperClassName={popperClassName}\n month={defaultMonth}\n instant={mode === \"instant\"}\n mode={selectionMode}\n required={dateRequired}\n selected={selectedDays}\n firstDayOfWeek={firstDayOfWeek}\n saveLabel={saveButtonText}\n cancelLabel={cancelButtonText}\n clearLabel={clearButtonText}\n onSave={onSave}\n onChange={onChange}\n onClose={onCancel}\n modifiers={modifiers}\n modalTitle={modalTitle}\n modalDescription={modalDescription}\n modalSaveBtnText={modalSaveBtnText}\n modalCancelBtnText={modalCancelBtnText}\n disabledDaysBefore={disableDaysBefore}\n disabledDaysAfter={disabledDaysAfter}\n backgroundElementClass={backgroundElementClass}\n disabled={weekendIsSelectable ? [] : weekends}\n popperTooltipClassName={popperTooltipClassName}\n popperTooltipStyle={popperTooltipStyle}\n open={defaultShowDatePicker}\n onCalendarToggle={onToggleDatePicker}\n onDayClick={onDayClick}\n enableConfirmModal={mode === \"atomic\" && !dateRequired}\n disableYearPicker={!enableYearPicker}\n disableAnimations={disableAnimations}\n showControls\n forceClose={forceClose}\n />\n ) : (\n <DatePicker\n month={defaultMonth}\n instant={mode === \"instant\"}\n mode={selectionMode}\n required={dateRequired}\n selected={selectedDays}\n firstDayOfWeek={firstDayOfWeek}\n saveLabel={saveButtonText}\n cancelLabel={cancelButtonText}\n clearLabel={clearButtonText}\n disabledDaysBefore={disableDaysBefore}\n disabledDaysAfter={disabledDaysAfter}\n popperTooltipClassName={popperTooltipClassName}\n popperTooltipStyle={popperTooltipStyle}\n disabled={weekendIsSelectable ? [] : weekends}\n onSave={onSave}\n onChange={onChange}\n modifiers={modifiers}\n onDayClick={onDayClick}\n disableYearPicker={!enableYearPicker}\n disableAnimations={disableAnimations}\n showControls\n open\n />\n )}\n </StyledSelectDate>\n );\n};\n\nSelectDate.displayName = \"SelectDate\";\n"],"mappings":"AAAA,OAAOA,KAAK,IAAqBC,OAAO,QAAuB,OAAO;AAGtE,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAOC,MAAM,MAAM,iBAAiB;AAEpC,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,gBAAgB,EAAEC,sBAAsB,QAAQ,UAAU;AAEnE,SA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E,WAAW,EAAEzE,gBAAiB;IAC9B0E,UAAU,EAAEzE,eAAgB;IAC5B2E,kBAAkB,EAAEtC,iBAAkB;IACtCG,iBAAiB,EAAEA,iBAAkB;IACrCP,sBAAsB,EAAEA,sBAAuB;IAC/CE,kBAAkB,EAAEA,kBAAmB;IACvCyC,QAAQ,EAAE7C,mBAAmB,GAAG,EAAE,GAAGJ,QAAS;IAC9CrB,MAAM,EAAEA,MAAO;IACfmC,QAAQ,EAAEA,QAAS;IACnBK,SAAS,EAAEA,SAAU;IACrBzC,UAAU,EAAEA,UAAW;IACvB2E,iBAAiB,EAAE,CAAC1C,gBAAiB;IACrCC,iBAAiB,EAAEA,iBAAkB;IACrC0C,YAAY;IACZJ,IAAI;EAAA,CACL,CAEa,CAAC;AAEvB,CAAC;AAEDrF,UAAU,CAAC0F,WAAW,GAAG,YAAY"}
package/dist/index.js CHANGED
@@ -13361,14 +13361,14 @@
13361
13361
  popperClassName = _ref.popperClassName,
13362
13362
  _ref$enableConfirmMod = _ref.enableConfirmModal,
13363
13363
  enableConfirmModal = _ref$enableConfirmMod === void 0 ? false : _ref$enableConfirmMod,
13364
- _ref$modalHeaderText = _ref.modalHeaderText,
13365
- modalHeaderText = _ref$modalHeaderText === void 0 ? "Discard changes?" : _ref$modalHeaderText,
13366
- _ref$modalDiscardMess = _ref.modalDiscardMessage,
13367
- modalDiscardMessage = _ref$modalDiscardMess === void 0 ? "All unsaved changes will be lost." : _ref$modalDiscardMess,
13368
- _ref$modalDiscardBtnT = _ref.modalDiscardBtnText,
13369
- modalDiscardBtnText = _ref$modalDiscardBtnT === void 0 ? "OK" : _ref$modalDiscardBtnT,
13364
+ _ref$modalTitle = _ref.modalTitle,
13365
+ modalTitle = _ref$modalTitle === void 0 ? "Save Changes" : _ref$modalTitle,
13366
+ _ref$modalDescription = _ref.modalDescription,
13367
+ modalDescription = _ref$modalDescription === void 0 ? "You updated the date. Would you like to save this change?" : _ref$modalDescription,
13368
+ _ref$modalSaveBtnText = _ref.modalSaveBtnText,
13369
+ modalSaveBtnText = _ref$modalSaveBtnText === void 0 ? "Save" : _ref$modalSaveBtnText,
13370
13370
  _ref$modalCancelBtnTe = _ref.modalCancelBtnText,
13371
- modalCancelBtnText = _ref$modalCancelBtnTe === void 0 ? "Cancel" : _ref$modalCancelBtnTe,
13371
+ modalCancelBtnText = _ref$modalCancelBtnTe === void 0 ? "Discard" : _ref$modalCancelBtnTe,
13372
13372
  backgroundElementClass = _ref.backgroundElementClass,
13373
13373
  popperTooltipClassName = _ref.popperTooltipClassName,
13374
13374
  popperTooltipStyle = _ref.popperTooltipStyle,
@@ -13929,17 +13929,41 @@
13929
13929
  var handleCaptionClick = React.useCallback(function () {
13930
13930
  isMonthSelectOpen && !disableYearPicker ? toggleYearSelect() : toggleMonthSelect();
13931
13931
  }, [disableYearPicker, isMonthSelectOpen, toggleMonthSelect, toggleYearSelect]);
13932
- var handleCloseDiscardModal = React.useCallback(function () {
13933
- setShowDiscardModal(false);
13934
- }, []);
13935
13932
  var handleSaveDiscardModal = React.useCallback(function () {
13933
+ if (selected) {
13934
+ if (onChange) {
13935
+ onChange({
13936
+ from: moment__default["default"].utc(selected === null || selected === void 0 ? void 0 : selected.from).unix(),
13937
+ to: selected !== null && selected !== void 0 && selected.to ? moment__default["default"].utc(selected === null || selected === void 0 ? void 0 : selected.to).unix() : moment__default["default"].utc(selected === null || selected === void 0 ? void 0 : selected.from).unix()
13938
+ });
13939
+ }
13940
+ if (onSave) {
13941
+ onSave({
13942
+ from: moment__default["default"].utc(selected === null || selected === void 0 ? void 0 : selected.from).unix(),
13943
+ to: selected !== null && selected !== void 0 && selected.to ? moment__default["default"].utc(selected === null || selected === void 0 ? void 0 : selected.to).unix() : moment__default["default"].utc(selected === null || selected === void 0 ? void 0 : selected.from).unix()
13944
+ });
13945
+ }
13946
+ } else {
13947
+ if (onChange) onChange(undefined);
13948
+ if (onSave) onSave(undefined);
13949
+ }
13950
+ setShowDiscardModal(false);
13951
+ if (target) {
13952
+ setIsOpen(false);
13953
+ if (onCalendarToggle) onCalendarToggle(false);
13954
+ }
13955
+ }, [selected, target, onChange, onSave, onCalendarToggle]);
13956
+ var handleDiscardModal = React.useCallback(function () {
13936
13957
  setSelected(defaultSelected !== null && defaultSelected !== void 0 && defaultSelected.from ? {
13937
13958
  from: toMoment(defaultSelected.from),
13938
13959
  to: defaultSelected.to ? toMoment(defaultSelected.to) : null
13939
13960
  } : null);
13940
13961
  setShowDiscardModal(false);
13941
- handleClose();
13942
- }, [defaultSelected, handleClose]);
13962
+ if (target) {
13963
+ setIsOpen(false);
13964
+ if (onCalendarToggle) onCalendarToggle(false);
13965
+ }
13966
+ }, [defaultSelected === null || defaultSelected === void 0 ? void 0 : defaultSelected.from, defaultSelected === null || defaultSelected === void 0 ? void 0 : defaultSelected.to, onCalendarToggle, target]);
13943
13967
  var wrapperProps = target ? {
13944
13968
  className: "c-date-picker--calendar",
13945
13969
  target,
@@ -14037,12 +14061,12 @@
14037
14061
  }, clearLabel)) : null))), !instant && target && !required && enableConfirmModal ? /*#__PURE__*/React__default["default"].createElement(StyledConfirmDialog$1, {
14038
14062
  className: "modal-select-date",
14039
14063
  open: showDiscardModal,
14040
- onCancel: handleCloseDiscardModal,
14064
+ onCancel: handleDiscardModal,
14041
14065
  onConfirm: handleSaveDiscardModal,
14042
- dialogTitle: modalHeaderText,
14043
- dialogContent: modalDiscardMessage,
14066
+ dialogTitle: modalTitle,
14067
+ dialogContent: modalDescription,
14044
14068
  cancelBtnText: modalCancelBtnText,
14045
- confirmBtnText: modalDiscardBtnText
14069
+ confirmBtnText: modalSaveBtnText
14046
14070
  }) : null);
14047
14071
  };
14048
14072
 
@@ -17048,6 +17072,11 @@
17048
17072
  return props.hover && styled.css(["background-color:var(--color-theme-200);"]);
17049
17073
  });
17050
17074
  StyledOption.displayName = "StyledOption";
17075
+ var StyledOptionContent = styled__default["default"].span.withConfig({
17076
+ displayName: "Styles__StyledOptionContent",
17077
+ componentId: "sc-1232l97-1"
17078
+ })(["display:flex;align-items:center;width:100%;justify-content:space-between;"]);
17079
+ StyledOptionContent.displayName = "StyledOptionContent";
17051
17080
 
17052
17081
  var StyledAutocompleteScrollShadow = styled__default["default"](ScrollShadow).withConfig({
17053
17082
  displayName: "Styles__StyledAutocompleteScrollShadow",
@@ -17126,7 +17155,7 @@
17126
17155
  className: classNames__default["default"]("c-option", className),
17127
17156
  hover: hover,
17128
17157
  onClick: onClick
17129
- }, renderOption ? renderOption : name);
17158
+ }, /*#__PURE__*/React__default["default"].createElement(StyledOptionContent, null, renderOption ? renderOption : name));
17130
17159
  });
17131
17160
  Option.displayName = "Option";
17132
17161
 
@@ -21305,14 +21334,14 @@
21305
21334
  cancelButtonText = _ref$cancelButtonText === void 0 ? "Cancel" : _ref$cancelButtonText,
21306
21335
  _ref$clearButtonText = _ref.clearButtonText,
21307
21336
  clearButtonText = _ref$clearButtonText === void 0 ? "Clear" : _ref$clearButtonText,
21308
- _ref$modalHeaderText = _ref.modalHeaderText,
21309
- modalHeaderText = _ref$modalHeaderText === void 0 ? "Discard changes?" : _ref$modalHeaderText,
21310
- _ref$modalDiscardMess = _ref.modalDiscardMessage,
21311
- modalDiscardMessage = _ref$modalDiscardMess === void 0 ? "All unsaved changes will be lost." : _ref$modalDiscardMess,
21312
- _ref$modalDiscardBtnT = _ref.modalDiscardBtnText,
21313
- modalDiscardBtnText = _ref$modalDiscardBtnT === void 0 ? "OK" : _ref$modalDiscardBtnT,
21337
+ _ref$modalTitle = _ref.modalTitle,
21338
+ modalTitle = _ref$modalTitle === void 0 ? "Save Changes" : _ref$modalTitle,
21339
+ _ref$modalDescription = _ref.modalDescription,
21340
+ modalDescription = _ref$modalDescription === void 0 ? "You updated the date. Would you like to save this change?" : _ref$modalDescription,
21341
+ _ref$modalSaveBtnText = _ref.modalSaveBtnText,
21342
+ modalSaveBtnText = _ref$modalSaveBtnText === void 0 ? "Save" : _ref$modalSaveBtnText,
21314
21343
  _ref$modalCancelBtnTe = _ref.modalCancelBtnText,
21315
- modalCancelBtnText = _ref$modalCancelBtnTe === void 0 ? "Cancel" : _ref$modalCancelBtnTe,
21344
+ modalCancelBtnText = _ref$modalCancelBtnTe === void 0 ? "Discard" : _ref$modalCancelBtnTe,
21316
21345
  onDayClick = _ref.onDayClick,
21317
21346
  onSave = _ref.onSave,
21318
21347
  onCancel = _ref.onCancel,
@@ -21479,9 +21508,9 @@
21479
21508
  onChange: onChange,
21480
21509
  onClose: onCancel,
21481
21510
  modifiers: modifiers,
21482
- modalHeaderText: modalHeaderText,
21483
- modalDiscardMessage: modalDiscardMessage,
21484
- modalDiscardBtnText: modalDiscardBtnText,
21511
+ modalTitle: modalTitle,
21512
+ modalDescription: modalDescription,
21513
+ modalSaveBtnText: modalSaveBtnText,
21485
21514
  modalCancelBtnText: modalCancelBtnText,
21486
21515
  disabledDaysBefore: disableDaysBefore,
21487
21516
  disabledDaysAfter: disabledDaysAfter,