@elliemae/ds-system 3.55.0-next.9 → 3.55.1

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.
@@ -52,12 +52,6 @@ const generateDataTestId = (props, meta) => {
52
52
  const generateDataDimsumSlot = (props, meta) => {
53
53
  if (meta.displayName === null) return {};
54
54
  if (!props.didDefinedGetOwnerProps) {
55
- if (false) {
56
- console.warn(
57
- `The component ${meta.displayName} does not define the 'getOwnerProps' function. The 'data-dimsum-slot' attribute will not be generated.
58
- This is required for the slot system to work correctly. Please ensure that the component is properly configured.`
59
- );
60
- }
61
55
  return {};
62
56
  }
63
57
  const finalProps = {};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/styled/generated-attributes/generateAttributes.ts", "../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { displayNameToKebabCase, displayNameToPropCase } from '../helpers.js';\nimport type { AttrsFunc, InternalAttrsFunc, Options, OwnerInterface, PartProps } from '../types.js';\n\nconst generateClassName: InternalAttrsFunc = (props, meta) => {\n if (meta.displayName === null) return {};\n return {\n className: meta.displayName,\n };\n};\n\nconst generateDataTestId: InternalAttrsFunc<{ 'data-testid': string }> = (props, meta) => {\n if (meta.displayName === null) return {};\n if (meta.options.preserveLegacyDataTestId) {\n return props['data-testid'] ? { 'data-testid': props['data-testid'] } : {};\n }\n\n return {\n 'data-testid': props['data-testid'] ?? displayNameToKebabCase(meta.displayName),\n };\n};\n\nconst generateDataDimsumSlot: InternalAttrsFunc = (props, meta) => {\n if (meta.displayName === null) return {};\n\n if (!props.didDefinedGetOwnerProps) {\n /* https://www.npmjs.com/package/esbuild-plugin-replace <== \"true\"\n https://esbuild.github.io/api/#platform\n When using the build API, all process.env.NODE_ENV expressions are automatically defined to \"production\" if all minification options are enabled and \"development\" otherwise.\n This only happens if process, process.env, and process.env.NODE_ENV are not already defined.\n This substitution is necessary to avoid React-based code crashing instantly (since process is a node API, not a web API).\n */\n if (process.env.NODE_ENV !== 'production' && \"true\" !== 'true') {\n console.warn(\n `The component ${meta.displayName} does not define the 'getOwnerProps' function. The 'data-dimsum-slot' attribute will not be generated.\n This is required for the slot system to work correctly. Please ensure that the component is properly configured.`,\n );\n }\n return {};\n }\n const finalProps: Record<string, unknown> = {};\n if (props['data-dimsum-slot']) {\n finalProps['data-dimsum-parent-slot'] = props['data-dimsum-slot'];\n }\n return {\n ...finalProps,\n 'data-dimsum-slot': displayNameToPropCase(meta.displayName),\n };\n};\n\nexport const getPartProps = (\n props: { 'data-testid': string; 'data-dimsum-slot': string } & OwnerInterface,\n): Record<string, unknown> => {\n const { getOwnerProps, getOwnerPropsArguments } = props;\n\n // If no ownerProps are provided, we won't add global attributes\n if (getOwnerProps === undefined) return {};\n\n const ownerPropsValue = getOwnerProps() as Record<string, PartProps>;\n const ownerPropsArgumentsValue = getOwnerPropsArguments?.() ?? {};\n\n // TODO: @carusox deprecate data-testid usage in favor of data-dimsum-slot\n const elementProps = ownerPropsValue[props['data-dimsum-slot']] ?? ownerPropsValue[props['data-testid']];\n\n // If no elementProps are present, we won't add global attributes either\n if (elementProps === undefined || elementProps === null) return {};\n\n // If elementProps is a function, we call it with the ownerPropsArguments\n // Otherwise we assign it directly\n const resultingObject = typeof elementProps === 'function' ? elementProps(ownerPropsArgumentsValue) : elementProps;\n\n return resultingObject;\n};\n\nconst wrap =\n <T extends object>(\n func: InternalAttrsFunc<T>,\n meta: { options: Options; displayName: string | null },\n ): AttrsFunc<T> =>\n (props) =>\n func(props, meta);\n\nexport const generateAttributes = (options: Options, displayName: string | null): AttrsFunc<any>[] => {\n const meta = { options, displayName };\n\n // Comprehensive list of all the generators above\n // ORDER MATTERS: the attributes returned by previous functions, are received as props by the next ones\n return [wrap(generateClassName, meta), wrap(generateDataTestId, meta), wrap(generateDataDimsumSlot, meta)];\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
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AGvG,MAAI,iBAAiB,UAAa,iBAAiB,KAAM,QAAO,CAAC;AAIjE,QAAM,kBAAkB,OAAO,iBAAiB,aAAa,aAAa,wBAAwB,IAAI;AAEtG,SAAO;AACT;AAEA,MAAM,OACJ,CACE,MACA,SAEF,CAAC,UACC,KAAK,OAAO,IAAI;AAEb,MAAM,qBAAqB,CAAC,SAAkB,gBAAiD;AACpG,QAAM,OAAO,EAAE,SAAS,YAAY;AAIpC,SAAO,CAAC,KAAK,mBAAmB,IAAI,GAAG,KAAK,oBAAoB,IAAI,GAAG,KAAK,wBAAwB,IAAI,CAAC;AAC3G;",
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { displayNameToKebabCase, displayNameToPropCase } from '../helpers.js';\nimport type { AttrsFunc, InternalAttrsFunc, Options, OwnerInterface, PartProps } from '../types.js';\n\nconst generateClassName: InternalAttrsFunc = (props, meta) => {\n if (meta.displayName === null) return {};\n return {\n className: meta.displayName,\n };\n};\n\nconst generateDataTestId: InternalAttrsFunc<{ 'data-testid': string }> = (props, meta) => {\n if (meta.displayName === null) return {};\n if (meta.options.preserveLegacyDataTestId) {\n return props['data-testid'] ? { 'data-testid': props['data-testid'] } : {};\n }\n\n return {\n 'data-testid': props['data-testid'] ?? displayNameToKebabCase(meta.displayName),\n };\n};\n\nconst generateDataDimsumSlot: InternalAttrsFunc = (props, meta) => {\n if (meta.displayName === null) return {};\n\n if (!props.didDefinedGetOwnerProps) {\n // temp disabling the warning because we don't want final app to be affected, next branch has correct logic here already, hotfix can just remove the warning\n // if (process.env.NODE_ENV !== 'production') {\n // console.warn(\n // `The component ${meta.displayName} does not define the 'getOwnerProps' function. The 'data-dimsum-slot' attribute will not be generated.\n // This is required for the slot system to work correctly. Please ensure that the component is properly configured.`,\n // );\n // }\n return {};\n }\n const finalProps: Record<string, unknown> = {};\n if (props['data-dimsum-slot']) {\n finalProps['data-dimsum-parent-slot'] = props['data-dimsum-slot'];\n }\n return {\n ...finalProps,\n 'data-dimsum-slot': displayNameToPropCase(meta.displayName),\n };\n};\n\nexport const getPartProps = (\n props: { 'data-testid': string; 'data-dimsum-slot': string } & OwnerInterface,\n): Record<string, unknown> => {\n const { getOwnerProps, getOwnerPropsArguments } = props;\n\n // If no ownerProps are provided, we won't add global attributes\n if (getOwnerProps === undefined) return {};\n\n const ownerPropsValue = getOwnerProps() as Record<string, PartProps>;\n const ownerPropsArgumentsValue = getOwnerPropsArguments?.() ?? {};\n\n // TODO: @carusox deprecate data-testid usage in favor of data-dimsum-slot\n const elementProps = ownerPropsValue[props['data-dimsum-slot']] ?? ownerPropsValue[props['data-testid']];\n\n // If no elementProps are present, we won't add global attributes either\n if (elementProps === undefined || elementProps === null) return {};\n\n // If elementProps is a function, we call it with the ownerPropsArguments\n // Otherwise we assign it directly\n const resultingObject = typeof elementProps === 'function' ? elementProps(ownerPropsArgumentsValue) : elementProps;\n\n return resultingObject;\n};\n\nconst wrap =\n <T extends object>(\n func: InternalAttrsFunc<T>,\n meta: { options: Options; displayName: string | null },\n ): AttrsFunc<T> =>\n (props) =>\n func(props, meta);\n\nexport const generateAttributes = (options: Options, displayName: string | null): AttrsFunc<any>[] => {\n const meta = { options, displayName };\n\n // Comprehensive list of all the generators above\n // ORDER MATTERS: the attributes returned by previous functions, are received as props by the next ones\n return [wrap(generateClassName, meta), wrap(generateDataTestId, meta), wrap(generateDataDimsumSlot, meta)];\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,qBAA8D;AAG9D,MAAM,oBAAuC,CAAC,OAAO,SAAS;AAC5D,MAAI,KAAK,gBAAgB,KAAM,QAAO,CAAC;AACvC,SAAO;AAAA,IACL,WAAW,KAAK;AAAA,EAClB;AACF;AAEA,MAAM,qBAAmE,CAAC,OAAO,SAAS;AACxF,MAAI,KAAK,gBAAgB,KAAM,QAAO,CA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@@ const styledFunction = (tag, options = defaultOptions) => {
104
104
  return ComponentWithRefsMerged;
105
105
  };
106
106
  const styledAttributes = {
107
- attrs: ((...args) => {
107
+ attrs: (...args) => {
108
108
  baseStyledResolver.attrs(...args);
109
109
  return dsStyledResolver;
110
- }),
111
- withConfig: ((...args) => {
110
+ },
111
+ withConfig: (...args) => {
112
112
  baseStyledResolver.withConfig(...args);
113
113
  return dsStyledResolver;
114
- })
114
+ }
115
115
  };
116
116
  return Object.assign(dsStyledResolver, styledAttributes);
117
117
  };
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/styled/styledFunction.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
4
  "sourcesContent": ["/* eslint-disable no-unused-vars */\n/* eslint-disable @typescript-eslint/ban-types */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { useMemo } from 'react';\nimport type { AnyStyledComponent, ThemedStyledFunction } from 'styled-components';\nimport { checkNamingConvention } from './checkNamingConvention.js';\nimport { coerceWithDefaultTheme } from './coerceWithDefaultTheme.js';\nimport { genStyleOverridesExpression, genVariantOverridesExpression } from './expressions/index.js';\nimport { fixStyleArg } from './fixStyleArg.js';\nimport { getPartProps } from './generated-attributes/generateAttributes.js';\nimport { generateAutoCalculated } from './generated-attributes/index.js';\nimport { callbackMerger } from './generated-attributes/utils/callbackMerger.js';\nimport { mergeRefs } from './generated-attributes/utils/refMerger.js';\nimport { displayNameToKebabCase, displayNameToPropCase } from './helpers.js';\nimport { styled as baseStyled } from './system.js';\nimport { dsStyledComponentTransform, magicCssTransform } from './transformers/index.js';\nimport type {\n AnyStyledRef,\n InnerRefInterface,\n Options,\n OwnerInterface,\n Theme,\n ThemedStyledFunctionBase,\n} from './types.js';\n\nconst defaultOptions: Options = {\n name: null,\n slot: null,\n preserveLegacyDataTestId: false,\n};\n\nexport const styledFunction = <\n C extends AnyStyledComponent | keyof React.JSX.IntrinsicElements | React.ComponentType<any>,\n>(\n tag: C,\n options: Options = defaultOptions,\n) => {\n const { name: componentName, slot: componentSlot } = options;\n\n checkNamingConvention(componentName, componentSlot);\n\n // Here we use the `as` because when C is keyof JSX.IntrinsicElements we get `never` for the attributes generic\n // We want to account for string | number | symbol that's why we transform it to `keyof any`\n const baseStyledResolver = baseStyled(tag) as unknown as ThemedStyledFunction<C, Theme, {}, keyof any>;\n\n // Due to the recursive natura of this function, we can't type it properly\n // Since we can apply .attrs or .withConfig, we are not sure on the type of the returned function\n // @ts-expect-error explained above\n const dsStyledResolver: ThemedStyledFunctionBase<C, Theme> = (styleArg, ...expressions) => {\n /**\n * Here we apply a transformation to the expressions only.\n * Since this resolver is returning a HOC of a styled-component, the syntax support for\n * selecting the className of another styled-component is not available anymore.\n * That's why we assign it a `dsStyledComponnentId`, we will replace the component's call for\n * the corresponding id\n */\n const expressionsWithDsStyledComponentId = dsStyledComponentTransform(expressions);\n\n /**\n * Here we apply a CSS transformation to support MAGIC styled components\n * This makes it possible to use the following syntax:\n * color: neutral-100;\n * background-color: success-900;\n */\n const [styleArgWithMagic, expressionsWithMagic] = magicCssTransform(styleArg, expressionsWithDsStyledComponentId);\n\n /**\n * We coerce all the already written expressions with the default theme\n * This prevents styled components to break when a theme is not provided\n * either with the HOC or the ThemeProvider\n */\n const expressionsWithThemeCoerced = coerceWithDefaultTheme(expressionsWithMagic);\n\n if (componentName && componentSlot) {\n // Here we add the style overrides expression\n expressionsWithThemeCoerced.push(genStyleOverridesExpression(componentName, componentSlot));\n }\n\n if (componentName && componentSlot === 'root') {\n // Here we add the variant overrides from the user (only for the root slot\n expressionsWithThemeCoerced.push(genVariantOverridesExpression(componentName));\n }\n\n /**\n * Here we will fix the format of the style argument\n * We possible added some new expressions into the mix,\n * so we need to properly adjust the style arg\n */\n const numOfExpressionsAdded = expressionsWithThemeCoerced.length - expressionsWithMagic.length;\n\n const fixedStyleArg = fixStyleArg(styleArgWithMagic, numOfExpressionsAdded);\n\n // We will add autocalculated attributes to the styled component\n const [displayName, attributes] = generateAutoCalculated(options);\n\n // For each attribute function, we will call `attrs` func with it\n // This will add the attributes to the styled component\n const baseStyledResolverWithAttributes = attributes.reduce<typeof baseStyledResolver>(\n (curStyledResolver, attributeFunc) => curStyledResolver.attrs(attributeFunc),\n baseStyledResolver,\n );\n\n const Component = baseStyledResolverWithAttributes(fixedStyleArg, ...expressionsWithThemeCoerced);\n\n const ComponentWithRefsMerged = (props: OwnerInterface & InnerRefInterface<C> & { 'data-testid'?: string }) => {\n // we may or not have data-testid at this point, so we need to calculate it\n const dataTestId = props['data-testid'] ?? (displayName !== null ? displayNameToKebabCase(displayName) : '');\n // we also need to calculate dataDimsumSlot at this point\n const dataDimsumSlot = displayName !== null ? displayNameToPropCase(displayName) : '';\n // then we get the part props for this slot, and we cast it to use refs\n const partProps = getPartProps({\n ...props,\n 'data-testid': dataTestId,\n 'data-dimsum-slot': dataDimsumSlot,\n }) as {\n innerRef?: AnyStyledRef<HTMLElement>;\n };\n\n // then we merge the callbacks from the props with the ones from the part\n // this object also has all global props from the parts\n const resultingObjectWithCallbackMerged = callbackMerger(props, partProps);\n\n const mergedRef = useMemo(\n () => mergeRefs(props.innerRef, partProps.innerRef),\n [props.innerRef, partProps.innerRef],\n );\n\n // We don't want to pass the owner props to the component down the line\n const { getOwnerProps, getOwnerPropsArguments, ...restProps } = props;\n // TODO:\n // deploy the following code and see if we break something in a dedicated effort ASAP\n // let ref = undefined;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore : as of thue 16 may 2024, Component.target.$$typeof is undefined for non-native react components\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n // if (typeof Component?.target === 'string') {\n // ref = mergedRef;\n // }\n\n const propsWithRefMerged = {\n ...restProps,\n ...resultingObjectWithCallbackMerged,\n // ref: ref,\n ref: mergedRef,\n innerRef: mergedRef,\n didDefinedGetOwnerProps: !!getOwnerProps,\n } as React.ComponentProps<C>;\n\n // TODO: check if we need to pass the ref to the component\n // Check $$typeof to see if it's a react-forward-ref\n // Check dsStyledComponentId to see if it's a styled component\n // Check what to do with span, div, etc.\n // Other cases should not receive ref...?\n\n return <Component {...propsWithRefMerged} />;\n };\n\n if (displayName !== null) {\n Component.displayName = displayName;\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore We use dsStyledComponent to access the original's component id\n ComponentWithRefsMerged.dsStyledComponentId = Component.styledComponentId as string;\n // eslint-disable-next-line @typescript-eslint/unbound-method\n ComponentWithRefsMerged.toString = Component.toString;\n\n return ComponentWithRefsMerged;\n };\n\n // Here we use arrow functions to preserve the `this` context\n const styledAttributes = {\n attrs: ((...args) => {\n baseStyledResolver.attrs(...args);\n return dsStyledResolver;\n }) as (typeof baseStyledResolver)['attrs'],\n withConfig: ((...args) => {\n baseStyledResolver.withConfig(...args);\n return dsStyledResolver;\n }) as (typeof baseStyledResolver)['withConfig'],\n };\n\n return Object.assign(dsStyledResolver, styledAttributes);\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD0JV;AAvJb,mBAA+B;AAE/B,mCAAsC;AACtC,oCAAuC;AACvC,yBAA2E;AAC3E,yBAA4B;AAC5B,gCAA6B;AAC7B,kCAAuC;AACvC,4BAA+B;AAC/B,uBAA0B;AAC1B,qBAA8D;AAC9D,oBAAqC;AACrC,0BAA8D;AAU9D,MAAM,iBAA0B;AAAA,EAC9B,MAAM;AAAA,EACN,MAAM;AAAA,EACN,0BAA0B;AAC5B;AAEO,MAAM,iBAAiB,CAG5B,KACA,UAAmB,mBAChB;AACH,QAAM,EAAE,MAAM,eAAe,MAAM,cAAc,IAAI;AAErD,0DAAsB,eAAe,aAAa;AAIlD,QAAM,yBAAqB,cAAAA,QAAW,GAAG;AAKzC,QAAM,mBAAuD,CAAC,aAAa,gBAAgB;AAQzF,UAAM,yCAAqC,gDAA2B,WAAW;AAQjF,UAAM,CA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G,IAAI;AAChC,aAAO;AAAA,IACT;AAAA,IACA,YAAa,IAAI,SAAS;AACxB,yBAAmB,WAAW,GAAG,IAAI;AACrC,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO,OAAO,OAAO,kBAAkB,gBAAgB;AACzD;",
6
6
  "names": ["baseStyled"]
7
7
  }
@@ -18,12 +18,6 @@ const generateDataTestId = (props, meta) => {
18
18
  const generateDataDimsumSlot = (props, meta) => {
19
19
  if (meta.displayName === null) return {};
20
20
  if (!props.didDefinedGetOwnerProps) {
21
- if (false) {
22
- console.warn(
23
- `The component ${meta.displayName} does not define the 'getOwnerProps' function. The 'data-dimsum-slot' attribute will not be generated.
24
- This is required for the slot system to work correctly. Please ensure that the component is properly configured.`
25
- );
26
- }
27
21
  return {};
28
22
  }
29
23
  const finalProps = {};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/styled/generated-attributes/generateAttributes.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { displayNameToKebabCase, displayNameToPropCase } from '../helpers.js';\nimport type { AttrsFunc, InternalAttrsFunc, Options, OwnerInterface, PartProps } from '../types.js';\n\nconst generateClassName: InternalAttrsFunc = (props, meta) => {\n if (meta.displayName === null) return {};\n return {\n className: meta.displayName,\n };\n};\n\nconst generateDataTestId: InternalAttrsFunc<{ 'data-testid': string }> = (props, meta) => {\n if (meta.displayName === null) return {};\n if (meta.options.preserveLegacyDataTestId) {\n return props['data-testid'] ? { 'data-testid': props['data-testid'] } : {};\n }\n\n return {\n 'data-testid': props['data-testid'] ?? displayNameToKebabCase(meta.displayName),\n };\n};\n\nconst generateDataDimsumSlot: InternalAttrsFunc = (props, meta) => {\n if (meta.displayName === null) return {};\n\n if (!props.didDefinedGetOwnerProps) {\n /* https://www.npmjs.com/package/esbuild-plugin-replace <== \"true\"\n https://esbuild.github.io/api/#platform\n When using the build API, all process.env.NODE_ENV expressions are automatically defined to \"production\" if all minification options are enabled and \"development\" otherwise.\n This only happens if process, process.env, and process.env.NODE_ENV are not already defined.\n This substitution is necessary to avoid React-based code crashing instantly (since process is a node API, not a web API).\n */\n if (process.env.NODE_ENV !== 'production' && \"true\" !== 'true') {\n console.warn(\n `The component ${meta.displayName} does not define the 'getOwnerProps' function. The 'data-dimsum-slot' attribute will not be generated.\n This is required for the slot system to work correctly. Please ensure that the component is properly configured.`,\n );\n }\n return {};\n }\n const finalProps: Record<string, unknown> = {};\n if (props['data-dimsum-slot']) {\n finalProps['data-dimsum-parent-slot'] = props['data-dimsum-slot'];\n }\n return {\n ...finalProps,\n 'data-dimsum-slot': displayNameToPropCase(meta.displayName),\n };\n};\n\nexport const getPartProps = (\n props: { 'data-testid': string; 'data-dimsum-slot': string } & OwnerInterface,\n): Record<string, unknown> => {\n const { getOwnerProps, getOwnerPropsArguments } = props;\n\n // If no ownerProps are provided, we won't add global attributes\n if (getOwnerProps === undefined) return {};\n\n const ownerPropsValue = getOwnerProps() as Record<string, PartProps>;\n const ownerPropsArgumentsValue = getOwnerPropsArguments?.() ?? {};\n\n // TODO: @carusox deprecate data-testid usage in favor of data-dimsum-slot\n const elementProps = ownerPropsValue[props['data-dimsum-slot']] ?? ownerPropsValue[props['data-testid']];\n\n // If no elementProps are present, we won't add global attributes either\n if (elementProps === undefined || elementProps === null) return {};\n\n // If elementProps is a function, we call it with the ownerPropsArguments\n // Otherwise we assign it directly\n const resultingObject = typeof elementProps === 'function' ? elementProps(ownerPropsArgumentsValue) : elementProps;\n\n return resultingObject;\n};\n\nconst wrap =\n <T extends object>(\n func: InternalAttrsFunc<T>,\n meta: { options: Options; displayName: string | null },\n ): AttrsFunc<T> =>\n (props) =>\n func(props, meta);\n\nexport const generateAttributes = (options: Options, displayName: string | null): AttrsFunc<any>[] => {\n const meta = { options, displayName };\n\n // Comprehensive list of all the generators above\n // ORDER MATTERS: the attributes returned by previous functions, are received as props by the next ones\n return [wrap(generateClassName, meta), wrap(generateDataTestId, meta), wrap(generateDataDimsumSlot, meta)];\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,wBAAwB,6BAA6B;AAG9D,MAAM,oBAAuC,CAAC,OAAO,SAAS;AAC5D,MAAI,KAAK,gBAAgB,KAAM,QAAO,CAAC;AACvC,SAAO;AAAA,IACL,WAAW,KAAK;AAAA,EAClB;AACF;AAEA,MAAM,qBAAmE,CAAC,OAAO,SAAS;AACxF,MAAI,KAAK,gBAAgB,KAAM,QAAO,CAAC;AACvC,MAAI,KAAK,QAAQ,0BAA0B;AACzC,WAAO,MAAM,aAAa,IAAI,EAAE,eAAe,MAAM,aAAa,EAAE,IAAI,CAAC;AAAA,EAC3E;AAEA,SAAO;AAAA,IACL,eAAe,MAAM,aAAa,KAAK,uBAAuB,KAAK,WAAW;AAAA,EAChF;AACF;AAEA,MAAM,yBAA4C,CAAC,OAAO,SAAS;AACjE,MAAI,KAAK,gBAAgB,KAAM,QAAO,CAAC;AAEvC,MAAI,CAAC,MAAM,yBAAyB;AAOlC,QAA6C,OAAmB;AAC9D,cAAQ;AAAA,QACN,iBAAiB,KAAK,WAAW;AAAA;AAAA,MAEnC;AAAA,IACF;AACA,WAAO,CAAC;AAAA,EACV;AACA,QAAM,aAAsC,CAAC;AAC7C,MAAI,MAAM,kBAAkB,GAAG;AAC7B,eAAW,yBAAyB,IAAI,MAAM,kBAAkB;AAAA,EAClE;AACA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,oBAAoB,sBAAsB,KAAK,WAAW;AAAA,EAC5D;AACF;AAEO,MAAM,eAAe,CAC1B,UAC4B;AAC5B,QAAM,EAAE,eAAe,uBAAuB,IAAI;AAGlD,MAAI,kBAAkB,OAAW,QAAO,CAAC;AAEzC,QAAM,kBAAkB,cAAc;AACtC,QAAM,2BAA2B,yBAAyB,KAAK,CAAC;AAGhE,QAAM,eAAe,gBAAgB,MAAM,kBAAkB,CAAC,KAAK,gBAAgB,MAAM,aAAa,CAAC;AAGvG,MAAI,iBAAiB,UAAa,iBAAiB,KAAM,QAAO,CAAC;AAIjE,QAAM,kBAAkB,OAAO,iBAAiB,aAAa,aAAa,wBAAwB,IAAI;AAEtG,SAAO;AACT;AAEA,MAAM,OACJ,CACE,MACA,SAEF,CAAC,UACC,KAAK,OAAO,IAAI;AAEb,MAAM,qBAAqB,CAAC,SAAkB,gBAAiD;AACpG,QAAM,OAAO,EAAE,SAAS,YAAY;AAIpC,SAAO,CAAC,KAAK,mBAAmB,IAAI,GAAG,KAAK,oBAAoB,IAAI,GAAG,KAAK,wBAAwB,IAAI,CAAC;AAC3G;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { displayNameToKebabCase, displayNameToPropCase } from '../helpers.js';\nimport type { AttrsFunc, InternalAttrsFunc, Options, OwnerInterface, PartProps } from '../types.js';\n\nconst generateClassName: InternalAttrsFunc = (props, meta) => {\n if (meta.displayName === null) return {};\n return {\n className: meta.displayName,\n };\n};\n\nconst generateDataTestId: InternalAttrsFunc<{ 'data-testid': string }> = (props, meta) => {\n if (meta.displayName === null) return {};\n if (meta.options.preserveLegacyDataTestId) {\n return props['data-testid'] ? { 'data-testid': props['data-testid'] } : {};\n }\n\n return {\n 'data-testid': props['data-testid'] ?? displayNameToKebabCase(meta.displayName),\n };\n};\n\nconst generateDataDimsumSlot: InternalAttrsFunc = (props, meta) => {\n if (meta.displayName === null) return {};\n\n if (!props.didDefinedGetOwnerProps) {\n // temp disabling the warning because we don't want final app to be affected, next branch has correct logic here already, hotfix can just remove the warning\n // if (process.env.NODE_ENV !== 'production') {\n // console.warn(\n // `The component ${meta.displayName} does not define the 'getOwnerProps' function. The 'data-dimsum-slot' attribute will not be generated.\n // This is required for the slot system to work correctly. Please ensure that the component is properly configured.`,\n // );\n // }\n return {};\n }\n const finalProps: Record<string, unknown> = {};\n if (props['data-dimsum-slot']) {\n finalProps['data-dimsum-parent-slot'] = props['data-dimsum-slot'];\n }\n return {\n ...finalProps,\n 'data-dimsum-slot': displayNameToPropCase(meta.displayName),\n };\n};\n\nexport const getPartProps = (\n props: { 'data-testid': string; 'data-dimsum-slot': string } & OwnerInterface,\n): Record<string, unknown> => {\n const { getOwnerProps, getOwnerPropsArguments } = props;\n\n // If no ownerProps are provided, we won't add global attributes\n if (getOwnerProps === undefined) return {};\n\n const ownerPropsValue = getOwnerProps() as Record<string, PartProps>;\n const ownerPropsArgumentsValue = getOwnerPropsArguments?.() ?? {};\n\n // TODO: @carusox deprecate data-testid usage in favor of data-dimsum-slot\n const elementProps = ownerPropsValue[props['data-dimsum-slot']] ?? ownerPropsValue[props['data-testid']];\n\n // If no elementProps are present, we won't add global attributes either\n if (elementProps === undefined || elementProps === null) return {};\n\n // If elementProps is a function, we call it with the ownerPropsArguments\n // Otherwise we assign it directly\n const resultingObject = typeof elementProps === 'function' ? elementProps(ownerPropsArgumentsValue) : elementProps;\n\n return resultingObject;\n};\n\nconst wrap =\n <T extends object>(\n func: InternalAttrsFunc<T>,\n meta: { options: Options; displayName: string | null },\n ): AttrsFunc<T> =>\n (props) =>\n func(props, meta);\n\nexport const generateAttributes = (options: Options, displayName: string | null): AttrsFunc<any>[] => {\n const meta = { options, displayName };\n\n // Comprehensive list of all the generators above\n // ORDER MATTERS: the attributes returned by previous functions, are received as props by the next ones\n return [wrap(generateClassName, meta), wrap(generateDataTestId, meta), wrap(generateDataDimsumSlot, meta)];\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,wBAAwB,6BAA6B;AAG9D,MAAM,oBAAuC,CAAC,OAAO,SAAS;AAC5D,MAAI,KAAK,gBAAgB,KAAM,QAAO,CAAC;AACvC,SAAO;AAAA,IACL,WAAW,KAAK;AAAA,EAClB;AACF;AAEA,MAAM,qBAAmE,CAAC,OAAO,SAAS;AACxF,MAAI,KAAK,gBAAgB,KAAM,QAAO,CAAC;AACvC,MAA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tag, options = defaultOptions) => {
71
71
  return ComponentWithRefsMerged;
72
72
  };
73
73
  const styledAttributes = {
74
- attrs: ((...args) => {
74
+ attrs: (...args) => {
75
75
  baseStyledResolver.attrs(...args);
76
76
  return dsStyledResolver;
77
- }),
78
- withConfig: ((...args) => {
77
+ },
78
+ withConfig: (...args) => {
79
79
  baseStyledResolver.withConfig(...args);
80
80
  return dsStyledResolver;
81
- })
81
+ }
82
82
  };
83
83
  return Object.assign(dsStyledResolver, styledAttributes);
84
84
  };
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/styled/styledFunction.tsx"],
4
4
  "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-unused-vars */\n/* eslint-disable @typescript-eslint/ban-types */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { useMemo } from 'react';\nimport type { AnyStyledComponent, ThemedStyledFunction } from 'styled-components';\nimport { checkNamingConvention } from './checkNamingConvention.js';\nimport { coerceWithDefaultTheme } from './coerceWithDefaultTheme.js';\nimport { genStyleOverridesExpression, genVariantOverridesExpression } from './expressions/index.js';\nimport { fixStyleArg } from './fixStyleArg.js';\nimport { getPartProps } from './generated-attributes/generateAttributes.js';\nimport { generateAutoCalculated } from './generated-attributes/index.js';\nimport { callbackMerger } from './generated-attributes/utils/callbackMerger.js';\nimport { mergeRefs } from './generated-attributes/utils/refMerger.js';\nimport { displayNameToKebabCase, displayNameToPropCase } from './helpers.js';\nimport { styled as baseStyled } from './system.js';\nimport { dsStyledComponentTransform, magicCssTransform } from './transformers/index.js';\nimport type {\n AnyStyledRef,\n InnerRefInterface,\n Options,\n OwnerInterface,\n Theme,\n ThemedStyledFunctionBase,\n} from './types.js';\n\nconst defaultOptions: Options = {\n name: null,\n slot: null,\n preserveLegacyDataTestId: false,\n};\n\nexport const styledFunction = <\n C extends AnyStyledComponent | keyof React.JSX.IntrinsicElements | React.ComponentType<any>,\n>(\n tag: C,\n options: Options = defaultOptions,\n) => {\n const { name: componentName, slot: componentSlot } = options;\n\n checkNamingConvention(componentName, componentSlot);\n\n // Here we use the `as` because when C is keyof JSX.IntrinsicElements we get `never` for the attributes generic\n // We want to account for string | number | symbol that's why we transform it to `keyof any`\n const baseStyledResolver = baseStyled(tag) as unknown as ThemedStyledFunction<C, Theme, {}, keyof any>;\n\n // Due to the recursive natura of this function, we can't type it properly\n // Since we can apply .attrs or .withConfig, we are not sure on the type of the returned function\n // @ts-expect-error explained above\n const dsStyledResolver: ThemedStyledFunctionBase<C, Theme> = (styleArg, ...expressions) => {\n /**\n * Here we apply a transformation to the expressions only.\n * Since this resolver is returning a HOC of a styled-component, the syntax support for\n * selecting the className of another styled-component is not available anymore.\n * That's why we assign it a `dsStyledComponnentId`, we will replace the component's call for\n * the corresponding id\n */\n const expressionsWithDsStyledComponentId = dsStyledComponentTransform(expressions);\n\n /**\n * Here we apply a CSS transformation to support MAGIC styled components\n * This makes it possible to use the following syntax:\n * color: neutral-100;\n * background-color: success-900;\n */\n const [styleArgWithMagic, expressionsWithMagic] = magicCssTransform(styleArg, expressionsWithDsStyledComponentId);\n\n /**\n * We coerce all the already written expressions with the default theme\n * This prevents styled components to break when a theme is not provided\n * either with the HOC or the ThemeProvider\n */\n const expressionsWithThemeCoerced = coerceWithDefaultTheme(expressionsWithMagic);\n\n if (componentName && componentSlot) {\n // Here we add the style overrides expression\n expressionsWithThemeCoerced.push(genStyleOverridesExpression(componentName, componentSlot));\n }\n\n if (componentName && componentSlot === 'root') {\n // Here we add the variant overrides from the user (only for the root slot\n expressionsWithThemeCoerced.push(genVariantOverridesExpression(componentName));\n }\n\n /**\n * Here we will fix the format of the style argument\n * We possible added some new expressions into the mix,\n * so we need to properly adjust the style arg\n */\n const numOfExpressionsAdded = expressionsWithThemeCoerced.length - expressionsWithMagic.length;\n\n const fixedStyleArg = fixStyleArg(styleArgWithMagic, numOfExpressionsAdded);\n\n // We will add autocalculated attributes to the styled component\n const [displayName, attributes] = generateAutoCalculated(options);\n\n // For each attribute function, we will call `attrs` func with it\n // This will add the attributes to the styled component\n const baseStyledResolverWithAttributes = attributes.reduce<typeof baseStyledResolver>(\n (curStyledResolver, attributeFunc) => curStyledResolver.attrs(attributeFunc),\n baseStyledResolver,\n );\n\n const Component = baseStyledResolverWithAttributes(fixedStyleArg, ...expressionsWithThemeCoerced);\n\n const ComponentWithRefsMerged = (props: OwnerInterface & InnerRefInterface<C> & { 'data-testid'?: string }) => {\n // we may or not have data-testid at this point, so we need to calculate it\n const dataTestId = props['data-testid'] ?? (displayName !== null ? displayNameToKebabCase(displayName) : '');\n // we also need to calculate dataDimsumSlot at this point\n const dataDimsumSlot = displayName !== null ? displayNameToPropCase(displayName) : '';\n // then we get the part props for this slot, and we cast it to use refs\n const partProps = getPartProps({\n ...props,\n 'data-testid': dataTestId,\n 'data-dimsum-slot': dataDimsumSlot,\n }) as {\n innerRef?: AnyStyledRef<HTMLElement>;\n };\n\n // then we merge the callbacks from the props with the ones from the part\n // this object also has all global props from the parts\n const resultingObjectWithCallbackMerged = callbackMerger(props, partProps);\n\n const mergedRef = useMemo(\n () => mergeRefs(props.innerRef, partProps.innerRef),\n [props.innerRef, partProps.innerRef],\n );\n\n // We don't want to pass the owner props to the component down the line\n const { getOwnerProps, getOwnerPropsArguments, ...restProps } = props;\n // TODO:\n // deploy the following code and see if we break something in a dedicated effort ASAP\n // let ref = undefined;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore : as of thue 16 may 2024, Component.target.$$typeof is undefined for non-native react components\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n // if (typeof Component?.target === 'string') {\n // ref = mergedRef;\n // }\n\n const propsWithRefMerged = {\n ...restProps,\n ...resultingObjectWithCallbackMerged,\n // ref: ref,\n ref: mergedRef,\n innerRef: mergedRef,\n didDefinedGetOwnerProps: !!getOwnerProps,\n } as React.ComponentProps<C>;\n\n // TODO: check if we need to pass the ref to the component\n // Check $$typeof to see if it's a react-forward-ref\n // Check dsStyledComponentId to see if it's a styled component\n // Check what to do with span, div, etc.\n // Other cases should not receive ref...?\n\n return <Component {...propsWithRefMerged} />;\n };\n\n if (displayName !== null) {\n Component.displayName = displayName;\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore We use dsStyledComponent to access the original's component id\n ComponentWithRefsMerged.dsStyledComponentId = Component.styledComponentId as string;\n // eslint-disable-next-line @typescript-eslint/unbound-method\n ComponentWithRefsMerged.toString = Component.toString;\n\n return ComponentWithRefsMerged;\n };\n\n // Here we use arrow functions to preserve the `this` context\n const styledAttributes = {\n attrs: ((...args) => {\n baseStyledResolver.attrs(...args);\n return dsStyledResolver;\n }) as (typeof baseStyledResolver)['attrs'],\n withConfig: ((...args) => {\n baseStyledResolver.withConfig(...args);\n return dsStyledResolver;\n }) as (typeof baseStyledResolver)['withConfig'],\n };\n\n return Object.assign(dsStyledResolver, styledAttributes);\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;AC0JV;AAvJb,SAAgB,eAAe;AAE/B,SAAS,6BAA6B;AACtC,SAAS,8BAA8B;AACvC,SAAS,6BAA6B,qCAAqC;AAC3E,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,8BAA8B;AACvC,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB,6BAA6B;AAC9D,SAAS,UAAU,kBAAkB;AACrC,SAAS,4BAA4B,yBAAyB;AAU9D,MAAM,iBAA0B;AAAA,EAC9B,MAAM;AAAA,EACN,MAAM;AAAA,EACN,0BAA0B;AAC5B;AAEO,MAAM,iBAAiB,CAG5B,KACA,UAAmB,mBAChB;AACH,QAAM,EAAE,MAAM,eAAe,MAAM,cAAc,IAAI;AAErD,wBAAsB,eAAe,aAAa;AAIlD,QAAM,qBAAqB,WAAW,GAAG;AAKzC,QAAM,mBAAuD,CAAC,aAAa,gBAAgB;AAQzF,UAAM,qCAAqC,2BAA2B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,OAAQ,IAAI,SAAS;AACnB,yBAAmB,MAAM,GAAG,IAAI;AAChC,aAAO;AAAA,IACT;AAAA,IACA,YAAa,IAAI,SAAS;AACxB,yBAAmB,WAAW,GAAG,IAAI;AACrC,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO,OAAO,OAAO,kBAAkB,gBAAgB;AACzD;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-system",
3
- "version": "3.55.0-next.9",
3
+ "version": "3.55.1",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - System",
6
6
  "files": [
@@ -51,8 +51,8 @@
51
51
  "jest": "~29.7.0",
52
52
  "jest-cli": "~29.7.0",
53
53
  "styled-components": "~5.3.9",
54
- "@elliemae/ds-monorepo-devops": "3.55.0-next.9",
55
- "@elliemae/ds-typescript-helpers": "3.55.0-next.9"
54
+ "@elliemae/ds-typescript-helpers": "3.55.1",
55
+ "@elliemae/ds-monorepo-devops": "3.55.1"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "@elliemae/pui-theme": "~2.13.0",