@ssa-ui-kit/core 2.31.0 → 2.33.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.
Files changed (28) hide show
  1. package/dist/components/DatePicker/styles.d.ts +0 -1
  2. package/dist/components/DateRangePicker/DateRangePicker.d.ts +1 -1
  3. package/dist/components/DateRangePicker/components/DatesListWrapper.d.ts +0 -1
  4. package/dist/components/DateRangePicker/components/TriggerInput.d.ts +1 -4
  5. package/dist/components/DateRangePicker/hooks/index.d.ts +1 -0
  6. package/dist/components/DateRangePicker/hooks/useDatePickerMask.d.ts +3 -9
  7. package/dist/components/DateRangePicker/hooks/useDateRangePicker.d.ts +3 -2
  8. package/dist/components/DateRangePicker/hooks/useRangeSelection.d.ts +20 -0
  9. package/dist/components/DateRangePicker/styles.d.ts +0 -2
  10. package/dist/components/DateRangePicker/types.d.ts +6 -4
  11. package/dist/components/DateRangePicker/useDateRangePickerContext.d.ts +2 -1
  12. package/dist/components/Filters/FilterBlockWrapper.d.ts +0 -1
  13. package/dist/components/JsonSchemaForm/constants.d.ts +1 -0
  14. package/dist/components/JsonSchemaForm/index.d.ts +2 -0
  15. package/dist/components/JsonSchemaForm/types.d.ts +6 -0
  16. package/dist/components/PersonInfo/PersonInfoAvatar.d.ts +1 -8
  17. package/dist/components/PersonInfo/PersonInfoCounter.d.ts +3 -0
  18. package/dist/components/PersonInfo/PersonInfoValue.d.ts +1 -8
  19. package/dist/components/PersonInfo/helpers.d.ts +11 -0
  20. package/dist/components/PersonInfo/styles.d.ts +29 -14
  21. package/dist/components/PersonInfo/types.d.ts +31 -1
  22. package/dist/components/Tooltip/types.d.ts +1 -0
  23. package/dist/components/Typeahead/styles.d.ts +0 -1
  24. package/dist/components/UserProfile/styles.d.ts +0 -2
  25. package/dist/components/Wrapper/Wrapper.d.ts +0 -1
  26. package/dist/index.js +636 -361
  27. package/dist/index.js.map +1 -1
  28. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1102,6 +1102,7 @@ __webpack_require__.d(Field_index_parts_namespaceObject, {
1102
1102
  var JsonSchemaForm_namespaceObject = {};
1103
1103
  __webpack_require__.r(JsonSchemaForm_namespaceObject);
1104
1104
  __webpack_require__.d(JsonSchemaForm_namespaceObject, {
1105
+ DEFAULT_AVATAR_SIZE: () => (DEFAULT_AVATAR_SIZE),
1105
1106
  Fields: () => (fields),
1106
1107
  Form: () => (JsonSchemaForm_Form),
1107
1108
  Templates: () => (templates),
@@ -8226,7 +8227,8 @@ const useTooltip = props => {
8226
8227
  size = 'small',
8227
8228
  hasArrow = true,
8228
8229
  arrowProps = {},
8229
- isOpen: isInitOpen = false
8230
+ isOpen: isInitOpen = false,
8231
+ allowHoverContent = false
8230
8232
  } = props || {};
8231
8233
  const [isOpen, setIsOpen] = (0,external_react_namespaceObject.useState)(isInitOpen || false);
8232
8234
  const arrowRef = (0,external_react_namespaceObject.useRef)(null);
@@ -8244,7 +8246,8 @@ const useTooltip = props => {
8244
8246
  } = floatingData;
8245
8247
  const hover = (0,external_floating_ui_react_namespaceObject.useHover)(context, {
8246
8248
  enabled: enableHover,
8247
- move: true
8249
+ move: true,
8250
+ handleClose: allowHoverContent ? (0,external_floating_ui_react_namespaceObject.safePolygon)() : undefined
8248
8251
  });
8249
8252
  const click = (0,external_floating_ui_react_namespaceObject.useClick)(context, {
8250
8253
  enabled: enableClick
@@ -14350,54 +14353,72 @@ function PersonInfo_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have t
14350
14353
 
14351
14354
 
14352
14355
  const PersonInfoBase = /*#__PURE__*/base_default()("div", true ? {
14353
- target: "ej2kihb12"
14356
+ target: "ej2kihb15"
14354
14357
  } : 0)( true ? {
14355
14358
  name: "3w0yoi",
14356
14359
  styles: "display:flex;flex-direction:column;gap:8px"
14357
14360
  } : 0);
14358
14361
  const PersonInfoHeader = /*#__PURE__*/base_default()("div", true ? {
14359
- target: "ej2kihb11"
14362
+ target: "ej2kihb14"
14360
14363
  } : 0)( true ? {
14361
14364
  name: "1ocjxm6",
14362
14365
  styles: "display:flex;align-items:flex-start;gap:8px"
14363
14366
  } : 0);
14364
14367
  const styles_IconWrapper = /*#__PURE__*/base_default()("div", true ? {
14365
- target: "ej2kihb10"
14368
+ target: "ej2kihb13"
14366
14369
  } : 0)( true ? {
14367
14370
  name: "13ltyg2",
14368
14371
  styles: "display:flex;align-items:flex-start;flex-shrink:0"
14369
14372
  } : 0);
14370
14373
  const styles_TitleWrapper = /*#__PURE__*/base_default()("div", true ? {
14371
- target: "ej2kihb9"
14374
+ target: "ej2kihb12"
14372
14375
  } : 0)( true ? {
14373
14376
  name: "1tcizyl",
14374
14377
  styles: "display:flex;flex-direction:column;gap:4px;flex:1"
14375
14378
  } : 0);
14376
14379
  const Title = /*#__PURE__*/base_default()("div", true ? {
14377
- target: "ej2kihb8"
14380
+ target: "ej2kihb11"
14378
14381
  } : 0)( true ? {
14379
14382
  name: "edklr6",
14380
14383
  styles: "font-size:14px;font-weight:600;line-height:19px"
14381
14384
  } : 0);
14385
+ const Row = /*#__PURE__*/base_default()("div", true ? {
14386
+ target: "ej2kihb10"
14387
+ } : 0)( true ? {
14388
+ name: "1j5vobt",
14389
+ styles: "display:flex;align-items:center;gap:4px"
14390
+ } : 0);
14382
14391
  const TextBase = /*#__PURE__*/base_default()("div", true ? {
14383
- target: "ej2kihb7"
14392
+ target: "ej2kihb9"
14384
14393
  } : 0)( true ? {
14385
14394
  name: "1bzpq77",
14386
14395
  styles: "font-size:14px;font-weight:400;line-height:19px"
14387
14396
  } : 0);
14388
14397
  const ValueWithCounter = /*#__PURE__*/base_default()("div", true ? {
14389
- target: "ej2kihb6"
14398
+ target: "ej2kihb8"
14390
14399
  } : 0)( true ? {
14391
14400
  name: "1j5vobt",
14392
14401
  styles: "display:flex;align-items:center;gap:4px"
14393
14402
  } : 0);
14394
14403
  const Counter = /*#__PURE__*/base_default()(TextBase.withComponent('span', true ? {
14395
- target: "ej2kihb13"
14404
+ target: "ej2kihb16"
14396
14405
  } : 0), true ? {
14397
- target: "ej2kihb5"
14406
+ target: "ej2kihb7"
14398
14407
  } : 0)("color:", ({
14399
14408
  theme
14400
- }) => theme.colors.greyDropdownFocused, ";margin-left:5px;" + ( true ? "" : 0));
14409
+ }) => theme.colors.greyDropdownFocused, ";margin-left:5px;cursor:pointer;" + ( true ? "" : 0));
14410
+ const CounterTooltipContent = /*#__PURE__*/base_default()("div", true ? {
14411
+ target: "ej2kihb6"
14412
+ } : 0)( true ? {
14413
+ name: "1oeds5o",
14414
+ styles: "min-width:220px;padding:12px"
14415
+ } : 0);
14416
+ const CounterTooltipList = /*#__PURE__*/base_default()("div", true ? {
14417
+ target: "ej2kihb5"
14418
+ } : 0)( true ? {
14419
+ name: "1acx518",
14420
+ styles: "display:flex;flex-direction:column;gap:8px;height:auto;max-height:220px;overflow:hidden;overflow-y:auto;padding-right:4px"
14421
+ } : 0);
14401
14422
  const AttributesList = /*#__PURE__*/base_default()("div", true ? {
14402
14423
  target: "ej2kihb4"
14403
14424
  } : 0)( true ? {
@@ -14441,6 +14462,29 @@ const CustomBadge = /*#__PURE__*/base_default()("div", true ? {
14441
14462
  } = BADGE_COLORS(theme)[colorName];
14442
14463
  return bg;
14443
14464
  }, ";" + ( true ? "" : 0));
14465
+ const personInfoValueLinkStyles = theme => ({
14466
+ textDecoration: 'none',
14467
+ color: theme.colors.greyDarker,
14468
+ cursor: 'pointer',
14469
+ transition: 'color 0.2s ease',
14470
+ display: 'inline-flex',
14471
+ alignItems: 'center',
14472
+ '&:hover': {
14473
+ color: theme.colors.blue
14474
+ }
14475
+ });
14476
+ const avatarWrapperLinkStyles = theme => ({
14477
+ textDecoration: 'none',
14478
+ color: theme.colors.greyDarker,
14479
+ cursor: 'pointer',
14480
+ transition: 'color 0.2s ease',
14481
+ '&:hover': {
14482
+ color: theme.colors.blue,
14483
+ '& > div:last-child': {
14484
+ color: theme.colors.blue
14485
+ }
14486
+ }
14487
+ });
14444
14488
  ;// ./src/components/PersonInfo/PersonInfoIcon.tsx
14445
14489
 
14446
14490
 
@@ -14465,17 +14509,25 @@ const PersonInfoIcon = ({
14465
14509
 
14466
14510
  const PersonInfoValue = ({
14467
14511
  value,
14468
- counter,
14469
14512
  css,
14470
- counterCss
14513
+ linkAttributes
14471
14514
  }) => {
14472
- return (0,jsx_runtime_namespaceObject.jsxs)(TextBase, {
14473
- css: css,
14474
- children: [value, counter && (0,jsx_runtime_namespaceObject.jsxs)(Counter, {
14475
- css: counterCss,
14476
- children: [" ", counter]
14477
- })]
14478
- });
14515
+ const isLink = Boolean(linkAttributes?.href);
14516
+ return (0,jsx_runtime_namespaceObject.jsx)(TextBase, {
14517
+ css: [isLink ? personInfoValueLinkStyles : undefined, css, true ? "" : 0, true ? "" : 0],
14518
+ ...(linkAttributes ?? {}),
14519
+ children: value
14520
+ });
14521
+ };
14522
+ ;// ./src/components/PersonInfo/helpers.ts
14523
+ const getLinkAttributes = (link, openLinkInNewTab) => {
14524
+ const isLink = Boolean(link);
14525
+ return isLink ? {
14526
+ as: 'a',
14527
+ href: link,
14528
+ target: openLinkInNewTab ? '_blank' : undefined,
14529
+ rel: openLinkInNewTab ? 'noreferrer' : undefined
14530
+ } : {};
14479
14531
  };
14480
14532
  ;// ./src/components/PersonInfo/PersonInfoAvatar.tsx
14481
14533
 
@@ -14483,22 +14535,34 @@ const PersonInfoValue = ({
14483
14535
 
14484
14536
 
14485
14537
 
14538
+
14486
14539
  const PersonInfoAvatar = ({
14487
14540
  avatar,
14488
14541
  value,
14489
- counter,
14490
- styles
14542
+ styles,
14543
+ link,
14544
+ openLinkInNewTab
14491
14545
  }) => {
14546
+ const hasAvatar = Boolean(avatar);
14547
+ const hasValue = Boolean(value);
14548
+ const isLink = Boolean(link);
14549
+ const linkAttributes = getLinkAttributes(link, openLinkInNewTab);
14550
+ if (!hasAvatar && !hasValue) return null;
14551
+ const valueNode = hasValue ? (0,jsx_runtime_namespaceObject.jsx)(PersonInfoValue, {
14552
+ value: value,
14553
+ css: hasAvatar ? styles?.avatarName : styles?.value,
14554
+ linkAttributes: !hasAvatar ? linkAttributes : undefined
14555
+ }) : null;
14556
+ if (!hasAvatar) {
14557
+ return valueNode;
14558
+ }
14492
14559
  return (0,jsx_runtime_namespaceObject.jsxs)(styles_AvatarWrapper, {
14560
+ css: isLink ? avatarWrapperLinkStyles : undefined,
14561
+ ...linkAttributes,
14493
14562
  children: [(0,jsx_runtime_namespaceObject.jsx)(Avatar_Avatar, {
14494
14563
  size: 24,
14495
14564
  image: avatar
14496
- }), value && (0,jsx_runtime_namespaceObject.jsx)(PersonInfoValue, {
14497
- value: value,
14498
- counter: counter,
14499
- css: styles?.avatarName,
14500
- counterCss: styles?.counter
14501
- })]
14565
+ }), valueNode]
14502
14566
  });
14503
14567
  };
14504
14568
  ;// ./src/components/PersonInfo/PersonInfoBadges.tsx
@@ -14535,6 +14599,100 @@ const PersonInfoBadges = ({
14535
14599
  })
14536
14600
  });
14537
14601
  };
14602
+ ;// ./src/components/ImageItem/ImageItem.tsx
14603
+ function ImageItem_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
14604
+
14605
+
14606
+
14607
+
14608
+ var ImageItem_ref = true ? {
14609
+ name: "c5ejfv",
14610
+ styles: "gap:8px;text-decoration:none"
14611
+ } : 0;
14612
+ const ImageItem = ({
14613
+ children,
14614
+ image,
14615
+ avatarSize = 24,
14616
+ link = '',
14617
+ openLinkInNewTab = false,
14618
+ className
14619
+ }) => {
14620
+ const theme = (0,react_namespaceObject.useTheme)();
14621
+ const additionalProps = link ? {
14622
+ href: link,
14623
+ target: openLinkInNewTab ? '_blank' : undefined
14624
+ } : {};
14625
+ return (0,jsx_runtime_namespaceObject.jsxs)(Wrapper_Wrapper, {
14626
+ css: ImageItem_ref,
14627
+ as: link ? 'a' : 'div',
14628
+ className: className,
14629
+ "data-testid": "image-item",
14630
+ ...additionalProps,
14631
+ children: [(0,jsx_runtime_namespaceObject.jsx)(Avatar_Avatar, {
14632
+ size: avatarSize,
14633
+ image: image
14634
+ }), (0,jsx_runtime_namespaceObject.jsx)("span", {
14635
+ css: /*#__PURE__*/(0,react_namespaceObject.css)({
14636
+ color: theme.colors.greyDarker,
14637
+ fontSize: 14,
14638
+ fontWeight: 500,
14639
+ cursor: link ? 'pointer' : 'default',
14640
+ '&:hover': {
14641
+ color: link ? theme.colors.blue : theme.colors.greyDarker
14642
+ }
14643
+ }, true ? "" : 0, true ? "" : 0),
14644
+ children: children
14645
+ })]
14646
+ });
14647
+ };
14648
+ ;// ./src/components/PersonInfo/PersonInfoCounter.tsx
14649
+
14650
+
14651
+
14652
+
14653
+
14654
+
14655
+
14656
+ const PersonInfoCounter = ({
14657
+ counterTooltip,
14658
+ css
14659
+ }) => {
14660
+ const tooltipUsers = counterTooltip?.users ?? [];
14661
+ const hasTooltipUsers = tooltipUsers.length > 0;
14662
+ const counterValue = hasTooltipUsers ? `+${tooltipUsers.length}` : null;
14663
+ if (!counterValue) {
14664
+ return null;
14665
+ }
14666
+ const tooltipBody = (0,jsx_runtime_namespaceObject.jsx)(CounterTooltipList, {
14667
+ "data-testid": "person-info-counter-tooltip-list",
14668
+ children: tooltipUsers.map(user => (0,jsx_runtime_namespaceObject.jsx)(ImageItem, {
14669
+ image: user.avatar,
14670
+ link: user.link,
14671
+ openLinkInNewTab: user.openLinkInNewTab,
14672
+ children: user.name
14673
+ }, user.id))
14674
+ });
14675
+ const counterNode = (0,jsx_runtime_namespaceObject.jsx)(Counter, {
14676
+ css: css,
14677
+ "data-testid": "person-info-counter",
14678
+ children: counterValue
14679
+ });
14680
+ return (0,jsx_runtime_namespaceObject.jsxs)(Tooltip_Tooltip, {
14681
+ enableHover: true,
14682
+ enableClick: false,
14683
+ allowHoverContent: true,
14684
+ placement: "top",
14685
+ size: "medium",
14686
+ hasArrow: true,
14687
+ children: [(0,jsx_runtime_namespaceObject.jsx)(TooltipTrigger_TooltipTrigger, {
14688
+ children: counterNode
14689
+ }), (0,jsx_runtime_namespaceObject.jsx)(TooltipContent_TooltipContent, {
14690
+ children: (0,jsx_runtime_namespaceObject.jsx)(CounterTooltipContent, {
14691
+ children: tooltipBody
14692
+ })
14693
+ })]
14694
+ });
14695
+ };
14538
14696
  ;// ./src/components/PersonInfo/PersonInfo.tsx
14539
14697
 
14540
14698
 
@@ -14549,11 +14707,13 @@ const PersonInfo = /*#__PURE__*/external_react_default().forwardRef(function Per
14549
14707
  value,
14550
14708
  badges,
14551
14709
  avatar,
14552
- counter,
14710
+ counterTooltip,
14553
14711
  attributes,
14554
14712
  description,
14555
14713
  styles,
14556
14714
  className,
14715
+ link,
14716
+ openLinkInNewTab,
14557
14717
  ...props
14558
14718
  }, ref) {
14559
14719
  return (0,jsx_runtime_namespaceObject.jsx)(PersonInfoBase, {
@@ -14567,16 +14727,17 @@ const PersonInfo = /*#__PURE__*/external_react_default().forwardRef(function Per
14567
14727
  children: [(0,jsx_runtime_namespaceObject.jsx)(Title, {
14568
14728
  css: styles?.title,
14569
14729
  children: title
14570
- }), avatar && (0,jsx_runtime_namespaceObject.jsx)(PersonInfoAvatar, {
14571
- avatar: avatar,
14572
- value: value,
14573
- counter: counter,
14574
- styles: styles
14575
- }), !avatar && value && (0,jsx_runtime_namespaceObject.jsx)(PersonInfoValue, {
14576
- value: value,
14577
- counter: counter,
14578
- css: styles?.value,
14579
- counterCss: styles?.counter
14730
+ }), (0,jsx_runtime_namespaceObject.jsxs)(Row, {
14731
+ children: [(0,jsx_runtime_namespaceObject.jsx)(PersonInfoAvatar, {
14732
+ avatar: avatar,
14733
+ value: value,
14734
+ styles: styles,
14735
+ link: link,
14736
+ openLinkInNewTab: openLinkInNewTab
14737
+ }), counterTooltip && (0,jsx_runtime_namespaceObject.jsx)(PersonInfoCounter, {
14738
+ counterTooltip: counterTooltip,
14739
+ css: styles?.counter
14740
+ })]
14580
14741
  }), badges && (0,jsx_runtime_namespaceObject.jsx)(PersonInfoBadges, {
14581
14742
  badges: badges,
14582
14743
  styles: styles
@@ -14814,8 +14975,8 @@ const styles_MonthsViewCell = /*#__PURE__*/base_default()("div", true ? {
14814
14975
  const TriggerWrapper = /*#__PURE__*/base_default()(Wrapper_Wrapper, true ? {
14815
14976
  target: "e19l41fq0"
14816
14977
  } : 0)( true ? {
14817
- name: "1utaypi",
14818
- styles: "padding:14px"
14978
+ name: "1h91tay",
14979
+ styles: "padding:14px;cursor:default"
14819
14980
  } : 0);
14820
14981
  ;// ./src/components/DateRangePicker/utils/dates.ts
14821
14982
 
@@ -14907,7 +15068,6 @@ const DateRangePickerContext = /*#__PURE__*/(0,external_react_namespaceObject.cr
14907
15068
  nameFrom: '',
14908
15069
  nameTo: '',
14909
15070
  maskOptions: {},
14910
- openCalendarMode: 'icon',
14911
15071
  inputFromRef: {
14912
15072
  current: null
14913
15073
  },
@@ -14936,9 +15096,6 @@ const DateRangePickerContext = /*#__PURE__*/(0,external_react_namespaceObject.cr
14936
15096
  day: 1
14937
15097
  }),
14938
15098
  currentIndex: 0,
14939
- handleSetIsOpen: () => {
14940
- // no-op
14941
- },
14942
15099
  handleToggleOpen: () => {
14943
15100
  // no-op
14944
15101
  },
@@ -14948,6 +15105,13 @@ const DateRangePickerContext = /*#__PURE__*/(0,external_react_namespaceObject.cr
14948
15105
  setCalendarType: () => {
14949
15106
  // no-op
14950
15107
  },
15108
+ rangeSelectionStep: null,
15109
+ setRangeSelectionStep: () => {
15110
+ // no-op
15111
+ },
15112
+ clearInputValue: () => {
15113
+ // no-op
15114
+ },
14951
15115
  setCalendarViewDateTime: () => {
14952
15116
  // no-op
14953
15117
  },
@@ -14956,7 +15120,8 @@ const DateRangePickerContext = /*#__PURE__*/(0,external_react_namespaceObject.cr
14956
15120
  },
14957
15121
  setLastFocusedElement: () => {
14958
15122
  // no-op
14959
- }
15123
+ },
15124
+ allowReverseSelection: false
14960
15125
  });
14961
15126
  ;// ./src/components/DateRangePicker/useDateRangePickerContext.tsx
14962
15127
 
@@ -15014,6 +15179,88 @@ const useRangeHighlighting = () => {
15014
15179
  hoveredDate
15015
15180
  };
15016
15181
  };
15182
+ ;// ./src/components/DateRangePicker/hooks/useRangeSelection.ts
15183
+
15184
+ const useRangeSelection = ({
15185
+ createNewDate,
15186
+ getComparisonFormat
15187
+ }) => {
15188
+ const {
15189
+ dateTime,
15190
+ calendarViewDateTime,
15191
+ setCalendarViewDateTime,
15192
+ setDateTime,
15193
+ setIsOpen,
15194
+ setLastFocusedElement,
15195
+ rangeSelectionStep,
15196
+ setRangeSelectionStep,
15197
+ clearInputValue,
15198
+ allowReverseSelection = false,
15199
+ onChange
15200
+ } = useDateRangePickerContext();
15201
+ const handleRangeSelect = selectedValue => {
15202
+ const newDate = createNewDate(selectedValue);
15203
+ if (!newDate) return;
15204
+
15205
+ // Range selection logic
15206
+ const isSelectingStart = rangeSelectionStep === 'start';
15207
+ if (isSelectingStart) {
15208
+ clearInputValue('to');
15209
+ setLastFocusedElement('to');
15210
+ setRangeSelectionStep('end');
15211
+ }
15212
+ let newDateTuple = isSelectingStart ? [newDate, undefined] : [dateTime[0], newDate];
15213
+ setCalendarViewDateTime(isSelectingStart ? [newDate, newDate] : [dateTime[0] ? calendarViewDateTime?.[0] : newDate, newDate]);
15214
+
15215
+ // Check if dates are in reverse order
15216
+ const isReversed = newDateTuple[0] && newDateTuple[1] && newDateTuple[0].toMillis() > newDateTuple[1].toMillis();
15217
+ if (isReversed) {
15218
+ if (allowReverseSelection) {
15219
+ // Auto-swap dates when reverse selection is allowed
15220
+ newDateTuple = [newDateTuple[1], newDateTuple[0]];
15221
+ } else if (!isSelectingStart) {
15222
+ // User selected an earlier date - update start date
15223
+ newDateTuple = [newDateTuple[1], undefined];
15224
+ setLastFocusedElement('to');
15225
+ setRangeSelectionStep('end');
15226
+ setCalendarViewDateTime([newDateTuple[0], newDateTuple[0]]);
15227
+ }
15228
+ }
15229
+ setDateTime(newDateTuple);
15230
+ const normalizeToMidnight = dt => dt.set({
15231
+ hour: 0,
15232
+ minute: 0,
15233
+ second: 0,
15234
+ millisecond: 0
15235
+ }).toJSDate();
15236
+
15237
+ // Call onChange when a date is selected from calendar
15238
+ if (isSelectingStart && newDateTuple[0]) {
15239
+ // First date selected
15240
+ onChange?.([normalizeToMidnight(newDateTuple[0]), null]);
15241
+ } else if (newDateTuple[0] && newDateTuple[1] && newDateTuple[0].toMillis() <= newDateTuple[1].toMillis()) {
15242
+ // Both dates selected and in correct order
15243
+ onChange?.([normalizeToMidnight(newDateTuple[0]), normalizeToMidnight(newDateTuple[1])]);
15244
+ setRangeSelectionStep(null);
15245
+ setIsOpen(false);
15246
+ }
15247
+ };
15248
+ const getDateSelectionState = currentDT => {
15249
+ const comparisonFormat = getComparisonFormat();
15250
+ const isCalendarFirstDateSelected = currentDT.toFormat(comparisonFormat) === dateTime[0]?.toFormat(comparisonFormat);
15251
+ const isCalendarSecondDateSelected = currentDT.toFormat(comparisonFormat) === dateTime[1]?.toFormat(comparisonFormat);
15252
+ const isCalendarDateSelected = isCalendarFirstDateSelected || isCalendarSecondDateSelected;
15253
+ return {
15254
+ isCalendarFirstDateSelected,
15255
+ isCalendarSecondDateSelected,
15256
+ isCalendarDateSelected
15257
+ };
15258
+ };
15259
+ return {
15260
+ handleRangeSelect,
15261
+ getDateSelectionState
15262
+ };
15263
+ };
15017
15264
  ;// ./src/components/DateRangePicker/components/DaysView.tsx
15018
15265
  function components_DaysView_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
15019
15266
 
@@ -15040,15 +15287,9 @@ var components_DaysView_ref3 = true ? {
15040
15287
  const DaysView_DaysView = () => {
15041
15288
  const weekDays = dates_getWeekDays();
15042
15289
  const {
15043
- dateTime,
15044
- calendarViewDateTime,
15045
15290
  dateMinDT,
15046
15291
  dateMaxDT,
15047
- lastFocusedElement,
15048
- currentCalendarViewDT,
15049
- setCalendarViewDateTime,
15050
- setDateTime,
15051
- setIsOpen
15292
+ currentCalendarViewDT
15052
15293
  } = useDateRangePickerContext();
15053
15294
  const currentDate = currentCalendarViewDT.toJSDate();
15054
15295
  const currentMonth = currentDate?.getMonth();
@@ -15059,22 +15300,23 @@ const DaysView_DaysView = () => {
15059
15300
  getClassNames,
15060
15301
  isHighlightDate
15061
15302
  } = useRangeHighlighting();
15303
+ const {
15304
+ handleRangeSelect,
15305
+ getDateSelectionState
15306
+ } = useRangeSelection({
15307
+ createNewDate: selectedDay => currentCalendarViewDT.set({
15308
+ day: Number(selectedDay)
15309
+ }),
15310
+ getComparisonFormat: () => 'D'
15311
+ });
15062
15312
  const handleDaySelect = event => {
15063
15313
  const {
15064
15314
  target
15065
15315
  } = event;
15066
- const selectedDay = Number(target.innerHTML);
15316
+ const selectedDay = target.innerHTML;
15067
15317
  const isEnabled = target.getAttribute('aria-disabled') === 'false';
15068
15318
  if (isEnabled) {
15069
- const newDate = currentCalendarViewDT.set({
15070
- day: selectedDay
15071
- });
15072
- const newDateTuple = lastFocusedElement === 'from' ? [newDate, dateTime[1]] : [dateTime[0], newDate];
15073
- setCalendarViewDateTime(lastFocusedElement === 'from' ? [newDate, dateTime[1] ? calendarViewDateTime?.[1] : newDate] : [dateTime[0] ? calendarViewDateTime?.[0] : newDate, newDate]);
15074
- setDateTime(newDateTuple);
15075
- if (newDateTuple[0] && newDateTuple[1]) {
15076
- setIsOpen(false);
15077
- }
15319
+ handleRangeSelect(selectedDay);
15078
15320
  }
15079
15321
  };
15080
15322
  return (0,jsx_runtime_namespaceObject.jsxs)((external_react_default()).Fragment, {
@@ -15088,16 +15330,18 @@ const DaysView_DaysView = () => {
15088
15330
  css: components_DaysView_ref3,
15089
15331
  onClick: handleDaySelect,
15090
15332
  children: dates.map((currentDate, index) => {
15091
- const currentDT = external_luxon_namespaceObject.DateTime.fromJSDate(currentDate);
15333
+ const currentDT = external_luxon_namespaceObject.DateTime.fromJSDate(currentDate).startOf('day');
15092
15334
  const calendarDate = currentDT.toFormat('D');
15093
15335
  const calendarDay = currentDate.getDate();
15094
15336
  const calendarMonth = currentDate.getMonth();
15095
15337
  const ariaLabel = currentDT.toLocaleString(external_luxon_namespaceObject.DateTime.DATE_HUGE);
15096
15338
  const isCalendarDateNow = nowDate === calendarDate;
15097
15339
  const isCalendarMonth = currentMonth === calendarMonth;
15098
- const isCalendarFirstDateSelected = calendarDate === dateTime[0]?.toFormat('D');
15099
- const isCalendarSecondDateSelected = calendarDate === dateTime[1]?.toFormat('D');
15100
- const isCalendarDateSelected = isCalendarFirstDateSelected || isCalendarSecondDateSelected;
15340
+ const {
15341
+ isCalendarFirstDateSelected,
15342
+ isCalendarSecondDateSelected,
15343
+ isCalendarDateSelected
15344
+ } = getDateSelectionState(currentDT);
15101
15345
  let isAriaDisabled = false;
15102
15346
  if (dateMinDT && dateMaxDT) {
15103
15347
  isAriaDisabled = currentDT < dateMinDT || currentDT > dateMaxDT || !isCalendarMonth;
@@ -15146,24 +15390,36 @@ var components_MonthsView_ref = true ? {
15146
15390
  } : 0;
15147
15391
  const MonthsView_MonthsView = () => {
15148
15392
  const {
15149
- dateTime,
15150
- calendarViewDateTime,
15151
15393
  dateMinDT,
15152
15394
  dateMaxDT,
15153
15395
  lastFocusedElement,
15154
15396
  currentCalendarViewDT,
15397
+ calendarViewDateTime,
15155
15398
  rangePickerType,
15156
15399
  setCalendarType,
15157
15400
  setCalendarViewDateTime,
15158
- onMonthChange,
15159
- setDateTime,
15160
- setIsOpen
15401
+ onMonthChange
15161
15402
  } = useDateRangePickerContext();
15162
15403
  const {
15163
15404
  handleDateHover,
15164
15405
  getClassNames,
15165
15406
  isHighlightDate
15166
15407
  } = useRangeHighlighting();
15408
+ const {
15409
+ handleRangeSelect,
15410
+ getDateSelectionState
15411
+ } = useRangeSelection({
15412
+ createNewDate: selectedMonth => {
15413
+ const monthNumber = constants_MONTHS.findIndex(month => month === selectedMonth);
15414
+ const newMonth = currentCalendarViewDT?.set({
15415
+ month: monthNumber + 1
15416
+ });
15417
+ return newMonth?.set({
15418
+ day: lastFocusedElement === 'from' ? 1 : newMonth.daysInMonth
15419
+ });
15420
+ },
15421
+ getComparisonFormat: () => 'yyyy-MM'
15422
+ });
15167
15423
  const handleMonthSelect = event => {
15168
15424
  const {
15169
15425
  target
@@ -15174,29 +15430,20 @@ const MonthsView_MonthsView = () => {
15174
15430
  return;
15175
15431
  }
15176
15432
  const selectedMonth = target.innerHTML;
15177
- const monthNumber = constants_MONTHS.findIndex(month => month === selectedMonth);
15178
15433
  if (rangePickerType === 'days') {
15434
+ // Navigation case: selecting month navigates to days view
15435
+ const monthNumber = constants_MONTHS.findIndex(month => month === selectedMonth);
15179
15436
  const newDate = currentCalendarViewDT?.set({
15180
15437
  month: monthNumber + 1
15181
15438
  });
15182
- setCalendarViewDateTime(lastFocusedElement === 'from' ? [newDate, calendarViewDateTime[1]] : [calendarViewDateTime[0], newDate]);
15183
15439
  if (newDate) {
15440
+ setCalendarViewDateTime(lastFocusedElement === 'from' ? [newDate, calendarViewDateTime[1]] : [calendarViewDateTime[0], newDate]);
15184
15441
  onMonthChange?.(newDate.toJSDate());
15442
+ setCalendarType('days');
15185
15443
  }
15186
- setCalendarType('days');
15187
15444
  } else {
15188
- const newMonth = currentCalendarViewDT?.set({
15189
- month: monthNumber + 1
15190
- });
15191
- const newDate = newMonth?.set({
15192
- day: lastFocusedElement === 'from' ? 1 : newMonth.daysInMonth
15193
- });
15194
- const newDateTuple = lastFocusedElement === 'from' ? [newDate, dateTime[1]] : [dateTime[0], newDate];
15195
- setCalendarViewDateTime(lastFocusedElement === 'from' ? [newDate, dateTime[1] ? calendarViewDateTime?.[1] : newDate] : [dateTime[0] ? calendarViewDateTime?.[0] : newDate, newDate]);
15196
- setDateTime(newDateTuple);
15197
- if (newDateTuple[0] && newDateTuple[1]) {
15198
- setIsOpen(false);
15199
- }
15445
+ // Range selection case: selecting month completes the range
15446
+ handleRangeSelect(selectedMonth);
15200
15447
  }
15201
15448
  };
15202
15449
  return (0,jsx_runtime_namespaceObject.jsx)(DatesListWrapper, {
@@ -15211,8 +15458,10 @@ const MonthsView_MonthsView = () => {
15211
15458
  const isMinMonthReached = dateMinDT ? currentMonthDT.month < dateMinDT.month && currentMonthDT.year === dateMinDT.year : false;
15212
15459
  const isMaxMonthReached = dateMaxDT ? currentMonthDT.month > dateMaxDT.month && currentMonthDT.year === dateMaxDT.year : false;
15213
15460
  const isAriaDisabled = isMinMonthReached || isMaxMonthReached;
15214
- const isCalendarFirstDateSelected = currentMonthDT.toFormat('yyyy-MM') === dateTime[0]?.toFormat('yyyy-MM');
15215
- const isCalendarSecondDateSelected = currentMonthDT.toFormat('yyyy-MM') === dateTime[1]?.toFormat('yyyy-MM');
15461
+ const {
15462
+ isCalendarFirstDateSelected,
15463
+ isCalendarSecondDateSelected
15464
+ } = getDateSelectionState(currentMonthDT);
15216
15465
  const classNames = getClassNames(currentMonthDT, {
15217
15466
  isCalendarFirstDateSelected,
15218
15467
  isCalendarSecondDateSelected
@@ -15248,7 +15497,6 @@ var components_YearsView_ref = true ? {
15248
15497
  const YearsView_YearsView = () => {
15249
15498
  const {
15250
15499
  rangePickerType,
15251
- dateTime,
15252
15500
  calendarViewDateTime,
15253
15501
  currentCalendarViewDT,
15254
15502
  dateMinParts,
@@ -15257,9 +15505,7 @@ const YearsView_YearsView = () => {
15257
15505
  lastFocusedElement,
15258
15506
  setCalendarType,
15259
15507
  setCalendarViewDateTime,
15260
- onYearChange,
15261
- setDateTime,
15262
- setIsOpen
15508
+ onYearChange
15263
15509
  } = useDateRangePickerContext();
15264
15510
  const wrapper = (0,external_react_namespaceObject.useRef)(null);
15265
15511
  const yearsList = dates_getYearsList({
@@ -15271,6 +15517,24 @@ const YearsView_YearsView = () => {
15271
15517
  getClassNames,
15272
15518
  isHighlightDate
15273
15519
  } = useRangeHighlighting();
15520
+ const {
15521
+ handleRangeSelect,
15522
+ getDateSelectionState
15523
+ } = useRangeSelection({
15524
+ createNewDate: selectedYear => {
15525
+ const newYear = currentCalendarViewDT?.set({
15526
+ year: Number(selectedYear)
15527
+ });
15528
+ return newYear?.set(lastFocusedElement === 'from' ? {
15529
+ day: 1,
15530
+ month: 1
15531
+ } : {
15532
+ day: 31,
15533
+ month: 12
15534
+ });
15535
+ },
15536
+ getComparisonFormat: () => 'yyyy'
15537
+ });
15274
15538
  (0,external_react_namespaceObject.useEffect)(() => {
15275
15539
  if (currentCalendarViewDT && wrapper.current) {
15276
15540
  wrapper.current.querySelector('[aria-current=date]')?.scrollIntoView({
@@ -15278,15 +15542,16 @@ const YearsView_YearsView = () => {
15278
15542
  block: 'center'
15279
15543
  });
15280
15544
  }
15281
- }, [calendarViewDateTime, lastFocusedElement]);
15545
+ }, [calendarViewDateTime, lastFocusedElement, currentCalendarViewDT]);
15282
15546
  const handleYearSelect = event => {
15283
15547
  const {
15284
15548
  target
15285
15549
  } = event;
15286
- const selectedYear = Number(target.innerHTML);
15550
+ const selectedYear = target.innerHTML;
15287
15551
  if (rangePickerType !== 'years') {
15552
+ // Navigation case: selecting year navigates to months view
15288
15553
  const newDate = currentCalendarViewDT.set({
15289
- year: selectedYear
15554
+ year: Number(selectedYear)
15290
15555
  });
15291
15556
  setCalendarType('months');
15292
15557
  setCalendarViewDateTime(lastFocusedElement === 'from' ? [newDate, calendarViewDateTime[1]] : [calendarViewDateTime[0], newDate]);
@@ -15294,22 +15559,8 @@ const YearsView_YearsView = () => {
15294
15559
  onYearChange?.(newDate.toJSDate());
15295
15560
  }
15296
15561
  } else {
15297
- const newYear = currentCalendarViewDT?.set({
15298
- year: selectedYear
15299
- });
15300
- const newDate = newYear?.set(lastFocusedElement === 'from' ? {
15301
- day: 1,
15302
- month: 1
15303
- } : {
15304
- day: 31,
15305
- month: 12
15306
- });
15307
- const newDateTuple = lastFocusedElement === 'from' ? [newDate, dateTime[1]] : [dateTime[0], newDate];
15308
- setCalendarViewDateTime(lastFocusedElement === 'from' ? [newDate, dateTime[1] ? calendarViewDateTime?.[1] : newDate] : [dateTime[0] ? calendarViewDateTime?.[0] : newDate, newDate]);
15309
- setDateTime(newDateTuple);
15310
- if (newDateTuple[0] && newDateTuple[1]) {
15311
- setIsOpen(false);
15312
- }
15562
+ // Range selection case: selecting year completes the range
15563
+ handleRangeSelect(selectedYear);
15313
15564
  }
15314
15565
  };
15315
15566
  return (0,jsx_runtime_namespaceObject.jsx)(DatesListWrapper, {
@@ -15327,8 +15578,10 @@ const YearsView_YearsView = () => {
15327
15578
  if (isCalendarYear) {
15328
15579
  additionalProps['aria-current'] = 'date';
15329
15580
  }
15330
- const isCalendarFirstDateSelected = year.toString() === dateTime[0]?.toFormat('yyyy');
15331
- const isCalendarSecondDateSelected = year.toString() === dateTime[1]?.toFormat('yyyy');
15581
+ const {
15582
+ isCalendarFirstDateSelected,
15583
+ isCalendarSecondDateSelected
15584
+ } = getDateSelectionState(currentYearDT);
15332
15585
  const classNames = getClassNames(currentYearDT, {
15333
15586
  isCalendarFirstDateSelected,
15334
15587
  isCalendarSecondDateSelected
@@ -15668,24 +15921,9 @@ function TriggerInput_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried
15668
15921
 
15669
15922
 
15670
15923
 
15671
- const WithTriggerPopover = ({
15672
- isEnabled,
15673
- children
15674
- }) => {
15675
- return isEnabled ? (0,jsx_runtime_namespaceObject.jsx)(PopoverTrigger, {
15676
- asChild: true,
15677
- children: /*#__PURE__*/external_react_default().cloneElement(children, {
15678
- ...children.props
15679
- })
15680
- }) : (/*#__PURE__*/external_react_default().cloneElement(children, {
15681
- ...children.props
15682
- }));
15683
- };
15684
15924
  const TriggerInput = ({
15685
15925
  datepickerType,
15686
- withPopover = false,
15687
- className,
15688
- onClick
15926
+ className
15689
15927
  }) => {
15690
15928
  const {
15691
15929
  format,
@@ -15698,7 +15936,9 @@ const TriggerInput = ({
15698
15936
  messages,
15699
15937
  setLastFocusedElement,
15700
15938
  classNames,
15701
- onBlur: handleBlur
15939
+ onBlur: handleBlur,
15940
+ isOpen,
15941
+ setIsOpen
15702
15942
  } = useDateRangePickerContext();
15703
15943
  const formContext = (0,external_react_hook_form_namespaceObject.useFormContext)(); // Using FormProvider from react-hook-form
15704
15944
  const useFormResult = (0,external_react_hook_form_namespaceObject.useForm)();
@@ -15720,42 +15960,55 @@ const TriggerInput = ({
15720
15960
  setLastFocusedElement(datepickerType);
15721
15961
  inputProps?.inputProps?.onFocus?.(e);
15722
15962
  };
15723
- const handleOpen = event => {
15724
- onClick?.(event);
15725
- };
15726
- return (0,jsx_runtime_namespaceObject.jsx)(WithTriggerPopover, {
15727
- isEnabled: withPopover,
15728
- children: (0,jsx_runtime_namespaceObject.jsx)(Input_Input, {
15729
- name: currentName,
15730
- placeholder: format,
15731
- ref: datepickerType === 'from' ? inputFromRef : inputToRef,
15732
- disabled: disabled,
15733
- register: register,
15734
- className: className,
15735
- wrapperClassName: /*#__PURE__*/(0,css_namespaceObject.css)("display:flex;padding-left:", datepickerType === 'from' ? 0 : 14, "px;" + ( true ? "" : 0), true ? "" : 0),
15736
- inputProps: {
15737
- onBlur: handleBlur,
15738
- onClick: handleOpen,
15739
- onFocus: handleFocus,
15740
- id: inputProps?.inputProps?.id || currentName,
15741
- 'data-testid': `daterangepicker-input-${datepickerType}`,
15742
- autoComplete: 'off',
15743
- className: [/*#__PURE__*/(0,css_namespaceObject.css)( true ? {
15744
- name: "15obm9d",
15745
- styles: "border:none!important;height:auto!important;padding:0!important;min-width:75px;line-height:16px;max-height:16px;letter-spacing:0.8px;border-radius:0!important;&::placeholder{letter-spacing:normal;}"
15746
- } : 0), datepickerType === 'from' ? classNames?.trigger?.inputFrom : classNames?.trigger?.inputTo].filter(Boolean).join(' '),
15747
- ...inputElementProps
15963
+ return (0,jsx_runtime_namespaceObject.jsx)(Input_Input, {
15964
+ name: currentName,
15965
+ placeholder: format,
15966
+ ref: datepickerType === 'from' ? inputFromRef : inputToRef,
15967
+ disabled: disabled,
15968
+ register: register,
15969
+ className: className,
15970
+ wrapperClassName: /*#__PURE__*/(0,css_namespaceObject.css)("display:flex;padding-left:", datepickerType === 'from' ? 0 : 14, "px;" + ( true ? "" : 0), true ? "" : 0),
15971
+ inputProps: {
15972
+ onBlur: handleBlur,
15973
+ onFocus: handleFocus,
15974
+ onClick: e => {
15975
+ if (isOpen) {
15976
+ setIsOpen(false);
15977
+ }
15978
+ inputProps?.inputProps?.onClick?.(e);
15748
15979
  },
15749
- showStatusIcon: false,
15750
- errors: fieldError,
15751
- status: fieldStatus,
15752
- helperText: fieldStatus === 'basic' ? messages?.description : messages?.error,
15753
- helperClassName: /*#__PURE__*/(0,css_namespaceObject.css)( true ? {
15754
- name: "lhoo11",
15755
- styles: "&>span::first-letter{text-transform:uppercase;}"
15756
- } : 0),
15757
- ...restInputProps
15758
- })
15980
+ onKeyDown: e => {
15981
+ inputProps?.inputProps?.onKeyDown?.(e);
15982
+ },
15983
+ onBeforeInput: e => {
15984
+ // pass-through
15985
+ inputProps?.inputProps?.onBeforeInput?.(e);
15986
+ },
15987
+ onInput: e => {
15988
+ // pass-through
15989
+ inputProps?.inputProps?.onInput?.(e);
15990
+ },
15991
+ onChange: e => {
15992
+ inputProps?.inputProps?.onChange?.(e);
15993
+ },
15994
+ id: inputProps?.inputProps?.id || currentName,
15995
+ 'data-testid': `daterangepicker-input-${datepickerType}`,
15996
+ autoComplete: 'off',
15997
+ className: [/*#__PURE__*/(0,css_namespaceObject.css)( true ? {
15998
+ name: "15obm9d",
15999
+ styles: "border:none!important;height:auto!important;padding:0!important;min-width:75px;line-height:16px;max-height:16px;letter-spacing:0.8px;border-radius:0!important;&::placeholder{letter-spacing:normal;}"
16000
+ } : 0), datepickerType === 'from' ? classNames?.trigger?.inputFrom : classNames?.trigger?.inputTo].filter(Boolean).join(' '),
16001
+ ...inputElementProps
16002
+ },
16003
+ showStatusIcon: false,
16004
+ errors: fieldError,
16005
+ status: fieldStatus,
16006
+ helperText: fieldStatus === 'basic' ? messages?.description : messages?.error,
16007
+ helperClassName: /*#__PURE__*/(0,css_namespaceObject.css)( true ? {
16008
+ name: "lhoo11",
16009
+ styles: "&>span::first-letter{text-transform:uppercase;}"
16010
+ } : 0),
16011
+ ...restInputProps
15759
16012
  });
15760
16013
  };
15761
16014
  ;// ./src/components/Field/FieldDescription.tsx
@@ -15855,8 +16108,8 @@ function Trigger_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to st
15855
16108
 
15856
16109
 
15857
16110
  var Trigger_ref = true ? {
15858
- name: "1ldd2k6",
15859
- styles: "margin:0 3px"
16111
+ name: "cx8u11",
16112
+ styles: "margin:0 3px;cursor:pointer"
15860
16113
  } : 0;
15861
16114
  const Trigger = () => {
15862
16115
  const {
@@ -15866,7 +16119,6 @@ const Trigger = () => {
15866
16119
  lastFocusedElement,
15867
16120
  disabled,
15868
16121
  status,
15869
- openCalendarMode,
15870
16122
  isOpen,
15871
16123
  showCalendarIcon,
15872
16124
  showStatusArea,
@@ -15899,49 +16151,46 @@ const Trigger = () => {
15899
16151
  ref: wrapperRef,
15900
16152
  className: classNames?.trigger?.controlsWrapper,
15901
16153
  children: [(0,jsx_runtime_namespaceObject.jsx)(TriggerInput, {
15902
- withPopover: true,
15903
16154
  datepickerType: "from",
15904
- className: classNames?.trigger?.inputFrom,
15905
- onClick: () => {
15906
- if (!isOpen) {
15907
- setIsOpen(true);
15908
- }
15909
- }
16155
+ className: classNames?.trigger?.inputFrom
15910
16156
  }), (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
15911
16157
  name: "carrot-right",
15912
16158
  size: 16,
15913
16159
  color: disabled ? theme.colors.grey : theme.colors.greyDarker,
15914
16160
  className: classNames?.trigger?.arrowIcon,
16161
+ onClick: () => {
16162
+ if (isOpen) {
16163
+ setIsOpen(false);
16164
+ }
16165
+ },
15915
16166
  css: Trigger_ref
15916
16167
  }), (0,jsx_runtime_namespaceObject.jsx)(TriggerInput, {
15917
16168
  datepickerType: "to",
15918
- className: classNames?.trigger?.inputTo,
15919
- onClick: () => {
15920
- if (!isOpen) {
15921
- setIsOpen(true);
15922
- }
15923
- }
15924
- }), showCalendarIcon && (0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
15925
- endIcon: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
15926
- name: "calendar",
15927
- size: 16,
15928
- color: disabled ? theme.colors.grey : theme.colors.greyDarker
15929
- }),
15930
- "data-testid": 'daterangepicker-button',
15931
- onClick: handleToggleOpen,
15932
- variant: "tertiary",
15933
- "aria-label": "Calendar",
15934
- isDisabled: disabled,
15935
- className: classNames?.trigger?.calendarIcon,
15936
- css: /*#__PURE__*/(0,react_namespaceObject.css)({
15937
- padding: 0,
15938
- margin: '0 0 0 10px',
15939
- height: 'auto',
15940
- cursor: openCalendarMode === 'input' || disabled ? 'default' : 'pointer',
15941
- '&:focus::before': {
15942
- display: 'none'
15943
- }
15944
- }, true ? "" : 0, true ? "" : 0)
16169
+ className: classNames?.trigger?.inputTo
16170
+ }), showCalendarIcon && (0,jsx_runtime_namespaceObject.jsx)(PopoverTrigger, {
16171
+ asChild: true,
16172
+ children: (0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
16173
+ endIcon: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
16174
+ name: "calendar",
16175
+ size: 16,
16176
+ color: disabled ? theme.colors.grey : theme.colors.greyDarker
16177
+ }),
16178
+ "data-testid": 'daterangepicker-button',
16179
+ onClick: handleToggleOpen,
16180
+ variant: "tertiary",
16181
+ "aria-label": "Calendar",
16182
+ isDisabled: disabled,
16183
+ className: classNames?.trigger?.calendarIcon,
16184
+ css: /*#__PURE__*/(0,react_namespaceObject.css)({
16185
+ padding: 0,
16186
+ margin: '0 0 0 10px',
16187
+ height: 'auto',
16188
+ cursor: disabled ? 'default' : 'pointer',
16189
+ '&:focus::before': {
16190
+ display: 'none'
16191
+ }
16192
+ }, true ? "" : 0, true ? "" : 0)
16193
+ })
15945
16194
  })]
15946
16195
  })
15947
16196
  }), showStatusArea && (0,jsx_runtime_namespaceObject.jsx)(TriggerStatusArea, {})]
@@ -15966,12 +16215,8 @@ const Content_DatePickerContent = () => {
15966
16215
  };
15967
16216
  ;// ./src/components/DateRangePicker/hooks/useDatePickerMask.tsx
15968
16217
 
15969
-
15970
16218
  const useDatePickerMask_useDatePickerMask = ({
15971
- maskOptions,
15972
- formatIndexes,
15973
- dateMinParts,
15974
- dateMaxParts
16219
+ maskOptions
15975
16220
  }) => {
15976
16221
  const {
15977
16222
  mask,
@@ -15984,28 +16229,13 @@ const useDatePickerMask_useDatePickerMask = ({
15984
16229
  mask,
15985
16230
  replacement,
15986
16231
  track: ({
15987
- data,
15988
- selectionStart,
15989
- selectionEnd,
15990
- value: currentValue
16232
+ data
15991
16233
  }) => {
15992
- const isDateMask = typeof mask === 'string' && /^[_/]+$/.test(mask);
15993
- if (isDateMask) {
15994
- const newValue = currentValue.slice(0, selectionStart) + data + currentValue.slice(selectionEnd);
15995
- const updatedValue = (0,mask_namespaceObject.format)(newValue, {
15996
- mask,
15997
- replacement
15998
- });
15999
- const splittedValue = updatedValue.split('/');
16000
- const isChecked = dates_processDate({
16001
- day: splittedValue[formatIndexes['day']],
16002
- month: splittedValue[formatIndexes['month']],
16003
- year: splittedValue[formatIndexes['year']]
16004
- }, dateMinParts[formatIndexes['year']], dateMaxParts[formatIndexes['year']]);
16005
- return isChecked ? data : '';
16006
- } else {
16007
- return data;
16008
- }
16234
+ // The mask should only format input, not validate it
16235
+ // Validation happens on blur in useDateRangePicker.handleBlur
16236
+ // This allows users to freely type and edit dates without blocking
16237
+ // Return data as-is (string for insertions, null/undefined for deletions)
16238
+ return data;
16009
16239
  },
16010
16240
  ...restMaskOptions
16011
16241
  });
@@ -16047,15 +16277,12 @@ const useDateRangePicker = ({
16047
16277
  const [isOpen, setIsOpen] = (0,external_react_namespaceObject.useState)(isOpenState);
16048
16278
  const [status, setStatus] = (0,external_react_namespaceObject.useState)(rest.status);
16049
16279
  const previousOpenState = (0,external_react_namespaceObject.useRef)(isOpenState);
16050
- const handleSetIsOpen = open => {
16051
- setIsOpen(open);
16052
- };
16280
+ const previousDateTime = (0,external_react_namespaceObject.useRef)([undefined, undefined]);
16281
+ const defaultValueProcessed = (0,external_react_namespaceObject.useRef)(false);
16053
16282
  const {
16054
16283
  clearErrors,
16055
16284
  setError,
16056
- setValue,
16057
- resetField,
16058
- setFocus
16285
+ setValue
16059
16286
  } = (0,external_react_hook_form_namespaceObject.useFormContext)();
16060
16287
  const nameFrom = `${_name}From`;
16061
16288
  const nameTo = `${_name}To`;
@@ -16069,7 +16296,6 @@ const useDateRangePicker = ({
16069
16296
  const [lastChangedDate, setLastChangedDate] = (0,external_react_namespaceObject.useState)([undefined, undefined]);
16070
16297
  const [lastFocusedElement, setLastFocusedElement] = (0,external_react_namespaceObject.useState)('from');
16071
16298
  const currentIndex = lastFocusedElement === 'from' ? 0 : 1;
16072
- const currentName = lastFocusedElement === 'from' ? nameFrom : nameTo;
16073
16299
  const [dateTimeForChangeEvent, setDateTimeForChangeEvent] = (0,external_react_namespaceObject.useState)(undefined);
16074
16300
  const [currentError, setCurrentError] = (0,external_react_namespaceObject.useState)({
16075
16301
  date: null,
@@ -16082,6 +16308,7 @@ const useDateRangePicker = ({
16082
16308
  year: splittedFormat.findIndex(item => item === 'yyyy')
16083
16309
  });
16084
16310
  const [calendarType, setCalendarType] = (0,external_react_namespaceObject.useState)(rangePickerType);
16311
+ const [rangeSelectionStep, setRangeSelectionStep] = (0,external_react_namespaceObject.useState)(null);
16085
16312
  const [calendarViewDateTime, setCalendarViewDateTime] = (0,external_react_namespaceObject.useState)([undefined, undefined]);
16086
16313
  const currentCalendarViewDT = calendarViewDateTime[currentIndex] || external_luxon_namespaceObject.DateTime.now().set({
16087
16314
  day: 1
@@ -16091,14 +16318,18 @@ const useDateRangePicker = ({
16091
16318
  const dateMinParts = finalDateMin.split('/').map(Number);
16092
16319
  const dateMaxParts = finalDateMax.split('/').map(Number);
16093
16320
  const defaultMask = getMaskForFormat(format);
16094
- const maskInputRef = useDatePickerMask_useDatePickerMask({
16321
+ // separate mask refs per input to prevent focus/typing conflicts
16322
+ const maskInputRefFrom = useDatePickerMask_useDatePickerMask({
16095
16323
  maskOptions: {
16096
16324
  mask: defaultMask,
16097
- ...maskOptions
16098
- },
16099
- dateMaxParts,
16100
- dateMinParts,
16101
- formatIndexes
16325
+ ...(maskOptions || {})
16326
+ }
16327
+ });
16328
+ const maskInputRefTo = useDatePickerMask_useDatePickerMask({
16329
+ maskOptions: {
16330
+ mask: defaultMask,
16331
+ ...(maskOptions || {})
16332
+ }
16102
16333
  });
16103
16334
  const dateMaxDT = external_luxon_namespaceObject.DateTime.fromObject({
16104
16335
  year: dateMaxParts[formatIndexes['year']],
@@ -16152,7 +16383,7 @@ const useDateRangePicker = ({
16152
16383
  setError(currentName, {
16153
16384
  message: errorMessage
16154
16385
  }, {
16155
- shouldFocus: true
16386
+ shouldFocus: false
16156
16387
  });
16157
16388
  setStatus('error');
16158
16389
  setDateTime(newDateTimeIfInvalid);
@@ -16164,7 +16395,7 @@ const useDateRangePicker = ({
16164
16395
  setError(currentName, {
16165
16396
  message: errorMessage
16166
16397
  }, {
16167
- shouldFocus: true
16398
+ shouldFocus: false
16168
16399
  });
16169
16400
  setStatus('error');
16170
16401
  setDateTime(newDateTimeIfInvalid);
@@ -16172,6 +16403,33 @@ const useDateRangePicker = ({
16172
16403
  safeOnChange();
16173
16404
  } else {
16174
16405
  setDateTime(newDateTimeIfValid);
16406
+ // Update calendar view to reflect the manually entered date
16407
+ let adjustedDateTime = newDateTime.startOf('day');
16408
+ if (adjustedDateTime < dateMinDT) {
16409
+ const {
16410
+ year,
16411
+ month,
16412
+ day
16413
+ } = dateMinDT;
16414
+ adjustedDateTime = adjustedDateTime.set({
16415
+ year,
16416
+ month,
16417
+ day
16418
+ });
16419
+ }
16420
+ if (adjustedDateTime > dateMaxDT) {
16421
+ const {
16422
+ year,
16423
+ month,
16424
+ day
16425
+ } = dateMaxDT;
16426
+ adjustedDateTime = adjustedDateTime.set({
16427
+ year,
16428
+ month,
16429
+ day
16430
+ });
16431
+ }
16432
+ setCalendarViewDateTime(currentElementType === 'from' ? [adjustedDateTime, calendarViewDateTime[1] || adjustedDateTime] : [calendarViewDateTime[0] || adjustedDateTime, adjustedDateTime]);
16175
16433
  clearErrors();
16176
16434
  setStatus('basic');
16177
16435
  safeOnError?.(null);
@@ -16180,26 +16438,35 @@ const useDateRangePicker = ({
16180
16438
  }
16181
16439
  };
16182
16440
  const handleBlur = event => {
16183
- event.preventDefault();
16184
16441
  const blurredValue = event.currentTarget.value;
16442
+ const fieldName = event.currentTarget.name;
16443
+ const isFromField = fieldName === nameFrom;
16185
16444
  if (blurredValue.length > 0) {
16186
- processValue(blurredValue);
16445
+ processValue(blurredValue, isFromField ? 'from' : 'to');
16446
+ } else {
16447
+ // User cleared the field - clear the corresponding dateTime
16448
+ setDateTime(prev => isFromField ? [undefined, prev[1]] : [prev[0], undefined]);
16449
+ setLastChangedDate(prev => isFromField ? [undefined, prev[1]] : [prev[0], undefined]);
16450
+ setValue(fieldName, undefined);
16451
+ clearErrors(fieldName);
16187
16452
  }
16188
16453
  };
16189
16454
  const processInputValue = (inputValue, elementName) => {
16190
16455
  const currentElementType = elementName || lastFocusedElement;
16191
16456
  const currentName = currentElementType === 'from' ? nameFrom : nameTo;
16457
+ const currentWatchedValue = currentElementType === 'from' ? inputValueFrom : inputValueTo;
16192
16458
  if (typeof inputValue === 'string' && inputValue.length && inputValue.length < expectedDateLength) {
16193
16459
  setIsOpen(false);
16194
- setTimeout(() => {
16195
- maskInputRef.current.focus();
16196
- }, 10);
16197
16460
  }
16198
16461
  let newDateTime;
16199
16462
  if (typeof inputValue === 'string' && inputValue.length === expectedDateLength) {
16200
16463
  newDateTime = external_luxon_namespaceObject.DateTime.fromFormat(inputValue, luxonFormat);
16201
- setValue(currentName, inputValue);
16202
- processValue(inputValue, elementName);
16464
+ // Avoid redundant setValue to prevent React Hook Form update loops
16465
+ if (currentWatchedValue !== inputValue) {
16466
+ setValue(currentName, inputValue);
16467
+ }
16468
+ // Do NOT validate immediately here to avoid blocking mid-edit scenarios and feedback loops.
16469
+ // Validation will happen on blur explicitly.
16203
16470
  }
16204
16471
  const newCalendarViewDateTime = newDateTime && newDateTime.isValid ? newDateTime : undefined;
16205
16472
  if (newCalendarViewDateTime) {
@@ -16247,56 +16514,95 @@ const useDateRangePicker = ({
16247
16514
  }
16248
16515
  }, [inputValueTo]);
16249
16516
  (0,external_react_namespaceObject.useEffect)(() => {
16250
- const currentIndex = lastFocusedElement === 'from' ? 0 : 1;
16251
- const currentInputValue = currentIndex === 0 ? inputValueFrom : inputValueTo;
16252
- if (dateTime?.[currentIndex]) {
16253
- const newValue = dateTime[currentIndex].toFormat(luxonFormat);
16254
- if (currentInputValue !== newValue) {
16255
- setValue(currentName, newValue);
16517
+ // Only sync when dateTime actually changes (from calendar selection or programmatic change)
16518
+ // Don't sync when only inputValue changes (user typing)
16519
+ const dateTimeChanged = previousDateTime.current[0]?.toMillis() !== dateTime[0]?.toMillis() || previousDateTime.current[1]?.toMillis() !== dateTime[1]?.toMillis();
16520
+
16521
+ // Initialize on first run
16522
+ if (previousDateTime.current[0] === undefined && previousDateTime.current[1] === undefined && (dateTime[0] !== undefined || dateTime[1] !== undefined)) {
16523
+ previousDateTime.current = [dateTime[0], dateTime[1]];
16524
+ // Continue to sync on initialization
16525
+ } else if (!dateTimeChanged) {
16526
+ // dateTime hasn't changed, don't sync (user is typing)
16527
+ return;
16528
+ } else {
16529
+ // Update previous dateTime
16530
+ previousDateTime.current = [dateTime[0], dateTime[1]];
16531
+ }
16532
+ const nextFromValue = dateTime[0]?.toFormat(luxonFormat);
16533
+ if (nextFromValue) {
16534
+ // Sync dateTime to form when dateTime changed (calendar selection)
16535
+ // Don't overwrite if user is actively typing (input is focused and partial)
16536
+ const isInputFocused = inputFromRef.current && document.activeElement === inputFromRef.current || inputToRef.current && document.activeElement === inputToRef.current;
16537
+ if (!inputValueFrom) {
16538
+ // Input is empty - sync from dateTime
16539
+ setValue(nameFrom, nextFromValue);
16540
+ } else if (inputValueFrom === nextFromValue) {
16541
+ // Already in sync - no action needed
16542
+ } else if (inputValueFrom.length < expectedDateLength && isInputFocused) {
16543
+ // User is actively typing partial input - don't overwrite
16544
+ } else {
16545
+ // dateTime changed (calendar selection) - sync to form
16546
+ setValue(nameFrom, nextFromValue);
16256
16547
  }
16257
16548
  }
16258
- }, [dateTime, lastFocusedElement, currentName]);
16549
+ const nextToValue = dateTime[1]?.toFormat(luxonFormat);
16550
+ if (nextToValue) {
16551
+ // Sync dateTime to form when dateTime changed (calendar selection)
16552
+ // Don't overwrite if user is actively typing (input is focused and partial)
16553
+ const isInputFocused = inputFromRef.current && document.activeElement === inputFromRef.current || inputToRef.current && document.activeElement === inputToRef.current;
16554
+ if (!inputValueTo) {
16555
+ // Input is empty - sync from dateTime
16556
+ setValue(nameTo, nextToValue);
16557
+ } else if (inputValueTo === nextToValue) {
16558
+ // Already in sync - no action needed
16559
+ } else if (inputValueTo.length < expectedDateLength && isInputFocused) {
16560
+ // User is actively typing partial input - don't overwrite
16561
+ } else {
16562
+ // dateTime changed (calendar selection) - sync to form
16563
+ setValue(nameTo, nextToValue);
16564
+ }
16565
+ }
16566
+ }, [dateTime, inputValueFrom, inputValueTo, luxonFormat, nameFrom, nameTo, setValue, expectedDateLength, inputFromRef, inputToRef]);
16259
16567
  (0,external_react_namespaceObject.useEffect)(() => {
16260
16568
  if (dateTime[0] && dateTime[1] && dateTime[0] > dateTime[1]) {
16569
+ // When dates are in reverse order, swap them silently
16570
+ // Calendar only opens via user click on icon button, not automatically
16261
16571
  if (lastFocusedElement === 'from') {
16262
- resetField(nameTo);
16263
16572
  setDateTime([dateTime[0], undefined]);
16264
16573
  setLastChangedDate([dateTime[0].toJSDate(), undefined]);
16265
16574
  setValue(nameTo, undefined);
16266
- setLastFocusedElement('to');
16267
- setTimeout(() => {
16268
- setFocus(nameTo, {
16269
- shouldSelect: true
16270
- });
16271
- }, 50);
16272
- setIsOpen(true);
16273
16575
  } else {
16274
- resetField(nameFrom);
16275
16576
  setDateTime([undefined, dateTime[1]]);
16276
16577
  setLastChangedDate([undefined, dateTime[1].toJSDate()]);
16277
16578
  setValue(nameFrom, undefined);
16278
- setLastFocusedElement('from');
16279
- setTimeout(() => {
16280
- setFocus(nameFrom, {
16281
- shouldSelect: true
16282
- });
16283
- }, 50);
16284
- setIsOpen(true);
16285
16579
  }
16286
16580
  }
16287
- }, [dateTime]);
16581
+ }, [dateTime, lastFocusedElement, nameFrom, nameTo, setValue]);
16288
16582
  (0,external_react_namespaceObject.useEffect)(() => {
16289
16583
  if (previousOpenState.current !== isOpen) {
16290
16584
  if (isOpen) {
16291
16585
  onOpen?.();
16586
+ setRangeSelectionStep('start');
16587
+ setLastFocusedElement('from');
16588
+ // Sync calendar view with current dateTime when opening
16589
+ // This ensures preselected dates are visible in the calendar
16590
+ if (dateTime[0] || dateTime[1]) {
16591
+ setCalendarViewDateTime([dateTime[0] || dateTime[1] || external_luxon_namespaceObject.DateTime.now().set({
16592
+ day: 1
16593
+ }), dateTime[1] || dateTime[0] || external_luxon_namespaceObject.DateTime.now().set({
16594
+ day: 1
16595
+ })]);
16596
+ }
16292
16597
  } else {
16293
16598
  onClose?.();
16599
+ setRangeSelectionStep(null);
16294
16600
  setCalendarType(rangePickerType);
16295
16601
  setCalendarViewDateTime([dateTime[0], dateTime[1]]);
16296
16602
  }
16297
16603
  previousOpenState.current = isOpen;
16298
16604
  }
16299
- }, [isOpen]);
16605
+ }, [isOpen, dateTime, rangePickerType, onOpen, onClose]);
16300
16606
  (0,external_react_namespaceObject.useEffect)(() => {
16301
16607
  const splittedFormat = format.split('/');
16302
16608
  setFormatIndexes({
@@ -16323,27 +16629,18 @@ const useDateRangePicker = ({
16323
16629
  if (Array.isArray(rest.value)) {
16324
16630
  const newDateTimeFrom = typeof rest.value[0] === 'string' && rest.value[0].length === expectedDateLength ? external_luxon_namespaceObject.DateTime.fromFormat(rest.value[0], luxonFormat) : undefined;
16325
16631
  const newDateTimeTo = typeof rest.value[1] === 'string' && rest.value[1].length === expectedDateLength ? external_luxon_namespaceObject.DateTime.fromFormat(rest.value[1], luxonFormat) : undefined;
16326
- const newDateTime = [newDateTimeFrom?.isValid ? newDateTimeFrom : undefined, newDateTimeTo?.isValid ? newDateTimeTo : undefined];
16632
+ const newDateTime = [newDateTimeFrom?.isValid ? newDateTimeFrom.startOf('day') : undefined, newDateTimeTo?.isValid ? newDateTimeTo.startOf('day') : undefined];
16327
16633
  setDateTime(newDateTime);
16328
16634
  setLastChangedDate([newDateTime[0]?.toJSDate(), newDateTime[1]?.toJSDate()]);
16635
+ // Sync calendar view with the new dates so they're visible when calendar opens
16636
+ setCalendarViewDateTime([newDateTime[0] || newDateTime[1] || undefined, newDateTime[1] || newDateTime[0] || undefined]);
16329
16637
  setValue(nameFrom, newDateTime[0]?.toFormat(luxonFormat));
16330
16638
  setValue(nameTo, newDateTime[1]?.toFormat(luxonFormat));
16331
16639
  }
16332
- }, [rest.value]);
16640
+ }, [rest.value, expectedDateLength, luxonFormat, nameFrom, nameTo, setValue, _name]);
16333
16641
  (0,external_react_namespaceObject.useEffect)(() => {
16334
16642
  setStatus(rest.status);
16335
16643
  }, [rest.status]);
16336
- (0,external_react_namespaceObject.useEffect)(() => {
16337
- if (lastChangedDate[0] || lastChangedDate[1]) {
16338
- if (lastFocusedElement === 'from' && !lastChangedDate[1]) {
16339
- setFocus(nameTo);
16340
- }
16341
- if (lastFocusedElement === 'to' && !lastChangedDate[0]) {
16342
- setFocus(nameFrom);
16343
- inputFromRef.current?.focus();
16344
- }
16345
- }
16346
- }, [lastChangedDate]);
16347
16644
  (0,external_react_namespaceObject.useEffect)(() => {
16348
16645
  if (calendarViewDateTime[0] && !calendarViewDateTime[1]) {
16349
16646
  setCalendarViewDateTime([calendarViewDateTime[0], calendarViewDateTime[0]]);
@@ -16358,11 +16655,20 @@ const useDateRangePicker = ({
16358
16655
  }
16359
16656
  }, [isOpenState]);
16360
16657
  (0,external_react_namespaceObject.useEffect)(() => {
16361
- if (defaultValue) {
16362
- setValue(nameFrom, defaultValue[0]);
16363
- setValue(nameTo, defaultValue[1]);
16658
+ // Only process defaultValue once on mount to avoid re-processing
16659
+ if (Array.isArray(defaultValue) && !defaultValueProcessed.current) {
16660
+ const defaultDateTimeFrom = typeof defaultValue[0] === 'string' && defaultValue[0].length === expectedDateLength ? external_luxon_namespaceObject.DateTime.fromFormat(defaultValue[0], luxonFormat) : undefined;
16661
+ const defaultDateTimeTo = typeof defaultValue[1] === 'string' && defaultValue[1].length === expectedDateLength ? external_luxon_namespaceObject.DateTime.fromFormat(defaultValue[1], luxonFormat) : undefined;
16662
+ const newDateTime = [defaultDateTimeFrom?.isValid ? defaultDateTimeFrom.startOf('day') : undefined, defaultDateTimeTo?.isValid ? defaultDateTimeTo.startOf('day') : undefined];
16663
+ setDateTime(newDateTime);
16664
+ setLastChangedDate([newDateTime[0]?.toJSDate(), newDateTime[1]?.toJSDate()]);
16665
+ // Sync calendar view with default dates so they're visible when calendar opens
16666
+ setCalendarViewDateTime([newDateTime[0] || newDateTime[1] || undefined, newDateTime[1] || newDateTime[0] || undefined]);
16667
+ setValue(nameFrom, newDateTime[0]?.toFormat(luxonFormat));
16668
+ setValue(nameTo, newDateTime[1]?.toFormat(luxonFormat));
16669
+ defaultValueProcessed.current = true;
16364
16670
  }
16365
- }, []);
16671
+ }, [defaultValue, expectedDateLength, luxonFormat, nameFrom, nameTo, setCalendarViewDateTime, setValue, _name]);
16366
16672
  return {
16367
16673
  formatIndexes,
16368
16674
  dateMinParts,
@@ -16373,7 +16679,6 @@ const useDateRangePicker = ({
16373
16679
  inputValueFrom,
16374
16680
  inputValueTo,
16375
16681
  calendarViewDateTime,
16376
- maskInputRef,
16377
16682
  calendarType,
16378
16683
  lastChangedDate,
16379
16684
  luxonFormat,
@@ -16384,16 +16689,24 @@ const useDateRangePicker = ({
16384
16689
  currentCalendarViewDT,
16385
16690
  isOpen,
16386
16691
  status,
16387
- inputFromRef: (0,external_floating_ui_react_namespaceObject.useMergeRefs)([maskInputRef, inputFromRef]),
16388
- inputToRef: (0,external_floating_ui_react_namespaceObject.useMergeRefs)([maskInputRef, inputToRef]),
16692
+ inputFromRef: (0,external_floating_ui_react_namespaceObject.useMergeRefs)([maskInputRefFrom, inputFromRef]),
16693
+ inputToRef: (0,external_floating_ui_react_namespaceObject.useMergeRefs)([maskInputRefTo, inputToRef]),
16389
16694
  setIsOpen,
16390
- handleSetIsOpen,
16391
16695
  setLastFocusedElement,
16392
16696
  safeOnChange,
16393
16697
  setCalendarType,
16394
16698
  setCalendarViewDateTime,
16395
16699
  setDateTime,
16396
- handleBlur
16700
+ handleBlur,
16701
+ rangeSelectionStep,
16702
+ setRangeSelectionStep,
16703
+ clearInputValue: field => {
16704
+ const targetName = field === 'from' ? nameFrom : nameTo;
16705
+ clearErrors(targetName);
16706
+ setValue(targetName, undefined);
16707
+ setDateTime(prev => field === 'from' ? [undefined, prev[1]] : [prev[0], undefined]);
16708
+ setLastChangedDate(prev => field === 'from' ? [undefined, prev[1]] : [prev[0], undefined]);
16709
+ }
16397
16710
  };
16398
16711
  };
16399
16712
  ;// ./src/components/DateRangePicker/DateRangePickerProvider.tsx
@@ -16422,7 +16735,7 @@ const DateRangePickerProvider = ({
16422
16735
  };
16423
16736
  const handleToggleOpen = e => {
16424
16737
  const tagName = e.currentTarget.tagName.toLowerCase();
16425
- if (rest.openCalendarMode === 'both' || rest.openCalendarMode === 'input' && tagName === 'input' || rest.openCalendarMode === 'icon' && tagName === 'button') {
16738
+ if (tagName === 'button') {
16426
16739
  toggleOpen();
16427
16740
  }
16428
16741
  if (tagName === 'input' && rest.inputProps?.inputProps?.onClick) {
@@ -16449,7 +16762,6 @@ const DateRangePickerProvider = ({
16449
16762
 
16450
16763
  const DateRangePicker = ({
16451
16764
  format,
16452
- openCalendarMode = 'icon',
16453
16765
  showCalendarIcon = true,
16454
16766
  showStatusArea = true,
16455
16767
  rangePickerType = 'days',
@@ -16458,7 +16770,6 @@ const DateRangePicker = ({
16458
16770
  const actualFormat = format || getFormatForRangePickerType(rangePickerType);
16459
16771
  return (0,jsx_runtime_namespaceObject.jsx)(DateRangePickerProvider, {
16460
16772
  format: actualFormat,
16461
- openCalendarMode: openCalendarMode,
16462
16773
  showCalendarIcon: showCalendarIcon,
16463
16774
  showStatusArea: showStatusArea,
16464
16775
  rangePickerType: rangePickerType,
@@ -18173,52 +18484,6 @@ const FiltersMultiSelectOptions = ({
18173
18484
  ;// ./src/components/Icon/index.ts
18174
18485
 
18175
18486
 
18176
- ;// ./src/components/ImageItem/ImageItem.tsx
18177
- function ImageItem_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
18178
-
18179
-
18180
-
18181
-
18182
- var ImageItem_ref = true ? {
18183
- name: "c5ejfv",
18184
- styles: "gap:8px;text-decoration:none"
18185
- } : 0;
18186
- const ImageItem = ({
18187
- children,
18188
- image,
18189
- avatarSize = 24,
18190
- link = '',
18191
- openLinkInNewTab = false,
18192
- className
18193
- }) => {
18194
- const theme = (0,react_namespaceObject.useTheme)();
18195
- const additionalProps = link ? {
18196
- href: link,
18197
- target: openLinkInNewTab ? '_blank' : undefined
18198
- } : {};
18199
- return (0,jsx_runtime_namespaceObject.jsxs)(Wrapper_Wrapper, {
18200
- css: ImageItem_ref,
18201
- as: link ? 'a' : 'div',
18202
- className: className,
18203
- "data-testid": "image-item",
18204
- ...additionalProps,
18205
- children: [(0,jsx_runtime_namespaceObject.jsx)(Avatar_Avatar, {
18206
- size: avatarSize,
18207
- image: image
18208
- }), (0,jsx_runtime_namespaceObject.jsx)("span", {
18209
- css: /*#__PURE__*/(0,react_namespaceObject.css)({
18210
- color: theme.colors.greyDarker,
18211
- fontSize: 14,
18212
- fontWeight: 500,
18213
- cursor: link ? 'pointer' : 'default',
18214
- '&:hover': {
18215
- color: link ? theme.colors.blue : theme.colors.greyDarker
18216
- }
18217
- }, true ? "" : 0, true ? "" : 0),
18218
- children: children
18219
- })]
18220
- });
18221
- };
18222
18487
  ;// ./src/components/ImageItem/index.ts
18223
18488
 
18224
18489
  ;// ./src/components/LinksTabBar/LinksTabBarBase.tsx
@@ -21132,10 +21397,22 @@ const RadioWidget = props => {
21132
21397
  }, i)) : undefined
21133
21398
  });
21134
21399
  };
21400
+ ;// ./src/components/JsonSchemaForm/constants.ts
21401
+ const DEFAULT_AVATAR_SIZE = 24;
21135
21402
  ;// ./src/components/JsonSchemaForm/widgets/SelectWidget.tsx
21136
21403
 
21137
21404
 
21138
21405
 
21406
+
21407
+ const getAvatarNode = (option, uiOptions) => {
21408
+ const avatar = option.schema?.avatar;
21409
+ if (!avatar) return;
21410
+ const avatarSize = uiOptions.typeaheadAvatarSize ?? DEFAULT_AVATAR_SIZE;
21411
+ return (0,jsx_runtime_namespaceObject.jsx)(Avatar_Avatar, {
21412
+ size: avatarSize,
21413
+ image: avatar
21414
+ });
21415
+ };
21139
21416
  const SelectWidget = props => {
21140
21417
  const {
21141
21418
  id,
@@ -21156,6 +21433,7 @@ const SelectWidget = props => {
21156
21433
  enumDisabled = []
21157
21434
  } = options;
21158
21435
  const customPlaceholder = placeholder || uiSchema?.['ui:placeholder'];
21436
+ const selectUiOptions = uiSchema?.['ui:options'] || {};
21159
21437
  const isMultiple = !!multiple || Array.isArray(value);
21160
21438
  const items = Array.isArray(enumOptions) ? enumOptions : [];
21161
21439
  const handleChange = onChangeOverride ? onChangeOverride : value => {
@@ -21183,8 +21461,7 @@ const SelectWidget = props => {
21183
21461
  };
21184
21462
  const handleTypeaheadChange = (changedValue, isAdded) => {
21185
21463
  if (isMultiple) {
21186
- const currentSelected = Array.isArray(selectedItems) ? selectedItems : [];
21187
- const newSelected = isAdded ? [...currentSelected, changedValue] : currentSelected.filter(item => item !== changedValue);
21464
+ const newSelected = isAdded ? [...selectedItems, changedValue] : selectedItems.filter(item => item !== changedValue);
21188
21465
  handleFormChange(newSelected);
21189
21466
  } else {
21190
21467
  const newValue = isAdded ? changedValue : undefined;
@@ -21207,8 +21484,7 @@ const SelectWidget = props => {
21207
21484
  };
21208
21485
  const onRemoveSelectedClick = removedValue => {
21209
21486
  if (isMultiple) {
21210
- const currentSelected = Array.isArray(selectedItems) ? selectedItems : [];
21211
- const newSelected = currentSelected.filter(item => item !== removedValue);
21487
+ const newSelected = selectedItems.filter(item => item !== removedValue);
21212
21488
  handleChange(newSelected);
21213
21489
  } else {
21214
21490
  handleChange(undefined);
@@ -21233,15 +21509,13 @@ const SelectWidget = props => {
21233
21509
  label,
21234
21510
  input
21235
21511
  }) => highlightInputMatch(label, input),
21236
- children: items.map(({
21237
- label,
21238
- value
21239
- }) => (0,jsx_runtime_namespaceObject.jsx)(TypeaheadOption_TypeaheadOption, {
21240
- value: value,
21241
- label: label || value,
21242
- isDisabled: disabled || Array.isArray(enumDisabled) && enumDisabled.includes(value),
21243
- children: label || value
21244
- }, value))
21512
+ children: items.map(item => (0,jsx_runtime_namespaceObject.jsx)(TypeaheadOption_TypeaheadOption, {
21513
+ value: item.value,
21514
+ label: item.label || item.value,
21515
+ avatar: getAvatarNode(item, selectUiOptions),
21516
+ isDisabled: disabled || Array.isArray(enumDisabled) && enumDisabled.includes(item.value),
21517
+ children: item.label || item.value
21518
+ }, item.value))
21245
21519
  })
21246
21520
  });
21247
21521
  };
@@ -21579,6 +21853,7 @@ const JsonSchemaForm_Form = /*#__PURE__*/base_default()(UnstyledForm, true ? {
21579
21853
  styles: ".form-group{margin-bottom:16px;}.form-group:last-child{margin-bottom:0;}"
21580
21854
  } : 0);
21581
21855
 
21856
+
21582
21857
  ;// ./src/components/index.ts
21583
21858
 
21584
21859