@canonical/react-ds-core 0.9.0-experimental.13 → 0.9.0-experimental.19

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.
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import "./styles.css";
3
3
  /** Buttons are clickable elements used to perform an action. */
4
- const Button = ({ id, className, appearance, label, ...props }) => {
4
+ const Button = ({ id, className, children, style, appearance, ...props }) => {
5
5
  return (_jsx("button", { id: id, className: ["ds", "button", appearance, className]
6
6
  .filter(Boolean)
7
- .join(" "), ...props, "aria-label": label, children: label }));
7
+ .join(" "), style: style, "aria-label": props["aria-label"] || children?.toString(), ...props, children: children }));
8
8
  };
9
9
  export default Button;
10
10
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../src/ui/Button/Button.tsx"],"names":[],"mappings":";AACA,OAAO,cAAc,CAAC;AAEtB,gEAAgE;AAChE,MAAM,MAAM,GAAG,CAAC,EACd,EAAE,EACF,SAAS,EACT,UAAU,EACV,KAAK,EACL,GAAG,KAAK,EACF,EAAsB,EAAE;IAC9B,OAAO,CACL,iBACE,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAC;aAC/C,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,KACR,KAAK,gBACG,KAAK,YAEhB,KAAK,GACC,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../src/ui/Button/Button.tsx"],"names":[],"mappings":";AACA,OAAO,cAAc,CAAC;AAEtB,gEAAgE;AAChE,MAAM,MAAM,GAAG,CAAC,EACd,EAAE,EACF,SAAS,EACT,QAAQ,EACR,KAAK,EACL,UAAU,EACV,GAAG,KAAK,EACF,EAAsB,EAAE;IAC9B,OAAO,CACL,iBACE,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAC;aAC/C,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,EACZ,KAAK,EAAE,KAAK,gBAIA,KAAK,CAAC,YAAY,CAAC,IAAI,QAAQ,EAAE,QAAQ,EAAE,KACnD,KAAK,YAER,QAAQ,GACF,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1,2 +1,12 @@
1
+ // TODO: this is how appearance could work as enum
2
+ //
3
+ // export enum ButtonAppearance {
4
+ // DEFAULT = "default",
5
+ // BASE = "base",
6
+ // POSITIVE = "positive",
7
+ // NEGATIVE = "negative",
8
+ // LINK = "link",
9
+ // }
10
+ //
1
11
  export {};
2
12
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ui/Button/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ui/Button/types.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,EAAE;AACF,iCAAiC;AACjC,yBAAyB;AACzB,mBAAmB;AACnB,2BAA2B;AAC3B,2BAA2B;AAC3B,mBAAmB;AACnB,IAAI;AACJ,EAAE"}
@@ -1,6 +1,6 @@
1
1
  import type Props from "./types.js";
2
2
  import "./styles.css";
3
3
  /** Buttons are clickable elements used to perform an action. */
4
- declare const Button: ({ id, className, appearance, label, ...props }: Props) => React.ReactElement;
4
+ declare const Button: ({ id, className, children, style, appearance, ...props }: Props) => React.ReactElement;
5
5
  export default Button;
6
6
  //# sourceMappingURL=Button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/ui/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,cAAc,CAAC;AAEtB,gEAAgE;AAChE,QAAA,MAAM,MAAM,GAAI,gDAMb,KAAK,KAAG,KAAK,CAAC,YAahB,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/ui/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,cAAc,CAAC;AAEtB,gEAAgE;AAChE,QAAA,MAAM,MAAM,GAAI,0DAOb,KAAK,KAAG,KAAK,CAAC,YAiBhB,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1,15 +1,18 @@
1
- import type React from "react";
1
+ import type { ButtonHTMLAttributes, ReactNode } from "react";
2
2
  export interface BaseProps {
3
3
  id?: string;
4
4
  /** Additional CSS classes */
5
5
  className?: string;
6
+ /**
7
+ * Button contents.
8
+ * This will also be used for the `aria-label`.
9
+ * If this contains anything other than a string literal (such as a <p> element), you should specify an
10
+ * `aria-label` prop to ensure that the button label is applied properly. Otherwise, the label will be set to [object Object].
11
+ * */
12
+ children: ReactNode;
6
13
  /** The visual style of the button */
7
14
  appearance?: "neutral" | "base" | "positive" | "negative" | "link";
8
- /** Button contents */
9
- label: string;
10
- /** Optional click handler */
11
- onClick?: () => void;
12
15
  }
13
- type Props = BaseProps & React.ButtonHTMLAttributes<HTMLButtonElement>;
16
+ type Props = BaseProps & ButtonHTMLAttributes<HTMLButtonElement>;
14
17
  export default Props;
15
18
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ui/Button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,MAAM,WAAW,SAAS;IAExB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,UAAU,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;IACnE,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,KAAK,KAAK,GAAG,SAAS,GAAG,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAEvE,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ui/Button/types.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7D,MAAM,WAAW,SAAS;IAExB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;SAKK;IACL,QAAQ,EAAE,SAAS,CAAC;IACpB,qCAAqC;IACrC,UAAU,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;CACpE;AAED,KAAK,KAAK,GAAG,SAAS,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAEjE,eAAe,KAAK,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonical/react-ds-core",
3
- "version": "0.9.0-experimental.13",
3
+ "version": "0.9.0-experimental.19",
4
4
  "type": "module",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -38,7 +38,7 @@
38
38
  "test:vitest:watch": "vitest"
39
39
  },
40
40
  "dependencies": {
41
- "@canonical/storybook-config": "^0.9.0-experimental.12",
41
+ "@canonical/storybook-config": "^0.9.0-experimental.19",
42
42
  "@canonical/styles": "^0.9.0-experimental.12",
43
43
  "react": "^19.0.0",
44
44
  "react-dom": "^19.0.0"
@@ -66,5 +66,5 @@
66
66
  "vite-tsconfig-paths": "^5.1.4",
67
67
  "vitest": "^3.0.9"
68
68
  },
69
- "gitHead": "80a8881629dff1e73974f03a014ae2de4b9977b8"
69
+ "gitHead": "989cbc0a9020e0952f922f111737e918860ad780"
70
70
  }