@transferwise/components 46.111.0 → 46.111.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.
Files changed (130) hide show
  1. package/build/common/panel/Panel.js +1 -0
  2. package/build/common/panel/Panel.js.map +1 -1
  3. package/build/common/panel/Panel.mjs +1 -0
  4. package/build/common/panel/Panel.mjs.map +1 -1
  5. package/build/common/responsivePanel/ResponsivePanel.js +6 -1
  6. package/build/common/responsivePanel/ResponsivePanel.js.map +1 -1
  7. package/build/common/responsivePanel/ResponsivePanel.mjs +6 -1
  8. package/build/common/responsivePanel/ResponsivePanel.mjs.map +1 -1
  9. package/build/dateInput/DateInput.js +46 -24
  10. package/build/dateInput/DateInput.js.map +1 -1
  11. package/build/dateInput/DateInput.mjs +48 -26
  12. package/build/dateInput/DateInput.mjs.map +1 -1
  13. package/build/dateLookup/DateLookup.js +5 -2
  14. package/build/dateLookup/DateLookup.js.map +1 -1
  15. package/build/dateLookup/DateLookup.mjs +5 -2
  16. package/build/dateLookup/DateLookup.mjs.map +1 -1
  17. package/build/dateLookup/dateTrigger/DateTrigger.js +2 -0
  18. package/build/dateLookup/dateTrigger/DateTrigger.js.map +1 -1
  19. package/build/dateLookup/dateTrigger/DateTrigger.mjs +2 -0
  20. package/build/dateLookup/dateTrigger/DateTrigger.mjs.map +1 -1
  21. package/build/field/Field.js +7 -2
  22. package/build/field/Field.js.map +1 -1
  23. package/build/field/Field.mjs +13 -8
  24. package/build/field/Field.mjs.map +1 -1
  25. package/build/inputs/InputGroup.js +1 -1
  26. package/build/inputs/InputGroup.js.map +1 -1
  27. package/build/inputs/InputGroup.mjs +2 -2
  28. package/build/inputs/InputGroup.mjs.map +1 -1
  29. package/build/inputs/SelectInput.js +13 -3
  30. package/build/inputs/SelectInput.js.map +1 -1
  31. package/build/inputs/SelectInput.mjs +13 -3
  32. package/build/inputs/SelectInput.mjs.map +1 -1
  33. package/build/inputs/contexts.js +8 -4
  34. package/build/inputs/contexts.js.map +1 -1
  35. package/build/inputs/contexts.mjs +7 -4
  36. package/build/inputs/contexts.mjs.map +1 -1
  37. package/build/label/Label.js +14 -8
  38. package/build/label/Label.js.map +1 -1
  39. package/build/label/Label.mjs +14 -8
  40. package/build/label/Label.mjs.map +1 -1
  41. package/build/listItem/Prompt/ListItemPrompt.js +1 -1
  42. package/build/listItem/Prompt/ListItemPrompt.js.map +1 -1
  43. package/build/listItem/Prompt/ListItemPrompt.mjs +1 -1
  44. package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -1
  45. package/build/main.css +163 -153
  46. package/build/moneyInput/MoneyInput.js +6 -5
  47. package/build/moneyInput/MoneyInput.js.map +1 -1
  48. package/build/moneyInput/MoneyInput.mjs +6 -5
  49. package/build/moneyInput/MoneyInput.mjs.map +1 -1
  50. package/build/phoneNumberInput/PhoneNumberInput.js +25 -3
  51. package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
  52. package/build/phoneNumberInput/PhoneNumberInput.mjs +27 -5
  53. package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
  54. package/build/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.js +23 -23
  55. package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -0
  56. package/build/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.mjs +23 -23
  57. package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -0
  58. package/build/styles/inputs/Input.css +5 -0
  59. package/build/styles/inputs/TextArea.css +5 -0
  60. package/build/styles/listItem/ListItem.css +5 -153
  61. package/build/styles/listItem/Prompt/ListItemPrompt.css +0 -153
  62. package/build/styles/main.css +163 -153
  63. package/build/types/common/panel/Panel.d.ts +2 -0
  64. package/build/types/common/panel/Panel.d.ts.map +1 -1
  65. package/build/types/common/responsivePanel/ResponsivePanel.d.ts +1 -0
  66. package/build/types/common/responsivePanel/ResponsivePanel.d.ts.map +1 -1
  67. package/build/types/dateInput/DateInput.d.ts +2 -2
  68. package/build/types/dateInput/DateInput.d.ts.map +1 -1
  69. package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
  70. package/build/types/dateLookup/dateTrigger/DateTrigger.d.ts +1 -0
  71. package/build/types/dateLookup/dateTrigger/DateTrigger.d.ts.map +1 -1
  72. package/build/types/field/Field.d.ts.map +1 -1
  73. package/build/types/inputs/InputGroup.d.ts.map +1 -1
  74. package/build/types/inputs/SelectInput.d.ts +8 -1
  75. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  76. package/build/types/inputs/contexts.d.ts +6 -1
  77. package/build/types/inputs/contexts.d.ts.map +1 -1
  78. package/build/types/label/Label.d.ts +5 -15
  79. package/build/types/label/Label.d.ts.map +1 -1
  80. package/build/types/listItem/Prompt/ListItemPrompt.d.ts +1 -1
  81. package/build/types/listItem/Prompt/ListItemPrompt.d.ts.map +1 -1
  82. package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
  83. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
  84. package/build/types/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.d.ts +1 -1
  85. package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -0
  86. package/build/types/prompt/InlinePrompt/index.d.ts.map +1 -0
  87. package/build/types/prompt/index.d.ts +3 -0
  88. package/build/types/prompt/index.d.ts.map +1 -0
  89. package/package.json +2 -2
  90. package/src/DisabledComponents.story.tsx +156 -0
  91. package/src/common/panel/Panel.tsx +2 -0
  92. package/src/common/responsivePanel/ResponsivePanel.tsx +7 -1
  93. package/src/dateInput/DateInput.spec.tsx +45 -7
  94. package/src/dateInput/DateInput.story.tsx +2 -0
  95. package/src/dateInput/DateInput.tsx +65 -30
  96. package/src/dateLookup/DateLookup.spec.tsx +16 -0
  97. package/src/dateLookup/DateLookup.tsx +6 -3
  98. package/src/dateLookup/dateTrigger/DateTrigger.tsx +3 -0
  99. package/src/field/Field.tsx +6 -5
  100. package/src/inputs/Input.css +5 -0
  101. package/src/inputs/InputGroup.tsx +3 -4
  102. package/src/inputs/SelectInput.story.tsx +7 -0
  103. package/src/inputs/SelectInput.tsx +29 -4
  104. package/src/inputs/TextArea.css +5 -0
  105. package/src/inputs/_common.less +5 -0
  106. package/src/inputs/contexts.tsx +12 -3
  107. package/src/label/Label.tsx +26 -20
  108. package/src/listItem/ListItem.css +5 -153
  109. package/src/listItem/ListItem.less +5 -0
  110. package/src/listItem/Prompt/ListItemPrompt.css +0 -153
  111. package/src/listItem/Prompt/ListItemPrompt.less +0 -2
  112. package/src/listItem/Prompt/ListItemPrompt.tsx +1 -1
  113. package/src/main.css +163 -153
  114. package/src/main.less +1 -0
  115. package/src/moneyInput/MoneyInput.spec.tsx +16 -1
  116. package/src/moneyInput/MoneyInput.tsx +7 -6
  117. package/src/phoneNumberInput/PhoneNumberInput.spec.tsx +32 -0
  118. package/src/phoneNumberInput/PhoneNumberInput.tsx +32 -11
  119. package/src/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.spec.tsx +2 -2
  120. package/src/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.tsx +4 -4
  121. package/src/prompt/index.ts +6 -0
  122. package/build/listItem/Prompt/InlinePrompt/InlinePrompt.js.map +0 -1
  123. package/build/listItem/Prompt/InlinePrompt/InlinePrompt.mjs.map +0 -1
  124. package/build/types/listItem/Prompt/InlinePrompt/InlinePrompt.d.ts.map +0 -1
  125. package/build/types/listItem/Prompt/InlinePrompt/index.d.ts.map +0 -1
  126. /package/build/styles/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.css +0 -0
  127. /package/build/types/{listItem/Prompt → prompt}/InlinePrompt/index.d.ts +0 -0
  128. /package/src/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.css +0 -0
  129. /package/src/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.less +0 -0
  130. /package/src/{listItem/Prompt → prompt}/InlinePrompt/index.ts +0 -0
