@homebound/beam 3.33.0 → 3.34.0
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 +211 -183
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.js +42 -14
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -8,7 +8,7 @@ import { VirtuosoHandle, ListRange } from 'react-virtuoso';
|
|
|
8
8
|
import { AriaButtonProps } from '@react-types/button';
|
|
9
9
|
import { MenuTriggerState } from 'react-stately';
|
|
10
10
|
import { FieldState, ListFieldState, ObjectState } from '@homebound/form-state';
|
|
11
|
-
import { NumberFieldAria } from '
|
|
11
|
+
import { NumberFieldAria } from 'react-aria';
|
|
12
12
|
|
|
13
13
|
/** Given a type X, and the user's proposed type T, only allow keys in X and nothing else. */
|
|
14
14
|
type Only<X, T> = X & Record<Exclude<keyof T, keyof X | "__kind">, never>;
|
|
@@ -4999,15 +4999,22 @@ type MenuSection = MenuItem & {
|
|
|
4999
4999
|
|
|
5000
5000
|
type TagXss = Margin | "backgroundColor" | "color";
|
|
5001
5001
|
type TagType = "info" | "caution" | "warning" | "success" | "neutral";
|
|
5002
|
-
type
|
|
5002
|
+
type TagPropsBase<X> = {
|
|
5003
5003
|
text: ReactNode;
|
|
5004
5004
|
type?: TagType;
|
|
5005
5005
|
xss?: X;
|
|
5006
|
-
icon?: IconKey;
|
|
5007
5006
|
/** A tooltip will automatically be displayed if the text is truncated. Set to true to prevent this behavior.
|
|
5008
5007
|
* @default false */
|
|
5009
5008
|
preventTooltip?: boolean;
|
|
5010
5009
|
};
|
|
5010
|
+
/** When `iconOnly`, `icon` is required — the tag renders only the icon; `text` stays for tooltip/a11y. */
|
|
5011
|
+
type TagProps<X> = TagPropsBase<X> & ({
|
|
5012
|
+
iconOnly?: false;
|
|
5013
|
+
icon?: IconKey;
|
|
5014
|
+
} | {
|
|
5015
|
+
iconOnly: true;
|
|
5016
|
+
icon: IconKey;
|
|
5017
|
+
});
|
|
5011
5018
|
/** Tag used for indicating a status */
|
|
5012
5019
|
declare function Tag<X extends Only<Xss<TagXss>, X>>(props: TagProps<X>): JSX.Element;
|
|
5013
5020
|
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { VirtuosoHandle, ListRange } from 'react-virtuoso';
|
|
|
8
8
|
import { AriaButtonProps } from '@react-types/button';
|
|
9
9
|
import { MenuTriggerState } from 'react-stately';
|
|
10
10
|
import { FieldState, ListFieldState, ObjectState } from '@homebound/form-state';
|
|
11
|
-
import { NumberFieldAria } from '
|
|
11
|
+
import { NumberFieldAria } from 'react-aria';
|
|
12
12
|
|
|
13
13
|
/** Given a type X, and the user's proposed type T, only allow keys in X and nothing else. */
|
|
14
14
|
type Only<X, T> = X & Record<Exclude<keyof T, keyof X | "__kind">, never>;
|
|
@@ -4999,15 +4999,22 @@ type MenuSection = MenuItem & {
|
|
|
4999
4999
|
|
|
5000
5000
|
type TagXss = Margin | "backgroundColor" | "color";
|
|
5001
5001
|
type TagType = "info" | "caution" | "warning" | "success" | "neutral";
|
|
5002
|
-
type
|
|
5002
|
+
type TagPropsBase<X> = {
|
|
5003
5003
|
text: ReactNode;
|
|
5004
5004
|
type?: TagType;
|
|
5005
5005
|
xss?: X;
|
|
5006
|
-
icon?: IconKey;
|
|
5007
5006
|
/** A tooltip will automatically be displayed if the text is truncated. Set to true to prevent this behavior.
|
|
5008
5007
|
* @default false */
|
|
5009
5008
|
preventTooltip?: boolean;
|
|
5010
5009
|
};
|
|
5010
|
+
/** When `iconOnly`, `icon` is required — the tag renders only the icon; `text` stays for tooltip/a11y. */
|
|
5011
|
+
type TagProps<X> = TagPropsBase<X> & ({
|
|
5012
|
+
iconOnly?: false;
|
|
5013
|
+
icon?: IconKey;
|
|
5014
|
+
} | {
|
|
5015
|
+
iconOnly: true;
|
|
5016
|
+
icon: IconKey;
|
|
5017
|
+
});
|
|
5011
5018
|
/** Tag used for indicating a status */
|
|
5012
5019
|
declare function Tag<X extends Only<Xss<TagXss>, X>>(props: TagProps<X>): JSX.Element;
|
|
5013
5020
|
|
package/dist/index.js
CHANGED
|
@@ -7720,8 +7720,8 @@ function MenuSectionImpl(props) {
|
|
|
7720
7720
|
}
|
|
7721
7721
|
|
|
7722
7722
|
// src/inputs/internal/MenuSearchField.tsx
|
|
7723
|
-
import { useTextField } from "@react-aria/textfield";
|
|
7724
7723
|
import { useRef as useRef11 } from "react";
|
|
7724
|
+
import { useTextField } from "react-aria";
|
|
7725
7725
|
|
|
7726
7726
|
// src/inputs/TextFieldBase.tsx
|
|
7727
7727
|
import { useState as useState11 } from "react";
|
|
@@ -21337,24 +21337,32 @@ function Tag(props) {
|
|
|
21337
21337
|
type,
|
|
21338
21338
|
xss,
|
|
21339
21339
|
preventTooltip = false,
|
|
21340
|
+
iconOnly,
|
|
21341
|
+
icon,
|
|
21340
21342
|
...otherProps
|
|
21341
21343
|
} = props;
|
|
21342
|
-
const
|
|
21344
|
+
const isIconOnly = !!iconOnly && !!icon;
|
|
21345
|
+
const {
|
|
21346
|
+
background,
|
|
21347
|
+
iconColor
|
|
21348
|
+
} = getStyles(type);
|
|
21343
21349
|
const tid = useTestIds(otherProps);
|
|
21344
21350
|
const [showTooltip, setShowTooltip] = useState49(false);
|
|
21345
21351
|
const ref = useRef52(null);
|
|
21346
21352
|
useResizeObserver6({
|
|
21347
21353
|
ref,
|
|
21348
21354
|
onResize: () => {
|
|
21349
|
-
if (ref.current) {
|
|
21355
|
+
if (!isIconOnly && ref.current) {
|
|
21350
21356
|
setShowTooltip(ref.current.offsetHeight < ref.current.scrollHeight);
|
|
21351
21357
|
}
|
|
21352
21358
|
}
|
|
21353
21359
|
});
|
|
21360
|
+
const tooltipTitle = !preventTooltip ? isIconOnly ? text : showTooltip ? text : void 0 : void 0;
|
|
21354
21361
|
return maybeTooltip({
|
|
21355
|
-
title:
|
|
21362
|
+
title: tooltipTitle,
|
|
21356
21363
|
children: /* @__PURE__ */ jsxs82("span", { ...tid, ...trussProps79({
|
|
21357
21364
|
...{
|
|
21365
|
+
position: "relative",
|
|
21358
21366
|
display: "dif",
|
|
21359
21367
|
fontWeight: "fw6",
|
|
21360
21368
|
fontSize: "fz_10px",
|
|
@@ -21362,18 +21370,23 @@ function Tag(props) {
|
|
|
21362
21370
|
textTransform: "ttu",
|
|
21363
21371
|
alignItems: "aic",
|
|
21364
21372
|
gap: "gap_4px",
|
|
21365
|
-
paddingLeft: "pl_6px",
|
|
21366
|
-
paddingRight: "pr_6px",
|
|
21367
21373
|
paddingTop: "pt_2px",
|
|
21368
21374
|
paddingBottom: "pb_2px",
|
|
21369
21375
|
color: "gray900",
|
|
21370
21376
|
borderRadius: "br4"
|
|
21371
21377
|
},
|
|
21372
|
-
...
|
|
21378
|
+
...isIconOnly ? {
|
|
21379
|
+
paddingLeft: "pl_2px",
|
|
21380
|
+
paddingRight: "pr_2px"
|
|
21381
|
+
} : {
|
|
21382
|
+
paddingLeft: "pl_6px",
|
|
21383
|
+
paddingRight: "pr_6px"
|
|
21384
|
+
},
|
|
21385
|
+
...background,
|
|
21373
21386
|
...xss
|
|
21374
21387
|
}), children: [
|
|
21375
|
-
|
|
21376
|
-
/* @__PURE__ */ jsx161("span", { ref, className: "oh d_negwebkit_box wbo_vertical to_ellipsis wlc_1 wbba", children: text })
|
|
21388
|
+
icon && /* @__PURE__ */ jsx161("span", { className: "fs0", children: /* @__PURE__ */ jsx161(Icon, { icon, inc: 1.75, color: iconColor }) }),
|
|
21389
|
+
isIconOnly ? /* @__PURE__ */ jsx161("span", { className: "absolute oh cli_inset_50 clp_none bd_0 h_1px m_neg1px w_1px p_0 wsnw o0", children: text }) : /* @__PURE__ */ jsx161("span", { ref, className: "oh d_negwebkit_box wbo_vertical to_ellipsis wlc_1 wbba", children: text })
|
|
21377
21390
|
] })
|
|
21378
21391
|
});
|
|
21379
21392
|
}
|
|
@@ -21381,23 +21394,38 @@ function getStyles(type) {
|
|
|
21381
21394
|
switch (type) {
|
|
21382
21395
|
case "info":
|
|
21383
21396
|
return {
|
|
21384
|
-
|
|
21397
|
+
background: {
|
|
21398
|
+
backgroundColor: "bgBlue100"
|
|
21399
|
+
},
|
|
21400
|
+
iconColor: "rgba(37, 99, 235, 1)" /* Blue600 */
|
|
21385
21401
|
};
|
|
21386
21402
|
case "caution":
|
|
21387
21403
|
return {
|
|
21388
|
-
|
|
21404
|
+
background: {
|
|
21405
|
+
backgroundColor: "bgYellow200"
|
|
21406
|
+
},
|
|
21407
|
+
iconColor: "rgba(161, 98, 7, 1)" /* Yellow700 */
|
|
21389
21408
|
};
|
|
21390
21409
|
case "warning":
|
|
21391
21410
|
return {
|
|
21392
|
-
|
|
21411
|
+
background: {
|
|
21412
|
+
backgroundColor: "bgRed200"
|
|
21413
|
+
},
|
|
21414
|
+
iconColor: "rgba(194, 65, 12, 1)" /* Orange700 */
|
|
21393
21415
|
};
|
|
21394
21416
|
case "success":
|
|
21395
21417
|
return {
|
|
21396
|
-
|
|
21418
|
+
background: {
|
|
21419
|
+
backgroundColor: "bgGreen200"
|
|
21420
|
+
},
|
|
21421
|
+
iconColor: "rgba(5, 150, 105, 1)" /* Green600 */
|
|
21397
21422
|
};
|
|
21398
21423
|
default:
|
|
21399
21424
|
return {
|
|
21400
|
-
|
|
21425
|
+
background: {
|
|
21426
|
+
backgroundColor: "bgGray200"
|
|
21427
|
+
},
|
|
21428
|
+
iconColor: "rgba(100, 100, 100, 1)" /* Gray700 */
|
|
21401
21429
|
};
|
|
21402
21430
|
}
|
|
21403
21431
|
}
|