@assembly-js/design-system 3.1.11 → 3.1.12

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.
@@ -3,15 +3,16 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
3
3
  import React from 'react';
4
4
  import { Avatar } from "../Avatar/Avatar";
5
5
  import { Body } from "../Typography";
6
- import clsx from 'clsx';
7
6
  import { UserWithCompanyAvatar } from "../Avatar/UserWithCompanyAvatar";
8
- import { getInitials } from "../../common/utils";
9
- export function ListItem(_ref) {
7
+ import { cn, getInitials } from "../../common/utils";
8
+ export function ListItem(props) {
10
9
  var _option$avatarSrc, _option$avatarFallbac, _option$label;
11
- var option = _ref.data,
12
- innerRef = _ref.innerRef,
13
- isFocused = _ref.isFocused,
14
- innerProps = _ref.innerProps;
10
+ var option = props.data,
11
+ innerRef = props.innerRef,
12
+ isFocused = props.isFocused,
13
+ isSelected = props.isSelected,
14
+ innerProps = props.innerProps,
15
+ listClassName = props.listClassName;
15
16
  var avatarSrc = option.avatarSrc,
16
17
  avatarFallbackColor = option.avatarFallbackColor,
17
18
  label = option.label,
@@ -23,13 +24,15 @@ export function ListItem(_ref) {
23
24
  key: option.value,
24
25
  ref: innerRef
25
26
  }, innerProps, {
26
- className: clsx('cop-flex cop-cursor-pointer cop-items-center cop-gap-3 cop-px-3 hover:cop-bg-gray-100', {
27
+ "data-focused": isFocused || undefined,
28
+ "data-selected": isSelected || undefined,
29
+ className: cn('cop-flex cop-cursor-pointer cop-items-center cop-gap-3 cop-px-3 hover:cop-bg-gray-100', {
27
30
  'cop-h-10': !!companyName,
28
31
  // if an option has company name to render, the option should have a height of 40px
29
32
  'cop-h-8': !companyName,
30
33
  // if an option has no company name to render, the option should have a height of 32px
31
34
  'cop-bg-primary': isFocused
32
- })
35
+ }, listClassName)
33
36
  }), option.type !== 'company' ? /*#__PURE__*/React.createElement(UserWithCompanyAvatar, {
34
37
  size: "sm",
35
38
  avatarSrc: (_option$avatarSrc = option.avatarSrc) !== null && _option$avatarSrc !== void 0 ? _option$avatarSrc : '',
@@ -2,7 +2,7 @@
2
2
  'use client';
3
3
 
4
4
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
5
- var _excluded = ["autoFocus", "grouped", "name", "internalUsers", "clientUsers", "companies", "onChange", "onBlur", "placeholder", "styles", "ignoreCompanies", "ignoreFilterClientsByCompany", "limitSelectedOptions", "initialValue", "customLabels", "listHeading"];
5
+ var _excluded = ["autoFocus", "grouped", "name", "internalUsers", "clientUsers", "companies", "onChange", "onBlur", "placeholder", "styles", "ignoreCompanies", "ignoreFilterClientsByCompany", "limitSelectedOptions", "initialValue", "customLabels", "listHeading", "listClassName"];
6
6
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
7
7
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
8
8
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -78,6 +78,7 @@ export var UserCompanySelector = function UserCompanySelector(_ref) {
78
78
  initialValue = _ref.initialValue,
79
79
  customLabels = _ref.customLabels,
80
80
  listHeading = _ref.listHeading,
81
+ listClassName = _ref.listClassName,
81
82
  others = _objectWithoutProperties(_ref, _excluded);
82
83
  var limitSelectedOptions = limitSelectedOptionsUnvalidated === 0 ? 1000 : Math.min(1000, limitSelectedOptionsUnvalidated);
83
84
  var companiesMap = useMemo(function () {
@@ -307,7 +308,8 @@ export var UserCompanySelector = function UserCompanySelector(_ref) {
307
308
  },
308
309
  Option: function Option(props) {
309
310
  return /*#__PURE__*/React.createElement(ListItem, _extends({}, props, {
310
- data: getCompanyData(props.data)
311
+ data: getCompanyData(props.data),
312
+ listClassName: listClassName
311
313
  }));
312
314
  },
313
315
  DropdownIndicator: function DropdownIndicator() {
@@ -330,7 +332,7 @@ export var UserCompanySelector = function UserCompanySelector(_ref) {
330
332
  }));
331
333
  }
332
334
  };
333
- }, [getCompanyData]);
335
+ }, [getCompanyData, listHeading, listClassName]);
334
336
  return /*#__PURE__*/React.createElement(Select, _extends({
335
337
  autoFocus: autoFocus,
336
338
  isMulti: true,
@@ -1,4 +1,9 @@
1
1
  import React from 'react';
2
- import { type OptionWithCompanyMetadata } from './types';
3
- import { type GroupBase, type OptionProps } from 'react-select';
4
- export declare function ListItem<_OptionProps extends OptionWithCompanyMetadata, GroupProps extends GroupBase<_OptionProps> = GroupBase<_OptionProps>>({ data: option, innerRef, isFocused, innerProps, }: OptionProps<_OptionProps, true, GroupProps>): React.JSX.Element;
2
+ import { type OptionWithCompanyMetadata, type UserCompanySelectorOption, type UserCompanySelectorGroupedOption } from './types';
3
+ import { type OptionProps } from 'react-select';
4
+ type ListItemProps = OptionProps<UserCompanySelectorOption, true, UserCompanySelectorGroupedOption> & {
5
+ data: OptionWithCompanyMetadata;
6
+ listClassName?: string;
7
+ };
8
+ export declare function ListItem(props: ListItemProps): React.JSX.Element;
9
+ export {};
@@ -41,6 +41,7 @@ export type UserCompanySelectorProps = {
41
41
  groupTermPlural: string;
42
42
  };
43
43
  listHeading?: string;
44
+ listClassName?: string;
44
45
  };
45
46
  /**
46
47
  * @deprecated Use Option instead