@eccenca/gui-elements 23.3.1 → 23.4.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.
Files changed (145) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js +3 -2
  3. package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
  4. package/dist/cjs/cmem/ActivityControl/SilkActivityControl.js +11 -6
  5. package/dist/cjs/cmem/ActivityControl/SilkActivityControl.js.map +1 -1
  6. package/dist/cjs/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.js +7 -4
  7. package/dist/cjs/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.js.map +1 -1
  8. package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js +61 -19
  9. package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
  10. package/dist/cjs/components/AutoSuggestion/AutoSuggestionList.js +4 -18
  11. package/dist/cjs/components/AutoSuggestion/AutoSuggestionList.js.map +1 -1
  12. package/dist/cjs/components/AutoSuggestion/ExtendedCodeEditor.js +65 -0
  13. package/dist/cjs/components/AutoSuggestion/ExtendedCodeEditor.js.map +1 -0
  14. package/dist/cjs/components/AutoSuggestion/index.js +3 -3
  15. package/dist/cjs/components/AutoSuggestion/index.js.map +1 -1
  16. package/dist/cjs/components/Card/CardHeader.js +19 -18
  17. package/dist/cjs/components/Card/CardHeader.js.map +1 -1
  18. package/dist/cjs/components/Grid/GridColumn.js +3 -3
  19. package/dist/cjs/components/Grid/GridColumn.js.map +1 -1
  20. package/dist/cjs/components/Icon/TestIcon.js +4 -4
  21. package/dist/cjs/components/Icon/TestIcon.js.map +1 -1
  22. package/dist/cjs/components/Icon/canonicalIconNames.js +5 -0
  23. package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
  24. package/dist/cjs/components/PropertyValuePair/PropertyName.js +4 -2
  25. package/dist/cjs/components/PropertyValuePair/PropertyName.js.map +1 -1
  26. package/dist/cjs/components/PropertyValuePair/PropertyValue.js +6 -4
  27. package/dist/cjs/components/PropertyValuePair/PropertyValue.js.map +1 -1
  28. package/dist/cjs/components/PropertyValuePair/PropertyValuePair.js +13 -3
  29. package/dist/cjs/components/PropertyValuePair/PropertyValuePair.js.map +1 -1
  30. package/dist/cjs/components/Skeleton/Skeleton.js +30 -0
  31. package/dist/cjs/components/Skeleton/Skeleton.js.map +1 -0
  32. package/dist/cjs/components/Skeleton/classnames.js +6 -0
  33. package/dist/cjs/components/Skeleton/classnames.js.map +1 -0
  34. package/dist/cjs/components/Table/TableCell.js +3 -2
  35. package/dist/cjs/components/Table/TableCell.js.map +1 -1
  36. package/dist/cjs/components/TextField/useTextValidation.js.map +1 -1
  37. package/dist/cjs/components/index.js +1 -0
  38. package/dist/cjs/components/index.js.map +1 -1
  39. package/dist/cjs/index.js +2 -0
  40. package/dist/cjs/index.js.map +1 -1
  41. package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js +3 -2
  42. package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
  43. package/dist/esm/cmem/ActivityControl/SilkActivityControl.js +14 -9
  44. package/dist/esm/cmem/ActivityControl/SilkActivityControl.js.map +1 -1
  45. package/dist/esm/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.js +8 -4
  46. package/dist/esm/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.js.map +1 -1
  47. package/dist/esm/components/AutoSuggestion/AutoSuggestion.js +82 -40
  48. package/dist/esm/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
  49. package/dist/esm/components/AutoSuggestion/AutoSuggestionList.js +6 -20
  50. package/dist/esm/components/AutoSuggestion/AutoSuggestionList.js.map +1 -1
  51. package/dist/esm/components/AutoSuggestion/ExtendedCodeEditor.js +70 -0
  52. package/dist/esm/components/AutoSuggestion/ExtendedCodeEditor.js.map +1 -0
  53. package/dist/esm/components/AutoSuggestion/index.js +2 -2
  54. package/dist/esm/components/AutoSuggestion/index.js.map +1 -1
  55. package/dist/esm/components/Card/CardHeader.js +15 -14
  56. package/dist/esm/components/Card/CardHeader.js.map +1 -1
  57. package/dist/esm/components/Grid/GridColumn.js +3 -3
  58. package/dist/esm/components/Grid/GridColumn.js.map +1 -1
  59. package/dist/esm/components/Icon/TestIcon.js +4 -4
  60. package/dist/esm/components/Icon/TestIcon.js.map +1 -1
  61. package/dist/esm/components/Icon/canonicalIconNames.js +5 -0
  62. package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
  63. package/dist/esm/components/PropertyValuePair/PropertyName.js +4 -2
  64. package/dist/esm/components/PropertyValuePair/PropertyName.js.map +1 -1
  65. package/dist/esm/components/PropertyValuePair/PropertyValue.js +6 -4
  66. package/dist/esm/components/PropertyValuePair/PropertyValue.js.map +1 -1
  67. package/dist/esm/components/PropertyValuePair/PropertyValuePair.js +13 -3
  68. package/dist/esm/components/PropertyValuePair/PropertyValuePair.js.map +1 -1
  69. package/dist/esm/components/Skeleton/Skeleton.js +24 -0
  70. package/dist/esm/components/Skeleton/Skeleton.js.map +1 -0
  71. package/dist/esm/components/Skeleton/classnames.js +3 -0
  72. package/dist/esm/components/Skeleton/classnames.js.map +1 -0
  73. package/dist/esm/components/Table/TableCell.js +4 -3
  74. package/dist/esm/components/Table/TableCell.js.map +1 -1
  75. package/dist/esm/components/TextField/useTextValidation.js.map +1 -1
  76. package/dist/esm/components/index.js +1 -0
  77. package/dist/esm/components/index.js.map +1 -1
  78. package/dist/esm/index.js +2 -0
  79. package/dist/esm/index.js.map +1 -1
  80. package/dist/types/cmem/ActivityControl/ActivityControlTypes.d.ts +1 -0
  81. package/dist/types/cmem/ActivityControl/ActivityControlWidget.d.ts +4 -0
  82. package/dist/types/cmem/ActivityControl/SilkActivityControl.d.ts +8 -4
  83. package/dist/types/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.d.ts +5 -4
  84. package/dist/types/components/AutoSuggestion/AutoSuggestion.d.ts +8 -2
  85. package/dist/types/components/AutoSuggestion/AutoSuggestionList.d.ts +6 -4
  86. package/dist/types/components/AutoSuggestion/{SingleLineCodeEditor.d.ts → ExtendedCodeEditor.d.ts} +7 -4
  87. package/dist/types/components/AutoSuggestion/index.d.ts +3 -3
  88. package/dist/types/components/Card/CardHeader.d.ts +2 -2
  89. package/dist/types/components/Grid/GridColumn.d.ts +1 -0
  90. package/dist/types/components/Icon/TestIcon.d.ts +2 -1
  91. package/dist/types/components/Icon/canonicalIconNames.d.ts +1 -1
  92. package/dist/types/components/PropertyValuePair/PropertyName.d.ts +7 -1
  93. package/dist/types/components/PropertyValuePair/PropertyValue.d.ts +7 -1
  94. package/dist/types/components/PropertyValuePair/PropertyValuePair.d.ts +5 -1
  95. package/dist/types/components/Skeleton/Skeleton.d.ts +13 -0
  96. package/dist/types/components/Skeleton/classnames.d.ts +1 -0
  97. package/dist/types/components/Table/TableCell.d.ts +7 -2
  98. package/dist/types/components/TextField/useTextValidation.d.ts +1 -0
  99. package/dist/types/components/index.d.ts +1 -0
  100. package/dist/types/index.d.ts +3 -0
  101. package/package.json +6 -3
  102. package/src/cmem/ActivityControl/ActivityControlTypes.ts +2 -0
  103. package/src/cmem/ActivityControl/ActivityControlWidget.tsx +6 -0
  104. package/src/cmem/ActivityControl/SilkActivityControl.tsx +78 -46
  105. package/src/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.tsx +12 -4
  106. package/src/components/AutoSuggestion/AutoSuggestion.tsx +84 -31
  107. package/src/components/AutoSuggestion/AutoSuggestionList.tsx +11 -42
  108. package/src/components/AutoSuggestion/ExtendedCodeEditor.tsx +129 -0
  109. package/src/components/AutoSuggestion/index.ts +3 -11
  110. package/src/components/AutoSuggestion/tests/AutoSuggestionList.test.tsx +83 -84
  111. package/src/components/AutoSuggestion/tests/{SingleLineCodeEditor.test.tsx → ExtendedCodeEditor.test.tsx} +7 -7
  112. package/src/components/Card/CardHeader.tsx +23 -25
  113. package/src/components/Grid/GridColumn.tsx +15 -13
  114. package/src/components/Icon/TestIcon.tsx +9 -13
  115. package/src/components/Icon/canonicalIconNames.tsx +10 -0
  116. package/src/components/Icon/stories/Icon.stories.tsx +17 -30
  117. package/src/components/Icon/stories/TestIcon.stories.tsx +8 -9
  118. package/src/components/OverviewItem/overviewitem.scss +27 -33
  119. package/src/components/Pagination/pagination.scss +6 -1
  120. package/src/components/PropertyValuePair/PropertyName.tsx +21 -2
  121. package/src/components/PropertyValuePair/PropertyValue.tsx +21 -5
  122. package/src/components/PropertyValuePair/PropertyValuePair.tsx +23 -4
  123. package/src/components/PropertyValuePair/propertyvalue.scss +6 -1
  124. package/src/components/PropertyValuePair/stories/PropertyName.stories.tsx +18 -0
  125. package/src/components/PropertyValuePair/stories/PropertyValue.stories.tsx +18 -0
  126. package/src/components/PropertyValuePair/stories/PropertyValueList.stories.tsx +33 -0
  127. package/src/components/PropertyValuePair/stories/PropertyValuePair.stories.tsx +29 -0
  128. package/src/components/Skeleton/Skeleton.stories.tsx +29 -0
  129. package/src/components/Skeleton/Skeleton.tsx +32 -0
  130. package/src/components/Skeleton/classnames.ts +3 -0
  131. package/src/components/Skeleton/skeleton.scss +1 -0
  132. package/src/components/Table/TableCell.tsx +12 -8
  133. package/src/components/Table/stories/TableCell.stories.tsx +30 -0
  134. package/src/components/Table/table.scss +96 -50
  135. package/src/components/TextField/stories/TextField.stories.tsx +21 -18
  136. package/src/components/TextField/useTextValidation.ts +82 -68
  137. package/src/components/index.scss +1 -0
  138. package/src/components/index.ts +1 -0
  139. package/src/extensions/codemirror/_codemirror.scss +1 -0
  140. package/src/index.ts +2 -0
  141. package/dist/cjs/components/AutoSuggestion/SingleLineCodeEditor.js +0 -53
  142. package/dist/cjs/components/AutoSuggestion/SingleLineCodeEditor.js.map +0 -1
  143. package/dist/esm/components/AutoSuggestion/SingleLineCodeEditor.js +0 -47
  144. package/dist/esm/components/AutoSuggestion/SingleLineCodeEditor.js.map +0 -1
  145. package/src/components/AutoSuggestion/SingleLineCodeEditor.tsx +0 -110