package/src/main.less CHANGED
@@ -4,6 +4,7 @@
4
4
  @import "./actionOption/ActionOption.less";
5
5
  @import "./alert/Alert.less";
6
6
  @import "./avatar/Avatar.less";
7
+ @import "./prompt/InlinePrompt/InlinePrompt.less";
7
8
  @import "./avatarView/AvatarView.less";
8
9
  @import "./avatarLayout/AvatarLayout.less";
9
10
  @import "./iconButton/IconButton.less";
@@ -406,7 +406,7 @@ describe('Money Input', () => {
406
406
  </>,
407
407
  );
408
408
 
409
- expect(screen.getAllByLabelText('Prioritized label')[0]).toHaveClass('input-group');
409
+ expect(screen.getAllByLabelText('Prioritized label')[0]).toHaveClass('np-form-control');
410
410
  });
411
411
 
412
412
  it('supports `Field` for labeling', () => {
@@ -415,9 +415,24 @@ describe('Money Input', () => {
415
415
  <MoneyInput {...initialProps} />
416
416
  </Field>,
417
417
  );
418
+
418
419
  expect(screen.getAllByRole('group')[0]).toHaveAccessibleName(/^Recipient gets/);
419
420
  });
420
421
 
422
+ it('focuses money input when `Field` label is clicked', async () => {
423
+ const label = 'Recipient gets';
424
+
425
+ render(
426
+ <Field label={label}>
427
+ <MoneyInput {...initialProps} />
428
+ </Field>,
429
+ );
430
+
431
+ const input = screen.getByRole('textbox');
432
+ await userEvent.click(screen.getByLabelText(label));
433
+ expect(input).toHaveFocus();
434
+ });
435
+
421
436
  describe('ids', () => {
422
437
  it('renders Select component with generated id when id is not provided', () => {
423
438
  customRender();
@@ -313,10 +313,10 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
313
313
  const selectedCurrencyElementId = `${inputAttributes?.id ?? amountInputId}SelectedCurrency`;
314
314
 
315
315
  return (
316
- <div
317
- role="group"
318
- {...inputAttributes}
319
- aria-labelledby={ariaLabelledBy}
316
+ <fieldset
317
+ aria-invalid={inputAttributes?.['aria-invalid']}
318
+ aria-describedby={inputAttributes?.['aria-describedby']}
319
+ aria-labelledby={inputAttributes?.id ?? amountInputId}
320
320
  className={clsx(
321
321
  this.style('tw-money-input'),
322
322
  this.style('input-group'),
@@ -324,7 +324,8 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
324
324
  )}
325
325
  >
326
326
  <Input
327
- id={amountInputId}
327
+ id={inputAttributes?.id ?? amountInputId}
328
+ aria-labelledby={ariaLabelledBy}
328
329
  value={this.state.formattedAmount}
329
330
  inputMode="decimal"
330
331
  disabled={disabled}
@@ -430,7 +431,7 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
430
431
  />
431
432
  </div>
432
433
  )}
433
- </div>
434
+ </fieldset>
434
435
  );
435
436
  }
436
437
  }
@@ -314,4 +314,36 @@ describe('PhoneNumberInput', () => {
314
314
  );
315
315
  expect(screen.getAllByRole('group')[0]).toHaveAccessibleName(/^Phone number/);
316
316
  });
