@rocket.chat/fuselage 0.85.0 → 0.86.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.
@@ -66,8 +66,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
66
66
  };
67
67
  Object.defineProperty(exports, "__esModule", ({ value: true }));
68
68
  exports.Palette = exports.isShadowColor = exports.isStatusColor = exports.isStatusBackgroundColor = exports.isBadgeColor = exports.isTextIconColor = exports.isStrokeColor = exports.isSurfaceColor = exports.shadowColors = exports.badgeBackgroundColors = exports.statusColors = exports.statusBackgroundColors = exports.textIconColors = exports.strokeColors = exports.surfaceColors = exports.neutral = exports.__setThrowErrorOnInvalidToken__ = exports.throwErrorOnInvalidToken = exports.Var = void 0;
69
- const colors_json_1 = __importDefault(__webpack_require__(/*! @rocket.chat/fuselage-tokens/colors.json */ "@rocket.chat/fuselage-tokens/colors.json"));
70
69
  const badge_json_1 = __importDefault(__webpack_require__(/*! @rocket.chat/fuselage-tokens/dist/badge.json */ "@rocket.chat/fuselage-tokens/dist/badge.json"));
70
+ const colors_json_1 = __importDefault(__webpack_require__(/*! @rocket.chat/fuselage-tokens/dist/colors.json */ "@rocket.chat/fuselage-tokens/dist/colors.json"));
71
71
  const font_json_1 = __importDefault(__webpack_require__(/*! @rocket.chat/fuselage-tokens/dist/font.json */ "@rocket.chat/fuselage-tokens/dist/font.json"));
72
72
  const shadow_json_1 = __importDefault(__webpack_require__(/*! @rocket.chat/fuselage-tokens/dist/shadow.json */ "@rocket.chat/fuselage-tokens/dist/shadow.json"));
73
73
  const status_json_1 = __importDefault(__webpack_require__(/*! @rocket.chat/fuselage-tokens/dist/status.json */ "@rocket.chat/fuselage-tokens/dist/status.json"));
