@transferwise/components 0.0.0-experimental-72362bd → 0.0.0-experimental-b20fb95
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/build/field/Field.js +32 -60
- package/build/field/Field.js.map +1 -1
- package/build/field/Field.mjs +34 -62
- package/build/field/Field.mjs.map +1 -1
- package/build/flowNavigation/FlowNavigation.js +2 -4
- package/build/flowNavigation/FlowNavigation.js.map +1 -1
- package/build/flowNavigation/FlowNavigation.mjs +2 -4
- package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
- package/build/i18n/en.json +0 -1
- package/build/i18n/en.json.js +0 -1
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +0 -1
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/inputs/TextArea.js +0 -5
- package/build/inputs/TextArea.js.map +1 -1
- package/build/inputs/TextArea.mjs +1 -6
- package/build/inputs/TextArea.mjs.map +1 -1
- package/build/inputs/contexts.js +0 -16
- package/build/inputs/contexts.js.map +1 -1
- package/build/inputs/contexts.mjs +2 -16
- package/build/inputs/contexts.mjs.map +1 -1
- package/build/main.css +2 -18
- package/build/styles/field/Field.css +2 -16
- package/build/styles/main.css +2 -18
- package/build/types/field/Field.d.ts.map +1 -1
- package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
- package/build/types/inputs/TextArea.d.ts.map +1 -1
- package/build/types/inputs/contexts.d.ts +0 -6
- package/build/types/inputs/contexts.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +0 -2
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/field/Field.css +2 -16
- package/src/field/Field.less +2 -14
- package/src/field/Field.story.tsx +1 -5
- package/src/field/Field.tsx +37 -80
- package/src/flowNavigation/FlowNavigation.story.tsx +14 -9
- package/src/flowNavigation/FlowNavigation.test.js +2 -2
- package/src/flowNavigation/FlowNavigation.test.story.tsx +77 -0
- package/src/flowNavigation/FlowNavigation.tsx +2 -5
- package/src/i18n/en.json +0 -1
- package/src/inputs/TextArea.tsx +2 -7
- package/src/inputs/contexts.tsx +1 -18
- package/src/main.css +2 -18
- package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +0 -1
- package/build/field/Field.messages.js +0 -14
- package/build/field/Field.messages.js.map +0 -1
- package/build/field/Field.messages.mjs +0 -10
- package/build/field/Field.messages.mjs.map +0 -1
- package/build/types/field/Field.messages.d.ts +0 -8
- package/build/types/field/Field.messages.d.ts.map +0 -1
- package/src/field/Field.messages.ts +0 -8
- package/src/inputs/TextArea.story.tsx +0 -56
package/build/inputs/contexts.js
CHANGED
|
@@ -25,20 +25,6 @@ function useInputAttributes({
|
|
|
25
25
|
function useFieldLabelRef() {
|
|
26
26
|
return React.useContext(FieldLabelContext)?.ref;
|
|
27
27
|
}
|
|
28
|
-
const TextareaCharacterCountContext = /*#__PURE__*/React.createContext(undefined);
|
|
29
|
-
const TextareaCharacterCountProvider = TextareaCharacterCountContext.Provider;
|
|
30
|
-
function useTextareaCharacterCount(current, max) {
|
|
31
|
-
const setCharacterCount = React.useContext(TextareaCharacterCountContext);
|
|
32
|
-
React.useEffect(() => {
|
|
33
|
-
if (setCharacterCount && max != null) {
|
|
34
|
-
setCharacterCount({
|
|
35
|
-
current,
|
|
36
|
-
max
|
|
37
|
-
});
|
|
38
|
-
return () => setCharacterCount(null);
|
|
39
|
-
}
|
|
40
|
-
}, [setCharacterCount, current, max]);
|
|
41
|
-
}
|
|
42
28
|
function withInputAttributes(Component, args) {
|
|
43
29
|
function ComponentWithInputAttributes(props) {
|
|
44
30
|
return /*#__PURE__*/jsxRuntime.jsx(Component, {
|
|
@@ -54,9 +40,7 @@ exports.FieldLabelContextProvider = FieldLabelContextProvider;
|
|
|
54
40
|
exports.InputDescribedByProvider = InputDescribedByProvider;
|
|
55
41
|
exports.InputIdContextProvider = InputIdContextProvider;
|
|
56
42
|
exports.InputInvalidProvider = InputInvalidProvider;
|
|
57
|
-
exports.TextareaCharacterCountProvider = TextareaCharacterCountProvider;
|
|
58
43
|
exports.useFieldLabelRef = useFieldLabelRef;
|
|
59
44
|
exports.useInputAttributes = useInputAttributes;
|
|
60
|
-
exports.useTextareaCharacterCount = useTextareaCharacterCount;
|
|
61
45
|
exports.withInputAttributes = withInputAttributes;
|
|
62
46
|
//# sourceMappingURL=contexts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contexts.js","sources":["../../src/inputs/contexts.tsx"],"sourcesContent":["import { createContext, useContext
|
|
1
|
+
{"version":3,"file":"contexts.js","sources":["../../src/inputs/contexts.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\n\ntype FieldLabelContextType = {\n id?: string;\n ref?: React.RefObject<HTMLLabelElement>;\n};\n\nconst FieldLabelContext = createContext<FieldLabelContextType | undefined>(undefined);\nexport const FieldLabelContextProvider = FieldLabelContext.Provider;\n\nconst InputIdContext = createContext<string | undefined>(undefined);\nexport const InputIdContextProvider = InputIdContext.Provider;\n\nconst InputDescribedByContext = createContext<string | undefined>(undefined);\nexport const InputDescribedByProvider = InputDescribedByContext.Provider;\n\nconst InputInvalidContext = createContext<boolean | undefined>(undefined);\nexport const InputInvalidProvider = InputInvalidContext.Provider;\n\ninterface UseInputAttributesArgs {\n /** Set this to `true` if the underlying element is not directly [labelable as per the HTML specification](https://html.spec.whatwg.org/multipage/forms.html#category-label). */\n nonLabelable?: boolean;\n}\n\nexport function useInputAttributes({ nonLabelable }: UseInputAttributesArgs = {}) {\n const labelId = useContext(FieldLabelContext)?.id;\n return {\n id: useContext(InputIdContext),\n 'aria-labelledby': nonLabelable ? labelId : undefined,\n 'aria-describedby': useContext(InputDescribedByContext),\n 'aria-invalid': useContext(InputInvalidContext),\n } satisfies React.HTMLAttributes<HTMLElement>;\n}\n\nexport function useFieldLabelRef() {\n return useContext(FieldLabelContext)?.ref;\n}\n\nexport interface WithInputAttributesProps {\n inputAttributes: ReturnType<typeof useInputAttributes>;\n}\n\nexport function withInputAttributes<T extends Partial<WithInputAttributesProps>>(\n Component: React.ComponentType<T>,\n args?: UseInputAttributesArgs,\n) {\n function ComponentWithInputAttributes(props: Omit<T, keyof WithInputAttributesProps>) {\n return <Component inputAttributes={useInputAttributes(args)} {...(props as T)} />;\n }\n\n ComponentWithInputAttributes.displayName = `withInputAttributes(${Component.displayName || Component.name || 'Component'})`;\n\n return ComponentWithInputAttributes;\n}\n"],"names":["FieldLabelContext","createContext","undefined","FieldLabelContextProvider","Provider","InputIdContext","InputIdContextProvider","InputDescribedByContext","InputDescribedByProvider","InputInvalidContext","InputInvalidProvider","useInputAttributes","nonLabelable","labelId","useContext","id","useFieldLabelRef","ref","withInputAttributes","Component","args","ComponentWithInputAttributes","props","_jsx","inputAttributes","displayName","name"],"mappings":";;;;;AAOA,MAAMA,iBAAiB,gBAAGC,mBAAa,CAAoCC,SAAS,CAAC;AAC9E,MAAMC,yBAAyB,GAAGH,iBAAiB,CAACI;AAE3D,MAAMC,cAAc,gBAAGJ,mBAAa,CAAqBC,SAAS,CAAC;AAC5D,MAAMI,sBAAsB,GAAGD,cAAc,CAACD;AAErD,MAAMG,uBAAuB,gBAAGN,mBAAa,CAAqBC,SAAS,CAAC;AACrE,MAAMM,wBAAwB,GAAGD,uBAAuB,CAACH;AAEhE,MAAMK,mBAAmB,gBAAGR,mBAAa,CAAsBC,SAAS,CAAC;AAClE,MAAMQ,oBAAoB,GAAGD,mBAAmB,CAACL;SAOxCO,kBAAkBA,CAAC;AAAEC,EAAAA;IAAyC,EAAE,EAAA;AAC9E,EAAA,MAAMC,OAAO,GAAGC,gBAAU,CAACd,iBAAiB,CAAC,EAAEe,EAAE;EACjD,OAAO;AACLA,IAAAA,EAAE,EAAED,gBAAU,CAACT,cAAc,CAAC;AAC9B,IAAA,iBAAiB,EAAEO,YAAY,GAAGC,OAAO,GAAGX,SAAS;AACrD,IAAA,kBAAkB,EAAEY,gBAAU,CAACP,uBAAuB,CAAC;IACvD,cAAc,EAAEO,gBAAU,CAACL,mBAAmB;GACH;AAC/C;SAEgBO,gBAAgBA,GAAA;AAC9B,EAAA,OAAOF,gBAAU,CAACd,iBAAiB,CAAC,EAAEiB,GAAG;AAC3C;AAMM,SAAUC,mBAAmBA,CACjCC,SAAiC,EACjCC,IAA6B,EAAA;EAE7B,SAASC,4BAA4BA,CAACC,KAA8C,EAAA;IAClF,oBAAOC,cAAA,CAACJ,SAAS,EAAA;AAACK,MAAAA,eAAe,EAAEb,kBAAkB,CAACS,IAAI,CAAE;MAAA,GAAME;AAAW,MAAI;AACnF,EAAA;AAEAD,EAAAA,4BAA4B,CAACI,WAAW,GAAG,CAAA,oBAAA,EAAuBN,SAAS,CAACM,WAAW,IAAIN,SAAS,CAACO,IAAI,IAAI,WAAW,CAAA,CAAA,CAAG;AAE3H,EAAA,OAAOL,4BAA4B;AACrC;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createContext, useContext
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
const FieldLabelContext = /*#__PURE__*/createContext(undefined);
|
|
@@ -23,20 +23,6 @@ function useInputAttributes({
|
|
|
23
23
|
function useFieldLabelRef() {
|
|
24
24
|
return useContext(FieldLabelContext)?.ref;
|
|
25
25
|
}
|
|
26
|
-
const TextareaCharacterCountContext = /*#__PURE__*/createContext(undefined);
|
|
27
|
-
const TextareaCharacterCountProvider = TextareaCharacterCountContext.Provider;
|
|
28
|
-
function useTextareaCharacterCount(current, max) {
|
|
29
|
-
const setCharacterCount = useContext(TextareaCharacterCountContext);
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (setCharacterCount && max != null) {
|
|
32
|
-
setCharacterCount({
|
|
33
|
-
current,
|
|
34
|
-
max
|
|
35
|
-
});
|
|
36
|
-
return () => setCharacterCount(null);
|
|
37
|
-
}
|
|
38
|
-
}, [setCharacterCount, current, max]);
|
|
39
|
-
}
|
|
40
26
|
function withInputAttributes(Component, args) {
|
|
41
27
|
function ComponentWithInputAttributes(props) {
|
|
42
28
|
return /*#__PURE__*/jsx(Component, {
|
|
@@ -48,5 +34,5 @@ function withInputAttributes(Component, args) {
|
|
|
48
34
|
return ComponentWithInputAttributes;
|
|
49
35
|
}
|
|
50
36
|
|
|
51
|
-
export { FieldLabelContextProvider, InputDescribedByProvider, InputIdContextProvider, InputInvalidProvider,
|
|
37
|
+
export { FieldLabelContextProvider, InputDescribedByProvider, InputIdContextProvider, InputInvalidProvider, useFieldLabelRef, useInputAttributes, withInputAttributes };
|
|
52
38
|
//# sourceMappingURL=contexts.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contexts.mjs","sources":["../../src/inputs/contexts.tsx"],"sourcesContent":["import { createContext, useContext
|
|
1
|
+
{"version":3,"file":"contexts.mjs","sources":["../../src/inputs/contexts.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\n\ntype FieldLabelContextType = {\n id?: string;\n ref?: React.RefObject<HTMLLabelElement>;\n};\n\nconst FieldLabelContext = createContext<FieldLabelContextType | undefined>(undefined);\nexport const FieldLabelContextProvider = FieldLabelContext.Provider;\n\nconst InputIdContext = createContext<string | undefined>(undefined);\nexport const InputIdContextProvider = InputIdContext.Provider;\n\nconst InputDescribedByContext = createContext<string | undefined>(undefined);\nexport const InputDescribedByProvider = InputDescribedByContext.Provider;\n\nconst InputInvalidContext = createContext<boolean | undefined>(undefined);\nexport const InputInvalidProvider = InputInvalidContext.Provider;\n\ninterface UseInputAttributesArgs {\n /** Set this to `true` if the underlying element is not directly [labelable as per the HTML specification](https://html.spec.whatwg.org/multipage/forms.html#category-label). */\n nonLabelable?: boolean;\n}\n\nexport function useInputAttributes({ nonLabelable }: UseInputAttributesArgs = {}) {\n const labelId = useContext(FieldLabelContext)?.id;\n return {\n id: useContext(InputIdContext),\n 'aria-labelledby': nonLabelable ? labelId : undefined,\n 'aria-describedby': useContext(InputDescribedByContext),\n 'aria-invalid': useContext(InputInvalidContext),\n } satisfies React.HTMLAttributes<HTMLElement>;\n}\n\nexport function useFieldLabelRef() {\n return useContext(FieldLabelContext)?.ref;\n}\n\nexport interface WithInputAttributesProps {\n inputAttributes: ReturnType<typeof useInputAttributes>;\n}\n\nexport function withInputAttributes<T extends Partial<WithInputAttributesProps>>(\n Component: React.ComponentType<T>,\n args?: UseInputAttributesArgs,\n) {\n function ComponentWithInputAttributes(props: Omit<T, keyof WithInputAttributesProps>) {\n return <Component inputAttributes={useInputAttributes(args)} {...(props as T)} />;\n }\n\n ComponentWithInputAttributes.displayName = `withInputAttributes(${Component.displayName || Component.name || 'Component'})`;\n\n return ComponentWithInputAttributes;\n}\n"],"names":["FieldLabelContext","createContext","undefined","FieldLabelContextProvider","Provider","InputIdContext","InputIdContextProvider","InputDescribedByContext","InputDescribedByProvider","InputInvalidContext","InputInvalidProvider","useInputAttributes","nonLabelable","labelId","useContext","id","useFieldLabelRef","ref","withInputAttributes","Component","args","ComponentWithInputAttributes","props","_jsx","inputAttributes","displayName","name"],"mappings":";;;AAOA,MAAMA,iBAAiB,gBAAGC,aAAa,CAAoCC,SAAS,CAAC;AAC9E,MAAMC,yBAAyB,GAAGH,iBAAiB,CAACI;AAE3D,MAAMC,cAAc,gBAAGJ,aAAa,CAAqBC,SAAS,CAAC;AAC5D,MAAMI,sBAAsB,GAAGD,cAAc,CAACD;AAErD,MAAMG,uBAAuB,gBAAGN,aAAa,CAAqBC,SAAS,CAAC;AACrE,MAAMM,wBAAwB,GAAGD,uBAAuB,CAACH;AAEhE,MAAMK,mBAAmB,gBAAGR,aAAa,CAAsBC,SAAS,CAAC;AAClE,MAAMQ,oBAAoB,GAAGD,mBAAmB,CAACL;SAOxCO,kBAAkBA,CAAC;AAAEC,EAAAA;IAAyC,EAAE,EAAA;AAC9E,EAAA,MAAMC,OAAO,GAAGC,UAAU,CAACd,iBAAiB,CAAC,EAAEe,EAAE;EACjD,OAAO;AACLA,IAAAA,EAAE,EAAED,UAAU,CAACT,cAAc,CAAC;AAC9B,IAAA,iBAAiB,EAAEO,YAAY,GAAGC,OAAO,GAAGX,SAAS;AACrD,IAAA,kBAAkB,EAAEY,UAAU,CAACP,uBAAuB,CAAC;IACvD,cAAc,EAAEO,UAAU,CAACL,mBAAmB;GACH;AAC/C;SAEgBO,gBAAgBA,GAAA;AAC9B,EAAA,OAAOF,UAAU,CAACd,iBAAiB,CAAC,EAAEiB,GAAG;AAC3C;AAMM,SAAUC,mBAAmBA,CACjCC,SAAiC,EACjCC,IAA6B,EAAA;EAE7B,SAASC,4BAA4BA,CAACC,KAA8C,EAAA;IAClF,oBAAOC,GAAA,CAACJ,SAAS,EAAA;AAACK,MAAAA,eAAe,EAAEb,kBAAkB,CAACS,IAAI,CAAE;MAAA,GAAME;AAAW,MAAI;AACnF,EAAA;AAEAD,EAAAA,4BAA4B,CAACI,WAAW,GAAG,CAAA,oBAAA,EAAuBN,SAAS,CAACM,WAAW,IAAIN,SAAS,CAACO,IAAI,IAAI,WAAW,CAAA,CAAA,CAAG;AAE3H,EAAA,OAAOL,4BAA4B;AACrC;;;;"}
|
package/build/main.css
CHANGED
|
@@ -30193,28 +30193,12 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
30193
30193
|
stroke-dasharray: var(--wds-list-item-spotlight-strokeDashSize) var(--wds-list-item-spotlight-strokeDashSize);
|
|
30194
30194
|
}
|
|
30195
30195
|
|
|
30196
|
-
.np-field-control
|
|
30196
|
+
.np-field-control,
|
|
30197
|
+
.np-field__prompt {
|
|
30197
30198
|
margin-top: 4px;
|
|
30198
30199
|
margin-top: var(--size-4);
|
|
30199
30200
|
}
|
|
30200
30201
|
|
|
30201
|
-
.np-field-validation {
|
|
30202
|
-
display: flex;
|
|
30203
|
-
align-items: flex-start;
|
|
30204
|
-
margin-top: 4px;
|
|
30205
|
-
margin-top: var(--size-4);
|
|
30206
|
-
gap: 8px;
|
|
30207
|
-
gap: var(--size-8);
|
|
30208
|
-
}
|
|
30209
|
-
|
|
30210
|
-
.np-field-textarea-char-counter {
|
|
30211
|
-
margin-left: auto;
|
|
30212
|
-
padding: 4px 0;
|
|
30213
|
-
padding: var(--size-4) 0;
|
|
30214
|
-
color: #768e9c;
|
|
30215
|
-
color: var(--color-content-tertiary);
|
|
30216
|
-
}
|
|
30217
|
-
|
|
30218
30202
|
.np-field .form-group--typeahead[class],
|
|
30219
30203
|
.np-field .np-checkbox-label[class] {
|
|
30220
30204
|
margin-bottom: 0;
|
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
.np-field-control
|
|
1
|
+
.np-field-control,
|
|
2
|
+
.np-field__prompt {
|
|
2
3
|
margin-top: 4px;
|
|
3
4
|
margin-top: var(--size-4);
|
|
4
5
|
}
|
|
5
|
-
.np-field-validation {
|
|
6
|
-
display: flex;
|
|
7
|
-
align-items: flex-start;
|
|
8
|
-
margin-top: 4px;
|
|
9
|
-
margin-top: var(--size-4);
|
|
10
|
-
gap: 8px;
|
|
11
|
-
gap: var(--size-8);
|
|
12
|
-
}
|
|
13
|
-
.np-field-textarea-char-counter {
|
|
14
|
-
margin-left: auto;
|
|
15
|
-
padding: 4px 0;
|
|
16
|
-
padding: var(--size-4) 0;
|
|
17
|
-
color: #768e9c;
|
|
18
|
-
color: var(--color-content-tertiary);
|
|
19
|
-
}
|
|
20
6
|
.np-field .form-group--typeahead[class],
|
|
21
7
|
.np-field .np-checkbox-label[class] {
|
|
22
8
|
margin-bottom: 0;
|
package/build/styles/main.css
CHANGED
|
@@ -30193,28 +30193,12 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
30193
30193
|
stroke-dasharray: var(--wds-list-item-spotlight-strokeDashSize) var(--wds-list-item-spotlight-strokeDashSize);
|
|
30194
30194
|
}
|
|
30195
30195
|
|
|
30196
|
-
.np-field-control
|
|
30196
|
+
.np-field-control,
|
|
30197
|
+
.np-field__prompt {
|
|
30197
30198
|
margin-top: 4px;
|
|
30198
30199
|
margin-top: var(--size-4);
|
|
30199
30200
|
}
|
|
30200
30201
|
|
|
30201
|
-
.np-field-validation {
|
|
30202
|
-
display: flex;
|
|
30203
|
-
align-items: flex-start;
|
|
30204
|
-
margin-top: 4px;
|
|
30205
|
-
margin-top: var(--size-4);
|
|
30206
|
-
gap: 8px;
|
|
30207
|
-
gap: var(--size-8);
|
|
30208
|
-
}
|
|
30209
|
-
|
|
30210
|
-
.np-field-textarea-char-counter {
|
|
30211
|
-
margin-left: auto;
|
|
30212
|
-
padding: 4px 0;
|
|
30213
|
-
padding: var(--size-4) 0;
|
|
30214
|
-
color: #768e9c;
|
|
30215
|
-
color: var(--color-content-tertiary);
|
|
30216
|
-
}
|
|
30217
|
-
|
|
30218
30202
|
.np-field .form-group--typeahead[class],
|
|
30219
30203
|
.np-field .np-checkbox-label[class] {
|
|
30220
30204
|
margin-bottom: 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../../src/field/Field.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../../src/field/Field.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AASjE,MAAM,MAAM,UAAU,GAAG;IACvB,6IAA6I;IAC7I,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,sGAAsG;IACtG,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,oBAAoB;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kDAAkD;IAClD,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;SAGK;IACL,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,8EAA8E;IAC9E,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,iCAAiC;IACjC,SAAS,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,wJAanB,UAAU,gCA4EZ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowNavigation.d.ts","sourceRoot":"","sources":["../../../src/flowNavigation/FlowNavigation.tsx"],"names":[],"mappings":"AAOA,OAAgB,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAQxD,MAAM,WAAW,mBAAmB;IAClC,iBAAiB;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,wBAAwB;IACxB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,qBAAqB;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,2FAA2F;IAC3F,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,sIAAsI;IACtI,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,wGAAwG;IACxG,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;CACxB;AAED,QAAA,MAAM,cAAc,GAAI,+DAQrB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"FlowNavigation.d.ts","sourceRoot":"","sources":["../../../src/flowNavigation/FlowNavigation.tsx"],"names":[],"mappings":"AAOA,OAAgB,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAQxD,MAAM,WAAW,mBAAmB;IAClC,iBAAiB;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,wBAAwB;IACxB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,qBAAqB;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,2FAA2F;IAC3F,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,sIAAsI;IACtI,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,wGAAwG;IACxG,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;CACxB;AAED,QAAA,MAAM,cAAc,GAAI,+DAQrB,mBAAmB,gCAsErB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../src/inputs/TextArea.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAIjC,MAAM,WAAW,aAAc,SAAQ,KAAK,CAC1C,KAAK,CAAC,qBAAqB,CAAC,UAAU,CAAC,EACvC;IACE,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CACF;CAAG;AAEJ,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../src/inputs/TextArea.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAIjC,MAAM,WAAW,aAAc,SAAQ,KAAK,CAC1C,KAAK,CAAC,qBAAqB,CAAC,UAAU,CAAC,EACvC;IACE,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CACF;CAAG;AAEJ,eAAO,MAAM,QAAQ,mIAcnB,CAAC"}
|
|
@@ -17,12 +17,6 @@ export declare function useInputAttributes({ nonLabelable }?: UseInputAttributes
|
|
|
17
17
|
'aria-invalid': boolean | undefined;
|
|
18
18
|
};
|
|
19
19
|
export declare function useFieldLabelRef(): import("react").RefObject<HTMLLabelElement> | undefined;
|
|
20
|
-
export type TextareaCharacterCountState = {
|
|
21
|
-
current: number;
|
|
22
|
-
max: number;
|
|
23
|
-
} | null;
|
|
24
|
-
export declare const TextareaCharacterCountProvider: import("react").Provider<((state: TextareaCharacterCountState) => void) | undefined>;
|
|
25
|
-
export declare function useTextareaCharacterCount(current: number, max: number | undefined): void;
|
|
26
20
|
export interface WithInputAttributesProps {
|
|
27
21
|
inputAttributes: ReturnType<typeof useInputAttributes>;
|
|
28
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../../src/inputs/contexts.tsx"],"names":[],"mappings":"AAEA,KAAK,qBAAqB,GAAG;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;CACzC,CAAC;AAGF,eAAO,MAAM,yBAAyB,6DAA6B,CAAC;AAGpE,eAAO,MAAM,sBAAsB,8CAA0B,CAAC;AAG9D,eAAO,MAAM,wBAAwB,8CAAmC,CAAC;AAGzE,eAAO,MAAM,oBAAoB,+CAA+B,CAAC;AAEjE,UAAU,sBAAsB;IAC9B,gLAAgL;IAChL,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,kBAAkB,CAAC,EAAE,YAAY,EAAE,GAAE,sBAA2B;;;;;EAQ/E;AAED,wBAAgB,gBAAgB,4DAE/B;AAED,MAAM,
|
|
1
|
+
{"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../../src/inputs/contexts.tsx"],"names":[],"mappings":"AAEA,KAAK,qBAAqB,GAAG;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;CACzC,CAAC;AAGF,eAAO,MAAM,yBAAyB,6DAA6B,CAAC;AAGpE,eAAO,MAAM,sBAAsB,8CAA0B,CAAC;AAG9D,eAAO,MAAM,wBAAwB,8CAAmC,CAAC;AAGzE,eAAO,MAAM,oBAAoB,+CAA+B,CAAC;AAEjE,UAAU,sBAAsB;IAC9B,gLAAgL;IAChL,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,kBAAkB,CAAC,EAAE,YAAY,EAAE,GAAE,sBAA2B;;;;;EAQ/E;AAED,wBAAgB,gBAAgB,4DAE/B;AAED,MAAM,WAAW,wBAAwB;IACvC,eAAe,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;CACxD;AAED,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,OAAO,CAAC,wBAAwB,CAAC,EAC7E,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACjC,IAAI,CAAC,EAAE,sBAAsB;YAEgB,IAAI,CAAC,CAAC,EAAE,MAAM,wBAAwB,CAAC;;EAOrF"}
|
|
@@ -30,7 +30,6 @@ declare function customRender(ui: ReactElement, { locale, messages, ...renderOpt
|
|
|
30
30
|
"neptune.Expander.expandAriaLabel": string;
|
|
31
31
|
"neptune.ExpressiveMoneyInput.currency.search.placeholder": string;
|
|
32
32
|
"neptune.ExpressiveMoneyInput.currency.select.currency": string;
|
|
33
|
-
"neptune.Field.characterCount": string;
|
|
34
33
|
"neptune.FlowNavigation.back": string;
|
|
35
34
|
"neptune.Info.ariaLabel": string;
|
|
36
35
|
"neptune.Label.optional": string;
|
|
@@ -118,7 +117,6 @@ declare function customRenderHook(callback: () => unknown, { locale, messages }?
|
|
|
118
117
|
"neptune.Expander.expandAriaLabel": string;
|
|
119
118
|
"neptune.ExpressiveMoneyInput.currency.search.placeholder": string;
|
|
120
119
|
"neptune.ExpressiveMoneyInput.currency.select.currency": string;
|
|
121
|
-
"neptune.Field.characterCount": string;
|
|
122
120
|
"neptune.FlowNavigation.back": string;
|
|
123
121
|
"neptune.Info.ariaLabel": string;
|
|
124
122
|
"neptune.Label.optional": string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test-utils/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAM,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAc,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAMxD;;;;GAIG;AACH,iBAAS,YAAY,CACnB,EAAE,EAAE,YAAY,EAChB,EAAE,MAAuB,EAAE,QAAa,EAAE,GAAG,aAAa,EAAE
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test-utils/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAM,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAc,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAMxD;;;;GAIG;AACH,iBAAS,YAAY,CACnB,EAAE,EAAE,YAAY,EAChB,EAAE,MAAuB,EAAE,QAAa,EAAE,GAAG,aAAa,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAK,GAChE,UAAU,CAAC,OAAO,MAAM,CAAC,CAK3B;AAED;;;GAGG;AACH,iBAAS,gBAAgB,CACvB,QAAQ,EAAE,MAAM,OAAO,EACvB,EAAE,MAAuB,EAAE,QAAa,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAK,uEAKhD;AAED,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,gBAAgB,IAAI,UAAU,EAAE,SAAS,EAAE,CAAC"}
|
package/package.json
CHANGED
package/src/field/Field.css
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
.np-field-control
|
|
1
|
+
.np-field-control,
|
|
2
|
+
.np-field__prompt {
|
|
2
3
|
margin-top: 4px;
|
|
3
4
|
margin-top: var(--size-4);
|
|
4
5
|
}
|
|
5
|
-
.np-field-validation {
|
|
6
|
-
display: flex;
|
|
7
|
-
align-items: flex-start;
|
|
8
|
-
margin-top: 4px;
|
|
9
|
-
margin-top: var(--size-4);
|
|
10
|
-
gap: 8px;
|
|
11
|
-
gap: var(--size-8);
|
|
12
|
-
}
|
|
13
|
-
.np-field-textarea-char-counter {
|
|
14
|
-
margin-left: auto;
|
|
15
|
-
padding: 4px 0;
|
|
16
|
-
padding: var(--size-4) 0;
|
|
17
|
-
color: #768e9c;
|
|
18
|
-
color: var(--color-content-tertiary);
|
|
19
|
-
}
|
|
20
6
|
.np-field .form-group--typeahead[class],
|
|
21
7
|
.np-field .np-checkbox-label[class] {
|
|
22
8
|
margin-bottom: 0;
|
package/src/field/Field.less
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
.np-field {
|
|
2
|
-
&-control
|
|
2
|
+
&-control,
|
|
3
|
+
&__prompt {
|
|
3
4
|
margin-top: var(--size-4);
|
|
4
5
|
}
|
|
5
6
|
|
|
6
|
-
&-validation {
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: flex-start;
|
|
9
|
-
margin-top: var(--size-4);
|
|
10
|
-
gap: var(--size-8);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
&-textarea-char-counter {
|
|
14
|
-
margin-left: auto;
|
|
15
|
-
padding: var(--size-4) 0;
|
|
16
|
-
color: var(--color-content-tertiary);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
7
|
// @FIXME space between individual fields should be 24px, while some older inputs
|
|
20
8
|
// inject extraneous space.
|
|
21
9
|
.form-group--typeahead[class],
|
|
@@ -84,11 +84,7 @@ export const Basic = (args: FieldProps) => {
|
|
|
84
84
|
messageIconLabel={args.messageIconLabel}
|
|
85
85
|
messageLoading={args.messageLoading}
|
|
86
86
|
>
|
|
87
|
-
<TextArea
|
|
88
|
-
maxLength={200}
|
|
89
|
-
value={value}
|
|
90
|
-
onChange={({ target }) => setValue(target.value)}
|
|
91
|
-
/>
|
|
87
|
+
<TextArea />
|
|
92
88
|
</Field>
|
|
93
89
|
|
|
94
90
|
<Field
|
package/src/field/Field.tsx
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
|
-
import {
|
|
3
|
-
import { useIntl } from 'react-intl';
|
|
2
|
+
import { useId, useRef } from 'react';
|
|
4
3
|
|
|
5
|
-
import Body from '../body';
|
|
6
4
|
import { Sentiment } from '../common';
|
|
7
|
-
import messages from './Field.messages';
|
|
8
5
|
import { InlinePrompt, type InlinePromptProps } from '../prompt';
|
|
9
6
|
import {
|
|
10
|
-
TextareaCharacterCountProvider,
|
|
11
|
-
type TextareaCharacterCountState,
|
|
12
7
|
FieldLabelContextProvider,
|
|
13
8
|
InputDescribedByProvider,
|
|
14
9
|
InputIdContextProvider,
|
|
@@ -59,7 +54,6 @@ export const Field = ({
|
|
|
59
54
|
children,
|
|
60
55
|
...props
|
|
61
56
|
}: FieldProps) => {
|
|
62
|
-
const { formatMessage } = useIntl();
|
|
63
57
|
const labelRef = useRef<HTMLLabelElement>(null);
|
|
64
58
|
const sentiment = props.error ? Sentiment.NEGATIVE : propType;
|
|
65
59
|
const message = propMessage || props.error;
|
|
@@ -72,14 +66,6 @@ export const Field = ({
|
|
|
72
66
|
|
|
73
67
|
const messageId = useId();
|
|
74
68
|
const descriptionId = useId();
|
|
75
|
-
const textareaCharCounterId = useId();
|
|
76
|
-
|
|
77
|
-
const [textareaCharacterCount, setTextareaCharacterCount] =
|
|
78
|
-
useState<TextareaCharacterCountState>(null);
|
|
79
|
-
const handleTextareaCharacterCount = useCallback(
|
|
80
|
-
(state: TextareaCharacterCountState) => setTextareaCharacterCount(state),
|
|
81
|
-
[],
|
|
82
|
-
);
|
|
83
69
|
|
|
84
70
|
/**
|
|
85
71
|
* form control can have multiple messages to describe it,
|
|
@@ -93,9 +79,6 @@ export const Field = ({
|
|
|
93
79
|
if (message) {
|
|
94
80
|
messageIds.push(messageId);
|
|
95
81
|
}
|
|
96
|
-
if (textareaCharacterCount) {
|
|
97
|
-
messageIds.push(textareaCharCounterId);
|
|
98
|
-
}
|
|
99
82
|
return messageIds.length > 0 ? messageIds.join(' ') : undefined;
|
|
100
83
|
}
|
|
101
84
|
|
|
@@ -104,69 +87,43 @@ export const Field = ({
|
|
|
104
87
|
<InputIdContextProvider value={inputId}>
|
|
105
88
|
<InputDescribedByProvider value={ariaDescribedbyByIds()}>
|
|
106
89
|
<InputInvalidProvider value={hasError}>
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
)}
|
|
90
|
+
<div
|
|
91
|
+
className={clsx(
|
|
92
|
+
'np-field form-group d-block',
|
|
93
|
+
{
|
|
94
|
+
'has-success': sentiment === Sentiment.POSITIVE,
|
|
95
|
+
'has-warning': sentiment === Sentiment.WARNING,
|
|
96
|
+
'has-error': hasError,
|
|
97
|
+
'has-info': sentiment === Sentiment.NEUTRAL,
|
|
98
|
+
},
|
|
99
|
+
className,
|
|
100
|
+
)}
|
|
101
|
+
>
|
|
102
|
+
{label != null ? (
|
|
103
|
+
<>
|
|
104
|
+
<Label ref={labelRef} id={labelId} htmlFor={inputId}>
|
|
105
|
+
{required ? label : <Label.Optional>{label}</Label.Optional>}
|
|
106
|
+
</Label>
|
|
107
|
+
<Label.Description id={descriptionId}>{description}</Label.Description>
|
|
108
|
+
<div className="np-field-control">{children}</div>
|
|
109
|
+
</>
|
|
110
|
+
) : (
|
|
111
|
+
children
|
|
112
|
+
)}
|
|
131
113
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
)}
|
|
146
|
-
{textareaCharacterCount && (
|
|
147
|
-
<Body
|
|
148
|
-
as="span"
|
|
149
|
-
id={textareaCharCounterId}
|
|
150
|
-
role="status"
|
|
151
|
-
aria-live={
|
|
152
|
-
textareaCharacterCount.current >= textareaCharacterCount.max * 0.8
|
|
153
|
-
? 'polite'
|
|
154
|
-
: 'off'
|
|
155
|
-
}
|
|
156
|
-
aria-atomic="true"
|
|
157
|
-
aria-label={formatMessage(messages.characterCount, {
|
|
158
|
-
current: textareaCharacterCount.current,
|
|
159
|
-
max: textareaCharacterCount.max,
|
|
160
|
-
})}
|
|
161
|
-
className="np-field-textarea-char-counter"
|
|
162
|
-
>
|
|
163
|
-
{textareaCharacterCount.current}/{textareaCharacterCount.max}
|
|
164
|
-
</Body>
|
|
165
|
-
)}
|
|
166
|
-
</div>
|
|
167
|
-
)}
|
|
168
|
-
</div>
|
|
169
|
-
</TextareaCharacterCountProvider>
|
|
114
|
+
{message && (
|
|
115
|
+
<InlinePrompt
|
|
116
|
+
sentiment={sentiment}
|
|
117
|
+
id={messageId}
|
|
118
|
+
mediaLabel={messageIconLabel}
|
|
119
|
+
className="np-field__prompt"
|
|
120
|
+
loading={messageLoading}
|
|
121
|
+
width="full"
|
|
122
|
+
>
|
|
123
|
+
{message}
|
|
124
|
+
</InlinePrompt>
|
|
125
|
+
)}
|
|
126
|
+
</div>
|
|
170
127
|
</InputInvalidProvider>
|
|
171
128
|
</InputDescribedByProvider>
|
|
172
129
|
</InputIdContextProvider>
|
|
@@ -3,7 +3,7 @@ import { useState } from 'react';
|
|
|
3
3
|
import AvatarView from '../avatarView';
|
|
4
4
|
import Body from '../body';
|
|
5
5
|
import Button from '../button';
|
|
6
|
-
import { ProfileType, Typography } from '../common';
|
|
6
|
+
import { Breakpoint, ProfileType, Typography } from '../common';
|
|
7
7
|
import Logo from '../logo';
|
|
8
8
|
import OverlayHeader from '../overlayHeader';
|
|
9
9
|
import { lorem10 } from '../test-utils';
|
|
@@ -45,14 +45,14 @@ const meta: Meta<StoryArgs> = {
|
|
|
45
45
|
};
|
|
46
46
|
export default meta;
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
const viewports = [
|
|
49
|
+
Breakpoint.ZOOM_400 - 10,
|
|
50
|
+
Breakpoint.ZOOM_400 + 10,
|
|
51
|
+
Breakpoint.EXTRA_SMALL + 10,
|
|
52
|
+
Breakpoint.SMALL + 10,
|
|
53
|
+
Breakpoint.MEDIUM + 10,
|
|
54
|
+
Breakpoint.LARGE + 10,
|
|
55
|
+
];
|
|
56
56
|
|
|
57
57
|
export const Variants: Story = {
|
|
58
58
|
args: {
|
|
@@ -62,6 +62,11 @@ export const Variants: Story = {
|
|
|
62
62
|
done: false,
|
|
63
63
|
avatarURL: '../tapestry-01.png',
|
|
64
64
|
},
|
|
65
|
+
parameters: {
|
|
66
|
+
chromatic: {
|
|
67
|
+
viewports,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
65
70
|
render: (args) => {
|
|
66
71
|
const [activeStep, setActiveStep] = useState(2);
|
|
67
72
|
const [closed, setClosed] = useState(false);
|
|
@@ -86,10 +86,10 @@ describe('FlowNavigation', () => {
|
|
|
86
86
|
expect(container.querySelector('.np-flow-navigation__stepper')).not.toBeInTheDocument();
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
-
it(`
|
|
89
|
+
it(`does not render stepper when steps is empty`, () => {
|
|
90
90
|
const { container } = render(<FlowNavigation {...props} steps={[]} />);
|
|
91
91
|
|
|
92
|
-
expect(container.querySelector('.np-flow-navigation__stepper')).toBeInTheDocument();
|
|
92
|
+
expect(container.querySelector('.np-flow-navigation__stepper')).not.toBeInTheDocument();
|
|
93
93
|
expect(container.querySelector('.tw-stepper')).not.toBeInTheDocument();
|
|
94
94
|
});
|
|
95
95
|
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import AvatarView from '../avatarView';
|
|
3
|
+
import { ProfileType } from '../common';
|
|
4
|
+
import Logo from '../logo';
|
|
5
|
+
import { allModes } from '../../.storybook/modes';
|
|
6
|
+
|
|
7
|
+
import FlowNavigation, { FlowNavigationProps } from './FlowNavigation';
|
|
8
|
+
|
|
9
|
+
const noop = () => {};
|
|
10
|
+
|
|
11
|
+
const baseProps: FlowNavigationProps = {
|
|
12
|
+
steps: [],
|
|
13
|
+
activeStep: 0,
|
|
14
|
+
avatar: <AvatarView profileType={ProfileType.PERSONAL} />,
|
|
15
|
+
logo: <Logo />,
|
|
16
|
+
onClose: noop,
|
|
17
|
+
onGoBack: noop,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const meta: Meta<typeof FlowNavigation> = {
|
|
21
|
+
component: FlowNavigation,
|
|
22
|
+
title: 'Navigation/FlowNavigation/Tests',
|
|
23
|
+
tags: ['!autodocs', '!manifest'],
|
|
24
|
+
parameters: {
|
|
25
|
+
padding: '0',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export default meta;
|
|
29
|
+
|
|
30
|
+
type Story = StoryObj<typeof FlowNavigation>;
|
|
31
|
+
|
|
32
|
+
export const EmptySteps: Story = {
|
|
33
|
+
parameters: {
|
|
34
|
+
chromatic: {
|
|
35
|
+
modes: {
|
|
36
|
+
tablet: allModes.tablet,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
globals: {
|
|
41
|
+
viewport: 'tablet',
|
|
42
|
+
},
|
|
43
|
+
render: () => <FlowNavigation {...baseProps} />,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const LongLabel: Story = {
|
|
47
|
+
parameters: {
|
|
48
|
+
chromatic: {
|
|
49
|
+
viewports: [360],
|
|
50
|
+
},
|
|
51
|
+
viewport: {
|
|
52
|
+
options: {
|
|
53
|
+
narrow: {
|
|
54
|
+
name: '360px',
|
|
55
|
+
styles: { width: '360px', height: '600px' },
|
|
56
|
+
type: 'mobile',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
globals: {
|
|
62
|
+
viewport: 'narrow',
|
|
63
|
+
},
|
|
64
|
+
render: () => (
|
|
65
|
+
<FlowNavigation
|
|
66
|
+
{...baseProps}
|
|
67
|
+
steps={[
|
|
68
|
+
{ label: 'Amount', hoverLabel: '100 GBP', onClick: noop },
|
|
69
|
+
{ label: 'You', hoverLabel: 'Elena Durante', onClick: noop },
|
|
70
|
+
{ label: 'Kedvezményezett', hoverLabel: 'Daniele Tomboro', onClick: noop },
|
|
71
|
+
{ label: 'Review', hoverLabel: 'Antonio Dozortevo', onClick: noop },
|
|
72
|
+
{ label: 'Pay', hoverLabel: 'Enrico Gusso', onClick: noop },
|
|
73
|
+
]}
|
|
74
|
+
activeStep={2}
|
|
75
|
+
/>
|
|
76
|
+
),
|
|
77
|
+
};
|