@estiva-app/ui 0.12.8 → 0.12.9
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/ChipInput.d.ts +8 -0
- package/dist/ChipInput.d.ts.map +1 -1
- package/dist/index.js +11 -4
- package/dist/index.js.map +3 -3
- package/package.json +2 -1
- package/src/ChipInput.mdx +9 -0
- package/src/ChipInput.stories.tsx +0 -4
- package/src/ChipInput.test.tsx +78 -2
- package/src/ChipInput.tsx +31 -2
package/dist/ChipInput.d.ts
CHANGED
|
@@ -68,6 +68,14 @@ export interface ChipInputProps<T extends ChipInputOption = ChipInputOption> {
|
|
|
68
68
|
rowLeading?: (option: T) => ReactNode;
|
|
69
69
|
/** Set by a `Field` with `required`; a caller inside one owes nothing. */
|
|
70
70
|
'aria-required'?: boolean | 'true' | 'false';
|
|
71
|
+
/**
|
|
72
|
+
* The field's name, for a caller that is not inside a `Field` — a `Field`'s
|
|
73
|
+
* label names it already. With neither this nor `aria-labelledby`, the
|
|
74
|
+
* placeholder is the name, and it stays the name once a chip is in.
|
|
75
|
+
*/
|
|
76
|
+
'aria-label'?: string;
|
|
77
|
+
/** The id of what names the field on the page — a visible "To:", say. */
|
|
78
|
+
'aria-labelledby'?: string;
|
|
71
79
|
}
|
|
72
80
|
export declare function ChipInput<T extends ChipInputOption = ChipInputOption>({ value, onChange, options, placeholder, autoFocus, excludeIds, chipLeading, rowLeading, ...aria }: ChipInputProps<T>): import("react").JSX.Element;
|
|
73
81
|
//# sourceMappingURL=ChipInput.d.ts.map
|
package/dist/ChipInput.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChipInput.d.ts","sourceRoot":"","sources":["../src/ChipInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"ChipInput.d.ts","sourceRoot":"","sources":["../src/ChipInput.tsx"],"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zE,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,EAAE,EACrE,KAAK,EACL,QAAQ,EACR,OAAO,EACP,WAAuB,EACvB,SAAS,EACT,UAAe,EACf,WAAW,EACX,UAAU,EACV,GAAG,IAAI,EACR,EAAE,cAAc,CAAC,CAAC,CAAC,+BAkJnB"}
|
package/dist/index.js
CHANGED
|
@@ -487,6 +487,7 @@ function Chip({ type = "neutral", label, leadingIcon, trailingIcon, className })
|
|
|
487
487
|
|
|
488
488
|
// src/ChipInput.tsx
|
|
489
489
|
import { useMemo, useState as useState2 } from "react";
|
|
490
|
+
import { Button as BaseButton3 } from "@base-ui/react/button";
|
|
490
491
|
import { Combobox } from "@base-ui/react/combobox";
|
|
491
492
|
import { IconX as IconX2 } from "@tabler/icons-react";
|
|
492
493
|
|
|
@@ -743,7 +744,7 @@ function InputChip({ label, leading, onRemove, className }) {
|
|
|
743
744
|
leading && /* @__PURE__ */ jsx15("span", { className: "flex shrink-0 items-center", children: leading }),
|
|
744
745
|
/* @__PURE__ */ jsx15("span", { className: CHIP_LABEL, children: label }),
|
|
745
746
|
onRemove && /* @__PURE__ */ jsx15(
|
|
746
|
-
|
|
747
|
+
BaseButton3,
|
|
747
748
|
{
|
|
748
749
|
type: "button",
|
|
749
750
|
onClick: (e) => {
|
|
@@ -784,6 +785,11 @@ function ChipInput({
|
|
|
784
785
|
[]
|
|
785
786
|
);
|
|
786
787
|
const open = query.trim().length > 0;
|
|
788
|
+
const ariaLabel = aria["aria-label"] ?? (value.length > 0 ? placeholder : void 0);
|
|
789
|
+
const naming = {
|
|
790
|
+
...ariaLabel !== void 0 && { "aria-label": ariaLabel },
|
|
791
|
+
...aria["aria-labelledby"] !== void 0 && { "aria-labelledby": aria["aria-labelledby"] }
|
|
792
|
+
};
|
|
787
793
|
function removeLast() {
|
|
788
794
|
if (value.length > 0) onChange(value.slice(0, -1));
|
|
789
795
|
}
|
|
@@ -829,6 +835,7 @@ function ChipInput({
|
|
|
829
835
|
autoFocus,
|
|
830
836
|
placeholder: value.length === 0 ? placeholder : "",
|
|
831
837
|
"aria-required": aria["aria-required"],
|
|
838
|
+
...naming,
|
|
832
839
|
onKeyDown: onInputKeyDown,
|
|
833
840
|
className: "flex-1 min-w-[120px] bg-transparent text-body-2 text-text-primary placeholder:text-text-muted outline-none border-none"
|
|
834
841
|
}
|
|
@@ -914,13 +921,13 @@ function Person({ name, picture, fallback = "\u2014", size = 20, className }) {
|
|
|
914
921
|
}
|
|
915
922
|
|
|
916
923
|
// src/PersonTrigger.tsx
|
|
917
|
-
import { Button as
|
|
924
|
+
import { Button as BaseButton4 } from "@base-ui/react/button";
|
|
918
925
|
import { IconChevronDown } from "@tabler/icons-react";
|
|
919
926
|
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
920
927
|
function PersonTrigger({ name, picture, fallback, size, open = false, compact = false, className, ...props }) {
|
|
921
928
|
if (compact) {
|
|
922
929
|
return /* @__PURE__ */ jsx18(
|
|
923
|
-
|
|
930
|
+
BaseButton4,
|
|
924
931
|
{
|
|
925
932
|
type: "button",
|
|
926
933
|
"aria-haspopup": "menu",
|
|
@@ -933,7 +940,7 @@ function PersonTrigger({ name, picture, fallback, size, open = false, compact =
|
|
|
933
940
|
);
|
|
934
941
|
}
|
|
935
942
|
return /* @__PURE__ */ jsxs12(
|
|
936
|
-
|
|
943
|
+
BaseButton4,
|
|
937
944
|
{
|
|
938
945
|
type: "button",
|
|
939
946
|
"aria-haspopup": "menu",
|