@i-dot-ai-npm/component-library-react 0.0.6 → 0.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@i-dot-ai-npm/component-library-react",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "React components for i.AI GOV.UK (auto-generated from HTML specs).",
5
5
  "type": "module",
6
6
  "exports": {
@@ -7,7 +7,7 @@ type DateInputFieldProps = {
7
7
  export default function DateInputField({ width, class: className, ...rest }: DateInputFieldProps) {
8
8
  const classes = [
9
9
  "govuk-input govuk-date-input__input",
10
- ({ "2": "govuk-input--width-2", "3": "govuk-input--width-3", "4": "govuk-input--width-4" }[width ?? ""] ?? ""),
10
+ (width ? { "2": "govuk-input--width-2", "3": "govuk-input--width-3", "4": "govuk-input--width-4" }[width] : ""),
11
11
  className ?? "",
12
12
  ]
13
13
  .filter(Boolean)
@@ -11,7 +11,7 @@ type FieldsetLegendProps = {
11
11
  export default function FieldsetLegend({ size, isPageHeading, class: className, children, ...rest }: FieldsetLegendProps) {
12
12
  const classes = [
13
13
  "govuk-fieldset__legend",
14
- ({ "small": "govuk-fieldset__legend--s", "medium": "govuk-fieldset__legend--m", "large": "govuk-fieldset__legend--l", "xl": "govuk-fieldset__legend--xl" }[size] ?? ""),
14
+ (size ? { "small": "govuk-fieldset__legend--s", "medium": "govuk-fieldset__legend--m", "large": "govuk-fieldset__legend--l", "xl": "govuk-fieldset__legend--xl" }[size] : ""),
15
15
  className ?? "",
16
16
  ]
17
17
  .filter(Boolean)
@@ -13,7 +13,7 @@ export default function Input({ error, extraLetterSpacing, subtle, width, class:
13
13
  error ? "govuk-input--error" : "",
14
14
  extraLetterSpacing ? "govuk-input--extra-letter-spacing" : "",
15
15
  subtle ? "govuk-input--subtle" : "",
16
- ({ "2": "govuk-input--width-2", "3": "govuk-input--width-3", "4": "govuk-input--width-4", "5": "govuk-input--width-5", "10": "govuk-input--width-10", "20": "govuk-input--width-20", "30": "govuk-input--width-30" }[width] ?? ""),
16
+ (width ? { "2": "govuk-input--width-2", "3": "govuk-input--width-3", "4": "govuk-input--width-4", "5": "govuk-input--width-5", "10": "govuk-input--width-10", "20": "govuk-input--width-20", "30": "govuk-input--width-30" }[width] : ""),
17
17
  className ?? "",
18
18
  ]
19
19
  .filter(Boolean)
@@ -10,7 +10,7 @@ type InputLabelProps = {
10
10
  export default function InputLabel({ size, class: className, children, ...rest }: InputLabelProps) {
11
11
  const classes = [
12
12
  "govuk-label",
13
- ({ "small": "govuk-label--s", "medium": "govuk-label--m", "large": "govuk-label--l", "xl": "govuk-label--xl" }[size] ?? ""),
13
+ (size ? { "small": "govuk-label--s", "medium": "govuk-label--m", "large": "govuk-label--l", "xl": "govuk-label--xl" }[size] : ""),
14
14
  className ?? "",
15
15
  ]
16
16
  .filter(Boolean)
@@ -11,7 +11,7 @@ type LabelProps = {
11
11
  export default function Label({ size, isPageHeading = false, class: className, children, ...rest }: LabelProps) {
12
12
  const classes = [
13
13
  "govuk-label",
14
- ({ "small": "govuk-label--s", "medium": "govuk-label--m", "large": "govuk-label--l", "xl": "govuk-label--xl" }[size] ?? ""),
14
+ (size ? { "small": "govuk-label--s", "medium": "govuk-label--m", "large": "govuk-label--l", "xl": "govuk-label--xl" }[size] : ""),
15
15
  className ?? "",
16
16
  ]
17
17
  .filter(Boolean)
package/src/link/Link.tsx CHANGED
@@ -14,7 +14,7 @@ export default function Link({ noUnderline, noVisitedState, variant, class: clas
14
14
  "govuk-link",
15
15
  noUnderline ? "govuk-link--no-underline" : "",
16
16
  noVisitedState ? "govuk-link--no-visited-state" : "",
17
- ({ "warning": "govuk-link--warning", "inverse": "govuk-link--inverse" }[variant] ?? ""),
17
+ (variant ? { "warning": "govuk-link--warning", "inverse": "govuk-link--inverse" }[variant] : ""),
18
18
  className ?? "",
19
19
  ]
20
20
  .filter(Boolean)
@@ -12,7 +12,7 @@ type TableCaptionProps = {
12
12
  export default function TableCaption({ size, class: className, children, ...rest }: TableCaptionProps) {
13
13
  const classes = [
14
14
  "govuk-table__caption",
15
- ({ "small": "govuk-table__caption--s", "medium": "govuk-table__caption--m", "large": "govuk-table__caption--l", "xl": "govuk-table__caption--xl" }[size] ?? ""),
15
+ (size ? { "small": "govuk-table__caption--s", "medium": "govuk-table__caption--m", "large": "govuk-table__caption--l", "xl": "govuk-table__caption--xl" }[size] : ""),
16
16
  className ?? "",
17
17
  ]
18
18
  .filter(Boolean)
package/src/tag/Tag.tsx CHANGED
@@ -10,7 +10,7 @@ type TagProps = {
10
10
  export default function Tag({ colour, class: className, children, ...rest }: TagProps) {
11
11
  const classes = [
12
12
  "govuk-tag",
13
- ({ "grey": "govuk-tag--grey", "green": "govuk-tag--green", "teal": "govuk-tag--teal", "turquoise": "govuk-tag--turquoise", "blue": "govuk-tag--blue", "light-blue": "govuk-tag--light-blue", "purple": "govuk-tag--purple", "magenta": "govuk-tag--magenta", "pink": "govuk-tag--pink", "red": "govuk-tag--red", "orange": "govuk-tag--orange", "yellow": "govuk-tag--yellow" }[colour] ?? ""),
13
+ (colour ? { "grey": "govuk-tag--grey", "green": "govuk-tag--green", "teal": "govuk-tag--teal", "turquoise": "govuk-tag--turquoise", "blue": "govuk-tag--blue", "light-blue": "govuk-tag--light-blue", "purple": "govuk-tag--purple", "magenta": "govuk-tag--magenta", "pink": "govuk-tag--pink", "red": "govuk-tag--red", "orange": "govuk-tag--orange", "yellow": "govuk-tag--yellow" }[colour] : ""),
14
14
  className ?? "",
15
15
  ]
16
16
  .filter(Boolean)