@onewelcome/react-lib-components 13.2.0-alpha.1 → 13.3.0-alpha.2
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/dist/components/Breadcrumbs/Breadcrumbs.module.scss.cjs.js +2 -2
- package/dist/components/Breadcrumbs/Breadcrumbs.module.scss.es.js +5 -5
- package/dist/components/Button/BaseButton.module.scss.cjs.js +2 -2
- package/dist/components/Button/BaseButton.module.scss.es.js +4 -4
- package/dist/components/Button/Button.module.scss.cjs.js +2 -2
- package/dist/components/Button/Button.module.scss.es.js +17 -17
- package/dist/components/Button/IconButton.module.scss.cjs.js +2 -2
- package/dist/components/Button/IconButton.module.scss.es.js +18 -18
- package/dist/components/ContextMenu/ContextMenu.cjs.js.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.es.js.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.module.scss.cjs.js +2 -2
- package/dist/components/ContextMenu/ContextMenu.module.scss.es.js +6 -6
- package/dist/components/ContextMenu/ContextMenuDivider.module.scss.cjs.js +2 -2
- package/dist/components/ContextMenu/ContextMenuDivider.module.scss.es.js +2 -2
- package/dist/components/ContextMenu/ContextMenuItem.module.scss.cjs.js +2 -2
- package/dist/components/ContextMenu/ContextMenuItem.module.scss.es.js +3 -3
- package/dist/components/ContextMenu/ContextMenuService.cjs.js +1 -1
- package/dist/components/ContextMenu/ContextMenuService.cjs.js.map +1 -1
- package/dist/components/ContextMenu/ContextMenuService.es.js +20 -17
- package/dist/components/ContextMenu/ContextMenuService.es.js.map +1 -1
- package/dist/components/DataGrid/DataGrid.cjs.js +1 -1
- package/dist/components/DataGrid/DataGrid.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGrid.es.js +76 -51
- package/dist/components/DataGrid/DataGrid.es.js.map +1 -1
- package/dist/components/DataGrid/DataGrid.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGrid.module.scss.es.js +8 -7
- package/dist/components/DataGrid/DataGrid.module.scss.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridActions/DataGridActions.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridActions/DataGridActions.module.scss.es.js +6 -6
- package/dist/components/DataGrid/DataGridActions/DataGridColumnsToggle.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridActions/DataGridColumnsToggle.module.scss.es.js +7 -7
- package/dist/components/DataGrid/DataGridBody/DataGridBody.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridBody/DataGridBody.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridBody/DataGridBody.es.js +4 -2
- package/dist/components/DataGrid/DataGridBody/DataGridBody.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridBody/DataGridBody.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridBody/DataGridBody.module.scss.es.js +2 -2
- package/dist/components/DataGrid/DataGridBody/DataGridCell/DataGridCell.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridBody/DataGridCell/DataGridCell.module.scss.es.js +5 -5
- package/dist/components/DataGrid/DataGridBody/DataGridDrawer/DataGridDrawer.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridBody/DataGridDrawer/DataGridDrawer.module.scss.es.js +4 -4
- package/dist/components/DataGrid/DataGridBody/DataGridDrawer/DataGridDrawerItem.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridBody/DataGridDrawer/DataGridDrawerItem.module.scss.es.js +5 -5
- package/dist/components/DataGrid/DataGridBody/DataGridRow/DataGridRow.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridBody/DataGridRow/DataGridRow.module.scss.es.js +24 -24
- package/dist/components/DataGrid/DataGridBody/DataGridRow/useNestedRow.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridBody/DataGridRow/useNestedRow.es.js +1 -1
- package/dist/components/DataGrid/DataGridBody/DataGridRow/useNestedRow.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilter.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilter.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilter.es.js +4 -4
- package/dist/components/DataGrid/DataGridFilters/DataGridFilter.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilter.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridFilters/DataGridFilter.module.scss.es.js +9 -9
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterService.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterService.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterService.es.js +44 -25
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterService.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterTag.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterTag.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterTag.es.js +15 -4
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterTag.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterValueSelect.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterValueSelect.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterValueSelect.es.js +56 -6
- package/dist/components/DataGrid/DataGridFilters/DataGridFilterValueSelect.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilters.interfaces.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridFilters.interfaces.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbar.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbar.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbar.es.js +4 -4
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbar.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbar.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridFilters/DataGridToolbar.module.scss.es.js +10 -10
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.es.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePicker.module.scss.es.js +17 -17
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePickerCalendarSection.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePickerCalendarSection.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePickerCalendarSection.es.js +45 -24
- package/dist/components/DataGrid/DataGridFilters/DateTimePicker/DateTimePickerCalendarSection.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/useFiltersReducer.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridFilters/useFiltersReducer.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridFilters/useFiltersReducer.es.js +7 -9
- package/dist/components/DataGrid/DataGridFilters/useFiltersReducer.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridHeader/DataGridHeader.cjs.js +1 -1
- package/dist/components/DataGrid/DataGridHeader/DataGridHeader.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridHeader/DataGridHeader.es.js +5 -2
- package/dist/components/DataGrid/DataGridHeader/DataGridHeader.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridHeader/DataGridHeader.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridHeader/DataGridHeader.module.scss.es.js +7 -4
- package/dist/components/DataGrid/DataGridHeader/DataGridHeader.module.scss.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridHeader/DataGridHeaderCell.cjs.js.map +1 -1
- package/dist/components/DataGrid/DataGridHeader/DataGridHeaderCell.es.js +1 -1
- package/dist/components/DataGrid/DataGridHeader/DataGridHeaderCell.es.js.map +1 -1
- package/dist/components/DataGrid/DataGridHeader/DataGridHeaderCell.module.scss.cjs.js +2 -2
- package/dist/components/DataGrid/DataGridHeader/DataGridHeaderCell.module.scss.es.js +11 -11
- package/dist/components/DatePicker/DatePicker.module.scss.cjs.js +2 -2
- package/dist/components/DatePicker/DatePicker.module.scss.es.js +31 -31
- package/dist/components/Form/Checkbox/Checkbox.module.scss.cjs.js +2 -2
- package/dist/components/Form/Checkbox/Checkbox.module.scss.es.js +13 -13
- package/dist/components/Form/Fieldset/Fieldset.cjs.js +1 -1
- package/dist/components/Form/Fieldset/Fieldset.cjs.js.map +1 -1
- package/dist/components/Form/Fieldset/Fieldset.es.js +2 -1
- package/dist/components/Form/Fieldset/Fieldset.es.js.map +1 -1
- package/dist/components/Form/Fieldset/Fieldset.module.scss.cjs.js +2 -2
- package/dist/components/Form/Fieldset/Fieldset.module.scss.es.js +8 -5
- package/dist/components/Form/Fieldset/Fieldset.module.scss.es.js.map +1 -1
- package/dist/components/Form/FileUpload/FileItem/FileItem.cjs.js +1 -1
- package/dist/components/Form/FileUpload/FileItem/FileItem.cjs.js.map +1 -1
- package/dist/components/Form/FileUpload/FileItem/FileItem.es.js +1 -1
- package/dist/components/Form/FileUpload/FileItem/FileItem.es.js.map +1 -1
- package/dist/components/Form/FileUpload/FileItem/FileItem.module.scss.cjs.js +2 -2
- package/dist/components/Form/FileUpload/FileItem/FileItem.module.scss.es.js +18 -18
- package/dist/components/Form/FileUpload/FileUpload.cjs.js +1 -1
- package/dist/components/Form/FileUpload/FileUpload.cjs.js.map +1 -1
- package/dist/components/Form/FileUpload/FileUpload.es.js +6 -6
- package/dist/components/Form/FileUpload/FileUpload.es.js.map +1 -1
- package/dist/components/Form/FileUpload/FileUpload.module.scss.cjs.js +2 -2
- package/dist/components/Form/FileUpload/FileUpload.module.scss.es.js +16 -16
- package/dist/components/Form/Form.module.scss.cjs.js +2 -2
- package/dist/components/Form/Form.module.scss.es.js +2 -2
- package/dist/components/Form/FormControl/FormControl.module.scss.cjs.js +2 -2
- package/dist/components/Form/FormControl/FormControl.module.scss.es.js +13 -13
- package/dist/components/Form/FormErrorText/FormErrorText.module.scss.cjs.js +2 -2
- package/dist/components/Form/FormErrorText/FormErrorText.module.scss.es.js +9 -6
- package/dist/components/Form/FormErrorText/FormErrorText.module.scss.es.js.map +1 -1
- package/dist/components/Form/FormGroup/FormGroup.module.scss.cjs.js +2 -2
- package/dist/components/Form/FormGroup/FormGroup.module.scss.es.js +3 -3
- package/dist/components/Form/FormHelperText/FormHelperText.module.scss.cjs.js +2 -2
- package/dist/components/Form/FormHelperText/FormHelperText.module.scss.es.js +4 -4
- package/dist/components/Form/FormSelectorWrapper/FormSelectorWrapper.cjs.js +1 -1
- package/dist/components/Form/FormSelectorWrapper/FormSelectorWrapper.cjs.js.map +1 -1
- package/dist/components/Form/FormSelectorWrapper/FormSelectorWrapper.es.js +4 -1
- package/dist/components/Form/FormSelectorWrapper/FormSelectorWrapper.es.js.map +1 -1
- package/dist/components/Form/FormSelectorWrapper/FormSelectorWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/FormSelectorWrapper/FormSelectorWrapper.module.scss.es.js +6 -6
- package/dist/components/Form/Input/Input.cjs.js +1 -1
- package/dist/components/Form/Input/Input.cjs.js.map +1 -1
- package/dist/components/Form/Input/Input.es.js +2 -1
- package/dist/components/Form/Input/Input.es.js.map +1 -1
- package/dist/components/Form/Input/Input.module.scss.cjs.js +2 -2
- package/dist/components/Form/Input/Input.module.scss.es.js +8 -8
- package/dist/components/Form/Label/Label.module.scss.cjs.js +2 -2
- package/dist/components/Form/Label/Label.module.scss.es.js +2 -2
- package/dist/components/Form/Radio/Radio.cjs.js.map +1 -1
- package/dist/components/Form/Radio/Radio.es.js +1 -1
- package/dist/components/Form/Radio/Radio.es.js.map +1 -1
- package/dist/components/Form/Radio/Radio.module.scss.cjs.js +2 -2
- package/dist/components/Form/Radio/Radio.module.scss.es.js +11 -11
- package/dist/components/Form/Select/MultiSelect/MultiOption.cjs.js +1 -1
- package/dist/components/Form/Select/MultiSelect/MultiOption.cjs.js.map +1 -1
- package/dist/components/Form/Select/MultiSelect/MultiOption.es.js +6 -6
- package/dist/components/Form/Select/MultiSelect/MultiOption.es.js.map +1 -1
- package/dist/components/Form/Select/MultiSelect/MultiSelect.cjs.js +1 -1
- package/dist/components/Form/Select/MultiSelect/MultiSelect.cjs.js.map +1 -1
- package/dist/components/Form/Select/MultiSelect/MultiSelect.es.js +198 -40
- package/dist/components/Form/Select/MultiSelect/MultiSelect.es.js.map +1 -1
- package/dist/components/Form/Select/MultiSelect/MultiSelect.module.scss.cjs.js +2 -2
- package/dist/components/Form/Select/MultiSelect/MultiSelect.module.scss.es.js +18 -15
- package/dist/components/Form/Select/MultiSelect/MultiSelect.module.scss.es.js.map +1 -1
- package/dist/components/Form/Select/MultiSelect/SelectButton.module.scss.cjs.js +2 -2
- package/dist/components/Form/Select/MultiSelect/SelectButton.module.scss.es.js +2 -2
- package/dist/components/Form/Select/MultiSelect/SelectedOptions.cjs.js.map +1 -1
- package/dist/components/Form/Select/MultiSelect/SelectedOptions.es.js.map +1 -1
- package/dist/components/Form/Select/MultiSelect/SelectedOptions.module.scss.cjs.js +2 -2
- package/dist/components/Form/Select/MultiSelect/SelectedOptions.module.scss.es.js +4 -4
- package/dist/components/Form/Select/MultiSelect/useArrowNavigation.cjs.js +1 -1
- package/dist/components/Form/Select/MultiSelect/useArrowNavigation.cjs.js.map +1 -1
- package/dist/components/Form/Select/MultiSelect/useArrowNavigation.es.js +81 -33
- package/dist/components/Form/Select/MultiSelect/useArrowNavigation.es.js.map +1 -1
- package/dist/components/Form/Select/MultiSelect/useSearch.cjs.js +1 -1
- package/dist/components/Form/Select/MultiSelect/useSearch.cjs.js.map +1 -1
- package/dist/components/Form/Select/MultiSelect/useSearch.es.js +40 -6
- package/dist/components/Form/Select/MultiSelect/useSearch.es.js.map +1 -1
- package/dist/components/Form/Select/Select.interfaces.cjs.js.map +1 -1
- package/dist/components/Form/Select/Select.interfaces.es.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/Option.cjs.js +1 -1
- package/dist/components/Form/Select/SingleSelect/Option.cjs.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/Option.es.js +10 -3
- package/dist/components/Form/Select/SingleSelect/Option.es.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/Select.cjs.js +1 -1
- package/dist/components/Form/Select/SingleSelect/Select.cjs.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/Select.es.js +169 -31
- package/dist/components/Form/Select/SingleSelect/Select.es.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/Select.module.scss.cjs.js +2 -2
- package/dist/components/Form/Select/SingleSelect/Select.module.scss.es.js +20 -17
- package/dist/components/Form/Select/SingleSelect/Select.module.scss.es.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/useArrowNavigation.cjs.js +1 -1
- package/dist/components/Form/Select/SingleSelect/useArrowNavigation.cjs.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/useArrowNavigation.es.js +119 -91
- package/dist/components/Form/Select/SingleSelect/useArrowNavigation.es.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/useSearch.cjs.js +1 -1
- package/dist/components/Form/Select/SingleSelect/useSearch.cjs.js.map +1 -1
- package/dist/components/Form/Select/SingleSelect/useSearch.es.js +34 -4
- package/dist/components/Form/Select/SingleSelect/useSearch.es.js.map +1 -1
- package/dist/components/Form/Select/useAddNewBtn.module.scss.cjs.js +2 -2
- package/dist/components/Form/Select/useAddNewBtn.module.scss.es.js +4 -4
- package/dist/components/Form/Select/useSelectPositionList.cjs.js +1 -1
- package/dist/components/Form/Select/useSelectPositionList.cjs.js.map +1 -1
- package/dist/components/Form/Select/useSelectPositionList.es.js +18 -5
- package/dist/components/Form/Select/useSelectPositionList.es.js.map +1 -1
- package/dist/components/Form/Textarea/Textarea.cjs.js +1 -1
- package/dist/components/Form/Textarea/Textarea.cjs.js.map +1 -1
- package/dist/components/Form/Textarea/Textarea.es.js +4 -0
- package/dist/components/Form/Textarea/Textarea.es.js.map +1 -1
- package/dist/components/Form/Textarea/Textarea.module.scss.cjs.js +2 -2
- package/dist/components/Form/Textarea/Textarea.module.scss.es.js +6 -6
- package/dist/components/Form/Toggle/Toggle.cjs.js +1 -1
- package/dist/components/Form/Toggle/Toggle.cjs.js.map +1 -1
- package/dist/components/Form/Toggle/Toggle.es.js +5 -3
- package/dist/components/Form/Toggle/Toggle.es.js.map +1 -1
- package/dist/components/Form/Toggle/Toggle.module.scss.cjs.js +2 -2
- package/dist/components/Form/Toggle/Toggle.module.scss.es.js +18 -18
- package/dist/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.cjs.js +1 -1
- package/dist/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.cjs.js.map +1 -1
- package/dist/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.es.js +25 -17
- package/dist/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.es.js.map +1 -1
- package/dist/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.module.scss.es.js +8 -4
- package/dist/components/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.module.scss.es.js.map +1 -1
- package/dist/components/Form/Wrapper/InputWrapper/InputWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/InputWrapper/InputWrapper.module.scss.es.js +5 -5
- package/dist/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.module.scss.es.js +3 -3
- package/dist/components/Form/Wrapper/RadioWrapper/RadioWrapper.cjs.js +1 -1
- package/dist/components/Form/Wrapper/RadioWrapper/RadioWrapper.cjs.js.map +1 -1
- package/dist/components/Form/Wrapper/RadioWrapper/RadioWrapper.es.js +37 -21
- package/dist/components/Form/Wrapper/RadioWrapper/RadioWrapper.es.js.map +1 -1
- package/dist/components/Form/Wrapper/RadioWrapper/RadioWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/RadioWrapper/RadioWrapper.module.scss.es.js +8 -4
- package/dist/components/Form/Wrapper/RadioWrapper/RadioWrapper.module.scss.es.js.map +1 -1
- package/dist/components/Form/Wrapper/SelectWrapper/SelectWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/SelectWrapper/SelectWrapper.module.scss.es.js +3 -3
- package/dist/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.cjs.js +1 -1
- package/dist/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.cjs.js.map +1 -1
- package/dist/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.es.js +2 -0
- package/dist/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.es.js.map +1 -1
- package/dist/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/TextareaWrapper/TextareaWrapper.module.scss.es.js +8 -8
- package/dist/components/Form/Wrapper/Wrapper/Wrapper.cjs.js +1 -1
- package/dist/components/Form/Wrapper/Wrapper/Wrapper.cjs.js.map +1 -1
- package/dist/components/Form/Wrapper/Wrapper/Wrapper.es.js +1 -1
- package/dist/components/Form/Wrapper/Wrapper/Wrapper.es.js.map +1 -1
- package/dist/components/Form/Wrapper/Wrapper/Wrapper.module.scss.cjs.js +2 -2
- package/dist/components/Form/Wrapper/Wrapper/Wrapper.module.scss.es.js +6 -6
- package/dist/components/Icon/Icon.cjs.js +1 -1
- package/dist/components/Icon/Icon.cjs.js.map +1 -1
- package/dist/components/Icon/Icon.es.js +1 -1
- package/dist/components/Icon/Icon.es.js.map +1 -1
- package/dist/components/Icon/Icon.module.scss.cjs.js +2 -2
- package/dist/components/Icon/Icon.module.scss.es.js +108 -108
- package/dist/components/Layout/ActionBar/ActionBar.module.scss.cjs.js +2 -2
- package/dist/components/Layout/ActionBar/ActionBar.module.scss.es.js +10 -10
- package/dist/components/Layout/Card/Card.module.scss.cjs.js +2 -2
- package/dist/components/Layout/Card/Card.module.scss.es.js +12 -12
- package/dist/components/Layout/ContentHeader/ContentHeader.cjs.js +1 -1
- package/dist/components/Layout/ContentHeader/ContentHeader.cjs.js.map +1 -1
- package/dist/components/Layout/ContentHeader/ContentHeader.es.js +66 -41
- package/dist/components/Layout/ContentHeader/ContentHeader.es.js.map +1 -1
- package/dist/components/Layout/ContentHeader/ContentHeader.module.scss.cjs.js +2 -2
- package/dist/components/Layout/ContentHeader/ContentHeader.module.scss.es.js +28 -13
- package/dist/components/Layout/ContentHeader/ContentHeader.module.scss.es.js.map +1 -1
- package/dist/components/Layout/FormPage/FormWithStepper/FormSection/FormSection.module.scss.cjs.js +2 -2
- package/dist/components/Layout/FormPage/FormWithStepper/FormSection/FormSection.module.scss.es.js +4 -4
- package/dist/components/Layout/FormPage/FormWithStepper/FormStepper/FormStepper.module.scss.cjs.js +2 -2
- package/dist/components/Layout/FormPage/FormWithStepper/FormStepper/FormStepper.module.scss.es.js +2 -2
- package/dist/components/Layout/FormPage/FormWithStepper/FormWithStepper.module.scss.cjs.js +2 -2
- package/dist/components/Layout/FormPage/FormWithStepper/FormWithStepper.module.scss.es.js +3 -3
- package/dist/components/Link/Link.cjs.js.map +1 -1
- package/dist/components/Link/Link.es.js +1 -1
- package/dist/components/Link/Link.es.js.map +1 -1
- package/dist/components/Link/Link.module.scss.cjs.js +2 -2
- package/dist/components/Link/Link.module.scss.es.js +17 -17
- package/dist/components/Notifications/Alert/AlertContainer/AlertContainer.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/Alert/AlertContainer/AlertContainer.module.scss.es.js +11 -11
- package/dist/components/Notifications/Alert/AlertContainer/useAlertContainerHeightAnimation.cjs.js +1 -1
- package/dist/components/Notifications/Alert/AlertContainer/useAlertContainerHeightAnimation.cjs.js.map +1 -1
- package/dist/components/Notifications/Alert/AlertContainer/useAlertContainerHeightAnimation.es.js +7 -1
- package/dist/components/Notifications/Alert/AlertContainer/useAlertContainerHeightAnimation.es.js.map +1 -1
- package/dist/components/Notifications/Alert/AlertItem/AlertItem.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/Alert/AlertItem/AlertItem.module.scss.es.js +22 -22
- package/dist/components/Notifications/Banner/Banner.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/Banner/Banner.module.scss.es.js +9 -9
- package/dist/components/Notifications/BaseModal/BaseModal.cjs.js +1 -1
- package/dist/components/Notifications/BaseModal/BaseModal.cjs.js.map +1 -1
- package/dist/components/Notifications/BaseModal/BaseModal.es.js +1 -1
- package/dist/components/Notifications/BaseModal/BaseModal.es.js.map +1 -1
- package/dist/components/Notifications/BaseModal/BaseModal.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/BaseModal/BaseModal.module.scss.es.js +5 -5
- package/dist/components/Notifications/BaseModal/BaseModalActions/BaseModalActions.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/BaseModal/BaseModalActions/BaseModalActions.module.scss.es.js +4 -4
- package/dist/components/Notifications/BaseModal/BaseModalContent/BaseModalContent.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/BaseModal/BaseModalContent/BaseModalContent.module.scss.es.js +2 -2
- package/dist/components/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.module.scss.es.js +6 -6
- package/dist/components/Notifications/Dialog/Dialog.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/Dialog/Dialog.module.scss.es.js +4 -4
- package/dist/components/Notifications/Dialog/DialogActions/DialogActions.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/Dialog/DialogActions/DialogActions.module.scss.es.js +3 -3
- package/dist/components/Notifications/Dialog/DialogTitle/DialogTitle.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/Dialog/DialogTitle/DialogTitle.module.scss.es.js +10 -10
- package/dist/components/Notifications/SideSheet/SideSheet.cjs.js.map +1 -1
- package/dist/components/Notifications/SideSheet/SideSheet.es.js +1 -1
- package/dist/components/Notifications/SideSheet/SideSheet.es.js.map +1 -1
- package/dist/components/Notifications/SideSheet/SideSheet.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/SideSheet/SideSheet.module.scss.es.js +13 -13
- package/dist/components/Notifications/SideSheet/SideSheetContent/SideSheetContent.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/SideSheet/SideSheetContent/SideSheetContent.module.scss.es.js +2 -2
- package/dist/components/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.module.scss.es.js +2 -2
- package/dist/components/Notifications/SlideInModal/SlideInModal.cjs.js.map +1 -1
- package/dist/components/Notifications/SlideInModal/SlideInModal.es.js +1 -1
- package/dist/components/Notifications/SlideInModal/SlideInModal.es.js.map +1 -1
- package/dist/components/Notifications/SlideInModal/SlideInModal.module.scss.cjs.js +2 -2
- package/dist/components/Notifications/SlideInModal/SlideInModal.module.scss.es.js +10 -10
- package/dist/components/Pagination/Pagination.cjs.js +1 -1
- package/dist/components/Pagination/Pagination.cjs.js.map +1 -1
- package/dist/components/Pagination/Pagination.es.js +118 -90
- package/dist/components/Pagination/Pagination.es.js.map +1 -1
- package/dist/components/Pagination/Pagination.module.scss.cjs.js +2 -2
- package/dist/components/Pagination/Pagination.module.scss.es.js +15 -14
- package/dist/components/Pagination/Pagination.module.scss.es.js.map +1 -1
- package/dist/components/Popover/Popover.module.scss.cjs.js +2 -2
- package/dist/components/Popover/Popover.module.scss.es.js +3 -3
- package/dist/components/ProgressBar/ProgressBar.cjs.js.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.es.js.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.module.scss.cjs.js +2 -2
- package/dist/components/ProgressBar/ProgressBar.module.scss.es.js +9 -9
- package/dist/components/Skeleton/Skeleton.module.scss.cjs.js +2 -2
- package/dist/components/Skeleton/Skeleton.module.scss.es.js +5 -5
- package/dist/components/Spinner/Spinner.module.scss.cjs.js +2 -2
- package/dist/components/Spinner/Spinner.module.scss.es.js +3 -3
- package/dist/components/Stepper/Step.module.scss.cjs.js +2 -2
- package/dist/components/Stepper/Step.module.scss.es.js +22 -22
- package/dist/components/Stepper/Stepper.module.scss.cjs.js +2 -2
- package/dist/components/Stepper/Stepper.module.scss.es.js +4 -4
- package/dist/components/Tabs/Tab.module.scss.cjs.js +2 -2
- package/dist/components/Tabs/Tab.module.scss.es.js +3 -3
- package/dist/components/Tabs/TabButton.module.scss.cjs.js +2 -2
- package/dist/components/Tabs/TabButton.module.scss.es.js +12 -12
- package/dist/components/Tabs/Tabs.cjs.js +1 -1
- package/dist/components/Tabs/Tabs.cjs.js.map +1 -1
- package/dist/components/Tabs/Tabs.es.js +1 -1
- package/dist/components/Tabs/Tabs.es.js.map +1 -1
- package/dist/components/Tabs/Tabs.module.scss.cjs.js +2 -2
- package/dist/components/Tabs/Tabs.module.scss.es.js +10 -10
- package/dist/components/Tag/RemoveButton.module.scss.cjs.js +2 -2
- package/dist/components/Tag/RemoveButton.module.scss.es.js +3 -3
- package/dist/components/Tag/Tag.cjs.js +1 -1
- package/dist/components/Tag/Tag.cjs.js.map +1 -1
- package/dist/components/Tag/Tag.es.js +1 -1
- package/dist/components/Tag/Tag.es.js.map +1 -1
- package/dist/components/Tag/Tag.module.scss.cjs.js +2 -2
- package/dist/components/Tag/Tag.module.scss.es.js +6 -6
- package/dist/components/TextEllipsis/TextEllipsis.cjs.js.map +1 -1
- package/dist/components/TextEllipsis/TextEllipsis.es.js.map +1 -1
- package/dist/components/TextEllipsis/TextEllipsis.module.scss.cjs.js +2 -2
- package/dist/components/TextEllipsis/TextEllipsis.module.scss.es.js +3 -3
- package/dist/components/Tiles/Tile.cjs.js.map +1 -1
- package/dist/components/Tiles/Tile.es.js.map +1 -1
- package/dist/components/Tiles/Tile.module.scss.cjs.js +2 -2
- package/dist/components/Tiles/Tile.module.scss.es.js +8 -8
- package/dist/components/Tiles/Tiles.module.scss.cjs.js +2 -2
- package/dist/components/Tiles/Tiles.module.scss.es.js +2 -2
- package/dist/components/Tooltip/Tooltip.cjs.js +1 -1
- package/dist/components/Tooltip/Tooltip.cjs.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.es.js +9 -16
- package/dist/components/Tooltip/Tooltip.es.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.module.scss.cjs.js +2 -2
- package/dist/components/Tooltip/Tooltip.module.scss.es.js +28 -27
- package/dist/components/Tooltip/Tooltip.module.scss.es.js.map +1 -1
- package/dist/components/Typography/Typography.module.scss.cjs.js +2 -2
- package/dist/components/Typography/Typography.module.scss.es.js +13 -13
- package/dist/components/_BaseStyling_/BaseStyling.cjs.js +2 -1
- package/dist/components/_BaseStyling_/BaseStyling.cjs.js.map +1 -1
- package/dist/components/_BaseStyling_/BaseStyling.es.js +3 -3
- package/dist/components/_BaseStyling_/BaseStyling.es.js.map +1 -1
- package/dist/components/admin/layout/LeftNav/LeftNav.cjs.js.map +1 -1
- package/dist/components/admin/layout/LeftNav/LeftNav.es.js +1 -1
- package/dist/components/admin/layout/LeftNav/LeftNav.es.js.map +1 -1
- package/dist/components/admin/layout/LeftNav/LeftNav.module.scss.cjs.js +2 -2
- package/dist/components/admin/layout/LeftNav/LeftNav.module.scss.es.js +5 -5
- package/dist/components/admin/layout/LeftNav/LeftNavItem/LeftNavItem.module.scss.cjs.js +2 -2
- package/dist/components/admin/layout/LeftNav/LeftNavItem/LeftNavItem.module.scss.es.js +14 -14
- package/dist/components/admin/layout/LeftNav/useRefItems.cjs.js +1 -1
- package/dist/components/admin/layout/LeftNav/useRefItems.cjs.js.map +1 -1
- package/dist/components/admin/layout/LeftNav/useRefItems.es.js +7 -6
- package/dist/components/admin/layout/LeftNav/useRefItems.es.js.map +1 -1
- package/dist/components/admin/layout/MicrofrontendContainer/MicrofrontendContainer.module.scss.cjs.js +2 -2
- package/dist/components/admin/layout/MicrofrontendContainer/MicrofrontendContainer.module.scss.es.js +3 -3
- package/dist/components/admin/layout/ProfileMenu/ProfileMenu.module.scss.cjs.js +2 -2
- package/dist/components/admin/layout/ProfileMenu/ProfileMenu.module.scss.es.js +7 -7
- package/dist/components/admin/layout/TopNavBar/TopNavBar.module.scss.cjs.js +2 -2
- package/dist/components/admin/layout/TopNavBar/TopNavBar.module.scss.es.js +13 -13
- package/dist/components/miscellaneous/IdentityProviderButton.module.scss.cjs.js +2 -2
- package/dist/components/miscellaneous/IdentityProviderButton.module.scss.es.js +3 -3
- package/dist/components/withReadOnly.cjs.js +1 -1
- package/dist/components/withReadOnly.cjs.js.map +1 -1
- package/dist/components/withReadOnly.es.js +2 -4
- package/dist/components/withReadOnly.es.js.map +1 -1
- package/dist/hooks/useScreenSize.cjs.js +1 -1
- package/dist/hooks/useScreenSize.cjs.js.map +1 -1
- package/dist/hooks/useScreenSize.es.js +1 -1
- package/dist/hooks/useScreenSize.es.js.map +1 -1
- package/dist/hooks/useStickyStacking.cjs.js +2 -0
- package/dist/hooks/useStickyStacking.cjs.js.map +1 -0
- package/dist/hooks/useStickyStacking.es.js +208 -0
- package/dist/hooks/useStickyStacking.es.js.map +1 -0
- package/dist/hooks/useUploadFile.cjs.js +1 -1
- package/dist/hooks/useUploadFile.cjs.js.map +1 -1
- package/dist/hooks/useUploadFile.es.js +1 -1
- package/dist/hooks/useUploadFile.es.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +95 -7
- package/dist/index.es.js +2 -0
- package/dist/index.es.js.map +1 -1
- package/dist/readyclasses.module.scss.cjs.js +2 -2
- package/dist/readyclasses.module.scss.es.js +5 -5
- package/dist/util/helper.cjs.js +1 -1
- package/dist/util/helper.cjs.js.map +1 -1
- package/dist/util/helper.es.js +14 -16
- package/dist/util/helper.es.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var t=document.createElement("style");t.appendChild(document.createTextNode('.TabButton_sr-
|
|
2
|
-
const hidden = "
|
|
3
|
-
const tabbutton = "
|
|
4
|
-
const selected = "
|
|
5
|
-
const fluid = "
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var t=document.createElement("style");t.appendChild(document.createTextNode('.TabButton_sr-only_PX3IM{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.TabButton_hidden_PX3IM{display:none}.TabButton_slide-in_PX3IM{animation:TabButton_slide-in_PX3IM .5s forwards}@media(prefers-reduced-motion:reduce){.TabButton_slide-in_PX3IM{animation-duration:.1ms}}.TabButton_slide-out_PX3IM{animation:TabButton_slide-out_PX3IM .5s forwards}@media(prefers-reduced-motion:reduce){.TabButton_slide-out_PX3IM{animation-duration:.1ms}}@keyframes TabButton_slide-in_PX3IM{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@keyframes TabButton_slide-out_PX3IM{0%{transform:translateY(0)}to{transform:translateY(100vh)}}/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.TabButton_tabbutton_PX3IM{color:var(--tab-text-color);border:0;border-radius:0;font-size:var(--font-size);line-height:var(--default-line-height);margin:0;padding:.5rem 1rem;cursor:pointer;font-family:var(--font-family);background-color:transparent;white-space:nowrap;position:relative;font-weight:400;border-bottom-style:var(--tablist-border-style);border-bottom-width:var(--tablist-border-width);border-bottom-color:var(--tablist-border-color)}.TabButton_tabbutton_PX3IM:focus-visible{outline:calc(.125 * var(--font-size)) solid var(--color-focus);outline-offset:0;border-radius:var(--focus-border-radius)}.TabButton_tabbutton_PX3IM:where(:focus-visible){z-index:1}.TabButton_tabbutton_PX3IM:disabled{color:var(--greyed-out);cursor:not-allowed}.TabButton_tabbutton_PX3IM:hover:not(:disabled){background-color:var(--tab-hover-color)}.TabButton_tabbutton_PX3IM:active:not(:disabled){background-color:var(--tab-pressed-color)}.TabButton_tabbutton_PX3IM.TabButton_selected_PX3IM{color:var(--tab-active-text-color)}.TabButton_tabbutton_PX3IM.TabButton_fluid_PX3IM{flex:1}.TabButton_tabbutton_PX3IM.TabButton_has-icon_PX3IM{gap:calc(.25 * var(--font-size));display:inline-flex;align-items:center}.TabButton_tabbutton_PX3IM.TabButton_has-icon_PX3IM i{display:flex}.TabButton_tabbutton_PX3IM.TabButton_has-icon_PX3IM span[data-icon]{display:inline-block;font-size:var(--font-size-big);width:var(--font-size-big)}.TabButton_tabbutton_PX3IM.TabButton_has-icon_PX3IM.TabButton_top-icon_PX3IM,.TabButton_tabbutton_PX3IM.TabButton_has-icon_PX3IM.TabButton_bottom-icon_PX3IM{flex-direction:column}.TabButton_tabbutton_PX3IM.TabButton_has-icon_PX3IM.TabButton_left-icon_PX3IM i,.TabButton_tabbutton_PX3IM.TabButton_has-icon_PX3IM.TabButton_top-icon_PX3IM i{order:-1}')),document.head.appendChild(t)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}}();
|
|
2
|
+
const hidden = "TabButton_hidden_PX3IM";
|
|
3
|
+
const tabbutton = "TabButton_tabbutton_PX3IM";
|
|
4
|
+
const selected = "TabButton_selected_PX3IM";
|
|
5
|
+
const fluid = "TabButton_fluid_PX3IM";
|
|
6
6
|
const classes = {
|
|
7
|
-
"sr-only": "TabButton_sr-
|
|
7
|
+
"sr-only": "TabButton_sr-only_PX3IM",
|
|
8
8
|
hidden,
|
|
9
|
-
"slide-in": "TabButton_slide-
|
|
10
|
-
"slide-out": "TabButton_slide-
|
|
9
|
+
"slide-in": "TabButton_slide-in_PX3IM",
|
|
10
|
+
"slide-out": "TabButton_slide-out_PX3IM",
|
|
11
11
|
tabbutton,
|
|
12
12
|
selected,
|
|
13
13
|
fluid,
|
|
14
|
-
"has-icon": "TabButton_has-
|
|
15
|
-
"top-icon": "TabButton_top-
|
|
16
|
-
"bottom-icon": "TabButton_bottom-
|
|
17
|
-
"left-icon": "TabButton_left-
|
|
14
|
+
"has-icon": "TabButton_has-icon_PX3IM",
|
|
15
|
+
"top-icon": "TabButton_top-icon_PX3IM",
|
|
16
|
+
"bottom-icon": "TabButton_bottom-icon_PX3IM",
|
|
17
|
+
"left-icon": "TabButton_left-icon_PX3IM"
|
|
18
18
|
};
|
|
19
19
|
export {
|
|
20
20
|
classes as default,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("./TabButton.cjs.js"),r=require("./Tabs.module.scss.cjs.js"),n=e.forwardRef(({children:n,selected:o=0,onTabChange:s,className:l,fluid:a,tabListClassName:i,align:c,iconsPosition:u="left",tabChanging:d,activateOnFocus:f=!0,...p},b)=>{const h=e=>Object.prototype.hasOwnProperty.call(e.props,"title"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("./TabButton.cjs.js"),r=require("./Tabs.module.scss.cjs.js"),n=e.forwardRef(({children:n,selected:o=0,onTabChange:s,className:l,fluid:a,tabListClassName:i,align:c,iconsPosition:u="left",tabChanging:d,activateOnFocus:f=!0,...p},b)=>{const h=e=>Object.prototype.hasOwnProperty.call(e.props,"title"),m=t=>{const r=e.Children.toArray(n),o=e=>Boolean(e&&h(e)&&!e.props.disabled);if(t>=0&&t<r.length&&o(r[t]))return t;const s=r.findIndex(o);return-1===s?0:s},[g,y]=e.useState([]),[v,w]=e.useState([]),[C,E]=e.useState(()=>m(o)),[S,x]=e.useState(()=>m(o)),[T,j]=e.useState(!1),[A,k]=e.useState({width:0,left:0,top:0}),I=b||e.createRef(),N=e.useRef(null),O=()=>e.Children.toArray(n).reduce((e,t,r)=>(h(t)&&!t.props.disabled&&e.push(r),e),[]),$=(e,t)=>{const r=O();if(!r.length)return e;const n=r.indexOf(e);return-1===n?r[0]:r["next"===t?(n+1)%r.length:(n-1+r.length)%r.length]},_=async e=>{var t,r;try{if("function"==typeof d&&!(await Promise.resolve(d(e,C)))){x(C);const e=null==(t=I.current)?void 0:t.querySelectorAll('button[role="tab"]');return void(null==(r=null==e?void 0:e[C])||r.focus())}E(e),null==s||s(e)}catch(n){}};e.useEffect(()=>{x(C)},[C]),e.useEffect(()=>{const e=m(C);e===C?O().includes(S)||x(e):E(e)},[n,C,S]),e.useEffect(()=>{I.current&&g.length&&(()=>{if(!I.current||!N.current)return;const e=I.current.querySelector('button[role="tab"][aria-selected="true"]');e&&k({left:e.offsetLeft,top:e.offsetTop+e.offsetHeight-N.current.offsetHeight-Number.parseInt(getComputedStyle(e).borderBottomWidth),width:e.offsetWidth})})()},[I.current,C,g]),e.useEffect(()=>{const r=e.Children.map(n,(r,n)=>h(r)?e.createElement(t.TabButton,{key:`${r.props.title.toLowerCase().replace(/\s/,"_")}_button`,tabIndex:S===n?0:-1,"aria-selected":C===n,focused:T&&S===n,tabActive:C===n,"aria-controls":`tab_${n}`,onClick:()=>{_(n)},onFocus:()=>{x(n)},disabled:r.props.disabled,fluid:a,iconPosition:u,icon:r.props.icon},r.props.title):null),o=e.Children.map(n,(t,r)=>h(t)?e.cloneElement(t,{key:`${t.props.title.toLowerCase().replace(/\s/,"_")}_tab`,tabIndex:C===r?0:-1,tabActive:C===r,id:`tab_${r}`,children:t.props.children}):null);w(o),y(r)},[n,C,S,a,c,u]);const q=[r.default.tablist];return c&&q.push(r.default[c]),i&&q.push(i),e.createElement("div",{...p,ref:I,className:`${r.default.tabs} ${l??""}`},e.createElement("div",{role:"tablist",tabIndex:-1,className:q.join(" "),onKeyDown:e=>{const t=O().length,r={ArrowRight:()=>$(S,"next"),ArrowLeft:()=>$(S,"prev"),Home:()=>O()[0]??0,End:()=>(()=>{const e=O();return e[e.length-1]??0})()};if(Object.keys(r).includes(e.key)&&!T&&j(!0),1===t)return;const n=r[e.key];if(!n)return;e.preventDefault();const o=n();x(o),f&&_(o)},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||setTimeout(()=>{x(C),j(!1)},0)}},g,e.createElement("div",{className:r.default.indicator,ref:N,"aria-hidden":"true",tabIndex:-1,style:{width:A.width,left:A.left,top:A.top}})),e.createElement("div",null,v))});exports.Tabs=n;
|
|
2
2
|
//# sourceMappingURL=Tabs.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.cjs.js","sources":["../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n ComponentPropsWithRef,\n createRef,\n ForwardRefRenderFunction,\n ReactElement,\n RefObject,\n useEffect,\n useRef,\n useState\n} from \"react\";\nimport { Props as TabProps } from \"./Tab\";\nimport { TabButton } from \"./TabButton\";\nimport classes from \"./Tabs.module.scss\";\n\nexport interface Props extends ComponentPropsWithRef<\"div\"> {\n children: ReactElement<TabProps>[];\n selected?: number;\n onTabChange?: (index: number) => void;\n tabChanging?: (newIndex: number, oldIndex: number) => Promise<boolean> | boolean;\n fluid?: boolean;\n align?: \"left\" | \"center\" | \"right\";\n tabListClassName?: string;\n iconsPosition?: \"left\" | \"right\" | \"top\" | \"bottom\";\n activateOnFocus?: boolean;\n}\n\nconst TabsComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n {\n children,\n selected = 0,\n onTabChange,\n className,\n fluid,\n tabListClassName,\n align,\n iconsPosition = \"left\",\n tabChanging,\n activateOnFocus = true,\n ...rest\n }: Props,\n ref\n) => {\n const isTabChild = (child: ReactElement) =>\n Object.prototype.hasOwnProperty.call(child.props, \"title\");\n\n const getValidSelectedIndex = (preferredIndex: number): number => {\n const kids = React.Children.toArray(children) as ReactElement[];\n\n const isSelectableTab = (child?: ReactElement) =>\n Boolean(child && isTabChild(child) && !child.props.disabled);\n\n if (\n preferredIndex >= 0 &&\n preferredIndex < kids.length &&\n isSelectableTab(kids[preferredIndex])\n ) {\n return preferredIndex;\n }\n\n const firstSelectableIndex = kids.findIndex(isSelectableTab);\n return firstSelectableIndex === -1 ? 0 : firstSelectableIndex;\n };\n\n const [renderedButtons, setRenderedButtons] = useState<ReactElement[]>([]);\n const [renderedTabs, setRenderedTabs] = useState<ReactElement[]>([]);\n const [activeTabIndex, setActiveTabIndex] = useState(() => getValidSelectedIndex(selected));\n const [focusedIndex, setFocusedIndex] = useState(() => getValidSelectedIndex(selected));\n const [usingKeyboardNavigation, setUsingKeyboardNavigation] = useState(false);\n const [indicatorStyles, setIndicatorStyles] = useState<{\n width: number;\n left: number;\n top: number;\n }>({\n width: 0,\n left: 0,\n top: 0\n });\n const tabsRef = (ref as RefObject<HTMLDivElement>) || createRef<HTMLDivElement>();\n const indicatorRef = useRef<HTMLDivElement>(null);\n\n const getEnabledTabIndexes = (): number[] => {\n const kids = React.Children.toArray(children) as ReactElement[];\n\n return kids.reduce((indexes: number[], child, index) => {\n if (isTabChild(child) && !child.props.disabled) {\n indexes.push(index);\n }\n return indexes;\n }, []);\n };\n\n const getNextEnabledTabIndex = (startIndex: number, direction: \"next\" | \"prev\"): number => {\n const enabledTabIndexes = getEnabledTabIndexes();\n\n if (!enabledTabIndexes.length) {\n return startIndex;\n }\n\n const currentPosition = enabledTabIndexes.indexOf(startIndex);\n\n if (currentPosition === -1) {\n return enabledTabIndexes[0];\n }\n\n const nextPosition =\n direction === \"next\"\n ? (currentPosition + 1) % enabledTabIndexes.length\n : (currentPosition - 1 + enabledTabIndexes.length) % enabledTabIndexes.length;\n\n return enabledTabIndexes[nextPosition];\n };\n\n const getFirstEnabledTabIndex = (): number => {\n const enabledTabIndexes = getEnabledTabIndexes();\n return enabledTabIndexes[0] ?? 0;\n };\n\n const getLastEnabledTabIndex = (): number => {\n const enabledTabIndexes = getEnabledTabIndexes();\n return enabledTabIndexes[enabledTabIndexes.length - 1] ?? 0;\n };\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n const totalAmountOfTabs = getEnabledTabIndexes().length;\n const keyToIndex: Record<string, () => number> = {\n ArrowRight: () => getNextEnabledTabIndex(focusedIndex, \"next\"),\n ArrowLeft: () => getNextEnabledTabIndex(focusedIndex, \"prev\"),\n Home: () => getFirstEnabledTabIndex(),\n End: () => getLastEnabledTabIndex()\n };\n const navigationKeys = Object.keys(keyToIndex);\n if (navigationKeys.includes(e.key) && !usingKeyboardNavigation) {\n setUsingKeyboardNavigation(true);\n }\n\n if (totalAmountOfTabs === 1) {\n return;\n }\n\n const getIndexForKey = keyToIndex[e.key];\n if (!getIndexForKey) {\n return;\n }\n\n e.preventDefault();\n const nextIndex = getIndexForKey();\n setFocusedIndex(nextIndex);\n if (activateOnFocus) {\n void handleTabClick(nextIndex);\n }\n };\n\n const handleBlur = (e: React.FocusEvent) => {\n if (!e.currentTarget.contains(e.relatedTarget)) {\n setTimeout(() => {\n setFocusedIndex(activeTabIndex);\n setUsingKeyboardNavigation(false);\n }, 0);\n }\n };\n\n const calculateIndicatorPosition = () => {\n if (!tabsRef.current || !indicatorRef.current) {\n return;\n }\n\n const selectedButton = tabsRef.current.querySelector(\n 'button[role=\"tab\"][aria-selected=\"true\"]'\n ) as HTMLElement | null;\n\n if (!selectedButton) {\n return;\n }\n\n setIndicatorStyles({\n left: selectedButton.offsetLeft,\n top:\n selectedButton.offsetTop +\n selectedButton.offsetHeight -\n indicatorRef.current.offsetHeight -\n parseInt(getComputedStyle(selectedButton).borderBottomWidth),\n width: selectedButton.offsetWidth\n });\n };\n\n const handleTabClick = async (newIndex: number) => {\n try {\n const allowed =\n typeof tabChanging === \"function\"\n ? await Promise.resolve(tabChanging(newIndex, activeTabIndex))\n : true;\n\n if (!allowed) {\n setFocusedIndex(activeTabIndex);\n const buttons = tabsRef.current?.querySelectorAll<HTMLButtonElement>('button[role=\"tab\"]');\n buttons?.[activeTabIndex]?.focus();\n return;\n }\n\n setActiveTabIndex(newIndex);\n onTabChange?.(newIndex);\n } catch (error) {\n console.error(\"handleTabClick failed: \", error);\n }\n };\n\n useEffect(() => {\n setFocusedIndex(activeTabIndex);\n }, [activeTabIndex]);\n\n useEffect(() => {\n const validSelectedIndex = getValidSelectedIndex(activeTabIndex);\n\n if (validSelectedIndex !== activeTabIndex) {\n setActiveTabIndex(validSelectedIndex);\n return;\n }\n\n const enabledTabIndexes = getEnabledTabIndexes();\n if (!enabledTabIndexes.includes(focusedIndex)) {\n setFocusedIndex(validSelectedIndex);\n }\n }, [children, activeTabIndex, focusedIndex]);\n\n useEffect(() => {\n if (tabsRef.current && renderedButtons.length) {\n calculateIndicatorPosition();\n }\n }, [tabsRef.current, activeTabIndex, renderedButtons]);\n\n useEffect(() => {\n const buttons = React.Children.map(children, (child, index) => {\n if (isTabChild(child)) {\n return React.createElement(\n TabButton,\n {\n key: `${child.props.title.toLowerCase().replace(/\\s/, \"_\")}_button`,\n tabIndex: focusedIndex === index ? 0 : -1,\n \"aria-selected\": activeTabIndex === index,\n focused: usingKeyboardNavigation && focusedIndex === index,\n tabActive: activeTabIndex === index,\n \"aria-controls\": `tab_${index}`,\n onClick: () => {\n void handleTabClick(index);\n },\n onFocus: () => {\n setFocusedIndex(index);\n },\n disabled: child.props.disabled,\n fluid: fluid,\n iconPosition: iconsPosition,\n icon: child.props.icon\n },\n child.props.title\n );\n }\n return null;\n });\n\n const tabs = React.Children.map(children, (child, index) => {\n if (isTabChild(child)) {\n return React.cloneElement(child, {\n key: `${child.props.title.toLowerCase().replace(/\\s/, \"_\")}_tab`,\n tabIndex: activeTabIndex === index ? 0 : -1,\n tabActive: activeTabIndex === index,\n id: `tab_${index}`,\n children: child.props.children\n });\n }\n\n return null;\n });\n\n setRenderedTabs(tabs);\n setRenderedButtons(buttons);\n }, [children, activeTabIndex, focusedIndex, fluid, align, iconsPosition]);\n\n const tabListClasses = [classes[\"tablist\"]];\n align && tabListClasses.push(classes[align]);\n tabListClassName && tabListClasses.push(tabListClassName);\n\n return (\n <div {...rest} ref={tabsRef} className={`${classes[\"tabs\"]} ${className ?? \"\"}`}>\n <div\n role=\"tablist\"\n tabIndex={-1}\n className={tabListClasses.join(\" \")}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n >\n {renderedButtons}\n <div\n className={classes[\"indicator\"]}\n ref={indicatorRef}\n aria-hidden=\"true\"\n tabIndex={-1}\n style={{\n width: indicatorStyles.width,\n left: indicatorStyles.left,\n top: indicatorStyles.top\n }}\n />\n </div>\n <div>{renderedTabs}</div>\n </div>\n );\n};\n\nexport const Tabs = React.forwardRef(TabsComponent);\n"],"names":["Tabs","React","forwardRef","children","selected","onTabChange","className","fluid","tabListClassName","align","iconsPosition","tabChanging","activateOnFocus","rest","ref","isTabChild","child","Object","prototype","hasOwnProperty","call","props","getValidSelectedIndex","preferredIndex","kids","Children","toArray","isSelectableTab","Boolean","disabled","length","firstSelectableIndex","findIndex","renderedButtons","setRenderedButtons","useState","renderedTabs","setRenderedTabs","activeTabIndex","setActiveTabIndex","focusedIndex","setFocusedIndex","usingKeyboardNavigation","setUsingKeyboardNavigation","indicatorStyles","setIndicatorStyles","width","left","top","tabsRef","createRef","indicatorRef","useRef","getEnabledTabIndexes","reduce","indexes","index","push","getNextEnabledTabIndex","startIndex","direction","enabledTabIndexes","currentPosition","indexOf","handleTabClick","async","newIndex","Promise","resolve","buttons","_a","current","querySelectorAll","_b","focus","error","useEffect","validSelectedIndex","includes","selectedButton","querySelector","offsetLeft","offsetTop","offsetHeight","parseInt","getComputedStyle","borderBottomWidth","offsetWidth","calculateIndicatorPosition","map","createElement","TabButton","key","title","toLowerCase","replace","tabIndex","focused","tabActive","onClick","onFocus","iconPosition","icon","tabs","cloneElement","id","tabListClasses","classes","role","join","onKeyDown","e","totalAmountOfTabs","keyToIndex","ArrowRight","ArrowLeft","Home","End","getLastEnabledTabIndex","keys","getIndexForKey","preventDefault","nextIndex","onBlur","currentTarget","contains","relatedTarget","setTimeout","style"],"mappings":"gLAoUaA,EAAOC,EAAMC,WA1R6C,EAEnEC,WACAC,WAAW,EACXC,cACAC,YACAC,QACAC,mBACAC,QACAC,gBAAgB,OAChBC,cACAC,mBAAkB,KACfC,GAELC,KAEA,MAAMC,EAAcC,GAClBC,OAAOC,UAAUC,eAAeC,KAAKJ,EAAMK,MAAO,SAE9CC,EAAyBC,IAC7B,MAAMC,EAAOvB,EAAMwB,SAASC,QAAQvB,GAE9BwB,EAAmBX,GACvBY,QAAQZ,GAASD,EAAWC,KAAWA,EAAMK,MAAMQ,UAErD,GACEN,GAAkB,GAClBA,EAAiBC,EAAKM,QACtBH,EAAgBH,EAAKD,IAErB,OAAOA,EAGT,MAAMQ,EAAuBP,EAAKQ,UAAUL,GAC5C,WAAOI,EAA8B,EAAIA,IAGpCE,EAAiBC,GAAsBC,EAAAA,SAAyB,KAChEC,EAAcC,GAAmBF,EAAAA,SAAyB,KAC1DG,EAAgBC,GAAqBJ,EAAAA,SAAS,IAAMb,EAAsBlB,KAC1EoC,EAAcC,GAAmBN,EAAAA,SAAS,IAAMb,EAAsBlB,KACtEsC,EAAyBC,GAA8BR,EAAAA,UAAS,IAChES,EAA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,KAAKjD,KAGtCkF,cAAC,MAAA,IAAQ7E,EAAMC,IAAKmC,EAAS3C,UAAW,GAAGqG,UAAc,QAAKrG,GAAa,MACzEL,EAAAyF,cAAC,MAAA,CACCkB,KAAK,UACLZ,UAAU,EACV1F,UAAWoG,EAAeG,KAAK,KAC/BC,UArKiBC,IACrB,MAAMC,EAAoB3D,IAAuBvB,OAC3CmF,EAA2C,CAC/CC,WAAY,IAAMxD,EAAuBlB,EAAc,QACvD2E,UAAW,IAAMzD,EAAuBlB,EAAc,QACtD4E,KAAM,IAdkB/D,IACD,IAAM,EAc7BgE,IAAK,IAXsB,MAC7B,MAAMxD,EAAoBR,IAC1B,OAAOQ,EAAkBA,EAAkB/B,OAAS,IAAM,GAS7CwF,IAOb,GALuBrG,OAAOsG,KAAKN,GAChBnC,SAASiC,EAAEnB,OAASlD,GACrCC,GAA2B,GAGH,IAAtBqE,EACF,OAGF,MAAMQ,EAAiBP,EAAWF,EAAEnB,KACpC,IAAK4B,EACH,OAGFT,EAAEU,iBACF,MAAMC,EAAYF,IAClB/E,EAAgBiF,GACZ9G,GACGoD,EAAe0D,IA4IlBC,OAxIcZ,IACbA,EAAEa,cAAcC,SAASd,EAAEe,gBAC9BC,WAAW,KACTtF,EAAgBH,GAChBK,GAA2B,IAC1B,KAqIAV,EACDhC,EAAAyF,cAAC,MAAA,CACCpF,UAAWqG,EAAAA,QAAmB,UAC9B7F,IAAKqC,EACL,cAAY,OACZ6C,UAAU,EACVgC,MAAO,CACLlF,MAAOF,EAAgBE,MACvBC,KAAMH,EAAgBG,KACtBC,IAAKJ,EAAgBI,QAI3B/C,EAAAyF,cAAC,MAAA,KAAKtD"}
|
|
1
|
+
{"version":3,"file":"Tabs.cjs.js","sources":["../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n ComponentPropsWithRef,\n createRef,\n ForwardRefRenderFunction,\n ReactElement,\n RefObject,\n useEffect,\n useRef,\n useState\n} from \"react\";\nimport { Props as TabProps } from \"./Tab\";\nimport { TabButton } from \"./TabButton\";\nimport classes from \"./Tabs.module.scss\";\n\nexport interface Props extends ComponentPropsWithRef<\"div\"> {\n children: ReactElement<TabProps>[];\n selected?: number;\n onTabChange?: (index: number) => void;\n tabChanging?: (newIndex: number, oldIndex: number) => Promise<boolean> | boolean;\n fluid?: boolean;\n align?: \"left\" | \"center\" | \"right\";\n tabListClassName?: string;\n iconsPosition?: \"left\" | \"right\" | \"top\" | \"bottom\";\n activateOnFocus?: boolean;\n}\n\nconst TabsComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n {\n children,\n selected = 0,\n onTabChange,\n className,\n fluid,\n tabListClassName,\n align,\n iconsPosition = \"left\",\n tabChanging,\n activateOnFocus = true,\n ...rest\n }: Props,\n ref\n) => {\n const isTabChild = (child: ReactElement) =>\n Object.prototype.hasOwnProperty.call(child.props, \"title\");\n\n const getValidSelectedIndex = (preferredIndex: number): number => {\n const kids = React.Children.toArray(children) as ReactElement[];\n\n const isSelectableTab = (child?: ReactElement) =>\n Boolean(child && isTabChild(child) && !child.props.disabled);\n\n if (\n preferredIndex >= 0 &&\n preferredIndex < kids.length &&\n isSelectableTab(kids[preferredIndex])\n ) {\n return preferredIndex;\n }\n\n const firstSelectableIndex = kids.findIndex(isSelectableTab);\n return firstSelectableIndex === -1 ? 0 : firstSelectableIndex;\n };\n\n const [renderedButtons, setRenderedButtons] = useState<ReactElement[]>([]);\n const [renderedTabs, setRenderedTabs] = useState<ReactElement[]>([]);\n const [activeTabIndex, setActiveTabIndex] = useState(() => getValidSelectedIndex(selected));\n const [focusedIndex, setFocusedIndex] = useState(() => getValidSelectedIndex(selected));\n const [usingKeyboardNavigation, setUsingKeyboardNavigation] = useState(false);\n const [indicatorStyles, setIndicatorStyles] = useState<{\n width: number;\n left: number;\n top: number;\n }>({\n width: 0,\n left: 0,\n top: 0\n });\n const tabsRef = (ref as RefObject<HTMLDivElement>) || createRef<HTMLDivElement>();\n const indicatorRef = useRef<HTMLDivElement>(null);\n\n const getEnabledTabIndexes = (): number[] => {\n const kids = React.Children.toArray(children) as ReactElement[];\n\n return kids.reduce((indexes: number[], child, index) => {\n if (isTabChild(child) && !child.props.disabled) {\n indexes.push(index);\n }\n return indexes;\n }, []);\n };\n\n const getNextEnabledTabIndex = (startIndex: number, direction: \"next\" | \"prev\"): number => {\n const enabledTabIndexes = getEnabledTabIndexes();\n\n if (!enabledTabIndexes.length) {\n return startIndex;\n }\n\n const currentPosition = enabledTabIndexes.indexOf(startIndex);\n\n if (currentPosition === -1) {\n return enabledTabIndexes[0];\n }\n\n const nextPosition =\n direction === \"next\"\n ? (currentPosition + 1) % enabledTabIndexes.length\n : (currentPosition - 1 + enabledTabIndexes.length) % enabledTabIndexes.length;\n\n return enabledTabIndexes[nextPosition];\n };\n\n const getFirstEnabledTabIndex = (): number => {\n const enabledTabIndexes = getEnabledTabIndexes();\n return enabledTabIndexes[0] ?? 0;\n };\n\n const getLastEnabledTabIndex = (): number => {\n const enabledTabIndexes = getEnabledTabIndexes();\n return enabledTabIndexes[enabledTabIndexes.length - 1] ?? 0;\n };\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n const totalAmountOfTabs = getEnabledTabIndexes().length;\n const keyToIndex: Record<string, () => number> = {\n ArrowRight: () => getNextEnabledTabIndex(focusedIndex, \"next\"),\n ArrowLeft: () => getNextEnabledTabIndex(focusedIndex, \"prev\"),\n Home: () => getFirstEnabledTabIndex(),\n End: () => getLastEnabledTabIndex()\n };\n const navigationKeys = Object.keys(keyToIndex);\n if (navigationKeys.includes(e.key) && !usingKeyboardNavigation) {\n setUsingKeyboardNavigation(true);\n }\n\n if (totalAmountOfTabs === 1) {\n return;\n }\n\n const getIndexForKey = keyToIndex[e.key];\n if (!getIndexForKey) {\n return;\n }\n\n e.preventDefault();\n const nextIndex = getIndexForKey();\n setFocusedIndex(nextIndex);\n if (activateOnFocus) {\n void handleTabClick(nextIndex);\n }\n };\n\n const handleBlur = (e: React.FocusEvent) => {\n if (!e.currentTarget.contains(e.relatedTarget)) {\n setTimeout(() => {\n setFocusedIndex(activeTabIndex);\n setUsingKeyboardNavigation(false);\n }, 0);\n }\n };\n\n const calculateIndicatorPosition = () => {\n if (!tabsRef.current || !indicatorRef.current) {\n return;\n }\n\n const selectedButton = tabsRef.current.querySelector(\n 'button[role=\"tab\"][aria-selected=\"true\"]'\n ) as HTMLElement | null;\n\n if (!selectedButton) {\n return;\n }\n\n setIndicatorStyles({\n left: selectedButton.offsetLeft,\n top:\n selectedButton.offsetTop +\n selectedButton.offsetHeight -\n indicatorRef.current.offsetHeight -\n Number.parseInt(getComputedStyle(selectedButton).borderBottomWidth),\n width: selectedButton.offsetWidth\n });\n };\n\n const handleTabClick = async (newIndex: number) => {\n try {\n const allowed =\n typeof tabChanging === \"function\"\n ? await Promise.resolve(tabChanging(newIndex, activeTabIndex))\n : true;\n\n if (!allowed) {\n setFocusedIndex(activeTabIndex);\n const buttons = tabsRef.current?.querySelectorAll<HTMLButtonElement>('button[role=\"tab\"]');\n buttons?.[activeTabIndex]?.focus();\n return;\n }\n\n setActiveTabIndex(newIndex);\n onTabChange?.(newIndex);\n } catch (error) {\n console.error(\"handleTabClick failed: \", error);\n }\n };\n\n useEffect(() => {\n setFocusedIndex(activeTabIndex);\n }, [activeTabIndex]);\n\n useEffect(() => {\n const validSelectedIndex = getValidSelectedIndex(activeTabIndex);\n\n if (validSelectedIndex !== activeTabIndex) {\n setActiveTabIndex(validSelectedIndex);\n return;\n }\n\n const enabledTabIndexes = getEnabledTabIndexes();\n if (!enabledTabIndexes.includes(focusedIndex)) {\n setFocusedIndex(validSelectedIndex);\n }\n }, [children, activeTabIndex, focusedIndex]);\n\n useEffect(() => {\n if (tabsRef.current && renderedButtons.length) {\n calculateIndicatorPosition();\n }\n }, [tabsRef.current, activeTabIndex, renderedButtons]);\n\n useEffect(() => {\n const buttons = React.Children.map(children, (child, index) => {\n if (isTabChild(child)) {\n return React.createElement(\n TabButton,\n {\n key: `${child.props.title.toLowerCase().replace(/\\s/, \"_\")}_button`,\n tabIndex: focusedIndex === index ? 0 : -1,\n \"aria-selected\": activeTabIndex === index,\n focused: usingKeyboardNavigation && focusedIndex === index,\n tabActive: activeTabIndex === index,\n \"aria-controls\": `tab_${index}`,\n onClick: () => {\n void handleTabClick(index);\n },\n onFocus: () => {\n setFocusedIndex(index);\n },\n disabled: child.props.disabled,\n fluid: fluid,\n iconPosition: iconsPosition,\n icon: child.props.icon\n },\n child.props.title\n );\n }\n return null;\n });\n\n const tabs = React.Children.map(children, (child, index) => {\n if (isTabChild(child)) {\n return React.cloneElement(child, {\n key: `${child.props.title.toLowerCase().replace(/\\s/, \"_\")}_tab`,\n tabIndex: activeTabIndex === index ? 0 : -1,\n tabActive: activeTabIndex === index,\n id: `tab_${index}`,\n children: child.props.children\n });\n }\n\n return null;\n });\n\n setRenderedTabs(tabs);\n setRenderedButtons(buttons);\n }, [children, activeTabIndex, focusedIndex, fluid, align, iconsPosition]);\n\n const tabListClasses = [classes[\"tablist\"]];\n align && tabListClasses.push(classes[align]);\n tabListClassName && tabListClasses.push(tabListClassName);\n\n return (\n <div {...rest} ref={tabsRef} className={`${classes[\"tabs\"]} ${className ?? \"\"}`}>\n <div\n role=\"tablist\"\n tabIndex={-1}\n className={tabListClasses.join(\" \")}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n >\n {renderedButtons}\n <div\n className={classes[\"indicator\"]}\n ref={indicatorRef}\n aria-hidden=\"true\"\n tabIndex={-1}\n style={{\n width: indicatorStyles.width,\n left: indicatorStyles.left,\n top: indicatorStyles.top\n }}\n />\n </div>\n <div>{renderedTabs}</div>\n </div>\n );\n};\n\nexport const Tabs = React.forwardRef(TabsComponent);\n"],"names":["Tabs","React","forwardRef","children","selected","onTabChange","className","fluid","tabListClassName","align","iconsPosition","tabChanging","activateOnFocus","rest","ref","isTabChild","child","Object","prototype","hasOwnProperty","call","props","getValidSelectedIndex","preferredIndex","kids","Children","toArray","isSelectableTab","Boolean","disabled","length","firstSelectableIndex","findIndex","renderedButtons","setRenderedButtons","useState","renderedTabs","setRenderedTabs","activeTabIndex","setActiveTabIndex","focusedIndex","setFocusedIndex","usingKeyboardNavigation","setUsingKeyboardNavigation","indicatorStyles","setIndicatorStyles","width","left","top","tabsRef","createRef","indicatorRef","useRef","getEnabledTabIndexes","reduce","indexes","index","push","getNextEnabledTabIndex","startIndex","direction","enabledTabIndexes","currentPosition","indexOf","handleTabClick","async","newIndex","Promise","resolve","buttons","_a","current","querySelectorAll","_b","focus","error","useEffect","validSelectedIndex","includes","selectedButton","querySelector","offsetLeft","offsetTop","offsetHeight","Number","parseInt","getComputedStyle","borderBottomWidth","offsetWidth","calculateIndicatorPosition","map","createElement","TabButton","key","title","toLowerCase","replace","tabIndex","focused","tabActive","onClick","onFocus","iconPosition","icon","tabs","cloneElement","id","tabListClasses","classes","role","join","onKeyDown","e","totalAmountOfTabs","keyToIndex","ArrowRight","ArrowLeft","Home","End","getLastEnabledTabIndex","keys","getIndexForKey","preventDefault","nextIndex","onBlur","currentTarget","contains","relatedTarget","setTimeout","style"],"mappings":"gLAoUaA,EAAOC,EAAMC,WA1R6C,EAEnEC,WACAC,WAAW,EACXC,cACAC,YACAC,QACAC,mBACAC,QACAC,gBAAgB,OAChBC,cACAC,mBAAkB,KACfC,GAELC,KAEA,MAAMC,EAAcC,GAClBC,OAAOC,UAAUC,eAAeC,KAAKJ,EAAMK,MAAO,SAE9CC,EAAyBC,IAC7B,MAAMC,EAAOvB,EAAMwB,SAASC,QAAQvB,GA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BH,GAChBK,GAA2B,IAC1B,KAqIAV,EACDhC,EAAA0F,cAAC,MAAA,CACCrF,UAAWsG,EAAAA,QAAmB,UAC9B9F,IAAKqC,EACL,cAAY,OACZ8C,UAAU,EACVgC,MAAO,CACLnF,MAAOF,EAAgBE,MACvBC,KAAMH,EAAgBG,KACtBC,IAAKJ,EAAgBI,QAI3B/C,EAAA0F,cAAC,MAAA,KAAKvD"}
|
|
@@ -111,7 +111,7 @@ const TabsComponent = ({
|
|
|
111
111
|
}
|
|
112
112
|
setIndicatorStyles({
|
|
113
113
|
left: selectedButton.offsetLeft,
|
|
114
|
-
top: selectedButton.offsetTop + selectedButton.offsetHeight - indicatorRef.current.offsetHeight - parseInt(getComputedStyle(selectedButton).borderBottomWidth),
|
|
114
|
+
top: selectedButton.offsetTop + selectedButton.offsetHeight - indicatorRef.current.offsetHeight - Number.parseInt(getComputedStyle(selectedButton).borderBottomWidth),
|
|
115
115
|
width: selectedButton.offsetWidth
|
|
116
116
|
});
|
|
117
117
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.es.js","sources":["../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n ComponentPropsWithRef,\n createRef,\n ForwardRefRenderFunction,\n ReactElement,\n RefObject,\n useEffect,\n useRef,\n useState\n} from \"react\";\nimport { Props as TabProps } from \"./Tab\";\nimport { TabButton } from \"./TabButton\";\nimport classes from \"./Tabs.module.scss\";\n\nexport interface Props extends ComponentPropsWithRef<\"div\"> {\n children: ReactElement<TabProps>[];\n selected?: number;\n onTabChange?: (index: number) => void;\n tabChanging?: (newIndex: number, oldIndex: number) => Promise<boolean> | boolean;\n fluid?: boolean;\n align?: \"left\" | \"center\" | \"right\";\n tabListClassName?: string;\n iconsPosition?: \"left\" | \"right\" | \"top\" | \"bottom\";\n activateOnFocus?: boolean;\n}\n\nconst TabsComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n {\n children,\n selected = 0,\n onTabChange,\n className,\n fluid,\n tabListClassName,\n align,\n iconsPosition = \"left\",\n tabChanging,\n activateOnFocus = true,\n ...rest\n }: Props,\n ref\n) => {\n const isTabChild = (child: ReactElement) =>\n Object.prototype.hasOwnProperty.call(child.props, \"title\");\n\n const getValidSelectedIndex = (preferredIndex: number): number => {\n const kids = React.Children.toArray(children) as ReactElement[];\n\n const isSelectableTab = (child?: ReactElement) =>\n Boolean(child && isTabChild(child) && !child.props.disabled);\n\n if (\n preferredIndex >= 0 &&\n preferredIndex < kids.length &&\n isSelectableTab(kids[preferredIndex])\n ) {\n return preferredIndex;\n }\n\n const firstSelectableIndex = kids.findIndex(isSelectableTab);\n return firstSelectableIndex === -1 ? 0 : firstSelectableIndex;\n };\n\n const [renderedButtons, setRenderedButtons] = useState<ReactElement[]>([]);\n const [renderedTabs, setRenderedTabs] = useState<ReactElement[]>([]);\n const [activeTabIndex, setActiveTabIndex] = useState(() => getValidSelectedIndex(selected));\n const [focusedIndex, setFocusedIndex] = useState(() => getValidSelectedIndex(selected));\n const [usingKeyboardNavigation, setUsingKeyboardNavigation] = useState(false);\n const [indicatorStyles, setIndicatorStyles] = useState<{\n width: number;\n left: number;\n top: number;\n }>({\n width: 0,\n left: 0,\n top: 0\n });\n const tabsRef = (ref as RefObject<HTMLDivElement>) || createRef<HTMLDivElement>();\n const indicatorRef = useRef<HTMLDivElement>(null);\n\n const getEnabledTabIndexes = (): number[] => {\n const kids = React.Children.toArray(children) as ReactElement[];\n\n return kids.reduce((indexes: number[], child, index) => {\n if (isTabChild(child) && !child.props.disabled) {\n indexes.push(index);\n }\n return indexes;\n }, []);\n };\n\n const getNextEnabledTabIndex = (startIndex: number, direction: \"next\" | \"prev\"): number => {\n const enabledTabIndexes = getEnabledTabIndexes();\n\n if (!enabledTabIndexes.length) {\n return startIndex;\n }\n\n const currentPosition = enabledTabIndexes.indexOf(startIndex);\n\n if (currentPosition === -1) {\n return enabledTabIndexes[0];\n }\n\n const nextPosition =\n direction === \"next\"\n ? (currentPosition + 1) % enabledTabIndexes.length\n : (currentPosition - 1 + enabledTabIndexes.length) % enabledTabIndexes.length;\n\n return enabledTabIndexes[nextPosition];\n };\n\n const getFirstEnabledTabIndex = (): number => {\n const enabledTabIndexes = getEnabledTabIndexes();\n return enabledTabIndexes[0] ?? 0;\n };\n\n const getLastEnabledTabIndex = (): number => {\n const enabledTabIndexes = getEnabledTabIndexes();\n return enabledTabIndexes[enabledTabIndexes.length - 1] ?? 0;\n };\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n const totalAmountOfTabs = getEnabledTabIndexes().length;\n const keyToIndex: Record<string, () => number> = {\n ArrowRight: () => getNextEnabledTabIndex(focusedIndex, \"next\"),\n ArrowLeft: () => getNextEnabledTabIndex(focusedIndex, \"prev\"),\n Home: () => getFirstEnabledTabIndex(),\n End: () => getLastEnabledTabIndex()\n };\n const navigationKeys = Object.keys(keyToIndex);\n if (navigationKeys.includes(e.key) && !usingKeyboardNavigation) {\n setUsingKeyboardNavigation(true);\n }\n\n if (totalAmountOfTabs === 1) {\n return;\n }\n\n const getIndexForKey = keyToIndex[e.key];\n if (!getIndexForKey) {\n return;\n }\n\n e.preventDefault();\n const nextIndex = getIndexForKey();\n setFocusedIndex(nextIndex);\n if (activateOnFocus) {\n void handleTabClick(nextIndex);\n }\n };\n\n const handleBlur = (e: React.FocusEvent) => {\n if (!e.currentTarget.contains(e.relatedTarget)) {\n setTimeout(() => {\n setFocusedIndex(activeTabIndex);\n setUsingKeyboardNavigation(false);\n }, 0);\n }\n };\n\n const calculateIndicatorPosition = () => {\n if (!tabsRef.current || !indicatorRef.current) {\n return;\n }\n\n const selectedButton = tabsRef.current.querySelector(\n 'button[role=\"tab\"][aria-selected=\"true\"]'\n ) as HTMLElement | null;\n\n if (!selectedButton) {\n return;\n }\n\n setIndicatorStyles({\n left: selectedButton.offsetLeft,\n top:\n selectedButton.offsetTop +\n selectedButton.offsetHeight -\n indicatorRef.current.offsetHeight -\n parseInt(getComputedStyle(selectedButton).borderBottomWidth),\n width: selectedButton.offsetWidth\n });\n };\n\n const handleTabClick = async (newIndex: number) => {\n try {\n const allowed =\n typeof tabChanging === \"function\"\n ? await Promise.resolve(tabChanging(newIndex, activeTabIndex))\n : true;\n\n if (!allowed) {\n setFocusedIndex(activeTabIndex);\n const buttons = tabsRef.current?.querySelectorAll<HTMLButtonElement>('button[role=\"tab\"]');\n buttons?.[activeTabIndex]?.focus();\n return;\n }\n\n setActiveTabIndex(newIndex);\n onTabChange?.(newIndex);\n } catch (error) {\n console.error(\"handleTabClick failed: \", error);\n }\n };\n\n useEffect(() => {\n setFocusedIndex(activeTabIndex);\n }, [activeTabIndex]);\n\n useEffect(() => {\n const validSelectedIndex = getValidSelectedIndex(activeTabIndex);\n\n if (validSelectedIndex !== activeTabIndex) {\n setActiveTabIndex(validSelectedIndex);\n return;\n }\n\n const enabledTabIndexes = getEnabledTabIndexes();\n if (!enabledTabIndexes.includes(focusedIndex)) {\n setFocusedIndex(validSelectedIndex);\n }\n }, [children, activeTabIndex, focusedIndex]);\n\n useEffect(() => {\n if (tabsRef.current && renderedButtons.length) {\n calculateIndicatorPosition();\n }\n }, [tabsRef.current, activeTabIndex, renderedButtons]);\n\n useEffect(() => {\n const buttons = React.Children.map(children, (child, index) => {\n if (isTabChild(child)) {\n return React.createElement(\n TabButton,\n {\n key: `${child.props.title.toLowerCase().replace(/\\s/, \"_\")}_button`,\n tabIndex: focusedIndex === index ? 0 : -1,\n \"aria-selected\": activeTabIndex === index,\n focused: usingKeyboardNavigation && focusedIndex === index,\n tabActive: activeTabIndex === index,\n \"aria-controls\": `tab_${index}`,\n onClick: () => {\n void handleTabClick(index);\n },\n onFocus: () => {\n setFocusedIndex(index);\n },\n disabled: child.props.disabled,\n fluid: fluid,\n iconPosition: iconsPosition,\n icon: child.props.icon\n },\n child.props.title\n );\n }\n return null;\n });\n\n const tabs = React.Children.map(children, (child, index) => {\n if (isTabChild(child)) {\n return React.cloneElement(child, {\n key: `${child.props.title.toLowerCase().replace(/\\s/, \"_\")}_tab`,\n tabIndex: activeTabIndex === index ? 0 : -1,\n tabActive: activeTabIndex === index,\n id: `tab_${index}`,\n children: child.props.children\n });\n }\n\n return null;\n });\n\n setRenderedTabs(tabs);\n setRenderedButtons(buttons);\n }, [children, activeTabIndex, focusedIndex, fluid, align, iconsPosition]);\n\n const tabListClasses = [classes[\"tablist\"]];\n align && tabListClasses.push(classes[align]);\n tabListClassName && tabListClasses.push(tabListClassName);\n\n return (\n <div {...rest} ref={tabsRef} className={`${classes[\"tabs\"]} ${className ?? \"\"}`}>\n <div\n role=\"tablist\"\n tabIndex={-1}\n className={tabListClasses.join(\" \")}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n >\n {renderedButtons}\n <div\n className={classes[\"indicator\"]}\n ref={indicatorRef}\n aria-hidden=\"true\"\n tabIndex={-1}\n style={{\n width: indicatorStyles.width,\n left: indicatorStyles.left,\n top: indicatorStyles.top\n }}\n />\n </div>\n <div>{renderedTabs}</div>\n </div>\n );\n};\n\nexport const Tabs = React.forwardRef(TabsComponent);\n"],"names":[],"mappings":";;;AA0CA,MAAM,gBAAiE,CACrE;AAAA,EACE;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB;AAAA,EACA,kBAAkB;AAAA,EAClB,GAAG;AACL,GACA,QACG;AACH,QAAM,aAAa,CAAC,UAClB,OAAO,UAAU,eAAe,KAAK,MAAM,OAAO,OA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AAG,CAAC,UAAU,gBAAgB,cAAc,OAAO,OAAO,aAAa,CAAC;AAExE,QAAM,iBAAiB,CAAC,QAAQ,SAAS,CAAC;AAC1C,WAAS,eAAe,KAAK,QAAQ,KAAK,CAAC;AAC3C,sBAAoB,eAAe,KAAK,gBAAgB;AAExD,SACE,sBAAA,cAAC,OAAA,EAAK,GAAG,MAAM,KAAK,SAAS,WAAW,GAAG,QAAQ,MAAM,CAAC,IAAI,aAAa,EAAE,GAAA,GAC3E,sBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,UAAU;AAAA,MACV,WAAW,eAAe,KAAK,GAAG;AAAA,MAClC,WAAW;AAAA,MACX,QAAQ;AAAA,IAAA;AAAA,IAEP;AAAA,IACD,sBAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW,QAAQ,WAAW;AAAA,QAC9B,KAAK;AAAA,QACL,eAAY;AAAA,QACZ,UAAU;AAAA,QACV,OAAO;AAAA,UACL,OAAO,gBAAgB;AAAA,UACvB,MAAM,gBAAgB;AAAA,UACtB,KAAK,gBAAgB;AAAA,QAAA;AAAA,MACvB;AAAA,IAAA;AAAA,EACF,GAEF,sBAAA,cAAC,OAAA,MAAK,YAAa,CACrB;AAEJ;AAEO,MAAM,OAAO,MAAM,WAAW,aAAa;"}
|
|
1
|
+
{"version":3,"file":"Tabs.es.js","sources":["../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n ComponentPropsWithRef,\n createRef,\n ForwardRefRenderFunction,\n ReactElement,\n RefObject,\n useEffect,\n useRef,\n useState\n} from \"react\";\nimport { Props as TabProps } from \"./Tab\";\nimport { TabButton } from \"./TabButton\";\nimport classes from \"./Tabs.module.scss\";\n\nexport interface Props extends ComponentPropsWithRef<\"div\"> {\n children: ReactElement<TabProps>[];\n selected?: number;\n onTabChange?: (index: number) => void;\n tabChanging?: (newIndex: number, oldIndex: number) => Promise<boolean> | boolean;\n fluid?: boolean;\n align?: \"left\" | \"center\" | \"right\";\n tabListClassName?: string;\n iconsPosition?: \"left\" | \"right\" | \"top\" | \"bottom\";\n activateOnFocus?: boolean;\n}\n\nconst TabsComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n {\n children,\n selected = 0,\n onTabChange,\n className,\n fluid,\n tabListClassName,\n align,\n iconsPosition = \"left\",\n tabChanging,\n activateOnFocus = true,\n ...rest\n }: Props,\n ref\n) => {\n const isTabChild = (child: ReactElement) =>\n Object.prototype.hasOwnProperty.call(child.props, \"title\");\n\n const getValidSelectedIndex = (preferredIndex: number): number => {\n const kids = React.Children.toArray(children) as ReactElement[];\n\n const isSelectableTab = (child?: ReactElement) =>\n Boolean(child && isTabChild(child) && !child.props.disabled);\n\n if (\n preferredIndex >= 0 &&\n preferredIndex < kids.length &&\n isSelectableTab(kids[preferredIndex])\n ) {\n return preferredIndex;\n }\n\n const firstSelectableIndex = kids.findIndex(isSelectableTab);\n return firstSelectableIndex === -1 ? 0 : firstSelectableIndex;\n };\n\n const [renderedButtons, setRenderedButtons] = useState<ReactElement[]>([]);\n const [renderedTabs, setRenderedTabs] = useState<ReactElement[]>([]);\n const [activeTabIndex, setActiveTabIndex] = useState(() => getValidSelectedIndex(selected));\n const [focusedIndex, setFocusedIndex] = useState(() => getValidSelectedIndex(selected));\n const [usingKeyboardNavigation, setUsingKeyboardNavigation] = useState(false);\n const [indicatorStyles, setIndicatorStyles] = useState<{\n width: number;\n left: number;\n top: number;\n }>({\n width: 0,\n left: 0,\n top: 0\n });\n const tabsRef = (ref as RefObject<HTMLDivElement>) || createRef<HTMLDivElement>();\n const indicatorRef = useRef<HTMLDivElement>(null);\n\n const getEnabledTabIndexes = (): number[] => {\n const kids = React.Children.toArray(children) as ReactElement[];\n\n return kids.reduce((indexes: number[], child, index) => {\n if (isTabChild(child) && !child.props.disabled) {\n indexes.push(index);\n }\n return indexes;\n }, []);\n };\n\n const getNextEnabledTabIndex = (startIndex: number, direction: \"next\" | \"prev\"): number => {\n const enabledTabIndexes = getEnabledTabIndexes();\n\n if (!enabledTabIndexes.length) {\n return startIndex;\n }\n\n const currentPosition = enabledTabIndexes.indexOf(startIndex);\n\n if (currentPosition === -1) {\n return enabledTabIndexes[0];\n }\n\n const nextPosition =\n direction === \"next\"\n ? (currentPosition + 1) % enabledTabIndexes.length\n : (currentPosition - 1 + enabledTabIndexes.length) % enabledTabIndexes.length;\n\n return enabledTabIndexes[nextPosition];\n };\n\n const getFirstEnabledTabIndex = (): number => {\n const enabledTabIndexes = getEnabledTabIndexes();\n return enabledTabIndexes[0] ?? 0;\n };\n\n const getLastEnabledTabIndex = (): number => {\n const enabledTabIndexes = getEnabledTabIndexes();\n return enabledTabIndexes[enabledTabIndexes.length - 1] ?? 0;\n };\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n const totalAmountOfTabs = getEnabledTabIndexes().length;\n const keyToIndex: Record<string, () => number> = {\n ArrowRight: () => getNextEnabledTabIndex(focusedIndex, \"next\"),\n ArrowLeft: () => getNextEnabledTabIndex(focusedIndex, \"prev\"),\n Home: () => getFirstEnabledTabIndex(),\n End: () => getLastEnabledTabIndex()\n };\n const navigationKeys = Object.keys(keyToIndex);\n if (navigationKeys.includes(e.key) && !usingKeyboardNavigation) {\n setUsingKeyboardNavigation(true);\n }\n\n if (totalAmountOfTabs === 1) {\n return;\n }\n\n const getIndexForKey = keyToIndex[e.key];\n if (!getIndexForKey) {\n return;\n }\n\n e.preventDefault();\n const nextIndex = getIndexForKey();\n setFocusedIndex(nextIndex);\n if (activateOnFocus) {\n void handleTabClick(nextIndex);\n }\n };\n\n const handleBlur = (e: React.FocusEvent) => {\n if (!e.currentTarget.contains(e.relatedTarget)) {\n setTimeout(() => {\n setFocusedIndex(activeTabIndex);\n setUsingKeyboardNavigation(false);\n }, 0);\n }\n };\n\n const calculateIndicatorPosition = () => {\n if (!tabsRef.current || !indicatorRef.current) {\n return;\n }\n\n const selectedButton = tabsRef.current.querySelector(\n 'button[role=\"tab\"][aria-selected=\"true\"]'\n ) as HTMLElement | null;\n\n if (!selectedButton) {\n return;\n }\n\n setIndicatorStyles({\n left: selectedButton.offsetLeft,\n top:\n selectedButton.offsetTop +\n selectedButton.offsetHeight -\n indicatorRef.current.offsetHeight -\n Number.parseInt(getComputedStyle(selectedButton).borderBottomWidth),\n width: selectedButton.offsetWidth\n });\n };\n\n const handleTabClick = async (newIndex: number) => {\n try {\n const allowed =\n typeof tabChanging === \"function\"\n ? await Promise.resolve(tabChanging(newIndex, activeTabIndex))\n : true;\n\n if (!allowed) {\n setFocusedIndex(activeTabIndex);\n const buttons = tabsRef.current?.querySelectorAll<HTMLButtonElement>('button[role=\"tab\"]');\n buttons?.[activeTabIndex]?.focus();\n return;\n }\n\n setActiveTabIndex(newIndex);\n onTabChange?.(newIndex);\n } catch (error) {\n console.error(\"handleTabClick failed: \", error);\n }\n };\n\n useEffect(() => {\n setFocusedIndex(activeTabIndex);\n }, [activeTabIndex]);\n\n useEffect(() => {\n const validSelectedIndex = getValidSelectedIndex(activeTabIndex);\n\n if (validSelectedIndex !== activeTabIndex) {\n setActiveTabIndex(validSelectedIndex);\n return;\n }\n\n const enabledTabIndexes = getEnabledTabIndexes();\n if (!enabledTabIndexes.includes(focusedIndex)) {\n setFocusedIndex(validSelectedIndex);\n }\n }, [children, activeTabIndex, focusedIndex]);\n\n useEffect(() => {\n if (tabsRef.current && renderedButtons.length) {\n calculateIndicatorPosition();\n }\n }, [tabsRef.current, activeTabIndex, renderedButtons]);\n\n useEffect(() => {\n const buttons = React.Children.map(children, (child, index) => {\n if (isTabChild(child)) {\n return React.createElement(\n TabButton,\n {\n key: `${child.props.title.toLowerCase().replace(/\\s/, \"_\")}_button`,\n tabIndex: focusedIndex === index ? 0 : -1,\n \"aria-selected\": activeTabIndex === index,\n focused: usingKeyboardNavigation && focusedIndex === index,\n tabActive: activeTabIndex === index,\n \"aria-controls\": `tab_${index}`,\n onClick: () => {\n void handleTabClick(index);\n },\n onFocus: () => {\n setFocusedIndex(index);\n },\n disabled: child.props.disabled,\n fluid: fluid,\n iconPosition: iconsPosition,\n icon: child.props.icon\n },\n child.props.title\n );\n }\n return null;\n });\n\n const tabs = React.Children.map(children, (child, index) => {\n if (isTabChild(child)) {\n return React.cloneElement(child, {\n key: `${child.props.title.toLowerCase().replace(/\\s/, \"_\")}_tab`,\n tabIndex: activeTabIndex === index ? 0 : -1,\n tabActive: activeTabIndex === index,\n id: `tab_${index}`,\n children: child.props.children\n });\n }\n\n return null;\n });\n\n setRenderedTabs(tabs);\n setRenderedButtons(buttons);\n }, [children, activeTabIndex, focusedIndex, fluid, align, iconsPosition]);\n\n const tabListClasses = [classes[\"tablist\"]];\n align && tabListClasses.push(classes[align]);\n tabListClassName && tabListClasses.push(tabListClassName);\n\n return (\n <div {...rest} ref={tabsRef} className={`${classes[\"tabs\"]} ${className ?? \"\"}`}>\n <div\n role=\"tablist\"\n tabIndex={-1}\n className={tabListClasses.join(\" \")}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n >\n {renderedButtons}\n <div\n className={classes[\"indicator\"]}\n ref={indicatorRef}\n aria-hidden=\"true\"\n tabIndex={-1}\n style={{\n width: indicatorStyles.width,\n left: indicatorStyles.left,\n top: indicatorStyles.top\n }}\n />\n </div>\n <div>{renderedTabs}</div>\n </div>\n );\n};\n\nexport const Tabs = React.forwardRef(TabsComponent);\n"],"names":[],"mappings":";;;AA0CA,MAAM,gBAAiE,CACrE;AAAA,EACE;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,E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BAAmB;AAAA,UAC9B,IAAI,OAAO,KAAK;AAAA,UAChB,UAAU,MAAM,MAAM;AAAA,QAAA,CACvB;AAAA,MACH;AAEA,aAAO;AAAA,IACT,CAAC;AAED,oBAAgB,IAAI;AACpB,uBAAmB,OAAO;AAAA,EAC5B,GAAG,CAAC,UAAU,gBAAgB,cAAc,OAAO,OAAO,aAAa,CAAC;AAExE,QAAM,iBAAiB,CAAC,QAAQ,SAAS,CAAC;AAC1C,WAAS,eAAe,KAAK,QAAQ,KAAK,CAAC;AAC3C,sBAAoB,eAAe,KAAK,gBAAgB;AAExD,SACE,sBAAA,cAAC,OAAA,EAAK,GAAG,MAAM,KAAK,SAAS,WAAW,GAAG,QAAQ,MAAM,CAAC,IAAI,aAAa,EAAE,GAAA,GAC3E,sBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,UAAU;AAAA,MACV,WAAW,eAAe,KAAK,GAAG;AAAA,MAClC,WAAW;AAAA,MACX,QAAQ;AAAA,IAAA;AAAA,IAEP;AAAA,IACD,sBAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW,QAAQ,WAAW;AAAA,QAC9B,KAAK;AAAA,QACL,eAAY;AAAA,QACZ,UAAU;AAAA,QACV,OAAO;AAAA,UACL,OAAO,gBAAgB;AAAA,UACvB,MAAM,gBAAgB;AAAA,UACtB,KAAK,gBAAgB;AAAA,QAAA;AAAA,MACvB;AAAA,IAAA;AAAA,EACF,GAEF,sBAAA,cAAC,OAAA,MAAK,YAAa,CACrB;AAEJ;AAEO,MAAM,OAAO,MAAM,WAAW,aAAa;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('.Tabs_sr-
|
|
2
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t="
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('.Tabs_sr-only_PX3IM{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.Tabs_hidden_PX3IM{display:none}.Tabs_slide-in_PX3IM{animation:Tabs_slide-in_PX3IM .5s forwards}@media(prefers-reduced-motion:reduce){.Tabs_slide-in_PX3IM{animation-duration:.1ms}}.Tabs_slide-out_PX3IM{animation:Tabs_slide-out_PX3IM .5s forwards}@media(prefers-reduced-motion:reduce){.Tabs_slide-out_PX3IM{animation-duration:.1ms}}@keyframes Tabs_slide-in_PX3IM{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@keyframes Tabs_slide-out_PX3IM{0%{transform:translateY(0)}to{transform:translateY(100vh)}}/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.Tabs_tabs_PX3IM{background-color:var(--tabs-background-color);padding:1rem 1.25rem;border-radius:.5rem;display:flex;flex-direction:column;gap:1rem}.Tabs_tablist_PX3IM{display:flex;flex-wrap:nowrap;overflow-x:auto;position:relative;margin:-5px;padding:5px;z-index:0}.Tabs_tablist_PX3IM.Tabs_center_PX3IM{justify-content:center}.Tabs_tablist_PX3IM.Tabs_right_PX3IM{justify-content:flex-end}.Tabs_indicator_PX3IM{position:absolute;height:calc(var(--tab-active-border-height) - var(--tablist-border-width));border-radius:.125rem .125rem 0 0;background-color:var(--tab-active-border-color);z-index:2;transition-property:left,width;transition-duration:.2s;transition-timing-function:ease-in-out}@media(prefers-reduced-motion:reduce){.Tabs_indicator_PX3IM{transition-duration:.1ms}}')),document.head.appendChild(e)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}}();
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t="Tabs_hidden_PX3IM",s="Tabs_tabs_PX3IM",e="Tabs_tablist_PX3IM",i="Tabs_center_PX3IM",r="Tabs_right_PX3IM",a="Tabs_indicator_PX3IM",o={"sr-only":"Tabs_sr-only_PX3IM",hidden:t,"slide-in":"Tabs_slide-in_PX3IM","slide-out":"Tabs_slide-out_PX3IM",tabs:s,tablist:e,center:i,right:r,indicator:a};exports.center=i,exports.default=o,exports.hidden=t,exports.indicator=a,exports.right=r,exports.tablist=e,exports.tabs=s;
|
|
3
3
|
//# sourceMappingURL=Tabs.module.scss.cjs.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('.Tabs_sr-
|
|
2
|
-
const hidden = "
|
|
3
|
-
const tabs = "
|
|
4
|
-
const tablist = "
|
|
5
|
-
const center = "
|
|
6
|
-
const right = "
|
|
7
|
-
const indicator = "
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('.Tabs_sr-only_PX3IM{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.Tabs_hidden_PX3IM{display:none}.Tabs_slide-in_PX3IM{animation:Tabs_slide-in_PX3IM .5s forwards}@media(prefers-reduced-motion:reduce){.Tabs_slide-in_PX3IM{animation-duration:.1ms}}.Tabs_slide-out_PX3IM{animation:Tabs_slide-out_PX3IM .5s forwards}@media(prefers-reduced-motion:reduce){.Tabs_slide-out_PX3IM{animation-duration:.1ms}}@keyframes Tabs_slide-in_PX3IM{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@keyframes Tabs_slide-out_PX3IM{0%{transform:translateY(0)}to{transform:translateY(100vh)}}/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.Tabs_tabs_PX3IM{background-color:var(--tabs-background-color);padding:1rem 1.25rem;border-radius:.5rem;display:flex;flex-direction:column;gap:1rem}.Tabs_tablist_PX3IM{display:flex;flex-wrap:nowrap;overflow-x:auto;position:relative;margin:-5px;padding:5px;z-index:0}.Tabs_tablist_PX3IM.Tabs_center_PX3IM{justify-content:center}.Tabs_tablist_PX3IM.Tabs_right_PX3IM{justify-content:flex-end}.Tabs_indicator_PX3IM{position:absolute;height:calc(var(--tab-active-border-height) - var(--tablist-border-width));border-radius:.125rem .125rem 0 0;background-color:var(--tab-active-border-color);z-index:2;transition-property:left,width;transition-duration:.2s;transition-timing-function:ease-in-out}@media(prefers-reduced-motion:reduce){.Tabs_indicator_PX3IM{transition-duration:.1ms}}')),document.head.appendChild(e)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}}();
|
|
2
|
+
const hidden = "Tabs_hidden_PX3IM";
|
|
3
|
+
const tabs = "Tabs_tabs_PX3IM";
|
|
4
|
+
const tablist = "Tabs_tablist_PX3IM";
|
|
5
|
+
const center = "Tabs_center_PX3IM";
|
|
6
|
+
const right = "Tabs_right_PX3IM";
|
|
7
|
+
const indicator = "Tabs_indicator_PX3IM";
|
|
8
8
|
const classes = {
|
|
9
|
-
"sr-only": "Tabs_sr-
|
|
9
|
+
"sr-only": "Tabs_sr-only_PX3IM",
|
|
10
10
|
hidden,
|
|
11
|
-
"slide-in": "Tabs_slide-
|
|
12
|
-
"slide-out": "Tabs_slide-
|
|
11
|
+
"slide-in": "Tabs_slide-in_PX3IM",
|
|
12
|
+
"slide-out": "Tabs_slide-out_PX3IM",
|
|
13
13
|
tabs,
|
|
14
14
|
tablist,
|
|
15
15
|
center,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('.RemoveButton_sr-
|
|
2
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('.RemoveButton_sr-only_PX3IM{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.RemoveButton_hidden_PX3IM{display:none}.RemoveButton_slide-in_PX3IM{animation:RemoveButton_slide-in_PX3IM .5s forwards}@media(prefers-reduced-motion:reduce){.RemoveButton_slide-in_PX3IM{animation-duration:.1ms}}.RemoveButton_slide-out_PX3IM{animation:RemoveButton_slide-out_PX3IM .5s forwards}@media(prefers-reduced-motion:reduce){.RemoveButton_slide-out_PX3IM{animation-duration:.1ms}}@keyframes RemoveButton_slide-in_PX3IM{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@keyframes RemoveButton_slide-out_PX3IM{0%{transform:translateY(0)}to{transform:translateY(100vh)}}/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.RemoveButton_remove_PX3IM{width:1.25rem;height:1.25rem;background:none;border:none;padding:0;margin-right:-.375rem;cursor:pointer}.RemoveButton_remove_PX3IM:hover{border-radius:.125rem;background-color:var(--color-black10)}.RemoveButton_remove_PX3IM:active{background-color:var(--color-blue-grey400)}.RemoveButton_remove_PX3IM:focus-visible{outline:calc(.125 * var(--font-size)) solid var(--color-focus);outline-offset:0;border-radius:var(--focus-border-radius)}.RemoveButton_remove_PX3IM .RemoveButton_icon_PX3IM{font-size:var(--font-size-small)}')),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}}();
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="RemoveButton_remove_PX3IM",o="RemoveButton_icon_PX3IM",t={remove:e,icon:o};exports.default=t,exports.icon=o,exports.remove=e;
|
|
3
3
|
//# sourceMappingURL=RemoveButton.module.scss.cjs.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('.RemoveButton_sr-
|
|
2
|
-
const remove = "
|
|
3
|
-
const icon = "
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('.RemoveButton_sr-only_PX3IM{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.RemoveButton_hidden_PX3IM{display:none}.RemoveButton_slide-in_PX3IM{animation:RemoveButton_slide-in_PX3IM .5s forwards}@media(prefers-reduced-motion:reduce){.RemoveButton_slide-in_PX3IM{animation-duration:.1ms}}.RemoveButton_slide-out_PX3IM{animation:RemoveButton_slide-out_PX3IM .5s forwards}@media(prefers-reduced-motion:reduce){.RemoveButton_slide-out_PX3IM{animation-duration:.1ms}}@keyframes RemoveButton_slide-in_PX3IM{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@keyframes RemoveButton_slide-out_PX3IM{0%{transform:translateY(0)}to{transform:translateY(100vh)}}/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.RemoveButton_remove_PX3IM{width:1.25rem;height:1.25rem;background:none;border:none;padding:0;margin-right:-.375rem;cursor:pointer}.RemoveButton_remove_PX3IM:hover{border-radius:.125rem;background-color:var(--color-black10)}.RemoveButton_remove_PX3IM:active{background-color:var(--color-blue-grey400)}.RemoveButton_remove_PX3IM:focus-visible{outline:calc(.125 * var(--font-size)) solid var(--color-focus);outline-offset:0;border-radius:var(--focus-border-radius)}.RemoveButton_remove_PX3IM .RemoveButton_icon_PX3IM{font-size:var(--font-size-small)}')),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}}();
|
|
2
|
+
const remove = "RemoveButton_remove_PX3IM";
|
|
3
|
+
const icon = "RemoveButton_icon_PX3IM";
|
|
4
4
|
const classes = {
|
|
5
5
|
remove,
|
|
6
6
|
icon
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),r=require("../Icon/Icon.cjs.js"),a=require("./Tag.module.scss.cjs.js"),o=require("../Typography/Typography.cjs.js"),t=require("./RemoveButton.cjs.js"),n=e.forwardRef(({children:n,variant:s,icon:c,backgroundColor:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),r=require("../Icon/Icon.cjs.js"),a=require("./Tag.module.scss.cjs.js"),o=require("../Typography/Typography.cjs.js"),t=require("./RemoveButton.cjs.js"),n=e.forwardRef(({children:n,variant:s,icon:c,backgroundColor:i,color:l,shape:d="rounded",removeButton:u={},...m},p)=>{const g=[a.default.tag];return"enabled"===s&&g.push(a.default["tag-enabled"]),"disabled"===s&&g.push(a.default["tag-disabled"]),"sharp"===d&&g.push(a.default.sharp),e.createElement("div",{...m,ref:p,className:`${g.join(" ")} ${m.className??""}`,style:{backgroundColor:i,color:l}},c?e.createElement(r.Icon,{size:"inherit",icon:c}):"enabled"===s?e.createElement(r.Icon,{size:"inherit",icon:r.Icons.CheckmarkCircleAlt}):"disabled"===s?e.createElement(r.Icon,{size:"inherit",icon:r.Icons.Forbidden}):void 0,e.createElement(o.Typography,{spacing:{marginBottom:0},variant:"body",className:a.default.label},n),e.createElement(t.RemoveButton,{...u,label:"string"==typeof n?n:void 0}))});exports.Tag=n;
|
|
2
2
|
//# sourceMappingURL=Tag.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.cjs.js","sources":["../../../src/components/Tag/Tag.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ForwardRefRenderFunction, HTMLAttributes, forwardRef } from \"react\";\nimport { Icon, Icons } from \"../Icon/Icon\";\nimport classes from \"./Tag.module.scss\";\nimport { Typography } from \"../Typography/Typography\";\nimport { RemoveButton, Props as RemoveButtonProps } from \"./RemoveButton\";\n\nexport interface Props extends HTMLAttributes<HTMLDivElement> {\n variant?: \"enabled\" | \"disabled\";\n icon?: Icons;\n backgroundColor?: string;\n color?: string;\n children?:
|
|
1
|
+
{"version":3,"file":"Tag.cjs.js","sources":["../../../src/components/Tag/Tag.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ForwardRefRenderFunction, HTMLAttributes, ReactNode, forwardRef } from \"react\";\nimport { Icon, Icons } from \"../Icon/Icon\";\nimport classes from \"./Tag.module.scss\";\nimport { Typography } from \"../Typography/Typography\";\nimport { RemoveButton, Props as RemoveButtonProps } from \"./RemoveButton\";\n\nexport interface Props extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\n variant?: \"enabled\" | \"disabled\";\n icon?: Icons;\n backgroundColor?: string;\n color?: string;\n /** Widened from `string` to `ReactNode` so callers (e.g. MultiSelect's async chip fallback,\n * whose label may come from a consumer-supplied `ReactNode`) aren't forced to stringify it.\n * The remove button's accessible label falls back to just `removeLabel` when `children` isn't\n * a plain string, since a `ReactNode` can't be safely concatenated into announcement text. */\n children?: ReactNode;\n shape?: \"rounded\" | \"sharp\";\n removeButton?: RemoveButtonProps;\n}\n\nconst TagComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n {\n children,\n variant,\n icon,\n backgroundColor,\n color,\n shape = \"rounded\",\n removeButton = {},\n ...rest\n }: Props,\n ref\n) => {\n const determineIcon = () => {\n if (icon) {\n return <Icon size=\"inherit\" icon={icon} />;\n }\n\n if (variant === \"enabled\") {\n return <Icon size=\"inherit\" icon={Icons.CheckmarkCircleAlt} />;\n } else if (variant === \"disabled\") {\n return <Icon size=\"inherit\" icon={Icons.Forbidden} />;\n }\n };\n\n const tagClasses = [classes[\"tag\"]];\n variant === \"enabled\" && tagClasses.push(classes[\"tag-enabled\"]);\n variant === \"disabled\" && tagClasses.push(classes[\"tag-disabled\"]);\n shape === \"sharp\" && tagClasses.push(classes[\"sharp\"]);\n\n return (\n <div\n {...rest}\n ref={ref}\n className={`${tagClasses.join(\" \")} ${rest.className ?? \"\"}`}\n style={{ backgroundColor, color }}\n >\n {determineIcon()}\n <Typography spacing={{ marginBottom: 0 }} variant=\"body\" className={classes[\"label\"]}>\n {children}\n </Typography>\n <RemoveButton {...removeButton} label={typeof children === \"string\" ? children : undefined} />\n </div>\n );\n};\n\nexport const Tag = forwardRef(TagComponent);\n"],"names":["Tag","forwardRef","children","variant","icon","backgroundColor","color","shape","removeButton","rest","ref","tagClasses","classes","push","React","createElement","className","join","style","Icon","size","Icons","CheckmarkCircleAlt","Forbidden","Typography","spacing","marginBottom","RemoveButton","label"],"mappings":"gQAkFaA,EAAMC,EAAAA,WA9CmD,EAElEC,WACAC,UACAC,OACAC,kBACAC,QACAC,QAAQ,UACRC,eAAe,CAAA,KACZC,GAELC,KAEA,MAYMC,EAAa,CAACC,UAAa,KAKjC,MAJY,YAAZT,GAAyBQ,EAAWE,KAAKD,EAAAA,QAAQ,gBACrC,aAAZT,GAA0BQ,EAAWE,KAAKD,EAAAA,QAAQ,iBACxC,UAAVL,GAAqBI,EAAWE,KAAKD,EAAAA,QAAe,OAGlDE,EAAAC,cAAC,MAAA,IACKN,EACJC,MACAM,UAAW,GAAGL,EAAWM,KAAK,QAAQR,EAAKO,WAAa,KACxDE,MAAO,CAAEb,kBAAiBC,UArBxBF,EACKU,EAAAC,cAACI,EAAAA,KAAA,CAAKC,KAAK,UAAUhB,SAGd,YAAZD,kBACMgB,EAAAA,KAAA,CAAKC,KAAK,UAAUhB,KAAMiB,QAAMC,qBACnB,aAAZnB,kBACDgB,EAAAA,KAAA,CAAKC,KAAK,UAAUhB,KAAMiB,QAAME,iBAD1C,IAkBER,cAACS,EAAAA,WAAA,CAAWC,QAAS,CAAEC,aAAc,GAAKvB,QAAQ,OAAOa,UAAWJ,EAAAA,QAAe,OAChFV,GAEHY,EAAAC,cAACY,mBAAiBnB,EAAcoB,MAA2B,iBAAb1B,EAAwBA"}
|
|
@@ -37,7 +37,7 @@ const TagComponent = ({
|
|
|
37
37
|
},
|
|
38
38
|
determineIcon(),
|
|
39
39
|
/* @__PURE__ */ React.createElement(Typography, { spacing: { marginBottom: 0 }, variant: "body", className: classes["label"] }, children),
|
|
40
|
-
/* @__PURE__ */ React.createElement(RemoveButton, { ...removeButton, label: children })
|
|
40
|
+
/* @__PURE__ */ React.createElement(RemoveButton, { ...removeButton, label: typeof children === "string" ? children : void 0 })
|
|
41
41
|
);
|
|
42
42
|
};
|
|
43
43
|
const Tag = forwardRef(TagComponent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.es.js","sources":["../../../src/components/Tag/Tag.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ForwardRefRenderFunction, HTMLAttributes, forwardRef } from \"react\";\nimport { Icon, Icons } from \"../Icon/Icon\";\nimport classes from \"./Tag.module.scss\";\nimport { Typography } from \"../Typography/Typography\";\nimport { RemoveButton, Props as RemoveButtonProps } from \"./RemoveButton\";\n\nexport interface Props extends HTMLAttributes<HTMLDivElement> {\n variant?: \"enabled\" | \"disabled\";\n icon?: Icons;\n backgroundColor?: string;\n color?: string;\n children?:
|
|
1
|
+
{"version":3,"file":"Tag.es.js","sources":["../../../src/components/Tag/Tag.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ForwardRefRenderFunction, HTMLAttributes, ReactNode, forwardRef } from \"react\";\nimport { Icon, Icons } from \"../Icon/Icon\";\nimport classes from \"./Tag.module.scss\";\nimport { Typography } from \"../Typography/Typography\";\nimport { RemoveButton, Props as RemoveButtonProps } from \"./RemoveButton\";\n\nexport interface Props extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\n variant?: \"enabled\" | \"disabled\";\n icon?: Icons;\n backgroundColor?: string;\n color?: string;\n /** Widened from `string` to `ReactNode` so callers (e.g. MultiSelect's async chip fallback,\n * whose label may come from a consumer-supplied `ReactNode`) aren't forced to stringify it.\n * The remove button's accessible label falls back to just `removeLabel` when `children` isn't\n * a plain string, since a `ReactNode` can't be safely concatenated into announcement text. */\n children?: ReactNode;\n shape?: \"rounded\" | \"sharp\";\n removeButton?: RemoveButtonProps;\n}\n\nconst TagComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n {\n children,\n variant,\n icon,\n backgroundColor,\n color,\n shape = \"rounded\",\n removeButton = {},\n ...rest\n }: Props,\n ref\n) => {\n const determineIcon = () => {\n if (icon) {\n return <Icon size=\"inherit\" icon={icon} />;\n }\n\n if (variant === \"enabled\") {\n return <Icon size=\"inherit\" icon={Icons.CheckmarkCircleAlt} />;\n } else if (variant === \"disabled\") {\n return <Icon size=\"inherit\" icon={Icons.Forbidden} />;\n }\n };\n\n const tagClasses = [classes[\"tag\"]];\n variant === \"enabled\" && tagClasses.push(classes[\"tag-enabled\"]);\n variant === \"disabled\" && tagClasses.push(classes[\"tag-disabled\"]);\n shape === \"sharp\" && tagClasses.push(classes[\"sharp\"]);\n\n return (\n <div\n {...rest}\n ref={ref}\n className={`${tagClasses.join(\" \")} ${rest.className ?? \"\"}`}\n style={{ backgroundColor, color }}\n >\n {determineIcon()}\n <Typography spacing={{ marginBottom: 0 }} variant=\"body\" className={classes[\"label\"]}>\n {children}\n </Typography>\n <RemoveButton {...removeButton} label={typeof children === \"string\" ? children : undefined} />\n </div>\n );\n};\n\nexport const Tag = forwardRef(TagComponent);\n"],"names":[],"mappings":";;;;;AAoCA,MAAM,eAAgE,CACpE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,eAAe,CAAA;AAAA,EACf,GAAG;AACL,GACA,QACG;AACH,QAAM,gBAAgB,MAAM;AAC1B,QAAI,MAAM;AACR,aAAO,sBAAA,cAAC,MAAA,EAAK,MAAK,WAAU,MAAY;AAAA,IAC1C;AAEA,QAAI,YAAY,WAAW;AACzB,iDAAQ,MAAA,EAAK,MAAK,WAAU,MAAM,MAAM,oBAAoB;AAAA,IAC9D,WAAW,YAAY,YAAY;AACjC,iDAAQ,MAAA,EAAK,MAAK,WAAU,MAAM,MAAM,WAAW;AAAA,IACrD;AAAA,EACF;AAEA,QAAM,aAAa,CAAC,QAAQ,KAAK,CAAC;AAClC,cAAY,aAAa,WAAW,KAAK,QAAQ,aAAa,CAAC;AAC/D,cAAY,cAAc,WAAW,KAAK,QAAQ,cAAc,CAAC;AACjE,YAAU,WAAW,WAAW,KAAK,QAAQ,OAAO,CAAC;AAErD,SACE,sBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA,WAAW,GAAG,WAAW,KAAK,GAAG,CAAC,IAAI,KAAK,aAAa,EAAE;AAAA,MAC1D,OAAO,EAAE,iBAAiB,MAAA;AAAA,IAAM;AAAA,IAE/B,cAAA;AAAA,IACD,sBAAA,cAAC,YAAA,EAAW,SAAS,EAAE,cAAc,EAAA,GAAK,SAAQ,QAAO,WAAW,QAAQ,OAAO,KAChF,QACH;AAAA,IACA,sBAAA,cAAC,gBAAc,GAAG,cAAc,OAAO,OAAO,aAAa,WAAW,WAAW,OAAA,CAAW;AAAA,EAAA;AAGlG;AAEO,MAAM,MAAM,WAAW,YAAY;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.
|
|
2
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a="
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.Tag_tag_PX3IM{font-size:var(--font-size-sub);padding:.25rem .75rem;border:none;border-radius:3.125rem;display:inline-flex;align-items:center;gap:.25rem}.Tag_tag_PX3IM.Tag_tag-enabled_PX3IM{background-color:var(--color-green100)}.Tag_tag_PX3IM.Tag_tag-disabled_PX3IM{background-color:var(--color-blue-grey100)}.Tag_tag_PX3IM.Tag_sharp_PX3IM{border-radius:.125rem}.Tag_tag_PX3IM .Tag_label_PX3IM{line-height:2;font-size:inherit;color:inherit}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}}();
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a="Tag_tag_PX3IM",e="Tag_sharp_PX3IM",t="Tag_label_PX3IM",l={tag:a,"tag-enabled":"Tag_tag-enabled_PX3IM","tag-disabled":"Tag_tag-disabled_PX3IM",sharp:e,label:t};exports.default=l,exports.label=t,exports.sharp=e,exports.tag=a;
|
|
3
3
|
//# sourceMappingURL=Tag.module.scss.cjs.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.
|
|
2
|
-
const tag = "
|
|
3
|
-
const sharp = "
|
|
4
|
-
const label = "
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.Tag_tag_PX3IM{font-size:var(--font-size-sub);padding:.25rem .75rem;border:none;border-radius:3.125rem;display:inline-flex;align-items:center;gap:.25rem}.Tag_tag_PX3IM.Tag_tag-enabled_PX3IM{background-color:var(--color-green100)}.Tag_tag_PX3IM.Tag_tag-disabled_PX3IM{background-color:var(--color-blue-grey100)}.Tag_tag_PX3IM.Tag_sharp_PX3IM{border-radius:.125rem}.Tag_tag_PX3IM .Tag_label_PX3IM{line-height:2;font-size:inherit;color:inherit}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}}();
|
|
2
|
+
const tag = "Tag_tag_PX3IM";
|
|
3
|
+
const sharp = "Tag_sharp_PX3IM";
|
|
4
|
+
const label = "Tag_label_PX3IM";
|
|
5
5
|
const classes = {
|
|
6
6
|
tag,
|
|
7
|
-
"tag-enabled": "Tag_tag-
|
|
8
|
-
"tag-disabled": "Tag_tag-
|
|
7
|
+
"tag-enabled": "Tag_tag-enabled_PX3IM",
|
|
8
|
+
"tag-disabled": "Tag_tag-disabled_PX3IM",
|
|
9
9
|
sharp,
|
|
10
10
|
label
|
|
11
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEllipsis.cjs.js","sources":["../../../src/components/TextEllipsis/TextEllipsis.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n ForwardRefRenderFunction,\n useRef,\n MouseEventHandler,\n useState,\n ComponentPropsWithRef\n} from \"react\";\nimport { Popover } from \"../Popover/Popover\";\nimport classes from \"./TextEllipsis.module.scss\";\n\nexport interface Props extends ComponentPropsWithRef<\"div\"> {\n children?: string;\n popoverClassName?: string;\n}\n\nconst TextEllipsisComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n { children, popoverClassName, className, ...rest }: Props,\n ref\n) => {\n const [showPopover, setShowPopover] = useState(false);\n const textContainer = useRef<HTMLDivElement>(null);\n\n const ellipsisVisible = () => {\n if (\n textContainer.current &&\n textContainer.current.offsetWidth < textContainer.current.scrollWidth\n ) {\n return true;\n }\n return false;\n };\n\n const onMouseEnter: MouseEventHandler<HTMLDivElement> = () => {\n ellipsisVisible() && setShowPopover(true);\n };\n\n const onMouseLeave: MouseEventHandler<HTMLDivElement> = () => {\n ellipsisVisible() && setShowPopover(false);\n };\n\n return (\n <div
|
|
1
|
+
{"version":3,"file":"TextEllipsis.cjs.js","sources":["../../../src/components/TextEllipsis/TextEllipsis.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n ForwardRefRenderFunction,\n useRef,\n MouseEventHandler,\n useState,\n ComponentPropsWithRef\n} from \"react\";\nimport { Popover } from \"../Popover/Popover\";\nimport classes from \"./TextEllipsis.module.scss\";\n\nexport interface Props extends ComponentPropsWithRef<\"div\"> {\n children?: string;\n popoverClassName?: string;\n}\n\nconst TextEllipsisComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n { children, popoverClassName, className, ...rest }: Props,\n ref\n) => {\n const [showPopover, setShowPopover] = useState(false);\n const textContainer = useRef<HTMLDivElement>(null);\n\n const ellipsisVisible = () => {\n if (\n textContainer.current &&\n textContainer.current.offsetWidth < textContainer.current.scrollWidth\n ) {\n return true;\n }\n return false;\n };\n\n const onMouseEnter: MouseEventHandler<HTMLDivElement> = () => {\n ellipsisVisible() && setShowPopover(true);\n };\n\n const onMouseLeave: MouseEventHandler<HTMLDivElement> = () => {\n ellipsisVisible() && setShowPopover(false);\n };\n\n return (\n <div // NOSONAR S6848 - the hover popover is progressive enhancement over text that is already fully readable; adding tabIndex/onFocus here would add a tab stop to every ellipsized text node in the app.\n {...rest}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n className={`${classes[\"text-ellipsis\"]} ${className ?? \"\"}`}\n ref={ref ?? textContainer}\n >\n {children}\n <Popover\n aria-hidden={true}\n data-hidden={!showPopover}\n show={showPopover}\n role=\"tooltip\"\n anchorEl={textContainer}\n className={`${classes.popover} ${popoverClassName ?? \"\"}`}\n >\n {children}\n </Popover>\n </div>\n );\n};\n\nexport const TextEllipsis = React.forwardRef(TextEllipsisComponent);\n"],"names":["TextEllipsis","React","forwardRef","children","popoverClassName","className","rest","ref","showPopover","setShowPopover","useState","textContainer","useRef","ellipsisVisible","current","offsetWidth","scrollWidth","createElement","onMouseEnter","onMouseLeave","classes","Popover","show","role","anchorEl","popover"],"mappings":"+LA+EaA,EAAeC,EAAMC,WAhD6C,EAC3EC,WAAUC,mBAAkBC,eAAcC,GAC5CC,KAEA,MAAOC,EAAaC,GAAkBC,EAAAA,UAAS,GACzCC,EAAgBC,EAAAA,OAAuB,MAEvCC,EAAkB,OAEpBF,EAAcG,SACdH,EAAcG,QAAQC,YAAcJ,EAAcG,QAAQE,aAe9D,OACEf,EAAAgB,cAAC,MAAA,IACKX,EACJY,aAXoD,KACtDL,KAAqBJ,GAAe,IAWlCU,aARoD,KACtDN,KAAqBJ,GAAe,IAQlCJ,UAAW,GAAGe,UAAQ,oBAAoBf,GAAa,KACvDE,IAAKA,GAAOI,GAEXR,EACDF,EAAAgB,cAACI,EAAAA,QAAA,CACC,eAAa,EACb,eAAcb,EACdc,KAAMd,EACNe,KAAK,UACLC,SAAUb,EACVN,UAAW,GAAGe,EAAAA,QAAQK,WAAWrB,GAAoB,MAEpDD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEllipsis.es.js","sources":["../../../src/components/TextEllipsis/TextEllipsis.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n ForwardRefRenderFunction,\n useRef,\n MouseEventHandler,\n useState,\n ComponentPropsWithRef\n} from \"react\";\nimport { Popover } from \"../Popover/Popover\";\nimport classes from \"./TextEllipsis.module.scss\";\n\nexport interface Props extends ComponentPropsWithRef<\"div\"> {\n children?: string;\n popoverClassName?: string;\n}\n\nconst TextEllipsisComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n { children, popoverClassName, className, ...rest }: Props,\n ref\n) => {\n const [showPopover, setShowPopover] = useState(false);\n const textContainer = useRef<HTMLDivElement>(null);\n\n const ellipsisVisible = () => {\n if (\n textContainer.current &&\n textContainer.current.offsetWidth < textContainer.current.scrollWidth\n ) {\n return true;\n }\n return false;\n };\n\n const onMouseEnter: MouseEventHandler<HTMLDivElement> = () => {\n ellipsisVisible() && setShowPopover(true);\n };\n\n const onMouseLeave: MouseEventHandler<HTMLDivElement> = () => {\n ellipsisVisible() && setShowPopover(false);\n };\n\n return (\n <div
|
|
1
|
+
{"version":3,"file":"TextEllipsis.es.js","sources":["../../../src/components/TextEllipsis/TextEllipsis.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n ForwardRefRenderFunction,\n useRef,\n MouseEventHandler,\n useState,\n ComponentPropsWithRef\n} from \"react\";\nimport { Popover } from \"../Popover/Popover\";\nimport classes from \"./TextEllipsis.module.scss\";\n\nexport interface Props extends ComponentPropsWithRef<\"div\"> {\n children?: string;\n popoverClassName?: string;\n}\n\nconst TextEllipsisComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n { children, popoverClassName, className, ...rest }: Props,\n ref\n) => {\n const [showPopover, setShowPopover] = useState(false);\n const textContainer = useRef<HTMLDivElement>(null);\n\n const ellipsisVisible = () => {\n if (\n textContainer.current &&\n textContainer.current.offsetWidth < textContainer.current.scrollWidth\n ) {\n return true;\n }\n return false;\n };\n\n const onMouseEnter: MouseEventHandler<HTMLDivElement> = () => {\n ellipsisVisible() && setShowPopover(true);\n };\n\n const onMouseLeave: MouseEventHandler<HTMLDivElement> = () => {\n ellipsisVisible() && setShowPopover(false);\n };\n\n return (\n <div // NOSONAR S6848 - the hover popover is progressive enhancement over text that is already fully readable; adding tabIndex/onFocus here would add a tab stop to every ellipsized text node in the app.\n {...rest}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n className={`${classes[\"text-ellipsis\"]} ${className ?? \"\"}`}\n ref={ref ?? textContainer}\n >\n {children}\n <Popover\n aria-hidden={true}\n data-hidden={!showPopover}\n show={showPopover}\n role=\"tooltip\"\n anchorEl={textContainer}\n className={`${classes.popover} ${popoverClassName ?? \"\"}`}\n >\n {children}\n </Popover>\n </div>\n );\n};\n\nexport const TextEllipsis = React.forwardRef(TextEllipsisComponent);\n"],"names":[],"mappings":";;;AA+BA,MAAM,wBAAyE,CAC7E,EAAE,UAAU,kBAAkB,WAAW,GAAG,KAAA,GAC5C,QACG;AACH,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK;AACpD,QAAM,gBAAgB,OAAuB,IAAI;AAEjD,QAAM,kBAAkB,MAAM;AAC5B,QACE,cAAc,WACd,cAAc,QAAQ,cAAc,cAAc,QAAQ,aAC1D;AACA,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT;AAEA,QAAM,eAAkD,MAAM;AAC5D,oBAAA,KAAqB,eAAe,IAAI;AAAA,EAC1C;AAEA,QAAM,eAAkD,MAAM;AAC5D,oBAAA,KAAqB,eAAe,KAAK;AAAA,EAC3C;AAEA,SACE,sBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA,WAAW,GAAG,QAAQ,eAAe,CAAC,IAAI,aAAa,EAAE;AAAA,MACzD,KAAK,OAAO;AAAA,IAAA;AAAA,IAEX;AAAA,IACD,sBAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,eAAa;AAAA,QACb,eAAa,CAAC;AAAA,QACd,MAAM;AAAA,QACN,MAAK;AAAA,QACL,UAAU;AAAA,QACV,WAAW,GAAG,QAAQ,OAAO,IAAI,oBAAoB,EAAE;AAAA,MAAA;AAAA,MAEtD;AAAA,IAAA;AAAA,EACH;AAGN;AAEO,MAAM,eAAe,MAAM,WAAW,qBAAqB;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.TextEllipsis_text-
|
|
2
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.TextEllipsis_text-ellipsis_PX3IM{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.TextEllipsis_popover_PX3IM{max-width:min(75ch,90%);padding:.6875rem .6875rem .6875rem .875rem;border-radius:.25rem;box-shadow:0 .1875rem .375rem #0000004a;white-space:pre-wrap;word-wrap:break-word;transition-property:opacity;transform:scale(1);z-index:1}')),document.head.appendChild(e)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}}();
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="TextEllipsis_popover_PX3IM",t={"text-ellipsis":"TextEllipsis_text-ellipsis_PX3IM",popover:e};exports.default=t,exports.popover=e;
|
|
3
3
|
//# sourceMappingURL=TextEllipsis.module.scss.cjs.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.TextEllipsis_text-
|
|
2
|
-
const popover = "
|
|
1
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('/*!\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.TextEllipsis_text-ellipsis_PX3IM{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.TextEllipsis_popover_PX3IM{max-width:min(75ch,90%);padding:.6875rem .6875rem .6875rem .875rem;border-radius:.25rem;box-shadow:0 .1875rem .375rem #0000004a;white-space:pre-wrap;word-wrap:break-word;transition-property:opacity;transform:scale(1);z-index:1}')),document.head.appendChild(e)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}}();
|
|
2
|
+
const popover = "TextEllipsis_popover_PX3IM";
|
|
3
3
|
const classes = {
|
|
4
|
-
"text-ellipsis": "TextEllipsis_text-
|
|
4
|
+
"text-ellipsis": "TextEllipsis_text-ellipsis_PX3IM",
|
|
5
5
|
popover
|
|
6
6
|
};
|
|
7
7
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tile.cjs.js","sources":["../../../src/components/Tiles/Tile.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n ComponentPropsWithoutRef,\n ComponentPropsWithRef,\n ForwardRefRenderFunction,\n ReactElement,\n useState\n} from \"react\";\nimport { Icon, Icons } from \"../Icon/Icon\";\nimport classes from \"./Tile.module.scss\";\nimport readyClasses from \"../../readyclasses.module.scss\";\n\nimport { Props as ContextMenuProps } from \"../ContextMenu/ContextMenu\";\nimport { generateID } from \"../../util/helper\";\nimport { Props as IconButtonProps } from \"../Button/IconButton\";\n\ninterface ImageProps extends ComponentPropsWithoutRef<\"img\"> {\n src: string;\n}\n\nexport interface Props extends ComponentPropsWithRef<\"div\"> {\n title: string;\n imageProps?: ImageProps;\n enabled?: boolean;\n loading?: boolean;\n tileAction?: ReactElement<ContextMenuProps> | ReactElement<IconButtonProps>;\n}\n\nconst TileComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n { title, imageProps, enabled, className, loading, tileAction, ...rest }: Props,\n ref\n) => {\n const [tileDescriptionID] = useState(generateID(20));\n\n if (!title) {\n throw new Error(\"Please make sure to pass a title prop to your Tile component.\");\n }\n\n const statusMessage = () => {\n if (enabled) {\n return \"Status: enabled\";\n }\n\n return \"Status: disabled\";\n };\n\n return (\n <article\n {...rest}\n tabIndex={0}\n aria-labelledby={tileDescriptionID}\n ref={ref}\n className={`${classes[\"tile\"]} ${loading ? classes[\"loading\"] : \"\"}`}\n >\n <header style={{ justifyContent: enabled === undefined ? \"flex-end\" : \"space-between\" }}>\n {enabled === true && (\n <Icon\n color=\"var(--success)\"\n icon={Icons.Checkmark}\n className={`${classes[\"icon\"]} ${className ?? \"\"}`}\n />\n )}\n {enabled === false && (\n <Icon\n color=\"var(--greyed-out)\"\n icon={Icons.Forbidden}\n className={`${classes[\"icon\"]} ${className ?? \"\"}`}\n />\n )}\n {enabled !== undefined && (\n <span id={tileDescriptionID} className={readyClasses[\"sr-only\"]}>\n {`${title}. ${statusMessage()}`}\n </span>\n )}\n {tileAction ?? null}\n </header>\n <div className={classes[\"content\"]}>\n {imageProps && imageProps.src.length > 0 && (\n <figure className={classes[\"image\"]}>{!loading && <img {...imageProps} alt=\"\" />}</figure>\n )}\n {(!imageProps || imageProps.src.length === 0) && (\n <Icon className={classes[\"placeholder\"]} icon={Icons.Image} />\n )}\n <span className={classes[\"title\"]}>{title}</span>\n </div>\n </article>\n );\n};\n\nexport const Tile = React.forwardRef(TileComponent);\n"],"names":["Tile","React","forwardRef","title","imageProps","enabled","className","loading","tileAction","rest","ref","tileDescriptionID","useState","generateID","Error","createElement","tabIndex","classes","style","justifyContent","Icon","color","icon","Icons","Checkmark","Forbidden","id","readyClasses","src","length","alt","Image"],"mappings":"0QAwGaA,EAAOC,EAAMC,WA7D6C,EACnEC,QAAOC,aAAYC,UAASC,YAAWC,UAASC,gBAAeC,GACjEC,KAEA,MAAOC,GAAqBC,EAAAA,SAASC,EAAAA,WAAW,KAEhD,IAAKV,EACH,MAAM,IAAIW,MAAM,iEAWlB,OACEb,EAAAc,cAAC,UAAA,IACKN,EACJO,SAAU,EACV,kBAAiBL,EACjBD,MACAJ,UAAW,GAAGW,EAAAA,QAAc,QAAKV,EAAUU,EAAAA,QAAiB,QAAI,MAEhEhB,EAAAc,cAAC,SAAA,CAAOG,MAAO,CAAEC,oBAA4B,IAAZd,EAAwB,WAAa,mBACvD,IAAZA,GACCJ,EAAAc,cAACK,EAAAA,KAAA,CACCC,MAAM,iBACNC,KAAMC,EAAAA,MAAMC,UACZlB,UAAW,GAAGW,UAAc,QAAKX,GAAa,QAGrC,IAAZD,GACCJ,EAAAc,cAACK,EAAAA,KAAA,CACCC,MAAM,oBACNC,KAAMC,EAAAA,MAAME,UACZnB,UAAW,GAAGW,UAAc,QAAKX,GAAa,YAGrC,IAAZD,mBACE,OAAA,CAAKqB,GAAIf,EAAmBL,UAAWqB,EAAAA,QAAa,YAClD,GAAGxB,MAhCRE,EACK,kBAGF,sBA+BFG,GAAc,MAEjBP,EAAAc,cAAC,OAAIT,UAAWW,EAAAA,QAAiB,SAC9Bb,GAAcA,EAAWwB,IAAIC,OAAS,mBACpC,SAAA,CAAOvB,UAAWW,EAAAA,QAAe,QAAKV,KAAWQ,cAAC,MAAA,IAAQX,EAAY0B,IAAI,QAE1E1B,GAAwC,IAA1BA,EAAWwB,IAAIC,SAC9B5B,EAAAc,cAACK,OAAA,CAAKd,UAAWW,EAAAA,QAAqB,YAAGK,KAAMC,EAAAA,MAAMQ,UAEvDhB,cAAC,OAAA,CAAKT,UAAWW,EAAAA,QAAe,OAAId"}
|
|
1
|
+
{"version":3,"file":"Tile.cjs.js","sources":["../../../src/components/Tiles/Tile.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n ComponentPropsWithoutRef,\n ComponentPropsWithRef,\n ForwardRefRenderFunction,\n ReactElement,\n useState\n} from \"react\";\nimport { Icon, Icons } from \"../Icon/Icon\";\nimport classes from \"./Tile.module.scss\";\nimport readyClasses from \"../../readyclasses.module.scss\";\n\nimport { Props as ContextMenuProps } from \"../ContextMenu/ContextMenu\";\nimport { generateID } from \"../../util/helper\";\nimport { Props as IconButtonProps } from \"../Button/IconButton\";\n\ninterface ImageProps extends ComponentPropsWithoutRef<\"img\"> {\n src: string;\n}\n\nexport interface Props extends ComponentPropsWithRef<\"div\"> {\n title: string;\n imageProps?: ImageProps;\n enabled?: boolean;\n loading?: boolean;\n tileAction?: ReactElement<ContextMenuProps> | ReactElement<IconButtonProps>;\n}\n\nconst TileComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (\n { title, imageProps, enabled, className, loading, tileAction, ...rest }: Props,\n ref\n) => {\n const [tileDescriptionID] = useState(generateID(20));\n\n if (!title) {\n throw new Error(\"Please make sure to pass a title prop to your Tile component.\");\n }\n\n const statusMessage = () => {\n if (enabled) {\n return \"Status: enabled\";\n }\n\n return \"Status: disabled\";\n };\n\n return (\n <article\n {...rest}\n tabIndex={0} // NOSONAR S6845 - the card is a deliberate focus target: focusing it is what makes the sr-only \"{title}. Status: enabled/disabled\" node referenced by aria-labelledby get announced, which an unfocusable <article> would never surface.\n aria-labelledby={tileDescriptionID}\n ref={ref}\n className={`${classes[\"tile\"]} ${loading ? classes[\"loading\"] : \"\"}`}\n >\n <header style={{ justifyContent: enabled === undefined ? \"flex-end\" : \"space-between\" }}>\n {enabled === true && (\n <Icon\n color=\"var(--success)\"\n icon={Icons.Checkmark}\n className={`${classes[\"icon\"]} ${className ?? \"\"}`}\n />\n )}\n {enabled === false && (\n <Icon\n color=\"var(--greyed-out)\"\n icon={Icons.Forbidden}\n className={`${classes[\"icon\"]} ${className ?? \"\"}`}\n />\n )}\n {enabled !== undefined && (\n <span id={tileDescriptionID} className={readyClasses[\"sr-only\"]}>\n {`${title}. ${statusMessage()}`}\n </span>\n )}\n {tileAction ?? null}\n </header>\n <div className={classes[\"content\"]}>\n {imageProps && imageProps.src.length > 0 && (\n <figure className={classes[\"image\"]}>{!loading && <img {...imageProps} alt=\"\" />}</figure>\n )}\n {(!imageProps || imageProps.src.length === 0) && (\n <Icon className={classes[\"placeholder\"]} icon={Icons.Image} />\n )}\n <span className={classes[\"title\"]}>{title}</span>\n </div>\n </article>\n );\n};\n\nexport const Tile = React.forwardRef(TileComponent);\n"],"names":["Tile","React","forwardRef","title","imageProps","enabled","className","loading","tileAction","rest","ref","tileDescriptionID","useState","generateID","Error","createElement","tabIndex","classes","style","justifyContent","Icon","color","icon","Icons","Checkmark","Forbidden","id","readyClasses","src","length","alt","Image"],"mappings":"0QAwGaA,EAAOC,EAAMC,WA7D6C,EACnEC,QAAOC,aAAYC,UAASC,YAAWC,UAASC,gBAAeC,GACjEC,KAEA,MAAOC,GAAqBC,EAAAA,SAASC,EAAAA,WAAW,KAEhD,IAAKV,EACH,MAAM,IAAIW,MAAM,iEAWlB,OACEb,EAAAc,cAAC,UAAA,IACKN,EACJO,SAAU,EACV,kBAAiBL,EACjBD,MACAJ,UAAW,GAAGW,EAAAA,QAAc,QAAKV,EAAUU,EAAAA,QAAiB,QAAI,MAEhEhB,EAAAc,cAAC,SAAA,CAAOG,MAAO,CAAEC,oBAA4B,IAAZd,EAAwB,WAAa,mBACvD,IAAZA,GACCJ,EAAAc,cAACK,EAAAA,KAAA,CACCC,MAAM,iBACNC,KAAMC,EAAAA,MAAMC,UACZlB,UAAW,GAAGW,UAAc,QAAKX,GAAa,QAGrC,IAAZD,GACCJ,EAAAc,cAACK,EAAAA,KAAA,CACCC,MAAM,oBACNC,KAAMC,EAAAA,MAAME,UACZnB,UAAW,GAAGW,UAAc,QAAKX,GAAa,YAGrC,IAAZD,mBACE,OAAA,CAAKqB,GAAIf,EAAmBL,UAAWqB,EAAAA,QAAa,YAClD,GAAGxB,MAhCRE,EACK,kBAGF,sBA+BFG,GAAc,MAEjBP,EAAAc,cAAC,OAAIT,UAAWW,EAAAA,QAAiB,SAC9Bb,GAAcA,EAAWwB,IAAIC,OAAS,mBACpC,SAAA,CAAOvB,UAAWW,EAAAA,QAAe,QAAKV,KAAWQ,cAAC,MAAA,IAAQX,EAAY0B,IAAI,QAE1E1B,GAAwC,IAA1BA,EAAWwB,IAAIC,SAC9B5B,EAAAc,cAACK,OAAA,CAAKd,UAAWW,EAAAA,QAAqB,YAAGK,KAAMC,EAAAA,MAAMQ,UAEvDhB,cAAC,OAAA,CAAKT,UAAWW,EAAAA,QAAe,OAAId"}
|