@transferwise/components 0.0.0-experimental-946d3a7 → 0.0.0-experimental-bf4cb26
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 +157 -57
- package/build/index.js.map +1 -1
- package/build/index.mjs +157 -59
- 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/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 -2
- 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 +17 -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 +1 -1
- package/src/dateInput/DateInput.rtl.spec.tsx +17 -0
- package/src/dateInput/DateInput.tsx +24 -18
- 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 +8 -9
- package/src/inputs/SelectInput.tsx +9 -9
- 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.ts +28 -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,26 @@ 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 = false
|
|
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
|
+
|
|
2595
2615
|
var messages$9 = defineMessages({
|
|
2596
2616
|
monthLabel: {
|
|
2597
2617
|
id: "neptune.DateInput.month.label"
|
|
@@ -2616,7 +2636,7 @@ const convertToLocalMidnight = date => {
|
|
|
2616
2636
|
};
|
|
2617
2637
|
|
|
2618
2638
|
const DateInput = ({
|
|
2619
|
-
'aria-labelledby':
|
|
2639
|
+
'aria-labelledby': ariaLabelledByProp,
|
|
2620
2640
|
'aria-label': ariaLabel,
|
|
2621
2641
|
disabled = false,
|
|
2622
2642
|
size = Size.MEDIUM,
|
|
@@ -2632,9 +2652,14 @@ const DateInput = ({
|
|
|
2632
2652
|
onFocus,
|
|
2633
2653
|
onBlur,
|
|
2634
2654
|
placeholders,
|
|
2635
|
-
id,
|
|
2655
|
+
id: idProp,
|
|
2636
2656
|
selectProps = {}
|
|
2637
2657
|
}) => {
|
|
2658
|
+
const inputAttributes = useInputAttributes({
|
|
2659
|
+
nonLabelable: true
|
|
2660
|
+
});
|
|
2661
|
+
const id = idProp ?? inputAttributes.id;
|
|
2662
|
+
const ariaLabelledBy = ariaLabelledByProp ?? inputAttributes['aria-labelledby'];
|
|
2638
2663
|
const {
|
|
2639
2664
|
locale,
|
|
2640
2665
|
formatMessage
|
|
@@ -2671,9 +2696,9 @@ const DateInput = ({
|
|
|
2671
2696
|
const [year, setYear] = useState(() => getInitialDate('year'));
|
|
2672
2697
|
const [lastBroadcastedValue, setLastBroadcastedValue] = useState(getDateObject);
|
|
2673
2698
|
const monthNames = getMonthNames(locale, monthFormat);
|
|
2674
|
-
dayLabel
|
|
2675
|
-
monthLabel
|
|
2676
|
-
yearLabel
|
|
2699
|
+
dayLabel ||= formatMessage(messages$9.dayLabel);
|
|
2700
|
+
monthLabel ||= formatMessage(messages$9.monthLabel);
|
|
2701
|
+
yearLabel ||= formatMessage(messages$9.yearLabel);
|
|
2677
2702
|
placeholders = {
|
|
2678
2703
|
day: placeholders?.day || formatMessage(messages$9.dayPlaceholder),
|
|
2679
2704
|
month: placeholders?.month || formatMessage(messages$9.monthLabel),
|
|
@@ -2864,6 +2889,7 @@ const DateInput = ({
|
|
|
2864
2889
|
const yearFirst = YMD.has(locale);
|
|
2865
2890
|
return /*#__PURE__*/jsx("div", {
|
|
2866
2891
|
className: "tw-date",
|
|
2892
|
+
...inputAttributes,
|
|
2867
2893
|
id: id,
|
|
2868
2894
|
"aria-labelledby": ariaLabelledBy,
|
|
2869
2895
|
"aria-label": ariaLabel,
|
|
@@ -2883,15 +2909,15 @@ const DateInput = ({
|
|
|
2883
2909
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
2884
2910
|
children: [getMonth(), getDay(), getYear()]
|
|
2885
2911
|
});
|
|
2886
|
-
}
|
|
2912
|
+
}
|
|
2913
|
+
if (yearFirst) {
|
|
2887
2914
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
2888
2915
|
children: [getYear(), getMonth(), getDay()]
|
|
2889
2916
|
});
|
|
2890
|
-
} else {
|
|
2891
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
2892
|
-
children: [getDay(), getMonth(), getYear()]
|
|
2893
|
-
});
|
|
2894
2917
|
}
|
|
2918
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
2919
|
+
children: [getDay(), getMonth(), getYear()]
|
|
2920
|
+
});
|
|
2895
2921
|
})()
|
|
2896
2922
|
})
|
|
2897
2923
|
});
|
|
@@ -4873,6 +4899,84 @@ const FlowNavigation = ({
|
|
|
4873
4899
|
});
|
|
4874
4900
|
};
|
|
4875
4901
|
|
|
4902
|
+
function InlineAlert({
|
|
4903
|
+
id,
|
|
4904
|
+
type = 'neutral',
|
|
4905
|
+
className,
|
|
4906
|
+
children
|
|
4907
|
+
}) {
|
|
4908
|
+
const danger = type === 'negative' || type === 'error';
|
|
4909
|
+
return /*#__PURE__*/jsxs("div", {
|
|
4910
|
+
role: "alert",
|
|
4911
|
+
id: id,
|
|
4912
|
+
className: classNames('alert alert-detach', `alert-${danger ? 'danger' : type}`, className),
|
|
4913
|
+
children: [danger && /*#__PURE__*/jsx(AlertCircle, {}), /*#__PURE__*/jsx("div", {
|
|
4914
|
+
children: children
|
|
4915
|
+
})]
|
|
4916
|
+
});
|
|
4917
|
+
}
|
|
4918
|
+
|
|
4919
|
+
const Label = ({
|
|
4920
|
+
id,
|
|
4921
|
+
htmlFor,
|
|
4922
|
+
className,
|
|
4923
|
+
children
|
|
4924
|
+
}) => {
|
|
4925
|
+
return /*#__PURE__*/jsx("label", {
|
|
4926
|
+
id: id,
|
|
4927
|
+
htmlFor: htmlFor,
|
|
4928
|
+
className: classNames('control-label d-flex flex-column gap-y-1 m-b-0', className),
|
|
4929
|
+
children: children
|
|
4930
|
+
});
|
|
4931
|
+
};
|
|
4932
|
+
|
|
4933
|
+
const Field = ({
|
|
4934
|
+
id,
|
|
4935
|
+
label,
|
|
4936
|
+
hint,
|
|
4937
|
+
error,
|
|
4938
|
+
className,
|
|
4939
|
+
children
|
|
4940
|
+
}) => {
|
|
4941
|
+
const hasError = Boolean(error);
|
|
4942
|
+
const hasHint = Boolean(hint) && !hasError;
|
|
4943
|
+
const labelId = useId();
|
|
4944
|
+
const fallbackInputId = useId(); // TODO: Use `React.useId()` when react>=18
|
|
4945
|
+
const inputId = id !== null ? id ?? fallbackInputId : undefined;
|
|
4946
|
+
const descriptionId = useId(); // TODO: Use `React.useId()` when react>=18
|
|
4947
|
+
return /*#__PURE__*/jsx(FieldLabelIdContextProvider, {
|
|
4948
|
+
value: labelId,
|
|
4949
|
+
children: /*#__PURE__*/jsx(InputIdContextProvider, {
|
|
4950
|
+
value: inputId,
|
|
4951
|
+
children: /*#__PURE__*/jsx(InputDescribedByProvider, {
|
|
4952
|
+
value: hasError || hasHint ? descriptionId : undefined,
|
|
4953
|
+
children: /*#__PURE__*/jsx(InputInvalidProvider, {
|
|
4954
|
+
value: hasError,
|
|
4955
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
4956
|
+
className: classNames('form-group d-block', {
|
|
4957
|
+
'has-error': hasError,
|
|
4958
|
+
'has-info': hasHint
|
|
4959
|
+
}, className),
|
|
4960
|
+
children: [/*#__PURE__*/jsxs(Label, {
|
|
4961
|
+
id: labelId,
|
|
4962
|
+
htmlFor: inputId,
|
|
4963
|
+
children: [label, children]
|
|
4964
|
+
}), hasHint && /*#__PURE__*/jsx(InlineAlert, {
|
|
4965
|
+
type: Sentiment.NEUTRAL,
|
|
4966
|
+
id: descriptionId,
|
|
4967
|
+
children: hint
|
|
4968
|
+
}), hasError && /*#__PURE__*/jsx(InlineAlert, {
|
|
4969
|
+
type: Sentiment.NEGATIVE,
|
|
4970
|
+
id: descriptionId,
|
|
4971
|
+
children: error
|
|
4972
|
+
})]
|
|
4973
|
+
})
|
|
4974
|
+
})
|
|
4975
|
+
})
|
|
4976
|
+
})
|
|
4977
|
+
});
|
|
4978
|
+
};
|
|
4979
|
+
|
|
4876
4980
|
const HeaderAction = ({
|
|
4877
4981
|
action
|
|
4878
4982
|
}) => {
|
|
@@ -5205,20 +5309,16 @@ const Info = ({
|
|
|
5205
5309
|
});
|
|
5206
5310
|
};
|
|
5207
5311
|
|
|
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
|
-
})]
|
|
5312
|
+
function inputClassNameBase({
|
|
5313
|
+
size = 'auto'
|
|
5314
|
+
} = {}) {
|
|
5315
|
+
return classNames('form-control',
|
|
5316
|
+
// TODO: Deprecate
|
|
5317
|
+
'np-form-control', {
|
|
5318
|
+
'np-form-control--size-auto': size === 'auto',
|
|
5319
|
+
'np-form-control--size-sm': size === 'sm',
|
|
5320
|
+
'np-form-control--size-md': size === 'md',
|
|
5321
|
+
'np-form-control--size-lg': size === 'lg'
|
|
5222
5322
|
});
|
|
5223
5323
|
}
|
|
5224
5324
|
|
|
@@ -5340,29 +5440,17 @@ function InputAddon({
|
|
|
5340
5440
|
});
|
|
5341
5441
|
}
|
|
5342
5442
|
|
|
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
5443
|
const Input = /*#__PURE__*/forwardRef(function Input({
|
|
5357
5444
|
size = 'auto',
|
|
5358
5445
|
shape = 'rectangle',
|
|
5359
5446
|
className,
|
|
5360
5447
|
...restProps
|
|
5361
5448
|
}, reference) {
|
|
5449
|
+
const inputAttributes = useInputAttributes();
|
|
5362
5450
|
const inputPaddings = useInputPaddings();
|
|
5363
5451
|
return /*#__PURE__*/jsx("input", {
|
|
5364
5452
|
ref: reference,
|
|
5365
|
-
className: classNames(className,
|
|
5453
|
+
className: classNames(className, inputClassNameBase({
|
|
5366
5454
|
size
|
|
5367
5455
|
}), 'np-input', {
|
|
5368
5456
|
'np-input--shape-rectangle': shape === 'rectangle',
|
|
@@ -5371,6 +5459,7 @@ const Input = /*#__PURE__*/forwardRef(function Input({
|
|
|
5371
5459
|
// eslint-disable-next-line react/forbid-dom-props
|
|
5372
5460
|
,
|
|
5373
5461
|
style: inputPaddings,
|
|
5462
|
+
...inputAttributes,
|
|
5374
5463
|
...restProps
|
|
5375
5464
|
});
|
|
5376
5465
|
});
|
|
@@ -5792,12 +5881,6 @@ const PolymorphicWithOverrides = /*#__PURE__*/forwardRef(function PolymorphicWit
|
|
|
5792
5881
|
});
|
|
5793
5882
|
});
|
|
5794
5883
|
|
|
5795
|
-
var messages$5 = defineMessages({
|
|
5796
|
-
noResultsFound: {
|
|
5797
|
-
id: "neptune.SelectInput.noResultsFound"
|
|
5798
|
-
}
|
|
5799
|
-
});
|
|
5800
|
-
|
|
5801
5884
|
function PreventScroll() {
|
|
5802
5885
|
usePreventScroll();
|
|
5803
5886
|
return null;
|
|
@@ -5917,7 +6000,7 @@ const ButtonInput = /*#__PURE__*/forwardRef(function ButtonInput({
|
|
|
5917
6000
|
return /*#__PURE__*/jsx("button", {
|
|
5918
6001
|
ref: ref,
|
|
5919
6002
|
type: "button",
|
|
5920
|
-
className: classNames(className,
|
|
6003
|
+
className: classNames(className, inputClassNameBase({
|
|
5921
6004
|
size
|
|
5922
6005
|
}), 'np-button-input')
|
|
5923
6006
|
// eslint-disable-next-line react/forbid-dom-props
|
|
@@ -6033,6 +6116,12 @@ function Popover({
|
|
|
6033
6116
|
});
|
|
6034
6117
|
}
|
|
6035
6118
|
|
|
6119
|
+
var messages$5 = defineMessages({
|
|
6120
|
+
noResultsFound: {
|
|
6121
|
+
id: "neptune.SelectInput.noResultsFound"
|
|
6122
|
+
}
|
|
6123
|
+
});
|
|
6124
|
+
|
|
6036
6125
|
function searchableString(value) {
|
|
6037
6126
|
return value.trim().replace(/\s+/gu, ' ').normalize('NFKC').toLowerCase();
|
|
6038
6127
|
}
|
|
@@ -6152,7 +6241,7 @@ function SelectInputClearButton({
|
|
|
6152
6241
|
}
|
|
6153
6242
|
const noop = () => {};
|
|
6154
6243
|
function SelectInput({
|
|
6155
|
-
id,
|
|
6244
|
+
id: idProp,
|
|
6156
6245
|
name,
|
|
6157
6246
|
multiple,
|
|
6158
6247
|
placeholder,
|
|
@@ -6170,9 +6259,10 @@ function SelectInput({
|
|
|
6170
6259
|
className,
|
|
6171
6260
|
onFilterChange = noop,
|
|
6172
6261
|
onChange,
|
|
6173
|
-
onClear
|
|
6174
|
-
onBlur
|
|
6262
|
+
onClear
|
|
6175
6263
|
}) {
|
|
6264
|
+
const inputAttributes = useInputAttributes();
|
|
6265
|
+
const id = idProp ?? inputAttributes.id;
|
|
6176
6266
|
const [open, setOpen] = useState(false);
|
|
6177
6267
|
const [filterQuery, _setFilterQuery] = useState('');
|
|
6178
6268
|
const setFilterQuery = useEffectEvent(query => {
|
|
@@ -6222,6 +6312,7 @@ function SelectInput({
|
|
|
6222
6312
|
ref(node);
|
|
6223
6313
|
triggerRef.current = node;
|
|
6224
6314
|
},
|
|
6315
|
+
...inputAttributes,
|
|
6225
6316
|
id,
|
|
6226
6317
|
...mergeProps({
|
|
6227
6318
|
onClick: () => {
|
|
@@ -6231,9 +6322,6 @@ function SelectInput({
|
|
|
6231
6322
|
if (event.key === ' ' || event.key === 'Enter' || event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
6232
6323
|
setOpen(prev => !prev);
|
|
6233
6324
|
}
|
|
6234
|
-
},
|
|
6235
|
-
onBlur: () => {
|
|
6236
|
-
onBlur?.();
|
|
6237
6325
|
}
|
|
6238
6326
|
}, getInteractionProps())
|
|
6239
6327
|
},
|
|
@@ -6578,9 +6666,11 @@ const TextArea = /*#__PURE__*/forwardRef(function TextArea({
|
|
|
6578
6666
|
className,
|
|
6579
6667
|
...restProps
|
|
6580
6668
|
}, reference) {
|
|
6669
|
+
const inputAttributes = useInputAttributes();
|
|
6581
6670
|
return /*#__PURE__*/jsx("textarea", {
|
|
6582
6671
|
ref: reference,
|
|
6583
|
-
className: classNames(className,
|
|
6672
|
+
className: classNames(className, inputClassNameBase(), 'np-text-area'),
|
|
6673
|
+
...inputAttributes,
|
|
6584
6674
|
...restProps
|
|
6585
6675
|
});
|
|
6586
6676
|
});
|
|
@@ -9326,9 +9416,13 @@ function RadioGroup({
|
|
|
9326
9416
|
selectedValue: controlledValue,
|
|
9327
9417
|
onChange
|
|
9328
9418
|
}) {
|
|
9419
|
+
const inputAttributes = useInputAttributes({
|
|
9420
|
+
nonLabelable: true
|
|
9421
|
+
});
|
|
9329
9422
|
const [uncontrolledValue, setUncontrolledValue] = useState(controlledValue);
|
|
9330
9423
|
return radios.length > 0 ? /*#__PURE__*/jsx("div", {
|
|
9331
9424
|
role: "radiogroup",
|
|
9425
|
+
...inputAttributes,
|
|
9332
9426
|
children: radios.map(({
|
|
9333
9427
|
value = '',
|
|
9334
9428
|
...restProps
|
|
@@ -10440,13 +10534,18 @@ const Summary = ({
|
|
|
10440
10534
|
};
|
|
10441
10535
|
|
|
10442
10536
|
const Switch = props => {
|
|
10537
|
+
const inputAttributes = useInputAttributes({
|
|
10538
|
+
nonLabelable: true
|
|
10539
|
+
});
|
|
10443
10540
|
const {
|
|
10444
10541
|
isModern
|
|
10445
10542
|
} = useTheme();
|
|
10446
10543
|
const {
|
|
10447
10544
|
checked,
|
|
10448
10545
|
className,
|
|
10449
|
-
id,
|
|
10546
|
+
id = inputAttributes.id,
|
|
10547
|
+
'aria-label': ariaLabel,
|
|
10548
|
+
'aria-labelledby': ariaLabelledbyProp,
|
|
10450
10549
|
onClick,
|
|
10451
10550
|
disabled
|
|
10452
10551
|
} = props;
|
|
@@ -10477,19 +10576,18 @@ const Switch = props => {
|
|
|
10477
10576
|
})
|
|
10478
10577
|
});
|
|
10479
10578
|
};
|
|
10480
|
-
const
|
|
10481
|
-
const ariaLabelledby = ariaLabel ? undefined : props['aria-labelledby'];
|
|
10482
|
-
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);
|
|
10579
|
+
const ariaLabelledby = (ariaLabel ? undefined : ariaLabelledbyProp) ?? inputAttributes['aria-labelledby'];
|
|
10483
10580
|
return /*#__PURE__*/jsxs("span", {
|
|
10484
10581
|
className: classNames('np-switch', {
|
|
10485
10582
|
'np-switch--unchecked': !checked,
|
|
10486
10583
|
'np-switch--checked': checked,
|
|
10487
|
-
disabled
|
|
10584
|
+
disabled
|
|
10488
10585
|
}, className),
|
|
10489
10586
|
tabIndex: 0,
|
|
10490
10587
|
role: "switch",
|
|
10491
10588
|
"aria-checked": checked,
|
|
10492
10589
|
"aria-label": ariaLabel,
|
|
10590
|
+
...inputAttributes,
|
|
10493
10591
|
"aria-labelledby": ariaLabelledby,
|
|
10494
10592
|
id: id,
|
|
10495
10593
|
"aria-disabled": disabled,
|
|
@@ -14345,5 +14443,5 @@ const translations = {
|
|
|
14345
14443
|
'zh-HK': zhHK
|
|
14346
14444
|
};
|
|
14347
14445
|
|
|
14348
|
-
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 };
|
|
14446
|
+
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, 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 };
|
|
14349
14447
|
//# sourceMappingURL=index.mjs.map
|