@assembly-js/design-system 3.1.10 → 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.
- package/dist/esm/components/Chip/Chip.js +5 -1
- package/dist/esm/components/UserCompanySelector/ListItem.js +14 -11
- package/dist/esm/components/UserCompanySelector/SelectedValueChip.js +2 -1
- package/dist/esm/components/UserCompanySelector/UserCompanySelector.js +5 -3
- package/dist/esm/types/components/Chip/Chip.d.ts +2 -1
- package/dist/esm/types/components/UserCompanySelector/ListItem.d.ts +8 -3
- package/dist/esm/types/components/UserCompanySelector/UserCompanySelector.stories.d.ts +1 -0
- package/dist/esm/types/components/UserCompanySelector/types.d.ts +1 -0
- package/dist/esm/types/tsconfig.tsbuildinfo +1 -1
- package/dist/styles/main.css +1 -1
- package/dist/types/components/Chip/Chip.d.ts +2 -1
- package/dist/types/components/UserCompanySelector/ListItem.d.ts +8 -3
- package/dist/types/components/UserCompanySelector/UserCompanySelector.stories.d.ts +1 -0
- package/dist/types/components/UserCompanySelector/types.d.ts +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/umd/components/Chip/Chip.js +5 -1
- package/dist/umd/components/UserCompanySelector/ListItem.js +17 -14
- package/dist/umd/components/UserCompanySelector/SelectedValueChip.js +2 -1
- package/dist/umd/components/UserCompanySelector/UserCompanySelector.js +5 -3
- package/dist/umd/types/components/Chip/Chip.d.ts +2 -1
- package/dist/umd/types/components/UserCompanySelector/ListItem.d.ts +8 -3
- package/dist/umd/types/components/UserCompanySelector/UserCompanySelector.stories.d.ts +1 -0
- package/dist/umd/types/components/UserCompanySelector/types.d.ts +1 -0
- package/dist/umd/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -101,6 +101,8 @@
|
|
|
101
101
|
size = _ref2$size === void 0 ? 'sm' : _ref2$size,
|
|
102
102
|
className = _ref2.className,
|
|
103
103
|
prefixIcon = _ref2.prefixIcon,
|
|
104
|
+
_ref2$truncate = _ref2.truncate,
|
|
105
|
+
truncate = _ref2$truncate === void 0 ? false : _ref2$truncate,
|
|
104
106
|
disabled = _ref2.disabled,
|
|
105
107
|
onClick = _ref2.onClick,
|
|
106
108
|
onClose = _ref2.onClose,
|
|
@@ -137,7 +139,9 @@
|
|
|
137
139
|
})
|
|
138
140
|
}), /*#__PURE__*/_react["default"].createElement(_Typography.Body, {
|
|
139
141
|
size: size !== 'sm' ? 'base' : 'sm',
|
|
140
|
-
className:
|
|
142
|
+
className: (0, _utils.cn)('cop-m-0', {
|
|
143
|
+
'cop-truncate': truncate
|
|
144
|
+
})
|
|
141
145
|
}, label), Boolean(onClose) ?
|
|
142
146
|
/*#__PURE__*/
|
|
143
147
|
// We intentionally attach both onClick and onTouch event
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// This file is generated by a script. Do not edit this file directly.
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
if (typeof define === "function" && define.amd) {
|
|
4
|
-
define(["exports", "react", "../Avatar/Avatar", "../Typography", "
|
|
4
|
+
define(["exports", "react", "../Avatar/Avatar", "../Typography", "../Avatar/UserWithCompanyAvatar", "../../common/utils"], factory);
|
|
5
5
|
} else if (typeof exports !== "undefined") {
|
|
6
|
-
factory(exports, require("react"), require("../Avatar/Avatar"), require("../Typography"), require("
|
|
6
|
+
factory(exports, require("react"), require("../Avatar/Avatar"), require("../Typography"), require("../Avatar/UserWithCompanyAvatar"), require("../../common/utils"));
|
|
7
7
|
} else {
|
|
8
8
|
var mod = {
|
|
9
9
|
exports: {}
|
|
10
10
|
};
|
|
11
|
-
factory(mod.exports, global.react, global.Avatar, global.Typography, global.
|
|
11
|
+
factory(mod.exports, global.react, global.Avatar, global.Typography, global.UserWithCompanyAvatar, global.utils);
|
|
12
12
|
global.ListItem = mod.exports;
|
|
13
13
|
}
|
|
14
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _react, _Avatar, _Typography,
|
|
14
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _react, _Avatar, _Typography, _UserWithCompanyAvatar, _utils) {
|
|
15
15
|
"use strict";
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -19,15 +19,16 @@
|
|
|
19
19
|
});
|
|
20
20
|
_exports.ListItem = ListItem;
|
|
21
21
|
_react = _interopRequireDefault(_react);
|
|
22
|
-
_clsx = _interopRequireDefault(_clsx);
|
|
23
22
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
24
23
|
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); }
|
|
25
|
-
function ListItem(
|
|
24
|
+
function ListItem(props) {
|
|
26
25
|
var _option$avatarSrc, _option$avatarFallbac, _option$label;
|
|
27
|
-
var option =
|
|
28
|
-
innerRef =
|
|
29
|
-
isFocused =
|
|
30
|
-
|
|
26
|
+
var option = props.data,
|
|
27
|
+
innerRef = props.innerRef,
|
|
28
|
+
isFocused = props.isFocused,
|
|
29
|
+
isSelected = props.isSelected,
|
|
30
|
+
innerProps = props.innerProps,
|
|
31
|
+
listClassName = props.listClassName;
|
|
31
32
|
var avatarSrc = option.avatarSrc,
|
|
32
33
|
avatarFallbackColor = option.avatarFallbackColor,
|
|
33
34
|
label = option.label,
|
|
@@ -39,13 +40,15 @@
|
|
|
39
40
|
key: option.value,
|
|
40
41
|
ref: innerRef
|
|
41
42
|
}, innerProps, {
|
|
42
|
-
|
|
43
|
+
"data-focused": isFocused || undefined,
|
|
44
|
+
"data-selected": isSelected || undefined,
|
|
45
|
+
className: (0, _utils.cn)('cop-flex cop-cursor-pointer cop-items-center cop-gap-3 cop-px-3 hover:cop-bg-gray-100', {
|
|
43
46
|
'cop-h-10': !!companyName,
|
|
44
47
|
// if an option has company name to render, the option should have a height of 40px
|
|
45
48
|
'cop-h-8': !companyName,
|
|
46
49
|
// if an option has no company name to render, the option should have a height of 32px
|
|
47
50
|
'cop-bg-primary': isFocused
|
|
48
|
-
})
|
|
51
|
+
}, listClassName)
|
|
49
52
|
}), option.type !== 'company' ? /*#__PURE__*/_react["default"].createElement(_UserWithCompanyAvatar.UserWithCompanyAvatar, {
|
|
50
53
|
size: "sm",
|
|
51
54
|
avatarSrc: (_option$avatarSrc = option.avatarSrc) !== null && _option$avatarSrc !== void 0 ? _option$avatarSrc : '',
|
|
@@ -62,12 +65,12 @@
|
|
|
62
65
|
size: "sm",
|
|
63
66
|
variant: 'rounded'
|
|
64
67
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
65
|
-
className: "cop-flex cop-flex-col cop-text-[10px]"
|
|
68
|
+
className: "cop-flex cop-min-w-0 cop-flex-col cop-text-[10px]"
|
|
66
69
|
}, /*#__PURE__*/_react["default"].createElement(_Typography.Body, {
|
|
67
70
|
className: "cop-m-0 cop-truncate",
|
|
68
71
|
size: "sm"
|
|
69
72
|
}, option.label), companyName && /*#__PURE__*/_react["default"].createElement("span", {
|
|
70
|
-
className: "cop-text-secondary"
|
|
73
|
+
className: "cop-truncate cop-text-secondary"
|
|
71
74
|
}, companyName)));
|
|
72
75
|
}
|
|
73
76
|
});
|
|
@@ -39,8 +39,9 @@
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
return /*#__PURE__*/_react["default"].createElement(_Chip.Chip, {
|
|
42
|
-
className: "!cop-rounded cop-border cop-border-solid cop-py-[5px]",
|
|
42
|
+
className: "!cop-rounded cop-border cop-border-solid cop-py-[5px] cop-max-w-[200px]",
|
|
43
43
|
variant: "outlined",
|
|
44
|
+
truncate: true,
|
|
44
45
|
onClose: handleRemove,
|
|
45
46
|
prefixIcon: option.type === 'company' ? /*#__PURE__*/_react["default"].createElement(_Avatar.Avatar, {
|
|
46
47
|
src: (_option$avatarSrc = option.avatarSrc) !== null && _option$avatarSrc !== void 0 ? _option$avatarSrc : '',
|
|
@@ -22,7 +22,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
22
22
|
_exports.UserCompanySelector = void 0;
|
|
23
23
|
_react = _interopRequireWildcard(_react);
|
|
24
24
|
_reactSelect = _interopRequireDefault(_reactSelect);
|
|
25
|
-
var _excluded = ["autoFocus", "grouped", "name", "internalUsers", "clientUsers", "companies", "onChange", "onBlur", "placeholder", "styles", "ignoreCompanies", "ignoreFilterClientsByCompany", "limitSelectedOptions", "initialValue", "customLabels", "listHeading"];
|
|
25
|
+
var _excluded = ["autoFocus", "grouped", "name", "internalUsers", "clientUsers", "companies", "onChange", "onBlur", "placeholder", "styles", "ignoreCompanies", "ignoreFilterClientsByCompany", "limitSelectedOptions", "initialValue", "customLabels", "listHeading", "listClassName"];
|
|
26
26
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
27
27
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
28
28
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
@@ -93,6 +93,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
93
93
|
initialValue = _ref.initialValue,
|
|
94
94
|
customLabels = _ref.customLabels,
|
|
95
95
|
listHeading = _ref.listHeading,
|
|
96
|
+
listClassName = _ref.listClassName,
|
|
96
97
|
others = _objectWithoutProperties(_ref, _excluded);
|
|
97
98
|
var limitSelectedOptions = limitSelectedOptionsUnvalidated === 0 ? 1000 : Math.min(1000, limitSelectedOptionsUnvalidated);
|
|
98
99
|
var companiesMap = (0, _react.useMemo)(function () {
|
|
@@ -322,7 +323,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
322
323
|
},
|
|
323
324
|
Option: function Option(props) {
|
|
324
325
|
return /*#__PURE__*/_react["default"].createElement(_ListItem.ListItem, _extends({}, props, {
|
|
325
|
-
data: getCompanyData(props.data)
|
|
326
|
+
data: getCompanyData(props.data),
|
|
327
|
+
listClassName: listClassName
|
|
326
328
|
}));
|
|
327
329
|
},
|
|
328
330
|
DropdownIndicator: function DropdownIndicator() {
|
|
@@ -345,7 +347,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
345
347
|
}));
|
|
346
348
|
}
|
|
347
349
|
};
|
|
348
|
-
}, [getCompanyData]);
|
|
350
|
+
}, [getCompanyData, listHeading, listClassName]);
|
|
349
351
|
return /*#__PURE__*/_react["default"].createElement(_reactSelect["default"], _extends({
|
|
350
352
|
autoFocus: autoFocus,
|
|
351
353
|
isMulti: true,
|
|
@@ -16,11 +16,12 @@ export interface ChipProps extends VariantProps<typeof chipStyles> {
|
|
|
16
16
|
label: string;
|
|
17
17
|
className?: string;
|
|
18
18
|
prefixIcon?: IconType | Exclude<React.ReactNode, string>;
|
|
19
|
+
truncate?: boolean;
|
|
19
20
|
onClick?: (event: React.KeyboardEvent | React.MouseEvent) => void;
|
|
20
21
|
onClose?: (event: React.KeyboardEvent | React.MouseEvent | React.TouchEvent) => void;
|
|
21
22
|
'aria-pressed'?: AriaAttributes['aria-pressed'];
|
|
22
23
|
}
|
|
23
|
-
export declare const Chip: ({ color, variant, label, size, className, prefixIcon, disabled, onClick, onClose, "aria-pressed": ariaPressed, }: ChipProps & {
|
|
24
|
+
export declare const Chip: ({ color, variant, label, size, className, prefixIcon, truncate, disabled, onClick, onClose, "aria-pressed": ariaPressed, }: ChipProps & {
|
|
24
25
|
color?: string;
|
|
25
26
|
}) => React.JSX.Element;
|
|
26
27
|
export {};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type OptionWithCompanyMetadata } from './types';
|
|
3
|
-
import { type
|
|
4
|
-
|
|
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 {};
|
|
@@ -12,6 +12,7 @@ export declare const WithSingleSelection: Story;
|
|
|
12
12
|
export declare const WithPlaceholder: Story;
|
|
13
13
|
export declare const WithAutoFocus: Story;
|
|
14
14
|
export declare const WithLongOptionLabel: Story;
|
|
15
|
+
export declare const WithLongCompanyName: Story;
|
|
15
16
|
export declare const WithCustomLabels: Story;
|
|
16
17
|
export declare const WithListHeading: Story;
|
|
17
18
|
export declare const WithAvatarFallbackColor: Story;
|