@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 @@
|
|
|
1
|
+
{"version":3,"file":"UNSTABLE_Picker.cjs","sources":["../../../src/components/UNSTABLE_Picker/UNSTABLE_Picker.tsx"],"sourcesContent":["'use client';\n\nimport classNames from 'classnames';\nimport React, { type ForwardedRef, forwardRef, useCallback, useImperativeHandle, useMemo, useRef } from 'react';\nimport { MULTIPLE_SELECTION_MODE } from '../../constants';\nimport { getSelectedKeys, isSingleSelectionMode, useAriaDescribedBy, useI18n, useStyleProps } from '../../hooks';\nimport { replaceTranslationParams } from '../../translations';\nimport { type ForwardRefComponent } from '../../types';\nimport { Dropdown, DropdownPopover } from '../Dropdown';\nimport { HelperText, Label, ValidationText } from '../Field';\nimport { useValidationTextRole } from '../Field/useValidationTextRole';\nimport { Icon } from '../Icon';\nimport { VisuallyHidden } from '../VisuallyHidden';\nimport { DEFAULT_SIZE } from './constants';\nimport { PickerContextProvider } from './PickerContext';\nimport { PickerPopoverContextProvider } from './PickerPopoverContext';\nimport type { SpiritUnstablePickerProps, SpiritUnstablePickerRef } from './types';\nimport UNSTABLE_PickerTag from './UNSTABLE_PickerTag';\nimport { usePickerId } from './usePickerId';\nimport { usePickerPopoverTabOutToTrigger } from './usePickerPopoverTabOutToTrigger';\nimport { usePickerSelectionGridKeyboard } from './usePickerSelectionGridKeyboard';\nimport { usePickerStyleProps } from './usePickerStyleProps';\nimport {\n collectPickerItems,\n getAggregatedTagLabel,\n getPickerItemLabelMap,\n getPickerSelectionGridKeyboardRowCount,\n getSelectedItems,\n} from './utils';\n\n// eslint-disable-next-line camelcase\nconst _UNSTABLE_Picker = (props: SpiritUnstablePickerProps, ref: ForwardedRef<SpiritUnstablePickerRef>) => {\n const { t } = useI18n();\n\n const {\n 'aria-describedby': ariaDescribedBy = '',\n addButtonLabel = t('picker.add'),\n children,\n closeButtonLabel = t('common.close'),\n emptySelectionLabel,\n helperText,\n id,\n isAggregated = false,\n isDisabled = false,\n isFluid = false,\n isLabelHidden = false,\n isOpen,\n isRequired = false,\n label,\n onSelectionChange,\n onToggle,\n removeAllLabel = t('picker.removeAll'),\n renderTags,\n selectedKeys,\n selectionAriaLabel = t('picker.selectionAriaLabel'),\n selectionMode = MULTIPLE_SELECTION_MODE,\n size = DEFAULT_SIZE,\n tagDescriptionText = t('picker.tagDescriptionText'),\n hasValidationIcon,\n validationState,\n validationText,\n ...restProps\n } = props;\n\n const [ariaDescribedByProp, register] = useAriaDescribedBy(ariaDescribedBy);\n const validationTextRole = useValidationTextRole({\n validationState,\n validationText,\n });\n const { classProps } = usePickerStyleProps({\n isDisabled,\n isFluid,\n isLabelHidden,\n isRequired,\n size,\n validationState,\n });\n const { styleProps, props: transferProps } = useStyleProps(restProps);\n const { labelId, pickerId, popoverId, selectionId, tagDescriptionId } = usePickerId(id);\n\n const pickerItems = useMemo(() => collectPickerItems(children), [children]);\n\n const pickerItemLabels = useMemo(() => getPickerItemLabelMap(pickerItems), [pickerItems]);\n\n const selectedPickerKeys = useMemo(() => getSelectedKeys(selectedKeys, selectionMode), [selectedKeys, selectionMode]);\n\n const selectedPickerItems = useMemo(\n () => getSelectedItems(selectedPickerKeys, pickerItemLabels),\n [selectedPickerKeys, pickerItemLabels],\n );\n\n const removeItem = (key: string) =>\n isSingleSelectionMode(selectionMode)\n ? onSelectionChange([])\n : onSelectionChange(selectedKeys.filter((selectedKey) => selectedKey !== key));\n\n const removeAll = () => onSelectionChange([]);\n\n const selectionGridRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n\n const close = useCallback(() => {\n if (!isOpen) {\n return;\n }\n\n onToggle();\n\n Promise.resolve().then(() => {\n triggerRef.current?.focus();\n });\n }, [isOpen, onToggle]);\n\n const { onPopoverKeyDownCapture } = usePickerPopoverTabOutToTrigger({\n isOpen,\n onClose: close,\n });\n\n const selectionGridKeyboardRowCount = getPickerSelectionGridKeyboardRowCount(selectedPickerItems.length, {\n isAggregated,\n });\n\n const { getKeyboardGridRowProps, removeTagAtIndex } = usePickerSelectionGridKeyboard({\n isDisabled,\n isPopoverOpen: isOpen,\n onRemoveAtIndex: (index) => {\n if (isAggregated) {\n removeAll();\n } else {\n removeItem(selectedPickerItems[index]!.value);\n }\n },\n selectionRef: selectionGridRef,\n tagCount: selectionGridKeyboardRowCount,\n });\n\n const emptyLabel = emptySelectionLabel ? replaceTranslationParams(emptySelectionLabel, { label }) : label;\n const aggregatedTagLabel = getAggregatedTagLabel(label, selectedPickerItems);\n\n const selectionContent = (() => {\n if (!selectedPickerItems.length) {\n return (\n <span aria-hidden=\"true\" className={classProps.selectionEmpty}>\n {emptyLabel}\n </span>\n );\n }\n\n if (renderTags) {\n return renderTags({\n getKeyboardGridRowProps,\n onRemove: removeItem,\n removeTagAtIndex,\n });\n }\n\n if (isAggregated) {\n return (\n <UNSTABLE_PickerTag\n tagKeyboardProps={getKeyboardGridRowProps(0)}\n isDisabled={isDisabled}\n label={aggregatedTagLabel}\n onRemove={() => removeTagAtIndex(0)}\n removeLabel={removeAllLabel}\n />\n );\n }\n\n return selectedPickerItems.map((item, index) => (\n <UNSTABLE_PickerTag\n key={item.value}\n tagKeyboardProps={getKeyboardGridRowProps(index)}\n isDisabled={isDisabled}\n label={item.label}\n onRemove={() => removeTagAtIndex(index)}\n />\n ));\n })();\n\n const popoverContextValue = useMemo(\n () => ({\n id: pickerId,\n isDisabled,\n onSelectionChange,\n selectedKeys: selectedPickerKeys,\n selectionMode,\n }),\n [selectedPickerKeys, isDisabled, onSelectionChange, pickerId, selectionMode],\n );\n\n useImperativeHandle(\n ref,\n () => ({\n close,\n selectedKeys,\n }),\n [close, selectedKeys],\n );\n\n return (\n <PickerContextProvider value={{ size, tagDescriptionId }}>\n <div {...styleProps} className={classNames(classProps.root, styleProps.className)} {...transferProps}>\n <Label id={labelId} UNSAFE_className={classProps.label} elementType=\"span\">\n {label}\n </Label>\n <Dropdown id={popoverId} isOpen={isOpen} onToggle={onToggle}>\n <div role=\"group\" aria-label={label} className={classProps.inputContainer}>\n <div\n ref={selectionGridRef}\n {...ariaDescribedByProp}\n id={selectionId}\n role={selectedPickerItems.length ? 'grid' : 'group'}\n aria-label={replaceTranslationParams(selectionAriaLabel, { label })}\n aria-live=\"off\"\n aria-atomic={false}\n aria-relevant=\"additions\"\n className={classProps.selection}\n >\n {selectionContent}\n </div>\n <button\n ref={triggerRef}\n type=\"button\"\n className={classProps.trigger}\n aria-haspopup=\"dialog\"\n aria-expanded={isOpen}\n aria-controls={popoverId}\n onClick={onToggle}\n disabled={isDisabled}\n >\n <VisuallyHidden>{isOpen ? closeButtonLabel : addButtonLabel}</VisuallyHidden>\n <Icon name={`chevron-${isOpen ? 'up' : 'down'}`} boxSize={20} />\n </button>\n </div>\n <DropdownPopover\n aria-labelledby={labelId}\n role=\"dialog\"\n aria-modal=\"true\"\n onKeyDownCapture={onPopoverKeyDownCapture}\n >\n <PickerPopoverContextProvider value={popoverContextValue}>{children}</PickerPopoverContextProvider>\n </DropdownPopover>\n </Dropdown>\n <HelperText\n UNSAFE_className={classProps.helperText}\n id={`${pickerId}-helper-text`}\n registerAria={register}\n helperText={helperText}\n />\n {validationState && (\n <ValidationText\n UNSAFE_className={classProps.validationText}\n id={`${pickerId}-validation-text`}\n {...(hasValidationIcon && { hasValidationStateIcon: validationState })}\n validationText={validationText}\n registerAria={register}\n role={validationTextRole}\n />\n )}\n <span id={tagDescriptionId} hidden>\n {tagDescriptionText}\n </span>\n </div>\n </PickerContextProvider>\n );\n};\n\nconst UNSTABLE_Picker = forwardRef<SpiritUnstablePickerRef, SpiritUnstablePickerProps>(\n _UNSTABLE_Picker,\n) as ForwardRefComponent<SpiritUnstablePickerRef, SpiritUnstablePickerProps>;\n\nUNSTABLE_Picker.spiritComponent = 'UNSTABLE_Picker';\nUNSTABLE_Picker.displayName = 'UNSTABLE_Picker';\n\nexport default UNSTABLE_Picker;\n"],"names":["_UNSTABLE_Picker","props","ref","t","useI18n","ariaDescribedBy","addButtonLabel","children","closeButtonLabel","emptySelectionLabel","helperText","id","isAggregated","isDisabled","isFluid","isLabelHidden","isOpen","isRequired","label","onSelectionChange","onToggle","removeAllLabel","renderTags","selectedKeys","selectionAriaLabel","selectionMode","MULTIPLE_SELECTION_MODE","size","DEFAULT_SIZE","tagDescriptionText","hasValidationIcon","validationState","validationText","restProps","ariaDescribedByProp","register","useAriaDescribedBy","validationTextRole","useValidationTextRole","classProps","usePickerStyleProps","styleProps","transferProps","useStyleProps","labelId","pickerId","popoverId","selectionId","tagDescriptionId","usePickerId","pickerItems","useMemo","collectPickerItems","pickerItemLabels","getPickerItemLabelMap","selectedPickerKeys","getSelectedKeys","selectedPickerItems","getSelectedItems","removeItem","key","isSingleSelectionMode","selectedKey","removeAll","selectionGridRef","useRef","triggerRef","close","useCallback","onPopoverKeyDownCapture","usePickerPopoverTabOutToTrigger","selectionGridKeyboardRowCount","getPickerSelectionGridKeyboardRowCount","getKeyboardGridRowProps","removeTagAtIndex","usePickerSelectionGridKeyboard","index","emptyLabel","replaceTranslationParams","aggregatedTagLabel","getAggregatedTagLabel","selectionContent","jsx","UNSTABLE_PickerTag","item","popoverContextValue","useImperativeHandle","PickerContextProvider","jsxs","classNames","Label","Dropdown","VisuallyHidden","Icon","DropdownPopover","PickerPopoverContextProvider","HelperText","ValidationText","UNSTABLE_Picker","forwardRef"],"mappings":"6nCA+BMA,GAAmB,CAACC,EAAkCC,IAA+C,CACzG,KAAM,CAAE,EAAAC,CAAA,EAAMC,WAAA,EAER,CACJ,mBAAoBC,EAAkB,GACtC,eAAAC,EAAiBH,EAAE,YAAY,EAC/B,SAAAI,EACA,iBAAAC,EAAmBL,EAAE,cAAc,EACnC,oBAAAM,EACA,WAAAC,EACA,GAAAC,EACA,aAAAC,EAAe,GACf,WAAAC,EAAa,GACb,QAAAC,EAAU,GACV,cAAAC,EAAgB,GAChB,OAAAC,EACA,WAAAC,EAAa,GACb,MAAAC,EACA,kBAAAC,EACA,SAAAC,EACA,eAAAC,EAAiBlB,EAAE,kBAAkB,EACrC,WAAAmB,EACA,aAAAC,EACA,mBAAAC,EAAqBrB,EAAE,2BAA2B,EAClD,cAAAsB,EAAgBC,GAAAA,wBAChB,KAAAC,EAAOC,GAAAA,aACP,mBAAAC,EAAqB1B,EAAE,2BAA2B,EAClD,kBAAA2B,GACA,gBAAAC,EACA,eAAAC,EACA,GAAGC,EAAA,EACDhC,EAEE,CAACiC,GAAqBC,CAAQ,EAAIC,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CAAS,CAAA,CAAA,CACtE,EACF,EACA2E,EAAAA,IAACc,GAAAA,QAAA,CACC,iBAAkBzD,EAAW,WAC7B,GAAI,GAAGM,CAAQ,eACf,aAAcV,EACd,WAAAzB,CAAA,CAAA,EAEDqB,GACCmD,EAAAA,IAACe,GAAAA,QAAA,CACC,iBAAkB1D,EAAW,eAC7B,GAAI,GAAGM,CAAQ,mBACd,GAAIf,IAAqB,CAAE,uBAAwBC,CAAA,EACpD,eAAAC,EACA,aAAcG,EACd,KAAME,EAAA,CAAA,QAGT,OAAA,CAAK,GAAIW,EAAkB,OAAM,GAC/B,SAAAnB,CAAA,CACH,CAAA,CAAA,CACF,CAAA,CACF,CAEJ,EAEMqE,EAAkBC,EAAAA,WACtBnG,EACF,EAEAkG,EAAgB,gBAAkB,kBAClCA,EAAgB,YAAc"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as e, jsxs as v } from "react/jsx-runtime";
|
|
3
|
+
import fe from "classnames";
|
|
4
|
+
import { forwardRef as ue, useMemo as m, useRef as w, useCallback as ge, useImperativeHandle as be } from "react";
|
|
5
|
+
import { MULTIPLE_SELECTION_MODE as ve } from "../../constants/selection.js";
|
|
6
|
+
import { useStyleProps as Pe } from "../../hooks/styleProps.js";
|
|
7
|
+
import { useAriaDescribedBy as Te } from "../../hooks/useAriaIdRefs.js";
|
|
8
|
+
import { useI18n as ye } from "../../hooks/useI18n.js";
|
|
9
|
+
import { getSelectedKeys as he, isSingleSelectionMode as ke } from "../../hooks/useSelectionState.js";
|
|
10
|
+
import { replaceTranslationParams as M } from "../../translations/replaceTranslationParams.js";
|
|
11
|
+
import Ie from "../Dropdown/Dropdown.js";
|
|
12
|
+
import Le from "../Dropdown/DropdownPopover.js";
|
|
13
|
+
import Se from "../Field/HelperText.js";
|
|
14
|
+
import xe from "../Field/Label.js";
|
|
15
|
+
import Ae from "../Field/ValidationText.js";
|
|
16
|
+
import { useValidationTextRole as Ne } from "../Field/useValidationTextRole.js";
|
|
17
|
+
import Ce from "../Icon/Icon.js";
|
|
18
|
+
import Ee from "../VisuallyHidden/VisuallyHidden.js";
|
|
19
|
+
import { DEFAULT_SIZE as Re } from "./constants.js";
|
|
20
|
+
import { PickerContextProvider as De } from "./PickerContext.js";
|
|
21
|
+
import { PickerPopoverContextProvider as Ke } from "./PickerPopoverContext.js";
|
|
22
|
+
import V from "./UNSTABLE_PickerTag.js";
|
|
23
|
+
import { usePickerId as _e } from "./usePickerId.js";
|
|
24
|
+
import { usePickerPopoverTabOutToTrigger as Be } from "./usePickerPopoverTabOutToTrigger.js";
|
|
25
|
+
import { usePickerSelectionGridKeyboard as Ue } from "./usePickerSelectionGridKeyboard.js";
|
|
26
|
+
import { usePickerStyleProps as we } from "./usePickerStyleProps.js";
|
|
27
|
+
import { collectPickerItems as Me, getPickerItemLabelMap as Ve, getSelectedItems as Fe, getPickerSelectionGridKeyboardRowCount as Ge, getAggregatedTagLabel as Oe } from "./utils.js";
|
|
28
|
+
const He = (G, O) => {
|
|
29
|
+
const { t: s } = ye(), {
|
|
30
|
+
"aria-describedby": H = "",
|
|
31
|
+
addButtonLabel: $ = s("picker.add"),
|
|
32
|
+
children: P,
|
|
33
|
+
closeButtonLabel: j = s("common.close"),
|
|
34
|
+
emptySelectionLabel: I,
|
|
35
|
+
helperText: z,
|
|
36
|
+
id: q,
|
|
37
|
+
isAggregated: T = !1,
|
|
38
|
+
isDisabled: t = !1,
|
|
39
|
+
isFluid: Z = !1,
|
|
40
|
+
isLabelHidden: J = !1,
|
|
41
|
+
isOpen: r,
|
|
42
|
+
isRequired: Q = !1,
|
|
43
|
+
label: i,
|
|
44
|
+
onSelectionChange: n,
|
|
45
|
+
onToggle: p,
|
|
46
|
+
removeAllLabel: W = s("picker.removeAll"),
|
|
47
|
+
renderTags: L,
|
|
48
|
+
selectedKeys: c,
|
|
49
|
+
selectionAriaLabel: X = s("picker.selectionAriaLabel"),
|
|
50
|
+
selectionMode: d = ve,
|
|
51
|
+
size: S = Re,
|
|
52
|
+
tagDescriptionText: Y = s("picker.tagDescriptionText"),
|
|
53
|
+
hasValidationIcon: ee,
|
|
54
|
+
validationState: f,
|
|
55
|
+
validationText: x,
|
|
56
|
+
...re
|
|
57
|
+
} = G, [oe, A] = Te(H), te = Ne({
|
|
58
|
+
validationState: f,
|
|
59
|
+
validationText: x
|
|
60
|
+
}), { classProps: o } = we({
|
|
61
|
+
isDisabled: t,
|
|
62
|
+
isFluid: Z,
|
|
63
|
+
isLabelHidden: J,
|
|
64
|
+
isRequired: Q,
|
|
65
|
+
size: S,
|
|
66
|
+
validationState: f
|
|
67
|
+
}), { styleProps: N, props: ie } = Pe(re), { labelId: C, pickerId: u, popoverId: E, selectionId: ae, tagDescriptionId: R } = _e(q), D = m(() => Me(P), [P]), K = m(() => Ve(D), [D]), g = m(() => he(c, d), [c, d]), a = m(
|
|
68
|
+
() => Fe(g, K),
|
|
69
|
+
[g, K]
|
|
70
|
+
), _ = (l) => ke(d) ? n([]) : n(c.filter((b) => b !== l)), le = () => n([]), B = w(null), U = w(null), y = ge(() => {
|
|
71
|
+
r && (p(), Promise.resolve().then(() => {
|
|
72
|
+
U.current?.focus();
|
|
73
|
+
}));
|
|
74
|
+
}, [r, p]), { onPopoverKeyDownCapture: se } = Be({
|
|
75
|
+
isOpen: r,
|
|
76
|
+
onClose: y
|
|
77
|
+
}), ne = Ge(a.length, {
|
|
78
|
+
isAggregated: T
|
|
79
|
+
}), { getKeyboardGridRowProps: h, removeTagAtIndex: k } = Ue({
|
|
80
|
+
isDisabled: t,
|
|
81
|
+
isPopoverOpen: r,
|
|
82
|
+
onRemoveAtIndex: (l) => {
|
|
83
|
+
T ? le() : _(a[l].value);
|
|
84
|
+
},
|
|
85
|
+
selectionRef: B,
|
|
86
|
+
tagCount: ne
|
|
87
|
+
}), ce = I ? M(I, { label: i }) : i, de = Oe(i, a), me = a.length ? L ? L({
|
|
88
|
+
getKeyboardGridRowProps: h,
|
|
89
|
+
onRemove: _,
|
|
90
|
+
removeTagAtIndex: k
|
|
91
|
+
}) : T ? /* @__PURE__ */ e(
|
|
92
|
+
V,
|
|
93
|
+
{
|
|
94
|
+
tagKeyboardProps: h(0),
|
|
95
|
+
isDisabled: t,
|
|
96
|
+
label: de,
|
|
97
|
+
onRemove: () => k(0),
|
|
98
|
+
removeLabel: W
|
|
99
|
+
}
|
|
100
|
+
) : a.map((l, b) => /* @__PURE__ */ e(
|
|
101
|
+
V,
|
|
102
|
+
{
|
|
103
|
+
tagKeyboardProps: h(b),
|
|
104
|
+
isDisabled: t,
|
|
105
|
+
label: l.label,
|
|
106
|
+
onRemove: () => k(b)
|
|
107
|
+
},
|
|
108
|
+
l.value
|
|
109
|
+
)) : /* @__PURE__ */ e("span", { "aria-hidden": "true", className: o.selectionEmpty, children: ce }), pe = m(
|
|
110
|
+
() => ({
|
|
111
|
+
id: u,
|
|
112
|
+
isDisabled: t,
|
|
113
|
+
onSelectionChange: n,
|
|
114
|
+
selectedKeys: g,
|
|
115
|
+
selectionMode: d
|
|
116
|
+
}),
|
|
117
|
+
[g, t, n, u, d]
|
|
118
|
+
);
|
|
119
|
+
return be(
|
|
120
|
+
O,
|
|
121
|
+
() => ({
|
|
122
|
+
close: y,
|
|
123
|
+
selectedKeys: c
|
|
124
|
+
}),
|
|
125
|
+
[y, c]
|
|
126
|
+
), /* @__PURE__ */ e(De, { value: { size: S, tagDescriptionId: R }, children: /* @__PURE__ */ v("div", { ...N, className: fe(o.root, N.className), ...ie, children: [
|
|
127
|
+
/* @__PURE__ */ e(xe, { id: C, UNSAFE_className: o.label, elementType: "span", children: i }),
|
|
128
|
+
/* @__PURE__ */ v(Ie, { id: E, isOpen: r, onToggle: p, children: [
|
|
129
|
+
/* @__PURE__ */ v("div", { role: "group", "aria-label": i, className: o.inputContainer, children: [
|
|
130
|
+
/* @__PURE__ */ e(
|
|
131
|
+
"div",
|
|
132
|
+
{
|
|
133
|
+
ref: B,
|
|
134
|
+
...oe,
|
|
135
|
+
id: ae,
|
|
136
|
+
role: a.length ? "grid" : "group",
|
|
137
|
+
"aria-label": M(X, { label: i }),
|
|
138
|
+
"aria-live": "off",
|
|
139
|
+
"aria-atomic": !1,
|
|
140
|
+
"aria-relevant": "additions",
|
|
141
|
+
className: o.selection,
|
|
142
|
+
children: me
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
/* @__PURE__ */ v(
|
|
146
|
+
"button",
|
|
147
|
+
{
|
|
148
|
+
ref: U,
|
|
149
|
+
type: "button",
|
|
150
|
+
className: o.trigger,
|
|
151
|
+
"aria-haspopup": "dialog",
|
|
152
|
+
"aria-expanded": r,
|
|
153
|
+
"aria-controls": E,
|
|
154
|
+
onClick: p,
|
|
155
|
+
disabled: t,
|
|
156
|
+
children: [
|
|
157
|
+
/* @__PURE__ */ e(Ee, { children: r ? j : $ }),
|
|
158
|
+
/* @__PURE__ */ e(Ce, { name: `chevron-${r ? "up" : "down"}`, boxSize: 20 })
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
)
|
|
162
|
+
] }),
|
|
163
|
+
/* @__PURE__ */ e(
|
|
164
|
+
Le,
|
|
165
|
+
{
|
|
166
|
+
"aria-labelledby": C,
|
|
167
|
+
role: "dialog",
|
|
168
|
+
"aria-modal": "true",
|
|
169
|
+
onKeyDownCapture: se,
|
|
170
|
+
children: /* @__PURE__ */ e(Ke, { value: pe, children: P })
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
] }),
|
|
174
|
+
/* @__PURE__ */ e(
|
|
175
|
+
Se,
|
|
176
|
+
{
|
|
177
|
+
UNSAFE_className: o.helperText,
|
|
178
|
+
id: `${u}-helper-text`,
|
|
179
|
+
registerAria: A,
|
|
180
|
+
helperText: z
|
|
181
|
+
}
|
|
182
|
+
),
|
|
183
|
+
f && /* @__PURE__ */ e(
|
|
184
|
+
Ae,
|
|
185
|
+
{
|
|
186
|
+
UNSAFE_className: o.validationText,
|
|
187
|
+
id: `${u}-validation-text`,
|
|
188
|
+
...ee && { hasValidationStateIcon: f },
|
|
189
|
+
validationText: x,
|
|
190
|
+
registerAria: A,
|
|
191
|
+
role: te
|
|
192
|
+
}
|
|
193
|
+
),
|
|
194
|
+
/* @__PURE__ */ e("span", { id: R, hidden: !0, children: Y })
|
|
195
|
+
] }) });
|
|
196
|
+
}, F = ue(
|
|
197
|
+
He
|
|
198
|
+
);
|
|
199
|
+
F.spiritComponent = "UNSTABLE_Picker";
|
|
200
|
+
F.displayName = "UNSTABLE_Picker";
|
|
201
|
+
export {
|
|
202
|
+
F as default
|
|
203
|
+
};
|
|
204
|
+
//# sourceMappingURL=UNSTABLE_Picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UNSTABLE_Picker.js","sources":["../../../src/components/UNSTABLE_Picker/UNSTABLE_Picker.tsx"],"sourcesContent":["'use client';\n\nimport classNames from 'classnames';\nimport React, { type ForwardedRef, forwardRef, useCallback, useImperativeHandle, useMemo, useRef } from 'react';\nimport { MULTIPLE_SELECTION_MODE } from '../../constants';\nimport { getSelectedKeys, isSingleSelectionMode, useAriaDescribedBy, useI18n, useStyleProps } from '../../hooks';\nimport { replaceTranslationParams } from '../../translations';\nimport { type ForwardRefComponent } from '../../types';\nimport { Dropdown, DropdownPopover } from '../Dropdown';\nimport { HelperText, Label, ValidationText } from '../Field';\nimport { useValidationTextRole } from '../Field/useValidationTextRole';\nimport { Icon } from '../Icon';\nimport { VisuallyHidden } from '../VisuallyHidden';\nimport { DEFAULT_SIZE } from './constants';\nimport { PickerContextProvider } from './PickerContext';\nimport { PickerPopoverContextProvider } from './PickerPopoverContext';\nimport type { SpiritUnstablePickerProps, SpiritUnstablePickerRef } from './types';\nimport UNSTABLE_PickerTag from './UNSTABLE_PickerTag';\nimport { usePickerId } from './usePickerId';\nimport { usePickerPopoverTabOutToTrigger } from './usePickerPopoverTabOutToTrigger';\nimport { usePickerSelectionGridKeyboard } from './usePickerSelectionGridKeyboard';\nimport { usePickerStyleProps } from './usePickerStyleProps';\nimport {\n collectPickerItems,\n getAggregatedTagLabel,\n getPickerItemLabelMap,\n getPickerSelectionGridKeyboardRowCount,\n getSelectedItems,\n} from './utils';\n\n// eslint-disable-next-line camelcase\nconst _UNSTABLE_Picker = (props: SpiritUnstablePickerProps, ref: ForwardedRef<SpiritUnstablePickerRef>) => {\n const { t } = useI18n();\n\n const {\n 'aria-describedby': ariaDescribedBy = '',\n addButtonLabel = t('picker.add'),\n children,\n closeButtonLabel = t('common.close'),\n emptySelectionLabel,\n helperText,\n id,\n isAggregated = false,\n isDisabled = false,\n isFluid = false,\n isLabelHidden = false,\n isOpen,\n isRequired = false,\n label,\n onSelectionChange,\n onToggle,\n removeAllLabel = t('picker.removeAll'),\n renderTags,\n selectedKeys,\n selectionAriaLabel = t('picker.selectionAriaLabel'),\n selectionMode = MULTIPLE_SELECTION_MODE,\n size = DEFAULT_SIZE,\n tagDescriptionText = t('picker.tagDescriptionText'),\n hasValidationIcon,\n validationState,\n validationText,\n ...restProps\n } = props;\n\n const [ariaDescribedByProp, register] = useAriaDescribedBy(ariaDescribedBy);\n const validationTextRole = useValidationTextRole({\n validationState,\n validationText,\n });\n const { classProps } = usePickerStyleProps({\n isDisabled,\n isFluid,\n isLabelHidden,\n isRequired,\n size,\n validationState,\n });\n const { styleProps, props: transferProps } = useStyleProps(restProps);\n const { labelId, pickerId, popoverId, selectionId, tagDescriptionId } = usePickerId(id);\n\n const pickerItems = useMemo(() => collectPickerItems(children), [children]);\n\n const pickerItemLabels = useMemo(() => getPickerItemLabelMap(pickerItems), [pickerItems]);\n\n const selectedPickerKeys = useMemo(() => getSelectedKeys(selectedKeys, selectionMode), [selectedKeys, selectionMode]);\n\n const selectedPickerItems = useMemo(\n () => getSelectedItems(selectedPickerKeys, pickerItemLabels),\n [selectedPickerKeys, pickerItemLabels],\n );\n\n const removeItem = (key: string) =>\n isSingleSelectionMode(selectionMode)\n ? onSelectionChange([])\n : onSelectionChange(selectedKeys.filter((selectedKey) => selectedKey !== key));\n\n const removeAll = () => onSelectionChange([]);\n\n const selectionGridRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n\n const close = useCallback(() => {\n if (!isOpen) {\n return;\n }\n\n onToggle();\n\n Promise.resolve().then(() => {\n triggerRef.current?.focus();\n });\n }, [isOpen, onToggle]);\n\n const { onPopoverKeyDownCapture } = usePickerPopoverTabOutToTrigger({\n isOpen,\n onClose: close,\n });\n\n const selectionGridKeyboardRowCount = getPickerSelectionGridKeyboardRowCount(selectedPickerItems.length, {\n isAggregated,\n });\n\n const { getKeyboardGridRowProps, removeTagAtIndex } = usePickerSelectionGridKeyboard({\n isDisabled,\n isPopoverOpen: isOpen,\n onRemoveAtIndex: (index) => {\n if (isAggregated) {\n removeAll();\n } else {\n removeItem(selectedPickerItems[index]!.value);\n }\n },\n selectionRef: selectionGridRef,\n tagCount: selectionGridKeyboardRowCount,\n });\n\n const emptyLabel = emptySelectionLabel ? replaceTranslationParams(emptySelectionLabel, { label }) : label;\n const aggregatedTagLabel = getAggregatedTagLabel(label, selectedPickerItems);\n\n const selectionContent = (() => {\n if (!selectedPickerItems.length) {\n return (\n <span aria-hidden=\"true\" className={classProps.selectionEmpty}>\n {emptyLabel}\n </span>\n );\n }\n\n if (renderTags) {\n return renderTags({\n getKeyboardGridRowProps,\n onRemove: removeItem,\n removeTagAtIndex,\n });\n }\n\n if (isAggregated) {\n return (\n <UNSTABLE_PickerTag\n tagKeyboardProps={getKeyboardGridRowProps(0)}\n isDisabled={isDisabled}\n label={aggregatedTagLabel}\n onRemove={() => removeTagAtIndex(0)}\n removeLabel={removeAllLabel}\n />\n );\n }\n\n return selectedPickerItems.map((item, index) => (\n <UNSTABLE_PickerTag\n key={item.value}\n tagKeyboardProps={getKeyboardGridRowProps(index)}\n isDisabled={isDisabled}\n label={item.label}\n onRemove={() => removeTagAtIndex(index)}\n />\n ));\n })();\n\n const popoverContextValue = useMemo(\n () => ({\n id: pickerId,\n isDisabled,\n onSelectionChange,\n selectedKeys: selectedPickerKeys,\n selectionMode,\n }),\n [selectedPickerKeys, isDisabled, onSelectionChange, pickerId, selectionMode],\n );\n\n useImperativeHandle(\n ref,\n () => ({\n close,\n selectedKeys,\n }),\n [close, selectedKeys],\n );\n\n return (\n <PickerContextProvider value={{ size, tagDescriptionId }}>\n <div {...styleProps} className={classNames(classProps.root, styleProps.className)} {...transferProps}>\n <Label id={labelId} UNSAFE_className={classProps.label} elementType=\"span\">\n {label}\n </Label>\n <Dropdown id={popoverId} isOpen={isOpen} onToggle={onToggle}>\n <div role=\"group\" aria-label={label} className={classProps.inputContainer}>\n <div\n ref={selectionGridRef}\n {...ariaDescribedByProp}\n id={selectionId}\n role={selectedPickerItems.length ? 'grid' : 'group'}\n aria-label={replaceTranslationParams(selectionAriaLabel, { label })}\n aria-live=\"off\"\n aria-atomic={false}\n aria-relevant=\"additions\"\n className={classProps.selection}\n >\n {selectionContent}\n </div>\n <button\n ref={triggerRef}\n type=\"button\"\n className={classProps.trigger}\n aria-haspopup=\"dialog\"\n aria-expanded={isOpen}\n aria-controls={popoverId}\n onClick={onToggle}\n disabled={isDisabled}\n >\n <VisuallyHidden>{isOpen ? closeButtonLabel : addButtonLabel}</VisuallyHidden>\n <Icon name={`chevron-${isOpen ? 'up' : 'down'}`} boxSize={20} />\n </button>\n </div>\n <DropdownPopover\n aria-labelledby={labelId}\n role=\"dialog\"\n aria-modal=\"true\"\n onKeyDownCapture={onPopoverKeyDownCapture}\n >\n <PickerPopoverContextProvider value={popoverContextValue}>{children}</PickerPopoverContextProvider>\n </DropdownPopover>\n </Dropdown>\n <HelperText\n UNSAFE_className={classProps.helperText}\n id={`${pickerId}-helper-text`}\n registerAria={register}\n helperText={helperText}\n />\n {validationState && (\n <ValidationText\n UNSAFE_className={classProps.validationText}\n id={`${pickerId}-validation-text`}\n {...(hasValidationIcon && { hasValidationStateIcon: validationState })}\n validationText={validationText}\n registerAria={register}\n role={validationTextRole}\n />\n )}\n <span id={tagDescriptionId} hidden>\n {tagDescriptionText}\n </span>\n </div>\n </PickerContextProvider>\n );\n};\n\nconst UNSTABLE_Picker = forwardRef<SpiritUnstablePickerRef, SpiritUnstablePickerProps>(\n _UNSTABLE_Picker,\n) as ForwardRefComponent<SpiritUnstablePickerRef, SpiritUnstablePickerProps>;\n\nUNSTABLE_Picker.spiritComponent = 'UNSTABLE_Picker';\nUNSTABLE_Picker.displayName = 'UNSTABLE_Picker';\n\nexport default UNSTABLE_Picker;\n"],"names":["_UNSTABLE_Picker","props","ref","t","useI18n","ariaDescribedBy","addButtonLabel","children","closeButtonLabel","emptySelectionLabel","helperText","id","isAggregated","isDisabled","isFluid","isLabelHidden","isOpen","isRequired","label","onSelectionChange","onToggle","removeAllLabel","renderTags","selectedKeys","selectionAriaLabel","selectionMode","MULTIPLE_SELECTION_MODE","size","DEFAULT_SIZE","tagDescriptionText","hasValidationIcon","validationState","validationText","restProps","ariaDescribedByProp","register","useAriaDescribedBy","validationTextRole","useValidationTextRole","classProps","usePickerStyleProps","styleProps","transferProps","useStyleProps","labelId","pickerId","popoverId","selectionId","tagDescriptionId","usePickerId","pickerItems","useMemo","collectPickerItems","pickerItemLabels","getPickerItemLabelMap","selectedPickerKeys","getSelectedKeys","selectedPickerItems","getSelectedItems","removeItem","key","isSingleSelectionMode","selectedKey","removeAll","selectionGridRef","useRef","triggerRef","close","useCallback","onPopoverKeyDownCapture","usePickerPopoverTabOutToTrigger","selectionGridKeyboardRowCount","getPickerSelectionGridKeyboardRowCount","getKeyboardGridRowProps","removeTagAtIndex","usePickerSelectionGridKeyboard","index","emptyLabel","replaceTranslationParams","aggregatedTagLabel","getAggregatedTagLabel","selectionContent","jsx","UNSTABLE_PickerTag","item","popoverContextValue","useImperativeHandle","PickerContextProvider","jsxs","classNames","Label","Dropdown","VisuallyHidden","Icon","DropdownPopover","PickerPopoverContextProvider","HelperText","ValidationText","UNSTABLE_Picker","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;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X,kBAAkByB;AAAA,UAElB,UAAA,gBAAAa,EAACa,IAAA,EAA6B,OAAOV,IAAsB,UAAA9E,EAAA,CAAS;AAAA,QAAA;AAAA,MAAA;AAAA,IACtE,GACF;AAAA,IACA,gBAAA2E;AAAA,MAACc;AAAA,MAAA;AAAA,QACC,kBAAkBzD,EAAW;AAAA,QAC7B,IAAI,GAAGM,CAAQ;AAAA,QACf,cAAcV;AAAA,QACd,YAAAzB;AAAA,MAAA;AAAA,IAAA;AAAA,IAEDqB,KACC,gBAAAmD;AAAA,MAACe;AAAA,MAAA;AAAA,QACC,kBAAkB1D,EAAW;AAAA,QAC7B,IAAI,GAAGM,CAAQ;AAAA,QACd,GAAIf,MAAqB,EAAE,wBAAwBC,EAAA;AAAA,QACpD,gBAAAC;AAAA,QACA,cAAcG;AAAA,QACd,MAAME;AAAA,MAAA;AAAA,IAAA;AAAA,sBAGT,QAAA,EAAK,IAAIW,GAAkB,QAAM,IAC/B,UAAAnB,EAAA,CACH;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ,GAEMqE,IAAkBC;AAAA,EACtBnG;AACF;AAEAkG,EAAgB,kBAAkB;AAClCA,EAAgB,cAAc;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),c=require("react"),d=require("../FieldGroup/FieldGroup.cjs"),l=require("./PickerPopoverContext.cjs"),r=({children:o,label:i,...u})=>{const e=l.usePickerPopoverContext(),t=c.useId(),s=e.id?`${e.id}-group-${t}`:t;return n.jsx(d.default,{...u,id:s,isFluid:!0,isLabelHidden:!0,label:i,children:o})};r.spiritComponent="UNSTABLE_PickerGroup";exports.default=r;
|
|
2
|
+
//# sourceMappingURL=UNSTABLE_PickerGroup.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UNSTABLE_PickerGroup.cjs","sources":["../../../src/components/UNSTABLE_Picker/UNSTABLE_PickerGroup.tsx"],"sourcesContent":["'use client';\n\nimport React, { useId } from 'react';\nimport { FieldGroup } from '../FieldGroup';\nimport { usePickerPopoverContext } from './PickerPopoverContext';\nimport type { SpiritUnstablePickerGroupProps } from './types';\n\nconst UNSTABLE_PickerGroup = ({ children, label, ...restProps }: SpiritUnstablePickerGroupProps) => {\n const pickerPopoverContext = usePickerPopoverContext();\n const generatedId = useId();\n const id = pickerPopoverContext.id ? `${pickerPopoverContext.id}-group-${generatedId}` : generatedId;\n\n return (\n <FieldGroup {...restProps} id={id} isFluid isLabelHidden label={label}>\n {children}\n </FieldGroup>\n );\n};\n\nUNSTABLE_PickerGroup.spiritComponent = 'UNSTABLE_PickerGroup';\n\nexport default UNSTABLE_PickerGroup;\n"],"names":["UNSTABLE_PickerGroup","children","label","restProps","pickerPopoverContext","usePickerPopoverContext","generatedId","useId","id","jsx","FieldGroup"],"mappings":"mQAOMA,EAAuB,CAAC,CAAE,SAAAC,EAAU,MAAAC,EAAO,GAAGC,KAAgD,CAClG,MAAMC,EAAuBC,EAAAA,wBAAA,EACvBC,EAAcC,EAAAA,MAAA,EACdC,EAAKJ,EAAqB,GAAK,GAAGA,EAAqB,EAAE,UAAUE,CAAW,GAAKA,EAEzF,OACEG,MAACC,EAAAA,QAAA,CAAY,GAAGP,EAAW,GAAAK,EAAQ,QAAO,GAAC,cAAa,GAAC,MAAAN,EACtD,SAAAD,CAAA,CACH,CAEJ,EAEAD,EAAqB,gBAAkB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SpiritUnstablePickerGroupProps } from './types';
|
|
3
|
+
declare const UNSTABLE_PickerGroup: {
|
|
4
|
+
({ children, label, ...restProps }: SpiritUnstablePickerGroupProps): React.JSX.Element;
|
|
5
|
+
spiritComponent: string;
|
|
6
|
+
};
|
|
7
|
+
export default UNSTABLE_PickerGroup;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { useId as u } from "react";
|
|
4
|
+
import n from "../FieldGroup/FieldGroup.js";
|
|
5
|
+
import { usePickerPopoverContext as d } from "./PickerPopoverContext.js";
|
|
6
|
+
const c = ({ children: o, label: t, ...i }) => {
|
|
7
|
+
const r = d(), e = u(), p = r.id ? `${r.id}-group-${e}` : e;
|
|
8
|
+
return /* @__PURE__ */ s(n, { ...i, id: p, isFluid: !0, isLabelHidden: !0, label: t, children: o });
|
|
9
|
+
};
|
|
10
|
+
c.spiritComponent = "UNSTABLE_PickerGroup";
|
|
11
|
+
export {
|
|
12
|
+
c as default
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=UNSTABLE_PickerGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UNSTABLE_PickerGroup.js","sources":["../../../src/components/UNSTABLE_Picker/UNSTABLE_PickerGroup.tsx"],"sourcesContent":["'use client';\n\nimport React, { useId } from 'react';\nimport { FieldGroup } from '../FieldGroup';\nimport { usePickerPopoverContext } from './PickerPopoverContext';\nimport type { SpiritUnstablePickerGroupProps } from './types';\n\nconst UNSTABLE_PickerGroup = ({ children, label, ...restProps }: SpiritUnstablePickerGroupProps) => {\n const pickerPopoverContext = usePickerPopoverContext();\n const generatedId = useId();\n const id = pickerPopoverContext.id ? `${pickerPopoverContext.id}-group-${generatedId}` : generatedId;\n\n return (\n <FieldGroup {...restProps} id={id} isFluid isLabelHidden label={label}>\n {children}\n </FieldGroup>\n );\n};\n\nUNSTABLE_PickerGroup.spiritComponent = 'UNSTABLE_PickerGroup';\n\nexport default UNSTABLE_PickerGroup;\n"],"names":["UNSTABLE_PickerGroup","children","label","restProps","pickerPopoverContext","usePickerPopoverContext","generatedId","useId","id","jsx","FieldGroup"],"mappings":";;;;;AAOA,MAAMA,IAAuB,CAAC,EAAE,UAAAC,GAAU,OAAAC,GAAO,GAAGC,QAAgD;AAClG,QAAMC,IAAuBC,EAAA,GACvBC,IAAcC,EAAA,GACdC,IAAKJ,EAAqB,KAAK,GAAGA,EAAqB,EAAE,UAAUE,CAAW,KAAKA;AAEzF,SACE,gBAAAG,EAACC,GAAA,EAAY,GAAGP,GAAW,IAAAK,GAAQ,SAAO,IAAC,eAAa,IAAC,OAAAN,GACtD,UAAAD,EAAA,CACH;AAEJ;AAEAD,EAAqB,kBAAkB;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("react/jsx-runtime"),P=require("../../constants/inputs.cjs"),o=require("../../hooks/useSelectionState.cjs"),m=require("../Checkbox/Checkbox.cjs"),h=require("../Radio/Radio.cjs"),k=require("./PickerPopoverContext.cjs"),c=({children:r,value:e,...u})=>{const{id:i,isDisabled:d,onSelectionChange:l,selectedKeys:s,selectionMode:t}=k.usePickerPopoverContext(),S=o.isKeySelected(s,e,t),n=o.isSingleSelectionMode(t),a=n?h.default:m.default,p=`${i}-${e}`,g=()=>{l(n?[e]:o.getToggledSelectedKeys(s,e,t))};return C.jsx(a,{...u,id:p,inputPosition:P.InputPositions.START,isChecked:S,isDisabled:d,isItem:!0,label:r,value:e,onChange:g,...n?{name:i}:{}})};c.spiritComponent="UNSTABLE_PickerItem";exports.default=c;
|
|
2
|
+
//# sourceMappingURL=UNSTABLE_PickerItem.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UNSTABLE_PickerItem.cjs","sources":["../../../src/components/UNSTABLE_Picker/UNSTABLE_PickerItem.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { InputPositions } from '../../constants';\nimport { getToggledSelectedKeys, isKeySelected, isSingleSelectionMode } from '../../hooks';\nimport { Checkbox } from '../Checkbox';\nimport { Radio } from '../Radio';\nimport { usePickerPopoverContext } from './PickerPopoverContext';\nimport type { SpiritUnstablePickerItemProps } from './types';\n\nconst UNSTABLE_PickerItem = ({ children, value, ...restProps }: SpiritUnstablePickerItemProps) => {\n const { id, isDisabled, onSelectionChange, selectedKeys, selectionMode } = usePickerPopoverContext();\n const isChecked = isKeySelected(selectedKeys, value, selectionMode);\n const single = isSingleSelectionMode(selectionMode);\n const InputComponent = single ? Radio : Checkbox;\n const inputId = `${id}-${value}`;\n\n const handleChange = () => {\n onSelectionChange(single ? [value] : getToggledSelectedKeys(selectedKeys, value, selectionMode));\n };\n\n return (\n <InputComponent\n {...restProps}\n id={inputId}\n inputPosition={InputPositions.START}\n isChecked={isChecked}\n isDisabled={isDisabled}\n isItem\n label={children}\n value={value}\n onChange={handleChange}\n {...(single ? { name: id } : {})}\n />\n );\n};\n\nUNSTABLE_PickerItem.spiritComponent = 'UNSTABLE_PickerItem';\n\nexport default UNSTABLE_PickerItem;\n"],"names":["UNSTABLE_PickerItem","children","value","restProps","id","isDisabled","onSelectionChange","selectedKeys","selectionMode","usePickerPopoverContext","isChecked","isKeySelected","single","isSingleSelectionMode","InputComponent","Radio","Checkbox","inputId","handleChange","getToggledSelectedKeys","jsx","InputPositions"],"mappings":"mWAUMA,EAAsB,CAAC,CAAE,SAAAC,EAAU,MAAAC,EAAO,GAAGC,KAA+C,CAChG,KAAM,CAAE,GAAAC,EAAI,WAAAC,EAAY,kBAAAC,EAAmB,aAAAC,EAAc,cAAAC,CAAA,EAAkBC,0BAAA,EACrEC,EAAYC,EAAAA,cAAcJ,EAAcL,EAAOM,CAAa,EAC5DI,EAASC,EAAAA,sBAAsBL,CAAa,EAC5CM,EAAiBF,EAASG,EAAAA,QAAQC,EAAAA,QAClCC,EAAU,GAAGb,CAAE,IAAIF,CAAK,GAExBgB,EAAe,IAAM,CACzBZ,EAAkBM,EAAS,CAACV,CAAK,EAAIiB,EAAAA,uBAAuBZ,EAAcL,EAAOM,CAAa,CAAC,CACjG,EAEA,OACEY,EAAAA,IAACN,EAAA,CACE,GAAGX,EACJ,GAAIc,EACJ,cAAeI,EAAAA,eAAe,MAC9B,UAAAX,EACA,WAAAL,EACA,OAAM,GACN,MAAOJ,EACP,MAAAC,EACA,SAAUgB,EACT,GAAIN,EAAS,CAAE,KAAMR,GAAO,CAAA,CAAC,CAAA,CAGpC,EAEAJ,EAAoB,gBAAkB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SpiritUnstablePickerItemProps } from './types';
|
|
3
|
+
declare const UNSTABLE_PickerItem: {
|
|
4
|
+
({ children, value, ...restProps }: SpiritUnstablePickerItemProps): React.JSX.Element;
|
|
5
|
+
spiritComponent: string;
|
|
6
|
+
};
|
|
7
|
+
export default UNSTABLE_PickerItem;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as C } from "react/jsx-runtime";
|
|
3
|
+
import { InputPositions as S } from "../../constants/inputs.js";
|
|
4
|
+
import { isKeySelected as f, getToggledSelectedKeys as a, isSingleSelectionMode as h } from "../../hooks/useSelectionState.js";
|
|
5
|
+
import u from "../Checkbox/Checkbox.js";
|
|
6
|
+
import I from "../Radio/Radio.js";
|
|
7
|
+
import { usePickerPopoverContext as P } from "./PickerPopoverContext.js";
|
|
8
|
+
const k = ({ children: s, value: e, ...r }) => {
|
|
9
|
+
const { id: i, isDisabled: c, onSelectionChange: m, selectedKeys: n, selectionMode: o } = P(), p = f(n, e, o), t = h(o), d = t ? I : u, l = `${i}-${e}`, g = () => {
|
|
10
|
+
m(t ? [e] : a(n, e, o));
|
|
11
|
+
};
|
|
12
|
+
return /* @__PURE__ */ C(
|
|
13
|
+
d,
|
|
14
|
+
{
|
|
15
|
+
...r,
|
|
16
|
+
id: l,
|
|
17
|
+
inputPosition: S.START,
|
|
18
|
+
isChecked: p,
|
|
19
|
+
isDisabled: c,
|
|
20
|
+
isItem: !0,
|
|
21
|
+
label: s,
|
|
22
|
+
value: e,
|
|
23
|
+
onChange: g,
|
|
24
|
+
...t ? { name: i } : {}
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
k.spiritComponent = "UNSTABLE_PickerItem";
|
|
29
|
+
export {
|
|
30
|
+
k as default
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=UNSTABLE_PickerItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UNSTABLE_PickerItem.js","sources":["../../../src/components/UNSTABLE_Picker/UNSTABLE_PickerItem.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { InputPositions } from '../../constants';\nimport { getToggledSelectedKeys, isKeySelected, isSingleSelectionMode } from '../../hooks';\nimport { Checkbox } from '../Checkbox';\nimport { Radio } from '../Radio';\nimport { usePickerPopoverContext } from './PickerPopoverContext';\nimport type { SpiritUnstablePickerItemProps } from './types';\n\nconst UNSTABLE_PickerItem = ({ children, value, ...restProps }: SpiritUnstablePickerItemProps) => {\n const { id, isDisabled, onSelectionChange, selectedKeys, selectionMode } = usePickerPopoverContext();\n const isChecked = isKeySelected(selectedKeys, value, selectionMode);\n const single = isSingleSelectionMode(selectionMode);\n const InputComponent = single ? Radio : Checkbox;\n const inputId = `${id}-${value}`;\n\n const handleChange = () => {\n onSelectionChange(single ? [value] : getToggledSelectedKeys(selectedKeys, value, selectionMode));\n };\n\n return (\n <InputComponent\n {...restProps}\n id={inputId}\n inputPosition={InputPositions.START}\n isChecked={isChecked}\n isDisabled={isDisabled}\n isItem\n label={children}\n value={value}\n onChange={handleChange}\n {...(single ? { name: id } : {})}\n />\n );\n};\n\nUNSTABLE_PickerItem.spiritComponent = 'UNSTABLE_PickerItem';\n\nexport default UNSTABLE_PickerItem;\n"],"names":["UNSTABLE_PickerItem","children","value","restProps","id","isDisabled","onSelectionChange","selectedKeys","selectionMode","usePickerPopoverContext","isChecked","isKeySelected","single","isSingleSelectionMode","InputComponent","Radio","Checkbox","inputId","handleChange","getToggledSelectedKeys","jsx","InputPositions"],"mappings":";;;;;;;AAUA,MAAMA,IAAsB,CAAC,EAAE,UAAAC,GAAU,OAAAC,GAAO,GAAGC,QAA+C;AAChG,QAAM,EAAE,IAAAC,GAAI,YAAAC,GAAY,mBAAAC,GAAmB,cAAAC,GAAc,eAAAC,EAAA,IAAkBC,EAAA,GACrEC,IAAYC,EAAcJ,GAAcL,GAAOM,CAAa,GAC5DI,IAASC,EAAsBL,CAAa,GAC5CM,IAAiBF,IAASG,IAAQC,GAClCC,IAAU,GAAGb,CAAE,IAAIF,CAAK,IAExBgB,IAAe,MAAM;AACzB,IAAAZ,EAAkBM,IAAS,CAACV,CAAK,IAAIiB,EAAuBZ,GAAcL,GAAOM,CAAa,CAAC;AAAA,EACjG;AAEA,SACE,gBAAAY;AAAA,IAACN;AAAA,IAAA;AAAA,MACE,GAAGX;AAAA,MACJ,IAAIc;AAAA,MACJ,eAAeI,EAAe;AAAA,MAC9B,WAAAX;AAAA,MACA,YAAAL;AAAA,MACA,QAAM;AAAA,MACN,OAAOJ;AAAA,MACP,OAAAC;AAAA,MACA,UAAUgB;AAAA,MACT,GAAIN,IAAS,EAAE,MAAMR,MAAO,CAAA;AAAA,IAAC;AAAA,EAAA;AAGpC;AAEAJ,EAAoB,kBAAkB;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),E=require("react"),q=require("../../constants/dictionaries.cjs"),C=require("../../hooks/useI18n.cjs"),S=require("../../translations/replaceTranslationParams.cjs"),_=require("../ControlButton/ControlButton.cjs"),v=require("../Icon/Icon.cjs"),j=require("../Tag/Tag.cjs"),i=require("./constants.cjs"),p=require("./PickerContext.cjs"),s=require("./utils.cjs"),u=({children:a,tagKeyboardProps:e,isDisabled:t,label:r,onRemove:l,removeLabel:d,...m})=>{const{t:x}=C.useI18n(),{size:o=q.Sizes.MEDIUM,tagDescriptionId:c}=p.usePickerContext(),I=d??S.replaceTranslationParams(x("picker.removeItemLabel"),{itemLabel:s.getNodeText(r)}),T=E.useMemo(()=>t||!e?{}:{onBlurCapture:e.onBlurCapture,onFocusCapture:e.onFocusCapture,onKeyDown:e.onKeyDown},[t,e]);return n.jsx(j.default,{...m,color:"selected",elementType:"div",size:i.PICKER_NESTED_SIZE_MAP[o],isDisabled:t,role:"row",tabIndex:t?-1:e?.tabIndex??0,"aria-label":s.getNodeText(r),...T,...c?{"aria-describedby":c}:{},children:n.jsxs("div",{role:"gridcell","aria-colindex":1,className:"d-contents",children:[a??n.jsx("span",{children:r}),n.jsx(_.default,{"aria-label":I,isDisabled:t,isSymmetrical:!0,onClick:l,size:i.PICKER_NESTED_SIZE_MAP[o],...e&&{tabIndex:e.removeButtonTabIndex},children:n.jsx(v.default,{name:"close"})})]})})};u.spiritComponent="UNSTABLE_PickerTag";exports.default=u;
|
|
2
|
+
//# sourceMappingURL=UNSTABLE_PickerTag.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UNSTABLE_PickerTag.cjs","sources":["../../../src/components/UNSTABLE_Picker/UNSTABLE_PickerTag.tsx"],"sourcesContent":["'use client';\n\nimport React, { useMemo } from 'react';\nimport { Sizes } from '../../constants';\nimport { useI18n } from '../../hooks';\nimport { replaceTranslationParams } from '../../translations';\nimport { ControlButton } from '../ControlButton';\nimport { Icon } from '../Icon';\nimport { Tag } from '../Tag';\nimport { PICKER_NESTED_SIZE_MAP } from './constants';\nimport { usePickerContext } from './PickerContext';\nimport type { SpiritUnstablePickerTagProps } from './types';\nimport { getNodeText } from './utils';\n\nconst UNSTABLE_PickerTag = ({\n children,\n tagKeyboardProps,\n isDisabled,\n label,\n onRemove,\n removeLabel,\n ...restProps\n}: SpiritUnstablePickerTagProps) => {\n const { t } = useI18n();\n const { size = Sizes.MEDIUM, tagDescriptionId } = usePickerContext();\n\n const removeButtonAriaLabel =\n removeLabel ??\n replaceTranslationParams(t('picker.removeItemLabel'), {\n itemLabel: getNodeText(label),\n });\n\n const tagKeyboardEventProps = useMemo(() => {\n if (isDisabled || !tagKeyboardProps) {\n return {};\n }\n\n return {\n onBlurCapture: tagKeyboardProps.onBlurCapture,\n onFocusCapture: tagKeyboardProps.onFocusCapture,\n onKeyDown: tagKeyboardProps.onKeyDown,\n };\n }, [isDisabled, tagKeyboardProps]);\n\n return (\n <Tag\n {...restProps}\n color=\"selected\"\n elementType=\"div\"\n size={PICKER_NESTED_SIZE_MAP[size]}\n isDisabled={isDisabled}\n role=\"row\"\n tabIndex={isDisabled ? -1 : (tagKeyboardProps?.tabIndex ?? 0)}\n aria-label={getNodeText(label)}\n {...tagKeyboardEventProps}\n {...(tagDescriptionId ? { 'aria-describedby': tagDescriptionId } : {})}\n >\n <div role=\"gridcell\" aria-colindex={1} className=\"d-contents\">\n {children ?? <span>{label}</span>}\n <ControlButton\n aria-label={removeButtonAriaLabel}\n isDisabled={isDisabled}\n isSymmetrical\n onClick={onRemove}\n size={PICKER_NESTED_SIZE_MAP[size]}\n {...(tagKeyboardProps && { tabIndex: tagKeyboardProps.removeButtonTabIndex })}\n >\n <Icon name=\"close\" />\n </ControlButton>\n </div>\n </Tag>\n );\n};\n\nUNSTABLE_PickerTag.spiritComponent = 'UNSTABLE_PickerTag';\n\nexport default UNSTABLE_PickerTag;\n"],"names":["UNSTABLE_PickerTag","children","tagKeyboardProps","isDisabled","label","onRemove","removeLabel","restProps","t","useI18n","size","Sizes","tagDescriptionId","usePickerContext","removeButtonAriaLabel","replaceTranslationParams","getNodeText","tagKeyboardEventProps","useMemo","jsx","Tag","PICKER_NESTED_SIZE_MAP","ControlButton","Icon"],"mappings":"kgBAcMA,EAAqB,CAAC,CAC1B,SAAAC,EACA,iBAAAC,EACA,WAAAC,EACA,MAAAC,EACA,SAAAC,EACA,YAAAC,EACA,GAAGC,CACL,IAAoC,CAClC,KAAM,CAAE,EAAAC,CAAA,EAAMC,UAAA,EACR,CAAE,KAAAC,EAAOC,EAAAA,MAAM,OAAQ,iBAAAC,CAAA,EAAqBC,EAAAA,iBAAA,EAE5CC,EACJR,GACAS,EAAAA,yBAAyBP,EAAE,wBAAwB,EAAG,CACpD,UAAWQ,EAAAA,YAAYZ,CAAK,CAAA,CAC7B,EAEGa,EAAwBC,EAAAA,QAAQ,IAChCf,GAAc,CAACD,EACV,CAAA,EAGF,CACL,cAAeA,EAAiB,cAChC,eAAgBA,EAAiB,eACjC,UAAWA,EAAiB,SAAA,EAE7B,CAACC,EAAYD,CAAgB,CAAC,EAEjC,OACEiB,EAAAA,IAACC,EAAAA,QAAA,CACE,GAAGb,EACJ,MAAM,WACN,YAAY,MACZ,KAAMc,EAAAA,uBAAuBX,CAAI,EACjC,WAAAP,EACA,KAAK,MACL,SAAUA,EAAa,GAAMD,GAAkB,UAAY,EAC3D,aAAYc,EAAAA,YAAYZ,CAAK,EAC5B,GAAGa,EACH,GAAIL,EAAmB,CAAE,mBAAoBA,CAAA,EAAqB,CAAA,EAEnE,gBAAC,MAAA,CAAI,KAAK,WAAW,gBAAe,EAAG,UAAU,aAC9C,SAAA,CAAAX,GAAYkB,EAAAA,IAAC,QAAM,SAAAf,CAAA,CAAM,EAC1Be,EAAAA,IAACG,EAAAA,QAAA,CACC,aAAYR,EACZ,WAAAX,EACA,cAAa,GACb,QAASE,EACT,KAAMgB,EAAAA,uBAAuBX,CAAI,EAChC,GAAIR,GAAoB,CAAE,SAAUA,EAAiB,oBAAA,EAEtD,SAAAiB,EAAAA,IAACI,EAAAA,QAAA,CAAK,KAAK,OAAA,CAAQ,CAAA,CAAA,CACrB,CAAA,CACF,CAAA,CAAA,CAGN,EAEAvB,EAAmB,gBAAkB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SpiritUnstablePickerTagProps } from './types';
|
|
3
|
+
declare const UNSTABLE_PickerTag: {
|
|
4
|
+
({ children, tagKeyboardProps, isDisabled, label, onRemove, removeLabel, ...restProps }: SpiritUnstablePickerTagProps): React.JSX.Element;
|
|
5
|
+
spiritComponent: string;
|
|
6
|
+
};
|
|
7
|
+
export default UNSTABLE_PickerTag;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as o, jsxs as x } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo as T } from "react";
|
|
4
|
+
import { Sizes as d } from "../../constants/dictionaries.js";
|
|
5
|
+
import { useI18n as C } from "../../hooks/useI18n.js";
|
|
6
|
+
import { replaceTranslationParams as E } from "../../translations/replaceTranslationParams.js";
|
|
7
|
+
import B from "../ControlButton/ControlButton.js";
|
|
8
|
+
import v from "../Icon/Icon.js";
|
|
9
|
+
import S from "../Tag/Tag.js";
|
|
10
|
+
import { PICKER_NESTED_SIZE_MAP as m } from "./constants.js";
|
|
11
|
+
import { usePickerContext as k } from "./PickerContext.js";
|
|
12
|
+
import { getNodeText as c } from "./utils.js";
|
|
13
|
+
const L = ({
|
|
14
|
+
children: l,
|
|
15
|
+
tagKeyboardProps: e,
|
|
16
|
+
isDisabled: r,
|
|
17
|
+
label: t,
|
|
18
|
+
onRemove: u,
|
|
19
|
+
removeLabel: a,
|
|
20
|
+
...s
|
|
21
|
+
}) => {
|
|
22
|
+
const { t: p } = C(), { size: n = d.MEDIUM, tagDescriptionId: i } = k(), f = a ?? E(p("picker.removeItemLabel"), {
|
|
23
|
+
itemLabel: c(t)
|
|
24
|
+
}), I = T(() => r || !e ? {} : {
|
|
25
|
+
onBlurCapture: e.onBlurCapture,
|
|
26
|
+
onFocusCapture: e.onFocusCapture,
|
|
27
|
+
onKeyDown: e.onKeyDown
|
|
28
|
+
}, [r, e]);
|
|
29
|
+
return /* @__PURE__ */ o(
|
|
30
|
+
S,
|
|
31
|
+
{
|
|
32
|
+
...s,
|
|
33
|
+
color: "selected",
|
|
34
|
+
elementType: "div",
|
|
35
|
+
size: m[n],
|
|
36
|
+
isDisabled: r,
|
|
37
|
+
role: "row",
|
|
38
|
+
tabIndex: r ? -1 : e?.tabIndex ?? 0,
|
|
39
|
+
"aria-label": c(t),
|
|
40
|
+
...I,
|
|
41
|
+
...i ? { "aria-describedby": i } : {},
|
|
42
|
+
children: /* @__PURE__ */ x("div", { role: "gridcell", "aria-colindex": 1, className: "d-contents", children: [
|
|
43
|
+
l ?? /* @__PURE__ */ o("span", { children: t }),
|
|
44
|
+
/* @__PURE__ */ o(
|
|
45
|
+
B,
|
|
46
|
+
{
|
|
47
|
+
"aria-label": f,
|
|
48
|
+
isDisabled: r,
|
|
49
|
+
isSymmetrical: !0,
|
|
50
|
+
onClick: u,
|
|
51
|
+
size: m[n],
|
|
52
|
+
...e && { tabIndex: e.removeButtonTabIndex },
|
|
53
|
+
children: /* @__PURE__ */ o(v, { name: "close" })
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
] })
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
L.spiritComponent = "UNSTABLE_PickerTag";
|
|
61
|
+
export {
|
|
62
|
+
L as default
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=UNSTABLE_PickerTag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UNSTABLE_PickerTag.js","sources":["../../../src/components/UNSTABLE_Picker/UNSTABLE_PickerTag.tsx"],"sourcesContent":["'use client';\n\nimport React, { useMemo } from 'react';\nimport { Sizes } from '../../constants';\nimport { useI18n } from '../../hooks';\nimport { replaceTranslationParams } from '../../translations';\nimport { ControlButton } from '../ControlButton';\nimport { Icon } from '../Icon';\nimport { Tag } from '../Tag';\nimport { PICKER_NESTED_SIZE_MAP } from './constants';\nimport { usePickerContext } from './PickerContext';\nimport type { SpiritUnstablePickerTagProps } from './types';\nimport { getNodeText } from './utils';\n\nconst UNSTABLE_PickerTag = ({\n children,\n tagKeyboardProps,\n isDisabled,\n label,\n onRemove,\n removeLabel,\n ...restProps\n}: SpiritUnstablePickerTagProps) => {\n const { t } = useI18n();\n const { size = Sizes.MEDIUM, tagDescriptionId } = usePickerContext();\n\n const removeButtonAriaLabel =\n removeLabel ??\n replaceTranslationParams(t('picker.removeItemLabel'), {\n itemLabel: getNodeText(label),\n });\n\n const tagKeyboardEventProps = useMemo(() => {\n if (isDisabled || !tagKeyboardProps) {\n return {};\n }\n\n return {\n onBlurCapture: tagKeyboardProps.onBlurCapture,\n onFocusCapture: tagKeyboardProps.onFocusCapture,\n onKeyDown: tagKeyboardProps.onKeyDown,\n };\n }, [isDisabled, tagKeyboardProps]);\n\n return (\n <Tag\n {...restProps}\n color=\"selected\"\n elementType=\"div\"\n size={PICKER_NESTED_SIZE_MAP[size]}\n isDisabled={isDisabled}\n role=\"row\"\n tabIndex={isDisabled ? -1 : (tagKeyboardProps?.tabIndex ?? 0)}\n aria-label={getNodeText(label)}\n {...tagKeyboardEventProps}\n {...(tagDescriptionId ? { 'aria-describedby': tagDescriptionId } : {})}\n >\n <div role=\"gridcell\" aria-colindex={1} className=\"d-contents\">\n {children ?? <span>{label}</span>}\n <ControlButton\n aria-label={removeButtonAriaLabel}\n isDisabled={isDisabled}\n isSymmetrical\n onClick={onRemove}\n size={PICKER_NESTED_SIZE_MAP[size]}\n {...(tagKeyboardProps && { tabIndex: tagKeyboardProps.removeButtonTabIndex })}\n >\n <Icon name=\"close\" />\n </ControlButton>\n </div>\n </Tag>\n );\n};\n\nUNSTABLE_PickerTag.spiritComponent = 'UNSTABLE_PickerTag';\n\nexport default UNSTABLE_PickerTag;\n"],"names":["UNSTABLE_PickerTag","children","tagKeyboardProps","isDisabled","label","onRemove","removeLabel","restProps","t","useI18n","size","Sizes","tagDescriptionId","usePickerContext","removeButtonAriaLabel","replaceTranslationParams","getNodeText","tagKeyboardEventProps","useMemo","jsx","Tag","PICKER_NESTED_SIZE_MAP","ControlButton","Icon"],"mappings":";;;;;;;;;;;;AAcA,MAAMA,IAAqB,CAAC;AAAA,EAC1B,UAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aA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AAA,EAAA;AAGN;AAEAvB,EAAmB,kBAAkB;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=require("react/jsx-runtime"),t=require("react"),p=require("../../hooks/useSelectionState.cjs"),T=require("../../hooks/useToggle.cjs"),U=require("./UNSTABLE_Picker.cjs"),_=(c,r)=>{const{defaultIsOpen:l=!1,defaultSelectedKeys:i=[],onSelectionChange:u,selectionMode:n,...a}=c,s=t.useRef(null),[d,S]=T.useToggle(l),{selectedKeys:e,setSelectedKeys:f}=p.useSelectionState({defaultSelectedKeys:i,onSelectionChange:u,selectionMode:n});return t.useImperativeHandle(r,()=>({close:()=>s.current?.close(),selectedKeys:e}),[e]),g.jsx(U.default,{...a,ref:s,isOpen:d,onSelectionChange:f,onToggle:S,selectedKeys:e,selectionMode:n})},o=t.forwardRef(_);o.spiritComponent="UNSTABLE_UncontrolledPicker";o.displayName="UNSTABLE_UncontrolledPicker";exports.default=o;
|
|
2
|
+
//# sourceMappingURL=UNSTABLE_UncontrolledPicker.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UNSTABLE_UncontrolledPicker.cjs","sources":["../../../src/components/UNSTABLE_Picker/UNSTABLE_UncontrolledPicker.tsx"],"sourcesContent":["'use client';\n\nimport React, { type ForwardedRef, forwardRef, useImperativeHandle, useRef } from 'react';\nimport { useSelectionState, useToggle } from '../../hooks';\nimport { type ForwardRefComponent } from '../../types';\nimport type { SpiritUnstablePickerRef, SpiritUnstableUncontrolledPickerProps } from './types';\nimport UNSTABLE_Picker from './UNSTABLE_Picker';\n\n// eslint-disable-next-line camelcase\nconst _UNSTABLE_UncontrolledPicker = (\n props: SpiritUnstableUncontrolledPickerProps,\n ref: ForwardedRef<SpiritUnstablePickerRef>,\n) => {\n const { defaultIsOpen = false, defaultSelectedKeys = [], onSelectionChange, selectionMode, ...restProps } = props;\n const pickerRef = useRef<SpiritUnstablePickerRef>(null);\n const [isOpen, onToggle] = useToggle(defaultIsOpen);\n\n const { selectedKeys, setSelectedKeys } = useSelectionState({\n defaultSelectedKeys,\n onSelectionChange,\n selectionMode,\n });\n\n useImperativeHandle(\n ref,\n () => ({\n close: () => pickerRef.current?.close(),\n selectedKeys,\n }),\n [selectedKeys],\n );\n\n return (\n <UNSTABLE_Picker\n {...restProps}\n ref={pickerRef}\n isOpen={isOpen}\n onSelectionChange={setSelectedKeys}\n onToggle={onToggle}\n selectedKeys={selectedKeys}\n selectionMode={selectionMode}\n />\n );\n};\n\nconst UNSTABLE_UncontrolledPicker = forwardRef<SpiritUnstablePickerRef, SpiritUnstableUncontrolledPickerProps>(\n _UNSTABLE_UncontrolledPicker,\n) as ForwardRefComponent<SpiritUnstablePickerRef, SpiritUnstableUncontrolledPickerProps>;\n\nUNSTABLE_UncontrolledPicker.spiritComponent = 'UNSTABLE_UncontrolledPicker';\nUNSTABLE_UncontrolledPicker.displayName = 'UNSTABLE_UncontrolledPicker';\n\nexport default UNSTABLE_UncontrolledPicker;\n"],"names":["_UNSTABLE_UncontrolledPicker","props","ref","defaultIsOpen","defaultSelectedKeys","onSelectionChange","selectionMode","restProps","pickerRef","useRef","isOpen","onToggle","useToggle","selectedKeys","setSelectedKeys","useSelectionState","useImperativeHandle","jsx","UNSTABLE_Picker","UNSTABLE_UncontrolledPicker","forwardRef"],"mappings":"0SASMA,EAA+B,CACnCC,EACAC,IACG,CACH,KAAM,CAAE,cAAAC,EAAgB,GAAO,oBAAAC,EAAsB,CAAA,EAAI,kBAAAC,EAAmB,cAAAC,EAAe,GAAGC,CAAA,EAAcN,EACtGO,EAAYC,EAAAA,OAAgC,IAAI,EAChD,CAACC,EAAQC,CAAQ,EAAIC,EAAAA,UAAUT,CAAa,EAE5C,CAAE,aAAAU,EAAc,gBAAAC,CAAA,EAAoBC,oBAAkB,CAC1D,oBAAAX,EACA,kBAAAC,EACA,cAAAC,CAAA,CACD,EAEDU,OAAAA,EAAAA,oBACEd,EACA,KAAO,CACL,MAAO,IAAMM,EAAU,SAAS,MAAA,EAChC,aAAAK,CAAA,GAEF,CAACA,CAAY,CAAA,EAIbI,EAAAA,IAACC,EAAAA,QAAA,CACE,GAAGX,EACJ,IAAKC,EACL,OAAAE,EACA,kBAAmBI,EACnB,SAAAH,EACA,aAAAE,EACA,cAAAP,CAAA,CAAA,CAGN,EAEMa,EAA8BC,EAAAA,WAClCpB,CACF,EAEAmB,EAA4B,gBAAkB,8BAC9CA,EAA4B,YAAc"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ForwardRefComponent } from '../../types';
|
|
2
|
+
import { SpiritUnstablePickerRef, SpiritUnstableUncontrolledPickerProps } from './types';
|
|
3
|
+
declare const UNSTABLE_UncontrolledPicker: ForwardRefComponent<SpiritUnstablePickerRef, SpiritUnstableUncontrolledPickerProps>;
|
|
4
|
+
export default UNSTABLE_UncontrolledPicker;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as u, useRef as S, useImperativeHandle as U } from "react";
|
|
4
|
+
import { useSelectionState as T } from "../../hooks/useSelectionState.js";
|
|
5
|
+
import { useToggle as g } from "../../hooks/useToggle.js";
|
|
6
|
+
import k from "./UNSTABLE_Picker.js";
|
|
7
|
+
const N = (n, s) => {
|
|
8
|
+
const { defaultIsOpen: c = !1, defaultSelectedKeys: l = [], onSelectionChange: i, selectionMode: o, ...d } = n, t = S(null), [f, p] = g(c), { selectedKeys: e, setSelectedKeys: a } = T({
|
|
9
|
+
defaultSelectedKeys: l,
|
|
10
|
+
onSelectionChange: i,
|
|
11
|
+
selectionMode: o
|
|
12
|
+
});
|
|
13
|
+
return U(
|
|
14
|
+
s,
|
|
15
|
+
() => ({
|
|
16
|
+
close: () => t.current?.close(),
|
|
17
|
+
selectedKeys: e
|
|
18
|
+
}),
|
|
19
|
+
[e]
|
|
20
|
+
), /* @__PURE__ */ m(
|
|
21
|
+
k,
|
|
22
|
+
{
|
|
23
|
+
...d,
|
|
24
|
+
ref: t,
|
|
25
|
+
isOpen: f,
|
|
26
|
+
onSelectionChange: a,
|
|
27
|
+
onToggle: p,
|
|
28
|
+
selectedKeys: e,
|
|
29
|
+
selectionMode: o
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}, r = u(
|
|
33
|
+
N
|
|
34
|
+
);
|
|
35
|
+
r.spiritComponent = "UNSTABLE_UncontrolledPicker";
|
|
36
|
+
r.displayName = "UNSTABLE_UncontrolledPicker";
|
|
37
|
+
export {
|
|
38
|
+
r as default
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=UNSTABLE_UncontrolledPicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UNSTABLE_UncontrolledPicker.js","sources":["../../../src/components/UNSTABLE_Picker/UNSTABLE_UncontrolledPicker.tsx"],"sourcesContent":["'use client';\n\nimport React, { type ForwardedRef, forwardRef, useImperativeHandle, useRef } from 'react';\nimport { useSelectionState, useToggle } from '../../hooks';\nimport { type ForwardRefComponent } from '../../types';\nimport type { SpiritUnstablePickerRef, SpiritUnstableUncontrolledPickerProps } from './types';\nimport UNSTABLE_Picker from './UNSTABLE_Picker';\n\n// eslint-disable-next-line camelcase\nconst _UNSTABLE_UncontrolledPicker = (\n props: SpiritUnstableUncontrolledPickerProps,\n ref: ForwardedRef<SpiritUnstablePickerRef>,\n) => {\n const { defaultIsOpen = false, defaultSelectedKeys = [], onSelectionChange, selectionMode, ...restProps } = props;\n const pickerRef = useRef<SpiritUnstablePickerRef>(null);\n const [isOpen, onToggle] = useToggle(defaultIsOpen);\n\n const { selectedKeys, setSelectedKeys } = useSelectionState({\n defaultSelectedKeys,\n onSelectionChange,\n selectionMode,\n });\n\n useImperativeHandle(\n ref,\n () => ({\n close: () => pickerRef.current?.close(),\n selectedKeys,\n }),\n [selectedKeys],\n );\n\n return (\n <UNSTABLE_Picker\n {...restProps}\n ref={pickerRef}\n isOpen={isOpen}\n onSelectionChange={setSelectedKeys}\n onToggle={onToggle}\n selectedKeys={selectedKeys}\n selectionMode={selectionMode}\n />\n );\n};\n\nconst UNSTABLE_UncontrolledPicker = forwardRef<SpiritUnstablePickerRef, SpiritUnstableUncontrolledPickerProps>(\n _UNSTABLE_UncontrolledPicker,\n) as ForwardRefComponent<SpiritUnstablePickerRef, SpiritUnstableUncontrolledPickerProps>;\n\nUNSTABLE_UncontrolledPicker.spiritComponent = 'UNSTABLE_UncontrolledPicker';\nUNSTABLE_UncontrolledPicker.displayName = 'UNSTABLE_UncontrolledPicker';\n\nexport default UNSTABLE_UncontrolledPicker;\n"],"names":["_UNSTABLE_UncontrolledPicker","props","ref","defaultIsOpen","defaultSelectedKeys","onSelectionChange","selectionMode","restProps","pickerRef","useRef","isOpen","onToggle","useToggle","selectedKeys","setSelectedKeys","useSelectionState","useImperativeHandle","jsx","UNSTABLE_Picker","UNSTABLE_UncontrolledPicker","forwardRef"],"mappings":";;;;;;AASA,MAAMA,IAA+B,CACnCC,GACAC,MACG;AACH,QAAM,EAAE,eAAAC,IAAgB,IAAO,qBAAAC,IAAsB,CAAA,GAAI,mBAAAC,GAAmB,eAAAC,GAAe,GAAGC,EAAA,IAAcN,GACtGO,IAAYC,EAAgC,IAAI,GAChD,CAACC,GAAQC,CAAQ,IAAIC,EAAUT,CAAa,GAE5C,EAAE,cAAAU,GAAc,iBAAAC,EAAA,IAAoBC,EAAkB;AAAA,IAC1D,qBAAAX;AAAA,IACA,mBAAAC;AAAA,IACA,eAAAC;AAAA,EAAA,CACD;AAED,SAAAU;AAAA,IACEd;AAAA,IACA,OAAO;AAAA,MACL,OAAO,MAAMM,EAAU,SAAS,MAAA;AAAA,MAChC,cAAAK;AAAA,IAAA;AAAA,IAEF,CAACA,CAAY;AAAA,EAAA,GAIb,gBAAAI;AAAA,IAACC;AAAA,IAAA;AAAA,MACE,GAAGX;AAAA,MACJ,KAAKC;AAAA,MACL,QAAAE;AAAA,MACA,mBAAmBI;AAAA,MACnB,UAAAH;AAAA,MACA,cAAAE;AAAA,MACA,eAAAP;AAAA,IAAA;AAAA,EAAA;AAGN,GAEMa,IAA8BC;AAAA,EAClCpB;AACF;AAEAmB,EAA4B,kBAAkB;AAC9CA,EAA4B,cAAc;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../constants/dictionaries.cjs"),E=e.Sizes.MEDIUM,S={[e.Sizes.SMALL]:e.SizesExtended.XSMALL,[e.Sizes.MEDIUM]:e.SizesExtended.SMALL,[e.Sizes.LARGE]:e.SizesExtended.MEDIUM};exports.DEFAULT_SIZE=E;exports.PICKER_NESTED_SIZE_MAP=S;
|
|
2
|
+
//# sourceMappingURL=constants.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.cjs","sources":["../../../src/components/UNSTABLE_Picker/constants.ts"],"sourcesContent":["import { Sizes, SizesExtended } from '../../constants';\nimport type { SizeExtendedDictionaryType } from '../../types';\n\ntype PickerShellSize = (typeof Sizes)[keyof typeof Sizes];\n\nexport const DEFAULT_SIZE = Sizes.MEDIUM;\n\n/** Maps picker shell size to extended sizes for nested Tag and ControlButton. */\nexport const PICKER_NESTED_SIZE_MAP: Record<PickerShellSize, SizeExtendedDictionaryType> = {\n [Sizes.SMALL]: SizesExtended.XSMALL,\n [Sizes.MEDIUM]: SizesExtended.SMALL,\n [Sizes.LARGE]: SizesExtended.MEDIUM,\n};\n"],"names":["DEFAULT_SIZE","Sizes","PICKER_NESTED_SIZE_MAP","SizesExtended"],"mappings":"oIAKaA,EAAeC,EAAAA,MAAM,OAGrBC,EAA8E,CACzF,CAACD,EAAAA,MAAM,KAAK,EAAGE,EAAAA,cAAc,OAC7B,CAACF,EAAAA,MAAM,MAAM,EAAGE,EAAAA,cAAc,MAC9B,CAACF,EAAAA,MAAM,KAAK,EAAGE,gBAAc,MAC/B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Sizes } from '../../constants';
|
|
2
|
+
import { SizeExtendedDictionaryType } from '../../types';
|
|
3
|
+
type PickerShellSize = (typeof Sizes)[keyof typeof Sizes];
|
|
4
|
+
export declare const DEFAULT_SIZE: "medium";
|
|
5
|
+
export declare const PICKER_NESTED_SIZE_MAP: Record<PickerShellSize, SizeExtendedDictionaryType>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SizesExtended as M, Sizes as E } from "../../constants/dictionaries.js";
|
|
2
|
+
const S = E.MEDIUM, t = {
|
|
3
|
+
[E.SMALL]: M.XSMALL,
|
|
4
|
+
[E.MEDIUM]: M.SMALL,
|
|
5
|
+
[E.LARGE]: M.MEDIUM
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
S as DEFAULT_SIZE,
|
|
9
|
+
t as PICKER_NESTED_SIZE_MAP
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../src/components/UNSTABLE_Picker/constants.ts"],"sourcesContent":["import { Sizes, SizesExtended } from '../../constants';\nimport type { SizeExtendedDictionaryType } from '../../types';\n\ntype PickerShellSize = (typeof Sizes)[keyof typeof Sizes];\n\nexport const DEFAULT_SIZE = Sizes.MEDIUM;\n\n/** Maps picker shell size to extended sizes for nested Tag and ControlButton. */\nexport const PICKER_NESTED_SIZE_MAP: Record<PickerShellSize, SizeExtendedDictionaryType> = {\n [Sizes.SMALL]: SizesExtended.XSMALL,\n [Sizes.MEDIUM]: SizesExtended.SMALL,\n [Sizes.LARGE]: SizesExtended.MEDIUM,\n};\n"],"names":["DEFAULT_SIZE","Sizes","PICKER_NESTED_SIZE_MAP","SizesExtended"],"mappings":";AAKO,MAAMA,IAAeC,EAAM,QAGrBC,IAA8E;AAAA,EACzF,CAACD,EAAM,KAAK,GAAGE,EAAc;AAAA,EAC7B,CAACF,EAAM,MAAM,GAAGE,EAAc;AAAA,EAC9B,CAACF,EAAM,KAAK,GAAGE,EAAc;AAC/B;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./UNSTABLE_Picker.cjs"),i=require("./UNSTABLE_PickerGroup.cjs"),P=require("./UNSTABLE_PickerItem.cjs"),t=require("./UNSTABLE_PickerTag.cjs"),c=require("./UNSTABLE_UncontrolledPicker.cjs"),r=require("./PickerPopoverContext.cjs"),u=require("./usePickerId.cjs"),e=require("./usePickerPopoverTabOutToTrigger.cjs"),s=require("./usePickerSelectionGridKeyboard.cjs"),k=require("./usePickerStyleProps.cjs");exports.UNSTABLE_Picker=o.default;exports.UNSTABLE_PickerGroup=i.default;exports.UNSTABLE_PickerItem=P.default;exports.UNSTABLE_PickerTag=t.default;exports.UNSTABLE_UncontrolledPicker=c.default;exports.PickerPopoverContextProvider=r.PickerPopoverContextProvider;exports.usePickerPopoverContext=r.usePickerPopoverContext;exports.usePickerId=u.usePickerId;exports.PICKER_POPOVER_FOCUSABLE_SELECTOR=e.PICKER_POPOVER_FOCUSABLE_SELECTOR;exports.getPickerPopoverFocusableElements=e.getPickerPopoverFocusableElements;exports.usePickerPopoverTabOutToTrigger=e.usePickerPopoverTabOutToTrigger;exports.usePickerSelectionGridKeyboard=s.usePickerSelectionGridKeyboard;exports.usePickerStyleProps=k.usePickerStyleProps;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|