@webiny/ui 0.0.0-mt-3 → 0.0.0-unstable.40876133bb
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/Accordion/Accordion.d.ts +4 -4
- package/Accordion/Accordion.js +27 -13
- package/Accordion/Accordion.js.map +1 -0
- package/Accordion/Accordion.stories.js +34 -23
- package/Accordion/Accordion.stories.js.map +1 -0
- package/Accordion/AccordionItem.d.ts +8 -8
- package/Accordion/AccordionItem.js +68 -39
- package/Accordion/AccordionItem.js.map +1 -0
- package/Accordion/index.js +31 -2
- package/Accordion/index.js.map +1 -0
- package/Alert/Alert.d.ts +4 -4
- package/Alert/Alert.js +21 -10
- package/Alert/Alert.js.map +1 -0
- package/Alert/Alert.stories.js +22 -13
- package/Alert/Alert.stories.js.map +1 -0
- package/Alert/index.js +18 -1
- package/Alert/index.js.map +1 -0
- package/AutoComplete/AutoComplete.d.ts +12 -19
- package/AutoComplete/AutoComplete.js +150 -101
- package/AutoComplete/AutoComplete.js.map +1 -0
- package/AutoComplete/AutoComplete.stories.js +27 -17
- package/AutoComplete/AutoComplete.stories.js.map +1 -0
- package/AutoComplete/MultiAutoComplete.d.ts +44 -40
- package/AutoComplete/MultiAutoComplete.js +317 -248
- package/AutoComplete/MultiAutoComplete.js.map +1 -0
- package/AutoComplete/MultiAutoComplete.stories.js +39 -28
- package/AutoComplete/MultiAutoComplete.stories.js.map +1 -0
- package/AutoComplete/index.js +31 -2
- package/AutoComplete/index.js.map +1 -0
- package/AutoComplete/styles.js +14 -4
- package/AutoComplete/styles.js.map +1 -0
- package/AutoComplete/types.d.ts +4 -3
- package/AutoComplete/types.js +5 -1
- package/AutoComplete/types.js.map +1 -0
- package/AutoComplete/utils.d.ts +11 -5
- package/AutoComplete/utils.js +21 -6
- package/AutoComplete/utils.js.map +1 -0
- package/Avatar/Avatar.d.ts +5 -11
- package/Avatar/Avatar.js +39 -19
- package/Avatar/Avatar.js.map +1 -0
- package/Avatar/Avatar.stories.js +19 -10
- package/Avatar/Avatar.stories.js.map +1 -0
- package/Avatar/index.js +18 -1
- package/Avatar/index.js.map +1 -0
- package/Button/Button.d.ts +9 -23
- package/Button/Button.js +58 -43
- package/Button/Button.js.map +1 -0
- package/Button/Button.stories.js +42 -29
- package/Button/Button.stories.js.map +1 -0
- package/Button/Button.styles.d.ts +6 -0
- package/Button/Button.styles.js +15 -0
- package/Button/Button.styles.js.map +1 -0
- package/Button/CopyButton/CopyButton.d.ts +4 -7
- package/Button/CopyButton/CopyButton.js +24 -14
- package/Button/CopyButton/CopyButton.js.map +1 -0
- package/Button/CopyButton/CopyButton.stories.js +20 -10
- package/Button/CopyButton/CopyButton.stories.js.map +1 -0
- package/Button/IconButton/IconButton.d.ts +4 -7
- package/Button/IconButton/IconButton.js +14 -7
- package/Button/IconButton/IconButton.js.map +1 -0
- package/Button/IconButton/IconButton.stories.js +31 -19
- package/Button/IconButton/IconButton.stories.js.map +1 -0
- package/Button/index.js +44 -3
- package/Button/index.js.map +1 -0
- package/Carousel/Carousel.d.ts +3 -3
- package/Carousel/Carousel.js +34 -21
- package/Carousel/Carousel.js.map +1 -0
- package/Carousel/Carouser.stories.js +27 -17
- package/Carousel/Carouser.stories.js.map +1 -0
- package/Carousel/index.js +15 -1
- package/Carousel/index.js.map +1 -0
- package/Checkbox/Checkbox.d.ts +5 -9
- package/Checkbox/Checkbox.js +42 -28
- package/Checkbox/Checkbox.js.map +1 -0
- package/Checkbox/Checkbox.stories.js +27 -16
- package/Checkbox/Checkbox.stories.js.map +1 -0
- package/Checkbox/Checkbox.styles.js +11 -4
- package/Checkbox/Checkbox.styles.js.map +1 -0
- package/Checkbox/CheckboxGroup.d.ts +2 -2
- package/Checkbox/CheckboxGroup.js +36 -20
- package/Checkbox/CheckboxGroup.js.map +1 -0
- package/Checkbox/CheckboxGroup.stories.js +29 -18
- package/Checkbox/CheckboxGroup.stories.js.map +1 -0
- package/Checkbox/index.js +23 -2
- package/Checkbox/index.js.map +1 -0
- package/Chips/Chip.d.ts +3 -8
- package/Chips/Chip.js +21 -7
- package/Chips/Chip.js.map +1 -0
- package/Chips/Chips.d.ts +4 -4
- package/Chips/Chips.js +29 -12
- package/Chips/Chips.js.map +1 -0
- package/Chips/Chips.stories.js +33 -18
- package/Chips/Chips.stories.js.map +1 -0
- package/Chips/index.d.ts +0 -1
- package/Chips/index.js +31 -3
- package/Chips/index.js.map +1 -0
- package/Chips/styles.js +21 -9
- package/Chips/styles.js.map +1 -0
- package/CodeEditor/CodeEditor.d.ts +5 -8
- package/CodeEditor/CodeEditor.js +56 -35
- package/CodeEditor/CodeEditor.js.map +1 -0
- package/CodeEditor/CodeEditor.stories.js +30 -17
- package/CodeEditor/CodeEditor.stories.js.map +1 -0
- package/CodeEditor/index.js +18 -1
- package/CodeEditor/index.js.map +1 -0
- package/ColorPicker/ColorPicker.d.ts +9 -10
- package/ColorPicker/ColorPicker.js +63 -51
- package/ColorPicker/ColorPicker.js.map +1 -0
- package/ColorPicker/ColorPicker.stories.js +26 -15
- package/ColorPicker/ColorPicker.stories.js.map +1 -0
- package/ColorPicker/index.js +18 -1
- package/ColorPicker/index.js.map +1 -0
- package/ConfirmationDialog/ConfirmationDialog.d.ts +13 -13
- package/ConfirmationDialog/ConfirmationDialog.js +57 -45
- package/ConfirmationDialog/ConfirmationDialog.js.map +1 -0
- package/ConfirmationDialog/ConfirmationDialog.stories.js +22 -12
- package/ConfirmationDialog/ConfirmationDialog.stories.js.map +1 -0
- package/ConfirmationDialog/index.js +31 -2
- package/ConfirmationDialog/index.js.map +1 -0
- package/ConfirmationDialog/withConfirmation.d.ts +2 -2
- package/ConfirmationDialog/withConfirmation.js +19 -6
- package/ConfirmationDialog/withConfirmation.js.map +1 -0
- package/DataTable/DataTable.d.ts +20 -0
- package/DataTable/DataTable.js +157 -0
- package/DataTable/DataTable.js.map +1 -0
- package/DataTable/DataTable.stories.d.ts +1 -0
- package/DataTable/DataTable.stories.js +77 -0
- package/DataTable/DataTable.stories.js.map +1 -0
- package/DataTable/README.md +72 -0
- package/DataTable/index.d.ts +1 -0
- package/DataTable/index.js +18 -0
- package/DataTable/index.js.map +1 -0
- package/DataTable/styled.d.ts +1 -0
- package/DataTable/styled.js +18 -0
- package/DataTable/styled.js.map +1 -0
- package/DelayedOnChange/DelayedOnChange.d.ts +40 -0
- package/DelayedOnChange/DelayedOnChange.js +129 -0
- package/DelayedOnChange/DelayedOnChange.js.map +1 -0
- package/DelayedOnChange/index.d.ts +2 -0
- package/DelayedOnChange/index.js +23 -0
- package/DelayedOnChange/index.js.map +1 -0
- package/DelayedOnChange/withDelayedOnChange.d.ts +3 -0
- package/DelayedOnChange/withDelayedOnChange.js +37 -0
- package/DelayedOnChange/withDelayedOnChange.js.map +1 -0
- package/Dialog/Dialog.d.ts +22 -30
- package/Dialog/Dialog.js +75 -39
- package/Dialog/Dialog.js.map +1 -0
- package/Dialog/Dialog.stories.js +26 -16
- package/Dialog/Dialog.stories.js.map +1 -0
- package/Dialog/index.js +18 -1
- package/Dialog/index.js.map +1 -0
- package/Drawer/Drawer.d.ts +1 -1
- package/Drawer/Drawer.js +20 -6
- package/Drawer/Drawer.js.map +1 -0
- package/Drawer/Drawer.stories.js +26 -15
- package/Drawer/Drawer.stories.js.map +1 -0
- package/Drawer/index.js +18 -1
- package/Drawer/index.js.map +1 -0
- package/DynamicFieldset/Fieldset.d.ts +26 -16
- package/DynamicFieldset/Fieldset.js +82 -60
- package/DynamicFieldset/Fieldset.js.map +1 -0
- package/DynamicFieldset/index.js +15 -1
- package/DynamicFieldset/index.js.map +1 -0
- package/Elevation/Elevation.d.ts +1 -1
- package/Elevation/Elevation.js +17 -6
- package/Elevation/Elevation.js.map +1 -0
- package/Elevation/Elevation.stories.js +27 -16
- package/Elevation/Elevation.stories.js.map +1 -0
- package/Elevation/index.js +18 -1
- package/Elevation/index.js.map +1 -0
- package/FormElementMessage/FormElementMessage.d.ts +1 -1
- package/FormElementMessage/FormElementMessage.js +15 -5
- package/FormElementMessage/FormElementMessage.js.map +1 -0
- package/FormElementMessage/index.js +13 -1
- package/FormElementMessage/index.js.map +1 -0
- package/FullName/FullName.js +8 -1
- package/FullName/FullName.js.map +1 -0
- package/FullName/index.js +18 -1
- package/FullName/index.js.map +1 -0
- package/Grid/Grid.d.ts +1 -1
- package/Grid/Grid.js +26 -9
- package/Grid/Grid.js.map +1 -0
- package/Grid/Grid.stories.js +21 -12
- package/Grid/Grid.stories.js.map +1 -0
- package/Grid/index.js +18 -1
- package/Grid/index.js.map +1 -0
- package/Helpers/ClassNames.d.ts +4 -3
- package/Helpers/ClassNames.js +21 -10
- package/Helpers/ClassNames.js.map +1 -0
- package/Helpers/index.js +13 -2
- package/Helpers/index.js.map +1 -0
- package/Icon/Icon.d.ts +3 -6
- package/Icon/Icon.js +19 -10
- package/Icon/Icon.js.map +1 -0
- package/Icon/Icon.stories.js +33 -20
- package/Icon/Icon.stories.js.map +1 -0
- package/Icon/index.js +18 -1
- package/Icon/index.js.map +1 -0
- package/Image/Image.d.ts +5 -4
- package/Image/Image.js +22 -10
- package/Image/Image.js.map +1 -0
- package/Image/Image.stories.js +21 -11
- package/Image/Image.stories.js.map +1 -0
- package/Image/index.js +18 -1
- package/Image/index.js.map +1 -0
- package/ImageEditor/ImageEditor.d.ts +33 -34
- package/ImageEditor/ImageEditor.js +110 -83
- package/ImageEditor/ImageEditor.js.map +1 -0
- package/ImageEditor/index.js +18 -1
- package/ImageEditor/index.js.map +1 -0
- package/ImageEditor/toolbar/crop.js +34 -15
- package/ImageEditor/toolbar/crop.js.map +1 -0
- package/ImageEditor/toolbar/filter.js +76 -47
- package/ImageEditor/toolbar/filter.js.map +1 -0
- package/ImageEditor/toolbar/flip.js +35 -16
- package/ImageEditor/toolbar/flip.js.map +1 -0
- package/ImageEditor/toolbar/icons/index.js +69 -8
- package/ImageEditor/toolbar/icons/index.js.map +1 -0
- package/ImageEditor/toolbar/index.js +39 -4
- package/ImageEditor/toolbar/index.js.map +1 -0
- package/ImageEditor/toolbar/rotate.js +65 -36
- package/ImageEditor/toolbar/rotate.js.map +1 -0
- package/ImageEditor/toolbar/types.d.ts +23 -12
- package/ImageEditor/toolbar/types.js +5 -1
- package/ImageEditor/toolbar/types.js.map +1 -0
- package/ImageUpload/Image.d.ts +6 -6
- package/ImageUpload/Image.js +57 -35
- package/ImageUpload/Image.js.map +1 -0
- package/ImageUpload/ImageEditorDialog.d.ts +11 -6
- package/ImageUpload/ImageEditorDialog.js +54 -31
- package/ImageUpload/ImageEditorDialog.js.map +1 -0
- package/ImageUpload/MultiImageUpload.d.ts +10 -31
- package/ImageUpload/MultiImageUpload.js +117 -81
- package/ImageUpload/MultiImageUpload.js.map +1 -0
- package/ImageUpload/MultiImageUpload.stories.js +26 -15
- package/ImageUpload/MultiImageUpload.stories.js.map +1 -0
- package/ImageUpload/SingleImageUpload.d.ts +16 -37
- package/ImageUpload/SingleImageUpload.js +85 -54
- package/ImageUpload/SingleImageUpload.js.map +1 -0
- package/ImageUpload/SingleImageUpload.stories.js +27 -16
- package/ImageUpload/SingleImageUpload.stories.js.map +1 -0
- package/ImageUpload/index.js +39 -4
- package/ImageUpload/index.js.map +1 -0
- package/ImageUpload/styled.d.ts +20 -14
- package/ImageUpload/styled.js +29 -15
- package/ImageUpload/styled.js.map +1 -0
- package/Input/Input.d.ts +4 -8
- package/Input/Input.js +70 -41
- package/Input/Input.js.map +1 -0
- package/Input/Input.stories.js +62 -46
- package/Input/Input.stories.js.map +1 -0
- package/Input/__tests__/Input.test.js +65 -48
- package/Input/__tests__/Input.test.js.map +1 -0
- package/Input/index.js +18 -1
- package/Input/index.js.map +1 -0
- package/List/CollapsibleList/CollapsibleList.stories.js +27 -16
- package/List/CollapsibleList/CollapsibleList.stories.js.map +1 -0
- package/List/CollapsibleList/index.d.ts +2 -2
- package/List/CollapsibleList/index.js +21 -6
- package/List/CollapsibleList/index.js.map +1 -0
- package/List/DataList/DataList.d.ts +24 -43
- package/List/DataList/DataList.js +112 -68
- package/List/DataList/DataList.js.map +1 -0
- package/List/DataList/DataList.stories.js +37 -25
- package/List/DataList/DataList.stories.js.map +1 -0
- package/List/DataList/DataListModalOverlay/DataListModalOverlay.d.ts +8 -8
- package/List/DataList/DataListModalOverlay/DataListModalOverlay.js +29 -10
- package/List/DataList/DataListModalOverlay/DataListModalOverlay.js.map +1 -0
- package/List/DataList/DataListModalOverlay/DataListModalOverlayAction.d.ts +3 -3
- package/List/DataList/DataListModalOverlay/DataListModalOverlayAction.js +27 -9
- package/List/DataList/DataListModalOverlay/DataListModalOverlayAction.js.map +1 -0
- package/List/DataList/DataListModalOverlay/DataListModalOverlayContext.d.ts +9 -4
- package/List/DataList/DataListModalOverlay/DataListModalOverlayContext.js +29 -8
- package/List/DataList/DataListModalOverlay/DataListModalOverlayContext.js.map +1 -0
- package/List/DataList/DataListModalOverlay/index.js +35 -3
- package/List/DataList/DataListModalOverlay/index.js.map +1 -0
- package/List/DataList/DataListWithSections.d.ts +45 -0
- package/List/DataList/DataListWithSections.js +356 -0
- package/List/DataList/DataListWithSections.js.map +1 -0
- package/List/DataList/Loader.d.ts +2 -2
- package/List/DataList/Loader.js +53 -50
- package/List/DataList/Loader.js.map +1 -0
- package/List/DataList/NoData.d.ts +2 -2
- package/List/DataList/NoData.js +19 -6
- package/List/DataList/NoData.js.map +1 -0
- package/List/DataList/icons/index.d.ts +1 -1
- package/List/DataList/icons/index.js +83 -38
- package/List/DataList/icons/index.js.map +1 -0
- package/List/DataList/index.d.ts +1 -0
- package/List/DataList/index.js +64 -3
- package/List/DataList/index.js.map +1 -0
- package/List/DataList/types.d.ts +1 -1
- package/List/DataList/types.js +5 -1
- package/List/DataList/types.js.map +1 -0
- package/List/List.d.ts +3 -2
- package/List/List.js +92 -49
- package/List/List.js.map +1 -0
- package/List/List.stories.js +52 -37
- package/List/List.stories.js.map +1 -0
- package/List/icons/index.js +23 -3
- package/List/icons/index.js.map +1 -0
- package/List/index.d.ts +1 -1
- package/List/index.js +74 -3
- package/List/index.js.map +1 -0
- package/Menu/Menu.d.ts +14 -21
- package/Menu/Menu.js +61 -49
- package/Menu/Menu.js.map +1 -0
- package/Menu/Menu.stories.js +24 -14
- package/Menu/Menu.stories.js.map +1 -0
- package/Menu/index.js +18 -1
- package/Menu/index.js.map +1 -0
- package/Mosaic/Mosaic.d.ts +4 -14
- package/Mosaic/Mosaic.js +22 -5
- package/Mosaic/Mosaic.js.map +1 -0
- package/Mosaic/Mosaic.stories.js +37 -28
- package/Mosaic/Mosaic.stories.js.map +1 -0
- package/Mosaic/index.js +18 -1
- package/Mosaic/index.js.map +1 -0
- package/Progress/CircularProgress.d.ts +8 -16
- package/Progress/CircularProgress.js +38 -20
- package/Progress/CircularProgress.js.map +1 -0
- package/Progress/index.js +15 -1
- package/Progress/index.js.map +1 -0
- package/Radio/Radio.d.ts +2 -6
- package/Radio/Radio.js +42 -28
- package/Radio/Radio.js.map +1 -0
- package/Radio/Radio.styles.js +11 -4
- package/Radio/Radio.styles.js.map +1 -0
- package/Radio/RadioGroup.d.ts +1 -6
- package/Radio/RadioGroup.js +38 -26
- package/Radio/RadioGroup.js.map +1 -0
- package/Radio/RadioGroup.stories.js +29 -18
- package/Radio/RadioGroup.stories.js.map +1 -0
- package/Radio/index.js +23 -2
- package/Radio/index.js.map +1 -0
- package/RichTextEditor/RichTextEditor.d.ts +13 -9
- package/RichTextEditor/RichTextEditor.js +92 -57
- package/RichTextEditor/RichTextEditor.js.map +1 -0
- package/RichTextEditor/RichTextEditor.stories.js +22 -11
- package/RichTextEditor/RichTextEditor.stories.js.map +1 -0
- package/RichTextEditor/createPropsFromConfig.d.ts +11 -1
- package/RichTextEditor/createPropsFromConfig.js +20 -5
- package/RichTextEditor/createPropsFromConfig.js.map +1 -0
- package/RichTextEditor/index.d.ts +1 -0
- package/RichTextEditor/index.js +30 -2
- package/RichTextEditor/index.js.map +1 -0
- package/Ripple/Ripple.d.ts +4 -5
- package/Ripple/Ripple.js +16 -5
- package/Ripple/Ripple.js.map +1 -0
- package/Ripple/Ripple.stories.js +57 -42
- package/Ripple/Ripple.stories.js.map +1 -0
- package/Ripple/index.js +18 -1
- package/Ripple/index.js.map +1 -0
- package/Scrollbar/Scrollbar.d.ts +5 -5
- package/Scrollbar/Scrollbar.js +14 -4
- package/Scrollbar/Scrollbar.js.map +1 -0
- package/Scrollbar/Scrollbar.stories.js +18 -9
- package/Scrollbar/Scrollbar.stories.js.map +1 -0
- package/Scrollbar/index.js +18 -1
- package/Scrollbar/index.js.map +1 -0
- package/Section/Section.stories.js +22 -12
- package/Section/Section.stories.js.map +1 -0
- package/Section/index.d.ts +4 -5
- package/Section/index.js +30 -15
- package/Section/index.js.map +1 -0
- package/Select/Select.d.ts +7 -10
- package/Select/Select.js +101 -23
- package/Select/Select.js.map +1 -0
- package/Select/Select.stories.js +36 -25
- package/Select/Select.stories.js.map +1 -0
- package/Select/index.js +18 -1
- package/Select/index.js.map +1 -0
- package/Skeleton/README.md +21 -0
- package/Skeleton/Skeleton.d.ts +4 -0
- package/Skeleton/Skeleton.js +25 -0
- package/Skeleton/Skeleton.js.map +1 -0
- package/Skeleton/Skeleton.stories.d.ts +1 -0
- package/Skeleton/Skeleton.stories.js +28 -0
- package/Skeleton/Skeleton.stories.js.map +1 -0
- package/Skeleton/index.d.ts +1 -0
- package/Skeleton/index.js +18 -0
- package/Skeleton/index.js.map +1 -0
- package/Slider/Slider.d.ts +1 -6
- package/Slider/Slider.js +47 -33
- package/Slider/Slider.js.map +1 -0
- package/Slider/Slider.stories.js +27 -16
- package/Slider/Slider.stories.js.map +1 -0
- package/Slider/index.js +15 -1
- package/Slider/index.js.map +1 -0
- package/Snackbar/Snackbar.d.ts +5 -7
- package/Snackbar/Snackbar.js +38 -23
- package/Snackbar/Snackbar.js.map +1 -0
- package/Snackbar/Snackbar.stories.js +44 -30
- package/Snackbar/Snackbar.stories.js.map +1 -0
- package/Snackbar/index.js +19 -1
- package/Snackbar/index.js.map +1 -0
- package/Switch/Switch.d.ts +2 -6
- package/Switch/Switch.js +48 -33
- package/Switch/Switch.js.map +1 -0
- package/Switch/Switch.stories.js +27 -16
- package/Switch/Switch.stories.js.map +1 -0
- package/Switch/index.js +18 -1
- package/Switch/index.js.map +1 -0
- package/Tabs/Tab.d.ts +6 -2
- package/Tabs/Tab.js +37 -10
- package/Tabs/Tab.js.map +1 -0
- package/Tabs/Tabs.d.ts +43 -21
- package/Tabs/Tabs.js +131 -125
- package/Tabs/Tabs.js.map +1 -0
- package/Tabs/Tabs.stories.js +34 -22
- package/Tabs/Tabs.stories.js.map +1 -0
- package/Tabs/index.js +31 -2
- package/Tabs/index.js.map +1 -0
- package/Tags/Tags.d.ts +5 -10
- package/Tags/Tags.js +71 -47
- package/Tags/Tags.js.map +1 -0
- package/Tags/Tags.stories.js +27 -16
- package/Tags/Tags.stories.js.map +1 -0
- package/Tags/index.js +18 -1
- package/Tags/index.js.map +1 -0
- package/Tooltip/Tooltip.d.ts +9 -8
- package/Tooltip/Tooltip.js +44 -25
- package/Tooltip/Tooltip.js.map +1 -0
- package/Tooltip/Tooltip.stories.js +20 -11
- package/Tooltip/Tooltip.stories.js.map +1 -0
- package/Tooltip/index.js +18 -1
- package/Tooltip/index.js.map +1 -0
- package/TopAppBar/TopAppBar.d.ts +1 -1
- package/TopAppBar/TopAppBar.js +18 -7
- package/TopAppBar/TopAppBar.js.map +1 -0
- package/TopAppBar/TopAppBar.stories.js +39 -25
- package/TopAppBar/TopAppBar.stories.js.map +1 -0
- package/TopAppBar/TopAppBarActionItem.d.ts +1 -1
- package/TopAppBar/TopAppBarActionItem.js +14 -4
- package/TopAppBar/TopAppBarActionItem.js.map +1 -0
- package/TopAppBar/TopAppBarNavigationIcon.d.ts +1 -1
- package/TopAppBar/TopAppBarNavigationIcon.js +14 -4
- package/TopAppBar/TopAppBarNavigationIcon.js.map +1 -0
- package/TopAppBar/TopAppBarPrimary.js +18 -7
- package/TopAppBar/TopAppBarPrimary.js.map +1 -0
- package/TopAppBar/TopAppBarSecondary.js +18 -7
- package/TopAppBar/TopAppBarSecondary.js.map +1 -0
- package/TopAppBar/TopAppBarSection.d.ts +1 -1
- package/TopAppBar/TopAppBarSection.js +18 -7
- package/TopAppBar/TopAppBarSection.js.map +1 -0
- package/TopAppBar/TopAppBarTitle.d.ts +1 -1
- package/TopAppBar/TopAppBarTitle.js +18 -7
- package/TopAppBar/TopAppBarTitle.js.map +1 -0
- package/TopAppBar/index.js +96 -7
- package/TopAppBar/index.js.map +1 -0
- package/TopProgressBar/TopProgressBar.d.ts +7 -7
- package/TopProgressBar/TopProgressBar.js +20 -7
- package/TopProgressBar/TopProgressBar.js.map +1 -0
- package/TopProgressBar/TopProgressBar.stories.js +22 -12
- package/TopProgressBar/TopProgressBar.stories.js.map +1 -0
- package/TopProgressBar/hoc/index.js +15 -1
- package/TopProgressBar/hoc/index.js.map +1 -0
- package/TopProgressBar/hoc/withTopProgressBar.d.ts +1 -1
- package/TopProgressBar/hoc/withTopProgressBar.js +16 -5
- package/TopProgressBar/hoc/withTopProgressBar.js.map +1 -0
- package/TopProgressBar/index.js +18 -1
- package/TopProgressBar/index.js.map +1 -0
- package/Typography/Typography.d.ts +4 -4
- package/Typography/Typography.js +14 -4
- package/Typography/Typography.js.map +1 -0
- package/Typography/Typography.stories.js +43 -34
- package/Typography/Typography.stories.js.map +1 -0
- package/Typography/index.js +18 -1
- package/Typography/index.js.map +1 -0
- package/package.json +56 -63
- package/styles.scss +3 -4
- package/types.d.ts +2 -2
- package/types.js +5 -1
- package/types.js.map +1 -0
- package/Chips/ChipIcon.d.ts +0 -4
- package/Chips/ChipIcon.js +0 -8
- package/rmwc/textfield/code/index.d.ts +0 -135
- package/rmwc/textfield/code/index.js +0 -571
- package/rmwc/textfield/next/index.d.ts +0 -135
- package/rmwc/textfield/next/index.js +0 -560
- package/rmwc/textfield/package.json +0 -45
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
2
|
interface ChildrenRenderProp {
|
|
3
|
-
showConfirmation: (onAccept?:
|
|
3
|
+
showConfirmation: (onAccept?: () => void, onCancel?: () => void) => any;
|
|
4
4
|
}
|
|
5
5
|
interface ConfirmationCallbacks {
|
|
6
|
-
onAccept
|
|
7
|
-
onCancel
|
|
6
|
+
onAccept?: () => void;
|
|
7
|
+
onCancel?: () => void;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
interface Props {
|
|
10
10
|
title?: React.ReactNode;
|
|
11
11
|
message?: React.ReactNode;
|
|
12
12
|
loading?: React.ReactNode;
|
|
@@ -14,15 +14,15 @@ declare type Props = {
|
|
|
14
14
|
children: (props: ChildrenRenderProp) => React.ReactNode;
|
|
15
15
|
disableConfirm?: boolean;
|
|
16
16
|
style?: React.CSSProperties;
|
|
17
|
-
}
|
|
18
|
-
|
|
17
|
+
}
|
|
18
|
+
interface ConfirmationDialogState {
|
|
19
19
|
show: boolean;
|
|
20
20
|
loading: boolean;
|
|
21
|
-
}
|
|
21
|
+
}
|
|
22
22
|
/**
|
|
23
23
|
* Use ConfirmationDialog component to display a list of choices, once the handler is triggered.
|
|
24
24
|
*/
|
|
25
|
-
declare class ConfirmationDialog extends React.Component<Props,
|
|
25
|
+
declare class ConfirmationDialog extends React.Component<Props, ConfirmationDialogState> {
|
|
26
26
|
static defaultProps: {
|
|
27
27
|
title: string;
|
|
28
28
|
message: string;
|
|
@@ -36,10 +36,10 @@ declare class ConfirmationDialog extends React.Component<Props, State> {
|
|
|
36
36
|
};
|
|
37
37
|
componentDidMount(): void;
|
|
38
38
|
componentWillUnmount(): void;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
private readonly showConfirmation;
|
|
40
|
+
private readonly hideConfirmation;
|
|
41
|
+
private readonly onAccept;
|
|
42
|
+
private readonly onCancel;
|
|
43
43
|
render(): JSX.Element;
|
|
44
44
|
}
|
|
45
45
|
export { ConfirmationDialog };
|
|
@@ -1,48 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ConfirmationDialog = void 0;
|
|
9
|
+
|
|
10
|
+
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
+
|
|
16
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
+
|
|
18
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
+
|
|
20
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
+
|
|
22
|
+
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
23
|
+
|
|
24
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
+
|
|
26
|
+
var _react = _interopRequireDefault(require("react"));
|
|
27
|
+
|
|
28
|
+
var _Dialog = require("./../Dialog");
|
|
29
|
+
|
|
30
|
+
var _Progress = require("../Progress");
|
|
13
31
|
|
|
14
32
|
/**
|
|
15
33
|
* Use ConfirmationDialog component to display a list of choices, once the handler is triggered.
|
|
16
34
|
*/
|
|
17
35
|
var ConfirmationDialog = /*#__PURE__*/function (_React$Component) {
|
|
18
|
-
|
|
36
|
+
(0, _inherits2.default)(ConfirmationDialog, _React$Component);
|
|
19
37
|
|
|
20
|
-
var _super =
|
|
38
|
+
var _super = (0, _createSuper2.default)(ConfirmationDialog);
|
|
21
39
|
|
|
22
40
|
function ConfirmationDialog() {
|
|
23
41
|
var _this;
|
|
24
42
|
|
|
25
|
-
|
|
43
|
+
(0, _classCallCheck2.default)(this, ConfirmationDialog);
|
|
26
44
|
|
|
27
45
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
28
46
|
args[_key] = arguments[_key];
|
|
29
47
|
}
|
|
30
48
|
|
|
31
49
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
onCancel:
|
|
50
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "__isMounted", false);
|
|
51
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "callbacks", {
|
|
52
|
+
onAccept: function onAccept() {
|
|
53
|
+
return void 0;
|
|
54
|
+
},
|
|
55
|
+
onCancel: function onCancel() {
|
|
56
|
+
return void 0;
|
|
57
|
+
}
|
|
38
58
|
});
|
|
39
|
-
|
|
40
|
-
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
59
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
|
|
41
60
|
show: false,
|
|
42
61
|
loading: false
|
|
43
62
|
});
|
|
44
|
-
|
|
45
|
-
_defineProperty(_assertThisInitialized(_this), "showConfirmation", function (onAccept, onCancel) {
|
|
63
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "showConfirmation", function (onAccept, onCancel) {
|
|
46
64
|
_this.callbacks = {
|
|
47
65
|
onAccept: onAccept,
|
|
48
66
|
onCancel: onCancel
|
|
@@ -52,16 +70,14 @@ var ConfirmationDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
52
70
|
show: true
|
|
53
71
|
});
|
|
54
72
|
});
|
|
55
|
-
|
|
56
|
-
_defineProperty(_assertThisInitialized(_this), "hideConfirmation", function () {
|
|
73
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hideConfirmation", function () {
|
|
57
74
|
_this.setState({
|
|
58
75
|
show: false
|
|
59
76
|
});
|
|
60
77
|
});
|
|
61
|
-
|
|
62
|
-
_defineProperty(_assertThisInitialized(_this), "onAccept", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
78
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onAccept", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
|
63
79
|
var onAccept;
|
|
64
|
-
return
|
|
80
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
65
81
|
while (1) {
|
|
66
82
|
switch (_context.prev = _context.next) {
|
|
67
83
|
case 0:
|
|
@@ -94,10 +110,9 @@ var ConfirmationDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
94
110
|
}
|
|
95
111
|
}, _callee);
|
|
96
112
|
})));
|
|
97
|
-
|
|
98
|
-
_defineProperty(_assertThisInitialized(_this), "onCancel", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
113
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onCancel", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
|
|
99
114
|
var onCancel;
|
|
100
|
-
return
|
|
115
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
|
101
116
|
while (1) {
|
|
102
117
|
switch (_context2.prev = _context2.next) {
|
|
103
118
|
case 0:
|
|
@@ -118,11 +133,10 @@ var ConfirmationDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
118
133
|
}
|
|
119
134
|
}, _callee2);
|
|
120
135
|
})));
|
|
121
|
-
|
|
122
136
|
return _this;
|
|
123
137
|
}
|
|
124
138
|
|
|
125
|
-
|
|
139
|
+
(0, _createClass2.default)(ConfirmationDialog, [{
|
|
126
140
|
key: "componentDidMount",
|
|
127
141
|
value: function componentDidMount() {
|
|
128
142
|
this.__isMounted = true;
|
|
@@ -135,14 +149,14 @@ var ConfirmationDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
135
149
|
}, {
|
|
136
150
|
key: "render",
|
|
137
151
|
value: function render() {
|
|
138
|
-
return /*#__PURE__*/
|
|
152
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Dialog.Dialog, {
|
|
139
153
|
style: this.props.style,
|
|
140
154
|
open: this.state.show,
|
|
141
155
|
onClose: this.hideConfirmation,
|
|
142
156
|
"data-testid": this.props["data-testid"]
|
|
143
|
-
}, this.state.loading ? this.props.loading : null, /*#__PURE__*/
|
|
157
|
+
}, this.state.loading ? this.props.loading : null, /*#__PURE__*/_react.default.createElement(_Dialog.DialogTitle, null, this.props.title), /*#__PURE__*/_react.default.createElement(_Dialog.DialogContent, null, this.props.message), /*#__PURE__*/_react.default.createElement(_Dialog.DialogActions, null, /*#__PURE__*/_react.default.createElement(_Dialog.DialogCancel, {
|
|
144
158
|
onClick: this.onCancel
|
|
145
|
-
}, "Cancel"), /*#__PURE__*/
|
|
159
|
+
}, "Cancel"), /*#__PURE__*/_react.default.createElement(_Dialog.DialogButton, {
|
|
146
160
|
"data-testid": "confirmationdialog-confirm-action",
|
|
147
161
|
onClick: this.onAccept,
|
|
148
162
|
disabled: this.props.disableConfirm
|
|
@@ -151,14 +165,12 @@ var ConfirmationDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
151
165
|
}));
|
|
152
166
|
}
|
|
153
167
|
}]);
|
|
154
|
-
|
|
155
168
|
return ConfirmationDialog;
|
|
156
|
-
}(
|
|
169
|
+
}(_react.default.Component);
|
|
157
170
|
|
|
158
|
-
|
|
171
|
+
exports.ConfirmationDialog = ConfirmationDialog;
|
|
172
|
+
(0, _defineProperty2.default)(ConfirmationDialog, "defaultProps", {
|
|
159
173
|
title: "Confirmation",
|
|
160
174
|
message: "Are you sure you want to continue?",
|
|
161
|
-
loading: /*#__PURE__*/
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
export { ConfirmationDialog };
|
|
175
|
+
loading: /*#__PURE__*/_react.default.createElement(_Progress.CircularProgress, null)
|
|
176
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ConfirmationDialog","onAccept","onCancel","show","loading","callbacks","setState","__isMounted","props","style","state","hideConfirmation","title","message","disableConfirm","children","showConfirmation","React","Component"],"sources":["ConfirmationDialog.tsx"],"sourcesContent":["import React from \"react\";\n\nimport {\n Dialog,\n DialogButton,\n DialogCancel,\n DialogActions,\n DialogTitle,\n DialogContent\n} from \"./../Dialog\";\n\nimport { CircularProgress } from \"../Progress\";\n\ninterface ChildrenRenderProp {\n showConfirmation: (onAccept?: () => void, onCancel?: () => void) => any;\n}\n\ninterface ConfirmationCallbacks {\n onAccept?: () => void;\n onCancel?: () => void;\n}\n\ninterface Props {\n // Title of confirmation dialog\n title?: React.ReactNode;\n\n // Message of confirmation dialog\n message?: React.ReactNode;\n\n // This element will be rendered during loading\n loading?: React.ReactNode;\n\n // For testing purposes\n \"data-testid\"?: string;\n\n // An element that will trigger the confirmation dialog.\n children: (props: ChildrenRenderProp) => React.ReactNode;\n\n // Is `Confirm` button disabled\n disableConfirm?: boolean;\n\n // Dialog component's custom in-line styles.\n style?: React.CSSProperties;\n}\n\ninterface ConfirmationDialogState {\n show: boolean;\n loading: boolean;\n}\n\n/**\n * Use ConfirmationDialog component to display a list of choices, once the handler is triggered.\n */\nclass ConfirmationDialog extends React.Component<Props, ConfirmationDialogState> {\n static defaultProps = {\n title: \"Confirmation\",\n message: \"Are you sure you want to continue?\",\n loading: <CircularProgress />\n };\n\n __isMounted = false;\n\n callbacks: ConfirmationCallbacks = {\n onAccept: () => {\n return void 0;\n },\n onCancel: () => {\n return void 0;\n }\n };\n\n public override state = {\n show: false,\n loading: false\n };\n\n public override componentDidMount() {\n this.__isMounted = true;\n }\n\n public override componentWillUnmount() {\n this.__isMounted = false;\n }\n\n private readonly showConfirmation = (onAccept?: () => void, onCancel?: () => void) => {\n this.callbacks = {\n onAccept,\n onCancel\n };\n this.setState({ show: true });\n };\n\n private readonly hideConfirmation = () => {\n this.setState({ show: false });\n };\n\n private readonly onAccept = async () => {\n const { onAccept } = this.callbacks;\n if (typeof onAccept === \"function\") {\n this.setState({ loading: true });\n await onAccept();\n if (this.__isMounted) {\n this.setState({ loading: false, show: false });\n }\n }\n };\n\n private readonly onCancel = async () => {\n const { onCancel } = this.callbacks;\n if (typeof onCancel === \"function\") {\n await onCancel();\n }\n };\n\n public override render() {\n return (\n <React.Fragment>\n <Dialog\n style={this.props.style}\n open={this.state.show}\n onClose={this.hideConfirmation}\n data-testid={this.props[\"data-testid\"]}\n >\n {this.state.loading ? this.props.loading : null}\n <DialogTitle>{this.props.title}</DialogTitle>\n <DialogContent>{this.props.message}</DialogContent>\n <DialogActions>\n <DialogCancel onClick={this.onCancel}>Cancel</DialogCancel>\n <DialogButton\n data-testid=\"confirmationdialog-confirm-action\"\n onClick={this.onAccept}\n disabled={this.props.disableConfirm}\n >\n Confirm\n </DialogButton>\n </DialogActions>\n </Dialog>\n {this.props.children({\n showConfirmation: this.showConfirmation\n })}\n </React.Fragment>\n );\n }\n}\n\nexport { ConfirmationDialog };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AASA;;AAuCA;AACA;AACA;IACMA,kB;;;;;;;;;;;;;;;8FAOY,K;4FAEqB;MAC/BC,QAAQ,EAAE,oBAAM;QACZ,OAAO,KAAK,CAAZ;MACH,CAH8B;MAI/BC,QAAQ,EAAE,oBAAM;QACZ,OAAO,KAAK,CAAZ;MACH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E,KAAKC,KAAL,CAAWP,IAFrB;QAGI,OAAO,EAAE,KAAKQ,gBAHlB;QAII,eAAa,KAAKH,KAAL,CAAW,aAAX;MAJjB,GAMK,KAAKE,KAAL,CAAWN,OAAX,GAAqB,KAAKI,KAAL,CAAWJ,OAAhC,GAA0C,IAN/C,eAOI,6BAAC,mBAAD,QAAc,KAAKI,KAAL,CAAWI,KAAzB,CAPJ,eAQI,6BAAC,qBAAD,QAAgB,KAAKJ,KAAL,CAAWK,OAA3B,CARJ,eASI,6BAAC,qBAAD,qBACI,6BAAC,oBAAD;QAAc,OAAO,EAAE,KAAKX;MAA5B,YADJ,eAEI,6BAAC,oBAAD;QACI,eAAY,mCADhB;QAEI,OAAO,EAAE,KAAKD,QAFlB;QAGI,QAAQ,EAAE,KAAKO,KAAL,CAAWM;MAHzB,aAFJ,CATJ,CADJ,EAqBK,KAAKN,KAAL,CAAWO,QAAX,CAAoB;QACjBC,gBAAgB,EAAE,KAAKA;MADN,CAApB,CArBL,CADJ;IA2BH;;;EAzF4BC,cAAA,CAAMC,S;;;8BAAjClB,kB,kBACoB;EAClBY,KAAK,EAAE,cADW;EAElBC,OAAO,EAAE,oCAFS;EAGlBT,OAAO,eAAE,6BAAC,0BAAD;AAHS,C"}
|
|
@@ -1,19 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _react2 = require("@storybook/react");
|
|
8
|
+
|
|
9
|
+
var _Story = require("@webiny/storybook-utils/Story");
|
|
10
|
+
|
|
11
|
+
var _README = _interopRequireDefault(require("./../ConfirmationDialog/README.md"));
|
|
12
|
+
|
|
13
|
+
var _Button = require("./../Button");
|
|
14
|
+
|
|
15
|
+
var _ConfirmationDialog = require("./ConfirmationDialog");
|
|
16
|
+
|
|
17
|
+
var story = (0, _react2.storiesOf)("Components/ConfirmationDialog", module);
|
|
8
18
|
story.add("usage", function () {
|
|
9
|
-
return /*#__PURE__*/
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement(_Story.Story, null, /*#__PURE__*/_react.default.createElement(_Story.StoryReadme, null, _README.default), /*#__PURE__*/_react.default.createElement(_Story.StorySandbox, {
|
|
10
20
|
title: "Icon with and without ConfirmationDialog"
|
|
11
|
-
}, /*#__PURE__*/
|
|
21
|
+
}, /*#__PURE__*/_react.default.createElement(_Story.StorySandboxExample, null, /*#__PURE__*/_react.default.createElement(_ConfirmationDialog.ConfirmationDialog, {
|
|
12
22
|
title: "Pay Invoice",
|
|
13
23
|
message: "Are you sure you want pay this invoice?"
|
|
14
24
|
}, function (_ref) {
|
|
15
25
|
var showConfirmation = _ref.showConfirmation;
|
|
16
|
-
return /*#__PURE__*/
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement(_Button.ButtonPrimary, {
|
|
17
27
|
onClick: function onClick() {
|
|
18
28
|
showConfirmation(function () {
|
|
19
29
|
return console.log("Confirm");
|
|
@@ -22,9 +32,9 @@ story.add("usage", function () {
|
|
|
22
32
|
});
|
|
23
33
|
}
|
|
24
34
|
}, "Pay Invoice");
|
|
25
|
-
})), /*#__PURE__*/
|
|
35
|
+
})), /*#__PURE__*/_react.default.createElement(_Story.StorySandboxCode, null, "\n <ConfirmationDialog\n title=\"Pay Invoice\"\n message=\"Are you sure you want pay this invoice?\"\n >\n {({ showConfirmation }) => {\n return (\n <ButtonPrimary\n onClick={() => {\n showConfirmation(\n () => console.log(\"Confirm\"),\n () => console.log(\"Cancel\")\n );\n }}\n >\n Pay Invoice\n </ButtonPrimary>\n );\n }}\n </ConfirmationDialog>\n ")));
|
|
26
36
|
}, {
|
|
27
37
|
info: {
|
|
28
|
-
propTables: [ConfirmationDialog]
|
|
38
|
+
propTables: [_ConfirmationDialog.ConfirmationDialog]
|
|
29
39
|
}
|
|
30
40
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["story","storiesOf","module","add","readme","showConfirmation","console","log","info","propTables","ConfirmationDialog"],"sources":["ConfirmationDialog.stories.tsx"],"sourcesContent":["import React from \"react\";\nimport { storiesOf } from \"@storybook/react\";\nimport {\n Story,\n StoryReadme,\n StorySandboxCode,\n StorySandbox,\n StorySandboxExample\n} from \"@webiny/storybook-utils/Story\";\nimport readme from \"./../ConfirmationDialog/README.md\";\nimport { ButtonPrimary } from \"./../Button\";\nimport { ConfirmationDialog } from \"./ConfirmationDialog\";\n\nconst story = storiesOf(\"Components/ConfirmationDialog\", module);\n\nstory.add(\n \"usage\",\n () => {\n return (\n <Story>\n <StoryReadme>{readme}</StoryReadme>\n <StorySandbox title={\"Icon with and without ConfirmationDialog\"}>\n <StorySandboxExample>\n <ConfirmationDialog\n title=\"Pay Invoice\"\n message=\"Are you sure you want pay this invoice?\"\n >\n {({ showConfirmation }) => {\n return (\n <ButtonPrimary\n onClick={() => {\n showConfirmation(\n () => console.log(\"Confirm\"),\n () => console.log(\"Cancel\")\n );\n }}\n >\n Pay Invoice\n </ButtonPrimary>\n );\n }}\n </ConfirmationDialog>\n </StorySandboxExample>\n <StorySandboxCode>\n {`\n <ConfirmationDialog\n title=\"Pay Invoice\"\n message=\"Are you sure you want pay this invoice?\"\n >\n {({ showConfirmation }) => {\n return (\n <ButtonPrimary\n onClick={() => {\n showConfirmation(\n () => console.log(\"Confirm\"),\n () => console.log(\"Cancel\")\n );\n }}\n >\n Pay Invoice\n </ButtonPrimary>\n );\n }}\n </ConfirmationDialog>\n `}\n </StorySandboxCode>\n </StorySandbox>\n </Story>\n );\n },\n { info: { propTables: [ConfirmationDialog] } }\n);\n"],"mappings":";;;;AAAA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AAEA,IAAMA,KAAK,GAAG,IAAAC,iBAAA,EAAU,+BAAV,EAA2CC,MAA3C,CAAd;AAEAF,KAAK,CAACG,GAAN,CACI,OADJ,EAEI,YAAM;EACF,oBACI,6BAAC,YAAD,qBACI,6BAAC,kBAAD,QAAcC,eAAd,CADJ,eAEI,6BAAC,mBAAD;IAAc,KAAK,EAAE;EAArB,gBACI,6BAAC,0BAAD,qBACI,6BAAC,sCAAD;IACI,KAAK,EAAC,aADV;IAEI,OAAO,EAAC;EAFZ,GAIK,gBAA0B;IAAA,IAAvBC,gBAAuB,QAAvBA,gBAAuB;IACvB,oBACI,6BAAC,qBAAD;MACI,OAAO,EAAE,mBAAM;QACXA,gBAAgB,CACZ;UAAA,OAAMC,OAAO,CAACC,GAAR,CAAY,SAAZ,CAAN;QAAA,CADY,EAEZ;UAAA,OAAMD,OAAO,CAACC,GAAR,CAAY,QAAZ,CAAN;QAAA,CAFY,CAAhB;MAIH;IANL,iBADJ;EAYH,CAjBL,CADJ,CADJ,eAsBI,6BAAC,uBAAD,o7BAtBJ,CAFJ,CADJ;AAmDH,CAtDL,EAuDI;EAAEC,IAAI,EAAE;IAAEC,UAAU,EAAE,CAACC,sCAAD;EAAd;AAAR,CAvDJ"}
|
|
@@ -1,2 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _ConfirmationDialog = require("./ConfirmationDialog");
|
|
8
|
+
|
|
9
|
+
Object.keys(_ConfirmationDialog).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _ConfirmationDialog[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _ConfirmationDialog[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
var _withConfirmation = require("./withConfirmation");
|
|
21
|
+
|
|
22
|
+
Object.keys(_withConfirmation).forEach(function (key) {
|
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
|
24
|
+
if (key in exports && exports[key] === _withConfirmation[key]) return;
|
|
25
|
+
Object.defineProperty(exports, key, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function get() {
|
|
28
|
+
return _withConfirmation[key];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./ConfirmationDialog\";\nexport * from \"./withConfirmation\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
2
|
declare type ConfirmationProps = {
|
|
3
3
|
title?: React.ReactNode;
|
|
4
4
|
message?: React.ReactNode;
|
|
5
5
|
};
|
|
6
|
-
declare type WithConfirmationParams = (props: any) => ConfirmationProps;
|
|
6
|
+
declare type WithConfirmationParams = (props: Record<string, any>) => ConfirmationProps;
|
|
7
7
|
export declare type WithConfirmationProps = {
|
|
8
8
|
showConfirmation: (confirm: Function, cancel: Function) => void;
|
|
9
9
|
};
|
|
@@ -1,15 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.withConfirmation = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _ConfirmationDialog = require("./ConfirmationDialog");
|
|
13
|
+
|
|
14
|
+
var withConfirmation = function withConfirmation(dialogProps) {
|
|
4
15
|
return function (Component) {
|
|
5
16
|
return function withConfirmationRender(ownProps) {
|
|
6
17
|
var props = typeof dialogProps === "function" ? dialogProps(ownProps) : dialogProps;
|
|
7
|
-
return /*#__PURE__*/
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement(_ConfirmationDialog.ConfirmationDialog, props, function (_ref) {
|
|
8
19
|
var showConfirmation = _ref.showConfirmation;
|
|
9
|
-
return /*#__PURE__*/
|
|
20
|
+
return /*#__PURE__*/_react.default.createElement(Component, Object.assign({}, ownProps, {
|
|
10
21
|
showConfirmation: showConfirmation
|
|
11
22
|
}));
|
|
12
23
|
});
|
|
13
24
|
};
|
|
14
25
|
};
|
|
15
|
-
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.withConfirmation = withConfirmation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["withConfirmation","dialogProps","Component","withConfirmationRender","ownProps","props","showConfirmation"],"sources":["withConfirmation.tsx"],"sourcesContent":["import React from \"react\";\nimport { ConfirmationDialog } from \"./ConfirmationDialog\";\n\ntype ConfirmationProps = {\n title?: React.ReactNode;\n message?: React.ReactNode;\n};\n\ntype WithConfirmationParams = (props: Record<string, any>) => ConfirmationProps;\n\nexport type WithConfirmationProps = {\n showConfirmation: (confirm: Function, cancel: Function) => void;\n};\n\nexport const withConfirmation = (dialogProps: WithConfirmationParams): Function => {\n return (Component: typeof React.Component) => {\n return function withConfirmationRender(ownProps: Record<string, any>) {\n const props = typeof dialogProps === \"function\" ? dialogProps(ownProps) : dialogProps;\n return (\n <ConfirmationDialog {...props}>\n {({ showConfirmation }) => (\n <Component {...ownProps} showConfirmation={showConfirmation} />\n )}\n </ConfirmationDialog>\n );\n };\n };\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAaO,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAmB,CAACC,WAAD,EAAmD;EAC/E,OAAO,UAACC,SAAD,EAAuC;IAC1C,OAAO,SAASC,sBAAT,CAAgCC,QAAhC,EAA+D;MAClE,IAAMC,KAAK,GAAG,OAAOJ,WAAP,KAAuB,UAAvB,GAAoCA,WAAW,CAACG,QAAD,CAA/C,GAA4DH,WAA1E;MACA,oBACI,6BAAC,sCAAD,EAAwBI,KAAxB,EACK;QAAA,IAAGC,gBAAH,QAAGA,gBAAH;QAAA,oBACG,6BAAC,SAAD,oBAAeF,QAAf;UAAyB,gBAAgB,EAAEE;QAA3C,GADH;MAAA,CADL,CADJ;IAOH,CATD;EAUH,CAXD;AAYH,CAbM"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DataTableCellProps } from "@rmwc/data-table";
|
|
3
|
+
import "@rmwc/data-table/data-table.css";
|
|
4
|
+
interface Column<T> {
|
|
5
|
+
header: string | number | JSX.Element;
|
|
6
|
+
cell?: (row: T) => string | number | JSX.Element;
|
|
7
|
+
meta?: DataTableCellProps;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare type Columns<T> = {
|
|
11
|
+
[P in keyof T]?: Column<T>;
|
|
12
|
+
};
|
|
13
|
+
interface Props<T> {
|
|
14
|
+
columns: Columns<T>;
|
|
15
|
+
data: T[];
|
|
16
|
+
onSelectRow?: (rows: T[] | []) => void;
|
|
17
|
+
loadingInitial?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const DataTable: <T>({ data, columns, onSelectRow, loadingInitial }: Props<T>) => JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.DataTable = void 0;
|
|
11
|
+
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
|
+
|
|
16
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
20
|
+
var _dataTable = require("@rmwc/data-table");
|
|
21
|
+
|
|
22
|
+
var _reactTable = require("@tanstack/react-table");
|
|
23
|
+
|
|
24
|
+
var _Checkbox = require("../Checkbox");
|
|
25
|
+
|
|
26
|
+
var _Skeleton = require("../Skeleton");
|
|
27
|
+
|
|
28
|
+
require("@rmwc/data-table/data-table.css");
|
|
29
|
+
|
|
30
|
+
var _styled = require("./styled");
|
|
31
|
+
|
|
32
|
+
var defineColumns = function defineColumns(columns, onSelectRow, loadingInitial) {
|
|
33
|
+
return (0, _react.useMemo)(function () {
|
|
34
|
+
var columnsList = Object.keys(columns).map(function (key) {
|
|
35
|
+
return (0, _objectSpread2.default)({
|
|
36
|
+
id: key
|
|
37
|
+
}, columns[key]);
|
|
38
|
+
});
|
|
39
|
+
var defaults = columnsList.map(function (column) {
|
|
40
|
+
var id = column.id,
|
|
41
|
+
_header = column.header,
|
|
42
|
+
meta = column.meta,
|
|
43
|
+
_cell = column.cell;
|
|
44
|
+
return {
|
|
45
|
+
accessorKey: id,
|
|
46
|
+
header: function header() {
|
|
47
|
+
return _header;
|
|
48
|
+
},
|
|
49
|
+
cell: function cell(info) {
|
|
50
|
+
if (_cell && typeof _cell === "function") {
|
|
51
|
+
return _cell(info.row.original);
|
|
52
|
+
} else {
|
|
53
|
+
return info.getValue();
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
meta: meta
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
var select = !!onSelectRow ? [{
|
|
60
|
+
id: "datatable-select-column",
|
|
61
|
+
header: function header(_ref) {
|
|
62
|
+
var table = _ref.table;
|
|
63
|
+
return !loadingInitial && /*#__PURE__*/_react.default.createElement(_Checkbox.Checkbox, {
|
|
64
|
+
indeterminate: table.getIsSomeRowsSelected(),
|
|
65
|
+
value: table.getIsAllRowsSelected(),
|
|
66
|
+
onChange: function onChange(e) {
|
|
67
|
+
return table.toggleAllPageRowsSelected(e);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
cell: function cell(_ref2) {
|
|
72
|
+
var row = _ref2.row;
|
|
73
|
+
return /*#__PURE__*/_react.default.createElement(_Checkbox.Checkbox, {
|
|
74
|
+
indeterminate: row.getIsSomeSelected(),
|
|
75
|
+
value: row.getIsSelected(),
|
|
76
|
+
onChange: row.getToggleSelectedHandler()
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
meta: {
|
|
80
|
+
hasFormControl: true,
|
|
81
|
+
className: "datatable-select-column"
|
|
82
|
+
}
|
|
83
|
+
}] : [];
|
|
84
|
+
return [].concat(select, (0, _toConsumableArray2.default)(defaults)).map(function (column) {
|
|
85
|
+
if (loadingInitial) {
|
|
86
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, column), {}, {
|
|
87
|
+
cell: function cell() {
|
|
88
|
+
return /*#__PURE__*/_react.default.createElement(_Skeleton.Skeleton, null);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return column;
|
|
94
|
+
});
|
|
95
|
+
}, [columns, onSelectRow, loadingInitial]);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
var defineData = function defineData(data, loadingInitial) {
|
|
99
|
+
return (0, _react.useMemo)(function () {
|
|
100
|
+
if (loadingInitial) {
|
|
101
|
+
return Array(10).fill({});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return data;
|
|
105
|
+
}, [data, loadingInitial]);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
var DataTable = function DataTable(_ref3) {
|
|
109
|
+
var data = _ref3.data,
|
|
110
|
+
columns = _ref3.columns,
|
|
111
|
+
onSelectRow = _ref3.onSelectRow,
|
|
112
|
+
loadingInitial = _ref3.loadingInitial;
|
|
113
|
+
|
|
114
|
+
var _React$useState = _react.default.useState({}),
|
|
115
|
+
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
|
116
|
+
rowSelection = _React$useState2[0],
|
|
117
|
+
setRowSelection = _React$useState2[1];
|
|
118
|
+
|
|
119
|
+
var table = (0, _reactTable.useReactTable)({
|
|
120
|
+
data: defineData(data, loadingInitial),
|
|
121
|
+
columns: defineColumns(columns, onSelectRow, loadingInitial),
|
|
122
|
+
getCoreRowModel: (0, _reactTable.getCoreRowModel)(),
|
|
123
|
+
state: {
|
|
124
|
+
rowSelection: rowSelection
|
|
125
|
+
},
|
|
126
|
+
enableRowSelection: !!onSelectRow,
|
|
127
|
+
onRowSelectionChange: setRowSelection
|
|
128
|
+
});
|
|
129
|
+
(0, _react.useEffect)(function () {
|
|
130
|
+
if (onSelectRow && typeof onSelectRow === "function") {
|
|
131
|
+
var dataSelected = table.getSelectedRowModel().flatRows.map(function (row) {
|
|
132
|
+
return row.original;
|
|
133
|
+
});
|
|
134
|
+
onSelectRow(dataSelected);
|
|
135
|
+
}
|
|
136
|
+
}, [rowSelection]);
|
|
137
|
+
return /*#__PURE__*/_react.default.createElement(_styled.Table, null, /*#__PURE__*/_react.default.createElement(_dataTable.DataTableContent, null, /*#__PURE__*/_react.default.createElement(_dataTable.DataTableHead, null, table.getHeaderGroups().map(function (headerGroup) {
|
|
138
|
+
return /*#__PURE__*/_react.default.createElement(_dataTable.DataTableRow, {
|
|
139
|
+
key: headerGroup.id
|
|
140
|
+
}, headerGroup.headers.map(function (header) {
|
|
141
|
+
return /*#__PURE__*/_react.default.createElement(_dataTable.DataTableHeadCell, Object.assign({
|
|
142
|
+
key: header.id
|
|
143
|
+
}, header.column.columnDef.meta), header.isPlaceholder ? null : (0, _reactTable.flexRender)(header.column.columnDef.header, header.getContext()));
|
|
144
|
+
}));
|
|
145
|
+
})), /*#__PURE__*/_react.default.createElement(_dataTable.DataTableBody, null, table.getRowModel().rows.map(function (row) {
|
|
146
|
+
return /*#__PURE__*/_react.default.createElement(_dataTable.DataTableRow, {
|
|
147
|
+
key: row.id,
|
|
148
|
+
selected: rowSelection.hasOwnProperty(row.index)
|
|
149
|
+
}, row.getVisibleCells().map(function (cell) {
|
|
150
|
+
return /*#__PURE__*/_react.default.createElement(_dataTable.DataTableCell, Object.assign({
|
|
151
|
+
key: cell.id
|
|
152
|
+
}, cell.column.columnDef.meta), (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext()));
|
|
153
|
+
}));
|
|
154
|
+
}))));
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
exports.DataTable = DataTable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["defineColumns","columns","onSelectRow","loadingInitial","useMemo","columnsList","Object","keys","map","key","id","defaults","column","header","meta","cell","accessorKey","info","row","original","getValue","select","table","getIsSomeRowsSelected","getIsAllRowsSelected","e","toggleAllPageRowsSelected","getIsSomeSelected","getIsSelected","getToggleSelectedHandler","hasFormControl","className","defineData","data","Array","fill","DataTable","React","useState","rowSelection","setRowSelection","useReactTable","getCoreRowModel","state","enableRowSelection","onRowSelectionChange","useEffect","dataSelected","getSelectedRowModel","flatRows","getHeaderGroups","headerGroup","headers","columnDef","isPlaceholder","flexRender","getContext","getRowModel","rows","hasOwnProperty","index","getVisibleCells"],"sources":["DataTable.tsx"],"sourcesContent":["import React, { useEffect, useMemo } from \"react\";\nimport {\n DataTableContent,\n DataTableHead,\n DataTableRow,\n DataTableHeadCell,\n DataTableBody,\n DataTableCell,\n DataTableCellProps\n} from \"@rmwc/data-table\";\n\nimport { flexRender, getCoreRowModel, useReactTable, ColumnDef } from \"@tanstack/react-table\";\n\nimport { Checkbox } from \"~/Checkbox\";\nimport { Skeleton } from \"~/Skeleton\";\n\nimport \"@rmwc/data-table/data-table.css\";\nimport { Table } from \"./styled\";\n\ninterface Column<T> {\n /*\n * Column header component.\n */\n header: string | number | JSX.Element;\n /*\n * Cell renderer, receives the full row and returns the value to render inside the cell.\n */\n cell?: (row: T) => string | number | JSX.Element;\n /*\n * Additional props to add to both header and row cells. Refer to RMWC documentation.\n */\n meta?: DataTableCellProps;\n /*\n * Column class names.\n */\n className?: string;\n}\n\nexport type Columns<T> = {\n [P in keyof T]?: Column<T>;\n};\n\ninterface Props<T> {\n /*\n * Columns definition.\n */\n columns: Columns<T>;\n /*\n * Data to display into DataTable body.\n */\n data: T[];\n /*\n * Callback that receives the selected rows.\n */\n onSelectRow?: (rows: T[] | []) => void;\n /*\n * Render the skeleton state at the initial data loading.\n */\n loadingInitial?: boolean;\n}\n\nconst defineColumns = <T,>(\n columns: Props<T>[\"columns\"],\n onSelectRow: Props<T>[\"onSelectRow\"],\n loadingInitial: Props<T>[\"loadingInitial\"]\n): ColumnDef<T>[] =>\n useMemo(() => {\n const columnsList = Object.keys(columns).map(key => ({\n id: key,\n ...columns[key as keyof typeof columns]\n }));\n\n const defaults: ColumnDef<T>[] = columnsList.map(column => {\n const { id, header, meta, cell } = column;\n\n return {\n accessorKey: id,\n header: () => header,\n cell: info => {\n if (cell && typeof cell === \"function\") {\n return cell(info.row.original);\n } else {\n return info.getValue();\n }\n },\n meta\n };\n });\n\n const select: ColumnDef<T>[] = !!onSelectRow\n ? [\n {\n id: \"datatable-select-column\",\n header: ({ table }) =>\n !loadingInitial && (\n <Checkbox\n indeterminate={table.getIsSomeRowsSelected()}\n value={table.getIsAllRowsSelected()}\n onChange={e => table.toggleAllPageRowsSelected(e)}\n />\n ),\n cell: ({ row }) => (\n <Checkbox\n indeterminate={row.getIsSomeSelected()}\n value={row.getIsSelected()}\n onChange={row.getToggleSelectedHandler()}\n />\n ),\n meta: {\n hasFormControl: true,\n className: \"datatable-select-column\"\n }\n }\n ]\n : [];\n\n return [...select, ...defaults].map(column => {\n if (loadingInitial) {\n return {\n ...column,\n cell: () => <Skeleton />\n };\n }\n\n return column;\n });\n }, [columns, onSelectRow, loadingInitial]);\n\nconst defineData = <T,>(\n data: Props<T>[\"data\"],\n loadingInitial: Props<T>[\"loadingInitial\"]\n): T[] => {\n return useMemo(() => {\n if (loadingInitial) {\n return Array(10).fill({});\n }\n return data;\n }, [data, loadingInitial]);\n};\n\nexport const DataTable = <T,>({ data, columns, onSelectRow, loadingInitial }: Props<T>) => {\n const [rowSelection, setRowSelection] = React.useState({});\n\n const table = useReactTable({\n data: defineData(data, loadingInitial),\n columns: defineColumns(columns, onSelectRow, loadingInitial),\n getCoreRowModel: getCoreRowModel(),\n state: {\n rowSelection\n },\n enableRowSelection: !!onSelectRow,\n onRowSelectionChange: setRowSelection\n });\n\n useEffect(() => {\n if (onSelectRow && typeof onSelectRow === \"function\") {\n const dataSelected = table.getSelectedRowModel().flatRows.map(row => row.original);\n onSelectRow(dataSelected);\n }\n }, [rowSelection]);\n\n return (\n <Table>\n <DataTableContent>\n <DataTableHead>\n {table.getHeaderGroups().map(headerGroup => (\n <DataTableRow key={headerGroup.id}>\n {headerGroup.headers.map(header => (\n <DataTableHeadCell\n key={header.id}\n {...header.column.columnDef.meta}\n >\n {header.isPlaceholder\n ? null\n : flexRender(\n header.column.columnDef.header,\n header.getContext()\n )}\n </DataTableHeadCell>\n ))}\n </DataTableRow>\n ))}\n </DataTableHead>\n <DataTableBody>\n {table.getRowModel().rows.map(row => (\n <DataTableRow\n key={row.id}\n selected={rowSelection.hasOwnProperty(row.index)}\n >\n {row.getVisibleCells().map(cell => (\n <DataTableCell key={cell.id} {...cell.column.columnDef.meta}>\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </DataTableCell>\n ))}\n </DataTableRow>\n ))}\n </DataTableBody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