@@ -113,7 +113,7 @@ exports.neutral = {
113
113
  // Falls back to the primitive palette directly. TODO(fuselage-tokens):
114
114
  // remove `primitive()` and its call sites below once resolved.
115
115
  const primitive = (ref, name) => new Var(name, colors_json_1.default[ref]);
116
- const surfaceTokens = surface_json_1.default.surface.light;
116
+ const surfaceTokens = surface_json_1.default.light;
117
117
  exports.surfaceColors = {
118
118
  'surface-light': new Var('surface-light', surfaceTokens.light),
119
119
  'surface-tint': new Var('surface-tint', surfaceTokens.tint),
@@ -129,7 +129,7 @@ exports.surfaceColors = {
129
129
  'surface-transparent': 'transparent',
130
130
  'surface-sidebar': new Var('surface-sidebar', surfaceTokens.sidebar),
131
131
  };
132
- const strokeTokens = stroke_json_1.default.stroke.light;
132
+ const strokeTokens = stroke_json_1.default.light;
133
133
  exports.strokeColors = {
134
134
  'stroke-extra-light': new Var('stroke-extra-light', strokeTokens.extraLight),
135
135
  'stroke-light': new Var('stroke-light', strokeTokens.light),
@@ -141,7 +141,7 @@ exports.strokeColors = {
141
141
  'stroke-extra-light-error': new Var('stroke-extra-light-error', strokeTokens.extraLightError),
142
142
  'stroke-error': new Var('stroke-error', strokeTokens.error),
143
143
  };
144
- const fontTokens = font_json_1.default.font.light;
144
+ const fontTokens = font_json_1.default.light;
145
145
  exports.textIconColors = {
146
146
  'font-white': new Var('font-white', fontTokens.white),
147
147
  'font-disabled': new Var('font-disabled', fontTokens.disabled),
@@ -155,7 +155,7 @@ exports.textIconColors = {
155
155
  'font-pure-black': new Var('font-pure-black', fontTokens.pureBlack),
156
156
  'font-pure-white': new Var('font-pure-white', fontTokens.pureWhite),
157
157
  };
158
- const statusTokens = status_json_1.default.status.light;
158
+ const statusTokens = status_json_1.default.light;
159
159
  exports.statusBackgroundColors = {
160
160
  'status-background-info': new Var('status-background-info', statusTokens.info),
161
161
  'status-background-success': new Var('status-background-success', statusTokens.success),
@@ -177,7 +177,7 @@ exports.statusColors = {
177
177
  'status-font-on-service-1': new Var('status-font-on-service-1', statusTokens['font-on-service-1']),
178
178
  'status-font-on-service-2': new Var('status-font-on-service-2', statusTokens['font-on-service-2']),
179
179
  };
180
- const badgeTokens = badge_json_1.default.badge.light;
180
+ const badgeTokens = badge_json_1.default.light;
181
181
  exports.badgeBackgroundColors = {
182
182
  'badge-background-level-0': new Var('badge-background-level-0', badgeTokens['level-0']),
183
183
  'badge-background-level-1': new Var('badge-background-level-1', badgeTokens['level-1']),
@@ -185,7 +185,7 @@ exports.badgeBackgroundColors = {
185
185
  'badge-background-level-3': new Var('badge-background-level-3', badgeTokens['level-3']),
186
186
  'badge-background-level-4': new Var('badge-background-level-4', badgeTokens['level-4']),
187
187
  };
188
- const shadowTokens = shadow_json_1.default.shadow.light;
188
+ const shadowTokens = shadow_json_1.default.light;
189
189
  exports.shadowColors = {
190
190
  'shadow-elevation-border': new Var('shadow-elevation-border', shadowTokens['elevation-border']),
191
191
  'shadow-elevation-1': new Var('shadow-elevation-1', shadowTokens['elevation-1']),
@@ -826,8 +826,8 @@ const prependClassName_1 = __webpack_require__(/*! ../../helpers/prependClassNam
826
826
  /**
827
827
  * Communicates notification’s amount and types.
828
828
  */
829
- function Badge({ is: Tag = 'span', variant = 'secondary', small, className, disabled, ...props }) {
830
- const modifiers = [variant, small && 'small', disabled && 'disabled']
829
+ function Badge({ is: Tag = 'span', variant = 'secondary', small, className, ...props }) {
830
+ const modifiers = [variant, small && 'small']
831
831
  .filter(Boolean)
832
832
  .map((modifier) => `rcx-badge--${modifier}`)
833
833
  .join(' ');
@@ -6520,7 +6520,7 @@ function Options({ maxHeight = 'x144', multiple, renderEmpty: EmptyComponent = O
6520
6520
  return;
6521
6521
  (0, prevent_1.prevent)(e);
6522
6522
  onSelect([value, label, selected, disabled, type, url]);
6523
- }, value: value, selected: selected, disabled: disabled, focus: cursor === i }, value));
6523
+ }, value: value, selected: !!selected, disabled: disabled, focus: cursor === i }, value));
6524
6524
  }
6525
6525
  }), [options, cursor, onSelect, OptionComponent]);
