@canonical/react-ds-global-form 0.45.0 → 0.48.0
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/README.md +14 -9
- package/dist/esm/density.css +23 -28
- package/dist/esm/index.css +28 -13
- package/dist/esm/lib/{component → _work_in_progress/component}/ColorField/ColorField.js +2 -2
- package/dist/esm/lib/_work_in_progress/component/ColorField/ColorField.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/component/ColorField/index.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/component/ColorField/types.js.map +1 -0
- package/dist/esm/lib/{component → _work_in_progress/component}/ComboboxField/ComboboxField.js +2 -2
- package/dist/esm/lib/_work_in_progress/component/ComboboxField/ComboboxField.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/component/ComboboxField/index.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/component/ComboboxField/types.js.map +1 -0
- package/dist/esm/lib/{component → _work_in_progress/component}/RatingField/RatingField.js +2 -2
- package/dist/esm/lib/_work_in_progress/component/RatingField/RatingField.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/component/RatingField/index.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/component/RatingField/types.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ColorInput/ColorInput.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ColorInput/index.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ColorInput/types.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/ComboboxInput.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/MultipleCombobox.js +198 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/MultipleCombobox.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/SingleCombobox.js +120 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/SingleCombobox.js.map +1 -0
- package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/List/List.js +16 -4
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/common/List/List.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/common/List/index.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/common/List/types.js.map +1 -0
- package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/ResetButton/ResetButton.js +2 -2
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/common/ResetButton/ResetButton.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/common/ResetButton/index.js.map +1 -0
- package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/ResetButton/styles.css +3 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/common/ResetButton/types.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/common/index.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/constants.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/index.js.map +1 -0
- package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/messages.js +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/messages.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/types.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/convertItemToString.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/convertValueToItem.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/filterItems.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/index.js +7 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/index.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/isPromise.js +6 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/isPromise.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/settleLookup.js +10 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/settleLookup.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/stopPageMovesAtEnds.js +25 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/ComboboxInput/utils/stopPageMovesAtEnds.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/RatingInput/RatingInput.js.map +1 -0
- package/dist/esm/lib/_work_in_progress/subcomponent/RatingInput/index.js.map +1 -0
- package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/styles.css +7 -7
- package/dist/esm/lib/_work_in_progress/subcomponent/RatingInput/types.js.map +1 -0
- package/dist/esm/lib/common/Wrapper/InvisibleWrapper.js +3 -1
- package/dist/esm/lib/common/Wrapper/InvisibleWrapper.js.map +1 -1
- package/dist/esm/lib/common/Wrapper/ToggleWrapper.css +0 -6
- package/dist/esm/lib/common/Wrapper/ToggleWrapper.js +2 -1
- package/dist/esm/lib/common/Wrapper/ToggleWrapper.js.map +1 -1
- package/dist/esm/lib/common/Wrapper/Wrapper.js +10 -6
- package/dist/esm/lib/common/Wrapper/Wrapper.js.map +1 -1
- package/dist/esm/lib/common/Wrapper/createMiddleware.js +70 -0
- package/dist/esm/lib/common/Wrapper/createMiddleware.js.map +1 -0
- package/dist/esm/lib/common/Wrapper/hooks/useFieldWrapper.js +2 -2
- package/dist/esm/lib/common/Wrapper/hooks/useFieldWrapper.js.map +1 -1
- package/dist/esm/lib/common/Wrapper/withConditionalDisplay.js +17 -12
- package/dist/esm/lib/common/Wrapper/withConditionalDisplay.js.map +1 -1
- package/dist/esm/lib/common/Wrapper/withWrapper.js +16 -10
- package/dist/esm/lib/common/Wrapper/withWrapper.js.map +1 -1
- package/dist/esm/lib/component/ChoicesField/Choices.js +2 -2
- package/dist/esm/lib/component/ChoicesField/Choices.js.map +1 -1
- package/dist/esm/lib/component/ChoicesField/ChoicesField.js +3 -2
- package/dist/esm/lib/component/ChoicesField/ChoicesField.js.map +1 -1
- package/dist/esm/lib/component/ChoicesField/styles.css +3 -65
- package/dist/esm/lib/component/DateTimeField/DateTimeField.js +2 -1
- package/dist/esm/lib/component/DateTimeField/DateTimeField.js.map +1 -1
- package/dist/esm/lib/component/FileUploadField/FileUploadField.js +45 -41
- package/dist/esm/lib/component/FileUploadField/FileUploadField.js.map +1 -1
- package/dist/esm/lib/component/FileUploadField/fileUploadRules.js +39 -0
- package/dist/esm/lib/component/FileUploadField/fileUploadRules.js.map +1 -0
- package/dist/esm/lib/component/FileUploadField/styles.css +30 -0
- package/dist/esm/lib/component/RichChoicesField/RichChoices.js +2 -2
- package/dist/esm/lib/component/RichChoicesField/RichChoices.js.map +1 -1
- package/dist/esm/lib/component/RichChoicesField/RichChoicesField.js +2 -2
- package/dist/esm/lib/component/index.js +5 -4
- package/dist/esm/lib/component/index.js.map +1 -1
- package/dist/esm/lib/index.js.map +1 -1
- package/dist/esm/lib/pattern/Field/Field.js +38 -31
- package/dist/esm/lib/pattern/Field/Field.js.map +1 -1
- package/dist/esm/lib/subcomponent/DateInput/styles.css +16 -0
- package/dist/esm/lib/subcomponent/DateTimeInput/styles.css +24 -7
- package/dist/esm/lib/subcomponent/Field/Description/Description.js +1 -3
- package/dist/esm/lib/subcomponent/Field/Description/Description.js.map +1 -1
- package/dist/esm/lib/subcomponent/Field/Description/styles.css +4 -0
- package/dist/esm/lib/subcomponent/Field/Error/Error.js +4 -4
- package/dist/esm/lib/subcomponent/Field/Error/Error.js.map +1 -1
- package/dist/esm/lib/subcomponent/Field/Error/styles.css +8 -0
- package/dist/esm/lib/subcomponent/Field/Label/styles.css +1 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/FileUploadInput.js +119 -64
- package/dist/esm/lib/subcomponent/FileUploadInput/FileUploadInput.js.map +1 -1
- package/dist/esm/lib/subcomponent/FileUploadInput/common/FileItem/FileItem.js +52 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/common/FileItem/FileItem.js.map +1 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/common/FileItem/index.js +2 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/common/FileItem/index.js.map +1 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/common/FileItem/types.js +2 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/common/FileItem/types.js.map +1 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/common/Thumbnail/Thumbnail.js +40 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/common/Thumbnail/Thumbnail.js.map +1 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/common/Thumbnail/index.js +2 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/common/Thumbnail/index.js.map +1 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/common/Thumbnail/types.js +2 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/common/Thumbnail/types.js.map +1 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/constants.js +3 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/constants.js.map +1 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/hooks/index.js +3 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/hooks/index.js.map +1 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/hooks/useFileUploads.js +148 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/hooks/useFileUploads.js.map +1 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/hooks/useObjectUrl.js +22 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/hooks/useObjectUrl.js.map +1 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/messages.js +25 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/messages.js.map +1 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/styles.css +255 -94
- package/dist/esm/lib/subcomponent/FileUploadInput/utils/formatFileSize.js +21 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/utils/formatFileSize.js.map +1 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/utils/getFileMessage.js +20 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/utils/getFileMessage.js.map +1 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/utils/index.js +4 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/utils/index.js.map +1 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/utils/matchesAccept.js +26 -0
- package/dist/esm/lib/subcomponent/FileUploadInput/utils/matchesAccept.js.map +1 -0
- package/dist/esm/lib/subcomponent/NumberInput/NumberInput.js +1 -1
- package/dist/esm/lib/subcomponent/NumberInput/NumberInput.js.map +1 -1
- package/dist/esm/lib/subcomponent/NumberInput/styles.css +17 -0
- package/dist/esm/lib/subcomponent/PasswordInput/styles.css +7 -1
- package/dist/esm/lib/subcomponent/PhoneInput/PhoneInput.js +8 -2
- package/dist/esm/lib/subcomponent/PhoneInput/PhoneInput.js.map +1 -1
- package/dist/esm/lib/subcomponent/RadioInput/styles.css +15 -13
- package/dist/esm/lib/subcomponent/TextInput/TextInput.js +3 -1
- package/dist/esm/lib/subcomponent/TextInput/TextInput.js.map +1 -1
- package/dist/esm/lib/subcomponent/index.js +5 -5
- package/dist/esm/lib/subcomponent/index.js.map +1 -1
- package/dist/esm/lib/utils/hooks/useFieldAriaProperties.js +6 -4
- package/dist/esm/lib/utils/hooks/useFieldAriaProperties.js.map +1 -1
- package/dist/esm/lib/utils/hooks/useOptionAriaProperties.js +3 -3
- package/dist/esm/lib/utils/hooks/useOptionAriaProperties.js.map +1 -1
- package/dist/esm/lib/utils/middleware/addRESTOptions.js +99 -39
- package/dist/esm/lib/utils/middleware/addRESTOptions.js.map +1 -1
- package/dist/esm/lib/utils/middleware/addRESTValidation.js +246 -32
- package/dist/esm/lib/utils/middleware/addRESTValidation.js.map +1 -1
- package/dist/esm/lib/utils/middleware/index.js +1 -0
- package/dist/esm/lib/utils/middleware/index.js.map +1 -1
- package/dist/esm/testing/expectNoAxeViolations.js +30 -0
- package/dist/esm/testing/expectNoAxeViolations.js.map +1 -0
- package/dist/types/lib/{component → _work_in_progress/component}/ColorField/ColorField.d.ts +7 -12
- package/dist/types/lib/_work_in_progress/component/ColorField/ColorField.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/component/ColorField/index.d.ts.map +1 -0
- package/dist/types/lib/{component → _work_in_progress/component}/ColorField/types.d.ts +1 -1
- package/dist/types/lib/_work_in_progress/component/ColorField/types.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/component/ComboboxField/ComboboxField.d.ts +53 -0
- package/dist/types/lib/_work_in_progress/component/ComboboxField/ComboboxField.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/component/ComboboxField/index.d.ts.map +1 -0
- package/dist/types/lib/{component → _work_in_progress/component}/ComboboxField/types.d.ts +1 -1
- package/dist/types/lib/_work_in_progress/component/ComboboxField/types.d.ts.map +1 -0
- package/dist/types/lib/{component → _work_in_progress/component}/RatingField/RatingField.d.ts +7 -12
- package/dist/types/lib/_work_in_progress/component/RatingField/RatingField.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/component/RatingField/index.d.ts.map +1 -0
- package/dist/types/lib/{component → _work_in_progress/component}/RatingField/types.d.ts +1 -1
- package/dist/types/lib/_work_in_progress/component/RatingField/types.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ColorInput/ColorInput.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ColorInput/index.d.ts.map +1 -0
- package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/types.d.ts +1 -1
- package/dist/types/lib/_work_in_progress/subcomponent/ColorInput/types.d.ts.map +1 -0
- package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/ComboboxInput.d.ts +13 -5
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/ComboboxInput.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/MultipleCombobox.d.ts +24 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/MultipleCombobox.d.ts.map +1 -0
- package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/SingleCombobox.d.ts +19 -4
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/SingleCombobox.d.ts.map +1 -0
- package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/List/List.d.ts +1 -1
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/List/List.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/List/index.d.ts.map +1 -0
- package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/List/types.d.ts +2 -1
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/List/types.d.ts.map +1 -0
- package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/ResetButton/ResetButton.d.ts +1 -1
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/ResetButton/ResetButton.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/ResetButton/index.d.ts.map +1 -0
- package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/ResetButton/types.d.ts +1 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/ResetButton/types.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/common/index.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/constants.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/index.d.ts.map +1 -0
- package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/messages.d.ts +1 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/messages.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/types.d.ts +52 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/types.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/convertItemToString.d.ts +4 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/convertItemToString.d.ts.map +1 -0
- package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/utils/convertValueToItem.d.ts +1 -1
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/convertValueToItem.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/filterItems.d.ts +4 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/filterItems.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/index.d.ts +7 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/index.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/isPromise.d.ts +4 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/isPromise.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/settleLookup.d.ts +8 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/settleLookup.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/stopPageMovesAtEnds.d.ts +13 -0
- package/dist/types/lib/_work_in_progress/subcomponent/ComboboxInput/utils/stopPageMovesAtEnds.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/subcomponent/RatingInput/RatingInput.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/subcomponent/RatingInput/index.d.ts.map +1 -0
- package/dist/types/lib/_work_in_progress/subcomponent/RatingInput/types.d.ts.map +1 -0
- package/dist/types/lib/common/Wrapper/InvisibleWrapper.d.ts.map +1 -1
- package/dist/types/lib/common/Wrapper/ToggleWrapper.d.ts.map +1 -1
- package/dist/types/lib/common/Wrapper/Wrapper.d.ts +1 -1
- package/dist/types/lib/common/Wrapper/Wrapper.d.ts.map +1 -1
- package/dist/types/lib/common/Wrapper/createMiddleware.d.ts +43 -0
- package/dist/types/lib/common/Wrapper/createMiddleware.d.ts.map +1 -0
- package/dist/types/lib/common/Wrapper/hooks/useFieldWrapper.d.ts +2 -0
- package/dist/types/lib/common/Wrapper/hooks/useFieldWrapper.d.ts.map +1 -1
- package/dist/types/lib/common/Wrapper/withConditionalDisplay.d.ts +9 -3
- package/dist/types/lib/common/Wrapper/withConditionalDisplay.d.ts.map +1 -1
- package/dist/types/lib/common/Wrapper/withToggleWrapper.d.ts +2 -2
- package/dist/types/lib/common/Wrapper/withToggleWrapper.d.ts.map +1 -1
- package/dist/types/lib/common/Wrapper/withWrapper.d.ts +3 -5
- package/dist/types/lib/common/Wrapper/withWrapper.d.ts.map +1 -1
- package/dist/types/lib/common/types.d.ts +19 -7
- package/dist/types/lib/common/types.d.ts.map +1 -1
- package/dist/types/lib/component/CheckboxField/CheckboxField.d.ts +1 -1
- package/dist/types/lib/component/ChoicesField/Choices.d.ts +1 -1
- package/dist/types/lib/component/ChoicesField/Choices.d.ts.map +1 -1
- package/dist/types/lib/component/ChoicesField/ChoicesField.d.ts +9 -13
- package/dist/types/lib/component/ChoicesField/ChoicesField.d.ts.map +1 -1
- package/dist/types/lib/component/ChoicesField/types.d.ts +2 -2
- package/dist/types/lib/component/ChoicesField/types.d.ts.map +1 -1
- package/dist/types/lib/component/DateField/DateField.d.ts +6 -11
- package/dist/types/lib/component/DateTimeField/DateTimeField.d.ts +7 -11
- package/dist/types/lib/component/DateTimeField/DateTimeField.d.ts.map +1 -1
- package/dist/types/lib/component/FileUploadField/FileUploadField.d.ts +299 -19
- package/dist/types/lib/component/FileUploadField/FileUploadField.d.ts.map +1 -1
- package/dist/types/lib/component/FileUploadField/fileUploadRules.d.ts +24 -0
- package/dist/types/lib/component/FileUploadField/fileUploadRules.d.ts.map +1 -0
- package/dist/types/lib/component/HiddenField/HiddenField.d.ts +6 -11
- package/dist/types/lib/component/NumberField/NumberField.d.ts +6 -11
- package/dist/types/lib/component/PasswordField/PasswordField.d.ts +6 -11
- package/dist/types/lib/component/PhoneField/PhoneField.d.ts +7 -11
- package/dist/types/lib/component/RangeField/RangeField.d.ts +6 -11
- package/dist/types/lib/component/RichChoicesField/RichChoices.d.ts +1 -1
- package/dist/types/lib/component/RichChoicesField/RichChoices.d.ts.map +1 -1
- package/dist/types/lib/component/RichChoicesField/RichChoicesField.d.ts +8 -13
- package/dist/types/lib/component/RichChoicesField/types.d.ts +2 -2
- package/dist/types/lib/component/RichChoicesField/types.d.ts.map +1 -1
- package/dist/types/lib/component/SelectField/SelectField.d.ts +6 -11
- package/dist/types/lib/component/SwitchField/SwitchField.d.ts +1 -1
- package/dist/types/lib/component/TextField/TextField.d.ts +6 -11
- package/dist/types/lib/component/TextareaField/TextareaField.d.ts +6 -11
- package/dist/types/lib/component/TimeField/TimeField.d.ts +6 -11
- package/dist/types/lib/component/index.d.ts +3 -3
- package/dist/types/lib/component/index.d.ts.map +1 -1
- package/dist/types/lib/index.d.ts +1 -1
- package/dist/types/lib/index.d.ts.map +1 -1
- package/dist/types/lib/pattern/Field/Field.d.ts +9 -5
- package/dist/types/lib/pattern/Field/Field.d.ts.map +1 -1
- package/dist/types/lib/pattern/Field/types.d.ts +69 -45
- package/dist/types/lib/pattern/Field/types.d.ts.map +1 -1
- package/dist/types/lib/subcomponent/Field/Description/Description.d.ts.map +1 -1
- package/dist/types/lib/subcomponent/Field/Error/Error.d.ts.map +1 -1
- package/dist/types/lib/subcomponent/FileUploadInput/FileUploadInput.d.ts +25 -4
- package/dist/types/lib/subcomponent/FileUploadInput/FileUploadInput.d.ts.map +1 -1
- package/dist/types/lib/subcomponent/FileUploadInput/common/FileItem/FileItem.d.ts +15 -0
- package/dist/types/lib/subcomponent/FileUploadInput/common/FileItem/FileItem.d.ts.map +1 -0
- package/dist/types/lib/subcomponent/FileUploadInput/common/FileItem/index.d.ts +3 -0
- package/dist/types/lib/subcomponent/FileUploadInput/common/FileItem/index.d.ts.map +1 -0
- package/dist/types/lib/subcomponent/FileUploadInput/common/FileItem/types.d.ts +28 -0
- package/dist/types/lib/subcomponent/FileUploadInput/common/FileItem/types.d.ts.map +1 -0
- package/dist/types/lib/subcomponent/FileUploadInput/common/Thumbnail/Thumbnail.d.ts +14 -0
- package/dist/types/lib/subcomponent/FileUploadInput/common/Thumbnail/Thumbnail.d.ts.map +1 -0
- package/dist/types/lib/subcomponent/FileUploadInput/common/Thumbnail/index.d.ts +3 -0
- package/dist/types/lib/subcomponent/FileUploadInput/common/Thumbnail/index.d.ts.map +1 -0
- package/dist/types/lib/subcomponent/FileUploadInput/common/Thumbnail/types.d.ts +9 -0
- package/dist/types/lib/subcomponent/FileUploadInput/common/Thumbnail/types.d.ts.map +1 -0
- package/dist/types/lib/subcomponent/FileUploadInput/constants.d.ts +3 -0
- package/dist/types/lib/subcomponent/FileUploadInput/constants.d.ts.map +1 -0
- package/dist/types/lib/subcomponent/FileUploadInput/hooks/index.d.ts +3 -0
- package/dist/types/lib/subcomponent/FileUploadInput/hooks/index.d.ts.map +1 -0
- package/dist/types/lib/subcomponent/FileUploadInput/hooks/useFileUploads.d.ts +33 -0
- package/dist/types/lib/subcomponent/FileUploadInput/hooks/useFileUploads.d.ts.map +1 -0
- package/dist/types/lib/subcomponent/FileUploadInput/hooks/useObjectUrl.d.ts +8 -0
- package/dist/types/lib/subcomponent/FileUploadInput/hooks/useObjectUrl.d.ts.map +1 -0
- package/dist/types/lib/subcomponent/FileUploadInput/index.d.ts +1 -1
- package/dist/types/lib/subcomponent/FileUploadInput/index.d.ts.map +1 -1
- package/dist/types/lib/subcomponent/FileUploadInput/messages.d.ts +4 -0
- package/dist/types/lib/subcomponent/FileUploadInput/messages.d.ts.map +1 -0
- package/dist/types/lib/subcomponent/FileUploadInput/types.d.ts +165 -8
- package/dist/types/lib/subcomponent/FileUploadInput/types.d.ts.map +1 -1
- package/dist/types/lib/subcomponent/FileUploadInput/utils/formatFileSize.d.ts +7 -0
- package/dist/types/lib/subcomponent/FileUploadInput/utils/formatFileSize.d.ts.map +1 -0
- package/dist/types/lib/subcomponent/FileUploadInput/utils/getFileMessage.d.ts +14 -0
- package/dist/types/lib/subcomponent/FileUploadInput/utils/getFileMessage.d.ts.map +1 -0
- package/dist/types/lib/subcomponent/FileUploadInput/utils/index.d.ts +5 -0
- package/dist/types/lib/subcomponent/FileUploadInput/utils/index.d.ts.map +1 -0
- package/dist/types/lib/subcomponent/FileUploadInput/utils/matchesAccept.d.ts +10 -0
- package/dist/types/lib/subcomponent/FileUploadInput/utils/matchesAccept.d.ts.map +1 -0
- package/dist/types/lib/subcomponent/PhoneInput/PhoneInput.d.ts +12 -0
- package/dist/types/lib/subcomponent/PhoneInput/PhoneInput.d.ts.map +1 -1
- package/dist/types/lib/subcomponent/PhoneInput/types.d.ts +11 -2
- package/dist/types/lib/subcomponent/PhoneInput/types.d.ts.map +1 -1
- package/dist/types/lib/subcomponent/TextInput/TextInput.d.ts +2 -0
- package/dist/types/lib/subcomponent/TextInput/TextInput.d.ts.map +1 -1
- package/dist/types/lib/subcomponent/index.d.ts +7 -7
- package/dist/types/lib/subcomponent/index.d.ts.map +1 -1
- package/dist/types/lib/subcomponent/types.d.ts +6 -0
- package/dist/types/lib/subcomponent/types.d.ts.map +1 -1
- package/dist/types/lib/utils/hooks/useFieldAriaProperties.d.ts +2 -1
- package/dist/types/lib/utils/hooks/useFieldAriaProperties.d.ts.map +1 -1
- package/dist/types/lib/utils/hooks/useOptionAriaProperties.d.ts +3 -2
- package/dist/types/lib/utils/hooks/useOptionAriaProperties.d.ts.map +1 -1
- package/dist/types/lib/utils/middleware/addRESTOptions.d.ts +37 -4
- package/dist/types/lib/utils/middleware/addRESTOptions.d.ts.map +1 -1
- package/dist/types/lib/utils/middleware/addRESTValidation.d.ts +38 -3
- package/dist/types/lib/utils/middleware/addRESTValidation.d.ts.map +1 -1
- package/dist/types/lib/utils/middleware/index.d.ts +2 -0
- package/dist/types/lib/utils/middleware/index.d.ts.map +1 -1
- package/dist/types/testing/expectNoAxeViolations.d.ts +10 -0
- package/dist/types/testing/expectNoAxeViolations.d.ts.map +1 -0
- package/package.json +23 -18
- package/dist/esm/lib/component/ColorField/ColorField.js.map +0 -1
- package/dist/esm/lib/component/ColorField/index.js.map +0 -1
- package/dist/esm/lib/component/ColorField/types.js.map +0 -1
- package/dist/esm/lib/component/ComboboxField/ComboboxField.js.map +0 -1
- package/dist/esm/lib/component/ComboboxField/index.js.map +0 -1
- package/dist/esm/lib/component/ComboboxField/types.js.map +0 -1
- package/dist/esm/lib/component/RatingField/RatingField.js.map +0 -1
- package/dist/esm/lib/component/RatingField/index.js.map +0 -1
- package/dist/esm/lib/component/RatingField/types.js.map +0 -1
- package/dist/esm/lib/subcomponent/ColorInput/ColorInput.js.map +0 -1
- package/dist/esm/lib/subcomponent/ColorInput/index.js.map +0 -1
- package/dist/esm/lib/subcomponent/ColorInput/types.js.map +0 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/ComboboxInput.js.map +0 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/MultipleCombobox.js +0 -84
- package/dist/esm/lib/subcomponent/ComboboxInput/MultipleCombobox.js.map +0 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/SingleCombobox.js +0 -67
- package/dist/esm/lib/subcomponent/ComboboxInput/SingleCombobox.js.map +0 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/common/List/List.js.map +0 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/common/List/index.js.map +0 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/common/List/types.js.map +0 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/common/ResetButton/ResetButton.js.map +0 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/common/ResetButton/index.js.map +0 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/common/ResetButton/types.js.map +0 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/common/index.js.map +0 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/constants.js.map +0 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/index.js.map +0 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/messages.js.map +0 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/types.js.map +0 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/utils/convertItemToString.js.map +0 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/utils/convertValueToItem.js.map +0 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/utils/filterItems.js.map +0 -1
- package/dist/esm/lib/subcomponent/ComboboxInput/utils/index.js +0 -4
- package/dist/esm/lib/subcomponent/ComboboxInput/utils/index.js.map +0 -1
- package/dist/esm/lib/subcomponent/RatingInput/RatingInput.js.map +0 -1
- package/dist/esm/lib/subcomponent/RatingInput/index.js.map +0 -1
- package/dist/esm/lib/subcomponent/RatingInput/types.js.map +0 -1
- package/dist/types/lib/component/ColorField/ColorField.d.ts.map +0 -1
- package/dist/types/lib/component/ColorField/index.d.ts.map +0 -1
- package/dist/types/lib/component/ColorField/types.d.ts.map +0 -1
- package/dist/types/lib/component/ComboboxField/ComboboxField.d.ts +0 -56
- package/dist/types/lib/component/ComboboxField/ComboboxField.d.ts.map +0 -1
- package/dist/types/lib/component/ComboboxField/index.d.ts.map +0 -1
- package/dist/types/lib/component/ComboboxField/types.d.ts.map +0 -1
- package/dist/types/lib/component/RatingField/RatingField.d.ts.map +0 -1
- package/dist/types/lib/component/RatingField/index.d.ts.map +0 -1
- package/dist/types/lib/component/RatingField/types.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ColorInput/ColorInput.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ColorInput/index.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ColorInput/types.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ComboboxInput/ComboboxInput.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ComboboxInput/MultipleCombobox.d.ts +0 -16
- package/dist/types/lib/subcomponent/ComboboxInput/MultipleCombobox.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ComboboxInput/SingleCombobox.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ComboboxInput/common/List/List.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ComboboxInput/common/List/index.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ComboboxInput/common/List/types.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ComboboxInput/common/ResetButton/ResetButton.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ComboboxInput/common/ResetButton/index.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ComboboxInput/common/ResetButton/types.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ComboboxInput/common/index.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ComboboxInput/constants.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ComboboxInput/index.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ComboboxInput/messages.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ComboboxInput/types.d.ts +0 -27
- package/dist/types/lib/subcomponent/ComboboxInput/types.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ComboboxInput/utils/convertItemToString.d.ts +0 -4
- package/dist/types/lib/subcomponent/ComboboxInput/utils/convertItemToString.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ComboboxInput/utils/convertValueToItem.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ComboboxInput/utils/filterItems.d.ts +0 -4
- package/dist/types/lib/subcomponent/ComboboxInput/utils/filterItems.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/ComboboxInput/utils/index.d.ts +0 -4
- package/dist/types/lib/subcomponent/ComboboxInput/utils/index.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/RatingInput/RatingInput.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/RatingInput/index.d.ts.map +0 -1
- package/dist/types/lib/subcomponent/RatingInput/types.d.ts.map +0 -1
- /package/dist/esm/lib/{component → _work_in_progress/component}/ColorField/index.js +0 -0
- /package/dist/esm/lib/{component → _work_in_progress/component}/ColorField/types.js +0 -0
- /package/dist/esm/lib/{component → _work_in_progress/component}/ComboboxField/index.js +0 -0
- /package/dist/esm/lib/{component → _work_in_progress/component}/ComboboxField/types.js +0 -0
- /package/dist/esm/lib/{component → _work_in_progress/component}/RatingField/index.js +0 -0
- /package/dist/esm/lib/{component → _work_in_progress/component}/RatingField/types.js +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/ColorInput.js +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/index.js +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/styles.css +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/types.js +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/ComboboxInput.js +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/List/index.js +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/List/styles.css +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/List/types.js +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/ResetButton/index.js +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/ResetButton/types.js +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/index.js +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/constants.js +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/index.js +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/styles.css +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/types.js +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/utils/convertItemToString.js +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/utils/convertValueToItem.js +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/utils/filterItems.js +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/RatingInput.js +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/index.js +0 -0
- /package/dist/esm/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/types.js +0 -0
- /package/dist/types/lib/{component → _work_in_progress/component}/ColorField/index.d.ts +0 -0
- /package/dist/types/lib/{component → _work_in_progress/component}/ComboboxField/index.d.ts +0 -0
- /package/dist/types/lib/{component → _work_in_progress/component}/RatingField/index.d.ts +0 -0
- /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/ColorInput.d.ts +0 -0
- /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ColorInput/index.d.ts +0 -0
- /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/List/index.d.ts +0 -0
- /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/ResetButton/index.d.ts +0 -0
- /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/common/index.d.ts +0 -0
- /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/constants.d.ts +0 -0
- /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/ComboboxInput/index.d.ts +0 -0
- /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/RatingInput.d.ts +0 -0
- /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/index.d.ts +0 -0
- /package/dist/types/lib/{subcomponent → _work_in_progress/subcomponent}/RatingInput/types.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/subcomponent/FileUploadInput/common/Thumbnail/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/subcomponent/FileUploadInput/common/Thumbnail/types.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,MAAM,MAAM,cAAc,GAAG;IAC3B;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/FileUploadInput/constants.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,eAAO,MAAM,uBAAuB,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/subcomponent/FileUploadInput/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { UploadFunction, UploadState, UploadSummary } from "../types.js";
|
|
2
|
+
type UseFileUploadsOptions = {
|
|
3
|
+
/** The upload function; the input is live only when it is set. */
|
|
4
|
+
upload?: UploadFunction;
|
|
5
|
+
/** Whether a chosen file may be uploaded (a file with an error may not). */
|
|
6
|
+
canUpload: (file: File) => boolean;
|
|
7
|
+
/** Called when the count of running or failed uploads changes. */
|
|
8
|
+
onSummaryChange?: (summary: UploadSummary) => void;
|
|
9
|
+
};
|
|
10
|
+
type FileUploads = {
|
|
11
|
+
/** The upload state of each chosen file that has been sent. */
|
|
12
|
+
states: ReadonlyMap<File, UploadState>;
|
|
13
|
+
/** Sends a file again after a failed upload. */
|
|
14
|
+
retry: (file: File) => void;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Runs the live uploads of the chosen files. Each new file that may be
|
|
18
|
+
* uploaded is sent once with its own abort signal; a file that leaves the
|
|
19
|
+
* selection has its upload aborted and its state dropped. Upload state lives
|
|
20
|
+
* here, keyed by the `File` object, and never in the form value.
|
|
21
|
+
*
|
|
22
|
+
* Cancelling an upload is removing its file: the consumer drops it from the
|
|
23
|
+
* value, and the upload is aborted with it. Once an upload ends, success or
|
|
24
|
+
* failure, its result shows for `RESULT_DISPLAY_DURATION`; a failed upload
|
|
25
|
+
* then stays failed until it is retried or removed.
|
|
26
|
+
*
|
|
27
|
+
* Every upload promise is settled here, so neither a rejection nor an abort
|
|
28
|
+
* escapes as an unhandled rejection. A result from an upload that has since
|
|
29
|
+
* been retried or removed is ignored.
|
|
30
|
+
*/
|
|
31
|
+
export default function useFileUploads(files: readonly File[], { upload, canUpload, onSummaryChange }: UseFileUploadsOptions): FileUploads;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=useFileUploads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFileUploads.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/subcomponent/FileUploadInput/hooks/useFileUploads.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE9E,KAAK,qBAAqB,GAAG;IAC3B,kEAAkE;IAClE,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,4EAA4E;IAC5E,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IACnC,kEAAkE;IAClE,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;CACpD,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,+DAA+D;IAC/D,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACvC,gDAAgD;IAChD,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CAC7B,CAAC;AAeF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,qBAAqB,GAC5D,WAAW,CAoJb"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An object URL for a file, created after mount and revoked when the file
|
|
3
|
+
* changes or the component unmounts. `undefined` without a file, during server
|
|
4
|
+
* rendering, on the first client render, and where object URLs are not
|
|
5
|
+
* supported.
|
|
6
|
+
*/
|
|
7
|
+
export default function useObjectUrl(file: File | undefined): string | undefined;
|
|
8
|
+
//# sourceMappingURL=useObjectUrl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useObjectUrl.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/subcomponent/FileUploadInput/hooks/useObjectUrl.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,IAAI,EAAE,IAAI,GAAG,SAAS,GACrB,MAAM,GAAG,SAAS,CAcpB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { default as FileUploadInput } from "./FileUploadInput.js";
|
|
2
|
-
export type { FileUploadInputProps } from "./types.js";
|
|
2
|
+
export type { FileMessage, FileMessageLevel, FileUploadInputProps, FileUploadMessages, UploadFunction, UploadOptions, UploadSummary, } from "./types.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/FileUploadInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/FileUploadInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,aAAa,GACd,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/FileUploadInput/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAKrD,QAAA,MAAM,QAAQ,EAAE,kBAsBf,CAAC;eAEa,QAAQ"}
|
|
@@ -1,19 +1,176 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
/**
|
|
3
|
-
export type
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
/** How serious a per-file message is. */
|
|
3
|
+
export type FileMessageLevel = "warning" | "error";
|
|
4
|
+
/** A message shown under one file's tile. */
|
|
5
|
+
export type FileMessage = {
|
|
6
|
+
level: FileMessageLevel;
|
|
7
|
+
message: string;
|
|
8
|
+
};
|
|
9
|
+
/** What the input hands an `upload` function for each file. */
|
|
10
|
+
export type UploadOptions = {
|
|
11
|
+
/** Aborted when the user cancels the upload, which removes the file. */
|
|
12
|
+
signal: AbortSignal;
|
|
13
|
+
/** Report the share of the file sent so far, from 0 to 1. */
|
|
14
|
+
onProgress: (fraction: number) => void;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Sends one file. Resolve when the file is stored; reject when it is not. A
|
|
18
|
+
* rejection, including one caused by the abort signal, is caught by the input.
|
|
19
|
+
*/
|
|
20
|
+
export type UploadFunction = (file: File, options: UploadOptions) => Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Where one file's live upload stands. Once an upload ends, `showResult` is
|
|
23
|
+
* true while its progress and result icon show, then false.
|
|
24
|
+
*/
|
|
25
|
+
export type UploadState = {
|
|
26
|
+
status: "uploading";
|
|
27
|
+
progress: number;
|
|
28
|
+
} | {
|
|
29
|
+
status: "uploaded";
|
|
30
|
+
showResult: boolean;
|
|
31
|
+
} | {
|
|
32
|
+
status: "failed";
|
|
33
|
+
reason: unknown;
|
|
34
|
+
/** The share sent before the upload failed, from 0 to 1. */
|
|
35
|
+
progress: number;
|
|
36
|
+
showResult: boolean;
|
|
37
|
+
};
|
|
38
|
+
/** How many live uploads are running, and how many need a retry. */
|
|
39
|
+
export type UploadSummary = {
|
|
40
|
+
/** Files still uploading. */
|
|
41
|
+
uploading: number;
|
|
42
|
+
/** Files whose upload failed, and that are still chosen. */
|
|
43
|
+
failed: number;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Every text the input renders or announces. Pass a subset through the
|
|
47
|
+
* `messages` prop to translate or reword it.
|
|
48
|
+
*/
|
|
49
|
+
export type FileUploadMessages = {
|
|
50
|
+
/** The text in the drop area, before the button. */
|
|
51
|
+
dropAreaText: () => string;
|
|
52
|
+
/** The label of the button that opens the file picker. */
|
|
53
|
+
chooseFile: (multiple: boolean) => string;
|
|
54
|
+
/** A file size, from bytes. Change it to localise the size format. */
|
|
55
|
+
fileSize: (bytes: number) => string;
|
|
56
|
+
/** The visible upload progress, from 0 to 1. */
|
|
57
|
+
progress: (fraction: number) => string;
|
|
58
|
+
/** The text alternative of the spinner while a file uploads. */
|
|
59
|
+
statusUploading: (fileName: string) => string;
|
|
60
|
+
/** The text alternative of the success icon. */
|
|
61
|
+
statusUploaded: (fileName: string) => string;
|
|
62
|
+
/** The text alternative of the warning icon after an upload. */
|
|
63
|
+
statusUploadedWithWarning: (fileName: string) => string;
|
|
64
|
+
/** The text alternative of the error icon after a failed upload. */
|
|
65
|
+
statusFailed: (fileName: string) => string;
|
|
66
|
+
/** The name of the button that removes a file. */
|
|
67
|
+
remove: (fileName: string) => string;
|
|
68
|
+
/** The name of the button that cancels a running upload and removes the file. */
|
|
69
|
+
cancelUpload: (fileName: string) => string;
|
|
70
|
+
/** The name of the button that retries a failed upload. */
|
|
71
|
+
retryUpload: (fileName: string) => string;
|
|
72
|
+
/** The text alternative of the icon before a per-file message. */
|
|
73
|
+
messageLevel: (level: FileMessageLevel) => string;
|
|
74
|
+
/** The message under a file whose upload failed. */
|
|
75
|
+
uploadFailed: (file: File, reason: unknown) => string;
|
|
76
|
+
/** The message under a file larger than `maxSize`, given as a size text. */
|
|
77
|
+
fileTooLarge: (maxSize: string) => string;
|
|
78
|
+
/** The message under a file that `accept` does not allow. */
|
|
79
|
+
fileTypeNotAccepted: (accept: string) => string;
|
|
80
|
+
/** The field error when more than `maxFiles` files are chosen. */
|
|
81
|
+
tooManyFiles: (maxFiles: number) => string;
|
|
82
|
+
/** The field error while a chosen file has an error. */
|
|
83
|
+
filesHaveErrors: () => string;
|
|
84
|
+
/** The field error while a file is still uploading. */
|
|
85
|
+
uploadsPending: () => string;
|
|
86
|
+
/** The field error while a file's upload failed. */
|
|
87
|
+
uploadsFailed: () => string;
|
|
88
|
+
};
|
|
89
|
+
type OwnProps = {
|
|
90
|
+
/**
|
|
91
|
+
* The `id` of the native file input, which a field label targets with
|
|
92
|
+
* `for`. Not set on the root element.
|
|
93
|
+
*/
|
|
94
|
+
id?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Name of the native file input, so the selected files post in a plain HTML
|
|
97
|
+
* submission. The form needs `enctype="multipart/form-data"` for the browser
|
|
98
|
+
* to send file contents.
|
|
99
|
+
*/
|
|
100
|
+
name?: string;
|
|
101
|
+
/** Whether a file must be selected. Set on the native file input. */
|
|
102
|
+
required?: boolean;
|
|
4
103
|
/** Selected files (controlled value). */
|
|
5
104
|
value?: File[];
|
|
6
105
|
/** Called with the next file list when files are added or removed. */
|
|
7
106
|
onChange?: (files: File[]) => void;
|
|
8
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* Accepted file types, as in the native `accept` attribute (for example
|
|
109
|
+
* `"image/*,.pdf"`). A file that does not match gets an error under its
|
|
110
|
+
* tile.
|
|
111
|
+
*/
|
|
9
112
|
accept?: string;
|
|
10
|
-
/** Maximum file size in bytes */
|
|
113
|
+
/** Maximum file size in bytes. A larger file gets an error under its tile. */
|
|
11
114
|
maxSize?: number;
|
|
12
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* Maximum number of files. The field reports a larger selection as a field
|
|
117
|
+
* error; the input itself does not drop files.
|
|
118
|
+
*/
|
|
13
119
|
maxFiles?: number;
|
|
14
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* Allow multiple files. When `false`, the drop area hides once a file is
|
|
122
|
+
* chosen and returns when the file is removed. It stays while `showFileList`
|
|
123
|
+
* is off, since the file list is then the only way to remove the file.
|
|
124
|
+
*/
|
|
15
125
|
multiple?: boolean;
|
|
16
|
-
/** Whether the input is disabled */
|
|
126
|
+
/** Whether the input is disabled. A disabled input draws no file list. */
|
|
17
127
|
disabled?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Upload each file as soon as it is chosen. Without it the input only lists
|
|
130
|
+
* the files, with no status, progress or retry.
|
|
131
|
+
*/
|
|
132
|
+
upload?: UploadFunction;
|
|
133
|
+
/**
|
|
134
|
+
* Add a warning or an error to a file. Runs only when `accept` and
|
|
135
|
+
* `maxSize` raise nothing. A file with an error is not uploaded.
|
|
136
|
+
*/
|
|
137
|
+
validateFile?: (file: File) => FileMessage | undefined;
|
|
138
|
+
/** Show each file's size on its tile. */
|
|
139
|
+
showFileSize?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Show the drop area, with its Choose file button. When off, the files can
|
|
142
|
+
* only be added by the consumer through `value`; the field-level `error` still
|
|
143
|
+
* shows, and the file actions carry the field's `aria-describedby`.
|
|
144
|
+
*/
|
|
145
|
+
showDropArea?: boolean;
|
|
146
|
+
/** Show the list of chosen files, with their tiles and messages. */
|
|
147
|
+
showFileList?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* A field-level message rendered under the drop area, or in its place when
|
|
150
|
+
* the drop area is not shown. While it is set, the drop area takes the error
|
|
151
|
+
* colours.
|
|
152
|
+
*/
|
|
153
|
+
error?: ReactNode;
|
|
154
|
+
/** Called when the number of running or failed uploads changes. */
|
|
155
|
+
onUploadStatusChange?: (summary: UploadSummary) => void;
|
|
156
|
+
/** Replaces some of the default texts. */
|
|
157
|
+
messages?: Partial<FileUploadMessages>;
|
|
158
|
+
/** Labels the button that opens the file picker, with its own text. */
|
|
159
|
+
"aria-labelledby"?: string;
|
|
160
|
+
/** Describes the button that opens the file picker. */
|
|
161
|
+
"aria-describedby"?: string;
|
|
162
|
+
/**
|
|
163
|
+
* Marks the button that opens the file picker as invalid, and gives the drop
|
|
164
|
+
* area the error colours.
|
|
165
|
+
*/
|
|
166
|
+
"aria-invalid"?: boolean | "true" | "false";
|
|
167
|
+
/** Points the button that opens the file picker at the field error. */
|
|
168
|
+
"aria-errormessage"?: string;
|
|
18
169
|
};
|
|
170
|
+
/**
|
|
171
|
+
* Props for the presentational FileUpload input (controlled, no
|
|
172
|
+
* react-hook-form). Renders a `<div class="ds input file-upload">` as its root.
|
|
173
|
+
*/
|
|
174
|
+
export type FileUploadInputProps = OwnProps & Omit<ComponentProps<"div">, keyof OwnProps>;
|
|
175
|
+
export {};
|
|
19
176
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/FileUploadInput/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/FileUploadInput/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats a byte count as a short, human-readable size in the given locale,
|
|
3
|
+
* for example `1.5 MB` in English or `1,5 MB` in German. Sizes step by 1024.
|
|
4
|
+
* @note Pure.
|
|
5
|
+
*/
|
|
6
|
+
export default function formatFileSize(bytes: number, locale?: string): string;
|
|
7
|
+
//# sourceMappingURL=formatFileSize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatFileSize.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/subcomponent/FileUploadInput/utils/formatFileSize.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,SAAO,GAAG,MAAM,CAa3E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FileMessage, FileUploadMessages } from "../types.js";
|
|
2
|
+
export type FileRules = {
|
|
3
|
+
accept?: string;
|
|
4
|
+
maxSize?: number;
|
|
5
|
+
validateFile?: (file: File) => FileMessage | undefined;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The message for one chosen file: an error when `accept` or `maxSize` rejects
|
|
9
|
+
* it, otherwise whatever `validateFile` returns. The input shows it under the
|
|
10
|
+
* file's tile, and the field turns an error into an invalid field.
|
|
11
|
+
* @note Pure when `validateFile` is.
|
|
12
|
+
*/
|
|
13
|
+
export default function getFileMessage(file: File, { accept, maxSize, validateFile }: FileRules, messages: Pick<FileUploadMessages, "fileSize" | "fileTooLarge" | "fileTypeNotAccepted">): FileMessage | undefined;
|
|
14
|
+
//# sourceMappingURL=getFileMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFileMessage.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/subcomponent/FileUploadInput/utils/getFileMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGnE,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,WAAW,GAAG,SAAS,CAAC;CACxD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,IAAI,EAAE,IAAI,EACV,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,SAAS,EAC5C,QAAQ,EAAE,IAAI,CACZ,kBAAkB,EAClB,UAAU,GAAG,cAAc,GAAG,qBAAqB,CACpD,GACA,WAAW,GAAG,SAAS,CAWzB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as formatFileSize } from "./formatFileSize.js";
|
|
2
|
+
export type { FileRules } from "./getFileMessage.js";
|
|
3
|
+
export { default as getFileMessage } from "./getFileMessage.js";
|
|
4
|
+
export { default as matchesAccept } from "./matchesAccept.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/subcomponent/FileUploadInput/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a file matches an `accept` list, by the rules of the native
|
|
3
|
+
* `accept` attribute: a `.ext` entry matches the end of the file name, a
|
|
4
|
+
* `type/*` entry matches the start of the MIME type, and any other entry
|
|
5
|
+
* matches the MIME type exactly. Matching ignores case. An empty list accepts
|
|
6
|
+
* every file.
|
|
7
|
+
* @note Pure.
|
|
8
|
+
*/
|
|
9
|
+
export default function matchesAccept(file: File, accept: string): boolean;
|
|
10
|
+
//# sourceMappingURL=matchesAccept.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matchesAccept.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/subcomponent/FileUploadInput/utils/matchesAccept.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAazE"}
|
|
@@ -14,6 +14,12 @@ import "./styles.css";
|
|
|
14
14
|
*
|
|
15
15
|
* The forwarded ref reaches the national-number input — the field's focusable
|
|
16
16
|
* element, and what react-hook-form needs for `setFocus` and focus-on-error.
|
|
17
|
+
* The `id` and the field's ARIA wiring go on that input too, so the field label
|
|
18
|
+
* names it; the country `<select>` keeps its own "Country code" label. Without
|
|
19
|
+
* `aria-labelledby` the number input falls back to a "Phone number" label.
|
|
20
|
+
*
|
|
21
|
+
* With a `name`, both controls post in a plain HTML submission: the number as
|
|
22
|
+
* `<name>` and the selected country code as `<name>-country`.
|
|
17
23
|
* @returns {React.ReactElement} - Rendered Phone
|
|
18
24
|
*
|
|
19
25
|
* `import { PhoneInput } from "@canonical/react-ds-global-form";`
|
|
@@ -21,6 +27,12 @@ import "./styles.css";
|
|
|
21
27
|
* @implements ds:global.subcomponent.phone_input
|
|
22
28
|
*/
|
|
23
29
|
export declare const PhoneInput: React.ForwardRefExoticComponent<import("../types.js").BaseProps & {
|
|
30
|
+
"aria-describedby"?: string | undefined;
|
|
31
|
+
"aria-errormessage"?: string | undefined;
|
|
32
|
+
"aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
|
|
33
|
+
"aria-labelledby"?: string | undefined;
|
|
34
|
+
"aria-required"?: ("false" | "true" | boolean) | undefined;
|
|
35
|
+
} & {
|
|
24
36
|
name?: string;
|
|
25
37
|
value?: string | PhoneValue;
|
|
26
38
|
onChange?: (value: string | PhoneValue) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneInput.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/PhoneInput/PhoneInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,gBAAgB,EACtB,MAAM,gCAAgC,CAAC;AAIxC,OAAO,KAAK,EAAmB,UAAU,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,cAAc,CAAC;AAgDtB
|
|
1
|
+
{"version":3,"file":"PhoneInput.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/PhoneInput/PhoneInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,gBAAgB,EACtB,MAAM,gCAAgC,CAAC;AAIxC,OAAO,KAAK,EAAmB,UAAU,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,cAAc,CAAC;AAgDtB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;0CA2KtB,CAAC;eAEa,UAAU"}
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
+
import type React from "react";
|
|
1
2
|
import type { CountryData, KnownCountryCode } from "../../utils/countries/index.js";
|
|
2
3
|
import type { BaseProps } from "../types.js";
|
|
3
4
|
export type { CountryCode, CountryData, KnownCountryCode, } from "../../utils/countries/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* ARIA wiring for the national-number input. The field tier supplies these, so
|
|
7
|
+
* the number is named by the field label and described by its description and
|
|
8
|
+
* error.
|
|
9
|
+
*/
|
|
10
|
+
type PhoneNumberAriaProps = Pick<React.AriaAttributes, "aria-labelledby" | "aria-describedby" | "aria-errormessage" | "aria-invalid" | "aria-required">;
|
|
4
11
|
/** Props for the presentational Phone input (controlled, no react-hook-form). */
|
|
5
|
-
export type PhoneInputProps = BaseProps & {
|
|
12
|
+
export type PhoneInputProps = BaseProps & PhoneNumberAriaProps & {
|
|
6
13
|
/**
|
|
7
14
|
* Name for the national-number input. The field tier supplies this; it is what
|
|
8
15
|
* gives the control a name in a plain HTML submission, so the entry is not
|
|
9
|
-
* silently dropped when scripting is unavailable.
|
|
16
|
+
* silently dropped when scripting is unavailable. The country `<select>` is
|
|
17
|
+
* named `<name>-country`, so a server can rebuild the full number from a
|
|
18
|
+
* plain submission.
|
|
10
19
|
*/
|
|
11
20
|
name?: string;
|
|
12
21
|
/** Controlled value — E.164 string or structured object. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/PhoneInput/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAI7C,YAAY,EACV,WAAW,EACX,WAAW,EACX,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AAExC,iFAAiF;AACjF,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/PhoneInput/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAI7C,YAAY,EACV,WAAW,EACX,WAAW,EACX,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AAExC;;;;GAIG;AACH,KAAK,oBAAoB,GAAG,IAAI,CAC9B,KAAK,CAAC,cAAc,EAClB,iBAAiB,GACjB,kBAAkB,GAClB,mBAAmB,GACnB,cAAc,GACd,eAAe,CAClB,CAAC;AAEF,iFAAiF;AACjF,MAAM,MAAM,eAAe,GAAG,SAAS,GACrC,oBAAoB,GAAG;IACrB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAE5B,kEAAkE;IAClE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,KAAK,IAAI,CAAC;IAEhD;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAEnD,0EAA0E;IAC1E,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAElC;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAEvC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAExC;;;OAGG;IACH,SAAS,CAAC,EAAE,WAAW,EAAE,CAAC;IAE1B,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAEpC;;;;;;;;;;OAUG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAE1C;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEJ,MAAM,MAAM,UAAU,GAAG;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
|
|
@@ -4,6 +4,8 @@ import "./styles.css";
|
|
|
4
4
|
*
|
|
5
5
|
* Usable standalone (controlled via `value`/`onChange`, or uncontrolled) or via
|
|
6
6
|
* the field tier, which spreads react-hook-form's `register()` result onto it.
|
|
7
|
+
* The `id` goes on the native `<input>`, not the chrome wrapper, so a
|
|
8
|
+
* `<label for>` names and focuses the real control.
|
|
7
9
|
* @returns {ReactElement} - Rendered Text
|
|
8
10
|
*
|
|
9
11
|
* `import { TextInput } from "@canonical/react-ds-global-form";`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/TextInput/TextInput.tsx"],"names":[],"mappings":"AAEA,OAAO,cAAc,CAAC;AAItB
|
|
1
|
+
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../../../src/lib/subcomponent/TextInput/TextInput.tsx"],"names":[],"mappings":"AAEA,OAAO,cAAc,CAAC;AAItB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS;;;;oDAwBrB,CAAC;eAEa,SAAS"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
export type { ColorInputProps, HexFormat, } from "../_work_in_progress/subcomponent/ColorInput/index.js";
|
|
2
|
+
export { ColorInput } from "../_work_in_progress/subcomponent/ColorInput/index.js";
|
|
3
|
+
export type { ComboboxInputProps } from "../_work_in_progress/subcomponent/ComboboxInput/index.js";
|
|
4
|
+
export { ComboboxInput } from "../_work_in_progress/subcomponent/ComboboxInput/index.js";
|
|
5
|
+
export type { RatingInputProps, RatingScale, } from "../_work_in_progress/subcomponent/RatingInput/index.js";
|
|
6
|
+
export { RatingInput } from "../_work_in_progress/subcomponent/RatingInput/index.js";
|
|
1
7
|
export type { CheckboxInputProps } from "./CheckboxInput/index.js";
|
|
2
8
|
export { CheckboxInput } from "./CheckboxInput/index.js";
|
|
3
|
-
export type { ColorInputProps, HexFormat } from "./ColorInput/index.js";
|
|
4
|
-
export { ColorInput } from "./ColorInput/index.js";
|
|
5
|
-
export type { ComboboxInputProps } from "./ComboboxInput/index.js";
|
|
6
|
-
export { ComboboxInput } from "./ComboboxInput/index.js";
|
|
7
9
|
export type { DateInputProps } from "./DateInput/index.js";
|
|
8
10
|
export { DateInput } from "./DateInput/index.js";
|
|
9
11
|
export type { DateTimeInputProps } from "./DateTimeInput/index.js";
|
|
10
12
|
export { DateTimeInput } from "./DateTimeInput/index.js";
|
|
11
13
|
export * from "./Field/index.js";
|
|
12
|
-
export type { FileUploadInputProps } from "./FileUploadInput/index.js";
|
|
14
|
+
export type { FileMessage, FileMessageLevel, FileUploadInputProps, FileUploadMessages, UploadFunction, UploadOptions, UploadSummary, } from "./FileUploadInput/index.js";
|
|
13
15
|
export { FileUploadInput } from "./FileUploadInput/index.js";
|
|
14
16
|
export type { HiddenInputProps } from "./HiddenInput/index.js";
|
|
15
17
|
export { HiddenInput } from "./HiddenInput/index.js";
|
|
@@ -23,8 +25,6 @@ export type { RadioInputProps } from "./RadioInput/index.js";
|
|
|
23
25
|
export { RadioInput } from "./RadioInput/index.js";
|
|
24
26
|
export type { RangeInputProps } from "./RangeInput/index.js";
|
|
25
27
|
export { RangeInput } from "./RangeInput/index.js";
|
|
26
|
-
export type { RatingInputProps, RatingScale } from "./RatingInput/index.js";
|
|
27
|
-
export { RatingInput } from "./RatingInput/index.js";
|
|
28
28
|
export type { SelectInputProps } from "./SelectInput/index.js";
|
|
29
29
|
export { SelectInput } from "./SelectInput/index.js";
|
|
30
30
|
export type { SwitchInputProps } from "./SwitchInput/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/subcomponent/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/subcomponent/index.ts"],"names":[],"mappings":"AAKA,YAAY,EACV,eAAe,EACf,SAAS,GACV,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,uDAAuD,CAAC;AACnF,YAAY,EAAE,kBAAkB,EAAE,MAAM,0DAA0D,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,MAAM,0DAA0D,CAAC;AACzF,YAAY,EACV,gBAAgB,EAChB,WAAW,GACZ,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,wDAAwD,CAAC;AACrF,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,cAAc,kBAAkB,CAAC;AACjC,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,aAAa,GACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,cAAc,YAAY,CAAC"}
|
|
@@ -4,6 +4,12 @@ export type BaseProps = {
|
|
|
4
4
|
className?: string;
|
|
5
5
|
style?: React.CSSProperties;
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* ARIA wiring for an option group's fieldset. The field tier supplies these, so
|
|
9
|
+
* the group is named by the field label and described by its description and
|
|
10
|
+
* error.
|
|
11
|
+
*/
|
|
12
|
+
export type GroupAriaProps = Pick<React.AriaAttributes, "aria-labelledby" | "aria-describedby">;
|
|
7
13
|
/** A selectable option for choice-style inputs (Select, Combobox, Choices…). */
|
|
8
14
|
export type Option = {
|
|
9
15
|
value: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/subcomponent/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,MAAM,GAAG;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,iEAAiE;AACjE,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,UAAU,GACV,OAAO,GACP,QAAQ,GACR,KAAK,GACL,KAAK,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/subcomponent/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,KAAK,CAAC,cAAc,EACpB,iBAAiB,GAAG,kBAAkB,CACvC,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,MAAM,GAAG;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,iEAAiE;AACjE,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,UAAU,GACV,OAAO,GACP,QAAQ,GACR,KAAK,GACL,KAAK,CAAC"}
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* @param {string} name - The name of the field.
|
|
4
4
|
* @param {boolean} isError - Indicates if the field is in an error state.
|
|
5
5
|
* @param {boolean} [isRequired] - Whether the field is required (drives `aria-required`, independent of error state).
|
|
6
|
+
* @param {boolean} [hasDescription] - Whether a description is rendered. `aria-describedby` only references ids that are in the document.
|
|
6
7
|
* @returns An object containing ARIA attributes for input, label, description, and error state.
|
|
7
8
|
*/
|
|
8
|
-
declare const useFieldAriaProps: (name: string, isError: boolean, isRequired?: boolean) => {
|
|
9
|
+
declare const useFieldAriaProps: (name: string, isError: boolean, isRequired?: boolean, hasDescription?: boolean) => {
|
|
9
10
|
input: {
|
|
10
11
|
id: string;
|
|
11
12
|
"aria-labelledby": string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFieldAriaProperties.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/hooks/useFieldAriaProperties.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"useFieldAriaProperties.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/hooks/useFieldAriaProperties.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,QAAA,MAAM,iBAAiB,SACf,MAAM,WACH,OAAO;;QAaV,EAAE;QACF,iBAAiB;QACjB,kBAAkB;QAIlB,mBAAmB;QACnB,cAAc;QAId,eAAe;;;QAGf,EAAE;QACF,OAAO;;;QAEM,EAAE;;;QAEf,EAAE;;CAMT,CAAC;eAEa,iBAAiB"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generates ARIA properties for a specific option in a choice-style field.
|
|
3
3
|
* Pure (no react-hook-form) — lives in the presentational tier so option-group
|
|
4
|
-
* inputs (Choices, RichChoices) can use it standalone.
|
|
4
|
+
* inputs (Choices, RichChoices) can use it standalone. Options carry no
|
|
5
|
+
* `aria-describedby`: the field description describes the whole group, so it is
|
|
6
|
+
* referenced from the group's fieldset instead.
|
|
5
7
|
* @param {string} name - The base name of the input field.
|
|
6
8
|
* @param {string} optionValue - The value of the specific option.
|
|
7
9
|
* @returns An object containing ARIA attributes for the option.
|
|
@@ -10,7 +12,6 @@ declare const useOptionAriaProps: (name: string, optionValue: string) => {
|
|
|
10
12
|
input: {
|
|
11
13
|
id: string;
|
|
12
14
|
"aria-labelledby": string;
|
|
13
|
-
"aria-describedby": string;
|
|
14
15
|
};
|
|
15
16
|
label: {
|
|
16
17
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOptionAriaProperties.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/hooks/useOptionAriaProperties.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"useOptionAriaProperties.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/hooks/useOptionAriaProperties.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,QAAA,MAAM,kBAAkB,SAAU,MAAM,eAAe,MAAM;;QASrD,EAAE;QACF,iBAAiB;;;QAGjB,EAAE;QACF,OAAO;;CAKd,CAAC;eAEa,kBAAkB"}
|
|
@@ -1,10 +1,43 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BaseInputProps } from "../../common/types.js";
|
|
2
|
+
import { type ConfiguredMiddleware } from "../../common/Wrapper/createMiddleware.js";
|
|
2
3
|
import type { Option } from "../../subcomponent/types.js";
|
|
3
|
-
interface OptionsFetchOptions {
|
|
4
|
+
interface OptionsFetchOptions<Data> {
|
|
5
|
+
/** HTTP method of the options request. Defaults to `"GET"`. */
|
|
4
6
|
method?: string;
|
|
7
|
+
/** Headers sent with the options request. */
|
|
5
8
|
headers?: Record<string, string>;
|
|
6
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Turns the response body into options. Without it the body must already be
|
|
11
|
+
* an `Option[]`.
|
|
12
|
+
*/
|
|
13
|
+
transformData?: (data: Data) => Option[];
|
|
7
14
|
}
|
|
8
|
-
|
|
15
|
+
/** Props the options middleware reads from, and writes to, the field. */
|
|
16
|
+
type OptionsFieldProps = BaseInputProps & {
|
|
17
|
+
options?: Option[];
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
};
|
|
20
|
+
/** A middleware that works with any field taking `options`. */
|
|
21
|
+
type OptionsMiddleware = ConfiguredMiddleware<OptionsFieldProps>;
|
|
22
|
+
/**
|
|
23
|
+
* Fetches a field's options from a REST endpoint and passes them as the
|
|
24
|
+
* `options` prop.
|
|
25
|
+
*
|
|
26
|
+
* The field keeps its normal markup in every state. While loading it is
|
|
27
|
+
* disabled, marked `aria-busy`, and has no options. A failed request is set as
|
|
28
|
+
* the field's error, so it shows where the field shows any other error, and
|
|
29
|
+
* leaves the field enabled. The middleware can be created inline: the field
|
|
30
|
+
* keeps one instance, which fetches again only when the URL changes, and
|
|
31
|
+
* drops the answer for the previous URL, its error included. The request is
|
|
32
|
+
* aborted when the field unmounts. Use one per field: an inner instance's
|
|
33
|
+
* options replace the outer one's.
|
|
34
|
+
*
|
|
35
|
+
* @param url - The endpoint returning the options.
|
|
36
|
+
* @param options - Request and transform options.
|
|
37
|
+
* @returns A middleware for any field that takes `options`.
|
|
38
|
+
*
|
|
39
|
+
* `import { addRESTOptions } from "@canonical/react-ds-global-form";`
|
|
40
|
+
*/
|
|
41
|
+
declare function addRESTFieldOptions<Data = Option[]>(url: string, options?: OptionsFetchOptions<Data>): OptionsMiddleware;
|
|
9
42
|
export default addRESTFieldOptions;
|
|
10
43
|
//# sourceMappingURL=addRESTOptions.d.ts.map
|