317
+
318
+ it('focuses country code input when `Field` label is clicked', async () => {
319
+ const label = 'Phone number';
320
+
321
+ render(
322
+ <Field label={label}>
323
+ <PhoneNumberInput initialValue="+12345678" onChange={() => {}} />
324
+ </Field>,
325
+ );
326
+
327
+ await userEvent.click(screen.getByText(label, { selector: 'label:not(.sr-only)' })); // Have to use `getByText` due to the way `Field` handles group labelling
328
+ const countryCodeFilterInput = screen.getByRole('combobox');
329
+ expect(countryCodeFilterInput).toHaveFocus();
330
+ });
331
+
332
+ it('focuses number input when `Field` label is clicked and country code is disabled', async () => {
333
+ const label = 'Phone number';
334
+
335
+ render(
336
+ <Field label={label}>
337
+ <PhoneNumberInput
338
+ initialValue="+12345678"
339
+ selectProps={{ disabled: true }}
340
+ onChange={() => {}}
341
+ />
342
+ </Field>,
343
+ );
344
+
345
+ const phoneNumberInput = screen.getByRole('textbox');
346
+ await userEvent.click(screen.getByText(label, { selector: 'label:not(.sr-only)' })); // Have to use `getByText` due to the way `Field` handles group labelling
347
+ expect(phoneNumberInput).toHaveFocus();
348
+ });
317
349
  });
