@transferwise/components 46.71.2 → 46.71.4
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 +7 -2
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs +7 -2
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/badge/Badge.js +13 -2
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +13 -2
- package/build/badge/Badge.mjs.map +1 -1
- package/build/circularButton/CircularButton.js +10 -2
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs +10 -2
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/common/circle/Circle.js +29 -0
- package/build/common/circle/Circle.js.map +1 -0
- package/build/common/circle/Circle.mjs +27 -0
- package/build/common/circle/Circle.mjs.map +1 -0
- package/build/inputs/SelectInput.js +38 -5
- package/build/inputs/SelectInput.js.map +1 -1
- package/build/inputs/SelectInput.mjs +38 -5
- package/build/inputs/SelectInput.mjs.map +1 -1
- package/build/main.css +7 -114
- package/build/moneyInput/MoneyInput.js +1 -1
- package/build/moneyInput/MoneyInput.js.map +1 -1
- package/build/moneyInput/MoneyInput.mjs +1 -1
- package/build/moneyInput/MoneyInput.mjs.map +1 -1
- package/build/statusIcon/StatusIcon.js +16 -3
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +16 -3
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/styles/avatar/Avatar.css +0 -29
- package/build/styles/badge/Badge.css +0 -10
- package/build/styles/circularButton/CircularButton.css +0 -37
- package/build/styles/common/circle/Circle.css +7 -0
- package/build/styles/main.css +7 -114
- package/build/styles/statusIcon/StatusIcon.css +0 -33
- package/build/types/avatar/Avatar.d.ts.map +1 -1
- package/build/types/badge/Badge.d.ts +9 -2
- package/build/types/badge/Badge.d.ts.map +1 -1
- package/build/types/circularButton/CircularButton.d.ts.map +1 -1
- package/build/types/common/circle/Circle.d.ts +34 -0
- package/build/types/common/circle/Circle.d.ts.map +1 -0
- package/build/types/common/circle/index.d.ts +3 -0
- package/build/types/common/circle/index.d.ts.map +1 -0
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/alert/Alert.spec.tsx +3 -1
- package/src/avatar/Avatar.css +0 -29
- package/src/avatar/Avatar.less +0 -12
- package/src/avatar/Avatar.tsx +9 -4
- package/src/avatarWrapper/AvatarWrapper.spec.tsx +3 -1
- package/src/avatarWrapper/__snapshots__/AvatarWrapper.spec.tsx.snap +22 -11
- package/src/badge/Badge.css +0 -10
- package/src/badge/Badge.less +0 -13
- package/src/badge/Badge.tsx +23 -3
- package/src/checkbox/Checkbox.spec.tsx +3 -1
- package/src/circularButton/CircularButton.css +0 -37
- package/src/circularButton/CircularButton.less +0 -27
- package/src/circularButton/CircularButton.spec.tsx +3 -1
- package/src/circularButton/CircularButton.tsx +10 -3
- package/src/circularButton/__snapshots__/CircularButton.spec.tsx.snap +20 -10
- package/src/common/circle/Circle.css +7 -0
- package/src/common/circle/Circle.less +6 -0
- package/src/common/circle/Circle.story.tsx +86 -0
- package/src/common/circle/Circle.tsx +46 -0
- package/src/common/circle/index.ts +2 -0
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +8 -4
- package/src/inlineAlert/InlineAlert.spec.tsx +3 -1
- package/src/inputs/SelectInput.docs.mdx +21 -0
- package/src/inputs/SelectInput.spec.tsx +94 -1
- package/src/inputs/SelectInput.story.tsx +4 -4
- package/src/inputs/SelectInput.tsx +45 -4
- package/src/main.css +7 -114
- package/src/main.less +1 -0
- package/src/moneyInput/MoneyInput.rtl.spec.tsx +10 -1
- package/src/moneyInput/MoneyInput.tsx +1 -1
- package/src/overlayHeader/__snapshots__/OverlayHeader.spec.tsx.snap +4 -2
- package/src/radio/__snapshots__/Radio.rtl.spec.tsx.snap +4 -2
- package/src/statusIcon/StatusIcon.css +0 -33
- package/src/statusIcon/StatusIcon.less +0 -24
- package/src/statusIcon/StatusIcon.spec.tsx +5 -3
- package/src/statusIcon/StatusIcon.tsx +17 -6
- package/src/summary/Summary.spec.tsx +3 -1
- package/src/typeahead/Typeahead.spec.js +3 -0
- package/src/upload/Upload.spec.js +3 -0
package/build/avatar/Avatar.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var clsx = require('clsx');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var colors = require('./colors/colors.js');
|
|
6
|
+
var Circle = require('../common/circle/Circle.js');
|
|
6
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
8
|
var theme = require('../common/theme.js');
|
|
8
9
|
|
|
@@ -31,14 +32,18 @@ const Avatar = ({
|
|
|
31
32
|
}) => {
|
|
32
33
|
const backgroundColorFromSeed = React.useMemo(() => !backgroundColor && backgroundColorSeed ? `var(${colors.getAvatarColorFromSeed(backgroundColorSeed)})` : undefined, [backgroundColor, backgroundColorSeed]);
|
|
33
34
|
const size = backwardsCompatibleSize(sizeFromProps);
|
|
34
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
35
|
+
return /*#__PURE__*/jsxRuntime.jsx(Circle, {
|
|
36
|
+
size: size,
|
|
37
|
+
fixedSize: true,
|
|
35
38
|
className: clsx.clsx('tw-avatar', className, `tw-avatar--${size}`, `tw-avatar--${type}`, {
|
|
36
39
|
'tw-avatar--outlined': outlined,
|
|
37
40
|
'tw-avatar--branded': Boolean(backgroundColorFromSeed),
|
|
38
41
|
'np-text-title-body': type === 'initials'
|
|
39
42
|
}),
|
|
40
43
|
"aria-label": ariaLabel,
|
|
41
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
44
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Circle, {
|
|
45
|
+
size: size,
|
|
46
|
+
fixedSize: true,
|
|
42
47
|
className: "tw-avatar__content",
|
|
43
48
|
style: {
|
|
44
49
|
backgroundColor: backgroundColor || backgroundColorFromSeed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.js","sources":["../../src/avatar/Avatar.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useMemo } from 'react';\n\nimport { Theme } from '../common';\n\nimport { getAvatarColorFromSeed } from './colors';\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 ? `var(${getAvatarColorFromSeed(backgroundColorSeed)})`\n : undefined,\n [backgroundColor, backgroundColorSeed],\n );\n\n const size = backwardsCompatibleSize(sizeFromProps);\n\n return (\n <
|
|
1
|
+
{"version":3,"file":"Avatar.js","sources":["../../src/avatar/Avatar.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useMemo } from 'react';\n\nimport { Theme } from '../common';\n\nimport { getAvatarColorFromSeed } from './colors';\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 ? `var(${getAvatarColorFromSeed(backgroundColorSeed)})`\n : undefined,\n [backgroundColor, backgroundColorSeed],\n );\n\n const size = backwardsCompatibleSize(sizeFromProps);\n\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 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","getAvatarColorFromSeed","undefined","_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,GACnC,CAAOY,IAAAA,EAAAA,6BAAsB,CAACZ,mBAAmB,CAAC,CAAG,CAAA,CAAA,GACrDa,SAAS,EACf,CAACd,eAAe,EAAEC,mBAAmB,CAAC,CACvC,CAAA;AAED,EAAA,MAAMH,IAAI,GAAGD,uBAAuB,CAACQ,aAAa,CAAC,CAAA;EAEnD,oBACEU,cAAA,CAACC,MAAM,EAAA;AACLlB,IAAAA,IAAI,EAAEA,IAAK;IACXmB,SAAS,EAAA,IAAA;AACTd,IAAAA,SAAS,EAAEe,SAAI,CAAC,WAAW,EAAEf,SAAS,EAAE,CAAcL,WAAAA,EAAAA,IAAI,CAAE,CAAA,EAAE,CAAcW,WAAAA,EAAAA,IAAI,EAAE,EAAE;AAClF,MAAA,qBAAqB,EAAEL,QAAQ;AAC/B,MAAA,oBAAoB,EAAEe,OAAO,CAACR,uBAAuB,CAAC;MACtD,oBAAoB,EAAEF,IAAI,KAAK,UAAA;AAChC,KAAA,CAAE;AACH,IAAA,YAAA,EAAYC,SAAU;IAAAR,QAAA,eAEtBa,cAAA,CAACC,MAAM,EAAA;AACLlB,MAAAA,IAAI,EAAEA,IAAK;MACXmB,SAAS,EAAA,IAAA;AACTd,MAAAA,SAAS,EAAC,oBAAoB;AAC9BiB,MAAAA,KAAK,EAAE;QACLpB,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,6 +1,7 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { getAvatarColorFromSeed } from './colors/colors.mjs';
|
|
4
|
+
import Circle from '../common/circle/Circle.mjs';
|
|
4
5
|
import { jsx } from 'react/jsx-runtime';
|
|
5
6
|
import { Theme } from '../common/theme.mjs';
|
|
6
7
|
|
|
@@ -29,14 +30,18 @@ const Avatar = ({
|
|
|
29
30
|
}) => {
|
|
30
31
|
const backgroundColorFromSeed = useMemo(() => !backgroundColor && backgroundColorSeed ? `var(${getAvatarColorFromSeed(backgroundColorSeed)})` : undefined, [backgroundColor, backgroundColorSeed]);
|
|
31
32
|
const size = backwardsCompatibleSize(sizeFromProps);
|
|
32
|
-
return /*#__PURE__*/jsx(
|
|
33
|
+
return /*#__PURE__*/jsx(Circle, {
|
|
34
|
+
size: size,
|
|
35
|
+
fixedSize: true,
|
|
33
36
|
className: clsx('tw-avatar', className, `tw-avatar--${size}`, `tw-avatar--${type}`, {
|
|
34
37
|
'tw-avatar--outlined': outlined,
|
|
35
38
|
'tw-avatar--branded': Boolean(backgroundColorFromSeed),
|
|
36
39
|
'np-text-title-body': type === 'initials'
|
|
37
40
|
}),
|
|
38
41
|
"aria-label": ariaLabel,
|
|
39
|
-
children: /*#__PURE__*/jsx(
|
|
42
|
+
children: /*#__PURE__*/jsx(Circle, {
|
|
43
|
+
size: size,
|
|
44
|
+
fixedSize: true,
|
|
40
45
|
className: "tw-avatar__content",
|
|
41
46
|
style: {
|
|
42
47
|
backgroundColor: backgroundColor || backgroundColorFromSeed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.mjs","sources":["../../src/avatar/Avatar.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useMemo } from 'react';\n\nimport { Theme } from '../common';\n\nimport { getAvatarColorFromSeed } from './colors';\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 ? `var(${getAvatarColorFromSeed(backgroundColorSeed)})`\n : undefined,\n [backgroundColor, backgroundColorSeed],\n );\n\n const size = backwardsCompatibleSize(sizeFromProps);\n\n return (\n <
|
|
1
|
+
{"version":3,"file":"Avatar.mjs","sources":["../../src/avatar/Avatar.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useMemo } from 'react';\n\nimport { Theme } from '../common';\n\nimport { getAvatarColorFromSeed } from './colors';\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 ? `var(${getAvatarColorFromSeed(backgroundColorSeed)})`\n : undefined,\n [backgroundColor, backgroundColorSeed],\n );\n\n const size = backwardsCompatibleSize(sizeFromProps);\n\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 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","getAvatarColorFromSeed","undefined","_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,GACnC,CAAOY,IAAAA,EAAAA,sBAAsB,CAACZ,mBAAmB,CAAC,CAAG,CAAA,CAAA,GACrDa,SAAS,EACf,CAACd,eAAe,EAAEC,mBAAmB,CAAC,CACvC,CAAA;AAED,EAAA,MAAMH,IAAI,GAAGD,uBAAuB,CAACQ,aAAa,CAAC,CAAA;EAEnD,oBACEU,GAAA,CAACC,MAAM,EAAA;AACLlB,IAAAA,IAAI,EAAEA,IAAK;IACXmB,SAAS,EAAA,IAAA;AACTd,IAAAA,SAAS,EAAEe,IAAI,CAAC,WAAW,EAAEf,SAAS,EAAE,CAAcL,WAAAA,EAAAA,IAAI,CAAE,CAAA,EAAE,CAAcW,WAAAA,EAAAA,IAAI,EAAE,EAAE;AAClF,MAAA,qBAAqB,EAAEL,QAAQ;AAC/B,MAAA,oBAAoB,EAAEe,OAAO,CAACR,uBAAuB,CAAC;MACtD,oBAAoB,EAAEF,IAAI,KAAK,UAAA;AAChC,KAAA,CAAE;AACH,IAAA,YAAA,EAAYC,SAAU;IAAAR,QAAA,eAEtBa,GAAA,CAACC,MAAM,EAAA;AACLlB,MAAAA,IAAI,EAAEA,IAAK;MACXmB,SAAS,EAAA,IAAA;AACTd,MAAAA,SAAS,EAAC,oBAAoB;AAC9BiB,MAAAA,KAAK,EAAE;QACLpB,eAAe,EAAEA,eAAe,IAAIW,uBAAAA;OACpC;AAAAT,MAAAA,QAAA,EAEDA,QAAAA;KACK,CAAA;AACV,GAAQ,CAAC,CAAA;AAEb;;;;"}
|
package/build/badge/Badge.js
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var clsx = require('clsx');
|
|
4
|
+
var Circle = require('../common/circle/Circle.js');
|
|
4
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
6
|
var size = require('../common/propsValues/size.js');
|
|
6
7
|
var theme = require('../common/theme.js');
|
|
7
8
|
|
|
9
|
+
const mapLegacySize = {
|
|
10
|
+
[String(size.Size.SMALL)]: 16,
|
|
11
|
+
// medium is deprecated, so we map it to small
|
|
12
|
+
[String(size.Size.MEDIUM)]: 16,
|
|
13
|
+
[String(size.Size.LARGE)]: 24
|
|
14
|
+
};
|
|
8
15
|
const Badge = ({
|
|
9
16
|
badge,
|
|
10
17
|
className = undefined,
|
|
11
|
-
size:
|
|
18
|
+
size: sizeProp = size.Size.SMALL,
|
|
12
19
|
border = theme.Theme.LIGHT,
|
|
13
20
|
'aria-label': ariaLabel,
|
|
14
21
|
children
|
|
15
22
|
}) => {
|
|
23
|
+
// medium is deprecated, so we map it to small
|
|
24
|
+
const size$1 = sizeProp === size.Size.MEDIUM ? size.Size.SMALL : sizeProp;
|
|
16
25
|
const classes = clsx.clsx('tw-badge', {
|
|
17
26
|
[`tw-badge-border-${border}`]: border,
|
|
18
27
|
[`tw-badge-${size$1}`]: size$1
|
|
@@ -23,7 +32,9 @@ const Badge = ({
|
|
|
23
32
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
24
33
|
className: "tw-badge__children",
|
|
25
34
|
children: children
|
|
26
|
-
}), /*#__PURE__*/jsxRuntime.jsx(
|
|
35
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Circle, {
|
|
36
|
+
size: mapLegacySize[size$1],
|
|
37
|
+
fixedSize: true,
|
|
27
38
|
className: "tw-badge__content",
|
|
28
39
|
children: badge
|
|
29
40
|
})]
|
package/build/badge/Badge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sources":["../../src/badge/Badge.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport {\n Size,\n Theme,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n ThemeDark,\n ThemeLight,\n CommonProps,\n} from '../common';\n\nexport type BadgeProps = {\n badge: ReactNode;\n children: ReactNode;\n size?: SizeSmall |
|
|
1
|
+
{"version":3,"file":"Badge.js","sources":["../../src/badge/Badge.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport {\n Size,\n Theme,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n ThemeDark,\n ThemeLight,\n CommonProps,\n} from '../common';\nimport Circle, { CircleProps } from '../common/circle';\n\n/**\n * @deprecated Use `SizeSmall` or `SizeLarge` instead.\n */\ntype DeprecatedSizes = SizeMedium;\n\nexport type BadgeProps = {\n badge: ReactNode;\n children: ReactNode;\n /**\n * `md` is deprecated, it will fallback to `sm` instead.\n */\n size?: SizeSmall | DeprecatedSizes | SizeLarge;\n border?: ThemeDark | ThemeLight;\n 'aria-label'?: string;\n} & CommonProps;\n\nconst mapLegacySize = {\n [String(Size.SMALL)]: 16,\n // medium is deprecated, so we map it to small\n [String(Size.MEDIUM)]: 16,\n [String(Size.LARGE)]: 24,\n} satisfies Record<string, CircleProps['size']>;\n\nconst Badge = ({\n badge,\n className = undefined,\n size: sizeProp = Size.SMALL,\n border = Theme.LIGHT,\n 'aria-label': ariaLabel,\n children,\n}: BadgeProps) => {\n // medium is deprecated, so we map it to small\n const size = sizeProp === Size.MEDIUM ? Size.SMALL : sizeProp;\n const classes: string = clsx(\n 'tw-badge',\n {\n [`tw-badge-border-${border}`]: border,\n [`tw-badge-${size}`]: size,\n },\n className,\n );\n\n return (\n <div aria-label={ariaLabel} className={classes}>\n <div className=\"tw-badge__children\">{children}</div>\n <Circle size={mapLegacySize[size]} fixedSize className=\"tw-badge__content\">\n {badge}\n </Circle>\n </div>\n );\n};\n\nexport default Badge;\n"],"names":["mapLegacySize","String","Size","SMALL","MEDIUM","LARGE","Badge","badge","className","undefined","size","sizeProp","border","Theme","LIGHT","ariaLabel","children","classes","clsx","_jsxs","_jsx","Circle","fixedSize"],"mappings":";;;;;;;;AA+BA,MAAMA,aAAa,GAAG;AACpB,EAAA,CAACC,MAAM,CAACC,SAAI,CAACC,KAAK,CAAC,GAAG,EAAE;AACxB;AACA,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,KAAK,GAAGA,CAAC;EACbC,KAAK;AACLC,EAAAA,SAAS,GAAGC,SAAS;AACrBC,EAAAA,IAAI,EAAEC,QAAQ,GAAGT,SAAI,CAACC,KAAK;EAC3BS,MAAM,GAAGC,WAAK,CAACC,KAAK;AACpB,EAAA,YAAY,EAAEC,SAAS;AACvBC,EAAAA,QAAAA;AAAQ,CACG,KAAI;AACf;AACA,EAAA,MAAMN,MAAI,GAAGC,QAAQ,KAAKT,SAAI,CAACE,MAAM,GAAGF,SAAI,CAACC,KAAK,GAAGQ,QAAQ,CAAA;AAC7D,EAAA,MAAMM,OAAO,GAAWC,SAAI,CAC1B,UAAU,EACV;AACE,IAAA,CAAC,CAAmBN,gBAAAA,EAAAA,MAAM,CAAE,CAAA,GAAGA,MAAM;IACrC,CAAC,CAAA,SAAA,EAAYF,MAAI,CAAA,CAAE,GAAGA,MAAAA;GACvB,EACDF,SAAS,CACV,CAAA;AAED,EAAA,oBACEW,eAAA,CAAA,KAAA,EAAA;AAAK,IAAA,YAAA,EAAYJ,SAAU;AAACP,IAAAA,SAAS,EAAES,OAAQ;AAAAD,IAAAA,QAAA,gBAC7CI,cAAA,CAAA,KAAA,EAAA;AAAKZ,MAAAA,SAAS,EAAC,oBAAoB;AAAAQ,MAAAA,QAAA,EAAEA,QAAAA;AAAQ,KAAM,CACnD,eAAAI,cAAA,CAACC,MAAM,EAAA;AAACX,MAAAA,IAAI,EAAEV,aAAa,CAACU,MAAI,CAAE;MAACY,SAAS,EAAA,IAAA;AAACd,MAAAA,SAAS,EAAC,mBAAmB;AAAAQ,MAAAA,QAAA,EACvET,KAAAA;AAAK,KACA,CACV,CAAA;AAAA,GAAK,CAAC,CAAA;AAEV;;;;"}
|
package/build/badge/Badge.mjs
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
|
+
import Circle from '../common/circle/Circle.mjs';
|
|
2
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
4
|
import { Size } from '../common/propsValues/size.mjs';
|
|
4
5
|
import { Theme } from '../common/theme.mjs';
|
|
5
6
|
|
|
7
|
+
const mapLegacySize = {
|
|
8
|
+
[String(Size.SMALL)]: 16,
|
|
9
|
+
// medium is deprecated, so we map it to small
|
|
10
|
+
[String(Size.MEDIUM)]: 16,
|
|
11
|
+
[String(Size.LARGE)]: 24
|
|
12
|
+
};
|
|
6
13
|
const Badge = ({
|
|
7
14
|
badge,
|
|
8
15
|
className = undefined,
|
|
9
|
-
size = Size.SMALL,
|
|
16
|
+
size: sizeProp = Size.SMALL,
|
|
10
17
|
border = Theme.LIGHT,
|
|
11
18
|
'aria-label': ariaLabel,
|
|
12
19
|
children
|
|
13
20
|
}) => {
|
|
21
|
+
// medium is deprecated, so we map it to small
|
|
22
|
+
const size = sizeProp === Size.MEDIUM ? Size.SMALL : sizeProp;
|
|
14
23
|
const classes = clsx('tw-badge', {
|
|
15
24
|
[`tw-badge-border-${border}`]: border,
|
|
16
25
|
[`tw-badge-${size}`]: size
|
|
@@ -21,7 +30,9 @@ const Badge = ({
|
|
|
21
30
|
children: [/*#__PURE__*/jsx("div", {
|
|
22
31
|
className: "tw-badge__children",
|
|
23
32
|
children: children
|
|
24
|
-
}), /*#__PURE__*/jsx(
|
|
33
|
+
}), /*#__PURE__*/jsx(Circle, {
|
|
34
|
+
size: mapLegacySize[size],
|
|
35
|
+
fixedSize: true,
|
|
25
36
|
className: "tw-badge__content",
|
|
26
37
|
children: badge
|
|
27
38
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.mjs","sources":["../../src/badge/Badge.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport {\n Size,\n Theme,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n ThemeDark,\n ThemeLight,\n CommonProps,\n} from '../common';\n\nexport type BadgeProps = {\n badge: ReactNode;\n children: ReactNode;\n size?: SizeSmall |
|
|
1
|
+
{"version":3,"file":"Badge.mjs","sources":["../../src/badge/Badge.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport {\n Size,\n Theme,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n ThemeDark,\n ThemeLight,\n CommonProps,\n} from '../common';\nimport Circle, { CircleProps } from '../common/circle';\n\n/**\n * @deprecated Use `SizeSmall` or `SizeLarge` instead.\n */\ntype DeprecatedSizes = SizeMedium;\n\nexport type BadgeProps = {\n badge: ReactNode;\n children: ReactNode;\n /**\n * `md` is deprecated, it will fallback to `sm` instead.\n */\n size?: SizeSmall | DeprecatedSizes | SizeLarge;\n border?: ThemeDark | ThemeLight;\n 'aria-label'?: string;\n} & CommonProps;\n\nconst mapLegacySize = {\n [String(Size.SMALL)]: 16,\n // medium is deprecated, so we map it to small\n [String(Size.MEDIUM)]: 16,\n [String(Size.LARGE)]: 24,\n} satisfies Record<string, CircleProps['size']>;\n\nconst Badge = ({\n badge,\n className = undefined,\n size: sizeProp = Size.SMALL,\n border = Theme.LIGHT,\n 'aria-label': ariaLabel,\n children,\n}: BadgeProps) => {\n // medium is deprecated, so we map it to small\n const size = sizeProp === Size.MEDIUM ? Size.SMALL : sizeProp;\n const classes: string = clsx(\n 'tw-badge',\n {\n [`tw-badge-border-${border}`]: border,\n [`tw-badge-${size}`]: size,\n },\n className,\n );\n\n return (\n <div aria-label={ariaLabel} className={classes}>\n <div className=\"tw-badge__children\">{children}</div>\n <Circle size={mapLegacySize[size]} fixedSize className=\"tw-badge__content\">\n {badge}\n </Circle>\n </div>\n );\n};\n\nexport default Badge;\n"],"names":["mapLegacySize","String","Size","SMALL","MEDIUM","LARGE","Badge","badge","className","undefined","size","sizeProp","border","Theme","LIGHT","ariaLabel","children","classes","clsx","_jsxs","_jsx","Circle","fixedSize"],"mappings":";;;;;;AA+BA,MAAMA,aAAa,GAAG;AACpB,EAAA,CAACC,MAAM,CAACC,IAAI,CAACC,KAAK,CAAC,GAAG,EAAE;AACxB;AACA,EAAA,CAACF,MAAM,CAACC,IAAI,CAACE,MAAM,CAAC,GAAG,EAAE;AACzB,EAAA,CAACH,MAAM,CAACC,IAAI,CAACG,KAAK,CAAC,GAAG,EAAA;CACuB,CAAA;AAEzCC,MAAAA,KAAK,GAAGA,CAAC;EACbC,KAAK;AACLC,EAAAA,SAAS,GAAGC,SAAS;AACrBC,EAAAA,IAAI,EAAEC,QAAQ,GAAGT,IAAI,CAACC,KAAK;EAC3BS,MAAM,GAAGC,KAAK,CAACC,KAAK;AACpB,EAAA,YAAY,EAAEC,SAAS;AACvBC,EAAAA,QAAAA;AAAQ,CACG,KAAI;AACf;AACA,EAAA,MAAMN,IAAI,GAAGC,QAAQ,KAAKT,IAAI,CAACE,MAAM,GAAGF,IAAI,CAACC,KAAK,GAAGQ,QAAQ,CAAA;AAC7D,EAAA,MAAMM,OAAO,GAAWC,IAAI,CAC1B,UAAU,EACV;AACE,IAAA,CAAC,CAAmBN,gBAAAA,EAAAA,MAAM,CAAE,CAAA,GAAGA,MAAM;IACrC,CAAC,CAAA,SAAA,EAAYF,IAAI,CAAA,CAAE,GAAGA,IAAAA;GACvB,EACDF,SAAS,CACV,CAAA;AAED,EAAA,oBACEW,IAAA,CAAA,KAAA,EAAA;AAAK,IAAA,YAAA,EAAYJ,SAAU;AAACP,IAAAA,SAAS,EAAES,OAAQ;AAAAD,IAAAA,QAAA,gBAC7CI,GAAA,CAAA,KAAA,EAAA;AAAKZ,MAAAA,SAAS,EAAC,oBAAoB;AAAAQ,MAAAA,QAAA,EAAEA,QAAAA;AAAQ,KAAM,CACnD,eAAAI,GAAA,CAACC,MAAM,EAAA;AAACX,MAAAA,IAAI,EAAEV,aAAa,CAACU,IAAI,CAAE;MAACY,SAAS,EAAA,IAAA;AAACd,MAAAA,SAAS,EAAC,mBAAmB;AAAAQ,MAAAA,QAAA,EACvET,KAAAA;AAAK,KACA,CACV,CAAA;AAAA,GAAK,CAAC,CAAA;AAEV;;;;"}
|
|
@@ -4,7 +4,10 @@ var clsx = require('clsx');
|
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var Body = require('../body/Body.js');
|
|
6
6
|
var classMap = require('../button/classMap.js');
|
|
7
|
+
var Circle = require('../common/circle/Circle.js');
|
|
8
|
+
var useMedia = require('../common/hooks/useMedia.js');
|
|
7
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
10
|
+
var breakpoint = require('../common/propsValues/breakpoint.js');
|
|
8
11
|
var typography = require('../common/propsValues/typography.js');
|
|
9
12
|
var control = require('../common/propsValues/control.js');
|
|
10
13
|
|
|
@@ -17,14 +20,19 @@ const CircularButton = ({
|
|
|
17
20
|
type = control.ControlType.ACCENT,
|
|
18
21
|
...rest
|
|
19
22
|
}) => {
|
|
20
|
-
const classes = clsx.clsx('btn np-btn', classMap.typeClassMap[type], classMap.priorityClassMap[priority]);
|
|
23
|
+
const classes = clsx.clsx('btn np-btn', 'm-b-1', classMap.typeClassMap[type], classMap.priorityClassMap[priority]);
|
|
21
24
|
const iconElement = Number(icon.props.size) !== 24 ? /*#__PURE__*/React.cloneElement(icon, {
|
|
22
25
|
size: 24
|
|
23
26
|
}) : icon;
|
|
27
|
+
const isTinyViewport = useMedia.useMedia(`(max-width: ${breakpoint.Breakpoint.ZOOM_400}px)`);
|
|
24
28
|
return /*#__PURE__*/jsxRuntime.jsxs("label", {
|
|
25
29
|
className: clsx.clsx('np-circular-btn', priority, type, disabled && 'disabled', className),
|
|
26
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(
|
|
30
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Circle, {
|
|
31
|
+
as: "input"
|
|
32
|
+
// @ts-expect-error it's input[type=button] element
|
|
33
|
+
,
|
|
27
34
|
type: "button",
|
|
35
|
+
size: isTinyViewport ? 64 : 56,
|
|
28
36
|
"aria-label": children,
|
|
29
37
|
className: classes,
|
|
30
38
|
disabled: disabled,
|
|
@@ -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 { ControlType, Priority, Typography } from '../common';\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', typeClassMap[type], priorityClassMap[priority]);\n\n const iconElement = Number(icon.props.size) !== 24 ? cloneElement(icon, { size: 24 }) : icon;\n\n return (\n <label className={clsx('np-circular-btn', priority, type, disabled && 'disabled', className)}>\n <input\n type=\"button\"\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","_jsxs","_jsx","
|
|
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 ? 64 : 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;;;;"}
|
|
@@ -2,7 +2,10 @@ import { clsx } from 'clsx';
|
|
|
2
2
|
import { cloneElement } from 'react';
|
|
3
3
|
import Body from '../body/Body.mjs';
|
|
4
4
|
import { typeClassMap, priorityClassMap } from '../button/classMap.mjs';
|
|
5
|
+
import Circle from '../common/circle/Circle.mjs';
|
|
6
|
+
import { useMedia } from '../common/hooks/useMedia.mjs';
|
|
5
7
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
|
+
import { Breakpoint } from '../common/propsValues/breakpoint.mjs';
|
|
6
9
|
import { Typography } from '../common/propsValues/typography.mjs';
|
|
7
10
|
import { Priority, ControlType } from '../common/propsValues/control.mjs';
|
|
8
11
|
|
|
@@ -15,14 +18,19 @@ const CircularButton = ({
|
|
|
15
18
|
type = ControlType.ACCENT,
|
|
16
19
|
...rest
|
|
17
20
|
}) => {
|
|
18
|
-
const classes = clsx('btn np-btn', typeClassMap[type], priorityClassMap[priority]);
|
|
21
|
+
const classes = clsx('btn np-btn', 'm-b-1', typeClassMap[type], priorityClassMap[priority]);
|
|
19
22
|
const iconElement = Number(icon.props.size) !== 24 ? /*#__PURE__*/cloneElement(icon, {
|
|
20
23
|
size: 24
|
|
21
24
|
}) : icon;
|
|
25
|
+
const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
|
|
22
26
|
return /*#__PURE__*/jsxs("label", {
|
|
23
27
|
className: clsx('np-circular-btn', priority, type, disabled && 'disabled', className),
|
|
24
|
-
children: [/*#__PURE__*/jsx(
|
|
28
|
+
children: [/*#__PURE__*/jsx(Circle, {
|
|
29
|
+
as: "input"
|
|
30
|
+
// @ts-expect-error it's input[type=button] element
|
|
31
|
+
,
|
|
25
32
|
type: "button",
|
|
33
|
+
size: isTinyViewport ? 64 : 56,
|
|
26
34
|
"aria-label": children,
|
|
27
35
|
className: classes,
|
|
28
36
|
disabled: disabled,
|
|
@@ -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 { ControlType, Priority, Typography } from '../common';\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', typeClassMap[type], priorityClassMap[priority]);\n\n const iconElement = Number(icon.props.size) !== 24 ? cloneElement(icon, { size: 24 }) : icon;\n\n return (\n <label className={clsx('np-circular-btn', priority, type, disabled && 'disabled', className)}>\n <input\n type=\"button\"\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","_jsxs","_jsx","
|
|
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 ? 64 : 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;;;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var clsx = require('clsx');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
const Circle = /*#__PURE__*/React.forwardRef(function Circle({
|
|
8
|
+
as: Element = 'div',
|
|
9
|
+
children,
|
|
10
|
+
size = 48,
|
|
11
|
+
fixedSize = false,
|
|
12
|
+
className,
|
|
13
|
+
style,
|
|
14
|
+
...props
|
|
15
|
+
}, ref) {
|
|
16
|
+
return /*#__PURE__*/jsxRuntime.jsx(Element, {
|
|
17
|
+
...props,
|
|
18
|
+
ref: ref,
|
|
19
|
+
style: {
|
|
20
|
+
...style,
|
|
21
|
+
'--circle-size': fixedSize ? `${size}px` : `var(--size-${size})`
|
|
22
|
+
},
|
|
23
|
+
className: clsx.clsx('np-circle', 'd-flex align-items-center justify-content-center', className),
|
|
24
|
+
children: children
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
module.exports = Circle;
|
|
29
|
+
//# sourceMappingURL=Circle.js.map
|
|
@@ -0,0 +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 | 64 | 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\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 return (\n <Element\n {...props}\n ref={ref}\n style={{ ...style, '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})` }}\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":["Circle","forwardRef","as","Element","children","size","fixedSize","className","style","props","ref","_jsx","clsx"],"mappings":";;;;;;AAqBA,MAAMA,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,oBACEC,cAAA,CAACR,OAAO,EAAA;AAAA,IAAA,GACFM,KAAK;AACTC,IAAAA,GAAG,EAAEA,GAAI;AACTF,IAAAA,KAAK,EAAE;AAAE,MAAA,GAAGA,KAAK;MAAE,eAAe,EAAEF,SAAS,GAAG,CAAA,EAAGD,IAAI,CAAI,EAAA,CAAA,GAAG,cAAcA,IAAI,CAAA,CAAA,CAAA;KAAM;IACtFE,SAAS,EAAEK,SAAI,CAAC,WAAW,EAAE,kDAAkD,EAAEL,SAAS,CAAE;AAAAH,IAAAA,QAAA,EAE3FA,QAAAA;AAAQ,GACF,CAAC,CAAA;AAEd,CAAC;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
const Circle = /*#__PURE__*/forwardRef(function Circle({
|
|
6
|
+
as: Element = 'div',
|
|
7
|
+
children,
|
|
8
|
+
size = 48,
|
|
9
|
+
fixedSize = false,
|
|
10
|
+
className,
|
|
11
|
+
style,
|
|
12
|
+
...props
|
|
13
|
+
}, ref) {
|
|
14
|
+
return /*#__PURE__*/jsx(Element, {
|
|
15
|
+
...props,
|
|
16
|
+
ref: ref,
|
|
17
|
+
style: {
|
|
18
|
+
...style,
|
|
19
|
+
'--circle-size': fixedSize ? `${size}px` : `var(--size-${size})`
|
|
20
|
+
},
|
|
21
|
+
className: clsx('np-circle', 'd-flex align-items-center justify-content-center', className),
|
|
22
|
+
children: children
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export { Circle as default };
|
|
27
|
+
//# sourceMappingURL=Circle.mjs.map
|
|
@@ -0,0 +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 | 64 | 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\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 return (\n <Element\n {...props}\n ref={ref}\n style={{ ...style, '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})` }}\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":["Circle","forwardRef","as","Element","children","size","fixedSize","className","style","props","ref","_jsx","clsx"],"mappings":";;;;AAqBA,MAAMA,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,oBACEC,GAAA,CAACR,OAAO,EAAA;AAAA,IAAA,GACFM,KAAK;AACTC,IAAAA,GAAG,EAAEA,GAAI;AACTF,IAAAA,KAAK,EAAE;AAAE,MAAA,GAAGA,KAAK;MAAE,eAAe,EAAEF,SAAS,GAAG,CAAA,EAAGD,IAAI,CAAI,EAAA,CAAA,GAAG,cAAcA,IAAI,CAAA,CAAA,CAAA;KAAM;IACtFE,SAAS,EAAEK,IAAI,CAAC,WAAW,EAAE,kDAAkD,EAAEL,SAAS,CAAE;AAAAH,IAAAA,QAAA,EAE3FA,QAAAA;AAAQ,GACF,CAAC,CAAA;AAEd,CAAC;;;;"}
|
|
@@ -170,7 +170,9 @@ function SelectInput({
|
|
|
170
170
|
onClose,
|
|
171
171
|
onClear
|
|
172
172
|
}) {
|
|
173
|
-
const inputAttributes = contexts.useInputAttributes(
|
|
173
|
+
const inputAttributes = contexts.useInputAttributes({
|
|
174
|
+
nonLabelable: true
|
|
175
|
+
});
|
|
174
176
|
const id = idProp ?? inputAttributes.id;
|
|
175
177
|
const [open, setOpen] = React.useState(false);
|
|
176
178
|
const initialized = React.useRef(false);
|
|
@@ -201,6 +203,28 @@ function SelectInput({
|
|
|
201
203
|
const searchInputRef = React.useRef(null);
|
|
202
204
|
const listboxRef = React.useRef(null);
|
|
203
205
|
const controllerRef = filterable ? searchInputRef : listboxRef;
|
|
206
|
+
/**
|
|
207
|
+
* Attempts to resolve the `listbox` label
|
|
208
|
+
* @see https://storybook.wise.design/?path=/docs/forms-selectinput-accessibility--docs#labelling
|
|
209
|
+
*/
|
|
210
|
+
const getListBoxLabelProps = () => {
|
|
211
|
+
if (UNSAFE_triggerButtonProps?.['aria-label']) {
|
|
212
|
+
return {
|
|
213
|
+
listBoxLabel: UNSAFE_triggerButtonProps['aria-label']
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
if (UNSAFE_triggerButtonProps?.['aria-labelledby']) {
|
|
217
|
+
return {
|
|
218
|
+
listBoxLabelledBy: UNSAFE_triggerButtonProps['aria-labelledby']
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
if (inputAttributes['aria-labelledby']) {
|
|
222
|
+
return {
|
|
223
|
+
listBoxLabelledBy: inputAttributes['aria-labelledby']
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
return {};
|
|
227
|
+
};
|
|
204
228
|
return /*#__PURE__*/jsxRuntime.jsx(react.Listbox, {
|
|
205
229
|
name: name,
|
|
206
230
|
multiple: multiple,
|
|
@@ -273,7 +297,7 @@ function SelectInput({
|
|
|
273
297
|
setFilterQuery('');
|
|
274
298
|
},
|
|
275
299
|
children: /*#__PURE__*/jsxRuntime.jsx(SelectInputOptions, {
|
|
276
|
-
id: `${id}Search
|
|
300
|
+
id: id ? `${id}Search` : undefined,
|
|
277
301
|
items: items,
|
|
278
302
|
renderValue: renderValue,
|
|
279
303
|
renderFooter: renderFooter,
|
|
@@ -282,7 +306,8 @@ function SelectInput({
|
|
|
282
306
|
searchInputRef: searchInputRef,
|
|
283
307
|
listboxRef: listboxRef,
|
|
284
308
|
filterQuery: deferredFilterQuery,
|
|
285
|
-
onFilterChange: setFilterQuery
|
|
309
|
+
onFilterChange: setFilterQuery,
|
|
310
|
+
...getListBoxLabelProps()
|
|
286
311
|
})
|
|
287
312
|
});
|
|
288
313
|
}
|
|
@@ -358,10 +383,13 @@ function SelectInputOptions({
|
|
|
358
383
|
searchInputRef,
|
|
359
384
|
listboxRef,
|
|
360
385
|
filterQuery,
|
|
361
|
-
onFilterChange
|
|
386
|
+
onFilterChange,
|
|
387
|
+
listBoxLabel,
|
|
388
|
+
listBoxLabelledBy
|
|
362
389
|
}) {
|
|
363
390
|
const intl = reactIntl.useIntl();
|
|
364
391
|
const controllerRef = filterable ? searchInputRef : listboxRef;
|
|
392
|
+
const [initialRender, setInitialRender] = React.useState(true);
|
|
365
393
|
const needle = React.useMemo(() => {
|
|
366
394
|
if (filterable) {
|
|
367
395
|
return filterQuery ? searchableString(filterQuery) : null;
|
|
@@ -408,6 +436,9 @@ function SelectInputOptions({
|
|
|
408
436
|
listboxContainerRef.current.style.setProperty('--initial-height', `${listboxContainerRef.current.offsetHeight}px`);
|
|
409
437
|
}
|
|
410
438
|
}, []);
|
|
439
|
+
React.useEffect(() => {
|
|
440
|
+
setInitialRender(false);
|
|
441
|
+
}, []);
|
|
411
442
|
const showStatus = resultsEmpty;
|
|
412
443
|
const statusId = React.useId();
|
|
413
444
|
const listboxId = React.useId();
|
|
@@ -427,7 +458,7 @@ function SelectInputOptions({
|
|
|
427
458
|
className: "np-select-input-options-container",
|
|
428
459
|
onAriaActiveDescendantChange: value => {
|
|
429
460
|
if (controllerRef.current != null) {
|
|
430
|
-
if (value != null) {
|
|
461
|
+
if (!initialRender && value != null) {
|
|
431
462
|
controllerRef.current.setAttribute('aria-activedescendant', value);
|
|
432
463
|
} else {
|
|
433
464
|
controllerRef.current.removeAttribute('aria-activedescendant');
|
|
@@ -480,6 +511,8 @@ function SelectInputOptions({
|
|
|
480
511
|
id: listboxId,
|
|
481
512
|
role: "listbox",
|
|
482
513
|
"aria-orientation": "vertical",
|
|
514
|
+
"aria-label": listBoxLabel,
|
|
515
|
+
"aria-labelledby": listBoxLabelledBy,
|
|
483
516
|
tabIndex: 0,
|
|
484
517
|
className: "np-select-input-listbox",
|
|
485
518
|
children: !virtualized ? filteredItems.map((_, index) => getItemNode(index)) : /*#__PURE__*/jsxRuntime.jsx(virtua.Virtualizer, {
|