linear-react-components-ui 1.1.14-beta.0 → 1.1.14-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +45 -77
- package/.gitlab-ci.yml +13 -5
- package/.nvmrc +1 -0
- package/.vscode/settings.json +12 -3
- package/babel.config.json +4 -4
- package/lib/@types/SizePixels.d.ts +1 -1
- package/lib/alerts/AlertContainer.js +48 -57
- package/lib/alerts/AlertProvider.js +36 -54
- package/lib/alerts/BaseAlert.js +12 -19
- package/lib/alerts/Message.d.ts +1 -1
- package/lib/alerts/Message.js +78 -45
- package/lib/alerts/helpers.js +2 -3
- package/lib/alerts/index.js +3 -4
- package/lib/alerts/types.d.ts +1 -0
- package/lib/alerts/withAlert.js +10 -11
- package/lib/assets/styles/alerts.scss +4 -7
- package/lib/assets/styles/button.scss +11 -9
- package/lib/assets/styles/checkbox.scss +45 -38
- package/lib/assets/styles/colors.scss +3 -1
- package/lib/assets/styles/commons.scss +1 -0
- package/lib/assets/styles/dialog.scss +37 -20
- package/lib/assets/styles/drawers.scss +9 -6
- package/lib/assets/styles/error.scss +9 -0
- package/lib/assets/styles/fieldset.scss +3 -0
- package/lib/assets/styles/gridlayout.scss +0 -2
- package/lib/assets/styles/hint.scss +21 -0
- package/lib/assets/styles/icon.scss +31 -4
- package/lib/assets/styles/input.scss +7 -7
- package/lib/assets/styles/multiSelect.scss +6 -1
- package/lib/assets/styles/radio.scss +37 -35
- package/lib/assets/styles/select.scss +13 -7
- package/lib/assets/styles/table.scss +9 -1
- package/lib/assets/styles/tabs.scss +28 -18
- package/lib/assets/styles/textContent.scss +9 -0
- package/lib/avatar/index.js +41 -41
- package/lib/badge/index.js +12 -14
- package/lib/buttons/ActivateButton.js +6 -9
- package/lib/buttons/AddButton.js +9 -12
- package/lib/buttons/Button.js +11 -12
- package/lib/buttons/ButtonGroups.js +6 -5
- package/lib/buttons/CancelButton.js +10 -9
- package/lib/buttons/DangerButton.js +10 -9
- package/lib/buttons/DefaultButton.js +90 -90
- package/lib/buttons/DestroyButton.js +10 -9
- package/lib/buttons/EditButton.js +6 -9
- package/lib/buttons/InactivateButton.js +6 -9
- package/lib/buttons/InfoButton.js +10 -9
- package/lib/buttons/PrimaryButton.js +10 -9
- package/lib/buttons/RestoreButton.js +6 -9
- package/lib/buttons/SaveButton.js +10 -9
- package/lib/buttons/SuccessButton.js +10 -9
- package/lib/buttons/WarningButton.js +10 -9
- package/lib/buttons/button_container/index.js +17 -21
- package/lib/buttons/index.js +16 -17
- package/lib/buttons/split_button/index.js +22 -25
- package/lib/buttons/types.d.ts +1 -0
- package/lib/calendar/DangerCalendar.js +10 -9
- package/lib/calendar/InfoCalendar.js +10 -9
- package/lib/calendar/PrimaryCalendar.js +10 -9
- package/lib/calendar/SuccessCalendar.js +10 -9
- package/lib/calendar/WarningCalendar.js +10 -9
- package/lib/calendar/base/Day.js +13 -12
- package/lib/calendar/base/Month.js +13 -18
- package/lib/calendar/base/Week.js +13 -18
- package/lib/calendar/base/helpers.js +12 -12
- package/lib/calendar/base/index.js +30 -44
- package/lib/calendar/index.js +7 -8
- package/lib/checkbox/Label.js +20 -10
- package/lib/checkbox/index.d.ts +2 -2
- package/lib/checkbox/index.js +83 -97
- package/lib/checkbox/types.d.ts +2 -1
- package/lib/dialog/Alert.js +5 -6
- package/lib/dialog/Custom.js +16 -18
- package/lib/dialog/Error.js +5 -6
- package/lib/dialog/Information.js +5 -6
- package/lib/dialog/Question.js +13 -14
- package/lib/dialog/Warning.js +7 -7
- package/lib/dialog/base/Content.js +8 -6
- package/lib/dialog/base/Footer.js +5 -8
- package/lib/dialog/base/Header.js +29 -29
- package/lib/dialog/base/index.d.ts +8 -2
- package/lib/dialog/base/index.js +109 -105
- package/lib/dialog/base/style.js +7 -10
- package/lib/dialog/form/index.js +31 -34
- package/lib/dialog/index.js +8 -9
- package/lib/dialog/types.d.ts +8 -13
- package/lib/drawer/Content.js +12 -11
- package/lib/drawer/Drawer.js +74 -88
- package/lib/drawer/Header.js +34 -37
- package/lib/drawer/helpers.js +3 -4
- package/lib/drawer/index.js +4 -5
- package/lib/dropdown/Popup.d.ts +1 -1
- package/lib/dropdown/Popup.js +41 -42
- package/lib/dropdown/helper.js +3 -5
- package/lib/dropdown/types.d.ts +1 -0
- package/lib/dropdown/withDropdown.js +39 -60
- package/lib/fieldset/index.js +52 -58
- package/lib/fieldset/types.d.ts +2 -0
- package/lib/form/Field.d.ts +2 -0
- package/lib/form/Field.js +73 -79
- package/lib/form/FieldArray.d.ts +2 -0
- package/lib/form/FieldArray.js +70 -94
- package/lib/form/FieldNumber.d.ts +2 -0
- package/lib/form/FieldNumber.js +39 -48
- package/lib/form/FieldPeriod.d.ts +2 -0
- package/lib/form/FieldPeriod.js +48 -54
- package/lib/form/helpers.d.ts +2 -0
- package/lib/form/helpers.js +22 -27
- package/lib/form/index.d.ts +2 -0
- package/lib/form/index.js +114 -146
- package/lib/form/types.d.ts +6 -2
- package/lib/form/withFieldHOC.d.ts +2 -0
- package/lib/form/withFieldHOC.js +32 -39
- package/lib/form/withFormSecurity.d.ts +2 -0
- package/lib/form/withFormSecurity.js +27 -35
- package/lib/gridlayout/GridCol.js +14 -14
- package/lib/gridlayout/GridRow.js +18 -12
- package/lib/gridlayout/index.js +3 -4
- package/lib/gridlayout/types.d.ts +1 -1
- package/lib/hint/helpers.d.ts +3 -0
- package/lib/hint/helpers.js +21 -0
- package/lib/hint/index.d.ts +2 -1
- package/lib/hint/index.js +18 -29
- package/lib/hint/types.d.ts +3 -0
- package/lib/icons/helper.d.ts +4 -0
- package/lib/icons/helper.js +7 -4
- package/lib/icons/index.d.ts +3 -2
- package/lib/icons/index.js +43 -48
- package/lib/icons/types.d.ts +22 -9
- package/lib/index.d.ts +2 -1
- package/lib/index.js +10 -10
- package/lib/inputs/base/InputTextBase.d.ts +2 -0
- package/lib/inputs/base/InputTextBase.js +149 -113
- package/lib/inputs/base/Label.d.ts +14 -0
- package/lib/inputs/base/Label.js +35 -0
- package/lib/inputs/base/helpers.d.ts +3 -2
- package/lib/inputs/base/helpers.js +21 -26
- package/lib/inputs/base/types.d.ts +17 -2
- package/lib/inputs/color/index.js +29 -40
- package/lib/inputs/date/Dialog.d.ts +2 -0
- package/lib/inputs/date/Dialog.js +9 -10
- package/lib/inputs/date/Dropdown.d.ts +2 -0
- package/lib/inputs/date/Dropdown.js +12 -11
- package/lib/inputs/date/helpers.d.ts +2 -0
- package/lib/inputs/date/helpers.js +14 -14
- package/lib/inputs/date/index.d.ts +2 -0
- package/lib/inputs/date/index.js +127 -152
- package/lib/inputs/date/types.d.ts +4 -1
- package/lib/inputs/{mask/imaskHOC.d.ts → errorMessage/index.d.ts} +5 -7
- package/lib/inputs/errorMessage/index.js +26 -0
- package/lib/inputs/file/DefaultFile.d.ts +2 -0
- package/lib/inputs/file/DefaultFile.js +47 -74
- package/lib/inputs/file/DragDropFile.d.ts +2 -0
- package/lib/inputs/file/DragDropFile.js +97 -149
- package/lib/inputs/file/File.d.ts +3 -1
- package/lib/inputs/file/File.js +26 -32
- package/lib/inputs/file/FileButtonSettings.d.ts +2 -0
- package/lib/inputs/file/FileButtonSettings.js +13 -13
- package/lib/inputs/file/helpers.d.ts +2 -0
- package/lib/inputs/file/helpers.js +4 -6
- package/lib/inputs/file/index.d.ts +2 -0
- package/lib/inputs/file/index.js +4 -5
- package/lib/inputs/file/types.d.ts +2 -0
- package/lib/inputs/inputHOC.d.ts +2 -1
- package/lib/inputs/inputHOC.js +21 -34
- package/lib/inputs/mask/BaseMask.d.ts +4 -5
- package/lib/inputs/mask/BaseMask.js +125 -37
- package/lib/inputs/mask/Cnpj.d.ts +2 -0
- package/lib/inputs/mask/Cnpj.js +18 -31
- package/lib/inputs/mask/Cpf.d.ts +2 -0
- package/lib/inputs/mask/Cpf.js +20 -37
- package/lib/inputs/mask/Phone.d.ts +2 -0
- package/lib/inputs/mask/Phone.js +7 -6
- package/lib/inputs/mask/ZipCode.d.ts +2 -0
- package/lib/inputs/mask/ZipCode.js +6 -9
- package/lib/inputs/mask/helpers.d.ts +50 -12
- package/lib/inputs/mask/helpers.js +77 -37
- package/lib/inputs/mask/index.d.ts +4 -2
- package/lib/inputs/mask/index.js +6 -7
- package/lib/inputs/mask/types.d.ts +18 -17
- package/lib/inputs/multiSelect/ActionButtons.d.ts +2 -0
- package/lib/inputs/multiSelect/ActionButtons.js +23 -22
- package/lib/inputs/multiSelect/Dropdown.d.ts +2 -0
- package/lib/inputs/multiSelect/Dropdown.js +50 -67
- package/lib/inputs/multiSelect/helper.d.ts +2 -0
- package/lib/inputs/multiSelect/helper.js +8 -7
- package/lib/inputs/multiSelect/index.d.ts +2 -0
- package/lib/inputs/multiSelect/index.js +83 -135
- package/lib/inputs/multiSelect/types.d.ts +2 -0
- package/lib/inputs/number/BaseNumber.d.ts +2 -1
- package/lib/inputs/number/BaseNumber.js +25 -24
- package/lib/inputs/number/Currency.d.ts +2 -1
- package/lib/inputs/number/Currency.js +8 -8
- package/lib/inputs/number/Decimal.d.ts +2 -1
- package/lib/inputs/number/Decimal.js +3 -6
- package/lib/inputs/number/format_number.js +5 -5
- package/lib/inputs/number/index.d.ts +2 -1
- package/lib/inputs/number/index.js +20 -32
- package/lib/inputs/number/types.d.ts +2 -9
- package/lib/inputs/period/Dialog.d.ts +3 -1
- package/lib/inputs/period/Dialog.js +9 -10
- package/lib/inputs/period/Dropdown.d.ts +2 -0
- package/lib/inputs/period/Dropdown.js +8 -9
- package/lib/inputs/period/PeriodList.d.ts +2 -0
- package/lib/inputs/period/PeriodList.js +14 -13
- package/lib/inputs/period/helper.d.ts +2 -0
- package/lib/inputs/period/helper.js +34 -37
- package/lib/inputs/period/index.d.ts +2 -0
- package/lib/inputs/period/index.js +162 -196
- package/lib/inputs/period/types.d.ts +3 -1
- package/lib/inputs/search/index.d.ts +2 -1
- package/lib/inputs/search/index.js +45 -68
- package/lib/inputs/select/ActionButtons.d.ts +2 -1
- package/lib/inputs/select/ActionButtons.js +25 -35
- package/lib/inputs/select/Dropdown.d.ts +2 -1
- package/lib/inputs/select/Dropdown.js +41 -60
- package/lib/inputs/select/helper.d.ts +2 -1
- package/lib/inputs/select/helper.js +49 -43
- package/lib/inputs/select/index.d.ts +2 -0
- package/lib/inputs/select/index.js +13 -12
- package/lib/inputs/select/multiple/Selecteds.d.ts +3 -1
- package/lib/inputs/select/multiple/Selecteds.js +17 -22
- package/lib/inputs/select/multiple/index.d.ts +2 -0
- package/lib/inputs/select/multiple/index.js +125 -162
- package/lib/inputs/select/simple/index.d.ts +2 -0
- package/lib/inputs/select/simple/index.js +154 -179
- package/lib/inputs/select/types.d.ts +5 -2
- package/lib/inputs/text/index.js +3 -6
- package/lib/inputs/textarea/index.d.ts +2 -0
- package/lib/inputs/textarea/index.js +10 -10
- package/lib/inputs/textarea/types.d.ts +2 -0
- package/lib/inputs/types.d.ts +12 -9
- package/lib/internals/colorStyles.js +2 -3
- package/lib/internals/constants.js +2 -4
- package/lib/internals/types.d.ts +5 -2
- package/lib/internals/withTooltip.d.ts +3 -2
- package/lib/internals/withTooltip.js +76 -76
- package/lib/labelMessages/index.js +22 -42
- package/lib/labels/DangerLabel.js +10 -9
- package/lib/labels/DefaultLabel.js +26 -40
- package/lib/labels/InfoLabel.js +10 -9
- package/lib/labels/PrimaryLabel.js +10 -9
- package/lib/labels/SuccessLabel.js +10 -9
- package/lib/labels/WarningLabel.js +10 -9
- package/lib/labels/index.js +8 -9
- package/lib/labels/label_container/index.js +8 -8
- package/lib/list/Header.js +9 -8
- package/lib/list/Item.js +74 -70
- package/lib/list/Separator.js +5 -8
- package/lib/list/helpers.js +4 -6
- package/lib/list/index.js +74 -101
- package/lib/menus/float/MenuItem.js +19 -20
- package/lib/menus/float/SubMenuContainer.js +27 -33
- package/lib/menus/float/helpers.js +3 -4
- package/lib/menus/float/index.js +17 -18
- package/lib/menus/float/types.d.ts +1 -1
- package/lib/menus/index.js +2 -3
- package/lib/menus/sidenav/ExpandMenu.js +9 -8
- package/lib/menus/sidenav/MenuLink.js +10 -9
- package/lib/menus/sidenav/NavMenuGroup.js +12 -11
- package/lib/menus/sidenav/NavMenuItem.js +48 -62
- package/lib/menus/sidenav/NavSubMenuItem.js +20 -25
- package/lib/menus/sidenav/helpers.js +6 -9
- package/lib/menus/sidenav/index.js +85 -113
- package/lib/menus/sidenav/popup_menu_search/EmptyList.js +7 -7
- package/lib/menus/sidenav/popup_menu_search/index.js +64 -84
- package/lib/menus/sidenav/types.d.ts +1 -1
- package/lib/noPermission/index.js +14 -17
- package/lib/panel/Content.d.ts +1 -1
- package/lib/panel/Content.js +47 -60
- package/lib/panel/DangerPanel.d.ts +1 -1
- package/lib/panel/DangerPanel.js +6 -9
- package/lib/panel/Default.d.ts +1 -1
- package/lib/panel/Default.js +45 -60
- package/lib/panel/Header.d.ts +1 -1
- package/lib/panel/Header.js +32 -30
- package/lib/panel/InfoPanel.d.ts +1 -1
- package/lib/panel/InfoPanel.js +6 -9
- package/lib/panel/PrimaryPanel.d.ts +1 -1
- package/lib/panel/PrimaryPanel.js +6 -9
- package/lib/panel/SuccessPanel.d.ts +1 -1
- package/lib/panel/SuccessPanel.js +6 -9
- package/lib/panel/ToolBar.d.ts +1 -1
- package/lib/panel/ToolBar.js +6 -5
- package/lib/panel/WarningPanel.d.ts +1 -1
- package/lib/panel/WarningPanel.js +6 -9
- package/lib/panel/helpers.d.ts +7 -2
- package/lib/panel/helpers.js +12 -24
- package/lib/panel/index.d.ts +1 -1
- package/lib/panel/index.js +9 -10
- package/lib/panel/types.d.ts +46 -5
- package/lib/permissionValidations.js +24 -29
- package/lib/popover/PopoverText.js +6 -5
- package/lib/popover/PopoverTitle.js +6 -5
- package/lib/popover/index.js +15 -19
- package/lib/progress/Bar.js +31 -37
- package/lib/progress/index.js +18 -20
- package/lib/radio/index.js +36 -57
- package/lib/shortcuts/index.js +10 -9
- package/lib/skeleton/SkeletonContainer.js +10 -11
- package/lib/skeleton/index.js +27 -34
- package/lib/spinner/SpinnerLoading.js +7 -8
- package/lib/spinner/index.js +23 -37
- package/lib/split/Split.js +95 -112
- package/lib/split/SplitSide.js +20 -19
- package/lib/split/helpers.js +3 -4
- package/lib/split/index.js +3 -4
- package/lib/table/Body.js +42 -45
- package/lib/table/Header.js +29 -32
- package/lib/table/HeaderColumn.d.ts +1 -1
- package/lib/table/HeaderColumn.js +35 -22
- package/lib/table/Row.js +45 -48
- package/lib/table/RowColumn.js +38 -39
- package/lib/table/helpers.js +7 -13
- package/lib/table/index.js +82 -102
- package/lib/table/types.d.ts +3 -0
- package/lib/tabs/DropdownTabs.d.ts +11 -0
- package/lib/tabs/DropdownTabs.js +71 -0
- package/lib/tabs/Menu.d.ts +1 -1
- package/lib/tabs/Menu.js +35 -23
- package/lib/tabs/{DropdownItems.d.ts → MenuTabs.d.ts} +3 -3
- package/lib/tabs/MenuTabs.js +82 -0
- package/lib/tabs/Panel.d.ts +1 -1
- package/lib/tabs/Panel.js +70 -66
- package/lib/tabs/context.d.ts +12 -0
- package/lib/tabs/context.js +130 -0
- package/lib/tabs/index.d.ts +1 -1
- package/lib/tabs/index.js +46 -225
- package/lib/tabs/tabHelpers.d.ts +4 -15
- package/lib/tabs/tabHelpers.js +37 -42
- package/lib/tabs/types.d.ts +48 -15
- package/lib/tabs/useTabs.d.ts +11 -0
- package/lib/tabs/useTabs.js +11 -0
- package/lib/textContent/index.d.ts +8 -0
- package/lib/textContent/index.js +30 -0
- package/lib/toolbar/ButtonBar.js +39 -43
- package/lib/toolbar/LabelBar.js +36 -40
- package/lib/toolbar/Separator.js +5 -8
- package/lib/toolbar/ToolBarGroup.js +7 -7
- package/lib/toolbar/helpers.js +2 -3
- package/lib/toolbar/index.js +23 -25
- package/lib/toolbar/types.d.ts +1 -0
- package/lib/tooltip/index.js +28 -33
- package/lib/treetable/Body.js +21 -33
- package/lib/treetable/Header.js +11 -14
- package/lib/treetable/Row.js +90 -142
- package/lib/treetable/helpers.js +15 -24
- package/lib/treetable/index.js +11 -13
- package/lib/treeview/Header.js +8 -7
- package/lib/treeview/Node.js +96 -136
- package/lib/treeview/constants.js +2 -3
- package/lib/treeview/index.js +150 -216
- package/lib/uitour/helpers.js +4 -7
- package/lib/uitour/index.d.ts +2 -1
- package/lib/uitour/index.js +113 -100
- package/lib/uitour/types.d.ts +9 -1
- package/package.json +77 -82
- package/tsconfig.json +1 -0
- package/.tool-versions +0 -1
- package/lib/inputs/mask/imaskHOC.js +0 -224
- package/lib/tabs/DropdownItems.js +0 -65
- package/lib/tabs/MenuItems.d.ts +0 -11
- package/lib/tabs/MenuItems.js +0 -76
- package/lib/treeview_old/Header.js +0 -28
- package/lib/treeview_old/Node.js +0 -88
- package/lib/treeview_old/index.js +0 -42
- package/lib/types-c2a0f035.d.ts +0 -50
package/lib/inputs/types.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { IBaseProps, CustomInputEvent } from './base/types.js';
|
|
|
5
5
|
import { IDrawerProps } from '../drawer/types.js';
|
|
6
6
|
import { TextAlign } from '../@types/Align.js';
|
|
7
7
|
import '../@types/Period.js';
|
|
8
|
+
import '../internals/types.js';
|
|
8
9
|
import '../@types/Position.js';
|
|
9
10
|
import '../@types/Icon.js';
|
|
10
11
|
import '../icons/helper.js';
|
|
@@ -53,16 +54,13 @@ interface IMaskHOCProps {
|
|
|
53
54
|
unmask?: boolean;
|
|
54
55
|
name?: string;
|
|
55
56
|
commit?: () => void;
|
|
56
|
-
onChange?: (event: CustomInputEvent, maskValue?: string, date?: string
|
|
57
|
-
initial: string;
|
|
58
|
-
final: string;
|
|
59
|
-
}) => void;
|
|
57
|
+
onChange?: (event: CustomInputEvent, maskValue?: string, date?: string) => void;
|
|
60
58
|
onFocus?: (e: CustomInputEvent) => void;
|
|
61
59
|
onComplete?: (e: CustomInputEvent, maskValue?: string, date?: string) => void;
|
|
62
60
|
inputRef?: MutableRefObject<HTMLInputElement | HTMLTextAreaElement | null> | ((ref: HTMLInputElement | HTMLTextAreaElement | null) => void);
|
|
63
61
|
placeholderChar?: string;
|
|
64
62
|
lazy?: boolean;
|
|
65
|
-
definitions?:
|
|
63
|
+
definitions?: any;
|
|
66
64
|
groups?: object;
|
|
67
65
|
pattern?: string;
|
|
68
66
|
format?: () => void;
|
|
@@ -97,7 +95,7 @@ interface IMaskHOCProps {
|
|
|
97
95
|
rounded?: boolean;
|
|
98
96
|
errorMessages?: string[];
|
|
99
97
|
skeletonize?: boolean;
|
|
100
|
-
mask?:
|
|
98
|
+
mask?: any;
|
|
101
99
|
isDateField?: boolean;
|
|
102
100
|
autoCompleteMask?: 'left' | 'right';
|
|
103
101
|
}
|
|
@@ -134,8 +132,8 @@ interface IDropdownSelectProps {
|
|
|
134
132
|
align?: 'left' | 'right';
|
|
135
133
|
}
|
|
136
134
|
interface IActionButtonsSelectProps {
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
handlerClear: () => void;
|
|
136
|
+
handlerOpenClose: () => void;
|
|
139
137
|
dropDownOpened: boolean;
|
|
140
138
|
showClearButton?: boolean;
|
|
141
139
|
disabled?: boolean;
|
|
@@ -150,5 +148,10 @@ interface IButtonsProps {
|
|
|
150
148
|
transparent: boolean;
|
|
151
149
|
disabled?: boolean;
|
|
152
150
|
}
|
|
151
|
+
interface ErrorProps {
|
|
152
|
+
customClass?: string;
|
|
153
|
+
style?: React.CSSProperties;
|
|
154
|
+
messages?: string | string[];
|
|
155
|
+
}
|
|
153
156
|
|
|
154
|
-
export { IActionButtonsSelectProps, IAdvancedFilterProps, IButtonsProps, IDropdownProps, IDropdownSelectProps, IInputHOCProps, IMaskHOCProps, ISearchProps };
|
|
157
|
+
export { ErrorProps, IActionButtonsSelectProps, IAdvancedFilterProps, IButtonsProps, IDropdownProps, IDropdownSelectProps, IInputHOCProps, IMaskHOCProps, ISearchProps };
|
|
@@ -4,12 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
7
|
+
const ColorStyles = {
|
|
8
8
|
PRIMARY: 'primary',
|
|
9
9
|
SUCCESS: 'success',
|
|
10
10
|
DANGER: 'danger',
|
|
11
11
|
INFO: 'info',
|
|
12
12
|
WARNING: 'warning'
|
|
13
13
|
};
|
|
14
|
-
var _default = ColorStyles;
|
|
15
|
-
exports.default = _default;
|
|
14
|
+
var _default = exports.default = ColorStyles;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.keyCodes = exports.PARA_ENGANAR_O_ESLINT_JA_QUE_TENHO_SO_UMA_CONSTANTE = void 0;
|
|
7
|
-
|
|
7
|
+
const keyCodes = exports.keyCodes = {
|
|
8
8
|
TAB: 9,
|
|
9
9
|
ENTER: 13,
|
|
10
10
|
ARROW_UP: 38,
|
|
@@ -12,6 +12,4 @@ var keyCodes = {
|
|
|
12
12
|
BACKSPACE: 8,
|
|
13
13
|
F: 70
|
|
14
14
|
};
|
|
15
|
-
exports.
|
|
16
|
-
var PARA_ENGANAR_O_ESLINT_JA_QUE_TENHO_SO_UMA_CONSTANTE = 1;
|
|
17
|
-
exports.PARA_ENGANAR_O_ESLINT_JA_QUE_TENHO_SO_UMA_CONSTANTE = PARA_ENGANAR_O_ESLINT_JA_QUE_TENHO_SO_UMA_CONSTANTE;
|
|
15
|
+
const PARA_ENGANAR_O_ESLINT_JA_QUE_TENHO_SO_UMA_CONSTANTE = exports.PARA_ENGANAR_O_ESLINT_JA_QUE_TENHO_SO_UMA_CONSTANTE = 1;
|
package/lib/internals/types.d.ts
CHANGED
|
@@ -8,9 +8,12 @@ interface WithTooltipProps {
|
|
|
8
8
|
tooltip?: string;
|
|
9
9
|
tooltipPosition?: Exclude<Position, 'center'>;
|
|
10
10
|
style?: CSSProperties;
|
|
11
|
-
|
|
11
|
+
handlerSetOnDeniedText?: (onDeniedValue: OnDenied) => void;
|
|
12
12
|
errorMessage?: string;
|
|
13
13
|
}
|
|
14
|
+
interface ITooltipContext {
|
|
15
|
+
handlerSetOnDeniedText: (text: string) => void;
|
|
16
|
+
}
|
|
14
17
|
interface GetDisplayNameParams {
|
|
15
18
|
displayName?: string;
|
|
16
19
|
name?: string;
|
|
@@ -19,4 +22,4 @@ interface HasToolTipParams {
|
|
|
19
22
|
tooltip?: string;
|
|
20
23
|
}
|
|
21
24
|
|
|
22
|
-
export { GetDisplayNameParams, HasToolTipParams, WithTooltipProps };
|
|
25
|
+
export { GetDisplayNameParams, HasToolTipParams, ITooltipContext, WithTooltipProps };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import { WithTooltipProps } from './types.js';
|
|
2
|
+
import { ITooltipContext, WithTooltipProps } from './types.js';
|
|
3
3
|
import '../@types/PermissionAttr.js';
|
|
4
4
|
import '../@types/Position.js';
|
|
5
5
|
|
|
6
|
+
declare const TooltipContext: React__default.Context<ITooltipContext>;
|
|
6
7
|
declare const withTooltip: <ComponentProps extends WithTooltipProps>(WrappedComponent: React__default.ComponentType<ComponentProps>) => {
|
|
7
8
|
(props: ComponentProps): JSX.Element;
|
|
8
9
|
displayName: string;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
|
-
export { withTooltip as default };
|
|
12
|
+
export { TooltipContext, withTooltip as default };
|
|
@@ -1,76 +1,62 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.TooltipContext = void 0;
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
8
|
var _tooltip = _interopRequireDefault(require("../tooltip"));
|
|
10
|
-
function _interopRequireDefault(
|
|
11
|
-
function _getRequireWildcardCache(
|
|
12
|
-
function _interopRequireWildcard(
|
|
13
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
-
var TOOLTIP_INITIAL_HEIGHT = 40;
|
|
21
|
-
var hasTooltip = function hasTooltip(_ref) {
|
|
22
|
-
var tooltip = _ref.tooltip;
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
13
|
+
const TOOLTIP_INITIAL_HEIGHT = 40;
|
|
14
|
+
const hasTooltip = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
tooltip
|
|
17
|
+
} = _ref;
|
|
23
18
|
return tooltip;
|
|
24
19
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
const TooltipContext = exports.TooltipContext = /*#__PURE__*/_react.default.createContext({});
|
|
21
|
+
const getDisplayName = _ref2 => {
|
|
22
|
+
let {
|
|
23
|
+
displayName,
|
|
24
|
+
name
|
|
25
|
+
} = _ref2;
|
|
28
26
|
return displayName || name || 'Component';
|
|
29
27
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
tooltipWidth =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
showTooltip = _useState6[0],
|
|
51
|
-
setShowTooltip = _useState6[1];
|
|
52
|
-
var _useState7 = (0, _react.useState)({
|
|
53
|
-
width: tooltipWidth,
|
|
54
|
-
height: TOOLTIP_INITIAL_HEIGHT
|
|
55
|
-
}),
|
|
56
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
57
|
-
tooltipDimensions = _useState8[0],
|
|
58
|
-
setTooltipDimensions = _useState8[1];
|
|
59
|
-
var targetElement = (0, _react.useRef)(null);
|
|
60
|
-
var tooltipElement = (0, _react.useRef)(null);
|
|
61
|
-
var onMouseOver = function onMouseOver(e) {
|
|
28
|
+
const withTooltip = WrappedComponent => {
|
|
29
|
+
const EnhancedComponent = props => {
|
|
30
|
+
const {
|
|
31
|
+
tooltip,
|
|
32
|
+
tooltipWidth = 'auto',
|
|
33
|
+
space = 20,
|
|
34
|
+
tooltipPosition = 'bottom',
|
|
35
|
+
errorMessage
|
|
36
|
+
} = props;
|
|
37
|
+
const [stateTooltipPosition, setStateTooltipPosition] = (0, _react.useState)(tooltipPosition);
|
|
38
|
+
const [onDeniedText, setOnDeniedText] = (0, _react.useState)('');
|
|
39
|
+
const [tooltipStyle, setTooltipStyle] = (0, _react.useState)('');
|
|
40
|
+
const [showTooltip, setShowTooltip] = (0, _react.useState)(false);
|
|
41
|
+
const [tooltipDimensions, setTooltipDimensions] = (0, _react.useState)({
|
|
42
|
+
width: tooltipWidth,
|
|
43
|
+
height: TOOLTIP_INITIAL_HEIGHT
|
|
44
|
+
});
|
|
45
|
+
const targetElement = (0, _react.useRef)(null);
|
|
46
|
+
const tooltipElement = (0, _react.useRef)(null);
|
|
47
|
+
const onMouseOver = e => {
|
|
62
48
|
if (targetElement.current && targetElement.current.contains(e.target)) {
|
|
63
49
|
setShowTooltip(true);
|
|
64
50
|
} else setShowTooltip(false);
|
|
65
51
|
};
|
|
66
|
-
|
|
52
|
+
const onMouseOut = () => {
|
|
67
53
|
setShowTooltip(false);
|
|
68
54
|
};
|
|
69
|
-
|
|
55
|
+
const onAnyScroll = () => {
|
|
70
56
|
setShowTooltip(false);
|
|
71
57
|
};
|
|
72
|
-
(0, _react.useEffect)(
|
|
73
|
-
if (hasTooltip(props)) {
|
|
58
|
+
(0, _react.useEffect)(() => {
|
|
59
|
+
if (hasTooltip(props) || onDeniedText) {
|
|
74
60
|
if (errorMessage) {
|
|
75
61
|
setShowTooltip(true);
|
|
76
62
|
} else {
|
|
@@ -82,8 +68,8 @@ var withTooltip = function withTooltip(WrappedComponent) {
|
|
|
82
68
|
}
|
|
83
69
|
}
|
|
84
70
|
}
|
|
85
|
-
return
|
|
86
|
-
if (hasTooltip(props)) {
|
|
71
|
+
return () => {
|
|
72
|
+
if (hasTooltip(props) || onDeniedText) {
|
|
87
73
|
document.removeEventListener('mouseover', onMouseOver);
|
|
88
74
|
document.removeEventListener('scroll', onAnyScroll, true);
|
|
89
75
|
if (targetElement && targetElement.current) {
|
|
@@ -91,16 +77,18 @@ var withTooltip = function withTooltip(WrappedComponent) {
|
|
|
91
77
|
}
|
|
92
78
|
}
|
|
93
79
|
};
|
|
94
|
-
}, [errorMessage]);
|
|
95
|
-
(0, _react.useEffect)(
|
|
80
|
+
}, [errorMessage, tooltip, onDeniedText]);
|
|
81
|
+
(0, _react.useEffect)(() => {
|
|
96
82
|
if (targetElement.current && tooltipElement.current) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
83
|
+
const {
|
|
84
|
+
width,
|
|
85
|
+
height
|
|
86
|
+
} = tooltipDimensions;
|
|
87
|
+
const targetDimensions = targetElement.current.getBoundingClientRect();
|
|
88
|
+
const targetVerticalCenter = (targetDimensions.top + targetDimensions.bottom) / 2;
|
|
89
|
+
const tooltipClientWidth = tooltipElement.current.clientWidth;
|
|
90
|
+
let style = "width: ".concat(typeof width === 'string' ? width : "".concat(width, "px"));
|
|
91
|
+
let left = targetDimensions.left + targetDimensions.width / 2 - tooltipClientWidth / 2;
|
|
104
92
|
left = Math.min(left, document.body.clientWidth - tooltipClientWidth - space);
|
|
105
93
|
style += "; left: ".concat(Math.max(space, left), "px");
|
|
106
94
|
switch (stateTooltipPosition) {
|
|
@@ -120,7 +108,11 @@ var withTooltip = function withTooltip(WrappedComponent) {
|
|
|
120
108
|
break;
|
|
121
109
|
case 'left':
|
|
122
110
|
if (targetDimensions.left < tooltipClientWidth) {
|
|
123
|
-
|
|
111
|
+
if (window.innerWidth - targetDimensions.right < tooltipClientWidth) {
|
|
112
|
+
setStateTooltipPosition('bottom');
|
|
113
|
+
} else {
|
|
114
|
+
setStateTooltipPosition('right');
|
|
115
|
+
}
|
|
124
116
|
} else {
|
|
125
117
|
style += "; top: ".concat(targetVerticalCenter + window.scrollY - height / 2, "px");
|
|
126
118
|
style += "; left: ".concat(targetDimensions.left - tooltipClientWidth - 6, "px");
|
|
@@ -139,14 +131,14 @@ var withTooltip = function withTooltip(WrappedComponent) {
|
|
|
139
131
|
}
|
|
140
132
|
setTooltipStyle(style);
|
|
141
133
|
}
|
|
142
|
-
}, [tooltipDimensions,
|
|
143
|
-
(0, _react.useEffect)(
|
|
134
|
+
}, [tooltipDimensions, stateTooltipPosition]);
|
|
135
|
+
(0, _react.useEffect)(() => {
|
|
144
136
|
setStateTooltipPosition(tooltipPosition);
|
|
145
137
|
}, [window.scrollY, window.scrollX, window.innerWidth]);
|
|
146
|
-
|
|
147
|
-
if (tooltip) {
|
|
138
|
+
const getTooltip = () => {
|
|
139
|
+
if (tooltip || onDeniedText) {
|
|
148
140
|
return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
149
|
-
text: tooltip,
|
|
141
|
+
text: onDeniedText || tooltip,
|
|
150
142
|
textError: errorMessage,
|
|
151
143
|
tooltipRef: tooltipElement,
|
|
152
144
|
style: tooltipStyle,
|
|
@@ -157,16 +149,24 @@ var withTooltip = function withTooltip(WrappedComponent) {
|
|
|
157
149
|
}
|
|
158
150
|
return null;
|
|
159
151
|
};
|
|
160
|
-
|
|
152
|
+
const getTarget = targetEl => {
|
|
161
153
|
if (!targetElement.current) targetElement.current = targetEl;
|
|
162
154
|
};
|
|
163
|
-
|
|
164
|
-
|
|
155
|
+
const contextValues = {
|
|
156
|
+
handlerSetOnDeniedText: setOnDeniedText
|
|
157
|
+
};
|
|
158
|
+
if (!hasTooltip(props) && !onDeniedText) {
|
|
159
|
+
return /*#__PURE__*/_react.default.createElement(TooltipContext.Provider, {
|
|
160
|
+
value: contextValues
|
|
161
|
+
}, /*#__PURE__*/_react.default.createElement(WrappedComponent, props));
|
|
162
|
+
}
|
|
163
|
+
return /*#__PURE__*/_react.default.createElement(TooltipContext.Provider, {
|
|
164
|
+
value: contextValues
|
|
165
|
+
}, /*#__PURE__*/_react.default.createElement(WrappedComponent, _extends({}, props, {
|
|
165
166
|
targetRef: getTarget
|
|
166
167
|
})), showTooltip && getTooltip());
|
|
167
168
|
};
|
|
168
169
|
EnhancedComponent.displayName = "withTooltip(".concat(getDisplayName(WrappedComponent), ")");
|
|
169
170
|
return EnhancedComponent;
|
|
170
171
|
};
|
|
171
|
-
var _default = withTooltip;
|
|
172
|
-
exports.default = _default;
|
|
172
|
+
var _default = exports.default = withTooltip;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -8,44 +7,26 @@ exports.default = void 0;
|
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
8
|
var _icons = _interopRequireDefault(require("../icons"));
|
|
10
9
|
require("../assets/styles/labelMessages.scss");
|
|
11
|
-
function _interopRequireDefault(
|
|
12
|
-
function _getRequireWildcardCache(
|
|
13
|
-
function _interopRequireWildcard(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
_ref$visible = _ref.visible,
|
|
32
|
-
visible = _ref$visible === void 0 ? true : _ref$visible,
|
|
33
|
-
_ref$children = _ref.children,
|
|
34
|
-
children = _ref$children === void 0 ? null : _ref$children,
|
|
35
|
-
_ref$customClass = _ref.customClass,
|
|
36
|
-
customClass = _ref$customClass === void 0 ? '' : _ref$customClass,
|
|
37
|
-
_ref$type = _ref.type,
|
|
38
|
-
type = _ref$type === void 0 ? 'default' : _ref$type,
|
|
39
|
-
_ref$showCloseButton = _ref.showCloseButton,
|
|
40
|
-
showCloseButton = _ref$showCloseButton === void 0 ? false : _ref$showCloseButton;
|
|
41
|
-
var _useState = (0, _react.useState)(false),
|
|
42
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
-
closed = _useState2[0],
|
|
44
|
-
setClosed = _useState2[1];
|
|
45
|
-
var getClass = function getClass() {
|
|
46
|
-
return "labelmessages-component -".concat(type, " ").concat(customClass, "\n ").concat(square && '-square', " ").concat(flat && '-flat');
|
|
47
|
-
};
|
|
48
|
-
var getIcon = function getIcon() {
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
const LabelMessages = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
style = {},
|
|
16
|
+
icon = null,
|
|
17
|
+
flat = false,
|
|
18
|
+
iconName,
|
|
19
|
+
handlerClosed,
|
|
20
|
+
square = true,
|
|
21
|
+
visible = true,
|
|
22
|
+
children = null,
|
|
23
|
+
customClass = '',
|
|
24
|
+
type = 'default',
|
|
25
|
+
showCloseButton = false
|
|
26
|
+
} = _ref;
|
|
27
|
+
const [closed, setClosed] = (0, _react.useState)(false);
|
|
28
|
+
const getClass = () => "labelmessages-component -".concat(type, " ").concat(customClass, "\n ").concat(square && '-square', " ").concat(flat && '-flat');
|
|
29
|
+
const getIcon = () => {
|
|
49
30
|
if (icon) {
|
|
50
31
|
return icon;
|
|
51
32
|
} else if (iconName) {
|
|
@@ -69,11 +50,10 @@ var LabelMessages = function LabelMessages(_ref) {
|
|
|
69
50
|
}, " ", getIcon(), " "), showCloseButton && /*#__PURE__*/_react.default.createElement("span", {
|
|
70
51
|
role: "presentation",
|
|
71
52
|
className: "labelmessagesitem -close",
|
|
72
|
-
onClick:
|
|
53
|
+
onClick: () => {
|
|
73
54
|
if (handlerClosed) handlerClosed();
|
|
74
55
|
setClosed(true);
|
|
75
56
|
}
|
|
76
57
|
}, "x")));
|
|
77
58
|
};
|
|
78
|
-
var _default = LabelMessages;
|
|
79
|
-
exports.default = _default;
|
|
59
|
+
var _default = exports.default = LabelMessages;
|
|
@@ -6,17 +6,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _DefaultLabel = _interopRequireDefault(require("./DefaultLabel"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(
|
|
11
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
12
|
-
function _objectWithoutProperties(
|
|
13
|
-
function _objectWithoutPropertiesLoose(
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
const _excluded = ["className"];
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
12
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
13
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
14
|
+
const DangerLabel = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
className
|
|
17
|
+
} = _ref,
|
|
16
18
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
17
19
|
return /*#__PURE__*/_react.default.createElement(_DefaultLabel.default, _extends({
|
|
18
20
|
className: "-danger"
|
|
19
21
|
}, rest));
|
|
20
22
|
};
|
|
21
|
-
var _default = DangerLabel;
|
|
22
|
-
exports.default = _default;
|
|
23
|
+
var _default = exports.default = DangerLabel;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -9,40 +8,30 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
8
|
var _icons = _interopRequireDefault(require("../icons"));
|
|
10
9
|
var _withTooltip = _interopRequireDefault(require("../internals/withTooltip"));
|
|
11
10
|
var _permissionValidations = require("../permissionValidations");
|
|
12
|
-
function _interopRequireDefault(
|
|
13
|
-
function _getRequireWildcardCache(
|
|
14
|
-
function _interopRequireWildcard(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
permissionAttr = _ref.permissionAttr,
|
|
37
|
-
skeletonize = _ref.skeletonize;
|
|
38
|
-
var options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible];
|
|
39
|
-
var _useState = (0, _react.useState)((0, _permissionValidations.actionsOnPermissionDenied)(options, permissionAttr)),
|
|
40
|
-
_useState2 = _slicedToArray(_useState, 1),
|
|
41
|
-
onDenied = _useState2[0];
|
|
42
|
-
var getClass = function getClass() {
|
|
43
|
-
return "label-component ".concat(className, " ").concat(customClass, " ").concat(bordered ? '-bordered' : '', " ").concat(disabled ? '-disabled' : '', "\n ").concat(skeletonize ? '-skeletonized' : '', "\n ").concat(size ? "-".concat(size) : '', "\n ").concat(iconAlign ? "icon-".concat(iconAlign) : '');
|
|
44
|
-
};
|
|
45
|
-
var getIcon = function getIcon() {
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
+
const DefaultLabel = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
style,
|
|
17
|
+
targetRef,
|
|
18
|
+
iconName,
|
|
19
|
+
icon,
|
|
20
|
+
children,
|
|
21
|
+
visible = true,
|
|
22
|
+
customClass,
|
|
23
|
+
className,
|
|
24
|
+
disabled,
|
|
25
|
+
size,
|
|
26
|
+
iconAlign = 'left',
|
|
27
|
+
bordered,
|
|
28
|
+
permissionAttr,
|
|
29
|
+
skeletonize
|
|
30
|
+
} = _ref;
|
|
31
|
+
const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible];
|
|
32
|
+
const [onDenied] = (0, _react.useState)((0, _permissionValidations.actionsOnPermissionDenied)(options, permissionAttr));
|
|
33
|
+
const getClass = () => "label-component ".concat(className, " ").concat(customClass, " ").concat(bordered ? '-bordered' : '', " ").concat(disabled ? '-disabled' : '', "\n ").concat(skeletonize ? '-skeletonized' : '', "\n ").concat(size ? "-".concat(size) : '', "\n ").concat(iconAlign ? "icon-".concat(iconAlign) : '');
|
|
34
|
+
const getIcon = () => {
|
|
46
35
|
if (icon) {
|
|
47
36
|
return icon;
|
|
48
37
|
} else if (iconName) {
|
|
@@ -57,10 +46,7 @@ var DefaultLabel = function DefaultLabel(_ref) {
|
|
|
57
46
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
58
47
|
style: style,
|
|
59
48
|
className: getClass(),
|
|
60
|
-
ref:
|
|
61
|
-
return targetRef && targetRef(r);
|
|
62
|
-
}
|
|
49
|
+
ref: r => targetRef && targetRef(r)
|
|
63
50
|
}, getIcon(), children);
|
|
64
51
|
};
|
|
65
|
-
var _default = (0, _withTooltip.default)(DefaultLabel);
|
|
66
|
-
exports.default = _default;
|
|
52
|
+
var _default = exports.default = (0, _withTooltip.default)(DefaultLabel);
|
package/lib/labels/InfoLabel.js
CHANGED
|
@@ -6,17 +6,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _DefaultLabel = _interopRequireDefault(require("./DefaultLabel"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(
|
|
11
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
12
|
-
function _objectWithoutProperties(
|
|
13
|
-
function _objectWithoutPropertiesLoose(
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
const _excluded = ["className"];
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
12
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
13
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
14
|
+
const InfoLabel = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
className
|
|
17
|
+
} = _ref,
|
|
16
18
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
17
19
|
return /*#__PURE__*/_react.default.createElement(_DefaultLabel.default, _extends({
|
|
18
20
|
className: "-info"
|
|
19
21
|
}, rest));
|
|
20
22
|
};
|
|
21
|
-
var _default = InfoLabel;
|
|
22
|
-
exports.default = _default;
|
|
23
|
+
var _default = exports.default = InfoLabel;
|