@algorithm-shift/design-system 1.3.111 → 1.3.112

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
@@ -630,7 +630,7 @@ var Typography = ({
630
630
  Tag,
631
631
  {
632
632
  style,
633
- className: cn(className, "pointer-events-auto"),
633
+ className: cn(className, "pointer-events-auto", onClick ? "cursor-pointer" : ""),
634
634
  onClick
635
635
  },
636
636
  [
@@ -2141,6 +2141,17 @@ function useLazyDropdown(config) {
2141
2141
  let pageOptions = [];
2142
2142
  if (cfg.dataSource === "api") {
2143
2143
  pageOptions = await fetchApiData(pageNum, term);
2144
+ if (pageNum > 1 && pageOptions.length === 0) {
2145
+ const firstPageOptions = await fetchApiData(1, term);
2146
+ setOptions((prev) => {
2147
+ const merged = uniqueOptions([...firstPageOptions]);
2148
+ return merged;
2149
+ });
2150
+ setPage(1);
2151
+ setHasMore(false);
2152
+ setLoading(false);
2153
+ return;
2154
+ }
2144
2155
  setHasMore(pageOptions.length === PAGE_SIZE);
2145
2156
  } else {
2146
2157
  const allData = allDataRef.current || [];
@@ -2169,7 +2180,7 @@ function useLazyDropdown(config) {
2169
2180
  } finally {
2170
2181
  setLoading(false);
2171
2182
  }
2172
- }, [fetchApiData, transformToOptions]);
2183
+ }, [fetchApiData, transformToOptions, PAGE_SIZE]);
2173
2184
  const fetchValueItem = async () => {
2174
2185
  if (!configRef.current.apiUrl) return [];
2175
2186
  try {
@@ -3008,6 +3019,7 @@ function DateTimePicker({
3008
3019
  mode = "date",
3009
3020
  ...props
3010
3021
  }) {
3022
+ const [open, setOpen] = React8.useState(false);
3011
3023
  const placeholderMap = {
3012
3024
  date: "Select date",
3013
3025
  datetime: "Select date & time",
@@ -3108,9 +3120,11 @@ function DateTimePicker({
3108
3120
  if (!next) {
3109
3121
  setDate(void 0);
3110
3122
  emitChange(void 0);
3123
+ setOpen(false);
3111
3124
  return;
3112
3125
  }
3113
3126
  const clickedDate = new Date(next);
3127
+ setOpen(false);
3114
3128
  updateDateTime(clickedDate);
3115
3129
  };
3116
3130
  const updateTimeInDate = (h, m) => {
@@ -3180,9 +3194,10 @@ function DateTimePicker({
3180
3194
  const today = /* @__PURE__ */ new Date();
3181
3195
  const selectedYearDate = new Date(year, today.getMonth(), today.getDate());
3182
3196
  updateDateTime(selectedYearDate);
3197
+ setOpen(false);
3183
3198
  };
3184
3199
  return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-col", children: [
3185
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Popover, { children: [
3200
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Popover, { open, onOpenChange: setOpen, children: [
3186
3201
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
3187
3202
  Button,
3188
3203
  {
@@ -3212,6 +3227,7 @@ function DateTimePicker({
3212
3227
  e.stopPropagation();
3213
3228
  setDate(void 0);
3214
3229
  emitChange(void 0);
3230
+ setOpen(false);
3215
3231
  }
3216
3232
  }
3217
3233
  )