@woosmap/ui 3.130.0 → 3.130.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.
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Encoding">
4
+ <file url="PROJECT" charset="UTF-8" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,18 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
+ <inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
6
+ <option name="ignoredPackages">
7
+ <value>
8
+ <list size="4">
9
+ <item index="0" class="java.lang.String" itemvalue="Fabric" />
10
+ <item index="1" class="java.lang.String" itemvalue="PyYAML" />
11
+ <item index="2" class="java.lang.String" itemvalue="Jinja2" />
12
+ <item index="3" class="java.lang.String" itemvalue="github3.py" />
13
+ </list>
14
+ </value>
15
+ </option>
16
+ </inspection_tool>
17
+ </profile>
18
+ </component>
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
package/.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
4
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/ui.iml" filepath="$PROJECT_DIR$/.idea/ui.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="PrettierConfiguration">
4
+ <option name="myRunOnReformat" value="true" />
5
+ </component>
6
+ </project>
package/.idea/ui.iml ADDED
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="inheritedJdk" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ <component name="TemplatesService">
9
+ <option name="TEMPLATE_FOLDERS">
10
+ <list>
11
+ <option value="$MODULE_DIR$/node_modules/@storybook/core/dist/server/templates" />
12
+ </list>
13
+ </option>
14
+ </component>
15
+ </module>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@woosmap/ui",
3
- "version": "3.130.0",
3
+ "version": "3.130.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/WebGeoServices/ui.git"
@@ -42,21 +42,45 @@ class DropdownMenu extends Component {
42
42
  constructor(props) {
43
43
  super(props);
44
44
  this.childrenRefs = {};
45
+ this.menuRef = React.createRef();
46
+ this.state = {
47
+ directionInBounds: props.direction,
48
+ };
45
49
  }
46
50
 
51
+ componentDidUpdate(_, prevState) {
52
+ if (this.menuRef.current) {
53
+ const { directionInBounds } = this.state;
54
+ const { directionInBounds: prevDirectionInBounds } = prevState;
55
+ const { top, bottom } = this.menuRef.current.getBoundingClientRect();
56
+ const { innerHeight } = window;
57
+ if (innerHeight > top && !prevDirectionInBounds.includes('s')) {
58
+ this.setDirectionInBounds(directionInBounds.replace('n', 's'));
59
+ }
60
+ if (innerHeight < bottom && !prevDirectionInBounds.includes('n')) {
61
+ this.setDirectionInBounds(directionInBounds.replace('s', 'n'));
62
+ }
63
+ }
64
+ }
65
+
66
+ setDirectionInBounds = (direction) => {
67
+ this.setState({ directionInBounds: direction });
68
+ };
69
+
47
70
  close = () => {
48
71
  closeChildren(this.childrenRefs);
49
72
  };
50
73
 
51
74
  render() {
52
75
  const { direction, children, closeCb, onMouseEnter, onMouseLeave, testId, isSection, ...rest } = this.props;
76
+ const { directionInBounds } = this.state;
53
77
  const childrenWithProps = mapChildrenWithProps(children, this.childrenRefs, { closeCb });
54
78
  if (isSection) {
55
79
  return (
56
- <div className="dropdown__container">
80
+ <div className="dropdown__container" ref={this.menuRef}>
57
81
  <div
58
82
  role="menu"
59
- className={cl('dropdown__menu', direction, 'dropdown__menu--section')}
83
+ className={cl('dropdown__menu', directionInBounds, 'dropdown__menu--section')}
60
84
  data-testid={testId}
61
85
  tabIndex="-1"
62
86
  onMouseEnter={onMouseEnter}
@@ -71,11 +95,12 @@ class DropdownMenu extends Component {
71
95
  return (
72
96
  <ul
73
97
  role="menu"
74
- className={cl('dropdown__menu', direction)}
98
+ className={cl('dropdown__menu', directionInBounds)}
75
99
  data-testid={testId}
76
100
  {...rest}
77
101
  onMouseEnter={onMouseEnter}
78
102
  onMouseLeave={onMouseLeave}
103
+ ref={this.menuRef}
79
104
  >
80
105
  {childrenWithProps}
81
106
  </ul>
@@ -99,7 +124,7 @@ DropdownMenu.propTypes = {
99
124
  onMouseLeave: PropTypes.func,
100
125
  testId: PropTypes.string,
101
126
  isSection: PropTypes.bool,
102
- direction: PropTypes.oneOf(['ne', 'e', 'se', 's', 'sw', 'w']),
127
+ direction: PropTypes.oneOf(['ne', 'e', 'se', 's', 'sw', 'w', 'nw']),
103
128
  };
104
129
 
105
130
  class DropdownMenuSection extends Component {
@@ -41,6 +41,13 @@
41
41
  left 0
42
42
  margin-bottom .3rem
43
43
 
44
+ &.nw
45
+ top auto
46
+ bottom 100%
47
+ right 0
48
+ left auto
49
+ margin-bottom .3rem
50
+
44
51
  &.s
45
52
  right 50%
46
53
  left auto
@@ -50,6 +57,10 @@
50
57
  right 0
51
58
  left auto
52
59
 
60
+ &.se
61
+ right auto
62
+ left 0
63
+
53
64
 
54
65
  &__item
55
66
  flexMiddle()