@zextras/carbonio-design-system 2.3.0 → 3.0.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,30 @@
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
+ ## [3.0.0](https://github.com/Zextras/carbonio-design-system/compare/v2.3.0...v3.0.0) (2023-09-27)
6
+
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * **Select:** set items of Select as required
11
+
12
+ ### Features
13
+
14
+ * **icons:** add new building icon ([4b6d0f0](https://github.com/Zextras/carbonio-design-system/commit/4b6d0f0fe106a7586664e9244a52a1b227b8aa9d)), closes [#225](https://github.com/Zextras/carbonio-design-system/issues/225)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **ChipInput:** do not prevent typing in input when separator is set to empty array ([ba802fd](https://github.com/Zextras/carbonio-design-system/commit/ba802fdc657c2a9a8944f6dbbd7de95cd86e689d)), closes [#220](https://github.com/Zextras/carbonio-design-system/issues/220)
20
+ * **ChipInput:** fix selectable placeholder in input fields ([5e13315](https://github.com/Zextras/carbonio-design-system/commit/5e13315c596b4bd101be4aeab4db8ac3dea613ad)), closes [#219](https://github.com/Zextras/carbonio-design-system/issues/219)
21
+ * **CustomModal:** do not prevent default behavior of click inside modal ([33a8952](https://github.com/Zextras/carbonio-design-system/commit/33a895241f468fb5d23dd7a364fe8fcdbc63565c)), closes [#218](https://github.com/Zextras/carbonio-design-system/issues/218)
22
+ * **Dropdown:** allow keyboard navigation on nested dropdowns ([18b5519](https://github.com/Zextras/carbonio-design-system/commit/18b551943b75e3d8358bd777361007c6303ee558)), closes [#217](https://github.com/Zextras/carbonio-design-system/issues/217)
23
+ * **Snackbar:** add padding on right side of snackbar without action ([8cb4df4](https://github.com/Zextras/carbonio-design-system/commit/8cb4df4950601d85c8482086c768cd87f86ad437)), closes [#223](https://github.com/Zextras/carbonio-design-system/issues/223)
24
+ * **Table:** prevent checkboxes to be visible when mouse leaves rows ([295d1bf](https://github.com/Zextras/carbonio-design-system/commit/295d1bf601caed9595976db0986a0954a885361b)), closes [#222](https://github.com/Zextras/carbonio-design-system/issues/222)
25
+
26
+
27
+ * **Select:** set items of Select as required ([d51c42a](https://github.com/Zextras/carbonio-design-system/commit/d51c42aa7da17a21d37ec3ec0e1c9a311290bd5a)), closes [#221](https://github.com/Zextras/carbonio-design-system/issues/221)
28
+
5
29
  ## [2.3.0](https://github.com/Zextras/carbonio-design-system/compare/v2.2.0...v2.3.0) (2023-08-30)
6
30
 
7
31
 
@@ -159,6 +159,32 @@ export declare type BannerProps = HTMLAttributes<HTMLDivElement> & {
159
159
  onClose?: never;
160
160
  });
161
161
 
162
+ declare type BareModalProps = {
163
+ /** Modal background */
164
+ background?: string | keyof DefaultTheme['palette'];
165
+ /** Modal size */
166
+ size?: 'extrasmall' | 'small' | 'medium' | 'large';
167
+ /** Boolean to show the modal */
168
+ open?: boolean;
169
+ /** Css property to handle the stack order of multiple modals */
170
+ zIndex?: number;
171
+ /** min height of the modal */
172
+ minHeight?: string;
173
+ /** max height of the modal */
174
+ maxHeight?: string;
175
+ /** Flag to disable the Portal implementation */
176
+ disablePortal?: boolean;
177
+ /** Content of the modal */
178
+ children?: React_2.ReactNode | React_2.ReactNode[];
179
+ /** Callback to close the Modal */
180
+ onClose?: (event: React_2.MouseEvent | KeyboardEvent) => void;
181
+ /**
182
+ * The window where to insert the Portal's children.
183
+ * The default value is 'windowObj' obtained from the ThemContext.
184
+ * */
185
+ containerWindow?: Window;
186
+ };
187
+
162
188
  declare type BreadcrumbCollapersProps = {
163
189
  all: string;
164
190
  } & PaddingProps;
@@ -698,9 +724,9 @@ declare type CSSObject = {
698
724
  [K in keyof CSSProperties]: CSSProperties[K] | (() => NonNullable<CSSProperties[K]>);
699
725
  };
700
726
 
701
- export declare const CustomModal: React_2.ForwardRefExoticComponent<PickedModal & Omit<React_2.HTMLAttributes<HTMLDivElement>, "open" | "background" | "maxHeight" | "minHeight" | "zIndex" | "title" | "children" | "size" | "onClose" | "disablePortal"> & React_2.RefAttributes<HTMLDivElement>>;
727
+ export declare const CustomModal: React_2.ForwardRefExoticComponent<BareModalProps & Omit<React_2.HTMLAttributes<HTMLDivElement>, "title" | keyof BareModalProps> & React_2.RefAttributes<HTMLDivElement>>;
702
728
 
703
- export declare type CustomModalProps = PickedModal & Omit<HTMLAttributes<HTMLDivElement>, keyof PickedModal | 'title'>;
729
+ export declare type CustomModalProps = BareModalProps & Omit<HTMLAttributes<HTMLDivElement>, keyof BareModalProps | 'title'>;
704
730
 
705
731
  export declare const DateTimePicker: React_2.ForwardRefExoticComponent<DateTimePickerProps & React_2.RefAttributes<DatePicker<never, undefined>>>;
706
732
 
@@ -849,7 +875,7 @@ export declare interface DropdownProps extends Omit<HTMLAttributes<HTMLDivElemen
849
875
  /** Only one component can be passed as children */
850
876
  children: React_2.ReactElement;
851
877
  /** trigger ref that can be used instead of lost children ref caused by cloneElement */
852
- triggerRef?: React_2.Ref<HTMLElement>;
878
+ triggerRef?: React_2.Ref<HTMLElement> | null;
853
879
  /** Placement of the dropdown */
854
880
  placement?: 'auto' | 'auto-start' | 'auto-end' | 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'right' | 'right-start' | 'right-end' | 'left' | 'left-start' | 'left-end';
855
881
  /** Flag to disable the Portal implementation */
@@ -867,7 +893,7 @@ export declare interface DropdownProps extends Omit<HTMLAttributes<HTMLDivElemen
867
893
  /** Item Padding Between */
868
894
  itemPaddingBetween?: keyof DefaultTheme['sizes']['padding'];
869
895
  /** Ref assign to the dropdown list popper container */
870
- dropdownListRef?: React_2.RefObject<HTMLDivElement>;
896
+ dropdownListRef?: React_2.RefObject<HTMLDivElement> | null;
871
897
  }
872
898
 
873
899
  export declare interface DropProps {
@@ -899,8 +925,6 @@ export declare interface DSWindow {
899
925
  };
900
926
  }
901
927
 
902
- declare type ElementType = 'listItem' | 'button' | 'list' | 'chipInputKeys' | 'chipInputSpace';
903
-
904
928
  export declare const EmailComposerInput: React_2.ForwardRefExoticComponent<EmailComposerInputProps & React_2.RefAttributes<HTMLDivElement>>;
905
929
 
906
930
  export declare interface EmailComposerInputProps extends HTMLAttributes<HTMLDivElement> {
@@ -980,7 +1004,13 @@ export declare function generateHighlightSet(fromColorSet: Parameters<typeof gen
980
1004
 
981
1005
  export { getDefaultLocale }
982
1006
 
983
- export declare function getKeyboardPreset(type: ElementType, callback: (e: KeyboardEvent) => void, ref?: React_2.MutableRefObject<HTMLElement | null> | undefined, keys?: string[], modifier?: boolean): KeyboardPreset;
1007
+ export declare function getKeyboardPreset(type: 'listItem', callback: NativeKeyboardEventHandler, ref?: undefined, keys?: undefined, modifier?: boolean): KeyboardPreset;
1008
+
1009
+ export declare function getKeyboardPreset(type: 'button', callback: NativeKeyboardEventHandler, ref?: undefined, keys?: undefined, modifier?: boolean): KeyboardPreset;
1010
+
1011
+ export declare function getKeyboardPreset(type: 'list', callback: undefined, ref: React_2.RefObject<HTMLElement>, keys?: undefined, modifier?: boolean): KeyboardPreset;
1012
+
1013
+ export declare function getKeyboardPreset(type: 'chipInputKeys', callback: NativeKeyboardEventHandler, ref?: undefined, keys?: string[], modifier?: boolean): KeyboardPreset;
984
1014
 
985
1015
  declare function getPadding(padding: PaddingStringComposition | PaddingObj): (args: {
986
1016
  theme: DefaultTheme;
@@ -1164,7 +1194,7 @@ export declare function generateHighlightSet(fromColorSet: Parameters<typeof gen
1164
1194
 
1165
1195
  declare type KeyboardPresetObj = {
1166
1196
  type: HtmlElementKeyboardEventKey;
1167
- callback: (e: KeyboardEvent) => void;
1197
+ callback: NativeKeyboardEventHandler;
1168
1198
  keys: string[];
1169
1199
  modifier?: boolean;
1170
1200
  haveToPreventDefault?: boolean;
@@ -1280,34 +1310,35 @@ export declare function generateHighlightSet(fromColorSet: Parameters<typeof gen
1280
1310
  height?: string;
1281
1311
  };
1282
1312
 
1283
- export declare const Modal: React_2.ForwardRefExoticComponent<Omit<ModalFooterProps, "errorActionLabel" | "onErrorAction"> & {
1284
- /** Modal background */
1313
+ export declare const Modal: React_2.ForwardRefExoticComponent<{
1285
1314
  background?: string | undefined;
1286
- /** Modal title */
1287
- title?: string | React_2.ReactElement<any, string | React_2.JSXElementConstructor<any>> | undefined;
1288
- /** Modal size */
1289
1315
  size?: "small" | "medium" | "large" | "extrasmall" | undefined;
1290
- /** Boolean to show the modal */
1291
1316
  open?: boolean | undefined;
1292
- /** Hide the footer completely */
1293
- hideFooter?: boolean | undefined;
1294
- /** Show icon to close Modal */
1295
- showCloseIcon?: boolean | undefined;
1296
- /** Css property to handle the stack order of multiple modals */
1297
1317
  zIndex?: number | undefined;
1298
- /** min height of the modal */
1299
1318
  minHeight?: string | undefined;
1300
- /** max height of the modal */
1301
1319
  maxHeight?: string | undefined;
1302
- /** Flag to disable the Portal implementation */
1303
1320
  disablePortal?: boolean | undefined;
1304
- /** Content of the modal */
1305
1321
  children?: React_2.ReactNode | React_2.ReactNode[];
1306
- /**
1307
- * The window where to insert the Portal's children.
1308
- * The default value is 'windowObj' obtained from the ThemContext.
1309
- * */
1322
+ onClose?: ((event: KeyboardEvent | React_2.MouseEvent<Element, MouseEvent>) => void) | undefined;
1310
1323
  containerWindow?: Window | undefined;
1324
+ } & Omit<React_2.HTMLAttributes<HTMLDivElement>, "title" | keyof {
1325
+ background?: string | undefined;
1326
+ size?: "small" | "medium" | "large" | "extrasmall" | undefined;
1327
+ open?: boolean | undefined;
1328
+ zIndex?: number | undefined;
1329
+ minHeight?: string | undefined;
1330
+ maxHeight?: string | undefined;
1331
+ disablePortal?: boolean | undefined;
1332
+ children?: React_2.ReactNode | React_2.ReactNode[];
1333
+ onClose?: ((event: KeyboardEvent | React_2.MouseEvent<Element, MouseEvent>) => void) | undefined;
1334
+ containerWindow?: Window | undefined;
1335
+ }> & Omit<ModalFooterProps, "errorActionLabel" | "onErrorAction"> & {
1336
+ /** Modal title */
1337
+ title?: string | React_2.ReactElement<any, string | React_2.JSXElementConstructor<any>> | undefined;
1338
+ /** Hide the footer completely */
1339
+ hideFooter?: boolean | undefined;
1340
+ /** Show icon to close Modal */
1341
+ showCloseIcon?: boolean | undefined;
1311
1342
  /** Label for copy button in the Error Modal */
1312
1343
  copyLabel?: ModalFooterProps['errorActionLabel'];
1313
1344
  /** Close icon tooltip label */
@@ -1377,34 +1408,13 @@ export declare function generateHighlightSet(fromColorSet: Parameters<typeof gen
1377
1408
  children: React_2.ReactNode | React_2.ReactNode[];
1378
1409
  }
1379
1410
 
1380
- export declare type ModalProps = Omit<ModalFooterProps, 'errorActionLabel' | 'onErrorAction'> & {
1381
- /** Modal background */
1382
- background?: string | keyof DefaultTheme['palette'];
1411
+ export declare type ModalProps = CustomModalProps & Omit<ModalFooterProps, 'errorActionLabel' | 'onErrorAction'> & {
1383
1412
  /** Modal title */
1384
1413
  title?: string | React_2.ReactElement;
1385
- /** Modal size */
1386
- size?: 'extrasmall' | 'small' | 'medium' | 'large';
1387
- /** Boolean to show the modal */
1388
- open?: boolean;
1389
1414
  /** Hide the footer completely */
1390
1415
  hideFooter?: boolean;
1391
1416
  /** Show icon to close Modal */
1392
1417
  showCloseIcon?: boolean;
1393
- /** Css property to handle the stack order of multiple modals */
1394
- zIndex?: number;
1395
- /** min height of the modal */
1396
- minHeight?: string;
1397
- /** max height of the modal */
1398
- maxHeight?: string;
1399
- /** Flag to disable the Portal implementation */
1400
- disablePortal?: boolean;
1401
- /** Content of the modal */
1402
- children?: React_2.ReactNode | React_2.ReactNode[];
1403
- /**
1404
- * The window where to insert the Portal's children.
1405
- * The default value is 'windowObj' obtained from the ThemContext.
1406
- * */
1407
- containerWindow?: Window;
1408
1418
  /** Label for copy button in the Error Modal */
1409
1419
  copyLabel?: ModalFooterProps['errorActionLabel'];
1410
1420
  /** Close icon tooltip label */
@@ -1459,6 +1469,8 @@ export declare function generateHighlightSet(fromColorSet: Parameters<typeof gen
1459
1469
 
1460
1470
  export declare type MultipleSelectionOnChange<T = string> = (value: Array<SelectItem<T>>) => void;
1461
1471
 
1472
+ declare type NativeKeyboardEventHandler = (event: KeyboardEvent) => void;
1473
+
1462
1474
  declare type NonEmptyArray<T> = [T, ...T[]];
1463
1475
 
1464
1476
  declare type Options = {
@@ -1498,8 +1510,6 @@ export declare function generateHighlightSet(fromColorSet: Parameters<typeof gen
1498
1510
 
1499
1511
  export declare const PasswordInput: React_2.ForwardRefExoticComponent<InputProps & React_2.RefAttributes<HTMLDivElement>>;
1500
1512
 
1501
- declare type PickedModal = Pick<ModalProps, 'background' | 'size' | 'open' | 'onClose' | 'zIndex' | 'minHeight' | 'maxHeight' | 'disablePortal' | 'children'>;
1502
-
1503
1513
  export declare const Popover: React_2.ForwardRefExoticComponent<PopoverProps & React_2.RefAttributes<HTMLDivElement>>;
1504
1514
 
1505
1515
  export declare interface PopoverProps extends PopperProps {
@@ -1669,7 +1679,7 @@ export declare function generateHighlightSet(fromColorSet: Parameters<typeof gen
1669
1679
  label?: string;
1670
1680
  background?: string;
1671
1681
  disabled?: boolean;
1672
- items?: SelectItem<T>[];
1682
+ items: SelectItem<T>[];
1673
1683
  /** Css display property of select */
1674
1684
  display?: 'block' | 'inline-block';
1675
1685
  /** Css width property of dropdown */
@@ -1985,7 +1995,7 @@ export declare function generateHighlightSet(fromColorSet: Parameters<typeof gen
1985
1995
  onChange?: never;
1986
1996
  } | {
1987
1997
  /** Items for the Select component of the header */
1988
- items: NonEmptyArray<NonNullable<SelectProps['items']>[number]>;
1998
+ items: NonEmptyArray<SelectProps['items'][number]>;
1989
1999
  /** De/Select all rows callback */
1990
2000
  onChange: MultipleSelectionOnChange;
1991
2001
  });
@@ -2194,7 +2204,14 @@ export declare function generateHighlightSet(fromColorSet: Parameters<typeof gen
2194
2204
 
2195
2205
  export declare const useIsVisible: <T extends HTMLElement>(listRef: React_2.RefObject<HTMLDivElement> | undefined, itemRef?: React_2.Ref<T> | undefined) => [boolean, React_2.RefObject<T>];
2196
2206
 
2197
- export declare function useKeyboard(ref: React_2.RefObject<HTMLElement>, events: KeyboardPreset): void;
2207
+ /**
2208
+ * Attach listeners for the given events to the given ref.
2209
+ *
2210
+ * Note: an event with the `keys` field set to an empty array is considered as an event for any key.
2211
+ * In order to have an event for no key, you should either provide an event with the `keys` field set
2212
+ * to an array with an empty key (`['']`), or not provide an event at all.
2213
+ */
2214
+ export declare function useKeyboard(ref: React_2.RefObject<HTMLElement>, events: KeyboardPreset, registerListener?: boolean): void;
2198
2215
 
2199
2216
  export declare function useModal(): CreateModalFn;
2200
2217