@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.js
CHANGED
|
@@ -2622,6 +2622,36 @@ const isMonthAndYearFormat = dateString => validDateString(dateString) && dateSt
|
|
|
2622
2622
|
const MDY = new Set(['en-US']);
|
|
2623
2623
|
const YMD = new Set(['hu', 'hu-HU', 'zh-HK', 'zh-CN', 'ja', 'ja-JP']);
|
|
2624
2624
|
|
|
2625
|
+
const FieldLabelIdContext = /*#__PURE__*/React.createContext(undefined);
|
|
2626
|
+
const FieldLabelIdContextProvider = FieldLabelIdContext.Provider;
|
|
2627
|
+
const InputIdContext = /*#__PURE__*/React.createContext(undefined);
|
|
2628
|
+
const InputIdContextProvider = InputIdContext.Provider;
|
|
2629
|
+
const InputDescribedByContext = /*#__PURE__*/React.createContext(undefined);
|
|
2630
|
+
const InputDescribedByProvider = InputDescribedByContext.Provider;
|
|
2631
|
+
const InputInvalidContext = /*#__PURE__*/React.createContext(undefined);
|
|
2632
|
+
const InputInvalidProvider = InputInvalidContext.Provider;
|
|
2633
|
+
function useInputAttributes({
|
|
2634
|
+
nonLabelable
|
|
2635
|
+
} = {}) {
|
|
2636
|
+
const labelId = React.useContext(FieldLabelIdContext);
|
|
2637
|
+
return {
|
|
2638
|
+
id: React.useContext(InputIdContext),
|
|
2639
|
+
'aria-labelledby': nonLabelable ? labelId : undefined,
|
|
2640
|
+
'aria-describedby': React.useContext(InputDescribedByContext),
|
|
2641
|
+
'aria-invalid': React.useContext(InputInvalidContext)
|
|
2642
|
+
};
|
|
2643
|
+
}
|
|
2644
|
+
function withInputAttributes(Component, args) {
|
|
2645
|
+
function ComponentWithInputAttributes(props) {
|
|
2646
|
+
return /*#__PURE__*/jsxRuntime.jsx(Component, {
|
|
2647
|
+
inputAttributes: useInputAttributes(args),
|
|
2648
|
+
...props
|
|
2649
|
+
});
|
|
2650
|
+
}
|
|
2651
|
+
ComponentWithInputAttributes.displayName = `withInputAttributes(${Component.displayName || Component.name || 'Component'})`;
|
|
2652
|
+
return ComponentWithInputAttributes;
|
|
2653
|
+
}
|
|
2654
|
+
|
|
2625
2655
|
var messages$9 = reactIntl.defineMessages({
|
|
2626
2656
|
monthLabel: {
|
|
2627
2657
|
id: "neptune.DateInput.month.label"
|
|
@@ -2646,7 +2676,7 @@ const convertToLocalMidnight = date => {
|
|
|
2646
2676
|
};
|
|
2647
2677
|
|
|
2648
2678
|
const DateInput = ({
|
|
2649
|
-
'aria-labelledby':
|
|
2679
|
+
'aria-labelledby': ariaLabelledByProp,
|
|
2650
2680
|
'aria-label': ariaLabel,
|
|
2651
2681
|
disabled = false,
|
|
2652
2682
|
size = exports.Size.MEDIUM,
|
|
@@ -2662,9 +2692,14 @@ const DateInput = ({
|
|
|
2662
2692
|
onFocus,
|
|
2663
2693
|
onBlur,
|
|
2664
2694
|
placeholders,
|
|
2665
|
-
id,
|
|
2695
|
+
id: idProp,
|
|
2666
2696
|
selectProps = {}
|
|
2667
2697
|
}) => {
|
|
2698
|
+
const inputAttributes = useInputAttributes({
|
|
2699
|
+
nonLabelable: true
|
|
2700
|
+
});
|
|
2701
|
+
const id = idProp ?? inputAttributes.id;
|
|
2702
|
+
const ariaLabelledBy = ariaLabelledByProp ?? inputAttributes['aria-labelledby'];
|
|
2668
2703
|
const {
|
|
2669
2704
|
locale,
|
|
2670
2705
|
formatMessage
|
|
@@ -2701,9 +2736,9 @@ const DateInput = ({
|
|
|
2701
2736
|
const [year, setYear] = React.useState(() => getInitialDate('year'));
|
|
2702
2737
|
const [lastBroadcastedValue, setLastBroadcastedValue] = React.useState(getDateObject);
|
|
2703
2738
|
const monthNames = getMonthNames(locale, monthFormat);
|
|
2704
|
-
dayLabel
|
|
2705
|
-
monthLabel
|
|
2706
|
-
yearLabel
|
|
2739
|
+
dayLabel ||= formatMessage(messages$9.dayLabel);
|
|
2740
|
+
monthLabel ||= formatMessage(messages$9.monthLabel);
|
|
2741
|
+
yearLabel ||= formatMessage(messages$9.yearLabel);
|
|
2707
2742
|
placeholders = {
|
|
2708
2743
|
day: placeholders?.day || formatMessage(messages$9.dayPlaceholder),
|
|
2709
2744
|
month: placeholders?.month || formatMessage(messages$9.monthLabel),
|
|
@@ -2894,6 +2929,7 @@ const DateInput = ({
|
|
|
2894
2929
|
const yearFirst = YMD.has(locale);
|
|
2895
2930
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2896
2931
|
className: "tw-date",
|
|
2932
|
+
...inputAttributes,
|
|
2897
2933
|
id: id,
|
|
2898
2934
|
"aria-labelledby": ariaLabelledBy,
|
|
2899
2935
|
"aria-label": ariaLabel,
|
|
@@ -2913,15 +2949,15 @@ const DateInput = ({
|
|
|
2913
2949
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2914
2950
|
children: [getMonth(), getDay(), getYear()]
|
|
2915
2951
|
});
|
|
2916
|
-
}
|
|
2952
|
+
}
|
|
2953
|
+
if (yearFirst) {
|
|
2917
2954
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2918
2955
|
children: [getYear(), getMonth(), getDay()]
|
|
2919
2956
|
});
|
|
2920
|
-
} else {
|
|
2921
|
-
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2922
|
-
children: [getDay(), getMonth(), getYear()]
|
|
2923
|
-
});
|
|
2924
2957
|
}
|
|
2958
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2959
|
+
children: [getDay(), getMonth(), getYear()]
|
|
2960
|
+
});
|
|
2925
2961
|
})()
|
|
2926
2962
|
})
|
|
2927
2963
|
});
|
|
@@ -4022,18 +4058,23 @@ class DateLookup extends React.PureComponent {
|
|
|
4022
4058
|
open
|
|
4023
4059
|
} = this.state;
|
|
4024
4060
|
const {
|
|
4061
|
+
inputAttributes,
|
|
4062
|
+
id: idProp,
|
|
4063
|
+
'aria-labelledby': ariaLabelledByProp,
|
|
4025
4064
|
size,
|
|
4026
4065
|
placeholder,
|
|
4027
4066
|
label,
|
|
4028
|
-
'aria-labelledby': ariaLabelledBy,
|
|
4029
4067
|
monthFormat,
|
|
4030
4068
|
disabled,
|
|
4031
4069
|
clearable,
|
|
4032
4070
|
value
|
|
4033
4071
|
} = this.props;
|
|
4072
|
+
const id = idProp ?? inputAttributes?.id;
|
|
4073
|
+
const ariaLabelledBy = ariaLabelledByProp ?? inputAttributes?.['aria-labelledby'];
|
|
4034
4074
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4035
4075
|
ref: this.element,
|
|
4036
|
-
|
|
4076
|
+
...inputAttributes,
|
|
4077
|
+
id: id,
|
|
4037
4078
|
"aria-labelledby": ariaLabelledBy,
|
|
4038
4079
|
className: "input-group",
|
|
4039
4080
|
onKeyDown: this.handleKeyDown,
|
|
@@ -4057,6 +4098,9 @@ class DateLookup extends React.PureComponent {
|
|
|
4057
4098
|
});
|
|
4058
4099
|
}
|
|
4059
4100
|
}
|
|
4101
|
+
var DateLookup$1 = withInputAttributes(DateLookup, {
|
|
4102
|
+
nonLabelable: true
|
|
4103
|
+
});
|
|
4060
4104
|
|
|
4061
4105
|
const NavigationOption = /*#__PURE__*/React.forwardRef(({
|
|
4062
4106
|
as: component = 'button',
|
|
@@ -4903,6 +4947,84 @@ const FlowNavigation = ({
|
|
|
4903
4947
|
});
|
|
4904
4948
|
};
|
|
4905
4949
|
|
|
4950
|
+
function InlineAlert({
|
|
4951
|
+
id,
|
|
4952
|
+
type = 'neutral',
|
|
4953
|
+
className,
|
|
4954
|
+
children
|
|
4955
|
+
}) {
|
|
4956
|
+
const danger = type === 'negative' || type === 'error';
|
|
4957
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4958
|
+
role: "alert",
|
|
4959
|
+
id: id,
|
|
4960
|
+
className: classNames__default.default('alert alert-detach', `alert-${danger ? 'danger' : type}`, className),
|
|
4961
|
+
children: [danger && /*#__PURE__*/jsxRuntime.jsx(icons.AlertCircle, {}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4962
|
+
children: children
|
|
4963
|
+
})]
|
|
4964
|
+
});
|
|
4965
|
+
}
|
|
4966
|
+
|
|
4967
|
+
const Label = ({
|
|
4968
|
+
id,
|
|
4969
|
+
htmlFor,
|
|
4970
|
+
className,
|
|
4971
|
+
children
|
|
4972
|
+
}) => {
|
|
4973
|
+
return /*#__PURE__*/jsxRuntime.jsx("label", {
|
|
4974
|
+
id: id,
|
|
4975
|
+
htmlFor: htmlFor,
|
|
4976
|
+
className: classNames__default.default('control-label d-flex flex-column gap-y-1 m-b-0', className),
|
|
4977
|
+
children: children
|
|
4978
|
+
});
|
|
4979
|
+
};
|
|
4980
|
+
|
|
4981
|
+
const Field = ({
|
|
4982
|
+
id,
|
|
4983
|
+
label,
|
|
4984
|
+
hint,
|
|
4985
|
+
error,
|
|
4986
|
+
className,
|
|
4987
|
+
children
|
|
4988
|
+
}) => {
|
|
4989
|
+
const hasError = Boolean(error);
|
|
4990
|
+
const hasHint = Boolean(hint) && !hasError;
|
|
4991
|
+
const labelId = reactId.useId();
|
|
4992
|
+
const fallbackInputId = reactId.useId(); // TODO: Use `React.useId()` when react>=18
|
|
4993
|
+
const inputId = id !== null ? id ?? fallbackInputId : undefined;
|
|
4994
|
+
const descriptionId = reactId.useId(); // TODO: Use `React.useId()` when react>=18
|
|
4995
|
+
return /*#__PURE__*/jsxRuntime.jsx(FieldLabelIdContextProvider, {
|
|
4996
|
+
value: labelId,
|
|
4997
|
+
children: /*#__PURE__*/jsxRuntime.jsx(InputIdContextProvider, {
|
|
4998
|
+
value: inputId,
|
|
4999
|
+
children: /*#__PURE__*/jsxRuntime.jsx(InputDescribedByProvider, {
|
|
5000
|
+
value: hasError || hasHint ? descriptionId : undefined,
|
|
5001
|
+
children: /*#__PURE__*/jsxRuntime.jsx(InputInvalidProvider, {
|
|
5002
|
+
value: hasError,
|
|
5003
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5004
|
+
className: classNames__default.default('form-group d-block', {
|
|
5005
|
+
'has-error': hasError,
|
|
5006
|
+
'has-info': hasHint
|
|
5007
|
+
}, className),
|
|
5008
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(Label, {
|
|
5009
|
+
id: labelId,
|
|
5010
|
+
htmlFor: inputId,
|
|
5011
|
+
children: [label, children]
|
|
5012
|
+
}), hasHint && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
|
|
5013
|
+
type: exports.Sentiment.NEUTRAL,
|
|
5014
|
+
id: descriptionId,
|
|
5015
|
+
children: hint
|
|
5016
|
+
}), hasError && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
|
|
5017
|
+
type: exports.Sentiment.NEGATIVE,
|
|
5018
|
+
id: descriptionId,
|
|
5019
|
+
children: error
|
|
5020
|
+
})]
|
|
5021
|
+
})
|
|
5022
|
+
})
|
|
5023
|
+
})
|
|
5024
|
+
})
|
|
5025
|
+
});
|
|
5026
|
+
};
|
|
5027
|
+
|
|
4906
5028
|
const HeaderAction = ({
|
|
4907
5029
|
action
|
|
4908
5030
|
}) => {
|
|
@@ -5235,20 +5357,16 @@ const Info = ({
|
|
|
5235
5357
|
});
|
|
5236
5358
|
};
|
|
5237
5359
|
|
|
5238
|
-
function
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
className: classNames__default.default('alert alert-detach', `alert-${danger ? 'danger' : type}`, className),
|
|
5249
|
-
children: [danger && /*#__PURE__*/jsxRuntime.jsx(icons.AlertCircle, {}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5250
|
-
children: children
|
|
5251
|
-
})]
|
|
5360
|
+
function inputClassNameBase({
|
|
5361
|
+
size = 'auto'
|
|
5362
|
+
} = {}) {
|
|
5363
|
+
return classNames__default.default('form-control',
|
|
5364
|
+
// TODO: Deprecate
|
|
5365
|
+
'np-form-control', {
|
|
5366
|
+
'np-form-control--size-auto': size === 'auto',
|
|
5367
|
+
'np-form-control--size-sm': size === 'sm',
|
|
5368
|
+
'np-form-control--size-md': size === 'md',
|
|
5369
|
+
'np-form-control--size-lg': size === 'lg'
|
|
5252
5370
|
});
|
|
5253
5371
|
}
|
|
5254
5372
|
|
|
@@ -5370,29 +5488,17 @@ function InputAddon({
|
|
|
5370
5488
|
});
|
|
5371
5489
|
}
|
|
5372
5490
|
|
|
5373
|
-
function formControlClassNameBase({
|
|
5374
|
-
size = 'auto'
|
|
5375
|
-
} = {}) {
|
|
5376
|
-
return classNames__default.default('form-control',
|
|
5377
|
-
// TODO: Deprecate
|
|
5378
|
-
'np-form-control', {
|
|
5379
|
-
'np-form-control--size-auto': size === 'auto',
|
|
5380
|
-
'np-form-control--size-sm': size === 'sm',
|
|
5381
|
-
'np-form-control--size-md': size === 'md',
|
|
5382
|
-
'np-form-control--size-lg': size === 'lg'
|
|
5383
|
-
});
|
|
5384
|
-
}
|
|
5385
|
-
|
|
5386
5491
|
const Input = /*#__PURE__*/React.forwardRef(function Input({
|
|
5387
5492
|
size = 'auto',
|
|
5388
5493
|
shape = 'rectangle',
|
|
5389
5494
|
className,
|
|
5390
5495
|
...restProps
|
|
5391
5496
|
}, reference) {
|
|
5497
|
+
const inputAttributes = useInputAttributes();
|
|
5392
5498
|
const inputPaddings = useInputPaddings();
|
|
5393
5499
|
return /*#__PURE__*/jsxRuntime.jsx("input", {
|
|
5394
5500
|
ref: reference,
|
|
5395
|
-
className: classNames__default.default(className,
|
|
5501
|
+
className: classNames__default.default(className, inputClassNameBase({
|
|
5396
5502
|
size
|
|
5397
5503
|
}), 'np-input', {
|
|
5398
5504
|
'np-input--shape-rectangle': shape === 'rectangle',
|
|
@@ -5401,6 +5507,7 @@ const Input = /*#__PURE__*/React.forwardRef(function Input({
|
|
|
5401
5507
|
// eslint-disable-next-line react/forbid-dom-props
|
|
5402
5508
|
,
|
|
5403
5509
|
style: inputPaddings,
|
|
5510
|
+
...inputAttributes,
|
|
5404
5511
|
...restProps
|
|
5405
5512
|
});
|
|
5406
5513
|
});
|
|
@@ -5822,12 +5929,6 @@ const PolymorphicWithOverrides = /*#__PURE__*/React.forwardRef(function Polymorp
|
|
|
5822
5929
|
});
|
|
5823
5930
|
});
|
|
5824
5931
|
|
|
5825
|
-
var messages$5 = reactIntl.defineMessages({
|
|
5826
|
-
noResultsFound: {
|
|
5827
|
-
id: "neptune.SelectInput.noResultsFound"
|
|
5828
|
-
}
|
|
5829
|
-
});
|
|
5830
|
-
|
|
5831
5932
|
function PreventScroll() {
|
|
5832
5933
|
overlays.usePreventScroll();
|
|
5833
5934
|
return null;
|
|
@@ -5947,7 +6048,7 @@ const ButtonInput = /*#__PURE__*/React.forwardRef(function ButtonInput({
|
|
|
5947
6048
|
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
5948
6049
|
ref: ref,
|
|
5949
6050
|
type: "button",
|
|
5950
|
-
className: classNames__default.default(className,
|
|
6051
|
+
className: classNames__default.default(className, inputClassNameBase({
|
|
5951
6052
|
size
|
|
5952
6053
|
}), 'np-button-input')
|
|
5953
6054
|
// eslint-disable-next-line react/forbid-dom-props
|
|
@@ -6063,6 +6164,12 @@ function Popover({
|
|
|
6063
6164
|
});
|
|
6064
6165
|
}
|
|
6065
6166
|
|
|
6167
|
+
var messages$5 = reactIntl.defineMessages({
|
|
6168
|
+
noResultsFound: {
|
|
6169
|
+
id: "neptune.SelectInput.noResultsFound"
|
|
6170
|
+
}
|
|
6171
|
+
});
|
|
6172
|
+
|
|
6066
6173
|
function searchableString(value) {
|
|
6067
6174
|
return value.trim().replace(/\s+/gu, ' ').normalize('NFKC').toLowerCase();
|
|
6068
6175
|
}
|
|
@@ -6182,7 +6289,7 @@ function SelectInputClearButton({
|
|
|
6182
6289
|
}
|
|
6183
6290
|
const noop = () => {};
|
|
6184
6291
|
function SelectInput({
|
|
6185
|
-
id,
|
|
6292
|
+
id: idProp,
|
|
6186
6293
|
name,
|
|
6187
6294
|
multiple,
|
|
6188
6295
|
placeholder,
|
|
@@ -6203,6 +6310,8 @@ function SelectInput({
|
|
|
6203
6310
|
onClose,
|
|
6204
6311
|
onClear
|
|
6205
6312
|
}) {
|
|
6313
|
+
const inputAttributes = useInputAttributes();
|
|
6314
|
+
const id = idProp ?? inputAttributes.id;
|
|
6206
6315
|
const [open, setOpen] = React.useState(false);
|
|
6207
6316
|
const initialized = React.useRef(false);
|
|
6208
6317
|
const handleClose = useEffectEvent(onClose ?? (() => {}));
|
|
@@ -6263,6 +6372,7 @@ function SelectInput({
|
|
|
6263
6372
|
ref(node);
|
|
6264
6373
|
triggerRef.current = node;
|
|
6265
6374
|
},
|
|
6375
|
+
...inputAttributes,
|
|
6266
6376
|
id,
|
|
6267
6377
|
...mergeProps__default.default({
|
|
6268
6378
|
onClick: () => {
|
|
@@ -6616,9 +6726,11 @@ const TextArea = /*#__PURE__*/React.forwardRef(function TextArea({
|
|
|
6616
6726
|
className,
|
|
6617
6727
|
...restProps
|
|
6618
6728
|
}, reference) {
|
|
6729
|
+
const inputAttributes = useInputAttributes();
|
|
6619
6730
|
return /*#__PURE__*/jsxRuntime.jsx("textarea", {
|
|
6620
6731
|
ref: reference,
|
|
6621
|
-
className: classNames__default.default(className,
|
|
6732
|
+
className: classNames__default.default(className, inputClassNameBase(), 'np-text-area'),
|
|
6733
|
+
...inputAttributes,
|
|
6622
6734
|
...restProps
|
|
6623
6735
|
});
|
|
6624
6736
|
});
|
|
@@ -9364,9 +9476,13 @@ function RadioGroup({
|
|
|
9364
9476
|
selectedValue: controlledValue,
|
|
9365
9477
|
onChange
|
|
9366
9478
|
}) {
|
|
9479
|
+
const inputAttributes = useInputAttributes({
|
|
9480
|
+
nonLabelable: true
|
|
9481
|
+
});
|
|
9367
9482
|
const [uncontrolledValue, setUncontrolledValue] = React.useState(controlledValue);
|
|
9368
9483
|
return radios.length > 0 ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
9369
9484
|
role: "radiogroup",
|
|
9485
|
+
...inputAttributes,
|
|
9370
9486
|
children: radios.map(({
|
|
9371
9487
|
value = '',
|
|
9372
9488
|
...restProps
|
|
@@ -10478,13 +10594,18 @@ const Summary = ({
|
|
|
10478
10594
|
};
|
|
10479
10595
|
|
|
10480
10596
|
const Switch = props => {
|
|
10597
|
+
const inputAttributes = useInputAttributes({
|
|
10598
|
+
nonLabelable: true
|
|
10599
|
+
});
|
|
10481
10600
|
const {
|
|
10482
10601
|
isModern
|
|
10483
10602
|
} = componentsTheming.useTheme();
|
|
10484
10603
|
const {
|
|
10485
10604
|
checked,
|
|
10486
10605
|
className,
|
|
10487
|
-
id,
|
|
10606
|
+
id = inputAttributes.id,
|
|
10607
|
+
'aria-label': ariaLabel,
|
|
10608
|
+
'aria-labelledby': ariaLabelledbyProp,
|
|
10488
10609
|
onClick,
|
|
10489
10610
|
disabled
|
|
10490
10611
|
} = props;
|
|
@@ -10515,19 +10636,18 @@ const Switch = props => {
|
|
|
10515
10636
|
})
|
|
10516
10637
|
});
|
|
10517
10638
|
};
|
|
10518
|
-
const
|
|
10519
|
-
const ariaLabelledby = ariaLabel ? undefined : props['aria-labelledby'];
|
|
10520
|
-
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);
|
|
10639
|
+
const ariaLabelledby = (ariaLabel ? undefined : ariaLabelledbyProp) ?? inputAttributes['aria-labelledby'];
|
|
10521
10640
|
return /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
10522
10641
|
className: classNames__default.default('np-switch', {
|
|
10523
10642
|
'np-switch--unchecked': !checked,
|
|
10524
10643
|
'np-switch--checked': checked,
|
|
10525
|
-
disabled
|
|
10644
|
+
disabled
|
|
10526
10645
|
}, className),
|
|
10527
10646
|
tabIndex: 0,
|
|
10528
10647
|
role: "switch",
|
|
10529
10648
|
"aria-checked": checked,
|
|
10530
10649
|
"aria-label": ariaLabel,
|
|
10650
|
+
...inputAttributes,
|
|
10531
10651
|
"aria-labelledby": ariaLabelledby,
|
|
10532
10652
|
id: id,
|
|
10533
10653
|
"aria-disabled": disabled,
|
|
@@ -14406,7 +14526,7 @@ exports.CriticalCommsBanner = CriticalCommsBanner;
|
|
|
14406
14526
|
exports.DEFAULT_LANG = DEFAULT_LANG;
|
|
14407
14527
|
exports.DEFAULT_LOCALE = DEFAULT_LOCALE;
|
|
14408
14528
|
exports.DateInput = DateInput;
|
|
14409
|
-
exports.DateLookup = DateLookup;
|
|
14529
|
+
exports.DateLookup = DateLookup$1;
|
|
14410
14530
|
exports.Decision = Decision;
|
|
14411
14531
|
exports.DefinitionList = DefinitionList$1;
|
|
14412
14532
|
exports.Dimmer = Dimmer$1;
|
|
@@ -14415,6 +14535,7 @@ exports.Display = Display;
|
|
|
14415
14535
|
exports.Drawer = Drawer$1;
|
|
14416
14536
|
exports.DropFade = DropFade;
|
|
14417
14537
|
exports.Emphasis = Emphasis;
|
|
14538
|
+
exports.Field = Field;
|
|
14418
14539
|
exports.FlowNavigation = FlowNavigation;
|
|
14419
14540
|
exports.Header = Header;
|
|
14420
14541
|
exports.Image = Image;
|
|
@@ -14424,6 +14545,7 @@ exports.Input = Input;
|
|
|
14424
14545
|
exports.InputGroup = InputGroup;
|
|
14425
14546
|
exports.InputWithDisplayFormat = InputWithDisplayFormat;
|
|
14426
14547
|
exports.InstructionsList = InstructionsList;
|
|
14548
|
+
exports.Label = Label;
|
|
14427
14549
|
exports.LanguageProvider = LanguageProvider;
|
|
14428
14550
|
exports.Link = Link;
|
|
14429
14551
|
exports.ListItem = ListItem$1;
|