@reykjavik/hanna-react 0.10.99 → 0.10.100
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/ArticleCards.d.ts +3 -1
- package/ArticleCards.js +1 -1
- package/CHANGELOG.md +2 -1
- package/_abstract/_CardList.d.ts +2 -1
- package/_abstract/_CardList.js +3 -2
- package/esm/ArticleCards.d.ts +3 -1
- package/esm/ArticleCards.js +1 -1
- package/esm/_abstract/_CardList.d.ts +2 -1
- package/esm/_abstract/_CardList.js +3 -2
- package/package.json +1 -1
package/ArticleCards.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { ImageCardListProps, ImageCardProps } from './_abstract/_CardList.js';
|
|
|
2
2
|
export type ArticleCardsItemProps = ImageCardProps;
|
|
3
3
|
/** @deprecated Use `ArticleCardsItemProps` instead (Remove in v0.11) */
|
|
4
4
|
export type ArticleCardProps = ArticleCardsItemProps;
|
|
5
|
-
export type ArticleCardsProps = Pick<ImageCardListProps, 'cards' | 'imgPlaceholder'
|
|
5
|
+
export type ArticleCardsProps = Pick<ImageCardListProps, 'cards' | 'imgPlaceholder'> & {
|
|
6
|
+
size?: 'large' | 'normal';
|
|
7
|
+
};
|
|
6
8
|
export declare const ArticleCards: (props: ArticleCardsProps) => JSX.Element;
|
|
7
9
|
export default ArticleCards;
|
package/ArticleCards.js
CHANGED
|
@@ -4,6 +4,6 @@ exports.ArticleCards = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const _CardList_js_1 = require("./_abstract/_CardList.js");
|
|
7
|
-
const ArticleCards = (props) => (react_1.default.createElement(_CardList_js_1.CardList, { bemPrefix: "ArticleCards", standalone: true, cards: props.cards, imgPlaceholder: props.imgPlaceholder || true }));
|
|
7
|
+
const ArticleCards = (props) => (react_1.default.createElement(_CardList_js_1.CardList, { bemPrefix: "ArticleCards", modifier: props.size === 'large' ? 'large' : undefined, standalone: true, cards: props.cards, imgPlaceholder: props.imgPlaceholder || true }));
|
|
8
8
|
exports.ArticleCards = ArticleCards;
|
|
9
9
|
exports.default = exports.ArticleCards;
|
package/CHANGELOG.md
CHANGED
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
- ... <!-- Add new lines here. -->
|
|
6
6
|
|
|
7
|
-
## 0.10.97 – 0.10.
|
|
7
|
+
## 0.10.97 – 0.10.100
|
|
8
8
|
|
|
9
9
|
_2023-08-22_
|
|
10
10
|
|
|
11
11
|
- feat: Add prop `meta` to items of `ActionCards`
|
|
12
12
|
- feat: Add prop `summary` to items of `ArticleCards` and `ImageCards`
|
|
13
|
+
- feat: Add prop `size="large"` to `ArticleCards`
|
|
13
14
|
- feat: Allow `JSX.Element` as item `meta` for accepting `*Cards` components
|
|
14
15
|
- feat: Allow `JSX.Element` as item `summary` for all `*Cards` components
|
|
15
16
|
- feat: Expand `MainMenuItemList` to allow components as custom
|
package/_abstract/_CardList.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { EitherObj } from '@reykjavik/hanna-utils';
|
|
3
|
+
import { BemModifierProps } from '../utils/types.js';
|
|
3
4
|
import { ImageProps } from './_Image.js';
|
|
4
5
|
export type TextCardProps = {
|
|
5
6
|
title: string;
|
|
@@ -28,6 +29,6 @@ type _CardListProps = EitherObj<ImageCardListProps, TextCardListProps> & CardLis
|
|
|
28
29
|
bemPrefix: string;
|
|
29
30
|
children?: ReactNode;
|
|
30
31
|
standalone?: boolean;
|
|
31
|
-
};
|
|
32
|
+
} & BemModifierProps;
|
|
32
33
|
export declare const CardList: (props: _CardListProps) => JSX.Element;
|
|
33
34
|
export {};
|
package/_abstract/_CardList.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CardList = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const classUtils_1 = require("@hugsmidjan/qj/classUtils");
|
|
6
7
|
const _Button_js_1 = require("./_Button.js");
|
|
7
8
|
const _Image_js_1 = require("./_Image.js");
|
|
8
9
|
const Card = (props) => {
|
|
@@ -21,7 +22,7 @@ const Card = (props) => {
|
|
|
21
22
|
' '));
|
|
22
23
|
};
|
|
23
24
|
const CardList = (props) => {
|
|
24
|
-
const { bemPrefix, title, summaryElement, cards, titleTag = 'h2', children, imgPlaceholder, } = props;
|
|
25
|
+
const { bemPrefix, modifier, title, summaryElement, cards, titleTag = 'h2', children, imgPlaceholder, } = props;
|
|
25
26
|
const TitleTag = titleTag;
|
|
26
27
|
const fallbackImageUrl = (imgPlaceholder !== true && imgPlaceholder) || undefined;
|
|
27
28
|
const fallbackImageStyle = fallbackImageUrl
|
|
@@ -33,7 +34,7 @@ const CardList = (props) => {
|
|
|
33
34
|
summaryElement ? (react_1.default.createElement("div", { className: bemPrefix + '__summary' },
|
|
34
35
|
title && react_1.default.createElement(TitleTag, { className: bemPrefix + '__title' }, title),
|
|
35
36
|
summaryElement)) : (title && react_1.default.createElement(TitleTag, { className: bemPrefix + '__title' }, title)),
|
|
36
|
-
react_1.default.createElement("ul", { className:
|
|
37
|
+
react_1.default.createElement("ul", { className: props.standalone ? (0, classUtils_1.modifiedClass)(bemPrefix, modifier) : bemPrefix + '__list', style: fallbackImageStyle }, cards.map((card, i) => (react_1.default.createElement("li", { key: i, className: bemPrefix + '__item' },
|
|
37
38
|
react_1.default.createElement(Card
|
|
38
39
|
/* Assert as `ImageCardProps` to silence the imgPlaceholder false-positive */
|
|
39
40
|
, Object.assign({}, card, { bem: bemPrefix, imgPlaceholder: !!imgPlaceholder })))))),
|
package/esm/ArticleCards.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { ImageCardListProps, ImageCardProps } from './_abstract/_CardList.js';
|
|
|
2
2
|
export type ArticleCardsItemProps = ImageCardProps;
|
|
3
3
|
/** @deprecated Use `ArticleCardsItemProps` instead (Remove in v0.11) */
|
|
4
4
|
export type ArticleCardProps = ArticleCardsItemProps;
|
|
5
|
-
export type ArticleCardsProps = Pick<ImageCardListProps, 'cards' | 'imgPlaceholder'
|
|
5
|
+
export type ArticleCardsProps = Pick<ImageCardListProps, 'cards' | 'imgPlaceholder'> & {
|
|
6
|
+
size?: 'large' | 'normal';
|
|
7
|
+
};
|
|
6
8
|
export declare const ArticleCards: (props: ArticleCardsProps) => JSX.Element;
|
|
7
9
|
export default ArticleCards;
|
package/esm/ArticleCards.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CardList } from './_abstract/_CardList.js';
|
|
3
|
-
export const ArticleCards = (props) => (React.createElement(CardList, { bemPrefix: "ArticleCards", standalone: true, cards: props.cards, imgPlaceholder: props.imgPlaceholder || true }));
|
|
3
|
+
export const ArticleCards = (props) => (React.createElement(CardList, { bemPrefix: "ArticleCards", modifier: props.size === 'large' ? 'large' : undefined, standalone: true, cards: props.cards, imgPlaceholder: props.imgPlaceholder || true }));
|
|
4
4
|
export default ArticleCards;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { EitherObj } from '@reykjavik/hanna-utils';
|
|
3
|
+
import { BemModifierProps } from '../utils/types.js';
|
|
3
4
|
import { ImageProps } from './_Image.js';
|
|
4
5
|
export type TextCardProps = {
|
|
5
6
|
title: string;
|
|
@@ -28,6 +29,6 @@ type _CardListProps = EitherObj<ImageCardListProps, TextCardListProps> & CardLis
|
|
|
28
29
|
bemPrefix: string;
|
|
29
30
|
children?: ReactNode;
|
|
30
31
|
standalone?: boolean;
|
|
31
|
-
};
|
|
32
|
+
} & BemModifierProps;
|
|
32
33
|
export declare const CardList: (props: _CardListProps) => JSX.Element;
|
|
33
34
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
2
3
|
import { Button } from './_Button.js';
|
|
3
4
|
import { Image } from './_Image.js';
|
|
4
5
|
const Card = (props) => {
|
|
@@ -17,7 +18,7 @@ const Card = (props) => {
|
|
|
17
18
|
' '));
|
|
18
19
|
};
|
|
19
20
|
export const CardList = (props) => {
|
|
20
|
-
const { bemPrefix, title, summaryElement, cards, titleTag = 'h2', children, imgPlaceholder, } = props;
|
|
21
|
+
const { bemPrefix, modifier, title, summaryElement, cards, titleTag = 'h2', children, imgPlaceholder, } = props;
|
|
21
22
|
const TitleTag = titleTag;
|
|
22
23
|
const fallbackImageUrl = (imgPlaceholder !== true && imgPlaceholder) || undefined;
|
|
23
24
|
const fallbackImageStyle = fallbackImageUrl
|
|
@@ -29,7 +30,7 @@ export const CardList = (props) => {
|
|
|
29
30
|
summaryElement ? (React.createElement("div", { className: bemPrefix + '__summary' },
|
|
30
31
|
title && React.createElement(TitleTag, { className: bemPrefix + '__title' }, title),
|
|
31
32
|
summaryElement)) : (title && React.createElement(TitleTag, { className: bemPrefix + '__title' }, title)),
|
|
32
|
-
React.createElement("ul", { className:
|
|
33
|
+
React.createElement("ul", { className: props.standalone ? modifiedClass(bemPrefix, modifier) : bemPrefix + '__list', style: fallbackImageStyle }, cards.map((card, i) => (React.createElement("li", { key: i, className: bemPrefix + '__item' },
|
|
33
34
|
React.createElement(Card
|
|
34
35
|
/* Assert as `ImageCardProps` to silence the imgPlaceholder false-positive */
|
|
35
36
|
, Object.assign({}, card, { bem: bemPrefix, imgPlaceholder: !!imgPlaceholder })))))),
|