widenarrow-ui 1.0.11 → 1.0.13

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.
Files changed (46) hide show
  1. package/lib/assets/svg/notificationPlus.d.ts +6 -0
  2. package/lib/components/Box/Box.stories.d.ts +1 -1
  3. package/lib/components/Button/Button.stories.d.ts +1 -1
  4. package/lib/components/Checkbox/Checkbox.stories.d.ts +1 -1
  5. package/lib/components/DropDown/DropDown.stories.d.ts +1 -1
  6. package/lib/components/DropDown/useHandleClickOutside.d.ts +1 -1
  7. package/lib/components/DropDownItem/DropDownItem.stories.d.ts +1 -1
  8. package/lib/components/FacetButton/FacetButton.stories.d.ts +1 -1
  9. package/lib/components/Grid/Grid.stories.d.ts +1 -1
  10. package/lib/components/Icon/Icon.stories.d.ts +1 -1
  11. package/lib/components/IconButton/IconButton.stories.d.ts +1 -1
  12. package/lib/components/Image/Image.stories.d.ts +1 -1
  13. package/lib/components/InlineButton/InlineButton.stories.d.ts +1 -1
  14. package/lib/components/ListItem/ListItem.stories.d.ts +1 -1
  15. package/lib/components/ListSkeleton/ListSkeleton.stories.d.ts +1 -1
  16. package/lib/components/MultiActionButton/MultiActionButton.stories.d.ts +1 -1
  17. package/lib/components/MultiActionButton/MultiActionButton.types.d.ts +3 -0
  18. package/lib/components/RadioButton/RadioButton.stories.d.ts +1 -1
  19. package/lib/components/Separator/Separator.stories.d.ts +1 -1
  20. package/lib/components/SolidSpinner/SolidSpinner.stories.d.ts +1 -1
  21. package/lib/components/SortableTable/SortableTable.stories.d.ts +1 -1
  22. package/lib/components/SortableTable/SortableTable.types.d.ts +4 -3
  23. package/lib/components/SwitchButton/SwitchButton.stories.d.ts +1 -1
  24. package/lib/components/Typography/Heading.stories.d.ts +1 -1
  25. package/lib/components/Typography/Label.stories.d.ts +1 -1
  26. package/lib/components/Typography/Paragraph.stories.d.ts +1 -1
  27. package/lib/components/Typography/Span.stories.d.ts +1 -1
  28. package/lib/constants.d.ts +1 -0
  29. package/lib/index.css +1 -1
  30. package/lib/index.d.ts +10 -3
  31. package/lib/index.esm.css +1 -1
  32. package/lib/index.esm.js +276 -265
  33. package/lib/index.esm.js.map +1 -1
  34. package/lib/index.js +276 -265
  35. package/lib/index.js.map +1 -1
  36. package/lib/types/styling.types.d.ts +3 -0
  37. package/package.json +2 -2
  38. package/src/assets/svg/notificationPlus.tsx +23 -0
  39. package/src/components/Icon/getIconFromConstant.tsx +3 -0
  40. package/src/components/MultiActionButton/MultiActionButton.module.scss +4 -0
  41. package/src/components/MultiActionButton/MultiActionButton.tsx +15 -0
  42. package/src/components/MultiActionButton/MultiActionButton.types.ts +3 -0
  43. package/src/components/SortableTable/SortableTable.tsx +3 -2
  44. package/src/components/SortableTable/SortableTable.types.ts +4 -3
  45. package/src/constants.ts +1 -0
  46. package/src/types/styling.types.ts +4 -0
@@ -1,4 +1,7 @@
1
1
  import { SizeTypes, ColorTypes, IconTypes, HierarchyTypes } from 'src/constants';
