@ssa-ui-kit/core 2.1.1-canary-2f77c98-20250310 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -85,6 +85,7 @@ __webpack_require__.d(__webpack_exports__, {
85
85
  CollapsibleNavBarProvider: () => (/* reexport */ CollapsibleNavBarProvider),
86
86
  ColorPicker: () => (/* reexport */ ColorPicker_ColorPicker),
87
87
  DatePicker: () => (/* reexport */ DatePicker),
88
+ DateRangePicker: () => (/* reexport */ DateRangePicker),
88
89
  Drawer: () => (/* reexport */ index_parts_namespaceObject),
89
90
  Dropdown: () => (/* reexport */ Dropdown_Dropdown),
90
91
  DropdownArrow: () => (/* reexport */ DropdownArrow_DropdownArrow),
@@ -92,6 +93,7 @@ __webpack_require__.d(__webpack_exports__, {
92
93
  DropdownOption: () => (/* reexport */ DropdownOption_DropdownOption),
93
94
  DropdownOptions: () => (/* reexport */ DropdownOptions_DropdownOptions),
94
95
  DropdownToggle: () => (/* reexport */ DropdownToggle_DropdownToggle),
96
+ Field: () => (/* reexport */ Field_index_parts_namespaceObject),
95
97
  Filters: () => (/* reexport */ Filters),
96
98
  FiltersMultiSelect: () => (/* reexport */ FiltersMultiSelect),
97
99
  FiltersMultiSelectEmpty: () => (/* reexport */ FiltersMultiSelectEmpty),
@@ -903,6 +905,18 @@ __webpack_require__.d(index_parts_namespaceObject, {
903
905
  Title: () => (DrawerTitle)
904
906
  });
905
907
 
908
+ // NAMESPACE OBJECT: ./src/components/Field/index.parts.ts
909
+ var Field_index_parts_namespaceObject = {};
910
+ __webpack_require__.r(Field_index_parts_namespaceObject);
911
+ __webpack_require__.d(Field_index_parts_namespaceObject, {
912
+ Control: () => (FieldControl),
913
+ Description: () => (FieldDescription),
914
+ Error: () => (FieldError),
915
+ Label: () => (FieldLabel),
916
+ Root: () => (FieldRoot),
917
+ Success: () => (FieldSuccess)
918
+ });
919
+
906
920
  // NAMESPACE OBJECT: ./src/components/Charts/PieChart/colorPalettes.ts
907
921
  var colorPalettes_namespaceObject = {};
908
922
  __webpack_require__.r(colorPalettes_namespaceObject);
@@ -1139,6 +1153,8 @@ const main = {
1139
1153
  //#487de1
1140
1154
  blueRoyal6: 'rgba(72, 125, 225, 0.06)',
1141
1155
  //#487DE1
1156
+ blueRoyal16: 'rgba(72, 125, 225, 0.16)',
1157
+ //#487DE1
1142
1158
  blueRoyal12: 'rgba(72, 125, 225, 0.12)',
1143
1159
  //#487DE1
1144
1160
  dangerShades300: 'rgb(253, 128, 122)',
@@ -4095,16 +4111,16 @@ function Dropdown_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to s
4095
4111
 
4096
4112
 
4097
4113
 
4098
- /**
4099
- * The structure of the component:
4100
- *
4101
- * Dropdown
4102
- * DropdownToggle
4103
- * DropdownOptions
4104
- * DropdownOption
4105
- *
4106
- * Aria attributes are set according to
4107
- * https://www.w3.org/WAI/ARIA/apg/example-index/combobox/combobox-select-only.html
4114
+ /**
4115
+ * The structure of the component:
4116
+ *
4117
+ * Dropdown
4118
+ * DropdownToggle
4119
+ * DropdownOptions
4120
+ * DropdownOption
4121
+ *
4122
+ * Aria attributes are set according to
4123
+ * https://www.w3.org/WAI/ARIA/apg/example-index/combobox/combobox-select-only.html
4108
4124
  **/
4109
4125
 
4110
4126
  const DropdownBase = /*#__PURE__*/base_default()("div", true ? {
@@ -4519,8 +4535,9 @@ const InputBase = /*#__PURE__*/base_default()("input", true ? {
4519
4535
  } : 0)("flex:1;background:", ({
4520
4536
  theme
4521
4537
  }) => theme.colors.white, ";border-radius:12px;background-origin:border-box;background-clip:padding-box,border-box;border:", ({
4538
+ showBorders,
4522
4539
  theme
4523
- }) => `1px solid ${theme.colors.grey}`, ";color:", ({
4540
+ }) => showBorders ? `1px solid ${theme.colors.grey}` : 'none', ";color:", ({
4524
4541
  theme
4525
4542
  }) => theme.colors.greyDarker, ";width:100%;height:44px;padding:14px;font-weight:400;font-size:0.875rem;line-height:1rem;&::placeholder{color:", ({
4526
4543
  theme
@@ -4531,8 +4548,9 @@ const InputBase = /*#__PURE__*/base_default()("input", true ? {
4531
4548
  }) => theme.colors.greyLighter, ";&::placeholder{color:", ({
4532
4549
  theme
4533
4550
  }) => theme.colors.grey, ";}&:disabled,&:disabled:hover{border:", ({
4551
+ showBorders,
4534
4552
  theme
4535
- }) => `1px solid ${theme.colors.grey}`, ";background-image:none;}}" + ( true ? "" : 0));
4553
+ }) => showBorders ? `1px solid ${theme.colors.grey}` : 'none', ";background-image:none;}}" + ( true ? "" : 0));
4536
4554
  ;// ./src/components/Input/InputGroup.tsx
4537
4555
 
4538
4556
  const InputGroup = /*#__PURE__*/base_default()("div", true ? {
@@ -4552,7 +4570,7 @@ const basic = theme => /*#__PURE__*/(0,react_namespaceObject.css)({
4552
4570
  borderColor: theme.colors.greyDarker80
4553
4571
  },
4554
4572
  '&:focus': {
4555
- borderColor: `2px solid ${theme.colors.blueRoyal}`
4573
+ borderColor: theme.colors.blueRoyal
4556
4574
  }
4557
4575
  }
4558
4576
  }, true ? "" : 0, true ? "" : 0);
@@ -4681,6 +4699,8 @@ const InputInner = ({
4681
4699
  maxLength,
4682
4700
  helperText,
4683
4701
  showHelperText = false,
4702
+ showStatusIcon = true,
4703
+ showBorders = true,
4684
4704
  register,
4685
4705
  onKeyUp
4686
4706
  }, inputRef) => {
@@ -4690,7 +4710,7 @@ const InputInner = ({
4690
4710
  }
4691
4711
  }, []);
4692
4712
  const [countChar, setCountChar] = external_react_default().useState(0);
4693
- const showStatusIcon = () => !disabled && !endElement;
4713
+ const showStatusIconByProps = !disabled && !endElement && showStatusIcon;
4694
4714
  const registerResult = register?.(name, validationSchema);
4695
4715
  const handleCount = e => {
4696
4716
  setCountChar(e.currentTarget.value.length);
@@ -4711,6 +4731,7 @@ const InputInner = ({
4711
4731
  }) : null, (0,jsx_runtime_namespaceObject.jsx)(InputBase, {
4712
4732
  type: type,
4713
4733
  id: `formElement-${name}`,
4734
+ showBorders: showBorders,
4714
4735
  placeholder: placeholder,
4715
4736
  disabled: disabled,
4716
4737
  css: /*#__PURE__*/(0,react_namespaceObject.css)({
@@ -4723,9 +4744,9 @@ const InputInner = ({
4723
4744
  ...registerResult,
4724
4745
  onBlur: handleBlur,
4725
4746
  ref: (0,external_floating_ui_react_namespaceObject.useMergeRefs)([registerResult?.ref, inputRef])
4726
- }), status === 'error' && showStatusIcon() ? (0,jsx_runtime_namespaceObject.jsx)(InputStatusError, {
4747
+ }), status === 'error' && showStatusIconByProps ? (0,jsx_runtime_namespaceObject.jsx)(InputStatusError, {
4727
4748
  errorTooltip: errorTooltip
4728
- }) : null, status === 'success' && showStatusIcon() ? (0,jsx_runtime_namespaceObject.jsx)(InputStatusSuccess, {
4749
+ }) : null, status === 'success' && showStatusIconByProps ? (0,jsx_runtime_namespaceObject.jsx)(InputStatusSuccess, {
4729
4750
  successTooltip: successTooltip
4730
4751
  }) : null, endElement ? (0,jsx_runtime_namespaceObject.jsx)("div", {
4731
4752
  css: styles_endElement,
@@ -5208,16 +5229,16 @@ const DropdownPlaceholderLabel = /*#__PURE__*/base_default()("div", true ? {
5208
5229
  styles: "white-space:nowrap;overflow:hidden;text-overflow:ellipsis"
5209
5230
  } : 0);
5210
5231
 
5211
- /**
5212
- * The structure of the component:
5213
- *
5214
- * MultipleDropdown
5215
- * DropdownToggle
5216
- * MultipleDropdownOptions
5217
- * DropdownOption
5218
- *
5219
- * Aria attributes are set according to
5220
- * https://www.w3.org/WAI/ARIA/apg/example-index/combobox/combobox-select-only.html
5232
+ /**
5233
+ * The structure of the component:
5234
+ *
5235
+ * MultipleDropdown
5236
+ * DropdownToggle
5237
+ * MultipleDropdownOptions
5238
+ * DropdownOption
5239
+ *
5240
+ * Aria attributes are set according to
5241
+ * https://www.w3.org/WAI/ARIA/apg/example-index/combobox/combobox-select-only.html
5221
5242
  **/
5222
5243
  function MultipleDropdownInner({
5223
5244
  selectedItems = [],
@@ -5462,8 +5483,8 @@ const NavToggle = ({
5462
5483
 
5463
5484
 
5464
5485
 
5465
- /**
5466
- * UI Component that shows the navigation bar
5486
+ /**
5487
+ * UI Component that shows the navigation bar
5467
5488
  */
5468
5489
  const NavBar = ({
5469
5490
  items
@@ -6713,12 +6734,12 @@ const ProgressVertical = ({
6713
6734
  /* harmony default export */ const ProgressVertical_ProgressVertical = (ProgressVertical);
6714
6735
  ;// ./src/components/ResponsiveImage/ResponsiveImage.tsx
6715
6736
 
6716
- /**
6717
- * A simple wrapper over the `<img />` tag.
6718
- *
6719
- * Don't forget to adjust Device Pixel Ratio in DevTools
6720
- * when testing srcSet, and use Hard Reload to force the
6721
- * browser to load an image of another resolution.
6737
+ /**
6738
+ * A simple wrapper over the `<img />` tag.
6739
+ *
6740
+ * Don't forget to adjust Device Pixel Ratio in DevTools
6741
+ * when testing srcSet, and use Hard Reload to force the
6742
+ * browser to load an image of another resolution.
6722
6743
  * */
6723
6744
  const ResponsiveImage = ({
6724
6745
  src,
@@ -7129,12 +7150,12 @@ const TabBarBase = /*#__PURE__*/base_default()("div", true ? {
7129
7150
  target: "e1hg26v10"
7130
7151
  } : 0)( true ? "" : 0);
7131
7152
 
7132
- /**
7133
- * This component doesn't show contents of the selected tab,
7134
- * however it accepts a required `renderContent()` render
7135
- * prop and stores it into the Context. This lets the parent
7136
- * component to decide where to render the contents of the
7137
- * selected tab.
7153
+ /**
7154
+ * This component doesn't show contents of the selected tab,
7155
+ * however it accepts a required `renderContent()` render
7156
+ * prop and stores it into the Context. This lets the parent
7157
+ * component to decide where to render the contents of the
7158
+ * selected tab.
7138
7159
  * */
7139
7160
  const TabBar = ({
7140
7161
  children
@@ -7451,13 +7472,13 @@ const useTooltipContext = () => {
7451
7472
 
7452
7473
 
7453
7474
 
7454
- /*
7455
- * <Tooltip>
7456
- * <TooltipTrigger>
7457
- * <Button />
7458
- * </TooltipTrigger>
7459
- * <TooltipContent>Tooltip</TooltipContent>
7460
- * </Tooltip>
7475
+ /*
7476
+ * <Tooltip>
7477
+ * <TooltipTrigger>
7478
+ * <Button />
7479
+ * </TooltipTrigger>
7480
+ * <TooltipContent>Tooltip</TooltipContent>
7481
+ * </Tooltip>
7461
7482
  * */
7462
7483
  const Tooltip = ({
7463
7484
  children,
@@ -7931,9 +7952,9 @@ var CardList_ref = true ? {
7931
7952
  name: "1fgo50s",
7932
7953
  styles: "list-style:none;padding:0;li{margin-bottom:15px;}"
7933
7954
  } : 0;
7934
- /**
7935
- *
7936
- * UI Component that renders a list of items with a custom render function
7955
+ /**
7956
+ *
7957
+ * UI Component that renders a list of items with a custom render function
7937
7958
  */
7938
7959
  const CardList = ({
7939
7960
  title,
@@ -8803,8 +8824,8 @@ const SCREEN_SIZES = {
8803
8824
 
8804
8825
 
8805
8826
 
8806
- /**
8807
- * UI Component that shows the collapsible navigation bar
8827
+ /**
8828
+ * UI Component that shows the collapsible navigation bar
8808
8829
  */
8809
8830
 
8810
8831
  const CollapsibleNavBar = ({
@@ -8896,7 +8917,9 @@ const external_luxon_namespaceObject = require("luxon");
8896
8917
 
8897
8918
  const DaysViewCell = /*#__PURE__*/base_default()(Wrapper_Wrapper, true ? {
8898
8919
  target: "e19kqgld2"
8899
- } : 0)("width:40px;height:40px;justify-content:center;font-size:14px;font-weight:500;border-radius:6px;border:", ({
8920
+ } : 0)("position:relative;width:40px;height:40px;justify-content:center;font-size:14px;font-weight:500;border-radius:", ({
8921
+ isHighlighted
8922
+ }) => isHighlighted ? 0 : '6px', ";border:", ({
8900
8923
  theme,
8901
8924
  isCalendarDateNow
8902
8925
  }) => isCalendarDateNow ? `1px solid ${theme.colors.greyFocused}` : 'none', ";color:", ({
@@ -8905,46 +8928,96 @@ const DaysViewCell = /*#__PURE__*/base_default()(Wrapper_Wrapper, true ? {
8905
8928
  }) => isCalendarDateSelected ? theme.colors.white : theme.colors.greyDarker, ";background:", ({
8906
8929
  theme,
8907
8930
  isCalendarDateSelected
8908
- }) => isCalendarDateSelected ? `linear-gradient(247deg, ${theme.colors.blueLighter} 14.71%, ${theme.colors.blue} 85.29%)` : 'none', ";cursor:pointer;user-select:none;&[aria-disabled='true']{color:", ({
8931
+ }) => isCalendarDateSelected && `linear-gradient(247deg, ${theme.colors.blueLighter} 14.71%, ${theme.colors.blue} 85.29%)`, ";cursor:pointer;user-select:none;&[aria-disabled='true']{color:", ({
8909
8932
  theme
8910
- }) => theme.colors.grey, ";cursor:default;pointer-events:none;}&[aria-disabled='false']:hover{background:", ({
8933
+ }) => theme.colors.grey, ";cursor:default;pointer-events:none;}&[aria-disabled='false']{background:", ({
8934
+ theme,
8935
+ isCalendarDateSelected,
8936
+ isHighlighted
8937
+ }) => isHighlighted && !isCalendarDateSelected && theme.colors.blueRoyal16, ";&:hover{background:", ({
8911
8938
  theme
8912
8939
  }) => theme.colors.greyLighter, ";color:", ({
8913
8940
  theme
8914
- }) => theme.colors.greyDarker, ";}&:hover{border:", ({
8941
+ }) => theme.colors.greyDarker, ";}&::before{content:'';display:", ({
8942
+ isCalendarFirstDateSelected,
8943
+ isCalendarSecondDateSelected
8944
+ }) => isCalendarFirstDateSelected || isCalendarSecondDateSelected ? 'block' : 'none', ";position:absolute;width:10px;height:40px;left:", ({
8945
+ isCalendarFirstDateSelected
8946
+ }) => isCalendarFirstDateSelected ? '0' : 'auto', ";right:", ({
8947
+ isCalendarSecondDateSelected
8948
+ }) => isCalendarSecondDateSelected ? '0' : 'auto', ";z-index:-1;background:", ({
8949
+ theme
8950
+ }) => theme.colors.blueRoyal16, ";}}&:hover{border:", ({
8915
8951
  theme,
8916
8952
  isCalendarDateNow
8917
8953
  }) => isCalendarDateNow && `1px solid ${theme.colors.greyFocused}`, ";}" + ( true ? "" : 0));
8918
8954
  const YearsViewCell = /*#__PURE__*/base_default()("div", true ? {
8919
8955
  target: "e19kqgld1"
8920
- } : 0)("display:flex;justify-content:center;align-items:center;width:70px;height:40px;border-radius:6px;font-size:14px;font-weight:500px;user-select:none;cursor:pointer;color:", ({
8956
+ } : 0)("display:flex;justify-content:center;position:relative;align-items:center;width:70px;height:40px;border-radius:", ({
8957
+ isCalendarFirstDateSelected,
8958
+ isCalendarSecondDateSelected
8959
+ }) => isCalendarFirstDateSelected || isCalendarSecondDateSelected ? '6px' : 0, ";font-size:14px;font-weight:500px;user-select:none;cursor:pointer;color:", ({
8921
8960
  theme,
8922
- isCalendarYear
8923
- }) => isCalendarYear && theme.colors.white, ";background:", ({
8961
+ isCalendarYear,
8962
+ isCalendarSecondDateSelected
8963
+ }) => (isCalendarYear || isCalendarSecondDateSelected) && theme.colors.white, ";background:", ({
8924
8964
  theme,
8965
+ isCalendarYear,
8966
+ isCalendarSecondDateSelected
8967
+ }) => isCalendarYear || isCalendarSecondDateSelected ? `linear-gradient(247.37deg, ${theme.colors.blueLighter} 14.71%, ${theme.colors.blue} 85.29%)` : 'none', ";background:", ({
8968
+ theme,
8969
+ isHighlighted,
8925
8970
  isCalendarYear
8926
- }) => isCalendarYear ? `linear-gradient(247.37deg, ${theme.colors.blueLighter} 14.71%, ${theme.colors.blue} 85.29%)` : 'none', ";&:hover{background:", ({
8971
+ }) => isHighlighted && !isCalendarYear && theme.colors.blueRoyal16, ";&:hover{background:", ({
8927
8972
  theme
8928
8973
  }) => theme.colors.greyLighter, ";color:", ({
8929
8974
  theme
8930
- }) => theme.colors.greyDarker, ";}" + ( true ? "" : 0));
8975
+ }) => theme.colors.greyDarker, ";}&::before{content:'';display:", ({
8976
+ isCalendarFirstDateSelected,
8977
+ isCalendarSecondDateSelected
8978
+ }) => isCalendarFirstDateSelected || isCalendarSecondDateSelected ? 'block' : 'none', ";position:absolute;width:10px;height:40px;left:", ({
8979
+ isCalendarSecondDateSelected
8980
+ }) => isCalendarSecondDateSelected ? '0' : 'auto', ";right:", ({
8981
+ isCalendarFirstDateSelected
8982
+ }) => isCalendarFirstDateSelected ? '0' : 'auto', ";z-index:-1;background:", ({
8983
+ theme
8984
+ }) => theme.colors.blueRoyal16, ";}" + ( true ? "" : 0));
8931
8985
  const MonthsViewCell = /*#__PURE__*/base_default()("div", true ? {
8932
8986
  target: "e19kqgld0"
8933
- } : 0)("display:flex;justify-content:center;align-items:center;width:99px;height:40px;border-radius:6px;font-size:14px;font-weight:500px;cursor:pointer;color:", ({
8987
+ } : 0)("display:flex;justify-content:center;position:relative;align-items:center;width:99px;height:40px;border-radius:", ({
8988
+ isCalendarFirstDateSelected,
8989
+ isCalendarSecondDateSelected
8990
+ }) => isCalendarFirstDateSelected || isCalendarSecondDateSelected ? '6px' : 0, ";font-size:14px;font-weight:500;cursor:pointer;color:", ({
8934
8991
  theme,
8935
- isCalendarMonth
8936
- }) => isCalendarMonth && theme.colors.white, ";user-select:none;background:", ({
8992
+ isCalendarMonth,
8993
+ isCalendarSecondDateSelected
8994
+ }) => (isCalendarMonth || isCalendarSecondDateSelected) && theme.colors.white, ";user-select:none;background:", ({
8937
8995
  theme,
8938
- isCalendarMonth
8939
- }) => isCalendarMonth ? `linear-gradient(247.37deg, ${theme.colors.blueLighter} 14.71%, ${theme.colors.blue} 85.29%)` : 'none', ";&[aria-disabled='true']{cursor:default;pointer-events:none;color:", ({
8996
+ isCalendarMonth,
8997
+ isCalendarSecondDateSelected
8998
+ }) => isCalendarMonth || isCalendarSecondDateSelected ? `linear-gradient(247.37deg, ${theme.colors.blueLighter} 14.71%, ${theme.colors.blue} 85.29%)` : 'none', ";&[aria-disabled='true']{cursor:default;pointer-events:none;color:", ({
8940
8999
  theme
8941
9000
  }) => theme.colors.greyDarker, ";background:", ({
8942
9001
  theme
8943
- }) => theme.colors.grey, ";}&[aria-disabled='false']:hover{background:", ({
9002
+ }) => theme.colors.grey, ";}&[aria-disabled='false']{background:", ({
9003
+ theme,
9004
+ isHighlighted,
9005
+ isCalendarMonth,
9006
+ isCalendarSecondDateSelected
9007
+ }) => isHighlighted && !isCalendarMonth && !isCalendarSecondDateSelected && theme.colors.blueRoyal16, ";&:hover{background:", ({
8944
9008
  theme
8945
9009
  }) => theme.colors.greyLighter, ";color:", ({
8946
9010
  theme
8947
- }) => theme.colors.greyDarker, ";}" + ( true ? "" : 0));
9011
+ }) => theme.colors.greyDarker, ";}&::before{content:'';display:", ({
9012
+ isCalendarFirstDateSelected,
9013
+ isCalendarSecondDateSelected
9014
+ }) => isCalendarFirstDateSelected || isCalendarSecondDateSelected ? 'block' : 'none', ";position:absolute;width:10px;height:40px;left:", ({
9015
+ isCalendarSecondDateSelected
9016
+ }) => isCalendarSecondDateSelected ? '0' : 'auto', ";right:", ({
9017
+ isCalendarFirstDateSelected
9018
+ }) => isCalendarFirstDateSelected ? '0' : 'auto', ";z-index:-1;background:", ({
9019
+ theme
9020
+ }) => theme.colors.blueRoyal16, ";}}" + ( true ? "" : 0));
8948
9021
  ;// ./src/components/DatePicker/utils/dates.ts
8949
9022
 
8950
9023
  const getDaysForCalendarMonth = date => {
@@ -9103,6 +9176,12 @@ const useDatePicker = ({
9103
9176
  });
9104
9177
  const [isLoading, setLoading] = (0,external_react_namespaceObject.useState)(true);
9105
9178
  const [dateTime, setDateTime] = (0,external_react_namespaceObject.useState)();
9179
+ const [lastChangedDate, setLastChangedDate] = (0,external_react_namespaceObject.useState)(undefined);
9180
+ const [dateTimeForChangeEvent, setDateTimeForChangeEvent] = (0,external_react_namespaceObject.useState)(undefined);
9181
+ const [currentError, setCurrentError] = (0,external_react_namespaceObject.useState)({
9182
+ date: null,
9183
+ error: null
9184
+ });
9106
9185
  const [isOpen, setIsOpen] = (0,external_react_namespaceObject.useState)(false);
9107
9186
  const splittedFormat = format.split('/');
9108
9187
  const [formatIndexes, setFormatIndexes] = (0,external_react_namespaceObject.useState)({
@@ -9131,6 +9210,31 @@ const useDatePicker = ({
9131
9210
  month: dateMinParts[formatIndexes['month']],
9132
9211
  day: dateMinParts[formatIndexes['day']]
9133
9212
  });
9213
+ const safeOnChange = newDateTime => {
9214
+ const _newDateTime = newDateTime ? newDateTime.startOf('day') : undefined;
9215
+ const _dateTimeForChangeEvent = dateTimeForChangeEvent ? dateTimeForChangeEvent.startOf('day') : undefined;
9216
+ if (_newDateTime?.toMillis() !== _dateTimeForChangeEvent?.toMillis()) {
9217
+ setDateTimeForChangeEvent(newDateTime);
9218
+ if (_newDateTime) {
9219
+ setLastChangedDate(_newDateTime.toJSDate());
9220
+ onChange?.(_newDateTime.toJSDate());
9221
+ } else {
9222
+ setLastChangedDate(undefined);
9223
+ onChange?.();
9224
+ }
9225
+ }
9226
+ };
9227
+
9228
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9229
+ const safeOnError = (date, error) => {
9230
+ if (currentError.date !== date && currentError.error !== error) {
9231
+ setCurrentError({
9232
+ date,
9233
+ error
9234
+ });
9235
+ onError?.(date, error);
9236
+ }
9237
+ };
9134
9238
  const processValue = newValue => {
9135
9239
  const newDateTime = typeof newValue === 'string' && newValue.length === 10 ? external_luxon_namespaceObject.DateTime.fromFormat(newValue, luxonFormat) : undefined;
9136
9240
  if (!newDateTime?.isValid) {
@@ -9141,8 +9245,8 @@ const useDatePicker = ({
9141
9245
  shouldFocus: true
9142
9246
  });
9143
9247
  setDateTime(undefined);
9144
- onChange?.();
9145
- onError?.(newValue, errorMessage);
9248
+ safeOnChange();
9249
+ safeOnError?.(newValue, errorMessage);
9146
9250
  } else if (newDateTime !== undefined) {
9147
9251
  if (newDateTime < dateMinDT || newDateTime > dateMaxDT) {
9148
9252
  const errorMessage = OUT_OF_RANGE;
@@ -9152,23 +9256,25 @@ const useDatePicker = ({
9152
9256
  shouldFocus: true
9153
9257
  });
9154
9258
  setDateTime(undefined);
9155
- onError?.(newValue, errorMessage);
9156
- onChange?.();
9259
+ safeOnError?.(newValue, errorMessage);
9260
+ safeOnChange();
9157
9261
  } else {
9158
9262
  setDateTime(newDateTime);
9159
9263
  clearErrors();
9160
- onError?.(null);
9161
- onChange?.(newDateTime.toJSDate());
9264
+ safeOnError?.(null);
9265
+ safeOnChange?.(newDateTime);
9162
9266
  }
9163
9267
  }
9164
9268
  };
9165
9269
  const handleBlur = event => {
9166
9270
  event.preventDefault();
9167
9271
  const blurredValue = event.currentTarget.value;
9168
- processValue(blurredValue);
9272
+ if (blurredValue.length > 0) {
9273
+ processValue(blurredValue);
9274
+ }
9169
9275
  };
9170
9276
  (0,external_react_namespaceObject.useEffect)(() => {
9171
- if (typeof inputValue === 'string' && inputValue.length < 10) {
9277
+ if (typeof inputValue === 'string' && inputValue.length && inputValue.length < 10) {
9172
9278
  setIsOpen(false);
9173
9279
  setTimeout(() => {
9174
9280
  maskInputRef.current.focus();
@@ -9262,6 +9368,9 @@ const useDatePicker = ({
9262
9368
  calendarViewDateTime,
9263
9369
  maskInputRef,
9264
9370
  calendarType,
9371
+ lastChangedDate,
9372
+ luxonFormat,
9373
+ safeOnChange,
9265
9374
  setCalendarType,
9266
9375
  setCalendarViewDateTime,
9267
9376
  setDateTime,
@@ -9284,6 +9393,7 @@ const DatePickerContext = /*#__PURE__*/(0,external_react_namespaceObject.createC
9284
9393
  inputRef: {
9285
9394
  current: null
9286
9395
  },
9396
+ inputProps: {},
9287
9397
  isOpen: false,
9288
9398
  calendarType: 'days',
9289
9399
  inputValue: undefined,
@@ -9324,6 +9434,11 @@ const DatePickerProvider = ({
9324
9434
  restHook.handleBlur(e);
9325
9435
  rest.onBlur?.(e);
9326
9436
  };
9437
+ (0,external_react_namespaceObject.useEffect)(() => {
9438
+ if (typeof rest.isOpenToggle === 'boolean') {
9439
+ restHook.setIsOpen(current => !current);
9440
+ }
9441
+ }, [rest.isOpenToggle]);
9327
9442
  return (0,jsx_runtime_namespaceObject.jsx)(DatePickerContext.Provider, {
9328
9443
  value: {
9329
9444
  ...rest,
@@ -9367,16 +9482,23 @@ const DaysView = () => {
9367
9482
  calendarViewDateTime,
9368
9483
  dateMinDT,
9369
9484
  dateMaxDT,
9485
+ lastChangedDate,
9486
+ highlightDates,
9370
9487
  setCalendarViewDateTime,
9371
9488
  setDateTime,
9372
9489
  setIsOpen,
9373
- onChange
9490
+ safeOnChange
9374
9491
  } = useDatePickerContext();
9375
9492
  const selectedDateTime = dateTime?.toFormat('D');
9376
9493
  const currentDate = calendarViewDateTime?.toJSDate();
9377
9494
  const currentMonth = currentDate?.getMonth();
9378
9495
  const dates = getDaysForCalendarMonth(currentDate);
9379
9496
  const nowDate = external_luxon_namespaceObject.DateTime.fromJSDate(new Date()).toFormat('D');
9497
+ const isHighlightEnabled = !!highlightDates?.enabled;
9498
+ const {
9499
+ otherDate
9500
+ } = highlightDates || {};
9501
+ const otherDateDT = otherDate && external_luxon_namespaceObject.DateTime.fromJSDate(otherDate);
9380
9502
  const handleDaySelect = event => {
9381
9503
  const {
9382
9504
  target
@@ -9389,7 +9511,7 @@ const DaysView = () => {
9389
9511
  });
9390
9512
  setCalendarViewDateTime(newDate);
9391
9513
  setDateTime(newDate);
9392
- onChange?.(newDate?.toJSDate());
9514
+ safeOnChange?.(newDate);
9393
9515
  setIsOpen(false);
9394
9516
  }
9395
9517
  };
@@ -9410,8 +9532,14 @@ const DaysView = () => {
9410
9532
  const calendarMonth = currentDate.getMonth();
9411
9533
  const ariaLabel = currentDT.toLocaleString(external_luxon_namespaceObject.DateTime.DATE_HUGE);
9412
9534
  const isCalendarDateNow = nowDate === calendarDate;
9413
- const isCalendarDateSelected = selectedDateTime === calendarDate;
9414
9535
  const isCalendarMonth = currentMonth === calendarMonth;
9536
+ const isCalendarFirstDateSelected = calendarDate === selectedDateTime;
9537
+ const isCalendarSecondDateSelected = calendarDate === otherDateDT?.toFormat('D');
9538
+ const isCalendarDateSelected = isCalendarFirstDateSelected || isCalendarSecondDateSelected;
9539
+ let isHighlightDate = false;
9540
+ if (isHighlightEnabled && lastChangedDate && otherDateDT && dateTime) {
9541
+ isHighlightDate = highlightDates.mode === 'dateTo' ? otherDateDT < currentDT && currentDT < dateTime : dateTime < currentDT && currentDT < otherDateDT;
9542
+ }
9415
9543
  let isAriaDisabled = false;
9416
9544
  if (dateMinDT && dateMaxDT) {
9417
9545
  isAriaDisabled = currentDT < dateMinDT || currentDT > dateMaxDT || !isCalendarMonth;
@@ -9428,6 +9556,9 @@ const DaysView = () => {
9428
9556
  "aria-label": ariaLabel,
9429
9557
  isCalendarDateNow: isCalendarDateNow,
9430
9558
  isCalendarDateSelected: isCalendarDateSelected,
9559
+ isCalendarFirstDateSelected: isCalendarFirstDateSelected,
9560
+ isCalendarSecondDateSelected: isCalendarSecondDateSelected,
9561
+ isHighlighted: isHighlightDate,
9431
9562
  children: calendarDay
9432
9563
  }, `day-${currentDate.getFullYear()}-${currentDate.getMonth()}-${currentDate.getDate()}-${index}`);
9433
9564
  })
@@ -9448,14 +9579,22 @@ var MonthsView_ref = true ? {
9448
9579
  } : 0;
9449
9580
  const MonthsView = () => {
9450
9581
  const {
9582
+ dateTime,
9451
9583
  calendarViewDateTime,
9452
9584
  dateMinDT,
9453
9585
  dateMaxDT,
9586
+ lastChangedDate,
9587
+ highlightDates,
9454
9588
  setCalendarType,
9455
9589
  setDateTime,
9456
9590
  setCalendarViewDateTime,
9457
9591
  onMonthChange
9458
9592
  } = useDatePickerContext();
9593
+ const isHighlightEnabled = !!highlightDates?.enabled;
9594
+ const {
9595
+ otherDate
9596
+ } = highlightDates || {};
9597
+ const otherDateDT = otherDate && external_luxon_namespaceObject.DateTime.fromJSDate(otherDate);
9459
9598
  const handleMonthSelect = event => {
9460
9599
  const {
9461
9600
  target
@@ -9490,10 +9629,19 @@ const MonthsView = () => {
9490
9629
  const isMinMonthReached = dateMinDT ? currentMonthDT.month < dateMinDT.month && currentMonthDT.year === dateMinDT.year : false;
9491
9630
  const isMaxMonthReached = dateMaxDT ? currentMonthDT.month > dateMaxDT.month && currentMonthDT.year === dateMaxDT.year : false;
9492
9631
  const isAriaDisabled = isMinMonthReached || isMaxMonthReached;
9632
+ const isCalendarFirstDateSelected = currentMonthDT.toFormat('yyyy-MM') === dateTime?.toFormat('yyyy-MM');
9633
+ const isCalendarSecondDateSelected = currentMonthDT.toFormat('yyyy-MM') === otherDateDT?.toFormat('yyyy-MM');
9634
+ let isHighlightDate = false;
9635
+ if (isHighlightEnabled && lastChangedDate && otherDateDT && dateTime) {
9636
+ isHighlightDate = highlightDates.mode === 'dateTo' ? otherDateDT < currentMonthDT && currentMonthDT < dateTime : dateTime < currentMonthDT && currentMonthDT < otherDateDT;
9637
+ }
9493
9638
  return (0,jsx_runtime_namespaceObject.jsx)(MonthsViewCell, {
9494
9639
  isCalendarMonth: isCalendarMonth,
9495
9640
  "aria-disabled": isAriaDisabled,
9496
9641
  "aria-label": `${month}, ${calendarViewDateTime?.year}`,
9642
+ isCalendarFirstDateSelected: isCalendarFirstDateSelected,
9643
+ isCalendarSecondDateSelected: isCalendarSecondDateSelected,
9644
+ isHighlighted: isHighlightDate,
9497
9645
  children: month
9498
9646
  }, month);
9499
9647
  })
@@ -9507,16 +9655,20 @@ function YearsView_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to
9507
9655
 
9508
9656
 
9509
9657
 
9658
+
9510
9659
  var YearsView_ref = true ? {
9511
9660
  name: "1n393qe",
9512
9661
  styles: "flex-wrap:wrap;overflow-y:auto;height:280px;align-content:flex-start"
9513
9662
  } : 0;
9514
9663
  const YearsView = () => {
9515
9664
  const {
9665
+ dateTime,
9516
9666
  calendarViewDateTime,
9517
9667
  dateMinParts,
9518
9668
  dateMaxParts,
9519
9669
  formatIndexes,
9670
+ lastChangedDate,
9671
+ highlightDates,
9520
9672
  setCalendarType,
9521
9673
  setCalendarViewDateTime,
9522
9674
  setDateTime,
@@ -9527,6 +9679,11 @@ const YearsView = () => {
9527
9679
  yearsFrom: dateMinParts[formatIndexes['year']],
9528
9680
  yearsCount: dateMaxParts[formatIndexes['year']] - dateMinParts[formatIndexes['year']] + 1
9529
9681
  });
9682
+ const isHighlightEnabled = !!highlightDates?.enabled;
9683
+ const {
9684
+ otherDate
9685
+ } = highlightDates || {};
9686
+ const otherDateDT = otherDate && external_luxon_namespaceObject.DateTime.fromJSDate(otherDate);
9530
9687
  (0,external_react_namespaceObject.useEffect)(() => {
9531
9688
  if (calendarViewDateTime && wrapper.current) {
9532
9689
  wrapper.current.querySelector('[aria-current=date]')?.scrollIntoView({
@@ -9560,8 +9717,17 @@ const YearsView = () => {
9560
9717
  if (isCalendarYear) {
9561
9718
  additionalProps['aria-current'] = 'date';
9562
9719
  }
9720
+ const isCalendarFirstDateSelected = year.toString() === dateTime?.toFormat('yyyy');
9721
+ const isCalendarSecondDateSelected = year.toString() === otherDateDT?.toFormat('yyyy');
9722
+ let isHighlightDate = false;
9723
+ if (isHighlightEnabled && lastChangedDate && otherDateDT && dateTime) {
9724
+ isHighlightDate = highlightDates.mode === 'dateTo' ? otherDateDT.year < year && year < dateTime.year : dateTime.year < year && year < otherDateDT.year;
9725
+ }
9563
9726
  return (0,jsx_runtime_namespaceObject.jsx)(YearsViewCell, {
9564
9727
  isCalendarYear: isCalendarYear,
9728
+ isCalendarFirstDateSelected: isCalendarFirstDateSelected,
9729
+ isCalendarSecondDateSelected: isCalendarSecondDateSelected,
9730
+ isHighlighted: isHighlightDate,
9565
9731
  ...additionalProps,
9566
9732
  children: year
9567
9733
  }, `year-${year}`);
@@ -9761,11 +9927,17 @@ const DatePickerTrigger = () => {
9761
9927
  label,
9762
9928
  openCalendarMode,
9763
9929
  inputRef,
9930
+ inputProps,
9764
9931
  disabled,
9765
9932
  helperText,
9933
+ showCalendarIcon,
9766
9934
  onBlur: handleBlur,
9767
9935
  setIsOpen
9768
9936
  } = useDatePickerContext();
9937
+ const {
9938
+ inputProps: inputElementProps,
9939
+ ...restInputProps
9940
+ } = inputProps || {};
9769
9941
  const formContext = (0,external_react_hook_form_namespaceObject.useFormContext)(); // Using FormProvider from react-hook-form
9770
9942
  const useFormResult = (0,external_react_hook_form_namespaceObject.useForm)();
9771
9943
  const theme = (0,react_namespaceObject.useTheme)();
@@ -9786,25 +9958,29 @@ const DatePickerTrigger = () => {
9786
9958
  if (openCalendarMode === 'both' || openCalendarMode === 'input' && tagName === 'input' || openCalendarMode === 'icon' && tagName === 'button') {
9787
9959
  toggleOpen();
9788
9960
  }
9961
+ if (e.currentTarget instanceof HTMLInputElement) {
9962
+ inputProps?.inputProps?.onClick?.(e);
9963
+ }
9789
9964
  };
9790
9965
  return (0,jsx_runtime_namespaceObject.jsxs)((external_react_default()).Fragment, {
9791
9966
  children: [label && (0,jsx_runtime_namespaceObject.jsx)(Label_Label, {
9792
- htmlFor: `field-${name}`,
9967
+ htmlFor: name,
9793
9968
  children: label
9794
9969
  }), (0,jsx_runtime_namespaceObject.jsx)(PopoverTrigger, {
9795
9970
  asChild: true,
9796
9971
  children: (0,jsx_runtime_namespaceObject.jsx)(Input_Input, {
9797
9972
  name: name,
9798
9973
  placeholder: format,
9799
- showHelperText: true,
9800
9974
  ref: inputRef,
9801
9975
  disabled: disabled,
9802
9976
  register: register,
9803
9977
  inputProps: {
9804
9978
  onBlur: handleBlur,
9805
9979
  onClick: handleToggleOpen,
9806
- id: `field-${name}`,
9807
- 'data-testid': 'datepicker-input'
9980
+ id: inputProps?.inputProps?.id || name,
9981
+ 'data-testid': 'datepicker-input',
9982
+ autoComplete: 'off',
9983
+ ...inputElementProps
9808
9984
  },
9809
9985
  errors: fieldError,
9810
9986
  status: fieldStatus,
@@ -9813,7 +9989,7 @@ const DatePickerTrigger = () => {
9813
9989
  name: "lhoo11",
9814
9990
  styles: "&>span::first-letter{text-transform:uppercase;}"
9815
9991
  } : 0),
9816
- endElement: (0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
9992
+ endElement: showCalendarIcon ? (0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
9817
9993
  endIcon: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
9818
9994
  name: "calendar",
9819
9995
  size: 16,
@@ -9831,7 +10007,8 @@ const DatePickerTrigger = () => {
9831
10007
  display: 'none'
9832
10008
  }
9833
10009
  }, true ? "" : 0, true ? "" : 0)
9834
- })
10010
+ }) : undefined,
10011
+ ...restInputProps
9835
10012
  })
9836
10013
  })]
9837
10014
  });
@@ -9865,17 +10042,439 @@ const DatePickerContent = () => {
9865
10042
  const DatePickerInner = ({
9866
10043
  format = DEFAULT_MASK_FORMAT,
9867
10044
  openCalendarMode = 'icon',
10045
+ showCalendarIcon = true,
10046
+ isOpenToggle,
9868
10047
  ...rest
9869
10048
  }, inputRef) => (0,jsx_runtime_namespaceObject.jsx)(DatePickerProvider, {
9870
10049
  format: format,
9871
10050
  openCalendarMode: openCalendarMode,
9872
10051
  inputRef: inputRef,
10052
+ showCalendarIcon: showCalendarIcon,
10053
+ isOpenToggle: isOpenToggle,
9873
10054
  ...rest,
9874
10055
  children: (0,jsx_runtime_namespaceObject.jsx)(DatePickerContent, {})
9875
10056
  });
9876
10057
  const DatePicker = /*#__PURE__*/(0,external_react_namespaceObject.forwardRef)(DatePickerInner);
9877
10058
  ;// ./src/components/DatePicker/index.ts
9878
10059
 
10060
+ ;// ./src/components/Field/FieldProvider.ts
10061
+
10062
+ const [FieldProvider, useFieldContext] = (0,hooks_namespaceObject.createSafeContext)('useFieldContext must be used within a FieldProvider');
10063
+ ;// ./src/components/Field/FieldRoot.tsx
10064
+
10065
+
10066
+ const FieldRoot = ({
10067
+ children,
10068
+ ...props
10069
+ }) => {
10070
+ const {
10071
+ disabled = false,
10072
+ status = 'basic',
10073
+ forwardFocus = true,
10074
+ ...divProps
10075
+ } = props;
10076
+ return (0,jsx_runtime_namespaceObject.jsx)("div", {
10077
+ ...divProps,
10078
+ children: (0,jsx_runtime_namespaceObject.jsx)(FieldProvider, {
10079
+ value: {
10080
+ disabled,
10081
+ status,
10082
+ forwardFocus
10083
+ },
10084
+ children: children
10085
+ })
10086
+ });
10087
+ };
10088
+ ;// ./src/components/Field/FieldLabel.tsx
10089
+
10090
+
10091
+
10092
+ const FieldLabel = ({
10093
+ children,
10094
+ ...props
10095
+ }) => {
10096
+ const ctx = useFieldContext();
10097
+ return (0,jsx_runtime_namespaceObject.jsx)(Label_Label, {
10098
+ isDisabled: ctx.disabled,
10099
+ ...props,
10100
+ children: children
10101
+ });
10102
+ };
10103
+ ;// ./src/components/Field/FieldControl.tsx
10104
+
10105
+
10106
+
10107
+
10108
+ const FieldControlBase = /*#__PURE__*/base_default()("div", true ? {
10109
+ target: "e1lr2tz0"
10110
+ } : 0)("display:flex;align-items:center;min-height:44px;height:auto;border-radius:8px;overflow:hidden;border:1px solid ", ({
10111
+ status,
10112
+ theme
10113
+ }) => {
10114
+ if (status === 'error') return theme.colors.red;
10115
+ if (status === 'success') return theme.colors.greenLighter;
10116
+ return theme.colors.grey;
10117
+ }, ";background:", ({
10118
+ disabled,
10119
+ theme
10120
+ }) => disabled ? theme.colors.greyLighter : theme.colors.white, ";&>*{background:transparent;}&:active,&:hover{background:", ({
10121
+ disabled,
10122
+ theme
10123
+ }) => disabled ? theme.colors.greyLighter : theme.colors.white, ";box-shadow:none;}&:hover{cursor:", ({
10124
+ disabled
10125
+ }) => disabled ? 'default' : 'pointer', ";}&:focus-within,&:active{border-color:", ({
10126
+ status,
10127
+ disabled,
10128
+ theme
10129
+ }) => {
10130
+ if (disabled) return theme.colors.grey;
10131
+ if (status === 'error') return theme.colors.red;
10132
+ if (status === 'success') return theme.colors.greenLighter;
10133
+ return theme.colors.blueRoyal;
10134
+ }, ";}" + ( true ? "" : 0));
10135
+ const isForwardRefComponent = component => {
10136
+ if (typeof component.type === 'object' && component.type.$$typeof?.toString() === 'Symbol(react.forward_ref)') {
10137
+ return true;
10138
+ }
10139
+ return false;
10140
+ };
10141
+ const FieldControl = /*#__PURE__*/external_react_default().forwardRef(function FieldControl({
10142
+ children,
10143
+ controlRef,
10144
+ ...props
10145
+ }, ref) {
10146
+ const ctx = useFieldContext();
10147
+ const baseProps = {
10148
+ ...props,
10149
+ ...ctx
10150
+ };
10151
+ const internalRef = (0,external_react_namespaceObject.useRef)(null);
10152
+ let _children = typeof children === 'function' ? children(ctx) : children;
10153
+ if (ctx.forwardFocus && /*#__PURE__*/(0,external_react_namespaceObject.isValidElement)(_children) && isForwardRefComponent(_children)) {
10154
+ const setRef = defaultRef => element => {
10155
+ internalRef.current = element;
10156
+ if (defaultRef) {
10157
+ if (typeof defaultRef === 'function') {
10158
+ defaultRef(element);
10159
+ } else {
10160
+ defaultRef.current = element;
10161
+ }
10162
+ }
10163
+ };
10164
+ _children = /*#__PURE__*/(0,external_react_namespaceObject.cloneElement)(_children, {
10165
+ ref: setRef(children.ref)
10166
+ });
10167
+ }
10168
+ return (0,jsx_runtime_namespaceObject.jsx)(FieldControlBase, {
10169
+ ...baseProps,
10170
+ ref: ref,
10171
+ onClick: event => {
10172
+ baseProps.onClick?.(event);
10173
+ if (controlRef) {
10174
+ controlRef.current?.focus?.();
10175
+ } else if (internalRef.current) {
10176
+ internalRef.current?.focus?.();
10177
+ }
10178
+ },
10179
+ children: _children
10180
+ });
10181
+ });
10182
+ ;// ./src/components/Field/FieldDescription.tsx
10183
+
10184
+
10185
+
10186
+ const FieldDescription = ({
10187
+ children
10188
+ }) => {
10189
+ const ctx = useFieldContext();
10190
+ if (ctx.status !== 'basic') {
10191
+ return null;
10192
+ }
10193
+ return (0,jsx_runtime_namespaceObject.jsx)(FormHelperText_FormHelperText, {
10194
+ status: "basic",
10195
+ children: children
10196
+ });
10197
+ };
10198
+ ;// ./src/components/Field/FieldError.tsx
10199
+
10200
+
10201
+
10202
+ const FieldError = ({
10203
+ children
10204
+ }) => {
10205
+ const ctx = useFieldContext();
10206
+ if (ctx.status !== 'error') {
10207
+ return null;
10208
+ }
10209
+ return (0,jsx_runtime_namespaceObject.jsx)(FormHelperText_FormHelperText, {
10210
+ status: "error",
10211
+ children: children
10212
+ });
10213
+ };
10214
+ ;// ./src/components/Field/FieldSuccess.tsx
10215
+
10216
+
10217
+
10218
+ const FieldSuccess = ({
10219
+ children
10220
+ }) => {
10221
+ const ctx = useFieldContext();
10222
+ if (ctx.status !== 'success') {
10223
+ return null;
10224
+ }
10225
+ return (0,jsx_runtime_namespaceObject.jsx)(FormHelperText_FormHelperText, {
10226
+ status: "success",
10227
+ children: children
10228
+ });
10229
+ };
10230
+ ;// ./src/components/DateRangePicker/constants.ts
10231
+ const constants_DEFAULT_MASK_FORMAT = 'mm/dd/yyyy';
10232
+ const constants_DEFAULT_MASK = '__/__/____';
10233
+ const constants_MONTHS = (/* unused pure expression or super */ null && (['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']));
10234
+ const constants_DATE_MIN = '01/01/1900';
10235
+ const constants_DATE_MAX = '01/01/2150';
10236
+ const constants_OUT_OF_RANGE = 'The date is out of the defined range';
10237
+ const constants_INVALID_DATE = 'Invalid date';
10238
+ ;// ./src/components/DateRangePicker/DateRangePicker.tsx
10239
+
10240
+ function DateRangePicker_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)."; }
10241
+
10242
+
10243
+
10244
+
10245
+
10246
+
10247
+
10248
+ // keep the same place for datepicker (from / to)
10249
+ // don't close the datepicker while switching between from / to
10250
+ // add errors (date to less than date from...)
10251
+ // add a logic to reset date to when date to less than date from
10252
+ // create subcomponents
10253
+ // hover daterange effect for the datepicker (from design)
10254
+
10255
+ var DateRangePicker_ref = true ? {
10256
+ name: "mwgsbg",
10257
+ styles: "& input{border:none !important;}"
10258
+ } : 0;
10259
+ var DateRangePicker_ref2 = true ? {
10260
+ name: "jpxugn",
10261
+ styles: "margin:0 14px"
10262
+ } : 0;
10263
+ var DateRangePicker_ref3 = true ? {
10264
+ name: "ud49p1",
10265
+ styles: "color:inherit;&::first-letter{text-transform:uppercase;}"
10266
+ } : 0;
10267
+ const DateRangePicker = ({
10268
+ format = constants_DEFAULT_MASK_FORMAT,
10269
+ openCalendarMode = 'both',
10270
+ name,
10271
+ label,
10272
+ value,
10273
+ defaultValue,
10274
+ ...rest
10275
+ }) => {
10276
+ const theme = (0,react_namespaceObject.useTheme)();
10277
+ // const [_value, _setValue] = useState(value || []);
10278
+ const formContext = (0,external_react_hook_form_namespaceObject.useFormContext)();
10279
+ const [currentStatus, setCurrentStatus] = (0,external_react_namespaceObject.useState)(rest.status);
10280
+ const errorsFrom = formContext.formState.errors[`${name}From`]?.message;
10281
+ const errorsTo = formContext.formState.errors[`${name}To`]?.message;
10282
+ const errorMessage = [errorsFrom, errorsTo].filter(Boolean);
10283
+ const {
10284
+ disabled
10285
+ } = rest;
10286
+ const [fromOpenToggle, setFromOpenToggle] = (0,external_react_namespaceObject.useState)();
10287
+ const [toOpenToggle, setToOpenToggle] = (0,external_react_namespaceObject.useState)();
10288
+ const [changedDate, setChangedDate] = (0,external_react_namespaceObject.useState)([null, null]);
10289
+ const [lastFocusedElement, setLastFocusedElement] = (0,external_react_namespaceObject.useState)('from');
10290
+ const [valueFrom, valueTo] = value || [];
10291
+ const [defaultValueFrom, defaultValueTo] = defaultValue || [];
10292
+ const datepickerFromRef = (0,external_react_namespaceObject.useRef)(null);
10293
+ const datepickerToRef = (0,external_react_namespaceObject.useRef)(null);
10294
+
10295
+ // const datepickerFromAdditionalProps = {};
10296
+ // const datepickerToAdditionalProps = {};
10297
+
10298
+ // useEffect(() => {
10299
+ // _setValue(value || []);
10300
+ // }, [value]);
10301
+
10302
+ (0,external_react_namespaceObject.useEffect)(() => {
10303
+ setCurrentStatus(rest.status);
10304
+ }, [rest.status]);
10305
+ (0,external_react_namespaceObject.useEffect)(() => {
10306
+ if (errorMessage.length) {
10307
+ setCurrentStatus('error');
10308
+ } else {
10309
+ setCurrentStatus(rest.status || 'basic');
10310
+ }
10311
+ }, [errorMessage]);
10312
+ const toggleOpen = () => {
10313
+ if (lastFocusedElement === 'from') {
10314
+ setFromOpenToggle(current => !current);
10315
+ setTimeout(() => datepickerFromRef.current?.focus(), 5);
10316
+ } else {
10317
+ setToOpenToggle(current => !current);
10318
+ setTimeout(() => datepickerToRef.current?.focus(), 5);
10319
+ }
10320
+ };
10321
+ const handleToggleOpen = e => {
10322
+ const tagName = e.currentTarget.tagName.toLowerCase();
10323
+ if (openCalendarMode === 'both' || openCalendarMode === 'input' && tagName === 'input' || openCalendarMode === 'icon' && tagName === 'button') {
10324
+ toggleOpen();
10325
+ }
10326
+ if (tagName === 'input' && rest.inputProps?.inputProps?.onClick) {
10327
+ rest.inputProps.inputProps.onClick(e);
10328
+ }
10329
+ };
10330
+ const handleFocus = e => {
10331
+ const {
10332
+ name
10333
+ } = e.currentTarget;
10334
+ setLastFocusedElement(name.endsWith('From') ? 'from' : 'to');
10335
+ rest.inputProps?.inputProps?.onFocus?.(e);
10336
+ };
10337
+ const onChangeFrom = date => {
10338
+ const newDate = date || null;
10339
+ if (newDate !== changedDate?.[0]) {
10340
+ const changedData = [newDate, changedDate ? changedDate[1] : null];
10341
+ setChangedDate(changedData);
10342
+ if (!changedDate?.[1]) {
10343
+ setLastFocusedElement('to');
10344
+ setToOpenToggle(true);
10345
+ }
10346
+ rest.onChange?.(changedData);
10347
+ }
10348
+ };
10349
+ const onChangeTo = date => {
10350
+ const newDate = date || null;
10351
+ if (changedDate[0] && newDate) {
10352
+ const selectedDateFromDT = external_luxon_namespaceObject.DateTime.fromJSDate(changedDate[0]);
10353
+ const selectedDateToDT = external_luxon_namespaceObject.DateTime.fromJSDate(newDate);
10354
+ if (selectedDateFromDT > selectedDateToDT) {
10355
+ const changedData = [newDate, null];
10356
+ setChangedDate(changedData);
10357
+
10358
+ // const dateStr = DateTime.fromJSDate(newDate).toFormat(
10359
+ // format.replace('mm', 'MM'),
10360
+ // );
10361
+ // _setValue([dateStr, _value[1] === undefined ? '' : undefined]);
10362
+ // _setValue([dateStr, undefined]);
10363
+ datepickerToRef.current?.focus();
10364
+ rest.onChange?.(changedData);
10365
+ return;
10366
+ }
10367
+ }
10368
+ if (newDate !== changedDate?.[1]) {
10369
+ const changedData = [changedDate ? changedDate[0] : null, newDate];
10370
+ setChangedDate(changedData);
10371
+ datepickerToRef.current?.focus();
10372
+ rest.onChange?.(changedData);
10373
+ }
10374
+ };
10375
+
10376
+ // TODO: change status dynamically
10377
+ return (0,jsx_runtime_namespaceObject.jsxs)(FieldRoot, {
10378
+ status: currentStatus,
10379
+ disabled: rest.disabled,
10380
+ children: [(0,jsx_runtime_namespaceObject.jsx)(FieldLabel, {
10381
+ htmlFor: lastFocusedElement === 'from' ? `${name}From` : `${name}To`,
10382
+ children: label
10383
+ }), (0,jsx_runtime_namespaceObject.jsx)(FieldControl, {
10384
+ children: (0,jsx_runtime_namespaceObject.jsxs)(Wrapper_Wrapper, {
10385
+ css: DateRangePicker_ref,
10386
+ children: [(0,jsx_runtime_namespaceObject.jsx)(DatePicker, {
10387
+ format: format,
10388
+ openCalendarMode: openCalendarMode,
10389
+ isOpenToggle: fromOpenToggle,
10390
+ name: `${name}From`,
10391
+ value: valueFrom,
10392
+ defaultValue: defaultValueFrom,
10393
+ label: '',
10394
+ showCalendarIcon: false,
10395
+ ...rest,
10396
+ ref: datepickerFromRef,
10397
+ onChange: onChangeFrom,
10398
+ highlightDates: {
10399
+ enabled: true,
10400
+ mode: 'dateFrom',
10401
+ otherDate: changedDate[1]
10402
+ },
10403
+ inputProps: {
10404
+ showStatusIcon: false,
10405
+ ...rest.inputProps,
10406
+ inputProps: {
10407
+ ...rest.inputProps?.inputProps,
10408
+ onFocus: handleFocus,
10409
+ onClick: handleToggleOpen
10410
+ }
10411
+ }
10412
+ }), (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
10413
+ name: "carrot-right",
10414
+ size: 18,
10415
+ color: theme.colors.greyDarker80,
10416
+ css: DateRangePicker_ref2
10417
+ }), (0,jsx_runtime_namespaceObject.jsx)(DatePicker, {
10418
+ format: format,
10419
+ openCalendarMode: openCalendarMode,
10420
+ isOpenToggle: toOpenToggle,
10421
+ name: `${name}To`,
10422
+ value: valueTo,
10423
+ defaultValue: defaultValueTo,
10424
+ label: '',
10425
+ showCalendarIcon: false,
10426
+ ...rest,
10427
+ ref: datepickerToRef,
10428
+ onChange: onChangeTo,
10429
+ highlightDates: {
10430
+ enabled: true,
10431
+ mode: 'dateTo',
10432
+ otherDate: changedDate[0]
10433
+ },
10434
+ inputProps: {
10435
+ showStatusIcon: false,
10436
+ ...rest.inputProps,
10437
+ inputProps: {
10438
+ ...rest.inputProps?.inputProps,
10439
+ onFocus: handleFocus,
10440
+ onClick: handleToggleOpen
10441
+ }
10442
+ }
10443
+ }), (0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
10444
+ endIcon: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
10445
+ name: "calendar",
10446
+ size: 16,
10447
+ color: disabled ? theme.colors.grey : theme.colors.greyDarker
10448
+ }),
10449
+ "data-testid": 'daterangepicker-button',
10450
+ onClick: handleToggleOpen,
10451
+ variant: "tertiary",
10452
+ "aria-label": "Calendar",
10453
+ isDisabled: disabled,
10454
+ css: /*#__PURE__*/(0,react_namespaceObject.css)({
10455
+ padding: 0,
10456
+ margin: '0 8px 0 14px',
10457
+ cursor: openCalendarMode === 'input' || disabled ? 'default' : 'pointer',
10458
+ '&:focus::before': {
10459
+ display: 'none'
10460
+ }
10461
+ }, true ? "" : 0, true ? "" : 0)
10462
+ })]
10463
+ })
10464
+ }), (0,jsx_runtime_namespaceObject.jsx)(FieldDescription, {
10465
+ children: rest.helperText
10466
+ }), (0,jsx_runtime_namespaceObject.jsx)(FieldError, {
10467
+ children: errorMessage ? errorMessage.map((error, index) => (0,jsx_runtime_namespaceObject.jsx)("span", {
10468
+ css: DateRangePicker_ref3,
10469
+ children: error
10470
+ }, `error-${index}`)) : rest.helperText
10471
+ }), (0,jsx_runtime_namespaceObject.jsx)(FieldSuccess, {
10472
+ children: rest.helperText
10473
+ })]
10474
+ });
10475
+ };
10476
+ ;// ./src/components/DateRangePicker/index.ts
10477
+
9879
10478
  ;// ./src/components/Drawer/DrawerProvider.tsx
9880
10479
 
9881
10480
  const [DrawerProvider, useDrawerContext] = (0,hooks_namespaceObject.createSafeContext)('useDrawer must be used within a DrawerProvider');
@@ -10198,9 +10797,13 @@ const DrawerContent = /*#__PURE__*/(0,external_react_namespaceObject.forwardRef)
10198
10797
 
10199
10798
 
10200
10799
 
10201
- ;// ./src/components/Field/FieldProvider.ts
10800
+ ;// ./src/components/Field/index.parts.ts
10801
+
10802
+
10803
+
10804
+
10805
+
10202
10806
 
10203
- const [FieldProvider, useFieldContext] = (0,hooks_namespaceObject.createSafeContext)('useFieldContext must be used within a FieldProvider');
10204
10807
  ;// ./src/components/Field/index.ts
10205
10808
 
10206
10809
 
@@ -11107,173 +11710,6 @@ const Filters = ({
11107
11710
  };
11108
11711
  ;// ./src/components/Filters/index.ts
11109
11712
 
11110
- ;// ./src/components/Field/FieldRoot.tsx
11111
-
11112
-
11113
- const FieldRoot = ({
11114
- children,
11115
- ...props
11116
- }) => {
11117
- const {
11118
- disabled = false,
11119
- status = 'basic',
11120
- forwardFocus = true,
11121
- ...divProps
11122
- } = props;
11123
- return (0,jsx_runtime_namespaceObject.jsx)("div", {
11124
- ...divProps,
11125
- children: (0,jsx_runtime_namespaceObject.jsx)(FieldProvider, {
11126
- value: {
11127
- disabled,
11128
- status,
11129
- forwardFocus
11130
- },
11131
- children: children
11132
- })
11133
- });
11134
- };
11135
- ;// ./src/components/Field/FieldLabel.tsx
11136
-
11137
-
11138
-
11139
- const FieldLabel = ({
11140
- children,
11141
- ...props
11142
- }) => {
11143
- const ctx = useFieldContext();
11144
- return (0,jsx_runtime_namespaceObject.jsx)(Label_Label, {
11145
- isDisabled: ctx.disabled,
11146
- ...props,
11147
- children: children
11148
- });
11149
- };
11150
- ;// ./src/components/Field/FieldControl.tsx
11151
-
11152
-
11153
-
11154
-
11155
- const FieldControlBase = /*#__PURE__*/base_default()("div", true ? {
11156
- target: "e1lr2tz0"
11157
- } : 0)("display:flex;align-items:center;min-height:44px;height:auto;border-radius:8px;overflow:hidden;border:1px solid ", ({
11158
- status,
11159
- theme
11160
- }) => {
11161
- if (status === 'error') return theme.colors.red;
11162
- if (status === 'success') return theme.colors.greenLighter;
11163
- return theme.colors.grey;
11164
- }, ";background:", ({
11165
- disabled,
11166
- theme
11167
- }) => disabled ? theme.colors.greyLighter : theme.colors.white, ";&>*{background:transparent;}&:active,&:hover{background:", ({
11168
- disabled,
11169
- theme
11170
- }) => disabled ? theme.colors.greyLighter : theme.colors.white, ";box-shadow:none;}&:hover{cursor:", ({
11171
- disabled
11172
- }) => disabled ? 'default' : 'pointer', ";}&:focus-within,&:active{border-color:", ({
11173
- status,
11174
- disabled,
11175
- theme
11176
- }) => {
11177
- if (disabled) return theme.colors.grey;
11178
- if (status === 'error') return theme.colors.red;
11179
- if (status === 'success') return theme.colors.greenLighter;
11180
- return theme.colors.blueRoyal;
11181
- }, ";}" + ( true ? "" : 0));
11182
- const isForwardRefComponent = component => {
11183
- if (typeof component.type === 'object' && component.type.$$typeof?.toString() === 'Symbol(react.forward_ref)') {
11184
- return true;
11185
- }
11186
- return false;
11187
- };
11188
- const FieldControl = /*#__PURE__*/external_react_default().forwardRef(function FieldControl({
11189
- children,
11190
- controlRef,
11191
- ...props
11192
- }, ref) {
11193
- const ctx = useFieldContext();
11194
- const baseProps = {
11195
- ...props,
11196
- ...ctx
11197
- };
11198
- const internalRef = (0,external_react_namespaceObject.useRef)(null);
11199
- let _children = typeof children === 'function' ? children(ctx) : children;
11200
- if (ctx.forwardFocus && /*#__PURE__*/(0,external_react_namespaceObject.isValidElement)(_children) && isForwardRefComponent(_children)) {
11201
- const setRef = defaultRef => element => {
11202
- internalRef.current = element;
11203
- if (defaultRef) {
11204
- if (typeof defaultRef === 'function') {
11205
- defaultRef(element);
11206
- } else {
11207
- defaultRef.current = element;
11208
- }
11209
- }
11210
- };
11211
- _children = /*#__PURE__*/(0,external_react_namespaceObject.cloneElement)(_children, {
11212
- ref: setRef(children.ref)
11213
- });
11214
- }
11215
- return (0,jsx_runtime_namespaceObject.jsx)(FieldControlBase, {
11216
- ...baseProps,
11217
- ref: ref,
11218
- onClick: event => {
11219
- baseProps.onClick?.(event);
11220
- if (controlRef) {
11221
- controlRef.current?.focus?.();
11222
- } else if (internalRef.current) {
11223
- internalRef.current?.focus?.();
11224
- }
11225
- },
11226
- children: _children
11227
- });
11228
- });
11229
- ;// ./src/components/Field/FieldDescription.tsx
11230
-
11231
-
11232
-
11233
- const FieldDescription = ({
11234
- children
11235
- }) => {
11236
- const ctx = useFieldContext();
11237
- if (ctx.status !== 'basic') {
11238
- return null;
11239
- }
11240
- return (0,jsx_runtime_namespaceObject.jsx)(FormHelperText_FormHelperText, {
11241
- status: "basic",
11242
- children: children
11243
- });
11244
- };
11245
- ;// ./src/components/Field/FieldError.tsx
11246
-
11247
-
11248
-
11249
- const FieldError = ({
11250
- children
11251
- }) => {
11252
- const ctx = useFieldContext();
11253
- if (ctx.status !== 'error') {
11254
- return null;
11255
- }
11256
- return (0,jsx_runtime_namespaceObject.jsx)(FormHelperText_FormHelperText, {
11257
- status: "error",
11258
- children: children
11259
- });
11260
- };
11261
- ;// ./src/components/Field/FieldSuccess.tsx
11262
-
11263
-
11264
-
11265
- const FieldSuccess = ({
11266
- children
11267
- }) => {
11268
- const ctx = useFieldContext();
11269
- if (ctx.status !== 'success') {
11270
- return null;
11271
- }
11272
- return (0,jsx_runtime_namespaceObject.jsx)(FormHelperText_FormHelperText, {
11273
- status: "success",
11274
- children: children
11275
- });
11276
- };
11277
11713
  ;// ./src/components/FiltersMultiSelect/useFiltersMultiSelect.tsx
11278
11714
 
11279
11715
  function useFilterMultiSelect({
@@ -11435,11 +11871,6 @@ function FiltersMultiSelect_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have
11435
11871
 
11436
11872
 
11437
11873
 
11438
-
11439
-
11440
-
11441
-
11442
-
11443
11874
  var FiltersMultiSelect_ref = true ? {
11444
11875
  name: "w1nxbg",
11445
11876
  styles: "padding:6px 14px"
@@ -13487,29 +13918,29 @@ const BarLineComplexChartView = ({
13487
13918
  debouncedFn();
13488
13919
  };
13489
13920
  const handleHover = () => {
13490
- /**
13491
- * Show tooltip on hover
13492
- * event: Readonly<Plotly.PlotHoverEvent>
13493
- * - event = {}
13494
- * - points:
13495
- * Array<{
13496
- * bbox: { x0: number; x1: number; y0: number; y1: number; };
13497
- * curveNumber: number;
13498
- * data: Plotly.Data;
13499
- * fullData: Plotly.Data;
13500
- * label: number;
13501
- * pointIndex: number;
13502
- * pointNumber: number;
13503
- * value: number;
13504
- * x: number;
13505
- * y: number;
13506
- * xaxis: string;
13507
- * yaxis: string;
13508
- * }>
13509
- * - xaxes: Array<{}>
13510
- * - xvals: Array<number>
13511
- * - yaxes: Array<{}>
13512
- * - yvals: Array<number>
13921
+ /**
13922
+ * Show tooltip on hover
13923
+ * event: Readonly<Plotly.PlotHoverEvent>
13924
+ * - event = {}
13925
+ * - points:
13926
+ * Array<{
13927
+ * bbox: { x0: number; x1: number; y0: number; y1: number; };
13928
+ * curveNumber: number;
13929
+ * data: Plotly.Data;
13930
+ * fullData: Plotly.Data;
13931
+ * label: number;
13932
+ * pointIndex: number;
13933
+ * pointNumber: number;
13934
+ * value: number;
13935
+ * x: number;
13936
+ * y: number;
13937
+ * xaxis: string;
13938
+ * yaxis: string;
13939
+ * }>
13940
+ * - xaxes: Array<{}>
13941
+ * - xvals: Array<number>
13942
+ * - yaxes: Array<{}>
13943
+ * - yvals: Array<number>
13513
13944
  */
13514
13945
  setIsOpen(false);
13515
13946
  };
@@ -14685,14 +15116,14 @@ var Typeahead_ref = true ? {
14685
15116
  name: "1d3w5wq",
14686
15117
  styles: "width:100%"
14687
15118
  } : 0;
14688
- /**
14689
- * The structure of the component:
14690
- * - TypeaheadTrigger
14691
- * - TypeaheadOptions
14692
- * - FormHelperText
14693
- *
14694
- * Aria attributes are set according to
14695
- * https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/
15119
+ /**
15120
+ * The structure of the component:
15121
+ * - TypeaheadTrigger
15122
+ * - TypeaheadOptions
15123
+ * - FormHelperText
15124
+ *
15125
+ * Aria attributes are set according to
15126
+ * https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/
14696
15127
  **/
14697
15128
  const Typeahead = ({
14698
15129
  name = 'typeahead-search',
@@ -15127,6 +15558,7 @@ const WithVisibleUpToLG = (Component, styles) => {
15127
15558
 
15128
15559
 
15129
15560
 
15561
+
15130
15562
 
15131
15563
 
15132
15564
  ;// ./src/contexts/Translation/config.ts