@@ -1,10 +1,8 @@
1
1
  $eccgui-color-overviewitem-divider: $ui-03 !default;
2
2
  $eccgui-size-overviewitem-spacing: $eccgui-size-typo-base * 0.5 !default;
3
-
4
3
  $eccgui-color-overviewitem-depiction-background: $eccgui-color-workspace-text !default;
5
4
  $eccgui-color-overviewitem-depiction-text: $eccgui-color-workspace-background !default;
6
5
  $eccgui-size-overviewitem-depiction-border-radius: $pt-border-radius !default;
7
-
8
6
  $eccgui-size-overviewitem-line-typo-small: $eccgui-size-typo-caption !default;
9
7
  $eccgui-size-overviewitem-line-typo-small-lineheight: $eccgui-size-typo-caption-lineheight !default;
10
8
  $eccgui-size-overviewitem-line-typo-large: $eccgui-size-typo-subtitle !default;
@@ -12,8 +10,7 @@ $eccgui-size-overviewitem-line-typo-large-lineheight: $eccgui-size-typo-subtitle
12
10
 
13
11
  .#{$eccgui}-overviewitem__list--hascolumns {
14
12
  display: flex;
15
- flex-direction: row;
16
- flex-wrap: wrap;
13
+ flex-flow: row wrap;
17
14
  align-items: stretch;