2
+ export interface UnknownObjectInterface {
3
+ [key: string]: unknown;
4
+ }
2
5
  export interface MarginInterface {
3
6
  margin?: '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8';
4
7
  marginX?: '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "widenarrow-ui",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "A storybook 6 typeScript component library used for Wide Narrow by infodesk",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -61,7 +61,7 @@
61
61
  "storybook": "7.4.2",
62
62
  "storybook-css-modules": "1.0.8",
63
63
  "tsconfig-paths-webpack-plugin": "4.1.0",
64
- "typescript": "5.0.4"
64
+ "typescript": "4.7.3"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "lazysizes": "5.2.2",
@@ -0,0 +1,23 @@
1
+ import React, { FC } from 'react';
2
+
3
+ interface Props {
4
+ className?: string;
5
+ }
6
+
7
+ const Icon: FC<Props> = ({ className }) => (
8
+ <svg className={className} width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
9
+ <path
10
+ fillRule="evenodd"
11
+ clipRule="evenodd"
12
+ d="M19.2901 17.79L18.0001 16.5V11.5C18.0001 8.43 16.3601 5.86 13.5001 5.18V4.5C13.5001 3.67 12.8301 3 12.0001 3C11.1701 3 10.5001 3.67 10.5001 4.5V5.18C7.63005 5.86 6.00005 8.42 6.00005 11.5V16.5L4.71005 17.79C4.08005 18.42 4.52005 19.5 5.41005 19.5H18.5801C19.4801 19.5 19.9201 18.42 19.2901 17.79ZM12.0001 22.5C13.1001 22.5 14.0001 21.6 14.0001 20.5H10.0001C10.0001 21.6 10.8901 22.5 12.0001 22.5Z"
13
+ />
14
+ <path
15
+ d="M17 14.125C17.3452 14.125 17.625 13.8452 17.625 13.5V11.125H20C20.3452 11.125 20.625 10.8452 20.625 10.5V8.5C20.625 8.15482 20.3452 7.875 20 7.875H17.625V5.5C17.625 5.15482 17.3452 4.875 17 4.875H15C14.6548 4.875 14.375 5.15482 14.375 5.5V7.875H12C11.6548 7.875 11.375 8.15482 11.375 8.5V10.5C11.375 10.8452 11.6548 11.125 12 11.125H14.375V13.5C14.375 13.8452 14.6548 14.125 15 14.125H17Z"
16
+ stroke="white"
17
+ strokeWidth="1.25"
18
+ strokeLineJoin="round"
19
+ />
20
+ </svg>
21
+ );
22
+
23
+ export default Icon;
@@ -121,6 +121,7 @@ import NotificationIcon from 'src/assets/svg/notification';
121
121
  import NotificationActiveIcon from 'src/assets/svg/notificationActive';
122
122
  import NotificationSettingsIcon from 'src/assets/svg/notificationSettings';
123
123
  import NotificationOffIcon from 'src/assets/svg/notificationOff';
124
+ import NotificationPlusIcon from 'src/assets/svg/notificationPlus';
124
125
  import OpenInNewIcon from 'src/assets/svg/openInNew';
125
126
  import PaletteIcon from 'src/assets/svg/palette';
126
127
  import PauseCircleIcon from 'src/assets/svg/pauseCircle';
@@ -444,6 +445,8 @@ const getIconFromConstant = (icon: Partial<IconTypes>, getIconClassName: (additi
444
445
  return <NotificationSettingsIcon className={getIconClassName()} />;
445
446
  case IconTypes.NOTIFICATION_OFF:
446
447
  return <NotificationOffIcon className={getIconClassName()} />;
448
+ case IconTypes.NOTIFICATION_PLUS:
449
+ return <NotificationPlusIcon className={getIconClassName()} />;
447
450
  case IconTypes.NO_CHANGE:
448
451
  return <NoChangeIcon className={getIconClassName()} />;
449
452
  case IconTypes.NO_DIRECTION:
@@ -162,6 +162,10 @@ $button-l-min-width: 100px;
162
162
  margin-right: $base-size;
163
163
  }
164
164
 
165
+ .marginLeft {
166
+ margin-left: $base-size;
167
+ }
168
+
165
169
  .spinner {
166
170
  @include absolute-center;
167
171
  z-index: 1;
@@ -13,6 +13,10 @@ import { MultiActionButtonProps } from './MultiActionButton.types';
13
13
 
14
14
  const s = classNames.bind(styles);
15
15
 
16
+ // middleIcon;
17
+ // middleIconSize;
18
+ // rotateMiddleIconByDegree;
19
+
16
20
  const MultiActionButton: FC<MultiActionButtonProps> = ({
17
21
  className,
18
22
  iconClassName,
@@ -20,12 +24,15 @@ const MultiActionButton: FC<MultiActionButtonProps> = ({
20
24
  type = HierarchyTypes.PRIMARY,
21
25
  size = SizeTypes.MEDIUM,
22
26
  rotateLeftIconByDegree,
27
+ rotateMiddleIconByDegree,
23
28
  rotateRightIconByDegree,
24
29
  text,
25
30
  toolTip,
26
31
  leftIconSize = SizeTypes.MEDIUM,
32
+ middleIconSize = SizeTypes.MEDIUM,
27
33
  rightIconSize = SizeTypes.MEDIUM,
28
34
  leftIcon,
35
+ middleIcon,
29
36
  rightIcon,
30
37
  withEllipsis,
31
38
  onRightClickCallback,
@@ -80,6 +87,14 @@ const MultiActionButton: FC<MultiActionButtonProps> = ({
80
87
  >
81
88
  {text}
82
89
  </span>
90
+ {middleIcon ? (
91
+ <Icon
92
+ icon={middleIcon}
93
+ size={middleIconSize || rightIconSize || size}
94
+ rotateIconByDegree={rotateMiddleIconByDegree}
95
+ className={s({ marginLeft: !!text, [iconClassName as string]: iconClassName })}
96
+ />
97
+ ) : null}
83
98
  </button>
84
99
  {withSeparator ? <Separator marginX={'0'} color={type === HierarchyTypes.PRIMARY ? ColorTypes.WHITE : ColorTypes.GREY_4} /> : null}
85
100
  <button className={s({ button: true, button_right: true, button_disabled: loading || disabled })} onClick={onRightClickCallback}>
@@ -8,10 +8,13 @@ export interface MultiActionButtonProps {
8
8
  type?: Partial<HierarchyTypes>;
9
9
  size?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
10
10
  leftIconSize?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
11
+ middleIconSize?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
11
12
  rightIconSize?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
12
13
  leftIcon?: Partial<IconTypes>;
14
+ middleIcon?: Partial<IconTypes>;
13
15
  rightIcon?: Partial<IconTypes>;
14
16
  rotateLeftIconByDegree?: 0 | 45 | 90 | 135 | 180 | 225 | 270 | 315;
17
+ rotateMiddleIconByDegree?: 0 | 45 | 90 | 135 | 180 | 225 | 270 | 315;
15
18
  rotateRightIconByDegree?: 0 | 45 | 90 | 135 | 180 | 225 | 270 | 315;
16
19
  disabled?: boolean;
17
20
  className?: string;
@@ -4,6 +4,7 @@ import classNames from 'classnames/bind';
4
4
  import { useInView } from 'react-intersection-observer';
5
5
 
6
6
  import { SizeTypes, HierarchyTypes, IconTypes } from 'src/constants';
7
+ import { UnknownObjectInterface } from 'src/types/styling.types';
7
8
  import {
8
9
  isArrayWithContent,
9
10
  sortObjectsInArrayByMultipleKeys,
@@ -116,7 +117,7 @@ const SortableTable: FC<SortableTableProps> = ({
116
117
  cellData_withEllipsis: cell.withEllipsis
117
118
  });
118
119
 
119
- const getCellData = (row: Record<string | number, unknown>, cell: CellInterface) => {
120
+ const getCellData = (row: UnknownObjectInterface, cell: CellInterface) => {
120
121
  if (cell.customCellComponent && is(Function, cell.customCellComponent)) {
121
122
  // eslint-disable-next-line
122
123
  // @ts-ignore
@@ -130,7 +131,7 @@ const SortableTable: FC<SortableTableProps> = ({
130
131
  return <span className={getCellDataClassName(cell)}>{cellValue}</span>;
131
132
  };
132
133
 
133
- const getRowContent = (row: Record<string | number, unknown>) =>
134
+ const getRowContent = (row: UnknownObjectInterface) =>
134
135
  cells.map((cell, i) => (
135
136
  <td
136
137
  style={{ width: cell.width }}
@@ -1,8 +1,9 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { IconTypes } from '../../constants';
3
+ import { UnknownObjectInterface } from '../../types/styling.types';
3
4
 
4
5
  export interface RowProps {
5
- row: Record<string | number, unknown>;
6
+ row: UnknownObjectInterface;
6
7
  rowClassName?: string;
7
8
  withIntersectionObserver?: boolean | undefined;
8
9
  children?: ReactNode;
@@ -19,12 +20,12 @@ export interface CellInterface {
19
20
  withEllipsis?: boolean;
20
21
  toolTip?: string;
21
22
  customHeaderCellComponent?: (cell: CellInterface) => ReactNode;
22
- customCellComponent?: (row: Record<string | number, unknown>) => ReactNode;
23
+ customCellComponent?: (row: UnknownObjectInterface) => ReactNode;
23
24
  }
24
25
 
25
26
  export interface SortableTableProps {
26
27
  cells: Array<CellInterface>;
27
- data: Array<Record<string | number, unknown>>;
28
+ data: Array<UnknownObjectInterface>;
28
29
  sortBy: Array<{
29
30
  keyName: string;
30
31
  ascending: boolean;
package/src/constants.ts CHANGED
@@ -119,6 +119,7 @@ export enum IconTypes {
119
119
  NOTIFICATION_ACTIVE = 'iconNotificationActive',
120
120
  NOTIFICATION_SETTINGS = 'iconNotificationSettings',
121
121
  NOTIFICATION_OFF = 'iconNotificationOff',
122
+ NOTIFICATION_PLUS = 'iconNotificationPlus',
122
123
  NO_CHANGE = 'iconNoChange',
123
124
  NO_DIRECTION = 'iconNoDirection',
124
125
  OPEN_IN_NEW = 'iconOpenInNew',
@@ -1,5 +1,9 @@
1
1
  import { SizeTypes, ColorTypes, IconTypes, HierarchyTypes } from 'src/constants';
2
2
 
3
+ export interface UnknownObjectInterface {
4
+ [key: string]: unknown;
5
+ }
6
+
3
7
  export interface MarginInterface {
4
8
  margin?: '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8';
5
9
  marginX?: '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8';