@simplybusiness/mobius 3.1.3 → 3.2.1

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/CHANGELOG.md CHANGED
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file, or link in
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.2.0] - 2023-01-04
9
+
10
+ ### Changed
11
+
12
+ - Allow providing a `ReactNode` as the `errorMessage` prop for `Question`
13
+
14
+ ### Fixed
15
+
16
+ - Fixed typo in `<Chopin.Actions />` docs
17
+ - Fixed `<Chopin.Actions />` back button styles when disabled
18
+
8
19
  ## [3.1.3] - 2022-12-19
9
20
 
10
21
  ### Fixed
@@ -121,6 +132,8 @@ Additionally, mobius and themes are available on the public NPM registry and can
121
132
 
122
133
  ## Github Links
123
134
 
135
+ [3.2.1]: https://github.com/simplybusiness/mobius/releases/tag/v3.2.1
136
+ [3.2.0]: https://github.com/simplybusiness/mobius/releases/tag/v3.2.0
124
137
  [3.1.3]: https://github.com/simplybusiness/mobius/releases/tag/v3.1.3
125
138
  [3.1.2]: https://github.com/simplybusiness/mobius/releases/tag/v3.1.2
126
139
  [3.1.1]: https://github.com/simplybusiness/mobius/releases/tag/v3.1.1
@@ -26,8 +26,8 @@ const Actions = (0, react_1.forwardRef)((props, ref) => {
26
26
  const nextButtonClasses = (0, clsx_1.default)("chopin/ActionsNext", {
27
27
  "--single-action": !backButton,
28
28
  });
29
- const backButtonProps = Object.assign(Object.assign({}, backButton), { className: "chopin/ActionsBack", variant: "basic", icon: "buttonArrowLeft" });
30
- const nextButtonProps = Object.assign(Object.assign({}, nextButton), { className: nextButtonClasses });
29
+ const backButtonProps = Object.assign(Object.assign({}, backButton), { className: "chopin/ActionsBack", variant: "ghost", icon: "leftArrow", size: "large" });
30
+ const nextButtonProps = Object.assign(Object.assign({}, nextButton), { className: nextButtonClasses, size: "large" });
31
31
  return ((0, jsx_runtime_1.jsx)(Flex_1.Flex, Object.assign({ ref: ref, className: classes, justifyContent: "center" }, rest, { children: (0, jsx_runtime_1.jsxs)(Flex_1.Flex, Object.assign({ className: "chopin/ActionsContainer", justifyContent: "space-between", alignItems: "center" }, { children: [(backButton === null || backButton === void 0 ? void 0 : backButton.href) && ((0, jsx_runtime_1.jsx)(LinkButton_1.LinkButton, Object.assign({}, backButtonProps, { href: backButtonProps.href }, { children: backLabel }))), (nextButton === null || nextButton === void 0 ? void 0 : nextButton.href) && ((0, jsx_runtime_1.jsx)(LinkButton_1.LinkButton, Object.assign({}, nextButtonProps, { href: nextButtonProps.href }, { children: nextLabel })))] })) })));
32
32
  });
33
33
  exports.Actions = Actions;