18
15
 
19
16
  & > li {
@@ -25,8 +22,8 @@ $eccgui-size-overviewitem-line-typo-large-lineheight: $eccgui-size-typo-subtitle
25
22
  }
26
23
 
27
24
  &.#{$eccgui}-overviewitem__list--hasspacing {
28
- margin-left: -1 * $eccgui-size-overviewitem-spacing * 0.5;
29
25
  margin-right: -1 * $eccgui-size-overviewitem-spacing * 0.5;
26
+ margin-left: -1 * $eccgui-size-overviewitem-spacing * 0.5;
30
27
 
31
28
  & > li {
32
29
  box-sizing: border-box;
@@ -48,13 +45,12 @@ $eccgui-size-overviewitem-line-typo-large-lineheight: $eccgui-size-typo-subtitle
48
45
 
49
46
  .#{$eccgui}-overviewitem__item {
50
47
  display: flex;
51
- flex-direction: row;
52
- flex-wrap: nowrap;
53
- justify-content: flex-start;
54
- align-items: stretch;
48
+ flex-flow: row nowrap;
55
49
  align-content: stretch;
56
- height: mini-units(6);
50
+ align-items: stretch;
51
+ justify-content: flex-start;
57
52
  max-width: 100%;
53
+ height: mini-units(6);
58
54
 
59
55
  &[tabindex]:not([tabindex="-1"]) {
60
56
  cursor: pointer;
@@ -66,19 +62,19 @@ $eccgui-size-overviewitem-line-typo-large-lineheight: $eccgui-size-typo-subtitle
66
62
  // @extend .#{$ns}-menu-item;
67
63
 
68
64
  &--active {
69
- background-color: $eccgui-color-accent;
70
65
  color: $eccgui-color-accent-contrast;
66
+ background-color: $eccgui-color-accent;
71
67
  }
72
68
  }
73
69
  }
