@performant-software/semantic-components 1.0.13-beta.2 → 1.0.13-beta.3
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/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Items.js +25 -13
- package/types/components/Items.js.flow +25 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@performant-software/semantic-components",
|
|
3
|
-
"version": "1.0.13-beta.
|
|
3
|
+
"version": "1.0.13-beta.3",
|
|
4
4
|
"description": "A package of shared components based on the Semantic UI Framework.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./build/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"build": "webpack --mode production && flow-copy-source -v src types"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@performant-software/shared-components": "^1.0.13-beta.
|
|
15
|
+
"@performant-software/shared-components": "^1.0.13-beta.3",
|
|
16
16
|
"@react-google-maps/api": "^2.8.1",
|
|
17
17
|
"axios": "^0.26.1",
|
|
18
18
|
"i18next": "^19.4.4",
|
package/src/components/Items.js
CHANGED
|
@@ -20,6 +20,16 @@ import './Items.css';
|
|
|
20
20
|
import type { Props as ListProps } from './List';
|
|
21
21
|
|
|
22
22
|
type Props = ListProps & {
|
|
23
|
+
/**
|
|
24
|
+
* Renders the Card/Item component as the passed component.
|
|
25
|
+
*/
|
|
26
|
+
as?: Element<any>,
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Props to supply to the Card/Item component.
|
|
30
|
+
*/
|
|
31
|
+
asProps?: any,
|
|
32
|
+
|
|
23
33
|
/**
|
|
24
34
|
* Child elements to append below the list content.
|
|
25
35
|
*/
|
|
@@ -61,11 +71,6 @@ type Props = ListProps & {
|
|
|
61
71
|
*/
|
|
62
72
|
renderAdditionalContent?: (item: any) => Element<any>,
|
|
63
73
|
|
|
64
|
-
/**
|
|
65
|
-
* Renders the container element for passed item.
|
|
66
|
-
*/
|
|
67
|
-
renderContainer?: (item: any, children: Element<any>) => ComponentType<any>,
|
|
68
|
-
|
|
69
74
|
/**
|
|
70
75
|
* A function that returns a JSX element to render as the card description.
|
|
71
76
|
* See Semantic UI <a href="https://react.semantic-ui.com/views/card/">Card</a>.
|
|
@@ -171,6 +176,17 @@ class ItemsClass extends Component<Props, {}> {
|
|
|
171
176
|
return classNames.join(' ');
|
|
172
177
|
}
|
|
173
178
|
|
|
179
|
+
/**
|
|
180
|
+
* Returns as asProps function value for the passed item, if provided.
|
|
181
|
+
*
|
|
182
|
+
* @param item
|
|
183
|
+
*
|
|
184
|
+
* @returns {*|{}}
|
|
185
|
+
*/
|
|
186
|
+
getItemProps(item) {
|
|
187
|
+
return (this.props.asProps && this.props.asProps(item)) || {};
|
|
188
|
+
}
|
|
189
|
+
|
|
174
190
|
/**
|
|
175
191
|
* Returns true if the component has the necessary props to render itself in the "selectable" state.
|
|
176
192
|
*
|
|
@@ -209,8 +225,10 @@ class ItemsClass extends Component<Props, {}> {
|
|
|
209
225
|
renderCard(item, index) {
|
|
210
226
|
let card = (
|
|
211
227
|
<Card
|
|
228
|
+
as={this.props.as}
|
|
212
229
|
key={item.id || index}
|
|
213
230
|
link={this.props.link}
|
|
231
|
+
{...this.getItemProps(item)}
|
|
214
232
|
>
|
|
215
233
|
{ this.props.renderImage && this.props.renderImage(item) }
|
|
216
234
|
<Card.Content>
|
|
@@ -280,10 +298,6 @@ class ItemsClass extends Component<Props, {}> {
|
|
|
280
298
|
);
|
|
281
299
|
}
|
|
282
300
|
|
|
283
|
-
if (this.props.renderContainer) {
|
|
284
|
-
card = this.props.renderContainer(item, card);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
301
|
return card;
|
|
288
302
|
}
|
|
289
303
|
|
|
@@ -347,7 +361,9 @@ class ItemsClass extends Component<Props, {}> {
|
|
|
347
361
|
renderItem(item, index) {
|
|
348
362
|
let listItem = (
|
|
349
363
|
<Item
|
|
364
|
+
as={this.props.as}
|
|
350
365
|
key={item.id || index}
|
|
366
|
+
{...this.getItemProps(item)}
|
|
351
367
|
>
|
|
352
368
|
{ this.props.renderImage && (
|
|
353
369
|
<Item.Image>
|
|
@@ -416,10 +432,6 @@ class ItemsClass extends Component<Props, {}> {
|
|
|
416
432
|
);
|
|
417
433
|
}
|
|
418
434
|
|
|
419
|
-
if (this.props.renderContainer) {
|
|
420
|
-
listItem = this.props.renderContainer(item, listItem);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
435
|
return listItem;
|
|
424
436
|
}
|
|
425
437
|
|
|
@@ -20,6 +20,16 @@ import './Items.css';
|
|
|
20
20
|
import type { Props as ListProps } from './List';
|
|
21
21
|
|
|
22
22
|
type Props = ListProps & {
|
|
23
|
+
/**
|
|
24
|
+
* Renders the Card/Item component as the passed component.
|
|
25
|
+
*/
|
|
26
|
+
as?: Element<any>,
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Props to supply to the Card/Item component.
|
|
30
|
+
*/
|
|
31
|
+
asProps?: any,
|
|
32
|
+
|
|
23
33
|
/**
|
|
24
34
|
* Child elements to append below the list content.
|
|
25
35
|
*/
|
|
@@ -61,11 +71,6 @@ type Props = ListProps & {
|
|
|
61
71
|
*/
|
|
62
72
|
renderAdditionalContent?: (item: any) => Element<any>,
|
|
63
73
|
|
|
64
|
-
/**
|
|
65
|
-
* Renders the container element for passed item.
|
|
66
|
-
*/
|
|
67
|
-
renderContainer?: (item: any, children: Element<any>) => ComponentType<any>,
|
|
68
|
-
|
|
69
74
|
/**
|
|
70
75
|
* A function that returns a JSX element to render as the card description.
|
|
71
76
|
* See Semantic UI <a href="https://react.semantic-ui.com/views/card/">Card</a>.
|
|
@@ -171,6 +176,17 @@ class ItemsClass extends Component<Props, {}> {
|
|
|
171
176
|
return classNames.join(' ');
|
|
172
177
|
}
|
|
173
178
|
|
|
179
|
+
/**
|
|
180
|
+
* Returns as asProps function value for the passed item, if provided.
|
|
181
|
+
*
|
|
182
|
+
* @param item
|
|
183
|
+
*
|
|
184
|
+
* @returns {*|{}}
|
|
185
|
+
*/
|
|
186
|
+
getItemProps(item) {
|
|
187
|
+
return (this.props.asProps && this.props.asProps(item)) || {};
|
|
188
|
+
}
|
|
189
|
+
|
|
174
190
|
/**
|
|
175
191
|
* Returns true if the component has the necessary props to render itself in the "selectable" state.
|
|
176
192
|
*
|
|
@@ -209,8 +225,10 @@ class ItemsClass extends Component<Props, {}> {
|
|
|
209
225
|
renderCard(item, index) {
|
|
210
226
|
let card = (
|
|
211
227
|
<Card
|
|
228
|
+
as={this.props.as}
|
|
212
229
|
key={item.id || index}
|
|
213
230
|
link={this.props.link}
|
|
231
|
+
{...this.getItemProps(item)}
|
|
214
232
|
>
|
|
215
233
|
{ this.props.renderImage && this.props.renderImage(item) }
|
|
216
234
|
<Card.Content>
|
|
@@ -280,10 +298,6 @@ class ItemsClass extends Component<Props, {}> {
|
|
|
280
298
|
);
|
|
281
299
|
}
|
|
282
300
|
|
|
283
|
-
if (this.props.renderContainer) {
|
|
284
|
-
card = this.props.renderContainer(item, card);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
301
|
return card;
|
|
288
302
|
}
|
|
289
303
|
|
|
@@ -347,7 +361,9 @@ class ItemsClass extends Component<Props, {}> {
|
|
|
347
361
|
renderItem(item, index) {
|
|
348
362
|
let listItem = (
|
|
349
363
|
<Item
|
|
364
|
+
as={this.props.as}
|
|
350
365
|
key={item.id || index}
|
|
366
|
+
{...this.getItemProps(item)}
|
|
351
367
|
>
|
|
352
368
|
{ this.props.renderImage && (
|
|
353
369
|
<Item.Image>
|
|
@@ -416,10 +432,6 @@ class ItemsClass extends Component<Props, {}> {
|
|
|
416
432
|
);
|
|
417
433
|
}
|
|
418
434
|
|
|
419
|
-
if (this.props.renderContainer) {
|
|
420
|
-
listItem = this.props.renderContainer(item, listItem);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
435
|
return listItem;
|
|
424
436
|
}
|
|
425
437
|
|