@@ -1,8 +1,8 @@
1
- import { useState, useEffect, useMemo } from 'react';
1
+ import { useState, useEffect, useMemo, useRef } from 'react';
2
2
  import { useIntl } from 'react-intl';
3
3
 
4
4
  import { Size, SizeLarge, SizeMedium, SizeSmall } from '../common';
5
- import { useInputAttributes } from '../inputs/contexts';
5
+ import { useFieldLabelRef, useInputAttributes } from '../inputs/contexts';
6
6
  import { SelectInput, SelectInputOptionContent, SelectInputProps } from '../inputs/SelectInput';
7
7
  import messages from './PhoneNumberInput.messages';
8
8
  import countries from './data/countries';
@@ -58,7 +58,10 @@ const PhoneNumberInput = ({
58
58
  selectProps = defaultSelectProps,
59
59
  disabledCountries = defaultDisabledCountries,
60
60
  }: PhoneNumberInputProps) => {
61
+ const countryCodeSelectRef = useRef<HTMLButtonElement>(null);
62
+ const phoneNumberInputRef = useRef<HTMLInputElement>(null);
61
63
  const inputAttributes = useInputAttributes({ nonLabelable: true });
64
+ const fieldLabelRef = useFieldLabelRef();
62
65
  const ariaLabelledBy = ariaLabelledByProp ?? inputAttributes['aria-labelledby'];
63
66
 
64
67
  const { locale, formatMessage } = useIntl();
@@ -71,6 +74,7 @@ const PhoneNumberInput = ({
71
74
  return `${backup}-${random}`;
72
75
  };
73
76
 
77
+ // Link the first non-disabled input to the the Field label, if present
74
78
  const ids = {
75
79
  countryCode: {
76
80
  label: createId(id, 'country-code-label'),
@@ -162,18 +166,34 @@ const PhoneNumberInput = ({
162
166
  setBroadcastedValue(internalValue);
163
167
  }, [onChange, broadcastedValue, internalValue]);
164
168
 
169
+ useEffect(() => {
170
+ const labelRef = fieldLabelRef?.current;
171
+
172
+ if (labelRef) {
173
+ const handleLabelClick = () => {
174
+ if (!selectProps.disabled) {
175
+ countryCodeSelectRef.current?.click();
176
+ } else {
177
+ phoneNumberInputRef.current?.focus();
178
+ }
179
+ };
180
+
181
+ labelRef.addEventListener('click', handleLabelClick);
182
+
183
+ return () => {
184
+ labelRef?.removeEventListener('click', handleLabelClick);
185
+ };
186
+ }
187
+ }, [fieldLabelRef, selectProps.disabled]);
188
+
165
189
  return (
166
- <div
167
- role="group"
168
- {...inputAttributes}
169
- aria-labelledby={ariaLabelledBy}
170
- className="tw-telephone"
171
- >
172
- <label className="sr-only" id={ids.countryCode.label}>
190
+ <fieldset {...inputAttributes} aria-labelledby={ariaLabelledBy} className="tw-telephone">
191
+ <label className="sr-only" id={ids.countryCode.label} htmlFor={ids.countryCode.select}>
173
192
  {formatMessage(messages.countryCodeLabel)}
174
193
  </label>
175
194
  <div className="tw-telephone__country-select">
176
195
  <SelectInput
196
+ triggerRef={countryCodeSelectRef}
177
197
  placeholder={formatMessage(messages.selectInputPlaceholder)}
178
198
  items={[...countriesByPrefix].map(([prefix, countries]) => ({
179
199
  type: 'option',
@@ -225,8 +245,9 @@ const PhoneNumberInput = ({
225
245
  {formatMessage(messages.phoneNumberLabel)}
226
246
  </label>
227
247
  <div className="tw-telephone__number-input">
228
- <div className={`input-group input-group-${size}`}>
248
+ <div className={`input-group input-group-${size} ${disabled ? 'disabled' : ''}`}>
229
249
  <Input
250
+ ref={phoneNumberInputRef}
230
251
  id={ids.phoneNumber.input}
231
252
  autoComplete="tel-national"
232
253
  name="phoneNumber"
@@ -243,7 +264,7 @@ const PhoneNumberInput = ({
243
264
  />
244
265
  </div>
245
266
  </div>
246
- </div>
267
+ </fieldset>
247
268
  );
248
269
  };
249
270
 
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { mockMatchMedia, render, screen } from '../../../test-utils';
2
+ import { mockMatchMedia, render, screen } from '../../test-utils';
3
3
  import { InlinePrompt, InlinePromptProps } from './InlinePrompt';
4
- import { Sentiment } from '../../../common';
4
+ import { Sentiment } from '../../common';
5
5
 
6
6
  mockMatchMedia();
7
7
 
@@ -1,9 +1,9 @@
1
- import { Sentiment } from '../../../common';
1
+ import { Sentiment } from '../../common';
2
2
  import { BackslashCircle } from '@transferwise/icons';
3
- import ProcessIndicator from '../../../processIndicator';
4
- import StatusIcon from '../../../statusIcon';
3
+ import ProcessIndicator from '../../processIndicator';
4
+ import StatusIcon from '../../statusIcon';
5
5
  import { clsx } from 'clsx';
6
- import Body from '../../../body';
6
+ import Body from '../../body';
7
7
 
8
8
  export type InlinePromptProps = {
9
9
  sentiment?: `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`;
@@ -0,0 +1,6 @@
1
+ // Prompt
2
+ // ..
3
+
4
+ // InlinePrompt
5
+ export type { InlinePromptProps } from './InlinePrompt';
6
+ export { InlinePrompt } from './InlinePrompt';
@@ -1 +0,0 @@
1
- {"version":3,"file":"InlinePrompt.js","sources":["../../../../src/listItem/Prompt/InlinePrompt/InlinePrompt.tsx"],"sourcesContent":["import { Sentiment } from '../../../common';\nimport { BackslashCircle } from '@transferwise/icons';\nimport ProcessIndicator from '../../../processIndicator';\nimport StatusIcon from '../../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../../body';\n\nexport type InlinePromptProps = {\n sentiment?: `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`;\n loading?: boolean;\n /**\n * Use for short-lived inline prompts to avoid swap of the icon (which is bad UX for short-lived prompts, e.g. when submit form)\n */\n muted?: boolean;\n id?: string;\n className?: string;\n 'data-testid'?: string;\n children: React.ReactNode;\n};\n\nexport const InlinePrompt = ({\n sentiment = Sentiment.POSITIVE,\n muted = false,\n loading = false,\n className,\n children,\n ...rest\n}: InlinePromptProps) => {\n const renderMedia = () => {\n if (muted) {\n return <BackslashCircle size={16} data-testid=\"InlinePrompt_Muted\" />;\n }\n if (loading) {\n return <ProcessIndicator data-testid=\"InlinePrompt_ProcessIndicator\" size=\"xxs\" />;\n }\n return <StatusIcon size={16} sentiment={sentiment} />;\n };\n\n return (\n <div\n className={clsx(\n 'wds-inline-prompt',\n `wds-inline-prompt--${sentiment}`,\n {\n 'wds-inline-prompt--muted': muted,\n 'wds-inline-prompt--loading': loading,\n },\n className,\n )}\n {...rest}\n >\n <div className=\"wds-inline-prompt__media-wrapper\">{renderMedia()}</div>\n <Body>{children}</Body>\n </div>\n );\n};\n"],"names":["InlinePrompt","sentiment","Sentiment","POSITIVE","muted","loading","className","children","rest","renderMedia","_jsx","BackslashCircle","size","ProcessIndicator","StatusIcon","_jsxs","clsx","Body"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBO,MAAMA,YAAY,GAAGA,CAAC;aAC3BC,WAAS,GAAGC,mBAAS,CAACC,QAAQ;AAC9BC,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,OAAO,GAAG,KAAK;EACfC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAI,CACW,KAAI;EACtB,MAAMC,WAAW,GAAGA,MAAK;AACvB,IAAA,IAAIL,KAAK,EAAE;MACT,oBAAOM,cAAA,CAACC,qBAAe,EAAA;AAACC,QAAAA,IAAI,EAAE,EAAG;QAAC,aAAA,EAAY;AAAoB,QAAG;AACvE,IAAA;AACA,IAAA,IAAIP,OAAO,EAAE;MACX,oBAAOK,cAAA,CAACG,wBAAgB,EAAA;AAAC,QAAA,aAAA,EAAY,+BAA+B;AAACD,QAAAA,IAAI,EAAC;AAAK,OAAA,CAAG;AACpF,IAAA;IACA,oBAAOF,cAAA,CAACI,kBAAU,EAAA;AAACF,MAAAA,IAAI,EAAE,EAAG;AAACX,MAAAA,SAAS,EAAEA;AAAU,MAAG;EACvD,CAAC;AAED,EAAA,oBACEc,eAAA,CAAA,KAAA,EAAA;IACET,SAAS,EAAEU,SAAI,CACb,mBAAmB,EACnB,CAAA,mBAAA,EAAsBf,WAAS,EAAE,EACjC;AACE,MAAA,0BAA0B,EAAEG,KAAK;AACjC,MAAA,4BAA4B,EAAEC;KAC/B,EACDC,SAAS,CACT;AAAA,IAAA,GACEE,IAAI;AAAAD,IAAAA,QAAA,gBAERG,cAAA,CAAA,KAAA,EAAA;AAAKJ,MAAAA,SAAS,EAAC,kCAAkC;MAAAC,QAAA,EAAEE,WAAW;AAAE,KAAM,CACtE,eAAAC,cAAA,CAACO,YAAI,EAAA;AAAAV,MAAAA,QAAA,EAAEA;AAAQ,KAAO,CACxB;AAAA,GAAK,CAAC;AAEV;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"InlinePrompt.mjs","sources":["../../../../src/listItem/Prompt/InlinePrompt/InlinePrompt.tsx"],"sourcesContent":["import { Sentiment } from '../../../common';\nimport { BackslashCircle } from '@transferwise/icons';\nimport ProcessIndicator from '../../../processIndicator';\nimport StatusIcon from '../../../statusIcon';\nimport { clsx } from 'clsx';\nimport Body from '../../../body';\n\nexport type InlinePromptProps = {\n sentiment?: `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`;\n loading?: boolean;\n /**\n * Use for short-lived inline prompts to avoid swap of the icon (which is bad UX for short-lived prompts, e.g. when submit form)\n */\n muted?: boolean;\n id?: string;\n className?: string;\n 'data-testid'?: string;\n children: React.ReactNode;\n};\n\nexport const InlinePrompt = ({\n sentiment = Sentiment.POSITIVE,\n muted = false,\n loading = false,\n className,\n children,\n ...rest\n}: InlinePromptProps) => {\n const renderMedia = () => {\n if (muted) {\n return <BackslashCircle size={16} data-testid=\"InlinePrompt_Muted\" />;\n }\n if (loading) {\n return <ProcessIndicator data-testid=\"InlinePrompt_ProcessIndicator\" size=\"xxs\" />;\n }\n return <StatusIcon size={16} sentiment={sentiment} />;\n };\n\n return (\n <div\n className={clsx(\n 'wds-inline-prompt',\n `wds-inline-prompt--${sentiment}`,\n {\n 'wds-inline-prompt--muted': muted,\n 'wds-inline-prompt--loading': loading,\n },\n className,\n )}\n {...rest}\n >\n <div className=\"wds-inline-prompt__media-wrapper\">{renderMedia()}</div>\n <Body>{children}</Body>\n </div>\n );\n};\n"],"names":["InlinePrompt","sentiment","Sentiment","POSITIVE","muted","loading","className","children","rest","renderMedia","_jsx","BackslashCircle","size","ProcessIndicator","StatusIcon","_jsxs","clsx","Body"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBO,MAAMA,YAAY,GAAGA,CAAC;EAC3BC,SAAS,GAAGC,SAAS,CAACC,QAAQ;AAC9BC,EAAAA,KAAK,GAAG,KAAK;AACbC,EAAAA,OAAO,GAAG,KAAK;EACfC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAI,CACW,KAAI;EACtB,MAAMC,WAAW,GAAGA,MAAK;AACvB,IAAA,IAAIL,KAAK,EAAE;MACT,oBAAOM,GAAA,CAACC,eAAe,EAAA;AAACC,QAAAA,IAAI,EAAE,EAAG;QAAC,aAAA,EAAY;AAAoB,QAAG;AACvE,IAAA;AACA,IAAA,IAAIP,OAAO,EAAE;MACX,oBAAOK,GAAA,CAACG,gBAAgB,EAAA;AAAC,QAAA,aAAA,EAAY,+BAA+B;AAACD,QAAAA,IAAI,EAAC;AAAK,OAAA,CAAG;AACpF,IAAA;IACA,oBAAOF,GAAA,CAACI,UAAU,EAAA;AAACF,MAAAA,IAAI,EAAE,EAAG;AAACX,MAAAA,SAAS,EAAEA;AAAU,MAAG;EACvD,CAAC;AAED,EAAA,oBACEc,IAAA,CAAA,KAAA,EAAA;IACET,SAAS,EAAEU,IAAI,CACb,mBAAmB,EACnB,CAAA,mBAAA,EAAsBf,SAAS,EAAE,EACjC;AACE,MAAA,0BAA0B,EAAEG,KAAK;AACjC,MAAA,4BAA4B,EAAEC;KAC/B,EACDC,SAAS,CACT;AAAA,IAAA,GACEE,IAAI;AAAAD,IAAAA,QAAA,gBAERG,GAAA,CAAA,KAAA,EAAA;AAAKJ,MAAAA,SAAS,EAAC,kCAAkC;MAAAC,QAAA,EAAEE,WAAW;AAAE,KAAM,CACtE,eAAAC,GAAA,CAACO,IAAI,EAAA;AAAAV,MAAAA,QAAA,EAAEA;AAAQ,KAAO,CACxB;AAAA,GAAK,CAAC;AAEV;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"InlinePrompt.d.ts","sourceRoot":"","sources":["../../../../../src/listItem/Prompt/InlinePrompt/InlinePrompt.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAO5C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,CAAC,EAAE,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC;IACjG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,6DAO1B,iBAAiB,gCA4BnB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/listItem/Prompt/InlinePrompt/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}