@thecb/components 9.5.1 → 9.5.2

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": "9.5.1",
3
+ "version": "9.5.2",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
package/src/.DS_Store CHANGED
Binary file
Binary file
Binary file
@@ -39,7 +39,8 @@ const EditableList = ({
39
39
  as = "p",
40
40
  listPadding = "0rem 0rem 1.5rem 0rem",
41
41
  qaPrefix,
42
- ariaLabel
42
+ ariaLabel,
43
+ editItemAriaRole = ""
43
44
  }) => {
44
45
  const addText = `Add a${
45
46
  itemName[0].match(/[aieouAIEOU]/) ? "n" : ""
@@ -151,6 +152,7 @@ const EditableList = ({
151
152
  action={() => editItem(item.id)}
152
153
  extraStyles={`min-width: 0;`}
153
154
  aria-label={`Edit ${ariaLabel || itemName}`}
155
+ role={editItemAriaRole}
154
156
  />
155
157
  </Box>
156
158
  )}
@@ -0,0 +1,31 @@
1
+ import React, { useState } from "react";
2
+ import { boolean } from "@storybook/addon-knobs";
3
+
4
+ import EditableList from "./EditableList";
5
+ import page from "../../../../.storybook/page";
6
+
7
+ const story = page({
8
+ title: "Components|Molecules/EditableList",
9
+ Component: EditableList
10
+ });
11
+ export default story;
12
+
13
+ export const editableList = () => {
14
+ return (
15
+ <EditableList
16
+ as="h2"
17
+ canRemove={false}
18
+ title="Contact first name"
19
+ titleWeight="600"
20
+ editItem={() => console.log("edit click")}
21
+ editItemAriaRole="link"
22
+ itemName="Contact first name"
23
+ listPadding="0"
24
+ renderItem={contactFirstName => contactFirstName}
25
+ maxItems={1}
26
+ items={["Ronald"]}
27
+ qaPrefix="Contact first name"
28
+ ariaLabel="Contact first name"
29
+ />
30
+ );
31
+ };