@@ -1 +1 @@
1
- {"version":3,"file":"Actions.js","sourceRoot":"","sources":["../../../../../src/components/Chopin/Actions/Actions.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,iCAAwC;AAExC,gDAAwB;AAGxB,qCAAkC;AAElC,iDAAoE;AAepE,MAAM,OAAO,GACX,IAAA,kBAAU,EAAC,CAAC,KAAmB,EAAE,GAAe,EAAE,EAAE;IAClD,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,KAC7D,KAAK,EAD6D,IAAI,UACtE,KAAK,EADD,mEAAoE,CACnE,CAAC;IAER,MAAM,OAAO,GAAG,IAAA,cAAI,EAAC,QAAQ,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC;IAC5D,MAAM,iBAAiB,GAAG,IAAA,cAAI,EAAC,oBAAoB,EAAE;QACnD,iBAAiB,EAAE,CAAC,UAAU;KAC/B,CAAC,CAAC;IAEH,MAAM,eAAe,mCAChB,UAAU,KACb,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,OAAkB,EAC3B,IAAI,EAAE,iBAA6B,GACpC,CAAC;IAEF,MAAM,eAAe,mCAChB,UAAU,KACb,SAAS,EAAE,iBAAiB,GAC7B,CAAC;IAEF,OAAO,CACL,uBAAC,WAAI,kBAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAC,QAAQ,IAAK,IAAI,cAClE,wBAAC,WAAI,kBACH,SAAS,EAAC,yBAAyB,EACnC,cAAc,EAAC,eAAe,EAC9B,UAAU,EAAC,QAAQ,iBAElB,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,KAAI,CACnB,uBAAC,uBAAU,oBAAK,eAAe,IAAE,IAAI,EAAE,eAAe,CAAC,IAAK,gBACzD,SAAS,IACC,CACd,EACA,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,KAAI,CACnB,uBAAC,uBAAU,oBAAK,eAAe,IAAE,IAAI,EAAE,eAAe,CAAC,IAAK,gBACzD,SAAS,IACC,CACd,KACI,IACF,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAGI,0BAAO;AADhB,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC"}
1
+ {"version":3,"file":"Actions.js","sourceRoot":"","sources":["../../../../../src/components/Chopin/Actions/Actions.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,iCAAwC;AAExC,gDAAwB;AAGxB,qCAAkC;AAElC,iDAAoE;AAepE,MAAM,OAAO,GACX,IAAA,kBAAU,EAAC,CAAC,KAAmB,EAAE,GAAe,EAAE,EAAE;IAClD,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,KAC7D,KAAK,EAD6D,IAAI,UACtE,KAAK,EADD,mEAAoE,CACnE,CAAC;IAER,MAAM,OAAO,GAAG,IAAA,cAAI,EAAC,QAAQ,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC;IAC5D,MAAM,iBAAiB,GAAG,IAAA,cAAI,EAAC,oBAAoB,EAAE;QACnD,iBAAiB,EAAE,CAAC,UAAU;KAC/B,CAAC,CAAC;IAEH,MAAM,eAAe,mCAChB,UAAU,KACb,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,OAAkB,EAC3B,IAAI,EAAE,WAAuB,EAC7B,IAAI,EAAE,OAAe,GACtB,CAAC;IAEF,MAAM,eAAe,mCAChB,UAAU,KACb,SAAS,EAAE,iBAAiB,EAC5B,IAAI,EAAE,OAAe,GACtB,CAAC;IAEF,OAAO,CACL,uBAAC,WAAI,kBAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAC,QAAQ,IAAK,IAAI,cAClE,wBAAC,WAAI,kBACH,SAAS,EAAC,yBAAyB,EACnC,cAAc,EAAC,eAAe,EAC9B,UAAU,EAAC,QAAQ,iBAElB,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,KAAI,CACnB,uBAAC,uBAAU,oBAAK,eAAe,IAAE,IAAI,EAAE,eAAe,CAAC,IAAK,gBACzD,SAAS,IACC,CACd,EACA,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,KAAI,CACnB,uBAAC,uBAAU,oBAAK,eAAe,IAAE,IAAI,EAAE,eAAe,CAAC,IAAK,gBACzD,SAAS,IACC,CACd,KACI,IACF,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAGI,0BAAO;AADhB,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC"}
@@ -2,7 +2,7 @@ import { ReactNode, ReactElement } from "react";
2
2
  export interface QuestionProps {
3
3
  label?: ReactElement | string;
4
4
  description?: string | ReactNode;
5
- errorMessage?: string;
5
+ errorMessage?: ReactNode;
6
6
  children?: ReactNode;
7
7
  validationState?: "valid" | "invalid" | "";
8
8
  help?: ReactNode;
@@ -20,8 +20,8 @@ const Actions = forwardRef((props, ref) => {
20
20
  const nextButtonClasses = clsx("chopin/ActionsNext", {
21
21
  "--single-action": !backButton,
22
22
  });
23
- const backButtonProps = Object.assign(Object.assign({}, backButton), { className: "chopin/ActionsBack", variant: "basic", icon: "buttonArrowLeft" });
24
- const nextButtonProps = Object.assign(Object.assign({}, nextButton), { className: nextButtonClasses });
23
+ const backButtonProps = Object.assign(Object.assign({}, backButton), { className: "chopin/ActionsBack", variant: "ghost", icon: "leftArrow", size: "large" });
24
+ const nextButtonProps = Object.assign(Object.assign({}, nextButton), { className: nextButtonClasses, size: "large" });
25
25
  return (_jsx(Flex, Object.assign({ ref: ref, className: classes, justifyContent: "center" }, rest, { children: _jsxs(Flex, Object.assign({ className: "chopin/ActionsContainer", justifyContent: "space-between", alignItems: "center" }, { children: [(backButton === null || backButton === void 0 ? void 0 : backButton.href) && (_jsx(LinkButton, Object.assign({}, backButtonProps, { href: backButtonProps.href }, { children: backLabel }))), (nextButton === null || nextButton === void 0 ? void 0 : nextButton.href) && (_jsx(LinkButton, Object.assign({}, nextButtonProps, { href: nextButtonProps.href }, { children: nextLabel })))] })) })));
26
26
  });
27
27
  Actions.displayName = "Actions";
@@ -1 +1 @@
1
- {"version":3,"file":"Actions.js","sourceRoot":"","sources":["../../../../../src/components/Chopin/Actions/Actions.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAO,MAAM,OAAO,CAAC;AAExC,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,UAAU,EAAwB,MAAM,kBAAkB,CAAC;AAepE,MAAM,OAAO,GACX,UAAU,CAAC,CAAC,KAAmB,EAAE,GAAe,EAAE,EAAE;IAClD,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,KAC7D,KAAK,EAD6D,IAAI,UACtE,KAAK,EADD,mEAAoE,CACnE,CAAC;IAER,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC;IAC5D,MAAM,iBAAiB,GAAG,IAAI,CAAC,oBAAoB,EAAE;QACnD,iBAAiB,EAAE,CAAC,UAAU;KAC/B,CAAC,CAAC;IAEH,MAAM,eAAe,mCAChB,UAAU,KACb,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,OAAkB,EAC3B,IAAI,EAAE,iBAA6B,GACpC,CAAC;IAEF,MAAM,eAAe,mCAChB,UAAU,KACb,SAAS,EAAE,iBAAiB,GAC7B,CAAC;IAEF,OAAO,CACL,KAAC,IAAI,kBAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAC,QAAQ,IAAK,IAAI,cAClE,MAAC,IAAI,kBACH,SAAS,EAAC,yBAAyB,EACnC,cAAc,EAAC,eAAe,EAC9B,UAAU,EAAC,QAAQ,iBAElB,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,KAAI,CACnB,KAAC,UAAU,oBAAK,eAAe,IAAE,IAAI,EAAE,eAAe,CAAC,IAAK,gBACzD,SAAS,IACC,CACd,EACA,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,KAAI,CACnB,KAAC,UAAU,oBAAK,eAAe,IAAE,IAAI,EAAE,eAAe,CAAC,IAAK,gBACzD,SAAS,IACC,CACd,KACI,IACF,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"Actions.js","sourceRoot":"","sources":["../../../../../src/components/Chopin/Actions/Actions.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAO,MAAM,OAAO,CAAC;AAExC,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,UAAU,EAAwB,MAAM,kBAAkB,CAAC;AAepE,MAAM,OAAO,GACX,UAAU,CAAC,CAAC,KAAmB,EAAE,GA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ts CHANGED
@@ -813,7 +813,7 @@ declare type QuestionGroupRef = Ref<QuestionGroupElementType>;
813
813
  declare interface QuestionProps {
814
814
  label?: ReactElement | string;
815
815
  description?: string | ReactNode;
816
- errorMessage?: string;
816
+ errorMessage?: ReactNode;
817
817
  children?: ReactNode;
818
818
  validationState?: "valid" | "invalid" | "";
819
819
  help?: ReactNode;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@simplybusiness/mobius",
3
3
  "license": "UNLICENSED",
4
- "version": "3.1.3",
4
+ "version": "3.2.1",
5
5
  "description": "Core library of Mobius react components",
6
6
  "repository": {
7
7
  "type": "git",
@@ -55,9 +55,9 @@ import { Chopin } from "@simplybusiness/mobius";
55
55
 
56
56
  <Chopin.Actions
57
57
  backLabel="Back"
58
- backButton={ href: "https://www.google.com" }
58
+ backButton={{ href: "https://www.google.com" }}
59
59
  nextLabel="Next Step"
60
- nextButton={ href: "https://www.google.com" }
60
+ nextButton={{ href: "https://www.google.com" }}
61
61
  />
62
62
  ```
63
63
 
@@ -84,7 +84,7 @@ import { Chopin } from "@simplybusiness/mobius";
84
84
 
85
85
  <Chopin.Actions
86
86
  nextLabel="Next Step"
87
- nextButton={ href: "https://www.google.com" }
87
+ nextButton={{ href: "https://www.google.com" }}
88
88
  />
89
89
  ```
90
90
 
@@ -111,10 +111,10 @@ import { Chopin } from "@simplybusiness/mobius";
111
111
 
112
112
  <Chopin.Actions
113
113
  backLabel="Back"
114
- backButton={
114
+ backButton={{
115
115
  href: "https://www.google.com",
116
116
  isDisabled: false,
117
- }
117
+ }}
118
118
  />
119
119
  ```
120
120
 
@@ -128,7 +128,7 @@ import { Chopin } from "@simplybusiness/mobius";
128
128
  backButton: {
129
129
  href: "https://www.google.com",
130
130
  elementType: "button",
131
- isDisabled: false,
131
+ isDisabled: true,
132
132
  },
133
133
  nextLabel: "Next Step",
134
134
  nextButton: {
@@ -152,15 +152,15 @@ import { Chopin } from "@simplybusiness/mobius";
152
152
 
153
153
  <Chopin.Actions
154
154
  backLabel="Back"
155
- backButton={
155
+ backButton={{
156
156
  href: "https://www.google.com",
157
157
  isDisabled: false,
158
- }
158
+ }}
159
159
  nextLabel="Next Step"
160
- nextButton={
160
+ nextButton={{
161
161
  href: "https://www.google.com",
162
162
  isDisabled: true,
163
- }
163
+ }}
164
164
  />
165
165
  ```
166
166
 
@@ -2,7 +2,7 @@ import { forwardRef, Ref } from "react";
2
2
  import { DOMProps } from "@react-types/shared";
3
3
  import clsx from "clsx";
4
4
  import type { IconName } from "@simplybusiness/icons";
5
- import { Variant } from "../../Button";
5
+ import { Size, Variant } from "../../Button";
6
6
  import { Flex } from "../../Flex";
7
7
  import { ForwardedRefComponent } from "../../../types/components";
8
8
  import { LinkButton, type LinkButtonProps } from "../../LinkButton";
@@ -33,13 +33,15 @@ const Actions: ForwardedRefComponent<ActionsProps, ActionsElementType> =
33
33
  const backButtonProps = {
34
34
  ...backButton,
35
35
  className: "chopin/ActionsBack",
36
- variant: "basic" as Variant,
37
- icon: "buttonArrowLeft" as IconName,
36
+ variant: "ghost" as Variant,
37
+ icon: "leftArrow" as IconName,
38
+ size: "large" as Size,
38
39
  };
39
40
 
40
41
  const nextButtonProps = {
41
42
  ...nextButton,
42
43
  className: nextButtonClasses,
44
+ size: "large" as Size,
43
45
  };
44
46
 
45
47
  return (
@@ -343,6 +343,19 @@ import { Chopin } from "@simplybusiness/mobius";
343
343
  {args => <Question {...args} />}
344
344
  </Story>
345
345
 
346
+ <Story
347
+ name="With Rich Error"
348
+ args={{
349
+ label: "Question label",
350
+ children: <TextField />,
351
+ errorMessage: <>This <em>contains</em> <strong>HTML</strong> <u>formatting</u></>,
352
+ validationState: "invalid",
353
+ closeHelpOnOutsideClick: false,
354
+ }}
355
+ >
356
+ {args => <Question {...args} />}
357
+ </Story>
358
+
346
359
  <!-- prettier-ignore -->
347
360
  ```jsx
348
361
  import { Chopin } from "@simplybusiness/mobius";
@@ -16,7 +16,7 @@ import { QuestionHelp } from "../QuestionHelp/QuestionHelp";
16
16
  export interface QuestionProps {
17
17
  label?: ReactElement | string;
18
18
  description?: string | ReactNode;
19
- errorMessage?: string;
19
+ errorMessage?: ReactNode;
20
20
  children?: ReactNode;
21
21
  validationState?: "valid" | "invalid" | "";
22
22
  help?: ReactNode;