@uktrade/react-component-library 0.20.2 → 0.21.0
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/Tags/Tags.d.ts +2 -1
- package/dist/components/Tags/Tags.d.ts.map +1 -1
- package/dist/components/Tags/Tags.js +3 -3
- package/dist/components/Tags/Tags.module.css +7 -0
- package/package.json +1 -1
- package/src/components/Tags/Tags.module.css +7 -0
- package/src/components/Tags/Tags.tsx +15 -3
|
@@ -3,8 +3,9 @@ import { TagColours } from "../Colours";
|
|
|
3
3
|
export type TagProps = {
|
|
4
4
|
text: string;
|
|
5
5
|
colour: TagColours;
|
|
6
|
+
fullWidth?: boolean;
|
|
6
7
|
};
|
|
7
|
-
export declare const Tag: ({ text, colour }: TagProps) => React.JSX.Element;
|
|
8
|
+
export declare const Tag: ({ text, colour, fullWidth }: TagProps) => React.JSX.Element;
|
|
8
9
|
export type TagsProps = {
|
|
9
10
|
children: React.ReactNode;
|
|
10
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tags.d.ts","sourceRoot":"","sources":["../../../src/components/Tags/Tags.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"Tags.d.ts","sourceRoot":"","sources":["../../../src/components/Tags/Tags.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,GAAG,GAAI,6BAA6B,QAAQ,KAAG,KAAK,CAAC,GAAG,CAAC,OAarE,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,cAAc,SAAS,KAAG,KAAK,CAAC,GAAG,CAAC,OAExD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,QAAQ,EAAE,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,UAAU,aAAa,KAAG,KAAK,CAAC,GAAG,CAAC,OAU5D,CAAC"}
|
|
@@ -3,8 +3,8 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import { TagColours } from "../Colours";
|
|
5
5
|
import styles from "./Tags.module.css";
|
|
6
|
-
export const Tag = ({ text, colour }) => {
|
|
7
|
-
return _jsx("strong", { className: clsx("govuk-tag", colour, styles.tag), children: text });
|
|
6
|
+
export const Tag = ({ text, colour, fullWidth }) => {
|
|
7
|
+
return (_jsx("strong", { className: clsx("govuk-tag", colour, styles.tag, fullWidth && styles.fullWidth), children: text }));
|
|
8
8
|
};
|
|
9
9
|
export const Tags = ({ children }) => {
|
|
10
10
|
return _jsx("span", { className: clsx("govuk-tags", styles.root), children: children });
|
|
@@ -12,5 +12,5 @@ export const Tags = ({ children }) => {
|
|
|
12
12
|
export const TagsList = ({ tags }) => {
|
|
13
13
|
if (!tags || tags.length === 0)
|
|
14
14
|
return _jsx(_Fragment, {});
|
|
15
|
-
return (_jsx(Tags, { children: tags.map((tag) => (_jsx(Tag, { text: tag.text, colour: tag.colour }, tag.text))) }));
|
|
15
|
+
return (_jsx(Tags, { children: tags.map((tag) => (_jsx(Tag, { text: tag.text, colour: tag.colour, fullWidth: tag.fullWidth }, tag.text))) }));
|
|
16
16
|
};
|
package/package.json
CHANGED
|
@@ -8,10 +8,22 @@ import styles from "./Tags.module.css";
|
|
|
8
8
|
export type TagProps = {
|
|
9
9
|
text: string;
|
|
10
10
|
colour: TagColours;
|
|
11
|
+
fullWidth?: boolean;
|
|
11
12
|
};
|
|
12
13
|
|
|
13
|
-
export const Tag = ({ text, colour }: TagProps): React.JSX.Element => {
|
|
14
|
-
return
|
|
14
|
+
export const Tag = ({ text, colour, fullWidth }: TagProps): React.JSX.Element => {
|
|
15
|
+
return (
|
|
16
|
+
<strong
|
|
17
|
+
className={clsx(
|
|
18
|
+
"govuk-tag",
|
|
19
|
+
colour,
|
|
20
|
+
styles.tag,
|
|
21
|
+
fullWidth && styles.fullWidth
|
|
22
|
+
)}
|
|
23
|
+
>
|
|
24
|
+
{text}
|
|
25
|
+
</strong>
|
|
26
|
+
);
|
|
15
27
|
};
|
|
16
28
|
|
|
17
29
|
export type TagsProps = {
|
|
@@ -32,7 +44,7 @@ export const TagsList = ({ tags }: TagsListProps): React.JSX.Element => {
|
|
|
32
44
|
return (
|
|
33
45
|
<Tags>
|
|
34
46
|
{tags.map((tag) => (
|
|
35
|
-
<Tag key={tag.text} text={tag.text} colour={tag.colour} />
|
|
47
|
+
<Tag key={tag.text} text={tag.text} colour={tag.colour} fullWidth={tag.fullWidth} />
|
|
36
48
|
))}
|
|
37
49
|
</Tags>
|
|
38
50
|
);
|