@agroshine/ags-web-ui-kit 1.1.0 → 1.2.1
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/LICENSE +21 -0
- package/README.md +22 -10
- package/dist/{chunk-JTFCE6RA.js → chunk-BZATZ5U5.js} +237 -102
- package/dist/chunk-BZATZ5U5.js.map +1 -0
- package/dist/{chunk-C4LX3XTN.cjs → chunk-NDHF6M7F.cjs} +238 -97
- package/dist/chunk-NDHF6M7F.cjs.map +1 -0
- package/dist/index.cjs +47 -23
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/organisms/index.cjs +47 -23
- package/dist/organisms/index.d.cts +75 -6
- package/dist/organisms/index.d.ts +75 -6
- package/dist/organisms/index.js +1 -1
- package/dist/styles/tokens.css +44 -0
- package/package.json +3 -3
- package/dist/chunk-C4LX3XTN.cjs.map +0 -1
- package/dist/chunk-JTFCE6RA.js.map +0 -1
|
@@ -720,114 +720,249 @@ var QueryState = React.forwardRef(function QueryState2({
|
|
|
720
720
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
721
721
|
});
|
|
722
722
|
QueryState.displayName = "QueryState";
|
|
723
|
-
|
|
723
|
+
var SearchCategoryMenu = ({
|
|
724
724
|
options,
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
}) {
|
|
732
|
-
const [isOpen, setIsOpen] = React.useState(false);
|
|
733
|
-
const dropdownRef = React.useRef(null);
|
|
734
|
-
const selectedLabel = React.useMemo(
|
|
735
|
-
() => options.find((option) => String(option.value) === selectedOption)?.label ?? selectedOption,
|
|
736
|
-
[options, selectedOption]
|
|
737
|
-
);
|
|
738
|
-
React.useEffect(() => {
|
|
739
|
-
const onClickOutside = (event) => {
|
|
740
|
-
if (!dropdownRef.current) return;
|
|
741
|
-
if (!dropdownRef.current.contains(event.target)) {
|
|
742
|
-
setIsOpen(false);
|
|
743
|
-
}
|
|
744
|
-
};
|
|
745
|
-
document.addEventListener("mousedown", onClickOutside);
|
|
746
|
-
return () => document.removeEventListener("mousedown", onClickOutside);
|
|
747
|
-
}, []);
|
|
725
|
+
isActive,
|
|
726
|
+
onSelect,
|
|
727
|
+
multi
|
|
728
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: options.map((opt) => {
|
|
729
|
+
const v = String(opt.value);
|
|
730
|
+
const active = isActive(v);
|
|
748
731
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
749
|
-
"
|
|
732
|
+
"button",
|
|
750
733
|
{
|
|
751
|
-
|
|
734
|
+
type: "button",
|
|
735
|
+
onClick: () => onSelect(v),
|
|
736
|
+
disabled: opt.disabled,
|
|
737
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
738
|
+
"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm transition-colors",
|
|
739
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
740
|
+
active ? "bg-primary-50 text-primary" : "text-foreground hover:bg-primary-50 hover:text-primary"
|
|
741
|
+
),
|
|
752
742
|
children: [
|
|
753
|
-
/* @__PURE__ */ jsxRuntime.
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
743
|
+
multi && /* @__PURE__ */ jsxRuntime.jsx(
|
|
744
|
+
"input",
|
|
745
|
+
{
|
|
746
|
+
type: "checkbox",
|
|
747
|
+
readOnly: true,
|
|
748
|
+
checked: active,
|
|
749
|
+
tabIndex: -1,
|
|
750
|
+
className: "h-4 w-4 shrink-0 accent-primary"
|
|
751
|
+
}
|
|
752
|
+
),
|
|
753
|
+
opt.leadingIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-primary [&_svg]:h-[18px] [&_svg]:w-[18px]", children: opt.leadingIcon }),
|
|
754
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate", children: opt.label })
|
|
755
|
+
]
|
|
756
|
+
},
|
|
757
|
+
v
|
|
758
|
+
);
|
|
759
|
+
}) });
|
|
760
|
+
var SearchFilterBar = React.forwardRef(
|
|
761
|
+
function SearchFilterBar2(props, ref) {
|
|
762
|
+
const {
|
|
763
|
+
options,
|
|
764
|
+
searchValue,
|
|
765
|
+
onSearchChange,
|
|
766
|
+
searchPlaceholder = "Busca en la categor\xEDa seleccionada",
|
|
767
|
+
onSearch,
|
|
768
|
+
onClear,
|
|
769
|
+
showClear = true,
|
|
770
|
+
suggestions,
|
|
771
|
+
suggestionsOpen,
|
|
772
|
+
categoryMenuWidth = 280,
|
|
773
|
+
className
|
|
774
|
+
} = props;
|
|
775
|
+
const [catOpen, setCatOpen] = React.useState(false);
|
|
776
|
+
const [focused, setFocused] = React.useState(false);
|
|
777
|
+
const inputRef = React.useRef(null);
|
|
778
|
+
const isMulti = props.categoryMultiSelect === true;
|
|
779
|
+
const categoryLabel = React.useMemo(() => {
|
|
780
|
+
if (isMulti) {
|
|
781
|
+
const selected = props.selectedOptions;
|
|
782
|
+
if (selected.length === 0) {
|
|
783
|
+
return props.categoryEmptyLabel ?? "Categor\xEDas";
|
|
784
|
+
}
|
|
785
|
+
const labelFn = props.categoryMultiLabel;
|
|
786
|
+
return labelFn?.(selected.length) ?? `${selected.length} elementos...`;
|
|
787
|
+
}
|
|
788
|
+
const v = props.selectedOption;
|
|
789
|
+
return options.find((o) => String(o.value) === v)?.label ?? v;
|
|
790
|
+
}, [isMulti, props, options]);
|
|
791
|
+
const isOptionActive = React.useCallback(
|
|
792
|
+
(v) => {
|
|
793
|
+
if (isMulti) return props.selectedOptions.includes(v);
|
|
794
|
+
return props.selectedOption === v;
|
|
795
|
+
},
|
|
796
|
+
[isMulti, props]
|
|
797
|
+
);
|
|
798
|
+
const handleSelect = React.useCallback(
|
|
799
|
+
(v) => {
|
|
800
|
+
if (isMulti) {
|
|
801
|
+
const selected = props.selectedOptions;
|
|
802
|
+
const next = selected.includes(v) ? selected.filter((x) => x !== v) : [...selected, v];
|
|
803
|
+
props.onOptionsChange(next);
|
|
804
|
+
} else {
|
|
805
|
+
props.onOptionChange(v);
|
|
806
|
+
setCatOpen(false);
|
|
807
|
+
}
|
|
808
|
+
},
|
|
809
|
+
[isMulti, props]
|
|
810
|
+
);
|
|
811
|
+
const showSuggestions = suggestionsOpen ?? (focused && searchValue.length > 0 && suggestions !== void 0);
|
|
812
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: chunkA3A7PJWG_cjs.cn("relative", className), children: [
|
|
813
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunk2KRMLIJQ_cjs.Popover, { open: catOpen, onOpenChange: setCatOpen, children: [
|
|
814
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunk2KRMLIJQ_cjs.PopoverAnchor, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
815
|
+
"div",
|
|
816
|
+
{
|
|
817
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
818
|
+
"flex h-12 items-center rounded-lg border-[1.5px] bg-background transition-colors",
|
|
819
|
+
catOpen || focused ? "border-primary" : "border-primary-200 hover:border-primary-400"
|
|
820
|
+
),
|
|
821
|
+
children: [
|
|
822
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunk2KRMLIJQ_cjs.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
823
|
+
"button",
|
|
824
|
+
{
|
|
825
|
+
type: "button",
|
|
826
|
+
className: "flex h-full w-[190px] shrink-0 cursor-pointer items-center gap-3 border-0 bg-transparent px-4 text-left text-sm font-semibold text-primary focus:outline-none",
|
|
827
|
+
"aria-haspopup": "listbox",
|
|
828
|
+
"aria-expanded": catOpen,
|
|
829
|
+
children: [
|
|
830
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate", children: categoryLabel }),
|
|
831
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
832
|
+
lucideReact.ChevronDown,
|
|
773
833
|
{
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
834
|
+
"aria-hidden": "true",
|
|
835
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
836
|
+
"h-3 w-3 shrink-0 transition-transform duration-200",
|
|
837
|
+
catOpen && "rotate-180"
|
|
838
|
+
)
|
|
777
839
|
}
|
|
778
840
|
)
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
841
|
+
]
|
|
842
|
+
}
|
|
843
|
+
) }),
|
|
844
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { "aria-hidden": "true", className: "h-6 w-px shrink-0 bg-primary-200" }),
|
|
845
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
846
|
+
"input",
|
|
847
|
+
{
|
|
848
|
+
ref: inputRef,
|
|
849
|
+
type: "text",
|
|
850
|
+
value: searchValue,
|
|
851
|
+
onChange: (e) => onSearchChange(e.target.value),
|
|
852
|
+
onFocus: () => setFocused(true),
|
|
853
|
+
onBlur: () => {
|
|
854
|
+
window.setTimeout(() => setFocused(false), 120);
|
|
855
|
+
},
|
|
856
|
+
onKeyDown: (e) => {
|
|
857
|
+
if (e.key === "Enter") onSearch?.(searchValue);
|
|
858
|
+
},
|
|
859
|
+
placeholder: searchPlaceholder,
|
|
860
|
+
className: "h-full min-w-0 flex-1 border-0 bg-transparent pl-4 pr-3 text-sm text-foreground outline-none placeholder:text-muted-foreground"
|
|
861
|
+
}
|
|
862
|
+
),
|
|
863
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex shrink-0 items-center gap-3 pr-4", children: [
|
|
864
|
+
showClear && searchValue && /* @__PURE__ */ jsxRuntime.jsx(
|
|
793
865
|
"button",
|
|
794
866
|
{
|
|
795
867
|
type: "button",
|
|
868
|
+
"aria-label": "Limpiar",
|
|
796
869
|
onClick: () => {
|
|
797
|
-
|
|
798
|
-
|
|
870
|
+
onSearchChange("");
|
|
871
|
+
onClear?.();
|
|
872
|
+
inputRef.current?.focus();
|
|
799
873
|
},
|
|
800
|
-
className:
|
|
801
|
-
children:
|
|
874
|
+
className: "grid h-6 w-6 cursor-pointer place-items-center border-0 bg-transparent p-0 text-muted-foreground hover:text-foreground",
|
|
875
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { "aria-hidden": "true", className: "h-5 w-5" })
|
|
802
876
|
}
|
|
803
|
-
)
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
877
|
+
),
|
|
878
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
879
|
+
"button",
|
|
880
|
+
{
|
|
881
|
+
type: "button",
|
|
882
|
+
"aria-label": "Buscar",
|
|
883
|
+
onClick: () => onSearch?.(searchValue),
|
|
884
|
+
className: "grid h-6 w-6 cursor-pointer place-items-center border-0 bg-transparent p-0 text-primary hover:text-primary-600",
|
|
885
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { "aria-hidden": "true", className: "h-5 w-5" })
|
|
886
|
+
}
|
|
887
|
+
)
|
|
888
|
+
] })
|
|
889
|
+
]
|
|
890
|
+
}
|
|
891
|
+
) }),
|
|
892
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
893
|
+
chunk2KRMLIJQ_cjs.PopoverContent,
|
|
894
|
+
{
|
|
895
|
+
align: "start",
|
|
896
|
+
sideOffset: 6,
|
|
897
|
+
style: { width: categoryMenuWidth },
|
|
898
|
+
className: "p-1.5",
|
|
899
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
900
|
+
SearchCategoryMenu,
|
|
901
|
+
{
|
|
902
|
+
options,
|
|
903
|
+
isActive: isOptionActive,
|
|
904
|
+
onSelect: handleSelect,
|
|
905
|
+
multi: isMulti
|
|
906
|
+
}
|
|
907
|
+
)
|
|
908
|
+
}
|
|
909
|
+
)
|
|
910
|
+
] }),
|
|
911
|
+
showSuggestions && /* @__PURE__ */ jsxRuntime.jsx(
|
|
912
|
+
"div",
|
|
913
|
+
{
|
|
914
|
+
className: "absolute inset-x-0 top-full z-20 mt-1.5 overflow-hidden rounded-lg border border-border bg-popover shadow-md",
|
|
915
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
916
|
+
children: suggestions
|
|
917
|
+
}
|
|
918
|
+
)
|
|
919
|
+
] });
|
|
920
|
+
}
|
|
921
|
+
);
|
|
922
|
+
SearchFilterBar.displayName = "SearchFilterBar";
|
|
923
|
+
var SearchSuggestRow = ({
|
|
924
|
+
children,
|
|
925
|
+
className
|
|
926
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkA3A7PJWG_cjs.cn("border-b border-border px-[18px] py-3 text-sm last:border-0", className), children });
|
|
927
|
+
var SearchSuggestQuery = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(SearchSuggestRow, { className: "font-medium text-foreground", children });
|
|
928
|
+
var SearchSuggestHeader = ({
|
|
929
|
+
title,
|
|
930
|
+
action
|
|
931
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs(SearchSuggestRow, { className: "flex items-center justify-between font-semibold text-foreground", children: [
|
|
932
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: title }),
|
|
933
|
+
action && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cursor-pointer text-[13.5px] font-medium text-primary underline underline-offset-[3px]", children: action })
|
|
934
|
+
] });
|
|
935
|
+
var SearchSuggestItem = ({
|
|
936
|
+
active,
|
|
937
|
+
withLinkIcon,
|
|
938
|
+
onClick,
|
|
939
|
+
children,
|
|
940
|
+
className
|
|
941
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
942
|
+
"div",
|
|
943
|
+
{
|
|
944
|
+
role: "option",
|
|
945
|
+
"aria-selected": active,
|
|
946
|
+
onClick,
|
|
947
|
+
className: chunkA3A7PJWG_cjs.cn(
|
|
948
|
+
"flex cursor-pointer items-center gap-3 border-b border-border px-[18px] py-3 text-sm text-foreground transition-colors last:border-0 hover:bg-primary-50",
|
|
949
|
+
active && "bg-primary-50",
|
|
950
|
+
className
|
|
951
|
+
),
|
|
952
|
+
children: [
|
|
953
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children }),
|
|
954
|
+
withLinkIcon && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUpRight, { "aria-hidden": "true", className: "h-4 w-4 shrink-0 text-foreground" })
|
|
955
|
+
]
|
|
956
|
+
}
|
|
957
|
+
);
|
|
958
|
+
var SearchSuggestFooter = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-border px-[18px] py-3 text-xs text-muted-foreground", children });
|
|
959
|
+
var SearchSuggestEmpty = ({
|
|
960
|
+
title,
|
|
961
|
+
description
|
|
962
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-[18px] py-7 text-center", children: [
|
|
963
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold text-foreground", children: title }),
|
|
964
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mx-auto mt-1.5 max-w-[36ch] text-xs text-muted-foreground", children: description })
|
|
965
|
+
] });
|
|
831
966
|
var sidebarItemVariants = classVarianceAuthority.cva(
|
|
832
967
|
[
|
|
833
968
|
"group/sb-item relative flex items-center gap-2.5 text-[13px] cursor-pointer select-none outline-none",
|
|
@@ -1179,9 +1314,15 @@ exports.RangePicker = RangePicker;
|
|
|
1179
1314
|
exports.Result = Result;
|
|
1180
1315
|
exports.SearchBox = SearchBox;
|
|
1181
1316
|
exports.SearchFilterBar = SearchFilterBar;
|
|
1317
|
+
exports.SearchSuggestEmpty = SearchSuggestEmpty;
|
|
1318
|
+
exports.SearchSuggestFooter = SearchSuggestFooter;
|
|
1319
|
+
exports.SearchSuggestHeader = SearchSuggestHeader;
|
|
1320
|
+
exports.SearchSuggestItem = SearchSuggestItem;
|
|
1321
|
+
exports.SearchSuggestQuery = SearchSuggestQuery;
|
|
1322
|
+
exports.SearchSuggestRow = SearchSuggestRow;
|
|
1182
1323
|
exports.Sidebar = Sidebar;
|
|
1183
1324
|
exports.Toaster = Toaster;
|
|
1184
1325
|
exports.Tree = Tree;
|
|
1185
1326
|
exports.UserAvatar = UserAvatar;
|
|
1186
|
-
//# sourceMappingURL=chunk-
|
|
1187
|
-
//# sourceMappingURL=chunk-
|
|
1327
|
+
//# sourceMappingURL=chunk-NDHF6M7F.cjs.map
|
|
1328
|
+
//# sourceMappingURL=chunk-NDHF6M7F.cjs.map
|