@elliemae/ds-controlled-form 3.0.0-alpha.2 → 3.0.0-alpha.3

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.
@@ -31,7 +31,7 @@ __export(useCorrectOptions_exports, {
31
31
  });
32
32
  var React = __toESM(require("react"));
33
33
  var import_react = require("react");
34
- var import_uuid = require("uuid");
34
+ var import_uid = require("uid");
35
35
  var import_lodash = require("lodash");
36
36
  const useCorrectOptions = (propsWithDefaults, showSelectedOptions) => {
37
37
  const { options, selectedValues, onCreate, innerRef } = propsWithDefaults;
@@ -61,7 +61,7 @@ const useCorrectOptions = (propsWithDefaults, showSelectedOptions) => {
61
61
  return selectedValuesWithSections();
62
62
  }
63
63
  if (onCreate !== import_lodash.noop && innerRef.current && innerRef.current.value !== "" && options.findIndex((option) => option.type === "option" && option.label === innerRef?.current?.value) === -1) {
64
- const creatableUuid = (0, import_uuid.v4)();
64
+ const creatableUuid = (0, import_uid.uid)(6);
65
65
  const creatableItem = {
66
66
  dsId: `creatable-${creatableUuid}`,
67
67
  label: innerRef.current?.value,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/controlled-combobox/config/useCorrectOptions.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { useMemo, useCallback } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport { noop } from 'lodash';\nimport { DSComboboxT } from '../react-desc-prop-types';\n\nconst useCorrectOptions = (propsWithDefaults: DSComboboxT.Props, showSelectedOptions: boolean) => {\n const { options, selectedValues, onCreate, innerRef } = propsWithDefaults;\n\n const selectedValuesWithSections = useCallback(() => {\n const multiSelectedValue = selectedValues as DSComboboxT.OptionTypes[];\n const items = [] as DSComboboxT.OptionTypes[];\n\n options.forEach((option) => {\n const isSelectedValue = multiSelectedValue.find((item) => item.dsId === option.dsId);\n if (isSelectedValue) {\n items.push(option);\n }\n\n if (option.type === 'section') {\n if (items[items.length - 1]?.type === 'section') {\n items[items.length - 1] = option;\n } else {\n items.push(option);\n }\n }\n });\n if (items[items.length - 1]?.type === 'section') {\n items.pop();\n }\n\n return items;\n }, [options, selectedValues]);\n\n const correctOptions = useMemo(() => {\n if (showSelectedOptions && Array.isArray(selectedValues) && selectedValues.length > 0) {\n return selectedValuesWithSections();\n }\n if (\n onCreate !== noop &&\n innerRef.current &&\n innerRef.current.value !== '' &&\n options.findIndex((option) => option.type === 'option' && option.label === innerRef?.current?.value) === -1\n ) {\n const creatableUuid = uuidv4();\n const creatableItem: DSComboboxT.ItemCreatableOption = {\n dsId: `creatable-${creatableUuid}`,\n label: innerRef.current?.value,\n type: 'creatable',\n };\n return [creatableItem, ...options];\n }\n return options;\n }, [options, onCreate, innerRef, selectedValuesWithSections, selectedValues, showSelectedOptions]);\n\n return correctOptions;\n};\n\nexport { useCorrectOptions };\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAqC;AACrC,kBAA6B;AAC7B,oBAAqB;AAGrB,MAAM,oBAAoB,CAAC,mBAAsC,wBAAiC;AAChG,QAAM,EAAE,SAAS,gBAAgB,UAAU,aAAa;AAExD,QAAM,6BAA6B,8BAAY,MAAM;AACnD,UAAM,qBAAqB;AAC3B,UAAM,QAAQ;AAEd,YAAQ,QAAQ,CAAC,WAAW;AAC1B,YAAM,kBAAkB,mBAAmB,KAAK,CAAC,SAAS,KAAK,SAAS,OAAO;AAC/E,UAAI,iBAAiB;AACnB,cAAM,KAAK;AAAA;AAGb,UAAI,OAAO,SAAS,WAAW;AAC7B,YAAI,MAAM,MAAM,SAAS,IAAI,SAAS,WAAW;AAC/C,gBAAM,MAAM,SAAS,KAAK;AAAA,eACrB;AACL,gBAAM,KAAK;AAAA;AAAA;AAAA;AAIjB,QAAI,MAAM,MAAM,SAAS,IAAI,SAAS,WAAW;AAC/C,YAAM;AAAA;AAGR,WAAO;AAAA,KACN,CAAC,SAAS;AAEb,QAAM,iBAAiB,0BAAQ,MAAM;AACnC,QAAI,uBAAuB,MAAM,QAAQ,mBAAmB,eAAe,SAAS,GAAG;AACrF,aAAO;AAAA;AAET,QACE,aAAa,sBACb,SAAS,WACT,SAAS,QAAQ,UAAU,MAC3B,QAAQ,UAAU,CAAC,WAAW,OAAO,SAAS,YAAY,OAAO,UAAU,UAAU,SAAS,WAAW,IACzG;AACA,YAAM,gBAAgB;AACtB,YAAM,gBAAiD;AAAA,QACrD,MAAM,aAAa;AAAA,QACnB,OAAO,SAAS,SAAS;AAAA,QACzB,MAAM;AAAA;AAER,aAAO,CAAC,eAAe,GAAG;AAAA;AAE5B,WAAO;AAAA,KACN,CAAC,SAAS,UAAU,UAAU,4BAA4B,gBAAgB;AAE7E,SAAO;AAAA;",
4
+ "sourcesContent": ["import { useMemo, useCallback } from 'react';\nimport { uid } from 'uid';\nimport { noop } from 'lodash';\nimport { DSComboboxT } from '../react-desc-prop-types';\n\nconst useCorrectOptions = (propsWithDefaults: DSComboboxT.Props, showSelectedOptions: boolean) => {\n const { options, selectedValues, onCreate, innerRef } = propsWithDefaults;\n\n const selectedValuesWithSections = useCallback(() => {\n const multiSelectedValue = selectedValues as DSComboboxT.OptionTypes[];\n const items = [] as DSComboboxT.OptionTypes[];\n\n options.forEach((option) => {\n const isSelectedValue = multiSelectedValue.find((item) => item.dsId === option.dsId);\n if (isSelectedValue) {\n items.push(option);\n }\n\n if (option.type === 'section') {\n if (items[items.length - 1]?.type === 'section') {\n items[items.length - 1] = option;\n } else {\n items.push(option);\n }\n }\n });\n if (items[items.length - 1]?.type === 'section') {\n items.pop();\n }\n\n return items;\n }, [options, selectedValues]);\n\n const correctOptions = useMemo(() => {\n if (showSelectedOptions && Array.isArray(selectedValues) && selectedValues.length > 0) {\n return selectedValuesWithSections();\n }\n if (\n onCreate !== noop &&\n innerRef.current &&\n innerRef.current.value !== '' &&\n options.findIndex((option) => option.type === 'option' && option.label === innerRef?.current?.value) === -1\n ) {\n const creatableUuid = uid(6);\n const creatableItem: DSComboboxT.ItemCreatableOption = {\n dsId: `creatable-${creatableUuid}`,\n label: innerRef.current?.value,\n type: 'creatable',\n };\n return [creatableItem, ...options];\n }\n return options;\n }, [options, onCreate, innerRef, selectedValuesWithSections, selectedValues, showSelectedOptions]);\n\n return correctOptions;\n};\n\nexport { useCorrectOptions };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAqC;AACrC,iBAAoB;AACpB,oBAAqB;AAGrB,MAAM,oBAAoB,CAAC,mBAAsC,wBAAiC;AAChG,QAAM,EAAE,SAAS,gBAAgB,UAAU,aAAa;AAExD,QAAM,6BAA6B,8BAAY,MAAM;AACnD,UAAM,qBAAqB;AAC3B,UAAM,QAAQ;AAEd,YAAQ,QAAQ,CAAC,WAAW;AAC1B,YAAM,kBAAkB,mBAAmB,KAAK,CAAC,SAAS,KAAK,SAAS,OAAO;AAC/E,UAAI,iBAAiB;AACnB,cAAM,KAAK;AAAA;AAGb,UAAI,OAAO,SAAS,WAAW;AAC7B,YAAI,MAAM,MAAM,SAAS,IAAI,SAAS,WAAW;AAC/C,gBAAM,MAAM,SAAS,KAAK;AAAA,eACrB;AACL,gBAAM,KAAK;AAAA;AAAA;AAAA;AAIjB,QAAI,MAAM,MAAM,SAAS,IAAI,SAAS,WAAW;AAC/C,YAAM;AAAA;AAGR,WAAO;AAAA,KACN,CAAC,SAAS;AAEb,QAAM,iBAAiB,0BAAQ,MAAM;AACnC,QAAI,uBAAuB,MAAM,QAAQ,mBAAmB,eAAe,SAAS,GAAG;AACrF,aAAO;AAAA;AAET,QACE,aAAa,sBACb,SAAS,WACT,SAAS,QAAQ,UAAU,MAC3B,QAAQ,UAAU,CAAC,WAAW,OAAO,SAAS,YAAY,OAAO,UAAU,UAAU,SAAS,WAAW,IACzG;AACA,YAAM,gBAAgB,oBAAI;AAC1B,YAAM,gBAAiD;AAAA,QACrD,MAAM,aAAa;AAAA,QACnB,OAAO,SAAS,SAAS;AAAA,QACzB,MAAM;AAAA;AAER,aAAO,CAAC,eAAe,GAAG;AAAA;AAE5B,WAAO;AAAA,KACN,CAAC,SAAS,UAAU,UAAU,4BAA4B,gBAAgB;AAE7E,SAAO;AAAA;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { useMemo, useCallback } from "react";
3
- import { v4 as uuidv4 } from "uuid";
3
+ import { uid } from "uid";
4
4
  import { noop } from "lodash";
5
5
  const useCorrectOptions = (propsWithDefaults, showSelectedOptions) => {
6
6
  const { options, selectedValues, onCreate, innerRef } = propsWithDefaults;
@@ -30,7 +30,7 @@ const useCorrectOptions = (propsWithDefaults, showSelectedOptions) => {
30
30
  return selectedValuesWithSections();
31
31
  }
32
32
  if (onCreate !== noop && innerRef.current && innerRef.current.value !== "" && options.findIndex((option) => option.type === "option" && option.label === innerRef?.current?.value) === -1) {
33
- const creatableUuid = uuidv4();
33
+ const creatableUuid = uid(6);
34
34
  const creatableItem = {
35
35
  dsId: `creatable-${creatableUuid}`,
36
36
  label: innerRef.current?.value,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/controlled-combobox/config/useCorrectOptions.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo, useCallback } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport { noop } from 'lodash';\nimport { DSComboboxT } from '../react-desc-prop-types';\n\nconst useCorrectOptions = (propsWithDefaults: DSComboboxT.Props, showSelectedOptions: boolean) => {\n const { options, selectedValues, onCreate, innerRef } = propsWithDefaults;\n\n const selectedValuesWithSections = useCallback(() => {\n const multiSelectedValue = selectedValues as DSComboboxT.OptionTypes[];\n const items = [] as DSComboboxT.OptionTypes[];\n\n options.forEach((option) => {\n const isSelectedValue = multiSelectedValue.find((item) => item.dsId === option.dsId);\n if (isSelectedValue) {\n items.push(option);\n }\n\n if (option.type === 'section') {\n if (items[items.length - 1]?.type === 'section') {\n items[items.length - 1] = option;\n } else {\n items.push(option);\n }\n }\n });\n if (items[items.length - 1]?.type === 'section') {\n items.pop();\n }\n\n return items;\n }, [options, selectedValues]);\n\n const correctOptions = useMemo(() => {\n if (showSelectedOptions && Array.isArray(selectedValues) && selectedValues.length > 0) {\n return selectedValuesWithSections();\n }\n if (\n onCreate !== noop &&\n innerRef.current &&\n innerRef.current.value !== '' &&\n options.findIndex((option) => option.type === 'option' && option.label === innerRef?.current?.value) === -1\n ) {\n const creatableUuid = uuidv4();\n const creatableItem: DSComboboxT.ItemCreatableOption = {\n dsId: `creatable-${creatableUuid}`,\n label: innerRef.current?.value,\n type: 'creatable',\n };\n return [creatableItem, ...options];\n }\n return options;\n }, [options, onCreate, innerRef, selectedValuesWithSections, selectedValues, showSelectedOptions]);\n\n return correctOptions;\n};\n\nexport { useCorrectOptions };\n"],
5
- "mappings": "AAAA;ACAA;AACA;AACA;AAGA,MAAM,oBAAoB,CAAC,mBAAsC,wBAAiC;AAChG,QAAM,EAAE,SAAS,gBAAgB,UAAU,aAAa;AAExD,QAAM,6BAA6B,YAAY,MAAM;AACnD,UAAM,qBAAqB;AAC3B,UAAM,QAAQ;AAEd,YAAQ,QAAQ,CAAC,WAAW;AAC1B,YAAM,kBAAkB,mBAAmB,KAAK,CAAC,SAAS,KAAK,SAAS,OAAO;AAC/E,UAAI,iBAAiB;AACnB,cAAM,KAAK;AAAA;AAGb,UAAI,OAAO,SAAS,WAAW;AAC7B,YAAI,MAAM,MAAM,SAAS,IAAI,SAAS,WAAW;AAC/C,gBAAM,MAAM,SAAS,KAAK;AAAA,eACrB;AACL,gBAAM,KAAK;AAAA;AAAA;AAAA;AAIjB,QAAI,MAAM,MAAM,SAAS,IAAI,SAAS,WAAW;AAC/C,YAAM;AAAA;AAGR,WAAO;AAAA,KACN,CAAC,SAAS;AAEb,QAAM,iBAAiB,QAAQ,MAAM;AACnC,QAAI,uBAAuB,MAAM,QAAQ,mBAAmB,eAAe,SAAS,GAAG;AACrF,aAAO;AAAA;AAET,QACE,aAAa,QACb,SAAS,WACT,SAAS,QAAQ,UAAU,MAC3B,QAAQ,UAAU,CAAC,WAAW,OAAO,SAAS,YAAY,OAAO,UAAU,UAAU,SAAS,WAAW,IACzG;AACA,YAAM,gBAAgB;AACtB,YAAM,gBAAiD;AAAA,QACrD,MAAM,aAAa;AAAA,QACnB,OAAO,SAAS,SAAS;AAAA,QACzB,MAAM;AAAA;AAER,aAAO,CAAC,eAAe,GAAG;AAAA;AAE5B,WAAO;AAAA,KACN,CAAC,SAAS,UAAU,UAAU,4BAA4B,gBAAgB;AAE7E,SAAO;AAAA;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo, useCallback } from 'react';\nimport { uid } from 'uid';\nimport { noop } from 'lodash';\nimport { DSComboboxT } from '../react-desc-prop-types';\n\nconst useCorrectOptions = (propsWithDefaults: DSComboboxT.Props, showSelectedOptions: boolean) => {\n const { options, selectedValues, onCreate, innerRef } = propsWithDefaults;\n\n const selectedValuesWithSections = useCallback(() => {\n const multiSelectedValue = selectedValues as DSComboboxT.OptionTypes[];\n const items = [] as DSComboboxT.OptionTypes[];\n\n options.forEach((option) => {\n const isSelectedValue = multiSelectedValue.find((item) => item.dsId === option.dsId);\n if (isSelectedValue) {\n items.push(option);\n }\n\n if (option.type === 'section') {\n if (items[items.length - 1]?.type === 'section') {\n items[items.length - 1] = option;\n } else {\n items.push(option);\n }\n }\n });\n if (items[items.length - 1]?.type === 'section') {\n items.pop();\n }\n\n return items;\n }, [options, selectedValues]);\n\n const correctOptions = useMemo(() => {\n if (showSelectedOptions && Array.isArray(selectedValues) && selectedValues.length > 0) {\n return selectedValuesWithSections();\n }\n if (\n onCreate !== noop &&\n innerRef.current &&\n innerRef.current.value !== '' &&\n options.findIndex((option) => option.type === 'option' && option.label === innerRef?.current?.value) === -1\n ) {\n const creatableUuid = uid(6);\n const creatableItem: DSComboboxT.ItemCreatableOption = {\n dsId: `creatable-${creatableUuid}`,\n label: innerRef.current?.value,\n type: 'creatable',\n };\n return [creatableItem, ...options];\n }\n return options;\n }, [options, onCreate, innerRef, selectedValuesWithSections, selectedValues, showSelectedOptions]);\n\n return correctOptions;\n};\n\nexport { useCorrectOptions };\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AAGA,MAAM,oBAAoB,CAAC,mBAAsC,wBAAiC;AAChG,QAAM,EAAE,SAAS,gBAAgB,UAAU,aAAa;AAExD,QAAM,6BAA6B,YAAY,MAAM;AACnD,UAAM,qBAAqB;AAC3B,UAAM,QAAQ;AAEd,YAAQ,QAAQ,CAAC,WAAW;AAC1B,YAAM,kBAAkB,mBAAmB,KAAK,CAAC,SAAS,KAAK,SAAS,OAAO;AAC/E,UAAI,iBAAiB;AACnB,cAAM,KAAK;AAAA;AAGb,UAAI,OAAO,SAAS,WAAW;AAC7B,YAAI,MAAM,MAAM,SAAS,IAAI,SAAS,WAAW;AAC/C,gBAAM,MAAM,SAAS,KAAK;AAAA,eACrB;AACL,gBAAM,KAAK;AAAA;AAAA;AAAA;AAIjB,QAAI,MAAM,MAAM,SAAS,IAAI,SAAS,WAAW;AAC/C,YAAM;AAAA;AAGR,WAAO;AAAA,KACN,CAAC,SAAS;AAEb,QAAM,iBAAiB,QAAQ,MAAM;AACnC,QAAI,uBAAuB,MAAM,QAAQ,mBAAmB,eAAe,SAAS,GAAG;AACrF,aAAO;AAAA;AAET,QACE,aAAa,QACb,SAAS,WACT,SAAS,QAAQ,UAAU,MAC3B,QAAQ,UAAU,CAAC,WAAW,OAAO,SAAS,YAAY,OAAO,UAAU,UAAU,SAAS,WAAW,IACzG;AACA,YAAM,gBAAgB,IAAI;AAC1B,YAAM,gBAAiD;AAAA,QACrD,MAAM,aAAa;AAAA,QACnB,OAAO,SAAS,SAAS;AAAA,QACzB,MAAM;AAAA;AAER,aAAO,CAAC,eAAe,GAAG;AAAA;AAE5B,WAAO;AAAA,KACN,CAAC,SAAS,UAAU,UAAU,4BAA4B,gBAAgB;AAE7E,SAAO;AAAA;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-controlled-form",
3
- "version": "3.0.0-alpha.2",
3
+ "version": "3.0.0-alpha.3",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Controlled Form Controllers",
6
6
  "files": [
@@ -59,19 +59,19 @@
59
59
  "indent": 4
60
60
  },
61
61
  "dependencies": {
62
- "@elliemae/ds-button": "3.0.0-alpha.2",
63
- "@elliemae/ds-circular-progress-indicator": "3.0.0-alpha.2",
64
- "@elliemae/ds-common": "3.0.0-alpha.2",
65
- "@elliemae/ds-form": "3.0.0-alpha.2",
66
- "@elliemae/ds-form-layout-blocks": "3.0.0-alpha.2",
67
- "@elliemae/ds-grid": "3.0.0-alpha.2",
68
- "@elliemae/ds-icons": "3.0.0-alpha.2",
69
- "@elliemae/ds-pills": "3.0.0-alpha.2",
70
- "@elliemae/ds-popperjs": "3.0.0-alpha.2",
71
- "@elliemae/ds-props-helpers": "3.0.0-alpha.2",
72
- "@elliemae/ds-system": "3.0.0-alpha.2",
73
- "@elliemae/ds-tooltip": "3.0.0-alpha.2",
74
- "@elliemae/ds-truncated-tooltip-text": "3.0.0-alpha.2",
62
+ "@elliemae/ds-button": "3.0.0-alpha.3",
63
+ "@elliemae/ds-circular-progress-indicator": "3.0.0-alpha.3",
64
+ "@elliemae/ds-common": "3.0.0-alpha.3",
65
+ "@elliemae/ds-form": "3.0.0-alpha.3",
66
+ "@elliemae/ds-form-layout-blocks": "3.0.0-alpha.3",
67
+ "@elliemae/ds-grid": "3.0.0-alpha.3",
68
+ "@elliemae/ds-icons": "3.0.0-alpha.3",
69
+ "@elliemae/ds-pills": "3.0.0-alpha.3",
70
+ "@elliemae/ds-popperjs": "3.0.0-alpha.3",
71
+ "@elliemae/ds-props-helpers": "3.0.0-alpha.3",
72
+ "@elliemae/ds-system": "3.0.0-alpha.3",
73
+ "@elliemae/ds-tooltip": "3.0.0-alpha.3",
74
+ "@elliemae/ds-truncated-tooltip-text": "3.0.0-alpha.3",
75
75
  "prop-types": "~15.8.1",
76
76
  "react-desc": "~4.1.3",
77
77
  "react-popper": "~2.2.5",