@transferwise/components 0.0.0-experimental-cbe9617 → 0.0.0-experimental-786cfd1

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 (60) hide show
  1. package/build/field/Field.js +10 -0
  2. package/build/field/Field.js.map +1 -1
  3. package/build/field/Field.mjs +10 -0
  4. package/build/field/Field.mjs.map +1 -1
  5. package/build/index.js +2 -0
  6. package/build/index.js.map +1 -1
  7. package/build/index.mjs +1 -0
  8. package/build/index.mjs.map +1 -1
  9. package/build/listItem/Prompt/ListItemPrompt.js +10 -0
  10. package/build/listItem/Prompt/ListItemPrompt.js.map +1 -1
  11. package/build/listItem/Prompt/ListItemPrompt.mjs +10 -0
  12. package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -1
  13. package/build/main.css +30 -1
  14. package/build/prompt/ActionPrompt/ActionPrompt.js +123 -0
  15. package/build/prompt/ActionPrompt/ActionPrompt.js.map +1 -0
  16. package/build/prompt/ActionPrompt/ActionPrompt.mjs +118 -0
  17. package/build/prompt/ActionPrompt/ActionPrompt.mjs.map +1 -0
  18. package/build/prompt/PrimitivePrompt/PrimitivePrompt.js +13 -11
  19. package/build/prompt/PrimitivePrompt/PrimitivePrompt.js.map +1 -1
  20. package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs +14 -12
  21. package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +1 -1
  22. package/build/styles/main.css +30 -1
  23. package/build/styles/prompt/ActionPrompt/ActionPrompt.css +20 -0
  24. package/build/styles/prompt/PrimitivePrompt/PrimitivePrompt.css +10 -1
  25. package/build/typeahead/Typeahead.js +10 -0
  26. package/build/typeahead/Typeahead.js.map +1 -1
  27. package/build/typeahead/Typeahead.mjs +10 -0
  28. package/build/typeahead/Typeahead.mjs.map +1 -1
  29. package/build/types/index.d.ts +2 -2
  30. package/build/types/index.d.ts.map +1 -1
  31. package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts +26 -0
  32. package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts.map +1 -0
  33. package/build/types/prompt/ActionPrompt/ActionPrompt.test.d.ts +2 -0
  34. package/build/types/prompt/ActionPrompt/ActionPrompt.test.d.ts.map +1 -0
  35. package/build/types/prompt/ActionPrompt/index.d.ts +3 -0
  36. package/build/types/prompt/ActionPrompt/index.d.ts.map +1 -0
  37. package/build/types/prompt/InlinePrompt/InlinePrompt.test.d.ts +2 -0
  38. package/build/types/prompt/InlinePrompt/InlinePrompt.test.d.ts.map +1 -0
  39. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts.map +1 -1
  40. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.test.d.ts +2 -0
  41. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.test.d.ts.map +1 -0
  42. package/build/types/prompt/index.d.ts +2 -0
  43. package/build/types/prompt/index.d.ts.map +1 -1
  44. package/package.json +3 -3
  45. package/src/index.ts +2 -2
  46. package/src/main.css +30 -1
  47. package/src/main.less +1 -0
  48. package/src/prompt/ActionPrompt/ActionPrompt.css +20 -0
  49. package/src/prompt/ActionPrompt/ActionPrompt.less +22 -0
  50. package/src/prompt/ActionPrompt/ActionPrompt.story.tsx +189 -0
  51. package/src/prompt/ActionPrompt/ActionPrompt.test.tsx +256 -0
  52. package/src/prompt/ActionPrompt/ActionPrompt.tsx +129 -0
  53. package/src/prompt/ActionPrompt/index.ts +2 -0
  54. package/src/prompt/InlinePrompt/{InlinePrompt.spec.tsx → InlinePrompt.test.tsx} +3 -38
  55. package/src/prompt/PrimitivePrompt/PrimitivePrompt.css +10 -1
  56. package/src/prompt/PrimitivePrompt/PrimitivePrompt.less +11 -1
  57. package/src/prompt/PrimitivePrompt/PrimitivePrompt.test.tsx +161 -0
  58. package/src/prompt/PrimitivePrompt/PrimitivePrompt.tsx +15 -11
  59. package/src/prompt/index.ts +3 -0
  60. package/src/ssr.spec.tsx +1 -0
@@ -26,6 +26,16 @@ require('react-intl');
26
26
  require('../common/closeButton/CloseButton.messages.js');
27
27
  var jsxRuntime = require('react/jsx-runtime');
28
28
  var InlinePrompt = require('../prompt/InlinePrompt/InlinePrompt.js');
29
+ require('../statusIcon/StatusIcon.js');
30
+ require('../body/Body.js');
31
+ require('../button/Button.resolver.js');
32
+ require('../badge/Badge.js');
33
+ require('@wise/art');
34
+ require('@transferwise/neptune-validation');
35
+ require('../provider/direction/DirectionProvider.js');
36
+ require('../sentimentSurface/SentimentSurface.js');
37
+ require('../primitives/PrimitiveButton/PrimitiveButton.js');
38
+ require('../primitives/PrimitiveAnchor/PrimitiveAnchor.js');
29
39
  var contexts = require('../inputs/contexts.js');
30
40
  var Label = require('../label/Label.js');
