@idds/react 1.1.89 → 1.1.91

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.es.js CHANGED
@@ -3769,7 +3769,8 @@ function SelectDropdown({
3769
3769
  searchValue,
3770
3770
  onSearchChange,
3771
3771
  disabled = false,
3772
- showPreviewValue = true
3772
+ showPreviewValue = true,
3773
+ searchable = true
3773
3774
  }) {
3774
3775
  const [isOpen, setIsOpen] = useState(false);
3775
3776
  const [internalSearchTerm, setInternalSearchTerm] = useState("");
@@ -3844,7 +3845,7 @@ function SelectDropdown({
3844
3845
  const found = options.find((o) => o.value === singleSelected);
3845
3846
  triggerLabel = found ? found.label : placeholder;
3846
3847
  }
3847
- const filteredOptions = onSearch ? options : options.filter(
3848
+ const filteredOptions = onSearch ? options : !searchable ? options : options.filter(
3848
3849
  (o) => o.label.toLowerCase().includes(searchTerm.toLowerCase())
3849
3850
  );
3850
3851
  const handleSearchChange = (e) => {
@@ -3994,7 +3995,7 @@ function SelectDropdown({
3994
3995
  // ← tinggi popup dapat diatur
3995
3996
  },
3996
3997
  children: [
3997
- /* @__PURE__ */ jsx("div", { className: "ina-select-dropdown__search", children: /* @__PURE__ */ jsx(
3998
+ searchable && /* @__PURE__ */ jsx("div", { className: "ina-select-dropdown__search", children: /* @__PURE__ */ jsx(
3998
3999
  "input",
3999
4000
  {
4000
4001
  type: "text",
@@ -7632,17 +7633,18 @@ function YearPicker({
7632
7633
  let bottom = void 0;
7633
7634
  let maxHeight = "400px";
7634
7635
  if (spaceBelow < panelRect.height && spaceAbove > spaceBelow) {
7635
- bottom = triggerRect.height + 4;
7636
+ bottom = viewportHeight - triggerRect.top + 4;
7636
7637
  top = void 0;
7637
7638
  maxHeight = `${Math.min(spaceAbove - 10, 400)}px`;
7638
7639
  } else {
7639
- top = triggerRect.height + 4;
7640
+ top = triggerRect.bottom + 4;
7640
7641
  bottom = void 0;
7641
7642
  maxHeight = `${Math.min(spaceBelow - 10, 400)}px`;
7642
7643
  }
7643
7644
  const maxWidth = `${Math.min(panelWidthValue, viewportWidth - 16)}px`;
7644
7645
  setPanelStyle({
7645
- position: "absolute",
7646
+ position: "fixed",
7647
+ // Use fixed to escape DatePicker panel stacking context
7646
7648
  top: top !== void 0 ? `${top}px` : void 0,
7647
7649
  bottom: bottom !== void 0 ? `${bottom}px` : void 0,
7648
7650
  left: left !== void 0 ? `${left}px` : void 0,
@@ -7987,17 +7989,18 @@ function MonthPicker({
7987
7989
  let bottom = void 0;
7988
7990
  let maxHeight = "300px";
7989
7991
  if (spaceBelow < panelRect.height && spaceAbove > spaceBelow) {
7990
- bottom = triggerRect.height + 4;
7992
+ bottom = viewportHeight - triggerRect.top + 4;
7991
7993
  top = void 0;
7992
7994
  maxHeight = `${Math.min(spaceAbove - 10, 300)}px`;
7993
7995
  } else {
7994
- top = triggerRect.height + 4;
7996
+ top = triggerRect.bottom + 4;
7995
7997
  bottom = void 0;
7996
7998
  maxHeight = `${Math.min(spaceBelow - 10, 300)}px`;
7997
7999
  }
7998
8000
  const maxWidth = `${Math.min(panelWidthValue, viewportWidth - 16)}px`;
7999
8001
  setPanelStyle({
8000
- position: "absolute",
8002
+ position: "fixed",
8003
+ // Use fixed to escape DatePicker panel stacking context
8001
8004
  top: top !== void 0 ? `${top}px` : void 0,
8002
8005
  bottom: bottom !== void 0 ? `${bottom}px` : void 0,
8003
8006
  left: left !== void 0 ? `${left}px` : void 0,
@@ -8256,6 +8259,7 @@ function DatePicker({
8256
8259
  const [hoveredDate, setHoveredDate] = useState(null);
8257
8260
  const [useRightPositioning, setUseRightPositioning] = useState(false);
8258
8261
  const [validatedTriggerWidth, setValidatedTriggerWidth] = useState(triggerWidth);
8262
+ const [tempStartDate, setTempStartDate] = useState(null);
8259
8263
  const containerRef = useRef(null);
8260
8264
  const triggerRef = useRef(null);
8261
8265
  const panelRef = useRef(null);
@@ -8279,6 +8283,7 @@ function DatePicker({
8279
8283
  if (((_a = event.detail) == null ? void 0 : _a.exclude) !== containerRef.current && isOpen) {
8280
8284
  setIsOpen(false);
8281
8285
  setHoveredDate(null);
8286
+ setTempStartDate(null);
8282
8287
  }
8283
8288
  };
8284
8289
  document.addEventListener(
@@ -8300,6 +8305,8 @@ function DatePicker({
8300
8305
  }
8301
8306
  setIsOpen(false);
8302
8307
  setHoveredDate(null);
8308
+ setTempStartDate(null);
8309
+ setTempStartDate(null);
8303
8310
  };
8304
8311
  if (isOpen) {
8305
8312
  document.addEventListener("mousedown", handleClickOutside, true);
@@ -8537,6 +8544,7 @@ function DatePicker({
8537
8544
  onChange("");
8538
8545
  } else if (mode === "range") {
8539
8546
  onChange(["", ""]);
8547
+ setTempStartDate(null);
8540
8548
  } else {
8541
8549
  onChange([]);
8542
8550
  }
@@ -8548,11 +8556,10 @@ function DatePicker({
8548
8556
  onChange(formattedDate);
8549
8557
  } else if (mode === "range") {
8550
8558
  const currentSelected = selectedDates;
8551
- if (currentSelected.length === 0) {
8552
- const formattedDate = formatDate(date, dateFormat);
8553
- onChange([formattedDate, ""]);
8554
- } else if (currentSelected.length === 1) {
8555
- const startDate = currentSelected[0];
8559
+ if (currentSelected.length === 0 && !tempStartDate) {
8560
+ setTempStartDate(date);
8561
+ } else if (currentSelected.length === 1 || tempStartDate) {
8562
+ const startDate = tempStartDate || currentSelected[0];
8556
8563
  const endDate = date;
8557
8564
  const [start, end] = startDate <= endDate ? [startDate, endDate] : [endDate, startDate];
8558
8565
  const formattedStart = formatDate(start, dateFormat);
@@ -8561,10 +8568,10 @@ function DatePicker({
8561
8568
  formattedStart,
8562
8569
  formattedEnd
8563
8570
  ]);
8571
+ setTempStartDate(null);
8564
8572
  setIsOpen(false);
8565
8573
  } else {
8566
- const formattedDate = formatDate(date, dateFormat);
8567
- onChange([formattedDate, ""]);
8574
+ setTempStartDate(date);
8568
8575
  }
8569
8576
  } else if (mode === "multiple") {
8570
8577
  const currentSelected = selectedDates;
@@ -8719,6 +8726,9 @@ function DatePicker({
8719
8726
  if (mode === "single") {
8720
8727
  return selectedDates.length > 0 && isSameDate(date, selectedDates[0]);
8721
8728
  } else if (mode === "range") {
8729
+ if (tempStartDate && isSameDate(date, tempStartDate)) {
8730
+ return true;
8731
+ }
8722
8732
  if (selectedDates.length === 1) {
8723
8733
  return isSameDate(date, selectedDates[0]);
8724
8734
  } else if (selectedDates.length === 2) {
@@ -8740,10 +8750,12 @@ function DatePicker({
8740
8750
  };
8741
8751
  const isHoveredForRange = (date) => {
8742
8752
  if (!date || !hoveredDate) return false;
8743
- if (mode === "range" && selectedDates.length === 1) {
8744
- const startDate = selectedDates[0];
8745
- const [start, end] = startDate <= hoveredDate ? [startDate, hoveredDate] : [hoveredDate, startDate];
8746
- return date > start && date < end;
8753
+ if (mode === "range") {
8754
+ const startDate = tempStartDate || (selectedDates.length > 0 ? selectedDates[0] : null);
8755
+ if (startDate) {
8756
+ const [start, end] = startDate <= hoveredDate ? [startDate, hoveredDate] : [hoveredDate, startDate];
8757
+ return date > start && date < end;
8758
+ }
8747
8759
  }
8748
8760
  return false;
8749
8761
  };
@@ -8766,15 +8778,17 @@ function DatePicker({
8766
8778
  };
8767
8779
  const getHoverRangePosition = (date) => {
8768
8780
  if (!date || !hoveredDate) return "none";
8769
- if (mode === "range" && selectedDates.length === 1) {
8770
- const startDate = selectedDates[0];
8771
- const [start, end] = startDate <= hoveredDate ? [startDate, hoveredDate] : [hoveredDate, startDate];
8772
- if (isSameDate(date, start) && isSameDate(date, end)) {
8773
- return "single";
8781
+ if (mode === "range") {
8782
+ const startDate = tempStartDate || (selectedDates.length > 0 ? selectedDates[0] : null);
8783
+ if (startDate) {
8784
+ const [start, end] = startDate <= hoveredDate ? [startDate, hoveredDate] : [hoveredDate, startDate];
8785
+ if (isSameDate(date, start) && isSameDate(date, end)) {
8786
+ return "single";
8787
+ }
8788
+ if (isSameDate(date, start)) return "start";
8789
+ if (isSameDate(date, end)) return "end";
8790
+ if (date > start && date < end) return "middle";
8774
8791
  }
8775
- if (isSameDate(date, start)) return "start";
8776
- if (isSameDate(date, end)) return "end";
8777
- if (date > start && date < end) return "middle";
8778
8792
  }
8779
8793
  return "none";
8780
8794
  };
@@ -9511,17 +9525,17 @@ const predefinedBrands = [
9511
9525
  "default"
9512
9526
  ];
9513
9527
  const defaultPrimaryColors = {
9514
- "--ina-primary-25": "#eff4ff",
9515
- "--ina-primary-50": "#d1dfff",
9516
- "--ina-primary-100": "#b2ccff",
9517
- "--ina-primary-200": "#83adff",
9518
- "--ina-primary-300": "#528aff",
9519
- "--ina-primary-400": "#3b82f6",
9520
- "--ina-primary-500": "#2871ff",
9521
- "--ina-primary-600": "#155eef",
9522
- "--ina-primary-700": "#004eeb",
9523
- "--ina-primary-800": "#0040c1",
9524
- "--ina-primary-900": "#01359e"
9528
+ "--ina-primary-25": "#a3a3a3",
9529
+ "--ina-primary-50": "#737373",
9530
+ "--ina-primary-100": "#525252",
9531
+ "--ina-primary-200": "#404040",
9532
+ "--ina-primary-300": "#141414",
9533
+ "--ina-primary-400": "#141414",
9534
+ "--ina-primary-500": "#141414",
9535
+ "--ina-primary-600": "#141414",
9536
+ "--ina-primary-700": "#141414",
9537
+ "--ina-primary-800": "#141414",
9538
+ "--ina-primary-900": "#141414"
9525
9539
  };
9526
9540
  let currentTheme = {
9527
9541
  name: "default"