@spteck/react-controls-v2 2.6.9 → 2.7.1
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/README.md +46 -0
- package/dist/components/NewsBigCard/INewsBigCardProps.d.ts +6 -0
- package/dist/components/NewsCard/INewsCardProps.d.ts +13 -0
- package/dist/components/NewsCard/NewsCardMeta.d.ts +7 -0
- package/dist/components/NewsCardCompact/INewsCardCompactProps.d.ts +13 -0
- package/dist/components/NewsCardCompact/NewsCardCompactMeta.d.ts +7 -0
- package/dist/components/NewsFeed/DraggableFeedCard.d.ts +25 -0
- package/dist/components/NewsFeed/INewsFeedProps.d.ts +40 -0
- package/dist/components/NewsStats/NewsStats.d.ts +8 -0
- package/dist/components/NewsStats/useNewsStatsStyles.d.ts +7 -0
- package/dist/index.cjs +34 -34
- package/dist/index.js +6877 -6541
- package/dist/models/INewsItem.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -199,6 +199,52 @@ If you are also using app context and localization, the recommended provider ord
|
|
|
199
199
|
| `InlineSVG` | Load, sanitize, and render SVG from URLs, data URIs, and raw markup |
|
|
200
200
|
| `BackgroundImage` | Full-width background images with cover sizing and overlay support |
|
|
201
201
|
|
|
202
|
+
### News & Publishing
|
|
203
|
+
|
|
204
|
+
| Component | Description |
|
|
205
|
+
|-----------|-------------|
|
|
206
|
+
| `NewsCard` | Standard vertical news card — image on top, headline, category badge, body text, author/date meta row, and a stats row (views, likes, comments, optional share button). Supports `default` and `overlay` variants, over-due accent, per-card settings panel, and click/link navigation. |
|
|
207
|
+
| `NewsCardCompact` | Compact horizontal news card — thumbnail beside the text. Supports `default`, `flat`, and `overlay` variants plus all the same stats/share/settings props as `NewsCard`. |
|
|
208
|
+
| `NewsBigCard` | Large feature card with a wide side image column. Supports `default` and `overlay` variants, full visibility controls (`showBodyText`, `showAuthorDate`, `showStats`, `showComments`, `showShare`), and an optional settings panel. |
|
|
209
|
+
| `NewsFeed` | Feed container that renders a collection of `INewsFeedItem` objects in one of nine layout variants: `grid`, `list`, `filmstrip`, `marquee`, `carousel`, `mosaic`, `feature`, `masonry`, and `trending`. Supports drag-and-drop reordering, fixed-height scrolling, and feed-wide visibility toggles. |
|
|
210
|
+
| `NewsTrendingFeed` | Compact trending-news sidebar widget — numbered thumbnail list with headline, category, date, and an optional "view all" action. |
|
|
211
|
+
| `NewsStats` | Stats row sub-component used by the card components — displays views, likes, comments (with Fluent UI `Tooltip`s), and an optional circular share `Button`. |
|
|
212
|
+
|
|
213
|
+
#### `INewsItem` interface
|
|
214
|
+
|
|
215
|
+
```ts
|
|
216
|
+
interface INewsItem {
|
|
217
|
+
headline: string; // required — main card headline
|
|
218
|
+
category?: string; // section label shown above the headline
|
|
219
|
+
bodyText?: string; // short description or body copy
|
|
220
|
+
author?: string; // author display name
|
|
221
|
+
date?: string | Date; // published date (ISO string, formatted string, or Date)
|
|
222
|
+
imageUrl?: string; // image URL
|
|
223
|
+
views?: number; // view count shown in the stats row
|
|
224
|
+
likes?: number; // like count shown in the stats row
|
|
225
|
+
comments?: number; // comment count (shown when showComments is true)
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
#### Common card props
|
|
230
|
+
|
|
231
|
+
| Prop | Type | Default | Description |
|
|
232
|
+
|------|------|---------|-------------|
|
|
233
|
+
| `showBodyText` | `boolean` | `true` | Show / hide body text |
|
|
234
|
+
| `showAuthorDate` | `boolean` | `true` | Show / hide author and date |
|
|
235
|
+
| `showStats` | `boolean` | `true` | Show / hide the stats row (views, likes, comments) |
|
|
236
|
+
| `showComments` | `boolean` | `true` | Show comment count inside the stats row |
|
|
237
|
+
| `showShare` | `boolean` | `false` | Show a circular share icon-button in the stats row |
|
|
238
|
+
| `onShare` | `(item: INewsItem) => void` | — | Called when the share button is clicked |
|
|
239
|
+
| `showCardSettings` | `boolean` | `false` | Show a settings gear button for per-card display customisation |
|
|
240
|
+
| `isOverDue` | `boolean` | `false` | Apply an amber over-due colour accent to the card |
|
|
241
|
+
| `headlineLines` | `number` | `1` | Max lines before headline is clamped |
|
|
242
|
+
| `bodyLines` | `number` | `3` | Max lines before body text is clamped |
|
|
243
|
+
| `locale` | `string` | browser | BCP 47 locale for date formatting |
|
|
244
|
+
| `timeZone` | `string` | browser | IANA time-zone identifier for date formatting |
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
202
248
|
### Media & Content
|
|
203
249
|
|
|
204
250
|
| Component | Description |
|
|
@@ -33,5 +33,11 @@ export interface INewsBigCardProps extends IBaseProps {
|
|
|
33
33
|
showAuthorDate?: boolean;
|
|
34
34
|
/** Hide view / like stats in the meta row. Defaults to `true` (shown). */
|
|
35
35
|
showStats?: boolean;
|
|
36
|
+
/** Show the comments count in the stats row. @default true */
|
|
37
|
+
showComments?: boolean;
|
|
38
|
+
/** Show a share icon-button on the card. @default false */
|
|
39
|
+
showShare?: boolean;
|
|
40
|
+
/** Called when the user clicks the share button. Receives the card's item. */
|
|
41
|
+
onShare?: (item: INewsItem) => void;
|
|
36
42
|
}
|
|
37
43
|
//# sourceMappingURL=INewsBigCardProps.d.ts.map
|
|
@@ -32,5 +32,18 @@ export interface INewsCardProps extends IBaseProps {
|
|
|
32
32
|
showAuthorDate?: boolean;
|
|
33
33
|
/** Hide view / like stats in the meta row. Defaults to `true` (shown). */
|
|
34
34
|
showStats?: boolean;
|
|
35
|
+
/** Show the comments count in the stats row. @default true */
|
|
36
|
+
showComments?: boolean;
|
|
37
|
+
/** Show a share icon-button on the card. @default false */
|
|
38
|
+
showShare?: boolean;
|
|
39
|
+
/** Called when the user clicks the share button. Receives the card's item. */
|
|
40
|
+
onShare?: (item: INewsItem) => void;
|
|
41
|
+
/**
|
|
42
|
+
* Show a settings gear button on the card. Clicking it opens a panel where
|
|
43
|
+
* the viewer can toggle image, body text, author/date, and stats visibility,
|
|
44
|
+
* and set headline / body line clamp values. State is local to each instance.
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
showCardSettings?: boolean;
|
|
35
48
|
}
|
|
36
49
|
//# sourceMappingURL=INewsCardProps.d.ts.map
|
|
@@ -4,11 +4,18 @@ export interface INewsCardMetaProps {
|
|
|
4
4
|
dateText?: string;
|
|
5
5
|
views?: number;
|
|
6
6
|
likes?: number;
|
|
7
|
+
comments?: number;
|
|
8
|
+
/** Show the comments count. @default true */
|
|
9
|
+
showComments?: boolean;
|
|
7
10
|
/** Renders white text for use on dark overlay cards */
|
|
8
11
|
isOverlay?: boolean;
|
|
9
12
|
isOverDue?: boolean;
|
|
10
13
|
showAuthorDate?: boolean;
|
|
11
14
|
showStats?: boolean;
|
|
15
|
+
/** Show a share icon-button in the stats row. @default false */
|
|
16
|
+
showShare?: boolean;
|
|
17
|
+
/** Called when the user clicks the share button. */
|
|
18
|
+
onShare?: () => void;
|
|
12
19
|
className?: string;
|
|
13
20
|
style?: React.CSSProperties;
|
|
14
21
|
}
|
|
@@ -37,5 +37,18 @@ export interface INewsCardCompactProps extends IBaseProps {
|
|
|
37
37
|
showAuthorDate?: boolean;
|
|
38
38
|
/** Hide view / like stats in the meta row. Defaults to `true` (shown). */
|
|
39
39
|
showStats?: boolean;
|
|
40
|
+
/** Show the comments count in the stats row. @default true */
|
|
41
|
+
showComments?: boolean;
|
|
42
|
+
/** Show a share icon-button on the card. @default false */
|
|
43
|
+
showShare?: boolean;
|
|
44
|
+
/** Called when the user clicks the share button. Receives the card's item. */
|
|
45
|
+
onShare?: (item: INewsItem) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Show a settings gear button on the card. Clicking it opens a panel where
|
|
48
|
+
* the viewer can toggle image, body text, author/date, and stats visibility,
|
|
49
|
+
* and set headline / body line clamp values. State is local to each instance.
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
showCardSettings?: boolean;
|
|
40
53
|
}
|
|
41
54
|
//# sourceMappingURL=INewsCardCompactProps.d.ts.map
|
|
@@ -4,11 +4,18 @@ export interface INewsCardCompactMetaProps {
|
|
|
4
4
|
dateText?: string;
|
|
5
5
|
views?: number;
|
|
6
6
|
likes?: number;
|
|
7
|
+
comments?: number;
|
|
8
|
+
/** Show the comments count. @default true */
|
|
9
|
+
showComments?: boolean;
|
|
7
10
|
/** Renders white text for use on dark overlay cards */
|
|
8
11
|
isOverlay?: boolean;
|
|
9
12
|
isOverDue?: boolean;
|
|
10
13
|
showAuthorDate?: boolean;
|
|
11
14
|
showStats?: boolean;
|
|
15
|
+
/** Show a share icon-button in the stats row. @default false */
|
|
16
|
+
showShare?: boolean;
|
|
17
|
+
/** Called when the user clicks the share button. */
|
|
18
|
+
onShare?: () => void;
|
|
12
19
|
className?: string;
|
|
13
20
|
style?: React.CSSProperties;
|
|
14
21
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface IDraggableFeedCardProps {
|
|
3
|
+
/** Unique id that matches the item id used in SortableContext. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** When false the wrapper renders children as-is with no dnd behaviour. */
|
|
6
|
+
draggable?: boolean;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
/** Additional style applied to the outer wrapper (e.g. grid column span). */
|
|
9
|
+
wrapperStyle?: React.CSSProperties;
|
|
10
|
+
/** Additional className applied to the outer wrapper (e.g. masonry item class). */
|
|
11
|
+
wrapperClassName?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* DraggableFeedCard
|
|
15
|
+
*
|
|
16
|
+
* A thin sortable wrapper around any news card.
|
|
17
|
+
* When `draggable` is true it:
|
|
18
|
+
* - registers itself with @dnd-kit/sortable via `useSortable`
|
|
19
|
+
* - renders a drag handle (ReOrderDotsVertical icon) in the top-right corner,
|
|
20
|
+
* visible only on hover or while dragging
|
|
21
|
+
* - only attaches the pointer listeners to the handle so card clicks still work
|
|
22
|
+
* - applies CSS transform/transition during drag for smooth reordering
|
|
23
|
+
*/
|
|
24
|
+
export declare const DraggableFeedCard: React.FC<IDraggableFeedCardProps>;
|
|
25
|
+
//# sourceMappingURL=DraggableFeedCard.d.ts.map
|
|
@@ -34,6 +34,22 @@ export interface INewsFeedLayoutProps {
|
|
|
34
34
|
height?: number | string;
|
|
35
35
|
headlineLines?: number;
|
|
36
36
|
bodyLines?: number;
|
|
37
|
+
/** Hide body text. Defaults to `true` (shown). Pass `false` to hide. */
|
|
38
|
+
showBodyText?: boolean;
|
|
39
|
+
/** Hide author and date in the meta row. Defaults to `true` (shown). */
|
|
40
|
+
showAuthorDate?: boolean;
|
|
41
|
+
/** Hide view / like stats in the meta row. Defaults to `true` (shown). */
|
|
42
|
+
showStats?: boolean;
|
|
43
|
+
/** Show the comments count on every card. @default true */
|
|
44
|
+
showComments?: boolean;
|
|
45
|
+
/** Show a share icon-button on every card. @default false */
|
|
46
|
+
showShare?: boolean;
|
|
47
|
+
/** Called when the user clicks a card's share button. Receives the card's item. */
|
|
48
|
+
onShare?: (item: INewsItem) => void;
|
|
49
|
+
/** Show a settings gear button on every card allowing per-card display customisation. */
|
|
50
|
+
showCardSettings?: boolean;
|
|
51
|
+
/** When true, each card renders a drag handle and the layout is sortable. */
|
|
52
|
+
draggable?: boolean;
|
|
37
53
|
}
|
|
38
54
|
export interface INewsFeedProps extends IBaseProps {
|
|
39
55
|
/** Collection of news items to display */
|
|
@@ -77,5 +93,29 @@ export interface INewsFeedProps extends IBaseProps {
|
|
|
77
93
|
* @default false
|
|
78
94
|
*/
|
|
79
95
|
showCardSettings?: boolean;
|
|
96
|
+
/** Hide body text. Defaults to `true` (shown). Pass `false` to hide. */
|
|
97
|
+
showBodyText?: boolean;
|
|
98
|
+
/** Hide author and date in the meta row. Defaults to `true` (shown). */
|
|
99
|
+
showAuthorDate?: boolean;
|
|
100
|
+
/** Hide view / like stats in the meta row. Defaults to `true` (shown). */
|
|
101
|
+
showStats?: boolean;
|
|
102
|
+
/** Show the comments count on every card. @default true */
|
|
103
|
+
showComments?: boolean;
|
|
104
|
+
/** Show a share icon-button on every card. @default false */
|
|
105
|
+
showShare?: boolean;
|
|
106
|
+
/** Called when the user clicks a card's share button. Receives the card's item. */
|
|
107
|
+
onShare?: (item: INewsItem) => void;
|
|
108
|
+
/**
|
|
109
|
+
* Enable drag-and-drop reordering of cards.
|
|
110
|
+
* Supported layouts: `grid`, `list`, `masonry`, `feature`.
|
|
111
|
+
* Has no effect on `marquee`, `filmstrip`, `carousel`, and `trending`.
|
|
112
|
+
* @default false
|
|
113
|
+
*/
|
|
114
|
+
draggable?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Called after the user drops a card into a new position.
|
|
117
|
+
* Receives the full re-ordered items array so the parent can persist the new order.
|
|
118
|
+
*/
|
|
119
|
+
onItemsReorder?: (reorderedItems: INewsFeedItem[]) => void;
|
|
80
120
|
}
|
|
81
121
|
//# sourceMappingURL=INewsFeedProps.d.ts.map
|
|
@@ -2,11 +2,19 @@ import * as React from "react";
|
|
|
2
2
|
export interface INewsStatsProps {
|
|
3
3
|
views?: number;
|
|
4
4
|
likes?: number;
|
|
5
|
+
/** Number of comments to display */
|
|
6
|
+
comments?: number;
|
|
7
|
+
/** Show the comments count. @default true */
|
|
8
|
+
showComments?: boolean;
|
|
5
9
|
color: string;
|
|
6
10
|
isOverDue?: boolean;
|
|
7
11
|
iconSize?: number;
|
|
8
12
|
heartSize?: number;
|
|
9
13
|
paddingTop?: string;
|
|
14
|
+
/** Show a share icon-button. @default false */
|
|
15
|
+
showShare?: boolean;
|
|
16
|
+
/** Called when the user clicks the share button. */
|
|
17
|
+
onShare?: () => void;
|
|
10
18
|
}
|
|
11
19
|
export declare const NewsStats: React.FC<INewsStatsProps>;
|
|
12
20
|
//# sourceMappingURL=NewsStats.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface INewsStatsStyles {
|
|
2
|
+
viewIcon: string;
|
|
3
|
+
commentIcon: string;
|
|
4
|
+
buttonIcon: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const useNewsStatsStyles: (color: string, viewsColor: string, iconSize: number) => INewsStatsStyles;
|
|
7
|
+
//# sourceMappingURL=useNewsStatsStyles.d.ts.map
|