@transferwise/components 0.0.0-experimental-dd50468 → 0.0.0-experimental-e77309f

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 (50) hide show
  1. package/build/alert/Alert.js +52 -49
  2. package/build/alert/Alert.js.map +1 -1
  3. package/build/alert/Alert.mjs +53 -50
  4. package/build/alert/Alert.mjs.map +1 -1
  5. package/build/i18n/en.json +0 -2
  6. package/build/i18n/en.json.js +0 -2
  7. package/build/i18n/en.json.js.map +1 -1
  8. package/build/i18n/en.json.mjs +0 -2
  9. package/build/i18n/en.json.mjs.map +1 -1
  10. package/build/main.css +0 -214
  11. package/build/styles/main.css +0 -214
  12. package/build/types/alert/Alert.d.ts +3 -1
  13. package/build/types/alert/Alert.d.ts.map +1 -1
  14. package/package.json +3 -3
  15. package/src/alert/Alert.spec.tsx +20 -0
  16. package/src/alert/Alert.story.tsx +50 -2
  17. package/src/alert/Alert.tsx +57 -50
  18. package/src/i18n/en.json +0 -2
  19. package/src/main.css +0 -214
  20. package/src/main.less +0 -1
  21. package/build/styles/table/Table.css +0 -214
  22. package/build/types/table/Table.d.ts +0 -23
  23. package/build/types/table/Table.d.ts.map +0 -1
  24. package/build/types/table/Table.messages.d.ts +0 -12
  25. package/build/types/table/Table.messages.d.ts.map +0 -1
  26. package/build/types/table/TableCell.d.ts +0 -37
  27. package/build/types/table/TableCell.d.ts.map +0 -1
  28. package/build/types/table/TableHeader.d.ts +0 -12
  29. package/build/types/table/TableHeader.d.ts.map +0 -1
  30. package/build/types/table/TableRow.d.ts +0 -17
  31. package/build/types/table/TableRow.d.ts.map +0 -1
  32. package/build/types/table/TableStatusText.d.ts +0 -9
  33. package/build/types/table/TableStatusText.d.ts.map +0 -1
  34. package/build/types/table/index.d.ts +0 -6
  35. package/build/types/table/index.d.ts.map +0 -1
  36. package/src/table/Table.css +0 -214
  37. package/src/table/Table.less +0 -253
  38. package/src/table/Table.messages.ts +0 -12
  39. package/src/table/Table.spec.tsx +0 -80
  40. package/src/table/Table.story.tsx +0 -352
  41. package/src/table/Table.tsx +0 -121
  42. package/src/table/TableCell.spec.tsx +0 -161
  43. package/src/table/TableCell.tsx +0 -143
  44. package/src/table/TableHeader.spec.tsx +0 -58
  45. package/src/table/TableHeader.tsx +0 -50
  46. package/src/table/TableRow.spec.tsx +0 -69
  47. package/src/table/TableRow.tsx +0 -62
  48. package/src/table/TableStatusText.spec.tsx +0 -42
  49. package/src/table/TableStatusText.tsx +0 -35
  50. package/src/table/index.ts +0 -11
@@ -49,7 +49,8 @@ function Alert({
49
49
  size: size$1,
50
50
  title,
51
51
  type = 'neutral',
52
- variant = 'desktop'
52
+ variant = 'desktop',
53
+ active = true
53
54
  }) {
54
55
  React.useEffect(() => {
55
56
  if (arrow !== undefined) {
@@ -79,58 +80,60 @@ function Alert({
79
80
  }, [resolvedType, type]);
80
81
  const [shouldFire, setShouldFire] = React.useState(false);
81
82
  const closeButtonReference = React.useRef(null);
82
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
83
- className: clsx.clsx('alert d-flex', `alert-${resolvedType}`, arrow != null && alertArrowClassNames(arrow), className),
84
- "data-testid": "alert",
85
- onTouchStart: () => setShouldFire(true),
86
- onTouchEnd: event => {
87
- if (shouldFire && action?.href &&
88
- // Check if current event is triggered from closeButton
89
- event.target instanceof Node && closeButtonReference.current && !closeButtonReference.current.contains(event.target)) {
90
- if (action.target === '_blank') {
91
- window.top?.open(action.href);
92
- } else {
93
- window.top?.location.assign(action.href);
83
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
84
+ role: resolvedType === sentiment.Sentiment.NEGATIVE ? 'alert' : 'status',
85
+ children: active && /*#__PURE__*/jsxRuntime.jsxs("div", {
86
+ className: clsx.clsx('alert d-flex', `alert-${resolvedType}`, arrow != null && alertArrowClassNames(arrow), className),
87
+ "data-testid": "alert",
88
+ onTouchStart: () => setShouldFire(true),
89
+ onTouchEnd: event => {
90
+ if (shouldFire && action?.href &&
91
+ // Check if current event is triggered from closeButton
92
+ event.target instanceof Node && closeButtonReference.current && !closeButtonReference.current.contains(event.target)) {
93
+ if (action.target === '_blank') {
94
+ window.top?.open(action.href);
95
+ } else {
96
+ window.top?.location.assign(action.href);
97
+ }
94
98
  }
95
- }
96
- setShouldFire(false);
97
- },
98
- onTouchMove: () => setShouldFire(false),
99
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
100
- className: clsx.clsx('alert__content', 'd-flex', 'flex-grow-1', variant),
101
- "data-testid": variant,
102
- children: [icon ? /*#__PURE__*/jsxRuntime.jsx("div", {
103
- className: "alert__icon",
104
- children: icon
105
- }) : /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
106
- size: size.Size.LARGE,
107
- sentiment: resolvedType
108
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
109
- className: "alert__message",
110
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
111
- role: sentiment.Sentiment.NEGATIVE === resolvedType ? 'alert' : 'status',
112
- children: [title && /*#__PURE__*/jsxRuntime.jsx(Title, {
113
- className: "m-b-1",
114
- type: typography.Typography.TITLE_BODY,
115
- children: title
116
- }), /*#__PURE__*/jsxRuntime.jsx(Body, {
117
- as: "span",
118
- className: "d-block",
119
- type: typography.Typography.BODY_LARGE,
120
- children: children || /*#__PURE__*/jsxRuntime.jsx(InlineMarkdown, {
121
- children: message
122
- })
99
+ setShouldFire(false);
100
+ },
101
+ onTouchMove: () => setShouldFire(false),
102
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
103
+ className: clsx.clsx('alert__content', 'd-flex', 'flex-grow-1', variant),
104
+ "data-testid": variant,
105
+ children: [icon ? /*#__PURE__*/jsxRuntime.jsx("div", {
106
+ className: "alert__icon",
107
+ children: icon
108
+ }) : /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
109
+ size: size.Size.LARGE,
110
+ sentiment: resolvedType
111
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
112
+ className: "alert__message",
113
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
114
+ children: [title && /*#__PURE__*/jsxRuntime.jsx(Title, {
115
+ className: "m-b-1",
116
+ type: typography.Typography.TITLE_BODY,
117
+ children: title
118
+ }), /*#__PURE__*/jsxRuntime.jsx(Body, {
119
+ as: "span",
120
+ className: "d-block",
121
+ type: typography.Typography.BODY_LARGE,
122
+ children: children || /*#__PURE__*/jsxRuntime.jsx(InlineMarkdown, {
123
+ children: message
124
+ })
125
+ })]
126
+ }), action && /*#__PURE__*/jsxRuntime.jsx(Action.Action, {
127
+ action: action,
128
+ className: "m-t-1"
123
129
  })]
124
- }), action && /*#__PURE__*/jsxRuntime.jsx(Action.Action, {
125
- action: action,
126
- className: "m-t-1"
127
130
  })]
131
+ }), onDismiss && /*#__PURE__*/jsxRuntime.jsx(CloseButton.CloseButton, {
132
+ ref: closeButtonReference,
133
+ className: "m-l-2",
134
+ onClick: onDismiss
128
135
  })]
129
- }), onDismiss && /*#__PURE__*/jsxRuntime.jsx(CloseButton.CloseButton, {
130
- ref: closeButtonReference,
131
- className: "m-l-2",
132
- onClick: onDismiss
133
- })]
136
+ })
134
137
  });
