@ndlib/component-library 1.0.17 → 1.0.19

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.
@@ -18,6 +18,7 @@ type CardChildren = React.ReactNode | ((state: CardState) => React.ReactNode);
18
18
  export type CardProps = StyledElementProps<HTMLDivElement, {
19
19
  headline?: string;
20
20
  heading?: string;
21
+ headlineStyles?: StylesProp;
21
22
  headingStyles?: StylesProp;
22
23
  headingIcon?: React.FC;
23
24
  headingAction?: React.ReactNode;
@@ -52,7 +52,7 @@ const DateDisplay = ({ date: dateString }) => {
52
52
  mt: 1,
53
53
  } }, { children: MONTH_LABELS[date.getMonth()] }))] })));
54
54
  };
55
- export const Card = ({ size, displayDate, headline, image, alt, layout, onClick, raised, truncateHeadlineAfter, heading, headingStyles, headingIcon, headingAction, backgroundColor, sx, imageHeight: imageHeightProp, imageWidth: imageWidthProp, containImage, containerWidth, containerHeight, children, }) => {
55
+ export const Card = ({ size, displayDate, headline, image, alt, layout, onClick, raised, truncateHeadlineAfter, heading, headlineStyles, headingStyles, headingIcon, headingAction, backgroundColor, sx, imageHeight: imageHeightProp, imageWidth: imageWidthProp, containImage, containerWidth, containerHeight, children, }) => {
56
56
  const theme = useTheme();
57
57
  const contentPaddingX = size === CARD_SIZE.SM ? 3 : 4;
58
58
  const isVertical = !layout || layout === CARD_LAYOUT.VERTICAL;
@@ -110,7 +110,7 @@ export const Card = ({ size, displayDate, headline, image, alt, layout, onClick,
110
110
  color: COLOR.WHITE,
111
111
  mt: 0,
112
112
  whiteSpace: 'nowrap',
113
- } }, { children: heading }))] }), _jsx(Row, { children: headingAction && headingAction })] }))), _jsx(Row, Object.assign({ sx: { px: contentPaddingX, py: contentPaddingY } }, { children: _jsxs(Column, Object.assign({ justify: "center" }, { children: [headline && (_jsx(Heading, Object.assign({ typography: typography, sx: { mt: 0 } }, { children: truncateHeadlineAfter ? (_jsx(ReadMore, Object.assign({ lines: truncateHeadlineAfter, typography: typography, sx: { bg: activeBackground } }, { children: headline }))) : (headline) }))), children && (_jsx(Box, Object.assign({ sx: { mt: headline && !heading ? 2 : 0 } }, { children: typeof children === 'function'
113
+ } }, { children: heading }))] }), _jsx(Row, { children: headingAction && headingAction })] }))), _jsx(Row, Object.assign({ sx: { px: contentPaddingX, py: contentPaddingY } }, { children: _jsxs(Column, Object.assign({ justify: "center" }, { children: [headline && (_jsx(Heading, Object.assign({ typography: typography, sx: Object.assign({ mt: 0 }, headlineStyles) }, { children: truncateHeadlineAfter ? (_jsx(ReadMore, Object.assign({ lines: truncateHeadlineAfter, typography: typography, sx: { bg: activeBackground } }, { children: headline }))) : (headline) }))), children && (_jsx(Box, Object.assign({ sx: { mt: headline && !heading ? 2 : 0 } }, { children: typeof children === 'function'
114
114
  ? children({ isHovered, activeBackground })
115
115
  : children })))] })) }))] })));
116
116
  };
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx } from "theme-ui/jsx-runtime";
13
- import React, { useEffect, useMemo, useRef } from 'react';
13
+ import React, { useEffect, useId, useRef } from 'react';
14
14
  import { useEnvironment } from '../../providers/env';
15
15
  export var GROUP_TYPE;
16
16
  (function (GROUP_TYPE) {
@@ -35,9 +35,9 @@ export const Group = (_a) => {
35
35
  const { level: parentLevel } = useGroup();
36
36
  const { flagInDevelopment } = useEnvironment();
37
37
  const type = typeProp || GROUP_TYPE.REGION;
38
- const randomSlug = useMemo(() => Math.random().toString().slice(2), []);
39
- const labelId = `group-label-${randomSlug}`;
40
- const labelTargetId = `labeled-${randomSlug}`;
38
+ const uniqueId = useId();
39
+ const labelId = `group-label-${uniqueId}`;
40
+ const labelTargetId = `labeled-${uniqueId}`;
41
41
  const headingRenderTracker = useRef({
42
42
  hasHeadingRendered: false,
43
43
  });
@@ -8,6 +8,7 @@ type HeaderProps = StyledElementProps<HTMLSpanElement, {
8
8
  underline?: boolean;
9
9
  underlineColor?: COLOR;
10
10
  typography?: TYPOGRAPHY_TYPE;
11
+ headlineStyles?: any;
11
12
  level?: number;
12
13
  }>;
13
14
  export declare enum HEADING_SIZE {
@@ -39,7 +39,7 @@ const LEVEL_TYPOGRAPHY_MAP = {
39
39
  6: TYPOGRAPHY_TYPE.HEADING_SMALL,
40
40
  };
41
41
  export const Heading = (_a) => {
42
- var { sx, size, standalone, underline, underlineColor, typography: typographyProp, level: levelParam } = _a, rest = __rest(_a, ["sx", "size", "standalone", "underline", "underlineColor", "typography", "level"]);
42
+ var { sx, size, standalone, underline, underlineColor, headlineStyles, typography: typographyProp, level: levelParam } = _a, rest = __rest(_a, ["sx", "size", "standalone", "underline", "underlineColor", "headlineStyles", "typography", "level"]);
43
43
  const { level: groupLevel, labelId, type, trackHeadingRendered } = useGroup();
44
44
  const { flagInDevelopment } = useEnvironment();
45
45
  const theme = useTheme();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndlib/component-library",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "files": [