@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
|
@@ -1,71 +1,81 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import { Sizes as
|
|
6
|
-
import { useStyleProps as
|
|
7
|
-
import { useAriaDescribedBy as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { useValidationTextRole as
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
import { jsx as o, jsxs as i, Fragment as v } from "react/jsx-runtime";
|
|
3
|
+
import A from "classnames";
|
|
4
|
+
import { forwardRef as x } from "react";
|
|
5
|
+
import { Sizes as E } from "../../constants/dictionaries.js";
|
|
6
|
+
import { useStyleProps as w } from "../../hooks/styleProps.js";
|
|
7
|
+
import { useAriaDescribedBy as I } from "../../hooks/useAriaIdRefs.js";
|
|
8
|
+
import U from "../CharacterCounter/CharacterCounter.js";
|
|
9
|
+
import C from "../Field/HelperText.js";
|
|
10
|
+
import D from "../Field/Label.js";
|
|
11
|
+
import V from "../Field/ValidationText.js";
|
|
12
|
+
import { useValidationTextRole as z } from "../Field/useValidationTextRole.js";
|
|
13
|
+
import R from "../Flex/Flex.js";
|
|
14
|
+
import j from "./TextFieldBaseInput.js";
|
|
15
|
+
import { useTextFieldBaseStyleProps as M } from "./useTextFieldBaseStyleProps.js";
|
|
16
|
+
import W from "./withPasswordToggle.js";
|
|
17
|
+
const $ = x(
|
|
18
|
+
W(j)
|
|
19
|
+
), H = (f, h) => {
|
|
19
20
|
const {
|
|
20
|
-
"aria-describedby":
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
"aria-describedby": u = "",
|
|
22
|
+
counterProps: s,
|
|
23
|
+
hasValidationIcon: F,
|
|
24
|
+
helperText: n,
|
|
23
25
|
id: e,
|
|
24
|
-
label:
|
|
25
|
-
size:
|
|
26
|
+
label: g,
|
|
27
|
+
size: m = E.MEDIUM,
|
|
26
28
|
validationState: t,
|
|
27
|
-
validationText:
|
|
28
|
-
...
|
|
29
|
-
} =
|
|
29
|
+
validationText: a,
|
|
30
|
+
...N
|
|
31
|
+
} = f, { classProps: r, props: P } = M({
|
|
30
32
|
id: e,
|
|
31
|
-
size:
|
|
33
|
+
size: m,
|
|
32
34
|
validationState: t,
|
|
33
|
-
...
|
|
34
|
-
}), { styleProps:
|
|
35
|
+
...N
|
|
36
|
+
}), { styleProps: p, props: B } = w(P), [b, l] = I(u), y = z({
|
|
35
37
|
validationState: t,
|
|
36
|
-
validationText:
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
38
|
+
validationText: a
|
|
39
|
+
}), S = n || t && a, d = /* @__PURE__ */ o(
|
|
40
|
+
C,
|
|
41
|
+
{
|
|
42
|
+
UNSAFE_className: r.helperText,
|
|
43
|
+
id: `${e}__helper-text`,
|
|
44
|
+
registerAria: l,
|
|
45
|
+
helperText: n
|
|
46
|
+
}
|
|
47
|
+
), c = t ? /* @__PURE__ */ o(
|
|
48
|
+
V,
|
|
49
|
+
{
|
|
50
|
+
UNSAFE_className: r.validationText,
|
|
51
|
+
elementType: "span",
|
|
52
|
+
...F && { hasValidationStateIcon: t },
|
|
53
|
+
id: `${e}__validation-text`,
|
|
54
|
+
validationText: a,
|
|
55
|
+
registerAria: l,
|
|
56
|
+
role: y
|
|
57
|
+
}
|
|
58
|
+
) : null, _ = s ? /* @__PURE__ */ o(U, { ...s, id: e, registerAria: l, UNSAFE_className: r.counter }) : null;
|
|
59
|
+
return /* @__PURE__ */ i("div", { ...p, className: A(r.root, p.className), children: [
|
|
60
|
+
/* @__PURE__ */ o(D, { htmlFor: e, UNSAFE_className: r.label, children: g }),
|
|
61
|
+
/* @__PURE__ */ o($, { ...B, ...b, id: e, ref: h, size: m }),
|
|
62
|
+
s ? /* @__PURE__ */ i(R, { direction: "horizontal", isWrapping: !1, alignmentX: "space-between", alignmentY: "top", children: [
|
|
63
|
+
S ? /* @__PURE__ */ i("div", { children: [
|
|
64
|
+
c,
|
|
65
|
+
d
|
|
66
|
+
] }) : null,
|
|
67
|
+
_
|
|
68
|
+
] }) : /* @__PURE__ */ i(v, { children: [
|
|
69
|
+
d,
|
|
70
|
+
c
|
|
71
|
+
] })
|
|
62
72
|
] });
|
|
63
|
-
},
|
|
64
|
-
|
|
73
|
+
}, T = x(
|
|
74
|
+
H
|
|
65
75
|
);
|
|
66
|
-
|
|
67
|
-
|
|
76
|
+
T.spiritComponent = "TextFieldBase";
|
|
77
|
+
T.displayName = "TextFieldBase";
|
|
68
78
|
export {
|
|
69
|
-
|
|
79
|
+
T as default
|
|
70
80
|
};
|
|
71
81
|
//# sourceMappingURL=TextFieldBase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextFieldBase.js","sources":["../../../src/components/TextFieldBase/TextFieldBase.tsx"],"sourcesContent":["'use client';\n\nimport classNames from 'classnames';\nimport React, { type ForwardedRef, forwardRef } from 'react';\nimport { Sizes } from '../../constants';\nimport { useAriaDescribedBy, useStyleProps } from '../../hooks';\nimport {\n type ForwardRefComponent,\n type SpiritTextFieldBaseProps,\n type TextFieldBasePasswordToggleProps,\n} from '../../types';\nimport { HelperText, Label, ValidationText
|
|
1
|
+
{"version":3,"file":"TextFieldBase.js","sources":["../../../src/components/TextFieldBase/TextFieldBase.tsx"],"sourcesContent":["'use client';\n\nimport classNames from 'classnames';\nimport React, { type ForwardedRef, forwardRef } from 'react';\nimport { Sizes } from '../../constants';\nimport { useAriaDescribedBy, useStyleProps } from '../../hooks';\nimport {\n type ForwardRefComponent,\n type SpiritTextFieldBaseProps,\n type TextFieldBasePasswordToggleProps,\n} from '../../types';\nimport { CharacterCounter } from '../CharacterCounter';\nimport { HelperText, Label, ValidationText } from '../Field';\nimport { useValidationTextRole } from '../Field/useValidationTextRole';\nimport { Flex } from '../Flex';\nimport TextFieldBaseInput from './TextFieldBaseInput';\nimport { useTextFieldBaseStyleProps } from './useTextFieldBaseStyleProps';\nimport withPasswordToggle from './withPasswordToggle';\n\nconst TextFieldBaseInputWithPasswordToggle = forwardRef(\n withPasswordToggle<TextFieldBasePasswordToggleProps>(TextFieldBaseInput),\n);\n\nconst _TextFieldBase = (props: SpiritTextFieldBaseProps, ref: ForwardedRef<HTMLInputElement | HTMLTextAreaElement>) => {\n const {\n 'aria-describedby': ariaDescribedBy = '',\n counterProps,\n hasValidationIcon,\n helperText,\n id,\n label,\n size = Sizes.MEDIUM,\n validationState,\n validationText,\n ...restProps\n } = props;\n const { classProps, props: modifiedProps } = useTextFieldBaseStyleProps({\n id,\n size,\n validationState,\n ...restProps,\n });\n const { styleProps, props: otherProps } = useStyleProps(modifiedProps);\n const [ariaDescribedByProp, register] = useAriaDescribedBy(ariaDescribedBy);\n const validationTextRole = useValidationTextRole({\n validationState,\n validationText,\n });\n\n const hasTextContent = helperText || (validationState && validationText);\n\n const helperTextElement = (\n <HelperText\n UNSAFE_className={classProps.helperText}\n id={`${id}__helper-text`}\n registerAria={register}\n helperText={helperText}\n />\n );\n\n const validationTextElement = validationState ? (\n <ValidationText\n UNSAFE_className={classProps.validationText}\n elementType=\"span\"\n {...(hasValidationIcon && { hasValidationStateIcon: validationState })}\n id={`${id}__validation-text`}\n validationText={validationText}\n registerAria={register}\n role={validationTextRole}\n />\n ) : null;\n\n const counterElement = counterProps ? (\n <CharacterCounter {...counterProps} id={id} registerAria={register} UNSAFE_className={classProps.counter} />\n ) : null;\n\n return (\n <div {...styleProps} className={classNames(classProps.root, styleProps.className)}>\n <Label htmlFor={id} UNSAFE_className={classProps.label}>\n {label}\n </Label>\n <TextFieldBaseInputWithPasswordToggle {...otherProps} {...ariaDescribedByProp} id={id} ref={ref} size={size} />\n {counterProps ? (\n <Flex direction=\"horizontal\" isWrapping={false} alignmentX=\"space-between\" alignmentY=\"top\">\n {hasTextContent ? (\n <div>\n {/* In counter layout, put validation first so the status message stays visually closest to the counter row. */}\n {validationTextElement}\n {helperTextElement}\n </div>\n ) : null}\n {counterElement}\n </Flex>\n ) : (\n <>\n {/* Without counter, keep the default field text flow: helper first, then validation. */}\n {helperTextElement}\n {validationTextElement}\n </>\n )}\n </div>\n );\n};\n\nconst TextFieldBase = forwardRef<HTMLInputElement | HTMLTextAreaElement, SpiritTextFieldBaseProps>(\n _TextFieldBase,\n) as ForwardRefComponent<HTMLInputElement | HTMLTextAreaElement, SpiritTextFieldBaseProps>;\n\nTextFieldBase.spiritComponent = 'TextFieldBase';\nTextFieldBase.displayName = 'TextFieldBase';\n\nexport default TextFieldBase;\n"],"names":["TextFieldBaseInputWithPasswordToggle","forwardRef","withPasswordToggle","TextFieldBaseInput","_TextFieldBase","props","ref","ariaDescribedBy","counterProps","hasValidationIcon","helperText","id","label","size","Sizes","validationState","validationText","restProps","classProps","modifiedProps","useTextFieldBaseStyleProps","styleProps","otherProps","useStyleProps","ariaDescribedByProp","register","useAriaDescribedBy","validationTextRole","useValidationTextRole","hasTextContent","helperTextElement","jsx","HelperText","validationTextElement","ValidationText","counterElement","CharacterCounter","jsxs","classNames","Label","Flex","Fragment","TextFieldBase"],"mappings":";;;;;;;;;;;;;;;;AAmBA,MAAMA,IAAuCC;AAAA,EAC3CC,EAAqDC,CAAkB;AACzE,GAEMC,IAAiB,CAACC,GAAiCC,MAA8D;AACrH,QAAM;AAAA,IACJ,oBAAoBC,IAAkB;AAAA,IACtC,cAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,IAAAC;AAAA,IACA,OAAAC;AAAA,IACA,MAAAC,IAAOC,EAAM;AAAA,IACb,iBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDZ,GACE,EAAE,YAAAa,GAAY,OAAOC,EAAA,IAAkBC,EAA2B;AAAA,IACtE,IAAAT;AAAA,IACA,MAAAE;AAAA,IACA,iBAAAE;AAAA,IACA,GAAGE;AAAA,EAAA,CACJ,GACK,EAAE,YAAAI,GAAY,OAAOC,EAAA,IAAeC,EAAcJ,CAAa,GAC/D,CAACK,GAAqBC,CAAQ,IAAIC,EAAmBnB,CAAe,GACpEoB,IAAqBC,EAAsB;AAAA,IAC/C,iBAAAb;AAAA,IACA,gBAAAC;AAAA,EAAA,CACD,GAEKa,IAAiBnB,KAAeK,KAAmBC,GAEnDc,IACJ,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,kBAAkBd,EAAW;AAAA,MAC7B,IAAI,GAAGP,CAAE;AAAA,MACT,cAAcc;AAAA,MACd,YAAAf;AAAA,IAAA;AAAA,EAAA,GAIEuB,IAAwBlB,IAC5B,gBAAAgB;AAAA,IAACG;AAAA,IAAA;AAAA,MACC,kBAAkBhB,EAAW;AAAA,MAC7B,aAAY;AAAA,MACX,GAAIT,KAAqB,EAAE,wBAAwBM,EAAA;AAAA,MACpD,IAAI,GAAGJ,CAAE;AAAA,MACT,gBAAAK;AAAA,MACA,cAAcS;AAAA,MACd,MAAME;AAAA,IAAA;AAAA,EAAA,IAEN,MAEEQ,IAAiB3B,IACrB,gBAAAuB,EAACK,GAAA,EAAkB,GAAG5B,GAAc,IAAAG,GAAQ,cAAcc,GAAU,kBAAkBP,EAAW,QAAA,CAAS,IACxG;AAEJ,SACE,gBAAAmB,EAAC,OAAA,EAAK,GAAGhB,GAAY,WAAWiB,EAAWpB,EAAW,MAAMG,EAAW,SAAS,GAC9E,UAAA;AAAA,IAAA,gBAAAU,EAACQ,KAAM,SAAS5B,GAAI,kBAAkBO,EAAW,OAC9C,UAAAN,GACH;AAAA,IACA,gBAAAmB,EAAC/B,KAAsC,GAAGsB,GAAa,GAAGE,GAAqB,IAAAb,GAAQ,KAAAL,GAAU,MAAAO,GAAY;AAAA,IAC5GL,IACC,gBAAA6B,EAACG,GAAA,EAAK,WAAU,cAAa,YAAY,IAAO,YAAW,iBAAgB,YAAW,OACnF,UAAA;AAAA,MAAAX,sBACE,OAAA,EAEE,UAAA;AAAA,QAAAI;AAAA,QACAH;AAAA,MAAA,EAAA,CACH,IACE;AAAA,MACHK;AAAA,IAAA,EAAA,CACH,IAEA,gBAAAE,EAAAI,GAAA,EAEG,UAAA;AAAA,MAAAX;AAAA,MACAG;AAAA,IAAA,EAAA,CACH;AAAA,EAAA,GAEJ;AAEJ,GAEMS,IAAgBzC;AAAA,EACpBG;AACF;AAEAsC,EAAc,kBAAkB;AAChCA,EAAc,cAAc;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("classnames"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("classnames"),q=require("../../hooks/useClassNamePrefix.cjs");function m(i){const{isFluid:d,isMultiline:s,isLabelHidden:n,size:t,validationState:l,...a}=i,{isDisabled:r,isRequired:T}=a,e=q.useClassNamePrefix(s?"TextArea":"TextField"),c=`${e}--disabled`,u=`${e}--fluid`,x=`${e}--${t}`,_=`${e}--${l}`,g=`${e}__input`,p=`${e}__label`,F=`${e}__label--required`,B=`${e}__label--hidden`,C=`${e}__validationText`,$=`${e}__passwordToggle`,b=`${e}__passwordToggle__button`,P=`${e}__passwordToggle__icon`,w=`${e}__helperText`,S=o(e,{[c]:r,[u]:d,[_]:l,[x]:t}),y=o(p,{[F]:T,[B]:n}),f=`${e}__counter`;return{classProps:{root:S,label:y,input:g,helperText:w,validationText:C,passwordToggle:$,passwordToggleButton:b,passwordToggleIcon:P,counter:f},props:{...a,isMultiline:s}}}exports.useTextFieldBaseStyleProps=m;
|
|
2
2
|
//# sourceMappingURL=useTextFieldBaseStyleProps.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTextFieldBaseStyleProps.cjs","sources":["../../../src/components/TextFieldBase/useTextFieldBaseStyleProps.ts"],"sourcesContent":["import classNames from 'classnames';\nimport { useClassNamePrefix } from '../../hooks';\nimport { type SpiritTextFieldBaseProps, type TextFieldBaseProps } from '../../types';\n\nexport interface TextFieldBaseStyles {\n /** className props */\n classProps: {\n root: string;\n label: string;\n input: string;\n helperText: string;\n validationText: string;\n passwordToggle: string;\n passwordToggleButton: string;\n passwordToggleIcon: string;\n };\n /** props to be passed to the input element */\n props: Omit<TextFieldBaseProps, 'label'>;\n}\n\nexport function useTextFieldBaseStyleProps(props: Omit<SpiritTextFieldBaseProps, 'label'>): TextFieldBaseStyles {\n const { isFluid, isMultiline, isLabelHidden, size, validationState, ...restProps } = props;\n const { isDisabled, isRequired } = restProps;\n\n const TextFieldBaseClass = useClassNamePrefix(isMultiline ? 'TextArea' : 'TextField');\n const TextFieldBaseDisabledClass = `${TextFieldBaseClass}--disabled`;\n const TextFieldBaseFluidClass = `${TextFieldBaseClass}--fluid`;\n const TextFieldBaseSizeClass = `${TextFieldBaseClass}--${size}`;\n const TextFieldBaseValidationClass = `${TextFieldBaseClass}--${validationState}`;\n const TextFieldBaseInputClass = `${TextFieldBaseClass}__input`;\n const TextFieldBaseLabelClass = `${TextFieldBaseClass}__label`;\n const TextFieldBaseLabelRequiredClass = `${TextFieldBaseClass}__label--required`;\n const TextFieldBaseLabelHiddenClass = `${TextFieldBaseClass}__label--hidden`;\n const TextFieldBaseValidationTextClass = `${TextFieldBaseClass}__validationText`;\n const TextFieldBasePasswordToggleClass = `${TextFieldBaseClass}__passwordToggle`;\n const TextFieldBasePasswordToggleButtonClass = `${TextFieldBaseClass}__passwordToggle__button`;\n const TextFieldBasePasswordToggleIconClass = `${TextFieldBaseClass}__passwordToggle__icon`;\n const TextFieldBaseHelperTextClass = `${TextFieldBaseClass}__helperText`;\n\n const rootStyles = classNames(TextFieldBaseClass, {\n [TextFieldBaseDisabledClass]: isDisabled,\n [TextFieldBaseFluidClass]: isFluid,\n [TextFieldBaseValidationClass]: validationState,\n [TextFieldBaseSizeClass]: size,\n });\n const labelStyles = classNames(TextFieldBaseLabelClass, {\n [TextFieldBaseLabelRequiredClass]: isRequired,\n [TextFieldBaseLabelHiddenClass]: isLabelHidden,\n });\n\n return {\n classProps: {\n root: rootStyles,\n label: labelStyles,\n input: TextFieldBaseInputClass,\n helperText: TextFieldBaseHelperTextClass,\n validationText: TextFieldBaseValidationTextClass,\n passwordToggle: TextFieldBasePasswordToggleClass,\n passwordToggleButton: TextFieldBasePasswordToggleButtonClass,\n passwordToggleIcon: TextFieldBasePasswordToggleIconClass,\n },\n props: {\n ...restProps,\n isMultiline,\n },\n };\n}\n"],"names":["useTextFieldBaseStyleProps","props","isFluid","isMultiline","isLabelHidden","size","validationState","restProps","isDisabled","isRequired","TextFieldBaseClass","useClassNamePrefix","TextFieldBaseDisabledClass","TextFieldBaseFluidClass","TextFieldBaseSizeClass","TextFieldBaseValidationClass","TextFieldBaseInputClass","TextFieldBaseLabelClass","TextFieldBaseLabelRequiredClass","TextFieldBaseLabelHiddenClass","TextFieldBaseValidationTextClass","TextFieldBasePasswordToggleClass","TextFieldBasePasswordToggleButtonClass","TextFieldBasePasswordToggleIconClass","TextFieldBaseHelperTextClass","rootStyles","classNames","labelStyles"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useTextFieldBaseStyleProps.cjs","sources":["../../../src/components/TextFieldBase/useTextFieldBaseStyleProps.ts"],"sourcesContent":["import classNames from 'classnames';\nimport { useClassNamePrefix } from '../../hooks';\nimport { type SpiritTextFieldBaseProps, type TextFieldBaseProps } from '../../types';\n\nexport interface TextFieldBaseStyles {\n /** className props */\n classProps: {\n root: string;\n label: string;\n input: string;\n helperText: string;\n validationText: string;\n passwordToggle: string;\n passwordToggleButton: string;\n passwordToggleIcon: string;\n counter: string;\n };\n /** props to be passed to the input element */\n props: Omit<TextFieldBaseProps, 'label'>;\n}\n\nexport function useTextFieldBaseStyleProps(props: Omit<SpiritTextFieldBaseProps, 'label'>): TextFieldBaseStyles {\n const { isFluid, isMultiline, isLabelHidden, size, validationState, ...restProps } = props;\n const { isDisabled, isRequired } = restProps;\n\n const TextFieldBaseClass = useClassNamePrefix(isMultiline ? 'TextArea' : 'TextField');\n const TextFieldBaseDisabledClass = `${TextFieldBaseClass}--disabled`;\n const TextFieldBaseFluidClass = `${TextFieldBaseClass}--fluid`;\n const TextFieldBaseSizeClass = `${TextFieldBaseClass}--${size}`;\n const TextFieldBaseValidationClass = `${TextFieldBaseClass}--${validationState}`;\n const TextFieldBaseInputClass = `${TextFieldBaseClass}__input`;\n const TextFieldBaseLabelClass = `${TextFieldBaseClass}__label`;\n const TextFieldBaseLabelRequiredClass = `${TextFieldBaseClass}__label--required`;\n const TextFieldBaseLabelHiddenClass = `${TextFieldBaseClass}__label--hidden`;\n const TextFieldBaseValidationTextClass = `${TextFieldBaseClass}__validationText`;\n const TextFieldBasePasswordToggleClass = `${TextFieldBaseClass}__passwordToggle`;\n const TextFieldBasePasswordToggleButtonClass = `${TextFieldBaseClass}__passwordToggle__button`;\n const TextFieldBasePasswordToggleIconClass = `${TextFieldBaseClass}__passwordToggle__icon`;\n const TextFieldBaseHelperTextClass = `${TextFieldBaseClass}__helperText`;\n\n const rootStyles = classNames(TextFieldBaseClass, {\n [TextFieldBaseDisabledClass]: isDisabled,\n [TextFieldBaseFluidClass]: isFluid,\n [TextFieldBaseValidationClass]: validationState,\n [TextFieldBaseSizeClass]: size,\n });\n const labelStyles = classNames(TextFieldBaseLabelClass, {\n [TextFieldBaseLabelRequiredClass]: isRequired,\n [TextFieldBaseLabelHiddenClass]: isLabelHidden,\n });\n const counterStyles = `${TextFieldBaseClass}__counter`;\n\n return {\n classProps: {\n root: rootStyles,\n label: labelStyles,\n input: TextFieldBaseInputClass,\n helperText: TextFieldBaseHelperTextClass,\n validationText: TextFieldBaseValidationTextClass,\n passwordToggle: TextFieldBasePasswordToggleClass,\n passwordToggleButton: TextFieldBasePasswordToggleButtonClass,\n passwordToggleIcon: TextFieldBasePasswordToggleIconClass,\n counter: counterStyles,\n },\n props: {\n ...restProps,\n isMultiline,\n },\n };\n}\n"],"names":["useTextFieldBaseStyleProps","props","isFluid","isMultiline","isLabelHidden","size","validationState","restProps","isDisabled","isRequired","TextFieldBaseClass","useClassNamePrefix","TextFieldBaseDisabledClass","TextFieldBaseFluidClass","TextFieldBaseSizeClass","TextFieldBaseValidationClass","TextFieldBaseInputClass","TextFieldBaseLabelClass","TextFieldBaseLabelRequiredClass","TextFieldBaseLabelHiddenClass","TextFieldBaseValidationTextClass","TextFieldBasePasswordToggleClass","TextFieldBasePasswordToggleButtonClass","TextFieldBasePasswordToggleIconClass","TextFieldBaseHelperTextClass","rootStyles","classNames","labelStyles","counterStyles"],"mappings":"8JAqBO,SAASA,EAA2BC,EAAqE,CAC9G,KAAM,CAAE,QAAAC,EAAS,YAAAC,EAAa,cAAAC,EAAe,KAAAC,EAAM,gBAAAC,EAAiB,GAAGC,GAAcN,EAC/E,CAAE,WAAAO,EAAY,WAAAC,CAAA,EAAeF,EAE7BG,EAAqBC,EAAAA,mBAAmBR,EAAc,WAAa,WAAW,EAC9ES,EAA6B,GAAGF,CAAkB,aAClDG,EAA0B,GAAGH,CAAkB,UAC/CI,EAAyB,GAAGJ,CAAkB,KAAKL,CAAI,GACvDU,EAA+B,GAAGL,CAAkB,KAAKJ,CAAe,GACxEU,EAA0B,GAAGN,CAAkB,UAC/CO,EAA0B,GAAGP,CAAkB,UAC/CQ,EAAkC,GAAGR,CAAkB,oBACvDS,EAAgC,GAAGT,CAAkB,kBACrDU,EAAmC,GAAGV,CAAkB,mBACxDW,EAAmC,GAAGX,CAAkB,mBACxDY,EAAyC,GAAGZ,CAAkB,2BAC9Da,EAAuC,GAAGb,CAAkB,yBAC5Dc,EAA+B,GAAGd,CAAkB,eAEpDe,EAAaC,EAAWhB,EAAoB,CAChD,CAACE,CAA0B,EAAGJ,EAC9B,CAACK,CAAuB,EAAGX,EAC3B,CAACa,CAA4B,EAAGT,EAChC,CAACQ,CAAsB,EAAGT,CAAA,CAC3B,EACKsB,EAAcD,EAAWT,EAAyB,CACtD,CAACC,CAA+B,EAAGT,EACnC,CAACU,CAA6B,EAAGf,CAAA,CAClC,EACKwB,EAAgB,GAAGlB,CAAkB,YAE3C,MAAO,CACL,WAAY,CACV,KAAMe,EACN,MAAOE,EACP,MAAOX,EACP,WAAYQ,EACZ,eAAgBJ,EAChB,eAAgBC,EAChB,qBAAsBC,EACtB,mBAAoBC,EACpB,QAASK,CAAA,EAEX,MAAO,CACL,GAAGrB,EACH,YAAAJ,CAAA,CACF,CAEJ"}
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import o from "classnames";
|
|
2
|
-
import { useClassNamePrefix as
|
|
2
|
+
import { useClassNamePrefix as y } from "../../hooks/useClassNamePrefix.js";
|
|
3
3
|
function q(i) {
|
|
4
|
-
const { isFluid: d, isMultiline: s, isLabelHidden: n, size: l, validationState: t, ...a } = i, { isDisabled: r, isRequired: T } = a, e =
|
|
4
|
+
const { isFluid: d, isMultiline: s, isLabelHidden: n, size: l, validationState: t, ...a } = i, { isDisabled: r, isRequired: T } = a, e = y(s ? "TextArea" : "TextField"), c = `${e}--disabled`, x = `${e}--fluid`, _ = `${e}--${l}`, u = `${e}--${t}`, p = `${e}__input`, g = `${e}__label`, F = `${e}__label--required`, B = `${e}__label--hidden`, $ = `${e}__validationText`, C = `${e}__passwordToggle`, b = `${e}__passwordToggle__button`, w = `${e}__passwordToggle__icon`, P = `${e}__helperText`, m = o(e, {
|
|
5
5
|
[c]: r,
|
|
6
6
|
[x]: d,
|
|
7
|
-
[
|
|
7
|
+
[u]: t,
|
|
8
8
|
[_]: l
|
|
9
|
-
}),
|
|
9
|
+
}), S = o(g, {
|
|
10
10
|
[F]: T,
|
|
11
11
|
[B]: n
|
|
12
|
-
})
|
|
12
|
+
}), f = `${e}__counter`;
|
|
13
13
|
return {
|
|
14
14
|
classProps: {
|
|
15
15
|
root: m,
|
|
16
|
-
label:
|
|
17
|
-
input:
|
|
16
|
+
label: S,
|
|
17
|
+
input: p,
|
|
18
18
|
helperText: P,
|
|
19
|
-
validationText:
|
|
20
|
-
passwordToggle:
|
|
19
|
+
validationText: $,
|
|
20
|
+
passwordToggle: C,
|
|
21
21
|
passwordToggleButton: b,
|
|
22
|
-
passwordToggleIcon: w
|
|
22
|
+
passwordToggleIcon: w,
|
|
23
|
+
counter: f
|
|
23
24
|
},
|
|
24
25
|
props: {
|
|
25
26
|
...a,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTextFieldBaseStyleProps.js","sources":["../../../src/components/TextFieldBase/useTextFieldBaseStyleProps.ts"],"sourcesContent":["import classNames from 'classnames';\nimport { useClassNamePrefix } from '../../hooks';\nimport { type SpiritTextFieldBaseProps, type TextFieldBaseProps } from '../../types';\n\nexport interface TextFieldBaseStyles {\n /** className props */\n classProps: {\n root: string;\n label: string;\n input: string;\n helperText: string;\n validationText: string;\n passwordToggle: string;\n passwordToggleButton: string;\n passwordToggleIcon: string;\n };\n /** props to be passed to the input element */\n props: Omit<TextFieldBaseProps, 'label'>;\n}\n\nexport function useTextFieldBaseStyleProps(props: Omit<SpiritTextFieldBaseProps, 'label'>): TextFieldBaseStyles {\n const { isFluid, isMultiline, isLabelHidden, size, validationState, ...restProps } = props;\n const { isDisabled, isRequired } = restProps;\n\n const TextFieldBaseClass = useClassNamePrefix(isMultiline ? 'TextArea' : 'TextField');\n const TextFieldBaseDisabledClass = `${TextFieldBaseClass}--disabled`;\n const TextFieldBaseFluidClass = `${TextFieldBaseClass}--fluid`;\n const TextFieldBaseSizeClass = `${TextFieldBaseClass}--${size}`;\n const TextFieldBaseValidationClass = `${TextFieldBaseClass}--${validationState}`;\n const TextFieldBaseInputClass = `${TextFieldBaseClass}__input`;\n const TextFieldBaseLabelClass = `${TextFieldBaseClass}__label`;\n const TextFieldBaseLabelRequiredClass = `${TextFieldBaseClass}__label--required`;\n const TextFieldBaseLabelHiddenClass = `${TextFieldBaseClass}__label--hidden`;\n const TextFieldBaseValidationTextClass = `${TextFieldBaseClass}__validationText`;\n const TextFieldBasePasswordToggleClass = `${TextFieldBaseClass}__passwordToggle`;\n const TextFieldBasePasswordToggleButtonClass = `${TextFieldBaseClass}__passwordToggle__button`;\n const TextFieldBasePasswordToggleIconClass = `${TextFieldBaseClass}__passwordToggle__icon`;\n const TextFieldBaseHelperTextClass = `${TextFieldBaseClass}__helperText`;\n\n const rootStyles = classNames(TextFieldBaseClass, {\n [TextFieldBaseDisabledClass]: isDisabled,\n [TextFieldBaseFluidClass]: isFluid,\n [TextFieldBaseValidationClass]: validationState,\n [TextFieldBaseSizeClass]: size,\n });\n const labelStyles = classNames(TextFieldBaseLabelClass, {\n [TextFieldBaseLabelRequiredClass]: isRequired,\n [TextFieldBaseLabelHiddenClass]: isLabelHidden,\n });\n\n return {\n classProps: {\n root: rootStyles,\n label: labelStyles,\n input: TextFieldBaseInputClass,\n helperText: TextFieldBaseHelperTextClass,\n validationText: TextFieldBaseValidationTextClass,\n passwordToggle: TextFieldBasePasswordToggleClass,\n passwordToggleButton: TextFieldBasePasswordToggleButtonClass,\n passwordToggleIcon: TextFieldBasePasswordToggleIconClass,\n },\n props: {\n ...restProps,\n isMultiline,\n },\n };\n}\n"],"names":["useTextFieldBaseStyleProps","props","isFluid","isMultiline","isLabelHidden","size","validationState","restProps","isDisabled","isRequired","TextFieldBaseClass","useClassNamePrefix","TextFieldBaseDisabledClass","TextFieldBaseFluidClass","TextFieldBaseSizeClass","TextFieldBaseValidationClass","TextFieldBaseInputClass","TextFieldBaseLabelClass","TextFieldBaseLabelRequiredClass","TextFieldBaseLabelHiddenClass","TextFieldBaseValidationTextClass","TextFieldBasePasswordToggleClass","TextFieldBasePasswordToggleButtonClass","TextFieldBasePasswordToggleIconClass","TextFieldBaseHelperTextClass","rootStyles","classNames","labelStyles"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useTextFieldBaseStyleProps.js","sources":["../../../src/components/TextFieldBase/useTextFieldBaseStyleProps.ts"],"sourcesContent":["import classNames from 'classnames';\nimport { useClassNamePrefix } from '../../hooks';\nimport { type SpiritTextFieldBaseProps, type TextFieldBaseProps } from '../../types';\n\nexport interface TextFieldBaseStyles {\n /** className props */\n classProps: {\n root: string;\n label: string;\n input: string;\n helperText: string;\n validationText: string;\n passwordToggle: string;\n passwordToggleButton: string;\n passwordToggleIcon: string;\n counter: string;\n };\n /** props to be passed to the input element */\n props: Omit<TextFieldBaseProps, 'label'>;\n}\n\nexport function useTextFieldBaseStyleProps(props: Omit<SpiritTextFieldBaseProps, 'label'>): TextFieldBaseStyles {\n const { isFluid, isMultiline, isLabelHidden, size, validationState, ...restProps } = props;\n const { isDisabled, isRequired } = restProps;\n\n const TextFieldBaseClass = useClassNamePrefix(isMultiline ? 'TextArea' : 'TextField');\n const TextFieldBaseDisabledClass = `${TextFieldBaseClass}--disabled`;\n const TextFieldBaseFluidClass = `${TextFieldBaseClass}--fluid`;\n const TextFieldBaseSizeClass = `${TextFieldBaseClass}--${size}`;\n const TextFieldBaseValidationClass = `${TextFieldBaseClass}--${validationState}`;\n const TextFieldBaseInputClass = `${TextFieldBaseClass}__input`;\n const TextFieldBaseLabelClass = `${TextFieldBaseClass}__label`;\n const TextFieldBaseLabelRequiredClass = `${TextFieldBaseClass}__label--required`;\n const TextFieldBaseLabelHiddenClass = `${TextFieldBaseClass}__label--hidden`;\n const TextFieldBaseValidationTextClass = `${TextFieldBaseClass}__validationText`;\n const TextFieldBasePasswordToggleClass = `${TextFieldBaseClass}__passwordToggle`;\n const TextFieldBasePasswordToggleButtonClass = `${TextFieldBaseClass}__passwordToggle__button`;\n const TextFieldBasePasswordToggleIconClass = `${TextFieldBaseClass}__passwordToggle__icon`;\n const TextFieldBaseHelperTextClass = `${TextFieldBaseClass}__helperText`;\n\n const rootStyles = classNames(TextFieldBaseClass, {\n [TextFieldBaseDisabledClass]: isDisabled,\n [TextFieldBaseFluidClass]: isFluid,\n [TextFieldBaseValidationClass]: validationState,\n [TextFieldBaseSizeClass]: size,\n });\n const labelStyles = classNames(TextFieldBaseLabelClass, {\n [TextFieldBaseLabelRequiredClass]: isRequired,\n [TextFieldBaseLabelHiddenClass]: isLabelHidden,\n });\n const counterStyles = `${TextFieldBaseClass}__counter`;\n\n return {\n classProps: {\n root: rootStyles,\n label: labelStyles,\n input: TextFieldBaseInputClass,\n helperText: TextFieldBaseHelperTextClass,\n validationText: TextFieldBaseValidationTextClass,\n passwordToggle: TextFieldBasePasswordToggleClass,\n passwordToggleButton: TextFieldBasePasswordToggleButtonClass,\n passwordToggleIcon: TextFieldBasePasswordToggleIconClass,\n counter: counterStyles,\n },\n props: {\n ...restProps,\n isMultiline,\n },\n };\n}\n"],"names":["useTextFieldBaseStyleProps","props","isFluid","isMultiline","isLabelHidden","size","validationState","restProps","isDisabled","isRequired","TextFieldBaseClass","useClassNamePrefix","TextFieldBaseDisabledClass","TextFieldBaseFluidClass","TextFieldBaseSizeClass","TextFieldBaseValidationClass","TextFieldBaseInputClass","TextFieldBaseLabelClass","TextFieldBaseLabelRequiredClass","TextFieldBaseLabelHiddenClass","TextFieldBaseValidationTextClass","TextFieldBasePasswordToggleClass","TextFieldBasePasswordToggleButtonClass","TextFieldBasePasswordToggleIconClass","TextFieldBaseHelperTextClass","rootStyles","classNames","labelStyles","counterStyles"],"mappings":";;AAqBO,SAASA,EAA2BC,GAAqE;AAC9G,QAAM,EAAE,SAAAC,GAAS,aAAAC,GAAa,eAAAC,GAAe,MAAAC,GAAM,iBAAAC,GAAiB,GAAGC,MAAcN,GAC/E,EAAE,YAAAO,GAAY,YAAAC,EAAA,IAAeF,GAE7BG,IAAqBC,EAAmBR,IAAc,aAAa,WAAW,GAC9ES,IAA6B,GAAGF,CAAkB,cAClDG,IAA0B,GAAGH,CAAkB,WAC/CI,IAAyB,GAAGJ,CAAkB,KAAKL,CAAI,IACvDU,IAA+B,GAAGL,CAAkB,KAAKJ,CAAe,IACxEU,IAA0B,GAAGN,CAAkB,WAC/CO,IAA0B,GAAGP,CAAkB,WAC/CQ,IAAkC,GAAGR,CAAkB,qBACvDS,IAAgC,GAAGT,CAAkB,mBACrDU,IAAmC,GAAGV,CAAkB,oBACxDW,IAAmC,GAAGX,CAAkB,oBACxDY,IAAyC,GAAGZ,CAAkB,4BAC9Da,IAAuC,GAAGb,CAAkB,0BAC5Dc,IAA+B,GAAGd,CAAkB,gBAEpDe,IAAaC,EAAWhB,GAAoB;AAAA,IAChD,CAACE,CAA0B,GAAGJ;AAAA,IAC9B,CAACK,CAAuB,GAAGX;AAAA,IAC3B,CAACa,CAA4B,GAAGT;AAAA,IAChC,CAACQ,CAAsB,GAAGT;AAAA,EAAA,CAC3B,GACKsB,IAAcD,EAAWT,GAAyB;AAAA,IACtD,CAACC,CAA+B,GAAGT;AAAA,IACnC,CAACU,CAA6B,GAAGf;AAAA,EAAA,CAClC,GACKwB,IAAgB,GAAGlB,CAAkB;AAE3C,SAAO;AAAA,IACL,YAAY;AAAA,MACV,MAAMe;AAAA,MACN,OAAOE;AAAA,MACP,OAAOX;AAAA,MACP,YAAYQ;AAAA,MACZ,gBAAgBJ;AAAA,MAChB,gBAAgBC;AAAA,MAChB,sBAAsBC;AAAA,MACtB,oBAAoBC;AAAA,MACpB,SAASK;AAAA,IAAA;AAAA,IAEX,OAAO;AAAA,MACL,GAAGrB;AAAA,MACH,aAAAJ;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),V=require("classnames"),u=require("react"),F=require("../../hooks/styleProps.cjs"),d=require("../../hooks/useAriaIdRefs.cjs"),I=require("../Field/HelperText.cjs"),$=require("../Field/Label.cjs"),B=require("../Field/ValidationText.cjs"),E=require("../Field/useValidationTextRole.cjs"),U=require("../InputDetails/InputDetails.cjs"),M=require("./useToggleStyleProps.cjs"),O=(p,g)=>{const{classProps:s,props:x}=M.useToggleStyleProps(p),{"aria-describedby":h="","aria-details":T,details:r,hasValidationIcon:y,id:t,isDisabled:m,isChecked:b=!1,isRequired:q,label:P,helperText:N,onChange:f=()=>{},validationState:a,validationText:l,...S}=x,{styleProps:o,props:A}=F.useStyleProps(S),[D,c]=d.useAriaDescribedBy(h),[_,j]=d.useAriaDetails(T),[v,R]=u.useState(b),C=E.useValidationTextRole({validationState:a,validationText:l}),k=n=>{R(n.target.checked),f(n)};return e.jsxs("div",{style:o.style,className:V(s.root,o.className),children:[e.jsxs("div",{className:s.text,children:[e.jsx($.default,{UNSAFE_className:s.label,htmlFor:t,children:P}),r&&e.jsx(U.default,{id:`${t}-details`,registerAriaDetails:j,children:r}),e.jsx(I.default,{UNSAFE_className:s.helperText,id:`${t}__helperText`,registerAria:c,helperText:N}),a&&e.jsx(B.default,{UNSAFE_className:s.validationText,...y&&{hasValidationStateIcon:a},id:`${t}__validationText`,validationText:l,registerAria:c,role:C})]}),e.jsx("input",{...A,...D,..._,type:"checkbox",id:t,className:s.input,disabled:m,checked:v,required:q,onChange:k,ref:g})]})},i=u.forwardRef(O);i.spiritComponent="Toggle";i.displayName="Toggle";exports.default=i;
|
|
2
2
|
//# sourceMappingURL=Toggle.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.cjs","sources":["../../../src/components/Toggle/Toggle.tsx"],"sourcesContent":["'use client';\n\nimport classNames from 'classnames';\nimport React, { type ChangeEvent, type ForwardedRef, forwardRef, useState } from 'react';\nimport { useAriaDescribedBy, useStyleProps } from '../../hooks';\nimport { type ForwardRefComponent, type SpiritToggleProps } from '../../types';\nimport { HelperText, Label, ValidationText
|
|
1
|
+
{"version":3,"file":"Toggle.cjs","sources":["../../../src/components/Toggle/Toggle.tsx"],"sourcesContent":["'use client';\n\nimport classNames from 'classnames';\nimport React, { type ChangeEvent, type ForwardedRef, forwardRef, useState } from 'react';\nimport { useAriaDescribedBy, useAriaDetails, useStyleProps } from '../../hooks';\nimport { type ForwardRefComponent, type SpiritToggleProps } from '../../types';\nimport { HelperText, Label, ValidationText } from '../Field';\nimport { useValidationTextRole } from '../Field/useValidationTextRole';\nimport { InputDetails } from '../InputDetails';\nimport { useToggleStyleProps } from './useToggleStyleProps';\n\nconst _Toggle = (props: SpiritToggleProps, ref: ForwardedRef<HTMLInputElement>) => {\n const { classProps, props: modifiedProps } = useToggleStyleProps(props);\n const {\n 'aria-describedby': ariaDescribedBy = '',\n 'aria-details': ariaDetailsAttr,\n details,\n hasValidationIcon,\n id,\n isDisabled,\n isChecked = false,\n isRequired,\n label,\n helperText,\n onChange = () => {},\n validationState,\n validationText,\n ...restProps\n } = modifiedProps;\n const { styleProps, props: otherProps } = useStyleProps(restProps);\n const [ariaDescribedByProp, register] = useAriaDescribedBy(ariaDescribedBy);\n const [ariaDetailsProp, registerDetails] = useAriaDetails(ariaDetailsAttr);\n const [checked, setChecked] = useState(isChecked);\n const validationTextRole = useValidationTextRole({\n validationState,\n validationText,\n });\n\n const handleOnChange = (event: ChangeEvent<HTMLInputElement>) => {\n setChecked(event.target.checked);\n onChange(event);\n };\n\n return (\n <div style={styleProps.style} className={classNames(classProps.root, styleProps.className)}>\n <div className={classProps.text}>\n <Label UNSAFE_className={classProps.label} htmlFor={id}>\n {label}\n </Label>\n {details && (\n <InputDetails id={`${id}-details`} registerAriaDetails={registerDetails}>\n {details}\n </InputDetails>\n )}\n <HelperText\n UNSAFE_className={classProps.helperText}\n id={`${id}__helperText`}\n registerAria={register}\n helperText={helperText}\n />\n {validationState && (\n <ValidationText\n UNSAFE_className={classProps.validationText}\n {...(hasValidationIcon && { hasValidationStateIcon: validationState })}\n id={`${id}__validationText`}\n validationText={validationText}\n registerAria={register}\n role={validationTextRole}\n />\n )}\n </div>\n <input\n {...otherProps}\n {...ariaDescribedByProp}\n {...ariaDetailsProp}\n type=\"checkbox\"\n id={id}\n className={classProps.input}\n disabled={isDisabled}\n checked={checked}\n required={isRequired}\n onChange={handleOnChange}\n ref={ref}\n />\n </div>\n );\n};\n\nconst Toggle = forwardRef<HTMLInputElement, SpiritToggleProps>(_Toggle) as ForwardRefComponent<\n HTMLInputElement,\n SpiritToggleProps\n>;\n\nToggle.spiritComponent = 'Toggle';\nToggle.displayName = 'Toggle';\n\nexport default Toggle;\n"],"names":["_Toggle","props","ref","classProps","modifiedProps","useToggleStyleProps","ariaDescribedBy","ariaDetailsAttr","details","hasValidationIcon","id","isDisabled","isChecked","isRequired","label","helperText","onChange","validationState","validationText","restProps","styleProps","otherProps","useStyleProps","ariaDescribedByProp","register","useAriaDescribedBy","ariaDetailsProp","registerDetails","useAriaDetails","checked","setChecked","useState","validationTextRole","useValidationTextRole","handleOnChange","event","jsxs","classNames","jsx","Label","InputDetails","HelperText","ValidationText","Toggle","forwardRef"],"mappings":"+gBAWMA,EAAU,CAACC,EAA0BC,IAAwC,CACjF,KAAM,CAAE,WAAAC,EAAY,MAAOC,CAAA,EAAkBC,EAAAA,oBAAoBJ,CAAK,EAChE,CACJ,mBAAoBK,EAAkB,GACtC,eAAgBC,EAChB,QAAAC,EACA,kBAAAC,EACA,GAAAC,EACA,WAAAC,EACA,UAAAC,EAAY,GACZ,WAAAC,EACA,MAAAC,EACA,WAAAC,EACA,SAAAC,EAAW,IAAM,CAAC,EAClB,gBAAAC,EACA,eAAAC,EACA,GAAGC,CAAA,EACDf,EACE,CAAA,WAAEgB,EAAY,MAAOC,CAAA,EAAeC,EAAAA,cAAcH,CAAS,EAC3D,CAACI,EAAqBC,CAAQ,EAAIC,EAAAA,mBAAmBnB,CAAe,EACpE,CAACoB,EAAiBC,CAAe,EAAIC,EAAAA,eAAerB,CAAe,EACnE,CAACsB,EAASC,CAAU,EAAIC,EAAAA,SAASnB,CAAS,EAC1CoB,EAAqBC,EAAAA,sBAAsB,CAC/C,gBAAAhB,EACA,eAAAC,CAAA,CACD,EAEKgB,EAAkBC,GAAyC,CAC/DL,EAAWK,EAAM,OAAO,OAAO,EAC/BnB,EAASmB,CAAK,CAChB,EAEA,OACEC,EAAAA,KAAC,MAAA,CAAI,MAAOhB,EAAW,MAAO,UAAWiB,EAAWlC,EAAW,KAAMiB,EAAW,SAAS,EACvF,SAAA,CAAAgB,EAAAA,KAAC,MAAA,CAAI,UAAWjC,EAAW,KACzB,SAAA,CAAAmC,MAACC,EAAAA,SAAM,iBAAkBpC,EAAW,MAAO,QAASO,EACjD,SAAAI,EACH,EACCN,SACEgC,EAAAA,QAAA,CAAa,GAAI,GAAG9B,CAAE,WAAY,oBAAqBiB,EACrD,SAAAnB,CAAA,CACH,EAEF8B,EAAAA,IAACG,EAAAA,QAAA,CACC,iBAAkBtC,EAAW,WAC7B,GAAI,GAAGO,CAAE,eACT,aAAcc,EACd,WAAAT,CAAA,CAAA,EAEDE,GACCqB,EAAAA,IAACI,EAAAA,QAAA,CACC,iBAAkBvC,EAAW,eAC5B,GAAIM,GAAqB,CAAE,uBAAwBQ,CAAA,EACpD,GAAI,GAAGP,CAAE,mBACT,eAAAQ,EACA,aAAcM,EACd,KAAMQ,CAAA,CAAA,CACR,EAEJ,EACAM,EAAAA,IAAC,QAAA,CACE,GAAGjB,EACH,GAAGE,EACH,GAAGG,EACJ,KAAK,WACL,GAAAhB,EACA,UAAWP,EAAW,MACtB,SAAUQ,EACV,QAAAkB,EACA,SAAUhB,EACV,SAAUqB,EACV,IAAAhC,CAAA,CAAA,CACF,EACF,CAEJ,EAEMyC,EAASC,EAAAA,WAAgD5C,CAAO,EAKtE2C,EAAO,gBAAkB,SACzBA,EAAO,YAAc"}
|
|
@@ -1,80 +1,84 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import { useStyleProps as
|
|
6
|
-
import { useAriaDescribedBy as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { useToggleStyleProps as
|
|
13
|
-
const
|
|
14
|
-
const { classProps: e, props:
|
|
15
|
-
"aria-describedby":
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
2
|
+
import { jsxs as c, jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import V from "classnames";
|
|
4
|
+
import { forwardRef as B, useState as E } from "react";
|
|
5
|
+
import { useStyleProps as I } from "../../hooks/styleProps.js";
|
|
6
|
+
import { useAriaDescribedBy as U, useAriaDetails as $ } from "../../hooks/useAriaIdRefs.js";
|
|
7
|
+
import j from "../Field/HelperText.js";
|
|
8
|
+
import q from "../Field/Label.js";
|
|
9
|
+
import w from "../Field/ValidationText.js";
|
|
10
|
+
import { useValidationTextRole as H } from "../Field/useValidationTextRole.js";
|
|
11
|
+
import L from "../InputDetails/InputDetails.js";
|
|
12
|
+
import { useToggleStyleProps as O } from "./useToggleStyleProps.js";
|
|
13
|
+
const z = (p, m) => {
|
|
14
|
+
const { classProps: e, props: h } = O(p), {
|
|
15
|
+
"aria-describedby": g = "",
|
|
16
|
+
"aria-details": f,
|
|
17
|
+
details: r,
|
|
18
|
+
hasValidationIcon: u,
|
|
19
|
+
id: t,
|
|
20
|
+
isDisabled: x,
|
|
21
|
+
isChecked: T = !1,
|
|
22
|
+
isRequired: N,
|
|
23
|
+
label: b,
|
|
24
|
+
helperText: y,
|
|
25
|
+
onChange: D = () => {
|
|
24
26
|
},
|
|
25
|
-
validationState:
|
|
26
|
-
validationText:
|
|
27
|
-
...
|
|
28
|
-
} =
|
|
29
|
-
validationState:
|
|
30
|
-
validationText:
|
|
31
|
-
}),
|
|
32
|
-
|
|
27
|
+
validationState: s,
|
|
28
|
+
validationText: a,
|
|
29
|
+
...A
|
|
30
|
+
} = h, { styleProps: o, props: P } = I(A), [S, l] = U(g), [_, v] = $(f), [C, k] = E(T), F = H({
|
|
31
|
+
validationState: s,
|
|
32
|
+
validationText: a
|
|
33
|
+
}), R = (d) => {
|
|
34
|
+
k(d.target.checked), D(d);
|
|
33
35
|
};
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
|
|
36
|
+
return /* @__PURE__ */ c("div", { style: o.style, className: V(e.root, o.className), children: [
|
|
37
|
+
/* @__PURE__ */ c("div", { className: e.text, children: [
|
|
38
|
+
/* @__PURE__ */ i(q, { UNSAFE_className: e.label, htmlFor: t, children: b }),
|
|
39
|
+
r && /* @__PURE__ */ i(L, { id: `${t}-details`, registerAriaDetails: v, children: r }),
|
|
40
|
+
/* @__PURE__ */ i(
|
|
41
|
+
j,
|
|
39
42
|
{
|
|
40
43
|
UNSAFE_className: e.helperText,
|
|
41
|
-
id: `${
|
|
42
|
-
registerAria:
|
|
43
|
-
helperText:
|
|
44
|
+
id: `${t}__helperText`,
|
|
45
|
+
registerAria: l,
|
|
46
|
+
helperText: y
|
|
44
47
|
}
|
|
45
48
|
),
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
s && /* @__PURE__ */ i(
|
|
50
|
+
w,
|
|
48
51
|
{
|
|
49
52
|
UNSAFE_className: e.validationText,
|
|
50
|
-
...
|
|
51
|
-
id: `${
|
|
52
|
-
validationText:
|
|
53
|
-
registerAria:
|
|
54
|
-
role:
|
|
53
|
+
...u && { hasValidationStateIcon: s },
|
|
54
|
+
id: `${t}__validationText`,
|
|
55
|
+
validationText: a,
|
|
56
|
+
registerAria: l,
|
|
57
|
+
role: F
|
|
55
58
|
}
|
|
56
59
|
)
|
|
57
60
|
] }),
|
|
58
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ i(
|
|
59
62
|
"input",
|
|
60
63
|
{
|
|
61
64
|
...P,
|
|
65
|
+
...S,
|
|
62
66
|
..._,
|
|
63
67
|
type: "checkbox",
|
|
64
|
-
id:
|
|
68
|
+
id: t,
|
|
65
69
|
className: e.input,
|
|
66
|
-
disabled:
|
|
67
|
-
checked:
|
|
68
|
-
required:
|
|
69
|
-
onChange:
|
|
70
|
+
disabled: x,
|
|
71
|
+
checked: C,
|
|
72
|
+
required: N,
|
|
73
|
+
onChange: R,
|
|
70
74
|
ref: m
|
|
71
75
|
}
|
|
72
76
|
)
|
|
73
77
|
] });
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
}, n = B(z);
|
|
79
|
+
n.spiritComponent = "Toggle";
|
|
80
|
+
n.displayName = "Toggle";
|
|
77
81
|
export {
|
|
78
|
-
|
|
82
|
+
n as default
|
|
79
83
|
};
|
|
80
84
|
//# sourceMappingURL=Toggle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.js","sources":["../../../src/components/Toggle/Toggle.tsx"],"sourcesContent":["'use client';\n\nimport classNames from 'classnames';\nimport React, { type ChangeEvent, type ForwardedRef, forwardRef, useState } from 'react';\nimport { useAriaDescribedBy, useStyleProps } from '../../hooks';\nimport { type ForwardRefComponent, type SpiritToggleProps } from '../../types';\nimport { HelperText, Label, ValidationText
|
|
1
|
+
{"version":3,"file":"Toggle.js","sources":["../../../src/components/Toggle/Toggle.tsx"],"sourcesContent":["'use client';\n\nimport classNames from 'classnames';\nimport React, { type ChangeEvent, type ForwardedRef, forwardRef, useState } from 'react';\nimport { useAriaDescribedBy, useAriaDetails, useStyleProps } from '../../hooks';\nimport { type ForwardRefComponent, type SpiritToggleProps } from '../../types';\nimport { HelperText, Label, ValidationText } from '../Field';\nimport { useValidationTextRole } from '../Field/useValidationTextRole';\nimport { InputDetails } from '../InputDetails';\nimport { useToggleStyleProps } from './useToggleStyleProps';\n\nconst _Toggle = (props: SpiritToggleProps, ref: ForwardedRef<HTMLInputElement>) => {\n const { classProps, props: modifiedProps } = useToggleStyleProps(props);\n const {\n 'aria-describedby': ariaDescribedBy = '',\n 'aria-details': ariaDetailsAttr,\n details,\n hasValidationIcon,\n id,\n isDisabled,\n isChecked = false,\n isRequired,\n label,\n helperText,\n onChange = () => {},\n validationState,\n validationText,\n ...restProps\n } = modifiedProps;\n const { styleProps, props: otherProps } = useStyleProps(restProps);\n const [ariaDescribedByProp, register] = useAriaDescribedBy(ariaDescribedBy);\n const [ariaDetailsProp, registerDetails] = useAriaDetails(ariaDetailsAttr);\n const [checked, setChecked] = useState(isChecked);\n const validationTextRole = useValidationTextRole({\n validationState,\n validationText,\n });\n\n const handleOnChange = (event: ChangeEvent<HTMLInputElement>) => {\n setChecked(event.target.checked);\n onChange(event);\n };\n\n return (\n <div style={styleProps.style} className={classNames(classProps.root, styleProps.className)}>\n <div className={classProps.text}>\n <Label UNSAFE_className={classProps.label} htmlFor={id}>\n {label}\n </Label>\n {details && (\n <InputDetails id={`${id}-details`} registerAriaDetails={registerDetails}>\n {details}\n </InputDetails>\n )}\n <HelperText\n UNSAFE_className={classProps.helperText}\n id={`${id}__helperText`}\n registerAria={register}\n helperText={helperText}\n />\n {validationState && (\n <ValidationText\n UNSAFE_className={classProps.validationText}\n {...(hasValidationIcon && { hasValidationStateIcon: validationState })}\n id={`${id}__validationText`}\n validationText={validationText}\n registerAria={register}\n role={validationTextRole}\n />\n )}\n </div>\n <input\n {...otherProps}\n {...ariaDescribedByProp}\n {...ariaDetailsProp}\n type=\"checkbox\"\n id={id}\n className={classProps.input}\n disabled={isDisabled}\n checked={checked}\n required={isRequired}\n onChange={handleOnChange}\n ref={ref}\n />\n </div>\n );\n};\n\nconst Toggle = forwardRef<HTMLInputElement, SpiritToggleProps>(_Toggle) as ForwardRefComponent<\n HTMLInputElement,\n SpiritToggleProps\n>;\n\nToggle.spiritComponent = 'Toggle';\nToggle.displayName = 'Toggle';\n\nexport default Toggle;\n"],"names":["_Toggle","props","ref","classProps","modifiedProps","useToggleStyleProps","ariaDescribedBy","ariaDetailsAttr","details","hasValidationIcon","id","isDisabled","isChecked","isRequired","label","helperText","onChange","validationState","validationText","restProps","styleProps","otherProps","useStyleProps","ariaDescribedByProp","register","useAriaDescribedBy","ariaDetailsProp","registerDetails","useAriaDetails","checked","setChecked","useState","validationTextRole","useValidationTextRole","handleOnChange","event","jsxs","classNames","jsx","Label","InputDetails","HelperText","ValidationText","Toggle","forwardRef"],"mappings":";;;;;;;;;;;;AAWA,MAAMA,IAAU,CAACC,GAA0BC,MAAwC;AACjF,QAAM,EAAE,YAAAC,GAAY,OAAOC,EAAA,IAAkBC,EAAoBJ,CAAK,GAChE;AAAA,IACJ,oBAAoBK,IAAkB;AAAA,IACtC,gBAAgBC;AAAA,IAChB,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,IAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,YAAAC;AAAA,IACA,OAAAC;AAAA,IACA,YAAAC;AAAA,IACA,UAAAC,IAAW,MAAM;AAAA,IAAC;AAAA,IAClB,iBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDf,GACE,EAAE,YAAAgB,GAAY,OAAOC,EAAA,IAAeC,EAAcH,CAAS,GAC3D,CAACI,GAAqBC,CAAQ,IAAIC,EAAmBnB,CAAe,GACpE,CAACoB,GAAiBC,CAAe,IAAIC,EAAerB,CAAe,GACnE,CAACsB,GAASC,CAAU,IAAIC,EAASnB,CAAS,GAC1CoB,IAAqBC,EAAsB;AAAA,IAC/C,iBAAAhB;AAAA,IACA,gBAAAC;AAAA,EAAA,CACD,GAEKgB,IAAiB,CAACC,MAAyC;AAC/D,IAAAL,EAAWK,EAAM,OAAO,OAAO,GAC/BnB,EAASmB,CAAK;AAAA,EAChB;AAEA,SACE,gBAAAC,EAAC,OAAA,EAAI,OAAOhB,EAAW,OAAO,WAAWiB,EAAWlC,EAAW,MAAMiB,EAAW,SAAS,GACvF,UAAA;AAAA,IAAA,gBAAAgB,EAAC,OAAA,EAAI,WAAWjC,EAAW,MACzB,UAAA;AAAA,MAAA,gBAAAmC,EAACC,KAAM,kBAAkBpC,EAAW,OAAO,SAASO,GACjD,UAAAI,GACH;AAAA,MACCN,uBACEgC,GAAA,EAAa,IAAI,GAAG9B,CAAE,YAAY,qBAAqBiB,GACrD,UAAAnB,EAAA,CACH;AAAA,MAEF,gBAAA8B;AAAA,QAACG;AAAA,QAAA;AAAA,UACC,kBAAkBtC,EAAW;AAAA,UAC7B,IAAI,GAAGO,CAAE;AAAA,UACT,cAAcc;AAAA,UACd,YAAAT;AAAA,QAAA;AAAA,MAAA;AAAA,MAEDE,KACC,gBAAAqB;AAAA,QAACI;AAAA,QAAA;AAAA,UACC,kBAAkBvC,EAAW;AAAA,UAC5B,GAAIM,KAAqB,EAAE,wBAAwBQ,EAAA;AAAA,UACpD,IAAI,GAAGP,CAAE;AAAA,UACT,gBAAAQ;AAAA,UACA,cAAcM;AAAA,UACd,MAAMQ;AAAA,QAAA;AAAA,MAAA;AAAA,IACR,GAEJ;AAAA,IACA,gBAAAM;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAGjB;AAAA,QACH,GAAGE;AAAA,QACH,GAAGG;AAAA,QACJ,MAAK;AAAA,QACL,IAAAhB;AAAA,QACA,WAAWP,EAAW;AAAA,QACtB,UAAUQ;AAAA,QACV,SAAAkB;AAAA,QACA,UAAUhB;AAAA,QACV,UAAUqB;AAAA,QACV,KAAAhC;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ,GAEMyC,IAASC,EAAgD5C,CAAO;AAKtE2C,EAAO,kBAAkB;AACzBA,EAAO,cAAc;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),L=require("classnames"),U=require("../../hooks/styleProps.cjs"),R=require("../../hooks/useClassNamePrefix.cjs"),V=require("../../hooks/useI18n.cjs"),N=require("../ControlButton/ControlButton.cjs"),D=require("../Field/ValidationText.cjs"),O=require("../Field/useValidationTextRole.cjs"),z=require("../Flex/Flex.cjs"),a=require("../Icon/Icon.cjs"),T=require("../VisuallyHidden/VisuallyHidden.cjs"),j=require("./constants.cjs"),M=require("./useFileStyleProps.cjs"),w={elementType:"li",iconName:j.DEFAULT_FILE_ICON_NAME},o=f=>{const v={...w,...f},{t:r}=V.useI18n(),{editText:S,elementType:P,hasValidationIcon:_,helperText:c,iconName:q,id:n,isDisabled:d,label:y,onDismiss:u,onChange:m,previewSlot:C,removeText:F,validationState:s,validationText:x,...A}=v,E=S??r("attachment.edit"),I=F??r("attachment.remove"),{classProps:t}=M.useFileStyleProps({isDisabled:d,validationState:s}),{styleProps:p,props:b}=U.useStyleProps(A),g=O.useValidationTextRole({validationState:s,validationText:x}),h={size:"large",isSymmetrical:!0,isDisabled:d},i=m?e.jsxs(N.default,{...h,onClick:m,children:[e.jsx(T.default,{children:E}),e.jsx(a.default,{name:j.DEFAULT_FILE_ACTION_BUTTON_ICON_NAME,boxSize:16,"aria-hidden":"true"})]}):null,l=u?e.jsxs(N.default,{...h,onClick:u,children:[e.jsx(T.default,{children:I}),e.jsx(a.default,{name:"close",boxSize:16,"aria-hidden":"true"})]}):null,B=P;return e.jsxs(B,{...b,...p,...n!=null&&n!==""?{id:n}:{},className:L(t.root,p.className),children:[C??e.jsx("div",{className:t.preview,children:e.jsx(a.default,{name:q,boxSize:20,"aria-hidden":"true"})}),e.jsx("div",{className:t.content,children:e.jsxs("div",{className:t.text,children:[e.jsx("span",{className:t.name,children:e.jsx("span",{className:R.useClassNamePrefix("text-truncate"),children:y})}),c&&e.jsx("div",{className:t.helperText,children:c}),s&&e.jsx(D.default,{UNSAFE_className:t.validationText,elementType:"div",..._&&{hasValidationStateIcon:s},role:g,validationText:x})]})}),i&&l?e.jsxs(z.default,{alignmentX:{mobile:"stretch",tablet:"left"},alignmentY:"stretch",spacingX:"space-500",children:[i,l]}):e.jsxs(e.Fragment,{children:[i,l]})]})};o.spiritComponent="UNSTABLE_File";o.displayName="UNSTABLE_File";exports.default=o;
|
|
2
|
+
//# sourceMappingURL=UNSTABLE_File.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UNSTABLE_File.cjs","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","Component","classNames","useClassNamePrefix","ValidationText","Flex","Fragment"],"mappings":"4mBAeMA,EAAe,CACnB,YAAa,KACb,SAAUC,EAAAA,sBACZ,EAEMC,EAA+CC,GAAmD,CACtG,MAAMC,EAAoB,CAAE,GAAGJ,EAAc,GAAGG,CAAA,EAC1C,CAAE,EAAAE,CAAA,EAAMC,UAAA,EACR,CACJ,SAAAC,EACA,YAAAC,EACA,kBAAAC,EACA,WAAAC,EACA,SAAAC,EACA,GAAAC,EACA,WAAAC,EACA,MAAAC,EACA,UAAAC,EACA,SAAAC,EACA,YAAAC,EACA,WAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,GAAGC,CAAA,EACDjB,EAEEkB,EAAmBf,GAAYF,EAAE,iBAAiB,EAClDkB,EAAqBL,GAAcb,EAAE,mBAAmB,EACxD,CAAE,WAAAmB,CAAA,EAAeC,EAAAA,kBAAkB,CAAE,WAAAZ,EAAY,gBAAAM,EAAiB,EAClE,CAAA,WAAEO,EAAY,MAAOC,CAAA,EAAkBC,EAAAA,cAAcP,CAAS,EAC9DQ,EAAqBC,EAAAA,sBAAsB,CAC/C,gBAAAX,EACA,eAAAC,CAAA,CACD,EAEKW,EAA4B,CAChC,KAAM,QACN,cAAe,GACf,WAAAlB,CAAA,EAGImB,EAAmBhB,EACvBiB,EAAAA,KAACC,EAAAA,SAAe,GAAGH,EAA2B,QAASf,EACrD,SAAA,CAAAmB,EAAAA,IAACC,EAAAA,SAAgB,SAAAd,CAAA,CAAiB,QACjCe,EAAAA,QAAA,CAAK,KAAMC,EAAAA,qCAAsC,QAAS,GAAI,cAAY,MAAA,CAAO,CAAA,CAAA,CACpF,EACE,KAEEC,EAAsBxB,EAC1BkB,EAAAA,KAACC,EAAAA,SAAe,GAAGH,EAA2B,QAAShB,EACrD,SAAA,CAAAoB,EAAAA,IAACC,EAAAA,SAAgB,SAAAb,CAAA,CAAmB,QACnCc,EAAAA,QAAA,CAAK,KAAK,QAAQ,QAAS,GAAI,cAAY,MAAA,CAAO,CAAA,CAAA,CACrD,EACE,KAEEG,EAAYhC,EAElB,OACEyB,EAAAA,KAACO,EAAA,CACE,GAAGb,EACH,GAAGD,EACH,GAAId,GAAM,MAAQA,IAAO,GAAK,CAAE,GAAAA,CAAA,EAAO,CAAA,EACxC,UAAW6B,EAAWjB,EAAW,KAAME,EAAW,SAAS,EAE1D,SAAA,CAAAT,GACCkB,EAAAA,IAAC,MAAA,CAAI,UAAWX,EAAW,QACzB,SAAAW,EAAAA,IAACE,EAAAA,QAAA,CAAK,KAAM1B,EAAU,QAAS,GAAI,cAAY,OAAO,EACxD,EAEFwB,EAAAA,IAAC,OAAI,UAAWX,EAAW,QACzB,SAAAS,EAAAA,KAAC,MAAA,CAAI,UAAWT,EAAW,KACzB,SAAA,CAAAW,EAAAA,IAAC,OAAA,CAAK,UAAWX,EAAW,KAC1B,SAAAW,EAAAA,IAAC,OAAA,CAAK,UAAWO,EAAAA,mBAAmB,eAAe,EAAI,SAAA5B,CAAA,CAAM,EAC/D,EACCJ,GAAcyB,EAAAA,IAAC,MAAA,CAAI,UAAWX,EAAW,WAAa,SAAAd,EAAW,EACjES,GACCgB,EAAAA,IAACQ,EAAAA,QAAA,CACC,iBAAkBnB,EAAW,eAC7B,YAAY,MACX,GAAIf,GAAqB,CAAE,uBAAwBU,CAAA,EACpD,KAAMU,EACN,eAAAT,CAAA,CAAA,CACF,CAAA,CAEJ,CAAA,CACF,EACCY,GAAoBO,EACnBN,EAAAA,KAACW,EAAAA,QAAA,CAAK,WAAY,CAAE,OAAQ,UAAW,OAAQ,MAAA,EAAU,WAAW,UAAU,SAAS,YACpF,SAAA,CAAAZ,EACAO,CAAA,CAAA,CACH,EAEAN,EAAAA,KAAAY,EAAAA,SAAA,CACG,SAAA,CAAAb,EACAO,CAAA,CAAA,CACH,CAAA,CAAA,CAAA,CAIR,EAEArC,EAAc,gBAAkB,gBAChCA,EAAc,YAAc"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ElementType } from 'react';
|
|
2
|
+
import { SpiritUnstableFileProps } from './types';
|
|
3
|
+
declare const UNSTABLE_File: {
|
|
4
|
+
<E extends ElementType = "li">(props: SpiritUnstableFileProps<E>): JSX.Element;
|
|
5
|
+
spiritComponent: string;
|
|
6
|
+
displayName: string;
|
|
7
|
+
};
|
|
8
|
+
export default UNSTABLE_File;
|