74
70
 
75
71
  .#{$eccgui}-overviewitem__item--highdensity,
76
72
  .#{$eccgui}-overviewitem__list--highdensity > li > .#{$eccgui}-overviewitem__item {
77
- height: $button-height; //mini-units(4);
73
+ height: $button-height; // mini-units(4);
78
74
 
79
75
  & > .#{$eccgui}-overviewitem__depiction {
80
- width: $button-height; //mini-units(4);
81
- height: $button-height; //mini-units(4);
76
+ width: $button-height; // mini-units(4);
77
+ height: $button-height; // mini-units(4);
82
78
  }
83
79
  }
84
80
 
@@ -98,27 +94,28 @@ $eccgui-size-overviewitem-line-typo-large-lineheight: $eccgui-size-typo-subtitle
98
94
  }
99
95
 
100
96
  .#{$eccgui}-overviewitem__depiction {
97
+ display: flex;
101
98
  flex-grow: 0;
102
99
  flex-shrink: 0;
100
+ align-content: center;
101
+ align-items: center;
103
102
  width: mini-units(6);
104
103
  height: mini-units(6);
105
104
  overflow: hidden;
106
- display: flex;
107
- align-items: center;
108
- align-content: center;
109
105
  text-align: center;
110
106
  border-radius: $eccgui-size-overviewitem-depiction-border-radius;
111
107
 
112
108
  & > * {
109
+ display: block;
113
110
  width: auto;
114
111
  max-height: 100%;
115
- display: block;
116
112
  margin: 0 auto;
117
113
  }
118
114
 
119
115
  &:not(.#{$eccgui}-overviewitem__depiction--keepcolors) {
120
- background-color: $eccgui-color-overviewitem-depiction-background;
121
116
  color: $eccgui-color-overviewitem-depiction-text;
117
+ background-color: $eccgui-color-overviewitem-depiction-background;
118
+
122
119
  svg {
123
120
  fill: $eccgui-color-overviewitem-depiction-text;
124
121
  }
@@ -126,14 +123,13 @@ $eccgui-size-overviewitem-line-typo-large-lineheight: $eccgui-size-typo-subtitle
126
123
  }
127
124
 
128
125
  .#{$eccgui}-overviewitem__description {
129
- flex-grow: 1;
130
- flex-shrink: 1;
131
126
  display: flex;
132
127
  flex-direction: column;
133
- flex-wrap: nowrap;
134
- justify-content: flex-start;
135
- align-items: stretch;
128
+ flex-grow: 1;
129
+ flex-shrink: 1;
136
130
  align-content: stretch;
131
+ align-items: stretch;
132
+ justify-content: flex-start;
137
133
  overflow: hidden;
138
134
 
139
135
  .#{$eccgui}-overviewitem__depiction + & {
@@ -142,24 +138,23 @@ $eccgui-size-overviewitem-line-typo-large-lineheight: $eccgui-size-typo-subtitle
142
138
  }
143
139
 
144
140
  .#{$eccgui}-overviewitem__line {
145
- flex-shrink: 1;
146
- flex-grow: 1;
147
141
  display: flex;
142
+ flex: 1 1 100%;
148
143
  align-items: center;
149
144
  overflow: hidden;
150
- white-space: nowrap;
151
145
  font-size: 1rem;
146
+ white-space: nowrap;
152
147
 
153
148
  & > * {
154
149
  display: inline-block;
155
- font-size: inherit;
156
150
  max-width: 100%;
151
+ font-size: inherit;
157
152
  }
158
153
  }
159
154
 
160
155
  .#{$eccgui}-overviewitem__line--small {
161
156
  font-size: $eccgui-size-overviewitem-line-typo-small;
