widenarrow-ui 0.1.21 → 0.1.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "widenarrow-ui",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
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",
@@ -26,6 +26,14 @@
26
26
  justify-content: space-between;
27
27
  transition: background 50ms ease-in;
28
28
 
29
+ .text {
30
+ transition: color 50ms ease-in;
31
+ }
32
+
33
+ svg {
34
+ transition: fill 50ms ease-in;
35
+ }
36
+
29
37
  &_small {
30
38
  padding: 8px 12px;
31
39
 
@@ -51,10 +51,7 @@ $button-s-min-width: 30px;
51
51
  min-width: $button-s-min-width;
52
52
  font-size: $font-size-s;
53
53
  line-height: 1;
54
-
55
- &_truncateText {
56
- max-width: 100%;
57
- }
54
+ max-width: 100%;
58
55
 
59
56
  &_disabled {
60
57
  pointer-events: none;
@@ -73,6 +70,10 @@ $button-s-min-width: 30px;
73
70
 
74
71
  .text {
75
72
  display: block;
73
+ white-space: nowrap;
74
+ overflow: hidden;
75
+ text-overflow: ellipsis;
76
+ padding: 2px 0;
76
77
  }
77
78
 
78
79
  .iconContainer {
@@ -0,0 +1,46 @@
1
+ @import 'src/styles/mixins.scss';
2
+
3
+ .container {
4
+ @include reset-list;
5
+
6
+ width: 100%;
7
+ }
8
+
9
+ .item {
10
+ display: flex;
11
+ flex-direction: column;
12
+ justify-content: center;
13
+ background-color: red;
14
+ width: 100%;
15
+
16
+ &_withBorder {
17
+ border: 1px solid transparent;
18
+ }
19
+
20
+ &_withBorderRadius {
21
+ border-radius: $border-radius;
22
+ }
23
+ }
24
+
25
+ .heading,
26
+ .text {
27
+ display: block;
28
+ height: 16px;
29
+ }
30
+
31
+ .heading {
32
+ width: 100%;
33
+ max-width: 100px;
34
+ margin-bottom: $base-size;
35
+ }
36
+
37
+ .text {
38
+ width: 100%;
39
+ max-width: 250px;
40
+ }
41
+
42
+ @include margin(8);
43
+ @include padding(8);
44
+ @include backgroundColor('backgroundColor');
45
+ @include backgroundColor('contentColor');
46
+ @include borderColor;
@@ -0,0 +1,30 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+
3
+ import ListSkeleton from 'src/components/ListSkeleton';
4
+
5
+ const meta: Meta<typeof ListSkeleton> = {
6
+ title: 'Components/ListSkeleton',
7
+ component: ListSkeleton
8
+ };
9
+
10
+ export default meta;
11
+
12
+ type Story = StoryObj<typeof ListSkeleton>;
13
+
14
+ export const Default: Story = {
15
+ args: {},
16
+ render: ({ ...props }) => (
17
+ <div style={{ width: '380px', display: 'flex', justifyContent: 'center' }}>
18
+ <ListSkeleton {...props} />
19
+ </div>
20
+ )
21
+ };
22
+
23
+ export const Primary: Story = {
24
+ args: {},
25
+ render: ({ ...props }) => (
26
+ <div style={{ width: '380px', display: 'flex', justifyContent: 'center' }}>
27
+ <ListSkeleton {...props} />
28
+ </div>
29
+ )
30
+ };
@@ -0,0 +1,81 @@
1
+ import { FC, Fragment } from 'react';
2
+ import classNames from 'classnames/bind';
3
+ import { is } from 'ramda';
4
+
5
+ import { ColorTypes } from 'src/constants';
6
+
7
+ import styles from './ListSkeleton.module.scss';
8
+
9
+ const s = classNames.bind(styles);
10
+
11
+ interface Props {
12
+ items: number;
13
+ itemHeight?: number;
14
+ className?: string;
15
+ itemClassName?: string;
16
+ withBorderRadius?: boolean;
17
+ withContent?: boolean;
18
+ backgroundColor?: `${ColorTypes}`;
19
+ backgroundColor?: `${ColorTypes}`;
20
+ marginBottom?: string;
21
+ padding?: string;
22
+ borderColor?: `${ColorTypes}`;
23
+ contentColor?: `${ColorTypes}`;
24
+ }
25
+
26
+ const ListSkeleton: FC<Props> = ({
27
+ items = 6,
28
+ className,
29
+ itemClassName,
30
+ backgroundColor = 'white',
31
+ borderColor,
32
+ contentColor = ColorTypes.GREY_2,
33
+ itemHeight = 60,
34
+ marginBottom = '1',
35
+ padding = '1',
36
+ withContent,
37
+ withBorderRadius
38
+ }) => {
39
+ const getItemMarkup = (key) => (
40
+ <li
41
+ key={key}
42
+ className={s('item', {
43
+ [`backgroundColor_${backgroundColor}`]: is(String, backgroundColor),
44
+ [`borderColor_${borderColor}`]: is(String, borderColor),
45
+ [`marginBottom_${marginBottom}`]: is(String, marginBottom),
46
+ [`padding_${padding}`]: is(String, padding),
47
+ item_withBorderRadius: withBorderRadius,
48
+ item_withBorder: !!withBorderRadius || !!borderColor,
49
+ [itemClassName as string]: itemClassName
50
+ })}
51
+ style={{ height: `${itemHeight}px` }}
52
+ >
53
+ {withContent && (
54
+ <Fragment>
55
+ <span
56
+ className={s('heading', {
57
+ [`contentColor_${contentColor}`]: is(String, contentColor)
58
+ })}
59
+ />
60
+ <span
61
+ className={s('text', {
62
+ [`contentColor_${contentColor}`]: is(String, contentColor)
63
+ })}
64
+ />
65
+ </Fragment>
66
+ )}
67
+ </li>
68
+ );
69
+
70
+ return (
71
+ <ul
72
+ className={s('container', {
73
+ [className as string]: className
74
+ })}
75
+ >
76
+ {[...Array(items)].map((_, index) => getItemMarkup(index))}
77
+ </ul>
78
+ );
79
+ };
80
+
81
+ export default ListSkeleton;
@@ -0,0 +1 @@
1
+ export { default } from './ListSkeleton';
@@ -15,9 +15,16 @@ $button-l-min-width: 48px;
15
15
  display: flex;
16
16
  justify-content: center;
17
17
  align-items: center;
18
+ position: relative;
18
19
  }
19
20
 
20
21
  .container {
22
+ height: auto;
23
+ max-width: 100%;
24
+ position: relative;
25
+ }
26
+
27
+ .innerContainer {
21
28
  display: inline-flex;
22
29
  align-items: center;
23
30
  line-height: 1;
@@ -26,6 +33,11 @@ $button-l-min-width: 48px;
26
33
  position: relative;
27
34
  overflow: hidden;
28
35
 
36
+ &_disabled {
37
+ opacity: $disabled-opacity;
38
+ pointer-events: none;
39
+ }
40
+
29
41
  &:hover {
30
42
  box-shadow: $box-shadow-button;
31
43
  }
@@ -133,3 +145,8 @@ $button-l-min-width: 48px;
133
145
  .leftIcon {
134
146
  margin-right: $base-size;
135
147
  }
148
+
149
+ .spinner {
150
+ @include absolute-center;
151
+ z-index: 1;
152
+ }
@@ -24,7 +24,8 @@ interface Props {
24
24
  iconSize?: SizeTypes.SMALL | SizeTypes.MEDIUM | SizeTypes.LARGE;
25
25
  leftIcon?: `${IconTypes}`;
26
26
  rightIcon?: `${IconTypes}`;
27
- rotateIconByDegree?: 0 | 45 | 90 | 135 | 180 | 225 | 270 | 315;
27
+ rotateLeftIconByDegree?: 0 | 45 | 90 | 135 | 180 | 225 | 270 | 315;
28
+ rotateRigthIconByDegree?: 0 | 45 | 90 | 135 | 180 | 225 | 270 | 315;
28
29
  disabled?: boolean;
29
30
  className?: string;
30
31
  iconClassName?: string;
@@ -45,7 +46,8 @@ const MultiActionButton: FC<Props> = ({
45
46
  type = PRIMARY,
46
47
  size = MEDIUM,
47
48
  iconSize = MEDIUM,
48
- rotateIconByDegree,
49
+ rotateLeftIconByDegree,
50
+ rotateRigthIconByDegree,
49
51
  text,
50
52
  toolTip,
51
53
  leftIcon,
@@ -60,49 +62,51 @@ const MultiActionButton: FC<Props> = ({
60
62
  withSeparator,
61
63
  tabIndex
62
64
  }) => {
63
- const CONTAINER_CLASSES = s('container', {
64
- container_primary: type === PRIMARY,
65
- container_secondary: type === SECONDARY,
66
- container_tertiary: type === TERTIARY,
67
- container_small: size === SMALL,
68
- container_medium: size === MEDIUM,
69
- container_large: size === LARGE,
70
- loading,
71
- [className as string]: className
72
- });
73
-
74
65
  const buttonMarkup = (
75
- <div role={'group'} className={CONTAINER_CLASSES}>
76
- {loading ? (
77
- <div className={s('spinnerContainer')}>
78
- <SolidSpinner className={s('spinner')} type={type} size={SizeTypes.SMALL} />
79
- </div>
80
- ) : null}
81
- <button
82
- title={text || ariaLabel || 'button'}
83
- id={id ? `${id}` : ''}
84
- className={s({ button: true, button_left: true })}
85
- disabled={loading || disabled}
86
- onClick={!loading ? OnLeftClickCallback : undefined}
87
- autoFocus={autoFocus}
88
- aria-label={ariaLabel}
89
- tabIndex={tabIndex}
66
+ <div
67
+ role={'group'}
68
+ className={s('container', {
69
+ [className as string]: className
70
+ })}
71
+ >
72
+ {loading ? <SolidSpinner className={s('spinner')} type={type} size={SizeTypes.SMALL} /> : null}
73
+ <div
74
+ className={s('innerContainer', {
75
+ innerContainer_primary: type === PRIMARY,
76
+ innerContainer_secondary: type === SECONDARY,
77
+ innerContainer_tertiary: type === TERTIARY,
78
+ innerContainer_small: size === SMALL,
79
+ innerContainer_medium: size === MEDIUM,
80
+ innerContainer_large: size === LARGE,
81
+ innerContainer_disabled: loading || disabled
82
+ })}
90
83
  >
91
- {leftIcon ? (
92
- <Icon
93
- icon={leftIcon}
94
- size={iconSize || size}
95
- className={iconClassName}
96
- rotateIconByDegree={rotateIconByDegree}
97
- className={s('leftIcon')}
98
- />
99
- ) : null}
100
- {text}
101
- </button>
102
- {withSeparator ? <Separator marginX={'0'} color={type === SECONDARY ? ColorTypes.GREY_4 : ColorTypes.WHITE} /> : null}
103
- <button className={s({ button: true, button_right: true })} onClick={onRightClickCallback}>
104
- <Icon icon={rightIcon} size={iconSize || size} className={iconClassName} rotateIconByDegree={rotateIconByDegree} />
105
- </button>
84
+ <button
85
+ title={text || ariaLabel || 'button'}
86
+ id={id ? `${id}` : ''}
87
+ className={s({ button: true, button_left: true, button_disabled: loading || disabled })}
88
+ disabled={loading || disabled}
89
+ onClick={!loading ? OnLeftClickCallback : undefined}
90
+ autoFocus={autoFocus}
91
+ aria-label={ariaLabel}
92
+ tabIndex={tabIndex}
93
+ >
94
+ {leftIcon ? (
95
+ <Icon
96
+ icon={leftIcon}
97
+ size={iconSize || size}
98
+ className={iconClassName}
99
+ rotateIconByDegree={rotateLeftIconByDegree}
100
+ className={s('leftIcon')}
101
+ />
102
+ ) : null}
103
+ {text}
104
+ </button>
105
+ {withSeparator ? <Separator marginX={'0'} color={type === SECONDARY ? ColorTypes.GREY_4 : ColorTypes.WHITE} /> : null}
106
+ <button className={s({ button: true, button_right: true, button_disabled: loading || disabled })} onClick={onRightClickCallback}>
107
+ <Icon icon={rightIcon} size={iconSize || size} className={iconClassName} rotateIconByDegree={rotateRigthIconByDegree} />
108
+ </button>
109
+ </div>
106
110
  </div>
107
111
  );
108
112
 
package/src/index.ts CHANGED
@@ -8,6 +8,7 @@ import IconButton from 'src/components/IconButton/IconButton';
8
8
  import Separator from 'src/components/Separator/Separator';
9
9
  import Box from 'src/components/Box/Box';
10
10
  import FormSkeleton from 'src/components/FormSkeleton/FormSkeleton';
11
+ import ListSkeleton from 'src/components/ListSkeleton/ListSkeleton';
11
12
  import DropDown from 'src/components/DropDown/DropDown';
12
13
  import DropDownItem from 'src/components/DropDownItem/DropDownItem';
13
14
  import FacetButton from 'src/components/FacetButton/FacetButton';
@@ -34,6 +35,7 @@ export {
34
35
  Paragraph,
35
36
  Span,
36
37
  FormSkeleton,
38
+ ListSkeleton,
37
39
  DropDown,
38
40
  DropDownItem,
39
41
  FacetButton,
@@ -898,46 +898,46 @@
898
898
  }
899
899
 
900
900
  @mixin borderColor {
901
- .#{$prefix}_blue {
901
+ .borderColor_blue {
902
902
  border-color: $blue;
903
903
  }
904
- .#{$prefix}_lightBlue {
904
+ .borderColor_lightBlue {
905
905
  border-color: $light-blue;
906
906
  }
907
- .#{$prefix}_yellow {
907
+ .borderColor_yellow {
908
908
  border-color: $yellow;
909
909
  }
910
- .#{$prefix}_orange {
910
+ .borderColor_orange {
911
911
  border-color: $orange;
912
912
  }
913
- .#{$prefix}_green {
913
+ .borderColor_green {
914
914
  border-color: $green;
915
915
  }
916
- .#{$prefix}_red {
916
+ .borderColor_red {
917
917
  border-color: $red;
918
918
  }
919
- .#{$prefix}_white {
919
+ .borderColor_white {
920
920
  border-color: $white;
921
921
  }
922
- .#{$prefix}_grey1 {
922
+ .borderColor_grey1 {
923
923
  border-color: $grey-1;
924
924
  }
925
- .#{$prefix}_grey2 {
925
+ .borderColor_grey2 {
926
926
  border-color: $grey-2;
927
927
  }
928
- .#{$prefix}_grey3 {
928
+ .borderColor_grey3 {
929
929
  border-color: $grey-3;
930
930
  }
931
- .#{$prefix}_grey4 {
931
+ .borderColor_grey4 {
932
932
  border-color: $grey-4;
933
933
  }
934
- .#{$prefix}_grey5 {
934
+ .borderColor_grey5 {
935
935
  border-color: $grey-5;
936
936
  }
937
- .#{$prefix}_grey6 {
937
+ .borderColor_grey6 {
938
938
  border-color: $grey-6;
939
939
  }
940
- .#{$prefix}_black {
940
+ .borderColor_black {
941
941
  border-color: $black;
942
942
  }
943
943
  }