@lumx/react 2.2.17 → 2.2.18-alpha-hooks.1
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/esm/_internal/{_rollupPluginBabelHelpers.js → _rolluppluginbabelhelpers.53.js} +1 -1
- package/esm/_internal/_rolluppluginbabelhelpers.53.js.map +1 -0
- package/esm/_internal/alert-dialog.js +19 -19
- package/esm/_internal/{AlertDialog.js → alertdialog.1.js} +8 -8
- package/esm/_internal/alertdialog.1.js.map +1 -0
- package/esm/_internal/autocomplete.js +21 -20
- package/esm/_internal/autocomplete.js.map +1 -1
- package/esm/_internal/{AutocompleteMultiple.js → autocompletemultiple.2.js} +9 -9
- package/esm/_internal/autocompletemultiple.2.js.map +1 -0
- package/esm/_internal/{Avatar2.js → avatar.3.js} +4 -4
- package/esm/_internal/avatar.3.js.map +1 -0
- package/esm/_internal/avatar.js +6 -6
- package/esm/_internal/{Badge2.js → badge.4.js} +3 -3
- package/esm/_internal/badge.4.js.map +1 -0
- package/esm/_internal/badge.js +3 -3
- package/esm/_internal/{Button2.js → button.5.js} +5 -5
- package/esm/_internal/button.5.js.map +1 -0
- package/esm/_internal/button.js +15 -14
- package/esm/_internal/button.js.map +1 -1
- package/esm/_internal/{ButtonGroup.js → buttongroup.7.js} +3 -3
- package/esm/_internal/buttongroup.7.js.map +1 -0
- package/esm/_internal/{ButtonRoot.js → buttonroot.57.js} +4 -4
- package/esm/_internal/buttonroot.57.js.map +1 -0
- package/esm/_internal/{Checkbox2.js → checkbox.8.js} +7 -7
- package/esm/_internal/checkbox.8.js.map +1 -0
- package/esm/_internal/checkbox.js +7 -7
- package/esm/_internal/{Chip2.js → chip.9.js} +3 -3
- package/esm/_internal/chip.9.js.map +1 -0
- package/esm/_internal/chip.js +4 -4
- package/esm/_internal/{ChipGroup.js → chipgroup.10.js} +3 -3
- package/esm/_internal/chipgroup.10.js.map +1 -0
- package/esm/_internal/{ClickAwayProvider.js → clickawayprovider.60.js} +4 -4
- package/esm/_internal/clickawayprovider.60.js.map +1 -0
- package/esm/_internal/comment-block.js +13 -12
- package/esm/_internal/comment-block.js.map +1 -1
- package/esm/_internal/{CommentBlock.js → commentblock.11.js} +5 -5
- package/esm/_internal/commentblock.11.js.map +1 -0
- package/esm/_internal/components.js +1 -1
- package/esm/_internal/{constants.js → constants.59.js} +1 -1
- package/esm/_internal/constants.59.js.map +1 -0
- package/esm/_internal/date-picker.js +19 -18
- package/esm/_internal/date-picker.js.map +1 -1
- package/esm/_internal/{DatePickerField.js → datepickerfield.12.js} +9 -9
- package/esm/_internal/datepickerfield.12.js.map +1 -0
- package/esm/_internal/{Dialog2.js → dialog.13.js} +12 -12
- package/esm/_internal/dialog.13.js.map +1 -0
- package/esm/_internal/dialog.js +12 -12
- package/esm/_internal/{Divider2.js → divider.14.js} +3 -3
- package/esm/_internal/divider.14.js.map +1 -0
- package/esm/_internal/divider.js +3 -3
- package/esm/_internal/drag-handle.js +4 -4
- package/esm/_internal/{DragHandle.js → draghandle.15.js} +4 -4
- package/esm/_internal/draghandle.15.js.map +1 -0
- package/esm/_internal/{Dropdown2.js → dropdown.16.js} +6 -6
- package/esm/_internal/dropdown.16.js.map +1 -0
- package/esm/_internal/dropdown.js +11 -10
- package/esm/_internal/dropdown.js.map +1 -1
- package/esm/_internal/expansion-panel.js +17 -16
- package/esm/_internal/expansion-panel.js.map +1 -1
- package/esm/_internal/{ExpansionPanel.js → expansionpanel.17.js} +8 -8
- package/esm/_internal/expansionpanel.17.js.map +1 -0
- package/esm/_internal/{Flag2.js → flag.18.js} +4 -4
- package/esm/_internal/flag.18.js.map +1 -0
- package/esm/_internal/flag.js +4 -4
- package/esm/_internal/flex-box.js +3 -3
- package/esm/_internal/{FlexBox.js → flexbox.19.js} +3 -3
- package/esm/_internal/flexbox.19.js.map +1 -0
- package/esm/_internal/{getRootClassName.js → getrootclassname.54.js} +2 -2
- package/esm/_internal/getrootclassname.54.js.map +1 -0
- package/esm/_internal/grid.js +3 -3
- package/esm/_internal/{GridItem.js → griditem.20.js} +3 -3
- package/esm/_internal/griditem.20.js.map +1 -0
- package/esm/_internal/{Icon2.js → icon.21.js} +3 -3
- package/esm/_internal/icon.21.js.map +1 -0
- package/esm/_internal/icon.js +3 -3
- package/esm/_internal/{IconButton.js → iconbutton.6.js} +6 -6
- package/esm/_internal/iconbutton.6.js.map +1 -0
- package/esm/_internal/image-block.js +6 -6
- package/esm/_internal/{ImageBlock.js → imageblock.22.js} +4 -4
- package/esm/_internal/imageblock.22.js.map +1 -0
- package/esm/{index2.js → _internal/index.55.js} +1 -1
- package/esm/_internal/index.55.js.map +1 -0
- package/esm/_internal/input-helper.js +3 -3
- package/esm/_internal/input-label.js +3 -3
- package/esm/_internal/{InputHelper.js → inputhelper.23.js} +3 -3
- package/esm/_internal/inputhelper.23.js.map +1 -0
- package/esm/_internal/{InputLabel.js → inputlabel.24.js} +3 -3
- package/esm/_internal/inputlabel.24.js.map +1 -0
- package/esm/_internal/{Lightbox2.js → lightbox.25.js} +11 -11
- package/esm/_internal/lightbox.25.js.map +1 -0
- package/esm/_internal/lightbox.js +17 -16
- package/esm/_internal/lightbox.js.map +1 -1
- package/esm/_internal/link-preview.js +8 -8
- package/esm/_internal/{Link2.js → link.26.js} +5 -5
- package/esm/_internal/link.26.js.map +1 -0
- package/esm/_internal/link.js +5 -5
- package/esm/_internal/{LinkPreview.js → linkpreview.27.js} +5 -5
- package/esm/_internal/linkpreview.27.js.map +1 -0
- package/esm/_internal/{List2.js → list.28.js} +6 -6
- package/esm/_internal/list.28.js.map +1 -0
- package/esm/_internal/list.js +7 -7
- package/esm/_internal/{ListSubheader.js → listsubheader.29.js} +3 -3
- package/esm/_internal/listsubheader.29.js.map +1 -0
- package/esm/_internal/{mergeRefs.js → mergerefs.56.js} +1 -1
- package/esm/_internal/mergerefs.56.js.map +1 -0
- package/esm/_internal/{Message2.js → message.30.js} +4 -4
- package/esm/_internal/message.30.js.map +1 -0
- package/esm/_internal/message.js +4 -4
- package/esm/_internal/{Mosaic2.js → mosaic.31.js} +4 -4
- package/esm/_internal/mosaic.31.js.map +1 -0
- package/esm/_internal/mosaic.js +6 -6
- package/esm/_internal/{Notification2.js → notification.32.js} +7 -7
- package/esm/_internal/notification.32.js.map +1 -0
- package/esm/_internal/notification.js +9 -9
- package/esm/_internal/{partitionMulti.js → partitionmulti.62.js} +1 -1
- package/esm/_internal/partitionmulti.62.js.map +1 -0
- package/esm/_internal/{Popover2.js → popover.33.js} +8 -31
- package/esm/_internal/popover.33.js.map +1 -0
- package/esm/_internal/popover.js +7 -6
- package/esm/_internal/popover.js.map +1 -1
- package/esm/_internal/post-block.js +7 -7
- package/esm/_internal/{PostBlock.js → postblock.34.js} +5 -5
- package/esm/_internal/postblock.34.js.map +1 -0
- package/esm/_internal/progress-tracker.js +9 -9
- package/esm/_internal/{Progress2.js → progress.35.js} +3 -3
- package/esm/_internal/progress.35.js.map +1 -0
- package/esm/_internal/progress.js +3 -3
- package/esm/_internal/{ProgressTrackerStepPanel.js → progresstrackersteppanel.36.js} +8 -8
- package/esm/_internal/progresstrackersteppanel.36.js.map +1 -0
- package/esm/_internal/radio-button.js +6 -6
- package/esm/_internal/{RadioGroup.js → radiogroup.37.js} +6 -6
- package/esm/_internal/radiogroup.37.js.map +1 -0
- package/esm/_internal/{renderLink.js → renderlink.65.js} +2 -2
- package/esm/_internal/renderlink.65.js.map +1 -0
- package/esm/_internal/select.js +20 -19
- package/esm/_internal/select.js.map +1 -1
- package/esm/_internal/{SelectMultiple.js → selectmultiple.38.js} +12 -12
- package/esm/_internal/selectmultiple.38.js.map +1 -0
- package/esm/_internal/side-navigation.js +15 -14
- package/esm/_internal/side-navigation.js.map +1 -1
- package/esm/_internal/{SideNavigationItem.js → sidenavigationitem.39.js} +7 -7
- package/esm/_internal/sidenavigationitem.39.js.map +1 -0
- package/esm/_internal/skeleton.js +3 -3
- package/esm/_internal/{SkeletonTypography.js → skeletontypography.40.js} +3 -3
- package/esm/_internal/skeletontypography.40.js.map +1 -0
- package/esm/_internal/{Slider2.js → slider.41.js} +6 -6
- package/esm/_internal/slider.41.js.map +1 -0
- package/esm/_internal/slider.js +6 -6
- package/esm/_internal/{Slides.js → slides.42.js} +8 -8
- package/esm/_internal/slides.42.js.map +1 -0
- package/esm/_internal/slideshow.js +14 -13
- package/esm/_internal/slideshow.js.map +1 -1
- package/esm/_internal/{Switch2.js → switch.43.js} +6 -6
- package/esm/_internal/switch.43.js.map +1 -0
- package/esm/_internal/switch.js +6 -6
- package/esm/_internal/table.js +4 -4
- package/esm/_internal/{TableRow.js → tablerow.44.js} +4 -4
- package/esm/_internal/tablerow.44.js.map +1 -0
- package/esm/_internal/{TabPanel.js → tabpanel.45.js} +6 -6
- package/esm/_internal/tabpanel.45.js.map +1 -0
- package/esm/_internal/tabs.js +7 -7
- package/esm/_internal/text-field.js +16 -15
- package/esm/_internal/text-field.js.map +1 -1
- package/esm/_internal/{TextField.js → textfield.46.js} +9 -9
- package/esm/_internal/textfield.46.js.map +1 -0
- package/esm/_internal/{Thumbnail2.js → thumbnail.47.js} +6 -6
- package/esm/_internal/thumbnail.47.js.map +1 -0
- package/esm/_internal/thumbnail.js +6 -6
- package/esm/_internal/{Toolbar2.js → toolbar.49.js} +3 -3
- package/esm/_internal/toolbar.49.js.map +1 -0
- package/esm/_internal/toolbar.js +3 -3
- package/esm/_internal/{Tooltip2.js → tooltip.50.js} +7 -7
- package/esm/_internal/tooltip.50.js.map +1 -0
- package/esm/_internal/tooltip.js +9 -8
- package/esm/_internal/tooltip.js.map +1 -1
- package/esm/_internal/{type.js → type.64.js} +1 -1
- package/esm/_internal/type.64.js.map +1 -0
- package/esm/_internal/{types.js → types.48.js} +2 -3
- package/esm/_internal/types.48.js.map +1 -0
- package/esm/_internal/{Uploader2.js → uploader.51.js} +4 -4
- package/esm/_internal/uploader.51.js.map +1 -0
- package/esm/_internal/uploader.js +4 -4
- package/esm/_internal/{useDelayedVisibility.js → usedelayedvisibility.63.js} +2 -2
- package/esm/_internal/usedelayedvisibility.63.js.map +1 -0
- package/esm/_internal/{useDisableBodyScroll.js → usedisablebodyscroll.61.js} +1 -1
- package/esm/_internal/usedisablebodyscroll.61.js.map +1 -0
- package/esm/_internal/{useFocusTrap.js → usefocustrap.58.js} +2 -2
- package/esm/_internal/usefocustrap.58.js.map +1 -0
- package/esm/_internal/user-block.js +9 -9
- package/esm/_internal/{UserBlock.js → userblock.52.js} +5 -5
- package/esm/_internal/userblock.52.js.map +1 -0
- package/esm/_internal/{useRovingTabIndex.js → userovingtabindex.66.js} +3 -3
- package/esm/_internal/userovingtabindex.66.js.map +1 -0
- package/hooks/useFocusWithin.d.ts +16 -0
- package/hooks/useFocusWithin.js +28 -0
- package/hooks/useFocusWithin.js.map +1 -0
- package/{types.d.ts → index.d.ts} +5 -6
- package/index.js +90 -0
- package/{esm/index.js.map → index.js.map} +1 -1
- package/package.json +11 -8
- package/src/components/thumbnail/index.ts +0 -1
- package/esm/_internal/AlertDialog.js.map +0 -1
- package/esm/_internal/AutocompleteMultiple.js.map +0 -1
- package/esm/_internal/Avatar2.js.map +0 -1
- package/esm/_internal/Badge2.js.map +0 -1
- package/esm/_internal/Button2.js.map +0 -1
- package/esm/_internal/ButtonGroup.js.map +0 -1
- package/esm/_internal/ButtonRoot.js.map +0 -1
- package/esm/_internal/Checkbox2.js.map +0 -1
- package/esm/_internal/Chip2.js.map +0 -1
- package/esm/_internal/ChipGroup.js.map +0 -1
- package/esm/_internal/ClickAwayProvider.js.map +0 -1
- package/esm/_internal/CommentBlock.js.map +0 -1
- package/esm/_internal/DatePickerField.js.map +0 -1
- package/esm/_internal/Dialog2.js.map +0 -1
- package/esm/_internal/Divider2.js.map +0 -1
- package/esm/_internal/DragHandle.js.map +0 -1
- package/esm/_internal/Dropdown2.js.map +0 -1
- package/esm/_internal/ExpansionPanel.js.map +0 -1
- package/esm/_internal/Flag2.js.map +0 -1
- package/esm/_internal/FlexBox.js.map +0 -1
- package/esm/_internal/GridItem.js.map +0 -1
- package/esm/_internal/Icon2.js.map +0 -1
- package/esm/_internal/IconButton.js.map +0 -1
- package/esm/_internal/ImageBlock.js.map +0 -1
- package/esm/_internal/InputHelper.js.map +0 -1
- package/esm/_internal/InputLabel.js.map +0 -1
- package/esm/_internal/Lightbox2.js.map +0 -1
- package/esm/_internal/Link2.js.map +0 -1
- package/esm/_internal/LinkPreview.js.map +0 -1
- package/esm/_internal/List2.js.map +0 -1
- package/esm/_internal/ListSubheader.js.map +0 -1
- package/esm/_internal/Message2.js.map +0 -1
- package/esm/_internal/Mosaic2.js.map +0 -1
- package/esm/_internal/Notification2.js.map +0 -1
- package/esm/_internal/Popover2.js.map +0 -1
- package/esm/_internal/PostBlock.js.map +0 -1
- package/esm/_internal/Progress2.js.map +0 -1
- package/esm/_internal/ProgressTrackerStepPanel.js.map +0 -1
- package/esm/_internal/RadioGroup.js.map +0 -1
- package/esm/_internal/SelectMultiple.js.map +0 -1
- package/esm/_internal/SideNavigationItem.js.map +0 -1
- package/esm/_internal/SkeletonTypography.js.map +0 -1
- package/esm/_internal/Slider2.js.map +0 -1
- package/esm/_internal/Slides.js.map +0 -1
- package/esm/_internal/Switch2.js.map +0 -1
- package/esm/_internal/TabPanel.js.map +0 -1
- package/esm/_internal/TableRow.js.map +0 -1
- package/esm/_internal/TextField.js.map +0 -1
- package/esm/_internal/Thumbnail2.js.map +0 -1
- package/esm/_internal/Toolbar2.js.map +0 -1
- package/esm/_internal/Tooltip2.js.map +0 -1
- package/esm/_internal/Uploader2.js.map +0 -1
- package/esm/_internal/UserBlock.js.map +0 -1
- package/esm/_internal/_rollupPluginBabelHelpers.js.map +0 -1
- package/esm/_internal/constants.js.map +0 -1
- package/esm/_internal/getRootClassName.js.map +0 -1
- package/esm/_internal/mergeRefs.js.map +0 -1
- package/esm/_internal/partitionMulti.js.map +0 -1
- package/esm/_internal/renderLink.js.map +0 -1
- package/esm/_internal/type.js.map +0 -1
- package/esm/_internal/types.js.map +0 -1
- package/esm/_internal/useDelayedVisibility.js.map +0 -1
- package/esm/_internal/useDisableBodyScroll.js.map +0 -1
- package/esm/_internal/useFocusTrap.js.map +0 -1
- package/esm/_internal/useRovingTabIndex.js.map +0 -1
- package/esm/index.js +0 -89
- package/esm/index2.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { e as _toConsumableArray, _ as _objectSpread2, a as _defineProperty, d as _slicedToArray } from './
|
|
1
|
+
import { e as _toConsumableArray, _ as _objectSpread2, a as _defineProperty, d as _slicedToArray } from './_rolluppluginbabelhelpers.53.js';
|
|
2
2
|
import { createContext, useContext, useMemo, useEffect, useCallback } from 'react';
|
|
3
|
-
import { u as uid } from '
|
|
3
|
+
import { u as uid } from './index.55.js';
|
|
4
4
|
|
|
5
5
|
var INIT_STATE = {
|
|
6
6
|
isLazy: true,
|
|
@@ -219,4 +219,4 @@ var useRovingTabIndex = function useRovingTabIndex(_ref) {
|
|
|
219
219
|
};
|
|
220
220
|
|
|
221
221
|
export { INIT_STATE as I, TabProviderContext as T, useTabProviderContextState as a, useTabProviderContext as b, reducer as r, useRovingTabIndex as u };
|
|
222
|
-
//# sourceMappingURL=
|
|
222
|
+
//# sourceMappingURL=userovingtabindex.66.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userovingtabindex.66.js","sources":["../../../src/components/tabs/state.ts","../../../src/hooks/useRovingTabIndex.tsx"],"sourcesContent":["import { Dispatch, createContext, useCallback, useContext, useEffect, useMemo } from 'react';\nimport { uid } from 'uid';\n\ntype TabType = 'tab' | 'tabPanel';\n\nexport interface State {\n isLazy: boolean;\n shouldActivateOnFocus: boolean;\n activeTabIndex: number;\n ids: Record<TabType, string[]>;\n}\n\nexport const INIT_STATE: State = {\n isLazy: true,\n shouldActivateOnFocus: false,\n activeTabIndex: 0,\n ids: { tab: [], tabPanel: [] },\n};\n\nexport type Action =\n | { type: 'update'; payload: Partial<State> }\n | { type: 'setActiveTabIndex'; payload: number }\n | { type: 'register'; payload: { type: TabType; id: string } }\n | { type: 'unregister'; payload: { type: TabType; id: string } };\n\nexport const reducer = (state: State, action: Action): State => {\n switch (action.type) {\n case 'update':\n return { ...state, ...action.payload };\n case 'setActiveTabIndex': {\n if (state.activeTabIndex === action.payload) {\n return state;\n }\n // Change active tab index.\n return { ...state, activeTabIndex: action.payload };\n }\n case 'register': {\n const { type, id } = action.payload;\n // Append tab/tabPanel id in state.\n return { ...state, ids: { ...state.ids, [type]: [...state.ids[type], id] } };\n }\n case 'unregister': {\n const { type, id } = action.payload;\n const index = state.ids[type].indexOf(id);\n if (index === -1) return state;\n // Remove tab & tab panel at index.\n const tabIds = [...state.ids.tab];\n tabIds.splice(index, 1);\n const tabPanelIds = [...state.ids.tabPanel];\n tabPanelIds.splice(index, 1);\n return {\n ...state,\n ids: { tab: tabIds, tabPanel: tabPanelIds },\n };\n }\n default:\n return state;\n }\n};\n\nexport const TabProviderContext = createContext<[State, Dispatch<Action>] | null>(null);\n\nexport type TabState = Pick<Required<State>, 'isLazy' | 'shouldActivateOnFocus'> & {\n isActive: boolean;\n tabId: string;\n tabPanelId: string;\n changeToTab(): void;\n};\n\n/* eslint-disable react-hooks/rules-of-hooks */\nexport const useTabProviderContext = (type: TabType, originalId?: string): undefined | TabState => {\n const context = useContext(TabProviderContext);\n if (!context) {\n return undefined;\n }\n const [state, dispatch] = context;\n\n // Current tab or tab panel id.\n const id = useMemo(\n () => originalId || `${type}-${uid()}`,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n useEffect(\n () => {\n // On mount: register tab or tab panel id.\n dispatch({ type: 'register', payload: { type, id } });\n return () => {\n // On unmount: unregister tab or tab panel id.\n dispatch({ type: 'unregister', payload: { type, id } });\n };\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n // Find tab/tabPanel index using it's id.\n const index = useMemo(() => state.ids[type].indexOf(id), [state.ids, type, id]);\n const tabId = useMemo(() => state.ids.tab[index] || '', [state, index]);\n const tabPanelId = useMemo(() => state.ids.tabPanel[index] || '', [state, index]);\n const isActive = useMemo(() => state.activeTabIndex === index, [state, index]);\n const changeToTab = useCallback(() => dispatch({ type: 'setActiveTabIndex', payload: index }), [dispatch, index]);\n return {\n isLazy: state.isLazy,\n shouldActivateOnFocus: state.shouldActivateOnFocus,\n tabId,\n tabPanelId,\n isActive,\n changeToTab,\n };\n};\n\nexport const useTabProviderContextState = (): State | undefined => {\n const context = useContext(TabProviderContext);\n return context?.[0];\n};\n","import { RefObject, useEffect } from 'react';\n\ninterface UseRovingTabIndexOptions {\n parentRef: RefObject<HTMLElement>;\n elementSelector: string;\n keepTabIndex?: boolean;\n /** List of values to be used as extra dependencies of the useEffect */\n extraDependencies?: any[];\n}\n\nexport const useRovingTabIndex = ({\n parentRef,\n elementSelector,\n keepTabIndex,\n extraDependencies = [],\n}: UseRovingTabIndexOptions): void => {\n useEffect(\n () => {\n const parent = parentRef?.current;\n if (!parent) {\n return undefined;\n }\n\n const elements = parent.querySelectorAll(elementSelector) as NodeListOf<HTMLElement>;\n const initialFocusableElement = parent?.querySelector(`${elementSelector}[tabindex=\"0\"]`);\n\n const handleKeyDown = (index: number) => (evt: KeyboardEvent) => {\n let newTabFocus = index;\n if (!(evt.key === 'ArrowRight' || evt.key === 'ArrowLeft')) {\n return;\n }\n\n if (evt.key === 'ArrowRight') {\n // Move right\n newTabFocus += 1;\n // If we're at the end, go to the start\n if (newTabFocus >= elements.length) {\n newTabFocus = 0;\n }\n } else if (evt.key === 'ArrowLeft') {\n // Move left\n newTabFocus -= 1;\n if (newTabFocus < 0) {\n // If we're at the start, move to the end\n newTabFocus = elements.length - 1;\n }\n }\n const newElement = elements[newTabFocus];\n newElement?.focus();\n if (keepTabIndex) {\n (evt.currentTarget as HTMLElement).setAttribute('tabindex', '-1');\n newElement?.setAttribute('tabindex', '0');\n }\n };\n\n if (elements?.length > 0) {\n elements.forEach((el, key) => {\n // if no element has tabindex set to 0, set the first element as focusable\n if (!initialFocusableElement && key === 0) {\n el.setAttribute('tabindex', '0');\n // set all other to -1\n } else if (initialFocusableElement !== el) {\n el.setAttribute('tabindex', '-1');\n }\n // add event listener\n el.addEventListener('keydown', handleKeyDown(key) as EventListener);\n });\n }\n\n // Cleanup listeners\n return () => {\n if (elements?.length > 0) {\n elements.forEach((el, key) => {\n el.removeEventListener('keydown', handleKeyDown(key) as EventListener);\n });\n }\n };\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [parentRef, ...extraDependencies],\n );\n};\n"],"names":["INIT_STATE","isLazy","shouldActivateOnFocus","activeTabIndex","ids","tab","tabPanel","reducer","state","action","type","payload","id","index","indexOf","tabIds","splice","tabPanelIds","TabProviderContext","createContext","useTabProviderContext","originalId","context","useContext","undefined","dispatch","useMemo","uid","useEffect","tabId","tabPanelId","isActive","changeToTab","useCallback","useTabProviderContextState","useRovingTabIndex","parentRef","elementSelector","keepTabIndex","extraDependencies","parent","current","elements","querySelectorAll","initialFocusableElement","querySelector","handleKeyDown","evt","newTabFocus","key","length","newElement","focus","currentTarget","setAttribute","forEach","el","addEventListener","removeEventListener"],"mappings":";;;;IAYaA,UAAiB,GAAG;AAC7BC,EAAAA,MAAM,EAAE,IADqB;AAE7BC,EAAAA,qBAAqB,EAAE,KAFM;AAG7BC,EAAAA,cAAc,EAAE,CAHa;AAI7BC,EAAAA,GAAG,EAAE;AAAEC,IAAAA,GAAG,EAAE,EAAP;AAAWC,IAAAA,QAAQ,EAAE;AAArB;AAJwB;IAapBC,OAAO,GAAG,SAAVA,OAAU,CAACC,KAAD,EAAeC,MAAf,EAAyC;AAC5D,UAAQA,MAAM,CAACC,IAAf;AACI,SAAK,QAAL;AACI,gCAAYF,KAAZ,MAAsBC,MAAM,CAACE,OAA7B;;AACJ,SAAK,mBAAL;AAA0B;AACtB,YAAIH,KAAK,CAACL,cAAN,KAAyBM,MAAM,CAACE,OAApC,EAA6C;AACzC,iBAAOH,KAAP;AACH,SAHqB;;;AAKtB,kCAAYA,KAAZ;AAAmBL,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CAACa,OAAT,CAAiB,UAACC,EAAD,EAAKP,GAAL,EAAa;AAC1B;AACA,YAAI,CAACL,uBAAD,IAA4BK,GAAG,KAAK,CAAxC,EAA2C;AACvCO,UAAAA,EAAE,CAACF,YAAH,CAAgB,UAAhB,EAA4B,GAA5B,EADuC;AAG1C,SAHD,MAGO,IAAIV,uBAAuB,KAAKY,EAAhC,EAAoC;AACvCA,UAAAA,EAAE,CAACF,YAAH,CAAgB,UAAhB,EAA4B,IAA5B;AACH,SAPyB;;;AAS1BE,QAAAA,EAAE,CAACC,gBAAH,CAAoB,SAApB,EAA+BX,aAAa,CAACG,GAAD,CAA5C;AACH,OAVD;AAWH,KAlDC;;;AAqDF,WAAO,YAAM;AACT,UAAI,CAAAP,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAEQ,MAAV,IAAmB,CAAvB,EAA0B;AACtBR,QAAAA,QAAQ,CAACa,OAAT,CAAiB,UAACC,EAAD,EAAKP,GAAL,EAAa;AAC1BO,UAAAA,EAAE,CAACE,mBAAH,CAAuB,SAAvB,EAAkCZ,aAAa,CAACG,GAAD,CAA/C;AACH,SAFD;AAGH;AACJ,KAND;AAOH,GA7DI;AAAA,GA8DJb,SA9DI,4BA8DUG,iBA9DV,GAAT;AAgEH;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface UseFocusWithinOptions {
|
|
2
|
+
/** element to add the focus within to */
|
|
3
|
+
element: HTMLElement | null;
|
|
4
|
+
/** callback to be executed on focus in */
|
|
5
|
+
onFocusIn: (ev: FocusEvent) => void;
|
|
6
|
+
/** callback to be executed on focus out */
|
|
7
|
+
onFocusOut: (ev: FocusEvent) => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Hook that allows to control when there is a focus event within a given element, meaning
|
|
11
|
+
* that any element within the given target will trigger the focus in and focus out events.
|
|
12
|
+
* @param options - UseFocusWithinOptions
|
|
13
|
+
*/
|
|
14
|
+
declare const useFocusWithin: ({ element, onFocusIn, onFocusOut }: UseFocusWithinOptions) => void;
|
|
15
|
+
|
|
16
|
+
export { UseFocusWithinOptions, useFocusWithin };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Hook that allows to control when there is a focus event within a given element, meaning
|
|
5
|
+
* that any element within the given target will trigger the focus in and focus out events.
|
|
6
|
+
* @param options - UseFocusWithinOptions
|
|
7
|
+
*/
|
|
8
|
+
var useFocusWithin = function useFocusWithin(_ref) {
|
|
9
|
+
var element = _ref.element,
|
|
10
|
+
onFocusIn = _ref.onFocusIn,
|
|
11
|
+
onFocusOut = _ref.onFocusOut;
|
|
12
|
+
useEffect(function () {
|
|
13
|
+
if (element) {
|
|
14
|
+
element.addEventListener('focusin', onFocusIn);
|
|
15
|
+
element.addEventListener('focusout', onFocusOut);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return function () {
|
|
19
|
+
if (element) {
|
|
20
|
+
element.removeEventListener('focusin', onFocusIn);
|
|
21
|
+
element.removeEventListener('focusout', onFocusOut);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}, [onFocusIn, element, onFocusOut]);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { useFocusWithin };
|
|
28
|
+
//# sourceMappingURL=useFocusWithin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFocusWithin.js","sources":["../../src/hooks/useFocusWithin.ts"],"sourcesContent":["import { useEffect } from 'react';\n\nexport interface UseFocusWithinOptions {\n /** element to add the focus within to */\n element: HTMLElement | null;\n /** callback to be executed on focus in */\n onFocusIn: (ev: FocusEvent) => void;\n /** callback to be executed on focus out */\n onFocusOut: (ev: FocusEvent) => void;\n}\n\n/**\n * Hook that allows to control when there is a focus event within a given element, meaning\n * that any element within the given target will trigger the focus in and focus out events.\n * @param options - UseFocusWithinOptions\n */\nexport const useFocusWithin = ({ element, onFocusIn, onFocusOut }: UseFocusWithinOptions) => {\n useEffect(() => {\n if (element) {\n element.addEventListener('focusin', onFocusIn);\n\n element.addEventListener('focusout', onFocusOut);\n }\n\n return () => {\n if (element) {\n element.removeEventListener('focusin', onFocusIn);\n\n element.removeEventListener('focusout', onFocusOut);\n }\n };\n }, [onFocusIn, element, onFocusOut]);\n};\n"],"names":["useFocusWithin","element","onFocusIn","onFocusOut","useEffect","addEventListener","removeEventListener"],"mappings":";;AAWA;;;;;IAKaA,cAAc,GAAG,SAAjBA,cAAiB,OAA+D;AAAA,MAA5DC,OAA4D,QAA5DA,OAA4D;AAAA,MAAnDC,SAAmD,QAAnDA,SAAmD;AAAA,MAAxCC,UAAwC,QAAxCA,UAAwC;AACzFC,EAAAA,SAAS,CAAC,YAAM;AACZ,QAAIH,OAAJ,EAAa;AACTA,MAAAA,OAAO,CAACI,gBAAR,CAAyB,SAAzB,EAAoCH,SAApC;AAEAD,MAAAA,OAAO,CAACI,gBAAR,CAAyB,UAAzB,EAAqCF,UAArC;AACH;;AAED,WAAO,YAAM;AACT,UAAIF,OAAJ,EAAa;AACTA,QAAAA,OAAO,CAACK,mBAAR,CAA4B,SAA5B,EAAuCJ,SAAvC;AAEAD,QAAAA,OAAO,CAACK,mBAAR,CAA4B,UAA5B,EAAwCH,UAAxC;AACH;AACJ,KAND;AAOH,GAdQ,EAcN,CAACD,SAAD,EAAYD,OAAZ,EAAqBE,UAArB,CAdM,CAAT;AAeH;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator v5.
|
|
1
|
+
// Generated by dts-bundle-generator v5.9.0
|
|
2
2
|
|
|
3
3
|
/// <reference types="react" />
|
|
4
4
|
|
|
@@ -671,7 +671,7 @@ export interface ChipGroupProps extends GenericProps {
|
|
|
671
671
|
children: ReactNode;
|
|
672
672
|
}
|
|
673
673
|
export declare const ChipGroup: Comp<ChipGroupProps, HTMLDivElement> & {
|
|
674
|
-
useChipGroupNavigation: import("
|
|
674
|
+
useChipGroupNavigation: import("@lumx/react/hooks/useChipGroupNavigation").useChipGroupNavigationType<any>;
|
|
675
675
|
};
|
|
676
676
|
/**
|
|
677
677
|
* Comment block variants.
|
|
@@ -1495,7 +1495,7 @@ export interface ListProps extends GenericProps {
|
|
|
1495
1495
|
onListItemSelected?(key: Key, index: number, evt: SyntheticEvent): void;
|
|
1496
1496
|
}
|
|
1497
1497
|
export declare const List: Comp<ListProps, HTMLUListElement> & {
|
|
1498
|
-
useKeyboardListNavigation: import("
|
|
1498
|
+
useKeyboardListNavigation: import("@lumx/react/hooks/useKeyboardListNavigation").useKeyboardListNavigationType;
|
|
1499
1499
|
};
|
|
1500
1500
|
export declare type ListItemSize = Extract<Size, "tiny" | "regular" | "big" | "huge">;
|
|
1501
1501
|
/**
|
|
@@ -2220,8 +2220,8 @@ export interface SlideshowControlsProps extends GenericProps {
|
|
|
2220
2220
|
playButtonProps?: Pick<IconButtonProps, "label"> & Omit<IconButtonProps, "label" | "onClick" | "icon" | "emphasis" | "color">;
|
|
2221
2221
|
}
|
|
2222
2222
|
export declare const SlideshowControls: Comp<SlideshowControlsProps, HTMLDivElement> & {
|
|
2223
|
-
useSlideshowControls: ({ activeIndex, groupBy, interval, autoPlay, defaultActiveIndex, onChange, itemsCount, id, slidesId, }: import("
|
|
2224
|
-
useSlideshowControlsDefaultOptions: Partial<import("
|
|
2223
|
+
useSlideshowControls: ({ activeIndex, groupBy, interval, autoPlay, defaultActiveIndex, onChange, itemsCount, id, slidesId, }: import("@lumx/react/hooks/useSlideshowControls").UseSlideshowControlsOptions) => import("@lumx/react/hooks/useSlideshowControls").UseSlideshowControls;
|
|
2224
|
+
useSlideshowControlsDefaultOptions: Partial<import("@lumx/react/hooks/useSlideshowControls").UseSlideshowControlsOptions>;
|
|
2225
2225
|
};
|
|
2226
2226
|
export interface SlidesProps extends GenericProps {
|
|
2227
2227
|
/** current slide active */
|
|
@@ -2547,7 +2547,6 @@ export interface TextFieldProps extends GenericProps {
|
|
|
2547
2547
|
* @return React element.
|
|
2548
2548
|
*/
|
|
2549
2549
|
export declare const TextField: Comp<TextFieldProps, HTMLDivElement>;
|
|
2550
|
-
export declare const useFocusPointStyle: ({ image, aspectRatio, focusPoint, imgProps: { width, height } }: ThumbnailProps, element: HTMLImageElement | undefined, isLoaded: boolean) => CSSProperties;
|
|
2551
2550
|
/**
|
|
2552
2551
|
* Defines the props of the component.
|
|
2553
2552
|
*/
|
package/index.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import './esm/_internal/_rolluppluginbabelhelpers.53.js';
|
|
2
|
+
export { Alignment, AspectRatio, ColorPalette, ColorVariant, Emphasis, Kind, Orientation, Size, Theme, Typography, TypographyInterface, TypographyTitleCustom } from './esm/_internal/components.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import './esm/_internal/getrootclassname.54.js';
|
|
5
|
+
export { I as Icon } from './esm/_internal/icon.21.js';
|
|
6
|
+
import './esm/_internal/index.55.js';
|
|
7
|
+
import 'lodash/isBoolean';
|
|
8
|
+
import 'lodash/isEmpty';
|
|
9
|
+
import 'lodash/kebabCase';
|
|
10
|
+
import 'lodash/noop';
|
|
11
|
+
import './esm/_internal/constants.59.js';
|
|
12
|
+
import 'lodash/concat';
|
|
13
|
+
import 'lodash/dropRight';
|
|
14
|
+
import 'lodash/last';
|
|
15
|
+
import 'lodash/partition';
|
|
16
|
+
import 'lodash/reduce';
|
|
17
|
+
import './esm/_internal/partitionmulti.62.js';
|
|
18
|
+
import 'lodash/get';
|
|
19
|
+
import './esm/_internal/type.64.js';
|
|
20
|
+
export { A as AlertDialog } from './esm/_internal/alertdialog.1.js';
|
|
21
|
+
export { P as Placement, a as Popover } from './esm/_internal/popover.33.js';
|
|
22
|
+
import './esm/_internal/mergerefs.56.js';
|
|
23
|
+
export { A as Autocomplete, a as AutocompleteMultiple } from './esm/_internal/autocompletemultiple.2.js';
|
|
24
|
+
export { A as Avatar } from './esm/_internal/avatar.3.js';
|
|
25
|
+
export { B as Badge } from './esm/_internal/badge.4.js';
|
|
26
|
+
import './esm/_internal/renderlink.65.js';
|
|
27
|
+
import './esm/_internal/buttonroot.57.js';
|
|
28
|
+
export { a as Button, B as ButtonEmphasis } from './esm/_internal/button.5.js';
|
|
29
|
+
export { I as IconButton } from './esm/_internal/iconbutton.6.js';
|
|
30
|
+
export { B as ButtonGroup } from './esm/_internal/buttongroup.7.js';
|
|
31
|
+
export { C as Checkbox } from './esm/_internal/checkbox.8.js';
|
|
32
|
+
import 'lodash/isFunction';
|
|
33
|
+
export { C as Chip } from './esm/_internal/chip.9.js';
|
|
34
|
+
export { C as ChipGroup } from './esm/_internal/chipgroup.10.js';
|
|
35
|
+
export { a as CommentBlock, C as CommentBlockVariant } from './esm/_internal/commentblock.11.js';
|
|
36
|
+
import 'moment';
|
|
37
|
+
export { D as DatePicker, a as DatePickerControlled, b as DatePickerField } from './esm/_internal/datepickerfield.12.js';
|
|
38
|
+
import 'lodash/range';
|
|
39
|
+
import 'moment-range';
|
|
40
|
+
import './esm/_internal/usefocustrap.58.js';
|
|
41
|
+
import 'react-dom';
|
|
42
|
+
import './esm/_internal/clickawayprovider.60.js';
|
|
43
|
+
export { D as Dialog } from './esm/_internal/dialog.13.js';
|
|
44
|
+
import 'lodash/pull';
|
|
45
|
+
import './esm/_internal/usedelayedvisibility.63.js';
|
|
46
|
+
import './esm/_internal/usedisablebodyscroll.61.js';
|
|
47
|
+
export { D as DEFAULT_PROPS, a as Divider } from './esm/_internal/divider.14.js';
|
|
48
|
+
export { D as DragHandle } from './esm/_internal/draghandle.15.js';
|
|
49
|
+
export { L as List, a as ListItem, i as isClickable } from './esm/_internal/list.28.js';
|
|
50
|
+
import './hooks/useFocusWithin.js';
|
|
51
|
+
export { D as Dropdown } from './esm/_internal/dropdown.16.js';
|
|
52
|
+
export { E as ExpansionPanel } from './esm/_internal/expansionpanel.17.js';
|
|
53
|
+
export { F as Flag } from './esm/_internal/flag.18.js';
|
|
54
|
+
import 'lodash/castArray';
|
|
55
|
+
export { F as FlexBox } from './esm/_internal/flexbox.19.js';
|
|
56
|
+
export { G as Grid, a as GridItem } from './esm/_internal/griditem.20.js';
|
|
57
|
+
import 'lodash/isObject';
|
|
58
|
+
export { a as ImageBlock, I as ImageBlockCaptionPosition } from './esm/_internal/imageblock.22.js';
|
|
59
|
+
export { I as InputHelper } from './esm/_internal/inputhelper.23.js';
|
|
60
|
+
export { I as InputLabel } from './esm/_internal/inputlabel.24.js';
|
|
61
|
+
export { L as Lightbox } from './esm/_internal/lightbox.25.js';
|
|
62
|
+
export { L as Link } from './esm/_internal/link.26.js';
|
|
63
|
+
export { L as LinkPreview } from './esm/_internal/linkpreview.27.js';
|
|
64
|
+
export { L as ListDivider, a as ListSubheader } from './esm/_internal/listsubheader.29.js';
|
|
65
|
+
export { M as Message } from './esm/_internal/message.30.js';
|
|
66
|
+
import 'lodash/take';
|
|
67
|
+
export { M as Mosaic } from './esm/_internal/mosaic.31.js';
|
|
68
|
+
export { N as Notification } from './esm/_internal/notification.32.js';
|
|
69
|
+
export { P as PostBlock } from './esm/_internal/postblock.34.js';
|
|
70
|
+
export { a as Progress, P as ProgressVariant } from './esm/_internal/progress.35.js';
|
|
71
|
+
import './esm/_internal/userovingtabindex.66.js';
|
|
72
|
+
export { a as ProgressTracker, P as ProgressTrackerProvider, b as ProgressTrackerStep, c as ProgressTrackerStepPanel } from './esm/_internal/progresstrackersteppanel.36.js';
|
|
73
|
+
export { R as RadioButton, a as RadioGroup } from './esm/_internal/radiogroup.37.js';
|
|
74
|
+
export { a as Select, c as SelectMultiple, b as SelectMultipleField, S as SelectVariant } from './esm/_internal/selectmultiple.38.js';
|
|
75
|
+
export { S as SideNavigation, a as SideNavigationItem } from './esm/_internal/sidenavigationitem.39.js';
|
|
76
|
+
export { S as SkeletonCircle, b as SkeletonRectangle, a as SkeletonRectangleVariant, c as SkeletonTypography } from './esm/_internal/skeletontypography.40.js';
|
|
77
|
+
export { S as Slider, c as clamp } from './esm/_internal/slider.41.js';
|
|
78
|
+
export { c as Slides, S as Slideshow, b as SlideshowControls, a as SlideshowItem } from './esm/_internal/slides.42.js';
|
|
79
|
+
import 'lodash/uniqueId';
|
|
80
|
+
export { S as Switch } from './esm/_internal/switch.43.js';
|
|
81
|
+
export { T as Table, a as TableBody, d as TableCell, c as TableCellVariant, e as TableHeader, f as TableRow, b as ThOrder } from './esm/_internal/tablerow.44.js';
|
|
82
|
+
export { c as Tab, b as TabList, a as TabListLayout, d as TabPanel, T as TabProvider } from './esm/_internal/tabpanel.45.js';
|
|
83
|
+
export { T as TextField } from './esm/_internal/textfield.46.js';
|
|
84
|
+
export { T as Thumbnail } from './esm/_internal/thumbnail.47.js';
|
|
85
|
+
export { T as ThumbnailAspectRatio, a as ThumbnailVariant } from './esm/_internal/types.48.js';
|
|
86
|
+
export { T as Toolbar } from './esm/_internal/toolbar.49.js';
|
|
87
|
+
export { T as Tooltip } from './esm/_internal/tooltip.50.js';
|
|
88
|
+
export { a as Uploader, U as UploaderVariant } from './esm/_internal/uploader.51.js';
|
|
89
|
+
export { U as UserBlock } from './esm/_internal/userblock.52.js';
|
|
90
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@juggle/resize-observer": "^3.2.0",
|
|
10
|
-
"@lumx/core": "^2.2.
|
|
11
|
-
"@lumx/icons": "^2.2.
|
|
10
|
+
"@lumx/core": "^2.2.18-alpha-hooks.1",
|
|
11
|
+
"@lumx/icons": "^2.2.18-alpha-hooks.1",
|
|
12
12
|
"@popperjs/core": "^2.5.4",
|
|
13
13
|
"body-scroll-lock": "^3.1.5",
|
|
14
14
|
"classnames": "^2.2.6",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"rollup-plugin-babel": "^4.4.0",
|
|
68
68
|
"rollup-plugin-cleaner": "^1.0.0",
|
|
69
69
|
"rollup-plugin-copy": "^3.3.0",
|
|
70
|
+
"rollup-plugin-dts": "^4.1.0",
|
|
70
71
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
71
72
|
"rollup-plugin-ts-paths-resolve": "^1.3.0",
|
|
72
73
|
"rollup-plugin-typescript-paths": "^1.2.2",
|
|
@@ -98,10 +99,12 @@
|
|
|
98
99
|
"React"
|
|
99
100
|
],
|
|
100
101
|
"license": "MIT",
|
|
101
|
-
"
|
|
102
|
-
"main": "esm/index.js",
|
|
103
|
-
"types": "types.d.ts",
|
|
102
|
+
"type": "module",
|
|
104
103
|
"name": "@lumx/react",
|
|
104
|
+
"exports": {
|
|
105
|
+
".": "./index.js",
|
|
106
|
+
"./hooks/*": "./hooks/*.js"
|
|
107
|
+
},
|
|
105
108
|
"publishConfig": {
|
|
106
109
|
"directory": "dist"
|
|
107
110
|
},
|
|
@@ -111,7 +114,7 @@
|
|
|
111
114
|
},
|
|
112
115
|
"scripts": {
|
|
113
116
|
"build": "rollup -c && yarn generate:types",
|
|
114
|
-
"generate:types": "dts-bundle-generator --no-check --external-types=react --external-imports=moment -o dist/
|
|
117
|
+
"generate:types": "dts-bundle-generator --no-check --external-types=react --external-imports=moment -o dist/index.d.ts src/index.ts",
|
|
115
118
|
"prepare": "install-peers || exit 0",
|
|
116
119
|
"prepublishOnly": "yarn build",
|
|
117
120
|
"test": "jest --config jest/index.js --coverage --notify --passWithNoTests --detectOpenHandles --runInBand",
|
|
@@ -120,6 +123,6 @@
|
|
|
120
123
|
"build:storybook": "cd storybook && ./build"
|
|
121
124
|
},
|
|
122
125
|
"sideEffects": false,
|
|
123
|
-
"version": "2.2.
|
|
124
|
-
"gitHead": "
|
|
126
|
+
"version": "2.2.18-alpha-hooks.1",
|
|
127
|
+
"gitHead": "280df99a48535a25a827bbd48575cd8af836b3fa"
|
|
125
128
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AlertDialog.js","sources":["../../../src/components/alert-dialog/AlertDialog.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport {\n DialogProps,\n Dialog,\n Button,\n Emphasis,\n ColorPalette,\n Icon,\n Size,\n Kind,\n Toolbar,\n ButtonProps,\n} from '@lumx/react';\n\nimport { mdiAlert, mdiAlertCircle, mdiCheckCircle, mdiInformation } from '@lumx/icons/';\nimport { uid } from 'uid';\nimport { Comp, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nexport interface AlertDialogProps extends Omit<DialogProps, 'header' | 'footer'> {\n /** Message variant. */\n kind?: Kind;\n /** Dialog title. */\n title?: string;\n /** Props forwarded to the confirm button */\n confirmProps: ButtonProps & {\n onClick(): void;\n label: string;\n };\n /**\n * Props forwarded to the cancel button.\n * Will not render a cancel button if undefined.\n */\n cancelProps?: ButtonProps & {\n onClick(): void;\n label: string;\n };\n}\n\n/**\n * Associative map from message kind to color and icon.\n */\nconst CONFIG = {\n [Kind.error]: { color: ColorPalette.red, icon: mdiAlert },\n [Kind.info]: { color: ColorPalette.blue, icon: mdiInformation },\n [Kind.success]: { color: ColorPalette.green, icon: mdiCheckCircle },\n [Kind.warning]: { color: ColorPalette.yellow, icon: mdiAlertCircle },\n};\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'AlertDialog';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<DialogProps> = {\n size: Size.tiny,\n kind: Kind.info,\n};\n\n/**\n * AlertDialog component.\n *\n * An alert dialog is a modal dialog that interrupts the user's workflow to\n * communicate an important message and acquire a response.\n *\n * It should not have a complex content.\n * Children of this component should only be strings, paragraphs or links.\n */\nexport const AlertDialog: Comp<AlertDialogProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n id,\n title,\n className,\n cancelProps,\n confirmProps,\n kind,\n size,\n dialogProps,\n children,\n ...forwardedProps\n } = props;\n\n const cancelButtonRef = React.useRef(null);\n const confirmationButtonRef = React.useRef(null);\n const { color, icon } = CONFIG[kind as Kind] || {};\n\n // Define a unique ID to target title and description for aria attributes.\n const uniqueId = React.useMemo(() => id || uid(), [id]);\n const titleId = `${uniqueId}-title`;\n const descriptionId = `${uniqueId}-description`;\n\n // If content is a string, set in a paragraph.\n const DescriptionElement = typeof children === 'string' ? 'p' : 'div';\n\n const { label: confirmLabel, onClick: confirmOnClick, ...forwardedConfirmProps } = confirmProps;\n const { label: cancelLabel, onClick: cancelOnClick, ...forwardedCancelProps } = cancelProps || {};\n\n return (\n <Dialog\n ref={ref}\n focusElement={cancelProps ? cancelButtonRef : confirmationButtonRef}\n size={size}\n dialogProps={{\n id: uniqueId,\n role: 'alertdialog',\n 'aria-labelledby': titleId,\n 'aria-describedby': descriptionId,\n ...dialogProps,\n }}\n className={classNames(\n className,\n handleBasicClasses({\n kind,\n prefix: CLASSNAME,\n }),\n )}\n {...forwardedProps}\n >\n <header>\n <Toolbar\n className=\"lumx-spacing-margin-horizontal\"\n before={<Icon icon={icon} size={Size.s} color={color} />}\n label={\n <h2 id={titleId} className=\"lumx-typography-title\">\n {title}\n </h2>\n }\n />\n </header>\n\n {children && (\n <DescriptionElement\n id={descriptionId}\n className=\"lumx-typography-body2 lumx-spacing-padding-vertical-big lumx-spacing-padding-horizontal-huge\"\n >\n {children}\n </DescriptionElement>\n )}\n\n <footer>\n <Toolbar\n className=\"lumx-spacing-margin-horizontal\"\n after={\n <>\n {cancelProps && (\n <Button\n {...forwardedCancelProps}\n ref={cancelButtonRef}\n emphasis={Emphasis.medium}\n onClick={cancelOnClick}\n >\n {cancelLabel}\n </Button>\n )}\n <Button\n {...forwardedConfirmProps}\n ref={confirmationButtonRef}\n color={color}\n className=\"lumx-spacing-margin-left-regular\"\n onClick={confirmOnClick}\n >\n {confirmLabel}\n </Button>\n </>\n }\n />\n </footer>\n </Dialog>\n );\n});\n\nAlertDialog.displayName = COMPONENT_NAME;\nAlertDialog.className = CLASSNAME;\nAlertDialog.defaultProps = DEFAULT_PROPS;\n"],"names":["CONFIG","Kind","error","color","ColorPalette","red","icon","mdiAlert","info","blue","mdiInformation","success","green","mdiCheckCircle","warning","yellow","mdiAlertCircle","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","size","Size","tiny","kind","AlertDialog","forwardRef","props","ref","id","title","className","cancelProps","confirmProps","dialogProps","children","forwardedProps","cancelButtonRef","React","useRef","confirmationButtonRef","uniqueId","useMemo","uid","titleId","descriptionId","DescriptionElement","confirmLabel","label","confirmOnClick","onClick","forwardedConfirmProps","cancelLabel","cancelOnClick","forwardedCancelProps","role","classNames","handleBasicClasses","prefix","s","Emphasis","medium","displayName","defaultProps"],"mappings":";;;;;;;;;;;;AAyCA;;;AAGA,IAAMA,MAAM,2CACPC,IAAI,CAACC,KADE,EACM;AAAEC,EAAAA,KAAK,EAAEC,YAAY,CAACC,GAAtB;AAA2BC,EAAAA,IAAI,EAAEC;AAAjC,CADN,4BAEPN,IAAI,CAACO,IAFE,EAEK;AAAEL,EAAAA,KAAK,EAAEC,YAAY,CAACK,IAAtB;AAA4BH,EAAAA,IAAI,EAAEI;AAAlC,CAFL,4BAGPT,IAAI,CAACU,OAHE,EAGQ;AAAER,EAAAA,KAAK,EAAEC,YAAY,CAACQ,KAAtB;AAA6BN,EAAAA,IAAI,EAAEO;AAAnC,CAHR,4BAIPZ,IAAI,CAACa,OAJE,EAIQ;AAAEX,EAAAA,KAAK,EAAEC,YAAY,CAACW,MAAtB;AAA8BT,EAAAA,IAAI,EAAEU;AAApC,CAJR,WAAZ;AAOA;;;;A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AAiB,MAAA,SAAS,EAAC;AAA3B,OACKd,KADL;AAJR,IADJ,CApBJ,EAgCKK,QAAQ,IACL,oBAAC,kBAAD;AACI,IAAA,EAAE,EAAEU,aADR;AAEI,IAAA,SAAS,EAAC;AAFd,KAIKV,QAJL,CAjCR,EAyCI,oCACI,oBAAC,OAAD;AACI,IAAA,SAAS,EAAC,gCADd;AAEI,IAAA,KAAK,EACD,0CACKH,WAAW,IACR,oBAAC,MAAD,eACQsB,oBADR;AAEI,MAAA,GAAG,EAAEjB,eAFT;AAGI,MAAA,QAAQ,EAAEuB,QAAQ,CAACC,MAHvB;AAII,MAAA,OAAO,EAAER;AAJb,QAMKD,WANL,CAFR,EAWI,oBAAC,MAAD,eACQD,qBADR;AAEI,MAAA,GAAG,EAAEX,qBAFT;AAGI,MAAA,KAAK,EAAErC,KAHX;AAII,MAAA,SAAS,EAAC,kCAJd;AAKI,MAAA,OAAO,EAAE8C;AALb,QAOKF,YAPL,CAXJ;AAHR,IADJ,CAzCJ,CADJ;AAwEH,CArG4E;AAuG7EtB,WAAW,CAACqC,WAAZ,GAA0B7C,cAA1B;AACAQ,WAAW,CAACM,SAAZ,GAAwBb,SAAxB;AACAO,WAAW,CAACsC,YAAZ,GAA2B3C,aAA3B;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteMultiple.js","sources":["../../../src/components/autocomplete/Autocomplete.tsx","../../../src/components/autocomplete/AutocompleteMultiple.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode, RefObject, SyntheticEvent, useRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Dropdown, IconButtonProps, Offset, Placement, TextField, Theme } from '@lumx/react';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nimport { useFocus } from '@lumx/react/hooks/useFocus';\nimport { mergeRefs } from '@lumx/react/utils/mergeRefs';\n\n/**\n * Defines the props of the component.\n */\nexport interface AutocompleteProps extends GenericProps {\n /**\n * Whether the suggestions list should display anchored to the input or to the wrapper.\n * @see {@link DropdownProps#anchorToInput}\n */\n anchorToInput?: boolean;\n /**\n * Props to pass to the clear button (minus those already set by the TextField props).\n * If not specified, the button won't be displayed.\n * @see {@link TextFieldProps#clearButtonProps}\n */\n clearButtonProps?: Pick<IconButtonProps, 'label'> &\n Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis'>;\n /**\n * Reference to the <input> or <textarea> element.\n * @see {@link TextFieldProps#inputRef}\n */\n inputRef?: RefObject<HTMLInputElement>;\n /**\n * The offset that will be applied to the Dropdown position.\n * @see {@link DropdownProps#offset}\n */\n offset?: Offset;\n /**\n * The preferred Dropdown location against the anchor element.\n * @see {@link DropdownProps#placement}\n */\n placement?: Placement;\n /**\n * Whether the dropdown should fit to the anchor width or not.\n * @see {@link DropdownProps#fitToAnchorWidth}\n */\n fitToAnchorWidth?: boolean;\n /**\n * The error related to the component.\n * @see {@link TextFieldProps#error}\n */\n error?: string | ReactNode;\n /**\n * Whether the text field is displayed with error style or not.\n * @see {@link TextFieldProps#hasError}\n */\n hasError?: boolean;\n /**\n * Whether the text box should be focused upon closing the suggestions or not.\n */\n shouldFocusOnClose?: boolean;\n /**\n * The helper message of the text field.\n * @see {@link TextFieldProps#helper}\n */\n helper?: string;\n /**\n * The icon of the text field (SVG path).\n * @see {@link TextFieldProps#icon}\n */\n icon?: string;\n /**\n * Whether the component is disabled or not.\n * @see {@link TextFieldProps#isDisabled}\n */\n isDisabled?: boolean;\n /**\n * Whether the component is required or not.\n * @see {@link TextFieldProps#isRequired}\n */\n isRequired?: boolean;\n /**\n * Whether the text field is displayed with valid style or not.\n * @see {@link TextFieldProps#isValid}\n */\n isValid?: boolean;\n /**\n * The label of the text field displayed in a label tag.\n * @see {@link TextFieldProps#label}\n */\n label?: string;\n /**\n * The placeholder message of the text field.\n * @see {@link TextFieldProps#placeholder}\n */\n placeholder?: string;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** List of suggestions to display during autocomplete. */\n children: React.ReactNode;\n /**\n * The list of chips to be displayed before the text field input.\n */\n chips?: React.ReactNode;\n /**\n * The value of the text field.\n * @see {@link TextFieldProps#value}\n */\n value: string;\n /**\n * Whether the suggestions from the autocomplete should be displayed or not.\n * @see {@link DropdownProps#isOpen}\n */\n isOpen: boolean;\n /**\n * The native input name property.\n * @see {@link TextFieldProps#name}\n */\n name?: string;\n /**\n * Whether a click in the Autocomplete dropdown would close it or not.\n * @see {@link DropdownProps#closeOnClick}\n */\n closeOnClick?: boolean;\n /**\n * Whether a click anywhere out of the Autocomplete would close it or not.\n * @see {@link DropdownProps#closeOnClickAway}\n */\n closeOnClickAway?: boolean;\n /**\n * Whether an escape key press would close the Autocomplete or not.\n * @see {@link DropdownProps#closeOnEscape}\n */\n closeOnEscape?: boolean;\n /**\n * The function called on blur.\n * @see {@link TextFieldProps#onBlur}\n */\n onBlur?(event: React.FocusEvent): void;\n /**\n * On change callback.\n * @see {@link TextFieldProps#onChange}\n */\n onChange(value: string, name?: string, event?: SyntheticEvent): void;\n /**\n * The function called on close.\n * @see {@link DropdownProps#onClose}\n */\n onClose?(): void;\n /**\n * The function called on focus.\n * @see {@link TextFieldProps#onFocus}\n */\n onFocus?(event: React.FocusEvent): void;\n /**\n * The function called when the bottom of the dropdown is reached.\n * @see {@link DropdownProps#onInfiniteScroll}\n */\n onInfiniteScroll?(): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Autocomplete';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<AutocompleteProps> = {\n anchorToInput: false,\n closeOnClick: false,\n closeOnClickAway: true,\n closeOnEscape: true,\n shouldFocusOnClose: false,\n};\n\n/**\n * Autocomplete component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Autocomplete: Comp<AutocompleteProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n anchorToInput,\n children,\n chips,\n className,\n closeOnClick,\n closeOnClickAway,\n closeOnEscape,\n disabled,\n error,\n fitToAnchorWidth,\n hasError,\n helper,\n icon,\n inputRef,\n clearButtonProps,\n isDisabled = disabled,\n isRequired,\n isOpen,\n isValid,\n label,\n name,\n offset,\n onBlur,\n onChange,\n onClose,\n onFocus,\n onInfiniteScroll,\n placeholder,\n placement,\n shouldFocusOnClose,\n theme,\n value,\n ...forwardedProps\n } = props;\n const inputAnchorRef = useRef<HTMLElement>(null);\n const textFieldRef = useRef(null);\n useFocus(inputAnchorRef.current, !isOpen && shouldFocusOnClose);\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n }),\n )}\n >\n <TextField\n chips={chips}\n error={error}\n hasError={hasError}\n helper={helper}\n icon={icon}\n inputRef={mergeRefs(inputAnchorRef, inputRef) as any}\n clearButtonProps={clearButtonProps}\n isDisabled={isDisabled}\n isRequired={isRequired}\n isValid={isValid}\n label={label}\n name={name}\n onBlur={onBlur}\n onChange={onChange}\n onFocus={onFocus}\n placeholder={placeholder}\n textFieldRef={textFieldRef}\n theme={theme}\n value={value}\n />\n <Dropdown\n anchorRef={anchorToInput ? inputAnchorRef : textFieldRef}\n closeOnClick={closeOnClick}\n closeOnClickAway={closeOnClickAway}\n closeOnEscape={closeOnEscape}\n fitToAnchorWidth={fitToAnchorWidth}\n isOpen={isOpen}\n offset={offset}\n onClose={onClose}\n onInfiniteScroll={onInfiniteScroll}\n placement={placement}\n shouldFocusOnOpen={false}\n theme={theme}\n >\n {children}\n </Dropdown>\n </div>\n );\n});\nAutocomplete.displayName = COMPONENT_NAME;\nAutocomplete.className = CLASSNAME;\nAutocomplete.defaultProps = DEFAULT_PROPS;\n","import { mdiClose } from '@lumx/icons';\nimport { Autocomplete, AutocompleteProps, Chip, HorizontalAlignment, Icon, Size } from '@lumx/react';\n\nimport { Comp, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nimport classNames from 'classnames';\nimport React, { forwardRef, ReactNode } from 'react';\n\n/**\n * Defines the props of the component.\n */\nexport interface AutocompleteMultipleProps extends AutocompleteProps {\n /** Selected values. */\n values: any[];\n /** Alignment of the chips in the autocomplete. */\n chipsAlignment?: HorizontalAlignment;\n /** Selected value render function. Default: Renders the value inside of a Chip. */\n selectedChipRender(\n choice: any,\n index: number,\n onClear?: (event: React.MouseEvent, choice: any) => void,\n isDisabled?: boolean,\n ): ReactNode | string;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'AutocompleteMultiple';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<AutocompleteMultipleProps> = {\n closeOnClickAway: true,\n closeOnEscape: true,\n selectedChipRender(choice, index, onClear, isDisabled) {\n const onClick = (event: React.MouseEvent) => onClear && onClear(event, choice);\n return (\n <Chip\n key={index}\n after={onClear && <Icon icon={mdiClose} size={Size.xxs} />}\n isDisabled={isDisabled}\n size={Size.s}\n onAfterClick={onClick}\n onClick={onClick}\n >\n {choice}\n </Chip>\n );\n },\n values: [],\n};\n\n/**\n * AutocompleteMultiple component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const AutocompleteMultiple: Comp<AutocompleteMultipleProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n anchorToInput,\n children,\n // `chipsAlignment` needs to be here to remove it from `forwardedProps`.\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n chipsAlignment,\n className,\n closeOnClickAway,\n closeOnEscape,\n fitToAnchorWidth,\n hasError,\n helper,\n icon,\n inputRef,\n clearButtonProps,\n isDisabled,\n isRequired,\n isOpen,\n isValid,\n label,\n name,\n offset,\n onBlur,\n onChange,\n onClear,\n onClose,\n onFocus,\n onInfiniteScroll,\n onKeyDown,\n placeholder,\n placement,\n selectedChipRender,\n shouldFocusOnClose,\n theme,\n type,\n value,\n values,\n ...forwardedProps\n } = props;\n\n return (\n <Autocomplete\n ref={ref}\n {...forwardedProps}\n anchorToInput={anchorToInput}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n }),\n )}\n name={name}\n value={value}\n onChange={onChange}\n onKeyDown={onKeyDown}\n onBlur={onBlur}\n shouldFocusOnClose={shouldFocusOnClose}\n onFocus={onFocus}\n hasError={hasError}\n helper={helper}\n icon={icon}\n inputRef={inputRef}\n chips={values && values.map((chip: any, index: number) => selectedChipRender(chip, index, onClear))}\n isDisabled={isDisabled}\n isRequired={isRequired}\n clearButtonProps={clearButtonProps}\n isValid={isValid}\n label={label}\n placeholder={placeholder}\n theme={theme}\n type={type}\n isOpen={isOpen}\n closeOnClick={false}\n closeOnClickAway={closeOnClickAway}\n closeOnEscape={closeOnEscape}\n onClose={onClose}\n offset={offset}\n placement={placement}\n fitToAnchorWidth={fitToAnchorWidth}\n onInfiniteScroll={onInfiniteScroll}\n >\n {children}\n </Autocomplete>\n );\n});\nAutocompleteMultiple.displayName = COMPONENT_NAME;\nAutocompleteMultiple.className = CLASSNAME;\nAutocompleteMultiple.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","anchorToInput","closeOnClick","closeOnClickAway","closeOnEscape","shouldFocusOnClose","Autocomplete","forwardRef","props","ref","children","chips","className","disabled","error","fitToAnchorWidth","hasError","helper","icon","inputRef","clearButtonProps","isDisabled","isRequired","isOpen","isValid","label","name","offset","onBlur","onChange","onClose","onFocus","onInfiniteScroll","placeholder","placement","theme","value","forwardedProps","inputAnchorRef","useRef","textFieldRef","useFocus","current","classNames","handleBasicClasses","prefix","mergeRefs","displayName","defaultProps","selectedChipRender","choice","index","onClear","onClick","event","mdiClose","Size","xxs","s","values","AutocompleteMultiple","chipsAlignment","onKeyDown","type","map","chip"],"mappings":";;;;;;;;;;;AAWA;;;;AAsJA;;;AAGA,IAAMA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
|
|
1
|
-
{"version":3,"file":"Avatar2.js","sources":["../../../src/components/avatar/Avatar.tsx"],"sourcesContent":["import React, { forwardRef, KeyboardEventHandler, MouseEventHandler, ReactElement, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AspectRatio, Size, Theme, Thumbnail, ThumbnailProps } from '@lumx/react';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\n/**\n * Avatar sizes.\n */\nexport type AvatarSize = Extract<Size, 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface AvatarProps extends GenericProps {\n /** Action toolbar content. */\n actions?: ReactNode;\n /** Image alternative text. */\n alt: string;\n /** Badge. */\n badge?: ReactElement;\n /** Image URL. */\n image: string;\n /** Props to pass to the link wrapping the thumbnail. */\n linkProps?: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;\n /** Custom react component for the link (can be used to inject react router Link). */\n linkAs?: 'a' | any;\n /** On click callback. */\n onClick?: MouseEventHandler<HTMLDivElement>;\n /** On key press callback. */\n onKeyPress?: KeyboardEventHandler<HTMLDivElement>;\n /** Size variant. */\n size?: AvatarSize;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Props to pass to the thumbnail (minus those already set by the Avatar props). */\n thumbnailProps?: Omit<\n ThumbnailProps,\n 'image' | 'alt' | 'size' | 'theme' | 'align' | 'fillHeight' | 'variant' | 'aspectRatio'\n >;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Avatar';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<AvatarProps> = {\n size: Size.m,\n theme: Theme.light,\n};\n\n/**\n * Avatar component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Avatar: Comp<AvatarProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n actions,\n alt,\n badge,\n className,\n image,\n linkProps,\n linkAs,\n onClick,\n onKeyPress,\n size,\n theme,\n thumbnailProps,\n ...forwardedProps\n } = props;\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, size, theme }))}\n >\n <Thumbnail\n linkProps={linkProps}\n linkAs={linkAs}\n className={`${CLASSNAME}__thumbnail`}\n onClick={onClick}\n onKeyPress={onKeyPress}\n {...thumbnailProps}\n aspectRatio={AspectRatio.square}\n size={size}\n image={image}\n alt={alt}\n theme={theme}\n />\n {actions && <div className={`${CLASSNAME}__actions`}>{actions}</div>}\n {badge && <div className={`${CLASSNAME}__badge`}>{badge}</div>}\n </div>\n );\n});\nAvatar.displayName = COMPONENT_NAME;\nAvatar.className = CLASSNAME;\nAvatar.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","size","Size","m","theme","Theme","light","Avatar","forwardRef","props","ref","actions","alt","badge","className","image","linkProps","linkAs","onClick","onKeyPress","thumbnailProps","forwardedProps","classNames","handleBasicClasses","prefix","AspectRatio","square","displayName","defaultProps"],"mappings":";;;;;;AAQA;;;;AAoCA;;;AAGA,IAAMA,cAAc,GAAG,QAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAmC,GAAG;AACxCC,EAAAA,IAAI,EAAEC,IAAI,CAACC,CAD6B;AAExCC,EAAAA,KAAK,EAAEC,KAAK,CAACC;AAF2B,CAA5C;AAKA;;;;;;;;IAOaC,MAAyC,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAE5EC,OAF4E,GAe5EF,KAf4E,CAE5EE,OAF4E;AAAA,MAG5EC,GAH4E,GAe5EH,KAf4E,CAG5EG,GAH4E;AAAA,MAI5EC,KAJ4E,GAe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ca,OAA1C,CAlBhB,EAmBKE,KAAK,IAAI;AAAK,IAAA,SAAS,YAAKf,SAAL;AAAd,KAAwCe,KAAxC,CAnBd,CADJ;AAuBH,CAxCkE;AAyCnEN,MAAM,CAACoB,WAAP,GAAqB9B,cAArB;AACAU,MAAM,CAACO,SAAP,GAAmBhB,SAAnB;AACAS,MAAM,CAACqB,YAAP,GAAsB5B,aAAtB;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Badge2.js","sources":["../../../src/components/badge/Badge.tsx"],"sourcesContent":["import { Color, ColorPalette } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\nimport classNames from 'classnames';\nimport React, { forwardRef, ReactNode } from 'react';\n\n/**\n * Defines the props of the component.\n */\nexport interface BadgeProps extends GenericProps {\n /** Badge content. */\n children?: ReactNode;\n /** Color variant. */\n color?: Color;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Badge';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<BadgeProps> = {\n color: ColorPalette.primary,\n};\n\n/**\n * Badge component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Badge: Comp<BadgeProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { children, className, color, ...forwardedProps } = props;\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, color }))}\n >\n {children}\n </div>\n );\n});\nBadge.displayName = COMPONENT_NAME;\nBadge.className = CLASSNAME;\nBadge.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","color","ColorPalette","primary","Badge","forwardRef","props","ref","children","className","forwardedProps","classNames","handleBasicClasses","prefix","displayName","defaultProps"],"mappings":";;;;;AAKA;;;;AAUA;;;AAGA,IAAMA,cAAc,GAAG,OAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAkC,GAAG;AACvCC,EAAAA,KAAK,EAAEC,YAAY,CAACC;AADmB,CAA3C;AAIA;;;;;;;;IAOaC,KAAuC,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MACtEC,QADsE,GACpBF,KADoB,CACtEE,QADsE;AAAA,MAC5DC,SAD4D,GACpBH,KADoB,CAC5DG,SAD4D;AAAA,MACjDR,KADiD,GACpBK,KADoB,CACjDL,KADiD;AAAA,MACvCS,cADuC,4BACpBJ,KADoB;;AAE9E,SACI;AACI,IAAA,GAAG,EAAEC;AADT,KAEQG,cAFR;AAGI,IAAA,SAAS,EAAEC,UAAU,CAACF,SAAD,EAAYG,kBAAkB,CAAC;AAAEC,MAAAA,MAAM,EAAEf,SAAV;AAAqBG,MAAAA,KAAK,EAALA;AAArB,KAAD,CAA9B;AAHzB,MAKKO,QALL,CADJ;AASH,CAXgE;AAYjEJ,KAAK,CAACU,WAAN,GAAoBjB,cAApB;AACAO,KAAK,CAACK,SAAN,GAAkBX,SAAlB;AACAM,KAAK,CAACW,YAAN,GAAqBf,aAArB;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Button2.js","sources":["../../../src/components/button/Button.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode } from 'react';\n\nimport classNames from 'classnames';\nimport isEmpty from 'lodash/isEmpty';\n\nimport { Emphasis, Icon, Size, Theme } from '@lumx/react';\nimport { Comp, getBasicClass, getRootClassName } from '@lumx/react/utils';\nimport { BaseButtonProps, ButtonRoot } from './ButtonRoot';\n\n/**\n * Button emphasis definition.\n * @deprecated Use Emphasis instead.\n */\nexport const ButtonEmphasis = Emphasis;\n\n/**\n * Defines the props of the component.\n */\nexport interface ButtonProps extends BaseButtonProps {\n /** Button content. */\n children?: ReactNode;\n /** Left icon (SVG path). */\n leftIcon?: string;\n /** Right icon (SVG path). */\n rightIcon?: string;\n /** When `true`, the button gets as large as possible. */\n fullWidth?: boolean;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Button';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<ButtonProps> = {\n emphasis: Emphasis.high,\n size: Size.m,\n theme: Theme.light,\n};\n\n/**\n * Button component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Button: Comp<ButtonProps, HTMLButtonElement | HTMLAnchorElement> = forwardRef((props, ref) => {\n const { children, className, emphasis, leftIcon, rightIcon, size, theme, ...forwardedProps } = props;\n\n const buttonClassName = classNames(\n className,\n getBasicClass({ prefix: CLASSNAME, type: 'hasLeftIcon', value: !isEmpty(leftIcon) }),\n getBasicClass({ prefix: CLASSNAME, type: 'hasRightIcon', value: !isEmpty(rightIcon) }),\n );\n\n return (\n <ButtonRoot\n ref={ref}\n {...{ emphasis, size, theme, ...forwardedProps }}\n className={buttonClassName}\n variant=\"button\"\n >\n {leftIcon && !isEmpty(leftIcon) && <Icon icon={leftIcon} />}\n {children && <span>{children}</span>}\n {rightIcon && !isEmpty(rightIcon) && <Icon icon={rightIcon} />}\n </ButtonRoot>\n );\n});\nButton.displayName = COMPONENT_NAME;\nButton.className = CLASSNAME;\nButton.defaultProps = DEFAULT_PROPS;\n"],"names":["ButtonEmphasis","Emphasis","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","emphasis","high","size","Size","m","theme","Theme","light","Button","forwardRef","props","ref","children","className","leftIcon","rightIcon","forwardedProps","buttonClassName","classNames","getBasicClass","prefix","type","value","isEmpty","displayName","defaultProps"],"mappings":";;;;;;;;AASA;;;;;IAIaA,cAAc,GAAGC;AAE9B;;;;AAcA;;;AAGA,IAAMC,cAAc,GAAG,Q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,EAALA;AAF1B,KAEoCW,cAFpC;AAGI,IAAA,SAAS,EAAEC,eAHf;AAII,IAAA,OAAO,EAAC;AAJZ,MAMKH,QAAQ,IAAI,CAACS,OAAO,CAACT,QAAD,CAApB,IAAkC,oBAAC,IAAD;AAAM,IAAA,IAAI,EAAEA;AAAZ,IANvC,EAOKF,QAAQ,IAAI,kCAAOA,QAAP,CAPjB,EAQKG,SAAS,IAAI,CAACQ,OAAO,CAACR,SAAD,CAArB,IAAoC,oBAAC,IAAD;AAAM,IAAA,IAAI,EAAEA;AAAZ,IARzC,CADJ;AAYH,CArByF;AAsB1FP,MAAM,CAACgB,WAAP,GAAqB5B,cAArB;AACAY,MAAM,CAACK,SAAP,GAAmBhB,SAAnB;AACAW,MAAM,CAACiB,YAAP,GAAsB1B,aAAtB;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonGroup.js","sources":["../../../src/components/button/ButtonGroup.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Comp, GenericProps, getRootClassName } from '@lumx/react/utils';\n\n/**\n * Defines the props of the component\n */\nexport type ButtonGroupProps = GenericProps;\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ButtonGroup';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<ButtonGroupProps> = {};\n\n/**\n * ButtonGroup component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const ButtonGroup: Comp<ButtonGroupProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { children, className, ...forwardedProps } = props;\n\n return (\n <div ref={ref} {...forwardedProps} className={classNames(className, CLASSNAME)}>\n {children}\n </div>\n );\n});\nButtonGroup.displayName = COMPONENT_NAME;\nButtonGroup.className = CLASSNAME;\nButtonGroup.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","ButtonGroup","forwardRef","props","ref","children","className","forwardedProps","classNames","displayName","defaultProps"],"mappings":";;;;;;;;AAMA;;;;AAKA;;;AAGA,IAAMA,cAAc,GAAG,aAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAwC,GAAG,EAAjD;AAEA;;;;;;;;IAOaC,WAAmD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAClFC,QADkF,GACvCF,KADuC,CAClFE,QADkF;AAAA,MACxEC,SADwE,GACvCH,KADuC,CACxEG,SADwE;AAAA,MAC1DC,cAD0D,4BACvCJ,KADuC;;AAG1F,SACI;AAAK,IAAA,GAAG,EAAEC;AAAV,KAAmBG,cAAnB;AAAmC,IAAA,SAAS,EAAEC,UAAU,CAACF,SAAD,EAAYR,SAAZ;AAAxD,MACKO,QADL,CADJ;AAKH,CAR4E;AAS7EJ,WAAW,CAACQ,WAAZ,GAA0BZ,cAA1B;AACAI,WAAW,CAACK,SAAZ,GAAwBR,SAAxB;AACAG,WAAW,CAACS,YAAZ,GAA2BV,aAA3B;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonRoot.js","sources":["../../../src/components/button/ButtonRoot.tsx"],"sourcesContent":["import React, { ButtonHTMLAttributes, DetailedHTMLProps, forwardRef, RefObject } from 'react';\n\nimport isEmpty from 'lodash/isEmpty';\n\nimport classNames from 'classnames';\n\nimport { Color, ColorPalette, Emphasis, Size, Theme } from '@lumx/react';\nimport { CSS_PREFIX } from '@lumx/react/constants';\nimport { Comp, GenericProps, handleBasicClasses } from '@lumx/react/utils';\nimport { renderLink } from '@lumx/react/utils/renderLink';\n\ntype HTMLButtonProps = DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;\n\n/**\n * Button size definition.\n */\nexport type ButtonSize = Extract<Size, 's' | 'm'>;\n\nexport interface BaseButtonProps extends GenericProps {\n /** ARIA button label. */\n ['aria-label']?: string;\n /** Color variant. */\n color?: Color;\n /** Emphasis variant. */\n emphasis?: Emphasis;\n /** Whether or not the button has a background color in low emphasis. */\n hasBackground?: boolean;\n /** Native anchor href property. It determines whether the Button will be a <button> or an <a>. */\n href?: string;\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Whether the component is selected or not. */\n isSelected?: boolean;\n /** Native button name property. */\n name?: string;\n /** Size variant. */\n size?: ButtonSize;\n /** Native anchor target property. */\n target?: '_self' | '_blank' | '_parent' | '_top';\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Native button type. */\n type?: HTMLButtonProps['type'];\n /** Custom react component for the link (can be used to inject react router Link). */\n linkAs?: 'a' | any;\n}\n\nexport interface ButtonRootProps extends BaseButtonProps {\n variant: 'button' | 'icon';\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ButtonRoot';\n\nexport const BUTTON_WRAPPER_CLASSNAME = `${CSS_PREFIX}-button-wrapper`;\nexport const BUTTON_CLASSNAME = `${CSS_PREFIX}-button`;\n\n/**\n * Render a button wrapper with the ButtonRoot inside.\n *\n * @param props Component props.\n * @return React element.\n */\nconst renderButtonWrapper: React.FC<ButtonRootProps> = (props) => {\n const { color, emphasis, variant, fullWidth } = props;\n\n const adaptedColor =\n emphasis === Emphasis.low && (color === ColorPalette.light ? ColorPalette.dark : ColorPalette.light);\n\n const wrapperClassName = classNames(\n handleBasicClasses({\n color: adaptedColor,\n prefix: BUTTON_WRAPPER_CLASSNAME,\n variant,\n fullWidth,\n }),\n );\n const buttonProps = { ...props, hasBackground: false };\n\n return (\n <div className={wrapperClassName}>\n {/* eslint-disable-next-line @typescript-eslint/no-use-before-define */}\n <ButtonRoot {...buttonProps} />\n </div>\n );\n};\n\n/**\n * ButtonRoot component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const ButtonRoot: Comp<ButtonRootProps, HTMLButtonElement | HTMLAnchorElement> = forwardRef((props, ref) => {\n const {\n 'aria-label': ariaLabel,\n children,\n className,\n color,\n disabled,\n emphasis,\n hasBackground,\n href,\n isDisabled = disabled,\n isSelected,\n isActive,\n isFocused,\n isHovered,\n linkAs,\n name,\n size,\n target,\n theme,\n variant,\n type = 'button',\n fullWidth,\n ...forwardedProps\n } = props;\n\n const adaptedColor =\n color ||\n (emphasis !== Emphasis.high && theme === Theme.dark && ColorPalette.light) ||\n (emphasis === Emphasis.high && ColorPalette.primary) ||\n ColorPalette.dark;\n\n if (hasBackground) {\n return renderButtonWrapper({ ...props, ref, variant, color: adaptedColor });\n }\n\n const buttonClassName = classNames(\n className,\n handleBasicClasses({\n color: adaptedColor,\n emphasis,\n isSelected,\n isDisabled,\n isActive,\n isFocused,\n isHovered,\n prefix: BUTTON_CLASSNAME,\n size,\n theme: emphasis === Emphasis.high && theme,\n variant,\n fullWidth,\n }),\n );\n\n /**\n * If the linkAs prop is used, we use the linkAs component instead of a <button>.\n * If there is an href attribute, we display an <a> instead of a <button>.\n *\n * However, in any case, if the component is disabled, we returned a <button> since disabled is not compatible with <a>.\n */\n if ((linkAs || !isEmpty(props.href)) && !isDisabled) {\n return renderLink(\n {\n linkAs,\n ...forwardedProps,\n 'aria-label': ariaLabel,\n href,\n target,\n className: buttonClassName,\n ref: ref as RefObject<HTMLAnchorElement>,\n },\n children,\n );\n }\n return (\n <button\n {...forwardedProps}\n disabled={isDisabled}\n aria-disabled={isDisabled}\n aria-label={ariaLabel}\n ref={ref as RefObject<HTMLButtonElement>}\n className={buttonClassName}\n name={name}\n type={\n // eslint-disable-next-line react/button-has-type\n type\n }\n >\n {children}\n </button>\n );\n});\nButtonRoot.displayName = COMPONENT_NAME;\nButtonRoot.defaultProps = {};\n"],"names":["COMPONENT_NAME","BUTTON_WRAPPER_CLASSNAME","CSS_PREFIX","BUTTON_CLASSNAME","renderButtonWrapper","props","color","emphasis","variant","fullWidth","adaptedColor","Emphasis","low","ColorPalette","light","dark","wrapperClassName","classNames","handleBasicClasses","prefix","buttonProps","hasBackground","ButtonRoot","forwardRef","ref","ariaLabel","children","className","disabled","href","isDisabled","isSelected","isActive","isFocused","isHovered","linkAs","name","size","target","theme","type","forwardedProps","high","Theme","primary","buttonClassName","isEmpty","renderLink","displayName","defaultProps"],"mappings":";;;;;;;AAmDA;;;AAGA,IAAMA,cAAc,GAAG,YAAvB;AAEO,IAAMC,wBAAwB,aAAMC,UAAN,oBAA9B;AACA,IAAMC,gBAAgB,aAAMD,UAAN,YAAtB;AAEP;;;;;;;AAMA,IAAME,mBAA8C,GAAG,SAAjDA,mBAAiD,CAACC,KAAD,EAAW;AAAA,MACtDC,KADsD,GACdD,KADc,CACtDC,KADsD;AAAA,MAC/CC,QAD+C,GACdF,KADc,CAC/CE,QAD+C;AAAA,MACrCC,OADqC,GACdH,KADc,CACrCG,OADqC;AAAA,MAC5BC,SAD4B,GACdJ,KADc,CAC5BI,SAD4B;AAG9D,MAAMC,YAAY,GACdH,QAAQ,KAAKI,QAAQ,CAACC,GAAtB,KAA8BN,KAAK,KAAKO,YAAY,CAACC,KAAvB,GAA+BD,YAAY,CAACE,IAA5C,GAAmDF,YAAY,CAACC,KAA9F,CADJ;AAGA,MAAME,gBAAgB,GAAGC,UAAU,CAC/BC,kBAAkB,CAAC;AACfZ,IAAAA,KAAK,EAAEI,YADQ;AAEfS,IAAAA,MAAM,EAAElB,wBAFO;AAGfO,IAAAA,OAAO,EAAPA,OAHe;AAIfC,IAAAA,SAAS,EAATA;AAJe,GAAD,CADa,CAAnC;;AAQA,MAAMW,WAAW,sBAAQf,KAAR;AAAegB,IAAAA,aAAa,EAAE;AAA9B,IAAjB;;AAEA,SACI;AAAK,IAAA,SAAS,EAAEL;AAAhB,KAEI,oBAAC,UAAD,EAAgBI,WAAhB,CAFJ,CADJ;AAMH,CAtBD;AAwBA;;;;;;;;;IAOaE,UAAwE,GAAGC,UAAU,CAAC,UAACl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D;AACjD,WAAOiB,UAAU;AAETZ,MAAAA,MAAM,EAANA;AAFS,OAGNM,cAHM;AAIT,oBAAchB,SAJL;AAKTI,MAAAA,IAAI,EAAJA,IALS;AAMTS,MAAAA,MAAM,EAANA,MANS;AAOTX,MAAAA,SAAS,EAAEkB,eAPF;AAQTrB,MAAAA,GAAG,EAAEA;AARI,QAUbE,QAVa,CAAjB;AAYH;;AACD,SACI,2CACQe,cADR;AAEI,IAAA,QAAQ,EAAEX,UAFd;AAGI,qBAAeA,UAHnB;AAII,kBAAYL,SAJhB;AAKI,IAAA,GAAG,EAAED,GALT;AAMI,IAAA,SAAS,EAAEqB,eANf;AAOI,IAAA,IAAI,EAAET,IAPV;AAQI,IAAA,IAAI;AAEAI,IAAAA;AAVR,MAaKd,QAbL,CADJ;AAiBH,CA3FiG;AA4FlGJ,UAAU,CAAC0B,WAAX,GAAyBhD,cAAzB;AACAsB,UAAU,CAAC2B,YAAX,GAA0B,EAA1B;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox2.js","sources":["../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import React, { useMemo, forwardRef, ReactNode, SyntheticEvent, InputHTMLAttributes } from 'react';\n\nimport classNames from 'classnames';\nimport { uid } from 'uid';\n\nimport { mdiCheck } from '@lumx/icons';\n\nimport { Icon, InputHelper, InputLabel, Theme } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\n/**\n * Defines the props of the component.\n */\nexport interface CheckboxProps extends GenericProps {\n /** Helper text. */\n helper?: string;\n /** Native input id property. */\n id?: string;\n /** Native input ref. */\n inputRef?: React.Ref<HTMLInputElement>;\n /** Whether it is checked or not. */\n isChecked?: boolean;\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Label text. */\n label?: ReactNode;\n /** Native input name property. */\n name?: string;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Native input value property. */\n value?: string;\n /** On change callback. */\n onChange?(isChecked: boolean, value?: string, name?: string, event?: SyntheticEvent): void;\n /** optional props for input */\n inputProps?: InputHTMLAttributes<HTMLInputElement>;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Checkbox';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<CheckboxProps> = {\n theme: Theme.light,\n};\n\n/**\n * Checkbox component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Checkbox: Comp<CheckboxProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n checked,\n className,\n disabled,\n helper,\n id,\n inputRef,\n isChecked = checked,\n isDisabled = disabled,\n label,\n name,\n onChange,\n theme,\n value,\n inputProps = {},\n ...forwardedProps\n } = props;\n const inputId = useMemo(() => id || `${CLASSNAME.toLowerCase()}-${uid()}`, [id]);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (onChange) {\n onChange(!isChecked, value, name, event);\n }\n };\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n isChecked,\n isDisabled,\n isUnchecked: !isChecked,\n prefix: CLASSNAME,\n theme,\n }),\n )}\n >\n <div className={`${CLASSNAME}__input-wrapper`}>\n <input\n ref={inputRef}\n type=\"checkbox\"\n id={inputId}\n className={`${CLASSNAME}__input-native`}\n tabIndex={isDisabled ? -1 : 0}\n name={name}\n value={value}\n checked={isChecked}\n onChange={handleChange}\n {...inputProps}\n />\n\n <div className={`${CLASSNAME}__input-placeholder`}>\n <div className={`${CLASSNAME}__input-background`} />\n\n <div className={`${CLASSNAME}__input-indicator`}>\n <Icon icon={mdiCheck} />\n </div>\n </div>\n </div>\n\n <div className={`${CLASSNAME}__content`}>\n {label && (\n <InputLabel htmlFor={inputId} className={`${CLASSNAME}__label`} theme={theme}>\n {label}\n </InputLabel>\n )}\n {helper && (\n <InputHelper className={`${CLASSNAME}__helper`} theme={theme}>\n {helper}\n </InputHelper>\n )}\n </div>\n </div>\n );\n});\nCheckbox.displayName = COMPONENT_NAME;\nCheckbox.className = CLASSNAME;\nCheckbox.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","theme","Theme","light","Checkbox","forwardRef","props","ref","checked","className","disabled","helper","id","inputRef","isChecked","isDisabled","label","name","onChange","value","inputProps","forwardedProps","inputId","useMemo","toLowerCase","uid","handleChange","event","classNames","handleBasicClasses","isUnchecked","prefix","mdiCheck","displayName","defaultProps"],"mappings":";;;;;;;;;AAUA;;;;AA4BA;;;AAGA,IAAMA,cAAc,GAAG,UAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAqC,GAAG;AAC1CC,EAAAA,KAAK,EAAEC,KAAK,CAACC;AAD6B,CAA9C;AAIA;;;;;;;;IAOaC,QAA6C,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAEhFC,OAFgF,GAiBhFF,KAjBgF,CAEhFE,OAFgF;AAAA,MAGhFC,SAHgF,GAiBhFH,KAjBgF,CAGhFG,SAHgF;AAAA,MAIhFC,QAJgF,GAiBhFJ,KAjBgF,CAIhFI,QAJgF;AAAA,MAKhFC,MALgF,GAiBhFL,KAjBgF,CAKhFK,MALgF;AAAA,MAMhFC,EANgF,GAiBhFN,KAjBgF,CAMhFM,EANgF;AAAA,MAOhFC,QAPgF,GAiBhFP,KAjBgF,CAOhFO,QAPgF;AAAA,yBAiBhFP,KAjBgF,CAQhFQ,SARgF;AAAA,MAQhFA,SARgF,iCAQpEN,OARoE;AAAA,0BAiBhFF,KAjBgF,CAShFS,UATgF;AAAA,MAShFA,UATgF,kCASnEL,QATmE;AAAA,MAUhFM,KAVgF,GAiBhFV,KAjBgF,CAUhFU,KAVgF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,CAAJ,GAAQ,CALhC;AAMI,IAAA,IAAI,EAAEE,IANV;AAOI,IAAA,KAAK,EAAEE,KAPX;AAQI,IAAA,OAAO,EAAEL,SARb;AASI,IAAA,QAAQ,EAAEY;AATd,KAUQN,UAVR,EADJ,EAcI;AAAK,IAAA,SAAS,YAAKtB,SAAL;AAAd,KACI;AAAK,IAAA,SAAS,YAAKA,SAAL;AAAd,IADJ,EAGI;AAAK,IAAA,SAAS,YAAKA,SAAL;AAAd,KACI,oBAAC,IAAD;AAAM,IAAA,IAAI,EAAEkC;AAAZ,IADJ,CAHJ,CAdJ,CAdJ,EAqCI;AAAK,IAAA,SAAS,YAAKlC,SAAL;AAAd,KACKkB,KAAK,IACF,oBAAC,UAAD;AAAY,IAAA,OAAO,EAAEM,OAArB;AAA8B,IAAA,SAAS,YAAKxB,SAAL,YAAvC;AAAgE,IAAA,KAAK,EAAEG;AAAvE,KACKe,KADL,CAFR,EAMKL,MAAM,IACH,oBAAC,WAAD;AAAa,IAAA,SAAS,YAAKb,SAAL,aAAtB;AAAgD,IAAA,KAAK,EAAEG;AAAvD,KACKU,MADL,CAPR,CArCJ,CADJ;AAoDH,CA9EsE;AA+EvEP,QAAQ,CAAC6B,WAAT,GAAuBpC,cAAvB;AACAO,QAAQ,CAACK,SAAT,GAAqBX,SAArB;AACAM,QAAQ,CAAC8B,YAAT,GAAwBlC,aAAxB;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Chip2.js","sources":["../../../src/hooks/useStopPropagation.ts","../../../src/components/chip/Chip.tsx"],"sourcesContent":["import isFunction from 'lodash/isFunction';\nimport { MouseEventHandler, useCallback } from 'react';\n\n/**\n * Wrap mouse event handler to stop event propagation.\n *\n * @param handler The mouse handler to wrap.\n * @return Mouse handler stopping propagation.\n */\nexport function useStopPropagation(handler?: MouseEventHandler): MouseEventHandler {\n return useCallback(\n (evt) => {\n if (!evt || !isFunction(handler)) {\n return;\n }\n handler(evt);\n evt.stopPropagation();\n },\n [handler],\n );\n}\n","import { Color, ColorPalette, Size, Theme } from '@lumx/react';\nimport { useStopPropagation } from '@lumx/react/hooks/useStopPropagation';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses, onEnterPressed } from '@lumx/react/utils';\n\nimport classNames from 'classnames';\n\nimport isFunction from 'lodash/isFunction';\nimport React, { forwardRef, MouseEventHandler, ReactNode } from 'react';\n\n/**\n * Chip sizes.\n */\ntype ChipSize = Extract<Size, 's' | 'm'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface ChipProps extends GenericProps {\n /** A component to be rendered after the content. */\n after?: ReactNode;\n /** A component to be rendered before the content. */\n before?: ReactNode;\n /** Color variant. */\n color?: Color;\n /** Whether the component is clickable or not. */\n isClickable?: boolean;\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Whether the chip is currently in a highlighted state or not. */\n isHighlighted?: boolean;\n /** Whether the component is selected or not. */\n isSelected?: boolean;\n /** Size variant. */\n size?: ChipSize;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** On \"after\" element clicked callback. */\n onAfterClick?: MouseEventHandler;\n /** On \"before\" element clicked callback. */\n onBeforeClick?: MouseEventHandler;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Chip';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<ChipProps> = {\n size: Size.m,\n theme: Theme.light,\n};\n\n/**\n * Chip component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Chip: Comp<ChipProps, HTMLAnchorElement> = forwardRef((props, ref) => {\n const {\n after,\n before,\n children,\n className,\n color,\n disabled,\n isClickable,\n isDisabled = disabled,\n isHighlighted,\n isSelected,\n onAfterClick,\n onBeforeClick,\n onClick,\n size,\n theme,\n ...forwardedProps\n } = props;\n const hasAfterClick = isFunction(onAfterClick);\n const hasBeforeClick = isFunction(onBeforeClick);\n const hasOnClick = isFunction(onClick);\n\n // Adapt color to the theme.\n const chipColor = color || (theme === Theme.light ? ColorPalette.dark : ColorPalette.light);\n\n const handleOnBeforeClick = useStopPropagation(onBeforeClick);\n const handleOnAfterClick = useStopPropagation(onAfterClick);\n\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <a\n {...forwardedProps}\n ref={ref}\n className={classNames(\n className,\n handleBasicClasses({\n clickable: Boolean(hasOnClick) || isClickable,\n color: chipColor,\n isDisabled,\n hasAfter: Boolean(after),\n hasBefore: Boolean(before),\n highlighted: Boolean(isHighlighted),\n prefix: CLASSNAME,\n selected: Boolean(isSelected),\n size,\n unselected: Boolean(!isSelected),\n }),\n )}\n role={hasOnClick ? 'button' : undefined}\n tabIndex={isDisabled || !hasOnClick ? -1 : 0}\n aria-disabled={(hasOnClick && isDisabled) || undefined}\n onClick={hasOnClick ? onClick : undefined}\n onKeyDown={hasOnClick ? onEnterPressed(onClick) : undefined}\n >\n {before && (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions\n <div\n className={classNames(`${CLASSNAME}__before`, {\n [`${CLASSNAME}__before--is-clickable`]: hasBeforeClick,\n })}\n onClick={handleOnBeforeClick}\n >\n {before}\n </div>\n )}\n\n <div className={`${CLASSNAME}__label`}>{children}</div>\n\n {after && (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions\n <div\n className={classNames(`${CLASSNAME}__after`, {\n [`${CLASSNAME}__after--is-clickable`]: hasAfterClick,\n })}\n onClick={handleOnAfterClick}\n >\n {after}\n </div>\n )}\n </a>\n );\n});\nChip.displayName = COMPONENT_NAME;\nChip.className = CLASSNAME;\nChip.defaultProps = DEFAULT_PROPS;\n"],"names":["useStopPropagation","handler","useCallback","evt","isFunction","stopPropagation","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","size","Size","m","theme","Theme","light","Chip","forwardRef","props","ref","after","before","children","className","color","disabled","isClickable","isDisabled","isHighlighted","isSelected","onAfterClick","onBeforeClick","onClick","forwardedProps","hasAfterClick","hasBeforeClick","hasOnClick","chipColor","ColorPalette","dark","handleOnBeforeClick","handleOnAfterClick","classNames","handleBasicClasses","clickable","Boolean","hasAfter","hasBefore","highlighted","prefix","selected","unselected","undefined","onEnterPressed","displayName","defaultProps"],"mappings":";;;;;;AAGA;;;;;;;AAMO,SAASA,kBAAT,CAA4BC,OAA5B,EAA4E;AAC/E,SAAOC,WAAW,CACd,UAACC,GAAD,EAAS;AACL,QAAI,CAACA,GAAD,IAAQ,CAACC,UAAU,CAACH,OAAD,CAAvB,EAAkC;AAC9B;AACH;;AACDA,IAAAA,OAAO,CAACE,GAAD,CAAP;AACAA,IAAAA,GAAG,CAACE,eAAJ;AACH,GAPa,EAQd,CAACJ,OAAD,CARc,CAAlB;AAUH;;ACVD;;;;AAiCA;;;AAGA,IAAMK,cAAc,GAAG,MAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAiC,GAAG;AACtCC,EAAAA,IAAI,EAAEC,IAAI,CAACC,CAD2B;AAEtCC,EAAAA,KAAK,EAAEC,KAAK,CAACC;AAFyB,CAA1C;AAKA;;;;;;;;IAOaC,IAAwC,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAE3EC,KAF2E,GAkB3EF,KAlB2E,CAE3EE,KAF2E;AAAA,MAG3EC,MAH2E,GAkB3EH,KAlB2E,CAG3EG,MAH2E;AAAA,MAI3EC,QAJ2E,GAkB3EJ,KAlB2E,CAI3EI,QAJ2E;AAAA,MAK3EC,SAL2E,GAkB3EL,KAlB2E,CAK3EK,SAL2E;AAAA,MAM3EC,KAN2E,GAkB3EN,KAlB2E,CAM3EM,KAN2E;AAAA,MAO3EC,QAP2E,GAkB3EP,KAlB2E,CAO3EO,QAP2E;AAAA,MAQ3EC,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AACAS,IAAI,CAACuC,YAAL,GAAoB9C,aAApB;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChipGroup.js","sources":["../../../src/hooks/useChipGroupNavigation.tsx","../../../src/components/chip/ChipGroup.tsx"],"sourcesContent":["import { useState } from 'react';\n\ninterface UseChipGroupNavigation {\n /** the current active chip index */\n activeChip: number;\n\n /** callback to be executed when the backspace was pressed */\n onBackspacePressed(): void;\n\n /** function that allows to reset the navigation */\n resetChipNavigation(): void;\n}\n\nexport type useChipGroupNavigationType<C = any> = (\n chips: C[],\n onChipDeleted: (chip: C) => void,\n initialActiveChip?: number,\n) => UseChipGroupNavigation;\n\nconst INITIAL_STATE_ACTIVE_CHIP = -1;\n\n/**\n * Hook that provides the necessary information to manage chips navigation.\n * @param chips List of chips selected.\n * @param onChipDeleted Callback executed when a chip must be eliminated.\n * @param initialActiveChip Initial active chip index.\n *\n * @return chip navigation tools.\n */\nexport const useChipGroupNavigation: useChipGroupNavigationType = (\n chips,\n onChipDeleted,\n initialActiveChip = INITIAL_STATE_ACTIVE_CHIP,\n) => {\n const [wasBackspacePressed, setWasBackspacePressed] = useState(false);\n const [activeChip, setActiveChip] = useState(initialActiveChip);\n\n /**\n * Resets the active index and backspace control to their initial state\n */\n const resetChipNavigation = () => {\n setWasBackspacePressed(false);\n setActiveChip(initialActiveChip);\n };\n\n /**\n * Callback to be executed when the backspace was pressed. If there are no chips\n * selected, it will return immediately. If there are it will check if the\n * backspace was already pressed. if it was, it means that the user wants to eliminate\n * the chip, so we execute the `onChipDeleted` function and reset internal state.\n *\n * If it was not pressed before, we set the `wasBackspacePressed` flag to true and\n * highlight the last chip.\n */\n const onBackspacePressed = () => {\n if (chips.length === 0) {\n return;\n }\n\n if (wasBackspacePressed) {\n const chipDeleted: any = chips[chips.length - 1];\n onChipDeleted(chipDeleted);\n resetChipNavigation();\n } else {\n setActiveChip(chips.length - 1);\n setWasBackspacePressed(true);\n }\n };\n\n return {\n activeChip,\n onBackspacePressed,\n resetChipNavigation,\n };\n};\n","import { Alignment, HorizontalAlignment } from '@lumx/react/components';\nimport React, { forwardRef, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nimport { useChipGroupNavigation } from '@lumx/react/hooks/useChipGroupNavigation';\n\n/**\n * Defines the props of the component.\n */\nexport interface ChipGroupProps extends GenericProps {\n /** Chip horizontal alignment. */\n align?: HorizontalAlignment;\n /** List of Chip. */\n children: ReactNode;\n}\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<ChipGroupProps> = {\n align: Alignment.left,\n};\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ChipGroup';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * ChipGroup component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nconst InternalChipGroup: Comp<ChipGroupProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { align, children, className, ...forwardedProps } = props;\n const chipGroupClassName = handleBasicClasses({\n align,\n prefix: CLASSNAME,\n });\n\n return (\n <div ref={ref} {...forwardedProps} className={classNames(className, chipGroupClassName)}>\n {children}\n </div>\n );\n});\nInternalChipGroup.displayName = COMPONENT_NAME;\nInternalChipGroup.className = CLASSNAME;\nInternalChipGroup.defaultProps = DEFAULT_PROPS;\n\nexport const ChipGroup = Object.assign(InternalChipGroup, { useChipGroupNavigation });\n"],"names":["INITIAL_STATE_ACTIVE_CHIP","useChipGroupNavigation","chips","onChipDeleted","initialActiveChip","useState","wasBackspacePressed","setWasBackspacePressed","activeChip","setActiveChip","resetChipNavigation","onBackspacePressed","length","chipDeleted","DEFAULT_PROPS","align","Alignment","left","COMPONENT_NAME","CLASSNAME","getRootClassName","InternalChipGroup","forwardRef","props","ref","children","className","forwardedProps","chipGroupClassName","handleBasicClasses","prefix","classNames","displayName","defaultProps","Chip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cAAc,GAAG,WAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;;;;;AAOA,IAAMG,iBAAuD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAC/ET,KAD+E,GAC7BQ,KAD6B,CAC/ER,KAD+E;AAAA,MACxEU,QADwE,GAC7BF,KAD6B,CACxEE,QADwE;AAAA,MAC9DC,SAD8D,GAC7BH,KAD6B,CAC9DG,SAD8D;AAAA,MAChDC,cADgD,4BAC7BJ,KAD6B;;AAEvF,MAAMK,kBAAkB,GAAGC,kBAAkB,CAAC;AAC1Cd,IAAAA,KAAK,EAALA,KAD0C;AAE1Ce,IAAAA,MAAM,EAAEX;AAFkC,GAAD,CAA7C;AAKA,SACI;AAAK,IAAA,GAAG,EAAEK;AAAV,KAAmBG,cAAnB;AAAmC,IAAA,SAAS,EAAEI,UAAU,CAACL,SAAD,EAAYE,kBAAZ;AAAxD,MACKH,QADL,CADJ;AAKH,CAZyE,CAA1E;AAaAJ,iBAAiB,CAACW,WAAlB,GAAgCd,cAAhC;AACAG,iBAAiB,CAACK,SAAlB,GAA8BP,SAA9B;AACAE,iBAAiB,CAACY,YAAlB,GAAiCnB,aAAjC;IAEaoB,SAAS,GAAGC,MAAM,CAACC,MAAP,CAAcf,iBAAd,EAAiC;AAAEpB,EAAAA,sBAAsB,EAAtBA;AAAF,CAAjC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClickAwayProvider.js","sources":["../../../src/hooks/useCallbackOnEscape.ts","../../../src/hooks/useClickAway.tsx","../../../src/utils/ClickAwayProvider/ClickAwayProvider.tsx"],"sourcesContent":["import { DOCUMENT } from '@lumx/react/constants';\nimport { Callback, onEscapePressed } from '@lumx/react/utils';\nimport { useEffect } from 'react';\n\n/**\n * Triggers a callback when the escape key is pressed.\n *\n * @param callback Callback\n * @param closeOnEscape Disables the hook when false\n * @param rootElement Element on which to listen the escape key\n */\nexport function useCallbackOnEscape(\n callback: Callback | undefined,\n closeOnEscape = true,\n rootElement = DOCUMENT?.body,\n) {\n useEffect(() => {\n if (closeOnEscape && callback && rootElement) {\n const onKeyDown = onEscapePressed(callback);\n rootElement.addEventListener('keydown', onKeyDown);\n return () => rootElement.removeEventListener('keydown', onKeyDown);\n }\n return undefined;\n }, [callback, closeOnEscape, rootElement]);\n}\n","import { RefObject, useEffect } from 'react';\n\nimport { Falsy } from '@lumx/react/utils';\n\nimport isEmpty from 'lodash/isEmpty';\n\nconst EVENT_TYPES = ['mousedown', 'touchstart'];\n\nfunction isClickAway(target: HTMLElement, refs: Array<RefObject<HTMLElement>>): boolean {\n // The target element is not contained in any of the listed element references.\n return !refs.some((e) => e?.current?.contains(target));\n}\n\nexport interface ClickAwayParameters {\n /**\n * A callback function to call when the user clicks away from the elements.\n */\n callback: EventListener | Falsy;\n /**\n * Elements from which we want to detect the click away.\n */\n refs: RefObject<Array<RefObject<HTMLElement>>>;\n}\n\n/**\n * Listen to clicks away from the given elements and callback the passed in function.\n *\n * Warning: If you need to detect click away on nested React portals, please use the `ClickAwayProvider` component.\n */\nexport function useClickAway({ callback, refs }: ClickAwayParameters): void {\n useEffect(() => {\n const { current: currentRefs } = refs;\n if (!callback || !currentRefs || isEmpty(currentRefs)) {\n return undefined;\n }\n const listener: EventListener = (evt) => {\n if (isClickAway(evt.target as HTMLElement, currentRefs)) {\n callback(evt);\n }\n };\n\n EVENT_TYPES.forEach((evtType) => document.addEventListener(evtType, listener));\n return () => {\n EVENT_TYPES.forEach((evtType) => document.removeEventListener(evtType, listener));\n };\n }, [callback, refs]);\n}\n","import React, { createContext, useContext, useEffect } from 'react';\nimport pull from 'lodash/pull';\nimport { ClickAwayParameters, useClickAway } from '@lumx/react/hooks/useClickAway';\n\nconst ClickAwayAncestorContext = createContext<ClickAwayParameters['refs'] | null>(null);\n\n/**\n * Component combining the `useClickAway` hook with a React context to hook into the React component tree and make sure\n * we take into account both the DOM tree and the React tree we trying to detect click away.\n *\n * @return the react component.\n */\nexport const ClickAwayProvider: React.FC<ClickAwayParameters> = ({ children, callback, refs }) => {\n const ancestorChildrenRefs = useContext(ClickAwayAncestorContext);\n\n useEffect(() => {\n const { current: currentRefs } = refs;\n const { current: currentAncestorChildrenRefs } = ancestorChildrenRefs || {};\n if (!currentAncestorChildrenRefs || !currentRefs) {\n return undefined;\n }\n // Push current refs to parent.\n currentAncestorChildrenRefs.push(...currentRefs);\n return () => {\n // Pull current refs from parent.\n pull(currentAncestorChildrenRefs, ...currentRefs);\n };\n }, [ancestorChildrenRefs, refs]);\n\n useClickAway({ callback, refs });\n return <ClickAwayAncestorContext.Provider value={refs}>{children}</ClickAwayAncestorContext.Provider>;\n};\nClickAwayProvider.displayName = 'ClickAwayProvider';\n"],"names":["useCallbackOnEscape","callback","closeOnEscape","rootElement","DOCUMENT","body","useEffect","onKeyDown","onEscapePressed","addEventListener","removeEventListener","undefined","EVENT_TYPES","isClickAway","target","refs","some","e","current","contains","useClickAway","currentRefs","isEmpty","listener","evt","forEach","evtType","document","ClickAwayAncestorContext","createContext","ClickAwayProvider","children","ancestorChildrenRefs","useContext","currentAncestorChildrenRefs","push","pull","displayName"],"mappings":";;;;;;;AAIA;;;;;;;;AAOO,SAASA,mBAAT,CACHC,QADG,EAIL;AAAA,MAFEC,aAEF,uEAFkB,IAElB;AAAA,MADEC,WACF,uEADgBC,QAChB,aADgBA,QAChB,uBADgBA,QAAQ,CAAEC,IAC1B;AACEC,EAAAA,SAAS,CAAC,YAAM;AACZ,QAAIJ,aAAa,IAAID,QAAjB,IAA6BE,WAAjC,EAA8C;AAC1C,UAAMI,SAAS,GAAGC,eAAe,CAACP,QAAD,CAAjC;AACAE,MAAAA,WAAW,CAACM,gBAAZ,CAA6B,SAA7B,EAAwCF,SAAxC;AACA,aAAO;AAAA,eAAMJ,WAAW,CAACO,mBAAZ,CAAgC,SAAhC,EAA2CH,SAA3C,CAAN;AAAA,OAAP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EAAWc,IAAX,CAfM,CAAT;AAgBH;;AC1CD,IAAMa,wBAAwB,GAAGC,aAAa,CAAqC,IAArC,CAA9C;AAEA;;;;;;;IAMaC,iBAAgD,GAAG,SAAnDA,iBAAmD,OAAkC;AAAA,MAA/BC,QAA+B,QAA/BA,QAA+B;AAAA,MAArB9B,QAAqB,QAArBA,QAAqB;AAAA,MAAXc,IAAW,QAAXA,IAAW;AAC9F,MAAMiB,oBAAoB,GAAGC,UAAU,CAACL,wBAAD,CAAvC;AAEAtB,EAAAA,SAAS,CAAC,YAAM;AAAA,QACKe,WADL,GACqBN,IADrB,CACJG,OADI;;AAAA,gBAEqCc,oBAAoB,IAAI,EAF7D;AAAA,QAEKE,2BAFL,SAEJhB,OAFI;;AAGZ,QAAI,CAACgB,2BAAD,IAAgC,CAACb,WAArC,EAAkD;AAC9C,aAAOV,SAAP;AACH,KALW;;;AAOZuB,IAAAA,2BAA2B,CAACC,IAA5B,OAAAD,2BAA2B,qBAASb,WAAT,EAA3B;AACA,WAAO,YAAM;AACT;AACAe,MAAAA,IAAI,MAAJ,UAAKF,2BAAL,4BAAqCb,WAArC;AACH,KAHD;AAIH,GAZQ,EAYN,CAACW,oBAAD,EAAuBjB,IAAvB,CAZM,CAAT;AAcAK,EAAAA,YAAY,CAAC;AAAEnB,IAAAA,QAAQ,EAARA,QAAF;AAAYc,IAAAA,IAAI,EAAJA;AAAZ,GAAD,CAAZ;AACA,SAAO,oBAAC,wBAAD,CAA0B,QAA1B;AAAmC,IAAA,KAAK,EAAEA;AAA1C,KAAiDgB,QAAjD,CAAP;AACH;AACDD,iBAAiB,CAACO,WAAlB,GAAgC,mBAAhC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CommentBlock.js","sources":["../../../src/components/comment-block/CommentBlock.tsx"],"sourcesContent":["import React, { Children, forwardRef, KeyboardEvent, KeyboardEventHandler, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Avatar, Size, Theme, Tooltip } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses, ValueOf } from '@lumx/react/utils';\n\nimport isFunction from 'lodash/isFunction';\nimport { AvatarProps } from '../avatar/Avatar';\n\n/**\n * Comment block variants.\n */\nexport const CommentBlockVariant = {\n indented: 'indented',\n linear: 'linear',\n} as const;\nexport type CommentBlockVariant = ValueOf<typeof CommentBlockVariant>;\n\n/**\n * Defines the props of the component.\n */\nexport interface CommentBlockProps extends GenericProps {\n /** Action toolbar content. */\n actions?: ReactNode;\n /** Props to pass to the avatar. */\n avatarProps: AvatarProps;\n /** Comment block replies. */\n children?: ReactNode;\n /** Comment date with the minimal timestamp informations (xx minutes, x hours, yesterday, 6 days, Month Day, Month Day Year)*/\n date: string;\n /** Comment date with the full timestamp informations (day, month, year, time) */\n fullDate?: string;\n /** Whether the component has actions to display or not. */\n hasActions?: boolean;\n /** Action toolbar header content. */\n headerActions?: ReactNode;\n /** Whether the component is open or not. */\n isOpen?: boolean;\n /** Whether the comment is relevant or not. */\n isRelevant?: boolean;\n /** Comment author name. */\n name: string;\n /** On click callback. */\n onClick?(): void;\n /** On mouse enter callback. */\n onMouseEnter?(): void;\n /** On mouse leave callback. */\n onMouseLeave?(): void;\n /** Comment content. */\n text: ReactNode | string;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Comment variant. */\n variant?: CommentBlockVariant;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'CommentBlock';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<CommentBlockProps> = {\n theme: Theme.light,\n variant: CommentBlockVariant.indented,\n};\n\n/**\n * CommentBlock component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const CommentBlock: Comp<CommentBlockProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n actions,\n avatarProps,\n children,\n className,\n date,\n fullDate,\n hasActions,\n headerActions,\n isOpen,\n isRelevant,\n name,\n onClick,\n onMouseEnter,\n onMouseLeave,\n text,\n theme,\n variant,\n ...forwardedProps\n } = props;\n const enterKeyPress: KeyboardEventHandler<HTMLElement> = (evt: KeyboardEvent<HTMLElement>) => {\n if (evt.key === 'Enter' && isFunction(onClick)) {\n onClick();\n }\n };\n const hasChildren = Children.count(children) > 0;\n\n return (\n <div\n ref={ref}\n className={classNames(\n className,\n handleBasicClasses({\n hasChildren: hasChildren && isOpen,\n hasIndentedChildren: hasChildren && variant === CommentBlockVariant.indented,\n hasLinearChildren: hasChildren && variant === CommentBlockVariant.linear,\n isRelevant,\n prefix: CLASSNAME,\n theme,\n }),\n )}\n {...forwardedProps}\n >\n <div className={`${CLASSNAME}__wrapper`}>\n <div className={`${CLASSNAME}__avatar`}>\n <Avatar\n {...avatarProps}\n size={Size.m}\n tabIndex={onClick ? 0 : -1}\n onClick={onClick}\n onKeyPress={enterKeyPress}\n />\n </div>\n\n <div className={`${CLASSNAME}__container`}>\n <div className={`${CLASSNAME}__content`}>\n <div className={`${CLASSNAME}__meta`}>\n <span\n className={`${CLASSNAME}__name`}\n onClick={onClick}\n onKeyPress={enterKeyPress}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n role=\"button\"\n tabIndex={onClick ? 0 : -1}\n >\n {name}\n </span>\n {headerActions && <span className={`${CLASSNAME}__header-actions`}>{headerActions}</span>}\n </div>\n\n <div className={`${CLASSNAME}__text`}>{text}</div>\n {date &&\n (fullDate ? (\n <Tooltip label={fullDate} placement=\"top\">\n <span className={`${CLASSNAME}__date`}>{date}</span>\n </Tooltip>\n ) : (\n <span className={`${CLASSNAME}__date`}>{date}</span>\n ))}\n </div>\n {hasActions && <div className={`${CLASSNAME}__actions`}>{actions}</div>}\n </div>\n </div>\n\n {hasChildren && isOpen && <div className={`${CLASSNAME}__children`}>{children}</div>}\n </div>\n );\n});\nCommentBlock.displayName = COMPONENT_NAME;\nCommentBlock.className = CLASSNAME;\nCommentBlock.defaultProps = DEFAULT_PROPS;\n"],"names":["CommentBlockVariant","indented","linear","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","theme","Theme","light","variant","CommentBlock","forwardRef","props","ref","actions","avatarProps","children","className","date","fullDate","hasActions","headerActions","isOpen","isRelevant","name","onClick","onMouseEnter","onMouseLeave","text","forwardedProps","enterKeyPress","evt","key","isFunction","hasChildren","Children","count","classNames","handleBasicClasses","hasIndentedChildren","hasLinearChildren","prefix","Size","m","displayName","defaultProps"],"mappings":";;;;;;;;AAUA;;;IAGaA,mBAAmB,GAAG;AAC/BC,EAAAA,QAAQ,EAAE,UADqB;AAE/BC,EAAAA,MAAM,EAAE;AAFuB;;AA4CnC;;;AAGA,IAAMC,cAAc,GAAG,cAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAyC,GAAG;AAC9CC,EAAAA,KAAK,EAAEC,KAAK,CAACC,KADiC;AAE9CC,EAAAA,OAAO,EAAEV,mBAAmB,CAACC;AAFiB,CAAlD;AAKA;;;;;;;;IAOaU,YAAqD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAExFC,OAFwF,GAoBxFF,KApBwF,CAExFE,OAFwF;AAAA,MAGxFC,WAHwF,GAoBxFH,KApBwF,CAGxFG,WAHwF;AAAA,MAIxFC,QAJwF,GAoBxFJ,KApBwF,CAIxFI,QAJwF;AAAA,MAKxFC,SALwF,GAoBxFL,KApBwF,CAKxFK,SALwF;AAAA,MAMxFC,IANwF,GAoBxFN,KApBwF,CAMxFM,IANwF;AAAA,MAOxFC,QAPwF,GAoBxFP,KApBwF,CAOxFO,QAPwF;AAAA,MAQxFC,UARwF,GAoBxFR,KApBwF,CAQxFQ,UARwF;AAAA,MASxFC,aATwF,GAoBxFT,KApBwF,CASxFS,aATwF;AAAA,MAUxFC,MAVwF,GAo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