162
- line-height: $eccgui-size-overviewitem-line-typo-small-lineheight
157
+ line-height: $eccgui-size-overviewitem-line-typo-small-lineheight;
163
158
  }
164
159
 
165
160
  .#{$eccgui}-overviewitem__line--large {
@@ -168,13 +163,12 @@ $eccgui-size-overviewitem-line-typo-large-lineheight: $eccgui-size-typo-subtitle
168
163
  }
169
164
 
170
165
  .#{$eccgui}-overviewitem__actions {
166
+ display: flex;
167
+ flex-flow: row nowrap;
171
168
  flex-grow: 0;
172
169
  flex-shrink: 0;
173
- display: flex;
174
- flex-direction: row;
175
- flex-wrap: nowrap;
176
- justify-content: flex-end;
177
170
  align-items: center;
171
+ justify-content: flex-end;
178
172
 
179
173
  &:not(:first-child) {
180
174
  margin-left: mini-units(1);
@@ -6,8 +6,8 @@ $eccgui-color-pagination-text: $eccgui-color-workspace-text !default;
6
6
  $eccgui-size-typo-pagination: $eccgui-size-typo-caption !default;
7
7
 
8
8
  .#{$prefix}--pagination {
9
- background-color: $eccgui-color-pagination-background;
10
9
  font-size: $eccgui-size-typo-pagination;
10
+ background-color: $eccgui-color-pagination-background;
11
11
 
12
12
  .#{$prefix}--form-item,
13
13
  .#{$prefix}--select-input {
@@ -29,6 +29,11 @@ span.#{$prefix}--pagination__text {
29
29
  }
30
30
  }
31
31
 
32
+ .#{$prefix}--pagination__button--no-index {
33
+ // TODO: revalidate if this is still necessary using the latest version of carbon lib
34
+ color: rgba($eccgui-color-workspace-text, $eccgui-opacity-disabled);
35
+ }
36
+
32
37
  .#{$eccgui}-pagination--hideinfotext {
33
38
  .#{$prefix}--pagination__left > .#{$prefix}--pagination__text:last-child {
34
39
  display: none;
@@ -2,12 +2,19 @@ import React from "react";
2
2
 
3
3
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
4
4
  import Label, { LabelProps } from "../Label/Label";
5
+ import OverflowText from "../Typography/OverflowText";
5
6
 
6
7
  export interface PropertyNameProps extends React.HTMLAttributes<HTMLElement> {
7
8
  /**
8
9
  * Increase or decrease the width used for the property name.
9
10
  */
10
11
  size?: "small" | "medium" | "large";
12
+ /**
13
+ * Force label to get displayed without line breaks.
14
+ * This works best if you use a simple string as content.
15
+ * Otherwise you may need to take care yourself about it.
16
+ */
17
+ nowrap?: boolean;
11
18
  /**
12
19
  * Additional label properties, e.g. `tooltip`.
13
20
  * It is only used if the `PropertyName` has simple text input.
@@ -15,19 +22,31 @@ export interface PropertyNameProps extends React.HTMLAttributes<HTMLElement> {
15
22
  labelProps?: LabelProps;
16
23
  }
17
24
 
18
- export const PropertyName = ({ className = "", size, children, labelProps, ...otherDtProps }: PropertyNameProps) => {
25
+ export const PropertyName = ({
26
+ children,
27
+ className = "",
28
+ size,
29
+ nowrap,
30
+ labelProps,
31
+ ...otherDtProps
32
+ }: PropertyNameProps) => {
19
33
  return (
20
34
  <dt
21
35
  className={
22
36
  `${eccgui}-propertyvalue__property` +
23
37
  (size ? ` ${eccgui}-propertyvalue__property--${size}` : "") +
38
+ (nowrap ? ` ${eccgui}-propertyvalue__property--nowrap` : "") +
24
39
  (className ? " " + className : "")
25
40
  }
26
41
  {...otherDtProps}
27
42
  >
28
43
  <div>
29
44
  {typeof children === "string" ? (
30
- <Label text={children} isLayoutForElement="span" {...labelProps} />
45
+ <Label
46
+ text={nowrap ? <OverflowText inline>{children}</OverflowText> : children}
47
+ isLayoutForElement="span"
48
+ {...labelProps}
49
+ />
31
50
  ) : (
32
51
  children
33
52
  )}
@@ -1,14 +1,30 @@
1
1
  import React from "react";
2
+
2
3
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
4
+ import OverflowText from "../Typography/OverflowText";
3
5
 
4
- export interface PropertyValueProps extends React.HTMLAttributes<HTMLElement> {};
6
+ export interface PropertyValueProps extends React.HTMLAttributes<HTMLElement> {
7
+ /**
8
+ * Force value to get displayed without line breaks.
9
+ * This works best if you use a string or inline element as content.
10
+ * Otherwise you may need to take care yourself about it.
11
+ */
12
+ nowrap?: boolean;
13
+ }
5
14
 
