@moosend/mooskin 1.1.4 → 1.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ActionsDropdown/ActionsDropdown.d.ts +2 -2
- package/lib/ActionsDropdown/model.d.ts +2 -2
- package/lib/ActionsDropdown/styles.d.ts +2 -2
- package/lib/Alert/Alert.d.ts +1 -1
- package/lib/Alert/model.d.ts +1 -1
- package/lib/Alert/styles.d.ts +1 -1
- package/lib/Anchor/Anchor.d.ts +1 -1
- package/lib/Anchor/model.d.ts +1 -1
- package/lib/Anchor/styles.d.ts +1 -1
- package/lib/Box/Box.d.ts +1 -1
- package/lib/Box/model.d.ts +6 -1
- package/lib/Box/styles.d.ts +2 -2
- package/lib/Button/Button.d.ts +2 -2
- package/lib/Button/model.d.ts +3 -1
- package/lib/Button/styles.d.ts +1 -1
- package/lib/Carousel/Carousel.d.ts +2 -2
- package/lib/Carousel/styles.d.ts +1 -1
- package/lib/Checkbox/Checkbox.d.ts +3 -3
- package/lib/Checkbox/model.d.ts +2 -2
- package/lib/Checkbox/styles.d.ts +2 -2
- package/lib/DatePicker/DatePicker.d.ts +1 -1
- package/lib/DatePicker/model.d.ts +10 -10
- package/lib/DateRange/DateRange.d.ts +1 -1
- package/lib/DateRange/model.d.ts +3 -3
- package/lib/DateRange/styles.d.ts +1 -1
- package/lib/DateSelect/DateSelect.d.ts +1 -1
- package/lib/DateSelect/model.d.ts +1 -1
- package/lib/DateTimePicker/DateTimePicker.d.ts +1 -1
- package/lib/DateTimePicker/model.d.ts +9 -5
- package/lib/Description/Description.d.ts +1 -1
- package/lib/Description/styles.d.ts +1 -1
- package/lib/Drawer/Drawer.d.ts +2 -2
- package/lib/Drawer/model.d.ts +1 -1
- package/lib/Drawer/styles.d.ts +3 -3
- package/lib/Expandable/Expandable.d.ts +2 -2
- package/lib/Expandable/model.d.ts +1 -1
- package/lib/Expandable/styles.d.ts +2 -2
- package/lib/Footer/Footer.d.ts +1 -1
- package/lib/Footer/styles.d.ts +1 -1
- package/lib/Grid/Grid.d.ts +1 -1
- package/lib/Grid/model.d.ts +1 -1
- package/lib/Grid/styles.d.ts +1 -1
- package/lib/IconButton/IconButton.d.ts +1 -1
- package/lib/IconButton/model.d.ts +1 -1
- package/lib/IconButton/styles.d.ts +1 -1
- package/lib/Image/Image.d.ts +1 -1
- package/lib/Input/Input.d.ts +2 -2
- package/lib/Input/model.d.ts +2 -2
- package/lib/Input/styles.d.ts +2 -2
- package/lib/Label/Label.d.ts +1 -1
- package/lib/Label/model.d.ts +1 -1
- package/lib/Label/styles.d.ts +1 -1
- package/lib/Layout/Layout.d.ts +1 -1
- package/lib/Layout/model.d.ts +1 -1
- package/lib/Layout/styles.d.ts +1 -1
- package/lib/List/List.d.ts +2 -2
- package/lib/List/styles.d.ts +1 -1
- package/lib/Loader/Loader.d.ts +1 -1
- package/lib/Loader/model.d.ts +1 -1
- package/lib/Loader/styles.d.ts +1 -1
- package/lib/LoadingBar/LoadingBar.d.ts +1 -1
- package/lib/LoadingBar/model.d.ts +1 -1
- package/lib/LoadingBar/styles.d.ts +1 -1
- package/lib/Modal/Modal.d.ts +2 -2
- package/lib/Modal/model.d.ts +1 -1
- package/lib/Modal/styles.d.ts +2 -2
- package/lib/NumberLabel/NumberLabel.d.ts +1 -1
- package/lib/NumberLabel/model.d.ts +1 -1
- package/lib/Pagination/Pagination.d.ts +1 -1
- package/lib/Pagination/model.d.ts +1 -1
- package/lib/Pagination/styles.d.ts +2 -2
- package/lib/Radio/Radio.d.ts +3 -3
- package/lib/Radio/model.d.ts +2 -2
- package/lib/Radio/styles.d.ts +1 -1
- package/lib/Select/Select.d.ts +2 -2
- package/lib/Select/model.d.ts +5 -2
- package/lib/Select/styles.d.ts +2 -2
- package/lib/Selector/Selector.d.ts +1 -1
- package/lib/Selector/model.d.ts +1 -1
- package/lib/Selector/styles.d.ts +1 -1
- package/lib/Sidemenu/Sidemenu.d.ts +1 -1
- package/lib/Sidemenu/model.d.ts +1 -1
- package/lib/Sidemenu/styles.d.ts +1 -1
- package/lib/Skeleton/Skeleton.d.ts +1 -1
- package/lib/Skeleton/model.d.ts +1 -1
- package/lib/Skeleton/styles.d.ts +1 -1
- package/lib/Slider/Slider.d.ts +1 -1
- package/lib/Slider/{Model.d.ts → model.d.ts} +2 -2
- package/lib/Slider/styles.d.ts +1 -1
- package/lib/Stack/Stack.d.ts +1 -1
- package/lib/Stack/model.d.ts +1 -1
- package/lib/Stack/styles.d.ts +1 -1
- package/lib/Steps/Steps.d.ts +1 -1
- package/lib/Steps/model.d.ts +1 -1
- package/lib/Steps/styles.d.ts +1 -1
- package/lib/Styled/MooskinContextProvider.d.ts +1 -1
- package/lib/Styled/model.d.ts +2 -2
- package/lib/Switch/Switch.d.ts +1 -1
- package/lib/Switch/model.d.ts +2 -2
- package/lib/Switch/styles.d.ts +1 -1
- package/lib/Table/Table.d.ts +1 -1
- package/lib/Table/styles.d.ts +1 -1
- package/lib/Tabs/Tabs.d.ts +1 -1
- package/lib/Tabs/model.d.ts +1 -1
- package/lib/Tabs/styles.d.ts +1 -1
- package/lib/Tags/Tags.d.ts +2 -2
- package/lib/Tags/model.d.ts +2 -2
- package/lib/Tags/styles.d.ts +2 -2
- package/lib/Text/Text.d.ts +1 -1
- package/lib/Text/model.d.ts +1 -1
- package/lib/Text/styles.d.ts +1 -1
- package/lib/TextArea/TextArea.d.ts +1 -1
- package/lib/TextArea/model.d.ts +1 -1
- package/lib/TextEditor/TextEditor.d.ts +1 -1
- package/lib/TextEditor/model.d.ts +5 -1
- package/lib/_utils/globals/variables.d.ts +1 -1
- package/lib/_utils/helper.d.ts +1 -1
- package/lib/_utils/index.d.ts +1 -3
- package/lib/_utils/test-setup.d.ts +1 -0
- package/lib/components/ActionsDropdown/ActionsDropdown.d.ts +2 -2
- package/lib/components/ActionsDropdown/ActionsDropdown.js +82 -0
- package/lib/components/ActionsDropdown/ActionsDropdown.js.map +1 -0
- package/lib/components/ActionsDropdown/ActionsDropdown.spec.js +35 -0
- package/lib/components/ActionsDropdown/ActionsDropdown.spec.js.map +1 -0
- package/lib/components/ActionsDropdown/model.d.ts +2 -2
- package/lib/components/ActionsDropdown/model.js +2 -0
- package/lib/components/ActionsDropdown/model.js.map +1 -0
- package/lib/components/ActionsDropdown/styles.d.ts +2 -2
- package/lib/components/ActionsDropdown/styles.js +94 -0
- package/lib/components/ActionsDropdown/styles.js.map +1 -0
- package/lib/components/Alert/Alert.d.ts +1 -1
- package/lib/components/Alert/Alert.js +105 -0
- package/lib/components/Alert/Alert.js.map +1 -0
- package/lib/components/Alert/Alert.spec.js +39 -0
- package/lib/components/Alert/Alert.spec.js.map +1 -0
- package/lib/components/Alert/model.d.ts +1 -1
- package/lib/components/Alert/model.js +2 -0
- package/lib/components/Alert/model.js.map +1 -0
- package/lib/components/Alert/styles.d.ts +1 -1
- package/lib/components/Alert/styles.js +126 -0
- package/lib/components/Alert/styles.js.map +1 -0
- package/lib/components/Anchor/Anchor.d.ts +1 -1
- package/lib/components/Anchor/Anchor.js +27 -0
- package/lib/components/Anchor/Anchor.js.map +1 -0
- package/lib/components/Anchor/Anchor.spec.d.ts +1 -0
- package/lib/components/Anchor/Anchor.spec.js +31 -0
- package/lib/components/Anchor/Anchor.spec.js.map +1 -0
- package/lib/components/Anchor/model.d.ts +1 -1
- package/lib/components/Anchor/model.js +2 -0
- package/lib/components/Anchor/model.js.map +1 -0
- package/lib/components/Anchor/styles.d.ts +1 -1
- package/lib/components/Anchor/styles.js +18 -0
- package/lib/components/Anchor/styles.js.map +1 -0
- package/lib/components/Box/Box.d.ts +1 -1
- package/lib/components/Box/Box.js +51 -0
- package/lib/components/Box/Box.js.map +1 -0
- package/lib/components/Box/Box.spec.d.ts +1 -0
- package/lib/components/Box/Box.spec.js +10 -0
- package/lib/components/Box/Box.spec.js.map +1 -0
- package/lib/components/Box/model.d.ts +6 -1
- package/lib/components/Box/model.js +103 -0
- package/lib/components/Box/model.js.map +1 -0
- package/lib/components/Box/resources.js +311 -0
- package/lib/components/Box/resources.js.map +1 -0
- package/lib/components/Box/styles.d.ts +3 -3
- package/lib/components/Box/styles.js +290 -0
- package/lib/components/Box/styles.js.map +1 -0
- package/lib/components/Button/Button.d.ts +2 -2
- package/lib/components/Button/Button.js +72 -0
- package/lib/components/Button/Button.js.map +1 -0
- package/lib/components/Button/Button.spec.d.ts +1 -0
- package/lib/components/Button/Button.spec.js +29 -0
- package/lib/components/Button/Button.spec.js.map +1 -0
- package/lib/components/Button/model.d.ts +3 -1
- package/lib/components/Button/model.js +2 -0
- package/lib/components/Button/model.js.map +1 -0
- package/lib/components/Button/styles.d.ts +1 -1
- package/lib/components/Button/styles.js +84 -0
- package/lib/components/Button/styles.js.map +1 -0
- package/lib/components/Carousel/Carousel.d.ts +2 -2
- package/lib/components/Carousel/Carousel.js +30 -0
- package/lib/components/Carousel/Carousel.js.map +1 -0
- package/lib/components/Carousel/Carousel.spec.d.ts +1 -0
- package/lib/components/Carousel/Carousel.spec.js +12 -0
- package/lib/components/Carousel/Carousel.spec.js.map +1 -0
- package/lib/components/Carousel/model.js +2 -0
- package/lib/components/Carousel/model.js.map +1 -0
- package/lib/components/Carousel/styles.d.ts +1 -1
- package/lib/components/Carousel/styles.js +18 -0
- package/lib/components/Carousel/styles.js.map +1 -0
- package/lib/components/Checkbox/Checkbox.d.ts +3 -3
- package/lib/components/Checkbox/Checkbox.js +83 -0
- package/lib/components/Checkbox/Checkbox.js.map +1 -0
- package/lib/components/Checkbox/Checkbox.spec.d.ts +1 -0
- package/lib/components/Checkbox/Checkbox.spec.js +29 -0
- package/lib/components/Checkbox/Checkbox.spec.js.map +1 -0
- package/lib/components/Checkbox/model.d.ts +2 -2
- package/lib/components/Checkbox/model.js +2 -0
- package/lib/components/Checkbox/model.js.map +1 -0
- package/lib/components/Checkbox/styles.d.ts +2 -2
- package/lib/components/Checkbox/styles.js +35 -0
- package/lib/components/Checkbox/styles.js.map +1 -0
- package/lib/components/DatePicker/DatePicker.d.ts +1 -1
- package/lib/components/DatePicker/DatePicker.js +45 -0
- package/lib/components/DatePicker/DatePicker.js.map +1 -0
- package/lib/components/DatePicker/DatePicker.spec.d.ts +1 -0
- package/lib/components/DatePicker/DatePicker.spec.js +11 -0
- package/lib/components/DatePicker/DatePicker.spec.js.map +1 -0
- package/lib/components/DatePicker/model.d.ts +10 -10
- package/lib/components/DatePicker/model.js +2 -0
- package/lib/components/DatePicker/model.js.map +1 -0
- package/lib/components/DateRange/DateRange.d.ts +1 -1
- package/lib/components/DateRange/DateRange.js +51 -0
- package/lib/components/DateRange/DateRange.js.map +1 -0
- package/lib/components/DateRange/DateRange.spec.d.ts +1 -0
- package/lib/components/DateRange/DateRange.spec.js +18 -0
- package/lib/components/DateRange/DateRange.spec.js.map +1 -0
- package/lib/components/DateRange/model.d.ts +3 -3
- package/lib/components/DateRange/model.js +2 -0
- package/lib/components/DateRange/model.js.map +1 -0
- package/lib/components/DateRange/styles.d.ts +1 -1
- package/lib/components/DateRange/styles.js +58 -0
- package/lib/components/DateRange/styles.js.map +1 -0
- package/lib/components/DateSelect/DateSelect.d.ts +1 -1
- package/lib/components/DateSelect/DateSelect.js +153 -0
- package/lib/components/DateSelect/DateSelect.js.map +1 -0
- package/lib/components/DateSelect/DateSelect.spec.d.ts +1 -0
- package/lib/components/DateSelect/DateSelect.spec.js +78 -0
- package/lib/components/DateSelect/DateSelect.spec.js.map +1 -0
- package/lib/components/DateSelect/model.d.ts +1 -1
- package/lib/components/DateSelect/model.js +2 -0
- package/lib/components/DateSelect/model.js.map +1 -0
- package/lib/components/DateTimePicker/DateTimePicker.d.ts +1 -1
- package/lib/components/DateTimePicker/DateTimePicker.js +45 -0
- package/lib/components/DateTimePicker/DateTimePicker.js.map +1 -0
- package/lib/components/DateTimePicker/DateTimePicker.spec.d.ts +1 -0
- package/lib/components/DateTimePicker/DateTimePicker.spec.js +11 -0
- package/lib/components/DateTimePicker/DateTimePicker.spec.js.map +1 -0
- package/lib/components/DateTimePicker/model.d.ts +9 -5
- package/lib/components/DateTimePicker/model.js +2 -0
- package/lib/components/DateTimePicker/model.js.map +1 -0
- package/lib/components/Description/Description.d.ts +1 -1
- package/lib/components/Description/Description.js +22 -0
- package/lib/components/Description/Description.js.map +1 -0
- package/lib/components/Description/Description.spec.d.ts +1 -0
- package/lib/components/Description/Description.spec.js +10 -0
- package/lib/components/Description/Description.spec.js.map +1 -0
- package/lib/components/Description/styles.d.ts +1 -1
- package/lib/components/Description/styles.js +11 -0
- package/lib/components/Description/styles.js.map +1 -0
- package/lib/components/Drawer/Drawer.d.ts +2 -2
- package/lib/components/Drawer/Drawer.js +146 -0
- package/lib/components/Drawer/Drawer.js.map +1 -0
- package/lib/components/Drawer/Drawer.spec.d.ts +1 -0
- package/lib/components/Drawer/Drawer.spec.js +34 -0
- package/lib/components/Drawer/Drawer.spec.js.map +1 -0
- package/lib/components/Drawer/model.d.ts +1 -1
- package/lib/components/Drawer/model.js +2 -0
- package/lib/components/Drawer/model.js.map +1 -0
- package/lib/components/Drawer/styles.d.ts +3 -3
- package/lib/components/Drawer/styles.js +202 -0
- package/lib/components/Drawer/styles.js.map +1 -0
- package/lib/components/Expandable/Expandable.d.ts +2 -2
- package/lib/components/Expandable/Expandable.js +117 -0
- package/lib/components/Expandable/Expandable.js.map +1 -0
- package/lib/components/Expandable/Expandable.spec.d.ts +1 -0
- package/lib/components/Expandable/Expandable.spec.js +67 -0
- package/lib/components/Expandable/Expandable.spec.js.map +1 -0
- package/lib/components/Expandable/model.d.ts +1 -1
- package/lib/components/Expandable/model.js +2 -0
- package/lib/components/Expandable/model.js.map +1 -0
- package/lib/components/Expandable/styles.d.ts +2 -2
- package/lib/components/Expandable/styles.js +45 -0
- package/lib/components/Expandable/styles.js.map +1 -0
- package/lib/components/Footer/Footer.d.ts +1 -1
- package/lib/components/Footer/Footer.js +37 -0
- package/lib/components/Footer/Footer.js.map +1 -0
- package/lib/components/Footer/Footer.spec.d.ts +1 -0
- package/lib/components/Footer/Footer.spec.js +21 -0
- package/lib/components/Footer/Footer.spec.js.map +1 -0
- package/lib/components/Footer/styles.d.ts +1 -1
- package/lib/components/Footer/styles.js +34 -0
- package/lib/components/Footer/styles.js.map +1 -0
- package/lib/components/Grid/Grid.d.ts +1 -1
- package/lib/components/Grid/Grid.js +30 -0
- package/lib/components/Grid/Grid.js.map +1 -0
- package/lib/components/Grid/Grid.spec.d.ts +1 -0
- package/lib/components/Grid/Grid.spec.js +51 -0
- package/lib/components/Grid/Grid.spec.js.map +1 -0
- package/lib/components/Grid/model.d.ts +1 -1
- package/lib/components/Grid/model.js +2 -0
- package/lib/components/Grid/model.js.map +1 -0
- package/lib/components/Grid/styles.d.ts +1 -1
- package/lib/components/Grid/styles.js +76 -0
- package/lib/components/Grid/styles.js.map +1 -0
- package/lib/components/IconButton/IconButton.d.ts +1 -1
- package/lib/components/IconButton/IconButton.js +26 -0
- package/lib/components/IconButton/IconButton.js.map +1 -0
- package/lib/components/IconButton/IconButton.spec.d.ts +1 -0
- package/lib/components/IconButton/IconButton.spec.js +23 -0
- package/lib/components/IconButton/IconButton.spec.js.map +1 -0
- package/lib/components/IconButton/model.d.ts +1 -1
- package/lib/components/IconButton/model.js +2 -0
- package/lib/components/IconButton/model.js.map +1 -0
- package/lib/components/IconButton/styles.d.ts +1 -1
- package/lib/components/IconButton/styles.js +14 -0
- package/lib/components/IconButton/styles.js.map +1 -0
- package/lib/components/Image/Image.d.ts +1 -1
- package/lib/components/Image/Image.js +20 -0
- package/lib/components/Image/Image.js.map +1 -0
- package/lib/components/Image/Image.spec.d.ts +1 -0
- package/lib/components/Image/Image.spec.js +10 -0
- package/lib/components/Image/Image.spec.js.map +1 -0
- package/lib/components/Image/styles.js +7 -0
- package/lib/components/Image/styles.js.map +1 -0
- package/lib/components/Input/Input.d.ts +2 -2
- package/lib/components/Input/Input.js +141 -0
- package/lib/components/Input/Input.js.map +1 -0
- package/lib/components/Input/Input.spec.d.ts +1 -0
- package/lib/components/Input/Input.spec.js +80 -0
- package/lib/components/Input/Input.spec.js.map +1 -0
- package/lib/components/Input/model.d.ts +2 -2
- package/lib/components/Input/model.js +2 -0
- package/lib/components/Input/model.js.map +1 -0
- package/lib/components/Input/styles.d.ts +2 -2
- package/lib/components/Input/styles.js +99 -0
- package/lib/components/Input/styles.js.map +1 -0
- package/lib/components/Label/Label.d.ts +1 -1
- package/lib/components/Label/Label.js +31 -0
- package/lib/components/Label/Label.js.map +1 -0
- package/lib/components/Label/Label.spec.d.ts +1 -0
- package/lib/components/Label/Label.spec.js +10 -0
- package/lib/components/Label/Label.spec.js.map +1 -0
- package/lib/components/Label/model.d.ts +1 -1
- package/lib/components/Label/model.js +2 -0
- package/lib/components/Label/model.js.map +1 -0
- package/lib/components/Label/styles.d.ts +1 -1
- package/lib/components/Label/styles.js +12 -0
- package/lib/components/Label/styles.js.map +1 -0
- package/lib/components/Layout/Layout.d.ts +1 -1
- package/lib/components/Layout/Layout.js +20 -0
- package/lib/components/Layout/Layout.js.map +1 -0
- package/lib/components/Layout/Layout.spec.d.ts +1 -0
- package/lib/components/Layout/Layout.spec.js +19 -0
- package/lib/components/Layout/Layout.spec.js.map +1 -0
- package/lib/components/Layout/model.d.ts +1 -1
- package/lib/components/Layout/model.js +2 -0
- package/lib/components/Layout/model.js.map +1 -0
- package/lib/components/Layout/styles.d.ts +1 -1
- package/lib/components/Layout/styles.js +10 -0
- package/lib/components/Layout/styles.js.map +1 -0
- package/lib/components/List/List.d.ts +2 -2
- package/lib/components/List/List.js +43 -0
- package/lib/components/List/List.js.map +1 -0
- package/lib/components/List/List.spec.d.ts +1 -0
- package/lib/components/List/List.spec.js +48 -0
- package/lib/components/List/List.spec.js.map +1 -0
- package/lib/components/List/styles.d.ts +1 -1
- package/lib/components/List/styles.js +28 -0
- package/lib/components/List/styles.js.map +1 -0
- package/lib/components/Loader/Loader.d.ts +1 -1
- package/lib/components/Loader/Loader.js +23 -0
- package/lib/components/Loader/Loader.js.map +1 -0
- package/lib/components/Loader/Loader.spec.d.ts +1 -0
- package/lib/components/Loader/Loader.spec.js +10 -0
- package/lib/components/Loader/Loader.spec.js.map +1 -0
- package/lib/components/Loader/model.d.ts +1 -1
- package/lib/components/Loader/model.js +2 -0
- package/lib/components/Loader/model.js.map +1 -0
- package/lib/components/Loader/styles.d.ts +1 -1
- package/lib/components/Loader/styles.js +24 -0
- package/lib/components/Loader/styles.js.map +1 -0
- package/lib/components/LoadingBar/LoadingBar.d.ts +1 -1
- package/lib/components/LoadingBar/LoadingBar.js +47 -0
- package/lib/components/LoadingBar/LoadingBar.js.map +1 -0
- package/lib/components/LoadingBar/LoadingBar.spec.d.ts +1 -0
- package/lib/components/LoadingBar/LoadingBar.spec.js +24 -0
- package/lib/components/LoadingBar/LoadingBar.spec.js.map +1 -0
- package/lib/components/LoadingBar/model.d.ts +1 -1
- package/lib/components/LoadingBar/model.js +2 -0
- package/lib/components/LoadingBar/model.js.map +1 -0
- package/lib/components/LoadingBar/styles.d.ts +1 -1
- package/lib/components/LoadingBar/styles.js +22 -0
- package/lib/components/LoadingBar/styles.js.map +1 -0
- package/lib/components/Modal/Modal.d.ts +2 -2
- package/lib/components/Modal/Modal.js +120 -0
- package/lib/components/Modal/Modal.js.map +1 -0
- package/lib/components/Modal/Modal.spec.d.ts +1 -0
- package/lib/components/Modal/Modal.spec.js +34 -0
- package/lib/components/Modal/Modal.spec.js.map +1 -0
- package/lib/components/Modal/model.d.ts +1 -1
- package/lib/components/Modal/model.js +2 -0
- package/lib/components/Modal/model.js.map +1 -0
- package/lib/components/Modal/styles.d.ts +2 -2
- package/lib/components/Modal/styles.js +121 -0
- package/lib/components/Modal/styles.js.map +1 -0
- package/lib/components/NumberLabel/NumberLabel.d.ts +1 -1
- package/lib/components/NumberLabel/NumberLabel.js +182 -0
- package/lib/components/NumberLabel/NumberLabel.js.map +1 -0
- package/lib/components/NumberLabel/NumberLabel.spec.d.ts +1 -0
- package/lib/components/NumberLabel/NumberLabel.spec.js +94 -0
- package/lib/components/NumberLabel/NumberLabel.spec.js.map +1 -0
- package/lib/components/NumberLabel/model.d.ts +1 -1
- package/lib/components/NumberLabel/model.js +2 -0
- package/lib/components/NumberLabel/model.js.map +1 -0
- package/lib/components/Pagination/Pagination.d.ts +1 -1
- package/lib/components/Pagination/Pagination.js +121 -0
- package/lib/components/Pagination/Pagination.js.map +1 -0
- package/lib/components/Pagination/Pagination.spec.d.ts +1 -0
- package/lib/components/Pagination/Pagination.spec.js +26 -0
- package/lib/components/Pagination/Pagination.spec.js.map +1 -0
- package/lib/components/Pagination/model.d.ts +1 -1
- package/lib/components/Pagination/model.js +2 -0
- package/lib/components/Pagination/model.js.map +1 -0
- package/lib/components/Pagination/styles.d.ts +2 -2
- package/lib/components/Pagination/styles.js +49 -0
- package/lib/components/Pagination/styles.js.map +1 -0
- package/lib/components/Radio/Radio.d.ts +3 -3
- package/lib/components/Radio/Radio.js +78 -0
- package/lib/components/Radio/Radio.js.map +1 -0
- package/lib/components/Radio/Radio.spec.d.ts +1 -0
- package/lib/components/Radio/Radio.spec.js +29 -0
- package/lib/components/Radio/Radio.spec.js.map +1 -0
- package/lib/components/Radio/model.d.ts +2 -2
- package/lib/components/Radio/model.js +2 -0
- package/lib/components/Radio/model.js.map +1 -0
- package/lib/components/Radio/styles.d.ts +1 -1
- package/lib/components/Radio/styles.js +37 -0
- package/lib/components/Radio/styles.js.map +1 -0
- package/lib/components/Select/Select.d.ts +2 -2
- package/lib/components/Select/Select.js +287 -0
- package/lib/components/Select/Select.js.map +1 -0
- package/lib/components/Select/Select.spec.d.ts +1 -0
- package/lib/components/Select/Select.spec.js +41 -0
- package/lib/components/Select/Select.spec.js.map +1 -0
- package/lib/components/Select/model.d.ts +5 -2
- package/lib/components/Select/model.js +2 -0
- package/lib/components/Select/model.js.map +1 -0
- package/lib/components/Select/styles.d.ts +2 -2
- package/lib/components/Select/styles.js +159 -0
- package/lib/components/Select/styles.js.map +1 -0
- package/lib/components/Selector/Selector.d.ts +1 -1
- package/lib/components/Selector/Selector.js +42 -0
- package/lib/components/Selector/Selector.js.map +1 -0
- package/lib/components/Selector/Selector.spec.d.ts +1 -0
- package/lib/components/Selector/Selector.spec.js +28 -0
- package/lib/components/Selector/Selector.spec.js.map +1 -0
- package/lib/components/Selector/model.d.ts +1 -1
- package/lib/components/Selector/model.js +2 -0
- package/lib/components/Selector/model.js.map +1 -0
- package/lib/components/Selector/styles.d.ts +1 -1
- package/lib/components/Selector/styles.js +44 -0
- package/lib/components/Selector/styles.js.map +1 -0
- package/lib/components/Sidemenu/Sidemenu.d.ts +1 -1
- package/lib/components/Sidemenu/Sidemenu.js +42 -0
- package/lib/components/Sidemenu/Sidemenu.js.map +1 -0
- package/lib/components/Sidemenu/Sidemenu.spec.d.ts +1 -0
- package/lib/components/Sidemenu/Sidemenu.spec.js +28 -0
- package/lib/components/Sidemenu/Sidemenu.spec.js.map +1 -0
- package/lib/components/Sidemenu/model.d.ts +1 -1
- package/lib/components/Sidemenu/model.js +2 -0
- package/lib/components/Sidemenu/model.js.map +1 -0
- package/lib/components/Sidemenu/styles.d.ts +1 -1
- package/lib/components/Sidemenu/styles.js +29 -0
- package/lib/components/Sidemenu/styles.js.map +1 -0
- package/lib/components/Skeleton/Skeleton.d.ts +1 -1
- package/lib/components/Skeleton/Skeleton.js +43 -0
- package/lib/components/Skeleton/Skeleton.js.map +1 -0
- package/lib/components/Skeleton/Skeleton.spec.d.ts +1 -0
- package/lib/components/Skeleton/Skeleton.spec.js +31 -0
- package/lib/components/Skeleton/Skeleton.spec.js.map +1 -0
- package/lib/components/Skeleton/model.d.ts +1 -1
- package/lib/components/Skeleton/model.js +2 -0
- package/lib/components/Skeleton/model.js.map +1 -0
- package/lib/components/Skeleton/styles.d.ts +1 -1
- package/lib/components/Skeleton/styles.js +53 -0
- package/lib/components/Skeleton/styles.js.map +1 -0
- package/lib/components/Slider/Slider.d.ts +1 -1
- package/lib/components/Slider/Slider.js +11 -0
- package/lib/components/Slider/Slider.js.map +1 -0
- package/lib/components/Slider/Slider.spec.d.ts +1 -0
- package/lib/components/Slider/Slider.spec.js +10 -0
- package/lib/components/Slider/Slider.spec.js.map +1 -0
- package/lib/components/Slider/{Model.d.ts → model.d.ts} +2 -2
- package/lib/components/Slider/model.js +2 -0
- package/lib/components/Slider/model.js.map +1 -0
- package/lib/components/Slider/styles.d.ts +1 -1
- package/lib/components/Slider/styles.js +61 -0
- package/lib/components/Slider/styles.js.map +1 -0
- package/lib/components/Stack/Stack.d.ts +1 -1
- package/lib/components/Stack/Stack.js +75 -0
- package/lib/components/Stack/Stack.js.map +1 -0
- package/lib/components/Stack/Stack.spec.d.ts +1 -0
- package/lib/components/Stack/Stack.spec.js +43 -0
- package/lib/components/Stack/Stack.spec.js.map +1 -0
- package/lib/components/Stack/model.d.ts +1 -1
- package/lib/components/Stack/model.js +2 -0
- package/lib/components/Stack/model.js.map +1 -0
- package/lib/components/Stack/styles.d.ts +1 -1
- package/lib/components/Stack/styles.js +12 -0
- package/lib/components/Stack/styles.js.map +1 -0
- package/lib/components/Steps/Steps.d.ts +1 -1
- package/lib/components/Steps/Steps.js +90 -0
- package/lib/components/Steps/Steps.js.map +1 -0
- package/lib/components/Steps/Steps.spec.d.ts +1 -0
- package/lib/components/Steps/Steps.spec.js +83 -0
- package/lib/components/Steps/Steps.spec.js.map +1 -0
- package/lib/components/Steps/model.d.ts +1 -1
- package/lib/components/Steps/model.js +2 -0
- package/lib/components/Steps/model.js.map +1 -0
- package/lib/components/Steps/styles.d.ts +1 -1
- package/lib/components/Steps/styles.js +45 -0
- package/lib/components/Steps/styles.js.map +1 -0
- package/lib/components/Styled/GlobalStyles.js +50 -0
- package/lib/components/Styled/GlobalStyles.js.map +1 -0
- package/lib/components/Styled/MooskinContextProvider.d.ts +1 -1
- package/lib/components/Styled/MooskinContextProvider.js +31 -0
- package/lib/components/Styled/MooskinContextProvider.js.map +1 -0
- package/lib/components/Styled/model.d.ts +2 -2
- package/lib/components/Styled/model.js +2 -0
- package/lib/components/Styled/model.js.map +1 -0
- package/lib/components/Switch/Switch.d.ts +1 -1
- package/lib/components/Switch/Switch.js +53 -0
- package/lib/components/Switch/Switch.js.map +1 -0
- package/lib/components/Switch/Switch.spec.d.ts +1 -0
- package/lib/components/Switch/Switch.spec.js +27 -0
- package/lib/components/Switch/Switch.spec.js.map +1 -0
- package/lib/components/Switch/model.d.ts +2 -2
- package/lib/components/Switch/model.js +2 -0
- package/lib/components/Switch/model.js.map +1 -0
- package/lib/components/Switch/styles.d.ts +1 -1
- package/lib/components/Switch/styles.js +58 -0
- package/lib/components/Switch/styles.js.map +1 -0
- package/lib/components/Table/Table.d.ts +1 -1
- package/lib/components/Table/Table.js +40 -0
- package/lib/components/Table/Table.js.map +1 -0
- package/lib/components/Table/Table.spec.d.ts +1 -0
- package/lib/components/Table/Table.spec.js +38 -0
- package/lib/components/Table/Table.spec.js.map +1 -0
- package/lib/components/Table/styles.d.ts +1 -1
- package/lib/components/Table/styles.js +56 -0
- package/lib/components/Table/styles.js.map +1 -0
- package/lib/components/Tabs/Tabs.d.ts +1 -1
- package/lib/components/Tabs/Tabs.js +81 -0
- package/lib/components/Tabs/Tabs.js.map +1 -0
- package/lib/components/Tabs/Tabs.spec.d.ts +1 -0
- package/lib/components/Tabs/Tabs.spec.js +83 -0
- package/lib/components/Tabs/Tabs.spec.js.map +1 -0
- package/lib/components/Tabs/model.d.ts +1 -1
- package/lib/components/Tabs/model.js +2 -0
- package/lib/components/Tabs/model.js.map +1 -0
- package/lib/components/Tabs/styles.d.ts +1 -1
- package/lib/components/Tabs/styles.js +29 -0
- package/lib/components/Tabs/styles.js.map +1 -0
- package/lib/components/Tags/Tags.d.ts +2 -2
- package/lib/components/Tags/Tags.js +190 -0
- package/lib/components/Tags/Tags.js.map +1 -0
- package/lib/components/Tags/Tags.spec.d.ts +1 -0
- package/lib/components/Tags/Tags.spec.js +101 -0
- package/lib/components/Tags/Tags.spec.js.map +1 -0
- package/lib/components/Tags/model.d.ts +2 -2
- package/lib/components/Tags/model.js +2 -0
- package/lib/components/Tags/model.js.map +1 -0
- package/lib/components/Tags/styles.d.ts +2 -2
- package/lib/components/Tags/styles.js +58 -0
- package/lib/components/Tags/styles.js.map +1 -0
- package/lib/components/Text/Text.d.ts +1 -1
- package/lib/components/Text/Text.js +25 -0
- package/lib/components/Text/Text.js.map +1 -0
- package/lib/components/Text/Text.spec.d.ts +1 -0
- package/lib/components/Text/Text.spec.js +10 -0
- package/lib/components/Text/Text.spec.js.map +1 -0
- package/lib/components/Text/model.d.ts +1 -1
- package/lib/components/Text/model.js +2 -0
- package/lib/components/Text/model.js.map +1 -0
- package/lib/components/Text/styles.d.ts +1 -1
- package/lib/components/Text/styles.js +11 -0
- package/lib/components/Text/styles.js.map +1 -0
- package/lib/components/TextArea/TextArea.d.ts +1 -1
- package/lib/components/TextArea/TextArea.js +24 -0
- package/lib/components/TextArea/TextArea.js.map +1 -0
- package/lib/components/TextArea/TextArea.spec.d.ts +1 -0
- package/lib/components/TextArea/TextArea.spec.js +39 -0
- package/lib/components/TextArea/TextArea.spec.js.map +1 -0
- package/lib/components/TextArea/model.d.ts +1 -1
- package/lib/components/TextArea/model.js +2 -0
- package/lib/components/TextArea/model.js.map +1 -0
- package/lib/components/TextArea/styles.js +14 -0
- package/lib/components/TextArea/styles.js.map +1 -0
- package/lib/components/TextEditor/TextEditor.d.ts +1 -1
- package/lib/components/TextEditor/TextEditor.js +88 -0
- package/lib/components/TextEditor/TextEditor.js.map +1 -0
- package/lib/components/TextEditor/TextEditor.spec.d.ts +1 -0
- package/lib/components/TextEditor/TextEditor.spec.js +30 -0
- package/lib/components/TextEditor/TextEditor.spec.js.map +1 -0
- package/lib/components/TextEditor/model.d.ts +5 -1
- package/lib/components/TextEditor/model.js +2 -0
- package/lib/components/TextEditor/model.js.map +1 -0
- package/lib/components/_utils/globals/locales.js +21 -0
- package/lib/components/_utils/globals/locales.js.map +1 -0
- package/lib/components/_utils/globals/screens.js +29 -0
- package/lib/components/_utils/globals/screens.js.map +1 -0
- package/lib/components/_utils/globals/variables.d.ts +1 -1
- package/lib/components/_utils/globals/variables.js +213 -0
- package/lib/components/_utils/globals/variables.js.map +1 -0
- package/lib/components/_utils/helper.d.ts +1 -1
- package/lib/components/_utils/helper.js +139 -0
- package/lib/components/_utils/helper.js.map +1 -0
- package/lib/components/_utils/index.d.ts +1 -3
- package/lib/components/_utils/index.js +2 -0
- package/lib/components/_utils/index.js.map +1 -0
- package/lib/components/_utils/test-setup.d.ts +1 -0
- package/lib/components/_utils/test-setup.js +9 -0
- package/lib/components/_utils/test-setup.js.map +1 -0
- package/lib/components/_utils/types/commonTypes.js +2 -0
- package/lib/components/_utils/types/commonTypes.js.map +1 -0
- package/lib/components/index/index.d.ts +41 -41
- package/lib/components/index/index.js +50 -0
- package/lib/components/index/index.js.map +1 -0
- package/lib/index/index.d.ts +41 -41
- package/lib/index/index.js +6 -35
- package/lib/index/index.js.LICENSE.txt +33 -0
- package/lib/index/style.css +3 -3
- package/lib/stories/ActionsDropdown.stories.d.ts +5 -3
- package/lib/stories/ActionsDropdown.stories.js +26 -0
- package/lib/stories/ActionsDropdown.stories.js.map +1 -0
- package/lib/stories/Alert.stories.d.ts +5 -3
- package/lib/stories/Alert.stories.js +29 -0
- package/lib/stories/Alert.stories.js.map +1 -0
- package/lib/stories/Anchor.stories.d.ts +6 -2
- package/lib/stories/Anchor.stories.js +21 -0
- package/lib/stories/Anchor.stories.js.map +1 -0
- package/lib/stories/Box.stories.d.ts +6 -2
- package/lib/stories/Box.stories.js +21 -0
- package/lib/stories/Box.stories.js.map +1 -0
- package/lib/stories/Button.stories.d.ts +3 -2
- package/lib/stories/Button.stories.js +39 -0
- package/lib/stories/Button.stories.js.map +1 -0
- package/lib/stories/Carousel.stories.d.ts +6 -2
- package/lib/stories/Carousel.stories.js +16 -0
- package/lib/stories/Carousel.stories.js.map +1 -0
- package/lib/stories/Checkbox.stories.d.ts +6 -2
- package/lib/stories/Checkbox.stories.js +43 -0
- package/lib/stories/Checkbox.stories.js.map +1 -0
- package/lib/stories/DatePicker.stories.d.ts +6 -2
- package/lib/stories/DatePicker.stories.js +15 -0
- package/lib/stories/DatePicker.stories.js.map +1 -0
- package/lib/stories/DateRange.stories.d.ts +6 -2
- package/lib/stories/DateRange.stories.js +25 -0
- package/lib/stories/DateRange.stories.js.map +1 -0
- package/lib/stories/DateSelect.stories.d.ts +6 -2
- package/lib/stories/DateSelect.stories.js +46 -0
- package/lib/stories/DateSelect.stories.js.map +1 -0
- package/lib/stories/DateTimePicker.stories.d.ts +6 -2
- package/lib/stories/DateTimePicker.stories.js +15 -0
- package/lib/stories/DateTimePicker.stories.js.map +1 -0
- package/lib/stories/Drawer.stories.d.ts +6 -2
- package/lib/stories/Drawer.stories.js +58 -0
- package/lib/stories/Drawer.stories.js.map +1 -0
- package/lib/stories/Expandable.stories.d.ts +6 -2
- package/lib/stories/Expandable.stories.js +22 -0
- package/lib/stories/Expandable.stories.js.map +1 -0
- package/lib/stories/Footer.stories.d.ts +6 -2
- package/lib/stories/Footer.stories.js +25 -0
- package/lib/stories/Footer.stories.js.map +1 -0
- package/lib/stories/Grid.stories.d.ts +6 -2
- package/lib/stories/Grid.stories.js +52 -0
- package/lib/stories/Grid.stories.js.map +1 -0
- package/lib/stories/IconButton.stories.d.ts +6 -2
- package/lib/stories/IconButton.stories.js +21 -0
- package/lib/stories/IconButton.stories.js.map +1 -0
- package/lib/stories/Input.stories.d.ts +5 -2
- package/lib/stories/Input.stories.js +58 -0
- package/lib/stories/Input.stories.js.map +1 -0
- package/lib/stories/Layout.stories.d.ts +6 -2
- package/lib/stories/Layout.stories.js +24 -0
- package/lib/stories/Layout.stories.js.map +1 -0
- package/lib/stories/List.stories.d.ts +5 -2
- package/lib/stories/List.stories.js +87 -0
- package/lib/stories/List.stories.js.map +1 -0
- package/lib/stories/Loader.stories.d.ts +6 -2
- package/lib/stories/Loader.stories.js +12 -0
- package/lib/stories/Loader.stories.js.map +1 -0
- package/lib/stories/LoadingBar.stories.d.ts +6 -2
- package/lib/stories/LoadingBar.stories.js +16 -0
- package/lib/stories/LoadingBar.stories.js.map +1 -0
- package/lib/stories/Modal.stories.d.ts +6 -2
- package/lib/stories/Modal.stories.js +21 -0
- package/lib/stories/Modal.stories.js.map +1 -0
- package/lib/stories/NumberLabel.stories.d.ts +6 -2
- package/lib/stories/NumberLabel.stories.js +39 -0
- package/lib/stories/NumberLabel.stories.js.map +1 -0
- package/lib/stories/Pagination.stories.d.ts +6 -2
- package/lib/stories/Pagination.stories.js +17 -0
- package/lib/stories/Pagination.stories.js.map +1 -0
- package/lib/stories/Radio.stories.d.ts +6 -2
- package/lib/stories/Radio.stories.js +44 -0
- package/lib/stories/Radio.stories.js.map +1 -0
- package/lib/stories/Select.stories.d.ts +6 -2
- package/lib/stories/Select.stories.js +83 -0
- package/lib/stories/Select.stories.js.map +1 -0
- package/lib/stories/Selector.stories.d.ts +6 -2
- package/lib/stories/Selector.stories.js +20 -0
- package/lib/stories/Selector.stories.js.map +1 -0
- package/lib/stories/Sidemenu.stories.d.ts +6 -2
- package/lib/stories/Sidemenu.stories.js +17 -0
- package/lib/stories/Sidemenu.stories.js.map +1 -0
- package/lib/stories/Skeleton.stories.d.ts +6 -2
- package/lib/stories/Skeleton.stories.js +41 -0
- package/lib/stories/Skeleton.stories.js.map +1 -0
- package/lib/stories/Slider.stories.d.ts +6 -2
- package/lib/stories/Slider.stories.js +14 -0
- package/lib/stories/Slider.stories.js.map +1 -0
- package/lib/stories/Stack.stories.d.ts +6 -2
- package/lib/stories/Stack.stories.js +86 -0
- package/lib/stories/Stack.stories.js.map +1 -0
- package/lib/stories/StackedTags.stories.d.ts +6 -2
- package/lib/stories/StackedTags.stories.js +28 -0
- package/lib/stories/StackedTags.stories.js.map +1 -0
- package/lib/stories/Steps.stories.d.ts +6 -2
- package/lib/stories/Steps.stories.js +20 -0
- package/lib/stories/Steps.stories.js.map +1 -0
- package/lib/stories/Switch.stories.d.ts +6 -2
- package/lib/stories/Switch.stories.js +25 -0
- package/lib/stories/Switch.stories.js.map +1 -0
- package/lib/stories/Table.stories.d.ts +6 -2
- package/lib/stories/Table.stories.js +42 -0
- package/lib/stories/Table.stories.js.map +1 -0
- package/lib/stories/Tabs.stories.d.ts +6 -2
- package/lib/stories/Tabs.stories.js +19 -0
- package/lib/stories/Tabs.stories.js.map +1 -0
- package/lib/stories/Tags.stories.d.ts +6 -2
- package/lib/stories/Tags.stories.js +40 -0
- package/lib/stories/Tags.stories.js.map +1 -0
- package/lib/stories/TextEditor.stories.d.ts +6 -2
- package/lib/stories/TextEditor.stories.js +41 -0
- package/lib/stories/TextEditor.stories.js.map +1 -0
- package/lib/stories/Textarea.stories.d.ts +6 -2
- package/lib/stories/Textarea.stories.js +21 -0
- package/lib/stories/Textarea.stories.js.map +1 -0
- package/package.json +45 -35
- package/README-legacy.md +0 -212
- /package/lib/{_utils/adapter.d.ts → components/ActionsDropdown/ActionsDropdown.spec.d.ts} +0 -0
- /package/lib/components/{_utils/adapter.d.ts → Alert/Alert.spec.d.ts} +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Box } from '../Box/Box';
|
|
3
|
+
import variables from '../_utils/globals/variables';
|
|
4
|
+
export const StyledTable = styled(Box) `
|
|
5
|
+
border: solid 1px #e2e2e2;
|
|
6
|
+
background-color: ${(props) => { var _a; return ((_a = props.palette) === null || _a === void 0 ? void 0 : _a.backgroundColors.white) || variables.backgroundColors.white; }};
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
`;
|
|
10
|
+
StyledTable.displayName = 'StyledTable';
|
|
11
|
+
export const StyledTableHeader = styled(Box) `
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
min-height: 45px;
|
|
15
|
+
`;
|
|
16
|
+
StyledTableHeader.displayName = 'StyledTableHeader';
|
|
17
|
+
export const StyledTableHeaderItem = styled(Box) `
|
|
18
|
+
font-size: 11px;
|
|
19
|
+
font-weight: bold;
|
|
20
|
+
font-stretch: normal;
|
|
21
|
+
font-style: normal;
|
|
22
|
+
letter-spacing: normal;
|
|
23
|
+
text-align: left;
|
|
24
|
+
color: ${(props) => { var _a; return ((_a = props.palette) === null || _a === void 0 ? void 0 : _a.fontColors.secondary2) || variables.fontColors.secondary2; }};
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
`;
|
|
28
|
+
StyledTableHeaderItem.displayName = 'StyledTableHeaderItem';
|
|
29
|
+
export const StyledTableRow = styled(Box) `
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
min-height: 90px;
|
|
33
|
+
border-top-width: 1px;
|
|
34
|
+
border-top-style: solid;
|
|
35
|
+
border-top-color: ${(props) => { var _a; return ((_a = props.palette) === null || _a === void 0 ? void 0 : _a.borderColors.gray1) || variables.borderColors.gray1; }};
|
|
36
|
+
border-bottom-width: 1px;
|
|
37
|
+
border-bottom-style: solid;
|
|
38
|
+
border-bottom-color: ${(props) => { var _a; return ((_a = props.palette) === null || _a === void 0 ? void 0 : _a.borderColors.gray1) || variables.borderColors.gray1; }};
|
|
39
|
+
:last-child {
|
|
40
|
+
border: none;
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
StyledTableRow.displayName = 'StyledTableRow';
|
|
44
|
+
export const StyledTableRowItem = styled(Box) `
|
|
45
|
+
font-size: 16px;
|
|
46
|
+
font-weight: 500;
|
|
47
|
+
font-stretch: normal;
|
|
48
|
+
font-style: normal;
|
|
49
|
+
letter-spacing: normal;
|
|
50
|
+
text-align: left;
|
|
51
|
+
color: ${(props) => { var _a; return ((_a = props.palette) === null || _a === void 0 ? void 0 : _a.fontColors.text) || variables.fontColors.text; }};
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
`;
|
|
55
|
+
StyledTableRowItem.displayName = 'StyledTableRowItem';
|
|
56
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -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CAAC,KAAK,KAAI,SAAS,CAAC,YAAY,CAAC,KAAK,CAAA,EAAA;;;;CAInG,CAAC;AAEF,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC;AAE9C,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAoB;;;;;;;UAOvD,CAAC,KAAK,EAAE,EAAE,WAAC,OAAA,CAAA,MAAA,KAAK,CAAC,OAAO,0CAAE,UAAU,CAAC,IAAI,KAAI,SAAS,CAAC,UAAU,CAAC,IAAI,CAAA,EAAA;;;CAG/E,CAAC;AAEF,kBAAkB,CAAC,WAAW,GAAG,oBAAoB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ITabCommonComponentProps, ITabComponentProps, ITabsComponentProps } from './model';
|
|
2
|
+
import type { ITabCommonComponentProps, ITabComponentProps, ITabsComponentProps } from './model';
|
|
3
3
|
export declare const Tabs: React.FC<ITabsComponentProps>;
|
|
4
4
|
export declare const Tab: React.FC<ITabComponentProps>;
|
|
5
5
|
export declare const TabHeader: React.FC<ITabCommonComponentProps>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import * as React from 'react';
|
|
13
|
+
import { withMooskinContext } from '../Styled/MooskinContextProvider';
|
|
14
|
+
import { Box } from '../Box/Box';
|
|
15
|
+
import { StyledTab, StyledTabContent, StyledTabHeader, StyledTabs } from './styles';
|
|
16
|
+
export const Tabs = withMooskinContext((_a) => {
|
|
17
|
+
var { className = '', style = {} } = _a, props = __rest(_a, ["className", "style"]);
|
|
18
|
+
const batchClickHandler = (e, activeId, callback) => {
|
|
19
|
+
var _a;
|
|
20
|
+
(_a = props.onClickTab) === null || _a === void 0 ? void 0 : _a.call(props, e, activeId);
|
|
21
|
+
callback === null || callback === void 0 ? void 0 : callback(e);
|
|
22
|
+
};
|
|
23
|
+
const getActiveItem = (activeId) => {
|
|
24
|
+
if (props.activeItem && Array.isArray(props.activeItem)) {
|
|
25
|
+
return props.activeItem.includes(activeId);
|
|
26
|
+
}
|
|
27
|
+
return props.activeItem === activeId;
|
|
28
|
+
};
|
|
29
|
+
const riteOfRakshir = (children, activeId, active) => {
|
|
30
|
+
let header;
|
|
31
|
+
let content;
|
|
32
|
+
React.Children.forEach(children, (child) => {
|
|
33
|
+
if (React.isValidElement(child) && child.type === TabHeader) {
|
|
34
|
+
header = React.cloneElement(child, {
|
|
35
|
+
active,
|
|
36
|
+
onClick: (e) => batchClickHandler(e, activeId, child.props.onClick),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if (React.isValidElement(child) && child.type === TabContent) {
|
|
40
|
+
content = active ? React.cloneElement(child, { active }) : undefined;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return { header, content };
|
|
44
|
+
};
|
|
45
|
+
const recurseChildren = (children) => {
|
|
46
|
+
if (!children) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
const headers = [];
|
|
50
|
+
const contents = [];
|
|
51
|
+
React.Children.forEach(children, (child, i) => {
|
|
52
|
+
if (React.isValidElement(child) && child.type === Tab) {
|
|
53
|
+
const active = child.props.active ? child.props.active : getActiveItem(child.props.activeId);
|
|
54
|
+
const { content, header } = riteOfRakshir(child.props.children, child.props.activeId, active);
|
|
55
|
+
header && headers.push(React.cloneElement(header, { key: i }));
|
|
56
|
+
content && contents.push(React.cloneElement(content, { key: i }));
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return (React.createElement(React.Fragment, null,
|
|
60
|
+
React.createElement(Box, { d: "flex" }, headers),
|
|
61
|
+
contents));
|
|
62
|
+
};
|
|
63
|
+
return React.createElement(StyledTabs, Object.assign({}, props), recurseChildren(props.children));
|
|
64
|
+
});
|
|
65
|
+
Tabs.displayName = 'Tabs';
|
|
66
|
+
export const Tab = withMooskinContext((_a) => {
|
|
67
|
+
var { className = '', style = {} } = _a, props = __rest(_a, ["className", "style"]);
|
|
68
|
+
return React.createElement(StyledTab, Object.assign({}, props));
|
|
69
|
+
});
|
|
70
|
+
Tab.displayName = 'Tab';
|
|
71
|
+
export const TabHeader = withMooskinContext((_a) => {
|
|
72
|
+
var { className = '', style = {} } = _a, props = __rest(_a, ["className", "style"]);
|
|
73
|
+
return (React.createElement(StyledTabHeader, Object.assign({ fontSize: [12, 12, 14, 14] }, props)));
|
|
74
|
+
});
|
|
75
|
+
TabHeader.displayName = 'TabHeader';
|
|
76
|
+
export const TabContent = withMooskinContext((_a) => {
|
|
77
|
+
var { className = '', style = {} } = _a, props = __rest(_a, ["className", "style"]);
|
|
78
|
+
return (React.createElement(StyledTabContent, Object.assign({}, props)));
|
|
79
|
+
});
|
|
80
|
+
TabContent.displayName = 'TabContent';
|
|
81
|
+
//# sourceMappingURL=Tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../../components/Tabs/Tabs.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAOtE,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGjC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EAAE,MAA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,EAAI,CAC/B,CAAA;CAAA,CAAC,CAAC;AAEH,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
3
|
+
import { Tab, TabContent, TabHeader, Tabs } from './Tabs';
|
|
4
|
+
describe('Tabs', () => {
|
|
5
|
+
test('renders correctly', () => {
|
|
6
|
+
const func = jest.fn();
|
|
7
|
+
const { container } = render(React.createElement(Tabs, { activeItem: 3, onClickTab: func },
|
|
8
|
+
React.createElement(Tab, { activeId: 1 },
|
|
9
|
+
React.createElement(TabHeader, null, `Item: 1`),
|
|
10
|
+
React.createElement(TabContent, null,
|
|
11
|
+
React.createElement("div", null, `Content for item with index: 1`))),
|
|
12
|
+
React.createElement(Tab, { activeId: 2 },
|
|
13
|
+
React.createElement(TabHeader, null, `Item: 2`),
|
|
14
|
+
React.createElement(TabContent, null,
|
|
15
|
+
React.createElement("div", null, `Content for item with index: 2`))),
|
|
16
|
+
React.createElement(Tab, { activeId: 3 },
|
|
17
|
+
React.createElement(TabHeader, null, `Item: 3`),
|
|
18
|
+
React.createElement(TabContent, null,
|
|
19
|
+
React.createElement("div", null, `Content for item with index: 3`))),
|
|
20
|
+
React.createElement(Tab, { activeId: 4 },
|
|
21
|
+
React.createElement(TabHeader, null, `Item: 4`),
|
|
22
|
+
React.createElement(TabContent, null,
|
|
23
|
+
React.createElement("div", null, `Content for item with index: 4`))),
|
|
24
|
+
React.createElement(Tab, { activeId: 5 },
|
|
25
|
+
React.createElement(TabHeader, null, `Item: 5`),
|
|
26
|
+
React.createElement(TabContent, null,
|
|
27
|
+
React.createElement("div", null, `Content for item with index: 5`))),
|
|
28
|
+
React.createElement(Tab, { activeId: 6 },
|
|
29
|
+
React.createElement(TabHeader, null, `Item: 6`),
|
|
30
|
+
React.createElement(TabContent, null,
|
|
31
|
+
React.createElement("div", null, `Content for item with index: 6`)))));
|
|
32
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
test('renders active tab content correctly', () => {
|
|
35
|
+
const func = jest.fn();
|
|
36
|
+
render(React.createElement(Tabs, { activeItem: 3, onClickTab: func },
|
|
37
|
+
React.createElement(Tab, { activeId: 1 },
|
|
38
|
+
React.createElement(TabHeader, null, `Item: 1`),
|
|
39
|
+
React.createElement(TabContent, null,
|
|
40
|
+
React.createElement("div", null, `Content for item with index: 1`))),
|
|
41
|
+
React.createElement(Tab, { activeId: 2 },
|
|
42
|
+
React.createElement(TabHeader, null, `Item: 2`),
|
|
43
|
+
React.createElement(TabContent, null,
|
|
44
|
+
React.createElement("div", null, `Content for item with index: 2`))),
|
|
45
|
+
React.createElement(Tab, { activeId: 3 },
|
|
46
|
+
React.createElement(TabHeader, null, `Item: 3`),
|
|
47
|
+
React.createElement(TabContent, null,
|
|
48
|
+
React.createElement("div", null, `Content for item with index: 3`))),
|
|
49
|
+
React.createElement(Tab, { activeId: 4 },
|
|
50
|
+
React.createElement(TabHeader, null, `Item: 4`),
|
|
51
|
+
React.createElement(TabContent, null,
|
|
52
|
+
React.createElement("div", null, `Content for item with index: 4`))),
|
|
53
|
+
React.createElement(Tab, { activeId: 5 },
|
|
54
|
+
React.createElement(TabHeader, null, `Item: 5`),
|
|
55
|
+
React.createElement(TabContent, null,
|
|
56
|
+
React.createElement("div", null, `Content for item with index: 5`))),
|
|
57
|
+
React.createElement(Tab, { activeId: 6 },
|
|
58
|
+
React.createElement(TabHeader, null, `Item: 6`),
|
|
59
|
+
React.createElement(TabContent, null,
|
|
60
|
+
React.createElement("div", null, `Content for item with index: 6`)))));
|
|
61
|
+
expect(screen.getByText('Content for item with index: 3')).toBeInTheDocument();
|
|
62
|
+
expect(screen.queryByText('Content for item with index: 1')).not.toBeInTheDocument();
|
|
63
|
+
});
|
|
64
|
+
test('calls onClickTab when a tab header is clicked', () => {
|
|
65
|
+
const func = jest.fn();
|
|
66
|
+
render(React.createElement(Tabs, { activeItem: 3, onClickTab: func },
|
|
67
|
+
React.createElement(Tab, { activeId: 1 },
|
|
68
|
+
React.createElement(TabHeader, null, `Item: 1`),
|
|
69
|
+
React.createElement(TabContent, null,
|
|
70
|
+
React.createElement("div", null, `Content for item with index: 1`))),
|
|
71
|
+
React.createElement(Tab, { activeId: 2 },
|
|
72
|
+
React.createElement(TabHeader, null, `Item: 2`),
|
|
73
|
+
React.createElement(TabContent, null,
|
|
74
|
+
React.createElement("div", null, `Content for item with index: 2`))),
|
|
75
|
+
React.createElement(Tab, { activeId: 3 },
|
|
76
|
+
React.createElement(TabHeader, null, `Item: 3`),
|
|
77
|
+
React.createElement(TabContent, null,
|
|
78
|
+
React.createElement("div", null, `Content for item with index: 3`)))));
|
|
79
|
+
fireEvent.click(screen.getByText('Item: 1'));
|
|
80
|
+
expect(func).toHaveBeenCalled();
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=Tabs.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tabs.spec.js","sourceRoot":"","sources":["../../../components/Tabs/Tabs.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE1D,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IACrB,IAAI,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAEvB,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAC3B,oBAAC,IAAI,IAAC,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI;YACpC,o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U;oBACV,iCAAM,gCAAgC,CAAO,CACjC,CACR;YACN,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC;gBACf,oBAAC,SAAS,QAAE,SAAS,CAAa;gBAClC,oBAAC,UAAU;oBACV,iCAAM,gCAAgC,CAAO,CACjC,CACR;YACN,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC;gBACf,oBAAC,SAAS,QAAE,SAAS,CAAa;gBAClC,oBAAC,UAAU;oBACV,iCAAM,gCAAgC,CAAO,CACjC,CACR,CACA,CACP,CAAC;QAEF,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;QAC7C,MAAM,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACjC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { IBoxComponentProps } from '../Box/model';
|
|
2
|
+
import type { IBoxComponentProps } from '../Box/model';
|
|
3
3
|
export interface ITabsComponentProps extends IBoxComponentProps {
|
|
4
4
|
activeItem?: number | string;
|
|
5
5
|
onClickTab?: (e: React.MouseEvent<HTMLElement>, value?: number | string) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../components/Tabs/model.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ITabCommonComponentProps, ITabComponentProps, ITabsComponentProps } from './model';
|
|
2
|
+
import type { ITabCommonComponentProps, ITabComponentProps, ITabsComponentProps } from './model';
|
|
3
3
|
export declare const StyledTabs: import("styled-components").StyledComponent<import("react").FC<import("../index").IBoxComponentProps>, any, ITabsComponentProps, never>;
|
|
4
4
|
export declare const StyledTab: import("styled-components").StyledComponent<import("react").FC<import("../index").IBoxComponentProps>, any, ITabComponentProps, never>;
|
|
5
5
|
export declare const StyledTabHeader: import("styled-components").StyledComponent<import("react").FC<import("../index").IBoxComponentProps>, any, ITabCommonComponentProps, never>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Box } from '../Box/Box';
|
|
3
|
+
import variables from '../_utils/globals/variables';
|
|
4
|
+
export const StyledTabs = styled(Box) `
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
`;
|
|
8
|
+
StyledTabs.displayName = 'StyledTabs';
|
|
9
|
+
export const StyledTab = styled(Box) ``;
|
|
10
|
+
StyledTab.displayName = 'StyledTab';
|
|
11
|
+
export const StyledTabHeader = styled(Box) `
|
|
12
|
+
font-size: 12px;
|
|
13
|
+
border-bottom: ${(props) => { var _a; return props.active ? `solid 2px ${((_a = props.palette) === null || _a === void 0 ? void 0 : _a.borderColors.primary1) || variables.borderColors.primary1}` : 'none'; }};
|
|
14
|
+
padding: ${(props) => (props.active ? '5px 0 3px' : '5px 0')};
|
|
15
|
+
font-weight: ${(props) => (props.active ? 'bold' : 'normal')};
|
|
16
|
+
font-stretch: normal;
|
|
17
|
+
font-style: normal;
|
|
18
|
+
letter-spacing: normal;
|
|
19
|
+
text-align: left;
|
|
20
|
+
color: ${(props) => { var _a; return ((_a = props.palette) === null || _a === void 0 ? void 0 : _a.fontColors.text) || variables.fontColors.text; }};
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
:not(:last-child) {
|
|
23
|
+
margin-right: 15px;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
StyledTabHeader.displayName = 'StyledTabHeader';
|
|
27
|
+
export const StyledTabContent = styled(Box) ``;
|
|
28
|
+
StyledTabContent.displayName = 'StyledTabContent';
|
|
29
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../components/Tabs/styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { IBoxComponentProps } from '../Box/model';
|
|
3
|
-
import { ITagComponentProps, ITagsComponentProps, ITagsInputComponentProps } from './model';
|
|
2
|
+
import type { IBoxComponentProps } from '../Box/model';
|
|
3
|
+
import type { ITagComponentProps, ITagsComponentProps, ITagsInputComponentProps } from './model';
|
|
4
4
|
export declare const Tags: React.FC<ITagsComponentProps>;
|
|
5
5
|
export declare const Tag: React.FC<ITagComponentProps>;
|
|
6
6
|
export declare const TagInput: React.FC<ITagsInputComponentProps>;
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import * as React from 'react';
|
|
13
|
+
import { withMooskinContext } from '../Styled/MooskinContextProvider';
|
|
14
|
+
import { StyledTag, StyledTagClose, StyledTagInput, StyledTags, StyledTagText } from './styles';
|
|
15
|
+
export const Tags = withMooskinContext((_a) => {
|
|
16
|
+
var { className = '', style = {}, dataLabel = '' } = _a, props = __rest(_a, ["className", "style", "dataLabel"]);
|
|
17
|
+
const [tagClose, setTagClose] = React.useState(false);
|
|
18
|
+
const batchClickHandler = (e, data, callback) => {
|
|
19
|
+
var _a;
|
|
20
|
+
(_a = props.onClickTag) === null || _a === void 0 ? void 0 : _a.call(props, e, data);
|
|
21
|
+
callback === null || callback === void 0 ? void 0 : callback(e);
|
|
22
|
+
};
|
|
23
|
+
const onRemoveTag = (e, i) => {
|
|
24
|
+
var _a;
|
|
25
|
+
e.stopPropagation();
|
|
26
|
+
(_a = props.onRemoveTag) === null || _a === void 0 ? void 0 : _a.call(props, e, i === -1 ? -1 : { dataLabel, value: i });
|
|
27
|
+
};
|
|
28
|
+
const onAddTag = (value) => {
|
|
29
|
+
var _a;
|
|
30
|
+
let validated = true;
|
|
31
|
+
if (props.validateTag) {
|
|
32
|
+
validated = props.validateTag(value);
|
|
33
|
+
}
|
|
34
|
+
validated && ((_a = props.onAddTag) === null || _a === void 0 ? void 0 : _a.call(props, { dataLabel, value }));
|
|
35
|
+
};
|
|
36
|
+
const recurseChildren = (children, tagIndex) => {
|
|
37
|
+
if (!children) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return React.Children.map(children, (child, i) => {
|
|
41
|
+
if (React.isValidElement(child) && child.type === Tag) {
|
|
42
|
+
return React.cloneElement(child, {
|
|
43
|
+
children: (React.createElement(React.Fragment, null,
|
|
44
|
+
recurseChildren(child.props.children, i),
|
|
45
|
+
child.props.removeIcon && props.onRemoveTag && !tagClose && React.createElement(TagClose, { onClick: (e) => onRemoveTag(e, i) }, "close"))),
|
|
46
|
+
key: i,
|
|
47
|
+
onClick: (e) => batchClickHandler(e, { dataLabel, value: i }, child.props.onClick),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (React.isValidElement(child) && child.type === TagClose) {
|
|
51
|
+
!tagClose && setTagClose(true);
|
|
52
|
+
return React.cloneElement(child, {
|
|
53
|
+
children: child.props.children ? child.props.children : 'close',
|
|
54
|
+
key: i,
|
|
55
|
+
onClick: child.props.onClick ? child.props.onClick : (e) => onRemoveTag(e, tagIndex !== null && tagIndex !== void 0 ? tagIndex : 0),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (React.isValidElement(child) && child.type === TagInput) {
|
|
59
|
+
return React.cloneElement(child, {
|
|
60
|
+
key: i,
|
|
61
|
+
onAddTag,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (React.isValidElement(child) && child.props.children) {
|
|
65
|
+
return React.cloneElement(child, { key: i, children: recurseChildren(child.props.children, tagIndex) });
|
|
66
|
+
}
|
|
67
|
+
return child;
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
return (React.createElement(StyledTags, Object.assign({ dataLabel: dataLabel }, props), recurseChildren(props.children)));
|
|
71
|
+
});
|
|
72
|
+
Tags.displayName = 'Tags';
|
|
73
|
+
export const Tag = withMooskinContext((_a) => {
|
|
74
|
+
var { className = '', removeIcon = true, style = {} } = _a, props = __rest(_a, ["className", "removeIcon", "style"]);
|
|
75
|
+
return (React.createElement(StyledTag, Object.assign({ className: className, removeIcon: removeIcon, style: style }, props)));
|
|
76
|
+
});
|
|
77
|
+
Tag.displayName = 'Tag';
|
|
78
|
+
export const TagInput = withMooskinContext((_a) => {
|
|
79
|
+
var { className = '', delimiters = ['Enter', 13], style = {} } = _a, props = __rest(_a, ["className", "delimiters", "style"]);
|
|
80
|
+
const [value, setValue] = React.useState(props.value || '');
|
|
81
|
+
const onChange = (e) => {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
const text = e.target.value;
|
|
84
|
+
const delimitersInternal = delimiters;
|
|
85
|
+
if (value && delimitersInternal && shouldSubmitPaste(text, delimiters)) {
|
|
86
|
+
let newTag = [];
|
|
87
|
+
const tags = [];
|
|
88
|
+
const charArray = text.split('');
|
|
89
|
+
for (let i = 0; i < charArray.length; i++) {
|
|
90
|
+
delimitersInternal === null || delimitersInternal === void 0 ? void 0 : delimitersInternal.map((delimiter) => {
|
|
91
|
+
if (charArray[i] === delimiter && newTag.join('') !== '') {
|
|
92
|
+
tags.push(newTag.join('').trim());
|
|
93
|
+
newTag = [];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
if (!delimitersInternal.includes(charArray[i]) && !delimitersInternal.includes(charArray[i].charCodeAt(0))) {
|
|
97
|
+
newTag.push(charArray[i]);
|
|
98
|
+
}
|
|
99
|
+
if (i === charArray.length - 1 && newTag.join('') !== '' && !delimitersInternal.includes(charArray[i])) {
|
|
100
|
+
tags.push(newTag.join('').trim());
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
(_a = props.onAddTag) === null || _a === void 0 ? void 0 : _a.call(props, tags);
|
|
104
|
+
setValue('');
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
setValue(e.target.value);
|
|
108
|
+
}
|
|
109
|
+
(_b = props.onChange) === null || _b === void 0 ? void 0 : _b.call(props, e);
|
|
110
|
+
};
|
|
111
|
+
const onRemoveTag = (e, i) => {
|
|
112
|
+
var _a;
|
|
113
|
+
e.stopPropagation();
|
|
114
|
+
(_a = props.onRemoveTag) === null || _a === void 0 ? void 0 : _a.call(props, e, i);
|
|
115
|
+
};
|
|
116
|
+
const onKeyDown = (e) => {
|
|
117
|
+
var _a, _b;
|
|
118
|
+
const delimitersInternal = delimiters && getConvertedDelimiters(delimiters);
|
|
119
|
+
const { key } = e;
|
|
120
|
+
const { keyCode } = e;
|
|
121
|
+
if (value && delimitersInternal && (delimitersInternal.includes(key) || delimitersInternal.includes(keyCode))) {
|
|
122
|
+
e.preventDefault();
|
|
123
|
+
(_a = props.onAddTag) === null || _a === void 0 ? void 0 : _a.call(props, value.toString());
|
|
124
|
+
setValue('');
|
|
125
|
+
}
|
|
126
|
+
if ((key === 'Backspace' || keyCode === 8) && value === '') {
|
|
127
|
+
const dummyEvent = { stopPropagation: () => { } };
|
|
128
|
+
onRemoveTag(dummyEvent, -1);
|
|
129
|
+
}
|
|
130
|
+
(_b = props.onKeyDown) === null || _b === void 0 ? void 0 : _b.call(props, e);
|
|
131
|
+
};
|
|
132
|
+
return (React.createElement(StyledTagInput, Object.assign({ className: className, delimiters: delimiters, style: style, boxAs: "input", value: value, onChange: onChange, onKeyDown: onKeyDown, autoFocus: true }, props)));
|
|
133
|
+
});
|
|
134
|
+
TagInput.displayName = 'TagInput';
|
|
135
|
+
export const TagClose = withMooskinContext((_a) => {
|
|
136
|
+
var { className = '', style = {} } = _a, props = __rest(_a, ["className", "style"]);
|
|
137
|
+
return (React.createElement(StyledTagClose, Object.assign({ className: className, style: style }, props)));
|
|
138
|
+
});
|
|
139
|
+
TagClose.displayName = 'TagClose';
|
|
140
|
+
export const TagText = withMooskinContext((_a) => {
|
|
141
|
+
var { className = '', style = {} } = _a, props = __rest(_a, ["className", "style"]);
|
|
142
|
+
return (React.createElement(StyledTagText, Object.assign({}, props)));
|
|
143
|
+
});
|
|
144
|
+
TagText.displayName = 'TagText';
|
|
145
|
+
const shouldSubmitPaste = (value, delimiters) => {
|
|
146
|
+
if (delimiters) {
|
|
147
|
+
const text = value.split('');
|
|
148
|
+
for (const char of text) {
|
|
149
|
+
for (const delimiter of delimiters) {
|
|
150
|
+
if (typeof delimiter === 'string' && char === delimiter) {
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
else if (typeof delimiter === 'number' && char.charCodeAt(0) === delimiter) {
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return false;
|
|
160
|
+
};
|
|
161
|
+
const getConvertedDelimiters = (delimiters) => {
|
|
162
|
+
const newDelimiters = delimiters.map((delimiter) => {
|
|
163
|
+
if (delimiter === ' ') {
|
|
164
|
+
return delimiter;
|
|
165
|
+
}
|
|
166
|
+
else if (!Number.isNaN(Number(delimiter))) {
|
|
167
|
+
return Number.parseInt(delimiter, 10);
|
|
168
|
+
}
|
|
169
|
+
else if (typeof delimiter === 'string') {
|
|
170
|
+
return delimiter.toLocaleLowerCase();
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
return delimiter;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
if (newDelimiters.includes('space') || newDelimiters.includes('spacebar') || newDelimiters.includes(' ')) {
|
|
177
|
+
!newDelimiters.includes(32) && newDelimiters.push(32);
|
|
178
|
+
}
|
|
179
|
+
if (newDelimiters.includes('enter')) {
|
|
180
|
+
!newDelimiters.includes(13) && newDelimiters.push(13);
|
|
181
|
+
}
|
|
182
|
+
if (newDelimiters.includes(',')) {
|
|
183
|
+
!newDelimiters.includes(188) && newDelimiters.push(188);
|
|
184
|
+
}
|
|
185
|
+
if (newDelimiters.includes('.')) {
|
|
186
|
+
!newDelimiters.includes(190) && newDelimiters.push(190);
|
|
187
|
+
}
|
|
188
|
+
return newDelimiters;
|
|
189
|
+
};
|
|
190
|
+
//# sourceMappingURL=Tags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tags.js","sourceRoot":"","sources":["../../../components/Tags/Tags.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAQtE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKhG,MAAM,CAAC,MAAM,IAAI,GAAkC,kBAAkB,CAAC,CAAC,EAAwD,EAAE,EAAE;QAA5D,EAAE,SAAS,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,OAAY,EAAP,KAAK,cAAtD,mCAAwD,CAAF;IAC5H,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,iBAAiB,GAAG,CACzB,CAAgC,EAChC,IAAwB,EACxB,QAAqD,EACpD,EAAE;;QACH,MAAA,KAAK,CAAC,UAAU,sDAAG,CAAC,EAAE,IAAI,CAAC,CAAC;QAC5B,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,CAAC,CAAC,CAAC;IACf,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,CAAgC,EAAE,CAA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AAC,GAAG,CAAC,CAAC;KACxD;IACD,IAAI,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAChC,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACxD;IAED,OAAO,aAAa,CAAC;AACtB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
3
|
+
import { Tag, TagInput, Tags } from './Tags';
|
|
4
|
+
describe('Tags', () => {
|
|
5
|
+
test('renders Tags correctly', () => {
|
|
6
|
+
const onAddTag = jest.fn();
|
|
7
|
+
const onRemoveTag = jest.fn();
|
|
8
|
+
const { container } = render(React.createElement(Tags, { className: "myClass", dataLabel: "SomeForm", style: { width: '50px' }, onAddTag: onAddTag, onRemoveTag: onRemoveTag },
|
|
9
|
+
React.createElement(Tag, { className: "tagClasses", style: { width: '50px' } }, "Prishtina"),
|
|
10
|
+
React.createElement(Tag, null, "Athens"),
|
|
11
|
+
React.createElement(TagInput, { placeholder: "olala", delimiters: [',', ' ', 'Enter', 13] })));
|
|
12
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
13
|
+
});
|
|
14
|
+
test('renders children correctly', () => {
|
|
15
|
+
const tags = ['Prishtina', 'Athens', 'London', 'New York', 'Beijing'];
|
|
16
|
+
render(React.createElement(Tags, null, tags.map((tag) => (React.createElement(Tag, { key: tag }, tag)))));
|
|
17
|
+
tags.forEach((tag) => {
|
|
18
|
+
expect(screen.getByText(tag)).toBeInTheDocument();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
test('adds a tag on enter and removes the last tag on backspace', () => {
|
|
22
|
+
const onAddTag = jest.fn();
|
|
23
|
+
const onRemoveTag = jest.fn();
|
|
24
|
+
render(React.createElement(Tags, { onAddTag: onAddTag },
|
|
25
|
+
React.createElement(Tag, null, "Prishtina"),
|
|
26
|
+
React.createElement(Tag, null, "Athens"),
|
|
27
|
+
React.createElement(TagInput, { onRemoveTag: onRemoveTag })));
|
|
28
|
+
const input = screen.getByRole('textbox');
|
|
29
|
+
expect(input).toHaveValue('');
|
|
30
|
+
fireEvent.change(input, { target: { value: 'Tokyo' } });
|
|
31
|
+
expect(input).toHaveValue('Tokyo');
|
|
32
|
+
fireEvent.keyDown(input, { keyCode: 13, key: 'Enter' });
|
|
33
|
+
expect(onAddTag).toHaveBeenCalledWith(expect.objectContaining({ value: 'Tokyo' }));
|
|
34
|
+
fireEvent.change(input, { target: { value: '' } });
|
|
35
|
+
fireEvent.keyDown(input, { keyCode: 8, key: 'Backspace' });
|
|
36
|
+
expect(onRemoveTag).toHaveBeenCalledWith(expect.anything(), -1);
|
|
37
|
+
});
|
|
38
|
+
test('deletes tag on close click', () => {
|
|
39
|
+
const onRemoveTag = jest.fn();
|
|
40
|
+
const tags = ['Prishtina', 'Athens', 'London'];
|
|
41
|
+
render(React.createElement(Tags, { onRemoveTag: onRemoveTag, dataLabel: "cities" }, tags.map((tag) => (React.createElement(Tag, { key: tag, removeIcon: true }, tag)))));
|
|
42
|
+
fireEvent.click(screen.getAllByText('close')[2]);
|
|
43
|
+
expect(onRemoveTag).toHaveBeenCalledWith(expect.anything(), expect.objectContaining({ dataLabel: 'cities', value: 2 }));
|
|
44
|
+
});
|
|
45
|
+
test('adds tags on keypress of custom delimiters', () => {
|
|
46
|
+
const onAddTag = jest.fn();
|
|
47
|
+
render(React.createElement(Tags, { onAddTag: onAddTag },
|
|
48
|
+
React.createElement(Tag, null, "Prishtina"),
|
|
49
|
+
React.createElement(TagInput, { delimiters: ['space', 32, 'enter', 188] })));
|
|
50
|
+
const input = screen.getByRole('textbox');
|
|
51
|
+
fireEvent.change(input, { target: { value: 'Tokyo' } });
|
|
52
|
+
fireEvent.keyDown(input, { keyCode: 32, key: ' ' });
|
|
53
|
+
expect(onAddTag).toHaveBeenCalledWith(expect.objectContaining({ value: 'Tokyo' }));
|
|
54
|
+
fireEvent.change(input, { target: { value: 'Berlin' } });
|
|
55
|
+
fireEvent.keyDown(input, { keyCode: 188, key: ',' });
|
|
56
|
+
expect(onAddTag).toHaveBeenCalledWith(expect.objectContaining({ value: 'Berlin' }));
|
|
57
|
+
});
|
|
58
|
+
test('splits a delimited value into tags', () => {
|
|
59
|
+
const onAddTag = jest.fn();
|
|
60
|
+
render(React.createElement(Tags, { onAddTag: onAddTag },
|
|
61
|
+
React.createElement(TagInput, { delimiters: [',', ' '] })));
|
|
62
|
+
const input = screen.getByRole('textbox');
|
|
63
|
+
fireEvent.change(input, { target: { value: 'seed' } });
|
|
64
|
+
fireEvent.change(input, { target: { value: 'Doni wow' } });
|
|
65
|
+
expect(onAddTag).toHaveBeenCalledWith(expect.objectContaining({ value: ['Doni', 'wow'] }));
|
|
66
|
+
});
|
|
67
|
+
test('does not split a value when no delimiter is present', () => {
|
|
68
|
+
const onAddTag = jest.fn();
|
|
69
|
+
render(React.createElement(Tags, { onAddTag: onAddTag },
|
|
70
|
+
React.createElement(TagInput, { delimiters: [','] })));
|
|
71
|
+
const input = screen.getByRole('textbox');
|
|
72
|
+
fireEvent.change(input, { target: { value: 'seed' } });
|
|
73
|
+
fireEvent.change(input, { target: { value: 'Hope of deliverance' } });
|
|
74
|
+
expect(onAddTag).not.toHaveBeenCalled();
|
|
75
|
+
expect(input).toHaveValue('Hope of deliverance');
|
|
76
|
+
});
|
|
77
|
+
test('refuses a tag when validateTag returns false', () => {
|
|
78
|
+
const onAddTag = jest.fn();
|
|
79
|
+
const validateTag = (tag) => tag.includes('@');
|
|
80
|
+
render(React.createElement(Tags, { onAddTag: onAddTag, validateTag: validateTag },
|
|
81
|
+
React.createElement(Tag, null, "doni"),
|
|
82
|
+
React.createElement(TagInput, null)));
|
|
83
|
+
const input = screen.getByRole('textbox');
|
|
84
|
+
fireEvent.change(input, { target: { value: 'text' } });
|
|
85
|
+
fireEvent.keyDown(input, { keyCode: 13, key: 'Enter' });
|
|
86
|
+
expect(onAddTag).not.toHaveBeenCalled();
|
|
87
|
+
fireEvent.change(input, { target: { value: 'doni@moosend.com' } });
|
|
88
|
+
fireEvent.keyDown(input, { keyCode: 13, key: 'Enter' });
|
|
89
|
+
expect(onAddTag).toHaveBeenCalledWith(expect.objectContaining({ value: 'doni@moosend.com' }));
|
|
90
|
+
});
|
|
91
|
+
test('calls onClickTag when a tag is clicked', () => {
|
|
92
|
+
const onClickTag = jest.fn();
|
|
93
|
+
render(React.createElement(Tags, { onClickTag: onClickTag, dataLabel: "people" },
|
|
94
|
+
React.createElement(Tag, null, "doni"),
|
|
95
|
+
React.createElement(Tag, null, "gent"),
|
|
96
|
+
React.createElement(Tag, null, "shkumbin")));
|
|
97
|
+
fireEvent.click(screen.getByText('doni'));
|
|
98
|
+
expect(onClickTag).toHaveBeenCalledWith(expect.anything(), expect.objectContaining({ dataLabel: 'people', value: 0 }));
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
//# sourceMappingURL=Tags.spec.js.map
|