6526
6526
  return ((0, jsx_runtime_1.jsx)(Box_1.Box, { "rcx-options": true, ...props, children: (0, jsx_runtime_1.jsx)(Tile_1.Tile, { padding: 0, paddingBlock: 'x12', paddingInline: 0, elevation: '2', children: (0, jsx_runtime_1.jsx)(Scrollable_1.Scrollable, { vertical: true, smooth: true, children: (0, jsx_runtime_1.jsxs)(Tile_1.Tile, { ref: liRef, elevation: '0', padding: 'none', maxHeight: maxHeight, onMouseDown: prevent_1.prevent, onClick: prevent_1.prevent, is: 'ol', "aria-multiselectable": multiple || true, role: 'listbox', id: id, "aria-activedescendant": options?.[cursor]?.[0]
@@ -6755,7 +6755,7 @@ function OptionsPaginated({ ref, withTitle, multiple, renderEmpty: EmptyComponen
6755
6755
  (0, prevent_1.prevent)(e);
6756
6756
  onSelect([value, label]);
6757
6757
  return false;
6758
- }, key: value, value: value, selected: selected || (multiple !== true && undefined), focus: cursor === index || undefined }));
6758
+ }, key: value, value: value, selected: !!selected, focus: cursor === index || undefined }));
6759
6759
  };
6760
6760
  return ((0, jsx_runtime_1.jsx)(Box_1.Box, { "rcx-options": true, ...props, ref: ref, children: (0, jsx_runtime_1.jsx)(Tile_1.Tile, { padding: 0, paddingBlock: 'x12', paddingInline: 0, elevation: '2', children: !options.length ? ((0, jsx_runtime_1.jsx)(EmptyComponent, {})) : ((0, jsx_runtime_1.jsx)(react_virtuoso_1.Virtuoso, { endReached: endReached, style: { height: '144px' }, totalCount: options.length, data: options,
6761
6761
  // TODO Add a scroller element
@@ -7181,14 +7181,14 @@ const stroke_json_1 = __importDefault(__webpack_require__(/*! @rocket.chat/fusel
7181
7181
  const surface_json_1 = __importDefault(__webpack_require__(/*! @rocket.chat/fuselage-tokens/dist/surface.json */ "@rocket.chat/fuselage-tokens/dist/surface.json"));
7182
7182
  const getTokens = (theme) => {
7183
7183
  const tokens = {
7184
- badge: badge_json_1.default.badge[theme],
7185
- button: button_json_1.default.button[theme],
7186
- font: font_json_1.default.font[theme],
7187
- shadow: shadow_json_1.default.shadow[theme],
7188
- status: status_json_1.default.status[theme],
7189
- statusBullet: statusBullet_json_1.default.statusBullet[theme],
7190
- stroke: stroke_json_1.default.stroke[theme],
7191
- surface: surface_json_1.default.surface[theme],
7184
+ badge: badge_json_1.default[theme],
7185
+ button: button_json_1.default[theme],
7186
+ font: font_json_1.default[theme],
7187
+ shadow: shadow_json_1.default[theme],
7188
+ status: status_json_1.default[theme],
7189
+ statusBullet: statusBullet_json_1.default[theme],
7190
+ stroke: stroke_json_1.default[theme],
7191
+ surface: surface_json_1.default[theme],
7192
7192
  };
7193
7193
  return tokens;
7194
7194
  };
@@ -9157,13 +9157,12 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
9157
9157
  exports.SidebarGroupTitle = void 0;
9158
9158
  const jsx_runtime_1 = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
9159
9159
  const Chevron_1 = __webpack_require__(/*! ../Chevron */ "./src/components/Chevron/index.ts");
9160
- const SidebarCollapseGroupMenu_1 = __webpack_require__(/*! ./SidebarCollapseGroupMenu */ "./src/components/SidebarV2/SidebarCollapseGroupMenu.tsx");
9161
9160
  const SidebarGroupTitle = ({ title, titleId, badge, menu, barProps, expanded, role, ...props }) => ((0, jsx_runtime_1.jsxs)("div", { className: [
9162
9161
  'rcx-box rcx-box--full',
9163
9162
  'rcx-sidebar-v2-collapse-group__bar rcx-box--animated',
9164
9163
  ]
9165
9164
  .filter(Boolean)
9166
- .join(' '), ...props, children: [(0, jsx_runtime_1.jsxs)("div", { className: 'rcx-box rcx-sidebar-v2-collapse-group__bar-button', role: role, ...barProps, children: [expanded !== undefined && (0, jsx_runtime_1.jsx)(Chevron_1.Chevron, { size: 'x20', right: !expanded }), title && ((0, jsx_runtime_1.jsx)("h4", { className: 'rcx-box rcx-box--full rcx-sidebar-v2-collapse-group__title', id: titleId, children: title })), !expanded && badge && badge] }), menu && (0, jsx_runtime_1.jsx)(SidebarCollapseGroupMenu_1.SidebarCollapseGroupMenu, { children: menu })] }));
9165
+ .join(' '), ...props, children: [(0, jsx_runtime_1.jsxs)("div", { className: 'rcx-box rcx-sidebar-v2-collapse-group__bar-button', role: role, ...barProps, children: [expanded !== undefined && (0, jsx_runtime_1.jsx)(Chevron_1.Chevron, { size: 'x20', right: !expanded }), title && ((0, jsx_runtime_1.jsx)("h4", { className: 'rcx-box rcx-box--full rcx-sidebar-v2-collapse-group__title', id: titleId, children: title })), !expanded && badge && badge] }), menu] }));
9167
9166
  exports.SidebarGroupTitle = SidebarGroupTitle;
9168
9167
 
9169
9168
 
@@ -11358,7 +11357,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
11358
11357
  };
11359
11358
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11360
11359
  exports.getPaletteColor = void 0;
11361
- const colors_json_1 = __importDefault(__webpack_require__(/*! @rocket.chat/fuselage-tokens/colors.json */ "@rocket.chat/fuselage-tokens/colors.json"));
11360
+ const colors_json_1 = __importDefault(__webpack_require__(/*! @rocket.chat/fuselage-tokens/dist/colors.json */ "@rocket.chat/fuselage-tokens/dist/colors.json"));
11362
11361
  const invariant_1 = __importDefault(__webpack_require__(/*! invariant */ "invariant"));
11363
11362
  const isPaletteColorRef = (ref) => typeof ref === 'string' && ref in colors_json_1.default;
11364
11363
  const mapTypeToPrefix = {
@@ -11939,7 +11938,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
11939
11938
  };
11940
11939
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11941
11940
  exports.fontScale = exports.fontFamily = exports.spacing = exports.size = exports.color = exports.fontColor = exports.backgroundColor = exports.strokeColor = exports.borderRadius = exports.borderWidth = void 0;
11942
- const typography_json_1 = __importDefault(__webpack_require__(/*! @rocket.chat/fuselage-tokens/typography.json */ "@rocket.chat/fuselage-tokens/typography.json"));
11941
+ const border_json_1 = __importDefault(__webpack_require__(/*! @rocket.chat/fuselage-tokens/dist/border.json */ "@rocket.chat/fuselage-tokens/dist/border.json"));
11942
+ const typography_json_1 = __importDefault(__webpack_require__(/*! @rocket.chat/fuselage-tokens/dist/typography.json */ "@rocket.chat/fuselage-tokens/dist/typography.json"));
11943
11943
  const memo_1 = __webpack_require__(/*! @rocket.chat/memo */ "@rocket.chat/memo");
11944
11944
  const invariant_1 = __importDefault(__webpack_require__(/*! invariant */ "invariant"));
11945
11945
  const Theme_1 = __webpack_require__(/*! ./Theme */ "./src/Theme.ts");
@@ -11965,20 +11965,14 @@ const measure = (computeSpecialValue) => (0, memo_1.memoize)((value) => {
11965
11965
  return value;
11966
11966
  });
11967
11967
  exports.borderWidth = measure((value) => {
11968
- if (value === 'none') {
11969
- return '0px';
11970
- }
11971
- if (value === 'default') {
11972
- return (0, exports.borderWidth)('x1');
11968
+ if (typeof value === 'string' && value in border_json_1.default.width) {
11969
+ return `${border_json_1.default.width[value]}px`;
11973
11970
  }
11974
11971
  return undefined;
11975
11972
  });
11976
11973
  exports.borderRadius = measure((value) => {
11977
- if (value === 'none') {
11978
- return '0px';
11979
- }
11980
- if (value === 'full') {
11981
- return '9999px';
11974
+ if (typeof value === 'string' && value in border_json_1.default.radius) {
11975
+ return `${border_json_1.default.radius[value] / 16}rem`;
11982
11976
  }
11983
11977
  return undefined;
11984
11978
  });
@@ -12111,22 +12105,22 @@ exports.spacing = measure((value) => {
12111
12105
  }
12112
12106
  return undefined;
12113
12107
  });
12114
- const isFontFamily = (value) => typeof value === 'string' && value in typography_json_1.default.fontFamilies;
12108
+ const isFontFamily = (value) => typeof value === 'string' && value in typography_json_1.default.fontFamily;
12115
12109
  exports.fontFamily = (0, memo_1.memoize)((value) => {
12116
12110
  if (!isFontFamily(value)) {
12117
12111
  return undefined;
12118
12112
  }
12119
- const fontFamily = typography_json_1.default.fontFamilies[value]
12113
+ const fontFamily = typography_json_1.default.fontFamily[value]
12120
12114
  .map((fontFace) => (fontFace.includes(' ') ? `'${fontFace}'` : fontFace))
12121
12115
  .join(', ');
12122
12116
  return (0, toCSSValue_1.toCSSFontValue)(value, fontFamily);
12123
12117
  });
12124
- const isFontScale = (value) => typeof value === 'string' && value in typography_json_1.default.fontScales;
12118
+ const isFontScale = (value) => typeof value === 'string' && value in typography_json_1.default.fontScale;
12125
12119
  exports.fontScale = (0, memo_1.memoize)((value) => {
12126
12120
  if (!isFontScale(value)) {
12127
12121
  return undefined;
12128
12122
  }
12129
- const { fontSize, fontWeight, lineHeight, letterSpacing } = typography_json_1.default.fontScales[value];
12123
+ const { fontSize, fontWeight, lineHeight, letterSpacing } = typography_json_1.default.fontScale[value];
12130
12124
  return {
12131
12125
  fontSize: `${fontSize / 16}rem`,
12132
12126
  fontWeight,
@@ -12158,16 +12152,6 @@ module.exports = require("@rocket.chat/fuselage-hooks");
12158
12152
 
12159
12153
  /***/ },
12160
12154
 
12161
- /***/ "@rocket.chat/fuselage-tokens/colors.json"
12162
- /*!***********************************************************!*\
12163
- !*** external "@rocket.chat/fuselage-tokens/colors.json" ***!
12164
- \***********************************************************/
12165
- (module) {
12166
-
12167
- module.exports = require("@rocket.chat/fuselage-tokens/colors.json");
12168
-
12169
- /***/ },
12170
-
12171
12155
  /***/ "@rocket.chat/fuselage-tokens/dist/badge.json"
12172
12156
  /*!***************************************************************!*\
12173
12157
  !*** external "@rocket.chat/fuselage-tokens/dist/badge.json" ***!
@@ -12178,6 +12162,16 @@ module.exports = require("@rocket.chat/fuselage-tokens/dist/badge.json");
12178
12162
 
12179
12163
  /***/ },
12180
12164
 
12165
+ /***/ "@rocket.chat/fuselage-tokens/dist/border.json"
12166
+ /*!****************************************************************!*\
12167
+ !*** external "@rocket.chat/fuselage-tokens/dist/border.json" ***!
12168
+ \****************************************************************/
12169
+ (module) {
12170
+
12171
+ module.exports = require("@rocket.chat/fuselage-tokens/dist/border.json");
12172
+
12173
+ /***/ },
12174
+
12181
12175
  /***/ "@rocket.chat/fuselage-tokens/dist/button.json"
12182
12176
  /*!****************************************************************!*\
12183
12177
  !*** external "@rocket.chat/fuselage-tokens/dist/button.json" ***!
@@ -12188,6 +12182,16 @@ module.exports = require("@rocket.chat/fuselage-tokens/dist/button.json");
12188
12182
 
12189
12183
  /***/ },
12190
12184
 
12185
+ /***/ "@rocket.chat/fuselage-tokens/dist/colors.json"
12186
+ /*!****************************************************************!*\
12187
+ !*** external "@rocket.chat/fuselage-tokens/dist/colors.json" ***!
12188
+ \****************************************************************/
12189
+ (module) {
12190
+
12191
+ module.exports = require("@rocket.chat/fuselage-tokens/dist/colors.json");
12192
+
12193
+ /***/ },
12194
+
12191
12195
  /***/ "@rocket.chat/fuselage-tokens/dist/font.json"
12192
12196
  /*!**************************************************************!*\
12193
12197
  !*** external "@rocket.chat/fuselage-tokens/dist/font.json" ***!
@@ -12248,13 +12252,13 @@ module.exports = require("@rocket.chat/fuselage-tokens/dist/surface.json");
12248
12252
 
12249
12253
  /***/ },
12250
12254
 
12251
- /***/ "@rocket.chat/fuselage-tokens/typography.json"
12252
- /*!***************************************************************!*\
12253
- !*** external "@rocket.chat/fuselage-tokens/typography.json" ***!
12254
- \***************************************************************/
12255
+ /***/ "@rocket.chat/fuselage-tokens/dist/typography.json"
12256
+ /*!********************************************************************!*\
12257
+ !*** external "@rocket.chat/fuselage-tokens/dist/typography.json" ***!
12258
+ \********************************************************************/
12255
12259
  (module) {
12256
12260
 
12257
- module.exports = require("@rocket.chat/fuselage-tokens/typography.json");
12261
+ module.exports = require("@rocket.chat/fuselage-tokens/dist/typography.json");
12258
12262
 
12259
12263
  /***/ },
12260
12264