@elliemae/ds-utilities 3.0.0-next.51 → 3.0.0-next.52

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/dist/cjs/index.js CHANGED
@@ -43,6 +43,8 @@ __export(src_exports, {
43
43
  findIndex: () => import_utils.findIndex,
44
44
  get: () => import_utils.get,
45
45
  getComponentFromProps: () => import_getComponentFromProps.default,
46
+ getObjectKeysToArray: () => import_objectUtilities.getObjectKeysToArray,
47
+ getObjectValuesToArray: () => import_objectUtilities.getObjectValuesToArray,
46
48
  getVisibleTimeByFormat: () => import_timeUtils.getVisibleTimeByFormat,
47
49
  greaterThan: () => import_operators.greaterThan,
48
50
  greaterThanOrEquals: () => import_operators.greaterThanOrEquals,
@@ -121,6 +123,7 @@ var React = __toESM(require("react"));
121
123
  var import_getComponentFromProps = __toESM(require("./getComponentFromProps"));
122
124
  var import_onClickHandlerForNonInteractiveElements = __toESM(require("./onClickHandlerForNonInteractiveElements"));
123
125
  var import_capitalize = require("./capitalize");
126
+ var import_objectUtilities = require("./objectUtilities");
124
127
  var import_operators = require("./operators");
125
128
  var import_utils = require("./utils");
126
129
  var import_system = require("./system");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["export { default as getComponentFromProps } from './getComponentFromProps';\nexport { default as onClickHandlerForNonInteractiveElements } from './onClickHandlerForNonInteractiveElements';\nexport { capitalize } from './capitalize';\nexport {\n checkNotEmpty,\n checkEmpty,\n greaterThan,\n validDate,\n equal,\n notEqual,\n isNull,\n isNotNull,\n isIn,\n isNotIn,\n greaterThanOrEquals,\n lessThanOrEquals,\n startsWith,\n contains,\n} from './operators';\nexport {\n cx,\n runAll,\n hashArray,\n safeCall,\n removeUndefinedProperties,\n isObject,\n curry,\n arrayMove,\n uniq,\n filter,\n uniqBy,\n groupBy,\n property,\n get,\n set,\n cloneDeep,\n debounce,\n findIndex,\n isEmpty,\n isString,\n isEqual,\n maxBy,\n meanBy,\n noop,\n omit,\n orderBy,\n pull,\n sortBy,\n sumBy,\n transform,\n isFunction,\n range,\n parseInt,\n padStart,\n isNaN,\n values,\n throttle,\n toggleInObject,\n toggleInArray,\n pick,\n pickBy,\n differenceBy,\n differenceWith,\n addOrRemove,\n isEqualWith,\n isBoolean,\n} from './utils';\nexport { setRef, mergeRefs, logger } from './system';\nexport {\n useMeasure,\n useForceUpdate,\n useOnClickOutside,\n useExecutionTimer,\n useExpandState,\n useHotkeys,\n useHoverHandlersDelay,\n useResizeObserver,\n useShouldRecalculate,\n useWindowScrollerList,\n usePrevious,\n useCancellableDelayedCallback,\n useDerivedStateFromProps,\n useOnElementResize,\n useIsShowingEllipsis,\n useCallbackAfterRender,\n useFocusTrap,\n UseFocusTrapWithSchema,\n useIsMobile,\n} from './hooks';\nexport { getVisibleTimeByFormat, addLeadingZeros } from './timeUtils';\nexport { compose } from './compose';\nexport { DOCUMENT, WINDOW } from './platform';\nexport { isDOMTypeElement } from './reactTypesUtility';\nexport { isRequired, isGreaterThan, isValidDate } from './validations';\n\n// TODO -- REMOVE WHEN READY\nexport * from './deprecated';\nexport * from './props-helpers';\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mCAAiD;AACjD,qDAAmE;AACnE,wBAA2B;AAC3B,uBAeO;AACP,mBA+CO;AACP,oBAA0C;AAC1C,mBAoBO;AACP,uBAAwD;AACxD,qBAAwB;AACxB,sBAAiC;AACjC,+BAAiC;AACjC,yBAAuD;AAGvD,wBAAc,yBAhGd;AAiGA,wBAAc,4BAjGd;",
4
+ "sourcesContent": ["export { default as getComponentFromProps } from './getComponentFromProps';\nexport { default as onClickHandlerForNonInteractiveElements } from './onClickHandlerForNonInteractiveElements';\nexport { capitalize } from './capitalize';\nexport { getObjectValuesToArray, getObjectKeysToArray } from './objectUtilities';\nexport {\n checkNotEmpty,\n checkEmpty,\n greaterThan,\n validDate,\n equal,\n notEqual,\n isNull,\n isNotNull,\n isIn,\n isNotIn,\n greaterThanOrEquals,\n lessThanOrEquals,\n startsWith,\n contains,\n} from './operators';\nexport {\n cx,\n runAll,\n hashArray,\n safeCall,\n removeUndefinedProperties,\n isObject,\n curry,\n arrayMove,\n uniq,\n filter,\n uniqBy,\n groupBy,\n property,\n get,\n set,\n cloneDeep,\n debounce,\n findIndex,\n isEmpty,\n isString,\n isEqual,\n maxBy,\n meanBy,\n noop,\n omit,\n orderBy,\n pull,\n sortBy,\n sumBy,\n transform,\n isFunction,\n range,\n parseInt,\n padStart,\n isNaN,\n values,\n throttle,\n toggleInObject,\n toggleInArray,\n pick,\n pickBy,\n differenceBy,\n differenceWith,\n addOrRemove,\n isEqualWith,\n isBoolean,\n} from './utils';\nexport { setRef, mergeRefs, logger } from './system';\nexport {\n useMeasure,\n useForceUpdate,\n useOnClickOutside,\n useExecutionTimer,\n useExpandState,\n useHotkeys,\n useHoverHandlersDelay,\n useResizeObserver,\n useShouldRecalculate,\n useWindowScrollerList,\n usePrevious,\n useCancellableDelayedCallback,\n useDerivedStateFromProps,\n useOnElementResize,\n useIsShowingEllipsis,\n useCallbackAfterRender,\n useFocusTrap,\n UseFocusTrapWithSchema,\n useIsMobile,\n} from './hooks';\nexport { getVisibleTimeByFormat, addLeadingZeros } from './timeUtils';\nexport { compose } from './compose';\nexport { DOCUMENT, WINDOW } from './platform';\nexport { isDOMTypeElement } from './reactTypesUtility';\nexport { isRequired, isGreaterThan, isValidDate } from './validations';\n\n// TODO -- REMOVE WHEN READY\nexport * from './deprecated';\nexport * from './props-helpers';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mCAAiD;AACjD,qDAAmE;AACnE,wBAA2B;AAC3B,6BAA6D;AAC7D,uBAeO;AACP,mBA+CO;AACP,oBAA0C;AAC1C,mBAoBO;AACP,uBAAwD;AACxD,qBAAwB;AACxB,sBAAiC;AACjC,+BAAiC;AACjC,yBAAuD;AAGvD,wBAAc,yBAjGd;AAkGA,wBAAc,4BAlGd;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,30 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var objectUtilities_exports = {};
22
+ __export(objectUtilities_exports, {
23
+ getObjectKeysToArray: () => getObjectKeysToArray,
24
+ getObjectValuesToArray: () => getObjectValuesToArray
25
+ });
26
+ module.exports = __toCommonJS(objectUtilities_exports);
27
+ var React = __toESM(require("react"));
28
+ const getObjectValuesToArray = (object) => JSON.stringify(object).match(/(?<=:").+?(?=")/g);
29
+ const getObjectKeysToArray = (object) => JSON.stringify(object).match(/(?<=")[^:"]+?(?=":)/g);
30
+ //# sourceMappingURL=objectUtilities.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/objectUtilities.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["export const getObjectValuesToArray = (object: Record<string, unknown>): string[] | null =>\n JSON.stringify(object).match(/(?<=:\").+?(?=\")/g);\n\nexport const getObjectKeysToArray = (object: Record<string, unknown>): string[] | null =>\n JSON.stringify(object).match(/(?<=\")[^:\"]+?(?=\":)/g);\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,yBAAyB,CAAC,WACrC,KAAK,UAAU,MAAM,EAAE,MAAM,kBAAkB;AAE1C,MAAM,uBAAuB,CAAC,WACnC,KAAK,UAAU,MAAM,EAAE,MAAM,sBAAsB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,45 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var getGlobalAttributes_exports = {};
22
+ __export(getGlobalAttributes_exports, {
23
+ getGlobalAttributes: () => getGlobalAttributes
24
+ });
25
+ module.exports = __toCommonJS(getGlobalAttributes_exports);
26
+ var React = __toESM(require("react"));
27
+ var import_constants = require("./constants");
28
+ const getGlobalAttributes = (props, overrides) => {
29
+ const globalAttributesObject = {};
30
+ Object.entries(props).forEach(([key, value]) => {
31
+ if (key in import_constants.globalAttributes || key.startsWith("data-")) {
32
+ if (overrides && key in overrides && typeof value === "function" && typeof overrides[key] === "function") {
33
+ const newFunc = (...args) => {
34
+ value(...args);
35
+ overrides[key](...args);
36
+ };
37
+ globalAttributesObject[key] = newFunc;
38
+ } else {
39
+ globalAttributesObject[key] = value;
40
+ }
41
+ }
42
+ });
43
+ return globalAttributesObject;
44
+ };
45
+ //# sourceMappingURL=getGlobalAttributes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/props-helpers/globalProps/getGlobalAttributes.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { AllHTMLAttributes, AriaAttributes, DOMAttributes, HTMLAttributes } from 'react';\nimport { GlobalAttributes, globalAttributes } from './constants';\n\nexport type GlobalAttributesT<T = Element> = AriaAttributes &\n DOMAttributes<T> &\n HTMLAttributes<T> &\n Omit<AllHTMLAttributes<T>, 'as'>;\n\nexport const getGlobalAttributes = <T, S = Element>(\n props: T,\n overrides?: Partial<GlobalAttributes<CallableFunction>>,\n): GlobalAttributesT<S> => {\n const globalAttributesObject: GlobalAttributesT<S> = {};\n Object.entries(props).forEach(([key, value]) => {\n if (key in globalAttributes || key.startsWith('data-')) {\n if (\n overrides &&\n key in overrides &&\n typeof value === 'function' &&\n typeof overrides[key as keyof GlobalAttributes] === 'function'\n ) {\n const newFunc = (...args: unknown[]) => {\n (value as CallableFunction)(...args);\n (overrides[key as keyof GlobalAttributes] as CallableFunction)(...args);\n };\n globalAttributesObject[key as keyof GlobalAttributes] = newFunc as unknown as T[keyof T];\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n globalAttributesObject[key as keyof GlobalAttributes] = value;\n }\n }\n });\n return globalAttributesObject;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,uBAAmD;AAO5C,MAAM,sBAAsB,CACjC,OACA,cACyB;AACzB,QAAM,yBAA+C,CAAC;AACtD,SAAO,QAAQ,KAAK,EAAE,QAAQ,CAAC,CAAC,KAAK,WAAW;AAC9C,QAAI,OAAO,qCAAoB,IAAI,WAAW,OAAO,GAAG;AACtD,UACE,aACA,OAAO,aACP,OAAO,UAAU,cACjB,OAAO,UAAU,SAAmC,YACpD;AACA,cAAM,UAAU,IAAI,SAAoB;AACtC,UAAC,MAA2B,GAAG,IAAI;AACnC,UAAC,UAAU,KAAoD,GAAG,IAAI;AAAA,QACxE;AACA,+BAAuB,OAAiC;AAAA,MAC1D,OAAO;AAEL,+BAAuB,OAAiC;AAAA,MAC1D;AAAA,IACF;AAAA,EACF,CAAC;AACD,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -18,6 +18,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
18
18
  var globalProps_exports = {};
19
19
  module.exports = __toCommonJS(globalProps_exports);
20
20
  var React = __toESM(require("react"));
21
+ __reExport(globalProps_exports, require("./getGlobalAttributes"), module.exports);
21
22
  __reExport(globalProps_exports, require("./useGetGlobalAttributes"), module.exports);
22
23
  __reExport(globalProps_exports, require("./globalAttributesPropTypes"), module.exports);
23
24
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/props-helpers/globalProps/index.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["export * from './useGetGlobalAttributes';\nexport * from './globalAttributesPropTypes';\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,gCAAc,qCAAd;AACA,gCAAc,wCADd;",
4
+ "sourcesContent": ["export * from './getGlobalAttributes';\nexport * from './useGetGlobalAttributes';\nexport * from './globalAttributesPropTypes';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,gCAAc,kCAAd;AACA,gCAAc,qCADd;AAEA,gCAAc,wCAFd;",
6
6
  "names": []
7
7
  }
@@ -25,25 +25,9 @@ __export(useGetGlobalAttributes_exports, {
25
25
  module.exports = __toCommonJS(useGetGlobalAttributes_exports);
26
26
  var React = __toESM(require("react"));
27
27
  var import_react = require("react");
28
- var import_constants = require("./constants");
28
+ var import_getGlobalAttributes = require("./getGlobalAttributes");
29
29
  const useGetGlobalAttributes = (props, overrides) => {
30
- const componentGlobalAttributes = (0, import_react.useMemo)(() => {
31
- const globalAttributesObject = {};
32
- Object.entries(props).forEach(([key, value]) => {
33
- if (key in import_constants.globalAttributes || key.startsWith("data-")) {
34
- if (overrides && key in overrides && typeof value === "function" && typeof overrides[key] === "function") {
35
- const newFunc = (...args) => {
36
- value(...args);
37
- overrides[key](...args);
38
- };
39
- globalAttributesObject[key] = newFunc;
40
- } else {
41
- globalAttributesObject[key] = value;
42
- }
43
- }
44
- });
45
- return globalAttributesObject;
46
- }, [props, overrides]);
30
+ const componentGlobalAttributes = (0, import_react.useMemo)(() => (0, import_getGlobalAttributes.getGlobalAttributes)(props, overrides), [props, overrides]);
47
31
  return componentGlobalAttributes;
48
32
  };
49
33
  //# sourceMappingURL=useGetGlobalAttributes.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/props-helpers/globalProps/useGetGlobalAttributes.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { AllHTMLAttributes, AriaAttributes, DOMAttributes, HTMLAttributes, useMemo } from 'react';\nimport { GlobalAttributes, globalAttributes } from './constants';\n\nexport type GlobalAttributesT<T = Element> = AriaAttributes &\n DOMAttributes<T> &\n HTMLAttributes<T> &\n Omit<AllHTMLAttributes<T>, 'as'>;\n\nexport const useGetGlobalAttributes = <T, S = Element>(\n props: T,\n overrides?: Partial<GlobalAttributes<CallableFunction>>,\n): GlobalAttributesT<S> => {\n const componentGlobalAttributes = useMemo(() => {\n const globalAttributesObject: GlobalAttributesT<S> = {};\n Object.entries(props).forEach(([key, value]) => {\n if (key in globalAttributes || key.startsWith('data-')) {\n if (\n overrides &&\n key in overrides &&\n typeof value === 'function' &&\n typeof overrides[key as keyof GlobalAttributes] === 'function'\n ) {\n const newFunc = (...args: unknown[]) => {\n (value as CallableFunction)(...args);\n (overrides[key as keyof GlobalAttributes] as CallableFunction)(...args);\n };\n globalAttributesObject[key as keyof GlobalAttributes] = newFunc as unknown as T[keyof T];\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n globalAttributesObject[key as keyof GlobalAttributes] = value;\n }\n }\n });\n return globalAttributesObject;\n }, [props, overrides]);\n\n return componentGlobalAttributes;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA0F;AAC1F,uBAAmD;AAO5C,MAAM,yBAAyB,CACpC,OACA,cACyB;AACzB,QAAM,4BAA4B,0BAAQ,MAAM;AAC9C,UAAM,yBAA+C,CAAC;AACtD,WAAO,QAAQ,KAAK,EAAE,QAAQ,CAAC,CAAC,KAAK,WAAW;AAC9C,UAAI,OAAO,qCAAoB,IAAI,WAAW,OAAO,GAAG;AACtD,YACE,aACA,OAAO,aACP,OAAO,UAAU,cACjB,OAAO,UAAU,SAAmC,YACpD;AACA,gBAAM,UAAU,IAAI,SAAoB;AACtC,YAAC,MAA2B,GAAG,IAAI;AACnC,YAAC,UAAU,KAAoD,GAAG,IAAI;AAAA,UACxE;AACA,iCAAuB,OAAiC;AAAA,QAC1D,OAAO;AAEL,iCAAuB,OAAiC;AAAA,QAC1D;AAAA,MACF;AAAA,IACF,CAAC;AACD,WAAO;AAAA,EACT,GAAG,CAAC,OAAO,SAAS,CAAC;AAErB,SAAO;AACT;",
4
+ "sourcesContent": ["import { useMemo } from 'react';\nimport { GlobalAttributes } from './constants';\nimport { getGlobalAttributes } from './getGlobalAttributes';\nimport type { GlobalAttributesT } from './getGlobalAttributes';\n\nexport const useGetGlobalAttributes = <T, S = Element>(\n props: T,\n overrides?: Partial<GlobalAttributes<CallableFunction>>,\n): GlobalAttributesT<S> => {\n const componentGlobalAttributes: GlobalAttributesT<S> = useMemo(\n () => getGlobalAttributes(props, overrides),\n [props, overrides],\n );\n return componentGlobalAttributes;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwB;AAExB,iCAAoC;AAG7B,MAAM,yBAAyB,CACpC,OACA,cACyB;AACzB,QAAM,4BAAkD,0BACtD,MAAM,oDAAoB,OAAO,SAAS,GAC1C,CAAC,OAAO,SAAS,CACnB;AACA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
package/dist/esm/index.js CHANGED
@@ -2,6 +2,7 @@ import * as React from "react";
2
2
  import { default as default2 } from "./getComponentFromProps";
3
3
  import { default as default3 } from "./onClickHandlerForNonInteractiveElements";
4
4
  import { capitalize } from "./capitalize";
5
+ import { getObjectValuesToArray, getObjectKeysToArray } from "./objectUtilities";
5
6
  import {
6
7
  checkNotEmpty,
7
8
  checkEmpty,
@@ -118,6 +119,8 @@ export {
118
119
  findIndex,
119
120
  get,
120
121
  default2 as getComponentFromProps,
122
+ getObjectKeysToArray,
123
+ getObjectValuesToArray,
121
124
  getVisibleTimeByFormat,
122
125
  greaterThan,
123
126
  greaterThanOrEquals,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { default as getComponentFromProps } from './getComponentFromProps';\nexport { default as onClickHandlerForNonInteractiveElements } from './onClickHandlerForNonInteractiveElements';\nexport { capitalize } from './capitalize';\nexport {\n checkNotEmpty,\n checkEmpty,\n greaterThan,\n validDate,\n equal,\n notEqual,\n isNull,\n isNotNull,\n isIn,\n isNotIn,\n greaterThanOrEquals,\n lessThanOrEquals,\n startsWith,\n contains,\n} from './operators';\nexport {\n cx,\n runAll,\n hashArray,\n safeCall,\n removeUndefinedProperties,\n isObject,\n curry,\n arrayMove,\n uniq,\n filter,\n uniqBy,\n groupBy,\n property,\n get,\n set,\n cloneDeep,\n debounce,\n findIndex,\n isEmpty,\n isString,\n isEqual,\n maxBy,\n meanBy,\n noop,\n omit,\n orderBy,\n pull,\n sortBy,\n sumBy,\n transform,\n isFunction,\n range,\n parseInt,\n padStart,\n isNaN,\n values,\n throttle,\n toggleInObject,\n toggleInArray,\n pick,\n pickBy,\n differenceBy,\n differenceWith,\n addOrRemove,\n isEqualWith,\n isBoolean,\n} from './utils';\nexport { setRef, mergeRefs, logger } from './system';\nexport {\n useMeasure,\n useForceUpdate,\n useOnClickOutside,\n useExecutionTimer,\n useExpandState,\n useHotkeys,\n useHoverHandlersDelay,\n useResizeObserver,\n useShouldRecalculate,\n useWindowScrollerList,\n usePrevious,\n useCancellableDelayedCallback,\n useDerivedStateFromProps,\n useOnElementResize,\n useIsShowingEllipsis,\n useCallbackAfterRender,\n useFocusTrap,\n UseFocusTrapWithSchema,\n useIsMobile,\n} from './hooks';\nexport { getVisibleTimeByFormat, addLeadingZeros } from './timeUtils';\nexport { compose } from './compose';\nexport { DOCUMENT, WINDOW } from './platform';\nexport { isDOMTypeElement } from './reactTypesUtility';\nexport { isRequired, isGreaterThan, isValidDate } from './validations';\n\n// TODO -- REMOVE WHEN READY\nexport * from './deprecated';\nexport * from './props-helpers';\n"],
5
- "mappings": "AAAA;ACAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgDA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqBA;AACA;AACA;AACA;AACA;AAGA;AACA;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { default as getComponentFromProps } from './getComponentFromProps';\nexport { default as onClickHandlerForNonInteractiveElements } from './onClickHandlerForNonInteractiveElements';\nexport { capitalize } from './capitalize';\nexport { getObjectValuesToArray, getObjectKeysToArray } from './objectUtilities';\nexport {\n checkNotEmpty,\n checkEmpty,\n greaterThan,\n validDate,\n equal,\n notEqual,\n isNull,\n isNotNull,\n isIn,\n isNotIn,\n greaterThanOrEquals,\n lessThanOrEquals,\n startsWith,\n contains,\n} from './operators';\nexport {\n cx,\n runAll,\n hashArray,\n safeCall,\n removeUndefinedProperties,\n isObject,\n curry,\n arrayMove,\n uniq,\n filter,\n uniqBy,\n groupBy,\n property,\n get,\n set,\n cloneDeep,\n debounce,\n findIndex,\n isEmpty,\n isString,\n isEqual,\n maxBy,\n meanBy,\n noop,\n omit,\n orderBy,\n pull,\n sortBy,\n sumBy,\n transform,\n isFunction,\n range,\n parseInt,\n padStart,\n isNaN,\n values,\n throttle,\n toggleInObject,\n toggleInArray,\n pick,\n pickBy,\n differenceBy,\n differenceWith,\n addOrRemove,\n isEqualWith,\n isBoolean,\n} from './utils';\nexport { setRef, mergeRefs, logger } from './system';\nexport {\n useMeasure,\n useForceUpdate,\n useOnClickOutside,\n useExecutionTimer,\n useExpandState,\n useHotkeys,\n useHoverHandlersDelay,\n useResizeObserver,\n useShouldRecalculate,\n useWindowScrollerList,\n usePrevious,\n useCancellableDelayedCallback,\n useDerivedStateFromProps,\n useOnElementResize,\n useIsShowingEllipsis,\n useCallbackAfterRender,\n useFocusTrap,\n UseFocusTrapWithSchema,\n useIsMobile,\n} from './hooks';\nexport { getVisibleTimeByFormat, addLeadingZeros } from './timeUtils';\nexport { compose } from './compose';\nexport { DOCUMENT, WINDOW } from './platform';\nexport { isDOMTypeElement } from './reactTypesUtility';\nexport { isRequired, isGreaterThan, isValidDate } from './validations';\n\n// TODO -- REMOVE WHEN READY\nexport * from './deprecated';\nexport * from './props-helpers';\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgDA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqBA;AACA;AACA;AACA;AACA;AAGA;AACA;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ const getObjectValuesToArray = (object) => JSON.stringify(object).match(/(?<=:").+?(?=")/g);
3
+ const getObjectKeysToArray = (object) => JSON.stringify(object).match(/(?<=")[^:"]+?(?=":)/g);
4
+ export {
5
+ getObjectKeysToArray,
6
+ getObjectValuesToArray
7
+ };
8
+ //# sourceMappingURL=objectUtilities.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/objectUtilities.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const getObjectValuesToArray = (object: Record<string, unknown>): string[] | null =>\n JSON.stringify(object).match(/(?<=:\").+?(?=\")/g);\n\nexport const getObjectKeysToArray = (object: Record<string, unknown>): string[] | null =>\n JSON.stringify(object).match(/(?<=\")[^:\"]+?(?=\":)/g);\n"],
5
+ "mappings": "AAAA;ACAO,MAAM,yBAAyB,CAAC,WACrC,KAAK,UAAU,MAAM,EAAE,MAAM,kBAAkB;AAE1C,MAAM,uBAAuB,CAAC,WACnC,KAAK,UAAU,MAAM,EAAE,MAAM,sBAAsB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,23 @@
1
+ import * as React from "react";
2
+ import { globalAttributes } from "./constants";
3
+ const getGlobalAttributes = (props, overrides) => {
4
+ const globalAttributesObject = {};
5
+ Object.entries(props).forEach(([key, value]) => {
6
+ if (key in globalAttributes || key.startsWith("data-")) {
7
+ if (overrides && key in overrides && typeof value === "function" && typeof overrides[key] === "function") {
8
+ const newFunc = (...args) => {
9
+ value(...args);
10
+ overrides[key](...args);
11
+ };
12
+ globalAttributesObject[key] = newFunc;
13
+ } else {
14
+ globalAttributesObject[key] = value;
15
+ }
16
+ }
17
+ });
18
+ return globalAttributesObject;
19
+ };
20
+ export {
21
+ getGlobalAttributes
22
+ };
23
+ //# sourceMappingURL=getGlobalAttributes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/props-helpers/globalProps/getGlobalAttributes.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { AllHTMLAttributes, AriaAttributes, DOMAttributes, HTMLAttributes } from 'react';\nimport { GlobalAttributes, globalAttributes } from './constants';\n\nexport type GlobalAttributesT<T = Element> = AriaAttributes &\n DOMAttributes<T> &\n HTMLAttributes<T> &\n Omit<AllHTMLAttributes<T>, 'as'>;\n\nexport const getGlobalAttributes = <T, S = Element>(\n props: T,\n overrides?: Partial<GlobalAttributes<CallableFunction>>,\n): GlobalAttributesT<S> => {\n const globalAttributesObject: GlobalAttributesT<S> = {};\n Object.entries(props).forEach(([key, value]) => {\n if (key in globalAttributes || key.startsWith('data-')) {\n if (\n overrides &&\n key in overrides &&\n typeof value === 'function' &&\n typeof overrides[key as keyof GlobalAttributes] === 'function'\n ) {\n const newFunc = (...args: unknown[]) => {\n (value as CallableFunction)(...args);\n (overrides[key as keyof GlobalAttributes] as CallableFunction)(...args);\n };\n globalAttributesObject[key as keyof GlobalAttributes] = newFunc as unknown as T[keyof T];\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n globalAttributesObject[key as keyof GlobalAttributes] = value;\n }\n }\n });\n return globalAttributesObject;\n};\n"],
5
+ "mappings": "AAAA;ACCA;AAOO,MAAM,sBAAsB,CACjC,OACA,cACyB;AACzB,QAAM,yBAA+C,CAAC;AACtD,SAAO,QAAQ,KAAK,EAAE,QAAQ,CAAC,CAAC,KAAK,WAAW;AAC9C,QAAI,OAAO,oBAAoB,IAAI,WAAW,OAAO,GAAG;AACtD,UACE,aACA,OAAO,aACP,OAAO,UAAU,cACjB,OAAO,UAAU,SAAmC,YACpD;AACA,cAAM,UAAU,IAAI,SAAoB;AACtC,UAAC,MAA2B,GAAG,IAAI;AACnC,UAAC,UAAU,KAAoD,GAAG,IAAI;AAAA,QACxE;AACA,+BAAuB,OAAiC;AAAA,MAC1D,OAAO;AAEL,+BAAuB,OAAiC;AAAA,MAC1D;AAAA,IACF;AAAA,EACF,CAAC;AACD,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -1,4 +1,5 @@
1
1
  import * as React from "react";
2
+ export * from "./getGlobalAttributes";
2
3
  export * from "./useGetGlobalAttributes";
3
4
  export * from "./globalAttributesPropTypes";
4
5
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/props-helpers/globalProps/index.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './useGetGlobalAttributes';\nexport * from './globalAttributesPropTypes';\n"],
5
- "mappings": "AAAA;ACAA;AACA;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './getGlobalAttributes';\nexport * from './useGetGlobalAttributes';\nexport * from './globalAttributesPropTypes';\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;",
6
6
  "names": []
7
7
  }
@@ -1,24 +1,8 @@
1
1
  import * as React from "react";
2
2
  import { useMemo } from "react";
3
- import { globalAttributes } from "./constants";
3
+ import { getGlobalAttributes } from "./getGlobalAttributes";
4
4
  const useGetGlobalAttributes = (props, overrides) => {
5
- const componentGlobalAttributes = useMemo(() => {
6
- const globalAttributesObject = {};
7
- Object.entries(props).forEach(([key, value]) => {
8
- if (key in globalAttributes || key.startsWith("data-")) {
9
- if (overrides && key in overrides && typeof value === "function" && typeof overrides[key] === "function") {
10
- const newFunc = (...args) => {
11
- value(...args);
12
- overrides[key](...args);
13
- };
14
- globalAttributesObject[key] = newFunc;
15
- } else {
16
- globalAttributesObject[key] = value;
17
- }
18
- }
19
- });
20
- return globalAttributesObject;
21
- }, [props, overrides]);
5
+ const componentGlobalAttributes = useMemo(() => getGlobalAttributes(props, overrides), [props, overrides]);
22
6
  return componentGlobalAttributes;
23
7
  };
24
8
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/props-helpers/globalProps/useGetGlobalAttributes.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { AllHTMLAttributes, AriaAttributes, DOMAttributes, HTMLAttributes, useMemo } from 'react';\nimport { GlobalAttributes, globalAttributes } from './constants';\n\nexport type GlobalAttributesT<T = Element> = AriaAttributes &\n DOMAttributes<T> &\n HTMLAttributes<T> &\n Omit<AllHTMLAttributes<T>, 'as'>;\n\nexport const useGetGlobalAttributes = <T, S = Element>(\n props: T,\n overrides?: Partial<GlobalAttributes<CallableFunction>>,\n): GlobalAttributesT<S> => {\n const componentGlobalAttributes = useMemo(() => {\n const globalAttributesObject: GlobalAttributesT<S> = {};\n Object.entries(props).forEach(([key, value]) => {\n if (key in globalAttributes || key.startsWith('data-')) {\n if (\n overrides &&\n key in overrides &&\n typeof value === 'function' &&\n typeof overrides[key as keyof GlobalAttributes] === 'function'\n ) {\n const newFunc = (...args: unknown[]) => {\n (value as CallableFunction)(...args);\n (overrides[key as keyof GlobalAttributes] as CallableFunction)(...args);\n };\n globalAttributesObject[key as keyof GlobalAttributes] = newFunc as unknown as T[keyof T];\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n globalAttributesObject[key as keyof GlobalAttributes] = value;\n }\n }\n });\n return globalAttributesObject;\n }, [props, overrides]);\n\n return componentGlobalAttributes;\n};\n"],
5
- "mappings": "AAAA;ACAA;AACA;AAOO,MAAM,yBAAyB,CACpC,OACA,cACyB;AACzB,QAAM,4BAA4B,QAAQ,MAAM;AAC9C,UAAM,yBAA+C,CAAC;AACtD,WAAO,QAAQ,KAAK,EAAE,QAAQ,CAAC,CAAC,KAAK,WAAW;AAC9C,UAAI,OAAO,oBAAoB,IAAI,WAAW,OAAO,GAAG;AACtD,YACE,aACA,OAAO,aACP,OAAO,UAAU,cACjB,OAAO,UAAU,SAAmC,YACpD;AACA,gBAAM,UAAU,IAAI,SAAoB;AACtC,YAAC,MAA2B,GAAG,IAAI;AACnC,YAAC,UAAU,KAAoD,GAAG,IAAI;AAAA,UACxE;AACA,iCAAuB,OAAiC;AAAA,QAC1D,OAAO;AAEL,iCAAuB,OAAiC;AAAA,QAC1D;AAAA,MACF;AAAA,IACF,CAAC;AACD,WAAO;AAAA,EACT,GAAG,CAAC,OAAO,SAAS,CAAC;AAErB,SAAO;AACT;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo } from 'react';\nimport { GlobalAttributes } from './constants';\nimport { getGlobalAttributes } from './getGlobalAttributes';\nimport type { GlobalAttributesT } from './getGlobalAttributes';\n\nexport const useGetGlobalAttributes = <T, S = Element>(\n props: T,\n overrides?: Partial<GlobalAttributes<CallableFunction>>,\n): GlobalAttributesT<S> => {\n const componentGlobalAttributes: GlobalAttributesT<S> = useMemo(\n () => getGlobalAttributes(props, overrides),\n [props, overrides],\n );\n return componentGlobalAttributes;\n};\n"],
5
+ "mappings": "AAAA;ACAA;AAEA;AAGO,MAAM,yBAAyB,CACpC,OACA,cACyB;AACzB,QAAM,4BAAkD,QACtD,MAAM,oBAAoB,OAAO,SAAS,GAC1C,CAAC,OAAO,SAAS,CACnB;AACA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-utilities",
3
- "version": "3.0.0-next.51",
3
+ "version": "3.0.0-next.52",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Utilities",
6
6
  "files": [