31
41
 
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","sources":["../../src/field/Field.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useId, useRef } from 'react';\n\nimport { Sentiment } from '../common';\nimport { InlinePrompt, type InlinePromptProps } from '../prompt';\nimport {\n FieldLabelContextProvider,\n InputDescribedByProvider,\n InputIdContextProvider,\n InputInvalidProvider,\n} from '../inputs/contexts';\nimport { Label } from '../label';\n\nexport type FieldProps = {\n /** `null` disables auto-generating the `id` attribute, falling back to nesting-based label association over setting `htmlFor` explicitly. */\n id?: string | null;\n /** Should be specified unless the wrapped control has its own labeling mechanism, e.g. `Checkbox`. */\n label?: React.ReactNode;\n required?: boolean;\n /** @deprecated use `description` prop instead */\n hint?: React.ReactNode;\n message?: React.ReactNode;\n /**\n * Override for the [InlinePrompt icon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n messageIconLabel?: string;\n /**\n * If true, shows a loading spinner in place of the message icon of the InlinePrompt\n */\n messageLoading?: boolean;\n description?: React.ReactNode;\n /** @deprecated use `message` and `type={Sentiment.NEGATIVE}` prop instead */\n error?: React.ReactNode;\n sentiment?: InlinePromptProps['sentiment'];\n className?: string;\n children?: React.ReactNode;\n};\n\nexport const Field = ({\n id,\n label,\n required = true,\n message: propMessage,\n messageIconLabel,\n messageLoading,\n hint,\n description = hint,\n sentiment: propType = Sentiment.NEUTRAL,\n className,\n children,\n ...props\n}: FieldProps) => {\n const labelRef = useRef<HTMLLabelElement>(null);\n const sentiment = props.error ? Sentiment.NEGATIVE : propType;\n const message = propMessage || props.error;\n const hasError = sentiment === Sentiment.NEGATIVE;\n\n const labelId = useId();\n\n const fallbackInputId = useId();\n const inputId = id !== null ? (id ?? fallbackInputId) : undefined;\n\n const messageId = useId();\n const descriptionId = useId();\n\n /**\n * form control can have multiple messages to describe it,\n * e.g the description underneath the label and inline alert\n */\n function ariaDescribedbyByIds() {\n const messageIds = [];\n if (description) {\n messageIds.push(descriptionId);\n }\n if (message) {\n messageIds.push(messageId);\n }\n return messageIds.length > 0 ? messageIds.join(' ') : undefined;\n }\n\n return (\n <FieldLabelContextProvider value={{ id: labelId, ref: labelRef }}>\n <InputIdContextProvider value={inputId}>\n <InputDescribedByProvider value={ariaDescribedbyByIds()}>\n <InputInvalidProvider value={hasError}>\n <div\n className={clsx(\n 'np-field form-group d-block',\n {\n 'has-success': sentiment === Sentiment.POSITIVE,\n 'has-warning': sentiment === Sentiment.WARNING,\n 'has-error': hasError,\n 'has-info': sentiment === Sentiment.NEUTRAL,\n },\n className,\n )}\n >\n {label != null ? (\n <>\n <Label ref={labelRef} id={labelId} htmlFor={inputId}>\n {required ? label : <Label.Optional>{label}</Label.Optional>}\n </Label>\n <Label.Description id={descriptionId}>{description}</Label.Description>\n <div className=\"np-field-control\">{children}</div>\n </>\n ) : (\n children\n )}\n\n {message && (\n <InlinePrompt\n sentiment={sentiment}\n id={messageId}\n mediaLabel={messageIconLabel}\n className=\"np-field__prompt\"\n loading={messageLoading}\n width=\"full\"\n >\n {message}\n </InlinePrompt>\n )}\n </div>\n </InputInvalidProvider>\n </InputDescribedByProvider>\n </InputIdContextProvider>\n </FieldLabelContextProvider>\n );\n};\n"],"names":["Field","id","label","required","message","propMessage","messageIconLabel","messageLoading","hint","description","sentiment","propType","Sentiment","NEUTRAL","className","children","props","labelRef","useRef","error","NEGATIVE","hasError","labelId","useId","fallbackInputId","inputId","undefined","messageId","descriptionId","ariaDescribedbyByIds","messageIds","push","length","join","_jsx","FieldLabelContextProvider","value","ref","InputIdContextProvider","InputDescribedByProvider","InputInvalidProvider","_jsxs","clsx","POSITIVE","WARNING","_Fragment","Label","htmlFor","Optional","Description","InlinePrompt","mediaLabel","loading","width"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCO,MAAMA,KAAK,GAAGA,CAAC;EACpBC,EAAE;EACFC,KAAK;AACLC,EAAAA,QAAQ,GAAG,IAAI;AACfC,EAAAA,OAAO,EAAEC,WAAW;EACpBC,gBAAgB;EAChBC,cAAc;EACdC,IAAI;AACJC,EAAAA,WAAW,GAAGD,IAAI;AAClBE,EAAAA,SAAS,EAAEC,QAAQ,GAAGC,mBAAS,CAACC,OAAO;EACvCC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAK,CACG,KAAI;AACf,EAAA,MAAMC,QAAQ,GAAGC,YAAM,CAAmB,IAAI,CAAC;EAC/C,MAAMR,WAAS,GAAGM,KAAK,CAACG,KAAK,GAAGP,mBAAS,CAACQ,QAAQ,GAAGT,QAAQ;AAC7D,EAAA,MAAMP,OAAO,GAAGC,WAAW,IAAIW,KAAK,CAACG,KAAK;AAC1C,EAAA,MAAME,QAAQ,GAAGX,WAAS,KAAKE,mBAAS,CAACQ,QAAQ;AAEjD,EAAA,MAAME,OAAO,GAAGC,WAAK,EAAE;AAEvB,EAAA,MAAMC,eAAe,GAAGD,WAAK,EAAE;EAC/B,MAAME,OAAO,GAAGxB,EAAE,KAAK,IAAI,GAAIA,EAAE,IAAIuB,eAAe,GAAIE,SAAS;AAEjE,EAAA,MAAMC,SAAS,GAAGJ,WAAK,EAAE;AACzB,EAAA,MAAMK,aAAa,GAAGL,WAAK,EAAE;AAE7B;;;AAGG;EACH,SAASM,oBAAoBA,GAAA;IAC3B,MAAM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AA,EAAE,EAAEqB,OAAQ;AAACyB,gBAAAA,OAAO,EAAEtB,OAAQ;gBAAAV,QAAA,EACjDZ,QAAQ,GAAGD,KAAK,gBAAGgC,cAAA,CAACY,WAAK,CAACE,QAAQ,EAAA;AAAAjC,kBAAAA,QAAA,EAAEb;iBAAsB;AAAC,eACvD,CACP,eAAAgC,cAAA,CAACY,WAAK,CAACG,WAAW,EAAA;AAAChD,gBAAAA,EAAE,EAAE2B,aAAc;AAAAb,gBAAAA,QAAA,EAAEN;eAA+B,CACtE,eAAAyB,cAAA,CAAA,KAAA,EAAA;AAAKpB,gBAAAA,SAAS,EAAC,kBAAkB;AAAAC,gBAAAA,QAAA,EAAEA;AAAQ,eAAM,CACnD;aAAA,CAAG,GAEHA,QACD,EAEAX,OAAO,iBACN8B,cAAA,CAACgB,yBAAY,EAAA;AACXxC,cAAAA,SAAS,EAAEA,WAAU;AACrBT,cAAAA,EAAE,EAAE0B,SAAU;AACdwB,cAAAA,UAAU,EAAE7C,gBAAiB;AAC7BQ,cAAAA,SAAS,EAAC,kBAAkB;AAC5BsC,cAAAA,OAAO,EAAE7C,cAAe;AACxB8C,cAAAA,KAAK,EAAC,MAAM;AAAAtC,cAAAA,QAAA,EAEXX;AAAO,aACI,CACf;WACE;SACe;OACE;KACJ;AAC1B,GAA2B,CAAC;AAEhC;;;;"}
1
+ {"version":3,"file":"Field.js","sources":["../../src/field/Field.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useId, useRef } from 'react';\n\nimport { Sentiment } from '../common';\nimport { InlinePrompt, type InlinePromptProps } from '../prompt';\nimport {\n FieldLabelContextProvider,\n InputDescribedByProvider,\n InputIdContextProvider,\n InputInvalidProvider,\n} from '../inputs/contexts';\nimport { Label } from '../label';\n\nexport type FieldProps = {\n /** `null` disables auto-generating the `id` attribute, falling back to nesting-based label association over setting `htmlFor` explicitly. */\n id?: string | null;\n /** Should be specified unless the wrapped control has its own labeling mechanism, e.g. `Checkbox`. */\n label?: React.ReactNode;\n required?: boolean;\n /** @deprecated use `description` prop instead */\n hint?: React.ReactNode;\n message?: React.ReactNode;\n /**\n * Override for the [InlinePrompt icon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n messageIconLabel?: string;\n /**\n * If true, shows a loading spinner in place of the message icon of the InlinePrompt\n */\n messageLoading?: boolean;\n description?: React.ReactNode;\n /** @deprecated use `message` and `type={Sentiment.NEGATIVE}` prop instead */\n error?: React.ReactNode;\n sentiment?: InlinePromptProps['sentiment'];\n className?: string;\n children?: React.ReactNode;\n};\n\nexport const Field = ({\n id,\n label,\n required = true,\n message: propMessage,\n messageIconLabel,\n messageLoading,\n hint,\n description = hint,\n sentiment: propType = Sentiment.NEUTRAL,\n className,\n children,\n ...props\n}: FieldProps) => {\n const labelRef = useRef<HTMLLabelElement>(null);\n const sentiment = props.error ? Sentiment.NEGATIVE : propType;\n const message = propMessage || props.error;\n const hasError = sentiment === Sentiment.NEGATIVE;\n\n const labelId = useId();\n\n const fallbackInputId = useId();\n const inputId = id !== null ? (id ?? fallbackInputId) : undefined;\n\n const messageId = useId();\n const descriptionId = useId();\n\n /**\n * form control can have multiple messages to describe it,\n * e.g the description underneath the label and inline alert\n */\n function ariaDescribedbyByIds() {\n const messageIds = [];\n if (description) {\n messageIds.push(descriptionId);\n }\n if (message) {\n messageIds.push(messageId);\n }\n return messageIds.length > 0 ? messageIds.join(' ') : undefined;\n }\n\n return (\n <FieldLabelContextProvider value={{ id: labelId, ref: labelRef }}>\n <InputIdContextProvider value={inputId}>\n <InputDescribedByProvider value={ariaDescribedbyByIds()}>\n <InputInvalidProvider value={hasError}>\n <div\n className={clsx(\n 'np-field form-group d-block',\n {\n 'has-success': sentiment === Sentiment.POSITIVE,\n 'has-warning': sentiment === Sentiment.WARNING,\n 'has-error': hasError,\n 'has-info': sentiment === Sentiment.NEUTRAL,\n },\n className,\n )}\n >\n {label != null ? (\n <>\n <Label ref={labelRef} id={labelId} htmlFor={inputId}>\n {required ? label : <Label.Optional>{label}</Label.Optional>}\n </Label>\n <Label.Description id={descriptionId}>{description}</Label.Description>\n <div className=\"np-field-control\">{children}</div>\n </>\n ) : (\n children\n )}\n\n {message && (\n <InlinePrompt\n sentiment={sentiment}\n id={messageId}\n mediaLabel={messageIconLabel}\n className=\"np-field__prompt\"\n loading={messageLoading}\n width=\"full\"\n >\n {message}\n </InlinePrompt>\n )}\n </div>\n </InputInvalidProvider>\n </InputDescribedByProvider>\n </InputIdContextProvider>\n </FieldLabelContextProvider>\n );\n};\n"],"names":["Field","id","label","required","message","propMessage","messageIconLabel","messageLoading","hint","description","sentiment","propType","Sentiment","NEUTRAL","className","children","props","labelRef","useRef","error","NEGATIVE","hasError","labelId","useId","fallbackInputId","inputId","undefined","messageId","descriptionId","ariaDescribedbyByIds","messageIds","push","length","join","_jsx","FieldLabelContextProvider","value","ref","InputIdContextProvider","InputDescribedByProvider","InputInvalidProvider","_jsxs","clsx","POSITIVE","WARNING","_Fragment","Label","htmlFor","Optional","Description","InlinePrompt","mediaLabel","loading","width"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCO,MAAMA,KAAK,GAAGA,CAAC;EACpBC,EAAE;EACFC,KAAK;AACLC,EAAAA,QAAQ,GAAG,IAAI;AACfC,EAAAA,OAAO,EAAEC,WAAW;EACpBC,gBAAgB;EAChBC,cAAc;EACdC,IAAI;AACJC,EAAAA,WAAW,GAAGD,IAAI;AAClBE,EAAAA,SAAS,EAAEC,QAAQ,GAAGC,mBAAS,CAACC,OAAO;EACvCC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAK,CACG,KAAI;AACf,EAAA,MAAMC,QAAQ,GAAGC,YAAM,CAAmB,IAAI,CAAC;EAC/C,MAAMR,WAAS,GAAGM,KAAK,CAACG,KAAK,GAAGP,mBAAS,CAACQ,QAAQ,GAAGT,QAAQ;AAC7D,EAAA,MAAMP,OAAO,GAAGC,WAAW,IAAIW,KAAK,CAACG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
@@ -24,6 +24,16 @@ import 'react-intl';
24
24
  import '../common/closeButton/CloseButton.messages.mjs';
25
25
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
26
26
  import { InlinePrompt } from '../prompt/InlinePrompt/InlinePrompt.mjs';
27
+ import '../statusIcon/StatusIcon.mjs';
28
+ import '../body/Body.mjs';
29
+ import '../button/Button.resolver.mjs';
30
+ import '../badge/Badge.mjs';
31
+ import '@wise/art';
32
+ import '@transferwise/neptune-validation';
33
+ import '../provider/direction/DirectionProvider.mjs';
34
+ import '../sentimentSurface/SentimentSurface.mjs';
35
+ import '../primitives/PrimitiveButton/PrimitiveButton.mjs';
36
+ import '../primitives/PrimitiveAnchor/PrimitiveAnchor.mjs';
27
37
  import { FieldLabelContextProvider, InputIdContextProvider, InputDescribedByProvider, InputInvalidProvider } from '../inputs/contexts.mjs';
28
38
  import { Label as LabelNamespace } from '../label/Label.mjs';
29
39
 
@@ -1 +1 @@
1
- {"version":3,"file":"Field.mjs","sources":["../../src/field/Field.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useId, useRef } from 'react';\n\nimport { Sentiment } from '../common';\nimport { InlinePrompt, type InlinePromptProps } from '../prompt';\nimport {\n FieldLabelContextProvider,\n InputDescribedByProvider,\n InputIdContextProvider,\n InputInvalidProvider,\n} from '../inputs/contexts';\nimport { Label } from '../label';\n\nexport type FieldProps = {\n /** `null` disables auto-generating the `id` attribute, falling back to nesting-based label association over setting `htmlFor` explicitly. */\n id?: string | null;\n /** Should be specified unless the wrapped control has its own labeling mechanism, e.g. `Checkbox`. */\n label?: React.ReactNode;\n required?: boolean;\n /** @deprecated use `description` prop instead */\n hint?: React.ReactNode;\n message?: React.ReactNode;\n /**\n * Override for the [InlinePrompt icon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n messageIconLabel?: string;\n /**\n * If true, shows a loading spinner in place of the message icon of the InlinePrompt\n */\n messageLoading?: boolean;\n description?: React.ReactNode;\n /** @deprecated use `message` and `type={Sentiment.NEGATIVE}` prop instead */\n error?: React.ReactNode;\n sentiment?: InlinePromptProps['sentiment'];\n className?: string;\n children?: React.ReactNode;\n};\n\nexport const Field = ({\n id,\n label,\n required = true,\n message: propMessage,\n messageIconLabel,\n messageLoading,\n hint,\n description = hint,\n sentiment: propType = Sentiment.NEUTRAL,\n className,\n children,\n ...props\n}: FieldProps) => {\n const labelRef = useRef<HTMLLabelElement>(null);\n const sentiment = props.error ? Sentiment.NEGATIVE : propType;\n const message = propMessage || props.error;\n const hasError = sentiment === Sentiment.NEGATIVE;\n\n const labelId = useId();\n\n const fallbackInputId = useId();\n const inputId = id !== null ? (id ?? fallbackInputId) : undefined;\n\n const messageId = useId();\n const descriptionId = useId();\n\n /**\n * form control can have multiple messages to describe it,\n * e.g the description underneath the label and inline alert\n */\n function ariaDescribedbyByIds() {\n const messageIds = [];\n if (description) {\n messageIds.push(descriptionId);\n }\n if (message) {\n messageIds.push(messageId);\n }\n return messageIds.length > 0 ? messageIds.join(' ') : undefined;\n }\n\n return (\n <FieldLabelContextProvider value={{ id: labelId, ref: labelRef }}>\n <InputIdContextProvider value={inputId}>\n <InputDescribedByProvider value={ariaDescribedbyByIds()}>\n <InputInvalidProvider value={hasError}>\n <div\n className={clsx(\n 'np-field form-group d-block',\n {\n 'has-success': sentiment === Sentiment.POSITIVE,\n 'has-warning': sentiment === Sentiment.WARNING,\n 'has-error': hasError,\n 'has-info': sentiment === Sentiment.NEUTRAL,\n },\n className,\n )}\n >\n {label != null ? (\n <>\n <Label ref={labelRef} id={labelId} htmlFor={inputId}>\n {required ? label : <Label.Optional>{label}</Label.Optional>}\n </Label>\n <Label.Description id={descriptionId}>{description}</Label.Description>\n <div className=\"np-field-control\">{children}</div>\n </>\n ) : (\n children\n )}\n\n {message && (\n <InlinePrompt\n sentiment={sentiment}\n id={messageId}\n mediaLabel={messageIconLabel}\n className=\"np-field__prompt\"\n loading={messageLoading}\n width=\"full\"\n >\n {message}\n </InlinePrompt>\n )}\n </div>\n </InputInvalidProvider>\n </InputDescribedByProvider>\n </InputIdContextProvider>\n </FieldLabelContextProvider>\n );\n};\n"],"names":["Field","id","label","required","message","propMessage","messageIconLabel","messageLoading","hint","description","sentiment","propType","Sentiment","NEUTRAL","className","children","props","labelRef","useRef","error","NEGATIVE","hasError","labelId","useId","fallbackInputId","inputId","undefined","messageId","descriptionId","ariaDescribedbyByIds","messageIds","push","length","join","_jsx","FieldLabelContextProvider","value","ref","InputIdContextProvider","InputDescribedByProvider","InputInvalidProvider","_jsxs","clsx","POSITIVE","WARNING","_Fragment","Label","htmlFor","Optional","Description","InlinePrompt","mediaLabel","loading","width"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCO,MAAMA,KAAK,GAAGA,CAAC;EACpBC,EAAE;EACFC,KAAK;AACLC,EAAAA,QAAQ,GAAG,IAAI;AACfC,EAAAA,OAAO,EAAEC,WAAW;EACpBC,gBAAgB;EAChBC,cAAc;EACdC,IAAI;AACJC,EAAAA,WAAW,GAAGD,IAAI;AAClBE,EAAAA,SAAS,EAAEC,QAAQ,GAAGC,SAAS,CAACC,OAAO;EACvCC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAK,CACG,KAAI;AACf,EAAA,MAAMC,QAAQ,GAAGC,MAAM,CAAmB,IAAI,CAAC;EAC/C,MAAMR,SAAS,GAAGM,KAAK,CAACG,KAAK,GAAGP,SAAS,CAACQ,QAAQ,GAAGT,QAAQ;AAC7D,EAAA,MAAMP,OAAO,GAAGC,WAAW,IAAIW,KAAK,CAACG,KAAK;AAC1C,EAAA,MAAME,QAAQ,GAAGX,SAAS,KAAKE,SAAS,CAACQ,QAAQ;AAEjD,EAAA,MAAME,OAAO,GAAGC,KAAK,EAAE;AAEvB,EAAA,MAAMC,eAAe,GAAGD,KAAK,EAAE;EAC/B,MAAME,OAAO,GAAGxB,EAAE,KAAK,IAAI,GAAIA,EAAE,IAAIuB,eAAe,GAAIE,SAAS;AAEjE,EAA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ACZuC,IAAA,CAAAI,QAAA,EAAA;cAAA9B,QAAA,EAAA,cACEmB,GAAA,CAACY,cAAK,EAAA;AAACT,gBAAAA,GAAG,EAAEpB,QAAS;AAAChB,gBAAAA,EAAE,EAAEqB,OAAQ;AAACyB,gBAAAA,OAAO,EAAEtB,OAAQ;gBAAAV,QAAA,EACjDZ,QAAQ,GAAGD,KAAK,gBAAGgC,GAAA,CAACY,cAAK,CAACE,QAAQ,EAAA;AAAAjC,kBAAAA,QAAA,EAAEb;iBAAsB;AAAC,eACvD,CACP,eAAAgC,GAAA,CAACY,cAAK,CAACG,WAAW,EAAA;AAAChD,gBAAAA,EAAE,EAAE2B,aAAc;AAAAb,gBAAAA,QAAA,EAAEN;eAA+B,CACtE,eAAAyB,GAAA,CAAA,KAAA,EAAA;AAAKpB,gBAAAA,SAAS,EAAC,kBAAkB;AAAAC,gBAAAA,QAAA,EAAEA;AAAQ,eAAM,CACnD;aAAA,CAAG,GAEHA,QACD,EAEAX,OAAO,iBACN8B,GAAA,CAACgB,YAAY,EAAA;AACXxC,cAAAA,SAAS,EAAEA,SAAU;AACrBT,cAAAA,EAAE,EAAE0B,SAAU;AACdwB,cAAAA,UAAU,EAAE7C,gBAAiB;AAC7BQ,cAAAA,SAAS,EAAC,kBAAkB;AAC5BsC,cAAAA,OAAO,EAAE7C,cAAe;AACxB8C,cAAAA,KAAK,EAAC,MAAM;AAAAtC,cAAAA,QAAA,EAEXX;AAAO,aACI,CACf;WACE;SACe;OACE;KACJ;AAC1B,GAA2B,CAAC;AAEhC;;;;"}
1
+ {"version":3,"file":"Field.mjs","sources":["../../src/field/Field.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useId, useRef } from 'react';\n\nimport { Sentiment } from '../common';\nimport { InlinePrompt, type InlinePromptProps } from '../prompt';\nimport {\n FieldLabelContextProvider,\n InputDescribedByProvider,\n InputIdContextProvider,\n InputInvalidProvider,\n} from '../inputs/contexts';\nimport { Label } from '../label';\n\nexport type FieldProps = {\n /** `null` disables auto-generating the `id` attribute, falling back to nesting-based label association over setting `htmlFor` explicitly. */\n id?: string | null;\n /** Should be specified unless the wrapped control has its own labeling mechanism, e.g. `Checkbox`. */\n label?: React.ReactNode;\n required?: boolean;\n /** @deprecated use `description` prop instead */\n hint?: React.ReactNode;\n message?: React.ReactNode;\n /**\n * Override for the [InlinePrompt icon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n messageIconLabel?: string;\n /**\n * If true, shows a loading spinner in place of the message icon of the InlinePrompt\n */\n messageLoading?: boolean;\n description?: React.ReactNode;\n /** @deprecated use `message` and `type={Sentiment.NEGATIVE}` prop instead */\n error?: React.ReactNode;\n sentiment?: InlinePromptProps['sentiment'];\n className?: string;\n children?: React.ReactNode;\n};\n\nexport const Field = ({\n id,\n label,\n required = true,\n message: propMessage,\n messageIconLabel,\n messageLoading,\n hint,\n description = hint,\n sentiment: propType = Sentiment.NEUTRAL,\n className,\n children,\n ...props\n}: FieldProps) => {\n const labelRef = useRef<HTMLLabelElement>(null);\n const sentiment = props.error ? Sentiment.NEGATIVE : propType;\n const message = propMessage || props.error;\n const hasError = sentiment === Sentiment.NEGATIVE;\n\n const labelId = useId();\n\n const fallbackInputId = useId();\n const inputId = id !== null ? (id ?? fallbackInputId) : undefined;\n\n const messageId = useId();\n const descriptionId = useId();\n\n /**\n * form control can have multiple messages to describe it,\n * e.g the description underneath the label and inline alert\n */\n function ariaDescribedbyByIds() {\n const messageIds = [];\n if (description) {\n messageIds.push(descriptionId);\n }\n if (message) {\n messageIds.push(messageId);\n }\n return messageIds.length > 0 ? messageIds.join(' ') : undefined;\n }\n\n return (\n <FieldLabelContextProvider value={{ id: labelId, ref: labelRef }}>\n <InputIdContextProvider value={inputId}>\n <InputDescribedByProvider value={ariaDescribedbyByIds()}>\n <InputInvalidProvider value={hasError}>\n <div\n className={clsx(\n 'np-field form-group d-block',\n {\n 'has-success': sentiment === Sentiment.POSITIVE,\n 'has-warning': sentiment === Sentiment.WARNING,\n 'has-error': hasError,\n 'has-info': sentiment === Sentiment.NEUTRAL,\n },\n className,\n )}\n >\n {label != null ? (\n <>\n <Label ref={labelRef} id={labelId} htmlFor={inputId}>\n {required ? label : <Label.Optional>{label}</Label.Optional>}\n </Label>\n <Label.Description id={descriptionId}>{description}</Label.Description>\n <div className=\"np-field-control\">{children}</div>\n </>\n ) : (\n children\n )}\n\n {message && (\n <InlinePrompt\n sentiment={sentiment}\n id={messageId}\n mediaLabel={messageIconLabel}\n className=\"np-field__prompt\"\n loading={messageLoading}\n width=\"full\"\n >\n {message}\n </InlinePrompt>\n )}\n </div>\n </InputInvalidProvider>\n </InputDescribedByProvider>\n </InputIdContextProvider>\n </FieldLabelContextProvider>\n );\n};\n"],"names":["Field","id","label","required","message","propMessage","messageIconLabel","messageLoading","hint","description","sentiment","propType","Sentiment","NEUTRAL","className","children","props","labelRef","useRef","error","NEGATIVE","hasError","labelId","useId","fallbackInputId","inputId","undefined","messageId","descriptionId","ariaDescribedbyByIds","messageIds","push","length","join","_jsx","FieldLabelContextProvider","value","ref","InputIdContextProvider","InputDescribedByProvider","InputInvalidProvider","_jsxs","clsx","POSITIVE","WARNING","_Fragment","Label","htmlFor","Optional","Description","InlinePrompt","mediaLabel","loading","width"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCO,MAAMA,KAAK,GAAGA,CAAC;EACpBC,EAAE;EACFC,KAAK;AACLC,EAAAA,QAAQ,GAAG,IAAI;AACfC,EAAAA,OAAO,EAAEC,WAAW;EACpBC,gBAAgB;EAChBC,cAAc;EACdC,IAAI;AACJC,EAAAA,WAAW,GAAGD,IAAI;AAClBE,EAAAA,SAAS,EAAEC,QAAQ,GAAGC,SAAS,CAACC,OAAO;EACvCC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAK,CACG,KAAI;AACf,EAAA,MAAMC,QAAQ,GAAGC,MAAM,CAAmB,IAAI,CAAC;EAC/C,MAAMR,SAAS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A,KAAK,EAAC,MAAM;AAAAtC,cAAAA,QAAA,EAEXX;AAAO,aACI,CACf;WACE;SACe;OACE;KACJ;AAC1B,GAA2B,CAAC;AAEhC;;;;"}
package/build/index.js CHANGED
@@ -52,6 +52,7 @@ var infoPresentations = require('./info/infoPresentations.js');
52
52
  var Info = require('./info/Info.js');
53
53
  var InlineAlert = require('./inlineAlert/InlineAlert.js');
54
54
  var InlinePrompt = require('./prompt/InlinePrompt/InlinePrompt.js');
55
+ var ActionPrompt = require('./prompt/ActionPrompt/ActionPrompt.js');
55
56
  var InputWithDisplayFormat = require('./inputWithDisplayFormat/InputWithDisplayFormat.js');
56
57
  var Input = require('./inputs/Input.js');
57
58
  var InputGroup = require('./inputs/InputGroup.js');
@@ -211,6 +212,7 @@ Object.defineProperty(exports, "InfoPresentation", {
211
212
  exports.Info = Info.default;
212
213
  exports.InlineAlert = InlineAlert.default;
213
214
  exports.InlinePrompt = InlinePrompt.InlinePrompt;
215
+ exports.ActionPrompt = ActionPrompt.ActionPrompt;
214
216
  exports.InputWithDisplayFormat = InputWithDisplayFormat.default;
215
217
  exports.Input = Input.Input;
216
218
  exports.InputGroup = InputGroup.InputGroup;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/build/index.mjs CHANGED
@@ -50,6 +50,7 @@ export { InfoPresentation } from './info/infoPresentations.mjs';
50
50
  export { default as Info } from './info/Info.mjs';
51
51
  export { default as InlineAlert } from './inlineAlert/InlineAlert.mjs';
52
52
  export { InlinePrompt } from './prompt/InlinePrompt/InlinePrompt.mjs';
53
+ export { ActionPrompt } from './prompt/ActionPrompt/ActionPrompt.mjs';
53
54
  export { default as InputWithDisplayFormat } from './inputWithDisplayFormat/InputWithDisplayFormat.mjs';
54
55
  export { Input } from './inputs/Input.mjs';
55
56
  export { InputGroup } from './inputs/InputGroup.mjs';
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -29,6 +29,16 @@ require('../../common/closeButton/CloseButton.messages.js');
29
29
  var jsxRuntime = require('react/jsx-runtime');
30
30
  var ListItemContext = require('../ListItemContext.js');
31
31
  var InlinePrompt = require('../../prompt/InlinePrompt/InlinePrompt.js');
32
+ require('../../statusIcon/StatusIcon.js');
33
+ require('../../body/Body.js');
34
+ require('../../button/Button.resolver.js');
35
+ require('../../badge/Badge.js');
36
+ require('@wise/art');
37
+ require('@transferwise/neptune-validation');
38
+ require('../../provider/direction/DirectionProvider.js');
39
+ require('../../sentimentSurface/SentimentSurface.js');
40
+ require('../../primitives/PrimitiveButton/PrimitiveButton.js');
41
+ require('../../primitives/PrimitiveAnchor/PrimitiveAnchor.js');
32
42
 
33
43
  const Prompt = ({
34
44
  sentiment: sentiment$1 = sentiment.Sentiment.NEUTRAL,
@@ -1 +1 @@
1
- {"version":3,"file":"ListItemPrompt.js","sources":["../../../src/listItem/Prompt/ListItemPrompt.tsx"],"sourcesContent":["import { useContext } from 'react';\nimport { Sentiment } from '../../common';\nimport { ListItemContext, type ListItemContextData } from '../ListItemContext';\nimport { InlinePrompt, type InlinePromptProps } from '../../prompt';\n\nexport type ListItemPromptProps = Pick<InlinePromptProps, 'children' | 'sentiment' | 'mediaLabel'>;\n\n/**\n * This component allows for rendering an Inline Prompt. <br />\n * In the future it will be a thin wrapper around a standalone component.<br />\n *\n * Please refer to the [Design documentation](https://wise.design/components/list-item#prompt) for details.\n */\nexport const Prompt = ({\n sentiment = Sentiment.NEUTRAL,\n mediaLabel,\n children,\n}: ListItemPromptProps) => {\n const { ids, props } = useContext<ListItemContextData>(ListItemContext);\n const isLongLivedMuted = props.disabled && Boolean(props.disabledPromptMessage);\n\n return (\n <InlinePrompt\n id={ids.prompt}\n sentiment={sentiment}\n mediaLabel={mediaLabel}\n muted={isLongLivedMuted}\n className=\"wds-list-item-prompt\"\n >\n {isLongLivedMuted ? props.disabledPromptMessage : children}\n </InlinePrompt>\n );\n};\n\nPrompt.displayName = 'ListItem.Prompt';\nexport default Prompt;\n"],"names":["Prompt","sentiment","Sentiment","NEUTRAL","mediaLabel","children","ids","props","useContext","ListItemContext","isLongLivedMuted","disabled","Boolean","disabledPromptMessage","_jsx","InlinePrompt","id","prompt","muted","className","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaO,MAAMA,MAAM,GAAGA,CAAC;aACrBC,WAAS,GAAGC,mBAAS,CAACC,OAAO;EAC7BC,UAAU;AACVC,EAAAA;AAAQ,CACY,KAAI;EACxB,MAAM;IAAEC,GAAG;AAAEC,IAAAA;AAAK,GAAE,GAAGC,gBAAU,CAAsBC,+BAAe,CAAC;EACvE,MAAMC,gBAAgB,GAAGH,KAAK,CAACI,QAAQ,IAAIC,OAAO,CAACL,KAAK,CAACM,qBAAqB,CAAC;EAE/E,oBACEC,cAAA,CAACC,yBAAY,EAAA;IACXC,EAAE,EAAEV,GAAG,CAACW,MAAO;AACfhB,IAAAA,SAAS,EAAEA,WAAU;AACrBG,IAAAA,UAAU,EAAEA,UAAW;AACvBc,IAAAA,KAAK,EAAER,gBAAiB;AACxBS,IAAAA,SAAS,EAAC,sBAAsB;AAAAd,IAAAA,QAAA,EAE/BK,gBAAgB,GAAGH,KAAK,CAACM,qBAAqB,GAAGR;AAAQ,GAC9C,CAAC;AAEnB;AAEAL,MAAM,CAACoB,WAAW,GAAG,iBAAiB;;;;;"}
1
+ {"version":3,"file":"ListItemPrompt.js","sources":["../../../src/listItem/Prompt/ListItemPrompt.tsx"],"sourcesContent":["import { useContext } from 'react';\nimport { Sentiment } from '../../common';\nimport { ListItemContext, type ListItemContextData } from '../ListItemContext';\nimport { InlinePrompt, type InlinePromptProps } from '../../prompt';\n\nexport type ListItemPromptProps = Pick<InlinePromptProps, 'children' | 'sentiment' | 'mediaLabel'>;\n\n/**\n * This component allows for rendering an Inline Prompt. <br />\n * In the future it will be a thin wrapper around a standalone component.<br />\n *\n * Please refer to the [Design documentation](https://wise.design/components/list-item#prompt) for details.\n */\nexport const Prompt = ({\n sentiment = Sentiment.NEUTRAL,\n mediaLabel,\n children,\n}: ListItemPromptProps) => {\n const { ids, props } = useContext<ListItemContextData>(ListItemContext);\n const isLongLivedMuted = props.disabled && Boolean(props.disabledPromptMessage);\n\n return (\n <InlinePrompt\n id={ids.prompt}\n sentiment={sentiment}\n mediaLabel={mediaLabel}\n muted={isLongLivedMuted}\n className=\"wds-list-item-prompt\"\n >\n {isLongLivedMuted ? props.disabledPromptMessage : children}\n </InlinePrompt>\n );\n};\n\nPrompt.displayName = 'ListItem.Prompt';\nexport default Prompt;\n"],"names":["Prompt","sentiment","Sentiment","NEUTRAL","mediaLabel","children","ids","props","useContext","ListItemContext","isLongLivedMuted","disabled","Boolean","disabledPromptMessage","_jsx","InlinePrompt","id","prompt","muted","className","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaO,MAAMA,MAAM,GAAGA,CAAC;aACrBC,WAAS,GAAGC,mBAAS,CAACC,OAAO;EAC7BC,UAAU;AACVC,EAAAA;AAAQ,CACY,KAAI;EACxB,MAAM;IAAEC,GAAG;AAAEC,IAAAA;AAAK,GAAE,GAAGC,gBAAU,CAAsBC,+BAAe,CAAC;EACvE,MAAMC,gBAAgB,GAAGH,KAAK,CAACI,QAAQ,IAAIC,OAAO,CAACL,KAAK,CAACM,qBAAqB,CAAC;EAE/E,oBACEC,cAAA,CAACC,yBAAY,EAAA;IACXC,EAAE,EAAEV,GAAG,CAACW,MAAO;AACfhB,IAAAA,SAAS,EAAEA,WAAU;AACrBG,IAAAA,UAAU,EAAEA,UAAW;AACvBc,IAAAA,KAAK,EAAER,gBAAiB;AACxBS,IAAAA,SAAS,EAAC,sBAAsB;AAAAd,IAAAA,QAAA,EAE/BK,gBAAgB,GAAGH,KAAK,CAACM,qBAAqB,GAAGR;AAAQ,GAC9C,CAAC;AAEnB;AAEAL,MAAM,CAACoB,WAAW,GAAG,iBAAiB;;;;;"}
@@ -25,6 +25,16 @@ import '../../common/closeButton/CloseButton.messages.mjs';
25
25
  import { jsx } from 'react/jsx-runtime';
26
26
  import { ListItemContext } from '../ListItemContext.mjs';
27
27
  import { InlinePrompt } from '../../prompt/InlinePrompt/InlinePrompt.mjs';
28
+ import '../../statusIcon/StatusIcon.mjs';
29
+ import '../../body/Body.mjs';
30
+ import '../../button/Button.resolver.mjs';
31
+ import '../../badge/Badge.mjs';
32
+ import '@wise/art';
33
+ import '@transferwise/neptune-validation';
34
+ import '../../provider/direction/DirectionProvider.mjs';
35
+ import '../../sentimentSurface/SentimentSurface.mjs';
36
+ import '../../primitives/PrimitiveButton/PrimitiveButton.mjs';
37
+ import '../../primitives/PrimitiveAnchor/PrimitiveAnchor.mjs';
28
38
 
29
39
  const Prompt = ({
30
40
  sentiment = Sentiment.NEUTRAL,
@@ -1 +1 @@
1
- {"version":3,"file":"ListItemPrompt.mjs","sources":["../../../src/listItem/Prompt/ListItemPrompt.tsx"],"sourcesContent":["import { useContext } from 'react';\nimport { Sentiment } from '../../common';\nimport { ListItemContext, type ListItemContextData } from '../ListItemContext';\nimport { InlinePrompt, type InlinePromptProps } from '../../prompt';\n\nexport type ListItemPromptProps = Pick<InlinePromptProps, 'children' | 'sentiment' | 'mediaLabel'>;\n\n/**\n * This component allows for rendering an Inline Prompt. <br />\n * In the future it will be a thin wrapper around a standalone component.<br />\n *\n * Please refer to the [Design documentation](https://wise.design/components/list-item#prompt) for details.\n */\nexport const Prompt = ({\n sentiment = Sentiment.NEUTRAL,\n mediaLabel,\n children,\n}: ListItemPromptProps) => {\n const { ids, props } = useContext<ListItemContextData>(ListItemContext);\n const isLongLivedMuted = props.disabled && Boolean(props.disabledPromptMessage);\n\n return (\n <InlinePrompt\n id={ids.prompt}\n sentiment={sentiment}\n mediaLabel={mediaLabel}\n muted={isLongLivedMuted}\n className=\"wds-list-item-prompt\"\n >\n {isLongLivedMuted ? props.disabledPromptMessage : children}\n </InlinePrompt>\n );\n};\n\nPrompt.displayName = 'ListItem.Prompt';\nexport default Prompt;\n"],"names":["Prompt","sentiment","Sentiment","NEUTRAL","mediaLabel","children","ids","props","useContext","ListItemContext","isLongLivedMuted","disabled","Boolean","disabledPromptMessage","_jsx","InlinePrompt","id","prompt","muted","className","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaO,MAAMA,MAAM,GAAGA,CAAC;EACrBC,SAAS,GAAGC,SAAS,CAACC,OAAO;EAC7BC,UAAU;AACVC,EAAAA;AAAQ,CACY,KAAI;EACxB,MAAM;IAAEC,GAAG;AAAEC,IAAAA;AAAK,GAAE,GAAGC,UAAU,CAAsBC,eAAe,CAAC;EACvE,MAAMC,gBAAgB,GAAGH,KAAK,CAACI,QAAQ,IAAIC,OAAO,CAACL,KAAK,CAACM,qBAAqB,CAAC;EAE/E,oBACEC,GAAA,CAACC,YAAY,EAAA;IACXC,EAAE,EAAEV,GAAG,CAACW,MAAO;AACfhB,IAAAA,SAAS,EAAEA,SAAU;AACrBG,IAAAA,UAAU,EAAEA,UAAW;AACvBc,IAAAA,KAAK,EAAER,gBAAiB;AACxBS,IAAAA,SAAS,EAAC,sBAAsB;AAAAd,IAAAA,QAAA,EAE/BK,gBAAgB,GAAGH,KAAK,CAACM,qBAAqB,GAAGR;AAAQ,GAC9C,CAAC;AAEnB;AAEAL,MAAM,CAACoB,WAAW,GAAG,iBAAiB;;;;"}
1
+ {"version":3,"file":"ListItemPrompt.mjs","sources":["../../../src/listItem/Prompt/ListItemPrompt.tsx"],"sourcesContent":["import { useContext } from 'react';\nimport { Sentiment } from '../../common';\nimport { ListItemContext, type ListItemContextData } from '../ListItemContext';\nimport { InlinePrompt, type InlinePromptProps } from '../../prompt';\n\nexport type ListItemPromptProps = Pick<InlinePromptProps, 'children' | 'sentiment' | 'mediaLabel'>;\n\n/**\n * This component allows for rendering an Inline Prompt. <br />\n * In the future it will be a thin wrapper around a standalone component.<br />\n *\n * Please refer to the [Design documentation](https://wise.design/components/list-item#prompt) for details.\n */\nexport const Prompt = ({\n sentiment = Sentiment.NEUTRAL,\n mediaLabel,\n children,\n}: ListItemPromptProps) => {\n const { ids, props } = useContext<ListItemContextData>(ListItemContext);\n const isLongLivedMuted = props.disabled && Boolean(props.disabledPromptMessage);\n\n return (\n <InlinePrompt\n id={ids.prompt}\n sentiment={sentiment}\n mediaLabel={mediaLabel}\n muted={isLongLivedMuted}\n className=\"wds-list-item-prompt\"\n >\n {isLongLivedMuted ? props.disabledPromptMessage : children}\n </InlinePrompt>\n );\n};\n\nPrompt.displayName = 'ListItem.Prompt';\nexport default Prompt;\n"],"names":["Prompt","sentiment","Sentiment","NEUTRAL","mediaLabel","children","ids","props","useContext","ListItemContext","isLongLivedMuted","disabled","Boolean","disabledPromptMessage","_jsx","InlinePrompt","id","prompt","muted","className","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaO,MAAMA,MAAM,GAAGA,CAAC;EACrBC,SAAS,GAAGC,SAAS,CAACC,OAAO;EAC7BC,UAAU;AACVC,EAAAA;AAAQ,CACY,KAAI;EACxB,MAAM;IAAEC,GAAG;AAAEC,IAAAA;AAAK,GAAE,GAAGC,UAAU,CAAsBC,eAAe,CAAC;EACvE,MAAMC,gBAAgB,GAAGH,KAAK,CAACI,QAAQ,IAAIC,OAAO,CAACL,KAAK,CAACM,qBAAqB,CAAC;EAE/E,oBACEC,GAAA,CAACC,YAAY,EAAA;IACXC,EAAE,EAAEV,GAAG,CAACW,MAAO;AACfhB,IAAAA,SAAS,EAAEA,SAAU;AACrBG,IAAAA,UAAU,EAAEA,UAAW;AACvBc,IAAAA,KAAK,EAAER,gBAAiB;AACxBS,IAAAA,SAAS,EAAC,sBAAsB;AAAAd,IAAAA,QAAA,EAE/BK,gBAAgB,GAAGH,KAAK,CAACM,qBAAqB,GAAGR;AAAQ,GAC9C,CAAC;AAEnB;AAEAL,MAAM,CAACoB,WAAW,GAAG,iBAAiB;;;;"}
package/build/main.css CHANGED
@@ -5339,6 +5339,8 @@ html:not([dir="rtl"]) .np-navigation-option {
5339
5339
  border-radius: 10px;
5340
5340
  border-radius: var(--radius-small);
5341
5341
  display: flex;
5342
+ gap: 16px;
5343
+ gap: var(--Prompt-gap, var(--size-16));
5342
5344
  word-wrap: break-word;
5343
5345
  padding: 8px;
5344
5346
  padding: var(--Prompt-padding, var(--padding-x-small));
@@ -5354,6 +5356,9 @@ html:not([dir="rtl"]) .np-navigation-option {
5354
5356
  grid-template-columns: auto 1fr;
5355
5357
  width: 100%;
5356
5358
  }
5359
+ .wds-prompt__content-wrapper--with-dismiss {
5360
+ grid-template-columns: auto 1fr auto;
5361
+ }
5357
5362
  .wds-prompt__media-wrapper {
5358
5363
  align-self: flex-start;
5359
5364
  padding-top: calc(4px - 1px);
@@ -5369,12 +5374,16 @@ html:not([dir="rtl"]) .np-navigation-option {
5369
5374
  gap: 8px;
5370
5375
  gap: var(--Prompt-actions-gap, var(--size-8));
5371
5376
  grid-column-start: 2;
5377
+ grid-column-end: 3;
5372
5378
  }
5373
- @media (max-width: 991px) {
5379
+ @media (max-width: 767px) {
5374
5380
  .wds-prompt__actions-wrapper {
5375
5381
  grid-column: span 2;
5376
5382
  width: 100%;
5377
5383
  }
5384
+ .wds-prompt__content-wrapper--with-dismiss .wds-prompt__actions-wrapper {
5385
+ grid-column: span 3;
5386
+ }
5378
5387
  }
5379
5388
  .wds-inline-prompt {
5380
5389
  --Prompt-gap: calc(var(--size-12) / 2);
@@ -7423,3 +7432,23 @@ html:not([dir="rtl"]) .np-navigation-option {
7423
7432
  .np-list-item__action {
7424
7433
  flex-shrink: 0;
7425
7434
  }
7435
+ .wds-action-prompt {
7436
+ --Prompt-padding: var(--size-16);
7437
+ --Prompt-actions-gap: var(--size-8);
7438
+ --Prompt-gap: var(--size-10) var(--size-16);
7439
+ }
7440
+ .wds-action-prompt--media-image {
7441
+ width: 48px;
7442
+ width: var(--size-48);
7443
+ height: 48px;
7444
+ height: var(--size-48);
7445
+ -o-object-fit: contain;
7446
+ object-fit: contain;
7447
+ }
7448
+ @media (max-width: 767px) {
7449
+ .wds-action-prompt--with-two-actions .wds-prompt__actions-wrapper .wds-Button {
7450
+ flex: 1 1 calc(50% - (var(--Prompt-actions-gap) / 2));
7451
+ min-width: -moz-fit-content;
7452
+ min-width: fit-content;
7453
+ }
7454
+ }
@@ -0,0 +1,123 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var clsx = require('clsx');
6
+ var StatusIcon = require('../../statusIcon/StatusIcon.js');
7
+ var Body = require('../../body/Body.js');
8
+ var Button_resolver = require('../../button/Button.resolver.js');
9
+ require('../../common/theme.js');
10
+ require('../../common/direction.js');
11
+ require('../../common/propsValues/control.js');
12
+ var breakpoint = require('../../common/propsValues/breakpoint.js');
13
+ require('../../common/propsValues/size.js');
14
+ var typography = require('../../common/propsValues/typography.js');
15
+ require('../../common/propsValues/width.js');
16
+ require('../../common/propsValues/type.js');
17
+ require('../../common/propsValues/dateMode.js');
18
+ require('../../common/propsValues/monthFormat.js');
19
+ require('../../common/propsValues/position.js');
20
+ require('../../common/propsValues/layouts.js');
21
+ require('../../common/propsValues/status.js');
22
+ require('../../common/propsValues/sentiment.js');
23
+ require('../../common/propsValues/profileType.js');
24
+ require('../../common/propsValues/variant.js');
25
+ require('../../common/propsValues/scroll.js');
26
+ require('../../common/propsValues/markdownNodeType.js');
27
+ require('../../common/fileType.js');
28
+ var icons = require('@transferwise/icons');
29
+ require('react');
30
+ require('react-intl');
31
+ require('../../common/closeButton/CloseButton.messages.js');
32
+ var jsxRuntime = require('react/jsx-runtime');
33
+ var AvatarView = require('../../avatarView/AvatarView.js');
34
+ var Image = require('../../image/Image.js');
35
+ var PrimitivePrompt = require('../PrimitivePrompt/PrimitivePrompt.js');
36
+ var useScreenSize = require('../../common/hooks/useScreenSize.js');
37
+
38
+ const ActionPrompt = ({
39
+ sentiment = 'neutral',
40
+ title,
41
+ description,
42
+ onDismiss,
43
+ media,
44
+ actionPrimary,
45
+ actionSecondary,
46
+ id,
47
+ className,
48
+ 'data-testid': testId
49
+ }) => {
50
+ const isMobile = !useScreenSize.useScreenSize(breakpoint.Breakpoint.MEDIUM);
51
+ const renderMedia = () => {
52
+ if (media?.imgSrc) {
53
+ return /*#__PURE__*/jsxRuntime.jsx(Image.default, {
54
+ src: media.imgSrc,
55
+ className: "wds-action-prompt--media-image",
56
+ alt: media['aria-label'] ?? ''
57
+ });
58
+ }
59
+ if (media?.avatar) {
60
+ const badge = media.avatar.badge ? media.avatar.badge : sentiment === 'proposition' ? {} : {
61
+ status: sentiment
62
+ };
63
+ return /*#__PURE__*/jsxRuntime.jsx(AvatarView.default, {
64
+ ...media.avatar,
65
+ badge: badge,
66
+ size: 48,
67
+ children: media.avatar.asset
68
+ });
69
+ }
70
+ return sentiment === 'proposition' ? /*#__PURE__*/jsxRuntime.jsx(AvatarView.default, {
71
+ size: 48,
72
+ children: /*#__PURE__*/jsxRuntime.jsx(icons.GiftBox, {})
73
+ }) : /*#__PURE__*/jsxRuntime.jsx(StatusIcon.default, {
74
+ size: 48,
75
+ sentiment: sentiment
76
+ });
77
+ };
78
+ return /*#__PURE__*/jsxRuntime.jsx(PrimitivePrompt.PrimitivePrompt, {
79
+ id: id,
80
+ sentiment: sentiment,
81
+ "data-testid": testId,
82
+ className: clsx.clsx('wds-action-prompt', {
83
+ 'wds-action-prompt--with-two-actions': !!actionSecondary
84
+ }, className),
85
+ media: renderMedia(),
86
+ actions: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
87
+ children: [actionSecondary &&
88
+ /*#__PURE__*/
89
+ // @ts-expect-error onClick type mismatch
90
+ jsxRuntime.jsx(Button_resolver.default, {
91
+ v2: true,
92
+ size: "md",
93
+ priority: "secondary",
94
+ href: actionSecondary.href,
95
+ block: isMobile,
96
+ onClick: actionSecondary?.onClick,
97
+ children: actionSecondary.label
98
+ }), /*#__PURE__*/jsxRuntime.jsx(Button_resolver.default, {
99
+ v2: true,
100
+ size: "md",
101
+ priority: "primary",
102
+ href: actionPrimary.href,
103
+ block: isMobile,
104
+ onClick: actionPrimary.onClick,
105
+ children: actionPrimary.label
106
+ })]
107
+ }),
108
+ onDismiss: onDismiss,
109
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
110
+ className: clsx.clsx('d-flex', 'flex-column', 'justify-content-center'),
111
+ children: [/*#__PURE__*/jsxRuntime.jsx(Body.default, {
112
+ type: typography.Typography.BODY_LARGE_BOLD,
113
+ children: title
114
+ }), description && /*#__PURE__*/jsxRuntime.jsx(Body.default, {
115
+ children: description
116
+ })]
117
+ })
118
+ });
119
+ };
120
+
121
+ exports.ActionPrompt = ActionPrompt;
122
+ exports.default = ActionPrompt;
123
+ //# sourceMappingURL=ActionPrompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionPrompt.js","sources":["../../../src/prompt/ActionPrompt/ActionPrompt.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport { clsx } from 'clsx';\n\nimport StatusIcon from '../../statusIcon';\nimport Body from '../../body';\nimport Button from '../../button';\nimport { Breakpoint, Typography } from '../../common';\nimport AvatarView, { AvatarViewProps } from '../../avatarView';\nimport Image from '../../image';\nimport { ButtonProps } from '../../button/Button.types';\nimport { PrimitivePrompt, PrimitivePromptProps } from '../PrimitivePrompt';\nimport { BadgeAssetsProps } from '../../badge';\nimport { GiftBox } from '@transferwise/icons';\nimport { useScreenSize } from '../../common/hooks/useScreenSize';\n\nexport type ActionPromptProps = {\n title: ReactNode;\n description?: ReactNode;\n media?: {\n imgSrc?: string;\n avatar?: Pick<AvatarViewProps, 'imgSrc' | 'profileName' | 'profileType'> & {\n asset?: AvatarViewProps['children'];\n badge?: Pick<BadgeAssetsProps, 'flagCode'>;\n };\n 'aria-label'?: string;\n };\n actionPrimary: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n actionSecondary?: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n} & Pick<PrimitivePromptProps, 'id' | 'className' | 'data-testid' | 'sentiment' | 'onDismiss'>;\n\nexport const ActionPrompt = ({\n sentiment = 'neutral',\n title,\n description,\n onDismiss,\n media,\n actionPrimary,\n actionSecondary,\n id,\n className,\n 'data-testid': testId,\n}: ActionPromptProps) => {\n const isMobile = !useScreenSize(Breakpoint.MEDIUM);\n\n const renderMedia = () => {\n if (media?.imgSrc) {\n return (\n <Image\n src={media.imgSrc}\n className=\"wds-action-prompt--media-image\"\n alt={media['aria-label'] ?? ''}\n />\n );\n }\n if (media?.avatar) {\n const badge = media.avatar.badge\n ? media.avatar.badge\n : sentiment === 'proposition'\n ? {}\n : { status: sentiment };\n return (\n <AvatarView {...media.avatar} badge={badge} size={48}>\n {media.avatar.asset}\n </AvatarView>\n );\n }\n return sentiment === 'proposition' ? (\n <AvatarView size={48}>\n <GiftBox />\n </AvatarView>\n ) : (\n <StatusIcon size={48} sentiment={sentiment} />\n );\n };\n\n return (\n <PrimitivePrompt\n id={id}\n sentiment={sentiment}\n data-testid={testId}\n className={clsx(\n 'wds-action-prompt',\n { 'wds-action-prompt--with-two-actions': !!actionSecondary },\n className,\n )}\n media={renderMedia()}\n actions={\n <>\n {actionSecondary && (\n // @ts-expect-error onClick type mismatch\n <Button\n v2\n size=\"md\"\n priority=\"secondary\"\n href={actionSecondary.href}\n block={isMobile}\n onClick={actionSecondary?.onClick}\n >\n {actionSecondary.label}\n </Button>\n )}\n {/* @ts-expect-error onClick type mismatch */}\n <Button\n v2\n size=\"md\"\n priority=\"primary\"\n href={actionPrimary.href}\n block={isMobile}\n onClick={actionPrimary.onClick}\n >\n {actionPrimary.label}\n </Button>\n </>\n }\n onDismiss={onDismiss}\n >\n <div className={clsx('d-flex', 'flex-column', 'justify-content-center')}>\n <Body type={Typography.BODY_LARGE_BOLD}>{title}</Body>\n {description && <Body>{description}</Body>}\n </div>\n </PrimitivePrompt>\n );\n};\n\nexport default ActionPrompt;\n"],"names":["ActionPrompt","sentiment","title","description","onDismiss","media","actionPrimary","actionSecondary","id","className","testId","isMobile","useScreenSize","Breakpoint","MEDIUM","renderMedia","imgSrc","_jsx","Image","src","alt","avatar","badge","status","AvatarView","size","children","asset","GiftBox","StatusIcon","PrimitivePrompt","clsx","actions","_jsxs","_Fragment","Button","v2","priority","href","block","onClick","label","Body","type","Typography","BODY_LARGE_BOLD"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCO,MAAMA,YAAY,GAAGA,CAAC;AAC3BC,EAAAA,SAAS,GAAG,SAAS;EACrBC,KAAK;EACLC,WAAW;EACXC,SAAS;EACTC,KAAK;EACLC,aAAa;EACbC,eAAe;EACfC,EAAE;EACFC,SAAS;AACT,EAAA,aAAa,EAAEC;AAAM,CACH,KAAI;EACtB,MAAMC,QAAQ,GAAG,CAACC,2BAAa,CAACC,qBAAU,CAACC,MAAM,CAAC;EAElD,MAAMC,WAAW,GAAGA,MAAK;IACvB,IAAIV,KAAK,EAAEW,MAAM,EAAE;MACjB,oBACEC,cAAA,CAACC,aAAK,EAAA;QACJC,GAAG,EAAEd,KAAK,CAACW,MAAO;AAClBP,QAAAA,SAAS,EAAC,gCAAgC;AAC1CW,QAAAA,GAAG,EAAEf,KAAK,CAAC,YAAY,CAAC,IAAI;AAAG,OAAA,CAC/B;AAEN,IAAA;IACA,IAAIA,KAAK,EAAEgB,MAAM,EAAE;MACjB,MAAMC,KAAK,GAAGjB,KAAK,CAACgB,MAAM,CAACC,KAAK,GAC5BjB,KAAK,CAACgB,MAAM,CAACC,KAAK,GAClBrB,SAAS,KAAK,aAAa,GACzB,EAAE,GACF;AAAEsB,QAAAA,MAAM,EAAEtB;OAAW;MAC3B,oBACEgB,cAAA,CAACO,kBAAU,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,QAAAA,IAAI,EAAC,IAAI;AACTY,QAAAA,QAAQ,EAAC,SAAS;QAClBC,IAAI,EAAEhC,aAAa,CAACgC,IAAK;AACzBC,QAAAA,KAAK,EAAE5B,QAAS;QAChB6B,OAAO,EAAElC,aAAa,CAACkC,OAAQ;QAAAd,QAAA,EAE9BpB,aAAa,CAACmC;AAAK,OACd,CACV;AAAA,KAAA,CACD;AACDrC,IAAAA,SAAS,EAAEA,SAAU;AAAAsB,IAAAA,QAAA,eAErBO,eAAA,CAAA,KAAA,EAAA;MAAKxB,SAAS,EAAEsB,SAAI,CAAC,QAAQ,EAAE,aAAa,EAAE,wBAAwB,CAAE;MAAAL,QAAA,EAAA,cACtET,cAAA,CAACyB,YAAI,EAAA;QAACC,IAAI,EAAEC,qBAAU,CAACC,eAAgB;AAAAnB,QAAAA,QAAA,EAAExB;AAAK,OAAO,CACrD,EAACC,WAAW,iBAAIc,cAAA,CAACyB,YAAI,EAAA;AAAAhB,QAAAA,QAAA,EAAEvB;AAAW,OAAO,CAAC;KACvC;AACP,GAAiB,CAAC;AAEtB;;;;;"}
@@ -0,0 +1,118 @@
1
+ import { clsx } from 'clsx';
2
+ import StatusIcon from '../../statusIcon/StatusIcon.mjs';
3
+ import Body from '../../body/Body.mjs';
4
+ import Button from '../../button/Button.resolver.mjs';
5
+ import '../../common/theme.mjs';
6
+ import '../../common/direction.mjs';
7
+ import '../../common/propsValues/control.mjs';
8
+ import { Breakpoint } from '../../common/propsValues/breakpoint.mjs';
9
+ import '../../common/propsValues/size.mjs';
10
+ import { Typography } from '../../common/propsValues/typography.mjs';
11
+ import '../../common/propsValues/width.mjs';
12
+ import '../../common/propsValues/type.mjs';
13
+ import '../../common/propsValues/dateMode.mjs';
14
+ import '../../common/propsValues/monthFormat.mjs';
15
+ import '../../common/propsValues/position.mjs';
16
+ import '../../common/propsValues/layouts.mjs';
17
+ import '../../common/propsValues/status.mjs';
18
+ import '../../common/propsValues/sentiment.mjs';
19
+ import '../../common/propsValues/profileType.mjs';
20
+ import '../../common/propsValues/variant.mjs';
21
+ import '../../common/propsValues/scroll.mjs';
22
+ import '../../common/propsValues/markdownNodeType.mjs';
23
+ import '../../common/fileType.mjs';
24
+ import { GiftBox } from '@transferwise/icons';
25
+ import 'react';
26
+ import 'react-intl';
27
+ import '../../common/closeButton/CloseButton.messages.mjs';
28
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
29
+ import AvatarView from '../../avatarView/AvatarView.mjs';
30
+ import Image from '../../image/Image.mjs';
31
+ import { PrimitivePrompt } from '../PrimitivePrompt/PrimitivePrompt.mjs';
32
+ import { useScreenSize } from '../../common/hooks/useScreenSize.mjs';
33
+
34
+ const ActionPrompt = ({
35
+ sentiment = 'neutral',
36
+ title,
37
+ description,
38
+ onDismiss,
39
+ media,
40
+ actionPrimary,
41
+ actionSecondary,
42
+ id,
43
+ className,
44
+ 'data-testid': testId
45
+ }) => {
46
+ const isMobile = !useScreenSize(Breakpoint.MEDIUM);
47
+ const renderMedia = () => {
48
+ if (media?.imgSrc) {
49
+ return /*#__PURE__*/jsx(Image, {
50
+ src: media.imgSrc,
51
+ className: "wds-action-prompt--media-image",
52
+ alt: media['aria-label'] ?? ''
53
+ });
54
+ }
55
+ if (media?.avatar) {
56
+ const badge = media.avatar.badge ? media.avatar.badge : sentiment === 'proposition' ? {} : {
57
+ status: sentiment
58
+ };
59
+ return /*#__PURE__*/jsx(AvatarView, {
60
+ ...media.avatar,
61
+ badge: badge,
62
+ size: 48,
63
+ children: media.avatar.asset
64
+ });
65
+ }
66
+ return sentiment === 'proposition' ? /*#__PURE__*/jsx(AvatarView, {
67
+ size: 48,
68
+ children: /*#__PURE__*/jsx(GiftBox, {})
69
+ }) : /*#__PURE__*/jsx(StatusIcon, {
70
+ size: 48,
71
+ sentiment: sentiment
72
+ });
73
+ };
74
+ return /*#__PURE__*/jsx(PrimitivePrompt, {
75
+ id: id,
76
+ sentiment: sentiment,
77
+ "data-testid": testId,
78
+ className: clsx('wds-action-prompt', {
79
+ 'wds-action-prompt--with-two-actions': !!actionSecondary
80
+ }, className),
81
+ media: renderMedia(),
82
+ actions: /*#__PURE__*/jsxs(Fragment, {
83
+ children: [actionSecondary &&
84
+ /*#__PURE__*/
85
+ // @ts-expect-error onClick type mismatch
86
+ jsx(Button, {
87
+ v2: true,
88
+ size: "md",
89
+ priority: "secondary",
90
+ href: actionSecondary.href,
91
+ block: isMobile,
92
+ onClick: actionSecondary?.onClick,
93
+ children: actionSecondary.label
94
+ }), /*#__PURE__*/jsx(Button, {
95
+ v2: true,
96
+ size: "md",
97
+ priority: "primary",
98
+ href: actionPrimary.href,
99
+ block: isMobile,
100
+ onClick: actionPrimary.onClick,
101
+ children: actionPrimary.label
102
+ })]
103
+ }),
104
+ onDismiss: onDismiss,
105
+ children: /*#__PURE__*/jsxs("div", {
106
+ className: clsx('d-flex', 'flex-column', 'justify-content-center'),
107
+ children: [/*#__PURE__*/jsx(Body, {
108
+ type: Typography.BODY_LARGE_BOLD,
109
+ children: title
110
+ }), description && /*#__PURE__*/jsx(Body, {
111
+ children: description
112
+ })]
113
+ })
114
+ });
115
+ };
116
+
117
+ export { ActionPrompt, ActionPrompt as default };
118
+ //# sourceMappingURL=ActionPrompt.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionPrompt.mjs","sources":["../../../src/prompt/ActionPrompt/ActionPrompt.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport { clsx } from 'clsx';\n\nimport StatusIcon from '../../statusIcon';\nimport Body from '../../body';\nimport Button from '../../button';\nimport { Breakpoint, Typography } from '../../common';\nimport AvatarView, { AvatarViewProps } from '../../avatarView';\nimport Image from '../../image';\nimport { ButtonProps } from '../../button/Button.types';\nimport { PrimitivePrompt, PrimitivePromptProps } from '../PrimitivePrompt';\nimport { BadgeAssetsProps } from '../../badge';\nimport { GiftBox } from '@transferwise/icons';\nimport { useScreenSize } from '../../common/hooks/useScreenSize';\n\nexport type ActionPromptProps = {\n title: ReactNode;\n description?: ReactNode;\n media?: {\n imgSrc?: string;\n avatar?: Pick<AvatarViewProps, 'imgSrc' | 'profileName' | 'profileType'> & {\n asset?: AvatarViewProps['children'];\n badge?: Pick<BadgeAssetsProps, 'flagCode'>;\n };\n 'aria-label'?: string;\n };\n actionPrimary: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n actionSecondary?: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {\n label: ButtonProps['children'];\n };\n} & Pick<PrimitivePromptProps, 'id' | 'className' | 'data-testid' | 'sentiment' | 'onDismiss'>;\n\nexport const ActionPrompt = ({\n sentiment = 'neutral',\n title,\n description,\n onDismiss,\n media,\n actionPrimary,\n actionSecondary,\n id,\n className,\n 'data-testid': testId,\n}: ActionPromptProps) => {\n const isMobile = !useScreenSize(Breakpoint.MEDIUM);\n\n const renderMedia = () => {\n if (media?.imgSrc) {\n return (\n <Image\n src={media.imgSrc}\n className=\"wds-action-prompt--media-image\"\n alt={media['aria-label'] ?? ''}\n />\n );\n }\n if (media?.avatar) {\n const badge = media.avatar.badge\n ? media.avatar.badge\n : sentiment === 'proposition'\n ? {}\n : { status: sentiment };\n return (\n <AvatarView {...media.avatar} badge={badge} size={48}>\n {media.avatar.asset}\n </AvatarView>\n );\n }\n return sentiment === 'proposition' ? (\n <AvatarView size={48}>\n <GiftBox />\n </AvatarView>\n ) : (\n <StatusIcon size={48} sentiment={sentiment} />\n );\n };\n\n return (\n <PrimitivePrompt\n id={id}\n sentiment={sentiment}\n data-testid={testId}\n className={clsx(\n 'wds-action-prompt',\n { 'wds-action-prompt--with-two-actions': !!actionSecondary },\n className,\n )}\n media={renderMedia()}\n actions={\n <>\n {actionSecondary && (\n // @ts-expect-error onClick type mismatch\n <Button\n v2\n size=\"md\"\n priority=\"secondary\"\n href={actionSecondary.href}\n block={isMobile}\n onClick={actionSecondary?.onClick}\n >\n {actionSecondary.label}\n </Button>\n )}\n {/* @ts-expect-error onClick type mismatch */}\n <Button\n v2\n size=\"md\"\n priority=\"primary\"\n href={actionPrimary.href}\n block={isMobile}\n onClick={actionPrimary.onClick}\n >\n {actionPrimary.label}\n </Button>\n </>\n }\n onDismiss={onDismiss}\n >\n <div className={clsx('d-flex', 'flex-column', 'justify-content-center')}>\n <Body type={Typography.BODY_LARGE_BOLD}>{title}</Body>\n {description && <Body>{description}</Body>}\n </div>\n </PrimitivePrompt>\n );\n};\n\nexport default ActionPrompt;\n"],"names":["ActionPrompt","sentiment","title","description","onDismiss","media","actionPrimary","actionSecondary","id","className","testId","isMobile","useScreenSize","Breakpoint","MEDIUM","renderMedia","imgSrc","_jsx","Image","src","alt","avatar","badge","status","AvatarView","size","children","asset","GiftBox","StatusIcon","PrimitivePrompt","clsx","actions","_jsxs","_Fragment","Button","v2","priority","href","block","onClick","label","Body","type","Typography","BODY_LARGE_BOLD"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCO,MAAMA,YAAY,GAAGA,CAAC;AAC3BC,EAAAA,SAAS,GAAG,SAAS;EACrBC,KAAK;EACLC,WAAW;EACXC,SAAS;EACTC,KAAK;EACLC,aAAa;EACbC,eAAe;EACfC,EAAE;EACFC,SAAS;AACT,EAAA,aAAa,EAAEC;AAAM,CACH,KAAI;EACtB,MAAMC,QAAQ,GAAG,CAACC,aAAa,CAACC,UAAU,CAACC,MAAM,CAAC;EAElD,MAAMC,WAAW,GAAGA,MAAK;IACvB,IAAIV,KAAK,EAAEW,MAAM,EAAE;MACjB,oBACEC,GAAA,CAACC,KAAK,EAAA;QACJC,GAAG,EAAEd,KAAK,CAACW,MAAO;AAClBP,QAAAA,SAAS,EAAC,gCAAgC;AAC1CW,QAAAA,GAAG,EAAEf,KAAK,CAAC,YAAY,CAAC,IAAI;AAAG,OAAA,CAC/B;AAEN,IAAA;IACA,IAAIA,KAAK,EAAEgB,MAAM,EAAE;MACjB,MAAMC,KAAK,GAAGjB,KAAK,CAACgB,MAAM,CAACC,KAAK,GAC5BjB,KA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Ae,EAAEiC,OAAQ;QAAAd,QAAA,EAEjCnB,eAAe,CAACkC;AAAK,OAChB,CACT,eAEDxB,GAAA,CAACkB,MAAM,EAAA;QACLC,EAAE,EAAA,IAAA;AACFX,QAAAA,IAAI,EAAC,IAAI;AACTY,QAAAA,QAAQ,EAAC,SAAS;QAClBC,IAAI,EAAEhC,aAAa,CAACgC,IAAK;AACzBC,QAAAA,KAAK,EAAE5B,QAAS;QAChB6B,OAAO,EAAElC,aAAa,CAACkC,OAAQ;QAAAd,QAAA,EAE9BpB,aAAa,CAACmC;AAAK,OACd,CACV;AAAA,KAAA,CACD;AACDrC,IAAAA,SAAS,EAAEA,SAAU;AAAAsB,IAAAA,QAAA,eAErBO,IAAA,CAAA,KAAA,EAAA;MAAKxB,SAAS,EAAEsB,IAAI,CAAC,QAAQ,EAAE,aAAa,EAAE,wBAAwB,CAAE;MAAAL,QAAA,EAAA,cACtET,GAAA,CAACyB,IAAI,EAAA;QAACC,IAAI,EAAEC,UAAU,CAACC,eAAgB;AAAAnB,QAAAA,QAAA,EAAExB;AAAK,OAAO,CACrD,EAACC,WAAW,iBAAIc,GAAA,CAACyB,IAAI,EAAA;AAAAhB,QAAAA,QAAA,EAAEvB;AAAW,OAAO,CAAC;KACvC;AACP,GAAiB,CAAC;AAEtB;;;;"}
@@ -18,26 +18,28 @@ const PrimitivePrompt = ({
18
18
  ...restProps
19
19
  }) => {
20
20
  const intl = reactIntl.useIntl();
21
- return /*#__PURE__*/jsxRuntime.jsxs(SentimentSurface.default, {
21
+ return /*#__PURE__*/jsxRuntime.jsx(SentimentSurface.default, {
22
22
  sentiment: sentiment,
23
23
  className: clsx.clsx('wds-prompt', `wds-prompt--${sentiment}`, className),
24
24
  ...restProps,
25
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
26
- className: "wds-prompt__content-wrapper",
25
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
26
+ className: clsx.clsx('wds-prompt__content-wrapper', {
27
+ 'wds-prompt__content-wrapper--with-dismiss': !!onDismiss
28
+ }),
27
29
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
28
30
  className: clsx.clsx('wds-prompt__media-wrapper'),
29
31
  children: media
30
- }), children, actions && /*#__PURE__*/jsxRuntime.jsx("div", {
32
+ }), children, onDismiss && /*#__PURE__*/jsxRuntime.jsx(IconButton.default, {
33
+ size: 24,
34
+ priority: "secondary",
35
+ "aria-label": intl.formatMessage(CloseButton_messages.default.ariaLabel),
36
+ onClick: onDismiss,
37
+ children: /*#__PURE__*/jsxRuntime.jsx(icons.Cross, {})
38
+ }), actions && /*#__PURE__*/jsxRuntime.jsx("div", {
31
39
  className: "wds-prompt__actions-wrapper",
32
40
  children: actions
33
41
  })]
34
- }), onDismiss && /*#__PURE__*/jsxRuntime.jsx(IconButton.default, {
35
- size: 24,
36
- priority: "secondary",
37
- "aria-label": intl.formatMessage(CloseButton_messages.default.ariaLabel),
38
- onClick: onDismiss,
39
- children: /*#__PURE__*/jsxRuntime.jsx(icons.Cross, {})
40
- })]
42
+ })
41
43
  });
42
44
  };
43
45
 
@@ -1 +1 @@
1
- {"version":3,"file":"PrimitivePrompt.js","sources":["../../../src/prompt/PrimitivePrompt/PrimitivePrompt.tsx"],"sourcesContent":["import { Cross } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport SentimentSurface, { Sentiment } from '../../sentimentSurface';\nimport IconButton from '../../iconButton';\nimport { useIntl } from 'react-intl';\nimport closeBtnMessages from '../../common/closeButton/CloseButton.messages';\nimport { ReactNode } from 'react';\n\nexport type PrimitivePromptProps = {\n /**\n * The sentiment determines the colour scheme\n * @default success\n */\n sentiment?: Sentiment;\n /**\n * Media to be displayed on the prompt (icon/image/etc).\n */\n media: ReactNode;\n /**\n * Any actions to be displayed on the prompt.\n */\n actions?: ReactNode;\n /**\n * Handler called when the close button is clicked. If not provided, then the close button is hidden.\n */\n onDismiss?: () => void;\n id?: string;\n className?: string;\n 'data-testid'?: string;\n children: ReactNode;\n};\n\n/**\n * PrimitivePrompt is a low-level component that provides the structure, sentiment support and styling for various prompts.\n * Uses several css variables to handle styling from within the consuming component, e.g. --Prompt-padding. */\nexport const PrimitivePrompt = ({\n sentiment = 'success',\n media,\n actions,\n onDismiss,\n className,\n children,\n ...restProps\n}: PrimitivePromptProps) => {\n const intl = useIntl();\n\n return (\n <SentimentSurface\n sentiment={sentiment}\n className={clsx('wds-prompt', `wds-prompt--${sentiment}`, className)}\n {...restProps}\n >\n <div className=\"wds-prompt__content-wrapper\">\n <div className={clsx('wds-prompt__media-wrapper')}>{media}</div>\n {children}\n {actions && <div className=\"wds-prompt__actions-wrapper\">{actions}</div>}\n </div>\n {onDismiss && (\n <IconButton\n size={24}\n priority=\"secondary\"\n aria-label={intl.formatMessage(closeBtnMessages.ariaLabel)}\n onClick={onDismiss}\n >\n <Cross />\n </IconButton>\n )}\n </SentimentSurface>\n );\n};\n"],"names":["PrimitivePrompt","sentiment","media","actions","onDismiss","className","children","restProps","intl","useIntl","_jsxs","SentimentSurface","clsx","_jsx","IconButton","size","priority","formatMessage","closeBtnMessages","ariaLabel","onClick","Cross"],"mappings":";;;;;;;;;;AAmCO,MAAMA,eAAe,GAAGA,CAAC;AAC9BC,EAAAA,SAAS,GAAG,SAAS;EACrBC,KAAK;EACLC,OAAO;EACPC,SAAS;EACTC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAS,CACS,KAAI;AACzB,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE;EAEtB,oBACEC,eAAA,CAACC,wBAAgB,EAAA;AACfV,IAAAA,SAAS,EAAEA,SAAU;IACrBI,SAAS,EAAEO,SAAI,CAAC,YAAY,EAAE,eAAeX,SAAS,CAAA,CAAE,EAAEI,SAAS,CAAE;AAAA,IAAA,GACjEE,SAAS;AAAAD,IAAAA,QAAA,gBAEbI,eAAA,CAAA,KAAA,EAAA;AAAKL,MAAAA,SAAS,EAAC,6BAA6B;AAAAC,MAAAA,QAAA,gBAC1CO,cAAA,CAAA,KAAA,EAAA;AAAKR,QAAAA,SAAS,EAAEO,SAAI,CAAC,2BAA2B,CAAE;AAAAN,QAAAA,QAAA,EAAEJ;AAAK,OAAM,CAC/D,EAACI,QAAQ,EACRH,OAAO,iBAAIU,cAAA,CAAA,KAAA,EAAA;AAAKR,QAAAA,SAAS,EAAC,6BAA6B;AAAAC,QAAAA,QAAA,EAAEH;AAAO,OAAM,CAAC;AAAA,KACrE,CACL,EAACC,SAAS,iBACRS,cAAA,CAACC,kBAAU,EAAA;AACTC,MAAAA,IAAI,EAAE,EAAG;AACTC,MAAAA,QAAQ,EAAC,WAAW;AACpB,MAAA,YAAA,EAAYR,IAAI,CAACS,aAAa,CAACC,4BAAgB,CAACC,SAAS,CAAE;AAC3DC,MAAAA,OAAO,EAAEhB,SAAU;AAAAE,MAAAA,QAAA,eAEnBO,cAAA,CAACQ,WAAK,EAAA,EAAA;AACR,KAAY,CACb;AAAA,GACe,CAAC;AAEvB;;;;"}
1
+ {"version":3,"file":"PrimitivePrompt.js","sources":["../../../src/prompt/PrimitivePrompt/PrimitivePrompt.tsx"],"sourcesContent":["import { Cross } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport SentimentSurface, { Sentiment } from '../../sentimentSurface';\nimport IconButton from '../../iconButton';\nimport { useIntl } from 'react-intl';\nimport closeBtnMessages from '../../common/closeButton/CloseButton.messages';\nimport { ReactNode } from 'react';\n\nexport type PrimitivePromptProps = {\n /**\n * The sentiment determines the colour scheme\n * @default success\n */\n sentiment?: Sentiment;\n /**\n * Media to be displayed on the prompt (icon/image/etc).\n */\n media: ReactNode;\n /**\n * Any actions to be displayed on the prompt.\n */\n actions?: ReactNode;\n /**\n * Handler called when the close button is clicked. If not provided, then the close button is hidden.\n */\n onDismiss?: () => void;\n id?: string;\n className?: string;\n 'data-testid'?: string;\n children: ReactNode;\n};\n\n/**\n * PrimitivePrompt is a low-level component that provides the structure, sentiment support and styling for various prompts.\n * Uses several css variables to handle styling from within the consuming component, e.g. --Prompt-padding. */\nexport const PrimitivePrompt = ({\n sentiment = 'success',\n media,\n actions,\n onDismiss,\n className,\n children,\n ...restProps\n}: PrimitivePromptProps) => {\n const intl = useIntl();\n\n return (\n <SentimentSurface\n sentiment={sentiment}\n className={clsx('wds-prompt', `wds-prompt--${sentiment}`, className)}\n {...restProps}\n >\n <div\n className={clsx('wds-prompt__content-wrapper', {\n 'wds-prompt__content-wrapper--with-dismiss': !!onDismiss,\n })}\n >\n <div className={clsx('wds-prompt__media-wrapper')}>{media}</div>\n {children}\n {onDismiss && (\n <IconButton\n size={24}\n priority=\"secondary\"\n aria-label={intl.formatMessage(closeBtnMessages.ariaLabel)}\n onClick={onDismiss}\n >\n <Cross />\n </IconButton>\n )}\n {actions && <div className=\"wds-prompt__actions-wrapper\">{actions}</div>}\n </div>\n </SentimentSurface>\n );\n};\n"],"names":["PrimitivePrompt","sentiment","media","actions","onDismiss","className","children","restProps","intl","useIntl","_jsx","SentimentSurface","clsx","_jsxs","IconButton","size","priority","formatMessage","closeBtnMessages","ariaLabel","onClick","Cross"],"mappings":";;;;;;;;;;AAmCO,MAAMA,eAAe,GAAGA,CAAC;AAC9BC,EAAAA,SAAS,GAAG,SAAS;EACrBC,KAAK;EACLC,OAAO;EACPC,SAAS;EACTC,SAAS;EACTC,QAAQ;EACR,GAAGC;AAAS,CACS,KAAI;AACzB,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE;EAEtB,oBACEC,cAAA,CAACC,wBAAgB,EAAA;AACfV,IAAAA,SAAS,EAAEA,SAAU;IACrBI,SAAS,EAAEO,SAAI,CAAC,YAAY,EAAE,eAAeX,SAAS,CAAA,CAAE,EAAEI,SAAS,CAAE;AAAA,IAAA,GACjEE,SAAS;AAAAD,IAAAA,QAAA,eAEbO,eAAA,CAAA,KAAA,EAAA;AACER,MAAAA,SAAS,EAAEO,SAAI,CAAC,6BAA6B,EAAE;QAC7C,2CAA2C,EAAE,CAAC,CAACR;AAChD,OAAA,CAAE;AAAAE,MAAAA,QAAA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