@yenio-pld/blocks 1.2.0-rc.20 → 1.2.0-rc.22

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.cjs CHANGED
@@ -3704,7 +3704,9 @@ function SearchablePicker({
3704
3704
  "aria-invalid": ariaInvalid,
3705
3705
  onOpenChange,
3706
3706
  onCreate,
3707
- createLabel
3707
+ createLabel,
3708
+ actionLabel,
3709
+ onAction
3708
3710
  }) {
3709
3711
  const isMdUp = useMediaQuery(MD_UP2);
3710
3712
  const dialogPortalContainer = dialog_js.useDialogPortalContainer();
@@ -3759,6 +3761,21 @@ function SearchablePicker({
3759
3761
  children: createActionLabel
3760
3762
  }
3761
3763
  ) : null;
3764
+ const actionButton = actionLabel && onAction ? /* @__PURE__ */ jsxRuntime.jsx(
3765
+ button_js.Button,
3766
+ {
3767
+ className: "w-full justify-start",
3768
+ disabled,
3769
+ size: "sm",
3770
+ type: "button",
3771
+ variant: "ghost",
3772
+ onClick: () => {
3773
+ setOpenState(false);
3774
+ onAction();
3775
+ },
3776
+ children: actionLabel
3777
+ }
3778
+ ) : null;
3762
3779
  const loadMoreButton = hasMore && onLoadMore ? /* @__PURE__ */ jsxRuntime.jsx(
3763
3780
  button_js.Button,
3764
3781
  {
@@ -3771,6 +3788,16 @@ function SearchablePicker({
3771
3788
  children: loadMoreLabel
3772
3789
  }
3773
3790
  ) : null;
3791
+ function renderFooter(includeQueryActions) {
3792
+ const queryCreate = includeQueryActions ? createButton : null;
3793
+ const queryLoadMore = includeQueryActions ? loadMoreButton : null;
3794
+ if (!queryCreate && !actionButton && !queryLoadMore) return null;
3795
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border p-1", children: [
3796
+ queryCreate,
3797
+ actionButton,
3798
+ queryLoadMore
3799
+ ] });
3800
+ }
3774
3801
  if (isMdUp) {
3775
3802
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("relative w-full", className), children: /* @__PURE__ */ jsxRuntime.jsxs(
3776
3803
  combobox_js.Combobox.Root,
@@ -3857,8 +3884,8 @@ function SearchablePicker({
3857
3884
  }
3858
3885
  ) }),
3859
3886
  loading ? /* @__PURE__ */ jsxRuntime.jsx(LoadingRows, {}) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3860
- /* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.Empty, { className: "px-3 py-3 text-sm text-muted-foreground", children: emptyLabel }),
3861
- /* @__PURE__ */ jsxRuntime.jsx(
3887
+ /* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.Empty, { className: "text-sm text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block px-3 py-3", children: emptyLabel }) }),
3888
+ options.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
3862
3889
  combobox_js.Combobox.List,
3863
3890
  {
3864
3891
  className: "max-h-60 overflow-y-auto p-1 outline-none",
@@ -3868,23 +3895,20 @@ function SearchablePicker({
3868
3895
  {
3869
3896
  value: item,
3870
3897
  className: cn(
3871
- "relative flex cursor-default items-center gap-2 rounded-md py-2 pr-2 pl-8 text-sm outline-none select-none",
3898
+ "relative flex cursor-default items-center gap-2 rounded-md px-2 py-2 text-sm outline-none select-none",
3872
3899
  "data-highlighted:bg-accent data-highlighted:text-accent-foreground"
3873
3900
  ),
3874
3901
  children: [
3875
- /* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.ItemIndicator, { className: "absolute left-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-4", "aria-hidden": true }) }),
3876
- /* @__PURE__ */ jsxRuntime.jsx(OptionBody, { option: item })
3902
+ /* @__PURE__ */ jsxRuntime.jsx(OptionBody, { option: item }),
3903
+ /* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.ItemIndicator, { className: "flex size-4 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-4", "aria-hidden": true }) })
3877
3904
  ]
3878
3905
  },
3879
3906
  item.id
3880
3907
  )
3881
3908
  }
3882
- ),
3883
- createButton || loadMoreButton ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border p-1", children: [
3884
- createButton,
3885
- loadMoreButton
3886
- ] }) : null
3887
- ] })
3909
+ ) : null
3910
+ ] }),
3911
+ renderFooter(!loading)
3888
3912
  ]
3889
3913
  }
3890
3914
  )
@@ -4000,6 +4024,7 @@ function SearchablePicker({
4000
4024
  ) }, option.id);
4001
4025
  }) }) : null,
4002
4026
  createButton,
4027
+ actionButton,
4003
4028
  loadMoreButton
4004
4029
  ] }) })
4005
4030
  ] }) })
@@ -4152,8 +4177,8 @@ function PaginatedCombobox({
4152
4177
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2Icon, { className: "size-4 animate-spin", "aria-hidden": true }),
4153
4178
  labels.loading
4154
4179
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4155
- /* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.Empty, { className: "px-3 py-2 text-sm text-muted-foreground", children: labels.noResults }),
4156
- /* @__PURE__ */ jsxRuntime.jsx(
4180
+ /* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.Empty, { className: "text-sm text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block px-3 py-2", children: labels.noResults }) }),
4181
+ listItems.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
4157
4182
  combobox_js.Combobox.List,
4158
4183
  {
4159
4184
  className: "max-h-60 overflow-y-auto p-1 outline-none",
@@ -4163,19 +4188,21 @@ function PaginatedCombobox({
4163
4188
  {
4164
4189
  value: item,
4165
4190
  className: cn(
4166
- "relative flex cursor-default flex-col gap-0.5 rounded-md py-1.5 pr-2 pl-8 text-sm outline-none select-none",
4191
+ "relative flex cursor-default items-start gap-2 rounded-md px-2 py-1.5 text-sm outline-none select-none",
4167
4192
  "data-highlighted:bg-accent data-highlighted:text-accent-foreground"
4168
4193
  ),
4169
4194
  children: [
4170
- /* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.ItemIndicator, { className: "absolute top-2 left-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-4", "aria-hidden": true }) }),
4171
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: item.label }),
4172
- item.secondary ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: item.secondary }) : null
4195
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
4196
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: item.label }),
4197
+ item.secondary ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: item.secondary }) : null
4198
+ ] }),
4199
+ /* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.ItemIndicator, { className: "mt-0.5 flex size-4 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-4", "aria-hidden": true }) })
4173
4200
  ]
4174
4201
  },
4175
4202
  item.value
4176
4203
  )
4177
4204
  }
4178
- )
4205
+ ) : null
4179
4206
  ] }),
4180
4207
  nextCursor && onLoadMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t p-1", children: /* @__PURE__ */ jsxRuntime.jsxs(
4181
4208
  "button",