@transferwise/components 0.0.0-experimental-613665e → 0.0.0-experimental-9b525c5
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 +177 -55
- package/build/index.js.map +1 -1
- package/build/index.mjs +176 -56
- package/build/index.mjs.map +1 -1
- package/build/types/dateInput/DateInput.d.ts +3 -2
- package/build/types/dateInput/DateInput.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.d.ts +8 -2
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/field/Field.d.ts +12 -0
- package/build/types/field/Field.d.ts.map +1 -0
- package/build/types/index.d.ts +4 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/inputs/Input.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts +1 -1
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/inputs/TextArea.d.ts.map +1 -1
- package/build/types/inputs/_common.d.ts +2 -2
- package/build/types/inputs/_common.d.ts.map +1 -1
- package/build/types/inputs/contexts.d.ts +24 -0
- package/build/types/inputs/contexts.d.ts.map +1 -0
- package/build/types/label/Label.d.ts +9 -0
- package/build/types/label/Label.d.ts.map +1 -0
- package/build/types/radioGroup/RadioGroup.d.ts.map +1 -1
- package/build/types/switch/Switch.d.ts +6 -3
- package/build/types/switch/Switch.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/dateInput/DateInput.rtl.spec.tsx +17 -0
- package/src/dateInput/DateInput.tsx +24 -18
- package/src/dateLookup/DateLookup.keyboardEvents.spec.js +2 -2
- package/src/dateLookup/DateLookup.rtl.spec.tsx +21 -0
- package/src/dateLookup/DateLookup.state.spec.js +5 -5
- package/src/dateLookup/DateLookup.tests.story.tsx +4 -11
- package/src/dateLookup/DateLookup.tsx +15 -5
- package/src/dateLookup/DateLookup.view.spec.js +11 -11
- package/src/field/Field.spec.tsx +95 -0
- package/src/field/Field.story.tsx +59 -0
- package/src/field/Field.tsx +70 -0
- package/src/index.ts +4 -0
- package/src/inputs/Input.tsx +5 -3
- package/src/inputs/SelectInput.spec.tsx +10 -0
- package/src/inputs/SelectInput.tsx +9 -4
- package/src/inputs/TextArea.tsx +6 -3
- package/src/inputs/_ButtonInput.tsx +2 -2
- package/src/inputs/_common.ts +2 -2
- package/src/inputs/contexts.tsx +45 -0
- package/src/label/Label.spec.tsx +26 -0
- package/src/label/Label.story.tsx +37 -0
- package/src/label/Label.tsx +20 -0
- package/src/radioGroup/RadioGroup.rtl.spec.tsx +14 -0
- package/src/radioGroup/RadioGroup.story.tsx +26 -0
- package/src/radioGroup/RadioGroup.tsx +4 -1
- package/src/switch/Switch.spec.tsx +10 -0
- package/src/switch/Switch.tsx +22 -13
package/build/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import React__default, { forwardRef, cloneElement, useState, useEffect, useRef,
|
|
|
3
3
|
import { useId } from '@radix-ui/react-id';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
|
-
import { ChevronUp, CrossCircleFill, Cross, NavigateAway, Check, Info as Info$1, Alert as Alert$1, ClockBorderless, Briefcase, Person, AlertCircleFill, ArrowLeft,
|
|
6
|
+
import { ChevronUp, CrossCircleFill, Cross, NavigateAway, Check, Info as Info$1, Alert as Alert$1, ClockBorderless, Briefcase, Person, AlertCircleFill, ArrowLeft, AlertCircle, QuestionMarkCircle, Search, CrossCircle, ChevronDown, CheckCircleFill, ArrowRight, Download, ClockFill, Upload as Upload$2, Document, Plus, PlusCircle } from '@transferwise/icons';
|
|
7
7
|
import { defineMessages, useIntl, injectIntl, IntlProvider } from 'react-intl';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import commonmark from 'commonmark';
|
|
@@ -2592,6 +2592,36 @@ const isMonthAndYearFormat = dateString => validDateString(dateString) && dateSt
|
|
|
2592
2592
|
const MDY = new Set(['en-US']);
|
|
2593
2593
|
const YMD = new Set(['hu', 'hu-HU', 'zh-HK', 'zh-CN', 'ja', 'ja-JP']);
|
|
2594
2594
|
|
|
2595
|
+
const FieldLabelIdContext = /*#__PURE__*/createContext(undefined);
|
|
2596
|
+
const FieldLabelIdContextProvider = FieldLabelIdContext.Provider;
|
|
2597
|
+
const InputIdContext = /*#__PURE__*/createContext(undefined);
|
|
2598
|
+
const InputIdContextProvider = InputIdContext.Provider;
|
|
2599
|
+
const InputDescribedByContext = /*#__PURE__*/createContext(undefined);
|
|
2600
|
+
const InputDescribedByProvider = InputDescribedByContext.Provider;
|
|
2601
|
+
const InputInvalidContext = /*#__PURE__*/createContext(undefined);
|
|
2602
|
+
const InputInvalidProvider = InputInvalidContext.Provider;
|
|
2603
|
+
function useInputAttributes({
|
|
2604
|
+
nonLabelable
|
|
2605
|
+
} = {}) {
|
|
2606
|
+
const labelId = useContext(FieldLabelIdContext);
|
|
2607
|
+
return {
|
|
2608
|
+
id: useContext(InputIdContext),
|
|
2609
|
+
'aria-labelledby': nonLabelable ? labelId : undefined,
|
|
2610
|
+
'aria-describedby': useContext(InputDescribedByContext),
|
|
2611
|
+
'aria-invalid': useContext(InputInvalidContext)
|
|
2612
|
+
};
|
|
2613
|
+
}
|
|
2614
|
+
function withInputAttributes(Component, args) {
|
|
2615
|
+
function ComponentWithInputAttributes(props) {
|
|
2616
|
+
return /*#__PURE__*/jsx(Component, {
|
|
2617
|
+
inputAttributes: useInputAttributes(args),
|
|
2618
|
+
...props
|
|
2619
|
+
});
|
|
2620
|
+
}
|
|
2621
|
+
ComponentWithInputAttributes.displayName = `withInputAttributes(${Component.displayName || Component.name || 'Component'})`;
|
|
2622
|
+
return ComponentWithInputAttributes;
|
|
2623
|
+
}
|
|
2624
|
+
|
|
2595
2625
|
var messages$9 = defineMessages({
|
|
2596
2626
|
monthLabel: {
|
|
2597
2627
|
id: "neptune.DateInput.month.label"
|
|
@@ -2616,7 +2646,7 @@ const convertToLocalMidnight = date => {
|
|
|
2616
2646
|
};
|
|
2617
2647
|
|
|
2618
2648
|
const DateInput = ({
|
|
2619
|
-
'aria-labelledby':
|
|
2649
|
+
'aria-labelledby': ariaLabelledByProp,
|
|
2620
2650
|
'aria-label': ariaLabel,
|
|
2621
2651
|
disabled = false,
|
|
2622
2652
|
size = Size.MEDIUM,
|
|
@@ -2632,9 +2662,14 @@ const DateInput = ({
|
|
|
2632
2662
|
onFocus,
|
|
2633
2663
|
onBlur,
|
|
2634
2664
|
placeholders,
|
|
2635
|
-
id,
|
|
2665
|
+
id: idProp,
|
|
2636
2666
|
selectProps = {}
|
|
2637
2667
|
}) => {
|
|
2668
|
+
const inputAttributes = useInputAttributes({
|
|
2669
|
+
nonLabelable: true
|
|
2670
|
+
});
|
|
2671
|
+
const id = idProp ?? inputAttributes.id;
|
|
2672
|
+
const ariaLabelledBy = ariaLabelledByProp ?? inputAttributes['aria-labelledby'];
|
|
2638
2673
|
const {
|
|
2639
2674
|
locale,
|
|
2640
2675
|
formatMessage
|
|
@@ -2671,9 +2706,9 @@ const DateInput = ({
|
|
|
2671
2706
|
const [year, setYear] = useState(() => getInitialDate('year'));
|
|
2672
2707
|
const [lastBroadcastedValue, setLastBroadcastedValue] = useState(getDateObject);
|
|
2673
2708
|
const monthNames = getMonthNames(locale, monthFormat);
|
|
2674
|
-
dayLabel
|
|
2675
|
-
monthLabel
|
|
2676
|
-
yearLabel
|
|
2709
|
+
dayLabel ||= formatMessage(messages$9.dayLabel);
|
|
2710
|
+
monthLabel ||= formatMessage(messages$9.monthLabel);
|
|
2711
|
+
yearLabel ||= formatMessage(messages$9.yearLabel);
|
|
2677
2712
|
placeholders = {
|
|
2678
2713
|
day: placeholders?.day || formatMessage(messages$9.dayPlaceholder),
|
|
2679
2714
|
month: placeholders?.month || formatMessage(messages$9.monthLabel),
|
|
@@ -2864,6 +2899,7 @@ const DateInput = ({
|
|
|
2864
2899
|
const yearFirst = YMD.has(locale);
|
|
2865
2900
|
return /*#__PURE__*/jsx("div", {
|
|
2866
2901
|
className: "tw-date",
|
|
2902
|
+
...inputAttributes,
|
|
2867
2903
|
id: id,
|
|
2868
2904
|
"aria-labelledby": ariaLabelledBy,
|
|
2869
2905
|
"aria-label": ariaLabel,
|
|
@@ -2883,15 +2919,15 @@ const DateInput = ({
|
|
|
2883
2919
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
2884
2920
|
children: [getMonth(), getDay(), getYear()]
|
|
2885
2921
|
});
|
|
2886
|
-
}
|
|
2922
|
+
}
|
|
2923
|
+
if (yearFirst) {
|
|
2887
2924
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
2888
2925
|
children: [getYear(), getMonth(), getDay()]
|
|
2889
2926
|
});
|
|
2890
|
-
} else {
|
|
2891
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
2892
|
-
children: [getDay(), getMonth(), getYear()]
|
|
2893
|
-
});
|
|
2894
2927
|
}
|
|
2928
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
2929
|
+
children: [getDay(), getMonth(), getYear()]
|
|
2930
|
+
});
|
|
2895
2931
|
})()
|
|
2896
2932
|
})
|
|
2897
2933
|
});
|
|
@@ -3992,18 +4028,23 @@ class DateLookup extends PureComponent {
|
|
|
3992
4028
|
open
|
|
3993
4029
|
} = this.state;
|
|
3994
4030
|
const {
|
|
4031
|
+
inputAttributes,
|
|
4032
|
+
id: idProp,
|
|
4033
|
+
'aria-labelledby': ariaLabelledByProp,
|
|
3995
4034
|
size,
|
|
3996
4035
|
placeholder,
|
|
3997
4036
|
label,
|
|
3998
|
-
'aria-labelledby': ariaLabelledBy,
|
|
3999
4037
|
monthFormat,
|
|
4000
4038
|
disabled,
|
|
4001
4039
|
clearable,
|
|
4002
4040
|
value
|
|
4003
4041
|
} = this.props;
|
|
4042
|
+
const id = idProp ?? inputAttributes?.id;
|
|
4043
|
+
const ariaLabelledBy = ariaLabelledByProp ?? inputAttributes?.['aria-labelledby'];
|
|
4004
4044
|
return /*#__PURE__*/jsxs("div", {
|
|
4005
4045
|
ref: this.element,
|
|
4006
|
-
|
|
4046
|
+
...inputAttributes,
|
|
4047
|
+
id: id,
|
|
4007
4048
|
"aria-labelledby": ariaLabelledBy,
|
|
4008
4049
|
className: "input-group",
|
|
4009
4050
|
onKeyDown: this.handleKeyDown,
|
|
@@ -4027,6 +4068,9 @@ class DateLookup extends PureComponent {
|
|
|
4027
4068
|
});
|
|
4028
4069
|
}
|
|
4029
4070
|
}
|
|
4071
|
+
var DateLookup$1 = withInputAttributes(DateLookup, {
|
|
4072
|
+
nonLabelable: true
|
|
4073
|
+
});
|
|
4030
4074
|
|
|
4031
4075
|
const NavigationOption = /*#__PURE__*/forwardRef(({
|
|
4032
4076
|
as: component = 'button',
|
|
@@ -4873,6 +4917,84 @@ const FlowNavigation = ({
|
|
|
4873
4917
|
});
|
|
4874
4918
|
};
|
|
4875
4919
|
|
|
4920
|
+
function InlineAlert({
|
|
4921
|
+
id,
|
|
4922
|
+
type = 'neutral',
|
|
4923
|
+
className,
|
|
4924
|
+
children
|
|
4925
|
+
}) {
|
|
4926
|
+
const danger = type === 'negative' || type === 'error';
|
|
4927
|
+
return /*#__PURE__*/jsxs("div", {
|
|
4928
|
+
role: "alert",
|
|
4929
|
+
id: id,
|
|
4930
|
+
className: classNames('alert alert-detach', `alert-${danger ? 'danger' : type}`, className),
|
|
4931
|
+
children: [danger && /*#__PURE__*/jsx(AlertCircle, {}), /*#__PURE__*/jsx("div", {
|
|
4932
|
+
children: children
|
|
4933
|
+
})]
|
|
4934
|
+
});
|
|
4935
|
+
}
|
|
4936
|
+
|
|
4937
|
+
const Label = ({
|
|
4938
|
+
id,
|
|
4939
|
+
htmlFor,
|
|
4940
|
+
className,
|
|
4941
|
+
children
|
|
4942
|
+
}) => {
|
|
4943
|
+
return /*#__PURE__*/jsx("label", {
|
|
4944
|
+
id: id,
|
|
4945
|
+
htmlFor: htmlFor,
|
|
4946
|
+
className: classNames('control-label d-flex flex-column gap-y-1 m-b-0', className),
|
|
4947
|
+
children: children
|
|
4948
|
+
});
|
|
4949
|
+
};
|
|
4950
|
+
|
|
4951
|
+
const Field = ({
|
|
4952
|
+
id,
|
|
4953
|
+
label,
|
|
4954
|
+
hint,
|
|
4955
|
+
error,
|
|
4956
|
+
className,
|
|
4957
|
+
children
|
|
4958
|
+
}) => {
|
|
4959
|
+
const hasError = Boolean(error);
|
|
4960
|
+
const hasHint = Boolean(hint) && !hasError;
|
|
4961
|
+
const labelId = useId();
|
|
4962
|
+
const fallbackInputId = useId(); // TODO: Use `React.useId()` when react>=18
|
|
4963
|
+
const inputId = id !== null ? id ?? fallbackInputId : undefined;
|
|
4964
|
+
const descriptionId = useId(); // TODO: Use `React.useId()` when react>=18
|
|
4965
|
+
return /*#__PURE__*/jsx(FieldLabelIdContextProvider, {
|
|
4966
|
+
value: labelId,
|
|
4967
|
+
children: /*#__PURE__*/jsx(InputIdContextProvider, {
|
|
4968
|
+
value: inputId,
|
|
4969
|
+
children: /*#__PURE__*/jsx(InputDescribedByProvider, {
|
|
4970
|
+
value: hasError || hasHint ? descriptionId : undefined,
|
|
4971
|
+
children: /*#__PURE__*/jsx(InputInvalidProvider, {
|
|
4972
|
+
value: hasError,
|
|
4973
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
4974
|
+
className: classNames('form-group d-block', {
|
|
4975
|
+
'has-error': hasError,
|
|
4976
|
+
'has-info': hasHint
|
|
4977
|
+
}, className),
|
|
4978
|
+
children: [/*#__PURE__*/jsxs(Label, {
|
|
4979
|
+
id: labelId,
|
|
4980
|
+
htmlFor: inputId,
|
|
4981
|
+
children: [label, children]
|
|
4982
|
+
}), hasHint && /*#__PURE__*/jsx(InlineAlert, {
|
|
4983
|
+
type: Sentiment.NEUTRAL,
|
|
4984
|
+
id: descriptionId,
|
|
4985
|
+
children: hint
|
|
4986
|
+
}), hasError && /*#__PURE__*/jsx(InlineAlert, {
|
|
4987
|
+
type: Sentiment.NEGATIVE,
|
|
4988
|
+
id: descriptionId,
|
|
4989
|
+
children: error
|
|
4990
|
+
})]
|
|
4991
|
+
})
|
|
4992
|
+
})
|
|
4993
|
+
})
|
|
4994
|
+
})
|
|
4995
|
+
});
|
|
4996
|
+
};
|
|
4997
|
+
|
|
4876
4998
|
const HeaderAction = ({
|
|
4877
4999
|
action
|
|
4878
5000
|
}) => {
|
|
@@ -5205,20 +5327,16 @@ const Info = ({
|
|
|
5205
5327
|
});
|
|
5206
5328
|
};
|
|
5207
5329
|
|
|
5208
|
-
function
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
className: classNames('alert alert-detach', `alert-${danger ? 'danger' : type}`, className),
|
|
5219
|
-
children: [danger && /*#__PURE__*/jsx(AlertCircle, {}), /*#__PURE__*/jsx("div", {
|
|
5220
|
-
children: children
|
|
5221
|
-
})]
|
|
5330
|
+
function inputClassNameBase({
|
|
5331
|
+
size = 'auto'
|
|
5332
|
+
} = {}) {
|
|
5333
|
+
return classNames('form-control',
|
|
5334
|
+
// TODO: Deprecate
|
|
5335
|
+
'np-form-control', {
|
|
5336
|
+
'np-form-control--size-auto': size === 'auto',
|
|
5337
|
+
'np-form-control--size-sm': size === 'sm',
|
|
5338
|
+
'np-form-control--size-md': size === 'md',
|
|
5339
|
+
'np-form-control--size-lg': size === 'lg'
|
|
5222
5340
|
});
|
|
5223
5341
|
}
|
|
5224
5342
|
|
|
@@ -5340,29 +5458,17 @@ function InputAddon({
|
|
|
5340
5458
|
});
|
|
5341
5459
|
}
|
|
5342
5460
|
|
|
5343
|
-
function formControlClassNameBase({
|
|
5344
|
-
size = 'auto'
|
|
5345
|
-
} = {}) {
|
|
5346
|
-
return classNames('form-control',
|
|
5347
|
-
// TODO: Deprecate
|
|
5348
|
-
'np-form-control', {
|
|
5349
|
-
'np-form-control--size-auto': size === 'auto',
|
|
5350
|
-
'np-form-control--size-sm': size === 'sm',
|
|
5351
|
-
'np-form-control--size-md': size === 'md',
|
|
5352
|
-
'np-form-control--size-lg': size === 'lg'
|
|
5353
|
-
});
|
|
5354
|
-
}
|
|
5355
|
-
|
|
5356
5461
|
const Input = /*#__PURE__*/forwardRef(function Input({
|
|
5357
5462
|
size = 'auto',
|
|
5358
5463
|
shape = 'rectangle',
|
|
5359
5464
|
className,
|
|
5360
5465
|
...restProps
|
|
5361
5466
|
}, reference) {
|
|
5467
|
+
const inputAttributes = useInputAttributes();
|
|
5362
5468
|
const inputPaddings = useInputPaddings();
|
|
5363
5469
|
return /*#__PURE__*/jsx("input", {
|
|
5364
5470
|
ref: reference,
|
|
5365
|
-
className: classNames(className,
|
|
5471
|
+
className: classNames(className, inputClassNameBase({
|
|
5366
5472
|
size
|
|
5367
5473
|
}), 'np-input', {
|
|
5368
5474
|
'np-input--shape-rectangle': shape === 'rectangle',
|
|
@@ -5371,6 +5477,7 @@ const Input = /*#__PURE__*/forwardRef(function Input({
|
|
|
5371
5477
|
// eslint-disable-next-line react/forbid-dom-props
|
|
5372
5478
|
,
|
|
5373
5479
|
style: inputPaddings,
|
|
5480
|
+
...inputAttributes,
|
|
5374
5481
|
...restProps
|
|
5375
5482
|
});
|
|
5376
5483
|
});
|
|
@@ -5792,12 +5899,6 @@ const PolymorphicWithOverrides = /*#__PURE__*/forwardRef(function PolymorphicWit
|
|
|
5792
5899
|
});
|
|
5793
5900
|
});
|
|
5794
5901
|
|
|
5795
|
-
var messages$5 = defineMessages({
|
|
5796
|
-
noResultsFound: {
|
|
5797
|
-
id: "neptune.SelectInput.noResultsFound"
|
|
5798
|
-
}
|
|
5799
|
-
});
|
|
5800
|
-
|
|
5801
5902
|
function PreventScroll() {
|
|
5802
5903
|
usePreventScroll();
|
|
5803
5904
|
return null;
|
|
@@ -5917,7 +6018,7 @@ const ButtonInput = /*#__PURE__*/forwardRef(function ButtonInput({
|
|
|
5917
6018
|
return /*#__PURE__*/jsx("button", {
|
|
5918
6019
|
ref: ref,
|
|
5919
6020
|
type: "button",
|
|
5920
|
-
className: classNames(className,
|
|
6021
|
+
className: classNames(className, inputClassNameBase({
|
|
5921
6022
|
size
|
|
5922
6023
|
}), 'np-button-input')
|
|
5923
6024
|
// eslint-disable-next-line react/forbid-dom-props
|
|
@@ -6033,6 +6134,12 @@ function Popover({
|
|
|
6033
6134
|
});
|
|
6034
6135
|
}
|
|
6035
6136
|
|
|
6137
|
+
var messages$5 = defineMessages({
|
|
6138
|
+
noResultsFound: {
|
|
6139
|
+
id: "neptune.SelectInput.noResultsFound"
|
|
6140
|
+
}
|
|
6141
|
+
});
|
|
6142
|
+
|
|
6036
6143
|
function searchableString(value) {
|
|
6037
6144
|
return value.trim().replace(/\s+/gu, ' ').normalize('NFKC').toLowerCase();
|
|
6038
6145
|
}
|
|
@@ -6152,7 +6259,7 @@ function SelectInputClearButton({
|
|
|
6152
6259
|
}
|
|
6153
6260
|
const noop = () => {};
|
|
6154
6261
|
function SelectInput({
|
|
6155
|
-
id,
|
|
6262
|
+
id: idProp,
|
|
6156
6263
|
name,
|
|
6157
6264
|
multiple,
|
|
6158
6265
|
placeholder,
|
|
@@ -6173,6 +6280,8 @@ function SelectInput({
|
|
|
6173
6280
|
onClose,
|
|
6174
6281
|
onClear
|
|
6175
6282
|
}) {
|
|
6283
|
+
const inputAttributes = useInputAttributes();
|
|
6284
|
+
const id = idProp ?? inputAttributes.id;
|
|
6176
6285
|
const [open, setOpen] = useState(false);
|
|
6177
6286
|
const initialized = useRef(false);
|
|
6178
6287
|
const handleClose = useEffectEvent(onClose ?? (() => {}));
|
|
@@ -6233,6 +6342,7 @@ function SelectInput({
|
|
|
6233
6342
|
ref(node);
|
|
6234
6343
|
triggerRef.current = node;
|
|
6235
6344
|
},
|
|
6345
|
+
...inputAttributes,
|
|
6236
6346
|
id,
|
|
6237
6347
|
...mergeProps({
|
|
6238
6348
|
onClick: () => {
|
|
@@ -6586,9 +6696,11 @@ const TextArea = /*#__PURE__*/forwardRef(function TextArea({
|
|
|
6586
6696
|
className,
|
|
6587
6697
|
...restProps
|
|
6588
6698
|
}, reference) {
|
|
6699
|
+
const inputAttributes = useInputAttributes();
|
|
6589
6700
|
return /*#__PURE__*/jsx("textarea", {
|
|
6590
6701
|
ref: reference,
|
|
6591
|
-
className: classNames(className,
|
|
6702
|
+
className: classNames(className, inputClassNameBase(), 'np-text-area'),
|
|
6703
|
+
...inputAttributes,
|
|
6592
6704
|
...restProps
|
|
6593
6705
|
});
|
|
6594
6706
|
});
|
|
@@ -9334,9 +9446,13 @@ function RadioGroup({
|
|
|
9334
9446
|
selectedValue: controlledValue,
|
|
9335
9447
|
onChange
|
|
9336
9448
|
}) {
|
|
9449
|
+
const inputAttributes = useInputAttributes({
|
|
9450
|
+
nonLabelable: true
|
|
9451
|
+
});
|
|
9337
9452
|
const [uncontrolledValue, setUncontrolledValue] = useState(controlledValue);
|
|
9338
9453
|
return radios.length > 0 ? /*#__PURE__*/jsx("div", {
|
|
9339
9454
|
role: "radiogroup",
|
|
9455
|
+
...inputAttributes,
|
|
9340
9456
|
children: radios.map(({
|
|
9341
9457
|
value = '',
|
|
9342
9458
|
...restProps
|
|
@@ -10448,13 +10564,18 @@ const Summary = ({
|
|
|
10448
10564
|
};
|
|
10449
10565
|
|
|
10450
10566
|
const Switch = props => {
|
|
10567
|
+
const inputAttributes = useInputAttributes({
|
|
10568
|
+
nonLabelable: true
|
|
10569
|
+
});
|
|
10451
10570
|
const {
|
|
10452
10571
|
isModern
|
|
10453
10572
|
} = useTheme();
|
|
10454
10573
|
const {
|
|
10455
10574
|
checked,
|
|
10456
10575
|
className,
|
|
10457
|
-
id,
|
|
10576
|
+
id = inputAttributes.id,
|
|
10577
|
+
'aria-label': ariaLabel,
|
|
10578
|
+
'aria-labelledby': ariaLabelledbyProp,
|
|
10458
10579
|
onClick,
|
|
10459
10580
|
disabled
|
|
10460
10581
|
} = props;
|
|
@@ -10485,19 +10606,18 @@ const Switch = props => {
|
|
|
10485
10606
|
})
|
|
10486
10607
|
});
|
|
10487
10608
|
};
|
|
10488
|
-
const
|
|
10489
|
-
const ariaLabelledby = ariaLabel ? undefined : props['aria-labelledby'];
|
|
10490
|
-
logActionRequiredIf('Switch now expects either `aria-label` or `aria-labelledby`, and will soon make these props required. Please update your usage to provide one or the other.', !ariaLabel && !ariaLabelledby);
|
|
10609
|
+
const ariaLabelledby = (ariaLabel ? undefined : ariaLabelledbyProp) ?? inputAttributes['aria-labelledby'];
|
|
10491
10610
|
return /*#__PURE__*/jsxs("span", {
|
|
10492
10611
|
className: classNames('np-switch', {
|
|
10493
10612
|
'np-switch--unchecked': !checked,
|
|
10494
10613
|
'np-switch--checked': checked,
|
|
10495
|
-
disabled
|
|
10614
|
+
disabled
|
|
10496
10615
|
}, className),
|
|
10497
10616
|
tabIndex: 0,
|
|
10498
10617
|
role: "switch",
|
|
10499
10618
|
"aria-checked": checked,
|
|
10500
10619
|
"aria-label": ariaLabel,
|
|
10620
|
+
...inputAttributes,
|
|
10501
10621
|
"aria-labelledby": ariaLabelledby,
|
|
10502
10622
|
id: id,
|
|
10503
10623
|
"aria-disabled": disabled,
|
|
@@ -14353,5 +14473,5 @@ const translations = {
|
|
|
14353
14473
|
'zh-HK': zhHK
|
|
14354
14474
|
};
|
|
14355
14475
|
|
|
14356
|
-
export { Accordion, ActionButton, ActionOption, Alert, AlertArrowPosition, Avatar, AvatarType, AvatarWrapper, Badge, Card as BaseCard, Body, BottomSheet$1 as BottomSheet, Breakpoint, Button, Card$2 as Card, Checkbox, CheckboxButton$1 as CheckboxButton, CheckboxOption, Chevron, Chip, Chips, CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup, DateMode, Decision, DecisionPresentation, DecisionType, DefinitionList$1 as DefinitionList, Dimmer$1 as Dimmer, Direction, DirectionProvider, Display, Drawer$1 as Drawer, DropFade, Emphasis, FileType, FlowNavigation, Header, Image, Info, InfoPresentation, InlineAlert, Input, InputGroup, InputWithDisplayFormat, InstructionsList, LanguageProvider, Layout, Link, ListItem$1 as ListItem, Loader, Logo$1 as Logo, LogoType, Markdown, MarkdownNodeType, Modal, Money, MoneyInput$1 as MoneyInput, MonthFormat, NavigationOption, NavigationOptionList as NavigationOptionsList, Nudge, Option$2 as Option, OverlayHeader$1 as OverlayHeader, PhoneNumberInput, Popover$1 as Popover, Position, Priority, ProcessIndicator$1 as ProcessIndicator, ProfileType, Progress, ProgressBar, PromoCard$1 as PromoCard, PromoCardGroup$1 as PromoCardGroup, Provider, RTL_LANGUAGES, Radio, RadioGroup, RadioOption, SUPPORTED_LANGUAGES, Scroll, SearchInput, Section, SegmentedControl, Select, SelectInput, SelectInputOptionContent, SelectInputTriggerButton, Sentiment, Size, SlidingPanel, SnackbarConsumer, SnackbarContext, SnackbarPortal, SnackbarProvider, Status, StatusIcon, Stepper, Sticky, Summary, Switch, SwitchOption, Tabs$1 as Tabs, TextArea, TextareaWithDisplayFormat, Theme, Title, Tooltip, Type, Typeahead, Typography, Upload$1 as Upload, UploadInput, UploadStep, Variant, Width, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale, isBrowser, isServerSide, translations, useDirection, useLayout, useScreenSize, useSnackbar };
|
|
14476
|
+
export { Accordion, ActionButton, ActionOption, Alert, AlertArrowPosition, Avatar, AvatarType, AvatarWrapper, Badge, Card as BaseCard, Body, BottomSheet$1 as BottomSheet, Breakpoint, Button, Card$2 as Card, Checkbox, CheckboxButton$1 as CheckboxButton, CheckboxOption, Chevron, Chip, Chips, CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup$1 as DateLookup, DateMode, Decision, DecisionPresentation, DecisionType, DefinitionList$1 as DefinitionList, Dimmer$1 as Dimmer, Direction, DirectionProvider, Display, Drawer$1 as Drawer, DropFade, Emphasis, Field, FileType, FlowNavigation, Header, Image, Info, InfoPresentation, InlineAlert, Input, InputGroup, InputWithDisplayFormat, InstructionsList, Label, LanguageProvider, Layout, Link, ListItem$1 as ListItem, Loader, Logo$1 as Logo, LogoType, Markdown, MarkdownNodeType, Modal, Money, MoneyInput$1 as MoneyInput, MonthFormat, NavigationOption, NavigationOptionList as NavigationOptionsList, Nudge, Option$2 as Option, OverlayHeader$1 as OverlayHeader, PhoneNumberInput, Popover$1 as Popover, Position, Priority, ProcessIndicator$1 as ProcessIndicator, ProfileType, Progress, ProgressBar, PromoCard$1 as PromoCard, PromoCardGroup$1 as PromoCardGroup, Provider, RTL_LANGUAGES, Radio, RadioGroup, RadioOption, SUPPORTED_LANGUAGES, Scroll, SearchInput, Section, SegmentedControl, Select, SelectInput, SelectInputOptionContent, SelectInputTriggerButton, Sentiment, Size, SlidingPanel, SnackbarConsumer, SnackbarContext, SnackbarPortal, SnackbarProvider, Status, StatusIcon, Stepper, Sticky, Summary, Switch, SwitchOption, Tabs$1 as Tabs, TextArea, TextareaWithDisplayFormat, Theme, Title, Tooltip, Type, Typeahead, Typography, Upload$1 as Upload, UploadInput, UploadStep, Variant, Width, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale, isBrowser, isServerSide, translations, useDirection, useLayout, useScreenSize, useSnackbar };
|
|
14357
14477
|
//# sourceMappingURL=index.mjs.map
|