@transferwise/components 0.0.0-experimental-c8ab32e → 0.0.0-experimental-d349b91

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.
Files changed (64) hide show
  1. package/build/field/Field.js +4 -13
  2. package/build/field/Field.js.map +1 -1
  3. package/build/field/Field.mjs +4 -13
  4. package/build/field/Field.mjs.map +1 -1
  5. package/build/i18n/en.json +1 -3
  6. package/build/i18n/en.json.js +1 -3
  7. package/build/i18n/en.json.js.map +1 -1
  8. package/build/i18n/en.json.mjs +1 -3
  9. package/build/i18n/en.json.mjs.map +1 -1
  10. package/build/i18n/zh-HK.json +2 -0
  11. package/build/i18n/zh-HK.json.js +2 -0
  12. package/build/i18n/zh-HK.json.js.map +1 -1
  13. package/build/i18n/zh-HK.json.mjs +2 -0
  14. package/build/i18n/zh-HK.json.mjs.map +1 -1
  15. package/build/label/Label.js +1 -29
  16. package/build/label/Label.js.map +1 -1
  17. package/build/label/Label.mjs +2 -30
  18. package/build/label/Label.mjs.map +1 -1
  19. package/build/stepper/Stepper.js +5 -2
  20. package/build/stepper/Stepper.js.map +1 -1
  21. package/build/stepper/Stepper.mjs +5 -2
  22. package/build/stepper/Stepper.mjs.map +1 -1
  23. package/build/types/field/Field.d.ts +2 -4
  24. package/build/types/field/Field.d.ts.map +1 -1
  25. package/build/types/index.d.ts +1 -1
  26. package/build/types/index.d.ts.map +1 -1
  27. package/build/types/label/Label.d.ts +1 -10
  28. package/build/types/label/Label.d.ts.map +1 -1
  29. package/build/types/stepper/Stepper.d.ts +4 -0
  30. package/build/types/stepper/Stepper.d.ts.map +1 -1
  31. package/package.json +4 -4
  32. package/src/dateInput/DateInput.story.tsx +1 -6
  33. package/src/dateLookup/DateLookup.rtl.spec.tsx +1 -1
  34. package/src/field/Field.spec.tsx +3 -4
  35. package/src/field/Field.story.tsx +4 -38
  36. package/src/field/Field.tests.story.tsx +2 -4
  37. package/src/field/Field.tsx +8 -17
  38. package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +4 -4
  39. package/src/i18n/en.json +1 -3
  40. package/src/i18n/zh-HK.json +2 -0
  41. package/src/index.ts +1 -1
  42. package/src/inlineAlert/InlineAlert.story.tsx +14 -11
  43. package/src/inputs/InputGroup.spec.tsx +1 -1
  44. package/src/inputs/SearchInput.spec.tsx +1 -1
  45. package/src/inputs/SelectInput.spec.tsx +1 -1
  46. package/src/label/Label.story.tsx +21 -37
  47. package/src/label/Label.tsx +2 -42
  48. package/src/radioGroup/RadioGroup.rtl.spec.tsx +1 -1
  49. package/src/select/Select.rtl.spec.tsx +1 -1
  50. package/src/stepper/Stepper.less +2 -2
  51. package/src/stepper/Stepper.story.tsx +49 -0
  52. package/src/stepper/Stepper.tsx +7 -3
  53. package/src/switch/Switch.spec.tsx +1 -1
  54. package/build/label/Label.messages.js +0 -15
  55. package/build/label/Label.messages.js.map +0 -1
  56. package/build/label/Label.messages.mjs +0 -13
  57. package/build/label/Label.messages.mjs.map +0 -1
  58. package/build/types/label/Label.messages.d.ts +0 -12
  59. package/build/types/label/Label.messages.d.ts.map +0 -1
  60. package/build/types/label/index.d.ts +0 -3
  61. package/build/types/label/index.d.ts.map +0 -1
  62. package/src/label/Label.messages.tsx +0 -12
  63. package/src/label/index.ts +0 -2
  64. package/src/stepper/Stepper.story.js +0 -40
@@ -9,6 +9,10 @@ export interface StepperProps {
9
9
  activeStep?: number;
10
10
  className?: string;
11
11
  }
