@ndlib/component-library 0.0.86 → 0.0.88
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/dist/components/composites/StructuredData/index.d.ts +4 -4
- package/dist/components/composites/StructuredData/index.js +20 -18
- package/dist/components/elements/Fields/CheckboxGroup/index.d.ts +9 -9
- package/dist/components/elements/Fields/CheckboxGroup/index.js +8 -8
- package/dist/components/elements/Fields/RadioGroup/index.d.ts +10 -9
- package/dist/components/elements/Fields/RadioGroup/index.js +8 -8
- package/package.json +1 -1
|
@@ -13,13 +13,13 @@ export type StructuredDataProps = {
|
|
|
13
13
|
endDate: string;
|
|
14
14
|
slug: string;
|
|
15
15
|
shortDescription: string;
|
|
16
|
-
representationalImage
|
|
16
|
+
representationalImage?: {
|
|
17
17
|
url: string;
|
|
18
18
|
};
|
|
19
|
-
location
|
|
19
|
+
location?: {
|
|
20
20
|
address: string;
|
|
21
21
|
};
|
|
22
|
-
locationText
|
|
22
|
+
locationText?: {
|
|
23
23
|
name: string;
|
|
24
24
|
};
|
|
25
25
|
}[];
|
|
@@ -27,7 +27,7 @@ export type StructuredDataProps = {
|
|
|
27
27
|
title: string;
|
|
28
28
|
author: string;
|
|
29
29
|
shortDescription: string;
|
|
30
|
-
image
|
|
30
|
+
image?: {
|
|
31
31
|
url: string;
|
|
32
32
|
};
|
|
33
33
|
slug: string;
|
|
@@ -19,32 +19,34 @@ export const getStructuredDataSchemas = ({ title, pathname, description, nofollo
|
|
|
19
19
|
const schemas = [];
|
|
20
20
|
if (pathname !== '') {
|
|
21
21
|
schemas.push(stringifyWebpageSchema({
|
|
22
|
-
name: metadata.title,
|
|
23
|
-
description: metadata.description,
|
|
24
|
-
url: metadata.url,
|
|
25
|
-
lang: metadata.lang,
|
|
22
|
+
name: metadata === null || metadata === void 0 ? void 0 : metadata.title,
|
|
23
|
+
description: metadata === null || metadata === void 0 ? void 0 : metadata.description,
|
|
24
|
+
url: metadata === null || metadata === void 0 ? void 0 : metadata.url,
|
|
25
|
+
lang: metadata === null || metadata === void 0 ? void 0 : metadata.lang,
|
|
26
26
|
}));
|
|
27
27
|
events === null || events === void 0 ? void 0 : events.map((event) => {
|
|
28
|
+
var _a, _b, _c;
|
|
28
29
|
schemas.push(stringifyEventSchema({
|
|
29
|
-
title: event.title,
|
|
30
|
-
description: event.shortDescription,
|
|
31
|
-
image: event.representationalImage.url,
|
|
32
|
-
url: event.slug,
|
|
33
|
-
startDate: event.startDate,
|
|
34
|
-
endDate: event.endDate,
|
|
35
|
-
eventLocation: event.location.address,
|
|
36
|
-
eventLocationName: event.locationText.name,
|
|
30
|
+
title: event === null || event === void 0 ? void 0 : event.title,
|
|
31
|
+
description: event === null || event === void 0 ? void 0 : event.shortDescription,
|
|
32
|
+
image: (_a = event === null || event === void 0 ? void 0 : event.representationalImage) === null || _a === void 0 ? void 0 : _a.url,
|
|
33
|
+
url: event === null || event === void 0 ? void 0 : event.slug,
|
|
34
|
+
startDate: event === null || event === void 0 ? void 0 : event.startDate,
|
|
35
|
+
endDate: event === null || event === void 0 ? void 0 : event.endDate,
|
|
36
|
+
eventLocation: (_b = event === null || event === void 0 ? void 0 : event.location) === null || _b === void 0 ? void 0 : _b.address,
|
|
37
|
+
eventLocationName: (_c = event === null || event === void 0 ? void 0 : event.locationText) === null || _c === void 0 ? void 0 : _c.name,
|
|
37
38
|
siteUrl: siteUrl,
|
|
38
39
|
}));
|
|
39
40
|
});
|
|
40
41
|
news === null || news === void 0 ? void 0 : news.map((article) => {
|
|
42
|
+
var _a;
|
|
41
43
|
schemas.push(stringifyNewsSchema({
|
|
42
|
-
title: article.title,
|
|
43
|
-
abstract: article.shortDescription,
|
|
44
|
-
author: article.author,
|
|
45
|
-
image: article.image.url,
|
|
46
|
-
url: article.slug,
|
|
47
|
-
publishedDate: article.publishedDate,
|
|
44
|
+
title: article === null || article === void 0 ? void 0 : article.title,
|
|
45
|
+
abstract: article === null || article === void 0 ? void 0 : article.shortDescription,
|
|
46
|
+
author: article === null || article === void 0 ? void 0 : article.author,
|
|
47
|
+
image: (_a = article === null || article === void 0 ? void 0 : article.image) === null || _a === void 0 ? void 0 : _a.url,
|
|
48
|
+
url: article === null || article === void 0 ? void 0 : article.slug,
|
|
49
|
+
publishedDate: article === null || article === void 0 ? void 0 : article.publishedDate,
|
|
48
50
|
siteUrl: siteUrl,
|
|
49
51
|
}));
|
|
50
52
|
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { StyledElementProps, StylesProp } from '../../../../theme';
|
|
3
2
|
import { Key } from '../option';
|
|
4
|
-
type Option = {
|
|
5
|
-
value:
|
|
3
|
+
type Option<K extends Key = string> = {
|
|
4
|
+
value: K;
|
|
6
5
|
label: string;
|
|
7
6
|
};
|
|
8
|
-
type CheckboxGroupProps = StyledElementProps<HTMLDivElement, {
|
|
9
|
-
onChange: (value: Set<
|
|
10
|
-
options: Option[];
|
|
11
|
-
checkedOptions?: Set<
|
|
12
|
-
columnStyles
|
|
7
|
+
type CheckboxGroupProps<K extends Key = string> = StyledElementProps<HTMLDivElement, {
|
|
8
|
+
onChange: (value: Set<K>) => void;
|
|
9
|
+
options: Option<K>[];
|
|
10
|
+
checkedOptions?: Set<K>;
|
|
11
|
+
columnStyles?: StylesProp;
|
|
12
|
+
rowStyles?: StylesProp;
|
|
13
13
|
columns?: number;
|
|
14
14
|
}, string>;
|
|
15
|
-
export declare
|
|
15
|
+
export declare function CheckboxGroup<K extends Key>({ options, checkedOptions, columns: columnsProp, columnStyles, rowStyles, onChange, ...rest }: CheckboxGroupProps<K>): import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
export {};
|
|
@@ -18,8 +18,8 @@ import { Group } from '../../Group';
|
|
|
18
18
|
import { GROUP_TYPE } from '../../Group';
|
|
19
19
|
import { Column } from '../../layout/Column';
|
|
20
20
|
import { TYPOGRAPHY_TYPE, getTypographyStyles, } from '../../../../theme/typography';
|
|
21
|
-
export
|
|
22
|
-
var { options, checkedOptions, columns: columnsProp, columnStyles, onChange } = _a, rest = __rest(_a, ["options", "checkedOptions", "columns", "columnStyles", "onChange"]);
|
|
21
|
+
export function CheckboxGroup(_a) {
|
|
22
|
+
var { options, checkedOptions, columns: columnsProp, columnStyles, rowStyles, onChange } = _a, rest = __rest(_a, ["options", "checkedOptions", "columns", "columnStyles", "rowStyles", "onChange"]);
|
|
23
23
|
const columns = columnsProp || 1;
|
|
24
24
|
const optionsByColumn = useMemo(() => {
|
|
25
25
|
const optionsByColumn = [];
|
|
@@ -33,10 +33,7 @@ export const CheckboxGroup = (_a) => {
|
|
|
33
33
|
}
|
|
34
34
|
return optionsByColumn;
|
|
35
35
|
}, [options, columns]);
|
|
36
|
-
return (_jsx(Row, Object.assign({}, rest, { children: optionsByColumn.map((options, index) => (_jsx(Column, Object.assign({ grow: 1, sx: Object.assign({ mr: 4 }, columnStyles) }, { children: options.map((option) => (_jsx(Group, Object.assign({ type: GROUP_TYPE.RAW }, { children: ({ labelTargetId }) => (_jsxs(Row, Object.assign({ sx: {
|
|
37
|
-
mb: 2,
|
|
38
|
-
alignItems: 'center',
|
|
39
|
-
} }, { children: [_jsx(Checkbox, { onChange: (checked) => {
|
|
36
|
+
return (_jsx(Row, Object.assign({}, rest, { children: optionsByColumn.map((options, index) => (_jsx(Column, Object.assign({ grow: 1, sx: Object.assign({ mr: 4 }, columnStyles) }, { children: options.map((option) => (_jsx(Group, Object.assign({ type: GROUP_TYPE.RAW }, { children: ({ labelTargetId }) => (_jsxs(Row, Object.assign({ sx: Object.assign({ mb: 2, alignItems: 'center' }, rowStyles) }, { children: [_jsx(Checkbox, { onChange: (checked) => {
|
|
40
37
|
const updatedSet = new Set(checkedOptions || []);
|
|
41
38
|
if (checked) {
|
|
42
39
|
updatedSet.add(option.value);
|
|
@@ -45,5 +42,8 @@ export const CheckboxGroup = (_a) => {
|
|
|
45
42
|
updatedSet.delete(option.value);
|
|
46
43
|
}
|
|
47
44
|
onChange(updatedSet);
|
|
48
|
-
}, checked: !!(checkedOptions === null || checkedOptions === void 0 ? void 0 : checkedOptions.has(option.value)), id: labelTargetId, sx: {
|
|
49
|
-
|
|
45
|
+
}, checked: !!(checkedOptions === null || checkedOptions === void 0 ? void 0 : checkedOptions.has(option.value)), id: labelTargetId, sx: {
|
|
46
|
+
mr: 2,
|
|
47
|
+
flexShrink: 0,
|
|
48
|
+
} }), _jsx(Label, Object.assign({ sx: Object.assign({ cursor: 'pointer' }, getTypographyStyles(TYPOGRAPHY_TYPE.CONDENSED_TEXT_MEDIUM)) }, { children: option.label }))] }))) }), option.value))) }), index))) })));
|
|
49
|
+
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { StyledElementProps } from '../../../../theme';
|
|
1
|
+
import { StyledElementProps, StylesProp } from '../../../../theme';
|
|
3
2
|
import { Key } from '../option';
|
|
4
|
-
type Option = {
|
|
5
|
-
value:
|
|
3
|
+
type Option<K extends Key = string> = {
|
|
4
|
+
value: K;
|
|
6
5
|
label: string;
|
|
7
6
|
};
|
|
8
|
-
type RadioGroupProps = StyledElementProps<HTMLDivElement, {
|
|
9
|
-
onChange: (value:
|
|
10
|
-
options: Option[];
|
|
11
|
-
|
|
7
|
+
type RadioGroupProps<K extends Key = string> = StyledElementProps<HTMLDivElement, {
|
|
8
|
+
onChange: (value: K) => void;
|
|
9
|
+
options: Option<K>[];
|
|
10
|
+
columnStyles?: StylesProp;
|
|
11
|
+
rowStyles?: StylesProp;
|
|
12
|
+
checked?: K;
|
|
12
13
|
}, string>;
|
|
13
|
-
export declare
|
|
14
|
+
export declare function RadioGroup<K extends Key = string>({ options, checked, onChange, columnStyles, rowStyles, ...rest }: RadioGroupProps<K>): import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export {};
|
|
@@ -17,12 +17,12 @@ import { GROUP_TYPE } from '../../Group';
|
|
|
17
17
|
import { Column } from '../../layout/Column';
|
|
18
18
|
import { TYPOGRAPHY_TYPE, getTypographyStyles, } from '../../../../theme/typography';
|
|
19
19
|
import { Radio } from '../Radio';
|
|
20
|
-
export
|
|
21
|
-
var { options, checked, onChange } = _a, rest = __rest(_a, ["options", "checked", "onChange"]);
|
|
22
|
-
return (_jsx(Column, Object.assign({}, rest, { children: options.map((option) => (_jsx(Group, Object.assign({ type: GROUP_TYPE.RAW }, { children: ({ labelTargetId }) => (_jsxs(Row, Object.assign({ sx: {
|
|
23
|
-
mb: 2,
|
|
24
|
-
alignItems: 'center',
|
|
25
|
-
} }, { children: [_jsx(Radio, { onChange: () => {
|
|
20
|
+
export function RadioGroup(_a) {
|
|
21
|
+
var { options, checked, onChange, columnStyles, rowStyles } = _a, rest = __rest(_a, ["options", "checked", "onChange", "columnStyles", "rowStyles"]);
|
|
22
|
+
return (_jsx(Column, Object.assign({}, rest, { sx: columnStyles }, { children: options.map((option) => (_jsx(Group, Object.assign({ type: GROUP_TYPE.RAW }, { children: ({ labelTargetId }) => (_jsxs(Row, Object.assign({ sx: Object.assign({ mb: 2, alignItems: 'center' }, rowStyles) }, { children: [_jsx(Radio, { onChange: () => {
|
|
26
23
|
onChange(option.value);
|
|
27
|
-
}, checked: checked === option.value, id: labelTargetId, sx: {
|
|
28
|
-
|
|
24
|
+
}, checked: checked === option.value, id: labelTargetId, sx: {
|
|
25
|
+
mr: 2,
|
|
26
|
+
flexShrink: 0,
|
|
27
|
+
} }), _jsx(Label, Object.assign({ sx: Object.assign({ cursor: 'pointer' }, getTypographyStyles(TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM)) }, { children: option.label }))] }))) }), option.value))) })));
|
|
28
|
+
}
|