@elliemae/ds-props-helpers 3.70.0-next.61 → 3.70.0-next.63

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.
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var getContractProps_exports = {};
30
+ __export(getContractProps_exports, {
31
+ getContractProps: () => getContractProps
32
+ });
33
+ module.exports = __toCommonJS(getContractProps_exports);
34
+ var React = __toESM(require("react"));
35
+ const DOCUMENTATION_ONLY_SCHEMA_KEYS = /* @__PURE__ */ new Set(["aria-*", "on-*", "data-*", "all HTML attributes"]);
36
+ const getContractProps = (props, contractShape) => {
37
+ const declaredKeys = new Set(Object.keys(contractShape).filter((key) => !DOCUMENTATION_ONLY_SCHEMA_KEYS.has(key)));
38
+ const contractProps = {};
39
+ Object.entries(props).forEach(([key, value]) => {
40
+ if (value === void 0) return;
41
+ if (DOCUMENTATION_ONLY_SCHEMA_KEYS.has(key)) return;
42
+ if (!declaredKeys.has(key) && !key.startsWith("data-")) return;
43
+ contractProps[key] = value;
44
+ });
45
+ return contractProps;
46
+ };
47
+ //# sourceMappingURL=getContractProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/contractProps/getContractProps.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/**\n * Documentation-only entries that live in `globalAttributesPropTypes` (and therefore in every\n * component schema that spreads it). They exist so the Storybook props table can show \"you may pass\n * any aria-* / data-* / on-* / HTML attribute\" in a single row \u2014 they are NOT prop names a consumer\n * can ever pass, so they must never be treated as part of the runtime key set.\n */\nconst DOCUMENTATION_ONLY_SCHEMA_KEYS = new Set(['aria-*', 'on-*', 'data-*', 'all HTML attributes']);\n\n/**\n * Filters an arbitrary object down to the props a component's contract declares.\n *\n * This is the engine behind each package's own curated passthrough utility (e.g. ds-app-picker's\n * `getDSAppPickerContractProps`). Packages are expected to expose a bound utility rather than their\n * schema: the schema stays an internal implementation detail, so the two can drift later without\n * expanding anyone's public API.\n *\n * Three behaviours worth knowing, because callers depend on them:\n *\n * 1. **Documentation-only wildcard keys are ignored.** See `DOCUMENTATION_ONLY_SCHEMA_KEYS`.\n * 2. **`data-*` is honoured by prefix**, matching `getGlobalAttributes` \u2014 arbitrary data attributes\n * are a supported consumer surface even though no schema can enumerate them. Note the house\n * behaviour deliberately does not extend the same courtesy to `aria-*` or `on*`: those are\n * matched against the schema's explicit list, so a typo fails loudly instead of reaching the DOM.\n * 3. **`undefined` is dropped, `null` is forwarded.** These two are not interchangeable, and the rule\n * follows React rather than being invented here:\n *\n * - React's own default resolution (`resolveDefaultProps`) applies a `defaultProps` entry only when\n * the incoming prop is `undefined`; a `null` is respected as an explicitly supplied value. This\n * is the same rule as JS destructuring defaults and ES6 default parameters \u2014 a language-level\n * standard, not a React invention. So `undefined` means \"I am not defining this, you decide\" and\n * `null` means \"I am defining it, as nothing\".\n * - Everywhere React *consumes* a value rather than defaulting it \u2014 DOM attributes, children, event\n * handlers \u2014 it collapses the two and treats both as absent. The distinction is load-bearing\n * only at a default-resolution boundary.\n *\n * A contract passthrough is exactly such a boundary: the result is spread *after* a wrapper's own\n * defaults, so dropping `undefined` is what stops an unset key from erasing a working default,\n * while forwarding `null` is what lets a consumer deliberately override one. This matters more\n * here than in plain React, because Dimsum's `useMemoMergePropsWithDefault` is a plain\n * `{...defaults, ...props}` spread \u2014 it does NOT skip `undefined` the way `resolveDefaultProps`\n * does, so an `undefined` that reaches it clobbers the component's default too.\n *\n * What happens to a forwarded `null` afterwards is the receiving component's business, not this\n * function's. Dimsum components are strictly typed: `validateTypescriptPropTypesImplementation`\n * validates any value that is not `undefined`, and a prop declared as a function does not admit\n * `null` \u2014 so passing `null` there raises a prop-type error, correctly. A prop only accepts `null`\n * if its own declared type says so and its code carries the matching null guards. Where a consumer\n * wants to state \"do nothing\", the type-honouring way to say it is an explicit no-op \u2014 `() => {}`\n * for a handler, `() => null` for a component \u2014 which is unambiguous in a way that `null` is not.\n * This function stays out of that decision: forwarding the value and letting the owning contract\n * judge it is the correct division of concerns at this abstraction level.\n *\n * @param props - the object to filter; anything the contract does not declare is discarded\n * @param contractShape - any object whose KEYS name the contract's props. Only `Object.keys` is read,\n * so it is deliberately not narrowed to `DSPropTypesSchema`\n *\n * a PropTypes schema is usually fine and there is a code dedicated to discarding the global attributes to make the schema compatible for faster internal transition/implementation.\n * @returns a new object containing only the declared, defined props\n */\nexport const getContractProps = <ContractProps>(props: object, contractShape: object): Partial<ContractProps> => {\n const declaredKeys = new Set(Object.keys(contractShape).filter((key) => !DOCUMENTATION_ONLY_SCHEMA_KEYS.has(key)));\n\n // `props` is typed as `object` rather than `Record<string, unknown>` so callers can pass their own\n // declared prop interfaces without a cast at every call site. The casts live here instead.\n const contractProps: Record<string, unknown> = {};\n\n Object.entries(props as Record<string, unknown>).forEach(([key, value]) => {\n if (value === undefined) return;\n // Order matters: 'data-*' is itself prefixed with 'data-', so the documentation-only check has\n // to win over the prefix rule below or the pseudo-key would readmit itself.\n if (DOCUMENTATION_ONLY_SCHEMA_KEYS.has(key)) return;\n if (!declaredKeys.has(key) && !key.startsWith('data-')) return;\n contractProps[key] = value;\n });\n\n return contractProps as Partial<ContractProps>;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADMvB,MAAM,iCAAiC,oBAAI,IAAI,CAAC,UAAU,QAAQ,UAAU,qBAAqB,CAAC;AAqD3F,MAAM,mBAAmB,CAAgB,OAAe,kBAAkD;AAC/G,QAAM,eAAe,IAAI,IAAI,OAAO,KAAK,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,+BAA+B,IAAI,GAAG,CAAC,CAAC;AAIjH,QAAM,gBAAyC,CAAC;AAEhD,SAAO,QAAQ,KAAgC,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACzE,QAAI,UAAU,OAAW;AAGzB,QAAI,+BAA+B,IAAI,GAAG,EAAG;AAC7C,QAAI,CAAC,aAAa,IAAI,GAAG,KAAK,CAAC,IAAI,WAAW,OAAO,EAAG;AACxD,kBAAc,GAAG,IAAI;AAAA,EACvB,CAAC;AAED,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var contractProps_exports = {};
30
+ __export(contractProps_exports, {
31
+ getContractProps: () => import_getContractProps.getContractProps
32
+ });
33
+ module.exports = __toCommonJS(contractProps_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_getContractProps = require("./getContractProps.js");
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/contractProps/index.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["export { getContractProps } from './getContractProps.js';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAAiC;",
6
+ "names": []
7
+ }
package/dist/cjs/index.js CHANGED
@@ -31,6 +31,7 @@ __export(index_exports, {
31
31
  PropTypes: () => import_propTypes.PropTypes,
32
32
  describe: () => import_propTypes.describe,
33
33
  getAriaProps: () => import_getProps.getAriaProps,
34
+ getContractProps: () => import_contractProps.getContractProps,
34
35
  getDataProps: () => import_getProps.getDataProps,
35
36
  getGlobalAttributes: () => import_globalProps.getGlobalAttributes,
36
37
  getPropsPerDatatestIdPropTypes: () => import_propsPerDataTestId.getPropsPerDatatestIdPropTypes,
@@ -58,6 +59,7 @@ var import_propTypes = require("./propTypes/index.js");
58
59
  var import_validation = require("./validation/index.js");
59
60
  var import_xstyledProps = require("./xstyledProps/index.js");
60
61
  var import_useDeprecateComponent = require("./useDeprecateComponent/index.js");
62
+ var import_contractProps = require("./contractProps/index.js");
61
63
  var import_propsPerDataTestId = require("./propsPerDataTestId/index.js");
62
64
  var import_propsPerSlot = require("./propsPerSlot/index.js");
63
65
  var import_useOwnerProps = require("./useOwnerProps/index.js");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["export { useMemoMergePropsWithDefault } from './defaultProps/index.js';\nexport { getAriaProps, getDataProps } from './getProps/index.js';\nexport {\n getGlobalAttributes,\n useGetGlobalAttributes,\n globalAttributesPropTypes,\n type GlobalAttributesT,\n} from './globalProps/index.js';\nexport { describe, PropTypes, type DSPropTypesSchema } from './propTypes/index.js';\nexport type { ValidationMap } from 'prop-types';\nexport {\n throwTypeError,\n throwRequiredError,\n useValidateTypescriptPropTypes,\n validateTypescriptPropTypesImplementation,\n} from './validation/index.js';\nexport { type XstyledProps, useGetXstyledProps, xstyledPropTypes, getXstyledProps } from './xstyledProps/index.js';\nexport { useDeprecateComponent } from './useDeprecateComponent/index.js';\n\nexport { getPropsPerDatatestid, getPropsPerDatatestIdPropTypes } from './propsPerDataTestId/index.js';\nexport { getPropsPerSlotPropTypes } from './propsPerSlot/index.js';\nexport { useOwnerProps } from './useOwnerProps/index.js';\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;ACAA,YAAuB;ADAvB,0BAA6C;AAC7C,sBAA2C;AAC3C,yBAKO;AACP,uBAA4D;AAE5D,wBAKO;AACP,0BAAyF;AACzF,mCAAsC;AAEtC,gCAAsE;AACtE,0BAAyC;AACzC,2BAA8B;",
4
+ "sourcesContent": ["export { useMemoMergePropsWithDefault } from './defaultProps/index.js';\nexport { getAriaProps, getDataProps } from './getProps/index.js';\nexport {\n getGlobalAttributes,\n useGetGlobalAttributes,\n globalAttributesPropTypes,\n type GlobalAttributesT,\n} from './globalProps/index.js';\nexport { describe, PropTypes, type DSPropTypesSchema } from './propTypes/index.js';\nexport type { ValidationMap } from 'prop-types';\nexport {\n throwTypeError,\n throwRequiredError,\n useValidateTypescriptPropTypes,\n validateTypescriptPropTypesImplementation,\n} from './validation/index.js';\nexport { type XstyledProps, useGetXstyledProps, xstyledPropTypes, getXstyledProps } from './xstyledProps/index.js';\nexport { useDeprecateComponent } from './useDeprecateComponent/index.js';\n\nexport { getContractProps } from './contractProps/index.js';\nexport { getPropsPerDatatestid, getPropsPerDatatestIdPropTypes } from './propsPerDataTestId/index.js';\nexport { getPropsPerSlotPropTypes } from './propsPerSlot/index.js';\nexport { useOwnerProps } from './useOwnerProps/index.js';\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;ACAA,YAAuB;ADAvB,0BAA6C;AAC7C,sBAA2C;AAC3C,yBAKO;AACP,uBAA4D;AAE5D,wBAKO;AACP,0BAAyF;AACzF,mCAAsC;AAEtC,2BAAiC;AACjC,gCAAsE;AACtE,0BAAyC;AACzC,2BAA8B;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,17 @@
1
+ import * as React from "react";
2
+ const DOCUMENTATION_ONLY_SCHEMA_KEYS = /* @__PURE__ */ new Set(["aria-*", "on-*", "data-*", "all HTML attributes"]);
3
+ const getContractProps = (props, contractShape) => {
4
+ const declaredKeys = new Set(Object.keys(contractShape).filter((key) => !DOCUMENTATION_ONLY_SCHEMA_KEYS.has(key)));
5
+ const contractProps = {};
6
+ Object.entries(props).forEach(([key, value]) => {
7
+ if (value === void 0) return;
8
+ if (DOCUMENTATION_ONLY_SCHEMA_KEYS.has(key)) return;
9
+ if (!declaredKeys.has(key) && !key.startsWith("data-")) return;
10
+ contractProps[key] = value;
11
+ });
12
+ return contractProps;
13
+ };
14
+ export {
15
+ getContractProps
16
+ };
17
+ //# sourceMappingURL=getContractProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/contractProps/getContractProps.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/**\n * Documentation-only entries that live in `globalAttributesPropTypes` (and therefore in every\n * component schema that spreads it). They exist so the Storybook props table can show \"you may pass\n * any aria-* / data-* / on-* / HTML attribute\" in a single row \u2014 they are NOT prop names a consumer\n * can ever pass, so they must never be treated as part of the runtime key set.\n */\nconst DOCUMENTATION_ONLY_SCHEMA_KEYS = new Set(['aria-*', 'on-*', 'data-*', 'all HTML attributes']);\n\n/**\n * Filters an arbitrary object down to the props a component's contract declares.\n *\n * This is the engine behind each package's own curated passthrough utility (e.g. ds-app-picker's\n * `getDSAppPickerContractProps`). Packages are expected to expose a bound utility rather than their\n * schema: the schema stays an internal implementation detail, so the two can drift later without\n * expanding anyone's public API.\n *\n * Three behaviours worth knowing, because callers depend on them:\n *\n * 1. **Documentation-only wildcard keys are ignored.** See `DOCUMENTATION_ONLY_SCHEMA_KEYS`.\n * 2. **`data-*` is honoured by prefix**, matching `getGlobalAttributes` \u2014 arbitrary data attributes\n * are a supported consumer surface even though no schema can enumerate them. Note the house\n * behaviour deliberately does not extend the same courtesy to `aria-*` or `on*`: those are\n * matched against the schema's explicit list, so a typo fails loudly instead of reaching the DOM.\n * 3. **`undefined` is dropped, `null` is forwarded.** These two are not interchangeable, and the rule\n * follows React rather than being invented here:\n *\n * - React's own default resolution (`resolveDefaultProps`) applies a `defaultProps` entry only when\n * the incoming prop is `undefined`; a `null` is respected as an explicitly supplied value. This\n * is the same rule as JS destructuring defaults and ES6 default parameters \u2014 a language-level\n * standard, not a React invention. So `undefined` means \"I am not defining this, you decide\" and\n * `null` means \"I am defining it, as nothing\".\n * - Everywhere React *consumes* a value rather than defaulting it \u2014 DOM attributes, children, event\n * handlers \u2014 it collapses the two and treats both as absent. The distinction is load-bearing\n * only at a default-resolution boundary.\n *\n * A contract passthrough is exactly such a boundary: the result is spread *after* a wrapper's own\n * defaults, so dropping `undefined` is what stops an unset key from erasing a working default,\n * while forwarding `null` is what lets a consumer deliberately override one. This matters more\n * here than in plain React, because Dimsum's `useMemoMergePropsWithDefault` is a plain\n * `{...defaults, ...props}` spread \u2014 it does NOT skip `undefined` the way `resolveDefaultProps`\n * does, so an `undefined` that reaches it clobbers the component's default too.\n *\n * What happens to a forwarded `null` afterwards is the receiving component's business, not this\n * function's. Dimsum components are strictly typed: `validateTypescriptPropTypesImplementation`\n * validates any value that is not `undefined`, and a prop declared as a function does not admit\n * `null` \u2014 so passing `null` there raises a prop-type error, correctly. A prop only accepts `null`\n * if its own declared type says so and its code carries the matching null guards. Where a consumer\n * wants to state \"do nothing\", the type-honouring way to say it is an explicit no-op \u2014 `() => {}`\n * for a handler, `() => null` for a component \u2014 which is unambiguous in a way that `null` is not.\n * This function stays out of that decision: forwarding the value and letting the owning contract\n * judge it is the correct division of concerns at this abstraction level.\n *\n * @param props - the object to filter; anything the contract does not declare is discarded\n * @param contractShape - any object whose KEYS name the contract's props. Only `Object.keys` is read,\n * so it is deliberately not narrowed to `DSPropTypesSchema`\n *\n * a PropTypes schema is usually fine and there is a code dedicated to discarding the global attributes to make the schema compatible for faster internal transition/implementation.\n * @returns a new object containing only the declared, defined props\n */\nexport const getContractProps = <ContractProps>(props: object, contractShape: object): Partial<ContractProps> => {\n const declaredKeys = new Set(Object.keys(contractShape).filter((key) => !DOCUMENTATION_ONLY_SCHEMA_KEYS.has(key)));\n\n // `props` is typed as `object` rather than `Record<string, unknown>` so callers can pass their own\n // declared prop interfaces without a cast at every call site. The casts live here instead.\n const contractProps: Record<string, unknown> = {};\n\n Object.entries(props as Record<string, unknown>).forEach(([key, value]) => {\n if (value === undefined) return;\n // Order matters: 'data-*' is itself prefixed with 'data-', so the documentation-only check has\n // to win over the prefix rule below or the pseudo-key would readmit itself.\n if (DOCUMENTATION_ONLY_SCHEMA_KEYS.has(key)) return;\n if (!declaredKeys.has(key) && !key.startsWith('data-')) return;\n contractProps[key] = value;\n });\n\n return contractProps as Partial<ContractProps>;\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACMvB,MAAM,iCAAiC,oBAAI,IAAI,CAAC,UAAU,QAAQ,UAAU,qBAAqB,CAAC;AAqD3F,MAAM,mBAAmB,CAAgB,OAAe,kBAAkD;AAC/G,QAAM,eAAe,IAAI,IAAI,OAAO,KAAK,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,+BAA+B,IAAI,GAAG,CAAC,CAAC;AAIjH,QAAM,gBAAyC,CAAC;AAEhD,SAAO,QAAQ,KAAgC,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACzE,QAAI,UAAU,OAAW;AAGzB,QAAI,+BAA+B,IAAI,GAAG,EAAG;AAC7C,QAAI,CAAC,aAAa,IAAI,GAAG,KAAK,CAAC,IAAI,WAAW,OAAO,EAAG;AACxD,kBAAc,GAAG,IAAI;AAAA,EACvB,CAAC;AAED,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ import { getContractProps } from "./getContractProps.js";
3
+ export {
4
+ getContractProps
5
+ };
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/contractProps/index.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { getContractProps } from './getContractProps.js';\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,wBAAwB;",
6
+ "names": []
7
+ }
package/dist/esm/index.js CHANGED
@@ -15,6 +15,7 @@ import {
15
15
  } from "./validation/index.js";
16
16
  import { useGetXstyledProps, xstyledPropTypes, getXstyledProps } from "./xstyledProps/index.js";
17
17
  import { useDeprecateComponent } from "./useDeprecateComponent/index.js";
18
+ import { getContractProps } from "./contractProps/index.js";
18
19
  import { getPropsPerDatatestid, getPropsPerDatatestIdPropTypes } from "./propsPerDataTestId/index.js";
19
20
  import { getPropsPerSlotPropTypes } from "./propsPerSlot/index.js";
20
21
  import { useOwnerProps } from "./useOwnerProps/index.js";
@@ -22,6 +23,7 @@ export {
22
23
  PropTypes,
23
24
  describe,
24
25
  getAriaProps,
26
+ getContractProps,
25
27
  getDataProps,
26
28
  getGlobalAttributes,
27
29
  getPropsPerDatatestIdPropTypes,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { useMemoMergePropsWithDefault } from './defaultProps/index.js';\nexport { getAriaProps, getDataProps } from './getProps/index.js';\nexport {\n getGlobalAttributes,\n useGetGlobalAttributes,\n globalAttributesPropTypes,\n type GlobalAttributesT,\n} from './globalProps/index.js';\nexport { describe, PropTypes, type DSPropTypesSchema } from './propTypes/index.js';\nexport type { ValidationMap } from 'prop-types';\nexport {\n throwTypeError,\n throwRequiredError,\n useValidateTypescriptPropTypes,\n validateTypescriptPropTypesImplementation,\n} from './validation/index.js';\nexport { type XstyledProps, useGetXstyledProps, xstyledPropTypes, getXstyledProps } from './xstyledProps/index.js';\nexport { useDeprecateComponent } from './useDeprecateComponent/index.js';\n\nexport { getPropsPerDatatestid, getPropsPerDatatestIdPropTypes } from './propsPerDataTestId/index.js';\nexport { getPropsPerSlotPropTypes } from './propsPerSlot/index.js';\nexport { useOwnerProps } from './useOwnerProps/index.js';\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,oCAAoC;AAC7C,SAAS,cAAc,oBAAoB;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,UAAU,iBAAyC;AAE5D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAA4B,oBAAoB,kBAAkB,uBAAuB;AACzF,SAAS,6BAA6B;AAEtC,SAAS,uBAAuB,sCAAsC;AACtE,SAAS,gCAAgC;AACzC,SAAS,qBAAqB;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { useMemoMergePropsWithDefault } from './defaultProps/index.js';\nexport { getAriaProps, getDataProps } from './getProps/index.js';\nexport {\n getGlobalAttributes,\n useGetGlobalAttributes,\n globalAttributesPropTypes,\n type GlobalAttributesT,\n} from './globalProps/index.js';\nexport { describe, PropTypes, type DSPropTypesSchema } from './propTypes/index.js';\nexport type { ValidationMap } from 'prop-types';\nexport {\n throwTypeError,\n throwRequiredError,\n useValidateTypescriptPropTypes,\n validateTypescriptPropTypesImplementation,\n} from './validation/index.js';\nexport { type XstyledProps, useGetXstyledProps, xstyledPropTypes, getXstyledProps } from './xstyledProps/index.js';\nexport { useDeprecateComponent } from './useDeprecateComponent/index.js';\n\nexport { getContractProps } from './contractProps/index.js';\nexport { getPropsPerDatatestid, getPropsPerDatatestIdPropTypes } from './propsPerDataTestId/index.js';\nexport { getPropsPerSlotPropTypes } from './propsPerSlot/index.js';\nexport { useOwnerProps } from './useOwnerProps/index.js';\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,oCAAoC;AAC7C,SAAS,cAAc,oBAAoB;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,UAAU,iBAAyC;AAE5D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAA4B,oBAAoB,kBAAkB,uBAAuB;AACzF,SAAS,6BAA6B;AAEtC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB,sCAAsC;AACtE,SAAS,gCAAgC;AACzC,SAAS,qBAAqB;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Filters an arbitrary object down to the props a component's contract declares.
3
+ *
4
+ * This is the engine behind each package's own curated passthrough utility (e.g. ds-app-picker's
5
+ * `getDSAppPickerContractProps`). Packages are expected to expose a bound utility rather than their
6
+ * schema: the schema stays an internal implementation detail, so the two can drift later without
7
+ * expanding anyone's public API.
8
+ *
9
+ * Three behaviours worth knowing, because callers depend on them:
10
+ *
11
+ * 1. **Documentation-only wildcard keys are ignored.** See `DOCUMENTATION_ONLY_SCHEMA_KEYS`.
12
+ * 2. **`data-*` is honoured by prefix**, matching `getGlobalAttributes` — arbitrary data attributes
13
+ * are a supported consumer surface even though no schema can enumerate them. Note the house
14
+ * behaviour deliberately does not extend the same courtesy to `aria-*` or `on*`: those are
15
+ * matched against the schema's explicit list, so a typo fails loudly instead of reaching the DOM.
16
+ * 3. **`undefined` is dropped, `null` is forwarded.** These two are not interchangeable, and the rule
17
+ * follows React rather than being invented here:
18
+ *
19
+ * - React's own default resolution (`resolveDefaultProps`) applies a `defaultProps` entry only when
20
+ * the incoming prop is `undefined`; a `null` is respected as an explicitly supplied value. This
21
+ * is the same rule as JS destructuring defaults and ES6 default parameters — a language-level
22
+ * standard, not a React invention. So `undefined` means "I am not defining this, you decide" and
23
+ * `null` means "I am defining it, as nothing".
24
+ * - Everywhere React *consumes* a value rather than defaulting it — DOM attributes, children, event
25
+ * handlers — it collapses the two and treats both as absent. The distinction is load-bearing
26
+ * only at a default-resolution boundary.
27
+ *
28
+ * A contract passthrough is exactly such a boundary: the result is spread *after* a wrapper's own
29
+ * defaults, so dropping `undefined` is what stops an unset key from erasing a working default,
30
+ * while forwarding `null` is what lets a consumer deliberately override one. This matters more
31
+ * here than in plain React, because Dimsum's `useMemoMergePropsWithDefault` is a plain
32
+ * `{...defaults, ...props}` spread — it does NOT skip `undefined` the way `resolveDefaultProps`
33
+ * does, so an `undefined` that reaches it clobbers the component's default too.
34
+ *
35
+ * What happens to a forwarded `null` afterwards is the receiving component's business, not this
36
+ * function's. Dimsum components are strictly typed: `validateTypescriptPropTypesImplementation`
37
+ * validates any value that is not `undefined`, and a prop declared as a function does not admit
38
+ * `null` — so passing `null` there raises a prop-type error, correctly. A prop only accepts `null`
39
+ * if its own declared type says so and its code carries the matching null guards. Where a consumer
40
+ * wants to state "do nothing", the type-honouring way to say it is an explicit no-op — `() => {}`
41
+ * for a handler, `() => null` for a component — which is unambiguous in a way that `null` is not.
42
+ * This function stays out of that decision: forwarding the value and letting the owning contract
43
+ * judge it is the correct division of concerns at this abstraction level.
44
+ *
45
+ * @param props - the object to filter; anything the contract does not declare is discarded
46
+ * @param contractShape - any object whose KEYS name the contract's props. Only `Object.keys` is read,
47
+ * so it is deliberately not narrowed to `DSPropTypesSchema`
48
+ *
49
+ * a PropTypes schema is usually fine and there is a code dedicated to discarding the global attributes to make the schema compatible for faster internal transition/implementation.
50
+ * @returns a new object containing only the declared, defined props
51
+ */
52
+ export declare const getContractProps: <ContractProps>(props: object, contractShape: object) => Partial<ContractProps>;
@@ -0,0 +1 @@
1
+ export { getContractProps } from './getContractProps.js';
@@ -6,6 +6,7 @@ export type { ValidationMap } from 'prop-types';
6
6
  export { throwTypeError, throwRequiredError, useValidateTypescriptPropTypes, validateTypescriptPropTypesImplementation, } from './validation/index.js';
7
7
  export { type XstyledProps, useGetXstyledProps, xstyledPropTypes, getXstyledProps } from './xstyledProps/index.js';
8
8
  export { useDeprecateComponent } from './useDeprecateComponent/index.js';
9
+ export { getContractProps } from './contractProps/index.js';
9
10
  export { getPropsPerDatatestid, getPropsPerDatatestIdPropTypes } from './propsPerDataTestId/index.js';
10
11
  export { getPropsPerSlotPropTypes } from './propsPerSlot/index.js';
11
12
  export { useOwnerProps } from './useOwnerProps/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-props-helpers",
3
- "version": "3.70.0-next.61",
3
+ "version": "3.70.0-next.63",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Props Helpers",
6
6
  "files": [
@@ -19,7 +19,7 @@
19
19
  "sideEffects": [],
20
20
  "repository": {
21
21
  "type": "git",
22
- "url": "https://git.elliemae.io/platform-ui/dimsum.git"
22
+ "url": "https://github.com/intcx/PLATFORM-UI.dimsum.git"
23
23
  },
24
24
  "engines": {
25
25
  "pnpm": ">=9",
@@ -35,12 +35,12 @@
35
35
  "dependencies": {
36
36
  "fast-deep-equal": "~3.1.3",
37
37
  "prop-types": "~15.8.1",
38
- "@elliemae/ds-system": "3.70.0-next.61",
39
- "@elliemae/ds-typescript-helpers": "3.70.0-next.61"
38
+ "@elliemae/ds-typescript-helpers": "3.70.0-next.63",
39
+ "@elliemae/ds-system": "3.70.0-next.63"
40
40
  },
41
41
  "devDependencies": {
42
42
  "jest": "^30.0.0",
43
- "@elliemae/ds-monorepo-devops": "3.70.0-next.61"
43
+ "@elliemae/ds-monorepo-devops": "3.70.0-next.63"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "lodash-es": "^4.18.1",