@terraware/web-components 2.3.25 → 2.3.26

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.
@@ -15,6 +15,7 @@ export type PhotoChooserProps = {
15
15
  photoSelectedText?: string;
16
16
  chooseFileText?: string;
17
17
  replaceFileText?: string;
18
+ maxPhotos?: number;
18
19
  };
19
20
  export default function PhotoChooser(props: PhotoChooserProps): JSX.Element;
20
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PhotoChooser/index.tsx"],"names":[],"mappings":"AASA,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAgCF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAChC,eAAe,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IAC1C,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,KAAK,CAAC,EAAE,qBAAqB,CAAC;IAC9B,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,GAAG,CAAC,OAAO,CAyK1E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PhotoChooser/index.tsx"],"names":[],"mappings":"AASA,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAmCF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAChC,eAAe,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IAC1C,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,KAAK,CAAC,EAAE,qBAAqB,CAAC;IAC9B,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,GAAG,CAAC,OAAO,CA2K1E"}
@@ -34,8 +34,11 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
34
34
  marginTop: theme.spacing(3)
35
35
  },
36
36
  error: {
37
- width: '100%',
38
- marginBottom: theme.spacing(2)
37
+ width: 'auto',
38
+ marginBottom: theme.spacing(2),
39
+ '&.mobile': {
40
+ width: 'auto'
41
+ }
39
42
  },
40
43
  thumbnail: {
41
44
  margin: 'auto auto',
@@ -58,7 +61,8 @@ function PhotoChooser(props) {
58
61
  uploadDescription = props.uploadDescription,
59
62
  photoSelectedText = props.photoSelectedText,
60
63
  chooseFileText = props.chooseFileText,
61
- replaceFileText = props.replaceFileText;
64
+ replaceFileText = props.replaceFileText,
65
+ maxPhotos = props.maxPhotos;
62
66
  var _useDeviceInfo = (0, _utils.useDeviceInfo)(),
63
67
  isMobile = _useDeviceInfo.isMobile;
64
68
  var classes = useStyles();
@@ -89,7 +93,7 @@ function PhotoChooser(props) {
89
93
  }
90
94
  }
91
95
  if (newFiles.length) {
92
- updateSelection([].concat((0, _toConsumableArray2.default)(files), newFiles));
96
+ updateSelection([].concat((0, _toConsumableArray2.default)(files), newFiles).slice(0, maxPhotos));
93
97
  }
94
98
  };
95
99
  var removeFileAtIndex = function removeFileAtIndex(index) {
@@ -136,10 +140,10 @@ function PhotoChooser(props) {
136
140
  return /*#__PURE__*/_react.default.createElement(_material.Box, {
137
141
  ref: divRef,
138
142
  tabIndex: 0,
139
- width: "100%",
140
143
  sx: {
141
144
  backgroundColor: theme.palette.TwClrBg,
142
- borderRadius: theme.spacing(4)
145
+ borderRadius: theme.spacing(4),
146
+ padding: theme.spacing(3)
143
147
  }
144
148
  }, /*#__PURE__*/_react.default.createElement(_material.Box, null, title && /*#__PURE__*/_react.default.createElement(_material.Typography, {
145
149
  fontSize: 20,
@@ -220,6 +224,7 @@ function PhotoChooser(props) {
220
224
  multiple: multipleSelection || false
221
225
  }), /*#__PURE__*/_react.default.createElement(_Button.default, {
222
226
  onClick: onChooseFileHandler,
227
+ disabled: maxPhotos !== undefined ? files.length >= maxPhotos : false,
223
228
  label: !multipleSelection && (files.length === 1 || editing) ? replaceFileText : chooseFileText,
224
229
  priority: "secondary",
225
230
  type: "passive",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@terraware/web-components",
3
- "version": "2.3.25",
3
+ "version": "2.3.26",
4
4
  "author": "Terraformation Inc.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {