linear-react-components-ui 1.1.20-beta.42 → 1.1.20-beta.43

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.
Files changed (47) hide show
  1. package/lib/assets/styles/button.scss +1 -0
  2. package/lib/assets/styles/effects.scss +0 -2
  3. package/lib/assets/styles/treetable.scss +2 -2
  4. package/lib/assets/styles/treeview.scss +24 -8
  5. package/lib/assets/styles/wizard.scss +100 -41
  6. package/lib/buttons/DefaultButton.js +6 -3
  7. package/lib/buttons/types.d.ts +1 -0
  8. package/lib/dialog/Alert.js +6 -2
  9. package/lib/dialog/Error.js +6 -2
  10. package/lib/dialog/Information.js +6 -2
  11. package/lib/dialog/Question.js +4 -4
  12. package/lib/dialog/Warning.js +6 -2
  13. package/lib/dialog/types.d.ts +1 -0
  14. package/lib/dialog/wizard/index.d.ts +1 -1
  15. package/lib/dialog/wizard/index.js +5 -3
  16. package/lib/dialog/wizard/progressbar.d.ts +2 -1
  17. package/lib/dialog/wizard/progressbar.js +5 -3
  18. package/lib/dropdown/Popup.d.ts +1 -1
  19. package/lib/dropdown/Popup.js +38 -17
  20. package/lib/dropdown/types.d.ts +6 -2
  21. package/lib/dropdown/withDropdown.js +5 -4
  22. package/lib/inputs/base/InputTextBase.js +7 -2
  23. package/lib/inputs/base/types.d.ts +1 -0
  24. package/lib/inputs/mask/helpers.d.ts +3 -3
  25. package/lib/inputs/number/BaseNumber.d.ts +1 -1
  26. package/lib/inputs/number/BaseNumber.js +9 -2
  27. package/lib/inputs/number/Currency.d.ts +1 -1
  28. package/lib/inputs/number/Currency.js +11 -4
  29. package/lib/popover/PopoverText.d.ts +1 -0
  30. package/lib/popover/PopoverTitle.d.ts +1 -0
  31. package/lib/popover/index.d.ts +3 -5
  32. package/lib/popover/index.js +21 -15
  33. package/lib/popover/types.d.ts +11 -0
  34. package/lib/treetable/Row.d.ts +1 -1
  35. package/lib/treetable/Row.js +40 -12
  36. package/lib/treetable/helpers.d.ts +1 -1
  37. package/lib/treetable/index.d.ts +2 -2
  38. package/lib/{types.d-73cece43.d.ts → types.d-b477e076.d.ts} +1 -0
  39. package/package.json +2 -2
  40. package/lib/checkbox/Label.js +0 -31
  41. package/lib/inputs/mask/imaskHOC.js +0 -203
  42. package/lib/menus/sidenav/popup_menu_help/index.js +0 -85
  43. package/lib/tabs/DropdownItems.js +0 -62
  44. package/lib/tabs/MenuItems.js +0 -70
  45. package/lib/treeview_old/Header.js +0 -29
  46. package/lib/treeview_old/Node.js +0 -68
  47. package/lib/treeview_old/index.js +0 -43
@@ -104,6 +104,7 @@ $shadow-button-inset-default: inset 0 0 0 1px $default-border-color, $shadow-but
104
104
  opacity: 0.7;
105
105
  border: solid 1px $font-color-disabled;
106
106
  pointer-events: auto;
107
+ cursor: not-allowed;
107
108
  }
