@abgov/react-components 7.2.0-dev.24 → 7.2.0-dev.26

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/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # React UI Components
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@abgov/react-components?color=%230081a2&label=react-components&style=flat-square)](https://www.npmjs.com/package/@abgov/react-components)
4
+
5
+ React wrappers for the Government of Alberta Design System web components.
6
+
7
+ Supported React versions: 17, 18, and 19.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm i @abgov/react-components @abgov/web-components @abgov/ui-components-common @abgov/design-tokens
13
+ ```
14
+
15
+ ## Register the web components
16
+
17
+ Import the underlying web components once in your application entry point, such as
18
+ `src/main.tsx`:
19
+
20
+ ```typescript
21
+ import "@abgov/web-components";
22
+ ```
23
+
24
+ ## Add styles
25
+
26
+ Import the component styles and design tokens in your main stylesheet, such as
27
+ `src/index.css`:
28
+
29
+ ```css
30
+ @import "@abgov/web-components/index.css";
31
+ @import "@abgov/design-tokens/dist/tokens.css";
32
+ ```
33
+
34
+ ## Add icons
35
+
36
+ Add Ionicons to the `<head>` of `index.html`:
37
+
38
+ ```html
39
+ <script
40
+ type="module"
41
+ src="https://cdn.jsdelivr.net/npm/ionicons@latest/dist/ionicons/ionicons.esm.js"
42
+ ></script>
43
+ <script
44
+ nomodule
45
+ src="https://cdn.jsdelivr.net/npm/ionicons@latest/dist/ionicons/ionicons.js"
46
+ ></script>
47
+ ```
48
+
49
+ ## Use a component
50
+
51
+ ```tsx
52
+ import { GoabButton } from "@abgov/react-components";
53
+
54
+ export function App() {
55
+ return <GoabButton type="primary">Continue</GoabButton>;
56
+ }
57
+ ```
58
+
59
+ See the [developer setup guide](https://design.alberta.ca/get-started/developers/setup/) and
60
+ [Government of Alberta Design System](https://design.alberta.ca) for more information.
package/index.js CHANGED
@@ -138,6 +138,7 @@ function getIconValue(icon, iconType) {
138
138
  return iconType ? "true" : "false";
139
139
  }
140
140
  function GoabBadge({
141
+ content,
141
142
  icon,
142
143
  iconType,
143
144
  size = "medium",
@@ -150,10 +151,12 @@ function GoabBadge({
150
151
  {
151
152
  icon: getIconValue(icon, iconType),
152
153
  icontype: iconType,
154
+ content: typeof content === "string" ? content : void 0,
153
155
  ..._props,
154
156
  version: "2",
155
157
  size,
156
- emphasis
158
+ emphasis,
159
+ children: typeof content !== "string" && content != null && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "content", children: content })
157
160
  }
158
161
  );
159
162
  }