@terraware/web-components 3.5.4 → 3.5.5

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,14 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ import './styles.scss';
3
+ type MapDrawerSize = 'small' | 'medium';
4
+ export type MapDrawerProp = {
5
+ children?: ReactNode;
6
+ onClose?: () => void;
7
+ open: boolean;
8
+ size: MapDrawerSize;
9
+ style?: CSSProperties;
10
+ title: string;
11
+ };
12
+ declare const MapDrawer: (props: MapDrawerProp) => import("react/jsx-runtime").JSX.Element | null;
13
+ export default MapDrawer;
14
+ //# sourceMappingURL=MapDrawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/Map/MapDrawer.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGxD,OAAO,eAAe,CAAC;AAGvB,KAAK,aAAa,GAAG,OAAO,GAAG,QAAQ,CAAC;AAExC,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,QAAA,MAAM,SAAS,UAAW,aAAa,mDAwBtC,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _material = require("@mui/material");
10
+ var _Icon = _interopRequireDefault(require("../Icon/Icon"));
11
+ require("./styles.scss");
12
+ var _utils = require("../../utils");
13
+ const MapDrawer = props => {
14
+ const {
15
+ children,
16
+ onClose,
17
+ open,
18
+ size,
19
+ style,
20
+ title
21
+ } = props;
22
+ const theme = (0, _material.useTheme)();
23
+ const {
24
+ isDesktop
25
+ } = (0, _utils.useDeviceInfo)();
26
+ return open ? /*#__PURE__*/_react.default.createElement(_material.Box, {
27
+ className: "map-drawer map-drawer".concat(isDesktop ? "--".concat(size) : '--mobile'),
28
+ border: "1px solid ".concat(theme.palette.TwClrBrdrTertiary),
29
+ style: style
30
+ }, /*#__PURE__*/_react.default.createElement(_material.Box, {
31
+ className: "map-drawer--header"
32
+ }, /*#__PURE__*/_react.default.createElement("p", {
33
+ className: "title"
34
+ }, title), /*#__PURE__*/_react.default.createElement(_material.IconButton, {
35
+ onClick: onClose,
36
+ size: "small"
37
+ }, /*#__PURE__*/_react.default.createElement(_Icon.default, {
38
+ name: "close",
39
+ className: "icon-close"
40
+ }))), /*#__PURE__*/_react.default.createElement(_material.Box, {
41
+ className: 'map-drawer--body'
42
+ }, children)) : null;
43
+ };
44
+ var _default = exports.default = MapDrawer;
@@ -1 +1 @@
1
- {"version":3,"file":"MapLegend.d.ts","sourceRoot":"","sources":["../../../src/components/Map/MapLegend.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QACL,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd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,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QACL,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,CAAC,eAAe,GAAG,aAAa,GAAG,iBAAiB,CAAC,CAAC;AAE1D,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,cAAc,EAAE,CAAC;CAC3B,CAAC;AAEF,QAAA,MAAM,SAAS,gBAAiB,cAAc,KAAG,WAgOhD,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
+ var _react = _interopRequireWildcard(require("react"));
9
10
  var _material = require("@mui/material");
10
11
  var _utils = require("../../utils");
11
12
  var _Icon = _interopRequireDefault(require("../Icon/Icon"));
@@ -19,6 +20,13 @@ const MapLegend = _ref => {
19
20
  isMobile,
20
21
  isDesktop
21
22
  } = (0, _utils.useDeviceInfo)();
23
+ const borderRadius = (0, _react.useMemo)(() => {
24
+ if (isDesktop) {
25
+ return '0 8px 8px 0'; // right-side
26
+ } else {
27
+ return '0 0 8px 8px'; // bottom-side
28
+ }
29
+ }, [isDesktop]);
22
30
  const legendComponents = legends.map((legend, index) => {
23
31
  const isFirst = index === 0;
24
32
  const isLast = index === legends.length - 1;
@@ -161,13 +169,12 @@ const MapLegend = _ref => {
161
169
  display: "flex",
162
170
  justifyItems: "flex-start",
163
171
  border: "1px solid ".concat(theme.palette.TwClrBrdrTertiary),
164
- borderRadius: "8px",
172
+ borderRadius: borderRadius,
165
173
  padding: theme.spacing(2, 1),
166
174
  flexDirection: 'column',
167
- maxWidth: isDesktop ? '184px' : '100%',
168
- width: isDesktop ? 'auto' : '100%',
169
- marginRight: 2,
170
- marginTop: isDesktop ? 0 : 2
175
+ maxWidth: isDesktop ? '184px' : 'fill',
176
+ width: isDesktop ? 'auto' : 'fill',
177
+ margin: 0
171
178
  }, legendComponents);
172
179
  };
173
180
  var _default = exports.default = MapLegend;
@@ -0,0 +1,64 @@
1
+ @import '../../style-dictionary-dist/terraware.scss';
2
+
3
+ .map-drawer {
4
+ display: flex;
5
+ flex-direction: column;
6
+ background: $tw-clr-base-white;
7
+
8
+ &--mobile {
9
+ display: none;
10
+ }
11
+
12
+ &--small {
13
+ min-width: 280px;
14
+ width: 280px;
15
+ }
16
+ &--medium {
17
+ min-width: 420px;
18
+ width: 420px;
19
+ }
20
+
21
+ &--header {
22
+ padding: $tw-spc-base-x-small $tw-spc-base-xx-small;
23
+ display: flex;
24
+ justify-content: space-between;
25
+ align-items: center;
26
+ .title {
27
+ font-family: $tw-fnt-mssg-title-font-family;
28
+ font-size: $tw-fnt-mssg-title-font-size;
29
+ font-weight: $tw-fnt-mssg-title-font-weight;
30
+ line-height: $tw-fnt-mssg-title-line-height;
31
+ color: $tw-clr-txt;
32
+ text-align: center;
33
+ text-overflow: ellipsis;
34
+ overflow: hidden;
35
+ white-space: nowrap;
36
+ margin: 0 $tw-spc-base-xx-small;
37
+ width: 100%;
38
+ }
39
+
40
+ .icon-close {
41
+ fill: $tw-clr-icn-secondary;
42
+ height: $tw-sz-base-medium;
43
+ width: $tw-sz-base-medium;
44
+ }
45
+ }
46
+
47
+ &--body {
48
+ background: $tw-clr-base-white;
49
+ padding: $tw-spc-base-small $tw-spc-base-x-small;
50
+ text-align: start;
51
+ overflow: auto;
52
+ white-space: pre-wrap;
53
+ }
54
+
55
+ &--message {
56
+ font-family: $tw-fnt-dlg-bx-message-font-family;
57
+ font-size: $tw-fnt-dlg-bx-message-font-size;
58
+ font-weight: $tw-fnt-dlg-bx-message-font-weight;
59
+ line-height: $tw-fnt-dlg-bx-message-line-height;
60
+ color: $tw-clr-txt;
61
+ width: 100%;
62
+ text-align: start;
63
+ }
64
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@terraware/web-components",
3
- "version": "3.5.4",
3
+ "version": "3.5.5",
4
4
  "author": "Terraformation Inc.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -0,0 +1,8 @@
1
+ import { MapDrawerProp } from '../components/Map/MapDrawer';
2
+ declare const _default: {
3
+ title: string;
4
+ component: (props: MapDrawerProp) => import("react/jsx-runtime").JSX.Element | null;
5
+ };
6
+ export default _default;
7
+ export declare const Default: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, MapDrawerProp>;
8
+ //# sourceMappingURL=MapDrawer.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapDrawer.stories.d.ts","sourceRoot":"","sources":["../../src/stories/MapDrawer.stories.tsx"],"names":[],"mappings":"AAKA,OAAkB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;;;;;AAGvE,wBAGE;AAuEF,eAAO,MAAM,OAAO,sGAAoB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"MapLegend.stories.d.ts","sourceRoot":"","sources":["../../src/stories/MapLegend.stories.tsx"],"names":[],"mappings":";AAEA,OAAkB,EAAkB,cAAc,EAAE,MAAM,6BAA6B,CAAC;;;;;AAKxF,wBAGE;AAuKF,eAAO,MAAM,OAAO,uGAAoB,CAAC"}
1
+ {"version":3,"file":"MapLegend.stories.d.ts","sourceRoot":"","sources":["../../src/stories/MapLegend.stories.tsx"],"names":[],"mappings":";AAEA,OAAkB,EAAkB,cAAc,EAAE,MAAM,6BAA6B,CAAC;;;;;AAKxF,wBAGE;AAkLF,eAAO,MAAM,OAAO,uGAAoB,CAAC"}