@idds/react 1.5.31 → 1.5.33

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
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import React, { createContext, useRef, useState, useCallback, useMemo, useContext, useId, useEffect, forwardRef, createElement, Fragment as Fragment$1, useImperativeHandle } from "react";
2
+ import React, { createContext, useRef, useState, useCallback, useMemo, useContext, useId, useEffect, forwardRef, createElement, useImperativeHandle, Fragment as Fragment$1 } from "react";
3
3
  import { createPortal } from "react-dom";
4
4
  const iddsColorTokens = {
5
5
  // Neutral Colors
@@ -824,136 +824,128 @@ const createReactComponent = (type, iconName, iconNamePascal, iconNode) => {
824
824
  * This source code is licensed under the MIT license.
825
825
  * See the LICENSE file in the root directory of this source tree.
826
826
  */
827
- const __iconNode$v = [["path", { "d": "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0", "key": "svg-0" }], ["path", { "d": "M12 8v4", "key": "svg-1" }], ["path", { "d": "M12 16h.01", "key": "svg-2" }]];
828
- const IconAlertCircle = createReactComponent("outline", "alert-circle", "AlertCircle", __iconNode$v);
827
+ const __iconNode$u = [["path", { "d": "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0", "key": "svg-0" }], ["path", { "d": "M12 8v4", "key": "svg-1" }], ["path", { "d": "M12 16h.01", "key": "svg-2" }]];
828
+ const IconAlertCircle = createReactComponent("outline", "alert-circle", "AlertCircle", __iconNode$u);
829
829
  /**
830
830
  * @license @tabler/icons-react v3.35.0 - MIT
831
831
  *
832
832
  * This source code is licensed under the MIT license.
833
833
  * See the LICENSE file in the root directory of this source tree.
834
834
  */
835
- const __iconNode$u = [["path", { "d": "M12 9v4", "key": "svg-0" }], ["path", { "d": "M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0z", "key": "svg-1" }], ["path", { "d": "M12 16h.01", "key": "svg-2" }]];
836
- const IconAlertTriangle = createReactComponent("outline", "alert-triangle", "AlertTriangle", __iconNode$u);
835
+ const __iconNode$t = [["path", { "d": "M12 9v4", "key": "svg-0" }], ["path", { "d": "M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0z", "key": "svg-1" }], ["path", { "d": "M12 16h.01", "key": "svg-2" }]];
836
+ const IconAlertTriangle = createReactComponent("outline", "alert-triangle", "AlertTriangle", __iconNode$t);
837
837
  /**
838
838
  * @license @tabler/icons-react v3.35.0 - MIT
839
839
  *
840
840
  * This source code is licensed under the MIT license.
841
841
  * See the LICENSE file in the root directory of this source tree.
842
842
  */
843
- const __iconNode$t = [["path", { "d": "M12 5l0 14", "key": "svg-0" }], ["path", { "d": "M16 15l-4 4", "key": "svg-1" }], ["path", { "d": "M8 15l4 4", "key": "svg-2" }]];
844
- const IconArrowNarrowDown = createReactComponent("outline", "arrow-narrow-down", "ArrowNarrowDown", __iconNode$t);
843
+ const __iconNode$s = [["path", { "d": "M12 5l0 14", "key": "svg-0" }], ["path", { "d": "M16 15l-4 4", "key": "svg-1" }], ["path", { "d": "M8 15l4 4", "key": "svg-2" }]];
844
+ const IconArrowNarrowDown = createReactComponent("outline", "arrow-narrow-down", "ArrowNarrowDown", __iconNode$s);
845
845
  /**
846
846
  * @license @tabler/icons-react v3.35.0 - MIT
847
847
  *
848
848
  * This source code is licensed under the MIT license.
849
849
  * See the LICENSE file in the root directory of this source tree.
850
850
  */
851
- const __iconNode$s = [["path", { "d": "M12 5l0 14", "key": "svg-0" }], ["path", { "d": "M16 9l-4 -4", "key": "svg-1" }], ["path", { "d": "M8 9l4 -4", "key": "svg-2" }]];
852
- const IconArrowNarrowUp = createReactComponent("outline", "arrow-narrow-up", "ArrowNarrowUp", __iconNode$s);
851
+ const __iconNode$r = [["path", { "d": "M12 5l0 14", "key": "svg-0" }], ["path", { "d": "M16 9l-4 -4", "key": "svg-1" }], ["path", { "d": "M8 9l4 -4", "key": "svg-2" }]];
852
+ const IconArrowNarrowUp = createReactComponent("outline", "arrow-narrow-up", "ArrowNarrowUp", __iconNode$r);
853
853
  /**
854
854
  * @license @tabler/icons-react v3.35.0 - MIT
855
855
  *
856
856
  * This source code is licensed under the MIT license.
857
857
  * See the LICENSE file in the root directory of this source tree.
858
858
  */
859
- const __iconNode$r = [["path", { "d": "M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12z", "key": "svg-0" }], ["path", { "d": "M16 3v4", "key": "svg-1" }], ["path", { "d": "M8 3v4", "key": "svg-2" }], ["path", { "d": "M4 11h16", "key": "svg-3" }], ["path", { "d": "M11 15h1", "key": "svg-4" }], ["path", { "d": "M12 15v3", "key": "svg-5" }]];
860
- const IconCalendar = createReactComponent("outline", "calendar", "Calendar", __iconNode$r);
859
+ const __iconNode$q = [["path", { "d": "M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12z", "key": "svg-0" }], ["path", { "d": "M16 3v4", "key": "svg-1" }], ["path", { "d": "M8 3v4", "key": "svg-2" }], ["path", { "d": "M4 11h16", "key": "svg-3" }], ["path", { "d": "M11 15h1", "key": "svg-4" }], ["path", { "d": "M12 15v3", "key": "svg-5" }]];
860
+ const IconCalendar = createReactComponent("outline", "calendar", "Calendar", __iconNode$q);
861
861
  /**
862
862
  * @license @tabler/icons-react v3.35.0 - MIT
863
863
  *
864
864
  * This source code is licensed under the MIT license.
865
865
  * See the LICENSE file in the root directory of this source tree.
866
866
  */
867
- const __iconNode$q = [["path", { "d": "M5 12l5 5l10 -10", "key": "svg-0" }]];
868
- const IconCheck = createReactComponent("outline", "check", "Check", __iconNode$q);
867
+ const __iconNode$p = [["path", { "d": "M5 12l5 5l10 -10", "key": "svg-0" }]];
868
+ const IconCheck = createReactComponent("outline", "check", "Check", __iconNode$p);
869
869
  /**
870
870
  * @license @tabler/icons-react v3.35.0 - MIT
871
871
  *
872
872
  * This source code is licensed under the MIT license.
873
873
  * See the LICENSE file in the root directory of this source tree.
874
874
  */
875
- const __iconNode$p = [["path", { "d": "M6 9l6 6l6 -6", "key": "svg-0" }]];
876
- const IconChevronDown = createReactComponent("outline", "chevron-down", "ChevronDown", __iconNode$p);
875
+ const __iconNode$o = [["path", { "d": "M6 9l6 6l6 -6", "key": "svg-0" }]];
876
+ const IconChevronDown = createReactComponent("outline", "chevron-down", "ChevronDown", __iconNode$o);
877
877
  /**
878
878
  * @license @tabler/icons-react v3.35.0 - MIT
879
879
  *
880
880
  * This source code is licensed under the MIT license.
881
881
  * See the LICENSE file in the root directory of this source tree.
882
882
  */
883
- const __iconNode$o = [["path", { "d": "M15 6l-6 6l6 6", "key": "svg-0" }]];
884
- const IconChevronLeft = createReactComponent("outline", "chevron-left", "ChevronLeft", __iconNode$o);
883
+ const __iconNode$n = [["path", { "d": "M15 6l-6 6l6 6", "key": "svg-0" }]];
884
+ const IconChevronLeft = createReactComponent("outline", "chevron-left", "ChevronLeft", __iconNode$n);
885
885
  /**
886
886
  * @license @tabler/icons-react v3.35.0 - MIT
887
887
  *
888
888
  * This source code is licensed under the MIT license.
889
889
  * See the LICENSE file in the root directory of this source tree.
890
890
  */
891
- const __iconNode$n = [["path", { "d": "M9 6l6 6l-6 6", "key": "svg-0" }]];
892
- const IconChevronRight = createReactComponent("outline", "chevron-right", "ChevronRight", __iconNode$n);
891
+ const __iconNode$m = [["path", { "d": "M9 6l6 6l-6 6", "key": "svg-0" }]];
892
+ const IconChevronRight = createReactComponent("outline", "chevron-right", "ChevronRight", __iconNode$m);
893
893
  /**
894
894
  * @license @tabler/icons-react v3.35.0 - MIT
895
895
  *
896
896
  * This source code is licensed under the MIT license.
897
897
  * See the LICENSE file in the root directory of this source tree.
898
898
  */
899
- const __iconNode$m = [["path", { "d": "M6 15l6 -6l6 6", "key": "svg-0" }]];
900
- const IconChevronUp = createReactComponent("outline", "chevron-up", "ChevronUp", __iconNode$m);
899
+ const __iconNode$l = [["path", { "d": "M6 15l6 -6l6 6", "key": "svg-0" }]];
900
+ const IconChevronUp = createReactComponent("outline", "chevron-up", "ChevronUp", __iconNode$l);
901
901
  /**
902
902
  * @license @tabler/icons-react v3.35.0 - MIT
903
903
  *
904
904
  * This source code is licensed under the MIT license.
905
905
  * See the LICENSE file in the root directory of this source tree.
906
906
  */
907
- const __iconNode$l = [["path", { "d": "M11 7l-5 5l5 5", "key": "svg-0" }], ["path", { "d": "M17 7l-5 5l5 5", "key": "svg-1" }]];
908
- const IconChevronsLeft = createReactComponent("outline", "chevrons-left", "ChevronsLeft", __iconNode$l);
907
+ const __iconNode$k = [["path", { "d": "M11 7l-5 5l5 5", "key": "svg-0" }], ["path", { "d": "M17 7l-5 5l5 5", "key": "svg-1" }]];
908
+ const IconChevronsLeft = createReactComponent("outline", "chevrons-left", "ChevronsLeft", __iconNode$k);
909
909
  /**
910
910
  * @license @tabler/icons-react v3.35.0 - MIT
911
911
  *
912
912
  * This source code is licensed under the MIT license.
913
913
  * See the LICENSE file in the root directory of this source tree.
914
914
  */
915
- const __iconNode$k = [["path", { "d": "M7 7l5 5l-5 5", "key": "svg-0" }], ["path", { "d": "M13 7l5 5l-5 5", "key": "svg-1" }]];
916
- const IconChevronsRight = createReactComponent("outline", "chevrons-right", "ChevronsRight", __iconNode$k);
915
+ const __iconNode$j = [["path", { "d": "M7 7l5 5l-5 5", "key": "svg-0" }], ["path", { "d": "M13 7l5 5l-5 5", "key": "svg-1" }]];
916
+ const IconChevronsRight = createReactComponent("outline", "chevrons-right", "ChevronsRight", __iconNode$j);
917
917
  /**
918
918
  * @license @tabler/icons-react v3.35.0 - MIT
919
919
  *
920
920
  * This source code is licensed under the MIT license.
921
921
  * See the LICENSE file in the root directory of this source tree.
922
922
  */
923
- const __iconNode$j = [["path", { "d": "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0", "key": "svg-0" }], ["path", { "d": "M9 12l2 2l4 -4", "key": "svg-1" }]];
924
- const IconCircleCheck = createReactComponent("outline", "circle-check", "CircleCheck", __iconNode$j);
923
+ const __iconNode$i = [["path", { "d": "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0", "key": "svg-0" }], ["path", { "d": "M9 12l2 2l4 -4", "key": "svg-1" }]];
924
+ const IconCircleCheck = createReactComponent("outline", "circle-check", "CircleCheck", __iconNode$i);
925
925
  /**
926
926
  * @license @tabler/icons-react v3.35.0 - MIT
927
927
  *
928
928
  * This source code is licensed under the MIT license.
929
929
  * See the LICENSE file in the root directory of this source tree.
930
930
  */
931
- const __iconNode$i = [["path", { "d": "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0", "key": "svg-0" }], ["path", { "d": "M10 10l4 4m0 -4l-4 4", "key": "svg-1" }]];
932
- const IconCircleX = createReactComponent("outline", "circle-x", "CircleX", __iconNode$i);
931
+ const __iconNode$h = [["path", { "d": "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0", "key": "svg-0" }], ["path", { "d": "M10 10l4 4m0 -4l-4 4", "key": "svg-1" }]];
932
+ const IconCircleX = createReactComponent("outline", "circle-x", "CircleX", __iconNode$h);
933
933
  /**
934
934
  * @license @tabler/icons-react v3.35.0 - MIT
935
935
  *
936
936
  * This source code is licensed under the MIT license.
937
937
  * See the LICENSE file in the root directory of this source tree.
938
938
  */
939
- const __iconNode$h = [["path", { "d": "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0", "key": "svg-0" }], ["path", { "d": "M12 7v5l3 3", "key": "svg-1" }]];
940
- const IconClock = createReactComponent("outline", "clock", "Clock", __iconNode$h);
939
+ const __iconNode$g = [["path", { "d": "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0", "key": "svg-0" }], ["path", { "d": "M12 7v5l3 3", "key": "svg-1" }]];
940
+ const IconClock = createReactComponent("outline", "clock", "Clock", __iconNode$g);
941
941
  /**
942
942
  * @license @tabler/icons-react v3.35.0 - MIT
943
943
  *
944
944
  * This source code is licensed under the MIT license.
945
945
  * See the LICENSE file in the root directory of this source tree.
946
946
  */
947
- const __iconNode$g = [["path", { "d": "M6 17.6l-2 -1.1v-2.5", "key": "svg-0" }], ["path", { "d": "M4 10v-2.5l2 -1.1", "key": "svg-1" }], ["path", { "d": "M10 4.1l2 -1.1l2 1.1", "key": "svg-2" }], ["path", { "d": "M18 6.4l2 1.1v2.5", "key": "svg-3" }], ["path", { "d": "M20 14v2.5l-2 1.12", "key": "svg-4" }], ["path", { "d": "M14 19.9l-2 1.1l-2 -1.1", "key": "svg-5" }], ["path", { "d": "M12 12l2 -1.1", "key": "svg-6" }], ["path", { "d": "M18 8.6l2 -1.1", "key": "svg-7" }], ["path", { "d": "M12 12l0 2.5", "key": "svg-8" }], ["path", { "d": "M12 18.5l0 2.5", "key": "svg-9" }], ["path", { "d": "M12 12l-2 -1.12", "key": "svg-10" }], ["path", { "d": "M6 8.6l-2 -1.1", "key": "svg-11" }]];
948
- const IconCube3dSphere = createReactComponent("outline", "cube-3d-sphere", "Cube3dSphere", __iconNode$g);
949
- /**
950
- * @license @tabler/icons-react v3.35.0 - MIT
951
- *
952
- * This source code is licensed under the MIT license.
953
- * See the LICENSE file in the root directory of this source tree.
954
- */
955
- const __iconNode$f = [["path", { "d": "M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", "key": "svg-0" }], ["path", { "d": "M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", "key": "svg-1" }], ["path", { "d": "M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0", "key": "svg-2" }]];
956
- const IconDotsVertical = createReactComponent("outline", "dots-vertical", "DotsVertical", __iconNode$f);
947
+ const __iconNode$f = [["path", { "d": "M6 17.6l-2 -1.1v-2.5", "key": "svg-0" }], ["path", { "d": "M4 10v-2.5l2 -1.1", "key": "svg-1" }], ["path", { "d": "M10 4.1l2 -1.1l2 1.1", "key": "svg-2" }], ["path", { "d": "M18 6.4l2 1.1v2.5", "key": "svg-3" }], ["path", { "d": "M20 14v2.5l-2 1.12", "key": "svg-4" }], ["path", { "d": "M14 19.9l-2 1.1l-2 -1.1", "key": "svg-5" }], ["path", { "d": "M12 12l2 -1.1", "key": "svg-6" }], ["path", { "d": "M18 8.6l2 -1.1", "key": "svg-7" }], ["path", { "d": "M12 12l0 2.5", "key": "svg-8" }], ["path", { "d": "M12 18.5l0 2.5", "key": "svg-9" }], ["path", { "d": "M12 12l-2 -1.12", "key": "svg-10" }], ["path", { "d": "M6 8.6l-2 -1.1", "key": "svg-11" }]];
948
+ const IconCube3dSphere = createReactComponent("outline", "cube-3d-sphere", "Cube3dSphere", __iconNode$f);
957
949
  /**
958
950
  * @license @tabler/icons-react v3.35.0 - MIT
959
951
  *
@@ -1138,94 +1130,102 @@ function AccordionCard({
1138
1130
  )
1139
1131
  ] });
1140
1132
  }
1141
- function ActionDropdown({
1142
- trigger,
1143
- items,
1144
- className = "",
1145
- iconSize = 24,
1146
- dropdownClassName = "",
1147
- dropdownStyle
1148
- }) {
1149
- const [open, setOpen] = useState(false);
1150
- const [dropdownPosition, setDropdownPosition] = useState({ vertical: "bottom", horizontal: "right" });
1151
- const containerRef = useRef(null);
1152
- useEffect(() => {
1153
- const handleClickOutside = (e) => {
1154
- if (containerRef.current && !containerRef.current.contains(e.target)) {
1155
- setOpen(false);
1156
- }
1157
- };
1158
- document.addEventListener("mousedown", handleClickOutside);
1159
- return () => {
1160
- document.removeEventListener("mousedown", handleClickOutside);
1161
- };
1162
- }, []);
1163
- const handleTriggerClick = (e) => {
1164
- e.stopPropagation();
1165
- if (containerRef.current) {
1166
- const rect = containerRef.current.getBoundingClientRect();
1167
- const dropdownHeight = items.length * 40 + 16;
1168
- const dropdownWidth = 160;
1169
- const fitsBelow = rect.bottom + dropdownHeight <= window.innerHeight;
1170
- const vertical = fitsBelow ? "bottom" : "top";
1171
- const fitsRight = rect.right + dropdownWidth <= window.innerWidth;
1172
- const horizontal = fitsRight ? "right" : "left";
1173
- setDropdownPosition({ vertical, horizontal });
1174
- }
1175
- setOpen((o) => !o);
1176
- };
1177
- return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: clsx("ina-action-dropdown", className), children: [
1178
- React.isValidElement(trigger) && trigger.props && trigger.props.type === "button" ? React.cloneElement(trigger, {
1179
- onClick: (e) => {
1180
- if (typeof trigger.props.onClick === "function") {
1181
- trigger.props.onClick(e);
1133
+ const ActionDropdown = forwardRef(
1134
+ ({
1135
+ label,
1136
+ items,
1137
+ placement = "bottom-start",
1138
+ icon,
1139
+ className,
1140
+ menuClassName,
1141
+ triggerClassName,
1142
+ width = "auto",
1143
+ disabled = false
1144
+ }, ref) => {
1145
+ const [isOpen, setIsOpen] = useState(false);
1146
+ const triggerRef = useRef(null);
1147
+ const menuRef = useRef(null);
1148
+ useImperativeHandle(ref, () => ({
1149
+ open: () => setIsOpen(true),
1150
+ close: () => setIsOpen(false),
1151
+ toggle: () => setIsOpen((prev) => !prev)
1152
+ }));
1153
+ useEffect(() => {
1154
+ const handleClickOutside = (event) => {
1155
+ if (triggerRef.current && !triggerRef.current.contains(event.target) && menuRef.current && !menuRef.current.contains(event.target)) {
1156
+ setIsOpen(false);
1182
1157
  }
1183
- handleTriggerClick(e);
1184
- },
1185
- "aria-haspopup": "true",
1186
- "aria-expanded": open
1187
- }) : /* @__PURE__ */ jsx(
1188
- "div",
1189
- {
1190
- onClick: handleTriggerClick,
1191
- "aria-haspopup": "true",
1192
- "aria-expanded": open,
1193
- className: "ina-action-dropdown__trigger",
1194
- children: trigger ?? /* @__PURE__ */ jsx(IconDotsVertical, { size: iconSize })
1195
- }
1196
- ),
1197
- open && /* @__PURE__ */ jsx(
1158
+ };
1159
+ document.addEventListener("mousedown", handleClickOutside);
1160
+ return () => {
1161
+ document.removeEventListener("mousedown", handleClickOutside);
1162
+ };
1163
+ }, []);
1164
+ const containerClasses = clsx(
1165
+ "ina-action-dropdown",
1166
+ width === "full" && "w-full",
1167
+ className
1168
+ );
1169
+ const triggerClasses = clsx(
1170
+ "ina-action-dropdown__trigger",
1171
+ triggerClassName
1172
+ );
1173
+ const menuClasses = clsx(
1174
+ "ina-action-dropdown__menu",
1175
+ `ina-action-dropdown__menu--${placement}`,
1176
+ `ina-action-dropdown__menu--width-${width}`,
1177
+ isOpen && "ina-action-dropdown__menu--visible",
1178
+ menuClassName
1179
+ );
1180
+ const handleItemClick = (item) => {
1181
+ var _a;
1182
+ if (item.disabled) return;
1183
+ (_a = item.onClick) == null ? void 0 : _a.call(item);
1184
+ setIsOpen(false);
1185
+ };
1186
+ return /* @__PURE__ */ jsxs(
1198
1187
  "div",
1199
1188
  {
1200
- className: clsx(
1201
- "ina-action-dropdown__menu",
1202
- `ina-action-dropdown__menu--${dropdownPosition.vertical}`,
1203
- `ina-action-dropdown__menu--${dropdownPosition.horizontal}`,
1204
- dropdownClassName
1205
- ),
1206
- style: dropdownStyle,
1207
- role: "menu",
1208
- onMouseDown: (e) => e.stopPropagation(),
1209
- children: /* @__PURE__ */ jsx("ul", { className: "ina-action-dropdown__list", children: items.map((item, idx) => {
1210
- if (item && typeof item === "object" && "props" in item && item.props.className) {
1211
- return /* @__PURE__ */ jsx("li", {
1212
- role: "none",
1213
- // Clone element dengan className hasil clsx
1214
- // @ts-ignore
1215
- children: React.cloneElement(item, {
1216
- className: clsx(
1217
- "ina-action-dropdown__item",
1218
- item.props.className
1219
- )
1220
- })
1221
- }, idx);
1222
- }
1223
- return /* @__PURE__ */ jsx("li", { role: "none", children: /* @__PURE__ */ jsx("div", { className: "ina-action-dropdown__item", children: item }) }, idx);
1224
- }) })
1189
+ className: containerClasses,
1190
+ ref: menuRef,
1191
+ children: [
1192
+ /* @__PURE__ */ jsxs(
1193
+ "button",
1194
+ {
1195
+ ref: triggerRef,
1196
+ type: "button",
1197
+ className: triggerClasses,
1198
+ onClick: () => !disabled && setIsOpen(!isOpen),
1199
+ disabled,
1200
+ children: [
1201
+ icon && /* @__PURE__ */ jsx("span", { className: "ina-action-dropdown__icon", children: icon }),
1202
+ label && /* @__PURE__ */ jsx("span", { className: "ina-action-dropdown__label", children: label })
1203
+ ]
1204
+ }
1205
+ ),
1206
+ /* @__PURE__ */ jsx("div", { className: menuClasses, children: /* @__PURE__ */ jsx("ul", { className: "ina-action-dropdown__list", children: items.map((item, index) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
1207
+ "button",
1208
+ {
1209
+ type: "button",
1210
+ className: clsx(
1211
+ "ina-action-dropdown__item",
1212
+ item.type && `ina-action-dropdown__item--${item.type}`,
1213
+ item.disabled && "ina-action-dropdown__item--disabled"
1214
+ ),
1215
+ onClick: () => handleItemClick(item),
1216
+ disabled: item.disabled,
1217
+ children: [
1218
+ item.icon && /* @__PURE__ */ jsx("span", { className: "ina-action-dropdown__item-icon", children: item.icon }),
1219
+ item.label
1220
+ ]
1221
+ }
1222
+ ) }, index)) }) })
1223
+ ]
1225
1224
  }
