@transferwise/components 0.0.0-experimental-7b7608c → 0.0.0-experimental-c76c3bc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/avatar/Avatar.js +5 -0
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs +5 -0
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/circularButton/CircularButton.js +1 -1
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs +1 -1
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/common/circle/Circle.js +15 -2
- package/build/common/circle/Circle.js.map +1 -1
- package/build/common/circle/Circle.mjs +15 -2
- package/build/common/circle/Circle.mjs.map +1 -1
- package/build/i18n/en.json +0 -2
- package/build/i18n/en.json.js +0 -2
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +0 -2
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/main.css +6 -237
- package/build/statusIcon/StatusIcon.js +4 -4
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +4 -4
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/styles/circularButton/CircularButton.css +2 -2
- package/build/styles/common/circle/Circle.css +4 -0
- package/build/styles/main.css +6 -237
- package/build/styles/statusIcon/StatusIcon.css +0 -20
- package/build/types/avatar/Avatar.d.ts.map +1 -1
- package/build/types/common/circle/Circle.d.ts +1 -1
- package/build/types/common/circle/Circle.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts +6 -2
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/avatar/Avatar.spec.tsx +3 -1
- package/src/avatar/Avatar.tsx +5 -2
- package/src/avatarWrapper/__snapshots__/AvatarWrapper.spec.tsx.snap +11 -11
- package/src/badge/Badge.spec.tsx +3 -1
- package/src/circularButton/CircularButton.css +2 -2
- package/src/circularButton/CircularButton.less +1 -1
- package/src/circularButton/CircularButton.tsx +1 -1
- package/src/circularButton/__snapshots__/CircularButton.spec.tsx.snap +10 -10
- package/src/common/circle/Circle.css +4 -0
- package/src/common/circle/Circle.less +6 -0
- package/src/common/circle/Circle.tsx +25 -2
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +4 -4
- package/src/i18n/en.json +0 -2
- package/src/main.css +6 -237
- package/src/main.less +0 -1
- package/src/overlayHeader/OverlayHeader.spec.tsx +3 -1
- package/src/overlayHeader/__snapshots__/OverlayHeader.spec.tsx.snap +2 -2
- package/src/promoCard/PromoCard.spec.tsx +3 -1
- package/src/radio/Radio.rtl.spec.tsx +2 -1
- package/src/radio/__snapshots__/Radio.rtl.spec.tsx.snap +2 -2
- package/src/statusIcon/StatusIcon.css +0 -20
- package/src/statusIcon/StatusIcon.less +0 -17
- package/src/statusIcon/StatusIcon.spec.tsx +3 -21
- package/src/statusIcon/StatusIcon.story.tsx +31 -8
- package/src/statusIcon/StatusIcon.tsx +12 -6
- package/build/styles/table/Table.css +0 -215
- package/build/types/table/Table.d.ts +0 -23
- package/build/types/table/Table.d.ts.map +0 -1
- package/build/types/table/Table.messages.d.ts +0 -12
- package/build/types/table/Table.messages.d.ts.map +0 -1
- package/build/types/table/TableCell.d.ts +0 -37
- package/build/types/table/TableCell.d.ts.map +0 -1
- package/build/types/table/TableHeader.d.ts +0 -12
- package/build/types/table/TableHeader.d.ts.map +0 -1
- package/build/types/table/TableRow.d.ts +0 -17
- package/build/types/table/TableRow.d.ts.map +0 -1
- package/build/types/table/TableStatusText.d.ts +0 -9
- package/build/types/table/TableStatusText.d.ts.map +0 -1
- package/build/types/table/index.d.ts +0 -6
- package/build/types/table/index.d.ts.map +0 -1
- package/src/table/Table.css +0 -215
- package/src/table/Table.less +0 -261
- package/src/table/Table.messages.ts +0 -12
- package/src/table/Table.spec.tsx +0 -87
- package/src/table/Table.story.tsx +0 -352
- package/src/table/Table.tsx +0 -121
- package/src/table/TableCell.spec.tsx +0 -298
- package/src/table/TableCell.tsx +0 -153
- package/src/table/TableHeader.spec.tsx +0 -58
- package/src/table/TableHeader.tsx +0 -50
- package/src/table/TableRow.spec.tsx +0 -104
- package/src/table/TableRow.tsx +0 -62
- package/src/table/TableStatusText.spec.tsx +0 -53
- package/src/table/TableStatusText.tsx +0 -35
- package/src/table/index.ts +0 -11
package/build/avatar/Avatar.js
CHANGED
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
var clsx = require('clsx');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var Circle = require('../common/circle/Circle.js');
|
|
6
|
+
var useMedia = require('../common/hooks/useMedia.js');
|
|
6
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
8
|
var colors = require('../common/colors.js');
|
|
9
|
+
var breakpoint = require('../common/propsValues/breakpoint.js');
|
|
8
10
|
var theme = require('../common/theme.js');
|
|
9
11
|
|
|
10
12
|
const backwardsCompatibleSize = size => {
|
|
@@ -32,6 +34,7 @@ const Avatar = ({
|
|
|
32
34
|
}) => {
|
|
33
35
|
const backgroundColorFromSeed = React.useMemo(() => !backgroundColor && backgroundColorSeed ? colors.getBrandColorFromSeed(backgroundColorSeed) : undefined, [backgroundColor, backgroundColorSeed]);
|
|
34
36
|
const size = backwardsCompatibleSize(sizeFromProps);
|
|
37
|
+
useMedia.useMedia(`(max-width: ${breakpoint.Breakpoint.ZOOM_400}px)`);
|
|
35
38
|
return /*#__PURE__*/jsxRuntime.jsx(Circle, {
|
|
36
39
|
size: size,
|
|
37
40
|
fixedSize: true,
|
|
@@ -46,6 +49,8 @@ const Avatar = ({
|
|
|
46
49
|
fixedSize: true,
|
|
47
50
|
className: "tw-avatar__content",
|
|
48
51
|
style: {
|
|
52
|
+
// @ts-expect-error CSS custom props allowed
|
|
53
|
+
'--circle-icon-size': '16px',
|
|
49
54
|
backgroundColor: backgroundColor || backgroundColorFromSeed
|
|
50
55
|
},
|
|
51
56
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.js","sources":["../../src/avatar/Avatar.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useMemo } from 'react';\n\nimport { getBrandColorFromSeed, Theme } from '../common';\n\nimport Circle from '../common/circle';\n\ntype NumericAvatarSize = 24 | 40 | 48 | 56 | 72;\n\ntype LegacyAvatarSize = 'sm' | 'md' | 'lg';\n\nexport type AvatarSize = NumericAvatarSize | LegacyAvatarSize;\n\nexport type AvatarTheme = 'light' | 'dark';\n\nexport type AvatarType = 'thumbnail' | 'icon' | 'emoji' | 'initials';\n\nexport interface AvatarProps {\n backgroundColor?: string;\n backgroundColorSeed?: string;\n children?: React.ReactNode;\n className?: string;\n outlined?: boolean;\n size?: AvatarSize;\n theme?: AvatarTheme;\n type?: AvatarType;\n 'aria-label'?: string;\n}\n\nconst backwardsCompatibleSize = (size: AvatarSize): NumericAvatarSize => {\n switch (size) {\n case 'sm':\n return 24;\n\n case 'md':\n return 48;\n\n case 'lg':\n return 72;\n\n default:\n return size;\n }\n};\n\nconst Avatar: React.FC<AvatarProps> = ({\n backgroundColor = null,\n backgroundColorSeed = null,\n children = null,\n className,\n outlined = false,\n size: sizeFromProps = 48,\n theme = Theme.LIGHT,\n type = 'thumbnail',\n 'aria-label': ariaLabel,\n}) => {\n const backgroundColorFromSeed = useMemo<string | undefined>(\n () =>\n !backgroundColor && backgroundColorSeed\n ? getBrandColorFromSeed(backgroundColorSeed)\n : undefined,\n [backgroundColor, backgroundColorSeed],\n );\n\n const size = backwardsCompatibleSize(sizeFromProps);\n
|
|
1
|
+
{"version":3,"file":"Avatar.js","sources":["../../src/avatar/Avatar.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useMemo } from 'react';\n\nimport { Breakpoint, getBrandColorFromSeed, Theme } from '../common';\n\nimport Circle from '../common/circle';\nimport { useMedia } from '../common/hooks/useMedia';\n\ntype NumericAvatarSize = 24 | 40 | 48 | 56 | 72;\n\ntype LegacyAvatarSize = 'sm' | 'md' | 'lg';\n\nexport type AvatarSize = NumericAvatarSize | LegacyAvatarSize;\n\nexport type AvatarTheme = 'light' | 'dark';\n\nexport type AvatarType = 'thumbnail' | 'icon' | 'emoji' | 'initials';\n\nexport interface AvatarProps {\n backgroundColor?: string;\n backgroundColorSeed?: string;\n children?: React.ReactNode;\n className?: string;\n outlined?: boolean;\n size?: AvatarSize;\n theme?: AvatarTheme;\n type?: AvatarType;\n 'aria-label'?: string;\n}\n\nconst backwardsCompatibleSize = (size: AvatarSize): NumericAvatarSize => {\n switch (size) {\n case 'sm':\n return 24;\n\n case 'md':\n return 48;\n\n case 'lg':\n return 72;\n\n default:\n return size;\n }\n};\n\nconst Avatar: React.FC<AvatarProps> = ({\n backgroundColor = null,\n backgroundColorSeed = null,\n children = null,\n className,\n outlined = false,\n size: sizeFromProps = 48,\n theme = Theme.LIGHT,\n type = 'thumbnail',\n 'aria-label': ariaLabel,\n}) => {\n const backgroundColorFromSeed = useMemo<string | undefined>(\n () =>\n !backgroundColor && backgroundColorSeed\n ? getBrandColorFromSeed(backgroundColorSeed)\n : undefined,\n [backgroundColor, backgroundColorSeed],\n );\n\n const size = backwardsCompatibleSize(sizeFromProps);\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n return (\n <Circle\n size={size}\n fixedSize\n className={clsx('tw-avatar', className, `tw-avatar--${size}`, `tw-avatar--${type}`, {\n 'tw-avatar--outlined': outlined,\n 'tw-avatar--branded': Boolean(backgroundColorFromSeed),\n 'np-text-title-body': type === 'initials',\n })}\n aria-label={ariaLabel}\n >\n <Circle\n size={size}\n fixedSize\n className=\"tw-avatar__content\"\n style={{\n // @ts-expect-error CSS custom props allowed\n '--circle-icon-size': '16px',\n backgroundColor: backgroundColor || backgroundColorFromSeed,\n }}\n >\n {children}\n </Circle>\n </Circle>\n );\n};\n\nexport default Avatar;\n"],"names":["backwardsCompatibleSize","size","Avatar","backgroundColor","backgroundColorSeed","children","className","outlined","sizeFromProps","theme","Theme","LIGHT","type","ariaLabel","backgroundColorFromSeed","useMemo","getBrandColorFromSeed","undefined","useMedia","Breakpoint","ZOOM_400","_jsx","Circle","fixedSize","clsx","Boolean","style"],"mappings":";;;;;;;;;;;AA8BA,MAAMA,uBAAuB,GAAIC,IAAgB,IAAuB;AACtE,EAAA,QAAQA,IAAI;AACV,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE,CAAA;AAEX,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE,CAAA;AAEX,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE,CAAA;AAEX,IAAA;AACE,MAAA,OAAOA,IAAI,CAAA;AACf,GAAA;AACF,CAAC,CAAA;AAEKC,MAAAA,MAAM,GAA0BA,CAAC;AACrCC,EAAAA,eAAe,GAAG,IAAI;AACtBC,EAAAA,mBAAmB,GAAG,IAAI;AAC1BC,EAAAA,QAAQ,GAAG,IAAI;EACfC,SAAS;AACTC,EAAAA,QAAQ,GAAG,KAAK;EAChBN,IAAI,EAAEO,aAAa,GAAG,EAAE;SACxBC,OAAK,GAAGC,WAAK,CAACC,KAAK;AACnBC,EAAAA,IAAI,GAAG,WAAW;AAClB,EAAA,YAAY,EAAEC,SAAAA;AAAS,CACxB,KAAI;EACH,MAAMC,uBAAuB,GAAGC,aAAO,CACrC,MACE,CAACZ,eAAe,IAAIC,mBAAmB,GACnCY,4BAAqB,CAACZ,mBAAmB,CAAC,GAC1Ca,SAAS,EACf,CAACd,eAAe,EAAEC,mBAAmB,CAAC,CACvC,CAAA;AAED,EAAA,MAAMH,IAAI,GAAGD,uBAAuB,CAACQ,aAAa,CAAC,CAAA;EAC5BU,iBAAQ,CAAC,eAAeC,qBAAU,CAACC,QAAQ,CAAA,GAAA,CAAK,EAAC;EACxE,oBACEC,cAAA,CAACC,MAAM,EAAA;AACLrB,IAAAA,IAAI,EAAEA,IAAK;IACXsB,SAAS,EAAA,IAAA;AACTjB,IAAAA,SAAS,EAAEkB,SAAI,CAAC,WAAW,EAAElB,SAAS,EAAE,CAAcL,WAAAA,EAAAA,IAAI,CAAE,CAAA,EAAE,CAAcW,WAAAA,EAAAA,IAAI,EAAE,EAAE;AAClF,MAAA,qBAAqB,EAAEL,QAAQ;AAC/B,MAAA,oBAAoB,EAAEkB,OAAO,CAACX,uBAAuB,CAAC;MACtD,oBAAoB,EAAEF,IAAI,KAAK,UAAA;AAChC,KAAA,CAAE;AACH,IAAA,YAAA,EAAYC,SAAU;IAAAR,QAAA,eAEtBgB,cAAA,CAACC,MAAM,EAAA;AACLrB,MAAAA,IAAI,EAAEA,IAAK;MACXsB,SAAS,EAAA,IAAA;AACTjB,MAAAA,SAAS,EAAC,oBAAoB;AAC9BoB,MAAAA,KAAK,EAAE;AACL;AACA,QAAA,oBAAoB,EAAE,MAAM;QAC5BvB,eAAe,EAAEA,eAAe,IAAIW,uBAAAA;OACpC;AAAAT,MAAAA,QAAA,EAEDA,QAAAA;KACK,CAAA;AACV,GAAQ,CAAC,CAAA;AAEb;;;;"}
|
package/build/avatar/Avatar.mjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import Circle from '../common/circle/Circle.mjs';
|
|
4
|
+
import { useMedia } from '../common/hooks/useMedia.mjs';
|
|
4
5
|
import { jsx } from 'react/jsx-runtime';
|
|
5
6
|
import { getBrandColorFromSeed } from '../common/colors.mjs';
|
|
7
|
+
import { Breakpoint } from '../common/propsValues/breakpoint.mjs';
|
|
6
8
|
import { Theme } from '../common/theme.mjs';
|
|
7
9
|
|
|
8
10
|
const backwardsCompatibleSize = size => {
|
|
@@ -30,6 +32,7 @@ const Avatar = ({
|
|
|
30
32
|
}) => {
|
|
31
33
|
const backgroundColorFromSeed = useMemo(() => !backgroundColor && backgroundColorSeed ? getBrandColorFromSeed(backgroundColorSeed) : undefined, [backgroundColor, backgroundColorSeed]);
|
|
32
34
|
const size = backwardsCompatibleSize(sizeFromProps);
|
|
35
|
+
useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
|
|
33
36
|
return /*#__PURE__*/jsx(Circle, {
|
|
34
37
|
size: size,
|
|
35
38
|
fixedSize: true,
|
|
@@ -44,6 +47,8 @@ const Avatar = ({
|
|
|
44
47
|
fixedSize: true,
|
|
45
48
|
className: "tw-avatar__content",
|
|
46
49
|
style: {
|
|
50
|
+
// @ts-expect-error CSS custom props allowed
|
|
51
|
+
'--circle-icon-size': '16px',
|
|
47
52
|
backgroundColor: backgroundColor || backgroundColorFromSeed
|
|
48
53
|
},
|
|
49
54
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.mjs","sources":["../../src/avatar/Avatar.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useMemo } from 'react';\n\nimport { getBrandColorFromSeed, Theme } from '../common';\n\nimport Circle from '../common/circle';\n\ntype NumericAvatarSize = 24 | 40 | 48 | 56 | 72;\n\ntype LegacyAvatarSize = 'sm' | 'md' | 'lg';\n\nexport type AvatarSize = NumericAvatarSize | LegacyAvatarSize;\n\nexport type AvatarTheme = 'light' | 'dark';\n\nexport type AvatarType = 'thumbnail' | 'icon' | 'emoji' | 'initials';\n\nexport interface AvatarProps {\n backgroundColor?: string;\n backgroundColorSeed?: string;\n children?: React.ReactNode;\n className?: string;\n outlined?: boolean;\n size?: AvatarSize;\n theme?: AvatarTheme;\n type?: AvatarType;\n 'aria-label'?: string;\n}\n\nconst backwardsCompatibleSize = (size: AvatarSize): NumericAvatarSize => {\n switch (size) {\n case 'sm':\n return 24;\n\n case 'md':\n return 48;\n\n case 'lg':\n return 72;\n\n default:\n return size;\n }\n};\n\nconst Avatar: React.FC<AvatarProps> = ({\n backgroundColor = null,\n backgroundColorSeed = null,\n children = null,\n className,\n outlined = false,\n size: sizeFromProps = 48,\n theme = Theme.LIGHT,\n type = 'thumbnail',\n 'aria-label': ariaLabel,\n}) => {\n const backgroundColorFromSeed = useMemo<string | undefined>(\n () =>\n !backgroundColor && backgroundColorSeed\n ? getBrandColorFromSeed(backgroundColorSeed)\n : undefined,\n [backgroundColor, backgroundColorSeed],\n );\n\n const size = backwardsCompatibleSize(sizeFromProps);\n
|
|
1
|
+
{"version":3,"file":"Avatar.mjs","sources":["../../src/avatar/Avatar.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useMemo } from 'react';\n\nimport { Breakpoint, getBrandColorFromSeed, Theme } from '../common';\n\nimport Circle from '../common/circle';\nimport { useMedia } from '../common/hooks/useMedia';\n\ntype NumericAvatarSize = 24 | 40 | 48 | 56 | 72;\n\ntype LegacyAvatarSize = 'sm' | 'md' | 'lg';\n\nexport type AvatarSize = NumericAvatarSize | LegacyAvatarSize;\n\nexport type AvatarTheme = 'light' | 'dark';\n\nexport type AvatarType = 'thumbnail' | 'icon' | 'emoji' | 'initials';\n\nexport interface AvatarProps {\n backgroundColor?: string;\n backgroundColorSeed?: string;\n children?: React.ReactNode;\n className?: string;\n outlined?: boolean;\n size?: AvatarSize;\n theme?: AvatarTheme;\n type?: AvatarType;\n 'aria-label'?: string;\n}\n\nconst backwardsCompatibleSize = (size: AvatarSize): NumericAvatarSize => {\n switch (size) {\n case 'sm':\n return 24;\n\n case 'md':\n return 48;\n\n case 'lg':\n return 72;\n\n default:\n return size;\n }\n};\n\nconst Avatar: React.FC<AvatarProps> = ({\n backgroundColor = null,\n backgroundColorSeed = null,\n children = null,\n className,\n outlined = false,\n size: sizeFromProps = 48,\n theme = Theme.LIGHT,\n type = 'thumbnail',\n 'aria-label': ariaLabel,\n}) => {\n const backgroundColorFromSeed = useMemo<string | undefined>(\n () =>\n !backgroundColor && backgroundColorSeed\n ? getBrandColorFromSeed(backgroundColorSeed)\n : undefined,\n [backgroundColor, backgroundColorSeed],\n );\n\n const size = backwardsCompatibleSize(sizeFromProps);\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n return (\n <Circle\n size={size}\n fixedSize\n className={clsx('tw-avatar', className, `tw-avatar--${size}`, `tw-avatar--${type}`, {\n 'tw-avatar--outlined': outlined,\n 'tw-avatar--branded': Boolean(backgroundColorFromSeed),\n 'np-text-title-body': type === 'initials',\n })}\n aria-label={ariaLabel}\n >\n <Circle\n size={size}\n fixedSize\n className=\"tw-avatar__content\"\n style={{\n // @ts-expect-error CSS custom props allowed\n '--circle-icon-size': '16px',\n backgroundColor: backgroundColor || backgroundColorFromSeed,\n }}\n >\n {children}\n </Circle>\n </Circle>\n );\n};\n\nexport default Avatar;\n"],"names":["backwardsCompatibleSize","size","Avatar","backgroundColor","backgroundColorSeed","children","className","outlined","sizeFromProps","theme","Theme","LIGHT","type","ariaLabel","backgroundColorFromSeed","useMemo","getBrandColorFromSeed","undefined","useMedia","Breakpoint","ZOOM_400","_jsx","Circle","fixedSize","clsx","Boolean","style"],"mappings":";;;;;;;;;AA8BA,MAAMA,uBAAuB,GAAIC,IAAgB,IAAuB;AACtE,EAAA,QAAQA,IAAI;AACV,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE,CAAA;AAEX,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE,CAAA;AAEX,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE,CAAA;AAEX,IAAA;AACE,MAAA,OAAOA,IAAI,CAAA;AACf,GAAA;AACF,CAAC,CAAA;AAEKC,MAAAA,MAAM,GAA0BA,CAAC;AACrCC,EAAAA,eAAe,GAAG,IAAI;AACtBC,EAAAA,mBAAmB,GAAG,IAAI;AAC1BC,EAAAA,QAAQ,GAAG,IAAI;EACfC,SAAS;AACTC,EAAAA,QAAQ,GAAG,KAAK;EAChBN,IAAI,EAAEO,aAAa,GAAG,EAAE;EACxBC,KAAK,GAAGC,KAAK,CAACC,KAAK;AACnBC,EAAAA,IAAI,GAAG,WAAW;AAClB,EAAA,YAAY,EAAEC,SAAAA;AAAS,CACxB,KAAI;EACH,MAAMC,uBAAuB,GAAGC,OAAO,CACrC,MACE,CAACZ,eAAe,IAAIC,mBAAmB,GACnCY,qBAAqB,CAACZ,mBAAmB,CAAC,GAC1Ca,SAAS,EACf,CAACd,eAAe,EAAEC,mBAAmB,CAAC,CACvC,CAAA;AAED,EAAA,MAAMH,IAAI,GAAGD,uBAAuB,CAACQ,aAAa,CAAC,CAAA;EAC5BU,QAAQ,CAAC,eAAeC,UAAU,CAACC,QAAQ,CAAA,GAAA,CAAK,EAAC;EACxE,oBACEC,GAAA,CAACC,MAAM,EAAA;AACLrB,IAAAA,IAAI,EAAEA,IAAK;IACXsB,SAAS,EAAA,IAAA;AACTjB,IAAAA,SAAS,EAAEkB,IAAI,CAAC,WAAW,EAAElB,SAAS,EAAE,CAAcL,WAAAA,EAAAA,IAAI,CAAE,CAAA,EAAE,CAAcW,WAAAA,EAAAA,IAAI,EAAE,EAAE;AAClF,MAAA,qBAAqB,EAAEL,QAAQ;AAC/B,MAAA,oBAAoB,EAAEkB,OAAO,CAACX,uBAAuB,CAAC;MACtD,oBAAoB,EAAEF,IAAI,KAAK,UAAA;AAChC,KAAA,CAAE;AACH,IAAA,YAAA,EAAYC,SAAU;IAAAR,QAAA,eAEtBgB,GAAA,CAACC,MAAM,EAAA;AACLrB,MAAAA,IAAI,EAAEA,IAAK;MACXsB,SAAS,EAAA,IAAA;AACTjB,MAAAA,SAAS,EAAC,oBAAoB;AAC9BoB,MAAAA,KAAK,EAAE;AACL;AACA,QAAA,oBAAoB,EAAE,MAAM;QAC5BvB,eAAe,EAAEA,eAAe,IAAIW,uBAAAA;OACpC;AAAAT,MAAAA,QAAA,EAEDA,QAAAA;KACK,CAAA;AACV,GAAQ,CAAC,CAAA;AAEb;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CircularButton.js","sources":["../../src/circularButton/CircularButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { cloneElement } from 'react';\n\nimport Body from '../body/Body';\nimport { typeClassMap, priorityClassMap } from '../button/classMap';\nimport { Breakpoint, ControlType, Priority, Typography } from '../common';\nimport Circle from '../common/circle';\nimport { useMedia } from '../common/hooks/useMedia';\n\nexport interface CircularButtonProps {\n className?: string;\n children: string;\n disabled?: boolean;\n icon: React.ReactElement<{ size?: unknown }>;\n onClick?: React.MouseEventHandler<HTMLInputElement>;\n priority?: `${Priority.PRIMARY | Priority.SECONDARY}`;\n type?: `${ControlType.ACCENT | ControlType.POSITIVE | ControlType.NEGATIVE}`;\n}\n\nconst CircularButton = ({\n className,\n children,\n disabled,\n icon,\n priority = Priority.PRIMARY,\n type = ControlType.ACCENT,\n ...rest\n}: CircularButtonProps) => {\n const classes = clsx('btn np-btn', 'm-b-1', typeClassMap[type], priorityClassMap[priority]);\n\n const iconElement = Number(icon.props.size) !== 24 ? cloneElement(icon, { size: 24 }) : icon;\n\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n\n return (\n <label className={clsx('np-circular-btn', priority, type, disabled && 'disabled', className)}>\n <Circle\n as=\"input\"\n // @ts-expect-error it's input[type=button] element\n type=\"button\"\n size={isTinyViewport ?
|
|
1
|
+
{"version":3,"file":"CircularButton.js","sources":["../../src/circularButton/CircularButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { cloneElement } from 'react';\n\nimport Body from '../body/Body';\nimport { typeClassMap, priorityClassMap } from '../button/classMap';\nimport { Breakpoint, ControlType, Priority, Typography } from '../common';\nimport Circle from '../common/circle';\nimport { useMedia } from '../common/hooks/useMedia';\n\nexport interface CircularButtonProps {\n className?: string;\n children: string;\n disabled?: boolean;\n icon: React.ReactElement<{ size?: unknown }>;\n onClick?: React.MouseEventHandler<HTMLInputElement>;\n priority?: `${Priority.PRIMARY | Priority.SECONDARY}`;\n type?: `${ControlType.ACCENT | ControlType.POSITIVE | ControlType.NEGATIVE}`;\n}\n\nconst CircularButton = ({\n className,\n children,\n disabled,\n icon,\n priority = Priority.PRIMARY,\n type = ControlType.ACCENT,\n ...rest\n}: CircularButtonProps) => {\n const classes = clsx('btn np-btn', 'm-b-1', typeClassMap[type], priorityClassMap[priority]);\n\n const iconElement = Number(icon.props.size) !== 24 ? cloneElement(icon, { size: 24 }) : icon;\n\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n\n return (\n <label className={clsx('np-circular-btn', priority, type, disabled && 'disabled', className)}>\n <Circle\n as=\"input\"\n // @ts-expect-error it's input[type=button] element\n type=\"button\"\n size={isTinyViewport ? 72 : 56}\n aria-label={children}\n className={classes}\n disabled={disabled}\n {...rest}\n />\n {iconElement}\n <Body as=\"span\" className=\"np-circular-btn__label\" type={Typography.BODY_DEFAULT_BOLD}>\n {children}\n </Body>\n </label>\n );\n};\n\nexport default CircularButton;\n"],"names":["CircularButton","className","children","disabled","icon","priority","Priority","PRIMARY","type","ControlType","ACCENT","rest","classes","clsx","typeClassMap","priorityClassMap","iconElement","Number","props","size","cloneElement","isTinyViewport","useMedia","Breakpoint","ZOOM_400","_jsxs","_jsx","Circle","as","Body","Typography","BODY_DEFAULT_BOLD"],"mappings":";;;;;;;;;;;;;AAmBMA,MAAAA,cAAc,GAAGA,CAAC;EACtBC,SAAS;EACTC,QAAQ;EACRC,QAAQ;EACRC,IAAI;EACJC,QAAQ,GAAGC,gBAAQ,CAACC,OAAO;EAC3BC,IAAI,GAAGC,mBAAW,CAACC,MAAM;EACzB,GAAGC,IAAAA;AACiB,CAAA,KAAI;AACxB,EAAA,MAAMC,OAAO,GAAGC,SAAI,CAAC,YAAY,EAAE,OAAO,EAAEC,qBAAY,CAACN,IAAI,CAAC,EAAEO,yBAAgB,CAACV,QAAQ,CAAC,CAAC,CAAA;AAE3F,EAAA,MAAMW,WAAW,GAAGC,MAAM,CAACb,IAAI,CAACc,KAAK,CAACC,IAAI,CAAC,KAAK,EAAE,gBAAGC,kBAAY,CAAChB,IAAI,EAAE;AAAEe,IAAAA,IAAI,EAAE,EAAA;GAAI,CAAC,GAAGf,IAAI,CAAA;EAE5F,MAAMiB,cAAc,GAAGC,iBAAQ,CAAC,eAAeC,qBAAU,CAACC,QAAQ,CAAA,GAAA,CAAK,CAAC,CAAA;AAExE,EAAA,oBACEC,eAAA,CAAA,OAAA,EAAA;AAAOxB,IAAAA,SAAS,EAAEY,SAAI,CAAC,iBAAiB,EAAER,QAAQ,EAAEG,IAAI,EAAEL,QAAQ,IAAI,UAAU,EAAEF,SAAS,CAAE;IAAAC,QAAA,EAAA,cAC3FwB,cAAA,CAACC,MAAM,EAAA;AACLC,MAAAA,EAAE,EAAC,OAAA;AACH;AAAA;AACApB,MAAAA,IAAI,EAAC,QAAQ;AACbW,MAAAA,IAAI,EAAEE,cAAc,GAAG,EAAE,GAAG,EAAG;AAC/B,MAAA,YAAA,EAAYnB,QAAS;AACrBD,MAAAA,SAAS,EAAEW,OAAQ;AACnBT,MAAAA,QAAQ,EAAEA,QAAS;MAAA,GACfQ,IAAAA;AAAI,KAEV,CAAA,EAACK,WAAW,eACZU,cAAA,CAACG,IAAI,EAAA;AAACD,MAAAA,EAAE,EAAC,MAAM;AAAC3B,MAAAA,SAAS,EAAC,wBAAwB;MAACO,IAAI,EAAEsB,qBAAU,CAACC,iBAAkB;AAAA7B,MAAAA,QAAA,EACnFA,QAAAA;AAAQ,KACL,CACR,CAAA;AAAA,GAAO,CAAC,CAAA;AAEZ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CircularButton.mjs","sources":["../../src/circularButton/CircularButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { cloneElement } from 'react';\n\nimport Body from '../body/Body';\nimport { typeClassMap, priorityClassMap } from '../button/classMap';\nimport { Breakpoint, ControlType, Priority, Typography } from '../common';\nimport Circle from '../common/circle';\nimport { useMedia } from '../common/hooks/useMedia';\n\nexport interface CircularButtonProps {\n className?: string;\n children: string;\n disabled?: boolean;\n icon: React.ReactElement<{ size?: unknown }>;\n onClick?: React.MouseEventHandler<HTMLInputElement>;\n priority?: `${Priority.PRIMARY | Priority.SECONDARY}`;\n type?: `${ControlType.ACCENT | ControlType.POSITIVE | ControlType.NEGATIVE}`;\n}\n\nconst CircularButton = ({\n className,\n children,\n disabled,\n icon,\n priority = Priority.PRIMARY,\n type = ControlType.ACCENT,\n ...rest\n}: CircularButtonProps) => {\n const classes = clsx('btn np-btn', 'm-b-1', typeClassMap[type], priorityClassMap[priority]);\n\n const iconElement = Number(icon.props.size) !== 24 ? cloneElement(icon, { size: 24 }) : icon;\n\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n\n return (\n <label className={clsx('np-circular-btn', priority, type, disabled && 'disabled', className)}>\n <Circle\n as=\"input\"\n // @ts-expect-error it's input[type=button] element\n type=\"button\"\n size={isTinyViewport ?
|
|
1
|
+
{"version":3,"file":"CircularButton.mjs","sources":["../../src/circularButton/CircularButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { cloneElement } from 'react';\n\nimport Body from '../body/Body';\nimport { typeClassMap, priorityClassMap } from '../button/classMap';\nimport { Breakpoint, ControlType, Priority, Typography } from '../common';\nimport Circle from '../common/circle';\nimport { useMedia } from '../common/hooks/useMedia';\n\nexport interface CircularButtonProps {\n className?: string;\n children: string;\n disabled?: boolean;\n icon: React.ReactElement<{ size?: unknown }>;\n onClick?: React.MouseEventHandler<HTMLInputElement>;\n priority?: `${Priority.PRIMARY | Priority.SECONDARY}`;\n type?: `${ControlType.ACCENT | ControlType.POSITIVE | ControlType.NEGATIVE}`;\n}\n\nconst CircularButton = ({\n className,\n children,\n disabled,\n icon,\n priority = Priority.PRIMARY,\n type = ControlType.ACCENT,\n ...rest\n}: CircularButtonProps) => {\n const classes = clsx('btn np-btn', 'm-b-1', typeClassMap[type], priorityClassMap[priority]);\n\n const iconElement = Number(icon.props.size) !== 24 ? cloneElement(icon, { size: 24 }) : icon;\n\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n\n return (\n <label className={clsx('np-circular-btn', priority, type, disabled && 'disabled', className)}>\n <Circle\n as=\"input\"\n // @ts-expect-error it's input[type=button] element\n type=\"button\"\n size={isTinyViewport ? 72 : 56}\n aria-label={children}\n className={classes}\n disabled={disabled}\n {...rest}\n />\n {iconElement}\n <Body as=\"span\" className=\"np-circular-btn__label\" type={Typography.BODY_DEFAULT_BOLD}>\n {children}\n </Body>\n </label>\n );\n};\n\nexport default CircularButton;\n"],"names":["CircularButton","className","children","disabled","icon","priority","Priority","PRIMARY","type","ControlType","ACCENT","rest","classes","clsx","typeClassMap","priorityClassMap","iconElement","Number","props","size","cloneElement","isTinyViewport","useMedia","Breakpoint","ZOOM_400","_jsxs","_jsx","Circle","as","Body","Typography","BODY_DEFAULT_BOLD"],"mappings":";;;;;;;;;;;AAmBMA,MAAAA,cAAc,GAAGA,CAAC;EACtBC,SAAS;EACTC,QAAQ;EACRC,QAAQ;EACRC,IAAI;EACJC,QAAQ,GAAGC,QAAQ,CAACC,OAAO;EAC3BC,IAAI,GAAGC,WAAW,CAACC,MAAM;EACzB,GAAGC,IAAAA;AACiB,CAAA,KAAI;AACxB,EAAA,MAAMC,OAAO,GAAGC,IAAI,CAAC,YAAY,EAAE,OAAO,EAAEC,YAAY,CAACN,IAAI,CAAC,EAAEO,gBAAgB,CAACV,QAAQ,CAAC,CAAC,CAAA;AAE3F,EAAA,MAAMW,WAAW,GAAGC,MAAM,CAACb,IAAI,CAACc,KAAK,CAACC,IAAI,CAAC,KAAK,EAAE,gBAAGC,YAAY,CAAChB,IAAI,EAAE;AAAEe,IAAAA,IAAI,EAAE,EAAA;GAAI,CAAC,GAAGf,IAAI,CAAA;EAE5F,MAAMiB,cAAc,GAAGC,QAAQ,CAAC,eAAeC,UAAU,CAACC,QAAQ,CAAA,GAAA,CAAK,CAAC,CAAA;AAExE,EAAA,oBACEC,IAAA,CAAA,OAAA,EAAA;AAAOxB,IAAAA,SAAS,EAAEY,IAAI,CAAC,iBAAiB,EAAER,QAAQ,EAAEG,IAAI,EAAEL,QAAQ,IAAI,UAAU,EAAEF,SAAS,CAAE;IAAAC,QAAA,EAAA,cAC3FwB,GAAA,CAACC,MAAM,EAAA;AACLC,MAAAA,EAAE,EAAC,OAAA;AACH;AAAA;AACApB,MAAAA,IAAI,EAAC,QAAQ;AACbW,MAAAA,IAAI,EAAEE,cAAc,GAAG,EAAE,GAAG,EAAG;AAC/B,MAAA,YAAA,EAAYnB,QAAS;AACrBD,MAAAA,SAAS,EAAEW,OAAQ;AACnBT,MAAAA,QAAQ,EAAEA,QAAS;MAAA,GACfQ,IAAAA;AAAI,KAEV,CAAA,EAACK,WAAW,eACZU,GAAA,CAACG,IAAI,EAAA;AAACD,MAAAA,EAAE,EAAC,MAAM;AAAC3B,MAAAA,SAAS,EAAC,wBAAwB;MAACO,IAAI,EAAEsB,UAAU,CAACC,iBAAkB;AAAA7B,MAAAA,QAAA,EACnFA,QAAAA;AAAQ,KACL,CACR,CAAA;AAAA,GAAO,CAAC,CAAA;AAEZ;;;;"}
|
|
@@ -2,8 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var clsx = require('clsx');
|
|
5
|
+
var useMedia = require('../hooks/useMedia.js');
|
|
6
|
+
var breakpoint = require('../propsValues/breakpoint.js');
|
|
5
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
8
|
|
|
9
|
+
const MAP_ICON_SIZE = {
|
|
10
|
+
16: 12,
|
|
11
|
+
24: 16,
|
|
12
|
+
32: 18,
|
|
13
|
+
40: 20,
|
|
14
|
+
48: 24,
|
|
15
|
+
56: 28,
|
|
16
|
+
72: 36
|
|
17
|
+
};
|
|
7
18
|
const Circle = /*#__PURE__*/React.forwardRef(function Circle({
|
|
8
19
|
as: Element = 'div',
|
|
9
20
|
children,
|
|
@@ -13,12 +24,14 @@ const Circle = /*#__PURE__*/React.forwardRef(function Circle({
|
|
|
13
24
|
style,
|
|
14
25
|
...props
|
|
15
26
|
}, ref) {
|
|
27
|
+
const isTinyViewport = useMedia.useMedia(`(max-width: ${breakpoint.Breakpoint.ZOOM_400}px)`);
|
|
16
28
|
return /*#__PURE__*/jsxRuntime.jsx(Element, {
|
|
17
29
|
...props,
|
|
18
30
|
ref: ref,
|
|
19
31
|
style: {
|
|
20
|
-
|
|
21
|
-
'--circle-size': fixedSize ? `${size}px` :
|
|
32
|
+
'--circle-size': fixedSize ? `${size}px` : `var(--size-${size})`,
|
|
33
|
+
'--circle-icon-size': isTinyViewport && !fixedSize ? `${MAP_ICON_SIZE[size] / 2}px` : `${MAP_ICON_SIZE[size]}px`,
|
|
34
|
+
...style
|
|
22
35
|
},
|
|
23
36
|
className: clsx.clsx('np-circle', 'd-flex align-items-center justify-content-center', className),
|
|
24
37
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Circle.js","sources":["../../../src/common/circle/Circle.tsx"],"sourcesContent":["import { HTMLAttributes, forwardRef } from 'react';\nimport { clsx } from 'clsx';\n\nexport type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 |
|
|
1
|
+
{"version":3,"file":"Circle.js","sources":["../../../src/common/circle/Circle.tsx"],"sourcesContent":["import { HTMLAttributes, forwardRef } from 'react';\nimport { clsx } from 'clsx';\nimport { useMedia } from '../hooks/useMedia';\nimport { Breakpoint } from '../propsValues/breakpoint';\n\nexport type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 72;\n\nexport type Props = {\n /**\n * Modify underlying element, `div` by default\n */\n as?: React.ElementType;\n /**\n * Set size of the circle in px, `48` by default\n */\n size?: ShapeSize;\n /**\n * When `true` will use the fixed size (`48px`) instead of the CSS spacing variable (`--size-*`)\n * as those can be dynamic a at certain viewport sizes\n */\n fixedSize?: boolean;\n} & HTMLAttributes<HTMLDivElement>;\n\n/**\n * circle like components has custom sizes for icons\n */\nconst MAP_ICON_SIZE = {\n 16: 12,\n 24: 16,\n 32: 18,\n 40: 20,\n 48: 24,\n 56: 28,\n 72: 36,\n};\n\nconst Circle = forwardRef(function Circle(\n {\n as: Element = 'div',\n children,\n size = 48,\n fixedSize = false,\n className,\n style,\n ...props\n }: Props,\n ref,\n) {\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n return (\n <Element\n {...props}\n ref={ref}\n style={{\n '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})`,\n '--circle-icon-size':\n isTinyViewport && !fixedSize\n ? `${MAP_ICON_SIZE[size] / 2}px`\n : `${MAP_ICON_SIZE[size]}px`,\n ...style,\n }}\n className={clsx('np-circle', 'd-flex align-items-center justify-content-center', className)}\n >\n {children}\n </Element>\n );\n});\n\nexport default Circle;\n"],"names":["MAP_ICON_SIZE","Circle","forwardRef","as","Element","children","size","fixedSize","className","style","props","ref","isTinyViewport","useMedia","Breakpoint","ZOOM_400","_jsx","clsx"],"mappings":";;;;;;;;AA0BA,MAAMA,aAAa,GAAG;AACpB,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAA;CACL,CAAA;AAED,MAAMC,MAAM,gBAAGC,gBAAU,CAAC,SAASD,MAAMA,CACvC;EACEE,EAAE,EAAEC,OAAO,GAAG,KAAK;EACnBC,QAAQ;AACRC,EAAAA,IAAI,GAAG,EAAE;AACTC,EAAAA,SAAS,GAAG,KAAK;EACjBC,SAAS;EACTC,KAAK;EACL,GAAGC,KAAAA;AAAK,CACF,EACRC,GAAG,EAAA;EAEH,MAAMC,cAAc,GAAGC,iBAAQ,CAAC,eAAeC,qBAAU,CAACC,QAAQ,CAAA,GAAA,CAAK,CAAC,CAAA;EACxE,oBACEC,cAAA,CAACZ,OAAO,EAAA;AAAA,IAAA,GACFM,KAAK;AACTC,IAAAA,GAAG,EAAEA,GAAI;AACTF,IAAAA,KAAK,EAAE;MACL,eAAe,EAAEF,SAAS,GAAG,CAAA,EAAGD,IAAI,CAAI,EAAA,CAAA,GAAG,CAAcA,WAAAA,EAAAA,IAAI,CAAG,CAAA,CAAA;MAChE,oBAAoB,EAClBM,cAAc,IAAI,CAACL,SAAS,GACxB,CAAA,EAAGP,aAAa,CAACM,IAAI,CAAC,GAAG,CAAC,IAAI,GAC9B,CAAA,EAAGN,aAAa,CAACM,IAAI,CAAC,CAAI,EAAA,CAAA;MAChC,GAAGG,KAAAA;KACH;IACFD,SAAS,EAAES,SAAI,CAAC,WAAW,EAAE,kDAAkD,EAAET,SAAS,CAAE;AAAAH,IAAAA,QAAA,EAE3FA,QAAAA;AAAQ,GACF,CAAC,CAAA;AAEd,CAAC;;;;"}
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
+
import { useMedia } from '../hooks/useMedia.mjs';
|
|
4
|
+
import { Breakpoint } from '../propsValues/breakpoint.mjs';
|
|
3
5
|
import { jsx } from 'react/jsx-runtime';
|
|
4
6
|
|
|
7
|
+
const MAP_ICON_SIZE = {
|
|
8
|
+
16: 12,
|
|
9
|
+
24: 16,
|
|
10
|
+
32: 18,
|
|
11
|
+
40: 20,
|
|
12
|
+
48: 24,
|
|
13
|
+
56: 28,
|
|
14
|
+
72: 36
|
|
15
|
+
};
|
|
5
16
|
const Circle = /*#__PURE__*/forwardRef(function Circle({
|
|
6
17
|
as: Element = 'div',
|
|
7
18
|
children,
|
|
@@ -11,12 +22,14 @@ const Circle = /*#__PURE__*/forwardRef(function Circle({
|
|
|
11
22
|
style,
|
|
12
23
|
...props
|
|
13
24
|
}, ref) {
|
|
25
|
+
const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
|
|
14
26
|
return /*#__PURE__*/jsx(Element, {
|
|
15
27
|
...props,
|
|
16
28
|
ref: ref,
|
|
17
29
|
style: {
|
|
18
|
-
|
|
19
|
-
'--circle-size': fixedSize ? `${size}px` :
|
|
30
|
+
'--circle-size': fixedSize ? `${size}px` : `var(--size-${size})`,
|
|
31
|
+
'--circle-icon-size': isTinyViewport && !fixedSize ? `${MAP_ICON_SIZE[size] / 2}px` : `${MAP_ICON_SIZE[size]}px`,
|
|
32
|
+
...style
|
|
20
33
|
},
|
|
21
34
|
className: clsx('np-circle', 'd-flex align-items-center justify-content-center', className),
|
|
22
35
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Circle.mjs","sources":["../../../src/common/circle/Circle.tsx"],"sourcesContent":["import { HTMLAttributes, forwardRef } from 'react';\nimport { clsx } from 'clsx';\n\nexport type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 |
|
|
1
|
+
{"version":3,"file":"Circle.mjs","sources":["../../../src/common/circle/Circle.tsx"],"sourcesContent":["import { HTMLAttributes, forwardRef } from 'react';\nimport { clsx } from 'clsx';\nimport { useMedia } from '../hooks/useMedia';\nimport { Breakpoint } from '../propsValues/breakpoint';\n\nexport type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 72;\n\nexport type Props = {\n /**\n * Modify underlying element, `div` by default\n */\n as?: React.ElementType;\n /**\n * Set size of the circle in px, `48` by default\n */\n size?: ShapeSize;\n /**\n * When `true` will use the fixed size (`48px`) instead of the CSS spacing variable (`--size-*`)\n * as those can be dynamic a at certain viewport sizes\n */\n fixedSize?: boolean;\n} & HTMLAttributes<HTMLDivElement>;\n\n/**\n * circle like components has custom sizes for icons\n */\nconst MAP_ICON_SIZE = {\n 16: 12,\n 24: 16,\n 32: 18,\n 40: 20,\n 48: 24,\n 56: 28,\n 72: 36,\n};\n\nconst Circle = forwardRef(function Circle(\n {\n as: Element = 'div',\n children,\n size = 48,\n fixedSize = false,\n className,\n style,\n ...props\n }: Props,\n ref,\n) {\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n return (\n <Element\n {...props}\n ref={ref}\n style={{\n '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})`,\n '--circle-icon-size':\n isTinyViewport && !fixedSize\n ? `${MAP_ICON_SIZE[size] / 2}px`\n : `${MAP_ICON_SIZE[size]}px`,\n ...style,\n }}\n className={clsx('np-circle', 'd-flex align-items-center justify-content-center', className)}\n >\n {children}\n </Element>\n );\n});\n\nexport default Circle;\n"],"names":["MAP_ICON_SIZE","Circle","forwardRef","as","Element","children","size","fixedSize","className","style","props","ref","isTinyViewport","useMedia","Breakpoint","ZOOM_400","_jsx","clsx"],"mappings":";;;;;;AA0BA,MAAMA,aAAa,GAAG;AACpB,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAE;AACN,EAAA,EAAE,EAAE,EAAA;CACL,CAAA;AAED,MAAMC,MAAM,gBAAGC,UAAU,CAAC,SAASD,MAAMA,CACvC;EACEE,EAAE,EAAEC,OAAO,GAAG,KAAK;EACnBC,QAAQ;AACRC,EAAAA,IAAI,GAAG,EAAE;AACTC,EAAAA,SAAS,GAAG,KAAK;EACjBC,SAAS;EACTC,KAAK;EACL,GAAGC,KAAAA;AAAK,CACF,EACRC,GAAG,EAAA;EAEH,MAAMC,cAAc,GAAGC,QAAQ,CAAC,eAAeC,UAAU,CAACC,QAAQ,CAAA,GAAA,CAAK,CAAC,CAAA;EACxE,oBACEC,GAAA,CAACZ,OAAO,EAAA;AAAA,IAAA,GACFM,KAAK;AACTC,IAAAA,GAAG,EAAEA,GAAI;AACTF,IAAAA,KAAK,EAAE;MACL,eAAe,EAAEF,SAAS,GAAG,CAAA,EAAGD,IAAI,CAAI,EAAA,CAAA,GAAG,CAAcA,WAAAA,EAAAA,IAAI,CAAG,CAAA,CAAA;MAChE,oBAAoB,EAClBM,cAAc,IAAI,CAACL,SAAS,GACxB,CAAA,EAAGP,aAAa,CAACM,IAAI,CAAC,GAAG,CAAC,IAAI,GAC9B,CAAA,EAAGN,aAAa,CAACM,IAAI,CAAC,CAAI,EAAA,CAAA;MAChC,GAAGG,KAAAA;KACH;IACFD,SAAS,EAAES,IAAI,CAAC,WAAW,EAAE,kDAAkD,EAAET,SAAS,CAAE;AAAAH,IAAAA,QAAA,EAE3FA,QAAAA;AAAQ,GACF,CAAC,CAAA;AAEd,CAAC;;;;"}
|
package/build/i18n/en.json
CHANGED
|
@@ -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!",
|
package/build/i18n/en.json.js
CHANGED
|
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/i18n/en.json.mjs
CHANGED
|
@@ -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
|
@@ -1013,8 +1013,8 @@ div.critical-comms .critical-comms-body {
|
|
|
1013
1013
|
}
|
|
1014
1014
|
@media (max-width: 320px) {
|
|
1015
1015
|
.np-circular-btn .tw-icon {
|
|
1016
|
-
top:
|
|
1017
|
-
top: var(--size-
|
|
1016
|
+
top: 12px;
|
|
1017
|
+
top: var(--size-12);
|
|
1018
1018
|
}
|
|
1019
1019
|
}
|
|
1020
1020
|
.np-circular-btn .tw-icon > svg {
|
|
@@ -1169,6 +1169,10 @@ div.critical-comms .critical-comms-body {
|
|
|
1169
1169
|
height: var(--circle-size);
|
|
1170
1170
|
flex-shrink: 0;
|
|
1171
1171
|
}
|
|
1172
|
+
.np-circle .tw-icon > svg {
|
|
1173
|
+
height: var(--circle-icon-size);
|
|
1174
|
+
width: var(--circle-icon-size);
|
|
1175
|
+
}
|
|
1172
1176
|
.np-bottom-sheet {
|
|
1173
1177
|
border-radius: 10px 10px 0 0;
|
|
1174
1178
|
}
|
|
@@ -4155,12 +4159,6 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4155
4159
|
transform: translateY(-24px);
|
|
4156
4160
|
}
|
|
4157
4161
|
}
|
|
4158
|
-
.status-icon > svg {
|
|
4159
|
-
height: 32px;
|
|
4160
|
-
height: var(--size-32);
|
|
4161
|
-
width: 32px;
|
|
4162
|
-
width: var(--size-32);
|
|
4163
|
-
}
|
|
4164
4162
|
.status-circle .light {
|
|
4165
4163
|
color: var(--color-contrast);
|
|
4166
4164
|
}
|
|
@@ -4176,20 +4174,6 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4176
4174
|
.np-theme-personal .status-circle.pending .status-icon {
|
|
4177
4175
|
color: var(--color-dark);
|
|
4178
4176
|
}
|
|
4179
|
-
.status-circle-sm .status-icon > svg {
|
|
4180
|
-
height: 14px;
|
|
4181
|
-
height: var(--size-14);
|
|
4182
|
-
width: 14px;
|
|
4183
|
-
width: var(--size-14);
|
|
4184
|
-
}
|
|
4185
|
-
@media (max-width: 320px) {
|
|
4186
|
-
.status-circle-sm .status-icon > svg {
|
|
4187
|
-
width: 24px;
|
|
4188
|
-
width: var(--size-24);
|
|
4189
|
-
height: 24px;
|
|
4190
|
-
height: var(--size-24);
|
|
4191
|
-
}
|
|
4192
|
-
}
|
|
4193
4177
|
.status-circle.negative,
|
|
4194
4178
|
.status-circle.error {
|
|
4195
4179
|
background-color: var(--color-sentiment-negative);
|
|
@@ -5025,221 +5009,6 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
5025
5009
|
padding: 0 var(--size-24);
|
|
5026
5010
|
}
|
|
5027
5011
|
}
|
|
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, var(--color-contrast-overlay), var(--color-contrast-overlay)), linear-gradient(to right, var(--color-contrast-overlay), var(--color-contrast-overlay)), linear-gradient(to right, rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0)), linear-gradient(to left, rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0));
|
|
5052
|
-
background-position: left center, right center, left center, right center;
|
|
5053
|
-
background-repeat: no-repeat;
|
|
5054
|
-
background-color: var(--color-contrast-overlay);
|
|
5055
|
-
background-size: 15px 100%, 15px 100%, 15px 100%, 15px 100%;
|
|
5056
|
-
background-attachment: local, local, scroll, scroll;
|
|
5057
|
-
overflow-x: auto;
|
|
5058
|
-
border-radius: 10px;
|
|
5059
|
-
}
|
|
5060
|
-
.np-theme-personal--dark .np-table-inner-container {
|
|
5061
|
-
background-image: linear-gradient(to right, var(--color-contrast-overlay), var(--color-contrast-overlay)), linear-gradient(to right, var(--color-contrast-overlay), var(--color-contrast-overlay)), linear-gradient(to right, #000000, rgba(0, 0, 0, 0)), linear-gradient(to left, #000000, rgba(0, 0, 0, 0));
|
|
5062
|
-
}
|
|
5063
|
-
.np-table-row:last-child .np-table-cell:first-child {
|
|
5064
|
-
border-bottom-left-radius: 10px;
|
|
5065
|
-
}
|
|
5066
|
-
.np-table-row:last-child .np-table-cell:last-child {
|
|
5067
|
-
border-bottom-right-radius: 10px;
|
|
5068
|
-
}
|
|
5069
|
-
.np-table-row--clickable:hover .np-table-cell {
|
|
5070
|
-
background-color: var(--color-background-screen-hover);
|
|
5071
|
-
cursor: pointer;
|
|
5072
|
-
}
|
|
5073
|
-
.np-table-row--separator .np-table-cell {
|
|
5074
|
-
padding: 0;
|
|
5075
|
-
}
|
|
5076
|
-
.np-table-header,
|
|
5077
|
-
.np-table-cell {
|
|
5078
|
-
padding: 0;
|
|
5079
|
-
}
|
|
5080
|
-
.np-table-header:first-child,
|
|
5081
|
-
.np-table-cell:first-child {
|
|
5082
|
-
padding-left: 16px;
|
|
5083
|
-
padding-left: var(--size-16);
|
|
5084
|
-
}
|
|
5085
|
-
.np-table-header:first-child .np-table-header-content,
|
|
5086
|
-
.np-table-cell:first-child .np-table-header-content,
|
|
5087
|
-
.np-table-header:first-child .np-table-cell-content,
|
|
5088
|
-
.np-table-cell:first-child .np-table-cell-content {
|
|
5089
|
-
padding-left: 0;
|
|
5090
|
-
}
|
|
5091
|
-
.np-table-header:last-child,
|
|
5092
|
-
.np-table-cell:last-child {
|
|
5093
|
-
padding-right: 16px;
|
|
5094
|
-
padding-right: var(--size-16);
|
|
5095
|
-
}
|
|
5096
|
-
.np-table-header:last-child .np-table-header-content,
|
|
5097
|
-
.np-table-cell:last-child .np-table-header-content,
|
|
5098
|
-
.np-table-header:last-child .np-table-cell-content,
|
|
5099
|
-
.np-table-cell:last-child .np-table-cell-content {
|
|
5100
|
-
padding-right: 0;
|
|
5101
|
-
}
|
|
5102
|
-
.np-table-header .np-text-body-large-bold,
|
|
5103
|
-
.np-table-cell .np-text-body-large-bold {
|
|
5104
|
-
font-size: 0.875rem;
|
|
5105
|
-
font-size: var(--font-size-14);
|
|
5106
|
-
}
|
|
5107
|
-
.np-table-header.np-table-header--right,
|
|
5108
|
-
.np-table-cell.np-table-cell--right {
|
|
5109
|
-
padding-right: calc(8px + 12px);
|
|
5110
|
-
padding-right: calc(var(--size-8) + var(--size-12));
|
|
5111
|
-
}
|
|
5112
|
-
.np-table-header.np-table-header--right > .np-text-body-default,
|
|
5113
|
-
.np-table-cell.np-table-cell--right > .np-text-body-default {
|
|
5114
|
-
text-align: right;
|
|
5115
|
-
}
|
|
5116
|
-
.np-table-header.np-table-header--right .np-table-header-content,
|
|
5117
|
-
.np-table-cell.np-table-cell--right .np-table-content {
|
|
5118
|
-
justify-content: end;
|
|
5119
|
-
}
|
|
5120
|
-
.np-table-header-content,
|
|
5121
|
-
.np-table-content {
|
|
5122
|
-
display: flex;
|
|
5123
|
-
align-items: center;
|
|
5124
|
-
justify-content: start;
|
|
5125
|
-
}
|
|
5126
|
-
.np-table-header {
|
|
5127
|
-
min-width: 160px;
|
|
5128
|
-
padding-right: 8px;
|
|
5129
|
-
padding-right: var(--size-8);
|
|
5130
|
-
padding-bottom: 8px;
|
|
5131
|
-
padding-bottom: var(--size-8);
|
|
5132
|
-
padding-left: 8px;
|
|
5133
|
-
padding-left: var(--size-8);
|
|
5134
|
-
background-color: rgba(134,167,189,0.10196);
|
|
5135
|
-
background-color: var(--color-background-neutral);
|
|
5136
|
-
color: #37517e;
|
|
5137
|
-
color: var(--color-content-primary);
|
|
5138
|
-
}
|
|
5139
|
-
.np-table-header-content {
|
|
5140
|
-
padding-top: 5px;
|
|
5141
|
-
padding-bottom: 5px;
|
|
5142
|
-
white-space: nowrap;
|
|
5143
|
-
}
|
|
5144
|
-
.np-table-header--has-error {
|
|
5145
|
-
color: var(--color-sentiment-negative);
|
|
5146
|
-
}
|
|
5147
|
-
.np-table-cell {
|
|
5148
|
-
padding: 16px 8px;
|
|
5149
|
-
padding: var(--size-16) var(--size-8);
|
|
5150
|
-
}
|
|
5151
|
-
.np-table-cell--primary {
|
|
5152
|
-
min-width: 200px;
|
|
5153
|
-
}
|
|
5154
|
-
.np-table-cell--currency .np-text-body-default {
|
|
5155
|
-
white-space: nowrap;
|
|
5156
|
-
}
|
|
5157
|
-
.np-table-cell--status .status-circle {
|
|
5158
|
-
width: 24px;
|
|
5159
|
-
height: 24px;
|
|
5160
|
-
}
|
|
5161
|
-
.np-table-cell--status .status-circle .status-icon > svg {
|
|
5162
|
-
width: 21px;
|
|
5163
|
-
height: 21px;
|
|
5164
|
-
}
|
|
5165
|
-
.np-table-cell .tw-chevron {
|
|
5166
|
-
margin-left: 8px;
|
|
5167
|
-
margin-left: var(--size-8);
|
|
5168
|
-
}
|
|
5169
|
-
.np-table-cell-separator {
|
|
5170
|
-
margin-top: 4px;
|
|
5171
|
-
margin-top: var(--size-4);
|
|
5172
|
-
margin-bottom: 4px;
|
|
5173
|
-
margin-bottom: var(--size-4);
|
|
5174
|
-
height: 1px;
|
|
5175
|
-
padding: 0;
|
|
5176
|
-
background-color: rgba(134,167,189,0.10196);
|
|
5177
|
-
background-color: var(--color-background-neutral);
|
|
5178
|
-
}
|
|
5179
|
-
.np-table-cell .np-text-body-default {
|
|
5180
|
-
line-height: 1.375rem;
|
|
5181
|
-
line-height: var(--line-height-22);
|
|
5182
|
-
}
|
|
5183
|
-
.np-table-cell .np-text-body-large-bold {
|
|
5184
|
-
display: flex;
|
|
5185
|
-
align-items: center;
|
|
5186
|
-
color: #37517e;
|
|
5187
|
-
color: var(--color-content-primary);
|
|
5188
|
-
white-space: nowrap;
|
|
5189
|
-
}
|
|
5190
|
-
.np-table-cell .np-table-content--success {
|
|
5191
|
-
color: var(--color-sentiment-positive);
|
|
5192
|
-
}
|
|
5193
|
-
.np-table-cell .np-table-content--error {
|
|
5194
|
-
color: var(--color-sentiment-negative);
|
|
5195
|
-
}
|
|
5196
|
-
.np-table-cell .tw-loader {
|
|
5197
|
-
margin: 150px auto;
|
|
5198
|
-
}
|
|
5199
|
-
@media (max-width: 320px) {
|
|
5200
|
-
.np-table-cell .tw-loader {
|
|
5201
|
-
margin-top: 70px;
|
|
5202
|
-
margin-bottom: 70px;
|
|
5203
|
-
}
|
|
5204
|
-
}
|
|
5205
|
-
.np-table-content {
|
|
5206
|
-
gap: 12px;
|
|
5207
|
-
gap: var(--size-12);
|
|
5208
|
-
}
|
|
5209
|
-
.np-table-content--success,
|
|
5210
|
-
.np-table-content--error {
|
|
5211
|
-
gap: 4px;
|
|
5212
|
-
gap: var(--size-4);
|
|
5213
|
-
}
|
|
5214
|
-
.np-table-content--success .np-table-content-text,
|
|
5215
|
-
.np-table-content--error .np-table-content-text {
|
|
5216
|
-
line-height: 155%;
|
|
5217
|
-
}
|
|
5218
|
-
.np-table-content-media {
|
|
5219
|
-
flex-shrink: 0;
|
|
5220
|
-
}
|
|
5221
|
-
.np-table-content-body {
|
|
5222
|
-
display: flex;
|
|
5223
|
-
flex-direction: column;
|
|
5224
|
-
font-size: 0.75rem;
|
|
5225
|
-
font-size: var(--font-size-12);
|
|
5226
|
-
color: #768e9c;
|
|
5227
|
-
color: var(--color-content-tertiary);
|
|
5228
|
-
}
|
|
5229
|
-
.np-table-content--reversed {
|
|
5230
|
-
flex-direction: row-reverse;
|
|
5231
|
-
}
|
|
5232
|
-
.np-table-content--reversed .np-table-content-body {
|
|
5233
|
-
align-items: end;
|
|
5234
|
-
}
|
|
5235
|
-
.np-table-empty-data {
|
|
5236
|
-
display: flex;
|
|
5237
|
-
align-items: center;
|
|
5238
|
-
}
|
|
5239
|
-
.np-table-empty-data .status-circle {
|
|
5240
|
-
margin-right: 12px;
|
|
5241
|
-
margin-right: var(--size-12);
|
|
5242
|
-
}
|
|
5243
5012
|
.np-tile {
|
|
5244
5013
|
min-width: 120px;
|
|
5245
5014
|
border-radius: 10px;
|
|
@@ -25,17 +25,17 @@ const mapLegacySize = {
|
|
|
25
25
|
};
|
|
26
26
|
const StatusIcon = ({
|
|
27
27
|
sentiment = 'neutral',
|
|
28
|
-
size: sizeProp =
|
|
28
|
+
size: sizeProp = 40
|
|
29
29
|
}) => {
|
|
30
30
|
const Icon = iconTypeMap[sentiment];
|
|
31
31
|
const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';
|
|
32
32
|
const isTinyViewport = useMedia.useMedia(`(max-width: ${breakpoint.Breakpoint.ZOOM_400}px)`);
|
|
33
|
-
const size
|
|
33
|
+
const size = typeof sizeProp === 'string' ? mapLegacySize[sizeProp] : sizeProp;
|
|
34
34
|
return /*#__PURE__*/jsxRuntime.jsx(Circle, {
|
|
35
35
|
as: "span",
|
|
36
|
-
size: size
|
|
36
|
+
size: isTinyViewport && size < 40 ? 32 : size,
|
|
37
37
|
"data-testid": "status-icon",
|
|
38
|
-
className: clsx.clsx('status-circle',
|
|
38
|
+
className: clsx.clsx('status-circle', sentiment),
|
|
39
39
|
children: /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
40
40
|
className: clsx.clsx('status-icon', iconColor)
|
|
41
41
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusIcon.js","sources":["../../src/statusIcon/StatusIcon.tsx"],"sourcesContent":["import { Info, Alert, Cross, Check, ClockBorderless } from '@transferwise/icons';\nimport { clsx } from 'clsx';\n\nimport { SizeSmall, SizeMedium, SizeLarge, Sentiment, Size, Breakpoint } from '../common';\nimport Circle, { CircleProps } from '../common/circle';\nimport { useMedia } from '../common/hooks/useMedia';\n\nexport type StatusIconProps = {\n sentiment
|
|
1
|
+
{"version":3,"file":"StatusIcon.js","sources":["../../src/statusIcon/StatusIcon.tsx"],"sourcesContent":["import { Info, Alert, Cross, Check, ClockBorderless } from '@transferwise/icons';\nimport { clsx } from 'clsx';\n\nimport { SizeSmall, SizeMedium, SizeLarge, Sentiment, Size, Breakpoint } from '../common';\nimport Circle, { CircleProps } from '../common/circle';\nimport { useMedia } from '../common/hooks/useMedia';\n\n/**\n * @deprecated use `16 | 24 | 32 | 40 | 48 | 56 | 72` component instead\n */\ntype LegacySizes = SizeSmall | SizeMedium | SizeLarge;\n\nexport type StatusIconProps = {\n sentiment?: `${Sentiment}`;\n size?: LegacySizes | 16 | 24 | 32 | 40 | 48 | 56 | 72;\n};\n\nconst iconTypeMap = {\n positive: Check,\n neutral: Info,\n warning: Alert,\n negative: Cross,\n pending: ClockBorderless,\n info: Info,\n error: Cross,\n success: Check,\n} satisfies Record<`${Sentiment}`, React.ElementType>;\n\nconst mapLegacySize = {\n [String(Size.SMALL)]: 16,\n [String(Size.MEDIUM)]: 40,\n [String(Size.LARGE)]: 48,\n} satisfies Record<string, CircleProps['size']>;\n\nconst StatusIcon = ({ sentiment = 'neutral', size: sizeProp = 40 }: StatusIconProps) => {\n const Icon = iconTypeMap[sentiment];\n const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';\n const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n const size: CircleProps['size'] =\n typeof sizeProp === 'string' ? mapLegacySize[sizeProp] : sizeProp;\n return (\n <Circle\n as=\"span\"\n size={isTinyViewport && size < 40 ? 32 : size}\n data-testid=\"status-icon\"\n className={clsx('status-circle', sentiment)}\n >\n <Icon className={clsx('status-icon', iconColor)} />\n </Circle>\n );\n};\n\nexport default StatusIcon;\n"],"names":["iconTypeMap","positive","Check","neutral","Info","warning","Alert","negative","Cross","pending","ClockBorderless","info","error","success","mapLegacySize","String","Size","SMALL","MEDIUM","LARGE","StatusIcon","sentiment","size","sizeProp","Icon","iconColor","isTinyViewport","useMedia","Breakpoint","ZOOM_400","_jsx","Circle","as","className","clsx","children"],"mappings":";;;;;;;;;;AAiBA,MAAMA,WAAW,GAAG;AAClBC,EAAAA,QAAQ,EAAEC,WAAK;AACfC,EAAAA,OAAO,EAAEC,UAAI;AACbC,EAAAA,OAAO,EAAEC,WAAK;AACdC,EAAAA,QAAQ,EAAEC,WAAK;AACfC,EAAAA,OAAO,EAAEC,qBAAe;AACxBC,EAAAA,IAAI,EAAEP,UAAI;AACVQ,EAAAA,KAAK,EAAEJ,WAAK;AACZK,EAAAA,OAAO,EAAEX,WAAAA;CAC0C,CAAA;AAErD,MAAMY,aAAa,GAAG;AACpB,EAAA,CAACC,MAAM,CAACC,SAAI,CAACC,KAAK,CAAC,GAAG,EAAE;AACxB,EAAA,CAACF,MAAM,CAACC,SAAI,CAACE,MAAM,CAAC,GAAG,EAAE;AACzB,EAAA,CAACH,MAAM,CAACC,SAAI,CAACG,KAAK,CAAC,GAAG,EAAA;CACuB,CAAA;AAEzCC,MAAAA,UAAU,GAAGA,CAAC;AAAEC,EAAAA,SAAS,GAAG,SAAS;EAAEC,IAAI,EAAEC,QAAQ,GAAG,EAAA;AAAE,CAAmB,KAAI;AACrF,EAAA,MAAMC,IAAI,GAAGxB,WAAW,CAACqB,SAAS,CAAC,CAAA;AACnC,EAAA,MAAMI,SAAS,GAAGJ,SAAS,KAAK,SAAS,IAAIA,SAAS,KAAK,SAAS,GAAG,MAAM,GAAG,OAAO,CAAA;EACvF,MAAMK,cAAc,GAAGC,iBAAQ,CAAC,eAAeC,qBAAU,CAACC,QAAQ,CAAA,GAAA,CAAK,CAAC,CAAA;AACxE,EAAA,MAAMP,IAAI,GACR,OAAOC,QAAQ,KAAK,QAAQ,GAAGT,aAAa,CAACS,QAAQ,CAAC,GAAGA,QAAQ,CAAA;EACnE,oBACEO,cAAA,CAACC,MAAM,EAAA;AACLC,IAAAA,EAAE,EAAC,MAAM;IACTV,IAAI,EAAEI,cAAc,IAAIJ,IAAI,GAAG,EAAE,GAAG,EAAE,GAAGA,IAAK;AAC9C,IAAA,aAAA,EAAY,aAAa;AACzBW,IAAAA,SAAS,EAAEC,SAAI,CAAC,eAAe,EAAEb,SAAS,CAAE;IAAAc,QAAA,eAE5CL,cAAA,CAACN,IAAI,EAAA;AAACS,MAAAA,SAAS,EAAEC,SAAI,CAAC,aAAa,EAAET,SAAS,CAAA;KAChD,CAAA;AAAA,GAAQ,CAAC,CAAA;AAEb;;;;"}
|