@alma-oss/spirit-web-react 4.4.2 → 4.5.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/CHANGELOG.md +51 -0
- package/DEPRECATIONS.md +2 -2
- package/README.md +135 -6
- package/dist/bundles/web-react.umd.js +1731 -624
- package/dist/bundles/web-react.umd.js.map +1 -1
- package/dist/bundles/web-react.umd.min.js +1 -1
- package/dist/bundles/web-react.umd.min.js.map +1 -1
- package/dist/components/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.cjs.map +1 -1
- package/dist/components/Button/Button.js +19 -19
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/ButtonLink/ButtonLink.cjs +1 -1
- package/dist/components/ButtonLink/ButtonLink.cjs.map +1 -1
- package/dist/components/ButtonLink/ButtonLink.d.ts +2 -2
- package/dist/components/ButtonLink/ButtonLink.js +23 -18
- package/dist/components/ButtonLink/ButtonLink.js.map +1 -1
- package/dist/components/ButtonLink/useButtonLinkStyleProps.cjs.map +1 -1
- package/dist/components/ButtonLink/useButtonLinkStyleProps.d.ts +9 -9
- package/dist/components/ButtonLink/useButtonLinkStyleProps.js.map +1 -1
- package/dist/components/Card/CardLink.cjs +1 -1
- package/dist/components/Card/CardLink.cjs.map +1 -1
- package/dist/components/Card/CardLink.d.ts +2 -2
- package/dist/components/Card/CardLink.js +10 -15
- package/dist/components/Card/CardLink.js.map +1 -1
- package/dist/components/CharacterCounter/CharacterCounter.cjs +2 -0
- package/dist/components/CharacterCounter/CharacterCounter.cjs.map +1 -0
- package/dist/components/CharacterCounter/CharacterCounter.d.ts +7 -0
- package/dist/components/CharacterCounter/CharacterCounter.js +23 -0
- package/dist/components/CharacterCounter/CharacterCounter.js.map +1 -0
- package/dist/components/CharacterCounter/constants.cjs +2 -0
- package/dist/components/CharacterCounter/constants.cjs.map +1 -0
- package/dist/components/CharacterCounter/constants.d.ts +1 -0
- package/dist/components/CharacterCounter/constants.js +5 -0
- package/dist/components/CharacterCounter/constants.js.map +1 -0
- package/dist/components/CharacterCounter/index.cjs +2 -0
- package/dist/components/CharacterCounter/index.d.ts +3 -0
- package/dist/components/CharacterCounter/index.js +7 -0
- package/dist/components/{UNSTABLE_Attachment → CharacterCounter}/index.js.map +1 -1
- package/dist/components/CharacterCounter/types.d.ts +6 -0
- package/dist/components/CharacterCounter/useCharacterCounterState.cjs +2 -0
- package/dist/components/CharacterCounter/useCharacterCounterState.cjs.map +1 -0
- package/dist/components/CharacterCounter/useCharacterCounterState.d.ts +25 -0
- package/dist/components/CharacterCounter/useCharacterCounterState.js +66 -0
- package/dist/components/CharacterCounter/useCharacterCounterState.js.map +1 -0
- package/dist/components/CharacterCounter.d.ts +2 -0
- package/dist/components/Checkbox/Checkbox.cjs +1 -1
- package/dist/components/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.js +58 -54
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/ControlButton/useControlButtonStyleProps.cjs.map +1 -1
- package/dist/components/ControlButton/useControlButtonStyleProps.js.map +1 -1
- package/dist/components/Dropdown/DropdownPopover.cjs.map +1 -1
- package/dist/components/Dropdown/DropdownPopover.d.ts +2 -2
- package/dist/components/Dropdown/DropdownPopover.js.map +1 -1
- package/dist/components/Field/index.cjs +1 -1
- package/dist/components/Field/index.d.ts +0 -2
- package/dist/components/Field/index.js +2 -4
- package/dist/components/Field/index.js.map +1 -1
- package/dist/components/Field/types.d.ts +1 -1
- package/dist/components/FieldGroup/FieldGroup.cjs +1 -1
- package/dist/components/FieldGroup/FieldGroup.cjs.map +1 -1
- package/dist/components/FieldGroup/FieldGroup.js +15 -16
- package/dist/components/FieldGroup/FieldGroup.js.map +1 -1
- package/dist/components/FileUploader/FileUploaderInput.cjs +1 -1
- package/dist/components/FileUploader/FileUploaderInput.cjs.map +1 -1
- package/dist/components/FileUploader/FileUploaderInput.js +36 -35
- package/dist/components/FileUploader/FileUploaderInput.js.map +1 -1
- package/dist/components/Header/HeaderDialogLink.cjs +1 -1
- package/dist/components/Header/HeaderDialogLink.cjs.map +1 -1
- package/dist/components/Header/HeaderDialogLink.js +18 -17
- package/dist/components/Header/HeaderDialogLink.js.map +1 -1
- package/dist/components/Header/HeaderLink.cjs +1 -1
- package/dist/components/Header/HeaderLink.cjs.map +1 -1
- package/dist/components/Header/HeaderLink.js +16 -15
- package/dist/components/Header/HeaderLink.js.map +1 -1
- package/dist/components/InputDetails/InputDetails.cjs +2 -0
- package/dist/components/InputDetails/InputDetails.cjs.map +1 -0
- package/dist/components/InputDetails/InputDetails.d.ts +7 -0
- package/dist/components/InputDetails/InputDetails.js +21 -0
- package/dist/components/InputDetails/InputDetails.js.map +1 -0
- package/dist/components/InputDetails/index.cjs +2 -0
- package/dist/components/InputDetails/index.cjs.map +1 -0
- package/dist/components/InputDetails/index.d.ts +2 -0
- package/dist/components/InputDetails/index.js +7 -0
- package/dist/components/InputDetails/index.js.map +1 -0
- package/dist/components/InputDetails/useInputDetailsStyleProps.cjs +2 -0
- package/dist/components/InputDetails/useInputDetailsStyleProps.cjs.map +1 -0
- package/dist/components/InputDetails/useInputDetailsStyleProps.d.ts +7 -0
- package/dist/components/InputDetails/useInputDetailsStyleProps.js +11 -0
- package/dist/components/InputDetails/useInputDetailsStyleProps.js.map +1 -0
- package/dist/components/InputDetails.d.ts +2 -0
- package/dist/components/Link/Link.cjs +1 -1
- package/dist/components/Link/Link.cjs.map +1 -1
- package/dist/components/Link/Link.js +10 -9
- package/dist/components/Link/Link.js.map +1 -1
- package/dist/components/Link/useLinkStyleProps.cjs.map +1 -1
- package/dist/components/Link/useLinkStyleProps.d.ts +1 -1
- package/dist/components/Link/useLinkStyleProps.js.map +1 -1
- package/dist/components/Pagination/PaginationLink.cjs +1 -1
- package/dist/components/Pagination/PaginationLink.cjs.map +1 -1
- package/dist/components/Pagination/PaginationLink.js +29 -18
- package/dist/components/Pagination/PaginationLink.js.map +1 -1
- package/dist/components/Radio/Radio.cjs +1 -1
- package/dist/components/Radio/Radio.cjs.map +1 -1
- package/dist/components/Radio/Radio.js +24 -25
- package/dist/components/Radio/Radio.js.map +1 -1
- package/dist/components/ScrollView/useScrollPosition.js +4 -4
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.cjs.map +1 -1
- package/dist/components/Select/Select.js +28 -29
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Slider/Slider.cjs +1 -1
- package/dist/components/Slider/Slider.cjs.map +1 -1
- package/dist/components/Slider/Slider.js +23 -24
- package/dist/components/Slider/Slider.js.map +1 -1
- package/dist/components/Tabs/TabLink.cjs +1 -1
- package/dist/components/Tabs/TabLink.cjs.map +1 -1
- package/dist/components/Tabs/TabLink.js +18 -17
- package/dist/components/Tabs/TabLink.js.map +1 -1
- package/dist/components/Tag/constants.cjs +1 -1
- package/dist/components/Tag/constants.cjs.map +1 -1
- package/dist/components/Tag/constants.d.ts +1 -0
- package/dist/components/Tag/constants.js +4 -3
- package/dist/components/Tag/constants.js.map +1 -1
- package/dist/components/Tag/useTagStyleProps.cjs +1 -1
- package/dist/components/Tag/useTagStyleProps.cjs.map +1 -1
- package/dist/components/Tag/useTagStyleProps.js +25 -10
- package/dist/components/Tag/useTagStyleProps.js.map +1 -1
- package/dist/components/TextArea/TextArea.cjs +1 -1
- package/dist/components/TextArea/TextArea.cjs.map +1 -1
- package/dist/components/TextArea/TextArea.js +57 -21
- package/dist/components/TextArea/TextArea.js.map +1 -1
- package/dist/components/TextArea/constants.cjs +2 -0
- package/dist/components/TextArea/constants.cjs.map +1 -0
- package/dist/components/TextArea/constants.d.ts +1 -0
- package/dist/components/TextArea/constants.js +5 -0
- package/dist/components/TextArea/constants.js.map +1 -0
- package/dist/components/TextFieldBase/TextFieldBase.cjs +1 -1
- package/dist/components/TextFieldBase/TextFieldBase.cjs.map +1 -1
- package/dist/components/TextFieldBase/TextFieldBase.js +69 -59
- package/dist/components/TextFieldBase/TextFieldBase.js.map +1 -1
- package/dist/components/TextFieldBase/useTextFieldBaseStyleProps.cjs +1 -1
- package/dist/components/TextFieldBase/useTextFieldBaseStyleProps.cjs.map +1 -1
- package/dist/components/TextFieldBase/useTextFieldBaseStyleProps.d.ts +1 -0
- package/dist/components/TextFieldBase/useTextFieldBaseStyleProps.js +11 -10
- package/dist/components/TextFieldBase/useTextFieldBaseStyleProps.js.map +1 -1
- package/dist/components/Toggle/Toggle.cjs +1 -1
- package/dist/components/Toggle/Toggle.cjs.map +1 -1
- package/dist/components/Toggle/Toggle.js +59 -55
- package/dist/components/Toggle/Toggle.js.map +1 -1
- package/dist/components/UNSTABLE_File/UNSTABLE_File.cjs +2 -0
- package/dist/components/UNSTABLE_File/UNSTABLE_File.cjs.map +1 -0
- package/dist/components/UNSTABLE_File/UNSTABLE_File.d.ts +8 -0
- package/dist/components/UNSTABLE_File/UNSTABLE_File.js +88 -0
- package/dist/components/UNSTABLE_File/UNSTABLE_File.js.map +1 -0
- package/dist/components/UNSTABLE_File/UNSTABLE_FileImagePreview.cjs +2 -0
- package/dist/components/UNSTABLE_File/UNSTABLE_FileImagePreview.cjs.map +1 -0
- package/dist/components/UNSTABLE_File/UNSTABLE_FileImagePreview.d.ts +8 -0
- package/dist/components/UNSTABLE_File/UNSTABLE_FileImagePreview.js +29 -0
- package/dist/components/UNSTABLE_File/UNSTABLE_FileImagePreview.js.map +1 -0
- package/dist/components/UNSTABLE_File/constants.cjs +2 -0
- package/dist/components/UNSTABLE_File/constants.cjs.map +1 -0
- package/dist/components/UNSTABLE_File/constants.d.ts +9 -0
- package/dist/components/UNSTABLE_File/constants.js +13 -0
- package/dist/components/UNSTABLE_File/constants.js.map +1 -0
- package/dist/components/UNSTABLE_File/index.cjs +2 -0
- package/dist/components/UNSTABLE_File/index.cjs.map +1 -0
- package/dist/components/UNSTABLE_File/index.d.ts +6 -0
- package/dist/components/UNSTABLE_File/index.js +16 -0
- package/dist/components/UNSTABLE_File/index.js.map +1 -0
- package/dist/components/UNSTABLE_File/types.d.ts +48 -0
- package/dist/components/UNSTABLE_File/useFileImageStyles.cjs +2 -0
- package/dist/components/UNSTABLE_File/useFileImageStyles.cjs.map +1 -0
- package/dist/components/UNSTABLE_File/useFileImageStyles.d.ts +19 -0
- package/dist/components/UNSTABLE_File/useFileImageStyles.js +21 -0
- package/dist/components/UNSTABLE_File/useFileImageStyles.js.map +1 -0
- package/dist/components/UNSTABLE_File/useFileStyleProps.cjs +2 -0
- package/dist/components/UNSTABLE_File/useFileStyleProps.cjs.map +1 -0
- package/dist/components/UNSTABLE_File/useFileStyleProps.d.ts +20 -0
- package/dist/components/UNSTABLE_File/useFileStyleProps.js +29 -0
- package/dist/components/UNSTABLE_File/useFileStyleProps.js.map +1 -0
- package/dist/components/UNSTABLE_File.d.ts +2 -0
- package/dist/components/UNSTABLE_FileUpload/UNSTABLE_FileUpload.cjs +1 -1
- package/dist/components/UNSTABLE_FileUpload/UNSTABLE_FileUpload.cjs.map +1 -1
- package/dist/components/UNSTABLE_FileUpload/UNSTABLE_FileUpload.js +129 -112
- package/dist/components/UNSTABLE_FileUpload/UNSTABLE_FileUpload.js.map +1 -1
- package/dist/components/UNSTABLE_FileUpload/types.d.ts +6 -3
- package/dist/components/UNSTABLE_FileUpload/useFileUploadStyleProps.cjs +1 -1
- package/dist/components/UNSTABLE_FileUpload/useFileUploadStyleProps.cjs.map +1 -1
- package/dist/components/UNSTABLE_FileUpload/useFileUploadStyleProps.d.ts +2 -3
- package/dist/components/UNSTABLE_FileUpload/useFileUploadStyleProps.js +18 -16
- package/dist/components/UNSTABLE_FileUpload/useFileUploadStyleProps.js.map +1 -1
- package/dist/components/UNSTABLE_Picker/PickerContext.cjs +2 -0
- package/dist/components/UNSTABLE_Picker/PickerContext.cjs.map +1 -0
- package/dist/components/UNSTABLE_Picker/PickerContext.d.ts +3 -0
- package/dist/components/UNSTABLE_Picker/PickerContext.js +9 -0
- package/dist/components/UNSTABLE_Picker/PickerContext.js.map +1 -0
- package/dist/components/UNSTABLE_Picker/PickerPopoverContext.cjs +2 -0
- package/dist/components/UNSTABLE_Picker/PickerPopoverContext.cjs.map +1 -0
- package/dist/components/UNSTABLE_Picker/PickerPopoverContext.d.ts +3 -0
- package/dist/components/UNSTABLE_Picker/PickerPopoverContext.js +16 -0
- package/dist/components/UNSTABLE_Picker/PickerPopoverContext.js.map +1 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_Picker.cjs +2 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_Picker.cjs.map +1 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_Picker.d.ts +4 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_Picker.js +204 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_Picker.js.map +1 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerGroup.cjs +2 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerGroup.cjs.map +1 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerGroup.d.ts +7 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerGroup.js +14 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerGroup.js.map +1 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerItem.cjs +2 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerItem.cjs.map +1 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerItem.d.ts +7 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerItem.js +32 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerItem.js.map +1 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerTag.cjs +2 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerTag.cjs.map +1 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerTag.d.ts +7 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerTag.js +64 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_PickerTag.js.map +1 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_UncontrolledPicker.cjs +2 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_UncontrolledPicker.cjs.map +1 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_UncontrolledPicker.d.ts +4 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_UncontrolledPicker.js +40 -0
- package/dist/components/UNSTABLE_Picker/UNSTABLE_UncontrolledPicker.js.map +1 -0
- package/dist/components/UNSTABLE_Picker/constants.cjs +2 -0
- package/dist/components/UNSTABLE_Picker/constants.cjs.map +1 -0
- package/dist/components/UNSTABLE_Picker/constants.d.ts +6 -0
- package/dist/components/UNSTABLE_Picker/constants.js +11 -0
- package/dist/components/UNSTABLE_Picker/constants.js.map +1 -0
- package/dist/components/UNSTABLE_Picker/index.cjs +2 -0
- package/dist/components/UNSTABLE_Picker/index.cjs.map +1 -0
- package/dist/components/UNSTABLE_Picker/index.d.ts +11 -0
- package/dist/components/UNSTABLE_Picker/index.js +26 -0
- package/dist/components/UNSTABLE_Picker/index.js.map +1 -0
- package/dist/components/UNSTABLE_Picker/types.d.ts +91 -0
- package/dist/components/UNSTABLE_Picker/usePickerId.cjs +2 -0
- package/dist/components/UNSTABLE_Picker/usePickerId.cjs.map +1 -0
- package/dist/components/UNSTABLE_Picker/usePickerId.d.ts +8 -0
- package/dist/components/UNSTABLE_Picker/usePickerId.js +15 -0
- package/dist/components/UNSTABLE_Picker/usePickerId.js.map +1 -0
- package/dist/components/UNSTABLE_Picker/usePickerPopoverTabOutToTrigger.cjs +2 -0
- package/dist/components/UNSTABLE_Picker/usePickerPopoverTabOutToTrigger.cjs.map +1 -0
- package/dist/components/UNSTABLE_Picker/usePickerPopoverTabOutToTrigger.d.ts +11 -0
- package/dist/components/UNSTABLE_Picker/usePickerPopoverTabOutToTrigger.js +27 -0
- package/dist/components/UNSTABLE_Picker/usePickerPopoverTabOutToTrigger.js.map +1 -0
- package/dist/components/UNSTABLE_Picker/usePickerSelectionGridKeyboard.cjs +2 -0
- package/dist/components/UNSTABLE_Picker/usePickerSelectionGridKeyboard.cjs.map +1 -0
- package/dist/components/UNSTABLE_Picker/usePickerSelectionGridKeyboard.d.ts +13 -0
- package/dist/components/UNSTABLE_Picker/usePickerSelectionGridKeyboard.js +95 -0
- package/dist/components/UNSTABLE_Picker/usePickerSelectionGridKeyboard.js.map +1 -0
- package/dist/components/UNSTABLE_Picker/usePickerStyleProps.cjs +2 -0
- package/dist/components/UNSTABLE_Picker/usePickerStyleProps.cjs.map +1 -0
- package/dist/components/UNSTABLE_Picker/usePickerStyleProps.d.ts +21 -0
- package/dist/components/UNSTABLE_Picker/usePickerStyleProps.js +29 -0
- package/dist/components/UNSTABLE_Picker/usePickerStyleProps.js.map +1 -0
- package/dist/components/UNSTABLE_Picker/utils.cjs +2 -0
- package/dist/components/UNSTABLE_Picker/utils.cjs.map +1 -0
- package/dist/components/UNSTABLE_Picker/utils.d.ts +10 -0
- package/dist/components/UNSTABLE_Picker/utils.js +41 -0
- package/dist/components/UNSTABLE_Picker/utils.js.map +1 -0
- package/dist/components/UNSTABLE_Picker.d.ts +2 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +4 -1
- package/dist/components/index.js +523 -498
- package/dist/components/index.js.map +1 -1
- package/dist/constants/index.cjs +1 -1
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +43 -40
- package/dist/constants/index.js.map +1 -1
- package/dist/constants/selection.cjs +2 -0
- package/dist/constants/selection.cjs.map +1 -0
- package/dist/constants/selection.d.ts +2 -0
- package/dist/constants/selection.js +6 -0
- package/dist/constants/selection.js.map +1 -0
- package/dist/context/RouterContext.cjs +2 -0
- package/dist/context/RouterContext.cjs.map +1 -0
- package/dist/context/RouterContext.d.ts +16 -0
- package/dist/context/RouterContext.js +12 -0
- package/dist/context/RouterContext.js.map +1 -0
- package/dist/context/index.cjs +1 -1
- package/dist/context/index.d.ts +1 -0
- package/dist/context/index.js +11 -7
- package/dist/context/index.js.map +1 -1
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +5 -1
- package/dist/hooks/index.js +54 -40
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useAriaIdRefs.cjs +2 -0
- package/dist/hooks/useAriaIdRefs.cjs.map +1 -0
- package/dist/hooks/useAriaIdRefs.d.ts +11 -0
- package/dist/hooks/useAriaIdRefs.js +23 -0
- package/dist/hooks/useAriaIdRefs.js.map +1 -0
- package/dist/hooks/useControlledModeGuard.cjs +2 -0
- package/dist/hooks/useControlledModeGuard.cjs.map +1 -0
- package/dist/hooks/useControlledModeGuard.d.ts +10 -0
- package/dist/hooks/useControlledModeGuard.js +33 -0
- package/dist/hooks/useControlledModeGuard.js.map +1 -0
- package/dist/hooks/useDebouncedValue.cjs +2 -0
- package/dist/hooks/useDebouncedValue.cjs.map +1 -0
- package/dist/hooks/useDebouncedValue.d.ts +1 -0
- package/dist/hooks/useDebouncedValue.js +17 -0
- package/dist/hooks/useDebouncedValue.js.map +1 -0
- package/dist/hooks/useLinkClick.cjs +2 -0
- package/dist/hooks/useLinkClick.cjs.map +1 -0
- package/dist/hooks/useLinkClick.d.ts +4 -0
- package/dist/hooks/useLinkClick.js +15 -0
- package/dist/hooks/useLinkClick.js.map +1 -0
- package/dist/hooks/useSelectionState.cjs +2 -0
- package/dist/hooks/useSelectionState.cjs.map +1 -0
- package/dist/hooks/useSelectionState.d.ts +17 -0
- package/dist/hooks/useSelectionState.js +41 -0
- package/dist/hooks/useSelectionState.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +722 -673
- package/dist/index.js.map +1 -1
- package/dist/translations/defaults.cjs +1 -1
- package/dist/translations/defaults.cjs.map +1 -1
- package/dist/translations/defaults.d.ts +17 -0
- package/dist/translations/defaults.js +17 -0
- package/dist/translations/defaults.js.map +1 -1
- package/dist/types/button.d.ts +3 -2
- package/dist/types/card.cjs.map +1 -1
- package/dist/types/card.d.ts +5 -7
- package/dist/types/card.js.map +1 -1
- package/dist/types/checkbox.d.ts +2 -2
- package/dist/types/controlButton.d.ts +2 -3
- package/dist/types/header.d.ts +3 -3
- package/dist/types/index.d.ts +1 -0
- package/dist/types/inputDetails.d.ts +9 -0
- package/dist/types/link.cjs.map +1 -1
- package/dist/types/link.d.ts +2 -2
- package/dist/types/link.js.map +1 -1
- package/dist/types/pagination.d.ts +4 -4
- package/dist/types/shared/index.cjs.map +1 -1
- package/dist/types/shared/index.d.ts +1 -0
- package/dist/types/shared/index.js.map +1 -1
- package/dist/types/shared/inputs.d.ts +3 -0
- package/dist/types/shared/router.d.ts +3 -0
- package/dist/types/tabs.d.ts +2 -2
- package/dist/types/tag.d.ts +1 -0
- package/dist/types/textArea.d.ts +26 -5
- package/dist/types/textFieldBase.d.ts +5 -2
- package/dist/types/toggle.d.ts +2 -2
- package/dist/utils/debounce.cjs +1 -1
- package/dist/utils/debounce.cjs.map +1 -1
- package/dist/utils/debounce.d.ts +4 -1
- package/dist/utils/debounce.js +11 -8
- package/dist/utils/debounce.js.map +1 -1
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +36 -33
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/router.cjs +2 -0
- package/dist/utils/router.cjs.map +1 -0
- package/dist/utils/router.d.ts +12 -0
- package/dist/utils/router.js +10 -0
- package/dist/utils/router.js.map +1 -0
- package/dist/utils/string.cjs +1 -1
- package/dist/utils/string.cjs.map +1 -1
- package/dist/utils/string.d.ts +1 -0
- package/dist/utils/string.js +10 -9
- package/dist/utils/string.js.map +1 -1
- package/package.json +38 -23
- package/dist/components/Field/useAriaIds.cjs +0 -2
- package/dist/components/Field/useAriaIds.cjs.map +0 -1
- package/dist/components/Field/useAriaIds.d.ts +0 -8
- package/dist/components/Field/useAriaIds.js +0 -15
- package/dist/components/Field/useAriaIds.js.map +0 -1
- package/dist/components/UNSTABLE_Attachment/UNSTABLE_Attachment.cjs +0 -2
- package/dist/components/UNSTABLE_Attachment/UNSTABLE_Attachment.cjs.map +0 -1
- package/dist/components/UNSTABLE_Attachment/UNSTABLE_Attachment.d.ts +0 -8
- package/dist/components/UNSTABLE_Attachment/UNSTABLE_Attachment.js +0 -42
- package/dist/components/UNSTABLE_Attachment/UNSTABLE_Attachment.js.map +0 -1
- package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentActionButton.cjs +0 -2
- package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentActionButton.cjs.map +0 -1
- package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentActionButton.d.ts +0 -8
- package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentActionButton.js +0 -30
- package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentActionButton.js.map +0 -1
- package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentDismissButton.cjs +0 -2
- package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentDismissButton.cjs.map +0 -1
- package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentDismissButton.d.ts +0 -8
- package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentDismissButton.js +0 -29
- package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentDismissButton.js.map +0 -1
- package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentImagePreview.cjs +0 -2
- package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentImagePreview.cjs.map +0 -1
- package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentImagePreview.d.ts +0 -8
- package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentImagePreview.js +0 -29
- package/dist/components/UNSTABLE_Attachment/UNSTABLE_AttachmentImagePreview.js.map +0 -1
- package/dist/components/UNSTABLE_Attachment/constants.cjs +0 -2
- package/dist/components/UNSTABLE_Attachment/constants.cjs.map +0 -1
- package/dist/components/UNSTABLE_Attachment/constants.d.ts +0 -9
- package/dist/components/UNSTABLE_Attachment/constants.js +0 -13
- package/dist/components/UNSTABLE_Attachment/constants.js.map +0 -1
- package/dist/components/UNSTABLE_Attachment/index.cjs +0 -2
- package/dist/components/UNSTABLE_Attachment/index.d.ts +0 -8
- package/dist/components/UNSTABLE_Attachment/index.js +0 -20
- package/dist/components/UNSTABLE_Attachment/types.d.ts +0 -42
- package/dist/components/UNSTABLE_Attachment/useAttachmentImageStyles.cjs +0 -2
- package/dist/components/UNSTABLE_Attachment/useAttachmentImageStyles.cjs.map +0 -1
- package/dist/components/UNSTABLE_Attachment/useAttachmentImageStyles.d.ts +0 -18
- package/dist/components/UNSTABLE_Attachment/useAttachmentImageStyles.js +0 -22
- package/dist/components/UNSTABLE_Attachment/useAttachmentImageStyles.js.map +0 -1
- package/dist/components/UNSTABLE_Attachment/useAttachmentStyleProps.cjs +0 -2
- package/dist/components/UNSTABLE_Attachment/useAttachmentStyleProps.cjs.map +0 -1
- package/dist/components/UNSTABLE_Attachment/useAttachmentStyleProps.d.ts +0 -21
- package/dist/components/UNSTABLE_Attachment/useAttachmentStyleProps.js +0 -24
- package/dist/components/UNSTABLE_Attachment/useAttachmentStyleProps.js.map +0 -1
- package/dist/components/UNSTABLE_Attachment.d.ts +0 -2
- package/dist/hooks/useAriaDescribedBy.cjs +0 -2
- package/dist/hooks/useAriaDescribedBy.cjs.map +0 -1
- package/dist/hooks/useAriaDescribedBy.d.ts +0 -5
- package/dist/hooks/useAriaDescribedBy.js +0 -7
- package/dist/hooks/useAriaDescribedBy.js.map +0 -1
- /package/dist/components/{UNSTABLE_Attachment → CharacterCounter}/index.cjs.map +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as o, jsx as e, Fragment as g } from "react/jsx-runtime";
|
|
3
|
+
import D from "classnames";
|
|
4
|
+
import { useStyleProps as V } from "../../hooks/styleProps.js";
|
|
5
|
+
import { useClassNamePrefix as z } from "../../hooks/useClassNamePrefix.js";
|
|
6
|
+
import { useI18n as O } from "../../hooks/useI18n.js";
|
|
7
|
+
import T from "../ControlButton/ControlButton.js";
|
|
8
|
+
import R from "../Field/ValidationText.js";
|
|
9
|
+
import { useValidationTextRole as w } from "../Field/useValidationTextRole.js";
|
|
10
|
+
import j from "../Flex/Flex.js";
|
|
11
|
+
import l from "../Icon/Icon.js";
|
|
12
|
+
import x from "../VisuallyHidden/VisuallyHidden.js";
|
|
13
|
+
import { DEFAULT_FILE_ICON_NAME as k, DEFAULT_FILE_ACTION_BUTTON_ICON_NAME as M } from "./constants.js";
|
|
14
|
+
import { useFileStyleProps as X } from "./useFileStyleProps.js";
|
|
15
|
+
const H = {
|
|
16
|
+
elementType: "li",
|
|
17
|
+
iconName: k
|
|
18
|
+
}, f = (v) => {
|
|
19
|
+
const S = { ...H, ...v }, { t: a } = O(), {
|
|
20
|
+
editText: C,
|
|
21
|
+
elementType: _,
|
|
22
|
+
hasValidationIcon: A,
|
|
23
|
+
helperText: m,
|
|
24
|
+
iconName: E,
|
|
25
|
+
id: n,
|
|
26
|
+
isDisabled: c,
|
|
27
|
+
label: F,
|
|
28
|
+
onDismiss: d,
|
|
29
|
+
onChange: p,
|
|
30
|
+
previewSlot: y,
|
|
31
|
+
removeText: I,
|
|
32
|
+
validationState: i,
|
|
33
|
+
validationText: h,
|
|
34
|
+
...P
|
|
35
|
+
} = S, B = C ?? a("attachment.edit"), b = I ?? a("attachment.remove"), { classProps: t } = X({ isDisabled: c, validationState: i }), { styleProps: u, props: L } = V(P), U = w({
|
|
36
|
+
validationState: i,
|
|
37
|
+
validationText: h
|
|
38
|
+
}), N = {
|
|
39
|
+
size: "large",
|
|
40
|
+
isSymmetrical: !0,
|
|
41
|
+
isDisabled: c
|
|
42
|
+
}, s = p ? /* @__PURE__ */ o(T, { ...N, onClick: p, children: [
|
|
43
|
+
/* @__PURE__ */ e(x, { children: B }),
|
|
44
|
+
/* @__PURE__ */ e(l, { name: M, boxSize: 16, "aria-hidden": "true" })
|
|
45
|
+
] }) : null, r = d ? /* @__PURE__ */ o(T, { ...N, onClick: d, children: [
|
|
46
|
+
/* @__PURE__ */ e(x, { children: b }),
|
|
47
|
+
/* @__PURE__ */ e(l, { name: "close", boxSize: 16, "aria-hidden": "true" })
|
|
48
|
+
] }) : null;
|
|
49
|
+
return /* @__PURE__ */ o(
|
|
50
|
+
_,
|
|
51
|
+
{
|
|
52
|
+
...L,
|
|
53
|
+
...u,
|
|
54
|
+
...n != null && n !== "" ? { id: n } : {},
|
|
55
|
+
className: D(t.root, u.className),
|
|
56
|
+
children: [
|
|
57
|
+
y ?? /* @__PURE__ */ e("div", { className: t.preview, children: /* @__PURE__ */ e(l, { name: E, boxSize: 20, "aria-hidden": "true" }) }),
|
|
58
|
+
/* @__PURE__ */ e("div", { className: t.content, children: /* @__PURE__ */ o("div", { className: t.text, children: [
|
|
59
|
+
/* @__PURE__ */ e("span", { className: t.name, children: /* @__PURE__ */ e("span", { className: z("text-truncate"), children: F }) }),
|
|
60
|
+
m && /* @__PURE__ */ e("div", { className: t.helperText, children: m }),
|
|
61
|
+
i && /* @__PURE__ */ e(
|
|
62
|
+
R,
|
|
63
|
+
{
|
|
64
|
+
UNSAFE_className: t.validationText,
|
|
65
|
+
elementType: "div",
|
|
66
|
+
...A && { hasValidationStateIcon: i },
|
|
67
|
+
role: U,
|
|
68
|
+
validationText: h
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
] }) }),
|
|
72
|
+
s && r ? /* @__PURE__ */ o(j, { alignmentX: { mobile: "stretch", tablet: "left" }, alignmentY: "stretch", spacingX: "space-500", children: [
|
|
73
|
+
s,
|
|
74
|
+
r
|
|
75
|
+
] }) : /* @__PURE__ */ o(g, { children: [
|
|
76
|
+
s,
|
|
77
|
+
r
|
|
78
|
+
] })
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
f.spiritComponent = "UNSTABLE_File";
|
|
84
|
+
f.displayName = "UNSTABLE_File";
|
|
85
|
+
export {
|
|
86
|
+
f as default
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=UNSTABLE_File.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UNSTABLE_File.js","sources":["../../../src/components/UNSTABLE_File/UNSTABLE_File.tsx"],"sourcesContent":["'use client';\n\nimport classNames from 'classnames';\nimport React, { type ElementType } from 'react';\nimport { useClassNamePrefix, useI18n, useStyleProps } from '../../hooks';\nimport { ControlButton } from '../ControlButton';\nimport { ValidationText } from '../Field';\nimport { useValidationTextRole } from '../Field/useValidationTextRole';\nimport { Flex } from '../Flex';\nimport { Icon } from '../Icon';\nimport { VisuallyHidden } from '../VisuallyHidden';\nimport { DEFAULT_FILE_ACTION_BUTTON_ICON_NAME, DEFAULT_FILE_ICON_NAME } from './constants';\nimport { type SpiritUnstableFileProps } from './types';\nimport { useFileStyleProps } from './useFileStyleProps';\n\nconst defaultProps = {\n elementType: 'li' as const,\n iconName: DEFAULT_FILE_ICON_NAME,\n};\n\nconst UNSTABLE_File = <E extends ElementType = 'li'>(props: SpiritUnstableFileProps<E>): JSX.Element => {\n const propsWithDefaults = { ...defaultProps, ...props };\n const { t } = useI18n();\n const {\n editText,\n elementType,\n hasValidationIcon,\n helperText,\n iconName,\n id,\n isDisabled,\n label,\n onDismiss,\n onChange,\n previewSlot,\n removeText,\n validationState,\n validationText,\n ...restProps\n } = propsWithDefaults;\n\n const resolvedEditText = editText ?? t('attachment.edit');\n const resolvedRemoveText = removeText ?? t('attachment.remove');\n const { classProps } = useFileStyleProps({ isDisabled, validationState });\n const { styleProps, props: transferProps } = useStyleProps(restProps);\n const validationTextRole = useValidationTextRole({\n validationState,\n validationText,\n });\n\n const fileRowControlButtonProps = {\n size: 'large' as const,\n isSymmetrical: true as const,\n isDisabled,\n };\n\n const editActionButton = onChange ? (\n <ControlButton {...fileRowControlButtonProps} onClick={onChange}>\n <VisuallyHidden>{resolvedEditText}</VisuallyHidden>\n <Icon name={DEFAULT_FILE_ACTION_BUTTON_ICON_NAME} boxSize={16} aria-hidden=\"true\" />\n </ControlButton>\n ) : null;\n\n const dismissActionButton = onDismiss ? (\n <ControlButton {...fileRowControlButtonProps} onClick={onDismiss}>\n <VisuallyHidden>{resolvedRemoveText}</VisuallyHidden>\n <Icon name=\"close\" boxSize={16} aria-hidden=\"true\" />\n </ControlButton>\n ) : null;\n\n const Component = elementType as ElementType;\n\n return (\n <Component\n {...transferProps}\n {...styleProps}\n {...(id != null && id !== '' ? { id } : {})}\n className={classNames(classProps.root, styleProps.className)}\n >\n {previewSlot ?? (\n <div className={classProps.preview}>\n <Icon name={iconName} boxSize={20} aria-hidden=\"true\" />\n </div>\n )}\n <div className={classProps.content}>\n <div className={classProps.text}>\n <span className={classProps.name}>\n <span className={useClassNamePrefix('text-truncate')}>{label}</span>\n </span>\n {helperText && <div className={classProps.helperText}>{helperText}</div>}\n {validationState && (\n <ValidationText\n UNSAFE_className={classProps.validationText}\n elementType=\"div\"\n {...(hasValidationIcon && { hasValidationStateIcon: validationState })}\n role={validationTextRole}\n validationText={validationText}\n />\n )}\n </div>\n </div>\n {editActionButton && dismissActionButton ? (\n <Flex alignmentX={{ mobile: 'stretch', tablet: 'left' }} alignmentY=\"stretch\" spacingX=\"space-500\">\n {editActionButton}\n {dismissActionButton}\n </Flex>\n ) : (\n <>\n {editActionButton}\n {dismissActionButton}\n </>\n )}\n </Component>\n );\n};\n\nUNSTABLE_File.spiritComponent = 'UNSTABLE_File';\nUNSTABLE_File.displayName = 'UNSTABLE_File';\n\nexport default UNSTABLE_File;\n"],"names":["defaultProps","DEFAULT_FILE_ICON_NAME","UNSTABLE_File","props","propsWithDefaults","t","useI18n","editText","elementType","hasValidationIcon","helperText","iconName","id","isDisabled","label","onDismiss","onChange","previewSlot","removeText","validationState","validationText","restProps","resolvedEditText","resolvedRemoveText","classProps","useFileStyleProps","styleProps","transferProps","useStyleProps","validationTextRole","useValidationTextRole","fileRowControlButtonProps","editActionButton","jsxs","ControlButton","jsx","VisuallyHidden","Icon","DEFAULT_FILE_ACTION_BUTTON_ICON_NAME","dismissActionButton","classNames","useClassNamePrefix","ValidationText","Flex","Fragment"],"mappings":"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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),F=require("classnames"),S=require("../../constants/media.cjs"),y=require("../../hooks/styleProps.cjs"),r=require("./constants.cjs"),E=require("./useFileStyleProps.cjs"),I={meta:void 0,imageObjectFit:S.ObjectFit.COVER},s=o=>{const l={...I,...o},{label:a,imagePreview:c,meta:n,imageObjectFit:p,...u}=l,{classProps:e}=E.useFileStyleProps({meta:n,imageObjectFit:p}),m=e.imageCropStyles??{},P=e.imageObjectFitStyles??{},{styleProps:t,props:g}=y.useStyleProps(u);return i.jsx("span",{...g,...t,className:F(e.preview,t.className),children:i.jsx("img",{src:c,width:r.DEFAULT_FILE_IMAGE_DIMENSION,height:r.DEFAULT_FILE_IMAGE_DIMENSION,alt:a,style:{...m,...P}})})};s.spiritComponent="UNSTABLE_FileImagePreview";s.displayName="UNSTABLE_FileImagePreview";exports.default=s;
|
|
2
|
+
//# sourceMappingURL=UNSTABLE_FileImagePreview.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UNSTABLE_FileImagePreview.cjs","sources":["../../../src/components/UNSTABLE_File/UNSTABLE_FileImagePreview.tsx"],"sourcesContent":["'use client';\n\nimport classNames from 'classnames';\nimport React from 'react';\nimport { ObjectFit } from '../../constants';\nimport { useStyleProps } from '../../hooks';\nimport { DEFAULT_FILE_IMAGE_DIMENSION } from './constants';\nimport { type SpiritUnstableFileImagePreviewProps } from './types';\nimport { useFileStyleProps } from './useFileStyleProps';\n\nconst defaultProps: Partial<SpiritUnstableFileImagePreviewProps> = {\n meta: undefined,\n imageObjectFit: ObjectFit.COVER,\n};\n\nconst UNSTABLE_FileImagePreview = (props: SpiritUnstableFileImagePreviewProps) => {\n const propsWithDefaults = { ...defaultProps, ...props };\n const { label, imagePreview, meta, imageObjectFit, ...restProps } = propsWithDefaults;\n const { classProps } = useFileStyleProps({ meta, imageObjectFit });\n const imageCropStyles = classProps.imageCropStyles ?? {};\n const imageObjectFitStyles = classProps.imageObjectFitStyles ?? {};\n const { styleProps, props: transferProps } = useStyleProps(restProps);\n\n return (\n <span {...transferProps} {...styleProps} className={classNames(classProps.preview, styleProps.className)}>\n <img\n src={imagePreview}\n width={DEFAULT_FILE_IMAGE_DIMENSION}\n height={DEFAULT_FILE_IMAGE_DIMENSION}\n alt={label}\n style={{ ...imageCropStyles, ...imageObjectFitStyles }}\n />\n </span>\n );\n};\n\nUNSTABLE_FileImagePreview.spiritComponent = 'UNSTABLE_FileImagePreview';\nUNSTABLE_FileImagePreview.displayName = 'UNSTABLE_FileImagePreview';\n\nexport default UNSTABLE_FileImagePreview;\n"],"names":["defaultProps","ObjectFit","UNSTABLE_FileImagePreview","props","propsWithDefaults","label","imagePreview","meta","imageObjectFit","restProps","classProps","useFileStyleProps","imageCropStyles","imageObjectFitStyles","styleProps","transferProps","useStyleProps","jsx","classNames","DEFAULT_FILE_IMAGE_DIMENSION"],"mappings":"uUAUMA,EAA6D,CACjE,KAAM,OACN,eAAgBC,EAAAA,UAAU,KAC5B,EAEMC,EAA6BC,GAA+C,CAChF,MAAMC,EAAoB,CAAE,GAAGJ,EAAc,GAAGG,CAAA,EAC1C,CAAE,MAAAE,EAAO,aAAAC,EAAc,KAAAC,EAAM,eAAAC,EAAgB,GAAGC,GAAcL,EAC9D,CAAE,WAAAM,CAAA,EAAeC,EAAAA,kBAAkB,CAAE,KAAAJ,EAAM,eAAAC,EAAgB,EAC3DI,EAAkBF,EAAW,iBAAmB,CAAA,EAChDG,EAAuBH,EAAW,sBAAwB,CAAA,EAC1D,CAAA,WAAEI,EAAY,MAAOC,CAAA,EAAkBC,EAAAA,cAAcP,CAAS,EAEpE,OACEQ,EAAAA,IAAC,OAAA,CAAM,GAAGF,EAAgB,GAAGD,EAAY,UAAWI,EAAWR,EAAW,QAASI,EAAW,SAAS,EACrG,SAAAG,EAAAA,IAAC,MAAA,CACC,IAAKX,EACL,MAAOa,EAAAA,6BACP,OAAQA,EAAAA,6BACR,IAAKd,EACL,MAAO,CAAE,GAAGO,EAAiB,GAAGC,CAAA,CAAqB,CAAA,EAEzD,CAEJ,EAEAX,EAA0B,gBAAkB,4BAC5CA,EAA0B,YAAc"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SpiritUnstableFileImagePreviewProps } from './types';
|
|
3
|
+
declare const UNSTABLE_FileImagePreview: {
|
|
4
|
+
(props: SpiritUnstableFileImagePreviewProps): React.JSX.Element;
|
|
5
|
+
spiritComponent: string;
|
|
6
|
+
displayName: string;
|
|
7
|
+
};
|
|
8
|
+
export default UNSTABLE_FileImagePreview;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import f from "classnames";
|
|
4
|
+
import { ObjectFit as S } from "../../constants/media.js";
|
|
5
|
+
import { useStyleProps as y } from "../../hooks/styleProps.js";
|
|
6
|
+
import { DEFAULT_FILE_IMAGE_DIMENSION as i } from "./constants.js";
|
|
7
|
+
import { useFileStyleProps as N } from "./useFileStyleProps.js";
|
|
8
|
+
const u = {
|
|
9
|
+
meta: void 0,
|
|
10
|
+
imageObjectFit: S.COVER
|
|
11
|
+
}, r = (o) => {
|
|
12
|
+
const m = { ...u, ...o }, { label: a, imagePreview: l, meta: p, imageObjectFit: c, ...n } = m, { classProps: e } = N({ meta: p, imageObjectFit: c }), g = e.imageCropStyles ?? {}, F = e.imageObjectFitStyles ?? {}, { styleProps: t, props: P } = y(n);
|
|
13
|
+
return /* @__PURE__ */ s("span", { ...P, ...t, className: f(e.preview, t.className), children: /* @__PURE__ */ s(
|
|
14
|
+
"img",
|
|
15
|
+
{
|
|
16
|
+
src: l,
|
|
17
|
+
width: i,
|
|
18
|
+
height: i,
|
|
19
|
+
alt: a,
|
|
20
|
+
style: { ...g, ...F }
|
|
21
|
+
}
|
|
22
|
+
) });
|
|
23
|
+
};
|
|
24
|
+
r.spiritComponent = "UNSTABLE_FileImagePreview";
|
|
25
|
+
r.displayName = "UNSTABLE_FileImagePreview";
|
|
26
|
+
export {
|
|
27
|
+
r as default
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=UNSTABLE_FileImagePreview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UNSTABLE_FileImagePreview.js","sources":["../../../src/components/UNSTABLE_File/UNSTABLE_FileImagePreview.tsx"],"sourcesContent":["'use client';\n\nimport classNames from 'classnames';\nimport React from 'react';\nimport { ObjectFit } from '../../constants';\nimport { useStyleProps } from '../../hooks';\nimport { DEFAULT_FILE_IMAGE_DIMENSION } from './constants';\nimport { type SpiritUnstableFileImagePreviewProps } from './types';\nimport { useFileStyleProps } from './useFileStyleProps';\n\nconst defaultProps: Partial<SpiritUnstableFileImagePreviewProps> = {\n meta: undefined,\n imageObjectFit: ObjectFit.COVER,\n};\n\nconst UNSTABLE_FileImagePreview = (props: SpiritUnstableFileImagePreviewProps) => {\n const propsWithDefaults = { ...defaultProps, ...props };\n const { label, imagePreview, meta, imageObjectFit, ...restProps } = propsWithDefaults;\n const { classProps } = useFileStyleProps({ meta, imageObjectFit });\n const imageCropStyles = classProps.imageCropStyles ?? {};\n const imageObjectFitStyles = classProps.imageObjectFitStyles ?? {};\n const { styleProps, props: transferProps } = useStyleProps(restProps);\n\n return (\n <span {...transferProps} {...styleProps} className={classNames(classProps.preview, styleProps.className)}>\n <img\n src={imagePreview}\n width={DEFAULT_FILE_IMAGE_DIMENSION}\n height={DEFAULT_FILE_IMAGE_DIMENSION}\n alt={label}\n style={{ ...imageCropStyles, ...imageObjectFitStyles }}\n />\n </span>\n );\n};\n\nUNSTABLE_FileImagePreview.spiritComponent = 'UNSTABLE_FileImagePreview';\nUNSTABLE_FileImagePreview.displayName = 'UNSTABLE_FileImagePreview';\n\nexport default UNSTABLE_FileImagePreview;\n"],"names":["defaultProps","ObjectFit","UNSTABLE_FileImagePreview","props","propsWithDefaults","label","imagePreview","meta","imageObjectFit","restProps","classProps","useFileStyleProps","imageCropStyles","imageObjectFitStyles","styleProps","transferProps","useStyleProps","jsx","classNames","DEFAULT_FILE_IMAGE_DIMENSION"],"mappings":";;;;;;;AAUA,MAAMA,IAA6D;AAAA,EACjE,MAAM;AAAA,EACN,gBAAgBC,EAAU;AAC5B,GAEMC,IAA4B,CAACC,MAA+C;AAChF,QAAMC,IAAoB,EAAE,GAAGJ,GAAc,GAAGG,EAAA,GAC1C,EAAE,OAAAE,GAAO,cAAAC,GAAc,MAAAC,GAAM,gBAAAC,GAAgB,GAAGC,MAAcL,GAC9D,EAAE,YAAAM,EAAA,IAAeC,EAAkB,EAAE,MAAAJ,GAAM,gBAAAC,GAAgB,GAC3DI,IAAkBF,EAAW,mBAAmB,CAAA,GAChDG,IAAuBH,EAAW,wBAAwB,CAAA,GAC1D,EAAE,YAAAI,GAAY,OAAOC,EAAA,IAAkBC,EAAcP,CAAS;AAEpE,SACE,gBAAAQ,EAAC,QAAA,EAAM,GAAGF,GAAgB,GAAGD,GAAY,WAAWI,EAAWR,EAAW,SAASI,EAAW,SAAS,GACrG,UAAA,gBAAAG;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAKX;AAAA,MACL,OAAOa;AAAA,MACP,QAAQA;AAAA,MACR,KAAKd;AAAA,MACL,OAAO,EAAE,GAAGO,GAAiB,GAAGC,EAAA;AAAA,IAAqB;AAAA,EAAA,GAEzD;AAEJ;AAEAX,EAA0B,kBAAkB;AAC5CA,EAA0B,cAAc;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=48,e="file",E="edit",I={TOP:"--spirit-file-image-top",LEFT:"--spirit-file-image-left",WIDTH:"--spirit-file-image-width",HEIGHT:"--spirit-file-image-height"};exports.DEFAULT_FILE_ACTION_BUTTON_ICON_NAME=E;exports.DEFAULT_FILE_ICON_NAME=e;exports.DEFAULT_FILE_IMAGE_DIMENSION=i;exports.FileImageCropCSS=I;
|
|
2
|
+
//# sourceMappingURL=constants.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.cjs","sources":["../../../src/components/UNSTABLE_File/constants.ts"],"sourcesContent":["export const DEFAULT_FILE_IMAGE_DIMENSION = 48;\n\nexport const DEFAULT_FILE_ICON_NAME = 'file';\n\nexport const DEFAULT_FILE_ACTION_BUTTON_ICON_NAME = 'edit';\n\nexport const FileImageCropCSS = {\n TOP: '--spirit-file-image-top',\n LEFT: '--spirit-file-image-left',\n WIDTH: '--spirit-file-image-width',\n HEIGHT: '--spirit-file-image-height',\n} as const;\n"],"names":["DEFAULT_FILE_IMAGE_DIMENSION","DEFAULT_FILE_ICON_NAME","DEFAULT_FILE_ACTION_BUTTON_ICON_NAME","FileImageCropCSS"],"mappings":"gFAAO,MAAMA,EAA+B,GAE/BC,EAAyB,OAEzBC,EAAuC,OAEvCC,EAAmB,CAC9B,IAAK,0BACL,KAAM,2BACN,MAAO,4BACP,OAAQ,4BACV"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const DEFAULT_FILE_IMAGE_DIMENSION = 48;
|
|
2
|
+
export declare const DEFAULT_FILE_ICON_NAME = "file";
|
|
3
|
+
export declare const DEFAULT_FILE_ACTION_BUTTON_ICON_NAME = "edit";
|
|
4
|
+
export declare const FileImageCropCSS: {
|
|
5
|
+
readonly TOP: "--spirit-file-image-top";
|
|
6
|
+
readonly LEFT: "--spirit-file-image-left";
|
|
7
|
+
readonly WIDTH: "--spirit-file-image-width";
|
|
8
|
+
readonly HEIGHT: "--spirit-file-image-height";
|
|
9
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const i = 48, e = "file", t = "edit", E = {
|
|
2
|
+
TOP: "--spirit-file-image-top",
|
|
3
|
+
LEFT: "--spirit-file-image-left",
|
|
4
|
+
WIDTH: "--spirit-file-image-width",
|
|
5
|
+
HEIGHT: "--spirit-file-image-height"
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
t as DEFAULT_FILE_ACTION_BUTTON_ICON_NAME,
|
|
9
|
+
e as DEFAULT_FILE_ICON_NAME,
|
|
10
|
+
i as DEFAULT_FILE_IMAGE_DIMENSION,
|
|
11
|
+
E as FileImageCropCSS
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../src/components/UNSTABLE_File/constants.ts"],"sourcesContent":["export const DEFAULT_FILE_IMAGE_DIMENSION = 48;\n\nexport const DEFAULT_FILE_ICON_NAME = 'file';\n\nexport const DEFAULT_FILE_ACTION_BUTTON_ICON_NAME = 'edit';\n\nexport const FileImageCropCSS = {\n TOP: '--spirit-file-image-top',\n LEFT: '--spirit-file-image-left',\n WIDTH: '--spirit-file-image-width',\n HEIGHT: '--spirit-file-image-height',\n} as const;\n"],"names":["DEFAULT_FILE_IMAGE_DIMENSION","DEFAULT_FILE_ICON_NAME","DEFAULT_FILE_ACTION_BUTTON_ICON_NAME","FileImageCropCSS"],"mappings":"AAAO,MAAMA,IAA+B,IAE/BC,IAAyB,QAEzBC,IAAuC,QAEvCC,IAAmB;AAAA,EAC9B,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AACV;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./UNSTABLE_File.cjs"),I=require("./UNSTABLE_FileImagePreview.cjs"),e=require("./constants.cjs"),E=require("./useFileImageStyles.cjs"),F=require("./useFileStyleProps.cjs");exports.UNSTABLE_File=_.default;exports.UNSTABLE_FileImagePreview=I.default;exports.DEFAULT_FILE_ACTION_BUTTON_ICON_NAME=e.DEFAULT_FILE_ACTION_BUTTON_ICON_NAME;exports.DEFAULT_FILE_ICON_NAME=e.DEFAULT_FILE_ICON_NAME;exports.DEFAULT_FILE_IMAGE_DIMENSION=e.DEFAULT_FILE_IMAGE_DIMENSION;exports.FileImageCropCSS=e.FileImageCropCSS;exports.useFileImageStyles=E.useFileImageStyles;exports.useFileStyleProps=F.useFileStyleProps;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as UNSTABLE_File } from './UNSTABLE_File';
|
|
2
|
+
export { default as UNSTABLE_FileImagePreview } from './UNSTABLE_FileImagePreview';
|
|
3
|
+
export * from './constants';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export * from './useFileImageStyles';
|
|
6
|
+
export * from './useFileStyleProps';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as _ } from "./UNSTABLE_File.js";
|
|
2
|
+
import { default as E } from "./UNSTABLE_FileImagePreview.js";
|
|
3
|
+
import { DEFAULT_FILE_ACTION_BUTTON_ICON_NAME as t, DEFAULT_FILE_ICON_NAME as F, DEFAULT_FILE_IMAGE_DIMENSION as N, FileImageCropCSS as l } from "./constants.js";
|
|
4
|
+
import { useFileImageStyles as m } from "./useFileImageStyles.js";
|
|
5
|
+
import { useFileStyleProps as L } from "./useFileStyleProps.js";
|
|
6
|
+
export {
|
|
7
|
+
t as DEFAULT_FILE_ACTION_BUTTON_ICON_NAME,
|
|
8
|
+
F as DEFAULT_FILE_ICON_NAME,
|
|
9
|
+
N as DEFAULT_FILE_IMAGE_DIMENSION,
|
|
10
|
+
l as FileImageCropCSS,
|
|
11
|
+
_ as UNSTABLE_File,
|
|
12
|
+
E as UNSTABLE_FileImagePreview,
|
|
13
|
+
m as useFileImageStyles,
|
|
14
|
+
L as useFileStyleProps
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ElementType, ReactNode } from 'react';
|
|
2
|
+
import { ObjectFit } from '../../constants';
|
|
3
|
+
import { PolymorphicComponentProps } from '../../types';
|
|
4
|
+
import { SpiritButtonElementProps, SpiritSpanElementProps, ValidationState, ValidationTextType } from '../../types/shared';
|
|
5
|
+
export interface UnstableFileItemMetadata {
|
|
6
|
+
[key: string | number]: unknown;
|
|
7
|
+
}
|
|
8
|
+
export interface UnstableFilePreviewStyleProps {
|
|
9
|
+
meta?: UnstableFileItemMetadata;
|
|
10
|
+
imageObjectFit?: (typeof ObjectFit)[keyof typeof ObjectFit];
|
|
11
|
+
}
|
|
12
|
+
export type UnstableFileItem = {
|
|
13
|
+
id: string;
|
|
14
|
+
label: string;
|
|
15
|
+
previewUrl?: string;
|
|
16
|
+
meta?: UnstableFileItemMetadata;
|
|
17
|
+
};
|
|
18
|
+
export interface UnstableFileActionButtonProps extends SpiritButtonElementProps {
|
|
19
|
+
}
|
|
20
|
+
export interface UnstableFileDismissButtonProps extends SpiritButtonElementProps {
|
|
21
|
+
}
|
|
22
|
+
export interface UnstableFileImagePreviewProps extends SpiritSpanElementProps, UnstableFilePreviewStyleProps {
|
|
23
|
+
imagePreview: string;
|
|
24
|
+
label: string;
|
|
25
|
+
}
|
|
26
|
+
export interface UnstableFileBaseProps {
|
|
27
|
+
editText?: string;
|
|
28
|
+
helperText?: ReactNode;
|
|
29
|
+
hasValidationIcon?: boolean;
|
|
30
|
+
iconName?: string;
|
|
31
|
+
id?: string;
|
|
32
|
+
isDisabled?: boolean;
|
|
33
|
+
label: string;
|
|
34
|
+
onDismiss?: () => void;
|
|
35
|
+
onChange?: () => void;
|
|
36
|
+
previewSlot?: ReactNode;
|
|
37
|
+
removeText?: string;
|
|
38
|
+
validationState?: ValidationState;
|
|
39
|
+
validationText?: ValidationTextType;
|
|
40
|
+
}
|
|
41
|
+
export type SpiritUnstableFileProps<E extends ElementType = 'li'> = PolymorphicComponentProps<E, UnstableFileBaseProps>;
|
|
42
|
+
export type UnstableFileProps = SpiritUnstableFileProps<'li'>;
|
|
43
|
+
export interface SpiritUnstableFileActionButtonProps extends UnstableFileActionButtonProps {
|
|
44
|
+
}
|
|
45
|
+
export interface SpiritUnstableFileDismissButtonProps extends UnstableFileDismissButtonProps {
|
|
46
|
+
}
|
|
47
|
+
export interface SpiritUnstableFileImagePreviewProps extends UnstableFileImagePreviewProps {
|
|
48
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./constants.cjs"),u=["x","y","cropWidth","cropHeight","originalWidth","originalHeight"],d=e=>e!=null&&u.every(t=>e[t]!=null),C=e=>{const{x:t,y:r,cropWidth:n,cropHeight:s,originalWidth:l,originalHeight:a}=e,c=o.DEFAULT_FILE_IMAGE_DIMENSION;let i;s>n?i=c/n:i=c/s;const g=Math.round(t*i),p=Math.round(r*i),S=Math.round(l*i),h=Math.round(a*i);return{[o.FileImageCropCSS.TOP]:`-${p}px`,[o.FileImageCropCSS.LEFT]:`-${g}px`,[o.FileImageCropCSS.WIDTH]:`${S}px`,[o.FileImageCropCSS.HEIGHT]:`${h}px`}};function I(e,t){const r=d(e),n=r?C(e):void 0;return{hasCoordsInMeta:r,imageCropStyles:n,imageObjectFitStyles:t?{"--spirit-file-image-object-fit":t}:void 0}}exports.useFileImageStyles=I;
|
|
2
|
+
//# sourceMappingURL=useFileImageStyles.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFileImageStyles.cjs","sources":["../../../src/components/UNSTABLE_File/useFileImageStyles.ts"],"sourcesContent":["import { type CSSProperties } from 'react';\nimport { DEFAULT_FILE_IMAGE_DIMENSION, FileImageCropCSS } from './constants';\nimport { type UnstableFileItemMetadata } from './types';\n\n// Crop math mirrors `useFileUploaderStyleProps` in FileUploader; preview size uses\n// `DEFAULT_FILE_IMAGE_DIMENSION` (UNSTABLE preview slot) instead of `IMAGE_DIMENSION` (54px attachment).\n\nexport type FileImageCropStyles = {\n [FileImageCropCSS.TOP]?: string;\n [FileImageCropCSS.LEFT]?: string;\n [FileImageCropCSS.WIDTH]?: string;\n [FileImageCropCSS.HEIGHT]?: string;\n} & CSSProperties;\n\nexport type FileImageObjectFitStyles = {\n '--spirit-file-image-object-fit': string;\n};\n\ntype FileImageCropMeta = {\n x: number;\n y: number;\n cropWidth: number;\n cropHeight: number;\n originalWidth: number;\n originalHeight: number;\n};\n\nconst CROP_META_KEYS = ['x', 'y', 'cropWidth', 'cropHeight', 'originalWidth', 'originalHeight'] as const;\n\nconst hasValidCropMeta = (meta: UnstableFileItemMetadata | undefined): meta is FileImageCropMeta =>\n meta != null && CROP_META_KEYS.every((key) => meta[key] != null);\n\nconst computeCropCSS = (meta: FileImageCropMeta): FileImageCropStyles => {\n const { x, y, cropWidth, cropHeight, originalWidth, originalHeight } = meta;\n const previewHeight = DEFAULT_FILE_IMAGE_DIMENSION;\n let scale: number;\n if (cropHeight > cropWidth) {\n // scale for portrait images\n scale = previewHeight / cropWidth;\n } else {\n // scale for landscape images\n scale = previewHeight / cropHeight;\n }\n\n const cropX = Math.round(x * scale);\n const cropY = Math.round(y * scale);\n const imageWidth = Math.round(originalWidth * scale);\n const imageHeight = Math.round(originalHeight * scale);\n\n return {\n [FileImageCropCSS.TOP]: `-${cropY}px`,\n [FileImageCropCSS.LEFT]: `-${cropX}px`,\n [FileImageCropCSS.WIDTH]: `${imageWidth}px`,\n [FileImageCropCSS.HEIGHT]: `${imageHeight}px`,\n };\n};\n\nexport function useFileImageStyles(meta?: UnstableFileItemMetadata, imageObjectFit?: string) {\n const hasCoordsInMeta = hasValidCropMeta(meta);\n const imageCropStyles = hasCoordsInMeta ? computeCropCSS(meta) : undefined;\n const imageObjectFitStyles = imageObjectFit ? { '--spirit-file-image-object-fit': imageObjectFit } : undefined;\n\n return { hasCoordsInMeta, imageCropStyles, imageObjectFitStyles };\n}\n"],"names":["CROP_META_KEYS","hasValidCropMeta","meta","key","computeCropCSS","x","y","cropWidth","cropHeight","originalWidth","originalHeight","previewHeight","DEFAULT_FILE_IMAGE_DIMENSION","scale","cropX","cropY","imageWidth","imageHeight","FileImageCropCSS","useFileImageStyles","imageObjectFit","hasCoordsInMeta","imageCropStyles"],"mappings":"mHA2BMA,EAAiB,CAAC,IAAK,IAAK,YAAa,aAAc,gBAAiB,gBAAgB,EAExFC,EAAoBC,GACxBA,GAAQ,MAAQF,EAAe,MAAOG,GAAQD,EAAKC,CAAG,GAAK,IAAI,EAE3DC,EAAkBF,GAAiD,CACvE,KAAM,CAAE,EAAAG,EAAG,EAAAC,EAAG,UAAAC,EAAW,WAAAC,EAAY,cAAAC,EAAe,eAAAC,GAAmBR,EACjES,EAAgBC,EAAAA,6BACtB,IAAIC,EACAL,EAAaD,EAEfM,EAAQF,EAAgBJ,EAGxBM,EAAQF,EAAgBH,EAG1B,MAAMM,EAAQ,KAAK,MAAMT,EAAIQ,CAAK,EAC5BE,EAAQ,KAAK,MAAMT,EAAIO,CAAK,EAC5BG,EAAa,KAAK,MAAMP,EAAgBI,CAAK,EAC7CI,EAAc,KAAK,MAAMP,EAAiBG,CAAK,EAErD,MAAO,CACL,CAACK,EAAAA,iBAAiB,GAAG,EAAG,IAAIH,CAAK,KACjC,CAACG,EAAAA,iBAAiB,IAAI,EAAG,IAAIJ,CAAK,KAClC,CAACI,EAAAA,iBAAiB,KAAK,EAAG,GAAGF,CAAU,KACvC,CAACE,mBAAiB,MAAM,EAAG,GAAGD,CAAW,IAAA,CAE7C,EAEO,SAASE,EAAmBjB,EAAiCkB,EAAyB,CAC3F,MAAMC,EAAkBpB,EAAiBC,CAAI,EACvCoB,EAAkBD,EAAkBjB,EAAeF,CAAI,EAAI,OAGjE,MAAO,CAAE,gBAAAmB,EAAiB,gBAAAC,EAAiB,qBAFdF,EAAiB,CAAE,iCAAkCA,GAAmB,MAE1D,CAC7C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { FileImageCropCSS } from './constants';
|
|
3
|
+
import { UnstableFileItemMetadata } from './types';
|
|
4
|
+
export type FileImageCropStyles = {
|
|
5
|
+
[FileImageCropCSS.TOP]?: string;
|
|
6
|
+
[FileImageCropCSS.LEFT]?: string;
|
|
7
|
+
[FileImageCropCSS.WIDTH]?: string;
|
|
8
|
+
[FileImageCropCSS.HEIGHT]?: string;
|
|
9
|
+
} & CSSProperties;
|
|
10
|
+
export type FileImageObjectFitStyles = {
|
|
11
|
+
'--spirit-file-image-object-fit': string;
|
|
12
|
+
};
|
|
13
|
+
export declare function useFileImageStyles(meta?: UnstableFileItemMetadata, imageObjectFit?: string): {
|
|
14
|
+
hasCoordsInMeta: boolean;
|
|
15
|
+
imageCropStyles: FileImageCropStyles | undefined;
|
|
16
|
+
imageObjectFitStyles: {
|
|
17
|
+
'--spirit-file-image-object-fit': string;
|
|
18
|
+
} | undefined;
|
|
19
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FileImageCropCSS as n, DEFAULT_FILE_IMAGE_DIMENSION as u } from "./constants.js";
|
|
2
|
+
const S = ["x", "y", "cropWidth", "cropHeight", "originalWidth", "originalHeight"], H = (t) => t != null && S.every((o) => t[o] != null), I = (t) => {
|
|
3
|
+
const { x: o, y: e, cropWidth: r, cropHeight: s, originalWidth: a, originalHeight: l } = t, c = u;
|
|
4
|
+
let i;
|
|
5
|
+
s > r ? i = c / r : i = c / s;
|
|
6
|
+
const p = Math.round(o * i), g = Math.round(e * i), h = Math.round(a * i), d = Math.round(l * i);
|
|
7
|
+
return {
|
|
8
|
+
[n.TOP]: `-${g}px`,
|
|
9
|
+
[n.LEFT]: `-${p}px`,
|
|
10
|
+
[n.WIDTH]: `${h}px`,
|
|
11
|
+
[n.HEIGHT]: `${d}px`
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
function m(t, o) {
|
|
15
|
+
const e = H(t), r = e ? I(t) : void 0;
|
|
16
|
+
return { hasCoordsInMeta: e, imageCropStyles: r, imageObjectFitStyles: o ? { "--spirit-file-image-object-fit": o } : void 0 };
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
m as useFileImageStyles
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=useFileImageStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFileImageStyles.js","sources":["../../../src/components/UNSTABLE_File/useFileImageStyles.ts"],"sourcesContent":["import { type CSSProperties } from 'react';\nimport { DEFAULT_FILE_IMAGE_DIMENSION, FileImageCropCSS } from './constants';\nimport { type UnstableFileItemMetadata } from './types';\n\n// Crop math mirrors `useFileUploaderStyleProps` in FileUploader; preview size uses\n// `DEFAULT_FILE_IMAGE_DIMENSION` (UNSTABLE preview slot) instead of `IMAGE_DIMENSION` (54px attachment).\n\nexport type FileImageCropStyles = {\n [FileImageCropCSS.TOP]?: string;\n [FileImageCropCSS.LEFT]?: string;\n [FileImageCropCSS.WIDTH]?: string;\n [FileImageCropCSS.HEIGHT]?: string;\n} & CSSProperties;\n\nexport type FileImageObjectFitStyles = {\n '--spirit-file-image-object-fit': string;\n};\n\ntype FileImageCropMeta = {\n x: number;\n y: number;\n cropWidth: number;\n cropHeight: number;\n originalWidth: number;\n originalHeight: number;\n};\n\nconst CROP_META_KEYS = ['x', 'y', 'cropWidth', 'cropHeight', 'originalWidth', 'originalHeight'] as const;\n\nconst hasValidCropMeta = (meta: UnstableFileItemMetadata | undefined): meta is FileImageCropMeta =>\n meta != null && CROP_META_KEYS.every((key) => meta[key] != null);\n\nconst computeCropCSS = (meta: FileImageCropMeta): FileImageCropStyles => {\n const { x, y, cropWidth, cropHeight, originalWidth, originalHeight } = meta;\n const previewHeight = DEFAULT_FILE_IMAGE_DIMENSION;\n let scale: number;\n if (cropHeight > cropWidth) {\n // scale for portrait images\n scale = previewHeight / cropWidth;\n } else {\n // scale for landscape images\n scale = previewHeight / cropHeight;\n }\n\n const cropX = Math.round(x * scale);\n const cropY = Math.round(y * scale);\n const imageWidth = Math.round(originalWidth * scale);\n const imageHeight = Math.round(originalHeight * scale);\n\n return {\n [FileImageCropCSS.TOP]: `-${cropY}px`,\n [FileImageCropCSS.LEFT]: `-${cropX}px`,\n [FileImageCropCSS.WIDTH]: `${imageWidth}px`,\n [FileImageCropCSS.HEIGHT]: `${imageHeight}px`,\n };\n};\n\nexport function useFileImageStyles(meta?: UnstableFileItemMetadata, imageObjectFit?: string) {\n const hasCoordsInMeta = hasValidCropMeta(meta);\n const imageCropStyles = hasCoordsInMeta ? computeCropCSS(meta) : undefined;\n const imageObjectFitStyles = imageObjectFit ? { '--spirit-file-image-object-fit': imageObjectFit } : undefined;\n\n return { hasCoordsInMeta, imageCropStyles, imageObjectFitStyles };\n}\n"],"names":["CROP_META_KEYS","hasValidCropMeta","meta","key","computeCropCSS","x","y","cropWidth","cropHeight","originalWidth","originalHeight","previewHeight","DEFAULT_FILE_IMAGE_DIMENSION","scale","cropX","cropY","imageWidth","imageHeight","FileImageCropCSS","useFileImageStyles","imageObjectFit","hasCoordsInMeta","imageCropStyles"],"mappings":";AA2BA,MAAMA,IAAiB,CAAC,KAAK,KAAK,aAAa,cAAc,iBAAiB,gBAAgB,GAExFC,IAAmB,CAACC,MACxBA,KAAQ,QAAQF,EAAe,MAAM,CAACG,MAAQD,EAAKC,CAAG,KAAK,IAAI,GAE3DC,IAAiB,CAACF,MAAiD;AACvE,QAAM,EAAE,GAAAG,GAAG,GAAAC,GAAG,WAAAC,GAAW,YAAAC,GAAY,eAAAC,GAAe,gBAAAC,MAAmBR,GACjES,IAAgBC;AACtB,MAAIC;AACJ,EAAIL,IAAaD,IAEfM,IAAQF,IAAgBJ,IAGxBM,IAAQF,IAAgBH;AAG1B,QAAMM,IAAQ,KAAK,MAAMT,IAAIQ,CAAK,GAC5BE,IAAQ,KAAK,MAAMT,IAAIO,CAAK,GAC5BG,IAAa,KAAK,MAAMP,IAAgBI,CAAK,GAC7CI,IAAc,KAAK,MAAMP,IAAiBG,CAAK;AAErD,SAAO;AAAA,IACL,CAACK,EAAiB,GAAG,GAAG,IAAIH,CAAK;AAAA,IACjC,CAACG,EAAiB,IAAI,GAAG,IAAIJ,CAAK;AAAA,IAClC,CAACI,EAAiB,KAAK,GAAG,GAAGF,CAAU;AAAA,IACvC,CAACE,EAAiB,MAAM,GAAG,GAAGD,CAAW;AAAA,EAAA;AAE7C;AAEO,SAASE,EAAmBjB,GAAiCkB,GAAyB;AAC3F,QAAMC,IAAkBpB,EAAiBC,CAAI,GACvCoB,IAAkBD,IAAkBjB,EAAeF,CAAI,IAAI;AAGjE,SAAO,EAAE,iBAAAmB,GAAiB,iBAAAC,GAAiB,sBAFdF,IAAiB,EAAE,kCAAkCA,MAAmB,OAE1D;AAC7C;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("classnames"),r=require("../../hooks/useClassNamePrefix.cjs"),n=require("./useFileImageStyles.cjs"),o=t=>{const e=r.useClassNamePrefix("UNSTABLE_File"),{imageCropStyles:a,imageObjectFitStyles:s,hasCoordsInMeta:i}=n.useFileImageStyles(t?.meta,t?.imageObjectFit);return{classProps:{root:l(e,{[`${e}--disabled`]:t?.isDisabled,[`has-${t?.validationState}`]:t?.validationState}),preview:`${e}__preview`,content:`${e}__content`,text:`${e}__text`,name:`${e}__name`,helperText:`${e}__helperText`,validationText:`${e}__validationText`,...i&&{imageCropStyles:a},...s&&{imageObjectFitStyles:s}}}};exports.useFileStyleProps=o;
|
|
2
|
+
//# sourceMappingURL=useFileStyleProps.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFileStyleProps.cjs","sources":["../../../src/components/UNSTABLE_File/useFileStyleProps.ts"],"sourcesContent":["import classNames from 'classnames';\nimport { useClassNamePrefix } from '../../hooks';\nimport { type StyleProps, type Validation } from '../../types';\nimport { type UnstableFilePreviewStyleProps } from './types';\nimport { type FileImageCropStyles, type FileImageObjectFitStyles, useFileImageStyles } from './useFileImageStyles';\n\nexport interface FileStyleProps extends StyleProps, Validation, UnstableFilePreviewStyleProps {\n isDisabled?: boolean;\n}\n\nexport interface FileStyle {\n classProps: {\n root: string;\n preview: string;\n content: string;\n text: string;\n name: string;\n helperText: string;\n validationText: string;\n imageCropStyles?: FileImageCropStyles;\n imageObjectFitStyles?: FileImageObjectFitStyles;\n };\n}\n\nexport const useFileStyleProps = (props?: FileStyleProps): FileStyle => {\n const fileClass = useClassNamePrefix('UNSTABLE_File');\n\n const { imageCropStyles, imageObjectFitStyles, hasCoordsInMeta } = useFileImageStyles(\n props?.meta,\n props?.imageObjectFit,\n );\n\n return {\n classProps: {\n root: classNames(fileClass, {\n [`${fileClass}--disabled`]: props?.isDisabled,\n [`has-${props?.validationState}`]: props?.validationState,\n }),\n preview: `${fileClass}__preview`,\n content: `${fileClass}__content`,\n text: `${fileClass}__text`,\n name: `${fileClass}__name`,\n helperText: `${fileClass}__helperText`,\n validationText: `${fileClass}__validationText`,\n ...(hasCoordsInMeta && { imageCropStyles }),\n ...(imageObjectFitStyles && { imageObjectFitStyles }),\n },\n };\n};\n"],"names":["useFileStyleProps","props","fileClass","useClassNamePrefix","imageCropStyles","imageObjectFitStyles","hasCoordsInMeta","useFileImageStyles","classNames"],"mappings":"oMAwBaA,EAAqBC,GAAsC,CACtE,MAAMC,EAAYC,EAAAA,mBAAmB,eAAe,EAE9C,CAAE,gBAAAC,EAAiB,qBAAAC,EAAsB,gBAAAC,CAAA,EAAoBC,EAAAA,mBACjEN,GAAO,KACPA,GAAO,cAAA,EAGT,MAAO,CACL,WAAY,CACV,KAAMO,EAAWN,EAAW,CAC1B,CAAC,GAAGA,CAAS,YAAY,EAAGD,GAAO,WACnC,CAAC,OAAOA,GAAO,eAAe,EAAE,EAAGA,GAAO,eAAA,CAC3C,EACD,QAAS,GAAGC,CAAS,YACrB,QAAS,GAAGA,CAAS,YACrB,KAAM,GAAGA,CAAS,SAClB,KAAM,GAAGA,CAAS,SAClB,WAAY,GAAGA,CAAS,eACxB,eAAgB,GAAGA,CAAS,mBAC5B,GAAII,GAAmB,CAAE,gBAAAF,CAAA,EACzB,GAAIC,GAAwB,CAAE,qBAAAA,CAAA,CAAqB,CACrD,CAEJ"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StyleProps, Validation } from '../../types';
|
|
2
|
+
import { UnstableFilePreviewStyleProps } from './types';
|
|
3
|
+
import { FileImageCropStyles, FileImageObjectFitStyles } from './useFileImageStyles';
|
|
4
|
+
export interface FileStyleProps extends StyleProps, Validation, UnstableFilePreviewStyleProps {
|
|
5
|
+
isDisabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface FileStyle {
|
|
8
|
+
classProps: {
|
|
9
|
+
root: string;
|
|
10
|
+
preview: string;
|
|
11
|
+
content: string;
|
|
12
|
+
text: string;
|
|
13
|
+
name: string;
|
|
14
|
+
helperText: string;
|
|
15
|
+
validationText: string;
|
|
16
|
+
imageCropStyles?: FileImageCropStyles;
|
|
17
|
+
imageObjectFitStyles?: FileImageObjectFitStyles;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare const useFileStyleProps: (props?: FileStyleProps) => FileStyle;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import l from "classnames";
|
|
2
|
+
import { useClassNamePrefix as o } from "../../hooks/useClassNamePrefix.js";
|
|
3
|
+
import { useFileImageStyles as r } from "./useFileImageStyles.js";
|
|
4
|
+
const c = (t) => {
|
|
5
|
+
const e = o("UNSTABLE_File"), { imageCropStyles: i, imageObjectFitStyles: a, hasCoordsInMeta: s } = r(
|
|
6
|
+
t?.meta,
|
|
7
|
+
t?.imageObjectFit
|
|
8
|
+
);
|
|
9
|
+
return {
|
|
10
|
+
classProps: {
|
|
11
|
+
root: l(e, {
|
|
12
|
+
[`${e}--disabled`]: t?.isDisabled,
|
|
13
|
+
[`has-${t?.validationState}`]: t?.validationState
|
|
14
|
+
}),
|
|
15
|
+
preview: `${e}__preview`,
|
|
16
|
+
content: `${e}__content`,
|
|
17
|
+
text: `${e}__text`,
|
|
18
|
+
name: `${e}__name`,
|
|
19
|
+
helperText: `${e}__helperText`,
|
|
20
|
+
validationText: `${e}__validationText`,
|
|
21
|
+
...s && { imageCropStyles: i },
|
|
22
|
+
...a && { imageObjectFitStyles: a }
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
c as useFileStyleProps
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=useFileStyleProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFileStyleProps.js","sources":["../../../src/components/UNSTABLE_File/useFileStyleProps.ts"],"sourcesContent":["import classNames from 'classnames';\nimport { useClassNamePrefix } from '../../hooks';\nimport { type StyleProps, type Validation } from '../../types';\nimport { type UnstableFilePreviewStyleProps } from './types';\nimport { type FileImageCropStyles, type FileImageObjectFitStyles, useFileImageStyles } from './useFileImageStyles';\n\nexport interface FileStyleProps extends StyleProps, Validation, UnstableFilePreviewStyleProps {\n isDisabled?: boolean;\n}\n\nexport interface FileStyle {\n classProps: {\n root: string;\n preview: string;\n content: string;\n text: string;\n name: string;\n helperText: string;\n validationText: string;\n imageCropStyles?: FileImageCropStyles;\n imageObjectFitStyles?: FileImageObjectFitStyles;\n };\n}\n\nexport const useFileStyleProps = (props?: FileStyleProps): FileStyle => {\n const fileClass = useClassNamePrefix('UNSTABLE_File');\n\n const { imageCropStyles, imageObjectFitStyles, hasCoordsInMeta } = useFileImageStyles(\n props?.meta,\n props?.imageObjectFit,\n );\n\n return {\n classProps: {\n root: classNames(fileClass, {\n [`${fileClass}--disabled`]: props?.isDisabled,\n [`has-${props?.validationState}`]: props?.validationState,\n }),\n preview: `${fileClass}__preview`,\n content: `${fileClass}__content`,\n text: `${fileClass}__text`,\n name: `${fileClass}__name`,\n helperText: `${fileClass}__helperText`,\n validationText: `${fileClass}__validationText`,\n ...(hasCoordsInMeta && { imageCropStyles }),\n ...(imageObjectFitStyles && { imageObjectFitStyles }),\n },\n };\n};\n"],"names":["useFileStyleProps","props","fileClass","useClassNamePrefix","imageCropStyles","imageObjectFitStyles","hasCoordsInMeta","useFileImageStyles","classNames"],"mappings":";;;AAwBO,MAAMA,IAAoB,CAACC,MAAsC;AACtE,QAAMC,IAAYC,EAAmB,eAAe,GAE9C,EAAE,iBAAAC,GAAiB,sBAAAC,GAAsB,iBAAAC,EAAA,IAAoBC;AAAA,IACjEN,GAAO;AAAA,IACPA,GAAO;AAAA,EAAA;AAGT,SAAO;AAAA,IACL,YAAY;AAAA,MACV,MAAMO,EAAWN,GAAW;AAAA,QAC1B,CAAC,GAAGA,CAAS,YAAY,GAAGD,GAAO;AAAA,QACnC,CAAC,OAAOA,GAAO,eAAe,EAAE,GAAGA,GAAO;AAAA,MAAA,CAC3C;AAAA,MACD,SAAS,GAAGC,CAAS;AAAA,MACrB,SAAS,GAAGA,CAAS;AAAA,MACrB,MAAM,GAAGA,CAAS;AAAA,MAClB,MAAM,GAAGA,CAAS;AAAA,MAClB,YAAY,GAAGA,CAAS;AAAA,MACxB,gBAAgB,GAAGA,CAAS;AAAA,MAC5B,GAAII,KAAmB,EAAE,iBAAAF,EAAA;AAAA,MACzB,GAAIC,KAAwB,EAAE,sBAAAA,EAAA;AAAA,IAAqB;AAAA,EACrD;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),G=require("classnames"),v=require("react"),J=require("../../hooks/styleProps.cjs"),K=require("../../hooks/useAriaIdRefs.cjs"),Q=require("../Button/Button.cjs"),W=require("../Field/HelperText.cjs"),g=require("../Field/Label.cjs"),X=require("../Field/ValidationText.cjs"),Y=require("../Field/useValidationTextRole.cjs"),ee=require("../Icon/Icon.cjs"),te=require("./useFileUploadState.cjs"),se=require("./useFileUploadStyleProps.cjs"),l=S=>{const[h,N]=v.useState(!1),{"aria-describedby":b="",accept:f,buttonText:T="Browse",children:y,dropZoneRef:A,hasValidationIcon:F,helperText:j,iconName:q="upload",id:U,inputRef:P,isCompact:d,isDisabled:s,isDragAndDropSupported:o,isLabelHidden:E,isMultiple:R,isRequired:_,label:B,labelText:c,linkText:I,name:p,onFilesSelected:L,rootId:n,validationState:a,validationText:u,...V}=S,m=p!==void 0,i=o??h,{isDragging:Z,onChange:C,onDragEnter:M,onDragLeave:O,onDragOver:$,onDrop:H}=te.useFileUploadState({onFilesSelected:m?L:void 0}),{classProps:t}=se.useFileUploadStyleProps({isCompact:d,isDisabled:s,isDragAndDropSupported:i,isDragging:Z,isLabelHidden:E,isRequired:_,validationState:a}),{styleProps:x,props:k}=J.useStyleProps(V),[w,D]=K.useAriaDescribedBy(b),z=Y.useValidationTextRole({validationState:a,validationText:u}),r=U;return v.useEffect(()=>{o===void 0&&N("draggable"in document.createElement("span"))},[o]),e.jsxs("div",{...k,...x,...n!=null&&n!==""?{id:n}:{},className:G(t.root,x.className),children:[m&&e.jsxs("div",{onDragOver:!s&&i?$:void 0,onDragEnter:!s&&i?M:void 0,onDragLeave:!s&&i?O:void 0,onDrop:!s&&i?H:void 0,className:t.input.root,children:[e.jsx(g.default,{htmlFor:r,UNSAFE_className:t.input.label,children:B}),e.jsx("input",{...w,type:"file",accept:f,id:r,ref:P,name:p,className:t.input.input,onChange:C,multiple:R,disabled:s}),e.jsxs("div",{ref:A,className:t.input.dropZone.root,children:[!d&&e.jsx(ee.default,{name:q,boxSize:28,"aria-hidden":"true"}),e.jsxs("div",{className:t.input.dropZone.content,children:[e.jsxs(g.default,{htmlFor:r,UNSAFE_className:t.input.dropZone.label,children:[I,c&&e.jsxs(e.Fragment,{children:[" ",e.jsx("span",{className:t.input.dropLabel,children:c})]})]}),e.jsx(W.default,{UNSAFE_className:t.input.helper,id:`${r}-helper`,registerAria:D,helperText:j})]}),e.jsx(Q.default,{"aria-hidden":"true",isDisabled:s,elementType:"div",type:null,children:T})]}),a&&e.jsx(X.default,{UNSAFE_className:t.input.validationText,elementType:"div",...F&&{hasValidationStateIcon:a},id:`${r}-validation`,validationText:u,registerAria:D,role:z})]}),y]})};l.spiritComponent="UNSTABLE_FileUpload";l.displayName="UNSTABLE_FileUpload";exports.default=l;
|
|
2
2
|
//# sourceMappingURL=UNSTABLE_FileUpload.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UNSTABLE_FileUpload.cjs","sources":["../../../src/components/UNSTABLE_FileUpload/UNSTABLE_FileUpload.tsx"],"sourcesContent":["'use client';\n\nimport classNames from 'classnames';\nimport React, { useEffect, useState } from 'react';\nimport { useAriaDescribedBy, useStyleProps } from '../../hooks';\nimport { HelperText, Label, ValidationText
|
|
1
|
+
{"version":3,"file":"UNSTABLE_FileUpload.cjs","sources":["../../../src/components/UNSTABLE_FileUpload/UNSTABLE_FileUpload.tsx"],"sourcesContent":["'use client';\n\nimport classNames from 'classnames';\nimport React, { useEffect, useState } from 'react';\nimport { useAriaDescribedBy, useStyleProps } from '../../hooks';\nimport { Button } from '../Button';\nimport { HelperText, Label, ValidationText } from '../Field';\nimport { useValidationTextRole } from '../Field/useValidationTextRole';\nimport { Icon } from '../Icon';\nimport { type UnstableFileUploadProps } from './types';\nimport { useFileUploadState } from './useFileUploadState';\nimport { useFileUploadStyleProps } from './useFileUploadStyleProps';\n\nconst UNSTABLE_FileUpload = (props: UnstableFileUploadProps) => {\n const [isDragAndDropDetected, setIsDragAndDropDetected] = useState(false);\n const {\n 'aria-describedby': ariaDescribedBy = '',\n accept,\n buttonText = 'Browse',\n children,\n dropZoneRef,\n hasValidationIcon,\n helperText,\n iconName = 'upload',\n id,\n inputRef,\n isCompact,\n isDisabled,\n isDragAndDropSupported: isDragAndDropSupportedProp,\n isLabelHidden,\n isMultiple,\n isRequired,\n label,\n labelText,\n linkText,\n name,\n onFilesSelected,\n rootId,\n validationState,\n validationText,\n ...restProps\n } = props;\n\n const hasInput = name !== undefined;\n\n const isDragAndDropSupported = isDragAndDropSupportedProp ?? isDragAndDropDetected;\n\n const { isDragging, onChange, onDragEnter, onDragLeave, onDragOver, onDrop } = useFileUploadState({\n onFilesSelected: hasInput ? onFilesSelected : undefined,\n });\n\n const { classProps } = useFileUploadStyleProps({\n hasValidationIcon,\n isCompact,\n isDisabled,\n isDragAndDropSupported,\n isDragging,\n isLabelHidden,\n isRequired,\n validationState,\n });\n\n const { styleProps, props: transferProps } = useStyleProps(restProps);\n\n const [ariaDescribedByProp, register] = useAriaDescribedBy(ariaDescribedBy);\n const validationTextRole = useValidationTextRole({\n validationState,\n validationText,\n });\n const inputId = id;\n\n useEffect(() => {\n if (isDragAndDropSupportedProp !== undefined) {\n return;\n }\n setIsDragAndDropDetected('draggable' in document.createElement('span'));\n }, [isDragAndDropSupportedProp]);\n\n return (\n <div\n {...transferProps}\n {...styleProps}\n {...(rootId != null && rootId !== '' ? { id: rootId } : {})}\n className={classNames(classProps.root, styleProps.className)}\n >\n {hasInput && (\n <div\n onDragOver={!isDisabled && isDragAndDropSupported ? onDragOver : undefined}\n onDragEnter={!isDisabled && isDragAndDropSupported ? onDragEnter : undefined}\n onDragLeave={!isDisabled && isDragAndDropSupported ? onDragLeave : undefined}\n onDrop={!isDisabled && isDragAndDropSupported ? onDrop : undefined}\n className={classProps.input.root}\n >\n <Label htmlFor={inputId} UNSAFE_className={classProps.input.label}>\n {label}\n </Label>\n <input\n {...ariaDescribedByProp}\n type=\"file\"\n accept={accept}\n id={inputId}\n ref={inputRef}\n name={name}\n className={classProps.input.input}\n onChange={onChange}\n multiple={isMultiple}\n disabled={isDisabled}\n />\n <div ref={dropZoneRef} className={classProps.input.dropZone.root}>\n {!isCompact && <Icon name={iconName} boxSize={28} aria-hidden=\"true\" />}\n <div className={classProps.input.dropZone.content}>\n <Label htmlFor={inputId} UNSAFE_className={classProps.input.dropZone.label}>\n {linkText}\n {labelText && (\n <>\n {' '}\n <span className={classProps.input.dropLabel}>{labelText}</span>\n </>\n )}\n </Label>\n <HelperText\n UNSAFE_className={classProps.input.helper}\n id={`${inputId}-helper`}\n registerAria={register}\n helperText={helperText}\n />\n </div>\n {/* @ts-expect-error - Div cannot have type=\"button\". This will be solved with https://jira.almacareer.tech/browse/DS-2168 */}\n <Button aria-hidden=\"true\" isDisabled={isDisabled} elementType=\"div\" type={null}>\n {buttonText}\n </Button>\n </div>\n {validationState && (\n <ValidationText\n UNSAFE_className={classProps.input.validationText}\n elementType=\"div\"\n {...(hasValidationIcon && { hasValidationStateIcon: validationState })}\n id={`${inputId}-validation`}\n validationText={validationText}\n registerAria={register}\n role={validationTextRole}\n />\n )}\n </div>\n )}\n {children}\n </div>\n );\n};\n\nUNSTABLE_FileUpload.spiritComponent = 'UNSTABLE_FileUpload';\nUNSTABLE_FileUpload.displayName = 'UNSTABLE_FileUpload';\n\nexport default UNSTABLE_FileUpload;\n"],"names":["UNSTABLE_FileUpload","props","isDragAndDropDetected","setIsDragAndDropDetected","useState","ariaDescribedBy","accept","buttonText","children","dropZoneRef","hasValidationIcon","helperText","iconName","id","inputRef","isCompact","isDisabled","isDragAndDropSupportedProp","isLabelHidden","isMultiple","isRequired","label","labelText","linkText","name","onFilesSelected","rootId","validationState","validationText","restProps","hasInput","isDragAndDropSupported","isDragging","onChange","onDragEnter","onDragLeave","onDragOver","onDrop","useFileUploadState","classProps","useFileUploadStyleProps","styleProps","transferProps","useStyleProps","ariaDescribedByProp","register","useAriaDescribedBy","validationTextRole","useValidationTextRole","inputId","useEffect","jsxs","classNames","jsx","Label","Icon","Fragment","HelperText","Button","ValidationText"],"mappings":"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"}
|