@transferwise/components 46.42.1 → 46.44.0
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/index.js +91 -64
- package/build/index.js.map +1 -1
- package/build/index.mjs +91 -64
- package/build/index.mjs.map +1 -1
- package/build/main.css +9 -2
- package/build/styles/carousel/Carousel.css +9 -2
- package/build/styles/main.css +9 -2
- package/build/types/carousel/Carousel.d.ts +1 -0
- package/build/types/carousel/Carousel.d.ts.map +1 -1
- package/build/types/checkboxButton/CheckboxButton.d.ts.map +1 -1
- package/build/types/field/Field.d.ts +2 -1
- package/build/types/field/Field.d.ts.map +1 -1
- package/build/types/inputs/InputGroup.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts +3 -1
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/carousel/Carousel.css +9 -2
- package/src/carousel/Carousel.less +10 -1
- package/src/carousel/Carousel.story.tsx +1 -0
- package/src/carousel/Carousel.tsx +2 -0
- package/src/checkbox/Checkbox.spec.tsx +13 -0
- package/src/checkbox/Checkbox.story.tsx +13 -0
- package/src/checkboxButton/CheckboxButton.tsx +12 -4
- package/src/field/Field.tsx +11 -5
- package/src/inputs/InputGroup.spec.tsx +26 -0
- package/src/inputs/InputGroup.tsx +35 -13
- package/src/inputs/SearchInput.spec.tsx +16 -0
- package/src/inputs/SelectInput.spec.tsx +1 -1
- package/src/inputs/SelectInput.tsx +4 -1
- package/src/main.css +9 -2
package/build/index.mjs
CHANGED
|
@@ -2145,6 +2145,7 @@ const Carousel = ({
|
|
|
2145
2145
|
}
|
|
2146
2146
|
},
|
|
2147
2147
|
href: card.href,
|
|
2148
|
+
target: card.hrefTarget,
|
|
2148
2149
|
rel: "noreferrer",
|
|
2149
2150
|
onKeyDown: event => handleOnKeyDown(event, index),
|
|
2150
2151
|
children: cardContent
|
|
@@ -2227,28 +2228,62 @@ const Card = /*#__PURE__*/forwardRef(function Card({
|
|
|
2227
2228
|
});
|
|
2228
2229
|
});
|
|
2229
2230
|
|
|
2230
|
-
const
|
|
2231
|
+
const FieldLabelIdContext = /*#__PURE__*/createContext(undefined);
|
|
2232
|
+
const FieldLabelIdContextProvider = FieldLabelIdContext.Provider;
|
|
2233
|
+
const InputIdContext = /*#__PURE__*/createContext(undefined);
|
|
2234
|
+
const InputIdContextProvider = InputIdContext.Provider;
|
|
2235
|
+
const InputDescribedByContext = /*#__PURE__*/createContext(undefined);
|
|
2236
|
+
const InputDescribedByProvider = InputDescribedByContext.Provider;
|
|
2237
|
+
const InputInvalidContext = /*#__PURE__*/createContext(undefined);
|
|
2238
|
+
const InputInvalidProvider = InputInvalidContext.Provider;
|
|
2239
|
+
function useInputAttributes({
|
|
2240
|
+
nonLabelable
|
|
2241
|
+
} = {}) {
|
|
2242
|
+
const labelId = useContext(FieldLabelIdContext);
|
|
2243
|
+
return {
|
|
2244
|
+
id: useContext(InputIdContext),
|
|
2245
|
+
'aria-labelledby': nonLabelable ? labelId : undefined,
|
|
2246
|
+
'aria-describedby': useContext(InputDescribedByContext),
|
|
2247
|
+
'aria-invalid': useContext(InputInvalidContext)
|
|
2248
|
+
};
|
|
2249
|
+
}
|
|
2250
|
+
function withInputAttributes(Component, args) {
|
|
2251
|
+
function ComponentWithInputAttributes(props) {
|
|
2252
|
+
return /*#__PURE__*/jsx(Component, {
|
|
2253
|
+
inputAttributes: useInputAttributes(args),
|
|
2254
|
+
...props
|
|
2255
|
+
});
|
|
2256
|
+
}
|
|
2257
|
+
ComponentWithInputAttributes.displayName = `withInputAttributes(${Component.displayName || Component.name || 'Component'})`;
|
|
2258
|
+
return ComponentWithInputAttributes;
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
const CheckboxButton = /*#__PURE__*/forwardRef(function CheckboxButton({
|
|
2231
2262
|
checked,
|
|
2232
2263
|
className,
|
|
2233
2264
|
disabled,
|
|
2234
2265
|
onChange,
|
|
2235
2266
|
...rest
|
|
2236
|
-
}, reference)
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2267
|
+
}, reference) {
|
|
2268
|
+
const inputAttributes = useInputAttributes();
|
|
2269
|
+
return /*#__PURE__*/jsxs("span", {
|
|
2270
|
+
className: classNames('np-checkbox-button', className, disabled && 'disabled'),
|
|
2271
|
+
children: [/*#__PURE__*/jsx("input", {
|
|
2272
|
+
...inputAttributes,
|
|
2273
|
+
...rest,
|
|
2274
|
+
ref: reference,
|
|
2275
|
+
type: "checkbox",
|
|
2276
|
+
disabled: disabled,
|
|
2277
|
+
checked: checked,
|
|
2278
|
+
onChange: onChange
|
|
2279
|
+
}), /*#__PURE__*/jsx("span", {
|
|
2280
|
+
className: "tw-checkbox-button",
|
|
2281
|
+
children: /*#__PURE__*/jsx("span", {
|
|
2282
|
+
className: "tw-checkbox-check"
|
|
2283
|
+
})
|
|
2284
|
+
})]
|
|
2285
|
+
});
|
|
2286
|
+
});
|
|
2252
2287
|
|
|
2253
2288
|
function Checkbox({
|
|
2254
2289
|
id,
|
|
@@ -3049,36 +3084,6 @@ const isMonthAndYearFormat = dateString => validDateString(dateString) && dateSt
|
|
|
3049
3084
|
const MDY = new Set(['en-US']);
|
|
3050
3085
|
const YMD = new Set(['hu', 'hu-HU', 'zh-HK', 'zh-CN', 'ja', 'ja-JP']);
|
|
3051
3086
|
|
|
3052
|
-
const FieldLabelIdContext = /*#__PURE__*/createContext(undefined);
|
|
3053
|
-
const FieldLabelIdContextProvider = FieldLabelIdContext.Provider;
|
|
3054
|
-
const InputIdContext = /*#__PURE__*/createContext(undefined);
|
|
3055
|
-
const InputIdContextProvider = InputIdContext.Provider;
|
|
3056
|
-
const InputDescribedByContext = /*#__PURE__*/createContext(undefined);
|
|
3057
|
-
const InputDescribedByProvider = InputDescribedByContext.Provider;
|
|
3058
|
-
const InputInvalidContext = /*#__PURE__*/createContext(undefined);
|
|
3059
|
-
const InputInvalidProvider = InputInvalidContext.Provider;
|
|
3060
|
-
function useInputAttributes({
|
|
3061
|
-
nonLabelable
|
|
3062
|
-
} = {}) {
|
|
3063
|
-
const labelId = useContext(FieldLabelIdContext);
|
|
3064
|
-
return {
|
|
3065
|
-
id: useContext(InputIdContext),
|
|
3066
|
-
'aria-labelledby': nonLabelable ? labelId : undefined,
|
|
3067
|
-
'aria-describedby': useContext(InputDescribedByContext),
|
|
3068
|
-
'aria-invalid': useContext(InputInvalidContext)
|
|
3069
|
-
};
|
|
3070
|
-
}
|
|
3071
|
-
function withInputAttributes(Component, args) {
|
|
3072
|
-
function ComponentWithInputAttributes(props) {
|
|
3073
|
-
return /*#__PURE__*/jsx(Component, {
|
|
3074
|
-
inputAttributes: useInputAttributes(args),
|
|
3075
|
-
...props
|
|
3076
|
-
});
|
|
3077
|
-
}
|
|
3078
|
-
ComponentWithInputAttributes.displayName = `withInputAttributes(${Component.displayName || Component.name || 'Component'})`;
|
|
3079
|
-
return ComponentWithInputAttributes;
|
|
3080
|
-
}
|
|
3081
|
-
|
|
3082
3087
|
var messages$9 = defineMessages({
|
|
3083
3088
|
monthLabel: {
|
|
3084
3089
|
id: "neptune.DateInput.month.label"
|
|
@@ -4896,11 +4901,11 @@ const Field = ({
|
|
|
4896
4901
|
'has-error': hasError,
|
|
4897
4902
|
'has-info': sentiment === Sentiment.NEUTRAL
|
|
4898
4903
|
}, className),
|
|
4899
|
-
children: [/*#__PURE__*/jsxs(Label, {
|
|
4904
|
+
children: [label != null ? /*#__PURE__*/jsxs(Label, {
|
|
4900
4905
|
id: labelId,
|
|
4901
4906
|
htmlFor: inputId,
|
|
4902
4907
|
children: [label, children]
|
|
4903
|
-
}), message && /*#__PURE__*/jsx(InlineAlert, {
|
|
4908
|
+
}) : children, message && /*#__PURE__*/jsx(InlineAlert, {
|
|
4904
4909
|
type: sentiment,
|
|
4905
4910
|
id: descriptionId,
|
|
4906
4911
|
children: message
|
|
@@ -5737,25 +5742,45 @@ function InputGroup({
|
|
|
5737
5742
|
className,
|
|
5738
5743
|
children
|
|
5739
5744
|
}) {
|
|
5745
|
+
const inputAttributes = useInputAttributes({
|
|
5746
|
+
nonLabelable: true
|
|
5747
|
+
});
|
|
5740
5748
|
const [paddingStart, setPaddingStart] = useState(inputPaddingInitialState(addonStart));
|
|
5741
5749
|
const [paddingEnd, setPaddingEnd] = useState(inputPaddingInitialState(addonEnd));
|
|
5742
|
-
return
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
children:
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5750
|
+
return (
|
|
5751
|
+
/*#__PURE__*/
|
|
5752
|
+
/* Prevent nested controls from being labeled redundantly */
|
|
5753
|
+
jsx(FieldLabelIdContextProvider, {
|
|
5754
|
+
value: undefined,
|
|
5755
|
+
children: /*#__PURE__*/jsx(InputIdContextProvider, {
|
|
5756
|
+
value: undefined,
|
|
5757
|
+
children: /*#__PURE__*/jsx(InputDescribedByProvider, {
|
|
5758
|
+
value: undefined,
|
|
5759
|
+
children: /*#__PURE__*/jsx(InputInvalidProvider, {
|
|
5760
|
+
value: undefined,
|
|
5761
|
+
children: /*#__PURE__*/jsx(InputPaddingStartContext.Provider, {
|
|
5762
|
+
value: useMemo(() => [paddingStart, setPaddingStart], [paddingStart]),
|
|
5763
|
+
children: /*#__PURE__*/jsx(InputPaddingEndContext.Provider, {
|
|
5764
|
+
value: useMemo(() => [paddingEnd, setPaddingEnd], [paddingEnd]),
|
|
5765
|
+
children: /*#__PURE__*/jsxs("fieldset", {
|
|
5766
|
+
...inputAttributes,
|
|
5767
|
+
disabled: disabled,
|
|
5768
|
+
className: classNames(className, 'np-input-group'),
|
|
5769
|
+
children: [addonStart != null ? /*#__PURE__*/jsx(InputAddon, {
|
|
5770
|
+
placement: "start",
|
|
5771
|
+
...addonStart
|
|
5772
|
+
}) : null, children, addonEnd != null ? /*#__PURE__*/jsx(InputAddon, {
|
|
5773
|
+
placement: "end",
|
|
5774
|
+
...addonEnd
|
|
5775
|
+
}) : null]
|
|
5776
|
+
})
|
|
5777
|
+
})
|
|
5778
|
+
})
|
|
5779
|
+
})
|
|
5780
|
+
})
|
|
5756
5781
|
})
|
|
5757
5782
|
})
|
|
5758
|
-
|
|
5783
|
+
);
|
|
5759
5784
|
}
|
|
5760
5785
|
const inputAddonContentWidthAddendByPadding = {
|
|
5761
5786
|
none: 0,
|
|
@@ -6620,6 +6645,7 @@ function SelectInput({
|
|
|
6620
6645
|
disabled,
|
|
6621
6646
|
size = 'md',
|
|
6622
6647
|
className,
|
|
6648
|
+
UNSAFE_triggerButtonProps,
|
|
6623
6649
|
onFilterChange = noop,
|
|
6624
6650
|
onChange,
|
|
6625
6651
|
onClose,
|
|
@@ -6688,6 +6714,7 @@ function SelectInput({
|
|
|
6688
6714
|
triggerRef.current = node;
|
|
6689
6715
|
},
|
|
6690
6716
|
...inputAttributes,
|
|
6717
|
+
...UNSAFE_triggerButtonProps,
|
|
6691
6718
|
id,
|
|
6692
6719
|
...mergeProps({
|
|
6693
6720
|
onClick: () => {
|