12
+ /**
13
+ * This component is considered user-unfriendly and inaccessible on its own and will likely be made internal in the future. Please use `FlowNavigation` instead.
14
+ * @see https://storybook.wise.design/?path=/story/navigation-flownavigation--variants
15
+ */
12
16
  declare const Stepper: ({ steps, activeStep, className }: StepperProps) => React.JSX.Element | null;
13
17
  export default Stepper;
14
18
  //# sourceMappingURL=Stepper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Stepper.d.ts","sourceRoot":"","sources":["../../../src/stepper/Stepper.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD,QAAA,MAAM,OAAO,qCAA0C,YAAY,6BA8DlE,CAAC;AAGF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"Stepper.d.ts","sourceRoot":"","sources":["../../../src/stepper/Stepper.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,QAAA,MAAM,OAAO,qCAA0C,YAAY,6BAgElE,CAAC;AAEF,eAAe,OAAO,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-c8ab32e",
3
+ "version": "0.0.0-experimental-d349b91",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -93,12 +93,12 @@
93
93
  "rollup-preserve-directives": "^1.1.1",
94
94
  "storybook": "^8.2.2",
95
95
  "@transferwise/less-config": "3.1.0",
96
- "@transferwise/neptune-css": "0.0.0-experimental-c8ab32e",
97
- "@wise/components-theming": "1.4.0"
96
+ "@wise/components-theming": "1.4.0",
97
+ "@transferwise/neptune-css": "14.12.1"
98
98
  },