108
109
  &.-shadowsdisabled {
109
110
  box-shadow: none!important;
@@ -135,12 +135,10 @@
135
135
  @keyframes revealelement {
136
136
  0% {
137
137
  color: transparent;
138
- height: 0%;
139
138
  opacity: 0.0;
140
139
  }
141
140
  50% {
142
141
  color: inherit;
143
- height: auto;
144
142
  opacity: 0.3;
145
143
  }
146
144
  100% {
@@ -78,13 +78,13 @@ table {
78
78
  display: flex;
79
79
  flex-direction: row;
80
80
  align-items: center;
81
+ justify-content: space-between;
81
82
  }
82
83
 
83
84
  span.container-toolbar-buttons {
84
- width: 100%;
85
+ width: auto;
85
86
  height: auto;
86
87
  margin-left: 4px;
87
- margin-right: 16px;
88
88
  }
89
89
 
90
90
  .row-toolbar {
@@ -1,6 +1,6 @@
1
1
  @import "./colors.scss";
2
2
  @import "./effects.scss";
3
- .treeview-component {
3
+ .treeview-component {
4
4
  display: flex;
5
5
  flex-direction: column;
6
6
  > .treeviewcontainer {
@@ -52,17 +52,17 @@
52
52
  align-items: center;
53
53
  min-height: 25px;
54
54
  color: $font-color-soft;
55
- >.node-menu {
55
+ > .node-menu {
56
56
  animation: revealelement 0.3s forwards ease-in-out;
57
57
  margin-left: 10px;
58
58
  }
59
- >.node-rightelements {
59
+ > .node-rightelements {
60
60
  animation: revealelement 0.3s forwards ease-in-out;
61
61
  display: flex;
62
62
  justify-content: flex-start;
63
63
  align-items: center;
64
64
  }
65
- >.node-toolbarelements {
65
+ > .node-toolbarelements {
66
66
  animation: revealelement 0.3s forwards ease-in-out;
67
67
  width: auto;
68
68
  height: 100%;
@@ -82,15 +82,31 @@
82
82
  }
83
83
  }
84
84
 
85
- .nodelist > .treeviewitem > .label > .node-rightelements > .element,
86
- .treeview-component > .treeviewcontainer > .treeviewitem > .label > .node-rightelements > .element {
85
+ .nodelist > .treeviewitem > .label > .node-rightelements > .element,
86
+ .treeview-component
87
+ > .treeviewcontainer
88
+ > .treeviewitem
89
+ > .label
90
+ > .node-rightelements
91
+ > .element {
87
92
  margin-left: 10px;
88
93
  display: flex;
89
94
  align-items: center;
90
95
  height: 100%;
91
96
  }
92
97
 
93
- .nodelist > .treeviewitem > .label > .node-toolbarelements > .toolbar-group > .buttonbar,
94
- .treeview-component > .treeviewcontainer > .treeviewitem > .label > .node-toolbarelements > .toolbar-group > .buttonbar {
98
+ .nodelist
99
+ > .treeviewitem
100
+ > .label
101
+ > .node-toolbarelements
102
+ > .toolbar-group
103
+ > .buttonbar,
104
+ .treeview-component
105
+ > .treeviewcontainer
106
+ > .treeviewitem
107
+ > .label
108
+ > .node-toolbarelements
109
+ > .toolbar-group
110
+ > .buttonbar {
95
111
  border: none;
96
112
  }
@@ -4,11 +4,72 @@
4
4
  .wizard-wrapper {
5
5
  .wizard-content {
6
6
  display: flex !important;
7
- flex-direction: column;
8
- .wizard-body{
9
- overflow: auto;
7
+ &:has(.wizard-progressbar[data-position="top"]) {
8
+ flex-direction: column;
9
+ }
10
+ &:has(.wizard-progressbar[data-position="left"]) {
11
+ flex-direction: row;
12
+ }
13
+ .wizard-progressbar {
14
+ > .title {
15
+ font-size: 16px;
16
+ font-weight: 600;
17
+ display: flex;
18
+ align-items: center;
19
+ position: relative;
20
+ &[data-disabled="true"] {
21
+ pointer-events: none;
22
+ -webkit-user-select: none;
23
+ -ms-user-select: none;
24
+ user-select: none;
25
+ .step {
26
+ .number {
27
+ background-color: #dadada;
28
+ border-color: #dadada;
29
+ }
30
+ }
31
+ .step-title {
32
+ color: #dadada;
33
+ }
34
+ }
35
+ &[data-completed="true"] {
36
+ > .step {
37
+ > .number {
38
+ background-color: $success-color;
39
+ border-color: $success-color;
40
+ }
41
+ }
42
+ }
43
+ > .step {
44
+ display: flex;
45
+ flex-direction: column;
46
+ align-items: center;
47
+ justify-content: center;
48
+ > .number {
49
+ display: flex;
50
+ align-items: center;
51
+ justify-content: center;
52
+ font-size: 20px;
53
+ font-weight: 600;
54
+ width: 36px;
55
+ height: 36px;
56
+ border-radius: 100%;
57
+ color: #fff;
58
+ background-color: $color-light-dark;
59
+ z-index: 1;
60
+ transition: all 0.2s ease-in-out;
61
+ border: 2px solid $color-light-dark;
62
+ }
63
+ }
64
+ > .step-title {
65
+ max-width: 150px;
66
+ overflow: hidden;
67
+ font-weight: 500;
68
+ color: $font-color-soft;
69
+ }
70
+ }
10
71
  }
11
- .wizard-progresbar {
72
+ .wizard-progressbar[data-position="top"] {
12
73
  width: 100%;
13
74
  display: grid;
14
75
  grid-auto-columns: 1fr;
@@ -19,12 +80,7 @@
19
80
  border-bottom: 2px solid $component-border-color;
20
81
  gap: 10px;
21
82
  > .title {
22
- font-size: 16px;
23
- font-weight: 600;
24
- display: flex;
25
- align-items: center;
26
83
  flex-direction: column;
27
- position: relative;
28
84
  flex: 1;
29
85
  text-align: center;
30
86
  &:first-child {
@@ -81,47 +137,50 @@
81
137
  & + .title:after {
82
138
  background-color: $success-color !important;
83
139
  }
84
- > .step {
85
- > .number {
86
- background-color: $success-color;
87
- border-color: $success-color;
88
- }
89
- }
90
- }
91
- &[data-disabled="true"] .step {
92
- opacity: 0.3;
93
140
  }
94
141
  > .step {
95
- display: flex;
96
- flex-direction: column;
97
- align-items: center;
98
- justify-content: center;
99
142
  width: 54px;
100
- > .number {
101
- display: flex;
102
- align-items: center;
103
- justify-content: center;
104
- font-size: 20px;
105
- font-weight: 600;
106
- width: 36px;
107
- height: 36px;
108
- border-radius: 100%;
109
- color: #fff;
110
- background-color: $color-light-dark;
111
- z-index: 1;
112
- transition: all 0.2s ease-in-out;
113
- border: 2px solid $color-light-dark;
114
- }
115
143
  }
116
144
  > .step-title {
117
- max-width: 150px;
118
- overflow: hidden;
119
145
  margin-top: 6px;
120
- font-weight: 500;
121
- color: $font-color-soft;
122
146
  }
123
147
  }
124
148
  }
149
+ .wizard-progressbar[data-position="left"] {
150
+ width: 220px;
151
+ display: flex;
152
+ flex-direction: column;
153
+ gap: 30px;
154
+ border-right: 1px solid #ccc;
155
+ padding: 10px 16px 10px 10px;
156
+ margin-right: 10px;
157
+ background-color: $fieldset-default;
158
+ > .title {
159
+ gap: 10px;
160
+ &:has(+ .title) {
161
+ &:after {
162
+ content: "";
163
+ position: absolute;
164
+ bottom: -44px;
165
+ left: 17px;
166
+ width: 3px;
167
+ height: calc(100% + 10px);
168
+ background-color: #dadada;
169
+ }
170
+ }
171
+ &[data-completed="true"] {
172
+ &:has(+ .title):after {
173
+ background-color: $success-color !important;
174
+ }
175
+ }
176
+ > .step {
177
+ width: 36px;
178
+ }
179
+ }
180
+ }
181
+ .wizard-body {
182
+ overflow: auto;
183
+ }
125
184
  }
126
185
  }
127
186
  }
@@ -11,7 +11,7 @@ var _withTooltip = _interopRequireWildcard(require("../internals/withTooltip"));
11
11
  var _spinner = _interopRequireDefault(require("../spinner"));
12
12
  var _withDropdown = _interopRequireDefault(require("../dropdown/withDropdown"));
13
13
  var _permissionValidations = require("../permissionValidations");
14
- const _excluded = ["dropdown", "onClick", "disabled", "iconName", "icon", "targetRef", "tabIndex", "isLoading", "label", "showDropdown", "getDropdownPopup", "isDropdownOpened", "showIconDropdown", "content", "style", "toggleable", "activeIconColor", "iconStyle", "visible", "customClass", "className", "size", "iconAlign", "boxShadow", "transparent", "round", "permissionAttr", "skeletonize", "errorMessage", "tooltipWidth", "isFloatMenu", "dropdownAlign", "customClassForDropdown", "buttonRef", "onDeniedText"];
14
+ const _excluded = ["dropdown", "onClick", "disabled", "iconName", "icon", "targetRef", "tabIndex", "isLoading", "label", "showDropdown", "getDropdownPopup", "isDropdownOpened", "showIconDropdown", "content", "style", "toggleable", "activeIconColor", "iconStyle", "visible", "customClass", "className", "size", "iconAlign", "boxShadow", "transparent", "round", "permissionAttr", "skeletonize", "errorMessage", "isFloatMenu", "dropdownAlign", "customClassForDropdown", "buttonRef", "handlerClose", "onDeniedText", "tooltip", "tooltipWidth", "tooltipPosition"];
15
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
16
  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); }
17
17
  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; }
@@ -54,12 +54,15 @@ const DefaultButton = _ref => {
54
54
  permissionAttr,
55
55
  skeletonize,
56
56
  errorMessage,
57
- tooltipWidth,
58
57
  isFloatMenu,
59
58
  dropdownAlign,
60
59
  customClassForDropdown,
61
60
  buttonRef,
62
- onDeniedText = 'Permissão Negada! Consulte o Administrador do sistema.'
61
+ handlerClose,
62
+ onDeniedText = 'Permissão Negada! Consulte o Administrador do sistema.',
63
+ tooltip,
64
+ tooltipWidth,
65
+ tooltipPosition
63
66
  } = _ref,
64
67
  rest = _objectWithoutProperties(_ref, _excluded);
65
68
  const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible];
@@ -41,6 +41,7 @@ interface IButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
41
41
  customClassForDropdown?: string;
42
42
  dropdownAlign?: 'left' | 'right';
43
43
  onClick?: (e: MouseEvent<HTMLButtonElement>) => void;
44
+ handlerClose?: (cb: () => void) => void;
44
45
  closeDropdownOnClickOutside?: boolean;
45
46
  errorMessage?: string;
46
47
  onDeniedText?: string;
@@ -11,10 +11,14 @@ var _icons = _interopRequireDefault(require("../icons"));
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
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
13
  const Alert = props => {
14
+ const {
15
+ onConfirmClick,
16
+ confirmLabel = 'Confirmar'
17
+ } = props;
14
18
  const buttons = [/*#__PURE__*/_react.default.createElement(_buttons.PrimaryButton, {
15
19
  key: "confirm-buttom",
16
- onClick: props.onConfirmClick,
17
- label: props.confirmLabel ?? 'Confirmar'
20
+ onClick: onConfirmClick,
21
+ label: confirmLabel
18
22
  })];
19
23
  return /*#__PURE__*/_react.default.createElement(_Custom.default, _extends({}, props, {
20
24
  buttons: buttons,
@@ -11,10 +11,14 @@ var _icons = _interopRequireDefault(require("../../lib/icons"));
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
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
13
  const Error = props => {
14
+ const {
15
+ onConfirmClick,
16
+ confirmLabel = 'Confirmar'
17
+ } = props;
14
18
  const buttons = [/*#__PURE__*/_react.default.createElement(_buttons.PrimaryButton, {
15
19
  key: "confirm-buttom",
16
- onClick: props.onConfirmClick,
17
- label: props.confirmLabel ?? 'Confirmar'
20
+ onClick: onConfirmClick,
21
+ label: confirmLabel
18
22
  })];
19
23
  return /*#__PURE__*/_react.default.createElement(_Custom.default, _extends({}, props, {
20
24
  buttons: buttons,
@@ -11,10 +11,14 @@ var _icons = _interopRequireDefault(require("../../lib/icons"));
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
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
13
  const Information = props => {
14
+ const {
15
+ onConfirmClick,
16
+ confirmLabel = 'Confirmar'
17
+ } = props;
14
18
  const buttons = [/*#__PURE__*/_react.default.createElement(_buttons.PrimaryButton, {
15
19
  key: "confirm-buttom",
16
- onClick: props.onConfirmClick,
17
- label: props.confirmLabel ?? 'Confirmar'
20
+ onClick: onConfirmClick,
21
+ label: confirmLabel
18
22
  })];
19
23
  return /*#__PURE__*/_react.default.createElement(_Custom.default, _extends({}, props, {
20
24
  buttons: buttons,
@@ -19,8 +19,8 @@ const Question = props => {
19
19
  isWaiting,
20
20
  onConfirmClick,
21
21
  onUnconfirmClick,
22
- confirmLabel,
23
- declineLabel
22
+ confirmLabel = 'Sim',
23
+ declineLabel = 'Não'
24
24
  } = props;
25
25
  const idUnconfirm = 'botao-unconfirm-click';
26
26
  const buttons = [/*#__PURE__*/_react.default.createElement(_buttons.DangerButton, {
@@ -28,13 +28,13 @@ const Question = props => {
28
28
  disabled: isWaiting,
29
29
  onClick: onConfirmClick,
30
30
  isLoading: isWaiting,
31
- label: confirmLabel ?? 'Sim'
31
+ label: confirmLabel
32
32
  }), /*#__PURE__*/_react.default.createElement(_buttons.default, {
33
33
  id: idUnconfirm,
34
34
  key: "no-buttom",
35
35
  disabled: isWaiting,
36
36
  onClick: onUnconfirmClick,
37
- label: declineLabel ?? 'Não'
37
+ label: declineLabel
38
38
  })];
39
39
  (0, _react.useLayoutEffect)(() => {
40
40
  const lastElementActive = document.activeElement;
@@ -11,9 +11,13 @@ var _icons = _interopRequireDefault(require("../../lib/icons"));
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
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
13
  const Warning = props => {
14
+ const {
15
+ onConfirmClick,
16
+ confirmLabel = 'Confirmar'
17
+ } = props;
14
18
  const buttons = [/*#__PURE__*/_react.default.createElement(_buttons.PrimaryButton, {
15
- onClick: props.onConfirmClick,
16
- label: props.confirmLabel ?? 'Confirmar',
19
+ onClick: onConfirmClick,
20
+ label: confirmLabel,
17
21
  key: 1
18
22
  })];
19
23
  return /*#__PURE__*/_react.default.createElement(_Custom.default, _extends({}, props, {
@@ -86,6 +86,7 @@ interface WizardComponentProps extends Omit<IFormProps, 'content'> {
86
86
  controls: WizardControls;
87
87
  customStyleForProgressBar?: CSSProperties;
88
88
  customStyleForBody?: CSSProperties;
89
+ progressBarPosition?: 'top' | 'left';
89
90
  }
90
91
  interface WizardStepComponentProps {
91
92
  children: React.ReactNode;
@@ -8,6 +8,6 @@ import '../../icons/helper.js';
8
8
 
9
9
  declare const WizardContext: React__default.Context<WizardControls | null>;
10
10
  declare const useWizardContext: () => WizardControls | null;
11
- declare function Wizard({ children, controls, showProgressbar, customStyleForProgressBar, customStyleForBody, ...dialogProps }: Readonly<WizardComponentProps>): JSX.Element;
11
+ declare function Wizard({ children, controls, showProgressbar, customStyleForProgressBar, customStyleForBody, progressBarPosition, ...dialogProps }: Readonly<WizardComponentProps>): JSX.Element;
12
12
 
13
13
  export { Wizard as Container, WizardContext, Wizard as default, useWizardContext };
@@ -25,7 +25,7 @@ var _progressbar = require("./progressbar");
25
25
  require("../../assets/styles/wizard.scss");
26
26
  var _step = require("./step");
27
27
  var _useWizard = require("./useWizard");
28
- const _excluded = ["children", "controls", "showProgressbar", "customStyleForProgressBar", "customStyleForBody"];
28
+ const _excluded = ["children", "controls", "showProgressbar", "customStyleForProgressBar", "customStyleForBody", "progressBarPosition"];
29
29
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
30
30
  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); }
31
31
  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; }
@@ -41,7 +41,8 @@ function Wizard(_ref) {
41
41
  controls,
42
42
  showProgressbar = true,
43
43
  customStyleForProgressBar,
44
- customStyleForBody
44
+ customStyleForBody,
45
+ progressBarPosition = 'top'
45
46
  } = _ref,
46
47
  dialogProps = _objectWithoutProperties(_ref, _excluded);
47
48
  const {
@@ -69,7 +70,8 @@ function Wizard(_ref) {
69
70
  contentClassName: "wizard-content"
70
71
  }, dialogProps), showProgressbar && /*#__PURE__*/_react.default.createElement(_progressbar.Progressbar, {
71
72
  stepsTitle: stepsTitle,
72
- customStyle: customStyleForProgressBar
73
+ customStyle: customStyleForProgressBar,
74
+ position: progressBarPosition
73
75
  }), /*#__PURE__*/_react.default.createElement("div", {
74
76
  className: "wizard-body",
75
77
  style: customStyleForBody
@@ -1,6 +1,6 @@
1
1
  import { CSSProperties } from 'react';
2
2
 
3
- declare function Progressbar({ customClass, customStyle, stepsTitle }: Readonly<{
3
+ declare function Progressbar({ customClass, customStyle, stepsTitle, position, }: Readonly<{
4
4
  customClass?: string;
5
5
  stepsTitle: {
6
6
  title: string;
@@ -8,6 +8,7 @@ declare function Progressbar({ customClass, customStyle, stepsTitle }: Readonly<
8
8
  completed: boolean;
9
9
  }[];
10
10
  customStyle?: CSSProperties;
11
+ position?: 'top' | 'left';
11
12
  }>): JSX.Element;
12
13
 
13
14
  export { Progressbar };
@@ -11,7 +11,8 @@ function Progressbar(_ref) {
11
11
  let {
12
12
  customClass,
13
13
  customStyle,
14
- stepsTitle
14
+ stepsTitle,
15
+ position = 'top'
15
16
  } = _ref;
16
17
  const context = (0, _.useWizardContext)();
17
18
  if (!context) throw new Error('WizardProgressbar must be used within a Wizard component');
@@ -19,8 +20,9 @@ function Progressbar(_ref) {
19
20
  currentStep
20
21
  } = context;
21
22
  return /*#__PURE__*/_react.default.createElement("div", {
22
- className: `wizard-progresbar ${customClass}`,
23
- style: customStyle
23
+ className: `wizard-progressbar ${customClass}`,
24
+ style: customStyle,
25
+ "data-position": position
24
26
  }, stepsTitle.map(step => /*#__PURE__*/_react.default.createElement("div", {
25
27
  key: step.number,
26
28
  className: "title",
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { IPopUpProps } from './types.js';
3
3
 
4
- declare const DropdownPopup: ({ id, customClassForDropdown, align, isFloatMenu, topPosition, leftPosition, rightPosition, minWidth, ...props }: IPopUpProps) => React.ReactPortal;
4
+ declare const DropdownPopup: ({ id, customClassForDropdown, align, isFloatMenu, topPosition, leftPosition, rightPosition, minWidth, targetRef, ...props }: IPopUpProps) => React.ReactPortal;
5
5
 
6
6
  export { DropdownPopup as default };
@@ -7,20 +7,36 @@ exports.default = void 0;
7
7
  var _react = require("react");
8
8
  var _reactDom = _interopRequireDefault(require("react-dom"));
9
9
  var _uuid = require("uuid");
10
- const _excluded = ["id", "customClassForDropdown", "align", "isFloatMenu", "topPosition", "leftPosition", "rightPosition", "minWidth"];
10
+ const _excluded = ["id", "customClassForDropdown", "align", "isFloatMenu", "topPosition", "leftPosition", "rightPosition", "minWidth", "targetRef"];
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
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
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 getCalendarDropdownStyle = _ref => {
14
+ const getDropdownStyles = _ref => {
15
15
  let {
16
- topPosition,
17
- leftPosition,
18
- rightPosition,
19
16
  align,
20
17
  isFloatMenu,
21
- minWidth
18
+ minWidth,
19
+ container,
20
+ target
22
21
  } = _ref;
23
- let style = `top: ${topPosition + (isFloatMenu ? 6 : 2)}px; min-width: ${minWidth}px;`;
22
+ if (!container || !target) return '';
23
+ const targetDimensions = target.getBoundingClientRect();
24
+ const rightPosition = !isFloatMenu ? window.innerWidth - targetDimensions.x - targetDimensions.width - 4 : undefined;
25
+ const leftPosition = targetDimensions.left;
26
+ let topPosition = targetDimensions.top + window.scrollY + targetDimensions.height;
27
+ let top = topPosition + (isFloatMenu ? 6 : 2);
28
+ let maxHeight = undefined;
29
+ let showScroll = false;
30
+ const isOverflowing = top + container.scrollHeight > window.innerHeight;
31
+ if (isOverflowing) {
32
+ const targetPosition = targetDimensions.top;
33
+ const containerHeight = container.scrollHeight;
34
+ showScroll = containerHeight > targetPosition;
35
+ maxHeight = showScroll ? targetPosition - 10 : containerHeight;
36
+ top = top - maxHeight - targetDimensions.height - (isFloatMenu ? 6 : 2) - 5;
37
+ }
38
+ let style = `top: ${top}px; min-width: ${minWidth}px;`;
39
+ if (showScroll) style += `max-height: ${maxHeight}px; overflow-y: scroll;`;
24
40
  if (align === 'left') {
25
41
  style += `left: ${leftPosition}px;`;
26
42
  } else if (align === 'right') {
@@ -28,7 +44,9 @@ const getCalendarDropdownStyle = _ref => {
28
44
  }
29
45
  return style;
30
46
  };
31
- const body = document.getElementsByTagName('body')[0];
47
+ const {
48
+ body
49
+ } = document;
32
50
  const DropdownPopup = _ref2 => {
33
51
  let {
34
52
  id,
@@ -38,20 +56,13 @@ const DropdownPopup = _ref2 => {
38
56
  topPosition = 0,
39
57
  leftPosition = 0,
40
58
  rightPosition = 0,
41
- minWidth = 0
59
+ minWidth = 0,
60
+ targetRef
42
61
  } = _ref2,
43
62
  props = _objectWithoutProperties(_ref2, _excluded);
44
63
  const popup = (0, _react.useRef)(document.createElement('div'));
45
64
  popup.current.className = `dropdown-component ${customClassForDropdown}`;
46
65
  popup.current.dataset.testid = 'dropdown-component';
47
- popup.current.style.cssText = getCalendarDropdownStyle({
48
- topPosition,
49
- leftPosition,
50
- rightPosition,
51
- align,
52
- isFloatMenu,
53
- minWidth
54
- });
55
66
  if (popup && popup.current) {
56
67
  const modalContainers = document.body.getElementsByClassName('modalcontainer');
57
68
  const lastModalContainer = modalContainers[modalContainers.length - 1];
@@ -60,6 +71,16 @@ const DropdownPopup = _ref2 => {
60
71
  (0, _react.useEffect)(() => {
61
72
  body.appendChild(popup.current);
62
73
  popup.current.id = id || `dropdown-component-${(0, _uuid.v1)()}`;
74
+ popup.current.style.cssText = getDropdownStyles({
75
+ topPosition,
76
+ leftPosition,
77
+ rightPosition,
78
+ align,
79
+ isFloatMenu,
80
+ minWidth,
81
+ container: popup.current,
82
+ target: targetRef
83
+ });
63
84
  return () => {
64
85
  body.removeChild(popup.current);
65
86
  };
@@ -10,6 +10,7 @@ interface WithDropdownProps {
10
10
  closeDropdownOnClickOutside?: boolean;
11
11
  showDropdown?: () => void;
12
12
  isFloatMenu?: boolean;
13
+ handlerClose?: (cb: () => void) => void;
13
14
  }
14
15
  interface WrappedComponentProps extends WithDropdownProps {
15
16
  getDropdownPopup?: (ref: Ref<HTMLElement | null>) => ReactElement;
@@ -31,14 +32,17 @@ interface IPopUpProps {
31
32
  leftPosition?: number;
32
33
  rightPosition?: number;
33
34
  minWidth?: number;
35
+ targetRef?: HTMLElement;
34
36
  }
35
- interface GetCalendarDropdownStyleParams {
37
+ interface GetDropdownStyleParams {
36
38
  align: 'left' | 'right';
37
39
  minWidth: number;
38
40
  isFloatMenu: boolean;
39
41
  topPosition: number;
40
42
  leftPosition: number;
41
43
  rightPosition: number;
44
+ container?: HTMLDivElement;
45
+ target?: HTMLElement;
42
46
  }
43
47
 
44
- export { GetCalendarDropdownStyleParams, GetDisplayNameParams, IPopUpProps, WithDropdownContextProps, WithDropdownProps, WrappedComponentProps };
48
+ export { GetDisplayNameParams, GetDropdownStyleParams, IPopUpProps, WithDropdownContextProps, WithDropdownProps, WrappedComponentProps };
@@ -20,6 +20,7 @@ const withDropdown = WrappedComponent => {
20
20
  showDropdown,
21
21
  dropdown,
22
22
  closeDropdownOnClickOutside = true,
23
+ handlerClose,
23
24
  customClassForDropdown,
24
25
  children,
25
26
  dropdownAlign = 'left',
@@ -48,11 +49,8 @@ const withDropdown = WrappedComponent => {
48
49
  const getDropdown = targetRef => {
49
50
  if (!targetRef || !opened) return null;
50
51
  wrappedComponentRef.current = targetRef;
51
- const targetDimensions = targetRef.getBoundingClientRect();
52
52
  return /*#__PURE__*/_react.default.createElement(_Popup.default, {
53
- topPosition: targetDimensions.top + window.scrollY + targetDimensions.height,
54
- rightPosition: !isFloatMenu ? window.innerWidth - targetDimensions.x - targetDimensions.width - 4 : undefined,
55
- leftPosition: targetDimensions.left,
53
+ targetRef: targetRef,
56
54
  align: dropdownAlign,
57
55
  customClassForDropdown: customClassForDropdown,
58
56
  isFloatMenu: isFloatMenu
@@ -73,6 +71,9 @@ const withDropdown = WrappedComponent => {
73
71
  }
74
72
  };
75
73
  }, []);
74
+ (0, _react.useEffect)(() => {
75
+ if (handlerClose) handlerClose(() => setOpened(false));
76
+ }, [handlerClose]);
76
77
  const contextValues = {
77
78
  handleDropdownClose: onDropdownClick
78
79
  };