@woosmap/ui 2.55.0 → 2.56.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@woosmap/ui",
3
- "version": "2.55.0",
3
+ "version": "2.56.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/WebGeoServices/ui.git"
@@ -10,17 +10,13 @@ function mapChildrenWithProps(children, childrenRefs, closeCb) {
10
10
  if (children) {
11
11
  return React.Children.map(children, (child, index) => {
12
12
  if (React.isValidElement(child)) {
13
- // only add ref to non functional components
14
13
  return React.cloneElement(child, {
15
14
  ...child.props,
16
15
  closeCb,
17
- ref:
18
- !child.type.prototype || (child.type.prototype && child.type.prototype.render)
19
- ? (elem) => {
20
- // eslint-disable-next-line no-param-reassign
21
- childrenRefs[index] = elem;
22
- }
23
- : undefined,
16
+ ref: (elem) => {
17
+ // eslint-disable-next-line no-param-reassign
18
+ childrenRefs[index] = elem;
19
+ },
24
20
  });
25
21
  }
26
22
  return child;
@@ -101,7 +97,7 @@ class DropdownMenuSection extends Component {
101
97
  const childrenWithProps = mapChildrenWithProps(children, this.childrenRefs, closeCb);
102
98
  return (
103
99
  <div className="dropdown__menu__section">
104
- {title && <div className="dropdown__menu__section__title">{title}</div>}
100
+ {title && <div className="dropdown__menu__item dropdown__menu__item__title">{title}</div>}
105
101
  <ul {...rest}>{childrenWithProps}</ul>
106
102
  </div>
107
103
  );
@@ -138,7 +134,7 @@ class DropdownItem extends Component {
138
134
  render() {
139
135
  const { children, closeCb, testId, ...rest } = this.props;
140
136
  return (
141
- <li className={cl('dropdown__item')} data-testid={testId} {...rest}>
137
+ <li className={cl('dropdown__menu__item')} data-testid={testId} {...rest}>
142
138
  {children}
143
139
  </li>
144
140
  );
@@ -170,7 +166,7 @@ class DropdownButtonItem extends Component {
170
166
  render() {
171
167
  const { onClick, btnIcon, btnLabel, isImportant, closeCb, ...rest } = this.props;
172
168
  return (
173
- <li className={cl('dropdown__item')}>
169
+ <li className={cl('dropdown__menu__item')}>
174
170
  <Button
175
171
  className={cl({ 'btn--dropdown-item--important': isImportant })}
176
172
  type="dropdown-item"
@@ -224,7 +220,7 @@ class DropdownConfirmButtonItem extends Component {
224
220
  const { onConfirm, btnIcon, btnLabel, closeCb, confirmLabel, isImportant, placement, ...rest } = this.props;
225
221
  // onConfirm and closeCb are put in this list to remove them from ...rest.
226
222
  return (
227
- <li className={cl('dropdown__item')}>
223
+ <li className={cl('dropdown__menu__item')}>
228
224
  <ConfirmationPopover
229
225
  ref={this.confirmRef}
230
226
  text={confirmLabel}
@@ -353,7 +349,7 @@ class Dropdown extends Component {
353
349
 
354
350
  return (
355
351
  <div
356
- ref={openOnMouseEnter ? null : this.clickOutsideRef}
352
+ ref={this.clickOutsideRef}
357
353
  className={cl('dropdown', { open }, `dropdown--${size}`, className)}
358
354
  {...rest}
359
355
  onMouseEnter={this.onMouseEnter}
@@ -3,7 +3,7 @@
3
3
  display inline-block
4
4
  &__separator
5
5
  width 100%
6
- border-bottom .1rem solid $secondary-light
6
+ border-bottom .1rem solid $borderColor
7
7
  &__menu
8
8
  box()
9
9
  display none
@@ -51,30 +51,31 @@
51
51
  left auto
52
52
 
53
53
 
54
+ &__item
55
+ flexMiddle()
56
+ ellipsis()
57
+ height $buttonHeight + .6rem
58
+ .popover__child
59
+ width 100%
60
+ > :not(.btn):not(.popover__child)
61
+ flexMiddle()
62
+ ellipsis()
63
+ height $buttonHeight + .6rem
64
+ padding 0 $padding
65
+ width 100%
66
+ cursor default
67
+ &:hover
68
+ background-color $primary10
69
+ &:first-child
70
+ > *
71
+ border-radius $borderRadius $borderRadius 0 0
72
+ &:last-child
73
+ > *
74
+ border-radius 0 0 $borderRadius $borderRadius
75
+ &__title
76
+ padding 0 $padding 0 $padding
54
77
  &.open
55
78
  .dropdown__menu
56
79
  display block
57
80
  &--section
58
- display flex
59
-
60
- &__item
61
- flexMiddle()
62
- ellipsis()
63
- height $buttonHeight + .6rem
64
- .popover__child
65
- width 100%
66
- > :not(.btn):not(.popover__child)
67
- flexMiddle()
68
- ellipsis()
69
- height $buttonHeight + .6rem
70
- padding 0 $padding
71
- width 100%
72
- cursor default
73
- &:hover
74
- background-color $primary10
75
- &:first-child
76
- > *
77
- border-radius $borderRadius $borderRadius 0 0
78
- &:last-child
79
- > *
80
- border-radius 0 0 $borderRadius $borderRadius
81
+ display flex