6
- export const PropertyValue = ({ className = "", children, ...otherProps }: PropertyValueProps) => {
15
+ export const PropertyValue = ({ children, className = "", nowrap, ...otherDdProps }: PropertyValueProps) => {
7
16
  return (
8
- <dd className={`${eccgui}-propertyvalue__value` + (className ? " " + className : "")} {...otherProps}>
9
- <div>{children}</div>
17
+ <dd
18
+ className={
19
+ `${eccgui}-propertyvalue__value` +
20
+ (nowrap ? ` ${eccgui}-propertyvalue__value--nowrap` : "") +
21
+ (className ? " " + className : "")
22
+ }
23
+ {...otherDdProps}
24
+ >
25
+ <div>{nowrap ? <OverflowText passDown>{children}</OverflowText> : children}</div>
10
26
  </dd>
11
27
  );
12
- }
28
+ };
13
29
 
14
30
  export default PropertyValue;
@@ -1,6 +1,10 @@
1
1
  import React from "react";
2
+
2
3
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
3
4
 
5
+ import PropertyName from "./PropertyName";
6
+ import PropertyValue from "./PropertyValue";
7
+
4
8
  export interface PropertyValuePairProps extends React.HTMLAttributes<HTMLDivElement> {
5
9
  /**
6
10
  * Add a bit white space to the bottom of the element.
@@ -10,15 +14,30 @@ export interface PropertyValuePairProps extends React.HTMLAttributes<HTMLDivElem
10
14
  * Add a horizontal rule to the bottom of the element.
11
15
  */
12
16
  hasDivider?: boolean;
13
- };
17
+ /**
18
+ * Forward the `nowrap` option to it `PropertyName` and `PropertyValue` children.
19
+ */
20
+ nowrap?: boolean;
21
+ }
14
22
 
15
23
  export const PropertyValuePair = ({
16
- className = "",
17
24
  children,
25
+ className = "",
26
+ nowrap,
18
27
  hasSpacing = false,
19
28
  hasDivider = false,
20
29
  ...otherProps
21
30
  }: PropertyValuePairProps) => {
31
+ const alteredChildren = nowrap
32
+ ? React.Children.map(children, (child) => {
33
+ const originalChild = child as React.ReactElement;
34
+ if (originalChild.type && (originalChild.type === PropertyName || originalChild.type === PropertyValue)) {
35
+ return React.cloneElement(originalChild, { nowrap: true });
36
+ }
37
+ return child;
38
+ })
39
+ : children;
40
+
22
41
  return (
23
42
  <div
24
43
  className={
@@ -29,9 +48,9 @@ export const PropertyValuePair = ({
29
48
  }
30
49
  {...otherProps}
31
50
  >
32
- {children}
51
+ {alteredChildren}
33
52
  </div>
34
53
  );
35
- }
54
+ };
36
55
 
37
56
  export default PropertyValuePair;
@@ -6,7 +6,7 @@
6
6
 
7
7
  .#{$eccgui}-propertyvalue__pair {
8
8
  display: block;
9
- max-width: 100%;
9
+ width: 100%;
10
10
  clear: both;
11
11
 
12
12
  &.#{$eccgui}-propertyvalue__pair--hasdivider {
@@ -63,6 +63,11 @@
63
63
  }
64
64
  }
65
65
 
66
+ .#{$eccgui}-propertyvalue__property--nowrap {
67
+ overflow: visible;
68
+ white-space: nowrap;
69
+ }
70
+
66
71
  .#{$eccgui}-propertyvalue__value {
67
72
  box-sizing: content-box;
68
73
  margin-left: math.div(3, 16) * 100%;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { loremIpsum } from "react-lorem-ipsum";
