@thecb/components 12.0.0-beta.7 → 12.0.0-beta.8

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": "@thecb/components",
3
- "version": "12.0.0-beta.7",
3
+ "version": "12.0.0-beta.8",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -24,7 +24,8 @@ const InternalLink = forwardRef(
24
24
  hoverUnderline = true,
25
25
  extraHoverStyles = ``,
26
26
  extraActiveStyles = ``,
27
- extraFocusStyles = ``
27
+ extraFocusStyles = ``,
28
+ ...rest
28
29
  },
29
30
  ref
30
31
  ) => {
@@ -57,6 +58,7 @@ const InternalLink = forwardRef(
57
58
  extraFocusStyles={extraFocusStyles}
58
59
  data-qa={dataQa}
59
60
  ref={ref}
61
+ {...rest}
60
62
  >
61
63
  {safeChildren(children, <span />)}
62
64
  </StyledInternalLink>
@@ -6,6 +6,7 @@ import {
6
6
  import { Box, Stack } from "../../atoms/layouts";
7
7
  import Placeholder from "../../atoms/placeholder";
8
8
  import ButtonWithAction from "../../atoms/button-with-action";
9
+ import { InternalLink } from "../../atoms/link";
9
10
  import Text from "../../atoms/text";
10
11
  import Title from "../../atoms/title";
11
12
  import {
@@ -42,7 +43,8 @@ const EditableList = ({
42
43
  qaPrefix,
43
44
  ariaLabel,
44
45
  editItemAriaRole = "",
45
- disablePlaceholder = false
46
+ disablePlaceholder = false,
47
+ getEditHref = null
46
48
  }) => {
47
49
  const addText = `Add a${
48
50
  itemName[0].match(/[aieouAIEOU]/) ? "n" : ""
@@ -150,14 +152,25 @@ const EditableList = ({
150
152
  dataQa={qaPrefix + " Edit"}
151
153
  key={`Edit ${item.id}`}
152
154
  >
153
- <ButtonWithAction
154
- variant="smallGhost"
155
- text="Edit"
156
- action={() => editItem(item.id)}
157
- extraStyles={`min-width: 0;`}
158
- aria-label={`Edit ${ariaLabel || itemName}`}
159
- role={editItemAriaRole}
160
- />
155
+ {getEditHref ? (
156
+ <InternalLink
157
+ to={getEditHref(item)}
158
+ fontWeight="400"
159
+ extraStyles={`margin: 0.5rem; min-width: 0;`}
160
+ aria-label={`Edit ${ariaLabel || itemName}`}
161
+ >
162
+ Edit
163
+ </InternalLink>
164
+ ) : (
165
+ <ButtonWithAction
166
+ variant="smallGhost"
167
+ text="Edit"
168
+ action={() => editItem(item.id)}
169
+ extraStyles={`min-width: 0;`}
170
+ aria-label={`Edit ${ariaLabel || itemName}`}
171
+ role={editItemAriaRole}
172
+ />
173
+ )}
161
174
  </Box>
162
175
  )}
163
176
  </EditableListItemControls>
@@ -19,7 +19,7 @@ const IconsModule = ({
19
19
  Icon = iconsMap[icon];
20
20
  }
21
21
  return (
22
- <Box padding="0 1rem 0 0">
22
+ <Box padding="0 1rem 0 0" aria-hidden="true">
23
23
  <Cluster justify="center" align="center">
24
24
  <Icon color={iconColor} />
25
25
  </Cluster>