@transferwise/components 46.165.4 → 46.165.5
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/Typeahead/TypeaheadInput/TypeaheadInput.js +5 -5
- package/build/Typeahead/TypeaheadInput/TypeaheadInput.js.map +1 -1
- package/build/Typeahead/TypeaheadInput/TypeaheadInput.mjs +5 -5
- package/build/Typeahead/TypeaheadInput/TypeaheadInput.mjs.map +1 -1
- package/build/main.css +8 -27
- package/build/styles/Typeahead/Typeahead.css +8 -27
- package/build/styles/main.css +8 -27
- package/build/types/Body/Body.d.ts +2 -2
- package/build/types/IconButton/IconButton.d.ts +1 -1
- package/build/types/MoneyInput/MoneyInput.d.ts +1 -1
- package/build/types/MoneyInput/MoneyInput.d.ts.map +1 -1
- package/build/types/Title/Title.d.ts +2 -2
- package/build/types/Typeahead/TypeaheadInput/TypeaheadInput.d.ts.map +1 -1
- package/build/types/Upload/Steps/UploadImageStep/UploadImageStep.d.ts +1 -1
- package/build/types/UploadInput/UploadItem/UploadItemLink.d.ts +1 -1
- package/package.json +2 -2
- package/src/Button/_stories/Button.test.story.tsx +1 -0
- package/src/Calendar/_stories/Calendar.test.story.tsx +1 -0
- package/src/DateInput/_stories/DateInput.rtl.test.story.tsx +1 -0
- package/src/DateInput/_stories/DateInput.story.tsx +1 -0
- package/src/Decision/_stories/Decision.test.story.tsx +1 -0
- package/src/DefinitionList/_stories/DefinitionList.test.story.tsx +1 -1
- package/src/ExpressiveMoneyInput/_stories/ExpressiveMoneyInput.rtl.test.story.tsx +1 -0
- package/src/Field/_stories/Field.test.story.tsx +1 -0
- package/src/Header/_stories/Header.test.story.tsx +1 -1
- package/src/InputWithDisplayFormat/_stories/InputWithDisplayFormat.test.story.tsx +1 -0
- package/src/Inputs/InputGroup/_stories/InputGroup.test.story.tsx +1 -0
- package/src/Inputs/SelectInput/_stories/SelectInput.rtl.test.story.tsx +1 -0
- package/src/Inputs/TextArea/_stories/TextArea.test.story.tsx +1 -0
- package/src/InstructionsList/_stories/InstructionsList.test.story.tsx +2 -1
- package/src/Label/_stories/Label.test.story.tsx +1 -0
- package/src/ListItem/_stories/ListItem.rtl.test.story.tsx +1 -6
- package/src/MoneyInput/_stories/MoneyInput.rtl.test.story.tsx +3 -1
- package/src/PhoneNumberInput/_stories/PhoneNumberInput.rtl.test.story.tsx +1 -1
- package/src/ProgressBar/_stories/ProgressBar.test.story.tsx +1 -0
- package/src/Prompt/ActionPrompt/_stories/ActionPrompt.test.story.tsx +1 -0
- package/src/Prompt/CriticalBanner/_stories/CriticalBanner.test.story.tsx +1 -0
- package/src/Prompt/InfoPrompt/_stories/InfoPrompt.test.story.tsx +1 -0
- package/src/Prompt/InlinePrompt/_stories/InlinePrompt.test.story.tsx +1 -0
- package/src/Table/_stories/Table.test.story.tsx +24 -13
- package/src/Tabs/_stories/Tabs.test.story.tsx +1 -1
- package/src/TextareaWithDisplayFormat/_stories/TextareaWithDisplayFormat.test.story.tsx +1 -0
- package/src/Typeahead/Typeahead.css +8 -27
- package/src/Typeahead/Typeahead.less +9 -32
- package/src/Typeahead/TypeaheadInput/TypeaheadInput.tsx +5 -5
- package/src/Typeahead/_stories/Typeahead.rtl.test.story.tsx +1 -1
- package/src/Typeahead/_stories/Typeahead.test.story.tsx +65 -0
- package/src/Upload/_stories/Upload.rtl.test.story.tsx +1 -0
- package/src/UploadInput/_stories/UploadInput.test.story.tsx +1 -0
- package/src/main.css +8 -27
|
@@ -62,10 +62,8 @@ class TypeaheadInput extends React.Component {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
recalculateWidth = () => {
|
|
65
|
-
|
|
66
|
-
this.
|
|
67
|
-
inputWidth: Math.max(DEFAULT_INPUT_MIN_WIDTH, this.sizerRef.current?.scrollWidth ?? 0 + 10)
|
|
68
|
-
});
|
|
65
|
+
this.setState({
|
|
66
|
+
inputWidth: Math.max(DEFAULT_INPUT_MIN_WIDTH, (this.sizerRef.current?.scrollWidth ?? 0) + 10)
|
|
69
67
|
});
|
|
70
68
|
};
|
|
71
69
|
renderInput = isRTL => {
|
|
@@ -129,7 +127,9 @@ class TypeaheadInput extends React.Component {
|
|
|
129
127
|
children: direction$1 => {
|
|
130
128
|
const isRTL = direction$1 === direction.Direction.RTL;
|
|
131
129
|
return multiple ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
132
|
-
className:
|
|
130
|
+
className: clsx.clsx('form-control typeahead__input-container', {
|
|
131
|
+
'typeahead__input-container--scrollable': maxHeight != null
|
|
132
|
+
}),
|
|
133
133
|
style: {
|
|
134
134
|
maxHeight
|
|
135
135
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeaheadInput.js","sources":["../../../src/Typeahead/TypeaheadInput/TypeaheadInput.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-autofocus */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport { clsx } from 'clsx';\nimport { Component, createRef, ReactNode } from 'react';\n\nimport { Input } from '../../Inputs/Input/Input';\nimport { TypeaheadOption, TypeaheadProps } from '../Typeahead';\nimport { Direction } from '../../common';\nimport { DirectionContext } from '../../Provider/Direction';\n\nconst DEFAULT_INPUT_MIN_WIDTH = 10;\n\nexport type TypeaheadInputProps<T> = {\n typeaheadId: string;\n value: string;\n selected: readonly TypeaheadOption<T>[];\n dropdownOpen?: boolean;\n autoComplete: string;\n onChange: React.ChangeEventHandler<HTMLInputElement>;\n onKeyDown: React.KeyboardEventHandler<HTMLInputElement>;\n onFocus: () => void;\n onPaste: React.ClipboardEventHandler<HTMLInputElement>;\n renderChip: (chip: TypeaheadOption<T>, index: number) => ReactNode;\n ariaActivedescendant?: string;\n} & Pick<\n TypeaheadProps<T>,\n 'id' | 'name' | 'autoFocus' | 'disabled' | 'multiple' | 'placeholder' | 'maxHeight'\n>;\n\ntype TypeaheadInputState = {\n inputWidth: number;\n keyboardFocusedOptionIndex: number | null;\n};\n\nexport default class TypeaheadInput<T> extends Component<\n TypeaheadInputProps<T>,\n TypeaheadInputState\n> {\n inputRef = createRef<HTMLInputElement>();\n sizerRef = createRef<HTMLDivElement>();\n\n constructor(props: TypeaheadInputProps<T>) {\n super(props);\n this.state = {\n inputWidth: DEFAULT_INPUT_MIN_WIDTH,\n keyboardFocusedOptionIndex: null,\n };\n }\n\n componentDidMount() {\n const { autoFocus } = this.props;\n if (autoFocus) {\n // Autofocus after context code executions (e.g open Modal) is completed\n setTimeout(() => {\n this.inputRef.current?.focus();\n });\n }\n }\n\n componentDidUpdate(previousProps: TypeaheadInputProps<T>) {\n if (previousProps.value !== this.props.value && this.props.multiple) {\n this.recalculateWidth();\n }\n }\n\n recalculateWidth = () => {\n
|
|
1
|
+
{"version":3,"file":"TypeaheadInput.js","sources":["../../../src/Typeahead/TypeaheadInput/TypeaheadInput.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-autofocus */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport { clsx } from 'clsx';\nimport { Component, createRef, ReactNode } from 'react';\n\nimport { Input } from '../../Inputs/Input/Input';\nimport { TypeaheadOption, TypeaheadProps } from '../Typeahead';\nimport { Direction } from '../../common';\nimport { DirectionContext } from '../../Provider/Direction';\n\nconst DEFAULT_INPUT_MIN_WIDTH = 10;\n\nexport type TypeaheadInputProps<T> = {\n typeaheadId: string;\n value: string;\n selected: readonly TypeaheadOption<T>[];\n dropdownOpen?: boolean;\n autoComplete: string;\n onChange: React.ChangeEventHandler<HTMLInputElement>;\n onKeyDown: React.KeyboardEventHandler<HTMLInputElement>;\n onFocus: () => void;\n onPaste: React.ClipboardEventHandler<HTMLInputElement>;\n renderChip: (chip: TypeaheadOption<T>, index: number) => ReactNode;\n ariaActivedescendant?: string;\n} & Pick<\n TypeaheadProps<T>,\n 'id' | 'name' | 'autoFocus' | 'disabled' | 'multiple' | 'placeholder' | 'maxHeight'\n>;\n\ntype TypeaheadInputState = {\n inputWidth: number;\n keyboardFocusedOptionIndex: number | null;\n};\n\nexport default class TypeaheadInput<T> extends Component<\n TypeaheadInputProps<T>,\n TypeaheadInputState\n> {\n inputRef = createRef<HTMLInputElement>();\n sizerRef = createRef<HTMLDivElement>();\n\n constructor(props: TypeaheadInputProps<T>) {\n super(props);\n this.state = {\n inputWidth: DEFAULT_INPUT_MIN_WIDTH,\n keyboardFocusedOptionIndex: null,\n };\n }\n\n componentDidMount() {\n const { autoFocus } = this.props;\n if (autoFocus) {\n // Autofocus after context code executions (e.g open Modal) is completed\n setTimeout(() => {\n this.inputRef.current?.focus();\n });\n }\n }\n\n componentDidUpdate(previousProps: TypeaheadInputProps<T>) {\n if (previousProps.value !== this.props.value && this.props.multiple) {\n this.recalculateWidth();\n }\n }\n\n recalculateWidth = () => {\n this.setState({\n inputWidth: Math.max(DEFAULT_INPUT_MIN_WIDTH, (this.sizerRef.current?.scrollWidth ?? 0) + 10),\n });\n };\n\n renderInput = (isRTL: boolean) => {\n const {\n typeaheadId,\n autoFocus,\n disabled,\n multiple,\n name,\n dropdownOpen,\n placeholder,\n selected,\n value,\n onChange,\n onKeyDown,\n onFocus,\n onPaste,\n autoComplete,\n ariaActivedescendant,\n } = this.props;\n const { inputWidth } = this.state;\n\n const hasPlaceholder = !multiple || selected.length === 0;\n return (\n <Input\n ref={this.inputRef}\n dir={isRTL ? 'rtl' : 'auto'}\n className={clsx(multiple && 'typeahead__input')}\n name={name}\n id={`input-${typeaheadId}`}\n aria-activedescendant={ariaActivedescendant}\n autoFocus={autoFocus}\n disabled={disabled}\n placeholder={hasPlaceholder ? placeholder : ''}\n aria-autocomplete=\"list\"\n aria-expanded={dropdownOpen}\n aria-haspopup=\"listbox\"\n aria-controls={dropdownOpen ? `menu-${typeaheadId}` : undefined}\n autoComplete={autoComplete}\n role=\"combobox\"\n value={value}\n style={multiple && selected.length > 0 ? { width: inputWidth } : {}}\n onChange={onChange}\n onKeyDown={onKeyDown}\n onClick={onFocus}\n onFocus={onFocus}\n onPaste={onPaste}\n />\n );\n };\n\n render() {\n const { multiple, selected, value, maxHeight, renderChip } = this.props;\n\n return (\n <DirectionContext.Consumer>\n {(direction) => {\n const isRTL = direction === Direction.RTL;\n\n return multiple ? (\n <div\n className={clsx('form-control typeahead__input-container', {\n 'typeahead__input-container--scrollable': maxHeight != null,\n })}\n style={{ maxHeight }}\n onClick={() => {\n this.inputRef.current?.focus();\n }}\n >\n <div className=\"typeahead__input-wrapper\">\n {selected && selected.map((chip, idx) => renderChip(chip, idx))}\n\n {this.renderInput(isRTL)}\n <div className=\"typeahead__input-aligner\" />\n </div>\n <div ref={this.sizerRef} className=\"sizer form-control typeahead__input\">\n {value}\n </div>\n </div>\n ) : (\n this.renderInput(isRTL)\n );\n }}\n </DirectionContext.Consumer>\n );\n }\n}\n"],"names":["DEFAULT_INPUT_MIN_WIDTH","TypeaheadInput","Component","inputRef","createRef","sizerRef","constructor","props","state","inputWidth","keyboardFocusedOptionIndex","componentDidMount","autoFocus","setTimeout","current","focus","componentDidUpdate","previousProps","value","multiple","recalculateWidth","setState","Math","max","scrollWidth","renderInput","isRTL","typeaheadId","disabled","name","dropdownOpen","placeholder","selected","onChange","onKeyDown","onFocus","onPaste","autoComplete","ariaActivedescendant","hasPlaceholder","length","_jsx","Input","ref","dir","className","clsx","id","undefined","role","style","width","onClick","render","maxHeight","renderChip","DirectionContext","Consumer","children","direction","Direction","RTL","_jsxs","map","chip","idx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AASA,MAAMA,uBAAuB,GAAG,EAAE;AAwBpB,MAAOC,cAAkB,SAAQC,eAG9C,CAAA;EACCC,QAAQ,gBAAGC,eAAS,EAAoB;EACxCC,QAAQ,gBAAGD,eAAS,EAAkB;EAEtCE,WAAAA,CAAYC,KAA6B,EAAA;IACvC,KAAK,CAACA,KAAK,CAAC;IACZ,IAAI,CAACC,KAAK,GAAG;AACXC,M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AAA,EACtBC,WAAS,IAAI;AACb,QAAA,MAAMjC,KAAK,GAAGiC,WAAS,KAAKC,mBAAS,CAACC,GAAG;QAEzC,OAAO1C,QAAQ,gBACb2C,eAAA,CAAA,KAAA,EAAA;AACEjB,UAAAA,SAAS,EAAEC,SAAI,CAAC,yCAAyC,EAAE;YACzD,wCAAwC,EAAEQ,SAAS,IAAI;AACxD,WAAA,CAAE;AACHJ,UAAAA,KAAK,EAAE;AAAEI,YAAAA;WAAY;UACrBF,OAAO,EAAEA,MAAK;AACZ,YAAA,IAAI,CAACjD,QAAQ,CAACW,OAAO,EAAEC,KAAK,EAAE;UAChC,CAAE;AAAA2C,UAAAA,QAAA,gBAEFI,eAAA,CAAA,KAAA,EAAA;AAAKjB,YAAAA,SAAS,EAAC,0BAA0B;YAAAa,QAAA,EAAA,CACtC1B,QAAQ,IAAIA,QAAQ,CAAC+B,GAAG,CAAC,CAACC,IAAI,EAAEC,GAAG,KAAKV,UAAU,CAACS,IAAI,EAAEC,GAAG,CAAC,CAAC,EAE9D,IAAI,CAACxC,WAAW,CAACC,KAAK,CAAC,eACxBe,cAAA,CAAA,KAAA,EAAA;AAAKI,cAAAA,SAAS,EAAC;AAA0B,aAAA,CAC3C;WAAK,CACL,eAAAJ,cAAA,CAAA,KAAA,EAAA;YAAKE,GAAG,EAAE,IAAI,CAACtC,QAAS;AAACwC,YAAAA,SAAS,EAAC,qCAAqC;AAAAa,YAAAA,QAAA,EACrExC;AAAK,WACH,CACP;AAAA,SAAK,CAAC,GAEN,IAAI,CAACO,WAAW,CAACC,KAAK,CACvB;AACH,MAAA;AAAC,KACwB,CAAC;AAEhC,EAAA;AACD;;"}
|
|
@@ -58,10 +58,8 @@ class TypeaheadInput extends Component {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
recalculateWidth = () => {
|
|
61
|
-
|
|
62
|
-
this.
|
|
63
|
-
inputWidth: Math.max(DEFAULT_INPUT_MIN_WIDTH, this.sizerRef.current?.scrollWidth ?? 0 + 10)
|
|
64
|
-
});
|
|
61
|
+
this.setState({
|
|
62
|
+
inputWidth: Math.max(DEFAULT_INPUT_MIN_WIDTH, (this.sizerRef.current?.scrollWidth ?? 0) + 10)
|
|
65
63
|
});
|
|
66
64
|
};
|
|
67
65
|
renderInput = isRTL => {
|
|
@@ -125,7 +123,9 @@ class TypeaheadInput extends Component {
|
|
|
125
123
|
children: direction => {
|
|
126
124
|
const isRTL = direction === Direction.RTL;
|
|
127
125
|
return multiple ? /*#__PURE__*/jsxs("div", {
|
|
128
|
-
className:
|
|
126
|
+
className: clsx('form-control typeahead__input-container', {
|
|
127
|
+
'typeahead__input-container--scrollable': maxHeight != null
|
|
128
|
+
}),
|
|
129
129
|
style: {
|
|
130
130
|
maxHeight
|
|
131
131
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeaheadInput.mjs","sources":["../../../src/Typeahead/TypeaheadInput/TypeaheadInput.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-autofocus */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport { clsx } from 'clsx';\nimport { Component, createRef, ReactNode } from 'react';\n\nimport { Input } from '../../Inputs/Input/Input';\nimport { TypeaheadOption, TypeaheadProps } from '../Typeahead';\nimport { Direction } from '../../common';\nimport { DirectionContext } from '../../Provider/Direction';\n\nconst DEFAULT_INPUT_MIN_WIDTH = 10;\n\nexport type TypeaheadInputProps<T> = {\n typeaheadId: string;\n value: string;\n selected: readonly TypeaheadOption<T>[];\n dropdownOpen?: boolean;\n autoComplete: string;\n onChange: React.ChangeEventHandler<HTMLInputElement>;\n onKeyDown: React.KeyboardEventHandler<HTMLInputElement>;\n onFocus: () => void;\n onPaste: React.ClipboardEventHandler<HTMLInputElement>;\n renderChip: (chip: TypeaheadOption<T>, index: number) => ReactNode;\n ariaActivedescendant?: string;\n} & Pick<\n TypeaheadProps<T>,\n 'id' | 'name' | 'autoFocus' | 'disabled' | 'multiple' | 'placeholder' | 'maxHeight'\n>;\n\ntype TypeaheadInputState = {\n inputWidth: number;\n keyboardFocusedOptionIndex: number | null;\n};\n\nexport default class TypeaheadInput<T> extends Component<\n TypeaheadInputProps<T>,\n TypeaheadInputState\n> {\n inputRef = createRef<HTMLInputElement>();\n sizerRef = createRef<HTMLDivElement>();\n\n constructor(props: TypeaheadInputProps<T>) {\n super(props);\n this.state = {\n inputWidth: DEFAULT_INPUT_MIN_WIDTH,\n keyboardFocusedOptionIndex: null,\n };\n }\n\n componentDidMount() {\n const { autoFocus } = this.props;\n if (autoFocus) {\n // Autofocus after context code executions (e.g open Modal) is completed\n setTimeout(() => {\n this.inputRef.current?.focus();\n });\n }\n }\n\n componentDidUpdate(previousProps: TypeaheadInputProps<T>) {\n if (previousProps.value !== this.props.value && this.props.multiple) {\n this.recalculateWidth();\n }\n }\n\n recalculateWidth = () => {\n
|
|
1
|
+
{"version":3,"file":"TypeaheadInput.mjs","sources":["../../../src/Typeahead/TypeaheadInput/TypeaheadInput.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-autofocus */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport { clsx } from 'clsx';\nimport { Component, createRef, ReactNode } from 'react';\n\nimport { Input } from '../../Inputs/Input/Input';\nimport { TypeaheadOption, TypeaheadProps } from '../Typeahead';\nimport { Direction } from '../../common';\nimport { DirectionContext } from '../../Provider/Direction';\n\nconst DEFAULT_INPUT_MIN_WIDTH = 10;\n\nexport type TypeaheadInputProps<T> = {\n typeaheadId: string;\n value: string;\n selected: readonly TypeaheadOption<T>[];\n dropdownOpen?: boolean;\n autoComplete: string;\n onChange: React.ChangeEventHandler<HTMLInputElement>;\n onKeyDown: React.KeyboardEventHandler<HTMLInputElement>;\n onFocus: () => void;\n onPaste: React.ClipboardEventHandler<HTMLInputElement>;\n renderChip: (chip: TypeaheadOption<T>, index: number) => ReactNode;\n ariaActivedescendant?: string;\n} & Pick<\n TypeaheadProps<T>,\n 'id' | 'name' | 'autoFocus' | 'disabled' | 'multiple' | 'placeholder' | 'maxHeight'\n>;\n\ntype TypeaheadInputState = {\n inputWidth: number;\n keyboardFocusedOptionIndex: number | null;\n};\n\nexport default class TypeaheadInput<T> extends Component<\n TypeaheadInputProps<T>,\n TypeaheadInputState\n> {\n inputRef = createRef<HTMLInputElement>();\n sizerRef = createRef<HTMLDivElement>();\n\n constructor(props: TypeaheadInputProps<T>) {\n super(props);\n this.state = {\n inputWidth: DEFAULT_INPUT_MIN_WIDTH,\n keyboardFocusedOptionIndex: null,\n };\n }\n\n componentDidMount() {\n const { autoFocus } = this.props;\n if (autoFocus) {\n // Autofocus after context code executions (e.g open Modal) is completed\n setTimeout(() => {\n this.inputRef.current?.focus();\n });\n }\n }\n\n componentDidUpdate(previousProps: TypeaheadInputProps<T>) {\n if (previousProps.value !== this.props.value && this.props.multiple) {\n this.recalculateWidth();\n }\n }\n\n recalculateWidth = () => {\n this.setState({\n inputWidth: Math.max(DEFAULT_INPUT_MIN_WIDTH, (this.sizerRef.current?.scrollWidth ?? 0) + 10),\n });\n };\n\n renderInput = (isRTL: boolean) => {\n const {\n typeaheadId,\n autoFocus,\n disabled,\n multiple,\n name,\n dropdownOpen,\n placeholder,\n selected,\n value,\n onChange,\n onKeyDown,\n onFocus,\n onPaste,\n autoComplete,\n ariaActivedescendant,\n } = this.props;\n const { inputWidth } = this.state;\n\n const hasPlaceholder = !multiple || selected.length === 0;\n return (\n <Input\n ref={this.inputRef}\n dir={isRTL ? 'rtl' : 'auto'}\n className={clsx(multiple && 'typeahead__input')}\n name={name}\n id={`input-${typeaheadId}`}\n aria-activedescendant={ariaActivedescendant}\n autoFocus={autoFocus}\n disabled={disabled}\n placeholder={hasPlaceholder ? placeholder : ''}\n aria-autocomplete=\"list\"\n aria-expanded={dropdownOpen}\n aria-haspopup=\"listbox\"\n aria-controls={dropdownOpen ? `menu-${typeaheadId}` : undefined}\n autoComplete={autoComplete}\n role=\"combobox\"\n value={value}\n style={multiple && selected.length > 0 ? { width: inputWidth } : {}}\n onChange={onChange}\n onKeyDown={onKeyDown}\n onClick={onFocus}\n onFocus={onFocus}\n onPaste={onPaste}\n />\n );\n };\n\n render() {\n const { multiple, selected, value, maxHeight, renderChip } = this.props;\n\n return (\n <DirectionContext.Consumer>\n {(direction) => {\n const isRTL = direction === Direction.RTL;\n\n return multiple ? (\n <div\n className={clsx('form-control typeahead__input-container', {\n 'typeahead__input-container--scrollable': maxHeight != null,\n })}\n style={{ maxHeight }}\n onClick={() => {\n this.inputRef.current?.focus();\n }}\n >\n <div className=\"typeahead__input-wrapper\">\n {selected && selected.map((chip, idx) => renderChip(chip, idx))}\n\n {this.renderInput(isRTL)}\n <div className=\"typeahead__input-aligner\" />\n </div>\n <div ref={this.sizerRef} className=\"sizer form-control typeahead__input\">\n {value}\n </div>\n </div>\n ) : (\n this.renderInput(isRTL)\n );\n }}\n </DirectionContext.Consumer>\n );\n }\n}\n"],"names":["DEFAULT_INPUT_MIN_WIDTH","TypeaheadInput","Component","inputRef","createRef","sizerRef","constructor","props","state","inputWidth","keyboardFocusedOptionIndex","componentDidMount","autoFocus","setTimeout","current","focus","componentDidUpdate","previousProps","value","multiple","recalculateWidth","setState","Math","max","scrollWidth","renderInput","isRTL","typeaheadId","disabled","name","dropdownOpen","placeholder","selected","onChange","onKeyDown","onFocus","onPaste","autoComplete","ariaActivedescendant","hasPlaceholder","length","_jsx","Input","ref","dir","className","clsx","id","undefined","role","style","width","onClick","render","maxHeight","renderChip","DirectionContext","Consumer","children","direction","Direction","RTL","_jsxs","map","chip","idx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AASA,MAAMA,uBAAuB,GAAG,EAAE;AAwBpB,MAAOC,cAAkB,SAAQC,SAG9C,CAAA;EACCC,QAAQ,gBAAGC,SAAS,EAAoB;EACxCC,QAAQ,gBAAGD,SAAS,EAAkB;EAEtCE,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
|
25411
25411
|
margin-block-end: auto;
|
|
25412
|
-
animation-name: slide;
|
|
25413
|
-
animation-duration: 0.03s;
|
|
25414
|
-
animation-timing-function: ease-in-out;
|
|
25415
|
-
}
|
|
25416
|
-
.typeahead--multiple .np-chip:first-child {
|
|
25417
|
-
animation-name: slideFirst;
|
|
25418
25412
|
}
|
|
25419
25413
|
.typeahead--multiple .np-chip-remove {
|
|
25420
25414
|
animation-name: fadeIn;
|
|
@@ -25426,7 +25420,10 @@ button.np-link {
|
|
|
25426
25420
|
min-block-size: auto;
|
|
25427
25421
|
padding-block-start: 0;
|
|
25428
25422
|
padding-block-end: 0;
|
|
25429
|
-
overflow:
|
|
25423
|
+
overflow: visible;
|
|
25424
|
+
}
|
|
25425
|
+
.typeahead--multiple .typeahead__input-container--scrollable {
|
|
25426
|
+
overflow-y: auto;
|
|
25430
25427
|
}
|
|
25431
25428
|
.typeahead--multiple .typeahead__input {
|
|
25432
25429
|
border: none;
|
|
@@ -25460,12 +25457,12 @@ button.np-link {
|
|
|
25460
25457
|
padding-inline-start: 0;
|
|
25461
25458
|
}
|
|
25462
25459
|
.typeahead--multiple.typeahead--has-value .typeahead__input {
|
|
25463
|
-
margin-block-end: calc(-1 * var(--size-8)
|
|
25460
|
+
margin-block-end: calc(-1 * var(--size-8));
|
|
25464
25461
|
margin-inline-start: var(--size-4);
|
|
25465
25462
|
}
|
|
25466
25463
|
.typeahead--multiple.typeahead--has-value .typeahead__input-wrapper::after {
|
|
25467
25464
|
content: "";
|
|
25468
|
-
block-size:
|
|
25465
|
+
block-size: var(--size-8);
|
|
25469
25466
|
inline-size: 100%;
|
|
25470
25467
|
}
|
|
25471
25468
|
.typeahead__input-wrapper {
|
|
@@ -25499,7 +25496,7 @@ button.np-link {
|
|
|
25499
25496
|
min-block-size: var(--input-height-large);
|
|
25500
25497
|
}
|
|
25501
25498
|
.typeahead-lg.typeahead--multiple .typeahead__input {
|
|
25502
|
-
padding-block-start:
|
|
25499
|
+
padding-block-start: var(--size-8);
|
|
25503
25500
|
}
|
|
25504
25501
|
.typeahead-lg.typeahead--multiple .typeahead__input-wrapper {
|
|
25505
25502
|
padding-block-end: var(--size-8);
|
|
@@ -25511,22 +25508,6 @@ button.np-link {
|
|
|
25511
25508
|
.typeahead-lg.typeahead--multiple .np-chip {
|
|
25512
25509
|
margin-block-end: 0;
|
|
25513
25510
|
}
|
|
25514
|
-
@keyframes slide {
|
|
25515
|
-
from {
|
|
25516
|
-
transform: translateX(-12px);
|
|
25517
|
-
}
|
|
25518
|
-
to {
|
|
25519
|
-
transform: none;
|
|
25520
|
-
}
|
|
25521
|
-
}
|
|
25522
|
-
@keyframes slideFirst {
|
|
25523
|
-
from {
|
|
25524
|
-
transform: translateX(-4px);
|
|
25525
|
-
}
|
|
25526
|
-
to {
|
|
25527
|
-
transform: none;
|
|
25528
|
-
}
|
|
25529
|
-
}
|
|
25530
25511
|
@keyframes fadeIn {
|
|
25531
25512
|
from {
|
|
25532
25513
|
opacity: 0;
|
|
@@ -25549,7 +25530,7 @@ button.np-link {
|
|
|
25549
25530
|
color: var(--color-interactive-secondary);
|
|
25550
25531
|
}
|
|
25551
25532
|
.np-theme-personal .typeahead .np-chip {
|
|
25552
|
-
margin-block-start:
|
|
25533
|
+
margin-block-start: var(--size-8);
|
|
25553
25534
|
}
|
|
25554
25535
|
.np-theme-personal .typeahead .np-chip--removable .np-text-body-default-bold {
|
|
25555
25536
|
padding-inline-end: var(--size-16);
|
|
@@ -26,12 +26,6 @@
|
|
|
26
26
|
}
|
|
27
27
|
.typeahead--multiple .np-chip {
|
|
28
28
|
margin-block-end: auto;
|
|
29
|
-
animation-name: slide;
|
|
30
|
-
animation-duration: 0.03s;
|
|
31
|
-
animation-timing-function: ease-in-out;
|
|
32
|
-
}
|
|
33
|
-
.typeahead--multiple .np-chip:first-child {
|
|
34
|
-
animation-name: slideFirst;
|
|
35
29
|
}
|
|
36
30
|
.typeahead--multiple .np-chip-remove {
|
|
37
31
|
animation-name: fadeIn;
|
|
@@ -43,7 +37,10 @@
|
|
|
43
37
|
min-block-size: auto;
|
|
44
38
|
padding-block-start: 0;
|
|
45
39
|
padding-block-end: 0;
|
|
46
|
-
overflow:
|
|
40
|
+
overflow: visible;
|
|
41
|
+
}
|
|
42
|
+
.typeahead--multiple .typeahead__input-container--scrollable {
|
|
43
|
+
overflow-y: auto;
|
|
47
44
|
}
|
|
48
45
|
.typeahead--multiple .typeahead__input {
|
|
49
46
|
border: none;
|
|
@@ -77,12 +74,12 @@
|
|
|
77
74
|
padding-inline-start: 0;
|
|
78
75
|
}
|
|
79
76
|
.typeahead--multiple.typeahead--has-value .typeahead__input {
|
|
80
|
-
margin-block-end: calc(-1 * var(--size-8)
|
|
77
|
+
margin-block-end: calc(-1 * var(--size-8));
|
|
81
78
|
margin-inline-start: var(--size-4);
|
|
82
79
|
}
|
|
83
80
|
.typeahead--multiple.typeahead--has-value .typeahead__input-wrapper::after {
|
|
84
81
|
content: "";
|
|
85
|
-
block-size:
|
|
82
|
+
block-size: var(--size-8);
|
|
86
83
|
inline-size: 100%;
|
|
87
84
|
}
|
|
88
85
|
.typeahead__input-wrapper {
|
|
@@ -116,7 +113,7 @@
|
|
|
116
113
|
min-block-size: var(--input-height-large);
|
|
117
114
|
}
|
|
118
115
|
.typeahead-lg.typeahead--multiple .typeahead__input {
|
|
119
|
-
padding-block-start:
|
|
116
|
+
padding-block-start: var(--size-8);
|
|
120
117
|
}
|
|
121
118
|
.typeahead-lg.typeahead--multiple .typeahead__input-wrapper {
|
|
122
119
|
padding-block-end: var(--size-8);
|
|
@@ -128,22 +125,6 @@
|
|
|
128
125
|
.typeahead-lg.typeahead--multiple .np-chip {
|
|
129
126
|
margin-block-end: 0;
|
|
130
127
|
}
|
|
131
|
-
@keyframes slide {
|
|
132
|
-
from {
|
|
133
|
-
transform: translateX(-12px);
|
|
134
|
-
}
|
|
135
|
-
to {
|
|
136
|
-
transform: none;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
@keyframes slideFirst {
|
|
140
|
-
from {
|
|
141
|
-
transform: translateX(-4px);
|
|
142
|
-
}
|
|
143
|
-
to {
|
|
144
|
-
transform: none;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
128
|
@keyframes fadeIn {
|
|
148
129
|
from {
|
|
149
130
|
opacity: 0;
|
|
@@ -166,7 +147,7 @@
|
|
|
166
147
|
color: var(--color-interactive-secondary);
|
|
167
148
|
}
|
|
168
149
|
.np-theme-personal .typeahead .np-chip {
|
|
169
|
-
margin-block-start:
|
|
150
|
+
margin-block-start: var(--size-8);
|
|
170
151
|
}
|
|
171
152
|
.np-theme-personal .typeahead .np-chip--removable .np-text-body-default-bold {
|
|
172
153
|
padding-inline-end: var(--size-16);
|
package/build/styles/main.css
CHANGED
|
@@ -25409,12 +25409,6 @@ button.np-link {
|
|
|
25409
25409
|
}
|
|
25410
25410
|
.typeahead--multiple .np-chip {
|
|
25411
25411
|
margin-block-end: auto;
|
|
25412
|
-
animation-name: slide;
|
|
25413
|
-
animation-duration: 0.03s;
|
|
25414
|
-
animation-timing-function: ease-in-out;
|
|
25415
|
-
}
|
|
25416
|
-
.typeahead--multiple .np-chip:first-child {
|
|
25417
|
-
animation-name: slideFirst;
|
|
25418
25412
|
}
|
|
25419
25413
|
.typeahead--multiple .np-chip-remove {
|
|
25420
25414
|
animation-name: fadeIn;
|
|
@@ -25426,7 +25420,10 @@ button.np-link {
|
|
|
25426
25420
|
min-block-size: auto;
|
|
25427
25421
|
padding-block-start: 0;
|
|
25428
25422
|
padding-block-end: 0;
|
|
25429
|
-
overflow:
|
|
25423
|
+
overflow: visible;
|
|
25424
|
+
}
|
|
25425
|
+
.typeahead--multiple .typeahead__input-container--scrollable {
|
|
25426
|
+
overflow-y: auto;
|
|
25430
25427
|
}
|
|
25431
25428
|
.typeahead--multiple .typeahead__input {
|
|
25432
25429
|
border: none;
|
|
@@ -25460,12 +25457,12 @@ button.np-link {
|
|
|
25460
25457
|
padding-inline-start: 0;
|
|
25461
25458
|
}
|
|
25462
25459
|
.typeahead--multiple.typeahead--has-value .typeahead__input {
|
|
25463
|
-
margin-block-end: calc(-1 * var(--size-8)
|
|
25460
|
+
margin-block-end: calc(-1 * var(--size-8));
|
|
25464
25461
|
margin-inline-start: var(--size-4);
|
|
25465
25462
|
}
|
|
25466
25463
|
.typeahead--multiple.typeahead--has-value .typeahead__input-wrapper::after {
|
|
25467
25464
|
content: "";
|
|
25468
|
-
block-size:
|
|
25465
|
+
block-size: var(--size-8);
|
|
25469
25466
|
inline-size: 100%;
|
|
25470
25467
|
}
|
|
25471
25468
|
.typeahead__input-wrapper {
|
|
@@ -25499,7 +25496,7 @@ button.np-link {
|
|
|
25499
25496
|
min-block-size: var(--input-height-large);
|
|
25500
25497
|
}
|
|
25501
25498
|
.typeahead-lg.typeahead--multiple .typeahead__input {
|
|
25502
|
-
padding-block-start:
|
|
25499
|
+
padding-block-start: var(--size-8);
|
|
25503
25500
|
}
|
|
25504
25501
|
.typeahead-lg.typeahead--multiple .typeahead__input-wrapper {
|
|
25505
25502
|
padding-block-end: var(--size-8);
|
|
@@ -25511,22 +25508,6 @@ button.np-link {
|
|
|
25511
25508
|
.typeahead-lg.typeahead--multiple .np-chip {
|
|
25512
25509
|
margin-block-end: 0;
|
|
25513
25510
|
}
|
|
25514
|
-
@keyframes slide {
|
|
25515
|
-
from {
|
|
25516
|
-
transform: translateX(-12px);
|
|
25517
|
-
}
|
|
25518
|
-
to {
|
|
25519
|
-
transform: none;
|
|
25520
|
-
}
|
|
25521
|
-
}
|
|
25522
|
-
@keyframes slideFirst {
|
|
25523
|
-
from {
|
|
25524
|
-
transform: translateX(-4px);
|
|
25525
|
-
}
|
|
25526
|
-
to {
|
|
25527
|
-
transform: none;
|
|
25528
|
-
}
|
|
25529
|
-
}
|
|
25530
25511
|
@keyframes fadeIn {
|
|
25531
25512
|
from {
|
|
25532
25513
|
opacity: 0;
|
|
@@ -25549,7 +25530,7 @@ button.np-link {
|
|
|
25549
25530
|
color: var(--color-interactive-secondary);
|
|
25550
25531
|
}
|
|
25551
25532
|
.np-theme-personal .typeahead .np-chip {
|
|
25552
|
-
margin-block-start:
|
|
25533
|
+
margin-block-start: var(--size-8);
|
|
25553
25534
|
}
|
|
25554
25535
|
.np-theme-personal .typeahead .np-chip--removable .np-text-body-default-bold {
|
|
25555
25536
|
padding-inline-end: var(--size-16);
|
|
@@ -11,7 +11,7 @@ export type BodyProps = HTMLAttributes<HTMLSpanElement | HTMLParagraphElement> &
|
|
|
11
11
|
*/
|
|
12
12
|
preserveNewlines?: boolean;
|
|
13
13
|
};
|
|
14
|
-
declare const Body: import("react").ForwardRefExoticComponent<HTMLAttributes<
|
|
14
|
+
declare const Body: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement | HTMLSpanElement> & {
|
|
15
15
|
/** @default 'body-default' */
|
|
16
16
|
type?: BodyTypes;
|
|
17
17
|
/** @default 'div' */
|
|
@@ -21,6 +21,6 @@ declare const Body: import("react").ForwardRefExoticComponent<HTMLAttributes<HTM
|
|
|
21
21
|
* @default false
|
|
22
22
|
*/
|
|
23
23
|
preserveNewlines?: boolean;
|
|
24
|
-
} & import("react").RefAttributes<HTMLDivElement |
|
|
24
|
+
} & import("react").RefAttributes<HTMLDivElement | HTMLParagraphElement | HTMLSpanElement | null>>;
|
|
25
25
|
export default Body;
|
|
26
26
|
//# sourceMappingURL=Body.d.ts.map
|
|
@@ -16,6 +16,6 @@ declare const IconButton: import("react").ForwardRefExoticComponent<{
|
|
|
16
16
|
/** @default 'default' */
|
|
17
17
|
type?: "default" | "negative";
|
|
18
18
|
'data-testid'?: string;
|
|
19
|
-
} & Pick<AnchorHTMLAttributes<HTMLAnchorElement>, "onClick" | "target" | "href"> & Pick<ButtonHTMLAttributes<HTMLButtonElement>, "disabled" | "onClick"> & Pick<HTMLAttributes<HTMLDivElement>, "
|
|
19
|
+
} & Pick<AnchorHTMLAttributes<HTMLAnchorElement>, "onClick" | "target" | "href"> & Pick<ButtonHTMLAttributes<HTMLButtonElement>, "disabled" | "onClick"> & Pick<HTMLAttributes<HTMLDivElement>, "id" | "className" | "tabIndex" | "role" | "aria-label" | "children"> & import("react").RefAttributes<unknown>>;
|
|
20
20
|
export default IconButton;
|
|
21
21
|
//# sourceMappingURL=IconButton.d.ts.map
|
|
@@ -55,6 +55,7 @@ declare const _default: import("react").FC<{
|
|
|
55
55
|
selectProps?: Partial<SelectInputProps<CurrencyOptionItem>> | undefined;
|
|
56
56
|
amount: number | null;
|
|
57
57
|
searchPlaceholder?: string | undefined;
|
|
58
|
+
decimals?: number | undefined;
|
|
58
59
|
currencies: readonly CurrencyItem[];
|
|
59
60
|
selectedCurrency: CurrencyOptionItem;
|
|
60
61
|
onCurrencyChange?: ((value: CurrencyOptionItem) => void) | undefined;
|
|
@@ -66,7 +67,6 @@ declare const _default: import("react").FC<{
|
|
|
66
67
|
}) => void) | undefined;
|
|
67
68
|
customActionLabel?: import("react").ReactNode;
|
|
68
69
|
onCustomAction?: (() => void) | undefined;
|
|
69
|
-
decimals?: number | undefined;
|
|
70
70
|
}>;
|
|
71
71
|
export default _default;
|
|
72
72
|
//# sourceMappingURL=MoneyInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoneyInput.d.ts","sourceRoot":"","sources":["../../../src/MoneyInput/MoneyInput.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAc,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE9E,OAAO,EAGL,SAAS,EACT,UAAU,EACV,SAAS,EAEV,MAAM,WAAW,CAAC;AACnB,OAAO,EAAuB,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAEnF,OAAO,EAKL,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAO/B,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM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AAE,MAAM,GAAG,IAAI,KAAK,IAAI;;sBAM9B,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,YAAY,EAAE,CAAA;KAAE,KAAK,IAAI;;sBAEzE,MAAM,IAAI;;AAkb7B,wBAA2F"}
|
|
@@ -10,7 +10,7 @@ export type TitleProps = LabelHTMLAttributes<HTMLHeadingElement | HTMLSpanElemen
|
|
|
10
10
|
*/
|
|
11
11
|
type?: TitleTypes;
|
|
12
12
|
};
|
|
13
|
-
declare const Title: React.ForwardRefExoticComponent<React.LabelHTMLAttributes<
|
|
13
|
+
declare const Title: React.ForwardRefExoticComponent<React.LabelHTMLAttributes<HTMLHeadingElement | HTMLLabelElement | HTMLSpanElement> & React.LiHTMLAttributes<HTMLLIElement> & {
|
|
14
14
|
/**
|
|
15
15
|
* Default value will based one `type` prop
|
|
16
16
|
*/
|
|
@@ -19,6 +19,6 @@ declare const Title: React.ForwardRefExoticComponent<React.LabelHTMLAttributes<H
|
|
|
19
19
|
* Default value: {@link DEFAULT_TYPE}
|
|
20
20
|
*/
|
|
21
21
|
type?: TitleTypes;
|
|
22
|
-
} & React.RefAttributes<
|
|
22
|
+
} & React.RefAttributes<HTMLHeadingElement | HTMLLabelElement | HTMLLegendElement | HTMLLIElement | HTMLSpanElement>>;
|
|
23
23
|
export default Title;
|
|
24
24
|
//# sourceMappingURL=Title.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeaheadInput.d.ts","sourceRoot":"","sources":["../../../../src/Typeahead/TypeaheadInput/TypeaheadInput.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAa,SAAS,EAAE,MAAM,OAAO,CAAC;AAGxD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAM/D,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAA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B,aAId;IAEF,WAAW,GAAI,OAAO,OAAO,iCA+C3B;IAEF,MAAM;CAmCP"}
|
|
@@ -15,7 +15,7 @@ export default class UploadImageStep extends PureComponent<UploadImageStepProps>
|
|
|
15
15
|
uploadInputRef: import("react").RefObject<HTMLInputElement>;
|
|
16
16
|
onManualUpload: () => void;
|
|
17
17
|
onKeyDown: (event: React.KeyboardEvent<HTMLLabelElement>) => void;
|
|
18
|
-
getImage: () => number | true | import("react").
|
|
18
|
+
getImage: () => number | true | Iterable<import("react").ReactNode> | import("react").JSX.Element;
|
|
19
19
|
render(): import("react").JSX.Element;
|
|
20
20
|
}
|
|
21
21
|
//# sourceMappingURL=UploadImageStep.d.ts.map
|
|
@@ -5,5 +5,5 @@ export declare const UploadItemLink: import("react").ForwardRefExoticComponent<{
|
|
|
5
5
|
singleFileUpload: boolean;
|
|
6
6
|
} & {
|
|
7
7
|
children?: import("react").ReactNode | undefined;
|
|
8
|
-
} & import("react").RefAttributes<
|
|
8
|
+
} & import("react").RefAttributes<HTMLAnchorElement | HTMLDivElement>>;
|
|
9
9
|
//# sourceMappingURL=UploadItemLink.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "46.165.
|
|
3
|
+
"version": "46.165.5",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"lodash.debounce": "^4.0.8",
|
|
122
122
|
"merge-props": "^6.0.0",
|
|
123
123
|
"react-transition-group": "^4.4.5",
|
|
124
|
-
"virtua": "^0.
|
|
124
|
+
"virtua": "^0.53.3"
|
|
125
125
|
},
|
|
126
126
|
"publishConfig": {
|
|
127
127
|
"access": "public",
|
|
@@ -222,7 +222,7 @@ export const RTLDiff: Story = {
|
|
|
222
222
|
);
|
|
223
223
|
},
|
|
224
224
|
...withRTLDiff({
|
|
225
|
-
fixedRows: { heights:
|
|
225
|
+
fixedRows: { heights: 'auto' },
|
|
226
226
|
i18n: {
|
|
227
227
|
fullName: { en: 'Full name', ar: 'الاسم الكامل' },
|
|
228
228
|
customerName: { en: 'Alice Smith', ar: 'أليس سميث' },
|
|
@@ -151,7 +151,7 @@ export const RTLDiff: Story = {
|
|
|
151
151
|
);
|
|
152
152
|
},
|
|
153
153
|
...withRTLDiff({
|
|
154
|
-
fixedRows: { heights:
|
|
154
|
+
fixedRows: { heights: 'auto', hideSeparators: true },
|
|
155
155
|
i18n: {
|
|
156
156
|
groupWithoutAction: { en: 'Group level without action', ar: 'مستوى المجموعة بدون إجراء' },
|
|
157
157
|
groupWithAction: { en: 'Group level with action', ar: 'مستوى المجموعة مع إجراء' },
|
|
@@ -15,7 +15,7 @@ export const RTLDiff: Story = {
|
|
|
15
15
|
render: () => {
|
|
16
16
|
const i18n = useRtlDiffI18n();
|
|
17
17
|
return (
|
|
18
|
-
<div
|
|
18
|
+
<div>
|
|
19
19
|
<InstructionsList
|
|
20
20
|
dos={[i18n.initialTransfer, i18n.inviteFriends]}
|
|
21
21
|
donts={[i18n.hiddenFees, i18n.badExchangeRate]}
|
|
@@ -30,6 +30,7 @@ export const RTLDiff: Story = {
|
|
|
30
30
|
);
|
|
31
31
|
},
|
|
32
32
|
...withRTLDiff({
|
|
33
|
+
fixedRows: { heights: 'auto' },
|
|
33
34
|
i18n: {
|
|
34
35
|
initialTransfer: {
|
|
35
36
|
en: 'Do an initial money transfer',
|
|
@@ -128,12 +128,7 @@ export default {
|
|
|
128
128
|
...withRTLDiff({
|
|
129
129
|
width: 'stretch',
|
|
130
130
|
i18n: i18nMap,
|
|
131
|
-
fixedRows: {
|
|
132
|
-
heights: [
|
|
133
|
-
4, 6, 4, 6, 7, 5, 7, 5, 5, 7, 5, 5, 5, 5, 13, 5, 5, 8, 4, 7, 7, 6, 7, 5, 9, 5, 5, 5, 5, 5,
|
|
134
|
-
5, 5, 6, 6, 6, 14, 8, 8, 8, 8, 8, 8,
|
|
135
|
-
],
|
|
136
|
-
},
|
|
131
|
+
fixedRows: { heights: 'auto' },
|
|
137
132
|
}),
|
|
138
133
|
} satisfies Meta<ListItemProps>;
|
|
139
134
|
|
|
@@ -583,6 +583,7 @@ export const RTLDiff: Story = {
|
|
|
583
583
|
);
|
|
584
584
|
},
|
|
585
585
|
...withRTLDiff({
|
|
586
|
+
fixedRows: { heights: 'auto' },
|
|
586
587
|
i18n: {
|
|
587
588
|
basicDescription: { en: 'Basic description only.', ar: 'الوصف الأساسي فقط.' },
|
|
588
589
|
withTitleHeading: { en: 'With Title', ar: 'مع عنوان' },
|
|
@@ -88,23 +88,34 @@ export const RTLDiff: Story = {
|
|
|
88
88
|
|
|
89
89
|
return (
|
|
90
90
|
<>
|
|
91
|
-
<
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
91
|
+
<div>
|
|
92
|
+
<Table data={{ headers, rows }} />
|
|
93
|
+
</div>
|
|
94
|
+
<div>
|
|
95
|
+
<Table
|
|
96
|
+
data={{
|
|
97
|
+
headers,
|
|
98
|
+
rows,
|
|
99
|
+
onRowClick: (rowData: TableRowType | TableRowClickableType) => {
|
|
100
|
+
void rowData;
|
|
101
|
+
},
|
|
102
|
+
}}
|
|
103
|
+
/>
|
|
104
|
+
</div>
|
|
105
|
+
<div>
|
|
106
|
+
<Table data={{ headers, rows }} fullWidth={false} />
|
|
107
|
+
</div>
|
|
108
|
+
<div>
|
|
109
|
+
<Table data={{ headers, rows: [] }} />
|
|
110
|
+
</div>
|
|
111
|
+
<div>
|
|
112
|
+
<Table data={{ headers, rows }} loading />
|
|
113
|
+
</div>
|
|
104
114
|
</>
|
|
105
115
|
);
|
|
106
116
|
},
|
|
107
117
|
...withRTLDiff({
|
|
118
|
+
fixedRows: { heights: 'auto' },
|
|
108
119
|
i18n: {
|
|
109
120
|
employeeHeader: { en: 'Employee', ar: 'الموظف' },
|
|
110
121
|
locationHeader: { en: 'Location', ar: 'الموقع' },
|
|
@@ -84,7 +84,7 @@ export const RTLDiff: Story = {
|
|
|
84
84
|
);
|
|
85
85
|
},
|
|
86
86
|
...withRTLDiff({
|
|
87
|
-
fixedRows: { heights:
|
|
87
|
+
fixedRows: { heights: 'auto' },
|
|
88
88
|
i18n: {
|
|
89
89
|
firstTab: { en: 'First tab', ar: 'التبويب الأول' },
|
|
90
90
|
secondTab: { en: 'Second tab', ar: 'التبويب الثاني' },
|
|
@@ -26,12 +26,6 @@
|
|
|
26
26
|
}
|
|
27
27
|
.typeahead--multiple .np-chip {
|
|
28
28
|
margin-block-end: auto;
|
|
29
|
-
animation-name: slide;
|
|
30
|
-
animation-duration: 0.03s;
|
|
31
|
-
animation-timing-function: ease-in-out;
|
|
32
|
-
}
|
|
33
|
-
.typeahead--multiple .np-chip:first-child {
|
|
34
|
-
animation-name: slideFirst;
|
|
35
29
|
}
|
|
36
30
|
.typeahead--multiple .np-chip-remove {
|
|
37
31
|
animation-name: fadeIn;
|
|
@@ -43,7 +37,10 @@
|
|
|
43
37
|
min-block-size: auto;
|
|
44
38
|
padding-block-start: 0;
|
|
45
39
|
padding-block-end: 0;
|
|
46
|
-
overflow:
|
|
40
|
+
overflow: visible;
|
|
41
|
+
}
|
|
42
|
+
.typeahead--multiple .typeahead__input-container--scrollable {
|
|
43
|
+
overflow-y: auto;
|
|
47
44
|
}
|
|
48
45
|
.typeahead--multiple .typeahead__input {
|
|
49
46
|
border: none;
|
|
@@ -77,12 +74,12 @@
|
|
|
77
74
|
padding-inline-start: 0;
|
|
78
75
|
}
|
|
79
76
|
.typeahead--multiple.typeahead--has-value .typeahead__input {
|
|
80
|
-
margin-block-end: calc(-1 * var(--size-8)
|
|
77
|
+
margin-block-end: calc(-1 * var(--size-8));
|
|
81
78
|
margin-inline-start: var(--size-4);
|
|
82
79
|
}
|
|
83
80
|
.typeahead--multiple.typeahead--has-value .typeahead__input-wrapper::after {
|
|
84
81
|
content: "";
|
|
85
|
-
block-size:
|
|
82
|
+
block-size: var(--size-8);
|
|
86
83
|
inline-size: 100%;
|
|
87
84
|
}
|
|
88
85
|
.typeahead__input-wrapper {
|
|
@@ -116,7 +113,7 @@
|
|
|
116
113
|
min-block-size: var(--input-height-large);
|
|
117
114
|
}
|
|
118
115
|
.typeahead-lg.typeahead--multiple .typeahead__input {
|
|
119
|
-
padding-block-start:
|
|
116
|
+
padding-block-start: var(--size-8);
|
|
120
117
|
}
|
|
121
118
|
.typeahead-lg.typeahead--multiple .typeahead__input-wrapper {
|
|
122
119
|
padding-block-end: var(--size-8);
|
|
@@ -128,22 +125,6 @@
|
|
|
128
125
|
.typeahead-lg.typeahead--multiple .np-chip {
|
|
129
126
|
margin-block-end: 0;
|
|
130
127
|
}
|
|
131
|
-
@keyframes slide {
|
|
132
|
-
from {
|
|
133
|
-
transform: translateX(-12px);
|
|
134
|
-
}
|
|
135
|
-
to {
|
|
136
|
-
transform: none;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
@keyframes slideFirst {
|
|
140
|
-
from {
|
|
141
|
-
transform: translateX(-4px);
|
|
142
|
-
}
|
|
143
|
-
to {
|
|
144
|
-
transform: none;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
128
|
@keyframes fadeIn {
|
|
148
129
|
from {
|
|
149
130
|
opacity: 0;
|
|
@@ -166,7 +147,7 @@
|
|
|
166
147
|
color: var(--color-interactive-secondary);
|
|
167
148
|
}
|
|
168
149
|
.np-theme-personal .typeahead .np-chip {
|
|
169
|
-
margin-block-start:
|
|
150
|
+
margin-block-start: var(--size-8);
|
|
170
151
|
}
|
|
171
152
|
.np-theme-personal .typeahead .np-chip--removable .np-text-body-default-bold {
|
|
172
153
|
padding-inline-end: var(--size-16);
|
|
@@ -35,13 +35,6 @@
|
|
|
35
35
|
&--multiple {
|
|
36
36
|
.np-chip {
|
|
37
37
|
margin-bottom: auto;
|
|
38
|
-
animation-name: slide;
|
|
39
|
-
animation-duration: @animation-duration;
|
|
40
|
-
animation-timing-function: @animation-timing-function;
|
|
41
|
-
|
|
42
|
-
&:first-child {
|
|
43
|
-
animation-name: slideFirst;
|
|
44
|
-
}
|
|
45
38
|
|
|
46
39
|
&-remove {
|
|
47
40
|
animation-name: fadeIn;
|
|
@@ -55,7 +48,11 @@
|
|
|
55
48
|
min-height: auto;
|
|
56
49
|
padding-top: 0;
|
|
57
50
|
padding-bottom: 0;
|
|
58
|
-
overflow:
|
|
51
|
+
overflow: visible;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.typeahead__input-container--scrollable {
|
|
55
|
+
overflow-y: auto;
|
|
59
56
|
}
|
|
60
57
|
|
|
61
58
|
.typeahead__input {
|
|
@@ -98,14 +95,14 @@
|
|
|
98
95
|
}
|
|
99
96
|
|
|
100
97
|
.typeahead__input {
|
|
101
|
-
margin-bottom: calc(-1 * var(--size-8)
|
|
98
|
+
margin-bottom: calc(-1 * var(--size-8));
|
|
102
99
|
margin-left: var(--size-4);
|
|
103
100
|
}
|
|
104
101
|
|
|
105
102
|
.typeahead__input-wrapper {
|
|
106
103
|
&::after {
|
|
107
104
|
content: "";
|
|
108
|
-
height:
|
|
105
|
+
height: var(--size-8);
|
|
109
106
|
width: 100%;
|
|
110
107
|
}
|
|
111
108
|
}
|
|
@@ -165,7 +162,7 @@
|
|
|
165
162
|
}
|
|
166
163
|
|
|
167
164
|
.typeahead__input {
|
|
168
|
-
padding-top:
|
|
165
|
+
padding-top: var(--size-8);
|
|
169
166
|
}
|
|
170
167
|
|
|
171
168
|
.typeahead__input-wrapper {
|
|
@@ -183,26 +180,6 @@
|
|
|
183
180
|
}
|
|
184
181
|
}
|
|
185
182
|
|
|
186
|
-
@keyframes slide {
|
|
187
|
-
from {
|
|
188
|
-
transform: translateX(-12px);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
to {
|
|
192
|
-
transform: none;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
@keyframes slideFirst {
|
|
197
|
-
from {
|
|
198
|
-
transform: translateX(-4px);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
to {
|
|
202
|
-
transform: none;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
183
|
@keyframes fadeIn {
|
|
207
184
|
from {
|
|
208
185
|
opacity: 0;
|
|
@@ -229,7 +206,7 @@
|
|
|
229
206
|
color: var(--color-interactive-secondary);
|
|
230
207
|
}
|
|
231
208
|
.np-chip {
|
|
232
|
-
margin-top:
|
|
209
|
+
margin-top: var(--size-8);
|
|
233
210
|
}
|
|
234
211
|
.np-chip--removable {
|
|
235
212
|
.np-text-body-default-bold {
|
|
@@ -65,10 +65,8 @@ export default class TypeaheadInput<T> extends Component<
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
recalculateWidth = () => {
|
|
68
|
-
|
|
69
|
-
this.
|
|
70
|
-
inputWidth: Math.max(DEFAULT_INPUT_MIN_WIDTH, this.sizerRef.current?.scrollWidth ?? 0 + 10),
|
|
71
|
-
});
|
|
68
|
+
this.setState({
|
|
69
|
+
inputWidth: Math.max(DEFAULT_INPUT_MIN_WIDTH, (this.sizerRef.current?.scrollWidth ?? 0) + 10),
|
|
72
70
|
});
|
|
73
71
|
};
|
|
74
72
|
|
|
@@ -131,7 +129,9 @@ export default class TypeaheadInput<T> extends Component<
|
|
|
131
129
|
|
|
132
130
|
return multiple ? (
|
|
133
131
|
<div
|
|
134
|
-
className=
|
|
132
|
+
className={clsx('form-control typeahead__input-container', {
|
|
133
|
+
'typeahead__input-container--scrollable': maxHeight != null,
|
|
134
|
+
})}
|
|
135
135
|
style={{ maxHeight }}
|
|
136
136
|
onClick={() => {
|
|
137
137
|
this.inputRef.current?.focus();
|
|
@@ -87,7 +87,7 @@ export const TriggerVariants: Story = {
|
|
|
87
87
|
</>
|
|
88
88
|
);
|
|
89
89
|
},
|
|
90
|
-
...withRTLDiff({ width: '80%', i18n: localisedStrings }),
|
|
90
|
+
...withRTLDiff({ fixedRows: { heights: 'auto' }, width: '80%', i18n: localisedStrings }),
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
export const OpenDropdown: Story = {
|
|
@@ -112,3 +112,68 @@ export const AutoFocusInModal: Story = {
|
|
|
112
112
|
);
|
|
113
113
|
},
|
|
114
114
|
};
|
|
115
|
+
|
|
116
|
+
const testEmails = [
|
|
117
|
+
{ label: 'alex@example.com' },
|
|
118
|
+
{ label: 'bruno.silva@example.com' },
|
|
119
|
+
{ label: 'chen@example.com' },
|
|
120
|
+
{ label: 'dana.khan@example.com' },
|
|
121
|
+
{ label: 'emeka@example.com' },
|
|
122
|
+
];
|
|
123
|
+
|
|
124
|
+
export const Chips: Story = {
|
|
125
|
+
render: () => (
|
|
126
|
+
<div className="d-flex flex-column">
|
|
127
|
+
<Field id="typeahead-chips-one-row" label="One row">
|
|
128
|
+
<Typeahead
|
|
129
|
+
id="typeahead-chips-one-row"
|
|
130
|
+
name="typeahead-chips-one-row"
|
|
131
|
+
multiple
|
|
132
|
+
allowNew
|
|
133
|
+
showSuggestions={false}
|
|
134
|
+
initialValue={testEmails.slice(0, 2)}
|
|
135
|
+
options={[]}
|
|
136
|
+
onChange={() => {}}
|
|
137
|
+
/>
|
|
138
|
+
</Field>
|
|
139
|
+
<Field id="typeahead-chips-wrapped" label="Wrapped over several rows">
|
|
140
|
+
<Typeahead
|
|
141
|
+
id="typeahead-chips-wrapped"
|
|
142
|
+
name="typeahead-chips-wrapped"
|
|
143
|
+
multiple
|
|
144
|
+
allowNew
|
|
145
|
+
showSuggestions={false}
|
|
146
|
+
initialValue={testEmails}
|
|
147
|
+
options={[]}
|
|
148
|
+
onChange={() => {}}
|
|
149
|
+
/>
|
|
150
|
+
</Field>
|
|
151
|
+
<Field id="typeahead-chips-capped" label="Capped with maxHeight">
|
|
152
|
+
<Typeahead
|
|
153
|
+
id="typeahead-chips-capped"
|
|
154
|
+
name="typeahead-chips-capped"
|
|
155
|
+
multiple
|
|
156
|
+
allowNew
|
|
157
|
+
showSuggestions={false}
|
|
158
|
+
maxHeight={100}
|
|
159
|
+
initialValue={testEmails}
|
|
160
|
+
options={[]}
|
|
161
|
+
onChange={() => {}}
|
|
162
|
+
/>
|
|
163
|
+
</Field>
|
|
164
|
+
<Field id="typeahead-chips-large" label="Large">
|
|
165
|
+
<Typeahead
|
|
166
|
+
id="typeahead-chips-large"
|
|
167
|
+
name="typeahead-chips-large"
|
|
168
|
+
size="lg"
|
|
169
|
+
multiple
|
|
170
|
+
allowNew
|
|
171
|
+
showSuggestions={false}
|
|
172
|
+
initialValue={testEmails.slice(0, 2)}
|
|
173
|
+
options={[]}
|
|
174
|
+
onChange={() => {}}
|
|
175
|
+
/>
|
|
176
|
+
</Field>
|
|
177
|
+
</div>
|
|
178
|
+
),
|
|
179
|
+
};
|
package/src/main.css
CHANGED
|
@@ -25409,12 +25409,6 @@ button.np-link {
|
|
|
25409
25409
|
}
|
|
25410
25410
|
.typeahead--multiple .np-chip {
|
|
25411
25411
|
margin-block-end: auto;
|
|
25412
|
-
animation-name: slide;
|
|
25413
|
-
animation-duration: 0.03s;
|
|
25414
|
-
animation-timing-function: ease-in-out;
|
|
25415
|
-
}
|
|
25416
|
-
.typeahead--multiple .np-chip:first-child {
|
|
25417
|
-
animation-name: slideFirst;
|
|
25418
25412
|
}
|
|
25419
25413
|
.typeahead--multiple .np-chip-remove {
|
|
25420
25414
|
animation-name: fadeIn;
|
|
@@ -25426,7 +25420,10 @@ button.np-link {
|
|
|
25426
25420
|
min-block-size: auto;
|
|
25427
25421
|
padding-block-start: 0;
|
|
25428
25422
|
padding-block-end: 0;
|
|
25429
|
-
overflow:
|
|
25423
|
+
overflow: visible;
|
|
25424
|
+
}
|
|
25425
|
+
.typeahead--multiple .typeahead__input-container--scrollable {
|
|
25426
|
+
overflow-y: auto;
|
|
25430
25427
|
}
|
|
25431
25428
|
.typeahead--multiple .typeahead__input {
|
|
25432
25429
|
border: none;
|
|
@@ -25460,12 +25457,12 @@ button.np-link {
|
|
|
25460
25457
|
padding-inline-start: 0;
|
|
25461
25458
|
}
|
|
25462
25459
|
.typeahead--multiple.typeahead--has-value .typeahead__input {
|
|
25463
|
-
margin-block-end: calc(-1 * var(--size-8)
|
|
25460
|
+
margin-block-end: calc(-1 * var(--size-8));
|
|
25464
25461
|
margin-inline-start: var(--size-4);
|
|
25465
25462
|
}
|
|
25466
25463
|
.typeahead--multiple.typeahead--has-value .typeahead__input-wrapper::after {
|
|
25467
25464
|
content: "";
|
|
25468
|
-
block-size:
|
|
25465
|
+
block-size: var(--size-8);
|
|
25469
25466
|
inline-size: 100%;
|
|
25470
25467
|
}
|
|
25471
25468
|
.typeahead__input-wrapper {
|
|
@@ -25499,7 +25496,7 @@ button.np-link {
|
|
|
25499
25496
|
min-block-size: var(--input-height-large);
|
|
25500
25497
|
}
|
|
25501
25498
|
.typeahead-lg.typeahead--multiple .typeahead__input {
|
|
25502
|
-
padding-block-start:
|
|
25499
|
+
padding-block-start: var(--size-8);
|
|
25503
25500
|
}
|
|
25504
25501
|
.typeahead-lg.typeahead--multiple .typeahead__input-wrapper {
|
|
25505
25502
|
padding-block-end: var(--size-8);
|
|
@@ -25511,22 +25508,6 @@ button.np-link {
|
|
|
25511
25508
|
.typeahead-lg.typeahead--multiple .np-chip {
|
|
25512
25509
|
margin-block-end: 0;
|
|
25513
25510
|
}
|
|
25514
|
-
@keyframes slide {
|
|
25515
|
-
from {
|
|
25516
|
-
transform: translateX(-12px);
|
|
25517
|
-
}
|
|
25518
|
-
to {
|
|
25519
|
-
transform: none;
|
|
25520
|
-
}
|
|
25521
|
-
}
|
|
25522
|
-
@keyframes slideFirst {
|
|
25523
|
-
from {
|
|
25524
|
-
transform: translateX(-4px);
|
|
25525
|
-
}
|
|
25526
|
-
to {
|
|
25527
|
-
transform: none;
|
|
25528
|
-
}
|
|
25529
|
-
}
|
|
25530
25511
|
@keyframes fadeIn {
|
|
25531
25512
|
from {
|
|
25532
25513
|
opacity: 0;
|
|
@@ -25549,7 +25530,7 @@ button.np-link {
|
|
|
25549
25530
|
color: var(--color-interactive-secondary);
|
|
25550
25531
|
}
|
|
25551
25532
|
.np-theme-personal .typeahead .np-chip {
|
|
25552
|
-
margin-block-start:
|
|
25533
|
+
margin-block-start: var(--size-8);
|
|
25553
25534
|
}
|
|
25554
25535
|
.np-theme-personal .typeahead .np-chip--removable .np-text-body-default-bold {
|
|
25555
25536
|
padding-inline-end: var(--size-16);
|