99
99
  "peerDependencies": {
100
100
  "@transferwise/icons": "^3.7.0",
101
- "@transferwise/neptune-css": "0.0.0-experimental-c8ab32e",
101
+ "@transferwise/neptune-css": "^14.9.6",
102
102
  "@wise/art": "^2.7.0",
103
103
  "@wise/components-theming": "^1.0.0",
104
104
  "react": ">=18",
@@ -1,7 +1,7 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
2
  import { fn } from '@storybook/test';
3
3
 
4
- import { DateInput, Field } from '..';
4
+ import { DateInput } from '..';
5
5
 
6
6
  const meta = {
7
7
  component: DateInput,
@@ -17,9 +17,4 @@ export const Basic = {
17
17
  args: {
18
18
  onChange: fn(),
19
19
  },
20
- render: (args) => (
21
- <Field label="Date of date">
22
- <DateInput {...args} />
23
- </Field>
24
- ),
25
20
  } satisfies Story;
@@ -28,7 +28,7 @@ describe('DateLookup', () => {
28
28
  </Field>,
29
29
  );
30
30
  // TODO: Replace with `.toHaveAttribute('aria-haspopup')`
31
- expect(screen.getByLabelText(/Date of birth/)).toHaveTextContent(
31
+ expect(screen.getByLabelText('Date of birth')).toHaveTextContent(
32
32
  initialValue.getFullYear().toString(),
33
33
  );
34
34
  });
@@ -14,11 +14,11 @@ describe('Field', () => {
14
14
  </Field>,
15
15
  );
16
16
 
17
- expect(screen.getByLabelText(/Phone number/)).toBeInTheDocument();
17
+ expect(screen.getByLabelText('Phone number')).toBeInTheDocument();
18
18
  expect(screen.getByRole('textbox')).not.toHaveAttribute('aria-describedby');
19
19
  });
20
20
 
21
- it.skip('should render help text if provided', () => {
21
+ it('should render help text if provided', () => {
22
22
  render(
23
23
  <Field label="Phone number" hint="This is help text">
24
24
  <Input />
@@ -50,8 +50,7 @@ describe('Field', () => {
50
50
  );
51
51
 
52
52
  expect(screen.getByRole('textbox', { description: 'This is error text' })).toBeInTheDocument();
53
- // screen.debug();
54
- // expect(screen.queryByText('This is help text')).not.toBeInTheDocument();
53
+ expect(screen.queryByText('This is help text')).not.toBeInTheDocument();
55
54
  });
56
55
 
57
56
  it('avoids triggering button within label inadvertently', async () => {
@@ -13,17 +13,9 @@ export default {
13
13
  export const Basic = () => {
14
14
  const [value, setValue] = useState<string | undefined>('This is some text');
15
15
  return (
16
- <>
17
- <Field label="Phone number" required>
18
- <Input value={value} onChange={({ target }) => setValue(target.value)} />
19
- </Field>
20
- <Field label="Phone number">
21
- <Input value={value} onChange={({ target }) => setValue(target.value)} />
22
- </Field>
23
- <Field label="Phone number" description="Please provide you primary phone number">
24
- <Input value={value} onChange={({ target }) => setValue(target.value)} />
25
- </Field>
26
- </>
16
+ <Field label="Phone number">
17
+ <Input value={value} onChange={({ target }) => setValue(target.value)} />
18
+ </Field>
27
19
  );
28
20
  };
29
21
 
@@ -40,33 +32,7 @@ export const WithStatusMessages = () => {
40
32
  <Field label="Phone number" sentiment={Sentiment.NEGATIVE} message="This is a required field">
41
33
  <Input value={value} onChange={({ target }) => setValue(target.value)} />
42
34
  </Field>
43
- <Field label="Phone number (this)" message="This is a helpful message (this)">
44
- <Input value={value} onChange={({ target }) => setValue(target.value)} />
45
- </Field>
46
- {/* instance with deprecated `hint` prop */}
47
- <Field
48
- label="Phone number"
49
- hint="This is a helpful message"
50
- sentiment={Sentiment.NEGATIVE}
51
- message="Validation error, please take a look"
52
- >
53
- <Input value={value} onChange={({ target }) => setValue(target.value)} />
54
- </Field>
55
- {/* instance with deprecated `error` & `hint` props */}
56
- <Field
57
- label="Phone number"
58
- hint="This is a helpful message"
59
- error="Validation error, please take a look"
60
- >
61
- <Input value={value} onChange={({ target }) => setValue(target.value)} />
62
- </Field>
63
- {/* instance with deprecated `error` & `hint` props */}
64
- <Field
65
- label="Phone number"
66
- description="This is a helpful message"
67
- sentiment={Sentiment.NEGATIVE}
68
- message="Validation error, please take a look"
69
- >
35
+ <Field label="Phone number" message="This is a helpful message">
70
36
  <Input value={value} onChange={({ target }) => setValue(target.value)} />
71
37
  </Field>
72
38
  </div>
@@ -3,7 +3,6 @@ import { useState } from 'react';
3
3
  import { Input } from '../inputs/Input';
4
4
  import { Field } from './Field';
5
5
  import { Sentiment } from '../common';
6
- import InlineAlert from '../inlineAlert/InlineAlert';
7
6
 
8
7
  export default {
9
8
  component: Field,
@@ -16,9 +15,8 @@ export const WithHelpAndErrorOnBlur = () => {
16
15
  return (
17
16
  <Field
18
17
  label="Phone number"
19
- sentiment={error ? Sentiment.NEGATIVE : undefined}
20
- message={error}
21
- description="Please include country code"
18
+ sentiment={error ? Sentiment.NEGATIVE : Sentiment.NEUTRAL}
19
+ message={error || 'Please include country code'}
22
20
  >
23
21
  <Input
24
22
  value={value}
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import { ReactNode, useId } from 'react';
2
+ import { useId } from 'react';
3
3
 
4
4
  import { Sentiment } from '../common';
5
5
  import InlineAlert from '../inlineAlert/InlineAlert';
@@ -9,18 +9,16 @@ import {
9
9
  InputIdContextProvider,
10
10
  InputInvalidProvider,
11
11
  } from '../inputs/contexts';
12
- import { Label } from '../label';
12
+ import { Label } from '../label/Label';
13
13
 
14
14
  export type FieldProps = {
15
15
  /** `null` disables auto-generating the `id` attribute, falling back to nesting-based label association over setting `htmlFor` explicitly. */
16
16
  id?: string | null;
17
17
  /** Should be specified unless the wrapped control has its own labeling mechanism, e.g. `Checkbox`. */
18
18
  label?: React.ReactNode;
19
- required?: boolean;
20
- /** @deprecated use `description` prop instead */
19
+ /** @deprecated use `message` and `type={Sentiment.NEUTRAL}` prop instead */
21
20
  hint?: React.ReactNode;
22
21
  message?: React.ReactNode;
23
- description?: React.ReactNode;
24
22
  /** @deprecated use `message` and `type={Sentiment.NEGATIVE}` prop instead */
25
23
  error?: React.ReactNode;
26
24
  sentiment?: `${Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.POSITIVE | Sentiment.WARNING}`;
@@ -31,26 +29,20 @@ export type FieldProps = {
31
29
  export const Field = ({
32
30
  id,
33
31
  label,
34
- required = false,
35
32
  message: propMessage,
36
- description: propDescription,
37
33
  sentiment: propType = Sentiment.NEUTRAL,
38
34
  className,
39
35
  children,
40
36
  ...props
41
37
  }: FieldProps) => {
42
38
  const sentiment = props.error ? Sentiment.NEGATIVE : propType;
43
- const message = propMessage || props.error || props.hint;
39
+ const message = props.error || props.hint || propMessage;
44
40
  const hasError = sentiment === Sentiment.NEGATIVE;
45
- const hasInfo: boolean = sentiment === Sentiment.NEUTRAL && (!!props.hint || !!message);
46
- const description: ReactNode = propDescription || (hasInfo && (props.hint || message));
47
-
48
- console.log('hasInfo', hasInfo, 'description', description);
49
41
 
50
42
  const labelId = useId();
51
43
 
52
44
  const fallbackInputId = useId();
53
- const inputId = id !== null ? (id ?? fallbackInputId) : undefined;
45
+ const inputId = id !== null ? id ?? fallbackInputId : undefined;
54
46
 
55
47
  const descriptionId = useId();
56
48
 
@@ -66,22 +58,21 @@ export const Field = ({
66
58
  'has-success': sentiment === Sentiment.POSITIVE,
67
59
  'has-warning': sentiment === Sentiment.WARNING,
68
60
  'has-error': hasError,
69
- 'has-info': hasInfo,
61
+ 'has-info': sentiment === Sentiment.NEUTRAL,
70
62
  },
71
63
  className,
72
64
  )}
73
65
  >
74
66
  {label != null ? (
75
67
  <Label id={labelId} htmlFor={inputId}>
76
- {required ? label : <Label.Optional>{label}</Label.Optional>}
77
- {description && <Label.Description>{description}</Label.Description>}
68
+ {label}
78
69
  {children}
79
70
  </Label>
80
71
  ) : (
81
72
  children
82
73
  )}
83
74
 
84
- {message && !hasInfo && (
75
+ {message && (
85
76
  <InlineAlert type={sentiment} id={descriptionId}>
86
77
  {message}
87
78
  </InlineAlert>
@@ -71,7 +71,7 @@ exports[`FlowNavigation on mobile renders as expected 1`] = `
71
71
  style="width: 50%;"
72
72
  />
73
73
  </div>
74
- <ul
74
+ <ol
75
75
  class="tw-stepper-steps p-t-1 m-b-0"
76
76
  >
77
77
  <li
@@ -107,7 +107,7 @@ exports[`FlowNavigation on mobile renders as expected 1`] = `
107
107
  label-2
108
108
  </span>
109
109
  </li>
110
- </ul>
110
+ </ol>
111
111
  </div>
112
112
  </div>
113
113
  </div>
@@ -187,7 +187,7 @@ exports[`FlowNavigation renders as expected 1`] = `
187
187
  style="width: 0%;"
188
188
  />
189
189
  </div>
190
- <ul
190
+ <ol
191
191
  class="tw-stepper-steps p-t-1 m-b-0"
192
192
  >
193
193
  <li
@@ -223,7 +223,7 @@ exports[`FlowNavigation renders as expected 1`] = `
223
223
  label-2
224
224
  </span>
225
225
  </li>
226
- </ul>
226
+ </ol>
227
227
  </div>
228
228
  </div>
229
229
  </div>
package/src/i18n/en.json CHANGED
@@ -18,7 +18,6 @@
18
18
  "neptune.DateLookup.year": "year",
19
19
  "neptune.FlowNavigation.back": "back to previous step",
20
20
  "neptune.Info.ariaLabel": "More information",
21
- "neptune.Label.optional": "(Optional)",
22
21
  "neptune.Link.opensInNewTab": "(opens in new tab)",
23
22
  "neptune.MoneyInput.Select.placeholder": "Select an option...",
24
23
  "neptune.PhoneNumberInput.SelectInput.placeholder": "Select an option...",
@@ -56,6 +55,5 @@
56
55
  "neptune.UploadItem.uploaded": "Uploaded",
57
56
  "neptune.UploadItem.uploadedFile": "Uploaded file",
58
57
  "neptune.UploadItem.uploading": "Uploading...",
59
- "neptune.UploadItem.uploadingFailed": "Uploading failed",
60
- "neptune.aria.Label.optional": "This field is optional"
58
+ "neptune.UploadItem.uploadingFailed": "Uploading failed"
61
59
  }
@@ -23,6 +23,8 @@
23
23
  "neptune.PhoneNumberInput.SelectInput.placeholder": "選擇其中一項…",
24
24
  "neptune.Select.searchPlaceholder": "搜尋…",
25
25
  "neptune.SelectInput.noResultsFound": "找不到任何結果",
26
+ "neptune.SelectOption.action.label": "選擇",
27
+ "neptune.SelectOption.selected.action.label": "更改已選選項",
26
28
  "neptune.Summary.statusDone": "已完成事項",
27
29
  "neptune.Summary.statusNotDone": "未完成事項",
28
30
  "neptune.Summary.statusPending": "待處理事項",
package/src/index.ts CHANGED
@@ -44,7 +44,7 @@ export type {
44
44
  } from './inputs/SelectInput';
45
45
  export type { TextAreaProps } from './inputs/TextArea';
46
46
  export type { InstructionsListProps } from './instructionsList';
47
- export type { LabelProps, LabelOptionalProps, LabelDescriptionProps } from './label/Label';
47
+ export type { LabelProps } from './label/Label';
48
48
  export type { LoaderProps } from './loader';
49
49
  export type { MarkdownProps } from './markdown';
50
50
  export type { ModalProps } from './modal';
@@ -5,8 +5,6 @@ import { Sentiment } from '../common';
5
5
  import { Input } from '../inputs/Input';
6
6
 
7
7
  import InlineAlert, { InlineAlertProps } from './InlineAlert';
8
- import { Label } from '../label';
9
- import { lorem40 } from '../test-utils';
10
8
 
11
9
  export default {
12
10
  component: InlineAlert,
@@ -68,31 +66,36 @@ export const Basic = () => {
68
66
  this manually.
69
67
  </p>
70
68
  <div className={`form-group ${typeClass}`}>
71
- <Label className="control-label" htmlFor="id0">
69
+ <label className="control-label" htmlFor="id0">
72
70
  Toggleable
73
- </Label>
71
+ </label>
74
72
  <Input id="id0" value="Neptune is cool" />
75
73
  <InlineAlert type={type}>{message}</InlineAlert>
76
74
  </div>
77
75
  <div className="form-group has-error">
78
- <Label className="control-label" htmlFor="id1">
76
+ <label className="control-label" htmlFor="id1">
79
77
  Negative
80
- </Label>
78
+ </label>
81
79
  <Input id="id1" value="Neptune is cool" />
82
80
  <InlineAlert type="negative">{message}</InlineAlert>
83
81
  </div>
84
82
  <div className="form-group has-success">
85
- <Label className="control-label" htmlFor="id2">
83
+ <label className="control-label" htmlFor="id2">
86
84
  Positive
87
- </Label>
85
+ </label>
88
86
  <Input id="id2" value="Neptune is cool" />
89
- <InlineAlert type="positive">{lorem40}</InlineAlert>
87
+ <InlineAlert type="positive">
88
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
89
+ ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
90
+ ullamco laboris nisi ut aliquip ex ea commodo consequat.
91
+ </InlineAlert>
90
92
  </div>
91
93
  <div className="form-group has-neutral">
92
- <Label className="control-label" htmlFor="id3">
94
+ <label className="control-label" htmlFor="id3">
93
95
  Neutral
94
- </Label>
96
+ </label>
95
97
  <Input id="id3" value="Neptune is cool" />
98
+ <InlineAlert type="neutral">{message}</InlineAlert>
96
99
  </div>
97
100
  <div className="form-group">
98
101
  <label className="control-label" htmlFor="id4">
@@ -26,6 +26,6 @@ describe('InputGroup', () => {
26
26
  </InputGroup>
27
27
  </Field>,
28
28
  );
29
- expect(screen.getByLabelText(/Search…/)).toHaveRole('textbox');
29
+ expect(screen.getByLabelText('Search…')).toHaveRole('textbox');
30
30
  });
31
31
  });
@@ -11,6 +11,6 @@ describe('SearchInput', () => {
11
11
  <SearchInput />
12
12
  </Field>,
13
13
  );
14
- expect(screen.getByLabelText(/Search…/)).toHaveRole('searchbox');
14
+ expect(screen.getByLabelText('Search…')).toHaveRole('searchbox');
15
15
  });
16
16
  });
@@ -214,6 +214,6 @@ describe('SelectInput', () => {
214
214
  <SelectInput items={[{ type: 'option', value: 'USD' }]} value="USD" />
215
215
  </Field>,
216
216
  );
217
- expect(screen.getByLabelText(/Currency/)).toHaveAttribute('aria-haspopup');
217
+ expect(screen.getByLabelText('Currency')).toHaveAttribute('aria-haspopup');
218
218
  });
219
219
  });
@@ -1,53 +1,37 @@
1
1
  import { useState } from 'react';
2
2
 
3
+ import Info from '../info/Info';
3
4
  import { Input } from '../inputs/Input';
4
5
  import { Label } from './Label';
5
- import InlineAlert from '../inlineAlert/InlineAlert';
6
- import { lorem10 } from '../test-utils';
7
6
 
8
7
  export default {
9
8
  component: Label,
10
9
  title: 'Label',
11
- tags: ['autodocs'],
12
10
  };
13
11
 
14
12
  export const Basic = () => {
15
13
  const [value, setValue] = useState<string | undefined>('This is some text');
16
14
  return (
17
- <>
18
- <Label className="m-b-2">
19
- Phone number
20
- <Input value={value} id="input" onChange={({ target }) => setValue(target.value)} />
21
- </Label>
22
-
23
- <Label className="m-b-2">
24
- <Label.Optional>Phone number</Label.Optional>
25
- <Input value={value} id="input" onChange={({ target }) => setValue(target.value)} />
26
- </Label>
27
-
28
- <Label className="m-b-2">
29
- <Label.Optional>Phone number</Label.Optional>
30
- <Label.Description>This an field Description</Label.Description>
31
- <Input value={value} id="input" onChange={({ target }) => setValue(target.value)} />
32
- </Label>
33
-
34
- <Label htmlFor="phone-number-1">
35
- <Label.Optional>Phone number</Label.Optional>
36
- <Label.Description>This an field Description</Label.Description>
37
- </Label>
38
- <Input
39
- id="phone-number-1"
40
- className="m-b-2"
41
- value={value}
42
- onChange={({ target }) => setValue(target.value)}
43
- />
15
+ <Label>
16
+ Phone number
17
+ <Input value={value} id="input" onChange={({ target }) => setValue(target.value)} />
18
+ </Label>
19
+ );
20
+ };
44
21
 
45
- {/* Instance of legacy and deprecated way of doing labels for visual testing */}
46
- <label className="control-label" htmlFor="phone-number-1">
47
- Phone number
48
- </label>
49
- <Input id="phone-number-1" value={value} onChange={({ target }) => setValue(target.value)} />
50
- <InlineAlert>{lorem10}</InlineAlert>
51
- </>
22
+ export const WithInfo = () => {
23
+ const [value, setValue] = useState<string | undefined>('This is some text');
24
+ return (
25
+ <Label>
26
+ <span className="d-flex">
27
+ Phone number{' '}
28
+ <Info
29
+ content="This is some help in popover"
30
+ aria-label="The aria label"
31
+ className="m-l-1"
32
+ />
33
+ </span>
34
+ <Input value={value} id="input" onChange={({ target }) => setValue(target.value)} />
35
+ </Label>
52
36
  );
53
37
  };
@@ -1,9 +1,4 @@
1
1
  import classNames from 'classnames';
2
- import Body from '../body';
3
- import { useIntl } from 'react-intl';
4
- import messages from './Label.messages';
5
- import { CommonProps } from '../common';
6
- import { PropsWithChildren } from 'react';
7
2
 
8
3
  export type LabelProps = {
9
4
  id?: string;
@@ -12,49 +7,14 @@ export type LabelProps = {
12
7
  children?: React.ReactNode;
13
8
  };
14
9
 
15
- const Label = ({ id, htmlFor, className, children }: LabelProps) => {
10
+ export const Label = ({ id, htmlFor, className, children }: LabelProps) => {
16
11
  return (
17
12
  <label
18
13
  id={id}
19
14
  htmlFor={htmlFor}
20
- className={classNames(
21
- 'control-label d-flex flex-column m-b-0',
22
- 'np-text-body-default-bold',
23
- 'text-primary',
24
- className,
25
- )}
15
+ className={classNames('control-label d-flex flex-column gap-y-1 m-b-0', className)}
26
16
  >
27
17
  {children}
28
18
  </label>
29
19
  );
30
20
  };
31
-
32
- export type LabelOptionalProps = PropsWithChildren<CommonProps>;
33
-
34
- const Optional = ({ children, className }: LabelOptionalProps) => {
35
- const { formatMessage } = useIntl();
36
- return (
37
- <div>
38
- {children}
39
- <Body
40
- as="span"
41
- aria-label={formatMessage(messages.optionalAriaLabel)}
42
- className={classNames('text-secondary', 'm-l-1', className)}
43
- >
44
- {formatMessage(messages.optionalLabel)}
45
- </Body>
46
- </div>
47
- );
48
- };
49
-
50
- export type LabelDescriptionProps = PropsWithChildren<CommonProps>;
51
-
52
- const Description = ({ children, className }: LabelDescriptionProps) =>
53
- children ? (
54
- <Body className={classNames('text-secondary', 'm-b-1', className)}>{children}</Body>
55
- ) : null;
56
-
57
- Label.Optional = Optional;
58
- Label.Description = Description;
59
-
60
- export { Label };
@@ -1,4 +1,4 @@
1
- import { render, screen } from '../test-utils';
1
+ import { render, screen } from '@testing-library/react';
2
2
 
3
3
  import RadioGroup from '.';
4
4
  import { Field } from '../field/Field';
@@ -12,6 +12,6 @@ describe('Select', () => {
12
12
  <Select options={options} selected={options[0]} onChange={() => {}} />
13
13
  </Field>,
14
14
  );
15
- expect(screen.getByLabelText(/Currency/)).toHaveTextContent('USD');
15
+ expect(screen.getByLabelText('Currency')).toHaveTextContent('USD');
16
16
  });
17
17
  });
@@ -79,7 +79,7 @@
79
79
 
80
80
  .progress-bar {
81
81
  .float(left);
82
-
82
+
83
83
  -webkit-backface-visibility: hidden;
84
84
  height: 100%;
85
85
  background-color: var(--color-interactive-primary);
@@ -87,7 +87,7 @@
87
87
  border-bottom-left-radius: 1px;
88
88
  transition: width 0.6s ease-in-out;
89
89
  will-change: width;
90
-
90
+
91
91
  &::after {
92
92
  .float(right);
93
93
 
@@ -0,0 +1,49 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { fn } from '@storybook/test';
3
+ import Stepper from './Stepper';
4
+
5
+ const STEPS = [
6
+ {
7
+ label: 'One',
8
+ onClick: fn(),
9
+ },
10
+ {
11
+ label: 'Two',
12
+ hoverLabel: (
13
+ <>
14
+ <div>
15
+ <strong>Diana Jaramillo</strong>
16
+ </div>
17
+ dianajarm123@gmail.com
18
+ </>
19
+ ),
20
+ onClick: fn(),
21
+ },
22
+ { label: 'Recipient', onClick: fn() },
23
+ { label: 'Smellification', onClick: fn() },
24
+ { label: 'Battle', onClick: fn() },
25
+ ];
26
+
27
+ export default {
28
+ component: Stepper,
29
+ title: 'Navigation/Stepper',
30
+ argTypes: {
31
+ activeStep: {
32
+ control: 'radio',
33
+ options: [...Array(STEPS.length).keys()],
34
+ },
35
+ },
36
+ tags: ['autodocs'],
37
+ } satisfies Meta<typeof Stepper>;
38
+
39
+ type Story = StoryObj<typeof Stepper>;
40
+
41
+ export const Basic: Story = {
42
+ render: ({ activeStep, steps }) => {
43
+ return <Stepper activeStep={activeStep} steps={steps} />;
44
+ },
45
+ args: {
46
+ activeStep: 2,
47
+ steps: STEPS,
48
+ },
49
+ };