@overmap-ai/core 1.0.36-misc-improvements.2 → 1.0.36

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.
@@ -6,13 +6,11 @@ import { ISerializedField, SelectFieldOption, SerializedMultiStringField } from
6
6
  type MultiStringFieldOptions = ChildFieldOptions<SelectFieldOption[]> & {
7
7
  minimum_length?: number;
8
8
  maximum_length?: number;
9
- placeholder?: string;
10
9
  };
11
10
  export declare const emptyMultiStringField: {
12
11
  type: string;
13
12
  minimum_length: number;
14
13
  maximum_length: null;
15
- placeholder: string;
16
14
  label: string;
17
15
  description: string;
18
16
  required: boolean;
@@ -28,7 +26,6 @@ export declare class MultiStringField extends BaseField<SelectFieldOption[], "mu
28
26
  readonly minLength: number;
29
27
  readonly maxLength: number;
30
28
  readonly onlyValidateAfterTouched = false;
31
- readonly placeholder: string;
32
29
  static Icon: typeof ListBulletIcon;
33
30
  constructor(options: MultiStringFieldOptions);
34
31
  getValueFromChangeEvent(event: ChangeEvent<HTMLInputElement> | SelectFieldOption[]): SelectFieldOption[];
@@ -10,7 +10,6 @@ export declare const emptyNumberField: {
10
10
  minimum: number;
11
11
  maximum: number;
12
12
  integers: boolean;
13
- placeholder: string;
14
13
  label: string;
15
14
  description: string;
16
15
  required: boolean;
@@ -19,7 +18,6 @@ export interface NumberFieldOptions extends ChildFieldOptions<NumberFieldValue>
19
18
  maximum?: number;
20
19
  minimum?: number;
21
20
  integers?: boolean;
22
- placeholder?: string;
23
21
  }
24
22
  export declare class NumberField extends BaseField<NumberFieldValue, "number"> {
25
23
  static readonly fieldTypeName = "Number";
@@ -27,7 +25,6 @@ export declare class NumberField extends BaseField<NumberFieldValue, "number"> {
27
25
  readonly minimum: number | undefined;
28
26
  readonly maximum: number | undefined;
29
27
  readonly integers: boolean;
30
- readonly placeholder: string;
31
28
  static Icon: typeof FontFamilyIcon;
32
29
  constructor(options: NumberFieldOptions);
33
30
  getValueFromChangeEvent(event: ChangeEvent<HTMLInputElement>): NumberFieldValue;
@@ -10,16 +10,13 @@ export interface BaseSelectFieldOptions<TValue, TIdentifier extends "select" | "
10
10
  * where the `label` is the text to display to the user and the `value` is the value handled by Formik.*/
11
11
  options: string[] | SelectFieldOption[];
12
12
  type: TIdentifier;
13
- placeholder?: string;
14
13
  }
15
14
  export declare abstract class BaseSelectField<TValue extends FieldValue, TIdentifier extends "select" | "multi-select"> extends BaseField<TValue, TIdentifier> {
16
15
  readonly options: SelectFieldOption[];
17
16
  readonly onlyValidateAfterTouched = false;
18
- readonly placeholder: string;
19
17
  protected constructor(options: BaseSelectFieldOptions<TValue, TIdentifier>);
20
18
  protected _serialize(): {
21
19
  options: SelectFieldOption[];
22
- placeholder: string;
23
20
  label: string;
24
21
  required: boolean;
25
22
  image?: File | Promise<File> | undefined;
@@ -10,7 +10,6 @@ export type MultiSelectFieldOptions = Omit<BaseSelectFieldOptions<SelectFieldOpt
10
10
  export declare const emptyMultiSelectField: {
11
11
  type: string;
12
12
  options: never[];
13
- placeholder: string;
14
13
  label: string;
15
14
  description: string;
16
15
  required: boolean;
@@ -10,7 +10,6 @@ export type SelectFieldOptions = Omit<BaseSelectFieldOptions<SelectFieldOptionVa
10
10
  export declare const emptySelectField: {
11
11
  type: string;
12
12
  options: never[];
13
- placeholder: string;
14
13
  label: string;
15
14
  description: string;
16
15
  required: boolean;
@@ -10,7 +10,6 @@ export declare const emptyStringField: {
10
10
  type: string;
11
11
  maximum_length: number;
12
12
  input_type: string;
13
- placeholder: string;
14
13
  label: string;
15
14
  description: string;
16
15
  required: boolean;
@@ -5,7 +5,6 @@ import { SerializedStringField } from "../../typings";
5
5
  export interface StringOrTextFieldOptions extends FieldOptions<string> {
6
6
  minLength?: NumberFieldValue;
7
7
  maxLength?: NumberFieldValue;
8
- placeholder?: string;
9
8
  }
10
9
  export type SerializedStringOrTextField<TIdentifier extends "string" | "text"> = Omit<SerializedStringField, "type"> & {
11
10
  type: TIdentifier;
@@ -13,7 +12,6 @@ export type SerializedStringOrTextField<TIdentifier extends "string" | "text"> =
13
12
  export declare abstract class StringOrTextField<TIdentifier extends "string" | "text"> extends BaseField<string, TIdentifier> {
14
13
  readonly minLength?: number;
15
14
  readonly maxLength: number;
16
- readonly placeholder: string;
17
15
  protected constructor(options: StringOrTextFieldOptions);
18
16
  /**
19
17
  * This function returns a function that validates that the value given for "minimum length" (when creating a new field) is less than or
@@ -7,7 +7,6 @@ export type TextFieldOptions = Omit<StringOrTextFieldOptions, "type">;
7
7
  export declare const emptyTextField: {
8
8
  type: string;
9
9
  maximum_length: number;
10
- placeholder: string;
11
10
  label: string;
12
11
  description: string;
13
12
  required: boolean;
@@ -30,7 +30,6 @@ export declare const FieldTypeToEmptyFieldMapping: {
30
30
  minimum: number;
31
31
  maximum: number;
32
32
  integers: boolean;
33
- placeholder: string;
34
33
  label: string;
35
34
  description: string;
36
35
  required: boolean;
@@ -44,7 +43,6 @@ export declare const FieldTypeToEmptyFieldMapping: {
44
43
  readonly select: {
45
44
  type: string;
46
45
  options: never[];
47
- placeholder: string;
48
46
  label: string;
49
47
  description: string;
50
48
  required: boolean;
@@ -53,7 +51,6 @@ export declare const FieldTypeToEmptyFieldMapping: {
53
51
  type: string;
54
52
  maximum_length: number;
55
53
  input_type: string;
56
- placeholder: string;
57
54
  label: string;
58
55
  description: string;
59
56
  required: boolean;
@@ -61,7 +58,6 @@ export declare const FieldTypeToEmptyFieldMapping: {
61
58
  readonly text: {
62
59
  type: string;
63
60
  maximum_length: number;
64
- placeholder: string;
65
61
  label: string;
66
62
  description: string;
67
63
  required: boolean;
@@ -85,7 +81,6 @@ export declare const FieldTypeToEmptyFieldMapping: {
85
81
  type: string;
86
82
  minimum_length: number;
87
83
  maximum_length: null;
88
- placeholder: string;
89
84
  label: string;
90
85
  description: string;
91
86
  required: boolean;
@@ -93,7 +88,6 @@ export declare const FieldTypeToEmptyFieldMapping: {
93
88
  readonly "multi-select": {
94
89
  type: string;
95
90
  options: never[];
96
- placeholder: string;
97
91
  label: string;
98
92
  description: string;
99
93
  required: boolean;
@@ -43,7 +43,6 @@ export interface SerializedFieldSection extends BaseSerializedObject {
43
43
  interface BaseSerializedStringField extends BaseSerializedField {
44
44
  minimum_length?: number;
45
45
  maximum_length: number;
46
- placeholder?: string;
47
46
  }
48
47
  export type StringInputType = Exclude<HTMLInputTypeAttribute, "checkbox" | "number" | "button">;
49
48
  export interface SerializedStringField extends BaseSerializedStringField {
@@ -64,7 +63,6 @@ export interface SerializedNumberField extends BaseSerializedField {
64
63
  minimum: number | undefined;
65
64
  maximum: number | undefined;
66
65
  integers: boolean;
67
- placeholder?: string;
68
66
  }
69
67
  export interface SerializedDateField extends BaseSerializedField {
70
68
  type: "date";
@@ -78,12 +76,10 @@ export interface SelectFieldOption {
78
76
  export interface SerializedSelectField extends BaseSerializedField {
79
77
  type: "select";
80
78
  options: SelectFieldOption[];
81
- placeholder?: string;
82
79
  }
83
80
  export interface SerializedMultiSelectField extends BaseSerializedField {
84
81
  type: "multi-select";
85
82
  options: SelectFieldOption[];
86
- placeholder?: string;
87
83
  }
88
84
  export interface SerializedUploadField extends BaseSerializedField {
89
85
  type: "upload";
@@ -8,7 +8,7 @@ var _a;
8
8
  import * as React from "react";
9
9
  import React__default, { useState, useEffect, useRef, memo, useMemo, forwardRef, createElement, useCallback, createContext, useContext, Children, isValidElement, cloneElement, Fragment as Fragment$1, useLayoutEffect, useReducer } from "react";
10
10
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
11
- import { unsafeShowToast, AlertDialogProvider, ToastProvider, DefaultTheme, Flex, IconButton, Text, useSeverityColor, Checkbox, TextArea, Select, useToast, Badge, MultiSelect, Button, ButtonList, divButtonProps, Tooltip, DropdownItemMenu, Popover, useAlertDialog, Input } from "@overmap-ai/blocks";
11
+ import { unsafeShowToast, AlertDialogProvider, ToastProvider, DefaultTheme, Flex, IconButton, Text, useSeverityColor, Checkbox, TextArea, Select, useToast, Badge, MultiSelect, Button, ButtonList, divButtonProps, Tooltip, DropdownItemMenu, Popover, Input, useAlertDialog } from "@overmap-ai/blocks";
12
12
  import { DepGraph } from "dependency-graph";
13
13
  import { offline as offline$1 } from "@redux-offline/redux-offline";
14
14
  import offlineConfig from "@redux-offline/redux-offline/lib/defaults";
@@ -8485,7 +8485,7 @@ const NumberInput = memo((props) => {
8485
8485
  ...fieldProps,
8486
8486
  type: "number",
8487
8487
  id: inputId,
8488
- placeholder: field.placeholder,
8488
+ placeholder: "Enter a number",
8489
8489
  min: field.minimum,
8490
8490
  max: field.maximum,
8491
8491
  step: field.integers ? 1 : 0.1,
@@ -8501,8 +8501,7 @@ const emptyNumberField = {
8501
8501
  type: "number",
8502
8502
  minimum: Number.MIN_SAFE_INTEGER,
8503
8503
  maximum: Number.MAX_SAFE_INTEGER,
8504
- integers: false,
8505
- placeholder: "Enter a number"
8504
+ integers: false
8506
8505
  };
8507
8506
  const valueIsFormikUserFormRevision$1 = (form) => {
8508
8507
  return "fields" in form;
@@ -8513,18 +8512,15 @@ const _NumberField = class _NumberField extends BaseField {
8513
8512
  minimum = Number.MIN_SAFE_INTEGER,
8514
8513
  maximum = Number.MAX_SAFE_INTEGER,
8515
8514
  integers = false,
8516
- placeholder = "Enter a number",
8517
8515
  ...base
8518
8516
  } = options;
8519
8517
  super({ ...base, type: "number" });
8520
8518
  __publicField(this, "minimum");
8521
8519
  __publicField(this, "maximum");
8522
8520
  __publicField(this, "integers");
8523
- __publicField(this, "placeholder");
8524
8521
  this.minimum = minimum;
8525
8522
  this.maximum = maximum;
8526
8523
  this.integers = integers;
8527
- this.placeholder = placeholder;
8528
8524
  }
8529
8525
  getValueFromChangeEvent(event) {
8530
8526
  const number = Number.parseFloat(event.target.value);
@@ -8600,8 +8596,7 @@ const _NumberField = class _NumberField extends BaseField {
8600
8596
  ...super._serialize(),
8601
8597
  minimum: this.minimum,
8602
8598
  maximum: this.maximum,
8603
- integers: this.integers,
8604
- placeholder: this.placeholder
8599
+ integers: this.integers
8605
8600
  };
8606
8601
  }
8607
8602
  static deserialize(data) {
@@ -8685,14 +8680,12 @@ const valueIsFormikUserFormRevision = (form) => {
8685
8680
  };
8686
8681
  class StringOrTextField extends BaseField {
8687
8682
  constructor(options) {
8688
- const { minLength, maxLength = 5e3, placeholder = "", ...base } = options;
8683
+ const { minLength, maxLength = 5e3, ...base } = options;
8689
8684
  super(base);
8690
8685
  __publicField(this, "minLength");
8691
8686
  __publicField(this, "maxLength");
8692
- __publicField(this, "placeholder");
8693
8687
  this.minLength = minLength ? Math.max(minLength, 0) : void 0;
8694
8688
  this.maxLength = maxLength ? Math.max(maxLength, 0) : 5e3;
8695
- this.placeholder = placeholder;
8696
8689
  }
8697
8690
  static getFieldCreationSchema(parentPath = "") {
8698
8691
  const path = parentPath && `${parentPath}.`;
@@ -8757,8 +8750,7 @@ class StringOrTextField extends BaseField {
8757
8750
  return {
8758
8751
  ...super._serialize(),
8759
8752
  minimum_length: this.minLength,
8760
- maximum_length: this.maxLength,
8761
- placeholder: this.placeholder
8753
+ maximum_length: this.maxLength
8762
8754
  };
8763
8755
  }
8764
8756
  }
@@ -8817,7 +8809,7 @@ const StringInput = memo((props) => {
8817
8809
  ...fieldProps,
8818
8810
  type: field.inputType,
8819
8811
  id: inputId,
8820
- placeholder: field.placeholder,
8812
+ placeholder: "Enter a short description",
8821
8813
  color
8822
8814
  }
8823
8815
  ) : /* @__PURE__ */ jsxs(TextField$1.Root, { className: styles$5.clickableLinkContainer, children: [
@@ -8850,15 +8842,14 @@ const emptyStringField = {
8850
8842
  ...emptyBaseField,
8851
8843
  type: "string",
8852
8844
  maximum_length: 500,
8853
- input_type: "text",
8854
- placeholder: "Enter a short description"
8845
+ input_type: "text"
8855
8846
  };
8856
8847
  const _StringField = class _StringField extends StringOrTextField {
8857
8848
  constructor(options) {
8858
- const { inputType = "text", placeholder = "Enter a short description", ...rest } = options;
8849
+ const { inputType = "text", ...rest } = options;
8859
8850
  const maxLength = options.maxLength ? Math.min(500, options.maxLength) : 500;
8860
8851
  const minLength = options.minLength ? Math.min(options.minLength, maxLength) : void 0;
8861
- super({ ...rest, maxLength, minLength, placeholder, type: "string" });
8852
+ super({ ...rest, maxLength, minLength, type: "string" });
8862
8853
  __publicField(this, "inputType");
8863
8854
  this.inputType = inputType;
8864
8855
  }
@@ -8900,7 +8891,7 @@ const TextInput = memo((props) => {
8900
8891
  ...fieldProps,
8901
8892
  resize: "vertical",
8902
8893
  id: inputId,
8903
- placeholder: field.placeholder,
8894
+ placeholder: "Enter a description",
8904
8895
  severity
8905
8896
  }
8906
8897
  )
@@ -8911,15 +8902,13 @@ TextInput.displayName = "TextInput";
8911
8902
  const emptyTextField = {
8912
8903
  ...emptyBaseField,
8913
8904
  type: "text",
8914
- maximum_length: 5e3,
8915
- placeholder: "Enter a description"
8905
+ maximum_length: 5e3
8916
8906
  };
8917
8907
  const _TextField = class _TextField extends StringOrTextField {
8918
8908
  constructor(options) {
8919
- const { placeholder = "Enter a description", ...rest } = options;
8920
8909
  const maxLength = options.maxLength ? Math.min(5e3, options.maxLength) : 5e3;
8921
8910
  const minLength = options.minLength ? Math.min(options.minLength, maxLength) : void 0;
8922
- super({ ...rest, maxLength, minLength, placeholder, type: "text" });
8911
+ super({ ...options, maxLength, minLength, type: "text" });
8923
8912
  }
8924
8913
  serialize() {
8925
8914
  return super._serialize();
@@ -8970,7 +8959,7 @@ const SelectInput = memo((props) => {
8970
8959
  items: options,
8971
8960
  ...fieldProps,
8972
8961
  onValueChange: handleChange,
8973
- placeholder: field.placeholder,
8962
+ placeholder: "Select one...",
8974
8963
  id: inputId,
8975
8964
  severity,
8976
8965
  ...rest
@@ -9231,13 +9220,13 @@ const MultiStringInput = memo((props) => {
9231
9220
  /* @__PURE__ */ jsx(Box, { grow: "1", children: /* @__PURE__ */ jsx(
9232
9221
  TextField$1.Input,
9233
9222
  {
9223
+ placeholder: "Press enter to add a new option",
9234
9224
  ...rest,
9235
9225
  ...fieldProps,
9236
9226
  value: intermediateValue,
9237
9227
  onChange: handleChange,
9238
9228
  onKeyDown: handleKeyDown,
9239
9229
  id: inputId,
9240
- placeholder: field.placeholder,
9241
9230
  color: updatedColor,
9242
9231
  onBlur: void 0
9243
9232
  }
@@ -9305,20 +9294,17 @@ const emptyMultiStringField = {
9305
9294
  ...emptyBaseField,
9306
9295
  type: "multi-string",
9307
9296
  minimum_length: 0,
9308
- maximum_length: null,
9309
- placeholder: "Press enter to add a new option"
9297
+ maximum_length: null
9310
9298
  };
9311
9299
  const _MultiStringField = class _MultiStringField extends BaseField {
9312
9300
  constructor(options) {
9313
- const { minimum_length, maximum_length, placeholder, ...rest } = options;
9301
+ const { minimum_length, maximum_length, ...rest } = options;
9314
9302
  super({ ...rest, type: "multi-string" });
9315
9303
  __publicField(this, "minLength");
9316
9304
  __publicField(this, "maxLength");
9317
9305
  __publicField(this, "onlyValidateAfterTouched", false);
9318
- __publicField(this, "placeholder");
9319
9306
  this.minLength = minimum_length ?? 0;
9320
9307
  this.maxLength = maximum_length ?? Infinity;
9321
- this.placeholder = placeholder ?? "Press enter to add a new option";
9322
9308
  }
9323
9309
  getValueFromChangeEvent(event) {
9324
9310
  if (Array.isArray(event))
@@ -9329,12 +9315,7 @@ const _MultiStringField = class _MultiStringField extends BaseField {
9329
9315
  return /* @__PURE__ */ jsx(MultiStringInput, { field: this, ...props });
9330
9316
  }
9331
9317
  serialize() {
9332
- return {
9333
- ...super._serialize(),
9334
- minimum_length: this.minLength,
9335
- maximum_length: this.maxLength,
9336
- placeholder: this.placeholder
9337
- };
9318
+ return { ...super._serialize(), minimum_length: this.minLength, maximum_length: this.maxLength };
9338
9319
  }
9339
9320
  isBlank(value) {
9340
9321
  return super.isBlank(value) || value.length === 0;
@@ -9365,12 +9346,9 @@ __publicField(_MultiStringField, "Icon", ListBulletIcon);
9365
9346
  let MultiStringField = _MultiStringField;
9366
9347
  class BaseSelectField extends BaseField {
9367
9348
  constructor(options) {
9368
- const { placeholder = "", ...base } = options;
9369
- super(base);
9349
+ super(options);
9370
9350
  __publicField(this, "options");
9371
9351
  __publicField(this, "onlyValidateAfterTouched", false);
9372
- __publicField(this, "placeholder");
9373
- this.placeholder = placeholder;
9374
9352
  const encounteredIds = /* @__PURE__ */ new Set();
9375
9353
  this.options = options.options.map((option) => {
9376
9354
  if (typeof option === "string") {
@@ -9389,8 +9367,7 @@ class BaseSelectField extends BaseField {
9389
9367
  _serialize() {
9390
9368
  return {
9391
9369
  ...super._serialize(),
9392
- options: this.options,
9393
- placeholder: this.placeholder
9370
+ options: this.options
9394
9371
  };
9395
9372
  }
9396
9373
  static getFieldCreationSchema(parentPath = "") {
@@ -9413,13 +9390,11 @@ class BaseSelectField extends BaseField {
9413
9390
  const emptySelectField = {
9414
9391
  ...emptyBaseField,
9415
9392
  type: "select",
9416
- options: [],
9417
- placeholder: "Select one..."
9393
+ options: []
9418
9394
  };
9419
9395
  const _SelectField = class _SelectField extends BaseSelectField {
9420
9396
  constructor(options) {
9421
- const { placeholder = "Select one...", ...rest } = options;
9422
- super({ ...rest, placeholder, type: "select" });
9397
+ super({ ...options, type: "select" });
9423
9398
  }
9424
9399
  getValueFromChangeEvent(event) {
9425
9400
  if (typeof event === "string")
@@ -9479,7 +9454,7 @@ const MultiSelectInput = memo((props) => {
9479
9454
  onValueChange: handleChange,
9480
9455
  options: field.options,
9481
9456
  name: fieldProps.name,
9482
- placeholder: field.placeholder,
9457
+ placeholder: "Select one or more...",
9483
9458
  id: inputId,
9484
9459
  severity,
9485
9460
  ...rest
@@ -9492,13 +9467,11 @@ MultiSelectInput.displayName = "MultiSelectInput";
9492
9467
  const emptyMultiSelectField = {
9493
9468
  ...emptyBaseField,
9494
9469
  type: "multi-select",
9495
- options: [],
9496
- placeholder: "Select one or more..."
9470
+ options: []
9497
9471
  };
9498
9472
  const _MultiSelectField = class _MultiSelectField extends BaseSelectField {
9499
9473
  constructor(options) {
9500
- const { placeholder = "Select one or more...", ...rest } = options;
9501
- super({ ...rest, placeholder, type: "multi-select" });
9474
+ super({ ...options, type: "multi-select" });
9502
9475
  }
9503
9476
  getValueFromChangeEvent(event) {
9504
9477
  if (Array.isArray(event))
@@ -10892,6 +10865,11 @@ const FieldBuilder = memo((props) => {
10892
10865
  }
10893
10866
  conditionValue = Array.isArray((_c = initial.condition) == null ? void 0 : _c.value) ? initial.condition.value.map((v) => typeof v === "string" ? v : v.label).join(", ") : (_e = (_d = initial.condition) == null ? void 0 : _d.value) == null ? void 0 : _e.toString();
10894
10867
  }
10868
+ const handleInputChangeForInput = useCallback((event) => {
10869
+ if (event.target.parentNode instanceof HTMLElement) {
10870
+ event.target.parentNode.dataset.replicatedValue = event.target.value;
10871
+ }
10872
+ }, []);
10895
10873
  const handleInputChangeForTextArea = useCallback((event) => {
10896
10874
  if (event.target.parentNode instanceof HTMLElement) {
10897
10875
  event.target.parentNode.dataset.replicatedValue = event.target.value;
@@ -11030,7 +11008,7 @@ const FieldBuilder = memo((props) => {
11030
11008
  {
11031
11009
  name: `${parentPath}.${index2}.label`,
11032
11010
  render: ({ setValue, value }) => /* @__PURE__ */ jsx(
11033
- TextArea,
11011
+ Input,
11034
11012
  {
11035
11013
  className: styles.grow,
11036
11014
  placeholder: `Enter a ${type === "section" ? "section" : "field"} label`,
@@ -11038,12 +11016,11 @@ const FieldBuilder = memo((props) => {
11038
11016
  onChange: (event) => {
11039
11017
  setValue(event.target.value);
11040
11018
  },
11041
- onInput: handleInputChangeForTextArea,
11042
- resize: "none",
11019
+ onInput: handleInputChangeForInput,
11043
11020
  maxLength: 200,
11044
11021
  showInputLength: false,
11045
11022
  variant: "ghost",
11046
- size: "3"
11023
+ size: "large"
11047
11024
  }
11048
11025
  )
11049
11026
  }