@assembly-js/design-system 3.1.9 → 3.1.11
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/common/utils.js +1 -24
- package/dist/esm/components/Chip/Chip.js +7 -9
- package/dist/esm/components/Icon.js +2 -10
- package/dist/esm/components/UserCompanySelector/ListItem.js +2 -2
- package/dist/esm/components/UserCompanySelector/SelectedValueChip.js +2 -1
- package/dist/esm/components/__tests__/Icon.test.js +82 -0
- package/dist/esm/components/iconType.js +21 -0
- package/dist/esm/types/components/Avatar/Avatar.d.ts +2 -2
- package/dist/esm/types/components/Chip/Chip.d.ts +2 -1
- package/dist/esm/types/components/Icon.d.ts +2 -3
- package/dist/esm/types/components/UserCompanySelector/UserCompanySelector.stories.d.ts +1 -0
- package/dist/esm/types/components/__tests__/Icon.test.d.ts +1 -0
- package/dist/esm/types/components/iconType.d.ts +5 -0
- package/dist/esm/types/tsconfig.tsbuildinfo +1 -1
- package/dist/styles/main.css +1 -1
- package/dist/types/components/Avatar/Avatar.d.ts +2 -2
- package/dist/types/components/Chip/Chip.d.ts +2 -1
- package/dist/types/components/Icon.d.ts +2 -3
- package/dist/types/components/UserCompanySelector/UserCompanySelector.stories.d.ts +1 -0
- package/dist/types/components/__tests__/Icon.test.d.ts +1 -0
- package/dist/types/components/iconType.d.ts +5 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/umd/common/utils.js +1 -24
- package/dist/umd/components/Chip/Chip.js +10 -13
- package/dist/umd/components/Icon.js +11 -15
- package/dist/umd/components/UserCompanySelector/ListItem.js +2 -2
- package/dist/umd/components/UserCompanySelector/SelectedValueChip.js +2 -1
- package/dist/umd/components/__tests__/Icon.test.js +98 -0
- package/dist/umd/components/iconType.js +43 -0
- package/dist/umd/types/components/Avatar/Avatar.d.ts +2 -2
- package/dist/umd/types/components/Chip/Chip.d.ts +2 -1
- package/dist/umd/types/components/Icon.d.ts +2 -3
- package/dist/umd/types/components/UserCompanySelector/UserCompanySelector.stories.d.ts +1 -0
- package/dist/umd/types/components/__tests__/Icon.test.d.ts +1 -0
- package/dist/umd/types/components/iconType.d.ts +5 -0
- package/dist/umd/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/umd/common/utils.js
CHANGED
|
@@ -20,31 +20,8 @@
|
|
|
20
20
|
_exports.cn = cn;
|
|
21
21
|
_exports.ensureUnreachable = ensureUnreachable;
|
|
22
22
|
_exports.getInitials = getInitials;
|
|
23
|
-
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); }
|
|
24
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
25
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
26
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
27
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
28
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
29
|
-
var COP_PREFIX = 'cop-';
|
|
30
|
-
function stripCopPrefix(_ref) {
|
|
31
|
-
var className = _ref.className,
|
|
32
|
-
parseClassName = _ref.parseClassName;
|
|
33
|
-
var parsed = parseClassName(className);
|
|
34
|
-
if (parsed.baseClassName.startsWith(COP_PREFIX)) {
|
|
35
|
-
return _objectSpread(_objectSpread({}, parsed), {}, {
|
|
36
|
-
baseClassName: parsed.baseClassName.slice(COP_PREFIX.length)
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
return parsed;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// `prefix: 'cop-'` was replaced with a custom parser because the built-in
|
|
43
|
-
// prefix option failed to merge mixed prefixed/non-prefixed classes correctly.
|
|
44
|
-
// `experimentalParseClassName` is experimental — revisit this if upgrading
|
|
45
|
-
// tailwind-merge to a new major version.
|
|
46
23
|
var twMerge = (0, _tailwindMerge.extendTailwindMerge)({
|
|
47
|
-
|
|
24
|
+
prefix: 'cop-'
|
|
48
25
|
});
|
|
49
26
|
function cn() {
|
|
50
27
|
for (var _len = arguments.length, inputs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -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", "cva", "react", "../Typography", "../../common/utils", "../Icon", "
|
|
4
|
+
define(["exports", "cva", "react", "../Typography", "../../common/utils", "../Icon", "./ChipColorDisplay"], factory);
|
|
5
5
|
} else if (typeof exports !== "undefined") {
|
|
6
|
-
factory(exports, require("cva"), require("react"), require("../Typography"), require("../../common/utils"), require("../Icon"), require("
|
|
6
|
+
factory(exports, require("cva"), require("react"), require("../Typography"), require("../../common/utils"), require("../Icon"), require("./ChipColorDisplay"));
|
|
7
7
|
} else {
|
|
8
8
|
var mod = {
|
|
9
9
|
exports: {}
|
|
10
10
|
};
|
|
11
|
-
factory(mod.exports, global.cva, global.react, global.Typography, global.utils, global.Icon, global.
|
|
11
|
+
factory(mod.exports, global.cva, global.react, global.Typography, global.utils, global.Icon, global.ChipColorDisplay);
|
|
12
12
|
global.Chip = mod.exports;
|
|
13
13
|
}
|
|
14
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _cva, _react, _Typography, _utils, _Icon,
|
|
14
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _cva, _react, _Typography, _utils, _Icon, _ChipColorDisplay) {
|
|
15
15
|
"use strict";
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -19,9 +19,6 @@
|
|
|
19
19
|
});
|
|
20
20
|
_exports.Chip = void 0;
|
|
21
21
|
_react = _interopRequireDefault(_react);
|
|
22
|
-
icons = _interopRequireWildcard(icons);
|
|
23
|
-
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); }
|
|
24
|
-
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; }
|
|
25
22
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
26
23
|
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); }
|
|
27
24
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -29,10 +26,6 @@
|
|
|
29
26
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
30
27
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
31
28
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
32
|
-
// Type guard function to validate IconType
|
|
33
|
-
var isIconType = function isIconType(icon) {
|
|
34
|
-
return typeof icon === 'string' && Object.keys(icons).includes(icon);
|
|
35
|
-
};
|
|
36
29
|
var chipStyles = (0, _cva.cva)({
|
|
37
30
|
base: 'cop-inline-flex cop-items-center cop-justify-center cop-gap-1.5 cop-rounded-[4px] cop-border cop-border-solid cop-box-border',
|
|
38
31
|
variants: {
|
|
@@ -91,7 +84,7 @@
|
|
|
91
84
|
if (!icon) {
|
|
92
85
|
return null;
|
|
93
86
|
}
|
|
94
|
-
if (
|
|
87
|
+
if ((0, _Icon.isValidIconType)(icon)) {
|
|
95
88
|
return /*#__PURE__*/_react["default"].createElement(_Icon.Icon, {
|
|
96
89
|
icon: icon,
|
|
97
90
|
className: className
|
|
@@ -108,6 +101,8 @@
|
|
|
108
101
|
size = _ref2$size === void 0 ? 'sm' : _ref2$size,
|
|
109
102
|
className = _ref2.className,
|
|
110
103
|
prefixIcon = _ref2.prefixIcon,
|
|
104
|
+
_ref2$truncate = _ref2.truncate,
|
|
105
|
+
truncate = _ref2$truncate === void 0 ? false : _ref2$truncate,
|
|
111
106
|
disabled = _ref2.disabled,
|
|
112
107
|
onClick = _ref2.onClick,
|
|
113
108
|
onClose = _ref2.onClose,
|
|
@@ -144,7 +139,9 @@
|
|
|
144
139
|
})
|
|
145
140
|
}), /*#__PURE__*/_react["default"].createElement(_Typography.Body, {
|
|
146
141
|
size: size !== 'sm' ? 'base' : 'sm',
|
|
147
|
-
className:
|
|
142
|
+
className: (0, _utils.cn)('cop-m-0', {
|
|
143
|
+
'cop-truncate': truncate
|
|
144
|
+
})
|
|
148
145
|
}, label), Boolean(onClose) ?
|
|
149
146
|
/*#__PURE__*/
|
|
150
147
|
// We intentionally attach both onClick and onTouch event
|
|
@@ -2,23 +2,29 @@
|
|
|
2
2
|
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); }
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
if (typeof define === "function" && define.amd) {
|
|
5
|
-
define(["exports", "react", "../icons", "
|
|
5
|
+
define(["exports", "react", "../icons", "../constants/iconToFaMap", "./iconType"], factory);
|
|
6
6
|
} else if (typeof exports !== "undefined") {
|
|
7
|
-
factory(exports, require("react"), require("../icons"), require("
|
|
7
|
+
factory(exports, require("react"), require("../icons"), require("../constants/iconToFaMap"), require("./iconType"));
|
|
8
8
|
} else {
|
|
9
9
|
var mod = {
|
|
10
10
|
exports: {}
|
|
11
11
|
};
|
|
12
|
-
factory(mod.exports, global.react, global.icons, global.
|
|
12
|
+
factory(mod.exports, global.react, global.icons, global.iconToFaMap, global.iconType);
|
|
13
13
|
global.Icon = mod.exports;
|
|
14
14
|
}
|
|
15
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _react, icons,
|
|
15
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _react, icons, _iconToFaMap, _iconType) {
|
|
16
16
|
"use strict";
|
|
17
17
|
|
|
18
18
|
Object.defineProperty(_exports, "__esModule", {
|
|
19
19
|
value: true
|
|
20
20
|
});
|
|
21
21
|
_exports.Icon = void 0;
|
|
22
|
+
Object.defineProperty(_exports, "isValidIconType", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function get() {
|
|
25
|
+
return _iconType.isValidIconType;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
22
28
|
_react = _interopRequireDefault(_react);
|
|
23
29
|
icons = _interopRequireWildcard(icons);
|
|
24
30
|
var _excluded = ["icon"];
|
|
@@ -28,16 +34,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
28
34
|
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); }
|
|
29
35
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
30
36
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
31
|
-
var faIconMap;
|
|
32
|
-
function getFAIconMap() {
|
|
33
|
-
if (!faIconMap) {
|
|
34
|
-
faIconMap = new Map(_icons2.icons.map(function (i) {
|
|
35
|
-
return [i.name, i];
|
|
36
|
-
}));
|
|
37
|
-
}
|
|
38
|
-
return faIconMap;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
37
|
/**
|
|
42
38
|
* Icon component that renders either a Font Awesome icon or a Design System icon.
|
|
43
39
|
* it checks if the icon name is in the Font Awesome icon set and renders the corresponding icon.
|
|
@@ -52,7 +48,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
52
48
|
var mappedFaIcon = _iconToFaMap.iconToFaMap[icon];
|
|
53
49
|
|
|
54
50
|
// if the icon name has a mapped fa icon, render the mapped fa icon, otherwise render the fa icon
|
|
55
|
-
var faIcon = mappedFaIcon ? getFAIconMap().get(mappedFaIcon) : getFAIconMap().get(icon);
|
|
51
|
+
var faIcon = mappedFaIcon ? (0, _iconType.getFAIconMap)().get(mappedFaIcon) : (0, _iconType.getFAIconMap)().get(icon);
|
|
56
52
|
if (faIcon) {
|
|
57
53
|
return /*#__PURE__*/_react["default"].createElement("svg", _extends({
|
|
58
54
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -62,12 +62,12 @@
|
|
|
62
62
|
size: "sm",
|
|
63
63
|
variant: 'rounded'
|
|
64
64
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
65
|
-
className: "cop-flex cop-flex-col cop-text-[10px]"
|
|
65
|
+
className: "cop-flex cop-min-w-0 cop-flex-col cop-text-[10px]"
|
|
66
66
|
}, /*#__PURE__*/_react["default"].createElement(_Typography.Body, {
|
|
67
67
|
className: "cop-m-0 cop-truncate",
|
|
68
68
|
size: "sm"
|
|
69
69
|
}, option.label), companyName && /*#__PURE__*/_react["default"].createElement("span", {
|
|
70
|
-
className: "cop-text-secondary"
|
|
70
|
+
className: "cop-truncate cop-text-secondary"
|
|
71
71
|
}, companyName)));
|
|
72
72
|
}
|
|
73
73
|
});
|
|
@@ -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 : '',
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// This file is generated by a script. Do not edit this file directly.
|
|
2
|
+
(function (global, factory) {
|
|
3
|
+
if (typeof define === "function" && define.amd) {
|
|
4
|
+
define([], factory);
|
|
5
|
+
} else if (typeof exports !== "undefined") {
|
|
6
|
+
factory();
|
|
7
|
+
} else {
|
|
8
|
+
var mod = {
|
|
9
|
+
exports: {}
|
|
10
|
+
};
|
|
11
|
+
factory();
|
|
12
|
+
global.IconTest = mod.exports;
|
|
13
|
+
}
|
|
14
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () {
|
|
15
|
+
"use strict";
|
|
16
|
+
|
|
17
|
+
var loadIconTypeModule = function loadIconTypeModule() {
|
|
18
|
+
var module;
|
|
19
|
+
jest.isolateModules(function () {
|
|
20
|
+
jest.doMock("../../icons", function () {
|
|
21
|
+
return {
|
|
22
|
+
Close: function Close() {
|
|
23
|
+
return null;
|
|
24
|
+
},
|
|
25
|
+
Search: function Search() {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
jest.doMock("../IconPicker/icons.generated", function () {
|
|
31
|
+
return {
|
|
32
|
+
icons: [{
|
|
33
|
+
name: 'address-book',
|
|
34
|
+
viewBox: '0 0 1 1',
|
|
35
|
+
path: 'M0 0'
|
|
36
|
+
}]
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
module = require("../iconType");
|
|
40
|
+
});
|
|
41
|
+
if (!module) {
|
|
42
|
+
throw new Error('Failed to load iconType module for tests');
|
|
43
|
+
}
|
|
44
|
+
return module;
|
|
45
|
+
};
|
|
46
|
+
describe('isValidIconType', function () {
|
|
47
|
+
it('returns true for a design-system icon name', function () {
|
|
48
|
+
var _loadIconTypeModule = loadIconTypeModule(),
|
|
49
|
+
isValidIconType = _loadIconTypeModule.isValidIconType;
|
|
50
|
+
expect(isValidIconType('Close')).toBe(true);
|
|
51
|
+
});
|
|
52
|
+
it('returns true for a font-awesome icon name', function () {
|
|
53
|
+
var _loadIconTypeModule2 = loadIconTypeModule(),
|
|
54
|
+
isValidIconType = _loadIconTypeModule2.isValidIconType;
|
|
55
|
+
expect(isValidIconType('address-book')).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
it('returns false for unknown icon strings', function () {
|
|
58
|
+
var _loadIconTypeModule3 = loadIconTypeModule(),
|
|
59
|
+
isValidIconType = _loadIconTypeModule3.isValidIconType;
|
|
60
|
+
expect(isValidIconType('definitely-not-a-valid-icon')).toBe(false);
|
|
61
|
+
});
|
|
62
|
+
it('returns false for inherited prototype property names', function () {
|
|
63
|
+
var _loadIconTypeModule4 = loadIconTypeModule(),
|
|
64
|
+
isValidIconType = _loadIconTypeModule4.isValidIconType;
|
|
65
|
+
expect(isValidIconType('constructor')).toBe(false);
|
|
66
|
+
});
|
|
67
|
+
it('returns false for non-string values', function () {
|
|
68
|
+
var _loadIconTypeModule5 = loadIconTypeModule(),
|
|
69
|
+
isValidIconType = _loadIconTypeModule5.isValidIconType;
|
|
70
|
+
expect(isValidIconType(undefined)).toBe(false);
|
|
71
|
+
expect(isValidIconType(null)).toBe(false);
|
|
72
|
+
expect(isValidIconType(42)).toBe(false);
|
|
73
|
+
expect(isValidIconType({
|
|
74
|
+
icon: 'Close'
|
|
75
|
+
})).toBe(false);
|
|
76
|
+
});
|
|
77
|
+
it('builds FA icon maps from the provided source', function () {
|
|
78
|
+
var _loadIconTypeModule6 = loadIconTypeModule(),
|
|
79
|
+
getFAIconMap = _loadIconTypeModule6.getFAIconMap;
|
|
80
|
+
var initialSource = [{
|
|
81
|
+
name: 'first',
|
|
82
|
+
viewBox: '0 0 1 1',
|
|
83
|
+
path: 'M0 0'
|
|
84
|
+
}];
|
|
85
|
+
var newSource = [{
|
|
86
|
+
name: 'second',
|
|
87
|
+
viewBox: '0 0 1 1',
|
|
88
|
+
path: 'M0 0'
|
|
89
|
+
}];
|
|
90
|
+
var firstMap = getFAIconMap(initialSource);
|
|
91
|
+
expect(firstMap.has('first')).toBe(true);
|
|
92
|
+
expect(firstMap.has('second')).toBe(false);
|
|
93
|
+
var secondMap = getFAIconMap(newSource);
|
|
94
|
+
expect(secondMap.has('first')).toBe(false);
|
|
95
|
+
expect(secondMap.has('second')).toBe(true);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// This file is generated by a script. Do not edit this file directly.
|
|
2
|
+
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); }
|
|
3
|
+
(function (global, factory) {
|
|
4
|
+
if (typeof define === "function" && define.amd) {
|
|
5
|
+
define(["exports", "../icons", "./IconPicker/icons.generated"], factory);
|
|
6
|
+
} else if (typeof exports !== "undefined") {
|
|
7
|
+
factory(exports, require("../icons"), require("./IconPicker/icons.generated"));
|
|
8
|
+
} else {
|
|
9
|
+
var mod = {
|
|
10
|
+
exports: {}
|
|
11
|
+
};
|
|
12
|
+
factory(mod.exports, global.icons, global.icons);
|
|
13
|
+
global.iconType = mod.exports;
|
|
14
|
+
}
|
|
15
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, icons, _icons2) {
|
|
16
|
+
"use strict";
|
|
17
|
+
|
|
18
|
+
Object.defineProperty(_exports, "__esModule", {
|
|
19
|
+
value: true
|
|
20
|
+
});
|
|
21
|
+
_exports.isValidIconType = _exports.getFAIconMap = void 0;
|
|
22
|
+
icons = _interopRequireWildcard(icons);
|
|
23
|
+
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); }
|
|
24
|
+
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; }
|
|
25
|
+
var defaultFAIconMap = new Map(_icons2.icons.map(function (icon) {
|
|
26
|
+
return [icon.name, icon];
|
|
27
|
+
}));
|
|
28
|
+
var getFAIconMap = _exports.getFAIconMap = function getFAIconMap() {
|
|
29
|
+
var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _icons2.icons;
|
|
30
|
+
if (source === _icons2.icons) {
|
|
31
|
+
return defaultFAIconMap;
|
|
32
|
+
}
|
|
33
|
+
return new Map(source.map(function (icon) {
|
|
34
|
+
return [icon.name, icon];
|
|
35
|
+
}));
|
|
36
|
+
};
|
|
37
|
+
var isValidIconType = _exports.isValidIconType = function isValidIconType(arg) {
|
|
38
|
+
if (typeof arg !== 'string') {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
return Object.prototype.hasOwnProperty.call(icons, arg) || getFAIconMap().has(arg);
|
|
42
|
+
};
|
|
43
|
+
});
|
|
@@ -20,8 +20,8 @@ declare const Avatar: React.ForwardRefExoticComponent<({
|
|
|
20
20
|
content?: string | undefined;
|
|
21
21
|
translate?: "yes" | "no" | undefined;
|
|
22
22
|
prefix?: string | undefined;
|
|
23
|
-
className?: string | undefined;
|
|
24
23
|
children?: React.ReactNode;
|
|
24
|
+
className?: string | undefined;
|
|
25
25
|
slot?: string | undefined;
|
|
26
26
|
style?: React.CSSProperties | undefined;
|
|
27
27
|
title?: string | undefined;
|
|
@@ -299,8 +299,8 @@ declare const Avatar: React.ForwardRefExoticComponent<({
|
|
|
299
299
|
content?: string | undefined;
|
|
300
300
|
translate?: "yes" | "no" | undefined;
|
|
301
301
|
prefix?: string | undefined;
|
|
302
|
-
className?: string | undefined;
|
|
303
302
|
children?: React.ReactNode;
|
|
303
|
+
className?: string | undefined;
|
|
304
304
|
slot?: string | undefined;
|
|
305
305
|
style?: React.CSSProperties | undefined;
|
|
306
306
|
title?: string | undefined;
|
|
@@ -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,7 +1,6 @@
|
|
|
1
1
|
import type { SVGProps } from 'react';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export type IconType = keyof typeof icons | FAIconName;
|
|
2
|
+
import type { IconType } from './iconType';
|
|
3
|
+
export { type IconType, isValidIconType } from './iconType';
|
|
5
4
|
/**
|
|
6
5
|
* Icon component that renders either a Font Awesome icon or a Design System icon.
|
|
7
6
|
* it checks if the icon name is in the Font Awesome icon set and renders the corresponding icon.
|
|
@@ -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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as icons from '../icons';
|
|
2
|
+
import { type FAIcon, type FAIconName } from './IconPicker/icons.generated';
|
|
3
|
+
export type IconType = keyof typeof icons | FAIconName;
|
|
4
|
+
export declare const getFAIconMap: (source?: ReadonlyArray<FAIcon>) => Map<string, FAIcon>;
|
|
5
|
+
export declare const isValidIconType: (arg: unknown) => arg is IconType;
|