3
+ import { Meta, StoryFn } from "@storybook/react";
4
+
5
+ import { PropertyName } from "../../../index";
6
+
7
+ export default {
8
+ title: "Components/PropertyValuePair/Name",
9
+ component: PropertyName,
10
+ argTypes: {},
11
+ } as Meta<typeof PropertyName>;
12
+
13
+ const Template: StoryFn<typeof PropertyName> = (args) => <PropertyName {...args} />;
14
+
15
+ export const Default = Template.bind({});
16
+ Default.args = {
17
+ children: loremIpsum({ p: 1, avgSentencesPerParagraph: 1, avgWordsPerSentence: 4, random: false }).toString(),
18
+ };
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { loremIpsum } from "react-lorem-ipsum";
3
+ import { Meta, StoryFn } from "@storybook/react";
4
+
5
+ import { PropertyValue } from "../../../index";
6
+
7
+ export default {
8
+ title: "Components/PropertyValuePair/Value",
9
+ component: PropertyValue,
10
+ argTypes: {},
11
+ } as Meta<typeof PropertyValue>;
12
+
13
+ const Template: StoryFn<typeof PropertyValue> = (args) => <PropertyValue {...args} />;
14
+
15
+ export const Default = Template.bind({});
16
+ Default.args = {
17
+ children: loremIpsum({ p: 3, avgSentencesPerParagraph: 5, avgWordsPerSentence: 8, random: false }).toString(),
18
+ };
@@ -0,0 +1,33 @@
1
+ import React from "react";
2
+ import { Meta, StoryFn } from "@storybook/react";
3
+
4
+ import { PropertyValueList, PropertyValuePair } from "../../../index";
5
+
6
+ import { Default as PairExample } from "./PropertyValuePair.stories";
7
+
8
+ export default {
9
+ title: "Components/PropertyValuePair/List",
10
+ component: PropertyValueList,
11
+ subcomponents: {
12
+ PropertyValuePair,
13
+ },
14
+ argTypes: {
15
+ children: {
16
+ control: "none",
17
+ description: "Shoukd be one or more `<PropertyValuePair />` elements.",
18
+ },
19
+ },
20
+ } as Meta<typeof PropertyValueList>;
21
+
22
+ const Template: StoryFn<typeof PropertyValueList> = (args) => <PropertyValueList {...args} />;
23
+
24
+ export const Default = Template.bind({});
25
+ Default.args = {
26
+ children: [
27
+ <PropertyValuePair {...PairExample.args} hasDivider hasSpacing />,
28
+ <PropertyValuePair {...PairExample.args} hasDivider hasSpacing />,
29
+ <PropertyValuePair {...PairExample.args} hasDivider hasSpacing />,
30
+ <PropertyValuePair {...PairExample.args} hasDivider hasSpacing />,
31
+ <PropertyValuePair {...PairExample.args} hasDivider hasSpacing />,
32
+ ],
33
+ };
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import { Meta, StoryFn } from "@storybook/react";
3
+
4
+ import { PropertyName, PropertyValue, PropertyValuePair } from "../../../index";
5
+
6
+ import { Default as NameExample } from "./PropertyName.stories";
7
+ import { Default as ValueExample } from "./PropertyValue.stories";
8
+
9
+ export default {
10
+ title: "Components/PropertyValuePair",
11
+ component: PropertyValuePair,
12
+ subcomponents: {
13
+ PropertyName,
14
+ PropertyValue,
15
+ },
16
+ argTypes: {
17
+ children: {
18
+ control: "none",
19
+ description: "Shoukd be `<PropertyName/>` and `<PropertyValue/>`, 1 of each.",
20
+ },
21
+ },
22
+ } as Meta<typeof PropertyValuePair>;
23
+
24
+ const Template: StoryFn<typeof PropertyValuePair> = (args) => <PropertyValuePair {...args} />;
25
+
26
+ export const Default = Template.bind({});
27
+ Default.args = {
28
+ children: [<PropertyName {...NameExample.args} />, <PropertyValue {...ValueExample.args} />],
29
+ };
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import { loremIpsum } from "react-lorem-ipsum";
3
+ import { Meta, StoryFn } from "@storybook/react";
4
+
5
+ import { Skeleton } from "./../../../index";
6
+
7
+ export default {
8
+ title: "Components/Skeleton",
9
+ component: Skeleton,
10
+ argTypes: {},
11
+ } as Meta<typeof Skeleton>;
12
+
13
+ const SkeletonExample: StoryFn<typeof Skeleton> = (args) => <Skeleton {...args} />;
14
+
15
+ export const Inline = SkeletonExample.bind({});
16
+ Inline.args = {
17
+ children: (
18
+ <span className="test">
19
+ {loremIpsum({ p: 1, avgSentencesPerParagraph: 1, avgWordsPerSentence: 3, random: false }).toString()}
20
+ </span>
21
+ ),
22
+ };
23
+
24
+ export const Block = SkeletonExample.bind({});
25
+ Block.args = {
26
+ children: (
27
+ <p>{loremIpsum({ p: 1, avgSentencesPerParagraph: 5, avgWordsPerSentence: 8, random: false }).toString()}</p>
28
+ ),
29
+ };
@@ -0,0 +1,32 @@
1
+ import React from "react";
2
+
3
+ import { SKELETON } from "./classnames";
4
+
5
+ export interface SkeletonProps {
6
+ /**
7
+ * Element that need to displayed using the skeleton styles.
8
+ */
9
+ children: JSX.Element | JSX.Element[];
10
+ }
11
+
12
+ /**
13
+ * `<Skeleton />` provides a loading state display of its children elements.
14
+ * It does not provide its own content.
15
+ */
16
+ export function Skeleton({ children }: SkeletonProps) {
17
+ const alteredChildren = React.Children.map(children, (child) => {
18
+ const originalChild = child as React.ReactElement;
19
+ if (originalChild.props) {
20
+ return React.cloneElement(originalChild, {
21
+ className: originalChild.props.className ? originalChild.props.className + " " + SKELETON : SKELETON,
22
+ // @see https://blueprintjs.com/docs/versions/4/#core/components/skeleton
23
+ disabled: true,
24
+ tabIndex: -1,
25
+ });
26
+ }
27
+ return originalChild;
28
+ });
29
+ return <>{alteredChildren}</>;
30
+ }
31
+
32
+ export default Skeleton;
@@ -0,0 +1,3 @@
1
+ import { Classes as BlueprintClasses } from "@blueprintjs/core";
2
+
3
+ export const SKELETON = BlueprintClasses.SKELETON;
@@ -0,0 +1 @@
1
+ @import "~@blueprintjs/core/src/components/skeleton/skeleton";
@@ -1,37 +1,41 @@
1
1
  import React from "react";
