@zextras/carbonio-design-system 0.4.1 → 0.5.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/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [0.5.0](https://github.com/Zextras/carbonio-design-system/compare/v0.4.1...v0.5.0) (2022-10-14)
6
+
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * **TabBar:** removed onItemClick and defaultSelected props
11
+
12
+ ### Features
13
+
14
+ * **Modal,CustomModal:** export modal components and add onClick on content ([090ef33](https://github.com/Zextras/carbonio-design-system/commit/090ef337e9902ae790ed2eeb52fdebb59bb36c1e)), closes [#130](https://github.com/Zextras/carbonio-design-system/issues/130)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **Dropdown:** close dropdown of type contextMenu when click is on trigger component ([3367540](https://github.com/Zextras/carbonio-design-system/commit/33675405f55aac9cc966a5a000b0ba12a4f528cc)), closes [#128](https://github.com/Zextras/carbonio-design-system/issues/128)
20
+
21
+
22
+ * **TabBar:** remove TabBar uncontrolled mode ([f69777e](https://github.com/Zextras/carbonio-design-system/commit/f69777e758a1b3a1db8c3e0c26db5d6960c80c0e)), closes [#126](https://github.com/Zextras/carbonio-design-system/issues/126)
23
+
5
24
  ### [0.4.1](https://github.com/Zextras/carbonio-design-system/compare/v0.4.0...v0.4.1) (2022-09-27)
6
25
 
7
26
 
@@ -625,9 +625,9 @@ declare type CSSObject = {
625
625
  [K in keyof CSSProperties]: CSSProperties[K] | (() => NonNullable<CSSProperties[K]>);
626
626
  };
627
627
 
628
- export declare const CustomModal: React_2.ForwardRefExoticComponent<Pick<ModalProps, "open" | "background" | "maxHeight" | "zIndex" | "children" | "size" | "disablePortal" | "onClose"> & Omit<React_2.HTMLAttributes<HTMLDivElement>, keyof ModalProps> & React_2.RefAttributes<HTMLDivElement>>;
628
+ export declare const CustomModal: React_2.ForwardRefExoticComponent<PickedModal & Omit<React_2.HTMLAttributes<HTMLDivElement>, "open" | "background" | "maxHeight" | "minHeight" | "zIndex" | "title" | "children" | "size" | "disablePortal" | "onClose"> & React_2.RefAttributes<HTMLDivElement>>;
629
629
 
630
- export declare type CustomModalProps = Pick<ModalProps, 'background' | 'size' | 'open' | 'onClose' | 'zIndex' | 'maxHeight' | 'disablePortal' | 'children'> & Omit<HTMLAttributes<HTMLDivElement>, keyof ModalProps>;
630
+ export declare type CustomModalProps = PickedModal & Omit<HTMLAttributes<HTMLDivElement>, keyof PickedModal | 'title'>;
631
631
 
632
632
  export declare const DateTimePicker: React_2.ForwardRefExoticComponent<DateTimePickerProps & React_2.RefAttributes<DatePicker<never, undefined>>>;
633
633
 
@@ -1144,62 +1144,126 @@ export declare const generateColorSet: ({ regular, hover, active, disabled, focu
1144
1144
  height?: string;
1145
1145
  };
1146
1146
 
1147
- export declare const Modal: React_2.ForwardRefExoticComponent<ModalProps & React_2.RefAttributes<HTMLDivElement>>;
1147
+ export declare const Modal: React_2.ForwardRefExoticComponent<Omit<ModalFooterProps, "errorActionLabel" | "onErrorAction"> & {
1148
+ /** Modal background */
1149
+ background?: string | undefined;
1150
+ /** Modal title */
1151
+ title?: string | React_2.ReactElement<any, string | React_2.JSXElementConstructor<any>> | undefined;
1152
+ /** Modal size */
1153
+ size?: "small" | "medium" | "large" | "extrasmall" | undefined;
1154
+ /** Boolean to show the modal */
1155
+ open?: boolean | undefined;
1156
+ /** Hide the footer completely */
1157
+ hideFooter?: boolean | undefined;
1158
+ /** Show icon to close Modal */
1159
+ showCloseIcon?: boolean | undefined;
1160
+ /** Css property to handle the stack order of multiple modals */
1161
+ zIndex?: number | undefined;
1162
+ /** min height of the modal */
1163
+ minHeight?: string | undefined;
1164
+ /** max height of the modal */
1165
+ maxHeight?: string | undefined;
1166
+ /** Flag to disable the Portal implementation */
1167
+ disablePortal?: boolean | undefined;
1168
+ /** Content of the modal */
1169
+ children?: React_2.ReactNode | React_2.ReactNode[];
1170
+ /** Label for copy button in the Error Modal */
1171
+ copyLabel?: ModalFooterProps['errorActionLabel'];
1172
+ /** Close icon tooltip label */
1173
+ closeIconTooltip?: string | undefined;
1174
+ } & Omit<React_2.HTMLAttributes<HTMLDivElement>, "title"> & React_2.RefAttributes<HTMLDivElement>>;
1148
1175
 
1149
- export declare function ModalManager({ children }: ModalManagerProps): JSX.Element;
1176
+ export declare const ModalBody: StyledComponent<"div", DefaultTheme, {
1177
+ maxHeight?: string | undefined;
1178
+ centered?: boolean | undefined;
1179
+ }, never>;
1150
1180
 
1151
- export declare const ModalManagerContext: React_2.Context<CreateModalFn>;
1181
+ export declare const ModalFooter: ({ centered, confirmColor, confirmLabel, errorActionLabel, customFooter, dismissLabel, onClose, onConfirm, onErrorAction, onSecondaryAction, optionalFooter, secondaryActionLabel, type }: ModalFooterProps) => JSX.Element;
1152
1182
 
1153
- export declare interface ModalManagerProps {
1154
- children: React_2.ReactNode | React_2.ReactNode[];
1155
- }
1183
+ export declare const ModalFooterContent: React_2.VFC<ModalFooterContentProps>;
1156
1184
 
1157
- export declare interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
1158
- /** Modal background */
1159
- background?: string | keyof ThemeObj['palette'];
1185
+ export declare type ModalFooterContentProps = Omit<ModalFooterProps, 'customFooter'>;
1186
+
1187
+ export declare interface ModalFooterProps {
1160
1188
  /** Modal type */
1161
1189
  type?: 'default' | 'error';
1162
- /** Modal title */
1163
- title?: string | React_2.ReactElement;
1164
- /** Modal size */
1165
- size?: 'extrasmall' | 'small' | 'medium' | 'large';
1166
- /** Boolean to show the modal */
1167
- open?: boolean;
1168
1190
  /** Centered Modal */
1169
1191
  centered?: boolean;
1170
1192
  /** Callback for main action */
1171
1193
  onConfirm?: (event: React_2.MouseEvent<HTMLButtonElement> | KeyboardEvent) => void;
1172
1194
  /** Label for the Main action Button */
1173
1195
  confirmLabel?: string;
1196
+ /** Disabled status for main action Button */
1197
+ confirmDisabled?: boolean;
1174
1198
  /** BackgroundColor for the Main action Button */
1175
1199
  confirmColor?: string | keyof ThemeObj['palette'];
1176
1200
  /** Callback for secondary action */
1177
1201
  onSecondaryAction?: (event: React_2.MouseEvent<HTMLButtonElement> | KeyboardEvent) => void;
1178
1202
  /** Label for the Secondary action Button */
1179
1203
  secondaryActionLabel?: string;
1204
+ /** Disabled status for secondary action Button */
1205
+ secondaryActionDisabled?: boolean;
1180
1206
  /** Callback to close the Modal */
1181
1207
  onClose?: (event: React_2.MouseEvent | KeyboardEvent) => void;
1182
1208
  /** Label for the Modal close Button */
1183
1209
  dismissLabel?: string;
1184
- /** Label for copy button in the Error Modal */
1185
- copyLabel?: string;
1186
1210
  /** Optional element to show in the footer of the Modal */
1187
1211
  optionalFooter?: React_2.ReactElement;
1188
1212
  /** Prop to override the default footer buttons */
1189
1213
  customFooter?: React_2.ReactElement;
1214
+ /** Label for dismiss button in the Error Modal */
1215
+ errorActionLabel?: string;
1216
+ /** Action called on error dismiss button */
1217
+ onErrorAction?: () => void;
1218
+ }
1219
+
1220
+ export declare const ModalHeader: ({ centered, onClose, showCloseIcon, title, type, closeIconTooltip }: ModalHeaderProps) => JSX.Element;
1221
+
1222
+ export declare interface ModalHeaderProps {
1223
+ centered?: boolean | undefined;
1224
+ type?: 'default' | 'error' | undefined;
1225
+ title?: string | React_2.ReactElement | undefined;
1226
+ showCloseIcon?: boolean | undefined;
1227
+ onClose?: ((event: React_2.MouseEvent | KeyboardEvent) => void) | undefined;
1228
+ closeIconTooltip?: string;
1229
+ }
1230
+
1231
+ export declare function ModalManager({ children }: ModalManagerProps): JSX.Element;
1232
+
1233
+ export declare const ModalManagerContext: React_2.Context<CreateModalFn>;
1234
+
1235
+ export declare interface ModalManagerProps {
1236
+ children: React_2.ReactNode | React_2.ReactNode[];
1237
+ }
1238
+
1239
+ export declare type ModalProps = Omit<ModalFooterProps, 'errorActionLabel' | 'onErrorAction'> & {
1240
+ /** Modal background */
1241
+ background?: string | keyof ThemeObj['palette'];
1242
+ /** Modal title */
1243
+ title?: string | React_2.ReactElement;
1244
+ /** Modal size */
1245
+ size?: 'extrasmall' | 'small' | 'medium' | 'large';
1246
+ /** Boolean to show the modal */
1247
+ open?: boolean;
1190
1248
  /** Hide the footer completely */
1191
1249
  hideFooter?: boolean;
1192
1250
  /** Show icon to close Modal */
1193
1251
  showCloseIcon?: boolean;
1194
1252
  /** Css property to handle the stack order of multiple modals */
1195
1253
  zIndex?: number;
1196
- /** max height of the modal body */
1254
+ /** min height of the modal */
1255
+ minHeight?: string;
1256
+ /** max height of the modal */
1197
1257
  maxHeight?: string;
1198
1258
  /** Flag to disable the Portal implementation */
1199
1259
  disablePortal?: boolean;
1200
1260
  /** Content of the modal */
1201
1261
  children?: React_2.ReactNode | React_2.ReactNode[];
1202
- }
1262
+ /** Label for copy button in the Error Modal */
1263
+ copyLabel?: ModalFooterProps['errorActionLabel'];
1264
+ /** Close icon tooltip label */
1265
+ closeIconTooltip?: string;
1266
+ } & Omit<HTMLAttributes<HTMLDivElement>, 'title'>;
1203
1267
 
1204
1268
  export declare const MultiButton: React_2.ForwardRefExoticComponent<{
1205
1269
  /** MultiButton text */
@@ -1284,6 +1348,8 @@ export declare const generateColorSet: ({ regular, hover, active, disabled, focu
1284
1348
 
1285
1349
  export declare const PasswordInput: React_2.ForwardRefExoticComponent<InputProps & React_2.RefAttributes<HTMLDivElement>>;
1286
1350
 
1351
+ declare type PickedModal = Pick<ModalProps, 'background' | 'size' | 'open' | 'onClose' | 'zIndex' | 'minHeight' | 'maxHeight' | 'disablePortal' | 'children'>;
1352
+
1287
1353
  export declare const Popover: React_2.ForwardRefExoticComponent<PopoverProps & React_2.RefAttributes<HTMLDivElement>>;
1288
1354
 
1289
1355
  export declare interface PopoverProps extends PopperProps {
@@ -1633,16 +1699,9 @@ export declare const generateColorSet: ({ regular, hover, active, disabled, focu
1633
1699
  /** List of elements, can have extra attributes to pass down to the CustomComponent */
1634
1700
  items: Array<Item>;
1635
1701
  /** id of the selected item */
1636
- selected?: string;
1637
- /** id of the default selected item */
1638
- defaultSelected?: string;
1702
+ selected: string;
1639
1703
  /** change callback, is called with the new selected id */
1640
- onChange: (selectedId: string) => void;
1641
- /** click (or also keyboard in the default component) event,
1642
- * the selectedItemId field is added to the event object */
1643
- onItemClick: (ev: React_2.SyntheticEvent & {
1644
- selectedItemId: string;
1645
- }) => void;
1704
+ onChange: (ev: React_2.SyntheticEvent, selectedId: string) => void;
1646
1705
  /** background color of the tabBar */
1647
1706
  background: string | keyof ThemeObj['palette'];
1648
1707
  /** underline color of the selected tab */
@@ -1118,6 +1118,14 @@ var curriedSetLightness = /*#__PURE__*/curry
1118
1118
  /* ::<number | string, string, string> */
1119
1119
  (setLightness);
1120
1120
 
1121
+ /*
1122
+ * SPDX-FileCopyrightText: 2021 Zextras <https://www.zextras.com>
1123
+ *
1124
+ * SPDX-License-Identifier: AGPL-3.0-only
1125
+ */
1126
+ const DefaultFontStyles = styled.createGlobalStyle(["@font-face{font-family:'Roboto';font-style:normal;font-weight:300;src:url('roboto-v20-latin-300.eot');src:local(''),url('./fonts/roboto/roboto-v20-latin-300.eot?#iefix') format('embedded-opentype'),url('./fonts/roboto/roboto-v20-latin-300.woff2') format('woff2'),url('./fonts/roboto/roboto-v20-latin-300.woff') format('woff'),url('./fonts/roboto/roboto-v20-latin-300.ttf') format('truetype'),url('./fonts/roboto/roboto-v20-latin-300.svg#Roboto') format('svg');}@font-face{font-family:'Roboto';font-style:italic;font-weight:300;src:url('roboto-v20-latin-300italic.eot');src:local(''),url('./fonts/roboto/roboto-v20-latin-300italic.eot?#iefix') format('embedded-opentype'),url('./fonts/roboto/roboto-v20-latin-300italic.woff2') format('woff2'),url('./fonts/roboto/roboto-v20-latin-300italic.woff') format('woff'),url('./fonts/roboto/roboto-v20-latin-300italic.ttf') format('truetype'),url('./fonts/roboto/roboto-v20-latin-300italic.svg#Roboto') format('svg');}@font-face{font-family:'Roboto';font-style:normal;font-weight:400;src:url('roboto-v20-latin-regular.eot');src:local(''),url('./fonts/roboto/roboto-v20-latin-regular.eot?#iefix') format('embedded-opentype'),url('./fonts/roboto/roboto-v20-latin-regular.woff2') format('woff2'),url('./fonts/roboto/roboto-v20-latin-regular.woff') format('woff'),url('./fonts/roboto/roboto-v20-latin-regular.ttf') format('truetype'),url('./fonts/roboto/roboto-v20-latin-regular.svg#Roboto') format('svg');}@font-face{font-family:'Roboto';font-style:italic;font-weight:400;src:url('roboto-v20-latin-italic.eot');src:local(''),url('./fonts/roboto/roboto-v20-latin-italic.eot?#iefix') format('embedded-opentype'),url('./fonts/roboto/roboto-v20-latin-italic.woff2') format('woff2'),url('./fonts/roboto/roboto-v20-latin-italic.woff') format('woff'),url('./fonts/roboto/roboto-v20-latin-italic.ttf') format('truetype'),url('./fonts/roboto/roboto-v20-latin-italic.svg#Roboto') format('svg');}@font-face{font-family:'Roboto';font-style:italic;font-weight:500;src:url('roboto-v20-latin-500italic.eot');src:local(''),url('./fonts/roboto/roboto-v20-latin-500italic.eot?#iefix') format('embedded-opentype'),url('./fonts/roboto/roboto-v20-latin-500italic.woff2') format('woff2'),url('./fonts/roboto/roboto-v20-latin-500italic.woff') format('woff'),url('./fonts/roboto/roboto-v20-latin-500italic.ttf') format('truetype'),url('./fonts/roboto/roboto-v20-latin-500italic.svg#Roboto') format('svg');}@font-face{font-family:'Roboto';font-style:normal;font-weight:500;src:url('roboto-v20-latin-500.eot');src:local(''),url('./fonts/roboto/roboto-v20-latin-500.eot?#iefix') format('embedded-opentype'),url('./fonts/roboto/roboto-v20-latin-500.woff2') format('woff2'),url('./fonts/roboto/roboto-v20-latin-500.woff') format('woff'),url('./fonts/roboto/roboto-v20-latin-500.ttf') format('truetype'),url('./fonts/roboto/roboto-v20-latin-500.svg#Roboto') format('svg');}@font-face{font-family:'Roboto';font-style:italic;font-weight:700;src:url('roboto-v20-latin-700italic.eot');src:local(''),url('./fonts/roboto/roboto-v20-latin-700italic.eot?#iefix') format('embedded-opentype'),url('./fonts/roboto/roboto-v20-latin-700italic.woff2') format('woff2'),url('./fonts/roboto/roboto-v20-latin-700italic.woff') format('woff'),url('./fonts/roboto/roboto-v20-latin-700italic.ttf') format('truetype'),url('./fonts/roboto/roboto-v20-latin-700italic.svg#Roboto') format('svg');}@font-face{font-family:'Roboto';font-style:normal;font-weight:700;src:url('roboto-v20-latin-700.eot');src:local(''),url('./fonts/roboto/roboto-v20-latin-700.eot?#iefix') format('embedded-opentype'),url('./fonts/roboto/roboto-v20-latin-700.woff2') format('woff2'),url('./fonts/roboto/roboto-v20-latin-700.woff') format('woff'),url('./fonts/roboto/roboto-v20-latin-700.ttf') format('truetype'),url('./fonts/roboto/roboto-v20-latin-700.svg#Roboto') format('svg');}"]);
1127
+ var DefaultFontStyles$1 = DefaultFontStyles;
1128
+
1121
1129
  function SvgAcceptanceMeeting(props) {
1122
1130
  return /*#__PURE__*/React__namespace.createElement("svg", _extends({
1123
1131
  width: 24,
@@ -12356,14 +12364,6 @@ const Theme = {
12356
12364
  // }
12357
12365
  // });
12358
12366
 
12359
- /*
12360
- * SPDX-FileCopyrightText: 2021 Zextras <https://www.zextras.com>
12361
- *
12362
- * SPDX-License-Identifier: AGPL-3.0-only
12363
- */
12364
- const DefaultFontStyles = styled.createGlobalStyle(["@font-face{font-family:'Roboto';font-style:normal;font-weight:300;src:url('roboto-v20-latin-300.eot');src:local(''),url('./fonts/roboto/roboto-v20-latin-300.eot?#iefix') format('embedded-opentype'),url('./fonts/roboto/roboto-v20-latin-300.woff2') format('woff2'),url('./fonts/roboto/roboto-v20-latin-300.woff') format('woff'),url('./fonts/roboto/roboto-v20-latin-300.ttf') format('truetype'),url('./fonts/roboto/roboto-v20-latin-300.svg#Roboto') format('svg');}@font-face{font-family:'Roboto';font-style:italic;font-weight:300;src:url('roboto-v20-latin-300italic.eot');src:local(''),url('./fonts/roboto/roboto-v20-latin-300italic.eot?#iefix') format('embedded-opentype'),url('./fonts/roboto/roboto-v20-latin-300italic.woff2') format('woff2'),url('./fonts/roboto/roboto-v20-latin-300italic.woff') format('woff'),url('./fonts/roboto/roboto-v20-latin-300italic.ttf') format('truetype'),url('./fonts/roboto/roboto-v20-latin-300italic.svg#Roboto') format('svg');}@font-face{font-family:'Roboto';font-style:normal;font-weight:400;src:url('roboto-v20-latin-regular.eot');src:local(''),url('./fonts/roboto/roboto-v20-latin-regular.eot?#iefix') format('embedded-opentype'),url('./fonts/roboto/roboto-v20-latin-regular.woff2') format('woff2'),url('./fonts/roboto/roboto-v20-latin-regular.woff') format('woff'),url('./fonts/roboto/roboto-v20-latin-regular.ttf') format('truetype'),url('./fonts/roboto/roboto-v20-latin-regular.svg#Roboto') format('svg');}@font-face{font-family:'Roboto';font-style:italic;font-weight:400;src:url('roboto-v20-latin-italic.eot');src:local(''),url('./fonts/roboto/roboto-v20-latin-italic.eot?#iefix') format('embedded-opentype'),url('./fonts/roboto/roboto-v20-latin-italic.woff2') format('woff2'),url('./fonts/roboto/roboto-v20-latin-italic.woff') format('woff'),url('./fonts/roboto/roboto-v20-latin-italic.ttf') format('truetype'),url('./fonts/roboto/roboto-v20-latin-italic.svg#Roboto') format('svg');}@font-face{font-family:'Roboto';font-style:italic;font-weight:500;src:url('roboto-v20-latin-500italic.eot');src:local(''),url('./fonts/roboto/roboto-v20-latin-500italic.eot?#iefix') format('embedded-opentype'),url('./fonts/roboto/roboto-v20-latin-500italic.woff2') format('woff2'),url('./fonts/roboto/roboto-v20-latin-500italic.woff') format('woff'),url('./fonts/roboto/roboto-v20-latin-500italic.ttf') format('truetype'),url('./fonts/roboto/roboto-v20-latin-500italic.svg#Roboto') format('svg');}@font-face{font-family:'Roboto';font-style:normal;font-weight:500;src:url('roboto-v20-latin-500.eot');src:local(''),url('./fonts/roboto/roboto-v20-latin-500.eot?#iefix') format('embedded-opentype'),url('./fonts/roboto/roboto-v20-latin-500.woff2') format('woff2'),url('./fonts/roboto/roboto-v20-latin-500.woff') format('woff'),url('./fonts/roboto/roboto-v20-latin-500.ttf') format('truetype'),url('./fonts/roboto/roboto-v20-latin-500.svg#Roboto') format('svg');}@font-face{font-family:'Roboto';font-style:italic;font-weight:700;src:url('roboto-v20-latin-700italic.eot');src:local(''),url('./fonts/roboto/roboto-v20-latin-700italic.eot?#iefix') format('embedded-opentype'),url('./fonts/roboto/roboto-v20-latin-700italic.woff2') format('woff2'),url('./fonts/roboto/roboto-v20-latin-700italic.woff') format('woff'),url('./fonts/roboto/roboto-v20-latin-700italic.ttf') format('truetype'),url('./fonts/roboto/roboto-v20-latin-700italic.svg#Roboto') format('svg');}@font-face{font-family:'Roboto';font-style:normal;font-weight:700;src:url('roboto-v20-latin-700.eot');src:local(''),url('./fonts/roboto/roboto-v20-latin-700.eot?#iefix') format('embedded-opentype'),url('./fonts/roboto/roboto-v20-latin-700.woff2') format('woff2'),url('./fonts/roboto/roboto-v20-latin-700.woff') format('woff'),url('./fonts/roboto/roboto-v20-latin-700.ttf') format('truetype'),url('./fonts/roboto/roboto-v20-latin-700.svg#Roboto') format('svg');}"]);
12365
- var DefaultFontStyles$1 = DefaultFontStyles;
12366
-
12367
12367
  /*
12368
12368
  * SPDX-FileCopyrightText: 2021 Zextras <https://www.zextras.com>
12369
12369
  *
@@ -14762,20 +14762,27 @@ var createPopper = /*#__PURE__*/popperGenerator({
14762
14762
  *
14763
14763
  * SPDX-License-Identifier: AGPL-3.0-only
14764
14764
  */
14765
- const Portal = /*#__PURE__*/React__default["default"].forwardRef(function PortalFn(_ref, ref) {
14766
- let {
14767
- children,
14768
- container,
14769
- show = false,
14770
- disablePortal = false
14771
- } = _ref;
14772
- const {
14773
- windowObj
14774
- } = React.useContext(styled.ThemeContext);
14775
- if (!show) return null;
14776
- if (disablePortal) return children;
14777
- return /*#__PURE__*/ReactDOM__default["default"].createPortal(children, container || windowObj.document.body);
14778
- });
14765
+
14766
+ function useCombinedRefs() {
14767
+ for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
14768
+ refs[_key] = arguments[_key];
14769
+ }
14770
+
14771
+ const targetRef = React.useRef(null);
14772
+ React.useEffect(() => {
14773
+ refs.forEach(ref => {
14774
+ if (!ref) return;
14775
+
14776
+ if (typeof ref === 'function') {
14777
+ ref(targetRef.current);
14778
+ } else {
14779
+ // eslint-disable-next-line no-param-reassign
14780
+ ref.current = targetRef.current;
14781
+ }
14782
+ });
14783
+ }, [refs]);
14784
+ return targetRef;
14785
+ }
14779
14786
 
14780
14787
  const Comp$2 = styled__default["default"].div.withConfig({
14781
14788
  displayName: "Text__Comp",
@@ -14835,27 +14842,20 @@ const Text = /*#__PURE__*/React__default["default"].forwardRef(function TextFn(_
14835
14842
  *
14836
14843
  * SPDX-License-Identifier: AGPL-3.0-only
14837
14844
  */
14838
-
14839
- function useCombinedRefs() {
14840
- for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
14841
- refs[_key] = arguments[_key];
14842
- }
14843
-
14844
- const targetRef = React.useRef(null);
14845
- React.useEffect(() => {
14846
- refs.forEach(ref => {
14847
- if (!ref) return;
14848
-
14849
- if (typeof ref === 'function') {
14850
- ref(targetRef.current);
14851
- } else {
14852
- // eslint-disable-next-line no-param-reassign
14853
- ref.current = targetRef.current;
14854
- }
14855
- });
14856
- }, [refs]);
14857
- return targetRef;
14858
- }
14845
+ const Portal = /*#__PURE__*/React__default["default"].forwardRef(function PortalFn(_ref2, _ref) {
14846
+ let {
14847
+ children,
14848
+ container,
14849
+ show = false,
14850
+ disablePortal = false
14851
+ } = _ref2;
14852
+ const {
14853
+ windowObj
14854
+ } = React.useContext(styled.ThemeContext);
14855
+ if (!show) return null;
14856
+ if (disablePortal) return children;
14857
+ return /*#__PURE__*/ReactDOM__default["default"].createPortal(children, container || windowObj.document.body);
14858
+ });
14859
14859
 
14860
14860
  const TooltipWrapper = /*#__PURE__*/React__default["default"].forwardRef(function TooltipWrapperFn(_ref, ref) {
14861
14861
  let {
@@ -21805,7 +21805,7 @@ const Dropdown = /*#__PURE__*/React__default["default"].forwardRef(function Drop
21805
21805
  var _innerTriggerRef$curr, _e$composedPath;
21806
21806
 
21807
21807
  const clickedOnDropdown = dropdownRef.current && (e.target === dropdownRef.current || dropdownRef.current.contains(e.target));
21808
- const clickedOnTrigger = innerTriggerRef.current && (e.target === innerTriggerRef.current || ((_innerTriggerRef$curr = innerTriggerRef.current) === null || _innerTriggerRef$curr === void 0 ? void 0 : _innerTriggerRef$curr.contains(e.target)));
21808
+ const clickedOnTrigger = !contextMenu && innerTriggerRef.current && (e.target === innerTriggerRef.current || ((_innerTriggerRef$curr = innerTriggerRef.current) === null || _innerTriggerRef$curr === void 0 ? void 0 : _innerTriggerRef$curr.contains(e.target)));
21809
21809
 
21810
21810
  const clickedOnNestedItem = nestedDropdownsRef.current && some_1(nestedDropdownsRef.current, nestedItemRef => nestedItemRef.current && nestedItemRef.current.contains(e.target));
21811
21811
 
@@ -21813,7 +21813,7 @@ const Dropdown = /*#__PURE__*/React__default["default"].forwardRef(function Drop
21813
21813
  !find_1(((_e$composedPath = e.composedPath) === null || _e$composedPath === void 0 ? void 0 : _e$composedPath.call(e)) ?? [], el => el.hasAttribute && el.hasAttribute('data-keep-open'))) {
21814
21814
  closePopper();
21815
21815
  }
21816
- }, [closePopper, dropdownRef, innerTriggerRef]);
21816
+ }, [closePopper, contextMenu, dropdownRef, innerTriggerRef]);
21817
21817
  const onStartSentinelFocus = React.useCallback(() => {
21818
21818
  const lastChild = popperItemsRef.current && popperItemsRef.current.querySelector('div[tabindex]:last-child');
21819
21819
  lastChild && lastChild.focus();
@@ -32261,46 +32261,35 @@ const TabBar = /*#__PURE__*/React__default["default"].forwardRef(function TabBar
32261
32261
  let {
32262
32262
  items,
32263
32263
  selected,
32264
- defaultSelected,
32265
32264
  onChange,
32266
- onItemClick,
32267
32265
  background,
32268
32266
  underlineColor = 'primary',
32269
32267
  forceWidthEquallyDistributed = false,
32270
32268
  ...rest
32271
32269
  } = _ref6;
32272
- const [currentSelection, setCurrentSelection] = React.useState(defaultSelected);
32273
- React.useEffect(() => {
32274
- if (typeof selected !== 'undefined') {
32275
- setCurrentSelection(selected);
32276
- onChange(selected);
32277
- }
32278
- }, [selected, onChange]);
32279
32270
  const onItemClickCb = React.useCallback(id => ev => {
32280
- setCurrentSelection(id);
32281
- onChange(id);
32282
- onItemClick({ ...ev,
32283
- selectedItemId: id
32284
- });
32285
- }, [onChange, onItemClick]);
32271
+ onChange(ev, id);
32272
+ }, [onChange]);
32286
32273
  return /*#__PURE__*/React__default["default"].createElement(Container, _extends({
32287
32274
  ref: ref,
32288
32275
  orientation: "horizontal",
32289
32276
  background: background,
32290
32277
  mainAlignment: "flex-start"
32291
- }, rest), map_1(items, item => item.CustomComponent ? /*#__PURE__*/React__default["default"].createElement(item.CustomComponent, {
32278
+ }, rest), map_1(items, (item, index) => item.CustomComponent ? /*#__PURE__*/React__default["default"].createElement(item.CustomComponent, {
32279
+ "data-testid": `tab${index}`,
32292
32280
  key: item.id,
32293
32281
  item: item,
32294
- selected: item.id === currentSelection,
32282
+ selected: item.id === selected,
32295
32283
  onClick: onItemClickCb(item.id),
32296
32284
  tabIndex: item.disabled ? undefined : 0,
32297
32285
  background: background,
32298
32286
  underlineColor: underlineColor,
32299
32287
  forceWidthEquallyDistributed: forceWidthEquallyDistributed
32300
32288
  }) : /*#__PURE__*/React__default["default"].createElement(DefaultTabBarItem, {
32289
+ "data-testid": `tab${index}`,
32301
32290
  key: item.id,
32302
32291
  item: item,
32303
- selected: item.id === currentSelection,
32292
+ selected: item.id === selected,
32304
32293
  background: background,
32305
32294
  onClick: onItemClickCb(item.id),
32306
32295
  tabIndex: item.disabled ? undefined : 0,
@@ -32366,6 +32355,7 @@ const StyledDiv = styled__default["default"].div.withConfig({
32366
32355
  } = _ref3;
32367
32356
  return pseudoClasses(theme, active && activeBackground || selected && selectedBackground || background);
32368
32357
  });
32358
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
32369
32359
  const LIWrapper = /*#__PURE__*/React__default["default"].memo(function LIWrapperFn(_ref4) {
32370
32360
  let {
32371
32361
  item,
@@ -32417,6 +32407,7 @@ const BottomElement = _ref5 => {
32417
32407
  });
32418
32408
  };
32419
32409
 
32410
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
32420
32411
  const List = /*#__PURE__*/React__default["default"].forwardRef(function ListFn(_ref6, ref) {
32421
32412
  let {
32422
32413
  items = [],
@@ -33181,8 +33172,8 @@ function getScrollbarSize(windowObj) {
33181
33172
 
33182
33173
  const ModalContainer = styled__default["default"].div.withConfig({
33183
33174
  displayName: "ModalComponents__ModalContainer",
33184
- componentId: "sc-1qw3g1a-0"
33185
- })(["display:flex;position:fixed;top:0;bottom:0;left:0;right:0;padding:", ";background-color:rgba(0,0,0,0);opacity:0;pointer-events:none;transition:0.3s ease-out;z-index:-1;justify-content:center;align-items:center;", ";", ";"], props => `${props.theme.sizes.padding.medium} ${props.theme.sizes.padding.medium} 0`, _ref => {
33175
+ componentId: "sc-3bij4r-0"
33176
+ })(["display:flex;position:fixed;top:0;bottom:0;left:0;right:0;padding:", ";background-color:rgba(0,0,0,0);opacity:0;pointer-events:none;transition:0.3s ease-out;z-index:-1;justify-content:center;align-items:center;overflow-y:auto;", ";", ";"], props => `${props.theme.sizes.padding.medium} ${props.theme.sizes.padding.medium} 0`, _ref => {
33186
33177
  let {
33187
33178
  mounted,
33188
33179
  open,
@@ -33197,21 +33188,32 @@ const ModalContainer = styled__default["default"].div.withConfig({
33197
33188
  });
33198
33189
  const ModalWrapper = styled__default["default"].div.withConfig({
33199
33190
  displayName: "ModalComponents__ModalWrapper",
33200
- componentId: "sc-1qw3g1a-1"
33191
+ componentId: "sc-3bij4r-1"
33201
33192
  })(["max-width:100%;width:100%;margin:auto;box-sizing:border-box;pointer-events:none;"]);
33202
- const ModalContent = styled__default["default"](Container).withConfig({
33203
- displayName: "ModalComponents__ModalContent",
33204
- componentId: "sc-1qw3g1a-2"
33205
- })(["position:relative;margin:0 auto ", ";padding:32px;max-width:100%;min-width:", ";width:", ";border-radius:16px;box-shadow:0 0 4px 0 rgba(166,166,166,0.5);outline:none;pointer-events:auto;"], props => props.theme.sizes.padding.medium, _ref3 => {
33193
+ const ModalContent = styled__default["default"](Container).attrs(_ref3 => {
33206
33194
  let {
33195
+ minHeight = '250px',
33207
33196
  $size
33208
33197
  } = _ref3;
33209
- return modalMinWidth[$size];
33210
- }, _ref4 => {
33198
+ return {
33199
+ minHeight,
33200
+ maxWidth: '100%',
33201
+ minWidth: modalMinWidth[$size],
33202
+ width: modalWidth[$size],
33203
+ padding: '32px',
33204
+ mainAlignment: 'flex-start',
33205
+ crossAlignment: 'flex-start',
33206
+ height: 'auto',
33207
+ tabIndex: -1
33208
+ };
33209
+ }).withConfig({
33210
+ displayName: "ModalComponents__ModalContent",
33211
+ componentId: "sc-3bij4r-2"
33212
+ })(["position:relative;margin:0 auto ", ";border-radius:16px;box-shadow:0 0 4px 0 rgba(166,166,166,0.5);outline:none;pointer-events:auto;"], _ref4 => {
33211
33213
  let {
33212
- $size
33214
+ theme
33213
33215
  } = _ref4;
33214
- return modalWidth[$size];
33216
+ return theme.sizes.padding.medium;
33215
33217
  });
33216
33218
 
33217
33219
  const CustomModal = /*#__PURE__*/React__default["default"].forwardRef(function ModalFn(_ref, ref) {
@@ -33222,8 +33224,10 @@ const CustomModal = /*#__PURE__*/React__default["default"].forwardRef(function M
33222
33224
  onClose,
33223
33225
  children,
33224
33226
  disablePortal = false,
33225
- maxHeight = '60vh',
33227
+ minHeight,
33228
+ maxHeight,
33226
33229
  zIndex = 999,
33230
+ onClick,
33227
33231
  ...rest
33228
33232
  } = _ref;
33229
33233
  const [delayedOpen, setDelayedOpen] = React.useState(false);
@@ -33239,7 +33243,9 @@ const CustomModal = /*#__PURE__*/React__default["default"].forwardRef(function M
33239
33243
  e.stopPropagation();
33240
33244
  }
33241
33245
 
33242
- modalContentRef.current && onClose && !modalContentRef.current.contains(e.target) && onClose(e);
33246
+ if (!e.defaultPrevented && modalContentRef.current && onClose && e.target instanceof Node && !modalContentRef.current.contains(e.target)) {
33247
+ onClose(e);
33248
+ }
33243
33249
  }, [onClose]);
33244
33250
  const onStartSentinelFocus = React.useCallback(() => {
33245
33251
  if (modalContentRef.current) {
@@ -33298,7 +33304,7 @@ const CustomModal = /*#__PURE__*/React__default["default"].forwardRef(function M
33298
33304
  }, [open]);
33299
33305
  const modalWrapperClickHandler = React.useCallback(e => {
33300
33306
  if (e) {
33301
- e.stopPropagation();
33307
+ e.preventDefault();
33302
33308
  }
33303
33309
  }, []);
33304
33310
  return /*#__PURE__*/React__default["default"].createElement(Portal, {
@@ -33322,108 +33328,129 @@ const CustomModal = /*#__PURE__*/React__default["default"].forwardRef(function M
33322
33328
  }, /*#__PURE__*/React__default["default"].createElement(ModalContent, {
33323
33329
  ref: modalContentRef,
33324
33330
  background: background,
33325
- tabIndex: -1,
33326
33331
  $size: size,
33327
- crossAlignment: "flex-start",
33328
- height: "auto",
33329
- maxHeight: maxHeight
33332
+ minHeight: minHeight,
33333
+ maxHeight: maxHeight,
33334
+ onClick: onClick
33330
33335
  }, children))), /*#__PURE__*/React__default["default"].createElement("div", {
33331
33336
  tabIndex: 0,
33332
33337
  ref: endSentinelRef
33333
33338
  })));
33334
33339
  });
33335
33340
 
33336
- function copyToClipboard(node, windowObj) {
33337
- const el = windowObj.document.createElement('textarea');
33338
-
33339
- if (el && node !== null && node !== void 0 && node.textContent) {
33340
- el.value = node.textContent;
33341
- windowObj.document.body.appendChild(el);
33342
- el.select();
33343
- windowObj.document.execCommand('copy');
33344
- windowObj.document.body.removeChild(el);
33345
- }
33346
- }
33347
-
33348
- const ModalTitle = styled__default["default"](Text).withConfig({
33349
- displayName: "Modal__ModalTitle",
33350
- componentId: "sc-1lygj44-0"
33351
- })(["box-sizing:border-box;width:100%;flex-grow:1;flex-basis:0;line-height:1.5;padding:", ";", ";"], props => `${props.theme.sizes.padding.small} ${props.theme.sizes.padding.small} ${props.theme.sizes.padding.small} 0`, _ref => {
33341
+ /*
33342
+ * SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
33343
+ *
33344
+ * SPDX-License-Identifier: AGPL-3.0-only
33345
+ */
33346
+ const ModalBody = styled__default["default"].div.attrs(_ref => {
33352
33347
  let {
33353
- centered
33348
+ maxHeight,
33349
+ centered = false
33354
33350
  } = _ref;
33351
+ return {
33352
+ maxHeight,
33353
+ centered
33354
+ };
33355
+ }).withConfig({
33356
+ displayName: "ModalBody",
33357
+ componentId: "sc-17rwooa-0"
33358
+ })(["overflow-y:auto;max-height:", ";max-width:100%;box-sizing:border-box;width:100%;padding-top:", ";padding-bottom:", ";", ";&::-webkit-scrollbar{width:8px;}&::-webkit-scrollbar-track{background-color:transparent;}&::-webkit-scrollbar-thumb{background-color:", ";border-radius:4px;}flex-grow:1;"], _ref2 => {
33359
+ let {
33360
+ maxHeight
33361
+ } = _ref2;
33362
+ return maxHeight;
33363
+ }, _ref3 => {
33364
+ let {
33365
+ theme
33366
+ } = _ref3;
33367
+ return theme.sizes.padding.large;
33368
+ }, _ref4 => {
33369
+ let {
33370
+ theme
33371
+ } = _ref4;
33372
+ return theme.sizes.padding.large;
33373
+ }, _ref5 => {
33374
+ let {
33375
+ centered
33376
+ } = _ref5;
33355
33377
  return centered && styled.css(["text-align:center;"]);
33356
- });
33357
- const ModalBody = styled__default["default"].div.withConfig({
33358
- displayName: "Modal__ModalBody",
33359
- componentId: "sc-1lygj44-1"
33360
- })(["overflow-y:auto;max-height:", ";max-width:100%;box-sizing:border-box;width:100%;padding-top:", ";padding-bottom:", ";", ";&::-webkit-scrollbar{width:8px;}&::-webkit-scrollbar-track{background-color:transparent;}&::-webkit-scrollbar-thumb{background-color:", ";border-radius:4px;}"], props => props.maxHeight, props => props.theme.sizes.padding.large, props => props.theme.sizes.padding.large, props => props.centered && styled.css(["text-align:center;"]), _ref2 => {
33378
+ }, _ref6 => {
33361
33379
  let {
33362
33380
  theme
33363
- } = _ref2;
33381
+ } = _ref6;
33364
33382
  return theme.palette.gray3.regular;
33365
33383
  });
33384
+
33385
+ /*
33386
+ * SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
33387
+ *
33388
+ * SPDX-License-Identifier: AGPL-3.0-only
33389
+ */
33366
33390
  const OptionalFooterContainer = styled__default["default"](Container).withConfig({
33367
- displayName: "Modal__OptionalFooterContainer",
33368
- componentId: "sc-1lygj44-2"
33391
+ displayName: "ModalFooter__OptionalFooterContainer",
33392
+ componentId: "sc-1kmh4vg-0"
33369
33393
  })(["min-width:1px;flex-basis:auto;flex-grow:1;"]);
33370
33394
  const ButtonContainer = styled__default["default"](Container).withConfig({
33371
- displayName: "Modal__ButtonContainer",
33372
- componentId: "sc-1lygj44-3"
33373
- })(["min-width:1px;flex-basis:auto;flex-grow:1;", ""], _ref3 => {
33395
+ displayName: "ModalFooter__ButtonContainer",
33396
+ componentId: "sc-1kmh4vg-1"
33397
+ })(["min-width:1px;flex-basis:auto;flex-grow:1;", ""], _ref => {
33374
33398
  let {
33375
33399
  $pushLeftFirstChild
33376
- } = _ref3;
33400
+ } = _ref;
33377
33401
  return $pushLeftFirstChild && styled.css(["> *{&:first-child{margin-right:auto;}}"]);
33378
33402
  });
33379
33403
  const DismissButton = styled__default["default"](Button$1).withConfig({
33380
- displayName: "Modal__DismissButton",
33381
- componentId: "sc-1lygj44-4"
33404
+ displayName: "ModalFooter__DismissButton",
33405
+ componentId: "sc-1kmh4vg-2"
33382
33406
  })(["margin-right:", ";flex-basis:auto;min-width:100px;flex-shrink:1;"], props => props.theme.sizes.padding.large);
33383
33407
  const ConfirmButton = styled__default["default"](Button$1).withConfig({
33384
- displayName: "Modal__ConfirmButton",
33385
- componentId: "sc-1lygj44-5"
33408
+ displayName: "ModalFooter__ConfirmButton",
33409
+ componentId: "sc-1kmh4vg-3"
33386
33410
  })(["flex-basis:auto;min-width:100px;flex-shrink:1;"]);
33387
33411
 
33388
- const ModalFooter = _ref4 => {
33412
+ const ModalFooterContent = _ref2 => {
33389
33413
  let {
33390
33414
  type,
33391
33415
  centered,
33392
33416
  onConfirm,
33393
33417
  confirmLabel,
33418
+ confirmDisabled,
33394
33419
  confirmColor,
33395
33420
  onSecondaryAction,
33396
33421
  secondaryActionLabel,
33422
+ secondaryActionDisabled,
33397
33423
  onClose,
33398
33424
  dismissLabel,
33399
- copyLabel,
33425
+ errorActionLabel,
33400
33426
  optionalFooter,
33401
- onCopyClipboard
33402
- } = _ref4;
33427
+ onErrorAction
33428
+ } = _ref2;
33403
33429
  const secondaryButton = React.useMemo(() => {
33404
33430
  let button;
33405
33431
 
33406
- if (type === 'error') {
33432
+ if (type === 'error' && onErrorAction) {
33407
33433
  button = /*#__PURE__*/React__default["default"].createElement(DismissButton, {
33408
- onClick: onCopyClipboard,
33434
+ onClick: onErrorAction,
33409
33435
  color: "secondary",
33410
- label: copyLabel
33436
+ label: errorActionLabel
33411
33437
  });
33412
33438
  } else {
33413
- button = onSecondaryAction && secondaryActionLabel ? /*#__PURE__*/React__default["default"].createElement(DismissButton, {
33439
+ button = onSecondaryAction && secondaryActionLabel && /*#__PURE__*/React__default["default"].createElement(DismissButton, {
33414
33440
  color: "primary",
33415
33441
  type: "outlined",
33416
33442
  onClick: onSecondaryAction,
33417
- label: secondaryActionLabel
33418
- }) : dismissLabel && onClose ? /*#__PURE__*/React__default["default"].createElement(DismissButton, {
33443
+ label: secondaryActionLabel,
33444
+ disabled: secondaryActionDisabled
33445
+ }) || dismissLabel && onClose && /*#__PURE__*/React__default["default"].createElement(DismissButton, {
33419
33446
  color: "secondary",
33420
33447
  onClick: onClose,
33421
33448
  label: dismissLabel
33422
- }) : undefined;
33449
+ }) || undefined;
33423
33450
  }
33424
33451
 
33425
33452
  return button;
33426
- }, [type, onCopyClipboard, copyLabel, onSecondaryAction, secondaryActionLabel, dismissLabel, onClose]);
33453
+ }, [type, onErrorAction, errorActionLabel, onSecondaryAction, secondaryActionLabel, secondaryActionDisabled, dismissLabel, onClose]);
33427
33454
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, optionalFooter && centered && /*#__PURE__*/React__default["default"].createElement(OptionalFooterContainer, {
33428
33455
  padding: {
33429
33456
  bottom: 'large'
@@ -33439,11 +33466,106 @@ const ModalFooter = _ref4 => {
33439
33466
  }), secondaryButton, (onConfirm || onClose) && /*#__PURE__*/React__default["default"].createElement(ConfirmButton, {
33440
33467
  color: confirmColor,
33441
33468
  onClick: onConfirm || onClose,
33442
- label: confirmLabel
33469
+ label: confirmLabel,
33470
+ disabled: confirmDisabled
33443
33471
  })));
33444
33472
  };
33445
33473
 
33446
- const Modal = /*#__PURE__*/React__default["default"].forwardRef(function ModalFn(_ref5, ref) {
33474
+ const ModalFooter = _ref3 => {
33475
+ let {
33476
+ centered,
33477
+ confirmColor,
33478
+ confirmLabel,
33479
+ errorActionLabel,
33480
+ customFooter,
33481
+ dismissLabel,
33482
+ onClose,
33483
+ onConfirm,
33484
+ onErrorAction,
33485
+ onSecondaryAction,
33486
+ optionalFooter,
33487
+ secondaryActionLabel,
33488
+ type
33489
+ } = _ref3;
33490
+ return /*#__PURE__*/React__default["default"].createElement(Container, {
33491
+ orientation: centered ? 'vertical' : 'horizontal',
33492
+ mainAlignment: "flex-end",
33493
+ padding: {
33494
+ top: 'large'
33495
+ }
33496
+ }, customFooter || /*#__PURE__*/React__default["default"].createElement(ModalFooterContent, {
33497
+ type: type,
33498
+ centered: centered,
33499
+ optionalFooter: optionalFooter,
33500
+ confirmLabel: confirmLabel,
33501
+ confirmColor: confirmColor,
33502
+ dismissLabel: dismissLabel,
33503
+ onConfirm: onConfirm,
33504
+ onClose: onClose,
33505
+ onSecondaryAction: onSecondaryAction,
33506
+ secondaryActionLabel: secondaryActionLabel,
33507
+ onErrorAction: onErrorAction,
33508
+ errorActionLabel: errorActionLabel
33509
+ }));
33510
+ };
33511
+
33512
+ /*
33513
+ * SPDX-FileCopyrightText: 2022 Zextras <https://www.zextras.com>
33514
+ *
33515
+ * SPDX-License-Identifier: AGPL-3.0-only
33516
+ */
33517
+ const ModalTitle = styled__default["default"](Text).withConfig({
33518
+ displayName: "ModalHeader__ModalTitle",
33519
+ componentId: "sc-q2y9wr-0"
33520
+ })(["box-sizing:border-box;width:100%;flex-grow:1;flex-basis:0;line-height:1.5;padding:", ";", ";"], props => `${props.theme.sizes.padding.small} ${props.theme.sizes.padding.small} ${props.theme.sizes.padding.small} 0`, _ref => {
33521
+ let {
33522
+ centered
33523
+ } = _ref;
33524
+ return centered && styled.css(["text-align:center;"]);
33525
+ });
33526
+
33527
+ const ModalHeader = _ref2 => {
33528
+ let {
33529
+ centered,
33530
+ onClose,
33531
+ showCloseIcon,
33532
+ title,
33533
+ type,
33534
+ closeIconTooltip
33535
+ } = _ref2;
33536
+ return /*#__PURE__*/React__default["default"].createElement(Row, {
33537
+ width: "100%",
33538
+ padding: {
33539
+ bottom: 'small'
33540
+ }
33541
+ }, /*#__PURE__*/React__default["default"].createElement(ModalTitle, {
33542
+ centered: !!centered,
33543
+ color: type === 'error' ? 'error' : undefined,
33544
+ size: "medium",
33545
+ weight: "bold"
33546
+ }, title), showCloseIcon && onClose && /*#__PURE__*/React__default["default"].createElement(Tooltip, {
33547
+ label: closeIconTooltip,
33548
+ disabled: !closeIconTooltip
33549
+ }, /*#__PURE__*/React__default["default"].createElement(IconButton, {
33550
+ icon: "Close",
33551
+ size: "large",
33552
+ onClick: onClose
33553
+ })));
33554
+ };
33555
+
33556
+ function copyToClipboard(node, windowObj) {
33557
+ const el = windowObj.document.createElement('textarea');
33558
+
33559
+ if (el && node !== null && node !== void 0 && node.textContent) {
33560
+ el.value = node.textContent;
33561
+ windowObj.document.body.appendChild(el);
33562
+ el.select();
33563
+ windowObj.document.execCommand('copy');
33564
+ windowObj.document.body.removeChild(el);
33565
+ }
33566
+ }
33567
+
33568
+ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function ModalFn(_ref, ref) {
33447
33569
  let {
33448
33570
  background = 'gray6',
33449
33571
  type = 'default',
@@ -33463,12 +33585,15 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function ModalFn
33463
33585
  customFooter,
33464
33586
  hideFooter = false,
33465
33587
  showCloseIcon = true,
33466
- maxHeight = '60vh',
33588
+ minHeight,
33589
+ maxHeight,
33467
33590
  children,
33468
33591
  disablePortal = false,
33469
33592
  zIndex = 999,
33593
+ onClick,
33594
+ closeIconTooltip,
33470
33595
  ...rest
33471
- } = _ref5;
33596
+ } = _ref;
33472
33597
  const [delayedOpen, setDelayedOpen] = React.useState(false);
33473
33598
  const {
33474
33599
  windowObj
@@ -33484,7 +33609,9 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function ModalFn
33484
33609
  e.stopPropagation();
33485
33610
  }
33486
33611
 
33487
- modalContentRef.current && !e.isDefaultPrevented() && !modalContentRef.current.contains(e.target) && onClose && onClose(e);
33612
+ if (!e.defaultPrevented && modalContentRef.current && e.target instanceof Node && !modalContentRef.current.contains(e.target) && onClose) {
33613
+ onClose(e);
33614
+ }
33488
33615
  }, [onClose]);
33489
33616
  const onCopyClipboard = React.useCallback(() => copyToClipboard(modalBodyRef.current, windowObj), [windowObj]);
33490
33617
  const onStartSentinelFocus = React.useCallback(() => {
@@ -33565,37 +33692,24 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function ModalFn
33565
33692
  }, /*#__PURE__*/React__default["default"].createElement(ModalWrapper, null, /*#__PURE__*/React__default["default"].createElement(ModalContent, {
33566
33693
  ref: modalContentRef,
33567
33694
  background: background,
33568
- tabIndex: -1,
33569
33695
  $size: size,
33570
- crossAlignment: "flex-start",
33571
- height: "auto"
33572
- }, /*#__PURE__*/React__default["default"].createElement(Row, {
33573
- width: "100%",
33574
- padding: {
33575
- bottom: 'small'
33576
- }
33577
- }, /*#__PURE__*/React__default["default"].createElement(ModalTitle, {
33578
- centered: centered,
33579
- color: type === 'error' ? 'error' : undefined,
33580
- size: "medium",
33581
- weight: "bold"
33582
- }, Title), showCloseIcon && /*#__PURE__*/React__default["default"].createElement(IconButton, {
33583
- icon: "Close",
33584
- size: "large",
33585
- onClick: onClose
33586
- })), /*#__PURE__*/React__default["default"].createElement(Divider, null), /*#__PURE__*/React__default["default"].createElement(ModalBody, {
33696
+ minHeight: minHeight,
33697
+ maxHeight: maxHeight,
33698
+ onClick: onClick
33699
+ }, /*#__PURE__*/React__default["default"].createElement(ModalHeader, {
33587
33700
  centered: centered,
33588
- ref: modalBodyRef,
33589
- maxHeight: maxHeight
33590
- }, children), !hideFooter && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Divider, null), /*#__PURE__*/React__default["default"].createElement(Container, {
33591
- orientation: centered ? 'vertical' : 'horizontal',
33592
- mainAlignment: "flex-end",
33593
- padding: {
33594
- top: 'large'
33595
- }
33596
- }, customFooter || /*#__PURE__*/React__default["default"].createElement(ModalFooter, {
33597
33701
  type: type,
33702
+ title: Title,
33703
+ showCloseIcon: showCloseIcon,
33704
+ onClose: onClose,
33705
+ closeIconTooltip: closeIconTooltip
33706
+ }), /*#__PURE__*/React__default["default"].createElement(Divider, null), /*#__PURE__*/React__default["default"].createElement(ModalBody, {
33707
+ centered: centered,
33708
+ ref: modalBodyRef
33709
+ }, children), !hideFooter && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Divider, null), /*#__PURE__*/React__default["default"].createElement(ModalFooter, {
33598
33710
  centered: centered,
33711
+ customFooter: customFooter,
33712
+ type: type,
33599
33713
  optionalFooter: optionalFooter,
33600
33714
  confirmLabel: confirmLabel,
33601
33715
  confirmColor: confirmColor,
@@ -33604,9 +33718,9 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function ModalFn
33604
33718
  onClose: onClose,
33605
33719
  onSecondaryAction: onSecondaryAction,
33606
33720
  secondaryActionLabel: secondaryActionLabel,
33607
- onCopyClipboard: onCopyClipboard,
33608
- copyLabel: copyLabel
33609
- })))))), /*#__PURE__*/React__default["default"].createElement("div", {
33721
+ onErrorAction: onCopyClipboard,
33722
+ errorActionLabel: copyLabel
33723
+ }))))), /*#__PURE__*/React__default["default"].createElement("div", {
33610
33724
  tabIndex: 0,
33611
33725
  ref: endSentinelRef
33612
33726
  })));
@@ -34027,7 +34141,7 @@ function ModalManager(_ref) {
34027
34141
  value: modal
34028
34142
  });
34029
34143
  return closeModal;
34030
- }, [windowObj.document.body.style]);
34144
+ }, [windowObj]);
34031
34145
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(ModalManagerContext.Provider, {
34032
34146
  value: createModal
34033
34147
  }, children), modals);
@@ -35434,6 +35548,10 @@ exports.Link = Link;
35434
35548
  exports.List = List;
35435
35549
  exports.LoadMore = LoadMore;
35436
35550
  exports.Modal = Modal;
35551
+ exports.ModalBody = ModalBody;
35552
+ exports.ModalFooter = ModalFooter;
35553
+ exports.ModalFooterContent = ModalFooterContent;
35554
+ exports.ModalHeader = ModalHeader;
35437
35555
  exports.ModalManager = ModalManager;
35438
35556
  exports.ModalManagerContext = ModalManagerContext;
35439
35557
  exports.MultiButton = MultiButton;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zextras/carbonio-design-system",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "An awesome UI for Zextras Projects.",
5
5
  "main": "dist/zapp-ui.bundle.js",
6
6
  "types": "dist/zapp-ui.bundle.d.ts",
@@ -65,7 +65,10 @@
65
65
  "copy-webpack-plugin": "10.2.0",
66
66
  "core-js": "3.19.1",
67
67
  "create-index": "2.6.0",
68
+ "eslint-plugin-jest-dom": "^4.0.2",
68
69
  "eslint-plugin-notice": "^0.9.10",
70
+ "eslint-plugin-testing-library": "^5.6.4",
71
+ "eslint-plugin-unused-imports": "^2.0.0",
69
72
  "file-loader": "6.2.0",
70
73
  "husky": "5.2.0",
71
74
  "is-ci": "3.0.1",