@orfium/ictinus 4.5.2 → 4.8.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.
- package/dist/components/Avatar/Avatar.d.ts +1 -1
- package/dist/components/Avatar/Avatar.js +17 -1
- package/dist/components/Avatar/Avatar.style.js +7 -1
- package/dist/components/Chip/Chip.d.ts +22 -20
- package/dist/components/Chip/Chip.js +55 -20
- package/dist/components/Chip/Chip.style.d.ts +2 -2
- package/dist/components/Chip/Chip.style.js +25 -53
- package/dist/components/Chip/components/Badge/Badge.d.ts +8 -0
- package/dist/components/Chip/components/Badge/Badge.js +31 -0
- package/dist/components/Chip/components/Badge/Badge.style.d.ts +4 -0
- package/dist/components/Chip/components/Badge/Badge.style.js +26 -0
- package/dist/components/Chip/components/Badge/index.d.ts +1 -0
- package/dist/components/Chip/components/Badge/index.js +10 -0
- package/dist/components/Table/Table.d.ts +4 -1
- package/dist/components/Table/Table.js +4 -2
- package/dist/components/Table/TableRowContext.d.ts +0 -1
- package/dist/components/Table/TableRowContext.js +0 -1
- package/dist/components/Table/components/RenderRowOrNestedRow/RenderRowOrNestedRow.js +5 -3
- package/dist/components/Table/components/RenderRowOrNestedRow/components/ContentCell/ContentCell.d.ts +2 -2
- package/dist/components/Table/components/RenderRowOrNestedRow/components/ContentCell/ContentCell.js +13 -7
- package/dist/components/Table/components/TableRowWrapper/TableRowWrapper.d.ts +0 -1
- package/dist/components/Table/components/TableRowWrapper/TableRowWrapper.js +0 -2
- package/dist/components/TruncatedContent/TruncatedContent.d.ts +11 -0
- package/dist/components/TruncatedContent/TruncatedContent.js +69 -0
- package/dist/components/TruncatedContent/TruncatedContent.style.d.ts +4 -0
- package/dist/components/TruncatedContent/TruncatedContent.style.js +26 -0
- package/dist/components/TruncatedContent/index.d.ts +1 -0
- package/dist/components/TruncatedContent/index.js +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -1
- package/dist/theme/palette.config.js +1 -1
- package/dist/theme/palette.js +2 -2
- package/dist/theme/typography.d.ts +1 -0
- package/dist/theme/typography.js +1 -0
- package/package.json +2 -1
|
@@ -23,7 +23,7 @@ export declare type Props = {
|
|
|
23
23
|
/** The class name of the avatar component if its styled **/
|
|
24
24
|
className?: string;
|
|
25
25
|
};
|
|
26
|
-
export declare type AvatarSizes = 'xxs' | 'xs' | 'sm' | 'md' | 'lg';
|
|
26
|
+
export declare type AvatarSizes = 'xxxs' | 'xxs' | 'xs' | 'sm' | 'md' | 'lg';
|
|
27
27
|
export declare type AvatarShapes = 'regular' | 'rounded' | 'circular';
|
|
28
28
|
declare const Avatar: React.ForwardRefExoticComponent<Pick<Props & DivProps, "children" | "onChange" | "onBlur" | "onClick" | "type" | "autoFocus" | "disabled" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "cite" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "data" | "dateTime" | "default" | "defer" | "download" | "encType" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "label" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "nonce" | "noValidate" | "open" | "optimum" | "pattern" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "sizes" | "span" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "summary" | "target" | "useMap" | "width" | "wmode" | "wrap" | "key" | keyof Props> & React.RefAttributes<HTMLDivElement>>;
|
|
29
29
|
export default Avatar;
|
|
@@ -17,6 +17,22 @@ var _react2 = require("@emotion/react");
|
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
19
|
|
|
20
|
+
var iconSizeBasedOnAvatar = function iconSizeBasedOnAvatar(size) {
|
|
21
|
+
switch (size) {
|
|
22
|
+
case 'xs':
|
|
23
|
+
return 18;
|
|
24
|
+
|
|
25
|
+
case 'xxs':
|
|
26
|
+
return 18;
|
|
27
|
+
|
|
28
|
+
case 'xxxs':
|
|
29
|
+
return 10;
|
|
30
|
+
|
|
31
|
+
default:
|
|
32
|
+
return 20;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
20
36
|
var Avatar = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
21
37
|
var _ref$src = _ref.src,
|
|
22
38
|
src = _ref$src === void 0 ? '' : _ref$src,
|
|
@@ -45,7 +61,7 @@ var Avatar = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
45
61
|
}), !src && !children && iconName && (0, _react2.jsx)(_Icon["default"], {
|
|
46
62
|
color: (0, _palette.pickTextColorFromSwatches)(calculatedColor.color, calculatedColor.shade),
|
|
47
63
|
name: iconName,
|
|
48
|
-
size: size
|
|
64
|
+
size: iconSizeBasedOnAvatar(size)
|
|
49
65
|
}), !src && children);
|
|
50
66
|
});
|
|
51
67
|
|
|
@@ -25,6 +25,9 @@ var sizeBasedOnProp = function sizeBasedOnProp(size) {
|
|
|
25
25
|
case 'xxs':
|
|
26
26
|
return (0, _utils.rem)(20);
|
|
27
27
|
|
|
28
|
+
case 'xxxs':
|
|
29
|
+
return (0, _utils.rem)(16);
|
|
30
|
+
|
|
28
31
|
default:
|
|
29
32
|
return (0, _utils.rem)(56);
|
|
30
33
|
}
|
|
@@ -54,6 +57,9 @@ var fontSizeBasedOnProp = function fontSizeBasedOnProp(theme, size) {
|
|
|
54
57
|
case 'xxs':
|
|
55
58
|
return theme.typography.fontSizes['11'];
|
|
56
59
|
|
|
60
|
+
case 'xxxs':
|
|
61
|
+
return theme.typography.fontSizes['8'];
|
|
62
|
+
|
|
57
63
|
default:
|
|
58
64
|
return theme.typography.fontSizes['18'];
|
|
59
65
|
}
|
|
@@ -69,7 +75,7 @@ var avatarStyle = function avatarStyle(_ref) {
|
|
|
69
75
|
/*#__PURE__*/
|
|
70
76
|
|
|
71
77
|
/*#__PURE__*/
|
|
72
|
-
(0, _react.css)(_functions.flex, ";width:", sizeBasedOnProp(size), ";height:", sizeBasedOnProp(size), ";border-radius:", shapeBasedOnProp(shape), ";background:", theme.utils.getColor(fill, fillShade), ";overflow:hidden;position:relative;font-size:", fontSizeBasedOnProp(theme, size), ";align-items:center;flex-shrink:0;line-height:1;user-select:none;justify-content:center;color:", (0, _palette.pickTextColorFromSwatches)(fill, fillShade), ";img{border-radius:100%;width:100%;height:100%;}" + (process.env.NODE_ENV === "production" ? "" : ";label:avatarStyle;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
78
|
+
(0, _react.css)(_functions.flex, ";width:", sizeBasedOnProp(size), ";height:", sizeBasedOnProp(size), ";border-radius:", shapeBasedOnProp(shape), ";background:", theme.utils.getColor(fill, fillShade), ";overflow:hidden;position:relative;font-size:", fontSizeBasedOnProp(theme, size), ";align-items:center;flex-shrink:0;line-height:1;user-select:none;justify-content:center;color:", (0, _palette.pickTextColorFromSwatches)(fill, fillShade), ";img{border-radius:100%;width:100%;height:100%;}" + (process.env.NODE_ENV === "production" ? "" : ";label:avatarStyle;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21wb25lbnRzL0F2YXRhci9BdmF0YXIuc3R5bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBNkQ2QyIsImZpbGUiOiIuLi8uLi8uLi9zcmMvY29tcG9uZW50cy9BdmF0YXIvQXZhdGFyLnN0eWxlLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgY3NzLCBTZXJpYWxpemVkU3R5bGVzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHsgcmVtIH0gZnJvbSAndGhlbWUvdXRpbHMnO1xuXG5pbXBvcnQgeyBUaGVtZSB9IGZyb20gJy4uLy4uL3RoZW1lJztcbmltcG9ydCB7IGZsZXggfSBmcm9tICcuLi8uLi90aGVtZS9mdW5jdGlvbnMnO1xuaW1wb3J0IHsgY29sb3JTaGFkZXMsIGZsYXRDb2xvcnMsIHBpY2tUZXh0Q29sb3JGcm9tU3dhdGNoZXMgfSBmcm9tICcuLi8uLi90aGVtZS9wYWxldHRlJztcbmltcG9ydCB7IEF2YXRhclNoYXBlcywgQXZhdGFyU2l6ZXMgfSBmcm9tICcuL0F2YXRhcic7XG5cbmNvbnN0IHNpemVCYXNlZE9uUHJvcCA9IChzaXplOiBBdmF0YXJTaXplcykgPT4ge1xuICBzd2l0Y2ggKHNpemUpIHtcbiAgICBjYXNlICdzbSc6XG4gICAgICByZXR1cm4gcmVtKDM2KTtcbiAgICBjYXNlICdtZCc6XG4gICAgICByZXR1cm4gcmVtKDQ2KTtcbiAgICBjYXNlICd4cyc6XG4gICAgICByZXR1cm4gcmVtKDI0KTtcbiAgICBjYXNlICd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QXZhdGFyU2hhcGVzO1xuICBzaXplOiBBdmF0YXJTaXplcztcbiAgZmlsbDogdHlwZW9mIGZsYXRDb2xvcnNbbnVtYmVyXTtcbiAgZmlsbFNoYWRlOiB0eXBlb2YgY29sb3JTaGFkZXNbbnVtYmVyXTtcbn0pID0+ICh0aGVtZTogVGhlbWUpOiBTZXJpYWxpemVkU3R5bGVzID0+IGNzc2BcbiAgJHtmbGV4fTtcbiAgd2lkdGg6ICR7c2l6ZUJhc2VkT25Qcm9wKHNpemUpfTtcbiAgaGVpZ2h0OiAke3NpemVCYXNlZE9uUHJvcChzaXplKX07XG4gIGJvcmRlci1yYWRpdXM6ICR7c2hhcGVCYXNlZE9uUHJvcChzaGFwZSl9O1xuICBiYWNrZ3JvdW5kOiAke3RoZW1lLnV0aWxzLmdldENvbG9yKGZpbGwsIGZpbGxTaGFkZSl9O1xuICBvdmVyZmxvdzogaGlkZGVuO1xuICBwb3NpdGlvbjogcmVsYXRpdmU7XG4gIGZvbnQtc2l6ZTogJHtmb250U2l6ZUJhc2VkT25Qcm9wKHRoZW1lLCBzaXplKX07XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGZsZXgtc2hyaW5rOiAwO1xuICBsaW5lLWhlaWdodDogMTtcbiAgdXNlci1zZWxlY3Q6IG5vbmU7XG4gIGp1c3RpZnktY29udGVudDogY2VudGVyO1xuICBjb2xvcjogJHtwaWNrVGV4dENvbG9yRnJvbVN3YXRjaGVzKGZpbGwsIGZpbGxTaGFkZSl9O1xuXG4gIGltZyB7XG4gICAgYm9yZGVyLXJhZGl1czogMTAwJTtcbiAgICB3aWR0aDogMTAwJTtcbiAgICBoZWlnaHQ6IDEwMCU7XG4gIH1cbmA7XG4iXX0= */", process.env.NODE_ENV === "production" ? "" : ";label:avatarStyle;")
|
|
73
79
|
);
|
|
74
80
|
};
|
|
75
81
|
};
|
|
@@ -1,32 +1,34 @@
|
|
|
1
|
+
import { ClickEvent } from 'hooks/useLoading';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
+
import { flatColors } from 'theme/palette';
|
|
3
4
|
import { TestId } from 'utils/types';
|
|
4
5
|
import { DivProps } from '../../utils/common';
|
|
5
6
|
export declare type Props = {
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
-
* @default
|
|
8
|
+
* Determines whether the chip should be read-only or interactive.
|
|
9
|
+
* @default read-only
|
|
9
10
|
*/
|
|
10
|
-
styleType?: '
|
|
11
|
-
/**
|
|
12
|
-
* @default md
|
|
13
|
-
* */
|
|
14
|
-
size?: 'md' | 'sm';
|
|
15
|
-
/** Defines the fill color of the component, if filled */
|
|
11
|
+
styleType?: 'read-only' | 'interactive';
|
|
12
|
+
/** Defines the fill color of the component, if filled. */
|
|
16
13
|
fill?: typeof flatColors[number];
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
/** An optional thumbnail to show to the left. */
|
|
15
|
+
thumbnail?: {
|
|
16
|
+
src?: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
};
|
|
19
|
+
/** Boolean defining if the chip is selected. */
|
|
20
|
+
isSelected?: boolean;
|
|
21
|
+
/** Boolean defining if the check icon is shown. */
|
|
22
|
+
isChecked?: boolean;
|
|
23
|
+
/** Defines the number value of the badge */
|
|
24
|
+
badgeNumber?: number;
|
|
25
|
+
/** Callback function for onClick. */
|
|
26
|
+
onClick?: (event: ClickEvent) => void;
|
|
27
|
+
/** A callback that is being triggered when type is interactive and you press the X icon. */
|
|
28
|
+
onClear?: () => void;
|
|
27
29
|
};
|
|
28
30
|
declare type TestProps = {
|
|
29
31
|
dataTestId?: TestId;
|
|
30
32
|
};
|
|
31
|
-
declare const Chip: React.ForwardRefExoticComponent<Pick<Props & TestProps & DivProps, "children" | "onChange" | "color" | "onBlur" | "
|
|
33
|
+
declare const Chip: React.ForwardRefExoticComponent<Pick<Props & TestProps & DivProps, "children" | "onChange" | "color" | "onBlur" | "type" | "autoFocus" | "disabled" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "cite" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "data" | "dateTime" | "default" | "defer" | "download" | "encType" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "label" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "nonce" | "noValidate" | "open" | "optimum" | "pattern" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "span" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "summary" | "target" | "useMap" | "width" | "wmode" | "wrap" | "key" | "dataTestId" | keyof Props> & React.RefAttributes<HTMLDivElement>>;
|
|
32
34
|
export default Chip;
|
|
@@ -7,44 +7,79 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
7
7
|
|
|
8
8
|
var _helpers = require("../../utils/helpers");
|
|
9
9
|
|
|
10
|
+
var _palette = require("../../theme/palette");
|
|
11
|
+
|
|
10
12
|
var _Chip = require("./Chip.style");
|
|
11
13
|
|
|
14
|
+
var _Badge = _interopRequireDefault(require("./components/Badge"));
|
|
15
|
+
|
|
16
|
+
var _Avatar = _interopRequireDefault(require("../Avatar"));
|
|
17
|
+
|
|
18
|
+
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
19
|
+
|
|
12
20
|
var _react2 = require("@emotion/react");
|
|
13
21
|
|
|
14
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
23
|
|
|
16
24
|
var Chip = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
17
25
|
var _ref$styleType = _ref.styleType,
|
|
18
|
-
styleType = _ref$styleType === void 0 ? '
|
|
19
|
-
_ref$size = _ref.size,
|
|
20
|
-
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
26
|
+
styleType = _ref$styleType === void 0 ? 'read-only' : _ref$styleType,
|
|
21
27
|
fill = _ref.fill,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
thumbnail = _ref.thumbnail,
|
|
29
|
+
isSelected = _ref.isSelected,
|
|
30
|
+
isChecked = _ref.isChecked,
|
|
31
|
+
badgeNumber = _ref.badgeNumber,
|
|
32
|
+
onClick = _ref.onClick,
|
|
33
|
+
onClear = _ref.onClear,
|
|
27
34
|
_ref$dataTestId = _ref.dataTestId,
|
|
28
35
|
dataTestId = _ref$dataTestId === void 0 ? '' : _ref$dataTestId,
|
|
29
36
|
children = _ref.children;
|
|
37
|
+
|
|
38
|
+
if (styleType === 'read-only' && (isSelected || isChecked || badgeNumber)) {
|
|
39
|
+
throw new Error('The properties isSelected, isChecked and badgeNumber are only for Interactive style type Chips.');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (styleType === 'interactive' && thumbnail) {
|
|
43
|
+
throw new Error('The property thumbnail is only for Read-Only style type Chips.');
|
|
44
|
+
}
|
|
45
|
+
|
|
30
46
|
return (0, _react2.jsx)("div", {
|
|
31
47
|
ref: ref,
|
|
32
48
|
"data-testid": (0, _helpers.generateTestDataId)('chip', dataTestId),
|
|
33
|
-
|
|
49
|
+
onClick: onClick,
|
|
50
|
+
css: (0, _Chip.chipStyle)({
|
|
34
51
|
styleType: styleType,
|
|
35
|
-
size: size,
|
|
36
52
|
fill: fill,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
53
|
+
isSelected: isSelected,
|
|
54
|
+
onClear: onClear,
|
|
55
|
+
onClick: onClick
|
|
40
56
|
})
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
}, isChecked && (0, _react2.jsx)(_Icon["default"], {
|
|
58
|
+
size: 14,
|
|
59
|
+
name: 'checkmark',
|
|
60
|
+
color: 'darkGrey',
|
|
61
|
+
variant: 850
|
|
62
|
+
}), thumbnail && (0, _react2.jsx)("div", null, (0, _react2.jsx)(_Avatar["default"], {
|
|
63
|
+
size: 'xxxs',
|
|
64
|
+
color: fill + "-" + _palette.BASE_SHADE,
|
|
65
|
+
src: thumbnail.src
|
|
66
|
+
}, thumbnail.name)), (0, _react2.jsx)("div", null, children), badgeNumber && (0, _react2.jsx)(_Badge["default"], {
|
|
67
|
+
fill: fill,
|
|
68
|
+
badgeNumber: badgeNumber,
|
|
69
|
+
isSelected: isSelected,
|
|
70
|
+
dataTestId: dataTestId
|
|
71
|
+
}), onClear && (0, _react2.jsx)("div", {
|
|
72
|
+
css: (0, _Chip.closeIconWrapperStyle)()
|
|
73
|
+
}, (0, _react2.jsx)(_Icon["default"], {
|
|
74
|
+
size: 14,
|
|
75
|
+
name: 'close',
|
|
76
|
+
color: 'darkGrey',
|
|
77
|
+
variant: 850,
|
|
78
|
+
onClick: function onClick(e) {
|
|
79
|
+
e.stopPropagation();
|
|
80
|
+
onClear();
|
|
81
|
+
}
|
|
82
|
+
})));
|
|
48
83
|
});
|
|
49
84
|
|
|
50
85
|
Chip.displayName = 'Chip';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SerializedStyles } from '@emotion/react';
|
|
2
2
|
import { Theme } from '../../theme';
|
|
3
3
|
import { Props } from './Chip';
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
4
|
+
export declare const chipStyle: ({ styleType, fill, isSelected, onClear, onClick, }: Props) => (theme: Theme) => SerializedStyles;
|
|
5
|
+
export declare const closeIconWrapperStyle: () => () => SerializedStyles;
|
|
@@ -1,77 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.
|
|
4
|
+
exports.closeIconWrapperStyle = exports.chipStyle = void 0;
|
|
5
5
|
|
|
6
6
|
var _react = require("@emotion/react");
|
|
7
7
|
|
|
8
|
-
var _polished = require("polished");
|
|
9
|
-
|
|
10
8
|
var _functions = require("../../theme/functions");
|
|
11
9
|
|
|
12
|
-
var _palette = require("../../theme/palette");
|
|
13
|
-
|
|
14
10
|
var _utils = require("../../theme/utils");
|
|
15
11
|
|
|
16
|
-
|
|
17
|
-
* These sizes are specific to this component thus these are placed here and not in the config **/
|
|
18
|
-
var styleBasedOnSize = function styleBasedOnSize(theme, size, leftIcon, rightIcon) {
|
|
19
|
-
var hasIcon = leftIcon !== undefined || rightIcon !== undefined;
|
|
20
|
-
|
|
21
|
-
switch (size) {
|
|
22
|
-
case 'sm':
|
|
23
|
-
return "\n height: " + (0, _utils.rem)(20) + ";\n border-radius: " + (0, _utils.rem)(16.5) + ";\n font-size: " + theme.typography.fontSizes['10'] + ";\n ";
|
|
24
|
-
|
|
25
|
-
default:
|
|
26
|
-
return "\n height: " + (0, _utils.rem)(24) + ";\n border-radius: " + (0, _utils.rem)(12.5) + ";\n font-size: " + theme.typography.fontSizes['12'] + ";\n ";
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
var wrapperStyleSwitch = function wrapperStyleSwitch(theme, styleType, fill, shade) {
|
|
31
|
-
if (shade === void 0) {
|
|
32
|
-
shade = _palette.BASE_SHADE;
|
|
33
|
-
}
|
|
12
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
34
13
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
case 'filled':
|
|
44
|
-
default:
|
|
45
|
-
return "\n background-color: " + (fill ? theme.utils.getColor(fill, shade) : theme.utils.getColor('lightGrey', 50)) + ";\n color: " + (fill ? (0, _palette.pickTextColorFromSwatches)(fill, shade) : '#232323') + ";\n border: " + (0, _utils.rem)(1) + " solid " + (fill ? theme.utils.getColor(fill, shade) : theme.utils.getColor('lightGrey', 50)) + ";\n ";
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
var wrapperStyle = function wrapperStyle(_ref) {
|
|
50
|
-
var styleType = _ref.styleType,
|
|
51
|
-
size = _ref.size,
|
|
52
|
-
fill = _ref.fill,
|
|
53
|
-
shade = _ref.shade,
|
|
54
|
-
leftIcon = _ref.leftIcon,
|
|
55
|
-
rightIcon = _ref.rightIcon;
|
|
14
|
+
var chipStyle = function chipStyle(_ref2) {
|
|
15
|
+
var styleType = _ref2.styleType,
|
|
16
|
+
_ref2$fill = _ref2.fill,
|
|
17
|
+
fill = _ref2$fill === void 0 ? 'greyScale' : _ref2$fill,
|
|
18
|
+
isSelected = _ref2.isSelected,
|
|
19
|
+
onClear = _ref2.onClear,
|
|
20
|
+
onClick = _ref2.onClick;
|
|
56
21
|
return function (theme) {
|
|
57
22
|
return (
|
|
58
23
|
/*#__PURE__*/
|
|
59
24
|
|
|
60
25
|
/*#__PURE__*/
|
|
61
|
-
(0, _react.css)(_functions.flexCenterVertical, ";",
|
|
26
|
+
(0, _react.css)(_functions.flexCenterVertical, ";height:", theme.spacing.lg, ";border-radius:", theme.spacing.lg, ";font-size:", theme.typography.fontSizes['12'], ";font-weight:", theme.typography.weights.medium, ";line-height:normal;box-sizing:border-box;padding:", theme.spacing.xsm, " ", theme.spacing.sm, ";background-color:", styleType === 'read-only' || onClear || isSelected ? theme.utils.getColor(fill, 50) : theme.palette.white, ";color:", theme.utils.getColor('darkGrey', 850), ";border:", (0, _utils.rem)(1), " solid ", styleType === 'read-only' || onClear || isSelected ? theme.utils.getColor(fill, 550) : theme.utils.getColor('lightGrey', 200), ";cursor:", onClick ? 'pointer' : 'auto', ";width:fit-content;transition:background-color 150ms linear;&:hover{background:", styleType === 'read-only' || onClear || isSelected ? theme.utils.getColor(fill, 100) : theme.utils.getColor('lightGrey', null, 'pale'), ";}>:not(:last-child){margin-right:", theme.spacing.xsm, ";}" + (process.env.NODE_ENV === "production" ? "" : ";label:chipStyle;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21wb25lbnRzL0NoaXAvQ2hpcC5zdHlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFhb0QiLCJmaWxlIjoiLi4vLi4vLi4vc3JjL2NvbXBvbmVudHMvQ2hpcC9DaGlwLnN0eWxlLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgY3NzLCBTZXJpYWxpemVkU3R5bGVzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHsgZmxleENlbnRlclZlcnRpY2FsIH0gZnJvbSAndGhlbWUvZnVuY3Rpb25zJztcbmltc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yZWFkLW9ubHknIHx8IG9uQ2xlYXIgfHwgaXNTZWxlY3RlZFxuICAgICAgPyB0aGVtZS51dGlscy5nZXRDb2xvcihmaWxsLCA1NTApXG4gICAgICA6IHRoZW1lLnV0aWxzLmdldENvbG9yKCdsaWdodEdyZXknLCAyMDApfTtcbiAgY3Vyc29yOiAke29uQ2xpY2sgPyAncG9pbnRlcicgOiAnYXV0byd9O1xuICB3aWR0aDogZml0LWNvbnRlbnQ7XG4gIHRyYW5zaXRpb246IGJhY2tncm91bmQtY29sb3IgMTUwbXMgbGluZWFyO1xuXG4gICY6aG92ZXIge1xuICAgIGJhY2tncm91bmQ6ICR7c3R5bGVUeXBlID09PSAncmVhZC1vbmx5JyB8fCBvbkNsZWFyIHx8IGlzU2VsZWN0ZWRcbiAgICAgID8gdGhlbWUudXRpbHMuZ2V0Q29sb3IoZmlsbCwgMTAwKVxuICAgICAgOiB0aGVtZS51dGlscy5nZXRDb2xvcignbGlnaHRHcmV5JywgbnVsbCwgJ3BhbGUnKX07XG4gIH1cblxuICA+IDpub3QoOmxhc3QtY2hpbGQpIHtcbiAgICBtYXJnaW4tcmlnaHQ6ICR7dGhlbWUuc3BhY2luZy54c219O1xuICB9XG5gO1xuXG5leHBvcnQgY29uc3QgY2xvc2VJY29uV3JhcHBlclN0eWxlID0gKCkgPT4gKCk6IFNlcmlhbGl6ZWRTdHlsZXMgPT4gY3NzYFxuICBjdXJzb3I6IHBvaW50ZXI7XG5gO1xuIl19 */", process.env.NODE_ENV === "production" ? "" : ";label:chipStyle;")
|
|
62
27
|
);
|
|
63
28
|
};
|
|
64
29
|
};
|
|
65
30
|
|
|
66
|
-
exports.
|
|
31
|
+
exports.chipStyle = chipStyle;
|
|
67
32
|
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
33
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
34
|
+
name: "e0dnmk",
|
|
35
|
+
styles: "cursor:pointer"
|
|
36
|
+
} : {
|
|
37
|
+
name: "uvczt0-closeIconWrapperStyle",
|
|
38
|
+
styles: "cursor:pointer;label:closeIconWrapperStyle;",
|
|
39
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21wb25lbnRzL0NoaXAvQ2hpcC5zdHlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE2Q3NFIiwiZmlsZSI6Ii4uLy4uLy4uL3NyYy9jb21wb25lbnRzL0NoaXAvQ2hpcC5zdHlsZS50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcywgU2VyaWFsaXplZFN0eWxlcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcbmltcG9ydCB7IGZsZXhDZW50ZXJWZXJ0aWNhbCB9IGZyb20gJ3RoZW1lL2Z1bmN0aW9ucyc7XG5pbXBvcnQgeyByZW0gfSBmcm9tICd0aGVtZS91dGlscyc7XG5cbmltcG9ydCB7IFRoZW1lIH0gZnJvbSAnLi4vLi4vdGhlbWUnO1xuaW1wb3J0IHsgUHJvcHMgfSBmcm9tICcuL0NoaXAnO1xuXG5leHBvcnQgY29uc3QgY2hpcFN0eWxlID0gKHtcbiAgc3R5bGVUeXBlLFxuICBmaWxsID0gJ2dyZXlTY2FsZScsXG4gIGlzU2VsZWN0ZWQsXG4gIG9uQ2xlYXIsXG4gIG9uQ2xpY2ssXG59OiBQcm9wcykgPT4gKHRoZW1lOiBUaGVtZSk6IFNlcmlhbGl6ZWRTdHlsZXMgPT4gY3NzYFxuICAke2ZsZXhDZW50ZXJWZXJ0aWNhbH07XG4gIGhlaWdodDogJHt0aGVtZS5zcGFjaW5nLmxnfTtcbiAgYm9yZGVyLXJhZGl1czogJHt0aGVtZS5zcGFjaW5nLmxnfTtcbiAgZm9udC1zaXplOiAke3RoZW1lLnR5cG9ncmFwaHkuZm9udFNpemVzWycxMiddfTtcbiAgZm9udC13ZWlnaH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G5cbiAgPiA6bm90KDpsYXN0LWNoaWxkKSB7XG4gICAgbWFyZ2luLXJpZ2h0OiAke3RoZW1lLnNwYWNpbmcueHNtfTtcbiAgfVxuYDtcblxuZXhwb3J0IGNvbnN0IGNsb3NlSWNvbldyYXBwZXJTdHlsZSA9ICgpID0+ICgpOiBTZXJpYWxpemVkU3R5bGVzID0+IGNzc2BcbiAgY3Vyc29yOiBwb2ludGVyO1xuYDtcbiJdfQ== */",
|
|
40
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
41
|
+
};
|
|
71
42
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
43
|
+
var closeIconWrapperStyle = function closeIconWrapperStyle() {
|
|
44
|
+
return function () {
|
|
45
|
+
return _ref;
|
|
46
|
+
};
|
|
75
47
|
};
|
|
76
48
|
|
|
77
|
-
exports.
|
|
49
|
+
exports.closeIconWrapperStyle = closeIconWrapperStyle;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
|
|
8
|
+
var _helpers = require("../../../../utils/helpers");
|
|
9
|
+
|
|
10
|
+
var _Badge = require("./Badge.style");
|
|
11
|
+
|
|
12
|
+
var _react2 = require("@emotion/react");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
|
|
16
|
+
var Badge = function Badge(_ref) {
|
|
17
|
+
var fill = _ref.fill,
|
|
18
|
+
isSelected = _ref.isSelected,
|
|
19
|
+
badgeNumber = _ref.badgeNumber,
|
|
20
|
+
dataTestId = _ref.dataTestId;
|
|
21
|
+
return (0, _react2.jsx)("div", {
|
|
22
|
+
"data-testid": (0, _helpers.generateTestDataId)('badge', dataTestId),
|
|
23
|
+
css: (0, _Badge.badgeStyle)({
|
|
24
|
+
fill: fill,
|
|
25
|
+
isSelected: isSelected
|
|
26
|
+
})
|
|
27
|
+
}, badgeNumber);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var _default = Badge;
|
|
31
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.badgeStyle = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = require("@emotion/react");
|
|
7
|
+
|
|
8
|
+
var _functions = require("../../../../theme/functions");
|
|
9
|
+
|
|
10
|
+
var _palette = require("../../../../theme/palette");
|
|
11
|
+
|
|
12
|
+
var badgeStyle = function badgeStyle(_ref) {
|
|
13
|
+
var _ref$fill = _ref.fill,
|
|
14
|
+
fill = _ref$fill === void 0 ? 'greyScale' : _ref$fill,
|
|
15
|
+
isSelected = _ref.isSelected;
|
|
16
|
+
return function (theme) {
|
|
17
|
+
return (
|
|
18
|
+
/*#__PURE__*/
|
|
19
|
+
|
|
20
|
+
/*#__PURE__*/
|
|
21
|
+
(0, _react.css)(_functions.flex, ";width:", theme.spacing.md, ";height:", theme.spacing.md, ";border-radius:100%;background:", isSelected ? theme.utils.getColor(fill, 550) : theme.utils.getColor('lightGrey', 200), ";font-size:", theme.typography.fontSizes['10'], ";font-weight:", theme.typography.weights.medium, ";align-items:center;flex-shrink:0;line-height:normal;justify-content:center;color:", isSelected ? (0, _palette.pickTextColorFromSwatches)(fill, 550) : (0, _palette.pickTextColorFromSwatches)('lightGrey', 200), ";" + (process.env.NODE_ENV === "production" ? "" : ";label:badgeStyle;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL0NoaXAvY29tcG9uZW50cy9CYWRnZS9CYWRnZS5zdHlsZS50cyJdLCJuYW1lcyI6W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O1xuICBmbGV4LXNocmluazogMDtcbiAgbGluZS1oZWlnaHQ6IG5vcm1hbDtcbiAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7XG4gIGNvbG9yOiAke2lzU2VsZWN0ZWRcbiAgICA/IHBpY2tUZXh0Q29sb3JGcm9tU3dhdGNoZXMoZmlsbCwgNTUwKVxuICAgIDogcGlja1RleHRDb2xvckZyb21Td2F0Y2hlcygnbGlnaHRHcmV5JywgMjAwKX07XG5gO1xuIl19 */", process.env.NODE_ENV === "production" ? "" : ";label:badgeStyle;")
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.badgeStyle = badgeStyle;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Badge';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
|
|
6
|
+
var _Badge = _interopRequireDefault(require("./Badge"));
|
|
7
|
+
|
|
8
|
+
exports["default"] = _Badge["default"];
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -3,6 +3,8 @@ import { ExtendedColumn, Sort, SortingOrder } from './types';
|
|
|
3
3
|
export declare type ContentComponent<T> = (data: Cell<T>) => React.Component | JSX.Element;
|
|
4
4
|
export declare type Cell<T> = {
|
|
5
5
|
content: number | string | ContentComponent<T>;
|
|
6
|
+
tooltipContent?: string;
|
|
7
|
+
hasTruncatedTooltip?: boolean;
|
|
6
8
|
colSpan?: number;
|
|
7
9
|
type?: 'financial' | 'normal';
|
|
8
10
|
align?: 'left' | 'right';
|
|
@@ -51,4 +53,5 @@ declare type Props<T> = {
|
|
|
51
53
|
dataTestIdPrefix?: string;
|
|
52
54
|
};
|
|
53
55
|
declare function Table<T>({ data, columns, type, fixedHeader, fixedCTA, onCheck, padded, onSort, initialSort, sortDir, topLeftText, topRightArea, actionWidth, dataTestIdPrefix, }: Props<T>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
54
|
-
|
|
56
|
+
declare const _default: React.MemoExoticComponent<typeof Table>;
|
|
57
|
+
export default _default;
|
|
@@ -11,6 +11,8 @@ var _pluralize = _interopRequireDefault(require("pluralize"));
|
|
|
11
11
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
|
|
14
|
+
var _reactFastCompare = _interopRequireDefault(require("react-fast-compare"));
|
|
15
|
+
|
|
14
16
|
var _CheckBox = _interopRequireDefault(require("../CheckBox"));
|
|
15
17
|
|
|
16
18
|
var _ExtendedColumnItem = _interopRequireDefault(require("./components/ExtendedColumnItem"));
|
|
@@ -251,7 +253,6 @@ function Table(_ref) {
|
|
|
251
253
|
fixedHeader: fixedHeader,
|
|
252
254
|
type: type,
|
|
253
255
|
columnCount: columnCount,
|
|
254
|
-
columnsHasNumberArr: columnsHasNumberArr,
|
|
255
256
|
columnsWithWidth: columnsWithWidth,
|
|
256
257
|
onSelectionChangeExist: Boolean(onCheck),
|
|
257
258
|
expanded: Boolean(row.expanded),
|
|
@@ -263,5 +264,6 @@ function Table(_ref) {
|
|
|
263
264
|
}))));
|
|
264
265
|
}
|
|
265
266
|
|
|
266
|
-
var _default = Table;
|
|
267
|
+
var _default = /*#__PURE__*/_react["default"].memo(Table, _reactFastCompare["default"]);
|
|
268
|
+
|
|
267
269
|
exports["default"] = _default;
|
|
@@ -44,7 +44,6 @@ var RenderRowWithCells = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
44
44
|
rowIndex = _ref.rowIndex;
|
|
45
45
|
|
|
46
46
|
var _React$useContext = React.useContext(_TableRowContext.TableRowContext),
|
|
47
|
-
columnsHasNumberArr = _React$useContext.columnsHasNumberArr,
|
|
48
47
|
columnsWithWidth = _React$useContext.columnsWithWidth,
|
|
49
48
|
onSelectionChangeExist = _React$useContext.onSelectionChangeExist,
|
|
50
49
|
padded = _React$useContext.padded,
|
|
@@ -87,17 +86,20 @@ var RenderRowWithCells = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
87
86
|
onClick: tChange
|
|
88
87
|
}))), (_row$cells2 = row.cells) == null ? void 0 : _row$cells2.map(function (_ref2, index) {
|
|
89
88
|
var content = _ref2.content,
|
|
89
|
+
tooltipContent = _ref2.tooltipContent,
|
|
90
|
+
_ref2$hasTruncatedToo = _ref2.hasTruncatedTooltip,
|
|
91
|
+
hasTruncatedTooltip = _ref2$hasTruncatedToo === void 0 ? true : _ref2$hasTruncatedToo,
|
|
90
92
|
colSpan = _ref2.colSpan,
|
|
91
93
|
cellType = _ref2.type,
|
|
92
94
|
align = _ref2.align;
|
|
93
95
|
return (0, _react2.jsx)(_ContentCell["default"], {
|
|
94
96
|
key: row.id + "-" + index,
|
|
95
97
|
cellCounter: index,
|
|
96
|
-
|
|
98
|
+
columnWidth: columnsWithWidth[index],
|
|
97
99
|
columns: columns,
|
|
100
|
+
tooltipContent: hasTruncatedTooltip ? (0, _helpers.isComponentFunctionType)(content) ? tooltipContent : tooltipContent != null ? tooltipContent : content.toString() : undefined,
|
|
98
101
|
padded: padded,
|
|
99
102
|
colSpan: colSpan,
|
|
100
|
-
columnsWithWidth: columnsWithWidth,
|
|
101
103
|
content: content,
|
|
102
104
|
cellType: cellType,
|
|
103
105
|
rowType: type,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ContentComponent, TableType } from '../../../../Table';
|
|
3
3
|
declare type Props = {
|
|
4
|
-
columnsHasNumberArr: boolean[];
|
|
5
4
|
columns: string[];
|
|
6
5
|
padded: boolean;
|
|
7
|
-
|
|
6
|
+
tooltipContent?: string;
|
|
7
|
+
columnWidth?: number;
|
|
8
8
|
content: number | string | ContentComponent<any>;
|
|
9
9
|
colSpan?: number;
|
|
10
10
|
cellType?: 'financial' | 'normal';
|
package/dist/components/Table/components/RenderRowOrNestedRow/components/ContentCell/ContentCell.js
CHANGED
|
@@ -7,6 +7,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
7
7
|
|
|
8
8
|
var _helpers = require("../../../../../../utils/helpers");
|
|
9
9
|
|
|
10
|
+
var _TruncatedContent = _interopRequireDefault(require("../../../../../TruncatedContent"));
|
|
11
|
+
|
|
10
12
|
var _TableCell = _interopRequireDefault(require("../../../TableCell"));
|
|
11
13
|
|
|
12
14
|
var _ContentCell = require("./ContentCell.style");
|
|
@@ -16,10 +18,10 @@ var _react2 = require("@emotion/react");
|
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
19
|
|
|
18
20
|
var ContentCell = function ContentCell(_ref) {
|
|
19
|
-
var
|
|
20
|
-
columns = _ref.columns,
|
|
21
|
+
var columns = _ref.columns,
|
|
21
22
|
padded = _ref.padded,
|
|
22
|
-
|
|
23
|
+
columnWidth = _ref.columnWidth,
|
|
24
|
+
tooltipContent = _ref.tooltipContent,
|
|
23
25
|
content = _ref.content,
|
|
24
26
|
colSpan = _ref.colSpan,
|
|
25
27
|
rowType = _ref.rowType,
|
|
@@ -29,24 +31,28 @@ var ContentCell = function ContentCell(_ref) {
|
|
|
29
31
|
dataTestIdPrefix = _ref.dataTestIdPrefix,
|
|
30
32
|
rowIndex = _ref.rowIndex,
|
|
31
33
|
index = _ref.index;
|
|
32
|
-
var isNumeral =
|
|
34
|
+
var isNumeral = !Number.isNaN(Number(content));
|
|
33
35
|
return (0, _react2.jsx)(_TableCell["default"], {
|
|
34
36
|
textAlign: align ? align : isNumeral ? 'right' : 'left',
|
|
35
37
|
colSpan: colSpan,
|
|
36
38
|
type: cellType,
|
|
37
39
|
padded: padded,
|
|
38
|
-
width:
|
|
40
|
+
width: columnWidth ? columnWidth + "%" : 'initial',
|
|
39
41
|
dataTestIdPrefix: dataTestIdPrefix,
|
|
40
42
|
rowIndex: rowIndex,
|
|
41
43
|
index: index
|
|
42
44
|
}, rowType === 'nested-header' && (0, _react2.jsx)("div", {
|
|
43
45
|
css: (0, _ContentCell.nestedHeaderStyle)()
|
|
44
|
-
}, columns[cellCounter]), (0,
|
|
46
|
+
}, columns[cellCounter]), (0, _react2.jsx)(_TruncatedContent["default"], {
|
|
47
|
+
placement: 'bottom',
|
|
48
|
+
shouldAlwaysShow: (0, _helpers.isComponentFunctionType)(content) && !!tooltipContent,
|
|
49
|
+
tooltipContent: tooltipContent
|
|
50
|
+
}, (0, _helpers.isComponentFunctionType)(content) ? content({
|
|
45
51
|
content: content,
|
|
46
52
|
colSpan: colSpan
|
|
47
53
|
}) : (0, _react2.jsx)("span", {
|
|
48
54
|
"data-column": columns[cellCounter]
|
|
49
|
-
}, content));
|
|
55
|
+
}, content)));
|
|
50
56
|
};
|
|
51
57
|
|
|
52
58
|
var _default = /*#__PURE__*/_react["default"].memo(ContentCell);
|
|
@@ -21,7 +21,6 @@ var TableRowWrapper = function TableRowWrapper(props) {
|
|
|
21
21
|
columns = props.columns,
|
|
22
22
|
fixedHeader = props.fixedHeader,
|
|
23
23
|
type = props.type,
|
|
24
|
-
columnsHasNumberArr = props.columnsHasNumberArr,
|
|
25
24
|
columnsWithWidth = props.columnsWithWidth,
|
|
26
25
|
columnCount = props.columnCount,
|
|
27
26
|
onSelectionChangeExist = props.onSelectionChangeExist,
|
|
@@ -37,7 +36,6 @@ var TableRowWrapper = function TableRowWrapper(props) {
|
|
|
37
36
|
return (0, _react2.jsx)(_TableRowContext.TableRowContext.Provider, {
|
|
38
37
|
value: {
|
|
39
38
|
row: row,
|
|
40
|
-
columnsHasNumberArr: columnsHasNumberArr,
|
|
41
39
|
columnsWithWidth: columnsWithWidth,
|
|
42
40
|
onSelectionChangeExist: onSelectionChangeExist,
|
|
43
41
|
padded: padded,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type Props = {
|
|
3
|
+
/** The content of the tooltip */
|
|
4
|
+
tooltipContent: string | undefined;
|
|
5
|
+
/** Flag for overriding other settings to always show the tooltip */
|
|
6
|
+
shouldAlwaysShow?: boolean;
|
|
7
|
+
/** The placement of the tooltip */
|
|
8
|
+
placement?: 'top' | 'bottom' | 'right' | 'left';
|
|
9
|
+
};
|
|
10
|
+
declare const TruncatedContent: React.FC<Props>;
|
|
11
|
+
export default TruncatedContent;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
7
|
+
|
|
8
|
+
var _TruncatedContent = require("./TruncatedContent.style");
|
|
9
|
+
|
|
10
|
+
var _Tooltip = _interopRequireDefault(require("../Tooltip"));
|
|
11
|
+
|
|
12
|
+
var _react2 = require("@emotion/react");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
var TruncatedContent = function TruncatedContent(_ref) {
|
|
21
|
+
var children = _ref.children,
|
|
22
|
+
_ref$shouldAlwaysShow = _ref.shouldAlwaysShow,
|
|
23
|
+
shouldAlwaysShow = _ref$shouldAlwaysShow === void 0 ? false : _ref$shouldAlwaysShow,
|
|
24
|
+
tooltipContent = _ref.tooltipContent,
|
|
25
|
+
_ref$placement = _ref.placement,
|
|
26
|
+
placement = _ref$placement === void 0 ? 'bottom' : _ref$placement;
|
|
27
|
+
|
|
28
|
+
var _useState = (0, _react.useState)(false),
|
|
29
|
+
isHovered = _useState[0],
|
|
30
|
+
setIsHovered = _useState[1];
|
|
31
|
+
|
|
32
|
+
var targetRef = (0, _react.useRef)(null);
|
|
33
|
+
var target = targetRef.current;
|
|
34
|
+
var handleMouseEnter = (0, _react.useCallback)(function () {
|
|
35
|
+
setIsHovered(true);
|
|
36
|
+
}, []);
|
|
37
|
+
var handleMouseLeave = (0, _react.useCallback)(function () {
|
|
38
|
+
setIsHovered(false);
|
|
39
|
+
}, []);
|
|
40
|
+
var isTruncated = (0, _react.useMemo)(function () {
|
|
41
|
+
return !!target && target.scrollWidth > target.offsetWidth;
|
|
42
|
+
}, [target]);
|
|
43
|
+
var showTooltip = (0, _react.useCallback)(function (tooltipContent, isHovered, isTruncated, shouldAlwaysShow) {
|
|
44
|
+
if (tooltipContent === undefined) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (shouldAlwaysShow) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return isHovered && isTruncated;
|
|
53
|
+
}, []);
|
|
54
|
+
return showTooltip(tooltipContent, isHovered, isTruncated, shouldAlwaysShow) ? (0, _react2.jsx)(_Tooltip["default"], {
|
|
55
|
+
placement: placement,
|
|
56
|
+
content: tooltipContent
|
|
57
|
+
}, (0, _react2.jsx)(_TruncatedContent.TruncationDiv, {
|
|
58
|
+
ref: targetRef,
|
|
59
|
+
onMouseEnter: handleMouseEnter,
|
|
60
|
+
onMouseLeave: handleMouseLeave
|
|
61
|
+
}, children)) : (0, _react2.jsx)(_TruncatedContent.TruncationDiv, {
|
|
62
|
+
ref: targetRef,
|
|
63
|
+
onMouseEnter: handleMouseEnter,
|
|
64
|
+
onMouseLeave: handleMouseLeave
|
|
65
|
+
}, children);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
var _default = TruncatedContent;
|
|
69
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const TruncationDiv: import("@emotion/styled").StyledComponent<{
|
|
2
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
3
|
+
as?: import("react").ElementType<any> | undefined;
|
|
4
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.TruncationDiv = void 0;
|
|
5
|
+
|
|
6
|
+
var _base = _interopRequireDefault(require("@emotion/styled/base"));
|
|
7
|
+
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
+
|
|
10
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
11
|
+
|
|
12
|
+
var TruncationDiv = (0, _base["default"])("div", process.env.NODE_ENV === "production" ? {
|
|
13
|
+
target: "ep8j7z50"
|
|
14
|
+
} : {
|
|
15
|
+
target: "ep8j7z50",
|
|
16
|
+
label: "TruncationDiv"
|
|
17
|
+
})(process.env.NODE_ENV === "production" ? {
|
|
18
|
+
name: "1h52dri",
|
|
19
|
+
styles: "overflow:hidden;text-overflow:ellipsis;white-space:nowrap"
|
|
20
|
+
} : {
|
|
21
|
+
name: "1h52dri",
|
|
22
|
+
styles: "overflow:hidden;text-overflow:ellipsis;white-space:nowrap",
|
|
23
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21wb25lbnRzL1RydW5jYXRlZENvbnRlbnQvVHJ1bmNhdGVkQ29udGVudC5zdHlsZS50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRXVDIiwiZmlsZSI6Ii4uLy4uLy4uL3NyYy9jb21wb25lbnRzL1RydW5jYXRlZENvbnRlbnQvVHJ1bmNhdGVkQ29udGVudC5zdHlsZS50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5cbmV4cG9ydCBjb25zdCBUcnVuY2F0aW9uRGl2ID0gc3R5bGVkLmRpdmBcbiAgb3ZlcmZsb3c6IGhpZGRlbjtcbiAgdGV4dC1vdmVyZmxvdzogZWxsaXBzaXM7XG4gIHdoaXRlLXNwYWNlOiBub3dyYXA7XG5gO1xuIl19 */",
|
|
24
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
25
|
+
});
|
|
26
|
+
exports.TruncationDiv = TruncationDiv;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './TruncatedContent';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
|
|
6
|
+
var _TruncatedContent = _interopRequireDefault(require("./TruncatedContent"));
|
|
7
|
+
|
|
8
|
+
exports["default"] = _TruncatedContent["default"];
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
package/dist/index.d.ts
CHANGED
|
@@ -52,5 +52,6 @@ export { default as useTheme } from './hooks/useTheme';
|
|
|
52
52
|
export { default as useBreakpoints } from './hooks/useBreakpoints';
|
|
53
53
|
export { default as useEscape } from './hooks/useEscape';
|
|
54
54
|
export { default as Filter } from './components/Filter';
|
|
55
|
+
export { default as TruncatedContent } from './components/TruncatedContent';
|
|
55
56
|
export { default as themeConfig } from './theme';
|
|
56
57
|
export { themeFunctions, palette, spacing, typography, elevation, overrides, queriesSizes, };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.typography = exports.spacing = exports.palette = exports.overrides = exports.themeFunctions = exports.elevation = exports.themeConfig = exports.Filter = exports.useEscape = exports.useBreakpoints = exports.useTheme = exports.TopNavBar = exports.Tooltip = exports.Toast = exports.ThemeProvider = exports.TextArea = exports.SearchField = exports.TextField = exports.Table = exports.Select = exports.RadioGroup = exports.Radio = exports.Pagination = exports.Snackbar = exports.Banner = exports.NotificationVisual = exports.NotificationsContainer = exports.InlineNotification = exports.Modal = exports.Menu = exports.Loader = exports.List = exports.Label = exports.IconButton = exports.Icon = exports.ExpandCollapse = exports.Drawer = exports.DatePicker = exports.Chip = exports.CheckBox = exports.DonutChart = exports.BarChart = exports.LineChart = exports.Card = exports.Button = exports.Breadcrumb = exports.Avatar = void 0;
|
|
4
|
+
exports.typography = exports.spacing = exports.palette = exports.overrides = exports.themeFunctions = exports.elevation = exports.themeConfig = exports.TruncatedContent = exports.Filter = exports.useEscape = exports.useBreakpoints = exports.useTheme = exports.TopNavBar = exports.Tooltip = exports.Toast = exports.ThemeProvider = exports.TextArea = exports.SearchField = exports.TextField = exports.Table = exports.Select = exports.RadioGroup = exports.Radio = exports.Pagination = exports.Snackbar = exports.Banner = exports.NotificationVisual = exports.NotificationsContainer = exports.InlineNotification = exports.Modal = exports.Menu = exports.Loader = exports.List = exports.Label = exports.IconButton = exports.Icon = exports.ExpandCollapse = exports.Drawer = exports.DatePicker = exports.Chip = exports.CheckBox = exports.DonutChart = exports.BarChart = exports.LineChart = exports.Card = exports.Button = exports.Breadcrumb = exports.Avatar = void 0;
|
|
5
5
|
|
|
6
6
|
var _useBreakpoints = _interopRequireWildcard(require("./hooks/useBreakpoints"));
|
|
7
7
|
|
|
@@ -188,6 +188,10 @@ var _Filter = _interopRequireDefault(require("./components/Filter"));
|
|
|
188
188
|
|
|
189
189
|
exports.Filter = _Filter["default"];
|
|
190
190
|
|
|
191
|
+
var _TruncatedContent = _interopRequireDefault(require("./components/TruncatedContent"));
|
|
192
|
+
|
|
193
|
+
exports.TruncatedContent = _TruncatedContent["default"];
|
|
194
|
+
|
|
191
195
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
192
196
|
|
|
193
197
|
exports.themeConfig = _theme["default"];
|
package/dist/theme/palette.js
CHANGED
|
@@ -62,8 +62,8 @@ var pickTextColorFromSwatches = function pickTextColorFromSwatches(color, shade)
|
|
|
62
62
|
650: ['greyScale', 'darkGrey', 'lightGrey', 'red', 'magenta', 'purple', 'darkBlue', 'blue', 'green', 'orange', 'darkOrange'],
|
|
63
63
|
600: ['greyScale', 'darkGrey', 'red', 'magenta', 'purple', 'darkBlue', 'blue', 'darkOrange'],
|
|
64
64
|
550: ['greyScale', 'darkGrey', 'red', 'magenta', 'purple', 'darkBlue', 'blue', 'darkOrange'],
|
|
65
|
-
500: ['darkGrey', 'magenta', 'purple', 'darkBlue', 'darkOrange'],
|
|
66
|
-
450: ['darkGrey', 'purple', 'darkBlue', 'darkOrange'],
|
|
65
|
+
500: ['darkGrey', 'magenta', 'purple', 'darkBlue', 'blue', 'darkOrange'],
|
|
66
|
+
450: ['darkGrey', 'purple', 'darkBlue', 'blue', 'darkOrange'],
|
|
67
67
|
400: ['darkGrey', 'darkOrange'],
|
|
68
68
|
350: ['darkGrey', 'darkOrange']
|
|
69
69
|
};
|
package/dist/theme/typography.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orfium/ictinus",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"license": "MIT",
|
|
@@ -97,6 +97,7 @@
|
|
|
97
97
|
"lodash": "^4.17.19",
|
|
98
98
|
"pluralize": "^8.0.0",
|
|
99
99
|
"polished": "^3.4.4",
|
|
100
|
+
"react-fast-compare": "^3.2.0",
|
|
100
101
|
"react-highlight-words": "^0.17.0",
|
|
101
102
|
"react-media": "^2.0.0-rc.1",
|
|
102
103
|
"react-window": "^1.8.6",
|