135
138
  }
136
139
  function alertArrowClassNames(arrow) {
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.js","sources":["../../src/alert/Alert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useState, useRef, useEffect } from 'react';\n\nimport Body from '../body/Body';\nimport { Sentiment, Size, Typography, Variant } from '../common';\nimport { CloseButton } from '../common/closeButton';\nimport StatusIcon from '../statusIcon';\nimport Title from '../title/Title';\nimport { logActionRequired } from '../utilities';\n\nimport InlineMarkdown from './inlineMarkdown';\nimport { Action } from '../common/action/Action';\n\nexport type AlertAction = {\n 'aria-label'?: string;\n href?: string;\n target?: string;\n text: React.ReactNode;\n onClick?: () => void;\n};\n\n/** @deprecated Use `\"top\" | \"bottom\"` instead. */\ntype AlertTypeDeprecated = `${Sentiment.SUCCESS | Sentiment.INFO | Sentiment.ERROR}`;\ntype AlertTypeResolved = `${\n | Sentiment.POSITIVE\n | Sentiment.NEUTRAL\n | Sentiment.WARNING\n | Sentiment.NEGATIVE}`;\nexport type AlertType = AlertTypeResolved | AlertTypeDeprecated;\n\nexport enum AlertArrowPosition {\n TOP_LEFT = 'up-left',\n TOP = 'up-center',\n TOP_RIGHT = 'up-right',\n BOTTOM_LEFT = 'down-left',\n BOTTOM = 'down-center',\n BOTTOM_RIGHT = 'down-right',\n}\n\nexport interface AlertProps {\n /** An optional call to action to sit under the main body of the alert. If your label is short, use aria-label to provide more context */\n action?: AlertAction;\n className?: string;\n /** An optional icon. If not provided, we will default the icon to something appropriate for the type */\n icon?: React.ReactNode;\n /** Title for the alert component */\n title?: string;\n /** The main body of the alert. Accepts plain text and bold words specified with **double stars */\n message?: string;\n /** The presence of the onDismiss handler will trigger the visibility of the close button */\n onDismiss?: React.MouseEventHandler<HTMLButtonElement>;\n /** The type dictates which icon and colour will be used */\n type?: AlertType;\n variant?: `${Variant}`;\n /** @deprecated Use `InlineAlert` instead. */\n arrow?: `${AlertArrowPosition}`;\n /** @deprecated Use `message` instead. Be aware `message` only accepts plain text or text with **bold** markdown. */\n children?: React.ReactNode;\n /** @deprecated Use `onDismiss` instead. */\n dismissible?: boolean;\n /** @deprecated Alert component doesn't support `size` anymore, please remove this prop. */\n size?: `${Size}`;\n}\n\nfunction resolveType(type: AlertType): AlertTypeResolved {\n switch (type) {\n case 'success':\n return 'positive';\n case 'info':\n return 'neutral';\n case 'error':\n return 'negative';\n default:\n return type;\n }\n}\n\nexport default function Alert({\n arrow,\n action,\n children,\n className,\n dismissible,\n icon,\n onDismiss,\n message,\n size,\n title,\n type = 'neutral',\n variant = 'desktop',\n}: AlertProps) {\n useEffect(() => {\n if (arrow !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'arrow' anymore, use 'InlineAlert' instead.\",\n );\n }\n }, [arrow]);\n\n useEffect(() => {\n if (children !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'children' anymore, use 'message' instead.\",\n );\n }\n }, [children]);\n\n useEffect(() => {\n if (dismissible !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'dismissible' anymore, use 'onDismiss' instead.\",\n );\n }\n }, [dismissible]);\n\n useEffect(() => {\n if (size !== undefined) {\n logActionRequired(\"Alert component doesn't support 'size' anymore, please remove that prop.\");\n }\n }, [size]);\n\n const resolvedType = resolveType(type);\n useEffect(() => {\n if (resolvedType !== type) {\n logActionRequired(\n `Alert component has deprecated '${type}' value for the 'type' prop. Please use '${resolvedType}' instead.`,\n );\n }\n }, [resolvedType, type]);\n\n const [shouldFire, setShouldFire] = useState(false);\n\n const closeButtonReference = useRef<HTMLButtonElement>(null);\n\n return (\n <div\n className={clsx(\n 'alert d-flex',\n `alert-${resolvedType}`,\n arrow != null && alertArrowClassNames(arrow),\n className,\n )}\n data-testid=\"alert\"\n onTouchStart={() => setShouldFire(true)}\n onTouchEnd={(event) => {\n if (\n shouldFire &&\n action?.href &&\n // Check if current event is triggered from closeButton\n event.target instanceof Node &&\n closeButtonReference.current &&\n !closeButtonReference.current.contains(event.target)\n ) {\n if (action.target === '_blank') {\n window.top?.open(action.href);\n } else {\n window.top?.location.assign(action.href);\n }\n }\n setShouldFire(false);\n }}\n onTouchMove={() => setShouldFire(false)}\n >\n <div\n className={clsx('alert__content', 'd-flex', 'flex-grow-1', variant)}\n data-testid={variant}\n >\n {icon ? (\n <div className=\"alert__icon\">{icon}</div>\n ) : (\n <StatusIcon size={Size.LARGE} sentiment={resolvedType} />\n )}\n <div className=\"alert__message\">\n <div role={Sentiment.NEGATIVE === resolvedType ? 'alert' : 'status'}>\n {title && (\n <Title className=\"m-b-1\" type={Typography.TITLE_BODY}>\n {title}\n </Title>\n )}\n <Body as=\"span\" className=\"d-block\" type={Typography.BODY_LARGE}>\n {children || <InlineMarkdown>{message}</InlineMarkdown>}\n </Body>\n </div>\n {action && <Action action={action} className=\"m-t-1\" />}\n </div>\n </div>\n {onDismiss && (\n <CloseButton ref={closeButtonReference} className=\"m-l-2\" onClick={onDismiss} />\n )}\n </div>\n );\n}\n\nfunction alertArrowClassNames(arrow: `${AlertArrowPosition}`) {\n switch (arrow) {\n case 'down-center':\n return 'arrow arrow-bottom arrow-center';\n case 'down-left':\n return 'arrow arrow-bottom arrow-left';\n case 'down-right':\n return 'arrow arrow-bottom arrow-right';\n case 'up-center':\n return 'arrow arrow-center';\n case 'up-right':\n return 'arrow arrow-right';\n case 'up-left':\n default:\n return 'arrow';\n }\n}\n"],"names":["AlertArrowPosition","resolveType","type","Alert","arrow","action","children","className","dismissible","icon","onDismiss","message","size","title","variant","useEffect","undefined","logActionRequired","resolvedType","shouldFire","setShouldFire","useState","closeButtonReference","useRef","_jsxs","clsx","alertArrowClassNames","onTouchStart","onTouchEnd","event","href","target","Node","current","contains","window","top","open","location","assign","onTouchMove","_jsx","StatusIcon","Size","LARGE","sentiment","role","Sentiment","NEGATIVE","Title","Typography","TITLE_BODY","Body","as","BODY_LARGE","InlineMarkdown","Action","CloseButton","ref","onClick"],"mappings":";;;;;;;;;;;;;;;;;;AA8BYA,oCAOX;AAPD,CAAA,UAAYA,kBAAkB,EAAA;AAC5BA,EAAAA,kBAAA,CAAA,UAAA,CAAA,GAAA,SAAoB,CAAA;AACpBA,EAAAA,kBAAA,CAAA,KAAA,CAAA,GAAA,WAAiB,CAAA;AACjBA,EAAAA,kBAAA,CAAA,WAAA,CAAA,GAAA,UAAsB,CAAA;AACtBA,EAAAA,kBAAA,CAAA,aAAA,CAAA,GAAA,WAAyB,CAAA;AACzBA,EAAAA,kBAAA,CAAA,QAAA,CAAA,GAAA,aAAsB,CAAA;AACtBA,EAAAA,kBAAA,CAAA,cAAA,CAAA,GAAA,YAA2B,CAAA;AAC7B,CAAC,EAPWA,0BAAkB,KAAlBA,0BAAkB,GAO7B,EAAA,CAAA,CAAA,CAAA;AA2BD,SAASC,WAAWA,CAACC,IAAe,EAAA;AAClC,EAAA,QAAQA,IAAI;AACV,IAAA,KAAK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AAACnD,UAAAA,MAAM,EAAEA,MAAO;AAACE,UAAAA,SAAS,EAAC,OAAA;AAAO,UAAG,CAAA;AAAA,OACpD,CACP,CAAA;AAAA,KAAK,CACL,EAACG,SAAS,iBACR+B,cAAA,CAACgB,uBAAW,EAAA;AAACC,MAAAA,GAAG,EAAEpC,oBAAqB;AAACf,MAAAA,SAAS,EAAC,OAAO;AAACoD,MAAAA,OAAO,EAAEjD,SAAAA;AAAU,KAAG,CACjF,CAAA;AAAA,GACE,CAAC,CAAA;AAEV,CAAA;AAEA,SAASgB,oBAAoBA,CAACtB,KAA8B,EAAA;AAC1D,EAAA,QAAQA,KAAK;AACX,IAAA,KAAK,aAAa;AAChB,MAAA,OAAO,iCAAiC,CAAA;AAC1C,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,+BAA+B,CAAA;AACxC,IAAA,KAAK,YAAY;AACf,MAAA,OAAO,gCAAgC,CAAA;AACzC,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,oBAAoB,CAAA;AAC7B,IAAA,KAAK,UAAU;AACb,MAAA,OAAO,mBAAmB,CAAA;AAC5B,IAAA,KAAK,SAAS,CAAA;AACd,IAAA;AACE,MAAA,OAAO,OAAO,CAAA;AAClB,GAAA;AACF;;;;"}
1
+ {"version":3,"file":"Alert.js","sources":["../../src/alert/Alert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useState, useRef, useEffect } from 'react';\n\nimport Body from '../body/Body';\nimport { Sentiment, Size, Typography, Variant } from '../common';\nimport { CloseButton } from '../common/closeButton';\nimport StatusIcon from '../statusIcon';\nimport Title from '../title/Title';\nimport { logActionRequired } from '../utilities';\n\nimport InlineMarkdown from './inlineMarkdown';\nimport { Action } from '../common/action/Action';\n\nexport type AlertAction = {\n 'aria-label'?: string;\n href?: string;\n target?: string;\n text: React.ReactNode;\n onClick?: () => void;\n};\n\n/** @deprecated Use `\"top\" | \"bottom\"` instead. */\ntype AlertTypeDeprecated = `${Sentiment.SUCCESS | Sentiment.INFO | Sentiment.ERROR}`;\ntype AlertTypeResolved = `${\n | Sentiment.POSITIVE\n | Sentiment.NEUTRAL\n | Sentiment.WARNING\n | Sentiment.NEGATIVE}`;\nexport type AlertType = AlertTypeResolved | AlertTypeDeprecated;\n\nexport enum AlertArrowPosition {\n TOP_LEFT = 'up-left',\n TOP = 'up-center',\n TOP_RIGHT = 'up-right',\n BOTTOM_LEFT = 'down-left',\n BOTTOM = 'down-center',\n BOTTOM_RIGHT = 'down-right',\n}\n\nexport interface AlertProps {\n /** An optional call to action to sit under the main body of the alert. If your label is short, use aria-label to provide more context */\n action?: AlertAction;\n className?: string;\n /** An optional icon. If not provided, we will default the icon to something appropriate for the type */\n icon?: React.ReactNode;\n /** Title for the alert component */\n title?: string;\n /** The main body of the alert. Accepts plain text and bold words specified with **double stars */\n message?: string;\n /** The presence of the onDismiss handler will trigger the visibility of the close button */\n onDismiss?: React.MouseEventHandler<HTMLButtonElement>;\n /** The type dictates which icon and colour will be used */\n type?: AlertType;\n variant?: `${Variant}`;\n /** Toggle to make it work with ARIA Live Region */\n active?: boolean;\n /** @deprecated Use `InlineAlert` instead. */\n arrow?: `${AlertArrowPosition}`;\n /** @deprecated Use `message` instead. Be aware `message` only accepts plain text or text with **bold** markdown. */\n children?: React.ReactNode;\n /** @deprecated Use `onDismiss` instead. */\n dismissible?: boolean;\n /** @deprecated Alert component doesn't support `size` anymore, please remove this prop. */\n size?: `${Size}`;\n}\n\nfunction resolveType(type: AlertType): AlertTypeResolved {\n switch (type) {\n case 'success':\n return 'positive';\n case 'info':\n return 'neutral';\n case 'error':\n return 'negative';\n default:\n return type;\n }\n}\n\nexport default function Alert({\n arrow,\n action,\n children,\n className,\n dismissible,\n icon,\n onDismiss,\n message,\n size,\n title,\n type = 'neutral',\n variant = 'desktop',\n active = true,\n}: AlertProps) {\n useEffect(() => {\n if (arrow !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'arrow' anymore, use 'InlineAlert' instead.\",\n );\n }\n }, [arrow]);\n\n useEffect(() => {\n if (children !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'children' anymore, use 'message' instead.\",\n );\n }\n }, [children]);\n\n useEffect(() => {\n if (dismissible !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'dismissible' anymore, use 'onDismiss' instead.\",\n );\n }\n }, [dismissible]);\n\n useEffect(() => {\n if (size !== undefined) {\n logActionRequired(\"Alert component doesn't support 'size' anymore, please remove that prop.\");\n }\n }, [size]);\n\n const resolvedType = resolveType(type);\n useEffect(() => {\n if (resolvedType !== type) {\n logActionRequired(\n `Alert component has deprecated '${type}' value for the 'type' prop. Please use '${resolvedType}' instead.`,\n );\n }\n }, [resolvedType, type]);\n\n const [shouldFire, setShouldFire] = useState(false);\n\n const closeButtonReference = useRef<HTMLButtonElement>(null);\n\n return (\n <div role={resolvedType === Sentiment.NEGATIVE ? 'alert' : 'status'}>\n {active && (\n <div\n className={clsx(\n 'alert d-flex',\n `alert-${resolvedType}`,\n arrow != null && alertArrowClassNames(arrow),\n className,\n )}\n data-testid=\"alert\"\n onTouchStart={() => setShouldFire(true)}\n onTouchEnd={(event) => {\n if (\n shouldFire &&\n action?.href &&\n // Check if current event is triggered from closeButton\n event.target instanceof Node &&\n closeButtonReference.current &&\n !closeButtonReference.current.contains(event.target)\n ) {\n if (action.target === '_blank') {\n window.top?.open(action.href);\n } else {\n window.top?.location.assign(action.href);\n }\n }\n setShouldFire(false);\n }}\n onTouchMove={() => setShouldFire(false)}\n >\n <div\n className={clsx('alert__content', 'd-flex', 'flex-grow-1', variant)}\n data-testid={variant}\n >\n {icon ? (\n <div className=\"alert__icon\">{icon}</div>\n ) : (\n <StatusIcon size={Size.LARGE} sentiment={resolvedType} />\n )}\n <div className=\"alert__message\">\n <div>\n {title && (\n <Title className=\"m-b-1\" type={Typography.TITLE_BODY}>\n {title}\n </Title>\n )}\n <Body as=\"span\" className=\"d-block\" type={Typography.BODY_LARGE}>\n {children || <InlineMarkdown>{message}</InlineMarkdown>}\n </Body>\n </div>\n {action && <Action action={action} className=\"m-t-1\" />}\n </div>\n </div>\n {onDismiss && (\n <CloseButton ref={closeButtonReference} className=\"m-l-2\" onClick={onDismiss} />\n )}\n </div>\n )}\n </div>\n );\n}\n\nfunction alertArrowClassNames(arrow: `${AlertArrowPosition}`) {\n switch (arrow) {\n case 'down-center':\n return 'arrow arrow-bottom arrow-center';\n case 'down-left':\n return 'arrow arrow-bottom arrow-left';\n case 'down-right':\n return 'arrow arrow-bottom arrow-right';\n case 'up-center':\n return 'arrow arrow-center';\n case 'up-right':\n return 'arrow arrow-right';\n case 'up-left':\n default:\n return 'arrow';\n }\n}\n"],"names":["AlertArrowPosition","resolveType","type","Alert","arrow","action","children","className","dismissible","icon","onDismiss","message","size","title","variant","active","useEffect","undefined","logActionRequired","resolvedType","shouldFire","setShouldFire","useState","closeButtonReference","useRef","_jsx","role","Sentiment","NEGATIVE","_jsxs","clsx","alertArrowClassNames","onTouchStart","onTouchEnd","event","href","target","Node","current","contains","window","top","open","location","assign","onTouchMove","StatusIcon","Size","LARGE","sentiment","Title","Typography","TITLE_BODY","Body","as","BODY_LARGE","InlineMarkdown","Action","CloseButton","ref","onClick"],"mappings":";;;;;;;;;;;;;;;;;;AA8BYA,oCAOX;AAPD,CAAA,UAAYA,kBAAkB,EAAA;AAC5BA,EAAAA,kBAAA,CAAA,UAAA,CAAA,GAAA,SAAoB,CAAA;AACpBA,EAAAA,kBAAA,CAAA,KAAA,CAAA,GAAA,WAAiB,CAAA;AACjBA,EAAAA,kBAAA,CAAA,WAAA,CAAA,GAAA,UAAsB,CAAA;AACtBA,EAAAA,kBAAA,CAAA,aAAA,CAAA,GAAA,WAAyB,CAAA;AACzBA,EAAAA,kBAAA,CAAA,QAAA,CAAA,GAAA,aAAsB,CAAA;AACtBA,EAAAA,kBAAA,CAAA,cAAA,CAAA,GAAA,YAA2B,CAAA;AAC7B,CAAC,EAPWA,0BAAkB,KAAlBA,0BAAkB,GAO7B,EAAA,CAAA,CAA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AC7DA,QAAQ,iBAAImB,cAAA,CAAC+B,cAAc,EAAA;AAAAlD,gBAAAA,QAAA,EAAEK,OAAAA;eAAwB,CAAA;AAAC,aACnD,CACR,CAAA;AAAA,WAAK,CACL,EAACN,MAAM,iBAAIoB,cAAA,CAACgC,aAAM,EAAA;AAACpD,YAAAA,MAAM,EAAEA,MAAO;AAACE,YAAAA,SAAS,EAAC,OAAA;AAAO,YAAG,CAAA;AAAA,SACpD,CACP,CAAA;AAAA,OAAK,CACL,EAACG,SAAS,iBACRe,cAAA,CAACiC,uBAAW,EAAA;AAACC,QAAAA,GAAG,EAAEpC,oBAAqB;AAAChB,QAAAA,SAAS,EAAC,OAAO;AAACqD,QAAAA,OAAO,EAAElD,SAAAA;AAAU,OAAG,CACjF,CAAA;KACE,CAAA;AACN,GACE,CAAC,CAAA;AAEV,CAAA;AAEA,SAASqB,oBAAoBA,CAAC3B,KAA8B,EAAA;AAC1D,EAAA,QAAQA,KAAK;AACX,IAAA,KAAK,aAAa;AAChB,MAAA,OAAO,iCAAiC,CAAA;AAC1C,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,+BAA+B,CAAA;AACxC,IAAA,KAAK,YAAY;AACf,MAAA,OAAO,gCAAgC,CAAA;AACzC,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,oBAAoB,CAAA;AAC7B,IAAA,KAAK,UAAU;AACb,MAAA,OAAO,mBAAmB,CAAA;AAC5B,IAAA,KAAK,SAAS,CAAA;AACd,IAAA;AACE,MAAA,OAAO,OAAO,CAAA;AAClB,GAAA;AACF;;;;"}
@@ -6,7 +6,7 @@ import StatusIcon from '../statusIcon/StatusIcon.mjs';
6
6
  import Title from '../title/Title.mjs';
7
7
  import InlineMarkdown from './inlineMarkdown/InlineMarkdown.mjs';
8
8
  import { Action } from '../common/action/Action.mjs';
9
- import { jsxs, jsx } from 'react/jsx-runtime';
9
+ import { jsx, jsxs } from 'react/jsx-runtime';
10
10
  import { logActionRequired } from '../utilities/logActionRequired.mjs';
11
11
  import { Sentiment } from '../common/propsValues/sentiment.mjs';
12
12
  import { Size } from '../common/propsValues/size.mjs';
@@ -45,7 +45,8 @@ function Alert({
45
45
  size,
46
46
  title,
47
47
  type = 'neutral',
48
- variant = 'desktop'
48
+ variant = 'desktop',
49
+ active = true
49
50
  }) {
50
51
  useEffect(() => {
51
52
  if (arrow !== undefined) {
@@ -75,58 +76,60 @@ function Alert({
75
76
  }, [resolvedType, type]);
76
77
  const [shouldFire, setShouldFire] = useState(false);
77
78
  const closeButtonReference = useRef(null);
78
- return /*#__PURE__*/jsxs("div", {
79
- className: clsx('alert d-flex', `alert-${resolvedType}`, arrow != null && alertArrowClassNames(arrow), className),
80
- "data-testid": "alert",
81
- onTouchStart: () => setShouldFire(true),
82
- onTouchEnd: event => {
83
- if (shouldFire && action?.href &&
84
- // Check if current event is triggered from closeButton
85
- event.target instanceof Node && closeButtonReference.current && !closeButtonReference.current.contains(event.target)) {
86
- if (action.target === '_blank') {
87
- window.top?.open(action.href);
88
- } else {
89
- window.top?.location.assign(action.href);
79
+ return /*#__PURE__*/jsx("div", {
80
+ role: resolvedType === Sentiment.NEGATIVE ? 'alert' : 'status',
81
+ children: active && /*#__PURE__*/jsxs("div", {
82
+ className: clsx('alert d-flex', `alert-${resolvedType}`, arrow != null && alertArrowClassNames(arrow), className),
83
+ "data-testid": "alert",
84
+ onTouchStart: () => setShouldFire(true),
85
+ onTouchEnd: event => {
86
+ if (shouldFire && action?.href &&
87
+ // Check if current event is triggered from closeButton
88
+ event.target instanceof Node && closeButtonReference.current && !closeButtonReference.current.contains(event.target)) {
89
+ if (action.target === '_blank') {
90
+ window.top?.open(action.href);
91
+ } else {
92
+ window.top?.location.assign(action.href);
93
+ }
90
94
  }
91
- }
92
- setShouldFire(false);
93
- },
94
- onTouchMove: () => setShouldFire(false),
95
- children: [/*#__PURE__*/jsxs("div", {
96
- className: clsx('alert__content', 'd-flex', 'flex-grow-1', variant),
97
- "data-testid": variant,
98
- children: [icon ? /*#__PURE__*/jsx("div", {
99
- className: "alert__icon",
100
- children: icon
101
- }) : /*#__PURE__*/jsx(StatusIcon, {
102
- size: Size.LARGE,
103
- sentiment: resolvedType
104
- }), /*#__PURE__*/jsxs("div", {
105
- className: "alert__message",
106
- children: [/*#__PURE__*/jsxs("div", {
107
- role: Sentiment.NEGATIVE === resolvedType ? 'alert' : 'status',
108
- children: [title && /*#__PURE__*/jsx(Title, {
109
- className: "m-b-1",
110
- type: Typography.TITLE_BODY,
111
- children: title
112
- }), /*#__PURE__*/jsx(Body, {
113
- as: "span",
114
- className: "d-block",
115
- type: Typography.BODY_LARGE,
116
- children: children || /*#__PURE__*/jsx(InlineMarkdown, {
117
- children: message
118
- })
95
+ setShouldFire(false);
96
+ },
97
+ onTouchMove: () => setShouldFire(false),
98
+ children: [/*#__PURE__*/jsxs("div", {
99
+ className: clsx('alert__content', 'd-flex', 'flex-grow-1', variant),
100
+ "data-testid": variant,
101
+ children: [icon ? /*#__PURE__*/jsx("div", {
102
+ className: "alert__icon",
103
+ children: icon
104
+ }) : /*#__PURE__*/jsx(StatusIcon, {
105
+ size: Size.LARGE,
106
+ sentiment: resolvedType
107
+ }), /*#__PURE__*/jsxs("div", {
108
+ className: "alert__message",
109
+ children: [/*#__PURE__*/jsxs("div", {
110
+ children: [title && /*#__PURE__*/jsx(Title, {
111
+ className: "m-b-1",
112
+ type: Typography.TITLE_BODY,
113
+ children: title
114
+ }), /*#__PURE__*/jsx(Body, {
115
+ as: "span",
116
+ className: "d-block",
117
+ type: Typography.BODY_LARGE,
118
+ children: children || /*#__PURE__*/jsx(InlineMarkdown, {
119
+ children: message
120
+ })
121
+ })]
122
+ }), action && /*#__PURE__*/jsx(Action, {
123
+ action: action,
124
+ className: "m-t-1"
119
125
  })]
120
- }), action && /*#__PURE__*/jsx(Action, {
121
- action: action,
122
- className: "m-t-1"
123
126
  })]
127
+ }), onDismiss && /*#__PURE__*/jsx(CloseButton, {
128
+ ref: closeButtonReference,
129
+ className: "m-l-2",
130
+ onClick: onDismiss
124
131
  })]
125
- }), onDismiss && /*#__PURE__*/jsx(CloseButton, {
126
- ref: closeButtonReference,
127
- className: "m-l-2",
128
- onClick: onDismiss
129
- })]
132
+ })
130
133
  });
131
134
  }
132
135
  function alertArrowClassNames(arrow) {
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.mjs","sources":["../../src/alert/Alert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useState, useRef, useEffect } from 'react';\n\nimport Body from '../body/Body';\nimport { Sentiment, Size, Typography, Variant } from '../common';\nimport { CloseButton } from '../common/closeButton';\nimport StatusIcon from '../statusIcon';\nimport Title from '../title/Title';\nimport { logActionRequired } from '../utilities';\n\nimport InlineMarkdown from './inlineMarkdown';\nimport { Action } from '../common/action/Action';\n\nexport type AlertAction = {\n 'aria-label'?: string;\n href?: string;\n target?: string;\n text: React.ReactNode;\n onClick?: () => void;\n};\n\n/** @deprecated Use `\"top\" | \"bottom\"` instead. */\ntype AlertTypeDeprecated = `${Sentiment.SUCCESS | Sentiment.INFO | Sentiment.ERROR}`;\ntype AlertTypeResolved = `${\n | Sentiment.POSITIVE\n | Sentiment.NEUTRAL\n | Sentiment.WARNING\n | Sentiment.NEGATIVE}`;\nexport type AlertType = AlertTypeResolved | AlertTypeDeprecated;\n\nexport enum AlertArrowPosition {\n TOP_LEFT = 'up-left',\n TOP = 'up-center',\n TOP_RIGHT = 'up-right',\n BOTTOM_LEFT = 'down-left',\n BOTTOM = 'down-center',\n BOTTOM_RIGHT = 'down-right',\n}\n\nexport interface AlertProps {\n /** An optional call to action to sit under the main body of the alert. If your label is short, use aria-label to provide more context */\n action?: AlertAction;\n className?: string;\n /** An optional icon. If not provided, we will default the icon to something appropriate for the type */\n icon?: React.ReactNode;\n /** Title for the alert component */\n title?: string;\n /** The main body of the alert. Accepts plain text and bold words specified with **double stars */\n message?: string;\n /** The presence of the onDismiss handler will trigger the visibility of the close button */\n onDismiss?: React.MouseEventHandler<HTMLButtonElement>;\n /** The type dictates which icon and colour will be used */\n type?: AlertType;\n variant?: `${Variant}`;\n /** @deprecated Use `InlineAlert` instead. */\n arrow?: `${AlertArrowPosition}`;\n /** @deprecated Use `message` instead. Be aware `message` only accepts plain text or text with **bold** markdown. */\n children?: React.ReactNode;\n /** @deprecated Use `onDismiss` instead. */\n dismissible?: boolean;\n /** @deprecated Alert component doesn't support `size` anymore, please remove this prop. */\n size?: `${Size}`;\n}\n\nfunction resolveType(type: AlertType): AlertTypeResolved {\n switch (type) {\n case 'success':\n return 'positive';\n case 'info':\n return 'neutral';\n case 'error':\n return 'negative';\n default:\n return type;\n }\n}\n\nexport default function Alert({\n arrow,\n action,\n children,\n className,\n dismissible,\n icon,\n onDismiss,\n message,\n size,\n title,\n type = 'neutral',\n variant = 'desktop',\n}: AlertProps) {\n useEffect(() => {\n if (arrow !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'arrow' anymore, use 'InlineAlert' instead.\",\n );\n }\n }, [arrow]);\n\n useEffect(() => {\n if (children !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'children' anymore, use 'message' instead.\",\n );\n }\n }, [children]);\n\n useEffect(() => {\n if (dismissible !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'dismissible' anymore, use 'onDismiss' instead.\",\n );\n }\n }, [dismissible]);\n\n useEffect(() => {\n if (size !== undefined) {\n logActionRequired(\"Alert component doesn't support 'size' anymore, please remove that prop.\");\n }\n }, [size]);\n\n const resolvedType = resolveType(type);\n useEffect(() => {\n if (resolvedType !== type) {\n logActionRequired(\n `Alert component has deprecated '${type}' value for the 'type' prop. Please use '${resolvedType}' instead.`,\n );\n }\n }, [resolvedType, type]);\n\n const [shouldFire, setShouldFire] = useState(false);\n\n const closeButtonReference = useRef<HTMLButtonElement>(null);\n\n return (\n <div\n className={clsx(\n 'alert d-flex',\n `alert-${resolvedType}`,\n arrow != null && alertArrowClassNames(arrow),\n className,\n )}\n data-testid=\"alert\"\n onTouchStart={() => setShouldFire(true)}\n onTouchEnd={(event) => {\n if (\n shouldFire &&\n action?.href &&\n // Check if current event is triggered from closeButton\n event.target instanceof Node &&\n closeButtonReference.current &&\n !closeButtonReference.current.contains(event.target)\n ) {\n if (action.target === '_blank') {\n window.top?.open(action.href);\n } else {\n window.top?.location.assign(action.href);\n }\n }\n setShouldFire(false);\n }}\n onTouchMove={() => setShouldFire(false)}\n >\n <div\n className={clsx('alert__content', 'd-flex', 'flex-grow-1', variant)}\n data-testid={variant}\n >\n {icon ? (\n <div className=\"alert__icon\">{icon}</div>\n ) : (\n <StatusIcon size={Size.LARGE} sentiment={resolvedType} />\n )}\n <div className=\"alert__message\">\n <div role={Sentiment.NEGATIVE === resolvedType ? 'alert' : 'status'}>\n {title && (\n <Title className=\"m-b-1\" type={Typography.TITLE_BODY}>\n {title}\n </Title>\n )}\n <Body as=\"span\" className=\"d-block\" type={Typography.BODY_LARGE}>\n {children || <InlineMarkdown>{message}</InlineMarkdown>}\n </Body>\n </div>\n {action && <Action action={action} className=\"m-t-1\" />}\n </div>\n </div>\n {onDismiss && (\n <CloseButton ref={closeButtonReference} className=\"m-l-2\" onClick={onDismiss} />\n )}\n </div>\n );\n}\n\nfunction alertArrowClassNames(arrow: `${AlertArrowPosition}`) {\n switch (arrow) {\n case 'down-center':\n return 'arrow arrow-bottom arrow-center';\n case 'down-left':\n return 'arrow arrow-bottom arrow-left';\n case 'down-right':\n return 'arrow arrow-bottom arrow-right';\n case 'up-center':\n return 'arrow arrow-center';\n case 'up-right':\n return 'arrow arrow-right';\n case 'up-left':\n default:\n return 'arrow';\n }\n}\n"],"names":["AlertArrowPosition","resolveType","type","Alert","arrow","action","children","className","dismissible","icon","onDismiss","message","size","title","variant","useEffect","undefined","logActionRequired","resolvedType","shouldFire","setShouldFire","useState","closeButtonReference","useRef","_jsxs","clsx","alertArrowClassNames","onTouchStart","onTouchEnd","event","href","target","Node","current","contains","window","top","open","location","assign","onTouchMove","_jsx","StatusIcon","Size","LARGE","sentiment","role","Sentiment","NEGATIVE","Title","Typography","TITLE_BODY","Body","as","BODY_LARGE","InlineMarkdown","Action","CloseButton","ref","onClick"],"mappings":";;;;;;;;;;;;;;IA8BYA,mBAOX;AAPD,CAAA,UAAYA,kBAAkB,EAAA;AAC5BA,EAAAA,kBAAA,CAAA,UAAA,CAAA,GAAA,SAAoB,CAAA;AACpBA,EAAAA,kBAAA,CAAA,KAAA,CAAA,GAAA,WAAiB,CAAA;AACjBA,EAAAA,kBAAA,CAAA,WAAA,CAAA,GAAA,UAAsB,CAAA;AACtBA,EAAAA,kBAAA,CAAA,aAAA,CAAA,GAAA,WAAyB,CAAA;AACzBA,EAAAA,kBAAA,CAAA,QAAA,CAAA,GAAA,aAAsB,CAAA;AACtBA,EAAAA,kBAAA,CAAA,cAAA,CAAA,GAAA,YAA2B,CAAA;AAC7B,CAAC,EAPWA,kBAAkB,KAAlBA,kBAAkB,GAO7B,EAAA,CAAA,CAAA,CAAA;AA2BD,SAASC,WAAWA,CAACC,IAAe,EAAA;AAClC,EAAA,QAAQA,IAAI;AACV,IAAA,KAAK,SAAS;AACZ,MAAA,OAAO,UAAU,CAAA;AACnB,IAAA,KAAK,MAAM;AACT,MAAA,OAAO,SAAS,CAAA;AAClB,IAAA,KAAK,OAAO;AACV,MAAA,OAAO,UAAU,CAAA;AACnB,IAAA;AACE,MAAA,OAAOA,IAAI,CAAA;AACf,GAAA;AACF,CAAA;AAEwB,SAAAC,KAAKA,CAAC;EAC5BC,KAAK;EACLC,MAAM;EACNC,QAAQ;EACRC,SAAS;EACTC,WAAW;EACXC,IAAI;EACJC,SAAS;EACTC,OAAO;EACPC,IAAI;EACJC,KAAK;AACLX,EAAAA,IAAI,GAAG,SAAS;AAChBY,EAAAA,OAAO,GAAG,SAAA;AACC,CAAA,EAAA;AACXC,EAAAA,SAAS,CAAC,MAAK;IACb,IAAIX,KAAK,KAAKY,SAAS,EAAE;MACvBC,iBAAiB,CACf,6EAA6E,CAC9E,CAAA;AACH,KAAA;AACF,GAAC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IAAA,KAAK,WAAW;AACd,MAAA,OAAO,oBAAoB,CAAA;AAC7B,IAAA,KAAK,UAAU;AACb,MAAA,OAAO,mBAAmB,CAAA;AAC5B,IAAA,KAAK,SAAS,CAAA;AACd,IAAA;AACE,MAAA,OAAO,OAAO,CAAA;AAClB,GAAA;AACF;;;;"}
1
+ {"version":3,"file":"Alert.mjs","sources":["../../src/alert/Alert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useState, useRef, useEffect } from 'react';\n\nimport Body from '../body/Body';\nimport { Sentiment, Size, Typography, Variant } from '../common';\nimport { CloseButton } from '../common/closeButton';\nimport StatusIcon from '../statusIcon';\nimport Title from '../title/Title';\nimport { logActionRequired } from '../utilities';\n\nimport InlineMarkdown from './inlineMarkdown';\nimport { Action } from '../common/action/Action';\n\nexport type AlertAction = {\n 'aria-label'?: string;\n href?: string;\n target?: string;\n text: React.ReactNode;\n onClick?: () => void;\n};\n\n/** @deprecated Use `\"top\" | \"bottom\"` instead. */\ntype AlertTypeDeprecated = `${Sentiment.SUCCESS | Sentiment.INFO | Sentiment.ERROR}`;\ntype AlertTypeResolved = `${\n | Sentiment.POSITIVE\n | Sentiment.NEUTRAL\n | Sentiment.WARNING\n | Sentiment.NEGATIVE}`;\nexport type AlertType = AlertTypeResolved | AlertTypeDeprecated;\n\nexport enum AlertArrowPosition {\n TOP_LEFT = 'up-left',\n TOP = 'up-center',\n TOP_RIGHT = 'up-right',\n BOTTOM_LEFT = 'down-left',\n BOTTOM = 'down-center',\n BOTTOM_RIGHT = 'down-right',\n}\n\nexport interface AlertProps {\n /** An optional call to action to sit under the main body of the alert. If your label is short, use aria-label to provide more context */\n action?: AlertAction;\n className?: string;\n /** An optional icon. If not provided, we will default the icon to something appropriate for the type */\n icon?: React.ReactNode;\n /** Title for the alert component */\n title?: string;\n /** The main body of the alert. Accepts plain text and bold words specified with **double stars */\n message?: string;\n /** The presence of the onDismiss handler will trigger the visibility of the close button */\n onDismiss?: React.MouseEventHandler<HTMLButtonElement>;\n /** The type dictates which icon and colour will be used */\n type?: AlertType;\n variant?: `${Variant}`;\n /** Toggle to make it work with ARIA Live Region */\n active?: boolean;\n /** @deprecated Use `InlineAlert` instead. */\n arrow?: `${AlertArrowPosition}`;\n /** @deprecated Use `message` instead. Be aware `message` only accepts plain text or text with **bold** markdown. */\n children?: React.ReactNode;\n /** @deprecated Use `onDismiss` instead. */\n dismissible?: boolean;\n /** @deprecated Alert component doesn't support `size` anymore, please remove this prop. */\n size?: `${Size}`;\n}\n\nfunction resolveType(type: AlertType): AlertTypeResolved {\n switch (type) {\n case 'success':\n return 'positive';\n case 'info':\n return 'neutral';\n case 'error':\n return 'negative';\n default:\n return type;\n }\n}\n\nexport default function Alert({\n arrow,\n action,\n children,\n className,\n dismissible,\n icon,\n onDismiss,\n message,\n size,\n title,\n type = 'neutral',\n variant = 'desktop',\n active = true,\n}: AlertProps) {\n useEffect(() => {\n if (arrow !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'arrow' anymore, use 'InlineAlert' instead.\",\n );\n }\n }, [arrow]);\n\n useEffect(() => {\n if (children !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'children' anymore, use 'message' instead.\",\n );\n }\n }, [children]);\n\n useEffect(() => {\n if (dismissible !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'dismissible' anymore, use 'onDismiss' instead.\",\n );\n }\n }, [dismissible]);\n\n useEffect(() => {\n if (size !== undefined) {\n logActionRequired(\"Alert component doesn't support 'size' anymore, please remove that prop.\");\n }\n }, [size]);\n\n const resolvedType = resolveType(type);\n useEffect(() => {\n if (resolvedType !== type) {\n logActionRequired(\n `Alert component has deprecated '${type}' value for the 'type' prop. Please use '${resolvedType}' instead.`,\n );\n }\n }, [resolvedType, type]);\n\n const [shouldFire, setShouldFire] = useState(false);\n\n const closeButtonReference = useRef<HTMLButtonElement>(null);\n\n return (\n <div role={resolvedType === Sentiment.NEGATIVE ? 'alert' : 'status'}>\n {active && (\n <div\n className={clsx(\n 'alert d-flex',\n `alert-${resolvedType}`,\n arrow != null && alertArrowClassNames(arrow),\n className,\n )}\n data-testid=\"alert\"\n onTouchStart={() => setShouldFire(true)}\n onTouchEnd={(event) => {\n if (\n shouldFire &&\n action?.href &&\n // Check if current event is triggered from closeButton\n event.target instanceof Node &&\n closeButtonReference.current &&\n !closeButtonReference.current.contains(event.target)\n ) {\n if (action.target === '_blank') {\n window.top?.open(action.href);\n } else {\n window.top?.location.assign(action.href);\n }\n }\n setShouldFire(false);\n }}\n onTouchMove={() => setShouldFire(false)}\n >\n <div\n className={clsx('alert__content', 'd-flex', 'flex-grow-1', variant)}\n data-testid={variant}\n >\n {icon ? (\n <div className=\"alert__icon\">{icon}</div>\n ) : (\n <StatusIcon size={Size.LARGE} sentiment={resolvedType} />\n )}\n <div className=\"alert__message\">\n <div>\n {title && (\n <Title className=\"m-b-1\" type={Typography.TITLE_BODY}>\n {title}\n </Title>\n )}\n <Body as=\"span\" className=\"d-block\" type={Typography.BODY_LARGE}>\n {children || <InlineMarkdown>{message}</InlineMarkdown>}\n </Body>\n </div>\n {action && <Action action={action} className=\"m-t-1\" />}\n </div>\n </div>\n {onDismiss && (\n <CloseButton ref={closeButtonReference} className=\"m-l-2\" onClick={onDismiss} />\n )}\n </div>\n )}\n </div>\n );\n}\n\nfunction alertArrowClassNames(arrow: `${AlertArrowPosition}`) {\n switch (arrow) {\n case 'down-center':\n return 'arrow arrow-bottom arrow-center';\n case 'down-left':\n return 'arrow arrow-bottom arrow-left';\n case 'down-right':\n return 'arrow arrow-bottom arrow-right';\n case 'up-center':\n return 'arrow arrow-center';\n case 'up-right':\n return 'arrow arrow-right';\n case 'up-left':\n default:\n return 'arrow';\n }\n}\n"],"names":["AlertArrowPosition","resolveType","type","Alert","arrow","action","children","className","dismissible","icon","onDismiss","message","size","title","variant","active","useEffect","undefined","logActionRequired","resolvedType","shouldFire","setShouldFire","useState","closeButtonReference","useRef","_jsx","role","Sentiment","NEGATIVE","_jsxs","clsx","alertArrowClassNames","onTouchStart","onTouchEnd","event","href","target","Node","current","contains","window","top","open","location","assign","onTouchMove","StatusIcon","Size","LARGE","sentiment","Title","Typography","TITLE_BODY","Body","as","BODY_LARGE","InlineMarkdown","Action","CloseButton","ref","onClick"],"mappings":";;;;;;;;;;;;;;IA8BYA,mBAOX;AAPD,CAAA,UAAYA,kBAAkB,EAAA;AAC5BA,EAAAA,kBAAA,CAAA,UAAA,CAAA,GAAA,SAAoB,CAAA;AACpBA,EAAAA,kBAAA,CAAA,KAAA,CAAA,GAAA,WAAiB,CAAA;AACjBA,EAAAA,kBAAA,CAAA,WAAA,CAAA,GAAA,UAAsB,CAAA;AACtBA,EAAAA,kBAAA,CAAA,aAAA,CAAA,GAAA,WAAyB,CAAA;AACzBA,EAAAA,kBAAA,CAAA,QAAA,CAAA,GAAA,aAAsB,CAAA;AACtBA,EAAAA,kBAAA,CAAA,cAAA,CAAA,GAAA,YAA2B,CAAA;AAC7B,CAAC,EAPWA,kBAAkB,KAAlBA,kBAAkB,GAO7B,EAAA,CAAA,CAAA,CAAA;AA6BD,SAASC,WAAWA,CAACC,IAAe,EAAA;AAClC,EAAA,QAAQA,IAAI;AACV,IAAA,KAAK,SAAS;AACZ,MAAA,OAAO,UAAU,CAAA;AACnB,IAAA,KAAK,MAAM;AACT,MAAA,OAAO,SAAS,CAAA;AAClB,IAAA,KAAK,OAAO;AACV,MAAA,OAAO,UAAU,CAAA;AACnB,IAAA;AACE,MAAA,OAAOA,IAAI,CAAA;AACf,GAAA;AACF,CAAA;AAEc,SAAUC,KAAKA,CAAC;EAC5BC,KAAK;EACLC,MAAM;EACNC,QAAQ;EACRC,SAAS;EACTC,WAAW;EACXC,IAAI;EACJC,SAAS;EACTC,OAAO;EACPC,IAAI;EACJC,KAAK;AACLX,EAAAA,IAAI,GAAG,SAAS;AAChBY,EAAAA,OAAO,GAAG,SAAS;AACnBC,EAAAA,MAAM,GAAG,IAAA;AACE,CAAA,EAAA;AACXC,EAAAA,SAAS,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A,QAAQA,KAAK;AACX,IAAA,KAAK,aAAa;AAChB,MAAA,OAAO,iCAAiC,CAAA;AAC1C,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,+BAA+B,CAAA;AACxC,IAAA,KAAK,YAAY;AACf,MAAA,OAAO,gCAAgC,CAAA;AACzC,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,oBAAoB,CAAA;AAC7B,IAAA,KAAK,UAAU;AACb,MAAA,OAAO,mBAAmB,CAAA;AAC5B,IAAA,KAAK,SAAS,CAAA;AACd,IAAA;AACE,MAAA,OAAO,OAAO,CAAA;AAClB,GAAA;AACF;;;;"}
@@ -30,8 +30,6 @@
30
30
  "neptune.Summary.statusDone": "Item done",
31
31
  "neptune.Summary.statusNotDone": "Item to do",
32
32
  "neptune.Summary.statusPending": "Item pending",
33
- "neptune.Table.emptyData": "No results found",
34
- "neptune.Table.refreshPage": "Refresh page",
35
33
  "neptune.Upload.csButtonText": "Upload another file?",
36
34
  "neptune.Upload.csFailureText": "Upload failed. Please, try again",
37
35
  "neptune.Upload.csSuccessText": "Upload complete!",
@@ -32,8 +32,6 @@ var en = {
32
32
  "neptune.Summary.statusDone": "Item done",
33
33
  "neptune.Summary.statusNotDone": "Item to do",
34
34
  "neptune.Summary.statusPending": "Item pending",
35
- "neptune.Table.emptyData": "No results found",
36
- "neptune.Table.refreshPage": "Refresh page",
37
35
  "neptune.Upload.csButtonText": "Upload another file?",
38
36
  "neptune.Upload.csFailureText": "Upload failed. Please, try again",
39
37
  "neptune.Upload.csSuccessText": "Upload complete!",
@@ -1 +1 @@
1
- {"version":3,"file":"en.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"en.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -30,8 +30,6 @@ var en = {
30
30
  "neptune.Summary.statusDone": "Item done",
31
31
  "neptune.Summary.statusNotDone": "Item to do",
32
32
  "neptune.Summary.statusPending": "Item pending",
33
- "neptune.Table.emptyData": "No results found",
34
- "neptune.Table.refreshPage": "Refresh page",
35
33
  "neptune.Upload.csButtonText": "Upload another file?",
36
34
  "neptune.Upload.csFailureText": "Upload failed. Please, try again",
37
35
  "neptune.Upload.csSuccessText": "Upload complete!",
@@ -1 +1 @@
1
- {"version":3,"file":"en.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"en.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/build/main.css CHANGED
@@ -5025,220 +5025,6 @@ html:not([dir="rtl"]) .np-navigation-option {
5025
5025
  padding: 0 var(--size-24);
5026
5026
  }
5027
5027
  }
5028
- .np-table {
5029
- width: 100%;
5030
- background-color: transparent;
5031
- }
5032
- .np-table-container {
5033
- padding: 8px;
5034
- padding: var(--size-8);
5035
- background-color: rgba(134,167,189,0.10196);
5036
- background-color: var(--color-background-neutral);
5037
- border-radius: 16px;
5038
- border-radius: var(--radius-medium);
5039
- }
5040
- .np-table-container--loading .np-table-header {
5041
- min-width: calc(160px * 2);
5042
- }
5043
- .np-table-container--center {
5044
- margin-right: auto;
5045
- margin-left: auto;
5046
- }
5047
- .np-table-container--full-width {
5048
- width: 100%;
5049
- }
5050
- .np-table-inner-container {
5051
- background-image: linear-gradient(to right, #ffffff, #ffffff), linear-gradient(to right, #ffffff, #ffffff), linear-gradient(to right, rgba(0, 0, 0, 0.25), rgba(255, 255, 255, 0)), linear-gradient(to left, rgba(0, 0, 0, 0.25), rgba(255, 255, 255, 0));
5052
- background-image: linear-gradient(to right, var(--color-background-screen), var(--color-background-screen)), linear-gradient(to right, var(--color-background-screen), var(--color-background-screen)), linear-gradient(to right, rgba(0, 0, 0, 0.25), rgba(255, 255, 255, 0)), linear-gradient(to left, rgba(0, 0, 0, 0.25), rgba(255, 255, 255, 0));
5053
- background-position: left center, right center, left center, right center;
5054
- background-repeat: no-repeat;
5055
- background-color: #ffffff;
5056
- background-color: var(--color-background-screen);
5057
- background-size: 10px 100%, 10px 100%, 10px 100%, 10px 100%;
5058
- background-attachment: local, local, scroll, scroll;
5059
- overflow-x: auto;
5060
- border-radius: 10px;
5061
- }
5062
- .np-table-row:last-child .np-table-cell:first-child {
5063
- border-bottom-left-radius: 10px;
5064
- }
5065
- .np-table-row:last-child .np-table-cell:last-child {
5066
- border-bottom-right-radius: 10px;
5067
- }
5068
- .np-table-row--clickable:hover .np-table-cell {
5069
- background-color: var(--color-background-screen-hover);
5070
- cursor: pointer;
5071
- }
5072
- .np-table-row--separator .np-table-cell {
5073
- padding: 0;
5074
- }
5075
- .np-table-header,
5076
- .np-table-cell {
5077
- padding: 0;
5078
- }
5079
- .np-table-header:first-child,
5080
- .np-table-cell:first-child {
5081
- padding-left: 16px;
5082
- padding-left: var(--size-16);
5083
- }
5084
- .np-table-header:first-child .np-table-header-content,
5085
- .np-table-cell:first-child .np-table-header-content,
5086
- .np-table-header:first-child .np-table-cell-content,
5087
- .np-table-cell:first-child .np-table-cell-content {
5088
- padding-left: 0;
5089
- }
5090
- .np-table-header:last-child,
5091
- .np-table-cell:last-child {
5092
- padding-right: 16px;
5093
- padding-right: var(--size-16);
5094
- }
5095
- .np-table-header:last-child .np-table-header-content,
5096
- .np-table-cell:last-child .np-table-header-content,
5097
- .np-table-header:last-child .np-table-cell-content,
5098
- .np-table-cell:last-child .np-table-cell-content {
5099
- padding-right: 0;
5100
- }
5101
- .np-table-header .np-text-body-large-bold,
5102
- .np-table-cell .np-text-body-large-bold {
5103
- font-size: 0.875rem;
5104
- font-size: var(--font-size-14);
5105
- }
5106
- .np-table-header.np-table-header--right,
5107
- .np-table-cell.np-table-cell--right {
5108
- padding-right: calc(8px + 12px);
5109
- padding-right: calc(var(--size-8) + var(--size-12));
5110
- }
5111
- .np-table-header.np-table-header--right > .np-text-body-default,
5112
- .np-table-cell.np-table-cell--right > .np-text-body-default {
5113
- text-align: right;
5114
- }
5115
- .np-table-header.np-table-header--right .np-table-header-content,
5116
- .np-table-cell.np-table-cell--right .np-table-content {
5117
- justify-content: end;
5118
- }
5119
- .np-table-header-content,
5120
- .np-table-content {
5121
- display: flex;
5122
- align-items: center;
5123
- justify-content: start;
5124
- }
5125
- .np-table-header {
5126
- min-width: 160px;
5127
- padding-right: 8px;
5128
- padding-right: var(--size-8);
5129
- padding-bottom: 8px;
5130
- padding-bottom: var(--size-8);
5131
- padding-left: 8px;
5132
- padding-left: var(--size-8);
5133
- background-color: rgba(134,167,189,0.10196);
5134
- background-color: var(--color-background-neutral);
5135
- color: #37517e;
5136
- color: var(--color-content-primary);
5137
- }
5138
- .np-table-header-content {
5139
- padding-top: 5px;
5140
- padding-bottom: 5px;
5141
- white-space: nowrap;
5142
- }
5143
- .np-table-header--has-error {
5144
- color: var(--color-sentiment-negative);
5145
- }
5146
- .np-table-cell {
5147
- padding: 16px 8px;
5148
- padding: var(--size-16) var(--size-8);
5149
- }
5150
- .np-table-cell--primary {
5151
- min-width: 200px;
5152
- }
5153
- .np-table-cell--currency .np-text-body-default {
5154
- white-space: nowrap;
5155
- }
5156
- .np-table-cell--status .status-circle {
5157
- width: 24px;
5158
- height: 24px;
5159
- }
5160
- .np-table-cell--status .status-circle .status-icon > svg {
5161
- width: 21px;
5162
- height: 21px;
5163
- }
5164
- .np-table-cell .tw-chevron {
5165
- margin-left: 8px;
5166
- margin-left: var(--size-8);
5167
- }
5168
- .np-table-cell-separator {
5169
- margin-top: 4px;
5170
- margin-top: var(--size-4);
5171
- margin-bottom: 4px;
5172
- margin-bottom: var(--size-4);
5173
- height: 1px;
5174
- padding: 0;
5175
- background-color: rgba(134,167,189,0.10196);
5176
- background-color: var(--color-background-neutral);
5177
- }
5178
- .np-table-cell .np-text-body-default {
5179
- line-height: 1.375rem;
5180
- line-height: var(--line-height-22);
5181
- }
5182
- .np-table-cell .np-text-body-large-bold {
5183
- display: flex;
5184
- align-items: center;
5185
- color: #37517e;
5186
- color: var(--color-content-primary);
5187
- white-space: nowrap;
5188
- }
5189
- .np-table-cell .np-table-content--success {
5190
- color: var(--color-sentiment-positive);
5191
- }
5192
- .np-table-cell .np-table-content--error {
5193
- color: var(--color-sentiment-negative);
5194
- }
5195
- .np-table-cell .tw-loader {
5196
- margin: 150px auto;
5197
- }
5198
- @media (max-width: 320px) {
5199
- .np-table-cell .tw-loader {
5200
- margin-top: 70px;
5201
- margin-bottom: 70px;
5202
- }
5203
- }
5204
- .np-table-content {
5205
- gap: 12px;
5206
- gap: var(--size-12);
5207
- }
5208
- .np-table-content--success,
5209
- .np-table-content--error {
5210
- gap: 4px;
5211
- gap: var(--size-4);
5212
- }
5213
- .np-table-content--success .np-table-content-text,
5214
- .np-table-content--error .np-table-content-text {
5215
- line-height: 155%;
5216
- }
5217
- .np-table-content-media {
5218
- flex-shrink: 0;
5219
- }
5220
- .np-table-content-body {
5221
- display: flex;
5222
- flex-direction: column;
5223
- font-size: 0.75rem;
5224
- font-size: var(--font-size-12);
5225
- color: #768e9c;
5226
- color: var(--color-content-tertiary);
5227
- }
5228
- .np-table-content--reversed {
5229
- flex-direction: row-reverse;
5230
- }
5231
- .np-table-content--reversed .np-table-content-body {
5232
- align-items: end;
5233
- }
5234
- .np-table-empty-data {
5235
- display: flex;
5236
- align-items: center;
5237
- }
5238
- .np-table-empty-data .status-circle {
5239
- margin-right: 12px;
5240
- margin-right: var(--size-12);
5241
- }
5242
5028
  .np-tile {
5243
5029
  min-width: 120px;
5244
5030
  border-radius: 10px;