@yenio-pld/blocks 1.2.0-rc.28 → 1.2.0-rc.29
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 +134 -128
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -30
- package/dist/index.js.map +1 -1
- package/dist/ui/button.d.ts +1 -1
- package/dist/ui/button.js +2 -0
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/card.js +1 -0
- package/dist/ui/card.js.map +1 -1
- package/dist/ui/table.js +2 -2
- package/dist/ui/table.js.map +1 -1
- package/package.json +1 -1
- package/src/theme.css +51 -7
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import * as
|
|
2
|
+
import * as React7 from 'react';
|
|
3
3
|
import { createContext, useContext, cloneElement, useRef, useEffect, useState, useId, useCallback, useLayoutEffect } from 'react';
|
|
4
4
|
import { Skeleton } from './ui/skeleton.js';
|
|
5
5
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
@@ -236,6 +236,12 @@ function ErrorState({
|
|
|
236
236
|
}
|
|
237
237
|
);
|
|
238
238
|
}
|
|
239
|
+
function withEmptyStateCta(action) {
|
|
240
|
+
if (!React7.isValidElement(action)) return action;
|
|
241
|
+
if (typeof action.type === "string") return action;
|
|
242
|
+
if (action.props.size != null) return action;
|
|
243
|
+
return React7.cloneElement(action, { size: "cta" });
|
|
244
|
+
}
|
|
239
245
|
function EmptyState({
|
|
240
246
|
title,
|
|
241
247
|
description,
|
|
@@ -286,7 +292,7 @@ function EmptyState({
|
|
|
286
292
|
),
|
|
287
293
|
description ? /* @__PURE__ */ jsx(EmptyDescription, { className: "mt-0 max-w-sm", children: description }) : null
|
|
288
294
|
] }),
|
|
289
|
-
action ? /* @__PURE__ */ jsx(EmptyContent, { className: "mt-1 gap-0", children: action }) : null
|
|
295
|
+
action ? /* @__PURE__ */ jsx(EmptyContent, { className: "mt-1 gap-0", children: withEmptyStateCta(action) }) : null
|
|
290
296
|
]
|
|
291
297
|
}
|
|
292
298
|
);
|
|
@@ -3124,8 +3130,8 @@ function CountryPicker({
|
|
|
3124
3130
|
"aria-invalid": ariaInvalid
|
|
3125
3131
|
}) {
|
|
3126
3132
|
const labels = { ...defaultLabels2(purpose, locale), ...labelsProp };
|
|
3127
|
-
const items =
|
|
3128
|
-
const selected =
|
|
3133
|
+
const items = React7.useMemo(() => countryPickerItems(locale), [locale]);
|
|
3134
|
+
const selected = React7.useMemo(() => findItem(items, value), [items, value]);
|
|
3129
3135
|
const dialogPortalContainer = useDialogPortalContainer();
|
|
3130
3136
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3131
3137
|
name ? /* @__PURE__ */ jsx("input", { type: "hidden", name, value: value.trim().toUpperCase() }) : null,
|
|
@@ -3426,14 +3432,14 @@ function TaxRegimePicker({
|
|
|
3426
3432
|
"aria-invalid": ariaInvalid
|
|
3427
3433
|
}) {
|
|
3428
3434
|
const labels = { ...defaultLabels3(locale), ...labelsProp };
|
|
3429
|
-
const items =
|
|
3430
|
-
const selected =
|
|
3435
|
+
const items = React7.useMemo(() => taxRegimePickerItems(locale), [locale]);
|
|
3436
|
+
const selected = React7.useMemo(() => findItem2(items, value), [items, value]);
|
|
3431
3437
|
const dialogPortalContainer = useDialogPortalContainer();
|
|
3432
3438
|
const isMdUp = useMediaQuery(MD_UP);
|
|
3433
|
-
const [open, setOpen] =
|
|
3434
|
-
const [query, setQuery] =
|
|
3435
|
-
const searchRef =
|
|
3436
|
-
const filtered =
|
|
3439
|
+
const [open, setOpen] = React7.useState(false);
|
|
3440
|
+
const [query, setQuery] = React7.useState("");
|
|
3441
|
+
const searchRef = React7.useRef(null);
|
|
3442
|
+
const filtered = React7.useMemo(
|
|
3437
3443
|
() => filterTaxRegimes(query, locale),
|
|
3438
3444
|
[locale, query]
|
|
3439
3445
|
);
|
|
@@ -3449,7 +3455,7 @@ function TaxRegimePicker({
|
|
|
3449
3455
|
onValueChange("");
|
|
3450
3456
|
setQuery("");
|
|
3451
3457
|
}
|
|
3452
|
-
|
|
3458
|
+
React7.useEffect(() => {
|
|
3453
3459
|
if (!open || isMdUp) return;
|
|
3454
3460
|
const handle = window.setTimeout(() => searchRef.current?.focus(), 0);
|
|
3455
3461
|
return () => window.clearTimeout(handle);
|
|
@@ -3710,21 +3716,21 @@ function SearchablePicker({
|
|
|
3710
3716
|
}) {
|
|
3711
3717
|
const isMdUp = useMediaQuery(MD_UP2);
|
|
3712
3718
|
const dialogPortalContainer = useDialogPortalContainer();
|
|
3713
|
-
const [open, setOpen] =
|
|
3714
|
-
const searchRef =
|
|
3719
|
+
const [open, setOpen] = React7.useState(false);
|
|
3720
|
+
const searchRef = React7.useRef(null);
|
|
3715
3721
|
function setOpenState(next) {
|
|
3716
3722
|
setOpen(next);
|
|
3717
3723
|
onOpenChange?.(next);
|
|
3718
3724
|
if (!next) onQueryChange("");
|
|
3719
3725
|
}
|
|
3720
|
-
const selected =
|
|
3726
|
+
const selected = React7.useMemo(() => {
|
|
3721
3727
|
if (!value) return null;
|
|
3722
3728
|
return options.find((option) => option.id === value) ?? {
|
|
3723
3729
|
id: value,
|
|
3724
3730
|
label: selectedLabel || value
|
|
3725
3731
|
};
|
|
3726
3732
|
}, [options, selectedLabel, value]);
|
|
3727
|
-
|
|
3733
|
+
React7.useEffect(() => {
|
|
3728
3734
|
if (!open || isMdUp) return;
|
|
3729
3735
|
const handle = window.setTimeout(() => searchRef.current?.focus(), 0);
|
|
3730
3736
|
return () => window.clearTimeout(handle);
|
|
@@ -4068,18 +4074,18 @@ function PaginatedCombobox({
|
|
|
4068
4074
|
}) {
|
|
4069
4075
|
const labels = { ...DEFAULT_LABELS, ...labelsProp };
|
|
4070
4076
|
const dialogPortalContainer = useDialogPortalContainer();
|
|
4071
|
-
const selected =
|
|
4077
|
+
const selected = React7.useMemo(
|
|
4072
4078
|
() => resolveSelected(value, items, selectedItem),
|
|
4073
4079
|
[value, items, selectedItem]
|
|
4074
4080
|
);
|
|
4075
|
-
const listItems =
|
|
4081
|
+
const listItems = React7.useMemo(() => {
|
|
4076
4082
|
if (!selected) return items;
|
|
4077
4083
|
if (items.some((item) => item.value === selected.value)) return items;
|
|
4078
4084
|
return [selected, ...items];
|
|
4079
4085
|
}, [items, selected]);
|
|
4080
|
-
const queryRef =
|
|
4081
|
-
const debounceRef =
|
|
4082
|
-
|
|
4086
|
+
const queryRef = React7.useRef("");
|
|
4087
|
+
const debounceRef = React7.useRef(null);
|
|
4088
|
+
React7.useEffect(() => {
|
|
4083
4089
|
return () => {
|
|
4084
4090
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
4085
4091
|
};
|
|
@@ -4354,7 +4360,7 @@ function PasswordInput({
|
|
|
4354
4360
|
hideLabel = "Hide password",
|
|
4355
4361
|
...props
|
|
4356
4362
|
}) {
|
|
4357
|
-
const [visible, setVisible] =
|
|
4363
|
+
const [visible, setVisible] = React7.useState(false);
|
|
4358
4364
|
return /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
4359
4365
|
/* @__PURE__ */ jsx(
|
|
4360
4366
|
Input,
|
|
@@ -4477,32 +4483,32 @@ function PhoneInput({
|
|
|
4477
4483
|
...props
|
|
4478
4484
|
}) {
|
|
4479
4485
|
const resolvedDefault = resolveCountry(defaultCountry, "MX");
|
|
4480
|
-
const [country, setCountry] =
|
|
4486
|
+
const [country, setCountry] = React7.useState(
|
|
4481
4487
|
() => parseIncoming(value, resolvedDefault).country
|
|
4482
4488
|
);
|
|
4483
|
-
const [national, setNational] =
|
|
4489
|
+
const [national, setNational] = React7.useState(
|
|
4484
4490
|
() => parseIncoming(value, resolvedDefault).national
|
|
4485
4491
|
);
|
|
4486
|
-
const [open, setOpen] =
|
|
4487
|
-
const [query, setQuery] =
|
|
4488
|
-
const lastEmittedRef =
|
|
4492
|
+
const [open, setOpen] = React7.useState(false);
|
|
4493
|
+
const [query, setQuery] = React7.useState("");
|
|
4494
|
+
const lastEmittedRef = React7.useRef(value);
|
|
4489
4495
|
const isMdUp = useMediaQuery(MD_UP3);
|
|
4490
4496
|
const dialogPortalContainer = useDialogPortalContainer();
|
|
4491
|
-
const searchRef =
|
|
4492
|
-
|
|
4497
|
+
const searchRef = React7.useRef(null);
|
|
4498
|
+
React7.useEffect(() => {
|
|
4493
4499
|
if (value === lastEmittedRef.current) return;
|
|
4494
4500
|
lastEmittedRef.current = value;
|
|
4495
4501
|
const next = parseIncoming(value, resolvedDefault);
|
|
4496
4502
|
setCountry(next.country);
|
|
4497
4503
|
setNational(next.national);
|
|
4498
4504
|
}, [value, resolvedDefault]);
|
|
4499
|
-
|
|
4505
|
+
React7.useEffect(() => {
|
|
4500
4506
|
if (!open || isMdUp) return;
|
|
4501
4507
|
const handle = window.setTimeout(() => searchRef.current?.focus(), 0);
|
|
4502
4508
|
return () => window.clearTimeout(handle);
|
|
4503
4509
|
}, [isMdUp, open]);
|
|
4504
4510
|
const selected = COUNTRY_OPTIONS2.find((option) => option.id === country) ?? COUNTRY_OPTIONS2.find((option) => option.id === resolvedDefault);
|
|
4505
|
-
const filtered =
|
|
4511
|
+
const filtered = React7.useMemo(
|
|
4506
4512
|
() => filterCountries2(COUNTRY_OPTIONS2, query),
|
|
4507
4513
|
[query]
|
|
4508
4514
|
);
|