@rocket.chat/fuselage 0.95.0 → 0.96.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.
Files changed (52) hide show
  1. package/dist/Theme.d.ts.map +1 -1
  2. package/dist/components/Item/Item.d.ts +32 -0
  3. package/dist/components/Item/Item.d.ts.map +1 -0
  4. package/dist/components/Item/ItemActions.d.ts +16 -0
  5. package/dist/components/Item/ItemActions.d.ts.map +1 -0
  6. package/dist/components/Item/ItemContent.d.ts +10 -0
  7. package/dist/components/Item/ItemContent.d.ts.map +1 -0
  8. package/dist/components/Item/ItemContext.d.ts +7 -0
  9. package/dist/components/Item/ItemContext.d.ts.map +1 -0
  10. package/dist/components/Item/ItemDescription.d.ts +15 -0
  11. package/dist/components/Item/ItemDescription.d.ts.map +1 -0
  12. package/dist/components/Item/ItemDivider.d.ts +19 -0
  13. package/dist/components/Item/ItemDivider.d.ts.map +1 -0
  14. package/dist/components/Item/ItemGroup.d.ts +13 -0
  15. package/dist/components/Item/ItemGroup.d.ts.map +1 -0
  16. package/dist/components/Item/ItemGroupContext.d.ts +6 -0
  17. package/dist/components/Item/ItemGroupContext.d.ts.map +1 -0
  18. package/dist/components/Item/ItemGroupHeader.d.ts +24 -0
  19. package/dist/components/Item/ItemGroupHeader.d.ts.map +1 -0
  20. package/dist/components/Item/ItemGroupTitle.d.ts +13 -0
  21. package/dist/components/Item/ItemGroupTitle.d.ts.map +1 -0
  22. package/dist/components/Item/ItemIcon.d.ts +15 -0
  23. package/dist/components/Item/ItemIcon.d.ts.map +1 -0
  24. package/dist/components/Item/ItemLink.d.ts +15 -0
  25. package/dist/components/Item/ItemLink.d.ts.map +1 -0
  26. package/dist/components/Item/ItemMedia.d.ts +14 -0
  27. package/dist/components/Item/ItemMedia.d.ts.map +1 -0
  28. package/dist/components/Item/ItemMeta.d.ts +10 -0
  29. package/dist/components/Item/ItemMeta.d.ts.map +1 -0
  30. package/dist/components/Item/ItemRow.d.ts +10 -0
  31. package/dist/components/Item/ItemRow.d.ts.map +1 -0
  32. package/dist/components/Item/ItemSkeleton.d.ts +18 -0
  33. package/dist/components/Item/ItemSkeleton.d.ts.map +1 -0
  34. package/dist/components/Item/ItemTitle.d.ts +10 -0
  35. package/dist/components/Item/ItemTitle.d.ts.map +1 -0
  36. package/dist/components/Item/index.d.ts +17 -0
  37. package/dist/components/Item/index.d.ts.map +1 -0
  38. package/dist/components/Item/types.d.ts +2 -0
  39. package/dist/components/Item/types.d.ts.map +1 -0
  40. package/dist/components/Item/useIdRegistry.d.ts +6 -0
  41. package/dist/components/Item/useIdRegistry.d.ts.map +1 -0
  42. package/dist/components/PaletteStyleTag/helpers/getPalette.d.ts +4 -4
  43. package/dist/components/Tag/Tag.d.ts +5 -1
  44. package/dist/components/Tag/Tag.d.ts.map +1 -1
  45. package/dist/components/index.d.ts +1 -0
  46. package/dist/components/index.d.ts.map +1 -1
  47. package/dist/fuselage.css +1 -1
  48. package/dist/fuselage.development.css +367 -20
  49. package/dist/fuselage.development.js +277 -3
  50. package/dist/fuselage.development.js.map +1 -1
  51. package/dist/fuselage.production.js +52 -52
  52. package/package.json +3 -3
