@transferwise/components 0.0.0-experimental-0278b85 → 0.0.0-experimental-c98fba0
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/alert/Alert.js +1 -1
- package/build/alert/Alert.mjs +1 -1
- package/build/button/Button.js +1 -4
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.messages.js.map +1 -1
- package/build/button/Button.messages.mjs.map +1 -1
- package/build/button/Button.mjs +1 -4
- package/build/button/Button.mjs.map +1 -1
- package/build/button/classMap.js.map +1 -1
- package/build/button/classMap.mjs.map +1 -1
- package/build/button/legacyUtils/legacyUtils.js +7 -6
- package/build/button/legacyUtils/legacyUtils.js.map +1 -1
- package/build/button/legacyUtils/legacyUtils.mjs +7 -6
- package/build/button/legacyUtils/legacyUtils.mjs.map +1 -1
- package/build/checkbox/Checkbox.js +1 -1
- package/build/checkbox/Checkbox.mjs +1 -1
- package/build/checkboxOption/CheckboxOption.js +1 -1
- package/build/checkboxOption/CheckboxOption.mjs +1 -1
- package/build/drawer/Drawer.js +1 -1
- package/build/drawer/Drawer.mjs +1 -1
- package/build/index.js +2 -2
- package/build/index.mjs +1 -1
- package/build/markdown/Markdown.js +1 -1
- package/build/markdown/Markdown.mjs +1 -1
- package/build/popover/Popover.js +1 -1
- package/build/popover/Popover.mjs +1 -1
- package/build/stepper/deviceDetection.js +2 -3
- package/build/stepper/deviceDetection.js.map +1 -1
- package/build/stepper/deviceDetection.mjs +2 -3
- package/build/stepper/deviceDetection.mjs.map +1 -1
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/button/Button.messages.d.ts +7 -7
- package/build/types/button/Button.messages.d.ts.map +1 -1
- package/build/types/button/classMap.d.ts +10 -10
- package/build/types/button/classMap.d.ts.map +1 -1
- package/build/types/button/legacyUtils/index.d.ts +1 -1
- package/build/types/button/legacyUtils/index.d.ts.map +1 -1
- package/build/types/button/legacyUtils/legacyUtils.d.ts +20 -6
- package/build/types/button/legacyUtils/legacyUtils.d.ts.map +1 -1
- package/build/types/checkboxButton/index.d.ts +1 -1
- package/build/types/checkboxButton/index.d.ts.map +1 -1
- package/build/types/stepper/deviceDetection.d.ts +1 -1
- package/build/types/stepper/deviceDetection.d.ts.map +1 -1
- package/build/types/utilities/deprecatedProperty/deprecatedProperty.d.ts +6 -8
- package/build/types/utilities/deprecatedProperty/deprecatedProperty.d.ts.map +1 -1
- package/build/types/utilities/deprecatedProperty/index.d.ts +1 -1
- package/build/types/utilities/deprecatedProperty/index.d.ts.map +1 -1
- package/build/types/utilities/index.d.ts +2 -2
- package/build/types/utilities/index.d.ts.map +1 -1
- package/build/types/utilities/logActionRequired.d.ts +2 -2
- package/build/types/utilities/logActionRequired.d.ts.map +1 -1
- package/build/utilities/logActionRequired.js.map +1 -1
- package/build/utilities/logActionRequired.mjs.map +1 -1
- package/package.json +3 -3
- package/src/button/Button.tsx +0 -3
- package/src/button/legacyUtils/legacyUtils.ts +74 -0
- package/src/flowNavigation/{FlowNavigation.story.js → FlowNavigation.story.tsx} +34 -16
- package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.js +85 -0
- package/src/select/{Select.story.js → Select.story.tsx} +97 -47
- package/src/stepper/{deviceDetection.js → deviceDetection.ts} +2 -6
- package/src/utilities/deprecatedProperty/{deprecatedProperty.ts → deprecatedProperty.js} +4 -23
- package/src/utilities/{logActionRequired.ts → logActionRequired.js} +2 -2
- package/build/types/test-utils/style-mock.d.ts +0 -1
- package/build/types/test-utils/style-mock.d.ts.map +0 -1
- package/src/button/legacyUtils/legacyUtils.js +0 -54
- package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.tsx +0 -78
- /package/src/button/{Button.messages.js → Button.messages.ts} +0 -0
- /package/src/button/{classMap.js → classMap.ts} +0 -0
- /package/src/button/legacyUtils/{index.js → index.ts} +0 -0
- /package/src/checkboxButton/{index.js → index.ts} +0 -0
- /package/src/test-utils/{style-mock.ts → style-mock.js} +0 -0
- /package/src/utilities/deprecatedProperty/{index.ts → index.js} +0 -0
- /package/src/utilities/{index.ts → index.js} +0 -0
package/build/alert/Alert.js
CHANGED
|
@@ -8,10 +8,10 @@ var Body = require('../body/Body.js');
|
|
|
8
8
|
var CloseButton = require('../common/closeButton/CloseButton.js');
|
|
9
9
|
var StatusIcon = require('../statusIcon/StatusIcon.js');
|
|
10
10
|
var Title = require('../title/Title.js');
|
|
11
|
-
var logActionRequired = require('../utilities/logActionRequired.js');
|
|
12
11
|
var InlineMarkdown = require('./inlineMarkdown/InlineMarkdown.js');
|
|
13
12
|
var Action = require('../common/action/Action.js');
|
|
14
13
|
var jsxRuntime = require('react/jsx-runtime');
|
|
14
|
+
var logActionRequired = require('../utilities/logActionRequired.js');
|
|
15
15
|
var sentiment = require('../common/propsValues/sentiment.js');
|
|
16
16
|
var size = require('../common/propsValues/size.js');
|
|
17
17
|
var typography = require('../common/propsValues/typography.js');
|
package/build/alert/Alert.mjs
CHANGED
|
@@ -4,10 +4,10 @@ import Body from '../body/Body.mjs';
|
|
|
4
4
|
import { CloseButton } from '../common/closeButton/CloseButton.mjs';
|
|
5
5
|
import StatusIcon from '../statusIcon/StatusIcon.mjs';
|
|
6
6
|
import Title from '../title/Title.mjs';
|
|
7
|
-
import { logActionRequired } from '../utilities/logActionRequired.mjs';
|
|
8
7
|
import InlineMarkdown from './inlineMarkdown/InlineMarkdown.mjs';
|
|
9
8
|
import { Action } from '../common/action/Action.mjs';
|
|
10
9
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
|
+
import { logActionRequired } from '../utilities/logActionRequired.mjs';
|
|
11
11
|
import { Sentiment } from '../common/propsValues/sentiment.mjs';
|
|
12
12
|
import { Size } from '../common/propsValues/size.mjs';
|
|
13
13
|
import { Typography } from '../common/propsValues/typography.mjs';
|
package/build/button/Button.js
CHANGED
|
@@ -6,8 +6,8 @@ var reactIntl = require('react-intl');
|
|
|
6
6
|
var ProcessIndicator = require('../processIndicator/ProcessIndicator.js');
|
|
7
7
|
var Button_messages = require('./Button.messages.js');
|
|
8
8
|
var classMap = require('./classMap.js');
|
|
9
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
10
9
|
var legacyUtils = require('./legacyUtils/legacyUtils.js');
|
|
10
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
11
11
|
var control = require('../common/propsValues/control.js');
|
|
12
12
|
var size = require('../common/propsValues/size.js');
|
|
13
13
|
|
|
@@ -25,14 +25,11 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
25
25
|
...rest
|
|
26
26
|
}, reference) => {
|
|
27
27
|
const intl = reactIntl.useIntl();
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
29
28
|
legacyUtils.logDeprecationNotices({
|
|
30
29
|
size: size$1,
|
|
31
30
|
type
|
|
32
31
|
});
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
34
32
|
const newType = legacyUtils.establishNewType(type);
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
36
33
|
const newPriority = legacyUtils.establishNewPriority(priority, type);
|
|
37
34
|
const classes = clsx.clsx(`btn btn-${size$1}`, `np-btn np-btn-${size$1}`, {
|
|
38
35
|
'btn-loading': loading,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../src/button/Button.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ElementType, forwardRef, MouseEvent } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n ControlType,\n Priority,\n ControlTypeAccent,\n ControlTypeNegative,\n ControlTypePositive,\n PriorityPrimary,\n PrioritySecondary,\n PriorityTertiary,\n SizeExtraSmall,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n} from '../common';\nimport ProcessIndicator from '../processIndicator';\n\nimport messages from './Button.messages';\nimport { typeClassMap, priorityClassMap } from './classMap';\nimport { establishNewPriority, establishNewType, logDeprecationNotices } from './legacyUtils';\n\n/** @deprecated */\ntype DeprecatedTypes = 'primary' | 'pay' | 'secondary' | 'danger' | 'link';\n\n/** @deprecated */\ntype DeprecatedSizes = SizeExtraSmall;\n\ntype CommonProps = {\n block?: boolean;\n disabled?: boolean;\n loading?: boolean;\n type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes | null;\n priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary | null;\n size?: SizeSmall | SizeMedium | SizeLarge | DeprecatedSizes;\n};\n\ntype ButtonProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'button'>, 'type'> & {\n as?: 'button';\n htmlType?: 'submit' | 'reset' | 'button';\n };\n\ntype AnchorProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'a'>, 'type'> & {\n as?: 'a';\n };\n\nexport type Props = ButtonProps | AnchorProps;\n\ntype ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;\n\nconst Button = forwardRef<ButtonReferenceType, Props>(\n (\n {\n as: component,\n block = false,\n children,\n className,\n disabled,\n loading = false,\n priority = Priority.PRIMARY,\n size = Size.MEDIUM,\n type = ControlType.ACCENT,\n onClick,\n ...rest\n }: Props,\n reference,\n ) => {\n const intl = useIntl();\n\n
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../src/button/Button.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ElementType, forwardRef, MouseEvent } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n ControlType,\n Priority,\n ControlTypeAccent,\n ControlTypeNegative,\n ControlTypePositive,\n PriorityPrimary,\n PrioritySecondary,\n PriorityTertiary,\n SizeExtraSmall,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n} from '../common';\nimport ProcessIndicator from '../processIndicator';\n\nimport messages from './Button.messages';\nimport { typeClassMap, priorityClassMap } from './classMap';\nimport { establishNewPriority, establishNewType, logDeprecationNotices } from './legacyUtils';\n\n/** @deprecated */\ntype DeprecatedTypes = 'primary' | 'pay' | 'secondary' | 'danger' | 'link';\n\n/** @deprecated */\ntype DeprecatedSizes = SizeExtraSmall;\n\ntype CommonProps = {\n block?: boolean;\n disabled?: boolean;\n loading?: boolean;\n type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes | null;\n priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary | null;\n size?: SizeSmall | SizeMedium | SizeLarge | DeprecatedSizes;\n};\n\ntype ButtonProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'button'>, 'type'> & {\n as?: 'button';\n htmlType?: 'submit' | 'reset' | 'button';\n };\n\ntype AnchorProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'a'>, 'type'> & {\n as?: 'a';\n };\n\nexport type Props = ButtonProps | AnchorProps;\n\ntype ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;\n\nconst Button = forwardRef<ButtonReferenceType, Props>(\n (\n {\n as: component,\n block = false,\n children,\n className,\n disabled,\n loading = false,\n priority = Priority.PRIMARY,\n size = Size.MEDIUM,\n type = ControlType.ACCENT,\n onClick,\n ...rest\n }: Props,\n reference,\n ) => {\n const intl = useIntl();\n\n logDeprecationNotices({ size, type });\n\n const newType = establishNewType(type);\n const newPriority = establishNewPriority(priority, type);\n\n const classes = clsx(\n `btn btn-${size}`,\n `np-btn np-btn-${size}`,\n {\n 'btn-loading': loading,\n 'btn-block np-btn-block': block,\n disabled,\n },\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n typeClassMap[newType],\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n priorityClassMap[newPriority],\n className,\n );\n\n function processIndicatorSize() {\n return ['sm', 'xs'].includes(size) ? 'xxs' : 'xs';\n }\n\n const Element = (component as ElementType) ?? 'button';\n let props;\n\n if (Element === 'button') {\n const { htmlType = 'button', ...restProps } = rest as ButtonProps;\n props = {\n ...restProps,\n disabled,\n 'aria-disabled': loading,\n type: htmlType,\n };\n } else {\n props = {\n ...rest,\n 'aria-disabled': loading,\n } as AnchorProps;\n }\n\n /**\n * Ensures that the button cannot be activated in loading or disabled mode,\n * when `aria-disabled` might be used over the `disabled` HTML attribute\n */\n const handleClick =\n (handler: Props['onClick']) =>\n (event: MouseEvent<HTMLButtonElement> & MouseEvent<HTMLAnchorElement>) => {\n if (disabled || loading) {\n event.preventDefault();\n } else if (typeof handler === 'function') {\n handler(event);\n }\n };\n\n return (\n <Element\n ref={reference}\n className={classes}\n onClick={handleClick(onClick)}\n {...props}\n aria-live={loading ? 'polite' : 'off'}\n aria-busy={loading}\n aria-label={loading ? intl.formatMessage(messages.loadingAriaLabel) : rest['aria-label']}\n >\n {children}\n {loading && (\n <ProcessIndicator\n size={processIndicatorSize()}\n className=\"btn-loader\"\n data-testid=\"ButtonProgressIndicator\"\n />\n )}\n </Element>\n );\n },\n);\n\nexport default Button;\n"],"names":["Button","forwardRef","as","component","block","children","className","disabled","loading","priority","Priority","PRIMARY","size","Size","MEDIUM","type","ControlType","ACCENT","onClick","rest","reference","intl","useIntl","logDeprecationNotices","newType","establishNewType","newPriority","establishNewPriority","classes","clsx","typeClassMap","priorityClassMap","processIndicatorSize","includes","Element","props","htmlType","restProps","handleClick","handler","event","preventDefault","_jsxs","ref","formatMessage","messages","loadingAriaLabel","_jsx","ProcessIndicator"],"mappings":";;;;;;;;;;;;;AAuDA,MAAMA,MAAM,gBAAGC,gBAAU,CACvB,CACE;AACEC,EAAAA,EAAE,EAAEC,SAAS;AACbC,EAAAA,KAAK,GAAG,KAAK;EACbC,QAAQ;EACRC,SAAS;EACTC,QAAQ;AACRC,EAAAA,OAAO,GAAG,KAAK;EACfC,QAAQ,GAAGC,gBAAQ,CAACC,OAAO;QAC3BC,MAAI,GAAGC,SAAI,CAACC,MAAM;EAClBC,IAAI,GAAGC,mBAAW,CAACC,MAAM;EACzBC,OAAO;EACP,GAAGC,IAAAA;AACG,CAAA,EACRC,SAAS,KACP;AACF,EAAA,MAAMC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AA;KACH,CAAA;AAClB,GAAA;AAEA;;;AAGG;AACH,EAAA,MAAM8B,WAAW,GACdC,OAAyB,IACzBC,KAAoE,IAAI;IACvE,IAAIjC,QAAQ,IAAIC,OAAO,EAAE;MACvBgC,KAAK,CAACC,cAAc,EAAE,CAAA;AACxB,KAAC,MAAM,IAAI,OAAOF,OAAO,KAAK,UAAU,EAAE;MACxCA,OAAO,CAACC,KAAK,CAAC,CAAA;AAChB,KAAA;GACD,CAAA;EAEH,oBACEE,eAAA,CAACR,OAAO,EAAA;AACNS,IAAAA,GAAG,EAAEvB,SAAU;AACfd,IAAAA,SAAS,EAAEsB,OAAQ;AACnBV,IAAAA,OAAO,EAAEoB,WAAW,CAACpB,OAAO,CAAE;AAAA,IAAA,GAC1BiB,KAAK;AACT,IAAA,WAAA,EAAW3B,OAAO,GAAG,QAAQ,GAAG,KAAM;AACtC,IAAA,WAAA,EAAWA,OAAQ;AACnB,IAAA,YAAA,EAAYA,OAAO,GAAGa,IAAI,CAACuB,aAAa,CAACC,eAAQ,CAACC,gBAAgB,CAAC,GAAG3B,IAAI,CAAC,YAAY,CAAE;AAAAd,IAAAA,QAAA,GAExFA,QAAQ,EACRG,OAAO,iBACNuC,cAAA,CAACC,gBAAgB,EAAA;MACfpC,IAAI,EAAEoB,oBAAoB,EAAG;AAC7B1B,MAAAA,SAAS,EAAC,YAAY;MACtB,aAAY,EAAA,yBAAA;AAAyB,KACrC,CACH,CAAA;AAAA,GACM,CAAC,CAAA;AAEd,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.messages.js","sources":["../../src/button/Button.messages.
|
|
1
|
+
{"version":3,"file":"Button.messages.js","sources":["../../src/button/Button.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n loadingAriaLabel: {\n id: 'neptune.Button.loadingAriaLabel',\n defaultMessage: 'loading',\n description: 'Description of button while loading',\n },\n});\n"],"names":["defineMessages","loadingAriaLabel","id"],"mappings":";;;;AAEA,eAAeA,wBAAc,CAAC;AAC5BC,EAAAA,gBAAgB,EAAE;IAChBC,EAAE,EAAA,iCAAA;AAGH,GAAA;AACF,CAAA,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.messages.mjs","sources":["../../src/button/Button.messages.
|
|
1
|
+
{"version":3,"file":"Button.messages.mjs","sources":["../../src/button/Button.messages.ts"],"sourcesContent":["import { defineMessages } from 'react-intl';\n\nexport default defineMessages({\n loadingAriaLabel: {\n id: 'neptune.Button.loadingAriaLabel',\n defaultMessage: 'loading',\n description: 'Description of button while loading',\n },\n});\n"],"names":["defineMessages","loadingAriaLabel","id"],"mappings":";;AAEA,eAAeA,cAAc,CAAC;AAC5BC,EAAAA,gBAAgB,EAAE;IAChBC,EAAE,EAAA,iCAAA;AAGH,GAAA;AACF,CAAA,CAAC;;;;"}
|
package/build/button/Button.mjs
CHANGED
|
@@ -4,8 +4,8 @@ import { useIntl } from 'react-intl';
|
|
|
4
4
|
import ProcessIndicator from '../processIndicator/ProcessIndicator.mjs';
|
|
5
5
|
import messages from './Button.messages.mjs';
|
|
6
6
|
import { typeClassMap, priorityClassMap } from './classMap.mjs';
|
|
7
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
7
|
import { logDeprecationNotices, establishNewType, establishNewPriority } from './legacyUtils/legacyUtils.mjs';
|
|
8
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
9
9
|
import { Priority, ControlType } from '../common/propsValues/control.mjs';
|
|
10
10
|
import { Size } from '../common/propsValues/size.mjs';
|
|
11
11
|
|
|
@@ -23,14 +23,11 @@ const Button = /*#__PURE__*/forwardRef(({
|
|
|
23
23
|
...rest
|
|
24
24
|
}, reference) => {
|
|
25
25
|
const intl = useIntl();
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
27
26
|
logDeprecationNotices({
|
|
28
27
|
size,
|
|
29
28
|
type
|
|
30
29
|
});
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
32
30
|
const newType = establishNewType(type);
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
34
31
|
const newPriority = establishNewPriority(priority, type);
|
|
35
32
|
const classes = clsx(`btn btn-${size}`, `np-btn np-btn-${size}`, {
|
|
36
33
|
'btn-loading': loading,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.mjs","sources":["../../src/button/Button.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ElementType, forwardRef, MouseEvent } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n ControlType,\n Priority,\n ControlTypeAccent,\n ControlTypeNegative,\n ControlTypePositive,\n PriorityPrimary,\n PrioritySecondary,\n PriorityTertiary,\n SizeExtraSmall,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n} from '../common';\nimport ProcessIndicator from '../processIndicator';\n\nimport messages from './Button.messages';\nimport { typeClassMap, priorityClassMap } from './classMap';\nimport { establishNewPriority, establishNewType, logDeprecationNotices } from './legacyUtils';\n\n/** @deprecated */\ntype DeprecatedTypes = 'primary' | 'pay' | 'secondary' | 'danger' | 'link';\n\n/** @deprecated */\ntype DeprecatedSizes = SizeExtraSmall;\n\ntype CommonProps = {\n block?: boolean;\n disabled?: boolean;\n loading?: boolean;\n type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes | null;\n priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary | null;\n size?: SizeSmall | SizeMedium | SizeLarge | DeprecatedSizes;\n};\n\ntype ButtonProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'button'>, 'type'> & {\n as?: 'button';\n htmlType?: 'submit' | 'reset' | 'button';\n };\n\ntype AnchorProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'a'>, 'type'> & {\n as?: 'a';\n };\n\nexport type Props = ButtonProps | AnchorProps;\n\ntype ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;\n\nconst Button = forwardRef<ButtonReferenceType, Props>(\n (\n {\n as: component,\n block = false,\n children,\n className,\n disabled,\n loading = false,\n priority = Priority.PRIMARY,\n size = Size.MEDIUM,\n type = ControlType.ACCENT,\n onClick,\n ...rest\n }: Props,\n reference,\n ) => {\n const intl = useIntl();\n\n
|
|
1
|
+
{"version":3,"file":"Button.mjs","sources":["../../src/button/Button.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ElementType, forwardRef, MouseEvent } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n ControlType,\n Priority,\n ControlTypeAccent,\n ControlTypeNegative,\n ControlTypePositive,\n PriorityPrimary,\n PrioritySecondary,\n PriorityTertiary,\n SizeExtraSmall,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n} from '../common';\nimport ProcessIndicator from '../processIndicator';\n\nimport messages from './Button.messages';\nimport { typeClassMap, priorityClassMap } from './classMap';\nimport { establishNewPriority, establishNewType, logDeprecationNotices } from './legacyUtils';\n\n/** @deprecated */\ntype DeprecatedTypes = 'primary' | 'pay' | 'secondary' | 'danger' | 'link';\n\n/** @deprecated */\ntype DeprecatedSizes = SizeExtraSmall;\n\ntype CommonProps = {\n block?: boolean;\n disabled?: boolean;\n loading?: boolean;\n type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes | null;\n priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary | null;\n size?: SizeSmall | SizeMedium | SizeLarge | DeprecatedSizes;\n};\n\ntype ButtonProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'button'>, 'type'> & {\n as?: 'button';\n htmlType?: 'submit' | 'reset' | 'button';\n };\n\ntype AnchorProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'a'>, 'type'> & {\n as?: 'a';\n };\n\nexport type Props = ButtonProps | AnchorProps;\n\ntype ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;\n\nconst Button = forwardRef<ButtonReferenceType, Props>(\n (\n {\n as: component,\n block = false,\n children,\n className,\n disabled,\n loading = false,\n priority = Priority.PRIMARY,\n size = Size.MEDIUM,\n type = ControlType.ACCENT,\n onClick,\n ...rest\n }: Props,\n reference,\n ) => {\n const intl = useIntl();\n\n logDeprecationNotices({ size, type });\n\n const newType = establishNewType(type);\n const newPriority = establishNewPriority(priority, type);\n\n const classes = clsx(\n `btn btn-${size}`,\n `np-btn np-btn-${size}`,\n {\n 'btn-loading': loading,\n 'btn-block np-btn-block': block,\n disabled,\n },\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n typeClassMap[newType],\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n priorityClassMap[newPriority],\n className,\n );\n\n function processIndicatorSize() {\n return ['sm', 'xs'].includes(size) ? 'xxs' : 'xs';\n }\n\n const Element = (component as ElementType) ?? 'button';\n let props;\n\n if (Element === 'button') {\n const { htmlType = 'button', ...restProps } = rest as ButtonProps;\n props = {\n ...restProps,\n disabled,\n 'aria-disabled': loading,\n type: htmlType,\n };\n } else {\n props = {\n ...rest,\n 'aria-disabled': loading,\n } as AnchorProps;\n }\n\n /**\n * Ensures that the button cannot be activated in loading or disabled mode,\n * when `aria-disabled` might be used over the `disabled` HTML attribute\n */\n const handleClick =\n (handler: Props['onClick']) =>\n (event: MouseEvent<HTMLButtonElement> & MouseEvent<HTMLAnchorElement>) => {\n if (disabled || loading) {\n event.preventDefault();\n } else if (typeof handler === 'function') {\n handler(event);\n }\n };\n\n return (\n <Element\n ref={reference}\n className={classes}\n onClick={handleClick(onClick)}\n {...props}\n aria-live={loading ? 'polite' : 'off'}\n aria-busy={loading}\n aria-label={loading ? intl.formatMessage(messages.loadingAriaLabel) : rest['aria-label']}\n >\n {children}\n {loading && (\n <ProcessIndicator\n size={processIndicatorSize()}\n className=\"btn-loader\"\n data-testid=\"ButtonProgressIndicator\"\n />\n )}\n </Element>\n );\n },\n);\n\nexport default Button;\n"],"names":["Button","forwardRef","as","component","block","children","className","disabled","loading","priority","Priority","PRIMARY","size","Size","MEDIUM","type","ControlType","ACCENT","onClick","rest","reference","intl","useIntl","logDeprecationNotices","newType","establishNewType","newPriority","establishNewPriority","classes","clsx","typeClassMap","priorityClassMap","processIndicatorSize","includes","Element","props","htmlType","restProps","handleClick","handler","event","preventDefault","_jsxs","ref","formatMessage","messages","loadingAriaLabel","_jsx","ProcessIndicator"],"mappings":";;;;;;;;;;;AAuDA,MAAMA,MAAM,gBAAGC,UAAU,CACvB,CACE;AACEC,EAAAA,EAAE,EAAEC,SAAS;AACbC,EAAAA,KAAK,GAAG,KAAK;EACbC,QAAQ;EACRC,SAAS;EACTC,QAAQ;AACRC,EAAAA,OAAO,GAAG,KAAK;EACfC,QAAQ,GAAGC,QAAQ,CAACC,OAAO;EAC3BC,IAAI,GAAGC,IAAI,CAACC,MAAM;EAClBC,IAAI,GAAGC,WAAW,CAACC,MAAM;EACzBC,OAAO;EACP,GAAGC,IAAAA;AACG,CAAA,EACRC,SAAS,KACP;AACF,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE,CAAA;AAEtBC,EAAAA,qBAAqB,CAAC;IAAEX,IAAI;AAAEG,IAAAA,IAAAA;AAAI,GAAE,CAAC,CAAA;AAErC,EAAA,MAAMS,OAAO,GAAGC,gBAAgB,CAACV,IAAI,CAAC,CAAA;AACtC,EAAA,MAAMW,WAAW,GAAGC,oBAAoB,CAAClB,QAAQ,EAAEM,IAAI,CAAC,CAAA;EAExD,MAAMa,OAAO,GAAGC,IAAI,CAClB,CAAA,QAAA,EAAWjB,IAAI,CAAA,CAAE,EACjB,CAAA,cAAA,EAAiBA,IAAI,CAAA,CAAE,EACvB;AACE,IAAA,aAAa,EAAEJ,OAAO;AACtB,IAAA,wBAAwB,EAAEJ,KAAK;AAC/BG,IAAAA,QAAAA;GACD;AACD;AACA;EACAuB,YAAY,CAACN,OAAO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,GAAG,KAAM;AACtC,IAAA,WAAA,EAAWA,OAAQ;AACnB,IAAA,YAAA,EAAYA,OAAO,GAAGa,IAAI,CAACuB,aAAa,CAACC,QAAQ,CAACC,gBAAgB,CAAC,GAAG3B,IAAI,CAAC,YAAY,CAAE;AAAAd,IAAAA,QAAA,GAExFA,QAAQ,EACRG,OAAO,iBACNuC,GAAA,CAACC,gBAAgB,EAAA;MACfpC,IAAI,EAAEoB,oBAAoB,EAAG;AAC7B1B,MAAAA,SAAS,EAAC,YAAY;MACtB,aAAY,EAAA,yBAAA;AAAyB,KACrC,CACH,CAAA;AAAA,GACM,CAAC,CAAA;AAEd,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classMap.js","sources":["../../src/button/classMap.
|
|
1
|
+
{"version":3,"file":"classMap.js","sources":["../../src/button/classMap.ts"],"sourcesContent":["import { ControlType, Priority } from '../common';\n\nexport const typeClassMap = {\n [ControlType.ACCENT]: 'btn-accent',\n [ControlType.POSITIVE]: 'btn-positive',\n [ControlType.NEGATIVE]: 'btn-negative',\n};\n\nexport const priorityClassMap = {\n [Priority.PRIMARY]: 'btn-priority-1',\n [Priority.SECONDARY]: 'btn-priority-2',\n [Priority.TERTIARY]: 'btn-priority-3',\n};\n"],"names":["typeClassMap","ControlType","ACCENT","POSITIVE","NEGATIVE","priorityClassMap","Priority","PRIMARY","SECONDARY","TERTIARY"],"mappings":";;;;AAEO,MAAMA,YAAY,GAAG;AAC1B,EAAA,CAACC,mBAAW,CAACC,MAAM,GAAG,YAAY;AAClC,EAAA,CAACD,mBAAW,CAACE,QAAQ,GAAG,cAAc;EACtC,CAACF,mBAAW,CAACG,QAAQ,GAAG,cAAA;EACzB;AAEM,MAAMC,gBAAgB,GAAG;AAC9B,EAAA,CAACC,gBAAQ,CAACC,OAAO,GAAG,gBAAgB;AACpC,EAAA,CAACD,gBAAQ,CAACE,SAAS,GAAG,gBAAgB;EACtC,CAACF,gBAAQ,CAACG,QAAQ,GAAG,gBAAA;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classMap.mjs","sources":["../../src/button/classMap.
|
|
1
|
+
{"version":3,"file":"classMap.mjs","sources":["../../src/button/classMap.ts"],"sourcesContent":["import { ControlType, Priority } from '../common';\n\nexport const typeClassMap = {\n [ControlType.ACCENT]: 'btn-accent',\n [ControlType.POSITIVE]: 'btn-positive',\n [ControlType.NEGATIVE]: 'btn-negative',\n};\n\nexport const priorityClassMap = {\n [Priority.PRIMARY]: 'btn-priority-1',\n [Priority.SECONDARY]: 'btn-priority-2',\n [Priority.TERTIARY]: 'btn-priority-3',\n};\n"],"names":["typeClassMap","ControlType","ACCENT","POSITIVE","NEGATIVE","priorityClassMap","Priority","PRIMARY","SECONDARY","TERTIARY"],"mappings":";;AAEO,MAAMA,YAAY,GAAG;AAC1B,EAAA,CAACC,WAAW,CAACC,MAAM,GAAG,YAAY;AAClC,EAAA,CAACD,WAAW,CAACE,QAAQ,GAAG,cAAc;EACtC,CAACF,WAAW,CAACG,QAAQ,GAAG,cAAA;EACzB;AAEM,MAAMC,gBAAgB,GAAG;AAC9B,EAAA,CAACC,QAAQ,CAACC,OAAO,GAAG,gBAAgB;AACpC,EAAA,CAACD,QAAQ,CAACE,SAAS,GAAG,gBAAgB;EACtC,CAACF,QAAQ,CAACG,QAAQ,GAAG,gBAAA;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var logActionRequired = require('../../utilities/logActionRequired.js');
|
|
4
3
|
var type = require('../../common/propsValues/type.js');
|
|
4
|
+
var logActionRequired = require('../../utilities/logActionRequired.js');
|
|
5
5
|
var control = require('../../common/propsValues/control.js');
|
|
6
6
|
var size = require('../../common/propsValues/size.js');
|
|
7
7
|
|
|
@@ -25,13 +25,12 @@ const deprecatedTypeMapMessage = {
|
|
|
25
25
|
[type.Type.SECONDARY]: 'ControlType.ACCENT with priority Priority.SECONDARY'
|
|
26
26
|
};
|
|
27
27
|
const deprecatedTypes = Object.keys(deprecatedTypeMap);
|
|
28
|
-
const establishNewType = originalType => deprecatedTypeMap[originalType]
|
|
28
|
+
const establishNewType = originalType => originalType && originalType in deprecatedTypeMap ? deprecatedTypeMap[originalType] : originalType;
|
|
29
29
|
const establishNewPriority = (originalPriority, originalType) => {
|
|
30
|
-
const type = establishNewType(originalType);
|
|
31
|
-
|
|
30
|
+
const type = originalType ? establishNewType(originalType) : '';
|
|
32
31
|
// The old SECONDARY and LINK types now map to priorities. If they're still using one of
|
|
33
32
|
// these old types, ignore whatever priority they've passed and use this instead.
|
|
34
|
-
if (oldTypePriorityMap
|
|
33
|
+
if (originalType && originalType in oldTypePriorityMap) {
|
|
35
34
|
return oldTypePriorityMap[originalType];
|
|
36
35
|
}
|
|
37
36
|
// Only ControlType.ACCENT supports tertiary styles
|
|
@@ -45,7 +44,9 @@ const logDeprecationNotices = ({
|
|
|
45
44
|
type
|
|
46
45
|
}) => {
|
|
47
46
|
logActionRequired.logActionRequiredIf('Button has deprecated the `Size.EXTRA_SMALL` value for the `size` prop. Please use Size.SMALL instead.', size$1 === size.Size.EXTRA_SMALL);
|
|
48
|
-
|
|
47
|
+
if (type && deprecatedTypes.includes(type) && type in deprecatedTypeMapMessage) {
|
|
48
|
+
logActionRequired.logActionRequired(`Button has deprecated the ${type} value for the \`type\` prop. Please update to ${deprecatedTypeMapMessage[type]}.`);
|
|
49
|
+
}
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
exports.establishNewPriority = establishNewPriority;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacyUtils.js","sources":["../../../src/button/legacyUtils/legacyUtils.
|
|
1
|
+
{"version":3,"file":"legacyUtils.js","sources":["../../../src/button/legacyUtils/legacyUtils.ts"],"sourcesContent":["import { ControlType, Priority, Size, Type } from '../../common';\nimport { logActionRequired, logActionRequiredIf } from '../../utilities';\n\nconst deprecatedTypeMap: Record<Type, ControlType> = {\n [Type.PRIMARY]: ControlType.ACCENT,\n [Type.SECONDARY]: ControlType.ACCENT,\n [Type.LINK]: ControlType.ACCENT,\n [Type.PAY]: ControlType.POSITIVE,\n [Type.DANGER]: ControlType.NEGATIVE,\n};\n\ntype OldTypeKeys = Type.DANGER | Type.LINK | Type.SECONDARY;\nconst oldTypePriorityMap: Record<OldTypeKeys, Priority> = {\n [Type.DANGER]: Priority.SECONDARY,\n [Type.LINK]: Priority.TERTIARY,\n [Type.SECONDARY]: Priority.SECONDARY,\n};\n\nconst deprecatedTypeMapMessage = {\n [Type.DANGER]: 'Type.NEGATIVE',\n [Type.LINK]: 'ControlType.ACCENT with priority Priority.TERTIARY',\n [Type.PAY]: 'ControlType.POSITIVE',\n [Type.PRIMARY]: 'ControlType.ACCENT',\n [Type.SECONDARY]: 'ControlType.ACCENT with priority Priority.SECONDARY',\n};\n\nconst deprecatedTypes = Object.keys(deprecatedTypeMap);\n\ntype EstablishNewTypeType = (\n originalType: Type | (string & Record<never, never>) | null,\n) => `${ControlType}` | string | null;\n\nexport const establishNewType: EstablishNewTypeType = (originalType) =>\n originalType && originalType in deprecatedTypeMap\n ? deprecatedTypeMap[originalType as Type]\n : originalType;\n\ntype EstablishNewPriorityType = (\n originalPriority?: Priority | (string & Record<never, never>) | null,\n originalType?: OldTypeKeys | (string & Record<never, never>) | null,\n) => `${ControlType}` | string | null | undefined;\n\nexport const establishNewPriority: EstablishNewPriorityType = (originalPriority, originalType) => {\n const type = originalType ? establishNewType(originalType) : '';\n\n // The old SECONDARY and LINK types now map to priorities. If they're still using one of\n // these old types, ignore whatever priority they've passed and use this instead.\n if (originalType && originalType in oldTypePriorityMap) {\n return oldTypePriorityMap[originalType as OldTypeKeys];\n }\n // Only ControlType.ACCENT supports tertiary styles\n if (originalPriority === Priority.TERTIARY && type !== ControlType.ACCENT) {\n return Priority.SECONDARY;\n }\n return originalPriority;\n};\n\ntype DeprecatedTypeMapMessageType = keyof typeof deprecatedTypeMapMessage;\ntype LogDeprecationNoticesType = (params: {\n size: `${Size}`;\n type: DeprecatedTypeMapMessageType | (string & Record<never, never>) | null;\n}) => void;\nexport const logDeprecationNotices: LogDeprecationNoticesType = ({ size, type }) => {\n logActionRequiredIf(\n 'Button has deprecated the `Size.EXTRA_SMALL` value for the `size` prop. Please use Size.SMALL instead.',\n size === Size.EXTRA_SMALL,\n );\n\n if (type && deprecatedTypes.includes(type) && type in deprecatedTypeMapMessage) {\n logActionRequired(\n `Button has deprecated the ${type} value for the \\`type\\` prop. Please update to ${deprecatedTypeMapMessage[type as DeprecatedTypeMapMessageType]}.`,\n );\n }\n};\n"],"names":["deprecatedTypeMap","Type","PRIMARY","ControlType","ACCENT","SECONDARY","LINK","PAY","POSITIVE","DANGER","NEGATIVE","oldTypePriorityMap","Priority","TERTIARY","deprecatedTypeMapMessage","deprecatedTypes","Object","keys","establishNewType","originalType","establishNewPriority","originalPriority","type","logDeprecationNotices","size","logActionRequiredIf","Size","EXTRA_SMALL","includes","logActionRequired"],"mappings":";;;;;;;AAGA,MAAMA,iBAAiB,GAA8B;AACnD,EAAA,CAACC,SAAI,CAACC,OAAO,GAAGC,mBAAW,CAACC,MAAM;AAClC,EAAA,CAACH,SAAI,CAACI,SAAS,GAAGF,mBAAW,CAACC,MAAM;AACpC,EAAA,CAACH,SAAI,CAACK,IAAI,GAAGH,mBAAW,CAACC,MAAM;AAC/B,EAAA,CAACH,SAAI,CAACM,GAAG,GAAGJ,mBAAW,CAACK,QAAQ;AAChC,EAAA,CAACP,SAAI,CAACQ,MAAM,GAAGN,mBAAW,CAACO,QAAAA;CAC5B,CAAA;AAGD,MAAMC,kBAAkB,GAAkC;AACxD,EAAA,CAACV,SAAI,CAACQ,MAAM,GAAGG,gBAAQ,CAACP,SAAS;AACjC,EAAA,CAACJ,SAAI,CAACK,IAAI,GAAGM,gBAAQ,CAACC,QAAQ;AAC9B,EAAA,CAACZ,SAAI,CAACI,SAAS,GAAGO,gBAAQ,CAACP,SAAAA;CAC5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EAAE;IAC9Ee,mCAAiB,CACf,6BAA6BP,IAAI,CAAA,+CAAA,EAAkDR,wBAAwB,CAACQ,IAAoC,CAAC,CAAA,CAAA,CAAG,CACrJ,CAAA;AACH,GAAA;AACF;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { logActionRequiredIf } from '../../utilities/logActionRequired.mjs';
|
|
2
1
|
import { Type } from '../../common/propsValues/type.mjs';
|
|
2
|
+
import { logActionRequiredIf, logActionRequired } from '../../utilities/logActionRequired.mjs';
|
|
3
3
|
import { ControlType, Priority } from '../../common/propsValues/control.mjs';
|
|
4
4
|
import { Size } from '../../common/propsValues/size.mjs';
|
|
5
5
|
|
|
@@ -23,13 +23,12 @@ const deprecatedTypeMapMessage = {
|
|
|
23
23
|
[Type.SECONDARY]: 'ControlType.ACCENT with priority Priority.SECONDARY'
|
|
24
24
|
};
|
|
25
25
|
const deprecatedTypes = Object.keys(deprecatedTypeMap);
|
|
26
|
-
const establishNewType = originalType => deprecatedTypeMap[originalType]
|
|
26
|
+
const establishNewType = originalType => originalType && originalType in deprecatedTypeMap ? deprecatedTypeMap[originalType] : originalType;
|
|
27
27
|
const establishNewPriority = (originalPriority, originalType) => {
|
|
28
|
-
const type = establishNewType(originalType);
|
|
29
|
-
|
|
28
|
+
const type = originalType ? establishNewType(originalType) : '';
|
|
30
29
|
// The old SECONDARY and LINK types now map to priorities. If they're still using one of
|
|
31
30
|
// these old types, ignore whatever priority they've passed and use this instead.
|
|
32
|
-
if (oldTypePriorityMap
|
|
31
|
+
if (originalType && originalType in oldTypePriorityMap) {
|
|
33
32
|
return oldTypePriorityMap[originalType];
|
|
34
33
|
}
|
|
35
34
|
// Only ControlType.ACCENT supports tertiary styles
|
|
@@ -43,7 +42,9 @@ const logDeprecationNotices = ({
|
|
|
43
42
|
type
|
|
44
43
|
}) => {
|
|
45
44
|
logActionRequiredIf('Button has deprecated the `Size.EXTRA_SMALL` value for the `size` prop. Please use Size.SMALL instead.', size === Size.EXTRA_SMALL);
|
|
46
|
-
|
|
45
|
+
if (type && deprecatedTypes.includes(type) && type in deprecatedTypeMapMessage) {
|
|
46
|
+
logActionRequired(`Button has deprecated the ${type} value for the \`type\` prop. Please update to ${deprecatedTypeMapMessage[type]}.`);
|
|
47
|
+
}
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
export { establishNewPriority, establishNewType, logDeprecationNotices };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacyUtils.mjs","sources":["../../../src/button/legacyUtils/legacyUtils.
|
|
1
|
+
{"version":3,"file":"legacyUtils.mjs","sources":["../../../src/button/legacyUtils/legacyUtils.ts"],"sourcesContent":["import { ControlType, Priority, Size, Type } from '../../common';\nimport { logActionRequired, logActionRequiredIf } from '../../utilities';\n\nconst deprecatedTypeMap: Record<Type, ControlType> = {\n [Type.PRIMARY]: ControlType.ACCENT,\n [Type.SECONDARY]: ControlType.ACCENT,\n [Type.LINK]: ControlType.ACCENT,\n [Type.PAY]: ControlType.POSITIVE,\n [Type.DANGER]: ControlType.NEGATIVE,\n};\n\ntype OldTypeKeys = Type.DANGER | Type.LINK | Type.SECONDARY;\nconst oldTypePriorityMap: Record<OldTypeKeys, Priority> = {\n [Type.DANGER]: Priority.SECONDARY,\n [Type.LINK]: Priority.TERTIARY,\n [Type.SECONDARY]: Priority.SECONDARY,\n};\n\nconst deprecatedTypeMapMessage = {\n [Type.DANGER]: 'Type.NEGATIVE',\n [Type.LINK]: 'ControlType.ACCENT with priority Priority.TERTIARY',\n [Type.PAY]: 'ControlType.POSITIVE',\n [Type.PRIMARY]: 'ControlType.ACCENT',\n [Type.SECONDARY]: 'ControlType.ACCENT with priority Priority.SECONDARY',\n};\n\nconst deprecatedTypes = Object.keys(deprecatedTypeMap);\n\ntype EstablishNewTypeType = (\n originalType: Type | (string & Record<never, never>) | null,\n) => `${ControlType}` | string | null;\n\nexport const establishNewType: EstablishNewTypeType = (originalType) =>\n originalType && originalType in deprecatedTypeMap\n ? deprecatedTypeMap[originalType as Type]\n : originalType;\n\ntype EstablishNewPriorityType = (\n originalPriority?: Priority | (string & Record<never, never>) | null,\n originalType?: OldTypeKeys | (string & Record<never, never>) | null,\n) => `${ControlType}` | string | null | undefined;\n\nexport const establishNewPriority: EstablishNewPriorityType = (originalPriority, originalType) => {\n const type = originalType ? establishNewType(originalType) : '';\n\n // The old SECONDARY and LINK types now map to priorities. If they're still using one of\n // these old types, ignore whatever priority they've passed and use this instead.\n if (originalType && originalType in oldTypePriorityMap) {\n return oldTypePriorityMap[originalType as OldTypeKeys];\n }\n // Only ControlType.ACCENT supports tertiary styles\n if (originalPriority === Priority.TERTIARY && type !== ControlType.ACCENT) {\n return Priority.SECONDARY;\n }\n return originalPriority;\n};\n\ntype DeprecatedTypeMapMessageType = keyof typeof deprecatedTypeMapMessage;\ntype LogDeprecationNoticesType = (params: {\n size: `${Size}`;\n type: DeprecatedTypeMapMessageType | (string & Record<never, never>) | null;\n}) => void;\nexport const logDeprecationNotices: LogDeprecationNoticesType = ({ size, type }) => {\n logActionRequiredIf(\n 'Button has deprecated the `Size.EXTRA_SMALL` value for the `size` prop. Please use Size.SMALL instead.',\n size === Size.EXTRA_SMALL,\n );\n\n if (type && deprecatedTypes.includes(type) && type in deprecatedTypeMapMessage) {\n logActionRequired(\n `Button has deprecated the ${type} value for the \\`type\\` prop. Please update to ${deprecatedTypeMapMessage[type as DeprecatedTypeMapMessageType]}.`,\n );\n }\n};\n"],"names":["deprecatedTypeMap","Type","PRIMARY","ControlType","ACCENT","SECONDARY","LINK","PAY","POSITIVE","DANGER","NEGATIVE","oldTypePriorityMap","Priority","TERTIARY","deprecatedTypeMapMessage","deprecatedTypes","Object","keys","establishNewType","originalType","establishNewPriority","originalPriority","type","logDeprecationNotices","size","logActionRequiredIf","Size","EXTRA_SMALL","includes","logActionRequired"],"mappings":";;;;;AAGA,MAAMA,iBAAiB,GAA8B;AACnD,EAAA,CAACC,IAAI,CAACC,OAAO,GAAGC,WAAW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CAACQ,YAA2B,CAAC,CAAA;AACxD,GAAA;AACA;EACA,IAAIE,gBAAgB,KAAKT,QAAQ,CAACC,QAAQ,IAAIS,IAAI,KAAKnB,WAAW,CAACC,MAAM,EAAE;IACzE,OAAOQ,QAAQ,CAACP,SAAS,CAAA;AAC3B,GAAA;AACA,EAAA,OAAOgB,gBAAgB,CAAA;AACzB,EAAC;AAOM,MAAME,qBAAqB,GAA8BA,CAAC;EAAEC,IAAI;AAAEF,EAAAA,IAAAA;AAAM,CAAA,KAAI;EACjFG,mBAAmB,CACjB,wGAAwG,EACxGD,IAAI,KAAKE,IAAI,CAACC,WAAW,CAC1B,CAAA;AAED,EAAA,IAAIL,IAAI,IAAIP,eAAe,CAACa,QAAQ,CAACN,IAAI,CAAC,IAAIA,IAAI,IAAIR,wBAAwB,EAAE;IAC9Ee,iBAAiB,CACf,6BAA6BP,IAAI,CAAA,+CAAA,EAAkDR,wBAAwB,CAACQ,IAAoC,CAAC,CAAA,CAAA,CAAG,CACrJ,CAAA;AACH,GAAA;AACF;;;;"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var clsx = require('clsx');
|
|
4
4
|
var Body = require('../body/Body.js');
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
5
|
var CheckboxButton = require('../checkboxButton/CheckboxButton.js');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var typography = require('../common/propsValues/typography.js');
|
|
8
8
|
|
|
9
9
|
function Checkbox({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import Body from '../body/Body.mjs';
|
|
3
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
3
|
import CheckboxButton from '../checkboxButton/CheckboxButton.mjs';
|
|
4
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
5
|
import { Typography } from '../common/propsValues/typography.mjs';
|
|
6
6
|
|
|
7
7
|
function Checkbox({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
+
var CheckboxButton = require('../checkboxButton/CheckboxButton.js');
|
|
4
5
|
var Option = require('../common/Option/Option.js');
|
|
5
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var CheckboxButton = require('../checkboxButton/CheckboxButton.js');
|
|
7
7
|
|
|
8
8
|
const CheckboxOption = /*#__PURE__*/React.forwardRef(({
|
|
9
9
|
checked,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
+
import CheckboxButton from '../checkboxButton/CheckboxButton.mjs';
|
|
2
3
|
import Option from '../common/Option/Option.mjs';
|
|
3
4
|
import { jsx } from 'react/jsx-runtime';
|
|
4
|
-
import CheckboxButton from '../checkboxButton/CheckboxButton.mjs';
|
|
5
5
|
|
|
6
6
|
const CheckboxOption = /*#__PURE__*/forwardRef(({
|
|
7
7
|
checked,
|
package/build/drawer/Drawer.js
CHANGED
|
@@ -7,8 +7,8 @@ var Dimmer = require('../dimmer/Dimmer.js');
|
|
|
7
7
|
var OverlayIdProvider = require('../provider/overlay/OverlayIdProvider.js');
|
|
8
8
|
var SlidingPanel = require('../slidingPanel/SlidingPanel.js');
|
|
9
9
|
var Title = require('../title/Title.js');
|
|
10
|
-
var logActionRequired = require('../utilities/logActionRequired.js');
|
|
11
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
|
+
var logActionRequired = require('../utilities/logActionRequired.js');
|
|
12
12
|
var useLayout = require('../common/hooks/useLayout/useLayout.js');
|
|
13
13
|
var position = require('../common/propsValues/position.js');
|
|
14
14
|
var typography = require('../common/propsValues/typography.js');
|
package/build/drawer/Drawer.mjs
CHANGED
|
@@ -5,8 +5,8 @@ import Dimmer from '../dimmer/Dimmer.mjs';
|
|
|
5
5
|
import { OverlayIdContext } from '../provider/overlay/OverlayIdProvider.mjs';
|
|
6
6
|
import SlidingPanel from '../slidingPanel/SlidingPanel.mjs';
|
|
7
7
|
import Title from '../title/Title.mjs';
|
|
8
|
-
import { logActionRequiredIf } from '../utilities/logActionRequired.mjs';
|
|
9
8
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
9
|
+
import { logActionRequiredIf } from '../utilities/logActionRequired.mjs';
|
|
10
10
|
import { useLayout } from '../common/hooks/useLayout/useLayout.mjs';
|
|
11
11
|
import { Position } from '../common/propsValues/position.mjs';
|
|
12
12
|
import { Typography } from '../common/propsValues/typography.mjs';
|
package/build/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var Button = require('./button/Button.js');
|
|
|
15
15
|
var Carousel = require('./carousel/Carousel.js');
|
|
16
16
|
var Card = require('./card/Card.js');
|
|
17
17
|
var Checkbox = require('./checkbox/Checkbox.js');
|
|
18
|
+
var CheckboxButton = require('./checkboxButton/CheckboxButton.js');
|
|
18
19
|
var CheckboxOption = require('./checkboxOption/CheckboxOption.js');
|
|
19
20
|
var Chevron = require('./chevron/Chevron.js');
|
|
20
21
|
var Chips = require('./chips/Chips.js');
|
|
@@ -99,7 +100,6 @@ var useScreenSize = require('./common/hooks/useScreenSize.js');
|
|
|
99
100
|
var useSnackbar = require('./snackbar/useSnackbar.js');
|
|
100
101
|
var index$1 = require('./i18n/index.js');
|
|
101
102
|
var withId = require('./withId/withId.js');
|
|
102
|
-
var CheckboxButton = require('./checkboxButton/CheckboxButton.js');
|
|
103
103
|
var ResponsivePanel = require('./common/responsivePanel/ResponsivePanel.js');
|
|
104
104
|
var useDirection = require('./common/hooks/useDirection/useDirection.js');
|
|
105
105
|
var useLayout = require('./common/hooks/useLayout/useLayout.js');
|
|
@@ -148,6 +148,7 @@ exports.Button = Button;
|
|
|
148
148
|
exports.Carousel = Carousel;
|
|
149
149
|
exports.Card = Card;
|
|
150
150
|
exports.Checkbox = Checkbox;
|
|
151
|
+
exports.CheckboxButton = CheckboxButton;
|
|
151
152
|
exports.CheckboxOption = CheckboxOption;
|
|
152
153
|
exports.Chevron = Chevron;
|
|
153
154
|
exports.Chips = Chips;
|
|
@@ -254,7 +255,6 @@ exports.useScreenSize = useScreenSize.useScreenSize;
|
|
|
254
255
|
exports.useSnackbar = useSnackbar;
|
|
255
256
|
exports.translations = index$1;
|
|
256
257
|
exports.withId = withId;
|
|
257
|
-
exports.CheckboxButton = CheckboxButton;
|
|
258
258
|
exports.ResponsivePanel = ResponsivePanel;
|
|
259
259
|
exports.useDirection = useDirection.useDirection;
|
|
260
260
|
exports.useLayout = useLayout.useLayout;
|
package/build/index.mjs
CHANGED
|
@@ -13,6 +13,7 @@ export { default as Button } from './button/Button.mjs';
|
|
|
13
13
|
export { default as Carousel } from './carousel/Carousel.mjs';
|
|
14
14
|
export { default as Card } from './card/Card.mjs';
|
|
15
15
|
export { default as Checkbox } from './checkbox/Checkbox.mjs';
|
|
16
|
+
export { default as CheckboxButton } from './checkboxButton/CheckboxButton.mjs';
|
|
16
17
|
export { default as CheckboxOption } from './checkboxOption/CheckboxOption.mjs';
|
|
17
18
|
export { default as Chevron } from './chevron/Chevron.mjs';
|
|
18
19
|
export { default as Chips } from './chips/Chips.mjs';
|
|
@@ -97,7 +98,6 @@ export { useScreenSize } from './common/hooks/useScreenSize.mjs';
|
|
|
97
98
|
export { default as useSnackbar } from './snackbar/useSnackbar.mjs';
|
|
98
99
|
export { default as translations } from './i18n/index.mjs';
|
|
99
100
|
export { default as withId } from './withId/withId.mjs';
|
|
100
|
-
export { default as CheckboxButton } from './checkboxButton/CheckboxButton.mjs';
|
|
101
101
|
export { default as ResponsivePanel } from './common/responsivePanel/ResponsivePanel.mjs';
|
|
102
102
|
export { useDirection } from './common/hooks/useDirection/useDirection.mjs';
|
|
103
103
|
export { useLayout } from './common/hooks/useLayout/useLayout.mjs';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var commonmark = require('commonmark');
|
|
4
|
-
var logActionRequired = require('../utilities/logActionRequired.js');
|
|
5
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
5
|
var markdownNodeType = require('../common/propsValues/markdownNodeType.js');
|
|
6
|
+
var logActionRequired = require('../utilities/logActionRequired.js');
|
|
7
7
|
|
|
8
8
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import commonmark from 'commonmark';
|
|
2
|
-
import { logActionRequired } from '../utilities/logActionRequired.mjs';
|
|
3
2
|
import { jsx } from 'react/jsx-runtime';
|
|
4
3
|
import { MarkdownNodeType } from '../common/propsValues/markdownNodeType.mjs';
|
|
4
|
+
import { logActionRequired } from '../utilities/logActionRequired.mjs';
|
|
5
5
|
|
|
6
6
|
const reader = new commonmark.Parser();
|
|
7
7
|
const writer = new commonmark.HtmlRenderer({
|
package/build/popover/Popover.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
var clsx = require('clsx');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var Title = require('../title/Title.js');
|
|
6
|
-
var logActionRequired = require('../utilities/logActionRequired.js');
|
|
7
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var logActionRequired = require('../utilities/logActionRequired.js');
|
|
8
8
|
var ResponsivePanel = require('../common/responsivePanel/ResponsivePanel.js');
|
|
9
9
|
var typography = require('../common/propsValues/typography.js');
|
|
10
10
|
var position = require('../common/propsValues/position.js');
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import { useEffect, useRef, useState, isValidElement, cloneElement } from 'react';
|
|
3
3
|
import Title from '../title/Title.mjs';
|
|
4
|
-
import { logActionRequired } from '../utilities/logActionRequired.mjs';
|
|
5
4
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
import { logActionRequired } from '../utilities/logActionRequired.mjs';
|
|
6
6
|
import ResponsivePanel from '../common/responsivePanel/ResponsivePanel.mjs';
|
|
7
7
|
import { Typography } from '../common/propsValues/typography.mjs';
|
|
8
8
|
import { Position } from '../common/propsValues/position.mjs';
|
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
function supportsTouchEvents() {
|
|
4
4
|
const onTouchStartIsDefined = typeof window !== 'undefined' && window.ontouchstart !== undefined;
|
|
5
5
|
const maxTouchPointsIsDefined = typeof navigator !== 'undefined' && navigator.maxTouchPoints;
|
|
6
|
-
|
|
7
|
-
return !!(onTouchStartIsDefined || maxTouchPointsIsDefined || documentTouchIsDefined);
|
|
6
|
+
return !!(onTouchStartIsDefined || maxTouchPointsIsDefined);
|
|
8
7
|
}
|
|
9
8
|
function userAgentSuggestsTouchDevice() {
|
|
10
9
|
const sampleTouchDevices = ['android', 'iemobile', 'iphone', 'ipad', 'ipod', 'blackberry', 'bada'];
|
|
11
10
|
const matchString = sampleTouchDevices.map(device => `(${device})`).join('|');
|
|
12
11
|
const regex = new RegExp(matchString, 'gi');
|
|
13
|
-
return typeof navigator !== 'undefined' && !!navigator.userAgent
|
|
12
|
+
return typeof navigator !== 'undefined' && !!regex.test(navigator.userAgent);
|
|
14
13
|
}
|
|
15
14
|
// Important: this is not fool-proof! It gives false positives and negatives, and will be outdated.
|
|
16
15
|
// Only use this for small vanity changes where it still works either way.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceDetection.js","sources":["../../src/stepper/deviceDetection.
|
|
1
|
+
{"version":3,"file":"deviceDetection.js","sources":["../../src/stepper/deviceDetection.ts"],"sourcesContent":["function supportsTouchEvents() {\n const onTouchStartIsDefined = typeof window !== 'undefined' && window.ontouchstart !== undefined;\n const maxTouchPointsIsDefined = typeof navigator !== 'undefined' && navigator.maxTouchPoints;\n\n return !!(onTouchStartIsDefined || maxTouchPointsIsDefined);\n}\n\nfunction userAgentSuggestsTouchDevice() {\n const sampleTouchDevices = [\n 'android',\n 'iemobile',\n 'iphone',\n 'ipad',\n 'ipod',\n 'blackberry',\n 'bada',\n ];\n const matchString = sampleTouchDevices.map((device) => `(${device})`).join('|');\n const regex = new RegExp(matchString, 'gi');\n return typeof navigator !== 'undefined' && !!regex.test(navigator.userAgent);\n}\n// Important: this is not fool-proof! It gives false positives and negatives, and will be outdated.\n// Only use this for small vanity changes where it still works either way.\nexport function isTouchDevice() {\n return supportsTouchEvents() || userAgentSuggestsTouchDevice();\n}\n"],"names":["supportsTouchEvents","onTouchStartIsDefined","window","ontouchstart","undefined","maxTouchPointsIsDefined","navigator","maxTouchPoints","userAgentSuggestsTouchDevice","sampleTouchDevices","matchString","map","device","join","regex","RegExp","test","userAgent","isTouchDevice"],"mappings":";;AAAA,SAASA,mBAAmBA,GAAA;EAC1B,MAAMC,qBAAqB,GAAG,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,YAAY,KAAKC,SAAS,CAAA;EAChG,MAAMC,uBAAuB,GAAG,OAAOC,SAAS,KAAK,WAAW,IAAIA,SAAS,CAACC,cAAc,CAAA;AAE5F,EAAA,OAAO,CAAC,EAAEN,qBAAqB,IAAII,uBAAuB,CAAC,CAAA;AAC7D,CAAA;AAEA,SAASG,4BAA4BA,GAAA;AACnC,EAAA,MAAMC,kBAAkB,GAAG,CACzB,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,MAAM,EACN,YAAY,EACZ,MAAM,CACP,CAAA;AACD,EAAA,MAAMC,WAAW,GAAGD,kBAAkB,CAACE,GAAG,CAAEC,MAAM,IAAK,CAAIA,CAAAA,EAAAA,MAAM,GAAG,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAAA;EAC/E,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,WAAW,EAAE,IAAI,CAAC,CAAA;AAC3C,EAAA,OAAO,OAAOJ,SAAS,KAAK,WAAW,IAAI,CAAC,CAACQ,KAAK,CAACE,IAAI,CAACV,SAAS,CAACW,SAAS,CAAC,CAAA;AAC9E,CAAA;AACA;AACA;SACgBC,aAAaA,GAAA;AAC3B,EAAA,OAAOlB,mBAAmB,EAAE,IAAIQ,4BAA4B,EAAE,CAAA;AAChE;;;;"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
function supportsTouchEvents() {
|
|
2
2
|
const onTouchStartIsDefined = typeof window !== 'undefined' && window.ontouchstart !== undefined;
|
|
3
3
|
const maxTouchPointsIsDefined = typeof navigator !== 'undefined' && navigator.maxTouchPoints;
|
|
4
|
-
|
|
5
|
-
return !!(onTouchStartIsDefined || maxTouchPointsIsDefined || documentTouchIsDefined);
|
|
4
|
+
return !!(onTouchStartIsDefined || maxTouchPointsIsDefined);
|
|
6
5
|
}
|
|
7
6
|
function userAgentSuggestsTouchDevice() {
|
|
8
7
|
const sampleTouchDevices = ['android', 'iemobile', 'iphone', 'ipad', 'ipod', 'blackberry', 'bada'];
|
|
9
8
|
const matchString = sampleTouchDevices.map(device => `(${device})`).join('|');
|
|
10
9
|
const regex = new RegExp(matchString, 'gi');
|
|
11
|
-
return typeof navigator !== 'undefined' && !!navigator.userAgent
|
|
10
|
+
return typeof navigator !== 'undefined' && !!regex.test(navigator.userAgent);
|
|
12
11
|
}
|
|
13
12
|
// Important: this is not fool-proof! It gives false positives and negatives, and will be outdated.
|
|
14
13
|
// Only use this for small vanity changes where it still works either way.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceDetection.mjs","sources":["../../src/stepper/deviceDetection.
|
|
1
|
+
{"version":3,"file":"deviceDetection.mjs","sources":["../../src/stepper/deviceDetection.ts"],"sourcesContent":["function supportsTouchEvents() {\n const onTouchStartIsDefined = typeof window !== 'undefined' && window.ontouchstart !== undefined;\n const maxTouchPointsIsDefined = typeof navigator !== 'undefined' && navigator.maxTouchPoints;\n\n return !!(onTouchStartIsDefined || maxTouchPointsIsDefined);\n}\n\nfunction userAgentSuggestsTouchDevice() {\n const sampleTouchDevices = [\n 'android',\n 'iemobile',\n 'iphone',\n 'ipad',\n 'ipod',\n 'blackberry',\n 'bada',\n ];\n const matchString = sampleTouchDevices.map((device) => `(${device})`).join('|');\n const regex = new RegExp(matchString, 'gi');\n return typeof navigator !== 'undefined' && !!regex.test(navigator.userAgent);\n}\n// Important: this is not fool-proof! It gives false positives and negatives, and will be outdated.\n// Only use this for small vanity changes where it still works either way.\nexport function isTouchDevice() {\n return supportsTouchEvents() || userAgentSuggestsTouchDevice();\n}\n"],"names":["supportsTouchEvents","onTouchStartIsDefined","window","ontouchstart","undefined","maxTouchPointsIsDefined","navigator","maxTouchPoints","userAgentSuggestsTouchDevice","sampleTouchDevices","matchString","map","device","join","regex","RegExp","test","userAgent","isTouchDevice"],"mappings":"AAAA,SAASA,mBAAmBA,GAAA;EAC1B,MAAMC,qBAAqB,GAAG,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,YAAY,KAAKC,SAAS,CAAA;EAChG,MAAMC,uBAAuB,GAAG,OAAOC,SAAS,KAAK,WAAW,IAAIA,SAAS,CAACC,cAAc,CAAA;AAE5F,EAAA,OAAO,CAAC,EAAEN,qBAAqB,IAAII,uBAAuB,CAAC,CAAA;AAC7D,CAAA;AAEA,SAASG,4BAA4BA,GAAA;AACnC,EAAA,MAAMC,kBAAkB,GAAG,CACzB,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,MAAM,EACN,YAAY,EACZ,MAAM,CACP,CAAA;AACD,EAAA,MAAMC,WAAW,GAAGD,kBAAkB,CAACE,GAAG,CAAEC,MAAM,IAAK,CAAIA,CAAAA,EAAAA,MAAM,GAAG,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAAA;EAC/E,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,WAAW,EAAE,IAAI,CAAC,CAAA;AAC3C,EAAA,OAAO,OAAOJ,SAAS,KAAK,WAAW,IAAI,CAAC,CAACQ,KAAK,CAACE,IAAI,CAACV,SAAS,CAACW,SAAS,CAAC,CAAA;AAC9E,CAAA;AACA;AACA;SACgBC,aAAaA,GAAA;AAC3B,EAAA,OAAOlB,mBAAmB,EAAE,IAAIQ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,CAAC,EAAE,MAAM,CAAC,GAAG;IAC/C,EAAE,CAAC,EAAE,GAAG,CAAC;CACV,CAAC;AAEJ,MAAM,MAAM,KAAK,GAAG,WAAW,GAAG,WAAW,CAAC;AAE9C,KAAK,mBAAmB,GAAG,iBAAiB,GAAG,iBAAiB,CAAC;AAEjE,QAAA,MAAM,MAAM,uJAkGX,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
}
|
|
1
|
+
declare const _default: {
|
|
2
|
+
loadingAriaLabel: {
|
|
3
|
+
id: string;
|
|
4
|
+
defaultMessage: string;
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
8
|
export default _default;
|
|
9
9
|
//# sourceMappingURL=Button.messages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.messages.d.ts","sourceRoot":"","sources":["../../../src/button/Button.messages.
|
|
1
|
+
{"version":3,"file":"Button.messages.d.ts","sourceRoot":"","sources":["../../../src/button/Button.messages.ts"],"names":[],"mappings":";;;;;;;AAEA,wBAMG"}
|