@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,8 +1,8 @@
|
|
|
1
1
|
import { jsx as e, jsxs as C } from "react/jsx-runtime";
|
|
2
2
|
import { useFieldIds as N } from "../hooks/useFieldIds.js";
|
|
3
3
|
import c from "./Checkbox.module.scss.js";
|
|
4
|
-
import F from "
|
|
5
|
-
import
|
|
4
|
+
import { HorizontalFieldLayout as F } from "../../HorizontalFieldLayout/HorizontalFieldLayout.js";
|
|
5
|
+
import j from "../../../../assets/icons/checkbox.svg.js";
|
|
6
6
|
const S = ({
|
|
7
7
|
name: o,
|
|
8
8
|
label: s,
|
|
@@ -28,7 +28,7 @@ const S = ({
|
|
|
28
28
|
p?.(v.target.checked);
|
|
29
29
|
};
|
|
30
30
|
return /* @__PURE__ */ e(
|
|
31
|
-
|
|
31
|
+
F,
|
|
32
32
|
{
|
|
33
33
|
label: s,
|
|
34
34
|
description: r,
|
|
@@ -57,7 +57,7 @@ const S = ({
|
|
|
57
57
|
className: c.checkboxInput
|
|
58
58
|
}
|
|
59
59
|
),
|
|
60
|
-
/* @__PURE__ */ e("div", { className: c.checkbox, children: /* @__PURE__ */ e(
|
|
60
|
+
/* @__PURE__ */ e("div", { className: c.checkbox, children: /* @__PURE__ */ e(j, { className: c.check }) })
|
|
61
61
|
] })
|
|
62
62
|
}
|
|
63
63
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sources":["../../../../../src/components/Common/UI/Checkbox/Checkbox.tsx"],"sourcesContent":["import type { ChangeEvent } from 'react'\nimport { useFieldIds } from '../hooks/useFieldIds'\nimport
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../../../../../src/components/Common/UI/Checkbox/Checkbox.tsx"],"sourcesContent":["import type { ChangeEvent } from 'react'\nimport { useFieldIds } from '../hooks/useFieldIds'\nimport styles from './Checkbox.module.scss'\nimport type { CheckboxProps } from './CheckboxTypes'\nimport { HorizontalFieldLayout } from '@/components/Common/HorizontalFieldLayout'\nimport IconChecked from '@/assets/icons/checkbox.svg?react'\n\nexport const Checkbox = ({\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 className,\n shouldVisuallyHideLabel,\n ...props\n}: CheckboxProps) => {\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.checkboxWrapper}>\n <input\n type=\"checkbox\"\n name={name}\n disabled={isDisabled}\n aria-invalid={isInvalid}\n aria-describedby={ariaDescribedBy}\n checked={value}\n id={inputId}\n ref={inputRef}\n onBlur={onBlur}\n onChange={handleChange}\n className={styles.checkboxInput}\n />\n <div className={styles.checkbox}>\n <IconChecked className={styles.check} />\n </div>\n </div>\n </HorizontalFieldLayout>\n )\n}\n"],"names":["Checkbox","name","label","description","errorMessage","isRequired","inputRef","value","isInvalid","isDisabled","id","onChange","onBlur","className","shouldVisuallyHideLabel","props","inputId","errorMessageId","descriptionId","ariaDescribedBy","useFieldIds","handleChange","event","jsx","HorizontalFieldLayout","jsxs","styles","IconChecked"],"mappings":";;;;;AAOO,MAAMA,IAAW,CAAC;AAAA,EACvB,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,WAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,GAAGC;AACL,MAAqB;AACnB,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,yBAAAJ;AAAA,MACA,WAAAD;AAAA,MACC,GAAGE;AAAA,MAEJ,UAAC,gBAAAU,EAAA,OAAA,EAAI,WAAWC,EAAO,iBACrB,UAAA;AAAA,QAAA,gBAAAH;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,MAAAtB;AAAA,YACA,UAAUQ;AAAA,YACV,gBAAcD;AAAA,YACd,oBAAkBW;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,OAAI,EAAA,WAAWG,EAAO,UACrB,4BAACC,GAAY,EAAA,WAAWD,EAAO,MAAO,CAAA,EACxC,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 CheckboxProps extends SharedHorizontalFieldLayoutProps, Pick<InputHTMLAttributes<HTMLInputElement>, 'name' | 'id' | 'className' | 'onBlur'> {
|
|
4
|
+
/**
|
|
5
|
+
* Current checked state of the checkbox
|
|
6
|
+
*/
|
|
4
7
|
value?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Callback when checkbox state changes
|
|
10
|
+
*/
|
|
5
11
|
onChange?: (value: boolean) => void;
|
|
12
|
+
/**
|
|
13
|
+
* React ref for the checkbox input element
|
|
14
|
+
*/
|
|
6
15
|
inputRef?: Ref<HTMLInputElement>;
|
|
16
|
+
/**
|
|
17
|
+
* Indicates if the checkbox is in an invalid state
|
|
18
|
+
*/
|
|
7
19
|
isInvalid?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Disables the checkbox and prevents interaction
|
|
22
|
+
*/
|
|
8
23
|
isDisabled?: boolean;
|
|
9
24
|
}
|
|
@@ -5,8 +5,8 @@ import { CheckboxGroup as G, CheckboxGroupStateContext as g } from "react-aria-c
|
|
|
5
5
|
import { useCheckboxGroupItem as I } from "react-aria";
|
|
6
6
|
import { Checkbox as y } from "../Checkbox/Checkbox.js";
|
|
7
7
|
import D from "./CheckboxGroup.module.scss.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { Fieldset as V } from "../../Fieldset/Fieldset.js";
|
|
9
|
+
import { useForkRef as A } from "../../../../hooks/useForkRef/useForkRef.js";
|
|
10
10
|
function F({
|
|
11
11
|
label: r,
|
|
12
12
|
description: e,
|
|
@@ -15,7 +15,7 @@ function F({
|
|
|
15
15
|
inputRef: l,
|
|
16
16
|
...s
|
|
17
17
|
}) {
|
|
18
|
-
const n = R(null), c =
|
|
18
|
+
const n = R(null), c = A(l, n), { inputProps: f, isSelected: p, isDisabled: u, isInvalid: m } = I(
|
|
19
19
|
{
|
|
20
20
|
...s,
|
|
21
21
|
value: i,
|
|
@@ -64,7 +64,7 @@ function w({
|
|
|
64
64
|
...d
|
|
65
65
|
}) {
|
|
66
66
|
return /* @__PURE__ */ a(
|
|
67
|
-
|
|
67
|
+
V,
|
|
68
68
|
{
|
|
69
69
|
legend: r,
|
|
70
70
|
description: e,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxGroup.js","sources":["../../../../../src/components/Common/UI/CheckboxGroup/CheckboxGroup.tsx"],"sourcesContent":["import { useContext, useRef } from 'react'\nimport type { Ref } from 'react'\nimport classNames from 'classnames'\nimport {\n CheckboxGroup as AriaCheckboxGroup,\n CheckboxGroupStateContext,\n type CheckboxGroupRenderProps,\n} from 'react-aria-components'\nimport { useCheckboxGroupItem } from 'react-aria'\nimport type { AriaCheckboxProps } from 'react-aria'\nimport type React from 'react'\nimport {
|
|
1
|
+
{"version":3,"file":"CheckboxGroup.js","sources":["../../../../../src/components/Common/UI/CheckboxGroup/CheckboxGroup.tsx"],"sourcesContent":["import { useContext, useRef } from 'react'\nimport type { Ref } from 'react'\nimport classNames from 'classnames'\nimport {\n CheckboxGroup as AriaCheckboxGroup,\n CheckboxGroupStateContext,\n type CheckboxGroupRenderProps,\n} from 'react-aria-components'\nimport { useCheckboxGroupItem } from 'react-aria'\nimport type { AriaCheckboxProps } from 'react-aria'\nimport type React from 'react'\nimport { Checkbox } from '../Checkbox'\nimport styles from './CheckboxGroup.module.scss'\nimport type { CheckboxGroupProps } from './CheckboxGroupTypes'\nimport { Fieldset } from '@/components/Common/Fieldset'\nimport { useForkRef } from '@/hooks/useForkRef/useForkRef'\n\n// Checkbox implementation specific to React Aria to get our checkbox to connect\n// to their CheckboxGroup component\ninterface ReactAriaCheckboxProps extends Omit<AriaCheckboxProps, 'value'> {\n label: React.ReactNode\n description?: React.ReactNode\n value: string\n groupState: CheckboxGroupRenderProps['state']\n inputRef?: Ref<HTMLInputElement>\n}\n\nfunction ReactAriaCheckbox({\n label,\n description,\n value,\n groupState,\n inputRef: inputRefFromProps,\n ...props\n}: ReactAriaCheckboxProps) {\n const internalInputRef = useRef<HTMLInputElement>(null)\n const handleInputRef = useForkRef(inputRefFromProps, internalInputRef)\n\n const { inputProps, isSelected, isDisabled, isInvalid } = useCheckboxGroupItem(\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 checkbox to React Aria and we already\n // configure a label for our checkboxes.\n children: ' ',\n isRequired: false,\n },\n groupState,\n internalInputRef,\n )\n\n const handleChange = (checked: boolean) => {\n if (checked) {\n groupState.addValue(value)\n } else {\n groupState.removeValue(value)\n }\n }\n\n return (\n <Checkbox\n label={label}\n inputRef={handleInputRef}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n description={description}\n onChange={handleChange}\n value={isSelected}\n name={inputProps.name}\n />\n )\n}\n\nfunction ReactAriaCheckboxWrapper(props: Omit<ReactAriaCheckboxProps, 'groupState'>) {\n const groupState = useContext(CheckboxGroupStateContext)\n // We can't render hooks conditionally so we have to use useCheckboxGroupItem above but\n // groupState is only defined if the component is rendered within a CheckboxGroup\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 CheckboxGroup\n return groupState ? <ReactAriaCheckbox groupState={groupState} {...props} /> : null\n}\n\nexport function CheckboxGroup({\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}: CheckboxGroupProps) {\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 <AriaCheckboxGroup\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 <ReactAriaCheckboxWrapper\n isDisabled={isDisabled}\n key={value}\n value={value}\n description={description}\n label={label}\n inputRef={index === 0 ? inputRef : undefined}\n />\n ))}\n </AriaCheckboxGroup>\n </Fieldset>\n )\n}\n"],"names":["ReactAriaCheckbox","label","description","value","groupState","inputRefFromProps","props","internalInputRef","useRef","handleInputRef","useForkRef","inputProps","isSelected","isDisabled","isInvalid","useCheckboxGroupItem","jsx","Checkbox","checked","ReactAriaCheckboxWrapper","useContext","CheckboxGroupStateContext","CheckboxGroup","errorMessage","isRequired","options","shouldVisuallyHideLabel","onChange","className","inputRef","Fieldset","classNames","styles","AriaCheckboxGroup","index"],"mappings":";;;;;;;;;AA2BA,SAASA,EAAkB;AAAA,EACzB,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAUC;AAAA,EACV,GAAGC;AACL,GAA2B;AACnB,QAAAC,IAAmBC,EAAyB,IAAI,GAChDC,IAAiBC,EAAWL,GAAmBE,CAAgB,GAE/D,EAAE,YAAAI,GAAY,YAAAC,GAAY,YAAAC,GAAY,WAAAC,EAAc,IAAAC;AAAA,IACxD;AAAA,MACE,GAAGT;AAAA,MACH,OAAAH;AAAA;AAAA;AAAA;AAAA,MAIA,UAAU;AAAA,MACV,YAAY;AAAA,IACd;AAAA,IACAC;AAAA,IACAG;AAAA,EACF;AAWE,SAAA,gBAAAS;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,OAAAhB;AAAA,MACA,UAAUQ;AAAA,MACV,YAAAI;AAAA,MACA,WAAAC;AAAA,MACA,aAAAZ;AAAA,MACA,UAfiB,CAACgB,MAAqB;AACzC,QAAIA,IACFd,EAAW,SAASD,CAAK,IAEzBC,EAAW,YAAYD,CAAK;AAAA,MAEhC;AAAA,MAUI,OAAOS;AAAA,MACP,MAAMD,EAAW;AAAA,IAAA;AAAA,EACnB;AAEJ;AAEA,SAASQ,EAAyBb,GAAmD;AAC7E,QAAAF,IAAagB,EAAWC,CAAyB;AAKvD,SAAOjB,IAAc,gBAAAY,EAAAhB,GAAA,EAAkB,YAAAI,GAAyB,GAAGE,EAAO,CAAA,IAAK;AACjF;AAEO,SAASgB,EAAc;AAAA,EAC5B,OAAArB;AAAA,EACA,aAAAC;AAAA,EACA,cAAAqB;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,WAAAV,IAAY;AAAA,EACZ,YAAAD,IAAa;AAAA,EACb,SAAAY;AAAA,EACA,yBAAAC,IAA0B;AAAA,EAC1B,OAAAvB;AAAA,EACA,UAAAwB;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGvB;AACL,GAAuB;AAEnB,SAAA,gBAAAU;AAAA,IAACc;AAAA,IAAA;AAAA,MACC,QAAQ7B;AAAA,MACR,aAAAC;AAAA,MACA,cAAAqB;AAAA,MACA,YAAAC;AAAA,MACA,0BAA0BE;AAAA,MAC1B,WAAWK,EAAWC,EAAO,MAAMJ,CAAS;AAAA,MAC3C,GAAGtB;AAAA,MAEJ,UAAA,gBAAAU;AAAA,QAACiB;AAAAA,QAAA;AAAA,UACC,WAAAnB;AAAA,UACA,YAAAU;AAAA,UACA,oBAAmB;AAAA,UACnB,OAAArB;AAAA,UACA,UAAAwB;AAAA,UACA,YAAAd;AAAA,UACA,mBAAgB;AAAA,UAEf,UAAQY,EAAA,IAAI,CAAC,EAAE,OAAAtB,GAAO,OAAAF,GAAO,YAAAY,IAAa,IAAO,aAAAX,EAAAA,GAAegC,MAC/D,gBAAAlB;AAAA,YAACG;AAAA,YAAA;AAAA,cACC,YAAYN;AAAAA,cAEZ,OAAOV;AAAAA,cACP,aAAaD;AAAAA,cACb,OAAOD;AAAAA,cACP,UAAUiC,MAAU,IAAIL,IAAW;AAAA,YAAA;AAAA,YAJ9B1B;AAAAA,UAMR,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACH;AAAA,EACF;AAEJ;"}
|
|
@@ -1,16 +1,46 @@
|
|
|
1
1
|
import { FieldsetHTMLAttributes, Ref } from 'react';
|
|
2
|
-
import { SharedFieldLayoutProps } from '
|
|
3
|
-
export
|
|
2
|
+
import { SharedFieldLayoutProps } from '../../FieldLayout/FieldLayoutTypes';
|
|
3
|
+
export interface CheckboxGroupOption {
|
|
4
|
+
/**
|
|
5
|
+
* Label text or content for the checkbox 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 checkbox option
|
|
14
|
+
*/
|
|
6
15
|
isDisabled?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Optional description text for the checkbox option
|
|
18
|
+
*/
|
|
7
19
|
description?: React.ReactNode;
|
|
8
|
-
}
|
|
20
|
+
}
|
|
9
21
|
export interface CheckboxGroupProps extends SharedFieldLayoutProps, Pick<FieldsetHTMLAttributes<HTMLFieldSetElement>, 'className'> {
|
|
22
|
+
/**
|
|
23
|
+
* Indicates if the checkbox group is in an invalid state
|
|
24
|
+
*/
|
|
10
25
|
isInvalid?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Disables all checkbox options in the group
|
|
28
|
+
*/
|
|
11
29
|
isDisabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Array of checkbox options to display
|
|
32
|
+
*/
|
|
12
33
|
options: Array<CheckboxGroupOption>;
|
|
34
|
+
/**
|
|
35
|
+
* Array of currently selected values
|
|
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 checkbox input element
|
|
44
|
+
*/
|
|
15
45
|
inputRef?: Ref<HTMLInputElement>;
|
|
16
46
|
}
|
|
@@ -5,11 +5,11 @@ import { useMemo as H } from "react";
|
|
|
5
5
|
import d from "classnames";
|
|
6
6
|
import { useFieldIds as K } from "../hooks/useFieldIds.js";
|
|
7
7
|
import t from "./ComboBox.module.scss.js";
|
|
8
|
-
import {
|
|
8
|
+
import { FieldLayout as M } from "../../FieldLayout/FieldLayout.js";
|
|
9
|
+
import { useTheme as U } from "../../../../contexts/ThemeProvider/useTheme.js";
|
|
9
10
|
/* empty css */
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { FieldLayout as $ } from "../FieldLayout/FieldLayout.js";
|
|
11
|
+
import _ from "../../../../assets/icons/alert-circle.svg.js";
|
|
12
|
+
import $ from "../../../../assets/icons/caret-down.svg.js";
|
|
13
13
|
const oo = ({
|
|
14
14
|
className: p,
|
|
15
15
|
description: i,
|
|
@@ -33,9 +33,9 @@ const oo = ({
|
|
|
33
33
|
inputId: f,
|
|
34
34
|
errorMessage: m,
|
|
35
35
|
description: i
|
|
36
|
-
}), { container: w } =
|
|
36
|
+
}), { container: w } = U(), A = H(() => n.map((o) => ({ name: o.label, id: o.value })), [n]);
|
|
37
37
|
return /* @__PURE__ */ r(
|
|
38
|
-
|
|
38
|
+
M,
|
|
39
39
|
{
|
|
40
40
|
label: s,
|
|
41
41
|
htmlFor: l,
|
|
@@ -65,8 +65,8 @@ const oo = ({
|
|
|
65
65
|
/* @__PURE__ */ e(T, { children: [
|
|
66
66
|
/* @__PURE__ */ r(j, { ref: C, placeholder: b, onBlur: B, ...N }),
|
|
67
67
|
/* @__PURE__ */ e("div", { "aria-hidden": "true", className: t.icons, children: [
|
|
68
|
-
a && /* @__PURE__ */ r(
|
|
69
|
-
/* @__PURE__ */ r(
|
|
68
|
+
a && /* @__PURE__ */ r(_, { fontSize: 16 }),
|
|
69
|
+
/* @__PURE__ */ r($, { title: S("icons.selectArrow") })
|
|
70
70
|
] })
|
|
71
71
|
] }),
|
|
72
72
|
/* @__PURE__ */ r(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboBox.js","sources":["../../../../../src/components/Common/UI/ComboBox/ComboBox.tsx"],"sourcesContent":["import type { Key } from 'react-aria-components'\nimport {\n ComboBox as AriaComboBox,\n Button,\n Input,\n ListBox,\n ListBoxItem,\n Popover,\n} from 'react-aria-components'\nimport { useTranslation } from 'react-i18next'\nimport { useMemo } from 'react'\nimport classNames from 'classnames'\nimport {
|
|
1
|
+
{"version":3,"file":"ComboBox.js","sources":["../../../../../src/components/Common/UI/ComboBox/ComboBox.tsx"],"sourcesContent":["import type { Key } from 'react-aria-components'\nimport {\n ComboBox as AriaComboBox,\n Button,\n Input,\n ListBox,\n ListBoxItem,\n Popover,\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 './ComboBox.module.scss'\nimport type { ComboBoxProps } from './ComboBoxTypes'\nimport { FieldLayout } from '@/components/Common/FieldLayout'\nimport { useTheme } from '@/contexts/ThemeProvider'\nimport AlertCircle from '@/assets/icons/alert-circle.svg?react'\nimport CaretDown from '@/assets/icons/caret-down.svg?react'\n\nexport const ComboBox = ({\n className,\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 inputRef,\n shouldVisuallyHideLabel,\n name,\n ...props\n}: ComboBoxProps) => {\n const { t } = useTranslation()\n const { inputId, errorMessageId, descriptionId, ariaDescribedBy } = useFieldIds({\n inputId: id,\n errorMessage,\n description,\n })\n const { container } = useTheme()\n\n const items = useMemo(() => {\n return options.map(option => ({ name: option.label, id: option.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, className)}\n withErrorIcon={false}\n >\n <AriaComboBox\n aria-label={label}\n aria-describedby={ariaDescribedBy}\n className={'react-aria-ComboBox-root'}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n onSelectionChange={key => {\n if (key) {\n onChange?.(key.toString())\n }\n }}\n id={inputId}\n selectedKey={value ? (value as Key) : undefined}\n name={name}\n >\n <Button>\n <Input ref={inputRef} placeholder={placeholder} onBlur={onBlur} {...props} />\n <div aria-hidden=\"true\" className={styles.icons}>\n {isInvalid && <AlertCircle fontSize={16} />}\n <CaretDown title={t('icons.selectArrow')} />\n </div>\n </Button>\n\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 </AriaComboBox>\n </FieldLayout>\n )\n}\n"],"names":["ComboBox","className","description","errorMessage","id","isDisabled","isInvalid","isRequired","label","onChange","onBlur","options","placeholder","value","inputRef","shouldVisuallyHideLabel","name","props","t","useTranslation","inputId","errorMessageId","descriptionId","ariaDescribedBy","useFieldIds","container","useTheme","items","useMemo","option","jsx","FieldLayout","classNames","styles","jsxs","AriaComboBox","key","Button","Input","AlertCircle","CaretDown","Popover","ListBox","item","ListBoxItem"],"mappings":";;;;;;;;;;;;AAoBO,MAAMA,KAAW,CAAC;AAAA,EACvB,WAAAC;AAAA,EACA,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,UAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,MAAAC;AAAA,EACA,GAAGC;AACL,MAAqB;AACb,QAAA,EAAE,GAAAC,EAAE,IAAIC,EAAe,GACvB,EAAE,SAAAC,GAAS,gBAAAC,GAAgB,eAAAC,GAAe,iBAAAC,EAAA,IAAoBC,EAAY;AAAA,IAC9E,SAASpB;AAAA,IACT,cAAAD;AAAA,IACA,aAAAD;AAAA,EAAA,CACD,GACK,EAAE,WAAAuB,EAAU,IAAIC,EAAS,GAEzBC,IAAQC,EAAQ,MACbjB,EAAQ,IAAI,CAAAkB,OAAW,EAAE,MAAMA,EAAO,OAAO,IAAIA,EAAO,MAAQ,EAAA,GACtE,CAAClB,CAAO,CAAC;AAGV,SAAA,gBAAAmB;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,OAAAvB;AAAA,MACA,SAASY;AAAA,MACT,cAAAjB;AAAA,MACA,gBAAAkB;AAAA,MACA,eAAAC;AAAA,MACA,YAAAf;AAAA,MACA,aAAAL;AAAA,MACA,yBAAAa;AAAA,MACA,WAAWiB,EAAWC,EAAO,MAAMhC,CAAS;AAAA,MAC5C,eAAe;AAAA,MAEf,UAAA,gBAAAiC;AAAA,QAACC;AAAAA,QAAA;AAAA,UACC,cAAY3B;AAAA,UACZ,oBAAkBe;AAAA,UAClB,WAAW;AAAA,UACX,YAAAlB;AAAA,UACA,WAAAC;AAAA,UACA,mBAAmB,CAAO8B,MAAA;AACxB,YAAIA,KACS3B,IAAA2B,EAAI,UAAU;AAAA,UAE7B;AAAA,UACA,IAAIhB;AAAA,UACJ,aAAaP,KAAyB;AAAA,UACtC,MAAAG;AAAA,UAEA,UAAA;AAAA,YAAA,gBAAAkB,EAACG,GACC,EAAA,UAAA;AAAA,cAAA,gBAAAP,EAACQ,KAAM,KAAKxB,GAAU,aAAAF,GAA0B,QAAAF,GAAiB,GAAGO,GAAO;AAAA,gCAC1E,OAAI,EAAA,eAAY,QAAO,WAAWgB,EAAO,OACvC,UAAA;AAAA,gBAAa3B,KAAA,gBAAAwB,EAACS,GAAY,EAAA,UAAU,GAAI,CAAA;AAAA,gBACxC,gBAAAT,EAAAU,GAAA,EAAU,OAAOtB,EAAE,mBAAmB,EAAG,CAAA;AAAA,cAAA,EAC5C,CAAA;AAAA,YAAA,GACF;AAAA,YAEA,gBAAAY;AAAA,cAACW;AAAA,cAAA;AAAA,gBACC,WAAWT,EAAWC,EAAO,SAAS,oBAAoB;AAAA,gBAC1D,0BAA0BR,EAAU;AAAA,gBACpC,WAAW;AAAA,gBAEX,UAAA,gBAAAK,EAACY,GAAQ,EAAA,OAAAf,GACN,UAAQ,CAAAgB,MAAA,gBAAAb,EAACc,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,16 +1,46 @@
|
|
|
1
1
|
import { InputHTMLAttributes, Ref, FocusEvent } from 'react';
|
|
2
|
-
import { SharedFieldLayoutProps } from '
|
|
2
|
+
import { SharedFieldLayoutProps } from '../../FieldLayout/FieldLayoutTypes';
|
|
3
3
|
export interface ComboBoxOption {
|
|
4
|
+
/**
|
|
5
|
+
* Display text for the option
|
|
6
|
+
*/
|
|
4
7
|
label: string;
|
|
8
|
+
/**
|
|
9
|
+
* Value of the option that will be passed to onChange
|
|
10
|
+
*/
|
|
5
11
|
value: string;
|
|
6
12
|
}
|
|
7
13
|
export interface ComboBoxProps extends SharedFieldLayoutProps, Pick<InputHTMLAttributes<HTMLInputElement>, 'className' | 'id' | 'name' | 'placeholder'> {
|
|
14
|
+
/**
|
|
15
|
+
* Disables the combo box 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 combo box 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 dropdown
|
|
36
|
+
*/
|
|
13
37
|
options: ComboBoxOption[];
|
|
38
|
+
/**
|
|
39
|
+
* Currently selected value
|
|
40
|
+
*/
|
|
14
41
|
value?: string;
|
|
42
|
+
/**
|
|
43
|
+
* React ref for the combo box input element
|
|
44
|
+
*/
|
|
15
45
|
inputRef?: Ref<HTMLInputElement>;
|
|
16
46
|
}
|
|
@@ -5,15 +5,15 @@ import u from "classnames";
|
|
|
5
5
|
import { parseDate as H } from "@internationalized/date";
|
|
6
6
|
import { useFieldIds as R } from "../hooks/useFieldIds.js";
|
|
7
7
|
import i from "./DatePicker.module.scss.js";
|
|
8
|
+
import { FieldLayout as U } from "../../FieldLayout/FieldLayout.js";
|
|
8
9
|
import "react";
|
|
9
|
-
import { useTheme as
|
|
10
|
+
import { useTheme as _ } from "../../../../contexts/ThemeProvider/useTheme.js";
|
|
10
11
|
/* empty css */
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import { formatDateToStringDate as
|
|
16
|
-
import { FieldLayout as O } from "../FieldLayout/FieldLayout.js";
|
|
12
|
+
import $ from "../../../../assets/icons/caret-down.svg.js";
|
|
13
|
+
import q from "../../../../assets/icons/caret-right.svg.js";
|
|
14
|
+
import J from "../../../../assets/icons/caret-left.svg.js";
|
|
15
|
+
import K from "../../../../assets/icons/alert-circle.svg.js";
|
|
16
|
+
import { formatDateToStringDate as O } from "../../../../helpers/dateFormatting.js";
|
|
17
17
|
function Q(e) {
|
|
18
18
|
return e ? new Date(
|
|
19
19
|
e.year,
|
|
@@ -41,11 +41,11 @@ const dr = ({
|
|
|
41
41
|
inputId: D,
|
|
42
42
|
errorMessage: l,
|
|
43
43
|
description: n
|
|
44
|
-
}), { container: P } =
|
|
44
|
+
}), { container: P } = _(), f = p ? O(p) : "", T = f ? H(f) : null, w = (t) => {
|
|
45
45
|
d && d(Q(t));
|
|
46
46
|
};
|
|
47
47
|
return /* @__PURE__ */ r(
|
|
48
|
-
|
|
48
|
+
U,
|
|
49
49
|
{
|
|
50
50
|
label: s,
|
|
51
51
|
htmlFor: h,
|
|
@@ -71,8 +71,8 @@ const dr = ({
|
|
|
71
71
|
/* @__PURE__ */ o(k, { children: [
|
|
72
72
|
/* @__PURE__ */ r(A, { ref: g, children: (t) => /* @__PURE__ */ r(B, { segment: t }) }),
|
|
73
73
|
/* @__PURE__ */ o("div", { className: i.icons, children: [
|
|
74
|
-
m && /* @__PURE__ */ r(
|
|
75
|
-
/* @__PURE__ */ r(c, { onBlur: S, children: /* @__PURE__ */ r(
|
|
74
|
+
m && /* @__PURE__ */ r(K, { "aria-hidden": "true", fontSize: 16 }),
|
|
75
|
+
/* @__PURE__ */ r(c, { onBlur: S, children: /* @__PURE__ */ r($, { title: a("icons.calendarArrow") }) })
|
|
76
76
|
] })
|
|
77
77
|
] }),
|
|
78
78
|
/* @__PURE__ */ r(
|
|
@@ -82,9 +82,9 @@ const dr = ({
|
|
|
82
82
|
UNSTABLE_portalContainer: P.current,
|
|
83
83
|
children: /* @__PURE__ */ r(L, { children: /* @__PURE__ */ o(j, { children: [
|
|
84
84
|
/* @__PURE__ */ o("header", { children: [
|
|
85
|
-
/* @__PURE__ */ r(c, { slot: "previous", children: /* @__PURE__ */ r(
|
|
85
|
+
/* @__PURE__ */ r(c, { slot: "previous", children: /* @__PURE__ */ r(J, { title: a("icons.previousMonth") }) }),
|
|
86
86
|
/* @__PURE__ */ r(E, {}),
|
|
87
|
-
/* @__PURE__ */ r(c, { slot: "next", children: /* @__PURE__ */ r(
|
|
87
|
+
/* @__PURE__ */ r(c, { slot: "next", children: /* @__PURE__ */ r(q, { title: a("icons.nextMonth") }) })
|
|
88
88
|
] }),
|
|
89
89
|
/* @__PURE__ */ r(G, { children: (t) => /* @__PURE__ */ r(M, { date: t }) })
|
|
90
90
|
] }) })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.js","sources":["../../../../../src/components/Common/UI/DatePicker/DatePicker.tsx"],"sourcesContent":["import {\n DatePicker as AriaDatePicker,\n Button,\n Calendar,\n CalendarCell,\n CalendarGrid,\n DateInput,\n DateSegment,\n Dialog,\n Group,\n Heading,\n Popover,\n type DateValue,\n} from 'react-aria-components'\nimport { useTranslation } from 'react-i18next'\nimport classNames from 'classnames'\nimport { parseDate } from '@internationalized/date'\nimport {
|
|
1
|
+
{"version":3,"file":"DatePicker.js","sources":["../../../../../src/components/Common/UI/DatePicker/DatePicker.tsx"],"sourcesContent":["import {\n DatePicker as AriaDatePicker,\n Button,\n Calendar,\n CalendarCell,\n CalendarGrid,\n DateInput,\n DateSegment,\n Dialog,\n Group,\n Heading,\n Popover,\n type DateValue,\n} from 'react-aria-components'\nimport { useTranslation } from 'react-i18next'\nimport classNames from 'classnames'\nimport { parseDate } from '@internationalized/date'\nimport { useFieldIds } from '../hooks/useFieldIds'\nimport styles from './DatePicker.module.scss'\nimport type { DatePickerProps } from './DatePickerTypes'\nimport { FieldLayout } from '@/components/Common/FieldLayout'\nimport { useTheme } from '@/contexts/ThemeProvider'\nimport CaretDown from '@/assets/icons/caret-down.svg?react'\nimport CaretRight from '@/assets/icons/caret-right.svg?react'\nimport CaretLeft from '@/assets/icons/caret-left.svg?react'\nimport AlertCircle from '@/assets/icons/alert-circle.svg?react'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\n\nfunction calendarDateValueToDate(dateValue: DateValue | null): Date | null {\n if (!dateValue) return null\n\n const date = new Date(\n dateValue.year,\n dateValue.month - 1, // DateValue months are 1-indexed\n dateValue.day,\n )\n\n return date\n}\n\nexport const DatePicker = ({\n className,\n description,\n errorMessage,\n id,\n inputRef,\n isDisabled,\n isInvalid,\n isRequired,\n label,\n onChange,\n onBlur,\n value,\n ...props\n}: DatePickerProps) => {\n const { t } = useTranslation()\n const { inputId, errorMessageId, descriptionId, ariaDescribedBy } = useFieldIds({\n inputId: id,\n errorMessage,\n description,\n })\n const { container } = useTheme()\n\n // Convert JavaScript Date to DateValue for internal use\n // Format the date as YYYY-MM-DD for parseDate\n const formattedDate = value ? formatDateToStringDate(value) : ''\n const internalValue = formattedDate ? parseDate(formattedDate) : null\n\n // Handle internal onChange to convert DateValue back to Date\n const handleChange = (dateValue: DateValue | null) => {\n if (onChange) {\n onChange(calendarDateValueToDate(dateValue))\n }\n }\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 className={classNames(styles.root, className)}\n withErrorIcon={false}\n >\n <div className={styles.container}>\n <AriaDatePicker\n aria-label={label}\n aria-describedby={ariaDescribedBy}\n id={inputId}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n value={internalValue}\n onChange={handleChange}\n {...props}\n >\n <Group>\n <DateInput ref={inputRef}>{segment => <DateSegment segment={segment} />}</DateInput>\n\n <div className={styles.icons}>\n {isInvalid && <AlertCircle aria-hidden=\"true\" fontSize={16} />}\n <Button onBlur={onBlur}>\n <CaretDown title={t('icons.calendarArrow')} />\n </Button>\n </div>\n </Group>\n <Popover\n className={classNames(styles.popover, 'react-aria-Popover')}\n UNSTABLE_portalContainer={container.current}\n >\n <Dialog>\n <Calendar>\n <header>\n <Button slot=\"previous\">\n <CaretLeft title={t('icons.previousMonth')} />\n </Button>\n <Heading />\n <Button slot=\"next\">\n <CaretRight title={t('icons.nextMonth')} />\n </Button>\n </header>\n <CalendarGrid>{date => <CalendarCell date={date} />}</CalendarGrid>\n </Calendar>\n </Dialog>\n </Popover>\n </AriaDatePicker>\n </div>\n </FieldLayout>\n )\n}\n"],"names":["calendarDateValueToDate","dateValue","DatePicker","className","description","errorMessage","id","inputRef","isDisabled","isInvalid","isRequired","label","onChange","onBlur","value","props","t","useTranslation","inputId","errorMessageId","descriptionId","ariaDescribedBy","useFieldIds","container","useTheme","formattedDate","formatDateToStringDate","internalValue","parseDate","handleChange","jsx","FieldLayout","classNames","styles","jsxs","AriaDatePicker","Group","DateInput","DateSegment","segment","AlertCircle","Button","CaretDown","Popover","Dialog","Calendar","CaretLeft","Heading","CaretRight","CalendarGrid","date","CalendarCell"],"mappings":";;;;;;;;;;;;;;;;AA4BA,SAASA,EAAwBC,GAA0C;AACrE,SAACA,IAEQ,IAAI;AAAA,IACfA,EAAU;AAAA,IACVA,EAAU,QAAQ;AAAA;AAAA,IAClBA,EAAU;AAAA,EACZ,IANuB;AASzB;AAEO,MAAMC,KAAa,CAAC;AAAA,EACzB,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,IAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,MAAuB;AACf,QAAA,EAAE,GAAAC,EAAE,IAAIC,EAAe,GACvB,EAAE,SAAAC,GAAS,gBAAAC,GAAgB,eAAAC,GAAe,iBAAAC,EAAA,IAAoBC,EAAY;AAAA,IAC9E,SAAShB;AAAA,IACT,cAAAD;AAAA,IACA,aAAAD;AAAA,EAAA,CACD,GACK,EAAE,WAAAmB,EAAU,IAAIC,EAAS,GAIzBC,IAAgBX,IAAQY,EAAuBZ,CAAK,IAAI,IACxDa,IAAgBF,IAAgBG,EAAUH,CAAa,IAAI,MAG3DI,IAAe,CAAC5B,MAAgC;AACpD,IAAIW,KACOA,EAAAZ,EAAwBC,CAAS,CAAC;AAAA,EAE/C;AAGE,SAAA,gBAAA6B;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,OAAApB;AAAA,MACA,SAASO;AAAA,MACT,cAAAb;AAAA,MACA,gBAAAc;AAAA,MACA,eAAAC;AAAA,MACA,YAAAV;AAAA,MACA,aAAAN;AAAA,MACA,WAAW4B,EAAWC,EAAO,MAAM9B,CAAS;AAAA,MAC5C,eAAe;AAAA,MAEf,UAAC,gBAAA2B,EAAA,OAAA,EAAI,WAAWG,EAAO,WACrB,UAAA,gBAAAC;AAAA,QAACC;AAAAA,QAAA;AAAA,UACC,cAAYxB;AAAA,UACZ,oBAAkBU;AAAA,UAClB,IAAIH;AAAA,UACJ,YAAAV;AAAA,UACA,WAAAC;AAAA,UACA,OAAOkB;AAAA,UACP,UAAUE;AAAA,UACT,GAAGd;AAAA,UAEJ,UAAA;AAAA,YAAA,gBAAAmB,EAACE,GACC,EAAA,UAAA;AAAA,cAAA,gBAAAN,EAACO,KAAU,KAAK9B,GAAW,iBAAY,gBAAAuB,EAAAQ,GAAA,EAAY,SAAAC,GAAkB,EAAG,CAAA;AAAA,cAEvE,gBAAAL,EAAA,OAAA,EAAI,WAAWD,EAAO,OACpB,UAAA;AAAA,gBAAAxB,KAAc,gBAAAqB,EAAAU,GAAA,EAAY,eAAY,QAAO,UAAU,IAAI;AAAA,gBAC5D,gBAAAV,EAACW,KAAO,QAAA5B,GACN,UAAA,gBAAAiB,EAACY,KAAU,OAAO1B,EAAE,qBAAqB,EAAG,CAAA,EAC9C,CAAA;AAAA,cAAA,EACF,CAAA;AAAA,YAAA,GACF;AAAA,YACA,gBAAAc;AAAA,cAACa;AAAA,cAAA;AAAA,gBACC,WAAWX,EAAWC,EAAO,SAAS,oBAAoB;AAAA,gBAC1D,0BAA0BV,EAAU;AAAA,gBAEpC,UAAA,gBAAAO,EAACc,GACC,EAAA,UAAA,gBAAAV,EAACW,GACC,EAAA,UAAA;AAAA,kBAAA,gBAAAX,EAAC,UACC,EAAA,UAAA;AAAA,oBAAC,gBAAAJ,EAAAW,GAAA,EAAO,MAAK,YACX,UAAA,gBAAAX,EAACgB,KAAU,OAAO9B,EAAE,qBAAqB,EAAA,CAAG,EAC9C,CAAA;AAAA,sCACC+B,GAAQ,EAAA;AAAA,oBACT,gBAAAjB,EAACW,GAAO,EAAA,MAAK,QACX,UAAA,gBAAAX,EAACkB,KAAW,OAAOhC,EAAE,iBAAiB,EAAG,CAAA,EAC3C,CAAA;AAAA,kBAAA,GACF;AAAA,oCACCiC,GAAc,EAAA,UAAA,CAAAC,MAAS,gBAAApB,EAAAqB,GAAA,EAAa,MAAAD,GAAY,EAAG,CAAA;AAAA,gBAAA,EAAA,CACtD,EACF,CAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,MAAA,EAEJ,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -1,12 +1,36 @@
|
|
|
1
1
|
import { InputHTMLAttributes, Ref, FocusEvent } from 'react';
|
|
2
|
-
import { SharedFieldLayoutProps } from '
|
|
2
|
+
import { SharedFieldLayoutProps } from '../../FieldLayout/FieldLayoutTypes';
|
|
3
3
|
export interface DatePickerProps extends SharedFieldLayoutProps, Pick<InputHTMLAttributes<HTMLInputElement>, 'className' | 'id' | 'name'> {
|
|
4
|
+
/**
|
|
5
|
+
* React ref for the date input element
|
|
6
|
+
*/
|
|
4
7
|
inputRef?: Ref<HTMLInputElement>;
|
|
8
|
+
/**
|
|
9
|
+
* Disables the date picker and prevents interaction
|
|
10
|
+
*/
|
|
5
11
|
isDisabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Indicates that the field has an error
|
|
14
|
+
*/
|
|
6
15
|
isInvalid?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Callback when selected date changes
|
|
18
|
+
*/
|
|
7
19
|
onChange?: (value: Date | null) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Handler for blur events
|
|
22
|
+
*/
|
|
8
23
|
onBlur?: (e: FocusEvent) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Label text for the date picker field
|
|
26
|
+
*/
|
|
9
27
|
label: string;
|
|
28
|
+
/**
|
|
29
|
+
* Currently selected date value
|
|
30
|
+
*/
|
|
10
31
|
value?: Date | null;
|
|
32
|
+
/**
|
|
33
|
+
* Placeholder text when no date is selected
|
|
34
|
+
*/
|
|
11
35
|
placeholder?: string;
|
|
12
36
|
}
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
export interface HeadingProps extends Pick<HTMLAttributes<HTMLHeadingElement>, 'className'> {
|
|
3
|
+
/**
|
|
4
|
+
* The HTML heading element to render (h1-h6)
|
|
5
|
+
*/
|
|
3
6
|
as: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
7
|
+
/**
|
|
8
|
+
* Optional visual style to apply, independent of the semantic heading level
|
|
9
|
+
*/
|
|
4
10
|
styledAs?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
11
|
+
/**
|
|
12
|
+
* Text alignment within the heading
|
|
13
|
+
*/
|
|
5
14
|
textAlign?: 'start' | 'center' | 'end';
|
|
15
|
+
/**
|
|
16
|
+
* Content to be displayed inside the heading
|
|
17
|
+
*/
|
|
6
18
|
children?: ReactNode;
|
|
7
19
|
}
|
|
@@ -1,2 +1,54 @@
|
|
|
1
1
|
import { AnchorHTMLAttributes } from 'react';
|
|
2
|
-
export type LinkProps = Pick<AnchorHTMLAttributes<HTMLAnchorElement>,
|
|
2
|
+
export type LinkProps = Pick<AnchorHTMLAttributes<HTMLAnchorElement>,
|
|
3
|
+
/**
|
|
4
|
+
* URL that the link points to
|
|
5
|
+
*/
|
|
6
|
+
'href'
|
|
7
|
+
/**
|
|
8
|
+
* Specifies where to open the linked document
|
|
9
|
+
*/
|
|
10
|
+
| 'target'
|
|
11
|
+
/**
|
|
12
|
+
* Specifies the relationship between the current document and the linked document
|
|
13
|
+
*/
|
|
14
|
+
| 'rel'
|
|
15
|
+
/**
|
|
16
|
+
* Indicates that the link is for downloading a resource
|
|
17
|
+
*/
|
|
18
|
+
| 'download'
|
|
19
|
+
/**
|
|
20
|
+
* Content to be displayed inside the link
|
|
21
|
+
*/
|
|
22
|
+
| 'children'
|
|
23
|
+
/**
|
|
24
|
+
* Additional CSS class name
|
|
25
|
+
*/
|
|
26
|
+
| 'className'
|
|
27
|
+
/**
|
|
28
|
+
* Unique identifier for the link
|
|
29
|
+
*/
|
|
30
|
+
| 'id'
|
|
31
|
+
/**
|
|
32
|
+
* Handler for key down events
|
|
33
|
+
*/
|
|
34
|
+
| 'onKeyDown'
|
|
35
|
+
/**
|
|
36
|
+
* Handler for key up events
|
|
37
|
+
*/
|
|
38
|
+
| 'onKeyUp'
|
|
39
|
+
/**
|
|
40
|
+
* Accessible label for the link
|
|
41
|
+
*/
|
|
42
|
+
| 'aria-label'
|
|
43
|
+
/**
|
|
44
|
+
* ID of an element that labels this link
|
|
45
|
+
*/
|
|
46
|
+
| 'aria-labelledby'
|
|
47
|
+
/**
|
|
48
|
+
* ID of an element that describes this link
|
|
49
|
+
*/
|
|
50
|
+
| 'aria-describedby'
|
|
51
|
+
/**
|
|
52
|
+
* Title text shown on hover
|
|
53
|
+
*/
|
|
54
|
+
| 'title'>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
export interface BaseListProps {
|
|
3
3
|
/**
|
|
4
4
|
* The list items to render
|
|
@@ -21,7 +21,5 @@ export interface BaseListProps {
|
|
|
21
21
|
*/
|
|
22
22
|
'aria-describedby'?: string;
|
|
23
23
|
}
|
|
24
|
-
export
|
|
25
|
-
|
|
26
|
-
export interface OrderedListProps extends BaseListProps, HTMLAttributes<HTMLOListElement> {
|
|
27
|
-
}
|
|
24
|
+
export type UnorderedListProps = BaseListProps;
|
|
25
|
+
export type OrderedListProps = BaseListProps;
|
|
@@ -1,16 +1,46 @@
|
|
|
1
1
|
import { ReactNode, RefObject } from 'react';
|
|
2
2
|
import { DataAttributes } from '../../../../types/Helpers';
|
|
3
3
|
export interface MenuItem extends DataAttributes {
|
|
4
|
+
/**
|
|
5
|
+
* Text label for the menu item
|
|
6
|
+
*/
|
|
4
7
|
label: string;
|
|
8
|
+
/**
|
|
9
|
+
* Optional icon to display before the label
|
|
10
|
+
*/
|
|
5
11
|
icon?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Callback function when the menu item is clicked
|
|
14
|
+
*/
|
|
6
15
|
onClick: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Disables the menu item and prevents interaction
|
|
18
|
+
*/
|
|
7
19
|
isDisabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Optional URL to navigate to when clicked
|
|
22
|
+
*/
|
|
8
23
|
href?: string;
|
|
9
24
|
}
|
|
10
25
|
export interface MenuProps extends DataAttributes {
|
|
26
|
+
/**
|
|
27
|
+
* Reference to the element that triggers the menu
|
|
28
|
+
*/
|
|
11
29
|
triggerRef?: RefObject<Element | null>;
|
|
30
|
+
/**
|
|
31
|
+
* Array of menu items to display
|
|
32
|
+
*/
|
|
12
33
|
items?: MenuItem[];
|
|
34
|
+
/**
|
|
35
|
+
* Controls whether the menu is currently open
|
|
36
|
+
*/
|
|
13
37
|
isOpen?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Callback when the menu is closed
|
|
40
|
+
*/
|
|
14
41
|
onClose?: () => void;
|
|
42
|
+
/**
|
|
43
|
+
* Accessible label describing the menu's purpose
|
|
44
|
+
*/
|
|
15
45
|
'aria-label': string;
|
|
16
46
|
}
|
|
@@ -4,8 +4,8 @@ import { NumberField as P, Group as T } from "react-aria-components";
|
|
|
4
4
|
import k from "classnames";
|
|
5
5
|
import { useFieldIds as z } from "../hooks/useFieldIds.js";
|
|
6
6
|
import A from "./NumberInput.module.scss.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { FieldLayout as C } from "../../FieldLayout/FieldLayout.js";
|
|
8
|
+
import { useLocale as H } from "../../../../contexts/LocaleProvider/useLocale.js";
|
|
9
9
|
import { Input as J } from "../Input/Input.js";
|
|
10
10
|
function q({
|
|
11
11
|
name: y,
|
|
@@ -32,7 +32,7 @@ function q({
|
|
|
32
32
|
minimumFractionDigits: B,
|
|
33
33
|
...u
|
|
34
34
|
}) {
|
|
35
|
-
const { locale: a, currency: n } =
|
|
35
|
+
const { locale: a, currency: n } = H(), { inputId: s, errorMessageId: E, descriptionId: L, ariaDescribedBy: S } = z({
|
|
36
36
|
inputId: p,
|
|
37
37
|
errorMessage: c,
|
|
38
38
|
description: i
|
|
@@ -41,7 +41,7 @@ function q({
|
|
|
41
41
|
currency: n
|
|
42
42
|
}).formatToParts(0).find((M) => M.type === "currency")?.value, [n, a]);
|
|
43
43
|
return /* @__PURE__ */ e(
|
|
44
|
-
|
|
44
|
+
C,
|
|
45
45
|
{
|
|
46
46
|
label: h,
|
|
47
47
|
description: i,
|