1226
- )
1227
- ] });
1228
- }
1225
+ );
1226
+ }
1227
+ );
1228
+ ActionDropdown.displayName = "ActionDropdown";
1229
1229
  function Alert(props) {
1230
1230
  const {
1231
1231
  variant = "info",
@@ -2311,120 +2311,92 @@ function Divider({
2311
2311
  );
2312
2312
  return /* @__PURE__ */ jsx("hr", { className: dividerClasses });
2313
2313
  }
2314
- function Dropdown({
2314
+ function BasicDropdown({
2315
2315
  trigger,
2316
- items,
2316
+ content,
2317
+ open: controlledOpen,
2318
+ defaultOpen = false,
2319
+ onOpenChange,
2320
+ placement = "bottom-start",
2317
2321
  className = "",
2318
- dropdownClassName = "",
2319
- dropdownStyle,
2320
- disabled = false,
2321
- dropdownWidth
2322
+ panelClassName = "",
2323
+ triggerClassName = "",
2324
+ disabled = false
2322
2325
  }) {
2323
- const [open, setOpen] = useState(false);
2324
- const [dropdownPosition, setDropdownPosition] = useState({ vertical: "bottom", horizontal: "left" });
2325
- const [triggerWidth, setTriggerWidth] = useState(0);
2326
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
2327
+ const isControlled = controlledOpen !== void 0;
2328
+ const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
2326
2329
  const containerRef = useRef(null);
2327
- const [mounted, setMounted] = useState(false);
2328
- useEffect(() => {
2329
- setMounted(true);
2330
- }, []);
2330
+ const triggerRef = useRef(null);
2331
+ const panelRef = useRef(null);
2332
+ const handleOpenChange = (newOpen) => {
2333
+ if (!isControlled) {
2334
+ setUncontrolledOpen(newOpen);
2335
+ }
2336
+ onOpenChange == null ? void 0 : onOpenChange(newOpen);
2337
+ };
2338
+ const toggle = (e) => {
2339
+ e.stopPropagation();
2340
+ if (disabled) return;
2341
+ handleOpenChange(!isOpen);
2342
+ };
2331
2343
  useEffect(() => {
2332
- if (!mounted) return;
2333
- const handleClickOutside = (e) => {
2334
- if (containerRef.current && !containerRef.current.contains(e.target)) {
2335
- setOpen(false);
2344
+ const handleClickOutside = (event) => {
2345
+ if (containerRef.current && !containerRef.current.contains(event.target)) {
2346
+ if (isOpen) {
2347
+ handleOpenChange(false);
2348
+ }
2336
2349
  }
2337
2350
  };
2338
2351
  document.addEventListener("mousedown", handleClickOutside);
2352
+ document.addEventListener("touchstart", handleClickOutside);
2339
2353
  return () => {
2340
2354
  document.removeEventListener("mousedown", handleClickOutside);
2355
+ document.removeEventListener("touchstart", handleClickOutside);
2341
2356
  };
2342
- }, [mounted]);
2343
- const handleTriggerClick = (e) => {
2344
- e.stopPropagation();
2345
- if (disabled) return;
2346
- if (containerRef.current) {
2347
- const rect = containerRef.current.getBoundingClientRect();
2348
- setTriggerWidth(rect.width);
2349
- const dropdownHeight = 200;
2350
- const fitsBelow = rect.bottom + dropdownHeight <= window.innerHeight;
2351
- const vertical = fitsBelow ? "bottom" : "top";
2352
- const fitsRight = rect.left + (dropdownWidth ?? 160) <= window.innerWidth;
2353
- const horizontal = fitsRight ? "left" : "right";
2354
- setDropdownPosition({ vertical, horizontal });
2355
- }
2356
- setOpen((o) => !o);
2357
- };
2358
- const dropdownContainerClasses = clsx("ina-dropdown", className);
2359
- const triggerClasses = clsx(
2360
- "ina-dropdown__trigger",
2361
- disabled && "ina-dropdown__trigger--disabled"
2362
- );
2363
- const menuClasses = clsx(
2364
- "ina-dropdown__menu",
2365
- open && "ina-dropdown__menu--visible",
2366
- `ina-dropdown__menu--position-${dropdownPosition.vertical}`,
2367
- `ina-dropdown__menu--align-${dropdownPosition.horizontal}`,
2368
- dropdownClassName
2369
- );
2370
- const effectiveWidth = dropdownWidth ?? triggerWidth;
2371
- const isStandardTrigger = typeof trigger === "string" || typeof trigger === "number";
2372
- return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: dropdownContainerClasses, children: [
2373
- /* @__PURE__ */ jsx("div", { onClick: handleTriggerClick, className: triggerClasses, children: isStandardTrigger ? /* @__PURE__ */ jsxs(
2357
+ }, [isOpen, onOpenChange]);
2358
+ const isPrimitiveTrigger = typeof trigger === "string" || typeof trigger === "number";
2359
+ return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: clsx("ina-basic-dropdown", className), children: [
2360
+ /* @__PURE__ */ jsx(
2374
2361
  "div",
2375
2362
  {
2376
- className: clsx(
2377
- "ina-dropdown__trigger-button",
2378
- open && "ina-dropdown__trigger-button--open"
2379
- ),
2380
- children: [
2381
- /* @__PURE__ */ jsx("span", { className: "ina-dropdown__trigger-content", children: trigger }),
2382
- /* @__PURE__ */ jsx(
2383
- "svg",
2384
- {
2385
- className: "ina-dropdown__trigger-icon",
2386
- width: "16",
2387
- height: "16",
2388
- viewBox: "0 0 16 16",
2389
- fill: "none",
2390
- xmlns: "http://www.w3.org/2000/svg",
2391
- children: /* @__PURE__ */ jsx(
2392
- "path",
2363
+ ref: triggerRef,
2364
+ className: clsx("ina-basic-dropdown__trigger", triggerClassName),
2365
+ onClick: toggle,
2366
+ children: isPrimitiveTrigger ? /* @__PURE__ */ jsxs(
2367
+ "button",
2368
+ {
2369
+ type: "button",
2370
+ disabled,
2371
+ className: clsx(
2372
+ "ina-basic-dropdown__trigger-button",
2373
+ isOpen && "ina-basic-dropdown__trigger-button--open"
2374
+ ),
2375
+ children: [
2376
+ /* @__PURE__ */ jsx("span", { className: "ina-basic-dropdown__trigger-content", children: trigger }),
2377
+ /* @__PURE__ */ jsx(
2378
+ IconChevronDown,
2393
2379
  {
2394
- d: "M4 6L8 10L12 6",
2395
- stroke: "currentColor",
2396
- strokeWidth: "1.5",
2397
- strokeLinecap: "round",
2398
- strokeLinejoin: "round"
2380
+ size: 16,
2381
+ className: "ina-basic-dropdown__trigger-icon"
2399
2382
  }
2400
2383
  )
2401
- }
2402
- )
2403
- ]
2384
+ ]
2385
+ }
2386
+ ) : trigger
2404
2387
  }
2405
- ) : trigger }),
2406
- open && /* @__PURE__ */ jsx(
2388
+ ),
2389
+ isOpen && !disabled && /* @__PURE__ */ jsx(
2407
2390
  "div",
2408
2391
  {
2409
- className: menuClasses,
2410
- style: {
2411
- width: effectiveWidth || void 0,
2412
- minWidth: effectiveWidth ? void 0 : "160px",
2413
- ...dropdownStyle
2414
- },
2415
- role: "menu",
2416
- onMouseDown: (e) => e.stopPropagation(),
2417
- children: /* @__PURE__ */ jsx("ul", { className: "ina-dropdown__list", children: items.map((item, idx) => {
2418
- if (item && typeof item === "object" && "props" in item && item.props.className) {
2419
- return /* @__PURE__ */ jsx("li", { role: "none", children: React.cloneElement(item, {
2420
- className: clsx(
2421
- "ina-dropdown__item",
2422
- item.props.className
2423
- )
2424
- }) }, idx);
2425
- }
2426
- return /* @__PURE__ */ jsx("li", { role: "none", children: /* @__PURE__ */ jsx("div", { className: "ina-dropdown__item", children: item }) }, idx);
2427
- }) })
2392
+ ref: panelRef,
2393
+ className: clsx(
2394
+ "ina-basic-dropdown__panel",
2395
+ `ina-basic-dropdown__panel--${placement}`,
2396
+ panelClassName
2397
+ ),
2398
+ onClick: (e) => e.stopPropagation(),
2399
+ children: content
2428
2400
  }
2429
2401
  )
2430
2402
  ] });
@@ -10028,7 +10000,8 @@ function DatePicker({
10028
10000
  readonly = false,
10029
10001
  size = "md",
10030
10002
  label,
10031
- required
10003
+ required,
10004
+ panelOnly = false
10032
10005
  }) {
10033
10006
  const [isOpen, setIsOpen] = useState(false);
10034
10007
  const [currentMonth, setCurrentMonth] = useState(/* @__PURE__ */ new Date());
@@ -10089,11 +10062,11 @@ function DatePicker({
10089
10062
  setTempStartDate(null);
10090
10063
  setTempStartDate(null);
10091
10064
  };
10092
- if (isOpen) {
10065
+ if (isOpen && !panelOnly) {
10093
10066
  document.addEventListener("mousedown", handleClickOutside, true);
10094
10067
  return () => document.removeEventListener("mousedown", handleClickOutside, true);
10095
10068
  }
10096
- }, [isOpen]);
10069
+ }, [isOpen, panelOnly]);
10097
10070
  useEffect(() => {
10098
10071
  if (isOpen) {
10099
10072
  const allDatePickers = document.querySelectorAll(".ina-date-picker");
@@ -10194,7 +10167,7 @@ function DatePicker({
10194
10167
  ]);
10195
10168
  const hasInitialized = useRef(false);
10196
10169
  useEffect(() => {
10197
- if (isOpen && !hasInitialized.current) {
10170
+ if ((isOpen || panelOnly) && !hasInitialized.current) {
10198
10171
  const parsedDates = parseSelectedDates();
10199
10172
  let targetMonth = null;
10200
10173
  let targetNextMonth = null;
@@ -10273,7 +10246,7 @@ function DatePicker({
10273
10246
  }
10274
10247
  }, [isOpen, mode, getFirstEnabledMonth]);
10275
10248
  useEffect(() => {
10276
- if (isOpen && triggerRef.current) {
10249
+ if (isOpen && triggerRef.current && !panelOnly) {
10277
10250
  const calculatePosition = () => {
10278
10251
  if (!triggerRef.current) return;
10279
10252
  const triggerRect = triggerRef.current.getBoundingClientRect();
@@ -10700,15 +10673,16 @@ function DatePicker({
10700
10673
  className: clsx(
10701
10674
  "ina-date-picker",
10702
10675
  disabled && "ina-date-picker--disabled",
10676
+ panelOnly && "ina-date-picker--panel-only",
10703
10677
  className
10704
10678
  ),
10705
10679
  style: { width: validatedTriggerWidth },
10706
10680
  children: [
10707
- label && /* @__PURE__ */ jsxs("label", { className: "ina-date-picker__label", children: [
10681
+ !panelOnly && label && /* @__PURE__ */ jsxs("label", { className: "ina-date-picker__label", children: [
10708
10682
  label,
10709
10683
  required && /* @__PURE__ */ jsx("span", { className: "ina-date-picker__required", children: "*" })
10710
10684
  ] }),
10711
- /* @__PURE__ */ jsxs(
10685
+ !panelOnly && /* @__PURE__ */ jsxs(
10712
10686
  "button",
10713
10687
  {
10714
10688
  ref: triggerRef,
@@ -10764,7 +10738,7 @@ function DatePicker({
10764
10738
  ]
10765
10739
  }
10766
10740
  ),
10767
- isOpen && !disabled && !readonly && /* @__PURE__ */ jsx(
10741
+ (isOpen || panelOnly) && !disabled && !readonly && /* @__PURE__ */ jsx(
10768
10742
  "div",
10769
10743
  {
10770
10744
  ref: panelRef,
@@ -11390,6 +11364,7 @@ export {
11390
11364
  Alert,
11391
11365
  Avatar,
11392
11366
  Badge,
11367
+ BasicDropdown,
11393
11368
  BottomSheet,
11394
11369
  Breadcrumb,
11395
11370
  Button,
@@ -11405,7 +11380,6 @@ export {
11405
11380
  DatePicker,
11406
11381
  Divider,
11407
11382
  Drawer,
11408
- Dropdown,
11409
11383
  FieldInputTable,
11410
11384
  FileUpload,
11411
11385
  FormField,