@yenio-pld/blocks 1.2.0-rc.11 → 1.2.0-rc.13
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 +40 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +40 -10
- package/dist/index.js.map +1 -1
- package/dist/ui/dialog.d.ts +3 -1
- package/dist/ui/dialog.js +22 -4
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/select.js +14 -5
- package/dist/ui/select.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -21,11 +21,11 @@ var classVarianceAuthority = require('class-variance-authority');
|
|
|
21
21
|
var alertDialog_js = require('./ui/alert-dialog.js');
|
|
22
22
|
var nextThemes = require('next-themes');
|
|
23
23
|
var combobox_js = require('./ui/combobox.js');
|
|
24
|
+
var dialog_js = require('./ui/dialog.js');
|
|
24
25
|
var drawer_js = require('./ui/drawer.js');
|
|
25
26
|
var input_js = require('./ui/input.js');
|
|
26
27
|
var slider_js = require('./ui/slider.js');
|
|
27
28
|
var toggle_js = require('./ui/toggle.js');
|
|
28
|
-
var dialog_js = require('./ui/dialog.js');
|
|
29
29
|
var framerMotion = require('framer-motion');
|
|
30
30
|
var badge_js = require('./ui/badge.js');
|
|
31
31
|
|
|
@@ -3087,6 +3087,7 @@ function CountryPicker({
|
|
|
3087
3087
|
const labels = { ...defaultLabels2(purpose, locale), ...labelsProp };
|
|
3088
3088
|
const items = React3__namespace.useMemo(() => countryPickerItems(locale), [locale]);
|
|
3089
3089
|
const selected = React3__namespace.useMemo(() => findItem(items, value), [items, value]);
|
|
3090
|
+
const dialogPortalContainer = dialog_js.useDialogPortalContainer();
|
|
3090
3091
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3091
3092
|
name ? /* @__PURE__ */ jsxRuntime.jsx("input", { type: "hidden", name, value: value.trim().toUpperCase() }) : null,
|
|
3092
3093
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -3139,7 +3140,7 @@ function CountryPicker({
|
|
|
3139
3140
|
]
|
|
3140
3141
|
}
|
|
3141
3142
|
),
|
|
3142
|
-
/* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3143
|
+
/* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.Portal, { container: dialogPortalContainer ?? void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3143
3144
|
combobox_js.Combobox.Positioner,
|
|
3144
3145
|
{
|
|
3145
3146
|
className: "pointer-events-auto isolate z-[60] outline-none",
|
|
@@ -3235,9 +3236,12 @@ function SearchablePicker({
|
|
|
3235
3236
|
id,
|
|
3236
3237
|
className,
|
|
3237
3238
|
"aria-invalid": ariaInvalid,
|
|
3238
|
-
onOpenChange
|
|
3239
|
+
onOpenChange,
|
|
3240
|
+
onCreate,
|
|
3241
|
+
createLabel
|
|
3239
3242
|
}) {
|
|
3240
3243
|
const isMdUp = useMediaQuery(MD_UP);
|
|
3244
|
+
const dialogPortalContainer = dialog_js.useDialogPortalContainer();
|
|
3241
3245
|
const [open, setOpen] = React3__namespace.useState(false);
|
|
3242
3246
|
const searchRef = React3__namespace.useRef(null);
|
|
3243
3247
|
function setOpenState(next) {
|
|
@@ -3266,9 +3270,29 @@ function SearchablePicker({
|
|
|
3266
3270
|
onChange("");
|
|
3267
3271
|
onQueryChange("");
|
|
3268
3272
|
}
|
|
3273
|
+
const trimmedQuery = query.trim();
|
|
3274
|
+
const showCreate = Boolean(onCreate) && trimmedQuery !== "" && !loading;
|
|
3275
|
+
function handleCreate() {
|
|
3276
|
+
if (!onCreate || trimmedQuery === "") return;
|
|
3277
|
+
onCreate(trimmedQuery);
|
|
3278
|
+
setOpenState(false);
|
|
3279
|
+
}
|
|
3269
3280
|
const display = selectedLabel || selected?.label || "";
|
|
3270
3281
|
const sheetTitle = title || placeholder;
|
|
3271
3282
|
const searchLabel = searchPlaceholder || placeholder;
|
|
3283
|
+
const createActionLabel = createLabel ?? `Add "${trimmedQuery}"`;
|
|
3284
|
+
const createButton = showCreate ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3285
|
+
button_js.Button,
|
|
3286
|
+
{
|
|
3287
|
+
className: "w-full justify-start",
|
|
3288
|
+
disabled,
|
|
3289
|
+
size: "sm",
|
|
3290
|
+
type: "button",
|
|
3291
|
+
variant: "ghost",
|
|
3292
|
+
onClick: handleCreate,
|
|
3293
|
+
children: createActionLabel
|
|
3294
|
+
}
|
|
3295
|
+
) : null;
|
|
3272
3296
|
const loadMoreButton = hasMore && onLoadMore ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3273
3297
|
button_js.Button,
|
|
3274
3298
|
{
|
|
@@ -3345,7 +3369,7 @@ function SearchablePicker({
|
|
|
3345
3369
|
}
|
|
3346
3370
|
) : null
|
|
3347
3371
|
] }),
|
|
3348
|
-
/* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3372
|
+
/* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.Portal, { container: dialogPortalContainer ?? void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3349
3373
|
combobox_js.Combobox.Positioner,
|
|
3350
3374
|
{
|
|
3351
3375
|
className: "pointer-events-auto isolate z-[60] outline-none",
|
|
@@ -3390,7 +3414,10 @@ function SearchablePicker({
|
|
|
3390
3414
|
)
|
|
3391
3415
|
}
|
|
3392
3416
|
),
|
|
3393
|
-
loadMoreButton ? /* @__PURE__ */ jsxRuntime.
|
|
3417
|
+
createButton || loadMoreButton ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border p-1", children: [
|
|
3418
|
+
createButton,
|
|
3419
|
+
loadMoreButton
|
|
3420
|
+
] }) : null
|
|
3394
3421
|
] })
|
|
3395
3422
|
]
|
|
3396
3423
|
}
|
|
@@ -3477,8 +3504,9 @@ function SearchablePicker({
|
|
|
3477
3504
|
onChange: (event) => onQueryChange(event.target.value)
|
|
3478
3505
|
}
|
|
3479
3506
|
) }),
|
|
3480
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3481
|
-
|
|
3507
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-y-auto px-2 pb-4", children: loading ? /* @__PURE__ */ jsxRuntime.jsx(LoadingRows, {}) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3508
|
+
options.length === 0 && !showCreate ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-2 py-3 text-sm text-muted-foreground", children: emptyLabel }) : null,
|
|
3509
|
+
options.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "flex flex-col gap-1 p-1", children: options.map((option) => {
|
|
3482
3510
|
const isSelected = option.id === value;
|
|
3483
3511
|
return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3484
3512
|
"button",
|
|
@@ -3504,9 +3532,10 @@ function SearchablePicker({
|
|
|
3504
3532
|
]
|
|
3505
3533
|
}
|
|
3506
3534
|
) }, option.id);
|
|
3507
|
-
}) }),
|
|
3535
|
+
}) }) : null,
|
|
3536
|
+
createButton,
|
|
3508
3537
|
loadMoreButton
|
|
3509
|
-
] })
|
|
3538
|
+
] }) })
|
|
3510
3539
|
] }) })
|
|
3511
3540
|
] });
|
|
3512
3541
|
}
|
|
@@ -3547,6 +3576,7 @@ function PaginatedCombobox({
|
|
|
3547
3576
|
"aria-invalid": ariaInvalid
|
|
3548
3577
|
}) {
|
|
3549
3578
|
const labels = { ...DEFAULT_LABELS, ...labelsProp };
|
|
3579
|
+
const dialogPortalContainer = dialog_js.useDialogPortalContainer();
|
|
3550
3580
|
const selected = React3__namespace.useMemo(
|
|
3551
3581
|
() => resolveSelected(value, items, selectedItem),
|
|
3552
3582
|
[value, items, selectedItem]
|
|
@@ -3639,7 +3669,7 @@ function PaginatedCombobox({
|
|
|
3639
3669
|
]
|
|
3640
3670
|
}
|
|
3641
3671
|
),
|
|
3642
|
-
/* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3672
|
+
/* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.Portal, { container: dialogPortalContainer ?? void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3643
3673
|
combobox_js.Combobox.Positioner,
|
|
3644
3674
|
{
|
|
3645
3675
|
className: "pointer-events-auto isolate z-[60] outline-none",
|