2
- import {
3
- TableCell as CarbonTableCell,
4
- TableCellProps as CarbonTableCellProps,
5
- } from "carbon-components-react";
2
+ import { TableCell as CarbonTableCell, TableCellProps as CarbonTableCellProps } from "carbon-components-react";
3
+
6
4
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
7
5
 
8
6
  export interface TableCellProps extends CarbonTableCellProps, React.TdHTMLAttributes<HTMLTableCellElement> {
7
+ /**
8
+ * By default all table cell content is aligned to the left of the cell.
9
+ * Use this property to change the horizontal alignment.
10
+ */
11
+ alignHorizontal?: "left" | "center";
9
12
  /**
10
13
  * By default all table cell content is aligned to the top of the cell.
11
14
  * Use this property to change the vertical alignment.
12
15
  */
13
- alignVertical?: "middle";
16
+ alignVertical?: "top" | "middle";
14
17
  }
15
18
 
16
19
  export function TableCell({
17
20
  className = "",
18
21
  children,
22
+ alignHorizontal,
19
23
  alignVertical,
20
24
  ...otherTableCellProps
21
25
  }: TableCellProps) {
22
-
23
26
  return (
24
27
  <CarbonTableCell
25
28
  className={
26
29
  `${eccgui}-simpletable__cell` +
27
- (!!alignVertical ? ` ${eccgui}-simpletable__cell--${alignVertical}` : "") +
30
+ (alignHorizontal ? ` ${eccgui}-simpletable__cell--${alignHorizontal}` : "") +
31
+ (alignVertical ? ` ${eccgui}-simpletable__cell--${alignVertical}` : "") +
28
32
  (className ? ` ${className}` : "")
29
33
  }
30
34
  {...otherTableCellProps}
31
35
  >
32
36
  {children}
33
37
  </CarbonTableCell>
34
- ) ;
38
+ );
35
39
  }
36
40
 
37
41
  export default TableCell;
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ import { loremIpsum } from "react-lorem-ipsum";
3
+ import { Meta, StoryFn } from "@storybook/react";
4
+
5
+ import { Table, TableBody, TableCell, TableContainer, TableRow } from "../../../index";
6
+
7
+ export default {
8
+ title: "Components/Table/TableCell",
9
+ component: TableCell,
10
+ argTypes: {},
11
+ } as Meta<typeof TableCell>;
12
+
13
+ const Template: StoryFn<typeof TableCell> = (args) => {
14
+ return (
15
+ <TableContainer>
16
+ <Table>
17
+ <TableBody>
18
+ <TableRow>
19
+ <TableCell {...args} />
20
+ </TableRow>
21
+ </TableBody>
22
+ </Table>
23
+ </TableContainer>
24
+ );
25
+ };
26
+
27
+ export const Default = Template.bind({});
28
+ Default.args = {
29
+ children: loremIpsum({ p: 1, avgSentencesPerParagraph: 1, avgWordsPerSentence: 4, random: false }).toString(),
30
+ };