@gusto/embedded-react-sdk 0.8.0 → 0.8.1
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/CHANGELOG.md +9 -0
- package/dist/components/Common/DataView/DataCards/DataCards.module.scss.js +5 -3
- package/dist/components/Common/DataView/DataCards/DataCards.module.scss.js.map +1 -1
- package/dist/components/Common/FadeIn/FadeIn.module.scss.js +4 -4
- package/dist/components/Common/{UI/FieldCaption → FieldCaption}/FieldCaption.js +1 -1
- package/dist/components/Common/FieldCaption/FieldCaption.js.map +1 -0
- package/dist/components/Common/{UI/FieldDescription → FieldDescription}/FieldDescription.js +1 -1
- package/dist/components/Common/FieldDescription/FieldDescription.js.map +1 -0
- package/dist/components/Common/{UI/FieldErrorMessage → FieldErrorMessage}/FieldErrorMessage.js +1 -1
- package/dist/components/Common/FieldErrorMessage/FieldErrorMessage.js.map +1 -0
- package/dist/components/Common/{UI/FieldLayout → FieldLayout}/FieldLayout.js +1 -1
- package/dist/components/Common/FieldLayout/FieldLayout.js.map +1 -0
- package/dist/components/Common/FieldLayout/FieldLayoutTypes.d.ts +52 -0
- package/dist/components/Common/{UI/Fieldset → Fieldset}/Fieldset.js +1 -1
- package/dist/components/Common/Fieldset/Fieldset.js.map +1 -0
- package/dist/components/Common/{UI/HorizontalFieldLayout → HorizontalFieldLayout}/HorizontalFieldLayout.js +2 -2
- package/dist/components/Common/HorizontalFieldLayout/HorizontalFieldLayout.js.map +1 -0
- package/dist/components/Common/SignatureForm/SignatureForm.d.ts +12 -6
- package/dist/components/Common/SignatureForm/SignatureForm.js +10 -10
- package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Common/UI/Alert/Alert.d.ts +1 -1
- package/dist/components/Common/UI/Alert/Alert.js +13 -12
- package/dist/components/Common/UI/Alert/Alert.js.map +1 -1
- package/dist/components/Common/UI/Alert/AlertTypes.d.ts +16 -4
- package/dist/components/Common/UI/Badge/BadgeTypes.d.ts +6 -0
- package/dist/components/Common/UI/Button/Button.js +28 -27
- package/dist/components/Common/UI/Button/Button.js.map +1 -1
- package/dist/components/Common/UI/Button/Button.module.scss.js +1 -1
- package/dist/components/Common/UI/Button/ButtonTypes.d.ts +29 -4
- package/dist/components/Common/UI/CalendarPreview/CalendarPreviewTypes.d.ts +24 -0
- package/dist/components/Common/UI/Card/Card.module.scss.js +1 -1
- package/dist/components/Common/UI/Card/CardTypes.d.ts +12 -4
- package/dist/components/Common/UI/Checkbox/Checkbox.js +4 -4
- package/dist/components/Common/UI/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Common/UI/Checkbox/CheckboxTypes.d.ts +16 -1
- package/dist/components/Common/UI/CheckboxGroup/CheckboxGroup.js +4 -4
- package/dist/components/Common/UI/CheckboxGroup/CheckboxGroup.js.map +1 -1
- package/dist/components/Common/UI/CheckboxGroup/CheckboxGroupTypes.d.ts +33 -3
- package/dist/components/Common/UI/ComboBox/ComboBox.js +8 -8
- package/dist/components/Common/UI/ComboBox/ComboBox.js.map +1 -1
- package/dist/components/Common/UI/ComboBox/ComboBoxTypes.d.ts +31 -1
- package/dist/components/Common/UI/DatePicker/DatePicker.js +13 -13
- package/dist/components/Common/UI/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/Common/UI/DatePicker/DatePickerTypes.d.ts +25 -1
- package/dist/components/Common/UI/Heading/HeadingTypes.d.ts +12 -0
- package/dist/components/Common/UI/Link/LinkTypes.d.ts +53 -1
- package/dist/components/Common/UI/List/ListTypes.d.ts +3 -5
- package/dist/components/Common/UI/Menu/MenuTypes.d.ts +30 -0
- package/dist/components/Common/UI/NumberInput/NumberInput.js +4 -4
- package/dist/components/Common/UI/NumberInput/NumberInput.js.map +1 -1
- package/dist/components/Common/UI/NumberInput/NumberInputTypes.d.ts +34 -1
- package/dist/components/Common/UI/ProgressBar/ProgressBarTypes.d.ts +12 -0
- package/dist/components/Common/UI/Radio/Radio.js +1 -1
- package/dist/components/Common/UI/Radio/Radio.js.map +1 -1
- package/dist/components/Common/UI/Radio/RadioTypes.d.ts +16 -1
- package/dist/components/Common/UI/RadioGroup/RadioGroup.js +4 -4
- package/dist/components/Common/UI/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/Common/UI/RadioGroup/RadioGroupTypes.d.ts +33 -3
- package/dist/components/Common/UI/Select/Select.js +8 -8
- package/dist/components/Common/UI/Select/Select.js.map +1 -1
- package/dist/components/Common/UI/Select/SelectTypes.d.ts +34 -1
- package/dist/components/Common/UI/Switch/Switch.js +1 -1
- package/dist/components/Common/UI/Switch/Switch.js.map +1 -1
- package/dist/components/Common/UI/Switch/SwitchTypes.d.ts +25 -1
- package/dist/components/Common/UI/Table/TableTypes.d.ts +21 -0
- package/dist/components/Common/UI/Text/TextTypes.d.ts +18 -0
- package/dist/components/Common/UI/TextInput/TextInput.js +1 -1
- package/dist/components/Common/UI/TextInput/TextInput.js.map +1 -1
- package/dist/components/Common/UI/TextInput/TextInputTypes.d.ts +22 -1
- package/dist/components/Company/AssignSignatory/AssignSignatory.js +12 -12
- package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +7 -7
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.d.ts +2 -2
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Schema.d.ts +41 -15
- package/dist/components/Company/AssignSignatory/CreateSignatory/Schema.js +17 -20
- package/dist/components/Company/AssignSignatory/CreateSignatory/Schema.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +10 -10
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.d.ts +17 -11
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +42 -45
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js +6 -6
- package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Form.d.ts +12 -6
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js +2 -2
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js +10 -10
- package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.d.ts +12 -6
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +17 -17
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
- package/dist/components/Company/DocumentSignerFlow/SignatureForm/SignatureForm.js +1 -1
- package/dist/components/Company/DocumentSignerFlow/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/FederalTaxes.js +5 -5
- package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.d.ts +18 -8
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +12 -16
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Industry.js +1 -1
- package/dist/components/Company/Industry/Industry.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Form.d.ts +27 -11
- package/dist/components/Company/Locations/LocationForm/Form.js +24 -24
- package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/LocationForm.js +24 -24
- package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +7 -7
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/List.js +28 -31
- package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/List.module.scss.js +8 -0
- package/dist/components/Company/PaySchedule/_parts/List.module.scss.js.map +1 -0
- package/dist/components/Company/PaySchedule/usePaySchedule.d.ts +31 -13
- package/dist/components/Company/PaySchedule/usePaySchedule.js +15 -20
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Form.d.ts +3 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js +3 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +66 -77
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
- package/dist/components/Employee/Compensation/Compensation.js +5 -5
- package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
- package/dist/components/Employee/Compensation/List.js +10 -10
- package/dist/components/Employee/Compensation/List.js.map +1 -1
- package/dist/components/Employee/Compensation/useCompensation.d.ts +90 -42
- package/dist/components/Employee/Compensation/useCompensation.js +45 -69
- package/dist/components/Employee/Compensation/useCompensation.js.map +1 -1
- package/dist/components/Employee/Deductions/Deductions.d.ts +9 -5
- package/dist/components/Employee/Deductions/Deductions.js +13 -13
- package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
- package/dist/components/Employee/Deductions/useDeductions.d.ts +34 -14
- package/dist/components/Employee/Deductions/useDeductions.js +14 -32
- package/dist/components/Employee/Deductions/useDeductions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/EmployeeList.js +1 -1
- package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccount.d.ts +22 -10
- package/dist/components/Employee/PaymentMethod/BankAccount.js +9 -9
- package/dist/components/Employee/PaymentMethod/BankAccount.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js +13 -13
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.d.ts +10 -6
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +8 -8
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.d.ts +92 -37
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +35 -42
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +68 -31
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +33 -46
- package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
- package/dist/components/Employee/Profile/HomeAddress.d.ts +33 -13
- package/dist/components/Employee/Profile/HomeAddress.js +39 -38
- package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.d.ts +81 -32
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +60 -74
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
- package/dist/components/Employee/Profile/Profile.js +51 -55
- package/dist/components/Employee/Profile/Profile.js.map +1 -1
- package/dist/components/Employee/Profile/SelfPersonalDetails.d.ts +44 -15
- package/dist/components/Employee/Profile/SelfPersonalDetails.js +18 -21
- package/dist/components/Employee/Profile/SelfPersonalDetails.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.d.ts +28 -12
- package/dist/components/Employee/Taxes/FederalForm.js +28 -28
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Taxes/StateForm.d.ts +9 -5
- package/dist/components/Employee/Taxes/StateForm.js +5 -5
- package/dist/components/Employee/Taxes/StateForm.js.map +1 -1
- package/dist/components/Employee/Taxes/Taxes.js +31 -34
- package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.d.ts +5 -0
- package/dist/contexts/ApiProvider/ApiProvider.js +34 -0
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +16 -16
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/helpers/validations.d.ts +6 -5
- package/dist/helpers/validations.js +10 -17
- package/dist/helpers/validations.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +7 -4
- package/dist/components/Common/UI/FieldCaption/FieldCaption.js.map +0 -1
- package/dist/components/Common/UI/FieldDescription/FieldDescription.js.map +0 -1
- package/dist/components/Common/UI/FieldErrorMessage/FieldErrorMessage.js.map +0 -1
- package/dist/components/Common/UI/FieldLayout/FieldLayout.js.map +0 -1
- package/dist/components/Common/UI/FieldLayout/FieldLayoutTypes.d.ts +0 -19
- package/dist/components/Common/UI/Fieldset/Fieldset.js.map +0 -1
- package/dist/components/Common/UI/HorizontalFieldLayout/HorizontalFieldLayout.js.map +0 -1
- /package/dist/components/Common/{UI/FieldCaption → FieldCaption}/FieldCaption.d.ts +0 -0
- /package/dist/components/Common/{UI/FieldCaption → FieldCaption}/FieldCaption.module.scss.js +0 -0
- /package/dist/components/Common/{UI/FieldCaption → FieldCaption}/FieldCaption.module.scss.js.map +0 -0
- /package/dist/components/Common/{UI/FieldCaption → FieldCaption}/index.d.ts +0 -0
- /package/dist/components/Common/{UI/FieldDescription → FieldDescription}/FieldDescription.d.ts +0 -0
- /package/dist/components/Common/{UI/FieldDescription → FieldDescription}/FieldDescription.module.scss.js +0 -0
- /package/dist/components/Common/{UI/FieldDescription → FieldDescription}/FieldDescription.module.scss.js.map +0 -0
- /package/dist/components/Common/{UI/FieldDescription → FieldDescription}/index.d.ts +0 -0
- /package/dist/components/Common/{UI/FieldErrorMessage → FieldErrorMessage}/FieldErrorMessage.d.ts +0 -0
- /package/dist/components/Common/{UI/FieldErrorMessage → FieldErrorMessage}/FieldErrorMessage.module.scss.js +0 -0
- /package/dist/components/Common/{UI/FieldErrorMessage → FieldErrorMessage}/FieldErrorMessage.module.scss.js.map +0 -0
- /package/dist/components/Common/{UI/FieldErrorMessage → FieldErrorMessage}/index.d.ts +0 -0
- /package/dist/components/Common/{UI/FieldLayout → FieldLayout}/FieldLayout.d.ts +0 -0
- /package/dist/components/Common/{UI/FieldLayout → FieldLayout}/FieldLayout.module.scss.js +0 -0
- /package/dist/components/Common/{UI/FieldLayout → FieldLayout}/FieldLayout.module.scss.js.map +0 -0
- /package/dist/components/Common/{UI/FieldLayout → FieldLayout}/index.d.ts +0 -0
- /package/dist/components/Common/{UI/Fieldset → Fieldset}/Fieldset.d.ts +0 -0
- /package/dist/components/Common/{UI/Fieldset → Fieldset}/Fieldset.module.scss.js +0 -0
- /package/dist/components/Common/{UI/Fieldset → Fieldset}/Fieldset.module.scss.js.map +0 -0
- /package/dist/components/Common/{UI/Fieldset → Fieldset}/index.d.ts +0 -0
- /package/dist/components/Common/{UI/HorizontalFieldLayout → HorizontalFieldLayout}/HorizontalFieldLayout.d.ts +0 -0
- /package/dist/components/Common/{UI/HorizontalFieldLayout → HorizontalFieldLayout}/HorizontalFieldLayout.module.scss.js +0 -0
- /package/dist/components/Common/{UI/HorizontalFieldLayout → HorizontalFieldLayout}/HorizontalFieldLayout.module.scss.js.map +0 -0
- /package/dist/components/Common/{UI/HorizontalFieldLayout → HorizontalFieldLayout}/HorizontalFieldLayoutTypes.d.ts +0 -0
- /package/dist/components/Common/{UI/HorizontalFieldLayout → HorizontalFieldLayout}/index.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.js","sources":["../../../../../src/components/Common/UI/NumberInput/NumberInput.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { Group, NumberField as AriaNumberField } from 'react-aria-components'\nimport classNames from 'classnames'\nimport {
|
|
1
|
+
{"version":3,"file":"NumberInput.js","sources":["../../../../../src/components/Common/UI/NumberInput/NumberInput.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { Group, NumberField as AriaNumberField } from 'react-aria-components'\nimport classNames from 'classnames'\nimport { Input } from '../Input'\nimport { useFieldIds } from '../hooks/useFieldIds'\nimport styles from './NumberInput.module.scss'\nimport type { NumberInputProps } from './NumberInputTypes'\nimport { FieldLayout } from '@/components/Common/FieldLayout'\nimport { useLocale } from '@/contexts/LocaleProvider'\n\nexport function NumberInput({\n name,\n format,\n inputRef,\n id,\n value,\n description,\n errorMessage,\n isRequired,\n placeholder,\n isInvalid,\n isDisabled,\n onChange,\n onBlur,\n label,\n min,\n max,\n shouldVisuallyHideLabel,\n adornmentStart,\n adornmentEnd,\n className,\n maximumFractionDigits,\n minimumFractionDigits,\n ...props\n}: NumberInputProps) {\n const { locale, currency } = useLocale()\n const { inputId, errorMessageId, descriptionId, ariaDescribedBy } = useFieldIds({\n inputId: id,\n errorMessage,\n description,\n })\n\n const minValue = typeof min === 'string' ? Number(min) : min\n const maxValue = typeof max === 'string' ? Number(max) : max\n\n const currencySymbol = useMemo(() => {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n })\n .formatToParts(0)\n .find(part => part.type === 'currency')?.value\n }, [currency, locale])\n\n return (\n <FieldLayout\n label={label}\n description={description}\n errorMessage={errorMessage}\n isRequired={isRequired}\n htmlFor={inputId}\n errorMessageId={errorMessageId}\n descriptionId={descriptionId}\n shouldVisuallyHideLabel={shouldVisuallyHideLabel}\n className={classNames(styles.root, className)}\n withErrorIcon={false}\n {...props}\n >\n <AriaNumberField\n value={value}\n name={name}\n formatOptions={{\n style: 'decimal',\n minimumFractionDigits: format === 'currency' ? 2 : minimumFractionDigits,\n maximumFractionDigits: format === 'currency' ? 2 : maximumFractionDigits,\n currency,\n currencyDisplay: 'symbol',\n }}\n isInvalid={isInvalid}\n isDisabled={isDisabled}\n isRequired={isRequired}\n validationBehavior=\"aria\"\n onChange={onChange}\n // This is a hack to silence an unnecessary react-aria warning. The FieldLayout component\n // already associates the label and input with htmlFor + ID. If we include a label id here,\n // the label will get read twice by assistive tech. This evaluates to an empty string which\n // does not get associated with any elements and does not get read.\n aria-labelledby=\" \"\n minValue={minValue}\n maxValue={maxValue}\n {...props}\n >\n <Group>\n <Input\n adornmentStart={adornmentStart || (format === 'currency' ? currencySymbol : null)}\n adornmentEnd={adornmentEnd || (format === 'percent' ? '%' : null)}\n id={inputId}\n inputRef={inputRef}\n onBlur={onBlur}\n placeholder={placeholder}\n aria-describedby={ariaDescribedBy}\n isDisabled={isDisabled}\n />\n </Group>\n </AriaNumberField>\n </FieldLayout>\n )\n}\n"],"names":["NumberInput","name","format","inputRef","id","value","description","errorMessage","isRequired","placeholder","isInvalid","isDisabled","onChange","onBlur","label","min","max","shouldVisuallyHideLabel","adornmentStart","adornmentEnd","className","maximumFractionDigits","minimumFractionDigits","props","locale","currency","useLocale","inputId","errorMessageId","descriptionId","ariaDescribedBy","useFieldIds","minValue","maxValue","currencySymbol","useMemo","part","jsx","FieldLayout","classNames","styles","AriaNumberField","Group","Input"],"mappings":";;;;;;;;;AAUO,SAASA,EAAY;AAAA,EAC1B,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,IAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,KAAAC;AAAA,EACA,KAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,WAAAC;AAAA,EACA,uBAAAC;AAAA,EAC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AA,UAChB,UAAAoB;AAAA,UACA,UAAAC;AAAA,UACC,GAAGV;AAAA,UAEJ,4BAACmB,GACC,EAAA,UAAA,gBAAAL;AAAA,YAACM;AAAA,YAAA;AAAA,cACC,gBAAgBzB,MAAmBhB,MAAW,aAAagC,IAAiB;AAAA,cAC5E,cAAcf,MAAiBjB,MAAW,YAAY,MAAM;AAAA,cAC5D,IAAIyB;AAAA,cACJ,UAAAxB;AAAA,cACA,QAAAU;AAAA,cACA,aAAAJ;AAAA,cACA,oBAAkBqB;AAAA,cAClB,YAAAnB;AAAA,YAAA;AAAA,UAAA,EAEJ,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EACF;AAEJ;"}
|
|
@@ -1,16 +1,49 @@
|
|
|
1
1
|
import { FocusEventHandler, InputHTMLAttributes, Ref } from 'react';
|
|
2
|
-
import { SharedFieldLayoutProps } from '../FieldLayout/FieldLayoutTypes';
|
|
3
2
|
import { InputProps } from '../Input/InputTypes';
|
|
3
|
+
import { SharedFieldLayoutProps } from '../../FieldLayout/FieldLayoutTypes';
|
|
4
4
|
export interface NumberInputProps extends SharedFieldLayoutProps, Pick<InputHTMLAttributes<HTMLInputElement>, 'min' | 'max' | 'name' | 'id' | 'placeholder' | 'className'> {
|
|
5
|
+
/**
|
|
6
|
+
* Format type for the number input
|
|
7
|
+
*/
|
|
5
8
|
format?: 'currency' | 'decimal' | 'percent';
|
|
9
|
+
/**
|
|
10
|
+
* React ref for the number input element
|
|
11
|
+
*/
|
|
6
12
|
inputRef?: Ref<HTMLInputElement>;
|
|
13
|
+
/**
|
|
14
|
+
* Current value of the number input
|
|
15
|
+
*/
|
|
7
16
|
value?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Indicates that the field has an error
|
|
19
|
+
*/
|
|
8
20
|
isInvalid?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Disables the number input and prevents interaction
|
|
23
|
+
*/
|
|
9
24
|
isDisabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Callback when number input value changes
|
|
27
|
+
*/
|
|
10
28
|
onChange?: (value: number) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Handler for blur events
|
|
31
|
+
*/
|
|
11
32
|
onBlur?: FocusEventHandler<HTMLElement>;
|
|
33
|
+
/**
|
|
34
|
+
* Element to display at the start of the input
|
|
35
|
+
*/
|
|
12
36
|
adornmentStart?: InputProps['adornmentStart'];
|
|
37
|
+
/**
|
|
38
|
+
* Element to display at the end of the input
|
|
39
|
+
*/
|
|
13
40
|
adornmentEnd?: InputProps['adornmentEnd'];
|
|
41
|
+
/**
|
|
42
|
+
* Minimum number of decimal places to display
|
|
43
|
+
*/
|
|
14
44
|
minimumFractionDigits?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Maximum number of decimal places to display
|
|
47
|
+
*/
|
|
15
48
|
maximumFractionDigits?: number;
|
|
16
49
|
}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
export interface ProgressBarProps {
|
|
2
|
+
/**
|
|
3
|
+
* Total number of steps in the progress sequence
|
|
4
|
+
*/
|
|
2
5
|
totalSteps: number;
|
|
6
|
+
/**
|
|
7
|
+
* Current step in the progress sequence
|
|
8
|
+
*/
|
|
3
9
|
currentStep: number;
|
|
10
|
+
/**
|
|
11
|
+
* Additional CSS class name for the progress bar container
|
|
12
|
+
*/
|
|
4
13
|
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Accessible label describing the progress bar's purpose
|
|
16
|
+
*/
|
|
5
17
|
label: string;
|
|
6
18
|
}
|
|
@@ -2,7 +2,7 @@ import { jsx as i, jsxs as x } from "react/jsx-runtime";
|
|
|
2
2
|
import F from "classnames";
|
|
3
3
|
import { useFieldIds as j } from "../hooks/useFieldIds.js";
|
|
4
4
|
import e from "./Radio.module.scss.js";
|
|
5
|
-
import { HorizontalFieldLayout as v } from "
|
|
5
|
+
import { HorizontalFieldLayout as v } from "../../HorizontalFieldLayout/HorizontalFieldLayout.js";
|
|
6
6
|
const R = ({
|
|
7
7
|
name: o,
|
|
8
8
|
label: t,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","sources":["../../../../../src/components/Common/UI/Radio/Radio.tsx"],"sourcesContent":["import type { ChangeEvent } from 'react'\nimport classNames from 'classnames'\nimport { useFieldIds } from '../hooks/useFieldIds'\nimport
|
|
1
|
+
{"version":3,"file":"Radio.js","sources":["../../../../../src/components/Common/UI/Radio/Radio.tsx"],"sourcesContent":["import type { ChangeEvent } from 'react'\nimport classNames from 'classnames'\nimport { useFieldIds } from '../hooks/useFieldIds'\nimport styles from './Radio.module.scss'\nimport type { RadioProps } from './RadioTypes'\nimport { HorizontalFieldLayout } from '@/components/Common/HorizontalFieldLayout'\n\nexport const Radio = ({\n name,\n label,\n description,\n errorMessage,\n isRequired,\n inputRef,\n value,\n isInvalid = false,\n isDisabled = false,\n id,\n onChange,\n onBlur,\n shouldVisuallyHideLabel,\n className,\n ...props\n}: RadioProps) => {\n const { inputId, errorMessageId, descriptionId, ariaDescribedBy } = useFieldIds({\n inputId: id,\n errorMessage,\n description,\n })\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n onChange?.(event.target.checked)\n }\n\n return (\n <HorizontalFieldLayout\n label={label}\n description={description}\n errorMessage={errorMessage}\n isRequired={isRequired}\n htmlFor={inputId}\n errorMessageId={errorMessageId}\n descriptionId={descriptionId}\n shouldVisuallyHideLabel={shouldVisuallyHideLabel}\n className={className}\n {...props}\n >\n <div className={styles.radioWrapper}>\n <input\n type=\"radio\"\n name={name}\n disabled={isDisabled}\n aria-describedby={ariaDescribedBy}\n checked={value}\n id={inputId}\n ref={inputRef}\n onBlur={onBlur}\n onChange={handleChange}\n className={styles.radioInput}\n />\n <div className={classNames(styles.radio, { [styles.checked as string]: value })}>\n {value && <div className={styles.radioDot} />}\n </div>\n </div>\n </HorizontalFieldLayout>\n )\n}\n"],"names":["Radio","name","label","description","errorMessage","isRequired","inputRef","value","isInvalid","isDisabled","id","onChange","onBlur","shouldVisuallyHideLabel","className","props","inputId","errorMessageId","descriptionId","ariaDescribedBy","useFieldIds","handleChange","event","jsx","HorizontalFieldLayout","jsxs","styles","classNames"],"mappings":";;;;;AAOO,MAAMA,IAAQ,CAAC;AAAA,EACpB,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,YAAAC,IAAa;AAAA,EACb,IAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,MAAkB;AAChB,QAAM,EAAE,SAAAC,GAAS,gBAAAC,GAAgB,eAAAC,GAAe,iBAAAC,EAAA,IAAoBC,EAAY;AAAA,IAC9E,SAASV;AAAA,IACT,cAAAN;AAAA,IACA,aAAAD;AAAA,EAAA,CACD,GAEKkB,IAAe,CAACC,MAAyC;AAClD,IAAAX,IAAAW,EAAM,OAAO,OAAO;AAAA,EACjC;AAGE,SAAA,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,OAAAtB;AAAA,MACA,aAAAC;AAAA,MACA,cAAAC;AAAA,MACA,YAAAC;AAAA,MACA,SAASW;AAAA,MACT,gBAAAC;AAAA,MACA,eAAAC;AAAA,MACA,yBAAAL;AAAA,MACA,WAAAC;AAAA,MACC,GAAGC;AAAA,MAEJ,UAAC,gBAAAU,EAAA,OAAA,EAAI,WAAWC,EAAO,cACrB,UAAA;AAAA,QAAA,gBAAAH;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,MAAAtB;AAAA,YACA,UAAUQ;AAAA,YACV,oBAAkBU;AAAA,YAClB,SAASZ;AAAA,YACT,IAAIS;AAAA,YACJ,KAAKV;AAAA,YACL,QAAAM;AAAA,YACA,UAAUS;AAAA,YACV,WAAWK,EAAO;AAAA,UAAA;AAAA,QACpB;AAAA,QACA,gBAAAH,EAAC,SAAI,WAAWI,EAAWD,EAAO,OAAO,EAAE,CAACA,EAAO,OAAiB,GAAGnB,EAAM,CAAC,GAC3E,UAASA,KAAA,gBAAAgB,EAAC,SAAI,WAAWG,EAAO,UAAU,EAC7C,CAAA;AAAA,MAAA,EACF,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
import { InputHTMLAttributes, Ref } from 'react';
|
|
2
|
-
import { SharedHorizontalFieldLayoutProps } from '
|
|
2
|
+
import { SharedHorizontalFieldLayoutProps } from '../../HorizontalFieldLayout/HorizontalFieldLayoutTypes';
|
|
3
3
|
export interface RadioProps extends SharedHorizontalFieldLayoutProps, Pick<InputHTMLAttributes<HTMLInputElement>, 'name' | 'id' | 'className' | 'onBlur'> {
|
|
4
|
+
/**
|
|
5
|
+
* Current checked state of the radio button
|
|
6
|
+
*/
|
|
4
7
|
value?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Callback when radio button state changes
|
|
10
|
+
*/
|
|
5
11
|
onChange?: (checked: boolean) => void;
|
|
12
|
+
/**
|
|
13
|
+
* React ref for the radio input element
|
|
14
|
+
*/
|
|
6
15
|
inputRef?: Ref<HTMLInputElement>;
|
|
16
|
+
/**
|
|
17
|
+
* Indicates that the field has an error
|
|
18
|
+
*/
|
|
7
19
|
isInvalid?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Disables the radio button and prevents interaction
|
|
22
|
+
*/
|
|
8
23
|
isDisabled?: boolean;
|
|
9
24
|
}
|
|
@@ -5,8 +5,8 @@ import { RadioGroup as G, RadioGroupStateContext as y } from "react-aria-compone
|
|
|
5
5
|
import { useRadio as D } from "react-aria";
|
|
6
6
|
import { Radio as S } from "../Radio/Radio.js";
|
|
7
7
|
import A from "./RadioGroup.module.scss.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { Fieldset as F } from "../../Fieldset/Fieldset.js";
|
|
9
|
+
import { useForkRef as N } from "../../../../hooks/useForkRef/useForkRef.js";
|
|
10
10
|
function V({
|
|
11
11
|
label: o,
|
|
12
12
|
description: e,
|
|
@@ -15,7 +15,7 @@ function V({
|
|
|
15
15
|
inputRef: n,
|
|
16
16
|
...l
|
|
17
17
|
}) {
|
|
18
|
-
const r = v(null), s =
|
|
18
|
+
const r = v(null), s = N(n, r), { inputProps: d, isSelected: p, isDisabled: f } = D(
|
|
19
19
|
{
|
|
20
20
|
...l,
|
|
21
21
|
value: t,
|
|
@@ -62,7 +62,7 @@ function z({
|
|
|
62
62
|
...u
|
|
63
63
|
}) {
|
|
64
64
|
return /* @__PURE__ */ i(
|
|
65
|
-
|
|
65
|
+
F,
|
|
66
66
|
{
|
|
67
67
|
legend: o,
|
|
68
68
|
description: e,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.js","sources":["../../../../../src/components/Common/UI/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import { useContext, useRef } from 'react'\nimport type { Ref } from 'react'\nimport classNames from 'classnames'\nimport {\n RadioGroup as AriaRadioGroup,\n RadioGroupStateContext,\n type RadioGroupRenderProps,\n} from 'react-aria-components'\nimport { useRadio } from 'react-aria'\nimport type { AriaRadioProps } from 'react-aria'\nimport type React from 'react'\nimport {
|
|
1
|
+
{"version":3,"file":"RadioGroup.js","sources":["../../../../../src/components/Common/UI/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import { useContext, useRef } from 'react'\nimport type { Ref } from 'react'\nimport classNames from 'classnames'\nimport {\n RadioGroup as AriaRadioGroup,\n RadioGroupStateContext,\n type RadioGroupRenderProps,\n} from 'react-aria-components'\nimport { useRadio } from 'react-aria'\nimport type { AriaRadioProps } from 'react-aria'\nimport type React from 'react'\nimport { Radio } from '../Radio'\nimport styles from './RadioGroup.module.scss'\nimport type { RadioGroupProps } from './RadioGroupTypes'\nimport { Fieldset } from '@/components/Common/Fieldset'\nimport { useForkRef } from '@/hooks/useForkRef/useForkRef'\n\n// Radio implementation specific to React Aria to get our radio to connect\n// to their RadioGroup component\ninterface ReactAriaRadioProps extends Omit<AriaRadioProps, 'value'> {\n label: React.ReactNode\n description?: React.ReactNode\n value: string\n groupState: RadioGroupRenderProps['state']\n inputRef?: Ref<HTMLInputElement>\n}\n\nfunction ReactAriaRadio({\n label,\n description,\n value,\n groupState,\n inputRef: inputRefFromProps,\n ...props\n}: ReactAriaRadioProps) {\n const inputRef = useRef<HTMLInputElement>(null)\n const handleInputRef = useForkRef(inputRefFromProps, inputRef)\n\n const { inputProps, isSelected, isDisabled } = useRadio(\n {\n ...props,\n value,\n // Hack to suppress aria-label warning from React Aria. We don't actually\n // use children for the mapping of our radio to React Aria and we already\n // configure a label for our radios.\n children: ' ',\n },\n groupState,\n inputRef,\n )\n\n const handleChange = (checked: boolean) => {\n if (checked) {\n groupState.setSelectedValue(value)\n }\n }\n\n return (\n <Radio\n label={label}\n inputRef={handleInputRef}\n isDisabled={isDisabled}\n description={description}\n onChange={handleChange}\n value={isSelected}\n name={inputProps.name}\n />\n )\n}\n\nfunction ReactAriaRadioWrapper(props: Omit<ReactAriaRadioProps, 'groupState'>) {\n const groupState = useContext(RadioGroupStateContext)\n // We can't render hooks conditionally so we have to use useRadio above but\n // groupState is only defined if the component is rendered within a RadioGroup\n // This wrapper component gets around that by checking if groupState is defined which\n // should always be the case for us since this component is only used within a RadioGroup\n return groupState ? <ReactAriaRadio groupState={groupState} {...props} /> : null\n}\n\nexport function RadioGroup({\n label,\n description,\n errorMessage,\n isRequired = false,\n isInvalid = false,\n isDisabled = false,\n options,\n shouldVisuallyHideLabel = false,\n value,\n onChange,\n className,\n inputRef,\n ...props\n}: RadioGroupProps) {\n return (\n <Fieldset\n legend={label}\n description={description}\n errorMessage={errorMessage}\n isRequired={isRequired}\n shouldVisuallyHideLegend={shouldVisuallyHideLabel}\n className={classNames(styles.root, className)}\n {...props}\n >\n <AriaRadioGroup\n isInvalid={isInvalid}\n isRequired={isRequired}\n validationBehavior=\"aria\"\n value={value}\n onChange={onChange}\n isDisabled={isDisabled}\n aria-labelledby=\" \"\n >\n {options.map(({ value, label, isDisabled = false, description }, index) => (\n <ReactAriaRadioWrapper\n isDisabled={isDisabled}\n key={value}\n value={value}\n description={description}\n label={label}\n inputRef={index === 0 ? inputRef : undefined}\n />\n ))}\n </AriaRadioGroup>\n </Fieldset>\n )\n}\n"],"names":["ReactAriaRadio","label","description","value","groupState","inputRefFromProps","props","inputRef","useRef","handleInputRef","useForkRef","inputProps","isSelected","isDisabled","useRadio","jsx","Radio","checked","ReactAriaRadioWrapper","useContext","RadioGroupStateContext","RadioGroup","errorMessage","isRequired","isInvalid","options","shouldVisuallyHideLabel","onChange","className","Fieldset","classNames","styles","AriaRadioGroup","index"],"mappings":";;;;;;;;;AA2BA,SAASA,EAAe;AAAA,EACtB,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAUC;AAAA,EACV,GAAGC;AACL,GAAwB;AAChB,QAAAC,IAAWC,EAAyB,IAAI,GACxCC,IAAiBC,EAAWL,GAAmBE,CAAQ,GAEvD,EAAE,YAAAI,GAAY,YAAAC,GAAY,YAAAC,EAAe,IAAAC;AAAA,IAC7C;AAAA,MACE,GAAGR;AAAA,MACH,OAAAH;AAAA;AAAA;AAAA;AAAA,MAIA,UAAU;AAAA,IACZ;AAAA,IACAC;AAAA,IACAG;AAAA,EACF;AASE,SAAA,gBAAAQ;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,OAAAf;AAAA,MACA,UAAUQ;AAAA,MACV,YAAAI;AAAA,MACA,aAAAX;AAAA,MACA,UAZiB,CAACe,MAAqB;AACzC,QAAIA,KACFb,EAAW,iBAAiBD,CAAK;AAAA,MAErC;AAAA,MASI,OAAOS;AAAA,MACP,MAAMD,EAAW;AAAA,IAAA;AAAA,EACnB;AAEJ;AAEA,SAASO,EAAsBZ,GAAgD;AACvE,QAAAF,IAAae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HTMLAttributes, Ref } from 'react';
|
|
2
|
-
import { SharedFieldLayoutProps } from '
|
|
3
|
-
export
|
|
2
|
+
import { SharedFieldLayoutProps } from '../../FieldLayout/FieldLayoutTypes';
|
|
3
|
+
export interface RadioGroupOption {
|
|
4
|
+
/**
|
|
5
|
+
* Label text or content for the radio option
|
|
6
|
+
*/
|
|
4
7
|
label: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Value of the option that will be passed to onChange
|
|
10
|
+
*/
|
|
5
11
|
value: string;
|
|
12
|
+
/**
|
|
13
|
+
* Disables this specific radio option
|
|
14
|
+
*/
|
|
6
15
|
isDisabled?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Optional description text for the radio option
|
|
18
|
+
*/
|
|
7
19
|
description?: React.ReactNode;
|
|
8
|
-
}
|
|
20
|
+
}
|
|
9
21
|
export interface RadioGroupProps extends SharedFieldLayoutProps, Pick<FieldsetHTMLAttributes<HTMLFieldSetElement>, 'className'> {
|
|
22
|
+
/**
|
|
23
|
+
* Indicates that the field has an error
|
|
24
|
+
*/
|
|
10
25
|
isInvalid?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Disables all radio options in the group
|
|
28
|
+
*/
|
|
11
29
|
isDisabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Array of radio options to display
|
|
32
|
+
*/
|
|
12
33
|
options: Array<RadioGroupOption>;
|
|
34
|
+
/**
|
|
35
|
+
* Currently selected value
|
|
36
|
+
*/
|
|
13
37
|
value?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Callback when selection changes
|
|
40
|
+
*/
|
|
14
41
|
onChange?: (value: string) => void;
|
|
42
|
+
/**
|
|
43
|
+
* React ref for the first radio input element
|
|
44
|
+
*/
|
|
15
45
|
inputRef?: Ref<HTMLInputElement>;
|
|
16
46
|
}
|
|
@@ -5,11 +5,11 @@ import { useMemo as K } from "react";
|
|
|
5
5
|
import p from "classnames";
|
|
6
6
|
import { useFieldIds as M } from "../hooks/useFieldIds.js";
|
|
7
7
|
import o from "./Select.module.scss.js";
|
|
8
|
-
import U from "
|
|
9
|
-
import V from "../../../../assets/icons/
|
|
10
|
-
import
|
|
8
|
+
import { FieldLayout as U } from "../../FieldLayout/FieldLayout.js";
|
|
9
|
+
import V from "../../../../assets/icons/caret-down.svg.js";
|
|
10
|
+
import _ from "../../../../assets/icons/alert-circle.svg.js";
|
|
11
|
+
import { useTheme as $ } from "../../../../contexts/ThemeProvider/useTheme.js";
|
|
11
12
|
/* empty css */
|
|
12
|
-
import { FieldLayout as $ } from "../FieldLayout/FieldLayout.js";
|
|
13
13
|
const re = ({
|
|
14
14
|
description: i,
|
|
15
15
|
errorMessage: a,
|
|
@@ -29,13 +29,13 @@ const re = ({
|
|
|
29
29
|
inputRef: y,
|
|
30
30
|
...B
|
|
31
31
|
}) => {
|
|
32
|
-
const { t: C } = H(), { container: N } =
|
|
32
|
+
const { t: C } = H(), { container: N } = $(), { inputId: d, errorMessageId: b, descriptionId: L, ariaDescribedBy: w } = M({
|
|
33
33
|
inputId: u,
|
|
34
34
|
errorMessage: a,
|
|
35
35
|
description: i
|
|
36
36
|
}), A = K(() => s.map((e) => ({ name: e.label, id: e.value })), [s]);
|
|
37
37
|
return /* @__PURE__ */ r(
|
|
38
|
-
|
|
38
|
+
U,
|
|
39
39
|
{
|
|
40
40
|
label: n,
|
|
41
41
|
htmlFor: d,
|
|
@@ -66,8 +66,8 @@ const re = ({
|
|
|
66
66
|
/* @__PURE__ */ t(j, { ref: y, children: [
|
|
67
67
|
/* @__PURE__ */ r(D, { children: ({ defaultChildren: e, isPlaceholder: F }) => F && c ? c : e }),
|
|
68
68
|
/* @__PURE__ */ t("div", { className: o.icons, "aria-hidden": "true", children: [
|
|
69
|
-
m && /* @__PURE__ */ r(
|
|
70
|
-
/* @__PURE__ */ r(
|
|
69
|
+
m && /* @__PURE__ */ r(_, { fontSize: 16 }),
|
|
70
|
+
/* @__PURE__ */ r(V, { title: C("icons.selectArrow") })
|
|
71
71
|
] })
|
|
72
72
|
] }),
|
|
73
73
|
/* @__PURE__ */ r(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sources":["../../../../../src/components/Common/UI/Select/Select.tsx"],"sourcesContent":["import type { Key } from 'react-aria-components'\nimport {\n Select as AriaSelect,\n Button,\n ListBox,\n ListBoxItem,\n Popover,\n SelectValue,\n} from 'react-aria-components'\nimport { useTranslation } from 'react-i18next'\nimport { useMemo } from 'react'\nimport classNames from 'classnames'\nimport { useFieldIds } from '../hooks/useFieldIds'\nimport
|
|
1
|
+
{"version":3,"file":"Select.js","sources":["../../../../../src/components/Common/UI/Select/Select.tsx"],"sourcesContent":["import type { Key } from 'react-aria-components'\nimport {\n Select as AriaSelect,\n Button,\n ListBox,\n ListBoxItem,\n Popover,\n SelectValue,\n} from 'react-aria-components'\nimport { useTranslation } from 'react-i18next'\nimport { useMemo } from 'react'\nimport classNames from 'classnames'\nimport { useFieldIds } from '../hooks/useFieldIds'\nimport styles from './Select.module.scss'\nimport type { SelectProps } from './SelectTypes'\nimport { FieldLayout } from '@/components/Common/FieldLayout'\nimport CaretDown from '@/assets/icons/caret-down.svg?react'\nimport AlertCircle from '@/assets/icons/alert-circle.svg?react'\nimport { useTheme } from '@/contexts/ThemeProvider'\n\nexport const Select = ({\n description,\n errorMessage,\n id,\n isDisabled,\n isInvalid,\n isRequired,\n label,\n onChange,\n onBlur,\n options,\n placeholder,\n value,\n shouldVisuallyHideLabel,\n name,\n className,\n inputRef,\n ...props\n}: SelectProps) => {\n const { t } = useTranslation()\n const { container } = useTheme()\n const { inputId, errorMessageId, descriptionId, ariaDescribedBy } = useFieldIds({\n inputId: id,\n errorMessage,\n description,\n })\n\n const items = useMemo(() => {\n return options.map(o => ({ name: o.label, id: o.value }))\n }, [options])\n\n return (\n <FieldLayout\n label={label}\n htmlFor={inputId}\n errorMessage={errorMessage}\n errorMessageId={errorMessageId}\n descriptionId={descriptionId}\n isRequired={isRequired}\n description={description}\n shouldVisuallyHideLabel={shouldVisuallyHideLabel}\n className={classNames(styles.root, 'react-aria-CustomSelect', className)}\n withErrorIcon={false}\n {...props}\n >\n <AriaSelect\n aria-label={label}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n onSelectionChange={key => {\n onChange?.(key.toString())\n }}\n onBlur={onBlur}\n id={inputId}\n selectedKey={value ? (value as Key) : undefined}\n aria-describedby={ariaDescribedBy}\n name={name}\n >\n <Button ref={inputRef}>\n <SelectValue>\n {({ defaultChildren, isPlaceholder }) => {\n return isPlaceholder && placeholder ? placeholder : defaultChildren\n }}\n </SelectValue>\n <div className={styles.icons} aria-hidden=\"true\">\n {isInvalid && <AlertCircle fontSize={16} />}\n <CaretDown title={t('icons.selectArrow')} />\n </div>\n </Button>\n <Popover\n className={classNames(styles.popover, 'react-aria-Popover')}\n UNSTABLE_portalContainer={container.current}\n maxHeight={320}\n >\n <ListBox items={items}>\n {item => <ListBoxItem key={item.id}>{item.name}</ListBoxItem>}\n </ListBox>\n </Popover>\n </AriaSelect>\n </FieldLayout>\n )\n}\n"],"names":["Select","description","errorMessage","id","isDisabled","isInvalid","isRequired","label","onChange","onBlur","options","placeholder","value","shouldVisuallyHideLabel","name","className","inputRef","props","t","useTranslation","container","useTheme","inputId","errorMessageId","descriptionId","ariaDescribedBy","useFieldIds","items","useMemo","o","jsx","FieldLayout","classNames","styles","jsxs","AriaSelect","key","Button","SelectValue","defaultChildren","isPlaceholder","AlertCircle","CaretDown","Popover","ListBox","item","ListBoxItem"],"mappings":";;;;;;;;;;;;AAoBO,MAAMA,KAAS,CAAC;AAAA,EACrB,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,IAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,aAAAC;AAAA,EACA,OAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,MAAA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AI,EAAA,WAAWN,EAAO,OAAO,eAAY,QACvC,UAAA;AAAA,gBAAa5B,KAAA,gBAAAyB,EAACW,GAAY,EAAA,UAAU,GAAI,CAAA;AAAA,gBACxC,gBAAAX,EAAAY,GAAA,EAAU,OAAOxB,EAAE,mBAAmB,EAAG,CAAA;AAAA,cAAA,EAC5C,CAAA;AAAA,YAAA,GACF;AAAA,YACA,gBAAAY;AAAA,cAACa;AAAA,cAAA;AAAA,gBACC,WAAWX,EAAWC,EAAO,SAAS,oBAAoB;AAAA,gBAC1D,0BAA0Bb,EAAU;AAAA,gBACpC,WAAW;AAAA,gBAEX,UAAA,gBAAAU,EAACc,GAAQ,EAAA,OAAAjB,GACN,UAAQ,CAAAkB,MAAA,gBAAAf,EAACgB,KAA2B,UAAKD,EAAA,KAAA,GAAfA,EAAK,EAAe,EACjD,CAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EACF;AAEJ;"}
|
|
@@ -1,17 +1,50 @@
|
|
|
1
1
|
import { FocusEvent, Ref, SelectHTMLAttributes } from 'react';
|
|
2
|
-
import { SharedFieldLayoutProps } from '
|
|
2
|
+
import { SharedFieldLayoutProps } from '../../FieldLayout/FieldLayoutTypes';
|
|
3
3
|
export interface SelectOption {
|
|
4
|
+
/**
|
|
5
|
+
* Value of the option that will be passed to onChange
|
|
6
|
+
*/
|
|
4
7
|
value: string;
|
|
8
|
+
/**
|
|
9
|
+
* Display text for the option
|
|
10
|
+
*/
|
|
5
11
|
label: string;
|
|
6
12
|
}
|
|
7
13
|
export interface SelectProps extends SharedFieldLayoutProps, Pick<SelectHTMLAttributes<HTMLSelectElement>, 'id' | 'name' | 'className'> {
|
|
14
|
+
/**
|
|
15
|
+
* Disables the select and prevents interaction
|
|
16
|
+
*/
|
|
8
17
|
isDisabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Indicates that the field has an error
|
|
20
|
+
*/
|
|
9
21
|
isInvalid?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Label text for the select field
|
|
24
|
+
*/
|
|
10
25
|
label: string;
|
|
26
|
+
/**
|
|
27
|
+
* Callback when selection changes
|
|
28
|
+
*/
|
|
11
29
|
onChange?: (value: string) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Handler for blur events
|
|
32
|
+
*/
|
|
12
33
|
onBlur?: (e: FocusEvent) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Array of options to display in the select dropdown
|
|
36
|
+
*/
|
|
13
37
|
options: SelectOption[];
|
|
38
|
+
/**
|
|
39
|
+
* Placeholder text when no option is selected
|
|
40
|
+
*/
|
|
14
41
|
placeholder?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Currently selected value
|
|
44
|
+
*/
|
|
15
45
|
value?: string;
|
|
46
|
+
/**
|
|
47
|
+
* React ref for the select button element
|
|
48
|
+
*/
|
|
16
49
|
inputRef?: Ref<HTMLButtonElement>;
|
|
17
50
|
}
|
|
@@ -4,7 +4,7 @@ import w from "classnames";
|
|
|
4
4
|
import { useRef as F, useEffect as x } from "react";
|
|
5
5
|
import { useFieldIds as j } from "../hooks/useFieldIds.js";
|
|
6
6
|
import t from "./Switch.module.scss.js";
|
|
7
|
-
import { HorizontalFieldLayout as z } from "
|
|
7
|
+
import { HorizontalFieldLayout as z } from "../../HorizontalFieldLayout/HorizontalFieldLayout.js";
|
|
8
8
|
function k({
|
|
9
9
|
name: d,
|
|
10
10
|
label: o,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.js","sources":["../../../../../src/components/Common/UI/Switch/Switch.tsx"],"sourcesContent":["import { Switch as _Switch } from 'react-aria-components'\nimport classNames from 'classnames'\nimport { useRef, useEffect } from 'react'\nimport { useFieldIds } from '../hooks/useFieldIds'\nimport
|
|
1
|
+
{"version":3,"file":"Switch.js","sources":["../../../../../src/components/Common/UI/Switch/Switch.tsx"],"sourcesContent":["import { Switch as _Switch } from 'react-aria-components'\nimport classNames from 'classnames'\nimport { useRef, useEffect } from 'react'\nimport { useFieldIds } from '../hooks/useFieldIds'\nimport styles from './Switch.module.scss'\nimport type { SwitchProps } from './SwitchTypes'\nimport { HorizontalFieldLayout } from '@/components/Common/HorizontalFieldLayout'\n\nexport function Switch({\n name,\n label,\n description,\n errorMessage,\n inputRef,\n isRequired,\n onChange,\n isInvalid = false,\n isDisabled = false,\n id,\n shouldVisuallyHideLabel,\n className,\n value,\n ...props\n}: SwitchProps) {\n const { inputId, errorMessageId, descriptionId, ariaDescribedBy } = useFieldIds({\n inputId: id,\n errorMessage,\n description,\n })\n\n const internalInputRef = useRef<HTMLInputElement>(null)\n\n useEffect(() => {\n if (inputRef) {\n if (typeof inputRef === 'function') {\n inputRef(internalInputRef.current)\n } else {\n inputRef.current = internalInputRef.current\n }\n }\n }, [inputRef])\n\n return (\n <HorizontalFieldLayout\n label={label}\n description={description}\n errorMessage={errorMessage}\n isRequired={isRequired}\n htmlFor={inputId}\n errorMessageId={errorMessageId}\n descriptionId={descriptionId}\n shouldVisuallyHideLabel={shouldVisuallyHideLabel}\n className={classNames(styles.root, className)}\n >\n <_Switch\n isDisabled={isDisabled}\n isSelected={value}\n onChange={onChange}\n name={name}\n id={inputId}\n aria-describedby={ariaDescribedBy}\n aria-invalid={isInvalid}\n aria-label={label}\n inputRef={internalInputRef}\n {...props}\n >\n <div className={styles.body}>\n <div className={styles.indicator} />\n </div>\n </_Switch>\n </HorizontalFieldLayout>\n )\n}\n"],"names":["Switch","name","label","description","errorMessage","inputRef","isRequired","onChange","isInvalid","isDisabled","id","shouldVisuallyHideLabel","className","value","props","inputId","errorMessageId","descriptionId","ariaDescribedBy","useFieldIds","internalInputRef","useRef","useEffect","jsx","HorizontalFieldLayout","classNames","styles","_Switch"],"mappings":";;;;;;;AAQO,SAASA,EAAO;AAAA,EACrB,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAA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} from 'react';
|
|
2
|
-
import { SharedHorizontalFieldLayoutProps } from '
|
|
2
|
+
import { SharedHorizontalFieldLayoutProps } from '../../HorizontalFieldLayout/HorizontalFieldLayoutTypes';
|
|
3
3
|
export interface SwitchProps extends SharedHorizontalFieldLayoutProps, Pick<InputHTMLAttributes<HTMLInputElement>, 'name' | 'id'> {
|
|
4
|
+
/**
|
|
5
|
+
* Handler for blur events
|
|
6
|
+
*/
|
|
4
7
|
onBlur?: (e: FocusEvent) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Callback when switch state changes
|
|
10
|
+
*/
|
|
5
11
|
onChange?: (checked: boolean) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Current checked state of the switch
|
|
14
|
+
*/
|
|
6
15
|
value?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* React ref for the switch input element
|
|
18
|
+
*/
|
|
7
19
|
inputRef?: Ref<HTMLInputElement>;
|
|
20
|
+
/**
|
|
21
|
+
* Indicates that the field has an error
|
|
22
|
+
*/
|
|
8
23
|
isInvalid?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Disables the switch and prevents interaction
|
|
26
|
+
*/
|
|
9
27
|
isDisabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Additional CSS class name for the switch container
|
|
30
|
+
*/
|
|
10
31
|
className?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Label text for the switch
|
|
34
|
+
*/
|
|
11
35
|
label: string;
|
|
12
36
|
}
|
|
@@ -1,14 +1,35 @@
|
|
|
1
1
|
import { ReactNode, TableHTMLAttributes } from 'react';
|
|
2
2
|
export interface TableData {
|
|
3
|
+
/**
|
|
4
|
+
* Unique identifier for the table cell
|
|
5
|
+
*/
|
|
3
6
|
key: string;
|
|
7
|
+
/**
|
|
8
|
+
* Content to be displayed in the table cell
|
|
9
|
+
*/
|
|
4
10
|
content: ReactNode;
|
|
5
11
|
}
|
|
6
12
|
export interface TableRow {
|
|
13
|
+
/**
|
|
14
|
+
* Unique identifier for the table row
|
|
15
|
+
*/
|
|
7
16
|
key: string;
|
|
17
|
+
/**
|
|
18
|
+
* Array of cells to be displayed in the row
|
|
19
|
+
*/
|
|
8
20
|
data: TableData[];
|
|
9
21
|
}
|
|
10
22
|
export interface TableProps extends Pick<TableHTMLAttributes<HTMLTableElement>, 'className' | 'aria-label' | 'id' | 'role' | 'aria-labelledby' | 'aria-describedby'> {
|
|
23
|
+
/**
|
|
24
|
+
* Array of header cells for the table
|
|
25
|
+
*/
|
|
11
26
|
headers: TableData[];
|
|
27
|
+
/**
|
|
28
|
+
* Array of rows to be displayed in the table
|
|
29
|
+
*/
|
|
12
30
|
rows: TableRow[];
|
|
31
|
+
/**
|
|
32
|
+
* Content to display when the table has no rows
|
|
33
|
+
*/
|
|
13
34
|
emptyState?: ReactNode;
|
|
14
35
|
}
|
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
export interface TextProps extends Pick<HTMLAttributes<HTMLParagraphElement>, 'className' | 'id'> {
|
|
3
|
+
/**
|
|
4
|
+
* HTML element to render the text as
|
|
5
|
+
*/
|
|
3
6
|
as?: 'p' | 'span' | 'div';
|
|
7
|
+
/**
|
|
8
|
+
* Size variant of the text
|
|
9
|
+
*/
|
|
4
10
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
11
|
+
/**
|
|
12
|
+
* Text alignment within the container
|
|
13
|
+
*/
|
|
5
14
|
textAlign?: 'start' | 'center' | 'end';
|
|
15
|
+
/**
|
|
16
|
+
* Font weight of the text
|
|
17
|
+
*/
|
|
6
18
|
weight?: 'regular' | 'medium' | 'semibold' | 'bold';
|
|
19
|
+
/**
|
|
20
|
+
* Content to be displayed
|
|
21
|
+
*/
|
|
7
22
|
children?: ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Visual style variant of the text
|
|
25
|
+
*/
|
|
8
26
|
variant?: 'supporting';
|
|
9
27
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { useFieldIds as w } from "../hooks/useFieldIds.js";
|
|
3
|
-
import { FieldLayout as B } from "
|
|
3
|
+
import { FieldLayout as B } from "../../FieldLayout/FieldLayout.js";
|
|
4
4
|
import { Input as D } from "../Input/Input.js";
|
|
5
5
|
function z({
|
|
6
6
|
name: a,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.js","sources":["../../../../../src/components/Common/UI/TextInput/TextInput.tsx"],"sourcesContent":["import type { ChangeEvent } from 'react'\nimport {
|
|
1
|
+
{"version":3,"file":"TextInput.js","sources":["../../../../../src/components/Common/UI/TextInput/TextInput.tsx"],"sourcesContent":["import type { ChangeEvent } from 'react'\nimport { Input } from '../Input'\nimport { useFieldIds } from '../hooks/useFieldIds'\nimport type { TextInputProps } from './TextInputTypes'\nimport { FieldLayout } from '@/components/Common/FieldLayout'\n\nexport function TextInput({\n name,\n label,\n description,\n errorMessage,\n isRequired,\n type = 'text',\n inputRef,\n isInvalid = false,\n isDisabled = false,\n id,\n value,\n placeholder,\n onChange,\n onBlur,\n className,\n shouldVisuallyHideLabel,\n adornmentEnd,\n adornmentStart,\n ...props\n}: TextInputProps) {\n const { inputId, errorMessageId, descriptionId, ariaDescribedBy } = useFieldIds({\n inputId: id,\n errorMessage,\n description,\n })\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n onChange?.(event.target.value)\n }\n\n return (\n <FieldLayout\n label={label}\n description={description}\n errorMessage={errorMessage}\n isRequired={isRequired}\n htmlFor={inputId}\n errorMessageId={errorMessageId}\n descriptionId={descriptionId}\n className={className}\n shouldVisuallyHideLabel={shouldVisuallyHideLabel}\n withErrorIcon={false}\n {...props}\n >\n <Input\n id={inputId}\n inputRef={inputRef}\n name={name}\n type={type}\n value={value}\n placeholder={placeholder}\n onChange={handleChange}\n onBlur={onBlur}\n aria-describedby={ariaDescribedBy}\n aria-invalid={isInvalid}\n isDisabled={isDisabled}\n adornmentStart={adornmentStart}\n adornmentEnd={adornmentEnd}\n />\n </FieldLayout>\n )\n}\n"],"names":["TextInput","name","label","description","errorMessage","isRequired","type","inputRef","isInvalid","isDisabled","id","value","placeholder","onChange","onBlur","className","shouldVisuallyHideLabel","adornmentEnd","adornmentStart","props","inputId","errorMessageId","descriptionId","ariaDescribedBy","useFieldIds","jsx","FieldLayout","Input","event"],"mappings":";;;;AAMO,SAASA,EAAU;AAAA,EACxB,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,YAAAC,IAAa;AAAA,EACb,IAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,GAAGC;AACL,GAAmB;AACjB,QAAM,EAAE,SAAAC,GAAS,gBAAAC,GAAgB,eAAAC,GAAe,iBAAAC,EAAA,IAAoBC,EAAY;AAAA,IAC9E,SAASd;AAAA,IACT,cAAAN;AAAA,IACA,aAAAD;AAAA,EAAA,CACD;AAOC,SAAA,gBAAAsB;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,OAAAxB;AAAA,MACA,aAAAC;AAAA,MACA,cAAAC;AAAA,MACA,YAAAC;AAAA,MACA,SAASe;AAAA,MACT,gBAAAC;AAAA,MACA,eAAAC;AAAA,MACA,WAAAP;AAAA,MACA,yBAAAC;AAAA,MACA,eAAe;AAAA,MACd,GAAGG;AAAA,MAEJ,UAAA,gBAAAM;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,IAAIP;AAAA,UACJ,UAAAb;AAAA,UACA,MAAAN;AAAA,UACA,MAAAK;AAAA,UACA,OAAAK;AAAA,UACA,aAAAC;AAAA,UACA,UAzBe,CAACgB,MAAyC;AAClD,YAAAf,IAAAe,EAAM,OAAO,KAAK;AAAA,UAC/B;AAAA,UAwBM,QAAAd;AAAA,UACA,oBAAkBS;AAAA,UAClB,gBAAcf;AAAA,UACd,YAAAC;AAAA,UACA,gBAAAS;AAAA,UACA,cAAAD;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EACF;AAEJ;"}
|
|
@@ -1,12 +1,33 @@
|
|
|
1
1
|
import { Ref, InputHTMLAttributes } from 'react';
|
|
2
|
-
import { SharedFieldLayoutProps } from '../FieldLayout/FieldLayoutTypes';
|
|
3
2
|
import { InputProps } from '../Input/InputTypes';
|
|
3
|
+
import { SharedFieldLayoutProps } from '../../FieldLayout/FieldLayoutTypes';
|
|
4
4
|
export interface TextInputProps extends SharedFieldLayoutProps, Pick<InputHTMLAttributes<HTMLInputElement>, 'name' | 'id' | 'placeholder' | 'className' | 'type' | 'onBlur'> {
|
|
5
|
+
/**
|
|
6
|
+
* React ref for the input element
|
|
7
|
+
*/
|
|
5
8
|
inputRef?: Ref<HTMLInputElement>;
|
|
9
|
+
/**
|
|
10
|
+
* Current value of the input
|
|
11
|
+
*/
|
|
6
12
|
value?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Callback when input value changes
|
|
15
|
+
*/
|
|
7
16
|
onChange?: (value: string) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Indicates that the field has an error
|
|
19
|
+
*/
|
|
8
20
|
isInvalid?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Disables the input and prevents interaction
|
|
23
|
+
*/
|
|
9
24
|
isDisabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Element to display at the start of the input
|
|
27
|
+
*/
|
|
10
28
|
adornmentStart?: InputProps['adornmentStart'];
|
|
29
|
+
/**
|
|
30
|
+
* Element to display at the end of the input
|
|
31
|
+
*/
|
|
11
32
|
adornmentEnd?: InputProps['adornmentEnd'];
|
|
12
33
|
}
|