@transferwise/components 46.132.1 → 46.133.1
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/chips/Chips.js.map +1 -1
- package/build/chips/Chips.mjs.map +1 -1
- package/build/inputs/InputGroup.js +10 -1
- package/build/inputs/InputGroup.js.map +1 -1
- package/build/inputs/InputGroup.mjs +10 -1
- package/build/inputs/InputGroup.mjs.map +1 -1
- package/build/label/Label.js +1 -1
- package/build/label/Label.js.map +1 -1
- package/build/label/Label.mjs +1 -1
- package/build/label/Label.mjs.map +1 -1
- package/build/logo/Logo.js +6 -0
- package/build/logo/Logo.js.map +1 -1
- package/build/logo/Logo.mjs +6 -0
- package/build/logo/Logo.mjs.map +1 -1
- package/build/main.css +22 -6
- package/build/phoneNumberInput/PhoneNumberInput.js +6 -1
- package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.mjs +6 -1
- package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
- package/build/styles/inputs/InputGroup.css +10 -2
- package/build/styles/listItem/ListItem.css +4 -4
- package/build/styles/listItem/ListItem.grid.css +3 -3
- package/build/styles/main.css +22 -6
- package/build/styles/phoneNumberInput/PhoneNumberInput.css +5 -0
- package/build/types/chips/Chips.d.ts +1 -1
- package/build/types/chips/Chips.d.ts.map +1 -1
- package/build/types/common/commonProps.d.ts +0 -6
- package/build/types/common/commonProps.d.ts.map +1 -1
- package/build/types/label/Label.d.ts.map +1 -1
- package/build/types/logo/Logo.d.ts +10 -1
- package/build/types/logo/Logo.d.ts.map +1 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/button/_stories/Button.accessibility.docs.mdx +10 -6
- package/src/button/_stories/Button.story.tsx +15 -7
- package/src/checkboxButton/CheckboxButton.story.tsx +125 -44
- package/src/checkboxButton/CheckboxButton.test.story.tsx +236 -0
- package/src/chips/Chips.story.tsx +141 -102
- package/src/chips/Chips.test.story.tsx +177 -0
- package/src/chips/Chips.tsx +1 -1
- package/src/circularButton/CircularButton.story.tsx +261 -49
- package/src/circularButton/CircularButton.test.story.tsx +192 -2
- package/src/common/bottomSheet/BottomSheet.story.tsx +11 -9
- package/src/common/bottomSheet/BottomSheet.test.story.tsx +28 -15
- package/src/common/commonProps.ts +0 -6
- package/src/divider/Divider.accessibility.docs.mdx +1 -10
- package/src/divider/Divider.story.tsx +0 -1
- package/src/expressiveMoneyInput/ExpressiveMoneyInput.story.tsx +1 -2
- package/src/header/Header.accessibility.docs.mdx +9 -5
- package/src/iconButton/IconButton.story.tsx +315 -110
- package/src/iconButton/IconButton.test.story.tsx +217 -44
- package/src/inputs/InputGroup.css +10 -2
- package/src/inputs/InputGroup.less +12 -2
- package/src/inputs/InputGroup.story.tsx +27 -0
- package/src/inputs/InputGroup.tsx +10 -0
- package/src/inputs/SelectInput/_stories/SelectInput.story.tsx +0 -1
- package/src/label/Label.tsx +1 -2
- package/src/legacylistItem/LegacyListItem.test.story.tsx +1 -1
- package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.story.tsx +0 -1
- package/src/listItem/AvatarLayout/ListItemAvatarLayout.story.tsx +0 -1
- package/src/listItem/AvatarView/ListItemAvatarView.story.tsx +0 -1
- package/src/listItem/Button/ListItemButton.story.tsx +0 -1
- package/src/listItem/Checkbox/ListItemCheckbox.story.tsx +0 -1
- package/src/listItem/IconButton/ListItemIconButton.story.tsx +0 -1
- package/src/listItem/ListItem.css +4 -4
- package/src/listItem/ListItem.grid.css +3 -3
- package/src/listItem/ListItem.grid.less +5 -3
- package/src/listItem/ListItem.less +1 -1
- package/src/listItem/ListItem.vars.less +2 -2
- package/src/listItem/Navigation/ListItemNavigation.story.tsx +0 -1
- package/src/listItem/Prompt/ListItemPrompt.story.tsx +0 -1
- package/src/listItem/Radio/ListItemRadio.story.tsx +0 -1
- package/src/listItem/Switch/ListItemSwitch.story.tsx +0 -1
- package/src/listItem/_stories/ListItem.layout.test.story.tsx +55 -0
- package/src/listItem/_stories/ListItem.story.tsx +1 -0
- package/src/logo/Logo.story.tsx +181 -21
- package/src/logo/Logo.test.story.tsx +40 -7
- package/src/logo/Logo.tsx +10 -1
- package/src/main.css +22 -6
- package/src/phoneNumberInput/PhoneNumberInput.css +5 -0
- package/src/phoneNumberInput/PhoneNumberInput.less +7 -0
- package/src/phoneNumberInput/PhoneNumberInput.tsx +10 -1
- package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +0 -1
- package/src/section/Section.story.tsx +12 -7
- package/src/sentimentSurface/SentimentSurface.story.tsx +1 -1
- package/src/snackbar/Snackbar.test.story.tsx +16 -104
- package/src/summary/Summary.test.story.tsx +1 -1
- package/src/switch/Switch.story.tsx +64 -42
- package/src/switch/Switch.test.story.tsx +123 -0
- package/src/switchOption/SwitchOption.story.tsx +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneNumberInput.mjs","sources":["../../src/phoneNumberInput/PhoneNumberInput.tsx"],"sourcesContent":["import { useState, useEffect, useMemo, useRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { Size, SizeLarge, SizeMedium, SizeSmall } from '../common';\nimport { useFieldLabelRef, useInputAttributes } from '../inputs/contexts';\nimport { SelectInput, SelectInputOptionContent, SelectInputProps } from '../inputs/SelectInput';\nimport messages from './PhoneNumberInput.messages';\nimport countries from './data/countries';\nimport {\n explodeNumberModel,\n isValidPhoneNumber,\n cleanNumber,\n setDefaultPrefix,\n sortArrayByProperty,\n groupCountriesByPrefix,\n excludeCountries,\n findCountryByPrefix,\n} from './utils';\nimport { PhoneNumber } from './utils/explodeNumberModel';\nimport { Input } from '../inputs/Input';\n\nconst ALLOWED_PHONE_CHARS = /^$|^[\\d-\\s]+$/;\n\nexport interface PhoneNumberInputProps {\n id?: string;\n 'aria-labelledby'?: string;\n required?: boolean;\n disabled?: boolean;\n initialValue?: string;\n onChange: (value: string | null, prefix: string) => void;\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n onBlur?: () => void;\n countryCode?: string;\n /** @default 'Prefix' */\n searchPlaceholder?: string;\n /** @default 'md' */\n size?: SizeSmall | SizeMedium | SizeLarge;\n placeholder?: string;\n /** @default {} */\n selectProps?: Partial<SelectInputProps<string | null>>;\n /**\n * List of iso3 codes of countries to remove from the list\n * @default []\n */\n disabledCountries?: readonly string[];\n}\n\nconst defaultSelectProps = {} satisfies PhoneNumberInputProps['selectProps'];\nconst defaultDisabledCountries = [] satisfies PhoneNumberInputProps['disabledCountries'];\n\nconst PhoneNumberInput = ({\n id,\n 'aria-labelledby': ariaLabelledByProp,\n required,\n disabled,\n initialValue,\n onChange,\n onFocus,\n onBlur,\n countryCode,\n searchPlaceholder = 'Prefix',\n size = Size.MEDIUM,\n placeholder,\n selectProps = defaultSelectProps,\n disabledCountries = defaultDisabledCountries,\n}: PhoneNumberInputProps) => {\n const countryCodeSelectRef = useRef<HTMLButtonElement>(null);\n const phoneNumberInputRef = useRef<HTMLInputElement>(null);\n const inputAttributes = useInputAttributes({ nonLabelable: true });\n const fieldLabelRef = useFieldLabelRef();\n const ariaLabelledBy = ariaLabelledByProp ?? inputAttributes['aria-labelledby'];\n\n const { locale, formatMessage } = useIntl();\n\n const createId = (customID: string | undefined, backup: string): string => {\n if (customID) {\n return customID + (backup ? `-${backup}` : '');\n }\n const random = Math.random().toString(36).slice(2, 8);\n return `${backup}-${random}`;\n };\n\n // Link the first non-disabled input to the the Field label, if present\n const ids = {\n countryCode: {\n label: createId(id, 'country-code-label'),\n select: createId(id, 'country-code-select'),\n },\n phoneNumber: {\n label: createId(id, 'phone-number-label'),\n input: createId(id, id ? '' : 'phone-number-input'),\n },\n };\n\n const [internalValue, setInternalValue] = useState<PhoneNumber>(() => {\n const cleanValue = initialValue ? cleanNumber(initialValue) : null;\n\n if (!cleanValue || !isValidPhoneNumber(cleanValue, 1)) {\n return {\n prefix: setDefaultPrefix(locale, countryCode),\n suffix: '',\n };\n }\n\n return explodeNumberModel(cleanValue);\n });\n const [broadcastedValue, setBroadcastedValue] = useState<PhoneNumber | null>(null);\n\n const [suffixDirty, setSuffixDirty] = useState(false);\n useEffect(() => {\n if (internalValue.suffix) {\n setSuffixDirty(true);\n }\n }, [internalValue.suffix]);\n\n const countriesByPrefix = useMemo(\n () =>\n groupCountriesByPrefix(\n sortArrayByProperty(excludeCountries(countries, disabledCountries), 'iso3'),\n ),\n [disabledCountries],\n );\n\n const onSuffixChange: React.ChangeEventHandler<HTMLInputElement> = (event) => {\n const suffix = event.target.value;\n if (ALLOWED_PHONE_CHARS.test(suffix)) {\n setInternalValue((prev) => ({ ...prev, suffix }));\n }\n };\n\n const onPaste: React.ClipboardEventHandler<HTMLInputElement> = (event) => {\n if (!event.nativeEvent.clipboardData) {\n return;\n }\n\n const pastedValue = (event.nativeEvent.clipboardData.getData('text/plain') || '').replace(\n /(\\s|-)+/g,\n '',\n );\n const pastedNumber = explodeNumberModel(pastedValue);\n\n if (\n pastedNumber.prefix != null &&\n countriesByPrefix.has(pastedNumber.prefix) &&\n ALLOWED_PHONE_CHARS.test(pastedNumber.suffix)\n ) {\n setInternalValue(pastedNumber);\n }\n };\n\n useEffect(() => {\n if (broadcastedValue === null) {\n setBroadcastedValue(internalValue);\n return;\n }\n\n const internalPhoneNumber = `${internalValue.prefix ?? ''}${internalValue.suffix}`;\n const broadcastedPhoneNumber = `${broadcastedValue.prefix ?? ''}${broadcastedValue.suffix}`;\n\n if (internalPhoneNumber === broadcastedPhoneNumber) {\n return;\n }\n\n const newValue = isValidPhoneNumber(internalPhoneNumber)\n ? cleanNumber(internalPhoneNumber)\n : null;\n\n onChange(\n newValue,\n internalValue.prefix ?? '', // TODO: Allow `null` in public API\n );\n setBroadcastedValue(internalValue);\n }, [onChange, broadcastedValue, internalValue]);\n\n useEffect(() => {\n const labelRef = fieldLabelRef?.current;\n\n if (labelRef) {\n const handleLabelClick = () => {\n if (!selectProps.disabled) {\n countryCodeSelectRef.current?.click();\n } else {\n phoneNumberInputRef.current?.focus();\n }\n };\n\n labelRef.addEventListener('click', handleLabelClick);\n\n return () => {\n labelRef?.removeEventListener('click', handleLabelClick);\n };\n }\n }, [fieldLabelRef, selectProps.disabled]);\n\n return (\n <fieldset {...inputAttributes} aria-labelledby={ariaLabelledBy} className=\"tw-telephone\">\n <label className=\"sr-only\" id={ids.countryCode.label} htmlFor={ids.countryCode.select}>\n {formatMessage(messages.countryCodeLabel)}\n </label>\n <div className=\"tw-telephone__country-select\">\n <SelectInput\n triggerRef={countryCodeSelectRef}\n placeholder={formatMessage(messages.selectInputPlaceholder)}\n items={[...countriesByPrefix].map(([prefix, countries]) => ({\n type: 'option',\n value: prefix,\n filterMatchers: [\n prefix,\n ...countries.map((country) => country.name),\n ...countries.map((country) => country.iso3),\n ],\n }))}\n value={internalValue.prefix}\n renderValue={(prefix, withinTrigger) => (\n <SelectInputOptionContent\n title={prefix}\n note={\n withinTrigger\n ? undefined\n : countriesByPrefix\n .get(prefix)\n ?.map((country) => country.iso3)\n .join(', ')\n }\n />\n )}\n filterable\n filterPlaceholder={searchPlaceholder}\n disabled={disabled}\n size={size}\n id={ids.countryCode.select}\n UNSAFE_triggerButtonProps={{\n id: ids.countryCode.select,\n 'aria-labelledby': ids.countryCode.label,\n 'aria-describedby': undefined,\n 'aria-invalid': undefined,\n }}\n onChange={(prefix) => {\n const country = prefix != null ? findCountryByPrefix(prefix) : null;\n setInternalValue((prev) => ({ ...prev, prefix, format: country?.phoneFormat }));\n }}\n onClose={() => {\n if (suffixDirty) {\n onBlur?.();\n }\n }}\n {...selectProps}\n />\n </div>\n <label className=\"sr-only\" id={ids.phoneNumber.label} htmlFor={ids.phoneNumber.input}>\n {formatMessage(messages.phoneNumberLabel)}\n </label>\n <div className=\"tw-telephone__number-input\">\n <div className={`input-group input-group-${size} ${disabled ? 'disabled' : ''}`}>\n <Input\n ref={phoneNumberInputRef}\n id={ids.phoneNumber.input}\n autoComplete=\"tel-national\"\n name=\"phoneNumber\"\n inputMode=\"numeric\"\n value={internalValue.suffix}\n disabled={disabled}\n required={required}\n placeholder={placeholder}\n aria-labelledby={ids.phoneNumber.label}\n onChange={onSuffixChange}\n onPaste={onPaste}\n onFocus={onFocus}\n onBlur={() => onBlur?.()}\n />\n </div>\n </div>\n </fieldset>\n );\n};\n\nexport default PhoneNumberInput;\n"],"names":["ALLOWED_PHONE_CHARS","defaultSelectProps","defaultDisabledCountries","PhoneNumberInput","id","ariaLabelledByProp","required","disabled","initialValue","onChange","onFocus","onBlur","countryCode","searchPlaceholder","size","Size","MEDIUM","placeholder","selectProps","disabledCountries","countryCodeSelectRef","useRef","phoneNumberInputRef","inputAttributes","useInputAttributes","nonLabelable","fieldLabelRef","useFieldLabelRef","ariaLabelledBy","locale","formatMessage","useIntl","createId","customID","backup","random","Math","toString","slice","ids","label","select","phoneNumber","input","internalValue","setInternalValue","useState","cleanValue","cleanNumber","isValidPhoneNumber","prefix","setDefaultPrefix","suffix","explodeNumberModel","broadcastedValue","setBroadcastedValue","suffixDirty","setSuffixDirty","useEffect","countriesByPrefix","useMemo","groupCountriesByPrefix","sortArrayByProperty","excludeCountries","countries","onSuffixChange","event","target","value","test","prev","onPaste","nativeEvent","clipboardData","pastedValue","getData","replace","pastedNumber","has","internalPhoneNumber","broadcastedPhoneNumber","newValue","labelRef","current","handleLabelClick","click","focus","addEventListener","removeEventListener","_jsxs","className","children","_jsx","htmlFor","messages","countryCodeLabel","SelectInput","triggerRef","selectInputPlaceholder","items","map","type","filterMatchers","country","name","iso3","renderValue","withinTrigger","SelectInputOptionContent","title","note","undefined","get","join","filterable","filterPlaceholder","UNSAFE_triggerButtonProps","findCountryByPrefix","format","phoneFormat","onClose","phoneNumberLabel","Input","ref","autoComplete","inputMode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAMA,mBAAmB,GAAG,eAAe;AA0B3C,MAAMC,kBAAkB,GAAG,EAAiD;AAC5E,MAAMC,w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AIP,QAAQ,GAAG,UAAU,GAAG,EAAE,CAAA,CAAG;QAAAoF,QAAA,eAC9EC,GAAA,CAAC8B,KAAK,EAAA;AACJC,UAAAA,GAAG,EAAErG,mBAAoB;AACzBlB,UAAAA,EAAE,EAAEmC,GAAG,CAACG,WAAW,CAACC,KAAM;AAC1BiF,UAAAA,YAAY,EAAC,cAAc;AAC3BpB,UAAAA,IAAI,EAAC,aAAa;AAClBqB,UAAAA,SAAS,EAAC,SAAS;UACnBzD,KAAK,EAAExB,aAAa,CAACQ,MAAO;AAC5B7C,UAAAA,QAAQ,EAAEA,QAAS;AACnBD,UAAAA,QAAQ,EAAEA,QAAS;AACnBW,UAAAA,WAAW,EAAEA,WAAY;AACzB,UAAA,iBAAA,EAAiBsB,GAAG,CAACG,WAAW,CAACF,KAAM;AACvC/B,UAAAA,QAAQ,EAAEwD,cAAe;AACzBM,UAAAA,OAAO,EAAEA,OAAQ;AACjB7D,UAAAA,OAAO,EAAEA,OAAQ;AACjBC,UAAAA,MAAM,EAAEA,MAAMA,MAAM;SAAK;OAExB;AACP,KAAK,CACP;AAAA,GAAU,CAAC;AAEf;;;;"}
|
|
1
|
+
{"version":3,"file":"PhoneNumberInput.mjs","sources":["../../src/phoneNumberInput/PhoneNumberInput.tsx"],"sourcesContent":["import { useState, useEffect, useMemo, useRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { Size, SizeLarge, SizeMedium, SizeSmall } from '../common';\nimport { useFieldLabelRef, useInputAttributes } from '../inputs/contexts';\nimport { useInputPaddings } from '../inputs/InputGroup';\nimport { SelectInput, SelectInputOptionContent, SelectInputProps } from '../inputs/SelectInput';\nimport messages from './PhoneNumberInput.messages';\nimport countries from './data/countries';\nimport {\n explodeNumberModel,\n isValidPhoneNumber,\n cleanNumber,\n setDefaultPrefix,\n sortArrayByProperty,\n groupCountriesByPrefix,\n excludeCountries,\n findCountryByPrefix,\n} from './utils';\nimport { PhoneNumber } from './utils/explodeNumberModel';\nimport { Input } from '../inputs/Input';\n\nconst ALLOWED_PHONE_CHARS = /^$|^[\\d-\\s]+$/;\n\nexport interface PhoneNumberInputProps {\n id?: string;\n 'aria-labelledby'?: string;\n required?: boolean;\n disabled?: boolean;\n initialValue?: string;\n onChange: (value: string | null, prefix: string) => void;\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n onBlur?: () => void;\n countryCode?: string;\n /** @default 'Prefix' */\n searchPlaceholder?: string;\n /** @default 'md' */\n size?: SizeSmall | SizeMedium | SizeLarge;\n placeholder?: string;\n /** @default {} */\n selectProps?: Partial<SelectInputProps<string | null>>;\n /**\n * List of iso3 codes of countries to remove from the list\n * @default []\n */\n disabledCountries?: readonly string[];\n}\n\nconst defaultSelectProps = {} satisfies PhoneNumberInputProps['selectProps'];\nconst defaultDisabledCountries = [] satisfies PhoneNumberInputProps['disabledCountries'];\n\nconst PhoneNumberInput = ({\n id,\n 'aria-labelledby': ariaLabelledByProp,\n required,\n disabled,\n initialValue,\n onChange,\n onFocus,\n onBlur,\n countryCode,\n searchPlaceholder = 'Prefix',\n size = Size.MEDIUM,\n placeholder,\n selectProps = defaultSelectProps,\n disabledCountries = defaultDisabledCountries,\n}: PhoneNumberInputProps) => {\n const countryCodeSelectRef = useRef<HTMLButtonElement>(null);\n const phoneNumberInputRef = useRef<HTMLInputElement>(null);\n const inputAttributes = useInputAttributes({ nonLabelable: true });\n const { paddingInlineStart } = useInputPaddings();\n const hasInputGroupAddonStart = paddingInlineStart != null;\n const fieldLabelRef = useFieldLabelRef();\n const ariaLabelledBy = ariaLabelledByProp ?? inputAttributes['aria-labelledby'];\n\n const { locale, formatMessage } = useIntl();\n\n const createId = (customID: string | undefined, backup: string): string => {\n if (customID) {\n return customID + (backup ? `-${backup}` : '');\n }\n const random = Math.random().toString(36).slice(2, 8);\n return `${backup}-${random}`;\n };\n\n // Link the first non-disabled input to the the Field label, if present\n const ids = {\n countryCode: {\n label: createId(id, 'country-code-label'),\n select: createId(id, 'country-code-select'),\n },\n phoneNumber: {\n label: createId(id, 'phone-number-label'),\n input: createId(id, id ? '' : 'phone-number-input'),\n },\n };\n\n const [internalValue, setInternalValue] = useState<PhoneNumber>(() => {\n const cleanValue = initialValue ? cleanNumber(initialValue) : null;\n\n if (!cleanValue || !isValidPhoneNumber(cleanValue, 1)) {\n return {\n prefix: setDefaultPrefix(locale, countryCode),\n suffix: '',\n };\n }\n\n return explodeNumberModel(cleanValue);\n });\n const [broadcastedValue, setBroadcastedValue] = useState<PhoneNumber | null>(null);\n\n const [suffixDirty, setSuffixDirty] = useState(false);\n useEffect(() => {\n if (internalValue.suffix) {\n setSuffixDirty(true);\n }\n }, [internalValue.suffix]);\n\n const countriesByPrefix = useMemo(\n () =>\n groupCountriesByPrefix(\n sortArrayByProperty(excludeCountries(countries, disabledCountries), 'iso3'),\n ),\n [disabledCountries],\n );\n\n const onSuffixChange: React.ChangeEventHandler<HTMLInputElement> = (event) => {\n const suffix = event.target.value;\n if (ALLOWED_PHONE_CHARS.test(suffix)) {\n setInternalValue((prev) => ({ ...prev, suffix }));\n }\n };\n\n const onPaste: React.ClipboardEventHandler<HTMLInputElement> = (event) => {\n if (!event.nativeEvent.clipboardData) {\n return;\n }\n\n const pastedValue = (event.nativeEvent.clipboardData.getData('text/plain') || '').replace(\n /(\\s|-)+/g,\n '',\n );\n const pastedNumber = explodeNumberModel(pastedValue);\n\n if (\n pastedNumber.prefix != null &&\n countriesByPrefix.has(pastedNumber.prefix) &&\n ALLOWED_PHONE_CHARS.test(pastedNumber.suffix)\n ) {\n setInternalValue(pastedNumber);\n }\n };\n\n useEffect(() => {\n if (broadcastedValue === null) {\n setBroadcastedValue(internalValue);\n return;\n }\n\n const internalPhoneNumber = `${internalValue.prefix ?? ''}${internalValue.suffix}`;\n const broadcastedPhoneNumber = `${broadcastedValue.prefix ?? ''}${broadcastedValue.suffix}`;\n\n if (internalPhoneNumber === broadcastedPhoneNumber) {\n return;\n }\n\n const newValue = isValidPhoneNumber(internalPhoneNumber)\n ? cleanNumber(internalPhoneNumber)\n : null;\n\n onChange(\n newValue,\n internalValue.prefix ?? '', // TODO: Allow `null` in public API\n );\n setBroadcastedValue(internalValue);\n }, [onChange, broadcastedValue, internalValue]);\n\n useEffect(() => {\n const labelRef = fieldLabelRef?.current;\n\n if (labelRef) {\n const handleLabelClick = () => {\n if (!selectProps.disabled) {\n countryCodeSelectRef.current?.click();\n } else {\n phoneNumberInputRef.current?.focus();\n }\n };\n\n labelRef.addEventListener('click', handleLabelClick);\n\n return () => {\n labelRef?.removeEventListener('click', handleLabelClick);\n };\n }\n }, [fieldLabelRef, selectProps.disabled]);\n\n return (\n <fieldset {...inputAttributes} aria-labelledby={ariaLabelledBy} className=\"tw-telephone\">\n <label className=\"sr-only\" id={ids.countryCode.label} htmlFor={ids.countryCode.select}>\n {formatMessage(messages.countryCodeLabel)}\n </label>\n <div\n className={`tw-telephone__country-select${\n hasInputGroupAddonStart\n ? ' tw-telephone__country-select--with-input-group-addon-start'\n : ''\n }`}\n >\n <SelectInput\n triggerRef={countryCodeSelectRef}\n placeholder={formatMessage(messages.selectInputPlaceholder)}\n items={[...countriesByPrefix].map(([prefix, countries]) => ({\n type: 'option',\n value: prefix,\n filterMatchers: [\n prefix,\n ...countries.map((country) => country.name),\n ...countries.map((country) => country.iso3),\n ],\n }))}\n value={internalValue.prefix}\n renderValue={(prefix, withinTrigger) => (\n <SelectInputOptionContent\n title={prefix}\n note={\n withinTrigger\n ? undefined\n : countriesByPrefix\n .get(prefix)\n ?.map((country) => country.iso3)\n .join(', ')\n }\n />\n )}\n filterable\n filterPlaceholder={searchPlaceholder}\n disabled={disabled}\n size={size}\n id={ids.countryCode.select}\n UNSAFE_triggerButtonProps={{\n id: ids.countryCode.select,\n 'aria-labelledby': ids.countryCode.label,\n 'aria-describedby': undefined,\n 'aria-invalid': undefined,\n }}\n onChange={(prefix) => {\n const country = prefix != null ? findCountryByPrefix(prefix) : null;\n setInternalValue((prev) => ({ ...prev, prefix, format: country?.phoneFormat }));\n }}\n onClose={() => {\n if (suffixDirty) {\n onBlur?.();\n }\n }}\n {...selectProps}\n />\n </div>\n <label className=\"sr-only\" id={ids.phoneNumber.label} htmlFor={ids.phoneNumber.input}>\n {formatMessage(messages.phoneNumberLabel)}\n </label>\n <div className=\"tw-telephone__number-input\">\n <div className={`input-group input-group-${size} ${disabled ? 'disabled' : ''}`}>\n <Input\n ref={phoneNumberInputRef}\n id={ids.phoneNumber.input}\n autoComplete=\"tel-national\"\n name=\"phoneNumber\"\n inputMode=\"numeric\"\n value={internalValue.suffix}\n disabled={disabled}\n required={required}\n placeholder={placeholder}\n aria-labelledby={ids.phoneNumber.label}\n onChange={onSuffixChange}\n onPaste={onPaste}\n onFocus={onFocus}\n onBlur={() => onBlur?.()}\n />\n </div>\n </div>\n </fieldset>\n );\n};\n\nexport default PhoneNumberInput;\n"],"names":["ALLOWED_PHONE_CHARS","defaultSelectProps","defaultDisabledCountries","PhoneNumberInput","id","ariaLabelledByProp","required","disabled","initialValue","onChange","onFocus","onBlur","countryCode","searchPlaceholder","size","Size","MEDIUM","placeholder","selectProps","disabledCountries","countryCodeSelectRef","useRef","phoneNumberInputRef","inputAttributes","useInputAttributes","nonLabelable","paddingInlineStart","useInputPaddings","hasInputGroupAddonStart","fieldLabelRef","useFieldLabelRef","ariaLabelledBy","locale","formatMessage","useIntl","createId","customID","backup","random","Math","toString","slice","ids","label","select","phoneNumber","input","internalValue","setInternalValue","useState","cleanValue","cleanNumber","isValidPhoneNumber","prefix","setDefaultPrefix","suffix","explodeNumberModel","broadcastedValue","setBroadcastedValue","suffixDirty","setSuffixDirty","useEffect","countriesByPrefix","useMemo","groupCountriesByPrefix","sortArrayByProperty","excludeCountries","countries","onSuffixChange","event","target","value","test","prev","onPaste","nativeEvent","clipboardData","pastedValue","getData","replace","pastedNumber","has","internalPhoneNumber","broadcastedPhoneNumber","newValue","labelRef","current","handleLabelClick","click","focus","addEventListener","removeEventListener","_jsxs","className","children","_jsx","htmlFor","messages","countryCodeLabel","SelectInput","triggerRef","selectInputPlaceholder","items","map","type","filterMatchers","country","name","iso3","renderValue","withinTrigger","SelectInputOptionContent","title","note","undefined","get","join","filterable","filterPlaceholder","UNSAFE_triggerButtonProps","findCountryByPrefix","format","phoneFormat","onClose","phoneNumberLabel","Input","ref","autoComplete","inputMode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAMA,mBAAmB,GAAG,eAAe;AA0B3C,MAAMC,kBAAkB,GAAG,EAAiD;AAC5E,MAAMC,wBAAwB,GAAG,EAAuD;AAExF,MAAMC,gBAAgB,GAAGA,CAAC;EACxBC,EAAE;AACF,EAAA,iBAAiB,EAAEC,kBAAkB;EACrCC,QAAQ;EACRC,QAAQ;EACRC,YAAY;EACZC,QAAQ;EACRC,OAAO;EACPC,MAAM;EACNC,WAAW;AACXC,EAAAA,iBAAiB,GAAG,QAAQ;EAC5BC,IAAI,GAAGC,IAAI,CAACC,MAAM;EAClBC,WAAW;AACXC,EAAAA,WAAW,GAAGjB,kBAAkB;AAChCkB,EAAAA,iBAAiB,GAAGjB;AAAwB,CACtB,KAAI;AAC1B,EAAA,MAAMkB,oBAAoB,GAAGC,MAAM,CAAoB,IAAI,CAAC;AAC5D,EAAA,MAAMC,mBAAmB,GAAGD,MAAM,CAAmB,IAAI,CAAC;EAC1D,MAAME,eAAe,GAAGC,kBAAkB,CAAC;AAAEC,IAAAA,YAAY,EAAE;AAAI,GAAE,CAAC;EAClE,MAAM;AAAEC,IAAAA;GAAoB,GAAGC,gBAAgB,EAAE;AACjD,EAAA,MAAMC,uBAAuB,GAAGF,kBAAkB,IAAI,IAAI;AAC1D,EAAA,MAAMG,aAAa,GAAGC,gBAAgB,EAAE;AACxC,EAAA,MAAMC,cAAc,GAAG1B,kBAAkB,IAAIkB,eAAe,CAAC,iBAAiB,CAAC;EAE/E,MAAM;IAAES,MAAM;AAAEC,IAAAA;GAAe,GAAGC,OAAO,EAAE;AAE3C,EAAA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6 +10,10 @@
|
|
|
10
10
|
grid-column-start: 1;
|
|
11
11
|
grid-row-start: 1;
|
|
12
12
|
}
|
|
13
|
+
.np-input-group .np-input-addon--avatar + fieldset .form-control.np-form-control.np-form-control--size-md.np-button-input {
|
|
14
|
+
padding-left: 48px;
|
|
15
|
+
padding-left: var(--size-48);
|
|
16
|
+
}
|
|
13
17
|
.np-input-addon {
|
|
14
18
|
pointer-events: none;
|
|
15
19
|
z-index: 10;
|
|
@@ -21,14 +25,18 @@
|
|
|
21
25
|
transition-timing-function: ease-out;
|
|
22
26
|
transition-duration: 150ms;
|
|
23
27
|
}
|
|
28
|
+
.np-input-addon.np-input-addon--avatar > .np-avatar-view {
|
|
29
|
+
margin-right: 8px;
|
|
30
|
+
margin-right: var(--size-8);
|
|
31
|
+
}
|
|
24
32
|
.np-input-group:disabled .np-input-addon:not(.np-input-addon--interactive) {
|
|
25
33
|
opacity: 0.45;
|
|
26
34
|
mix-blend-mode: luminosity;
|
|
27
35
|
}
|
|
28
|
-
.np-input-group:has( > :is(input,button,select):focus-visible) .np-input-addon {
|
|
36
|
+
.np-input-group:has( > :is(input, button, select):focus-visible) .np-input-addon {
|
|
29
37
|
color: var(--color-interactive-primary);
|
|
30
38
|
}
|
|
31
|
-
.np-input-group:has( > :is(input,button,select):hover) .np-input-addon {
|
|
39
|
+
.np-input-group:has( > :is(input, button, select):hover) .np-input-addon {
|
|
32
40
|
color: #b5b7ba;
|
|
33
41
|
color: var(--color-interactive-secondary-hover);
|
|
34
42
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-noControl.wds-list-item-noInfo-hasPrompt:not(:has(.wds-list-item-subtitle-value, .wds-list-item-subtitle)) .wds-list-item-prompt {
|
|
10
10
|
margin-top: -2px;
|
|
11
11
|
}
|
|
12
|
-
@container (
|
|
12
|
+
@container (width > 308px) {
|
|
13
13
|
.wds-list-item-gridWrapper .wds-list-item-control-wrapper {
|
|
14
14
|
height: var(--wds-list-item-control-wrapper-height);
|
|
15
15
|
align-content: center;
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
grid-template-areas: "body";
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
@container (
|
|
108
|
+
@container (240px < width <= 308px) {
|
|
109
109
|
.wds-list-item-gridWrapper .wds-list-item-media-image {
|
|
110
110
|
-o-object-position: bottom left;
|
|
111
111
|
object-position: bottom left;
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
margin-top: var(--size-4);
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
@container (
|
|
239
|
+
@container (width <= 240px) {
|
|
240
240
|
.wds-list-item-gridWrapper .wds-list-item-control-wrapper {
|
|
241
241
|
align-content: start;
|
|
242
242
|
}
|
|
@@ -531,7 +531,7 @@
|
|
|
531
531
|
flex-direction: column;
|
|
532
532
|
justify-content: center;
|
|
533
533
|
}
|
|
534
|
-
@container (
|
|
534
|
+
@container (width > 308px) {
|
|
535
535
|
.wds-list-item-titles,
|
|
536
536
|
.wds-list-item-value {
|
|
537
537
|
min-height: 100%;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-noControl.wds-list-item-noInfo-hasPrompt:not(:has(.wds-list-item-subtitle-value, .wds-list-item-subtitle)) .wds-list-item-prompt {
|
|
10
10
|
margin-top: -2px;
|
|
11
11
|
}
|
|
12
|
-
@container (
|
|
12
|
+
@container (width > 308px) {
|
|
13
13
|
.wds-list-item-gridWrapper .wds-list-item-control-wrapper {
|
|
14
14
|
height: var(--wds-list-item-control-wrapper-height);
|
|
15
15
|
align-content: center;
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
grid-template-areas: "body";
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
@container (
|
|
108
|
+
@container (240px < width <= 308px) {
|
|
109
109
|
.wds-list-item-gridWrapper .wds-list-item-media-image {
|
|
110
110
|
-o-object-position: bottom left;
|
|
111
111
|
object-position: bottom left;
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
margin-top: var(--size-4);
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
@container (
|
|
239
|
+
@container (width <= 240px) {
|
|
240
240
|
.wds-list-item-gridWrapper .wds-list-item-control-wrapper {
|
|
241
241
|
align-content: start;
|
|
242
242
|
}
|
package/build/styles/main.css
CHANGED
|
@@ -29430,7 +29430,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
29430
29430
|
margin-top: -2px;
|
|
29431
29431
|
}
|
|
29432
29432
|
|
|
29433
|
-
@container (
|
|
29433
|
+
@container (width > 308px) {
|
|
29434
29434
|
.wds-list-item-gridWrapper .wds-list-item-control-wrapper {
|
|
29435
29435
|
height: var(--wds-list-item-control-wrapper-height);
|
|
29436
29436
|
align-content: center;
|
|
@@ -29527,7 +29527,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
29527
29527
|
}
|
|
29528
29528
|
}
|
|
29529
29529
|
|
|
29530
|
-
@container (
|
|
29530
|
+
@container (240px < width <= 308px) {
|
|
29531
29531
|
.wds-list-item-gridWrapper .wds-list-item-media-image {
|
|
29532
29532
|
-o-object-position: bottom left;
|
|
29533
29533
|
object-position: bottom left;
|
|
@@ -29659,7 +29659,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
29659
29659
|
}
|
|
29660
29660
|
}
|
|
29661
29661
|
|
|
29662
|
-
@container (
|
|
29662
|
+
@container (width <= 240px) {
|
|
29663
29663
|
.wds-list-item-gridWrapper .wds-list-item-control-wrapper {
|
|
29664
29664
|
align-content: start;
|
|
29665
29665
|
}
|
|
@@ -29987,7 +29987,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
29987
29987
|
justify-content: center;
|
|
29988
29988
|
}
|
|
29989
29989
|
|
|
29990
|
-
@container (
|
|
29990
|
+
@container (width > 308px) {
|
|
29991
29991
|
.wds-list-item-titles,
|
|
29992
29992
|
.wds-list-item-value {
|
|
29993
29993
|
min-height: 100%;
|
|
@@ -30167,6 +30167,11 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
30167
30167
|
grid-row-start: 1;
|
|
30168
30168
|
}
|
|
30169
30169
|
|
|
30170
|
+
.np-input-group .np-input-addon--avatar + fieldset .form-control.np-form-control.np-form-control--size-md.np-button-input {
|
|
30171
|
+
padding-left: 48px;
|
|
30172
|
+
padding-left: var(--size-48);
|
|
30173
|
+
}
|
|
30174
|
+
|
|
30170
30175
|
.np-input-addon {
|
|
30171
30176
|
pointer-events: none;
|
|
30172
30177
|
z-index: 10;
|
|
@@ -30179,16 +30184,21 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
30179
30184
|
transition-duration: 150ms;
|
|
30180
30185
|
}
|
|
30181
30186
|
|
|
30187
|
+
.np-input-addon.np-input-addon--avatar > .np-avatar-view {
|
|
30188
|
+
margin-right: 8px;
|
|
30189
|
+
margin-right: var(--size-8);
|
|
30190
|
+
}
|
|
30191
|
+
|
|
30182
30192
|
.np-input-group:disabled .np-input-addon:not(.np-input-addon--interactive) {
|
|
30183
30193
|
opacity: 0.45;
|
|
30184
30194
|
mix-blend-mode: luminosity;
|
|
30185
30195
|
}
|
|
30186
30196
|
|
|
30187
|
-
.np-input-group:has( > :is(input,button,select):focus-visible) .np-input-addon {
|
|
30197
|
+
.np-input-group:has( > :is(input, button, select):focus-visible) .np-input-addon {
|
|
30188
30198
|
color: var(--color-interactive-primary);
|
|
30189
30199
|
}
|
|
30190
30200
|
|
|
30191
|
-
.np-input-group:has( > :is(input,button,select):hover) .np-input-addon {
|
|
30201
|
+
.np-input-group:has( > :is(input, button, select):hover) .np-input-addon {
|
|
30192
30202
|
color: #b5b7ba;
|
|
30193
30203
|
color: var(--color-interactive-secondary-hover);
|
|
30194
30204
|
}
|
|
@@ -31687,6 +31697,12 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
31687
31697
|
width: 100%;
|
|
31688
31698
|
}
|
|
31689
31699
|
|
|
31700
|
+
.tw-telephone__country-select--with-input-group-addon-start .np-button-input {
|
|
31701
|
+
padding-inline-start: 48px;
|
|
31702
|
+
padding-inline-start: var(--size-48);
|
|
31703
|
+
padding-inline-end: 26px !important;
|
|
31704
|
+
}
|
|
31705
|
+
|
|
31690
31706
|
.tw-telephone__number-input {
|
|
31691
31707
|
flex: auto 1 1;
|
|
31692
31708
|
}
|
|
@@ -18,6 +18,11 @@
|
|
|
18
18
|
.tw-telephone__country-select .np-input-group {
|
|
19
19
|
width: 100%;
|
|
20
20
|
}
|
|
21
|
+
.tw-telephone__country-select--with-input-group-addon-start .np-button-input {
|
|
22
|
+
padding-inline-start: 48px;
|
|
23
|
+
padding-inline-start: var(--size-48);
|
|
24
|
+
padding-inline-end: 26px !important;
|
|
25
|
+
}
|
|
21
26
|
.tw-telephone__number-input {
|
|
22
27
|
flex: auto 1 1;
|
|
23
28
|
}
|
|
@@ -14,7 +14,7 @@ export type ChipsProps = CommonProps & AriaLabelProperty & {
|
|
|
14
14
|
}) => void;
|
|
15
15
|
/** Used to manage which chips are selected */
|
|
16
16
|
selected: ChipValue | readonly ChipValue[];
|
|
17
|
-
/**
|
|
17
|
+
/** True turns on Filter-mode, False is Choice */
|
|
18
18
|
multiple?: boolean;
|
|
19
19
|
};
|
|
20
20
|
declare const Chips: ({ chips, onChange, selected, "aria-label": ariaLabel, className, multiple, }: ChipsProps) => import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chips.d.ts","sourceRoot":"","sources":["../../../src/chips/Chips.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAK3D,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC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AAK,CAAC"}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
export type CommonProps = {
|
|
2
|
-
/**
|
|
3
|
-
* Space-separated list of the case-sensitive CSS classes,
|
|
4
|
-
* most would be applied to outermost element inside the component
|
|
5
|
-
*
|
|
6
|
-
* @see https://github.com/transferwise/neptune-web/blob/main/rfc/0001-always-pass-classname.md
|
|
7
|
-
*/
|
|
8
2
|
className?: string;
|
|
9
3
|
};
|
|
10
4
|
export type AriaLabelProperty = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commonProps.d.ts","sourceRoot":"","sources":["../../../src/common/commonProps.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB
|
|
1
|
+
{"version":3,"file":"commonProps.d.ts","sourceRoot":"","sources":["../../../src/common/commonProps.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,KAAK,CAAC,yBAAyB,CAAC;IACzC,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9D,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../src/label/Label.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAc,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEtD,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;
|
|
1
|
+
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../src/label/Label.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAc,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEtD,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AA6BF,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;AAchE,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,WAAW,CAAC,GAAG;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAWrF,QAAA,MAAM,cAAc;wCAvBwC,kBAAkB;+CAcR,qBAAqB;CASrB,CAAC;AAGvE,OAAO,EAAE,cAAc,IAAI,KAAK,EAAE,CAAC"}
|
|
@@ -6,7 +6,10 @@ export declare enum LogoType {
|
|
|
6
6
|
export interface LogoProps {
|
|
7
7
|
/** Extra classes applied to Logo */
|
|
8
8
|
className?: string;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Renders a light-coloured version suited for dark backgrounds.
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
10
13
|
inverse?: boolean;
|
|
11
14
|
/**
|
|
12
15
|
* What type of logo to display
|
|
@@ -14,5 +17,11 @@ export interface LogoProps {
|
|
|
14
17
|
*/
|
|
15
18
|
type?: `${LogoType}`;
|
|
16
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Renders the Wise wordmark logo. Responsive — shows the flag-only mark on small viewports
|
|
22
|
+
* and the full wordmark on ≥576px (small breakpoint and above).
|
|
23
|
+
*
|
|
24
|
+
* @see {@link https://wise.design/foundations/logo Design Spec}
|
|
25
|
+
*/
|
|
17
26
|
export default function Logo({ className, inverse, type }: LogoProps): import("react").JSX.Element;
|
|
18
27
|
//# sourceMappingURL=Logo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logo.d.ts","sourceRoot":"","sources":["../../../src/logo/Logo.tsx"],"names":[],"mappings":"AA0BA,oBAAY,QAAQ;IAClB,IAAI,SAAS;IACb,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;CAChC;AAED,MAAM,WAAW,SAAS;IACxB,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB
|
|
1
|
+
{"version":3,"file":"Logo.d.ts","sourceRoot":"","sources":["../../../src/logo/Logo.tsx"],"names":[],"mappings":"AA0BA,oBAAY,QAAQ;IAClB,IAAI,SAAS;IACb,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;CAChC;AAED,MAAM,WAAW,SAAS;IACxB,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC;CACtB;AAQD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAa,EAAE,EAAE,SAAS,+BAW5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneNumberInput.d.ts","sourceRoot":"","sources":["../../../src/phoneNumberInput/PhoneNumberInput.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA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
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "46.
|
|
3
|
+
"version": "46.133.1",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
"@babel/preset-env": "^7.29.0",
|
|
44
44
|
"@babel/preset-react": "^7.28.5",
|
|
45
45
|
"@babel/preset-typescript": "^7.28.5",
|
|
46
|
-
"@formatjs/cli": "^6.
|
|
46
|
+
"@formatjs/cli": "^6.13.1",
|
|
47
47
|
"@rollup/plugin-babel": "^6.1.0",
|
|
48
48
|
"@rollup/plugin-json": "^6.1.0",
|
|
49
49
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
50
50
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
51
51
|
"@rollup/plugin-url": "^8.0.2",
|
|
52
|
-
"@storybook/addon-a11y": "^10.3.
|
|
53
|
-
"@storybook/addon-docs": "^10.3.
|
|
54
|
-
"@storybook/addon-mcp": "^0.
|
|
52
|
+
"@storybook/addon-a11y": "^10.3.2",
|
|
53
|
+
"@storybook/addon-docs": "^10.3.2",
|
|
54
|
+
"@storybook/addon-mcp": "^0.4.1",
|
|
55
55
|
"@storybook/addon-webpack5-compiler-babel": "^4.0.0",
|
|
56
|
-
"@storybook/react-webpack5": "^10.3.
|
|
56
|
+
"@storybook/react-webpack5": "^10.3.2",
|
|
57
57
|
"@testing-library/dom": "^10.4.1",
|
|
58
58
|
"@testing-library/jest-dom": "^6.9.1",
|
|
59
59
|
"@testing-library/react": "^16.3.2",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@types/babel__core": "^7.20.5",
|
|
64
64
|
"@types/commonmark": "^0.27.10",
|
|
65
65
|
"@types/jest": "^30.0.0",
|
|
66
|
-
"@types/lodash": "4.17.
|
|
66
|
+
"@types/lodash": "4.17.24",
|
|
67
67
|
"@types/lodash.clamp": "^4.0.9",
|
|
68
68
|
"@types/lodash.debounce": "^4.0.9",
|
|
69
69
|
"@types/react": "^18.3.28",
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
"@wise/art": "^2.26.0",
|
|
73
73
|
"@wise/eslint-config": "^13.3.0",
|
|
74
74
|
"babel-plugin-formatjs": "^10.5.41",
|
|
75
|
-
"eslint": "^9.39.
|
|
76
|
-
"eslint-plugin-storybook": "^10.3.
|
|
75
|
+
"eslint": "^9.39.4",
|
|
76
|
+
"eslint-plugin-storybook": "^10.3.2",
|
|
77
77
|
"gulp": "^5.0.1",
|
|
78
|
-
"jest": "^30.
|
|
78
|
+
"jest": "^30.3.0",
|
|
79
79
|
"jest-environment-jsdom": "^29.7.0",
|
|
80
80
|
"jest-fetch-mock": "^3.0.3",
|
|
81
81
|
"jsdom-testing-mocks": "^1.16.0",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"react-intl": "^7.1.14",
|
|
84
84
|
"rollup": "^4.57.1",
|
|
85
85
|
"rollup-preserve-directives": "^1.1.3",
|
|
86
|
-
"storybook": "^10.3.
|
|
87
|
-
"storybook-addon-tag-badges": "^3.0
|
|
86
|
+
"storybook": "^10.3.2",
|
|
87
|
+
"storybook-addon-tag-badges": "^3.1.0",
|
|
88
88
|
"storybook-addon-test-codegen": "^3.0.1",
|
|
89
89
|
"@transferwise/less-config": "3.1.2",
|
|
90
90
|
"@transferwise/neptune-css": "14.27.1",
|
|
@@ -102,24 +102,24 @@
|
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
104
|
"@babel/runtime": "^7.28.6",
|
|
105
|
-
"@floating-ui/react": "^0.27.
|
|
105
|
+
"@floating-ui/react": "^0.27.19",
|
|
106
106
|
"@headlessui/react": "^2.2.9",
|
|
107
107
|
"@popperjs/core": "^2.11.8",
|
|
108
|
-
"@react-aria/focus": "^3.21.
|
|
109
|
-
"@react-aria/overlays": "^3.31.
|
|
110
|
-
"@transferwise/formatting": "^2.13.
|
|
108
|
+
"@react-aria/focus": "^3.21.5",
|
|
109
|
+
"@react-aria/overlays": "^3.31.2",
|
|
110
|
+
"@transferwise/formatting": "^2.13.7",
|
|
111
111
|
"@transferwise/neptune-validation": "^3.3.3",
|
|
112
112
|
"clsx": "^2.1.1",
|
|
113
113
|
"commonmark": "^0.31.2",
|
|
114
114
|
"core-js": "^3.48.0",
|
|
115
|
-
"framer-motion": "^12.
|
|
115
|
+
"framer-motion": "^12.36.0",
|
|
116
116
|
"lodash.clamp": "^4.0.3",
|
|
117
117
|
"lodash.debounce": "^4.0.8",
|
|
118
118
|
"merge-props": "^6.0.0",
|
|
119
119
|
"react-popper": "^2.3.0",
|
|
120
120
|
"react-transition-group": "^4.4.5",
|
|
121
|
-
"virtua": "^0.48.
|
|
122
|
-
"@transferwise/neptune-tokens": "^8.
|
|
121
|
+
"virtua": "^0.48.8",
|
|
122
|
+
"@transferwise/neptune-tokens": "^8.20.3"
|
|
123
123
|
},
|
|
124
124
|
"publishConfig": {
|
|
125
125
|
"access": "public",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta, Canvas, Source } from '@storybook/addon-docs/blocks';
|
|
2
2
|
import { Bulb } from '@transferwise/icons';
|
|
3
|
-
import
|
|
4
|
-
import * as stories from './Button.story';
|
|
3
|
+
import ListItem from '../../listItem';
|
|
4
|
+
import * as stories from './Button.test.story';
|
|
5
5
|
|
|
6
6
|
<Meta title="Actions/Button/Accessibility" />
|
|
7
7
|
|
|
@@ -9,11 +9,15 @@ import * as stories from './Button.story';
|
|
|
9
9
|
|
|
10
10
|
Given the `Button` is a widely used and highly sensitive component, there are some instances where care is required to ensure inclusive and accessible experience.
|
|
11
11
|
|
|
12
|
-
<
|
|
13
|
-
media={<Bulb size={24} />}
|
|
12
|
+
<ListItem
|
|
14
13
|
title="Design guidance"
|
|
15
|
-
|
|
16
|
-
href="https://wise.design/components/button#accessibility"
|
|
14
|
+
subtitle="Before you start, familiarise yourself with the dedicated accessibility documentation."
|
|
15
|
+
control={<ListItem.Navigation href="https://wise.design/components/button#accessibility" />}
|
|
16
|
+
media={
|
|
17
|
+
<ListItem.AvatarView>
|
|
18
|
+
<Bulb />
|
|
19
|
+
</ListItem.AvatarView>
|
|
20
|
+
}
|
|
17
21
|
/>
|
|
18
22
|
|
|
19
23
|
<br />
|
|
@@ -153,13 +153,11 @@ const getPropsForPreview = (args: PreviewStoryArgs) => {
|
|
|
153
153
|
const meta: Meta<typeof Button> = {
|
|
154
154
|
component: Button,
|
|
155
155
|
title: 'Actions/Button',
|
|
156
|
-
tags: ['new'],
|
|
157
156
|
argTypes: {
|
|
158
157
|
v2: {
|
|
159
158
|
table: {
|
|
160
159
|
readonly: true,
|
|
161
160
|
},
|
|
162
|
-
description: 'If set, toggles the new Button API',
|
|
163
161
|
},
|
|
164
162
|
size: {
|
|
165
163
|
type: {
|
|
@@ -196,13 +194,11 @@ const meta: Meta<typeof Button> = {
|
|
|
196
194
|
},
|
|
197
195
|
},
|
|
198
196
|
disabled: {
|
|
199
|
-
description: 'Toggles the disabled state',
|
|
200
197
|
table: {
|
|
201
198
|
defaultValue: { summary: 'false' },
|
|
202
199
|
},
|
|
203
200
|
},
|
|
204
201
|
loading: {
|
|
205
|
-
description: 'Toggles the loading state',
|
|
206
202
|
table: {
|
|
207
203
|
defaultValue: { summary: 'false' },
|
|
208
204
|
},
|
|
@@ -216,7 +212,6 @@ const meta: Meta<typeof Button> = {
|
|
|
216
212
|
type: {
|
|
217
213
|
name: 'string',
|
|
218
214
|
},
|
|
219
|
-
description: 'If set, the component will render as an HTML anchor.',
|
|
220
215
|
},
|
|
221
216
|
target: {
|
|
222
217
|
type: {
|
|
@@ -241,7 +236,6 @@ const meta: Meta<typeof Button> = {
|
|
|
241
236
|
summary: 'string',
|
|
242
237
|
},
|
|
243
238
|
},
|
|
244
|
-
description: "Native HTML button's `type` attribute",
|
|
245
239
|
},
|
|
246
240
|
htmlType: {
|
|
247
241
|
table: {
|
|
@@ -255,6 +249,21 @@ const meta: Meta<typeof Button> = {
|
|
|
255
249
|
},
|
|
256
250
|
},
|
|
257
251
|
},
|
|
252
|
+
id: {
|
|
253
|
+
table: {
|
|
254
|
+
category: 'Common',
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
className: {
|
|
258
|
+
table: {
|
|
259
|
+
category: 'Common',
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
onClick: {
|
|
263
|
+
table: {
|
|
264
|
+
category: 'Common',
|
|
265
|
+
},
|
|
266
|
+
},
|
|
258
267
|
},
|
|
259
268
|
args: {
|
|
260
269
|
v2: true,
|
|
@@ -306,7 +315,6 @@ export const Playground: StoryObj<PreviewStoryArgs> = {
|
|
|
306
315
|
onMouseLeave: { table: { disable: true } },
|
|
307
316
|
...previewArgTypes,
|
|
308
317
|
},
|
|
309
|
-
tags: ['!autodocs'],
|
|
310
318
|
};
|
|
311
319
|
|
|
312
320
|
/**
|