@majoo-ui/react 1.62.2 → 1.62.4

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/index.esm.js CHANGED
@@ -41,7 +41,7 @@ import { EditableInput, ColorWrap, Saturation, Hue, Alpha, Swatch } from 'react-
41
41
  import * as color from 'react-color/lib/helpers/color';
42
42
  import StepWizard$1 from 'react-step-wizard';
43
43
  import { useVirtual } from 'react-virtual';
44
- import { MapContainer, Circle, TileLayer, useMapEvents } from '@monsonjeremy/react-leaflet';
44
+ import { useMapEvents, MapContainer, Circle, TileLayer } from '@monsonjeremy/react-leaflet';
45
45
  import 'leaflet/dist/leaflet.css';
46
46
  import 'leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.css';
47
47
  import 'leaflet-defaulticon-compatibility';
@@ -13594,7 +13594,7 @@ const InputTagsComponent = styled('div', {
13594
13594
  }
13595
13595
  }
13596
13596
  });
13597
- const Input$8 = styled('input', {
13597
+ const Input$7 = styled('input', {
13598
13598
  display: 'flex',
13599
13599
  position: 'relative',
13600
13600
  flex: 'auto',
@@ -13705,7 +13705,7 @@ function TagsInput(_ref) {
13705
13705
  disabled: disabled || readOnly || tags.length >= max,
13706
13706
  value: value,
13707
13707
  css: Object.assign({}, props.css)
13708
- }, props), /*#__PURE__*/React__default.createElement(Input$8, {
13708
+ }, props), /*#__PURE__*/React__default.createElement(Input$7, {
13709
13709
  type: "text",
13710
13710
  onKeyUp: event => addTags(event)
13711
13711
  // onKeyDown={event => removeTags(tags.length - 1, event.key)}
@@ -15185,7 +15185,7 @@ const Button$3 = styled('button', {
15185
15185
  }
15186
15186
  }
15187
15187
  });
15188
- const Input$7 = styled('input', {
15188
+ const Input$6 = styled('input', {
15189
15189
  marginLeft: '$spacing-05',
15190
15190
  display: 'flex',
15191
15191
  width: '100%',
@@ -15361,7 +15361,7 @@ const SelectInputSearch$1 = /*#__PURE__*/React.forwardRef((_a, forwardedRef) =>
15361
15361
  width: '$spacing-05',
15362
15362
  padding: 0
15363
15363
  } : undefined
15364
- }), jsx(Input$7, Object.assign({}, inputProps, props, {
15364
+ }), jsx(Input$6, Object.assign({}, inputProps, props, {
15365
15365
  placeholder: placeholder,
15366
15366
  readOnly: readOnly,
15367
15367
  isReadOnly: readOnly,
@@ -16425,7 +16425,7 @@ const InputWrapper$1 = styled('div', {
16425
16425
  }
16426
16426
  }
16427
16427
  });
16428
- const Input$6 = styled('input', {
16428
+ const Input$5 = styled('input', {
16429
16429
  width: '100%',
16430
16430
  textAlign: 'left',
16431
16431
  background: 'unset',
@@ -17305,7 +17305,7 @@ const InputSelectCheck = /*#__PURE__*/forwardRef((_ref, ref) => {
17305
17305
  suppressRefError: true
17306
17306
  }), {
17307
17307
  disabled: disabled || readOnly
17308
- }), /*#__PURE__*/React__default.createElement(Input$6, _extends({}, getInputProps({
17308
+ }), /*#__PURE__*/React__default.createElement(Input$5, _extends({}, getInputProps({
17309
17309
  disabled: disabled || readOnly,
17310
17310
  refKey: 'ref',
17311
17311
  ref
@@ -17747,7 +17747,7 @@ const InputWrapper = styled('div', {
17747
17747
  }
17748
17748
  }
17749
17749
  });
17750
- const Input$5 = styled('input', {
17750
+ const Input$4 = styled('input', {
17751
17751
  display: 'flex',
17752
17752
  position: 'relative',
17753
17753
  flex: 'auto',
@@ -17847,7 +17847,7 @@ function InputCreatable({
17847
17847
  size: size,
17848
17848
  isInvalid: isInvalid,
17849
17849
  disabled: disabled || readOnly
17850
- }, /*#__PURE__*/React__default.createElement(Input$5, {
17850
+ }, /*#__PURE__*/React__default.createElement(Input$4, {
17851
17851
  type: "text",
17852
17852
  placeholder: placeholder,
17853
17853
  disabled: disabled,
@@ -18345,7 +18345,7 @@ const SelectInputSearch = /*#__PURE__*/React.forwardRef((_a, forwardedRef) => {
18345
18345
  width: '$spacing-05',
18346
18346
  padding: 0
18347
18347
  } : undefined
18348
- }), jsx(Input$7, Object.assign({}, inputProps, props, {
18348
+ }), jsx(Input$6, Object.assign({}, inputProps, props, {
18349
18349
  placeholder: placeholder,
18350
18350
  readOnly: readOnly,
18351
18351
  isReadOnly: readOnly,
@@ -18532,7 +18532,7 @@ ResendOTP.defaultProps = {
18532
18532
  timeInterval: 1000
18533
18533
  };
18534
18534
 
18535
- const Input$4 = styled(InputNumber, {
18535
+ const Input$3 = styled(InputNumber, {
18536
18536
  border: `1px solid $gray150`,
18537
18537
  borderLeft: 'none',
18538
18538
  borderRight: 'none',
@@ -18715,7 +18715,7 @@ const InputCounter = /*#__PURE__*/forwardRef((props, ref) => {
18715
18715
  size: 24,
18716
18716
  color: disabled || disabledDecrement ? colors$7.iconDisable : colors$7.primary500
18717
18717
  })
18718
- }), jsx(Input$4, {
18718
+ }), jsx(Input$3, {
18719
18719
  ref: ref,
18720
18720
  disabled: disabled || disabledIncrement || disabledDecrement || disableManualInput,
18721
18721
  disabledChange: disabledIncrement || disabledDecrement || disableManualInput,
@@ -19471,7 +19471,7 @@ const DateNumber = styled('div', {
19471
19471
  });
19472
19472
  DateNumber.displayName = 'DateNumber';
19473
19473
 
19474
- const Input$3 = styled('input', {
19474
+ const Input$2 = styled('input', {
19475
19475
  display: 'none'
19476
19476
  });
19477
19477
  const InputTime = styled('input', {
@@ -19740,7 +19740,7 @@ const NativeTimePicker = ({
19740
19740
  type: "up",
19741
19741
  disabled: disabled || disabledMinute || disabledMinuteIncrease,
19742
19742
  onClick: () => handleUp('minutes')
19743
- })), /*#__PURE__*/React__default.createElement(Input$3, {
19743
+ })), /*#__PURE__*/React__default.createElement(Input$2, {
19744
19744
  type: "time",
19745
19745
  defaultValue: moment(date).format(format),
19746
19746
  value: value,
@@ -27936,14 +27936,9 @@ const TemplateAlertFunction = props => {
27936
27936
  props == null || props.onOpenAutoFocus();
27937
27937
  }
27938
27938
  }
27939
- }, /*#__PURE__*/React__default.createElement(StyledTitle, {
27939
+ }, /*#__PURE__*/React__default.createElement(ADialog.Title, {
27940
27940
  asChild: true
27941
- }, /*#__PURE__*/React__default.createElement("div", {
27942
- style: {
27943
- display: 'flex',
27944
- justifyContent: 'space-between'
27945
- }
27946
- }, /*#__PURE__*/React__default.createElement(Heading, {
27941
+ }, /*#__PURE__*/React__default.createElement(StyledTitle, null, /*#__PURE__*/React__default.createElement(Heading, {
27947
27942
  heading: "pageTitle"
27948
27943
  }, props.title), !props.hideCloseButton && /*#__PURE__*/React__default.createElement(ADialog.Cancel, {
27949
27944
  asChild: true
@@ -27956,14 +27951,14 @@ const TemplateAlertFunction = props => {
27956
27951
  size: 22
27957
27952
  }))))), /*#__PURE__*/React__default.createElement(Separator$2, {
27958
27953
  orientation: "horizontal"
27959
- }), /*#__PURE__*/React__default.createElement(StyledDescription$1, {
27954
+ }), /*#__PURE__*/React__default.createElement(ADialog.Description, {
27960
27955
  asChild: true
27961
- }, /*#__PURE__*/React__default.createElement(Paragraph, {
27956
+ }, /*#__PURE__*/React__default.createElement(StyledDescription$1, null, /*#__PURE__*/React__default.createElement(Paragraph, {
27962
27957
  paragraph: "longContentRegular",
27963
27958
  css: {
27964
27959
  textAlign: 'justify'
27965
27960
  }
27966
- }, props.description)), /*#__PURE__*/React__default.createElement(Box, {
27961
+ }, props.description))), /*#__PURE__*/React__default.createElement(Box, {
27967
27962
  css: {
27968
27963
  width: '100%',
27969
27964
  display: props != null && props.singleButton && props != null && props.hideActionButton ? 'none' : 'inherit'
@@ -28045,14 +28040,9 @@ function AlertDialog(props) {
28045
28040
  onOpenAutoFocus: e => {
28046
28041
  if (!props.onOpenAutoFocus) e.preventDefault();else props.onOpenAutoFocus(e);
28047
28042
  }
28048
- }, /*#__PURE__*/React__default.createElement(StyledTitle, {
28043
+ }, /*#__PURE__*/React__default.createElement(ADialog.Title, {
28049
28044
  asChild: true
28050
- }, /*#__PURE__*/React__default.createElement("div", {
28051
- style: {
28052
- display: 'flex',
28053
- justifyContent: 'space-between'
28054
- }
28055
- }, /*#__PURE__*/React__default.createElement(Heading, {
28045
+ }, /*#__PURE__*/React__default.createElement(StyledTitle, null, /*#__PURE__*/React__default.createElement(Heading, {
28056
28046
  heading: "pageTitle"
28057
28047
  }, props.title), !props.hideCloseButton && /*#__PURE__*/React__default.createElement(AlertDialogCancel, {
28058
28048
  asChild: true
@@ -28065,15 +28055,15 @@ function AlertDialog(props) {
28065
28055
  size: 22
28066
28056
  }))))), /*#__PURE__*/React__default.createElement(Separator$2, {
28067
28057
  orientation: "horizontal"
28068
- }), /*#__PURE__*/React__default.createElement(StyledDescription$1, {
28058
+ }), /*#__PURE__*/React__default.createElement(ADialog.Description, {
28069
28059
  asChild: true
28070
- }, /*#__PURE__*/React__default.createElement(Paragraph, {
28060
+ }, /*#__PURE__*/React__default.createElement(StyledDescription$1, null, /*#__PURE__*/React__default.createElement(Paragraph, {
28071
28061
  paragraph: "longContentRegular",
28072
28062
  css: {
28073
28063
  textAlign: 'justify',
28074
28064
  wordBreak: 'break-word'
28075
28065
  }
28076
- }, props.description)), /*#__PURE__*/React__default.createElement(Box, {
28066
+ }, props.description))), /*#__PURE__*/React__default.createElement(Box, {
28077
28067
  css: {
28078
28068
  width: '100%',
28079
28069
  display: props != null && props.singleButton && props != null && props.hideActionButton ? 'none' : 'inherit'
@@ -30488,7 +30478,7 @@ function imgPreview(image_1, crop_1) {
30488
30478
  }
30489
30479
 
30490
30480
  const _excluded = ["customPreviewIcon"];
30491
- const Input$2 = styled('input', {
30481
+ const Input$1 = styled('input', {
30492
30482
  display: 'none !important'
30493
30483
  });
30494
30484
  const Children = styled('div', {
@@ -31338,7 +31328,7 @@ const Upload = ({
31338
31328
  }, !isFile && renderPicture(), isFile && renderFile(), progress || isLoading ? /*#__PURE__*/React__default.createElement(UploadProgress, {
31339
31329
  progress: progress,
31340
31330
  loading: loading
31341
- }) : renderUpload(), showCropper && renderCropper(), /*#__PURE__*/React__default.createElement(Input$2, {
31331
+ }) : renderUpload(), showCropper && renderCropper(), /*#__PURE__*/React__default.createElement(Input$1, {
31342
31332
  type: "file",
31343
31333
  accept: accept,
31344
31334
  ref: hiddenFileInput,
@@ -52358,7 +52348,7 @@ const RemoveIcon = styled(RemoveOutline, {
52358
52348
  }
52359
52349
  }
52360
52350
  });
52361
- const Input$1 = styled(InputText, {
52351
+ const Input = styled(InputText, {
52362
52352
  height: '32px !important'
52363
52353
  });
52364
52354
  const Required$1 = styled('span', {
@@ -52775,7 +52765,7 @@ function EditableTable(props) {
52775
52765
  });
52776
52766
  }
52777
52767
  EditableTable.Product = Product;
52778
- EditableTable.Input = Input$1;
52768
+ EditableTable.Input = Input;
52779
52769
  EditableTable.Switch = Switch;
52780
52770
  EditableTable.Remove = Remove;
52781
52771
  EditableTable.TableRow = TableRow$1;
@@ -53171,13 +53161,14 @@ function ProgressIndicator(props) {
53171
53161
  return direction === 'horizontal' ? renderHorizontalIndicator() : renderVerticalIndicator();
53172
53162
  }
53173
53163
 
53164
+ //@ts-nocheck
53174
53165
  const Container$3 = styled(Flex$1, {
53175
53166
  gap: '$spacing-05',
53176
53167
  '@md': {
53177
53168
  width: 517
53178
53169
  }
53179
53170
  });
53180
- const AddressCard = styled(Flex$1, {
53171
+ const AddressCardWrapper = styled(Flex$1, {
53181
53172
  border: '1px solid #EEF0F0',
53182
53173
  borderRadius: 8,
53183
53174
  gap: '$spacing-04',
@@ -53189,7 +53180,7 @@ const Address = styled('p', {
53189
53180
  color: '$textPrimary',
53190
53181
  margin: 0
53191
53182
  });
53192
- const Input = styled('input', {
53183
+ const SearchInput = styled('input', {
53193
53184
  boxSizing: `border-box`,
53194
53185
  border: `1px solid transparent`,
53195
53186
  width: 204,
@@ -53202,7 +53193,7 @@ const Input = styled('input', {
53202
53193
  outline: `none`,
53203
53194
  textOverflow: `ellipses`
53204
53195
  });
53205
- const ZoomControl = styled(Flex$1, {
53196
+ const ZoomControlButton = styled(Flex$1, {
53206
53197
  height: 44,
53207
53198
  width: 44,
53208
53199
  padding: 12,
@@ -53214,97 +53205,65 @@ const ZoomControl = styled(Flex$1, {
53214
53205
  cursor: 'pointer',
53215
53206
  zIndex: 1800
53216
53207
  });
53217
- const InputSearch = ({
53218
- placeholder,
53219
- value,
53220
- list,
53221
- onChange,
53222
- onSelect
53223
- }) => jsxs(Box, {
53224
- css: {
53225
- position: 'absolute',
53226
- left: 16,
53227
- top: 16,
53228
- zIndex: 1000
53229
- },
53230
- children: [jsxs(Box, {
53231
- css: {
53232
- position: 'relative'
53233
- },
53234
- children: [jsx(Input, {
53235
- placeholder: placeholder,
53236
- value: value,
53237
- onChange: onChange
53238
- }), jsx(Box, {
53239
- css: {
53240
- position: 'absolute',
53241
- top: 5,
53242
- left: 10
53243
- },
53244
- children: jsx(SearchOutline, {
53245
- size: 24
53246
- })
53247
- })]
53248
- }), list.length ? jsx(Box, {
53249
- css: {
53250
- position: 'relative',
53251
- zIndex: 1000,
53252
- width: 204,
53253
- maxHeight: 155,
53254
- overflow: 'hidden',
53255
- backgroundColor: '$bgWhite',
53256
- borderRadius: '$sm'
53257
- },
53258
- children: jsx(Flex$1, {
53259
- direction: "column",
53260
- gap: 2,
53261
- children: list.map((item, index) => {
53262
- return jsx(Paragraph, {
53263
- css: {
53264
- cursor: 'pointer',
53265
- padding: '$spacing-02',
53266
- '&:hover': {
53267
- backgroundColor: '$gray100'
53268
- }
53269
- },
53270
- isTruncated: true,
53271
- onClick: () => onSelect(item),
53272
- children: item.display_name
53273
- }, index);
53274
- })
53275
- })
53276
- }) : jsx(Fragment, {})]
53208
+ const MapWrapper = styled('div', {
53209
+ position: 'relative',
53210
+ width: '100% !important',
53211
+ height: '441px !important',
53212
+ overflow: 'hidden',
53213
+ '@md': {
53214
+ width: '517px !important'
53215
+ }
53277
53216
  });
53278
- function MapPicker(props) {
53279
- const {
53280
- t
53281
- } = useTranslation(['MajooUI/mapPicker', 'translation']);
53282
- useRef(null);
53283
- const {
53284
- css,
53285
- showBanner,
53286
- bannerDescription,
53287
- radius,
53288
- value,
53289
- showSelectButton,
53290
- onChange,
53291
- onMarkerClick
53292
- } = props;
53293
- const [center, setCenter] = useState({
53217
+ const mapContainerStyle = {
53218
+ mobile: {
53219
+ position: 'relative',
53220
+ width: '100%',
53221
+ height: '441px'
53222
+ },
53223
+ desktop: {
53224
+ position: 'relative',
53225
+ width: '517px',
53226
+ height: '441px'
53227
+ }
53228
+ };
53229
+
53230
+ function useMapSearch({
53231
+ initialCenter = {
53294
53232
  lat: -6.175392,
53295
53233
  lng: 106.827153
53296
- });
53234
+ },
53235
+ showSelectButton = true,
53236
+ onChange
53237
+ }) {
53238
+ const [center, setCenter] = useState(initialCenter);
53297
53239
  const [places, setPlaces] = useState([]);
53298
53240
  const [searchQuery, setSearchQuery] = useState('');
53299
53241
  const [searchResult, setSearchResult] = useState([]);
53300
- const [isBanner, setIsBanner] = useState(true);
53301
- const [zoom, setZoom] = useState(16);
53302
- const getFullAddress = useCallback(latLng => __awaiter(this, void 0, void 0, function* () {
53242
+ // Track if component is mounted to prevent state updates after unmount
53243
+ const isMountedRef = useRef(true);
53244
+ // AbortController to cancel pending fetch requests
53245
+ const abortControllerRef = useRef(null);
53246
+ // Cleanup on unmount
53247
+ useEffect(() => {
53248
+ isMountedRef.current = true;
53249
+ return () => {
53250
+ var _a;
53251
+ isMountedRef.current = false;
53252
+ // Abort any pending fetch requests
53253
+ (_a = abortControllerRef.current) === null || _a === void 0 ? void 0 : _a.abort();
53254
+ };
53255
+ }, []);
53256
+ const getFullAddress = useCallback((latLng, signal) => __awaiter(this, void 0, void 0, function* () {
53303
53257
  try {
53304
- const res = yield fetch(`https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=${Number(latLng.lat)}&lon=${Number(latLng.lng)}&accept-language=id`);
53258
+ const res = yield fetch(`https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=${Number(latLng.lat)}&lon=${Number(latLng.lng)}&accept-language=id`, {
53259
+ signal
53260
+ });
53305
53261
  const location = yield res.json();
53306
53262
  return location;
53307
53263
  } catch (error) {
53264
+ if (error.name === 'AbortError') {
53265
+ return null; // Request was cancelled, return null
53266
+ }
53308
53267
  throw new Error('Failed to search address');
53309
53268
  }
53310
53269
  }), []);
@@ -53315,15 +53274,18 @@ function MapPicker(props) {
53315
53274
  place_id,
53316
53275
  address
53317
53276
  }) => {
53277
+ // Only update state if component is still mounted
53278
+ if (!isMountedRef.current) return;
53318
53279
  setCenter({
53319
53280
  lat: Number(lat),
53320
53281
  lng: Number(lon)
53321
53282
  });
53322
53283
  setPlaces([{
53323
- lat: lat,
53324
- lon: lon,
53325
- place_id: place_id,
53326
- display_name: display_name
53284
+ lat,
53285
+ lon,
53286
+ place_id,
53287
+ display_name,
53288
+ address
53327
53289
  }]);
53328
53290
  setSearchQuery('');
53329
53291
  setSearchResult([]);
@@ -53333,224 +53295,397 @@ function MapPicker(props) {
53333
53295
  lng: Number(lon),
53334
53296
  formatted_address: display_name,
53335
53297
  address_components: address
53336
- });
53337
- }, [onChange]);
53298
+ }, !showSelectButton);
53299
+ }, [onChange, showSelectButton]);
53338
53300
  const handleSearchSelect = useCallback(item => __awaiter(this, void 0, void 0, function* () {
53301
+ var _a;
53302
+ // Cancel any previous pending request
53303
+ (_a = abortControllerRef.current) === null || _a === void 0 ? void 0 : _a.abort();
53304
+ abortControllerRef.current = new AbortController();
53339
53305
  const fullAddress = yield getFullAddress({
53340
53306
  lat: Number(item.lat),
53341
53307
  lng: Number(item.lon)
53342
- });
53343
- handleSelect(fullAddress);
53308
+ }, abortControllerRef.current.signal);
53309
+ // getFullAddress returns null if aborted
53310
+ if (fullAddress) {
53311
+ handleSelect(fullAddress);
53312
+ }
53344
53313
  }), [getFullAddress, handleSelect]);
53345
53314
  const handleSearchLatLng = useCallback(latLng => __awaiter(this, void 0, void 0, function* () {
53346
- const {
53347
- lat,
53348
- lon,
53349
- display_name,
53350
- place_id,
53351
- address
53352
- } = yield getFullAddress(latLng);
53353
- handleSelect({
53354
- lat,
53355
- lon,
53356
- display_name,
53357
- place_id,
53358
- address
53359
- });
53360
- setPlaces([{
53361
- place_id,
53362
- display_name,
53363
- lat,
53364
- lon
53365
- }]);
53366
- }), [getFullAddress, handleSelect]);
53367
- useEffect(() => {
53368
- if (value && (value === null || value === void 0 ? void 0 : value.lat) && (value === null || value === void 0 ? void 0 : value.lng)) {
53369
- setCenter(value);
53315
+ var _b;
53316
+ // Cancel any previous pending request
53317
+ (_b = abortControllerRef.current) === null || _b === void 0 ? void 0 : _b.abort();
53318
+ abortControllerRef.current = new AbortController();
53319
+ const fullAddress = yield getFullAddress(latLng, abortControllerRef.current.signal);
53320
+ // getFullAddress returns null if aborted
53321
+ if (fullAddress) {
53322
+ const {
53323
+ lat,
53324
+ lon,
53325
+ display_name,
53326
+ place_id,
53327
+ address
53328
+ } = fullAddress;
53329
+ handleSelect({
53330
+ lat,
53331
+ lon,
53332
+ display_name,
53333
+ place_id,
53334
+ address
53335
+ });
53370
53336
  }
53371
- }, [value]);
53372
- const handleSearch = useCallback(query => __awaiter(this, void 0, void 0, function* () {
53337
+ }), [getFullAddress, handleSelect]);
53338
+ const handleSearch = useCallback((query, signal) => __awaiter(this, void 0, void 0, function* () {
53373
53339
  try {
53374
- const res = yield fetch(`https://nominatim.openstreetmap.org/search.php?q=${query}&polygon_geojson=1&format=jsonv2`);
53340
+ const res = yield fetch(`https://nominatim.openstreetmap.org/search.php?q=${query}&polygon_geojson=1&format=jsonv2`, {
53341
+ signal
53342
+ });
53375
53343
  const result = yield res.json();
53376
- setSearchResult(result);
53344
+ // Only update state if component is still mounted
53345
+ if (isMountedRef.current) {
53346
+ setSearchResult(result);
53347
+ }
53377
53348
  } catch (error) {
53349
+ if (error.name === 'AbortError') {
53350
+ return; // Request was cancelled, do nothing
53351
+ }
53378
53352
  throw new Error('Failed to search address');
53379
53353
  }
53380
53354
  }), []);
53355
+ // Debounced search effect
53381
53356
  useEffect(() => {
53382
53357
  let timeoutId = setTimeout(() => ({}), 1000);
53358
+ const searchAbortController = new AbortController();
53383
53359
  clearTimeout(timeoutId);
53384
53360
  timeoutId = setTimeout(() => {
53385
53361
  if (searchQuery) {
53386
- handleSearch(searchQuery);
53362
+ handleSearch(searchQuery, searchAbortController.signal);
53387
53363
  }
53388
53364
  }, 1000);
53389
- return () => clearTimeout(timeoutId);
53365
+ return () => {
53366
+ clearTimeout(timeoutId);
53367
+ searchAbortController.abort();
53368
+ };
53390
53369
  }, [searchQuery, handleSearch]);
53391
- const MarkerSvg = () => {
53392
- return jsxs("svg", {
53393
- width: "33",
53394
- height: "46",
53395
- viewBox: "0 0 33 46",
53396
- fill: "none",
53397
- xmlns: "http://www.w3.org/2000/svg",
53398
- children: [jsx("defs", {
53399
- children: jsxs("filter", {
53400
- id: "shadow",
53401
- x: "-10%",
53402
- y: "-10%",
53403
- width: "120%",
53404
- height: "120%",
53405
- children: [jsx("feOffset", {
53406
- in: "SourceAlpha",
53407
- dx: "0",
53408
- dy: "1.5",
53409
- result: "offsetOut"
53410
- }), jsx("feGaussianBlur", {
53411
- in: "offsetOut",
53412
- stdDeviation: "1",
53413
- result: "blurOut"
53414
- }), jsx("feBlend", {
53415
- in: "SourceGraphic",
53416
- in2: "blurOut",
53417
- mode: "normal"
53418
- })]
53419
- })
53420
- }), jsxs("g", {
53421
- filter: "url(#shadow)",
53422
- children: [jsx("path", {
53423
- d: "M15.5699 42.6456C15.9031 43.4891 17.0969 43.489 17.4301 42.6456L21.589 32.1174C21.8483 31.4611 21.3646 30.75 20.6589 30.75H12.3411C11.6354 30.75 11.1517 31.4611 11.411 32.1174L15.5699 42.6456Z",
53424
- fill: "white"
53425
- }), jsx("rect", {
53426
- x: "1",
53427
- y: "1",
53428
- width: "31",
53429
- height: "31",
53430
- rx: "15.5",
53431
- fill: "#04C99E"
53432
- }), jsx("path", {
53433
- fillRule: "evenodd",
53434
- clipRule: "evenodd",
53435
- d: "M24.5117 21.7932C24.5117 22.8679 23.6672 23.7355 22.6211 23.7355C21.5749 23.7355 20.7304 22.8679 20.7304 21.7932C20.7304 19.4107 20.7304 17.0411 20.7304 14.6715C21.0454 14.6715 21.3606 14.6715 21.6757 14.6715C21.9026 14.6715 22.016 14.4643 21.8522 14.283C21.1211 13.4025 20.3774 12.535 19.6464 11.6545C19.4573 11.3955 19.3943 11.4473 19.2179 11.6545C18.4868 12.535 17.7432 13.4025 17.0121 14.283C16.8483 14.4773 16.9617 14.6715 17.1886 14.6715C17.5037 14.6715 17.8188 14.6715 18.1339 14.6715C18.1339 17.0541 18.1465 19.4107 18.1465 21.7932C18.1465 22.8679 17.302 23.7355 16.2558 23.7355C15.2097 23.7355 14.3652 22.8679 14.3652 21.7932C14.3652 20.1229 14.3778 18.4655 14.3778 16.808C14.6929 16.808 15.008 16.808 15.3231 16.808C15.55 16.808 15.6634 16.6009 15.4996 16.4196C14.7685 15.5391 14.0249 14.6715 13.2938 13.791C13.1048 13.532 13.0417 13.5838 12.8653 13.791C12.1342 14.6715 11.3906 15.5391 10.6595 16.4196C10.4957 16.6138 10.6091 16.808 10.836 16.808C11.1511 16.808 11.4662 16.808 11.7813 16.808V16.8987V21.7932C11.7813 22.8679 10.9368 23.7355 9.89065 23.7355C8.84449 23.7355 8 22.8679 8 21.7932V14.2054C8 12.781 8.56719 11.4732 9.48731 10.5279C10.4074 9.5827 11.6805 9.00001 13.0796 9.00001C14.2896 9.00001 15.3988 9.44027 16.2684 10.1654C17.1381 9.44027 18.2473 9.00001 19.4573 9.00001C20.8565 9.00001 22.1295 9.5827 23.0496 10.5279C23.9697 11.4732 24.5369 12.781 24.5369 14.2054V21.7932H24.5117Z",
53436
- fill: "white"
53437
- }), jsx("rect", {
53438
- x: "1",
53439
- y: "1",
53440
- width: "31",
53441
- height: "31",
53442
- rx: "15.5",
53443
- stroke: "white",
53444
- strokeWidth: "2"
53445
- })]
53446
- })]
53447
- });
53370
+ const handleSearchChange = useCallback(e => {
53371
+ const val = e.target.value;
53372
+ setSearchQuery(val);
53373
+ }, []);
53374
+ return {
53375
+ center,
53376
+ setCenter,
53377
+ places,
53378
+ searchQuery,
53379
+ searchResult,
53380
+ handleSearchChange,
53381
+ handleSearchSelect,
53382
+ handleSearchLatLng,
53383
+ getFullAddress
53448
53384
  };
53449
- const isDesktop = useMediaQuery('(min-width: 767px)');
53450
- function handleMarkerClick() {
53451
- handleSearchLatLng(center);
53452
- onMarkerClick === null || onMarkerClick === void 0 ? void 0 : onMarkerClick();
53453
- }
53454
- function ButtonSelect() {
53455
- return jsx(Box, {
53385
+ }
53386
+
53387
+ function InputSearch({
53388
+ placeholder,
53389
+ value,
53390
+ list,
53391
+ onChange,
53392
+ onSelect
53393
+ }) {
53394
+ return jsxs(Box, {
53395
+ css: {
53396
+ position: 'absolute',
53397
+ left: 16,
53398
+ top: 16,
53399
+ zIndex: 1000
53400
+ },
53401
+ children: [jsxs(Box, {
53456
53402
  css: {
53457
- position: 'absolute',
53458
- top: '34%',
53459
- left: '22%',
53460
- zIndex: 1000,
53461
- '@md': {
53462
- left: '32%'
53463
- }
53403
+ position: 'relative'
53464
53404
  },
53465
- children: jsxs(Flex$1, {
53466
- align: "center",
53467
- gap: 3,
53405
+ children: [jsx(SearchInput, {
53406
+ placeholder: placeholder,
53407
+ value: value,
53408
+ onChange: onChange
53409
+ }), jsx(Box, {
53468
53410
  css: {
53469
- backgroundColor: '$btnPrimary',
53470
- borderRadius: 6,
53471
- fontSize: 16,
53472
- fontWeight: 600,
53473
- color: '$textWhite',
53474
- padding: '4px 12px',
53475
- height: 28,
53476
- cursor: 'pointer'
53411
+ position: 'absolute',
53412
+ top: 5,
53413
+ left: 10
53477
53414
  },
53478
- onClick: handleMarkerClick,
53479
- children: [t('selectLocationText', 'Gunakan Lokasi Ini'), jsx(Box, {
53480
- css: {
53481
- marginTop: 3
53482
- },
53483
- children: jsx(ChevronRightOutline, {
53484
- color: "#FFFFFF"
53485
- })
53486
- })]
53487
- })
53488
- });
53489
- }
53490
- function MarkerIcon() {
53491
- return jsx(Box, {
53415
+ children: jsx(SearchOutline, {
53416
+ size: 24
53417
+ })
53418
+ })]
53419
+ }), list.length ? jsx(Box, {
53492
53420
  css: {
53493
- position: 'absolute',
53494
- top: '40%',
53495
- left: '46%',
53421
+ position: 'relative',
53496
53422
  zIndex: 1000,
53497
- '@md': {
53498
- left: '47%'
53499
- }
53423
+ width: 204,
53424
+ maxHeight: 155,
53425
+ overflow: 'hidden',
53426
+ backgroundColor: '$bgWhite',
53427
+ borderRadius: '$sm'
53500
53428
  },
53501
- children: jsx(MarkerSvg, {})
53502
- });
53503
- }
53504
- function handleSearchChange(e) {
53505
- const val = e.target.value;
53506
- setSearchQuery(val);
53507
- }
53508
- function ChangeView({
53509
- center
53510
- }) {
53511
- const map = useMapEvents({
53512
- dragend: e => {
53513
- const latLng = e.target.getCenter();
53514
- handleSearchLatLng(latLng);
53429
+ children: jsx(Flex$1, {
53430
+ direction: "column",
53431
+ gap: 2,
53432
+ children: list.map((item, index) => {
53433
+ return jsx(Paragraph, {
53434
+ css: {
53435
+ cursor: 'pointer',
53436
+ padding: '$spacing-02',
53437
+ '&:hover': {
53438
+ backgroundColor: '$gray100'
53439
+ }
53440
+ },
53441
+ isTruncated: true,
53442
+ onClick: () => onSelect(item),
53443
+ children: item.display_name
53444
+ }, index);
53445
+ })
53446
+ })
53447
+ }) : jsx(Fragment, {})]
53448
+ });
53449
+ }
53450
+
53451
+ function ButtonSelect({
53452
+ onClick,
53453
+ label = 'Gunakan Lokasi Ini'
53454
+ }) {
53455
+ return jsx(Box, {
53456
+ css: {
53457
+ position: 'absolute',
53458
+ top: '34%',
53459
+ left: '22%',
53460
+ zIndex: 1000,
53461
+ '@md': {
53462
+ left: '32%'
53515
53463
  }
53516
- });
53517
- map.setView(center, map.getZoom());
53518
- return null;
53519
- }
53520
- return jsxs(Container$3, {
53521
- direction: "column",
53522
- css: css,
53523
- children: [showBanner && isBanner && jsxs(Banner, {
53464
+ },
53465
+ children: jsxs(Flex$1, {
53466
+ align: "center",
53467
+ gap: 3,
53524
53468
  css: {
53525
- padding: 16
53469
+ backgroundColor: '$btnPrimary',
53470
+ borderRadius: 6,
53471
+ fontSize: 16,
53472
+ fontWeight: 600,
53473
+ color: '$textWhite',
53474
+ padding: '4px 12px',
53475
+ height: 28,
53476
+ cursor: 'pointer'
53526
53477
  },
53527
- variant: "info",
53528
- bannerBlock: true,
53529
- onRemove: () => setIsBanner(false),
53530
- children: [jsx(Paragraph, {
53478
+ onClick: onClick,
53479
+ children: [label, jsx(Box, {
53531
53480
  css: {
53532
- flex: 1
53481
+ marginTop: 3
53533
53482
  },
53534
- paragraph: "longContentRegular",
53535
- color: "secondary",
53536
- children: bannerDescription !== null && bannerDescription !== void 0 ? bannerDescription : t('bannerDescriptionText', 'Pastikan lokasi yang ditandai pada peta sudah sesuai dengan alamat')
53537
- }), jsx(BannerClose, {})]
53538
- }), jsx(Box, {
53483
+ children: jsx(ChevronRightOutline, {
53484
+ color: "#FFFFFF"
53485
+ })
53486
+ })]
53487
+ })
53488
+ });
53489
+ }
53490
+
53491
+ function MarkerSvg() {
53492
+ return jsxs("svg", {
53493
+ width: "33",
53494
+ height: "46",
53495
+ viewBox: "0 0 33 46",
53496
+ fill: "none",
53497
+ xmlns: "http://www.w3.org/2000/svg",
53498
+ children: [jsx("defs", {
53499
+ children: jsxs("filter", {
53500
+ id: "shadow",
53501
+ x: "-10%",
53502
+ y: "-10%",
53503
+ width: "120%",
53504
+ height: "120%",
53505
+ children: [jsx("feOffset", {
53506
+ in: "SourceAlpha",
53507
+ dx: "0",
53508
+ dy: "1.5",
53509
+ result: "offsetOut"
53510
+ }), jsx("feGaussianBlur", {
53511
+ in: "offsetOut",
53512
+ stdDeviation: "1",
53513
+ result: "blurOut"
53514
+ }), jsx("feBlend", {
53515
+ in: "SourceGraphic",
53516
+ in2: "blurOut",
53517
+ mode: "normal"
53518
+ })]
53519
+ })
53520
+ }), jsxs("g", {
53521
+ filter: "url(#shadow)",
53522
+ children: [jsx("path", {
53523
+ d: "M15.5699 42.6456C15.9031 43.4891 17.0969 43.489 17.4301 42.6456L21.589 32.1174C21.8483 31.4611 21.3646 30.75 20.6589 30.75H12.3411C11.6354 30.75 11.1517 31.4611 11.411 32.1174L15.5699 42.6456Z",
53524
+ fill: "white"
53525
+ }), jsx("rect", {
53526
+ x: "1",
53527
+ y: "1",
53528
+ width: "31",
53529
+ height: "31",
53530
+ rx: "15.5",
53531
+ fill: "#04C99E"
53532
+ }), jsx("path", {
53533
+ fillRule: "evenodd",
53534
+ clipRule: "evenodd",
53535
+ d: "M24.5117 21.7932C24.5117 22.8679 23.6672 23.7355 22.6211 23.7355C21.5749 23.7355 20.7304 22.8679 20.7304 21.7932C20.7304 19.4107 20.7304 17.0411 20.7304 14.6715C21.0454 14.6715 21.3606 14.6715 21.6757 14.6715C21.9026 14.6715 22.016 14.4643 21.8522 14.283C21.1211 13.4025 20.3774 12.535 19.6464 11.6545C19.4573 11.3955 19.3943 11.4473 19.2179 11.6545C18.4868 12.535 17.7432 13.4025 17.0121 14.283C16.8483 14.4773 16.9617 14.6715 17.1886 14.6715C17.5037 14.6715 17.8188 14.6715 18.1339 14.6715C18.1339 17.0541 18.1465 19.4107 18.1465 21.7932C18.1465 22.8679 17.302 23.7355 16.2558 23.7355C15.2097 23.7355 14.3652 22.8679 14.3652 21.7932C14.3652 20.1229 14.3778 18.4655 14.3778 16.808C14.6929 16.808 15.008 16.808 15.3231 16.808C15.55 16.808 15.6634 16.6009 15.4996 16.4196C14.7685 15.5391 14.0249 14.6715 13.2938 13.791C13.1048 13.532 13.0417 13.5838 12.8653 13.791C12.1342 14.6715 11.3906 15.5391 10.6595 16.4196C10.4957 16.6138 10.6091 16.808 10.836 16.808C11.1511 16.808 11.4662 16.808 11.7813 16.808V16.8987V21.7932C11.7813 22.8679 10.9368 23.7355 9.89065 23.7355C8.84449 23.7355 8 22.8679 8 21.7932V14.2054C8 12.781 8.56719 11.4732 9.48731 10.5279C10.4074 9.5827 11.6805 9.00001 13.0796 9.00001C14.2896 9.00001 15.3988 9.44027 16.2684 10.1654C17.1381 9.44027 18.2473 9.00001 19.4573 9.00001C20.8565 9.00001 22.1295 9.5827 23.0496 10.5279C23.9697 11.4732 24.5369 12.781 24.5369 14.2054V21.7932H24.5117Z",
53536
+ fill: "white"
53537
+ }), jsx("rect", {
53538
+ x: "1",
53539
+ y: "1",
53540
+ width: "31",
53541
+ height: "31",
53542
+ rx: "15.5",
53543
+ stroke: "white",
53544
+ strokeWidth: "2"
53545
+ })]
53546
+ })]
53547
+ });
53548
+ }
53549
+
53550
+ function MarkerIcon() {
53551
+ return jsx(Box, {
53552
+ css: {
53553
+ position: 'absolute',
53554
+ top: '40%',
53555
+ left: '46%',
53556
+ zIndex: 1000,
53557
+ '@md': {
53558
+ left: '47%'
53559
+ }
53560
+ },
53561
+ children: jsx(MarkerSvg, {})
53562
+ });
53563
+ }
53564
+
53565
+ function ZoomControls({
53566
+ onZoomIn,
53567
+ onZoomOut
53568
+ }) {
53569
+ return jsxs(Flex$1, {
53570
+ direction: "column",
53571
+ gap: 2,
53572
+ css: {
53573
+ position: 'absolute',
53574
+ bottom: 16,
53575
+ right: 16,
53576
+ zIndex: 1000
53577
+ },
53578
+ children: [jsx(ZoomControlButton, {
53579
+ onClick: onZoomIn,
53580
+ children: jsx(PlusOutline, {
53581
+ size: 20,
53582
+ color: "#04C99E"
53583
+ })
53584
+ }), jsx(ZoomControlButton, {
53585
+ onClick: onZoomOut,
53586
+ children: jsx(MinusOutline, {
53587
+ size: 20,
53588
+ color: "#04C99E"
53589
+ })
53590
+ })]
53591
+ });
53592
+ }
53593
+
53594
+ function AddressCard({
53595
+ place
53596
+ }) {
53597
+ return jsxs(AddressCardWrapper, {
53598
+ align: "center",
53599
+ children: [jsx(Box, {
53539
53600
  css: {
53540
- position: 'relative',
53541
- width: isDesktop ? '517px !important' : '100% !important',
53542
- height: '441px !important',
53543
- overflow: 'hidden'
53601
+ width: 24,
53602
+ height: 24
53544
53603
  },
53604
+ children: jsx(LocationOutline, {
53605
+ size: 24
53606
+ })
53607
+ }), ' ', jsx(Address, {
53608
+ children: place.display_name
53609
+ })]
53610
+ }, place.place_id);
53611
+ }
53612
+
53613
+ //@ts-nocheck
53614
+ function ChangeView({
53615
+ center,
53616
+ readOnly,
53617
+ onDragEnd
53618
+ }) {
53619
+ const map = useMapEvents({
53620
+ dragend: e => {
53621
+ if (readOnly) return;
53622
+ const latLng = e.target.getCenter();
53623
+ onDragEnd(latLng);
53624
+ }
53625
+ });
53626
+ map.setView(center, map.getZoom());
53627
+ return null;
53628
+ }
53629
+
53630
+ function MapPicker(props) {
53631
+ const {
53632
+ css,
53633
+ radius,
53634
+ value,
53635
+ showSelectButton,
53636
+ readOnly,
53637
+ onChange,
53638
+ selectLocationText,
53639
+ searchPlaceholder,
53640
+ header
53641
+ } = props;
53642
+ const [zoom, setZoom] = useState(16);
53643
+ const isDesktop = useMediaQuery('(min-width: 767px)');
53644
+ const {
53645
+ center,
53646
+ setCenter,
53647
+ places,
53648
+ searchQuery,
53649
+ searchResult,
53650
+ handleSearchChange,
53651
+ handleSearchSelect,
53652
+ handleSearchLatLng
53653
+ } = useMapSearch({
53654
+ initialCenter: value && (value === null || value === void 0 ? void 0 : value.lat) && (value === null || value === void 0 ? void 0 : value.lng) && value || {
53655
+ lat: -6.175392,
53656
+ lng: 106.827153
53657
+ },
53658
+ showSelectButton,
53659
+ onChange
53660
+ });
53661
+ useEffect(() => {
53662
+ if (value && (value === null || value === void 0 ? void 0 : value.lat) && (value === null || value === void 0 ? void 0 : value.lng)) {
53663
+ setCenter(value);
53664
+ handleSearchLatLng(value);
53665
+ }
53666
+ }, [value, setCenter]);
53667
+ function handleMarkerClick() {
53668
+ if (places.length > 0) {
53669
+ const mapObject = {
53670
+ place_id: places[0].place_id,
53671
+ lat: places[0].lat,
53672
+ lng: places[0].lon,
53673
+ formatted_address: places[0].display_name,
53674
+ address_components: places[0].address
53675
+ };
53676
+ onChange === null || onChange === void 0 ? void 0 : onChange(Object.assign({}, mapObject), true);
53677
+ }
53678
+ }
53679
+ return jsxs(Container$3, {
53680
+ direction: "column",
53681
+ css: css,
53682
+ children: [header, jsx(MapWrapper, {
53545
53683
  children: jsxs(MapContainer, {
53546
53684
  center: [center === null || center === void 0 ? void 0 : center.lat, center === null || center === void 0 ? void 0 : center.lng],
53547
53685
  zoom: zoom,
53548
53686
  zoomControl: false,
53549
- style: {
53550
- position: 'relative',
53551
- width: isDesktop ? '517px' : '100%',
53552
- height: '441px'
53553
- },
53687
+ dragging: !readOnly,
53688
+ style: isDesktop ? mapContainerStyle.desktop : mapContainerStyle.mobile,
53554
53689
  children: [radius && jsx(Circle, {
53555
53690
  center: [center === null || center === void 0 ? void 0 : center.lat, center === null || center === void 0 ? void 0 : center.lng],
53556
53691
  radius: radius,
@@ -53560,61 +53695,30 @@ function MapPicker(props) {
53560
53695
  }
53561
53696
  }), jsx(TileLayer, {
53562
53697
  url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
53563
- }), showSelectButton && jsx(ButtonSelect, {}), jsx(MarkerIcon, {}), jsx(ChangeView, {
53564
- center: [center === null || center === void 0 ? void 0 : center.lat, center === null || center === void 0 ? void 0 : center.lng]
53565
- }), jsx(InputSearch, {
53698
+ }), showSelectButton && jsx(ButtonSelect, {
53699
+ onClick: handleMarkerClick,
53700
+ label: selectLocationText
53701
+ }), jsx(MarkerIcon, {}), jsx(ChangeView, {
53702
+ center: [center === null || center === void 0 ? void 0 : center.lat, center === null || center === void 0 ? void 0 : center.lng],
53703
+ readOnly: readOnly,
53704
+ onDragEnd: handleSearchLatLng
53705
+ }), !readOnly && jsx(InputSearch, {
53566
53706
  list: searchResult,
53567
53707
  value: searchQuery,
53568
- placeholder: t('searchPlaceholder', 'Cari ...'),
53708
+ placeholder: searchPlaceholder || 'Cari ...',
53569
53709
  onChange: handleSearchChange,
53570
53710
  onSelect: handleSearchSelect
53571
- }), jsxs(Flex$1, {
53572
- direction: "column",
53573
- gap: 2,
53574
- css: {
53575
- position: 'absolute',
53576
- bottom: 16,
53577
- right: 16,
53578
- zIndex: 1000
53579
- },
53580
- children: [jsx(ZoomControl, {
53581
- onClick: () => setZoom(current => current + 1),
53582
- children: jsx(PlusOutline, {
53583
- size: 20,
53584
- color: "#04C99E"
53585
- })
53586
- }), jsx(ZoomControl, {
53587
- onClick: () => setZoom(current => current - 1),
53588
- children: jsx(MinusOutline, {
53589
- size: 20,
53590
- color: "#04C99E"
53591
- })
53592
- })]
53711
+ }), jsx(ZoomControls, {
53712
+ onZoomIn: () => setZoom(current => current + 1),
53713
+ onZoomOut: () => setZoom(current => current - 1)
53593
53714
  })]
53594
53715
  }, zoom)
53595
- }), places === null || places === void 0 ? void 0 : places.map(({
53596
- place_id,
53597
- display_name
53598
- }) => {
53599
- return jsxs(AddressCard, {
53600
- align: "center",
53601
- children: [jsx(Box, {
53602
- css: {
53603
- width: 24,
53604
- height: 24
53605
- },
53606
- children: jsx(LocationOutline, {
53607
- size: 24
53608
- })
53609
- }), ' ', jsx(Address, {
53610
- children: display_name
53611
- })]
53612
- }, place_id);
53613
- })]
53716
+ }), places === null || places === void 0 ? void 0 : places.map(place => jsx(AddressCard, {
53717
+ place: place
53718
+ }, place.place_id))]
53614
53719
  });
53615
53720
  }
53616
53721
  MapPicker.defaultProps = {
53617
- showBanner: true,
53618
53722
  value: {
53619
53723
  lat: -6.175392,
53620
53724
  lng: 106.827153
@@ -53632,22 +53736,18 @@ const ContainerInput = styled('div', {
53632
53736
  });
53633
53737
  function InputMapPicker(props) {
53634
53738
  var _a;
53635
- const {
53636
- t
53637
- } = useTranslation(['MajooUI/mapPicker', 'translation']);
53638
53739
  const {
53639
53740
  css,
53640
53741
  modalTitle,
53641
53742
  buttonLabel,
53642
53743
  placeholder,
53643
- showBanner,
53644
- bannerDescription,
53645
53744
  radius,
53646
53745
  value,
53647
53746
  showSelectButton,
53747
+ readOnly,
53648
53748
  onChange,
53649
- onMarkerClick,
53650
- customInputValue
53749
+ customInputValue,
53750
+ header
53651
53751
  } = props;
53652
53752
  const modalTrigger = React__default.useRef(null);
53653
53753
  const [inputValue, setInputValue] = useState(placeholder);
@@ -53669,13 +53769,13 @@ function InputMapPicker(props) {
53669
53769
  var _a;
53670
53770
  (_a = modalTrigger === null || modalTrigger === void 0 ? void 0 : modalTrigger.current) === null || _a === void 0 ? void 0 : _a.click();
53671
53771
  }
53672
- function handleMarkerClick() {
53673
- handleClick();
53674
- onMarkerClick === null || onMarkerClick === void 0 ? void 0 : onMarkerClick();
53675
- }
53676
- function handleChange(mapObject) {
53677
- setInputValue(mapObject.formatted_address);
53678
- onChange === null || onChange === void 0 ? void 0 : onChange(mapObject);
53772
+ function handleChange(mapObject, isConfirmed) {
53773
+ if (isConfirmed) {
53774
+ handleClick();
53775
+ onChange === null || onChange === void 0 ? void 0 : onChange(mapObject);
53776
+ } else {
53777
+ setInputValue(mapObject.formatted_address);
53778
+ }
53679
53779
  }
53680
53780
  const isDesktop = useMediaQuery('(min-width: 767px)');
53681
53781
  return jsxs(React__default.Fragment, {
@@ -53718,13 +53818,13 @@ function InputMapPicker(props) {
53718
53818
  flex: 1
53719
53819
  },
53720
53820
  isTruncated: true,
53721
- children: (_a = customInputValue !== null && customInputValue !== void 0 ? customInputValue : inputValue) !== null && _a !== void 0 ? _a : t('mapPlaceholder', 'Tandai lokasi dalam peta')
53821
+ children: (_a = customInputValue !== null && customInputValue !== void 0 ? customInputValue : inputValue) !== null && _a !== void 0 ? _a : 'Tandai lokasi dalam peta'
53722
53822
  }), isDesktop ? jsx(Button$4, {
53723
53823
  type: "button",
53724
53824
  size: "sm",
53725
53825
  buttonType: "secondary",
53726
53826
  onClick: handleClick,
53727
- children: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : t('buttonLabelText', 'Ubah Lokasi')
53827
+ children: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : 'Ubah Lokasi'
53728
53828
  }) : null]
53729
53829
  })
53730
53830
  })]
@@ -53733,19 +53833,20 @@ function InputMapPicker(props) {
53733
53833
  size: "md",
53734
53834
  buttonType: "secondary",
53735
53835
  onClick: handleClick,
53736
- children: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : t('buttonLabelText', 'Ubah Lokasi')
53836
+ children: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : 'Ubah Lokasi'
53737
53837
  }) : null]
53738
53838
  }), jsxs(ModalDialog, {
53739
53839
  width: isDesktop ? 565 : '100%',
53740
53840
  layer: "$modal",
53741
53841
  onPointerDownOutside: e => e.preventDefault(),
53842
+ onCloseClick: () => setInputValue(placeholder),
53742
53843
  children: [jsx(ModalDialogTrigger, {
53743
53844
  asChild: true,
53744
53845
  children: jsx("div", {
53745
53846
  ref: modalTrigger
53746
53847
  })
53747
53848
  }), jsx(ModalDialogTitle, {
53748
- children: modalTitle !== null && modalTitle !== void 0 ? modalTitle : t('modalTitle', 'Tambah Lokasi di Map')
53849
+ children: modalTitle !== null && modalTitle !== void 0 ? modalTitle : 'Tambah Lokasi di Map'
53749
53850
  }), jsx(ModalDialogContent, {
53750
53851
  css: {
53751
53852
  overflowY: 'auto',
@@ -53753,13 +53854,12 @@ function InputMapPicker(props) {
53753
53854
  position: 'relative'
53754
53855
  },
53755
53856
  children: jsx(MapPicker, {
53756
- showBanner: showBanner,
53757
- bannerDescription: bannerDescription,
53758
53857
  value: value,
53759
53858
  onChange: handleChange,
53760
- onMarkerClick: handleMarkerClick,
53761
53859
  radius: radius,
53762
- showSelectButton: showSelectButton
53860
+ showSelectButton: showSelectButton,
53861
+ readOnly: readOnly,
53862
+ header: header
53763
53863
  })
53764
53864
  })]
53765
53865
  })]
@@ -57117,4 +57217,4 @@ const useToggle = initialValue => {
57117
57217
  return useReducer(toggleReducer, initialValue);
57118
57218
  };
57119
57219
 
57120
- export { ADVANCE_PICKER, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AdvancedOption, AlertDialog, AlertDialogCancel, AlertDialogConfirm, AlertDialogContent, AlertDialogDescription, AlertDialogFunction, AlertDialogRoot, AlertDialogTitle, AlertDialogTrigger, Avatar, BOTTOM_LEFT_POSITION, BOTTOM_RIGHT_POSITION, Badge, Banner, BannerClose, BannerDescription, BannerLink, BannerTitle, BarChartComponent as BarChart, Box, Breadcrumb, BreadcrumbItem, BreadcrumbLink, Button$4 as Button, ButtonDropdown, ButtonGroup$1 as ButtonGroup, ButtonGroupItem, ButtonPrimitive, Card, CardComponent, CardLineColor, Cell, CheckboxGroup, CheckboxTable, ColorPicker_default as ColorPicker, Colors$1 as Colors, ContentEditor, ContextMenu, ContextMenuItem, ContextMenuSeparator, ContextMenuTrigger, CustomDatePicker, DATE_RANGE_PICKER, DEFAULT, DateColumn, DatePicker, DatePickerMulti, DecimalColumn, Device as DevicePreview, Dialog, DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerCloseButton, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuArrow, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemIndicator, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger, EditableTable, Flex$1 as Flex, FormGroup, FormHelper, FormLabel, Grid, GridItem, Heading, IconButton, IconContainer, Image, ImageDevicePreview, Input$7 as Input, InputCheckbox, InputColorPicker, InputCombobox, InputCounter, InputCreatable, InputDatePicker, InputDateRange, InputGroup, InputLeftAddon, InputLeftElement, InputMapPicker, InputNumber, InputOTP, InputPrefix, InputRadio, InputRadioGroup, InputResourceList, InputRightAddon, InputRightElement, InputSearchbox, InputSelect, InputSelectCheck, InputSelectTag, InputSignature, InputSuffix, InputSwitch, InputSwitchWithImage, TagsInput as InputTags, InputText, InputTextArea, InputTimePicker, LAST_30_DAYS, LAST_7_DAYS, LAST_MONTH, LAST_TWO_MONTHS, LAST_WEEK, LineChart, Link, LoadingBar, MONTHLY, MajooProvider, MapPicker, MemoizedEditableTable, MobileTable, ModalDialog, ModalDialogContent, ModalDialogFooter, ModalDialogTitle, ModalDialogTrigger, NEXT_MONTH, NEXT_WEEK, NativeTimePicker, NotificationBadge, OptionWrapper$2 as OptionWrapper, PREV_MONTH, PREV_WEEK, PageContainer, PageDialog, PageDialogContent, PageDialogFooter, PageDialogTitle, PageDialogTrigger, Pagination, Paper, PaperComponent, Paragraph, PieChartComponent as PieChart, Popover, PopoverClose, PopoverContent, PopoverTrigger, PriceColumn, Progress$1 as Progress, ProgressIndicator, RANGE_CONTROL, RANGE_MONTH, RANGE_PICKER, RANGE_WEEK, ResendOTP, RightSlot, rowExpanderColumn as RowExpanderColumn, rowExpanderMultipleColumn as RowExpanderMultipleColumn, rowMenuColumn as RowMenuColumn, rowSelectionColumn as RowSelectionColumn, rowSelectionWithCallbackColumn as RowSelectionWithCallbackColumn, SINGLE_PICKER, ScrollSync, ScrollSyncNode, SelectBox, SelectContainer, SelectItem, SelectOption, Separator$2 as Separator, Skeleton, Slider, StepWizard, StepWizardContext, StyledBox, StyledDropdown, StyledInput$1 as StyledInput, StyledSpan, StyledTitle$2 as StyledTitle, THIS_MONTH, THIS_WEEK, TODAY, TOP_LEFT_POSITION, TOP_RIGHT_POSITION, Table, TableBody$3 as TableBody, TableCell$3 as TableCell, TableColumn, TableContent$3 as TableContent, TableFoot$2 as TableFoot, TableFootCell$2 as TableFootCell, TableFootRow$2 as TableFootRow, TableHead$3 as TableHead, TableHeadCellContent, TableHeaderCellContainer, TableOfContent, TableOfContentPage, TableRow$3 as TableRow, Tabs$1 as Tabs, TabsContent$1 as TabsContent, TabsList$1 as TabsList, TabsTrigger$1 as TabsTrigger, Tag, TagList, TagStatus, Text$1 as Text, TextVariantsEnum, TimePicker, ToastContext, ToastProvider, Tooltip$1 as Tooltip, UPDATE_PICKER, Upload, WEEKLY, YESTERDAY, addOnCellStyle, advancePickerDate, advancePickerOptionsEn, advancePickerOptionsId, defaultEmptyDataProps, defaultFetchDataParams, pickerReducer, useListOption, useToggle };
57220
+ export { ADVANCE_PICKER, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AdvancedOption, AlertDialog, AlertDialogCancel, AlertDialogConfirm, AlertDialogContent, AlertDialogDescription, AlertDialogFunction, AlertDialogRoot, AlertDialogTitle, AlertDialogTrigger, Avatar, BOTTOM_LEFT_POSITION, BOTTOM_RIGHT_POSITION, Badge, Banner, BannerClose, BannerDescription, BannerLink, BannerTitle, BarChartComponent as BarChart, Box, Breadcrumb, BreadcrumbItem, BreadcrumbLink, Button$4 as Button, ButtonDropdown, ButtonGroup$1 as ButtonGroup, ButtonGroupItem, ButtonPrimitive, Card, CardComponent, CardLineColor, Cell, CheckboxGroup, CheckboxTable, ColorPicker_default as ColorPicker, Colors$1 as Colors, ContentEditor, ContextMenu, ContextMenuItem, ContextMenuSeparator, ContextMenuTrigger, CustomDatePicker, DATE_RANGE_PICKER, DEFAULT, DateColumn, DatePicker, DatePickerMulti, DecimalColumn, Device as DevicePreview, Dialog, DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerCloseButton, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuArrow, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemIndicator, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger, EditableTable, Flex$1 as Flex, FormGroup, FormHelper, FormLabel, Grid, GridItem, Heading, IconButton, IconContainer, Image, ImageDevicePreview, Input$6 as Input, InputCheckbox, InputColorPicker, InputCombobox, InputCounter, InputCreatable, InputDatePicker, InputDateRange, InputGroup, InputLeftAddon, InputLeftElement, InputMapPicker, InputNumber, InputOTP, InputPrefix, InputRadio, InputRadioGroup, InputResourceList, InputRightAddon, InputRightElement, InputSearchbox, InputSelect, InputSelectCheck, InputSelectTag, InputSignature, InputSuffix, InputSwitch, InputSwitchWithImage, TagsInput as InputTags, InputText, InputTextArea, InputTimePicker, LAST_30_DAYS, LAST_7_DAYS, LAST_MONTH, LAST_TWO_MONTHS, LAST_WEEK, LineChart, Link, LoadingBar, MONTHLY, MajooProvider, MapPicker, MemoizedEditableTable, MobileTable, ModalDialog, ModalDialogContent, ModalDialogFooter, ModalDialogTitle, ModalDialogTrigger, NEXT_MONTH, NEXT_WEEK, NativeTimePicker, NotificationBadge, OptionWrapper$2 as OptionWrapper, PREV_MONTH, PREV_WEEK, PageContainer, PageDialog, PageDialogContent, PageDialogFooter, PageDialogTitle, PageDialogTrigger, Pagination, Paper, PaperComponent, Paragraph, PieChartComponent as PieChart, Popover, PopoverClose, PopoverContent, PopoverTrigger, PriceColumn, Progress$1 as Progress, ProgressIndicator, RANGE_CONTROL, RANGE_MONTH, RANGE_PICKER, RANGE_WEEK, ResendOTP, RightSlot, rowExpanderColumn as RowExpanderColumn, rowExpanderMultipleColumn as RowExpanderMultipleColumn, rowMenuColumn as RowMenuColumn, rowSelectionColumn as RowSelectionColumn, rowSelectionWithCallbackColumn as RowSelectionWithCallbackColumn, SINGLE_PICKER, ScrollSync, ScrollSyncNode, SelectBox, SelectContainer, SelectItem, SelectOption, Separator$2 as Separator, Skeleton, Slider, StepWizard, StepWizardContext, StyledBox, StyledDropdown, StyledInput$1 as StyledInput, StyledSpan, StyledTitle$2 as StyledTitle, THIS_MONTH, THIS_WEEK, TODAY, TOP_LEFT_POSITION, TOP_RIGHT_POSITION, Table, TableBody$3 as TableBody, TableCell$3 as TableCell, TableColumn, TableContent$3 as TableContent, TableFoot$2 as TableFoot, TableFootCell$2 as TableFootCell, TableFootRow$2 as TableFootRow, TableHead$3 as TableHead, TableHeadCellContent, TableHeaderCellContainer, TableOfContent, TableOfContentPage, TableRow$3 as TableRow, Tabs$1 as Tabs, TabsContent$1 as TabsContent, TabsList$1 as TabsList, TabsTrigger$1 as TabsTrigger, Tag, TagList, TagStatus, Text$1 as Text, TextVariantsEnum, TimePicker, ToastContext, ToastProvider, Tooltip$1 as Tooltip, UPDATE_PICKER, Upload, WEEKLY, YESTERDAY, addOnCellStyle, advancePickerDate, advancePickerOptionsEn, advancePickerOptionsId, defaultEmptyDataProps, defaultFetchDataParams, pickerReducer, useListOption, useToggle };