@@ -310,7 +310,6 @@ if (process.env.NODE_ENV !== "production") (function() {
310
310
  800: new Var("neutral-800", _rocket_chat_fuselage_tokens_dist_colors_json.default.n800),
311
311
  900: new Var("neutral-900", _rocket_chat_fuselage_tokens_dist_colors_json.default.n900)
312
312
  };
313
- var primitive = (ref, name) => new Var(name, _rocket_chat_fuselage_tokens_dist_colors_json.default[ref]);
314
313
  var surfaceTokens = _rocket_chat_fuselage_tokens_dist_surface_json.default.light;
315
314
  var surfaceColors = {
316
315
  "surface-light": new Var("surface-light", surfaceTokens.light),
@@ -366,7 +365,7 @@ if (process.env.NODE_ENV !== "production") (function() {
366
365
  var statusColors = {
367
366
  "status-font-on-info": new Var("status-font-on-info", statusTokens["font-on-info"]),
368
367
  "status-font-on-success": new Var("status-font-on-success", statusTokens["font-on-success"]),
369
- "status-font-on-warning": primitive("y800", "status-font-on-warning"),
368
+ "status-font-on-warning": new Var("status-font-on-warning", statusTokens["font-on-warning"]),
370
369
  "status-font-on-warning-2": new Var("status-font-on-warning-2", statusTokens["font-on-warning-2"]),
371
370
  "status-font-on-danger": new Var("status-font-on-danger", statusTokens["font-on-danger"]),
372
371
  "status-font-on-service-1": new Var("status-font-on-service-1", statusTokens["font-on-service-1"]),
@@ -3259,6 +3258,265 @@ if (process.env.NODE_ENV !== "production") (function() {
3259
3258
  size: 20
3260
3259
  });
3261
3260
  //#endregion
3261
+ //#region src/components/Item/ItemContext.ts
3262
+ var ItemContext = (0, react.createContext)({
3263
+ descriptionIds: [],
3264
+ registerDescription: () => () => void 0
3265
+ });
3266
+ var useItemContext = () => (0, react.useContext)(ItemContext);
3267
+ //#endregion
3268
+ //#region src/components/Item/useIdRegistry.ts
3269
+ /**
3270
+ * Collects the ids that descendants announce, so a parent can reference them
3271
+ * in ARIA relationships without the consumer wiring ids by hand.
3272
+ */
3273
+ var useIdRegistry = () => {
3274
+ const [ids, setIds] = (0, react.useState)([]);
3275
+ return [ids, (0, react.useCallback)((id) => {
3276
+ setIds((prev) => prev.includes(id) ? prev : [...prev, id]);
3277
+ return () => {
3278
+ setIds((prev) => prev.filter((value) => value !== id));
3279
+ };
3280
+ }, [])];
3281
+ };
3282
+ //#endregion
3283
+ //#region src/components/Item/Item.tsx
3284
+ /**
3285
+ * A list row composed from slots: media, icon, content and actions.
3286
+ */
3287
+ var Item = ({ is: Tag = "div", inset = "none", selected, highlighted, focused, disabled, variant, className, onClick, children, ...props }) => {
3288
+ const [descriptionIds, registerDescription] = useIdRegistry();
3289
+ const contextValue = (0, react.useMemo)(() => ({
3290
+ descriptionIds,
3291
+ registerDescription
3292
+ }), [descriptionIds, registerDescription]);
3293
+ const handleClick = onClick ? (event) => {
3294
+ if (disabled) return;
3295
+ onClick(event);
3296
+ } : void 0;
3297
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ItemContext.Provider, {
3298
+ value: contextValue,
3299
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
3300
+ ...props,
3301
+ className: cx(cxx("rcx-item")({
3302
+ [`inset-${inset}`]: inset !== "none",
3303
+ clickable: !!onClick,
3304
+ selected: !!selected,
3305
+ highlighted: !!highlighted,
3306
+ focused: !!focused,
3307
+ disabled: !!disabled,
3308
+ danger: variant === "danger"
3309
+ }), className),
3310
+ onClick: handleClick,
3311
+ children
3312
+ })
3313
+ });
3314
+ };
3315
+ //#endregion
3316
+ //#region src/components/Item/ItemActions.tsx
3317
+ /**
3318
+ * The trailing buttons, icon buttons or menu trigger of an `Item` or `ItemGroupHeader`.
3319
+ * Placed as a direct child it spans every row; placed inside an `ItemRow` it only takes space from that row.
3320
+ */
3321
+ var ItemActions = ({ is: Tag = "div", reveal = "always", className, children, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
3322
+ ...props,
3323
+ className: cx(cxx("rcx-item__actions")({ "reveal-hover": reveal === "hover" }), className),
3324
+ children: reveal === "hover" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3325
+ className: "rcx-item__actions-inner",
3326
+ children
3327
+ }) : children
3328
+ });
3329
+ //#endregion
3330
+ //#region src/components/Item/ItemContent.tsx
3331
+ /**
3332
+ * The flexible, truncating column that holds the title and description, or one `ItemRow` per line.
3333
+ */
3334
+ var ItemContent = ({ is: Tag = "div", className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
3335
+ ...props,
3336
+ className: cx("rcx-item__content", className)
3337
+ });
3338
+ //#endregion
3339
+ //#region src/components/Item/ItemDescription.tsx
3340
+ /**
3341
+ * The secondary line of an `Item`, such as a last message preview or a username.
3342
+ */
3343
+ var ItemDescription = ({ is, inline, className, ...props }) => {
3344
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(is ?? (inline ? "span" : "div"), {
3345
+ ...props,
3346
+ className: cx(cxx("rcx-item__description")({ inline: !!inline }), className)
3347
+ });
3348
+ };
3349
+ //#endregion
3350
+ //#region src/components/Item/ItemDivider.tsx
3351
+ /**
3352
+ * The divider between groups, menu sections, or a header and its rows.
3353
+ */
3354
+ var ItemDivider = ({ is: Tag = "div", inset = "none", className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
3355
+ ...props,
3356
+ className: cx(cxx("rcx-item-divider")({ [`inset-${inset}`]: inset !== "none" }), className)
3357
+ });
3358
+ //#endregion
3359
+ //#region src/components/Item/ItemGroupContext.ts
3360
+ var ItemGroupContext = (0, react.createContext)({ registerTitle: () => () => void 0 });
3361
+ var useItemGroupContext = () => (0, react.useContext)(ItemGroupContext);
3362
+ //#endregion
3363
+ //#region src/components/Item/ItemGroup.tsx
3364
+ /**
3365
+ * A list of `Item` rows. An `ItemGroupTitle` inside it labels the group, and its width drives the narrow layout.
3366
+ */
3367
+ var ItemGroup = ({ is: Tag = "div", className, children, ...props }) => {
3368
+ const [titleIds, registerTitle] = useIdRegistry();
3369
+ const contextValue = (0, react.useMemo)(() => ({ registerTitle }), [registerTitle]);
3370
+ const ariaLabelledBy = !(!!props["aria-label"] || !!props["aria-labelledby"]) && titleIds.length > 0 ? titleIds.join(" ") : void 0;
3371
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ItemGroupContext.Provider, {
3372
+ value: contextValue,
3373
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
3374
+ "aria-labelledby": ariaLabelledBy,
3375
+ ...props,
3376
+ className: cx("rcx-item-group", className),
3377
+ children
3378
+ })
3379
+ });
3380
+ };
3381
+ //#endregion
3382
+ //#region src/components/Item/ItemGroupHeader.tsx
3383
+ /**
3384
+ * The label row of a group, such as Favorites, Recent or Moderators. It holds an `ItemGroupTitle` and optional trailing content.
3385
+ */
3386
+ var ItemGroupHeader = ({ is: Tag = "div", inset = "none", sticky, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
3387
+ ...props,
3388
+ className: cx(cxx("rcx-item-group-header")({
3389
+ [`inset-${inset}`]: inset !== "none",
3390
+ sticky: !!sticky
3391
+ }), className)
3392
+ });
3393
+ //#endregion
3394
+ //#region src/components/Item/ItemGroupTitle.tsx
3395
+ /**
3396
+ * The text of an `ItemGroupHeader`. Inside an `ItemGroup`, it becomes the group's accessible name.
3397
+ */
3398
+ var ItemGroupTitle = ({ is: Tag = "div", id: propId, className, type, ...props }) => {
3399
+ const generatedId = (0, react.useId)();
3400
+ const id = propId ?? generatedId;
3401
+ const { registerTitle } = useItemGroupContext();
3402
+ (0, react.useEffect)(() => registerTitle(id), [id, registerTitle]);
3403
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
3404
+ ...props,
3405
+ type: Tag === "button" ? type ?? "button" : type,
3406
+ id,
3407
+ className: cx("rcx-item-group-title", className)
3408
+ });
3409
+ };
3410
+ //#endregion
3411
+ //#region src/components/Item/ItemIcon.tsx
3412
+ /**
3413
+ * A 20px slot for the room type icon or a user status, placed before the title.
3414
+ */
3415
+ var ItemIcon = ({ is: Tag = "div", label, id: propId, className, ...props }) => {
3416
+ const generatedId = (0, react.useId)();
3417
+ const id = propId ?? generatedId;
3418
+ const { registerDescription } = useItemContext();
3419
+ (0, react.useEffect)(() => {
3420
+ if (!label) return;
3421
+ return registerDescription(id);
3422
+ }, [
3423
+ id,
3424
+ label,
3425
+ registerDescription
3426
+ ]);
3427
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
3428
+ ...label ? {
3429
+ "role": "img",
3430
+ "aria-label": label
3431
+ } : { "aria-hidden": true },
3432
+ ...props,
3433
+ id,
3434
+ className: cx("rcx-item__icon", className)
3435
+ });
3436
+ };
3437
+ //#endregion
3438
+ //#region src/components/Item/ItemLink.tsx
3439
+ /**
3440
+ * The primary target of an `Item`. It covers the whole row, so actions sit beside it instead of inside it.
3441
+ */
3442
+ var ItemLink = (props) => {
3443
+ const { descriptionIds } = useItemContext();
3444
+ const ariaDescribedBy = [props["aria-describedby"], ...descriptionIds].filter(Boolean).join(" ") || void 0;
3445
+ if (props.is === "button") {
3446
+ const { is: _is, className, type = "button", ...rest } = props;
3447
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3448
+ ...rest,
3449
+ type,
3450
+ "aria-describedby": ariaDescribedBy,
3451
+ className: cx("rcx-item__link", className)
3452
+ });
3453
+ }
3454
+ const { is: _is, className, children, ...rest } = props;
3455
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
3456
+ ...rest,
3457
+ "aria-describedby": ariaDescribedBy,
3458
+ className: cx("rcx-item__link", className),
3459
+ children
3460
+ });
3461
+ };
3462
+ //#endregion
3463
+ //#region src/components/Item/ItemMedia.tsx
3464
+ /**
3465
+ * The leading avatar, icon or thumbnail of an `Item`. Its box fits its child, so the child's size sets the row height.
3466
+ */
3467
+ var ItemMedia = ({ is: Tag = "div", variant = "default", className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
3468
+ ...props,
3469
+ className: cx(cxx("rcx-item__media")({ icon: variant === "icon" }), className)
3470
+ });
3471
+ //#endregion
3472
+ //#region src/components/Item/ItemMeta.tsx
3473
+ /**
3474
+ * Short trailing text that never truncates, such as a timestamp, count or file size.
3475
+ */
3476
+ var ItemMeta = ({ is: Tag = "div", className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
3477
+ ...props,
3478
+ className: cx("rcx-item__meta", className)
3479
+ });
3480
+ //#endregion
3481
+ //#region src/components/Item/ItemRow.tsx
3482
+ /**
3483
+ * A horizontal line inside `ItemContent`, such as a title with a timestamp or a description with a badge.
3484
+ */
3485
+ var ItemRow = ({ is: Tag = "div", className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
3486
+ ...props,
3487
+ className: cx("rcx-item__row", className)
3488
+ });
3489
+ //#endregion
3490
+ //#region src/components/Item/ItemTitle.tsx
3491
+ /**
3492
+ * The main label of an `Item`. It truncates with an ellipsis.
3493
+ */
3494
+ var ItemTitle = ({ is: Tag = "div", className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
3495
+ ...props,
3496
+ className: cx("rcx-item__title", className)
3497
+ });
3498
+ //#endregion
3499
+ //#region src/components/Item/ItemSkeleton.tsx
3500
+ /**
3501
+ * A loading placeholder with the same height as an `Item` with the same media and lines.
3502
+ */
3503
+ var ItemSkeleton = ({ is, inset, mediaSize = "x20", description = false }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Item, {
3504
+ is,
3505
+ inset,
3506
+ "aria-hidden": true,
3507
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ItemMedia, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, {
3508
+ variant: "rect",
3509
+ width: mediaSize,
3510
+ height: mediaSize
3511
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ItemContent, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ItemTitle, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, {
3512
+ variant: "text",
3513
+ width: "60%"
3514
+ }) }), description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ItemDescription, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, {
3515
+ variant: "text",
3516
+ width: "40%"
3517
+ }) })] })]
3518
+ });
3519
+ //#endregion
3262
3520
  //#region src/components/Menu/MenuOption.tsx
3263
3521
  function MenuOption({ is: Tag = "li", id, children, focus, selected, className, title, disabled, variant, onClick, ...props }) {
3264
3522
  return /* @__PURE__ */ (0, react.createElement)(Tag, {
@@ -4039,11 +4297,12 @@ if (process.env.NODE_ENV !== "production") (function() {
4039
4297
  /**
4040
4298
  * Used for mentions
4041
4299
  */
4042
- var Tag = ({ large, medium, className, disabled, onClick, variant, children, icon, href, ...props }) => {
4300
+ var Tag = ({ large, medium, pill, className, disabled, onClick, variant, children, icon, href, ...props }) => {
4043
4301
  const modifiers = [
4044
4302
  variant,
4045
4303
  medium && "medium",
4046
4304
  large && "large",
4305
+ pill && "pill",
4047
4306
  disabled && "disabled",
4048
4307
  onClick && "clickable",
4049
4308
  href && "clickable"
@@ -7057,6 +7316,21 @@ if (process.env.NODE_ENV !== "production") (function() {
7057
7316
  exports.Input = Input;
7058
7317
  exports.InputBox = InputBox;
7059
7318
  exports.InputBoxSkeleton = InputBoxSkeleton;
7319
+ exports.Item = Item;
7320
+ exports.ItemActions = ItemActions;
7321
+ exports.ItemContent = ItemContent;
7322
+ exports.ItemDescription = ItemDescription;
7323
+ exports.ItemDivider = ItemDivider;
7324
+ exports.ItemGroup = ItemGroup;
7325
+ exports.ItemGroupHeader = ItemGroupHeader;
7326
+ exports.ItemGroupTitle = ItemGroupTitle;
7327
+ exports.ItemIcon = ItemIcon;
7328
+ exports.ItemLink = ItemLink;
7329
+ exports.ItemMedia = ItemMedia;
7330
+ exports.ItemMeta = ItemMeta;
7331
+ exports.ItemRow = ItemRow;
7332
+ exports.ItemSkeleton = ItemSkeleton;
7333
+ exports.ItemTitle = ItemTitle;
7060
7334
  exports.Label = Label;
7061
7335
  exports.Margins = Margins;
7062
7336
  exports.Menu = Menu;