@redsift/design-system 12.5.3-alpha.5 → 12.5.3-alpha.6

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.
@@ -2,6 +2,7 @@ import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBab
2
2
  import React__default, { forwardRef } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { S as StyledText, b as StyledHighlightMarker } from './styles6.js';
5
+ import { w as warnOnAliasProps } from './warnAliasProps.js';
5
6
  import { n as normalizeHighlightOptions, i as isNonAscii, r as replaceInvisibleChars } from './highlightNonAscii.js';
6
7
  import { F as FontFamily } from './fonts.js';
7
8
  import { f as getStylingTransientProps } from './styles.js';
@@ -10,6 +11,31 @@ import { u as useTheme } from './useTheme.js';
10
11
  const _excluded = ["as", "children", "className", "color", "fontFamily", "fontSize", "fontWeight", "highlightNonAscii", "lineHeight", "noWrap", "theme", "variant", "wordBreak"];
11
12
  const COMPONENT_NAME = 'Text';
12
13
  const CLASSNAME = 'redsift-text';
14
+ const TEXT_ALIAS_WARNINGS = [{
15
+ prop: 'kind',
16
+ use: 'variant'
17
+ }, {
18
+ prop: 'appearance',
19
+ use: 'variant'
20
+ }, {
21
+ prop: 'size',
22
+ use: 'fontSize',
23
+ hint: 'Text uses fontSize / variant for sizing.'
24
+ }, {
25
+ prop: 'weight',
26
+ use: 'fontWeight'
27
+ }, {
28
+ prop: 'level',
29
+ use: 'as',
30
+ hint: 'For headings (h1-h6) use the Heading component, not Text.'
31
+ }, {
32
+ prop: 'tag',
33
+ use: 'as'
34
+ }, {
35
+ prop: 'slot',
36
+ use: 'children',
37
+ hint: 'Text does not implement a slot API; pass content as children.'
38
+ }];
13
39
 
14
40
  /**
15
41
  * Processes a string and wraps consecutive non-ASCII characters in highlight markers.
@@ -103,6 +129,7 @@ const highlightNonAsciiChars = (text, options) => {
103
129
  * <Text highlightNonAscii>ƅankofamerica.com</Text>
104
130
  */
105
131
  const Text = /*#__PURE__*/forwardRef((props, ref) => {
132
+ warnOnAliasProps(COMPONENT_NAME, props, TEXT_ALIAS_WARNINGS);
106
133
  const {
107
134
  transientProps,
108
135
  otherProps
@@ -1 +1 @@
1
- {"version":3,"file":"Text2.js","sources":["../../src/components/text/Text.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode, RefObject } from 'react';\nimport classNames from 'classnames';\nimport { Comp, FontFamily, getStylingTransientProps } from '../../types';\nimport { StyledText, StyledHighlightMarker } from './styles';\nimport { TextProps } from './types';\nimport { useTheme } from '../theme';\nimport {\n isNonAscii,\n replaceInvisibleChars,\n normalizeHighlightOptions,\n NormalizedHighlightOptions,\n} from '../../utils/highlightNonAscii';\n\nconst COMPONENT_NAME = 'Text';\nconst CLASSNAME = 'redsift-text';\n\n/**\n * Processes a string and wraps consecutive non-ASCII characters in highlight markers.\n * Groups consecutive non-ASCII characters to minimize DOM nodes.\n * Invisible characters are replaced with visible indicators (•).\n */\nconst highlightNonAsciiChars = (text: string, options: NormalizedHighlightOptions): ReactNode[] => {\n const result: ReactNode[] = [];\n let currentAscii = '';\n let currentNonAscii = '';\n let keyIndex = 0;\n\n // Use Array.from to correctly handle Unicode surrogate pairs (e.g., emojis)\n const chars = Array.from(text);\n\n for (const char of chars) {\n if (isNonAscii(char)) {\n // Flush ASCII buffer\n if (currentAscii) {\n result.push(currentAscii);\n currentAscii = '';\n }\n currentNonAscii += char;\n } else {\n // Flush non-ASCII buffer\n if (currentNonAscii) {\n result.push(\n <StyledHighlightMarker key={keyIndex++} $font={options.font} $background={options.background}>\n {replaceInvisibleChars(currentNonAscii)}\n </StyledHighlightMarker>\n );\n currentNonAscii = '';\n }\n currentAscii += char;\n }\n }\n\n // Flush remaining buffers\n if (currentAscii) {\n result.push(currentAscii);\n }\n if (currentNonAscii) {\n result.push(\n <StyledHighlightMarker key={keyIndex} $font={options.font} $background={options.background}>\n {replaceInvisibleChars(currentNonAscii)}\n </StyledHighlightMarker>\n );\n }\n\n return result;\n};\n\n/**\n * Text renders text content with consistent styling. By default renders a\n * `<span>` but can be changed via the `as` prop.\n *\n * Variants: `body`, `button`, `caption`, `inherit`\n * Semantic elements: `span` (default), `p`, `b`, `i`, `u`, `abbr`, `cite`,\n * `del`, `em`, `ins`, `kbd`, `mark`, `s`, `samp`, `sub`, `sup`\n *\n * @example\n * // Basic text\n * <Text>Hello world</Text>\n *\n * @example\n * // Typography variants\n * <Text variant=\"body\">Body text for paragraphs</Text>\n * <Text variant=\"button\">Button-style text</Text>\n * <Text variant=\"caption\">Small caption text</Text>\n *\n * @example\n * // Semantic elements\n * <Text as=\"p\">Paragraph element</Text>\n * <Text as=\"b\">Bold text</Text>\n * <Text as=\"em\">Emphasized text</Text>\n * <Text as=\"mark\">Highlighted text</Text>\n * <Text as=\"kbd\">Keyboard input</Text>\n *\n * @example\n * // Custom styling\n * <Text color=\"grey\" fontSize=\"14px\" fontWeight={600}>Custom styled</Text>\n *\n * @example\n * // Truncated text with ellipsis\n * <Text noWrap>Very long text that will be truncated with ellipsis...</Text>\n *\n * @example\n * // Caption with color\n * <Text variant=\"caption\" color=\"grey\">Last updated: Jan 2024</Text>\n *\n * @example\n * // Highlight non-ASCII characters (useful for IDN domain names)\n * <Text highlightNonAscii>ƅankofamerica.com</Text>\n */\nexport const Text: Comp<TextProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { transientProps, otherProps } = getStylingTransientProps(props);\n\n const {\n as,\n children,\n className,\n color,\n fontFamily = FontFamily.poppins,\n fontSize,\n fontWeight,\n highlightNonAscii,\n lineHeight,\n noWrap,\n theme: propsTheme,\n variant,\n wordBreak,\n ...forwardedProps\n } = otherProps;\n\n const theme = useTheme(propsTheme);\n\n // Process children to highlight non-ASCII characters if enabled and children is a string\n let renderedChildren = children;\n if (highlightNonAscii && typeof children === 'string') {\n const options = normalizeHighlightOptions(highlightNonAscii);\n renderedChildren = highlightNonAsciiChars(children, options);\n }\n\n return (\n <StyledText\n as={as}\n {...forwardedProps}\n {...transientProps}\n className={classNames(Text.className, className)}\n ref={ref as RefObject<HTMLDivElement>}\n $as={as}\n $color={color}\n $fontFamily={fontFamily}\n $fontSize={fontSize}\n $fontWeight={fontWeight}\n $lineHeight={lineHeight}\n $noWrap={noWrap}\n $wordBreak={wordBreak}\n $theme={theme}\n $variant={variant}\n >\n {renderedChildren}\n </StyledText>\n );\n});\nText.className = CLASSNAME;\nText.displayName = COMPONENT_NAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","highlightNonAsciiChars","text","options","result","currentAscii","currentNonAscii","keyIndex","chars","Array","from","char","isNonAscii","push","React","createElement","StyledHighlightMarker","key","$font","font","$background","background","replaceInvisibleChars","Text","forwardRef","props","ref","transientProps","otherProps","getStylingTransientProps","as","children","className","color","fontFamily","FontFamily","poppins","fontSize","fontWeight","highlightNonAscii","lineHeight","noWrap","theme","propsTheme","variant","wordBreak","forwardedProps","_objectWithoutProperties","_excluded","useTheme","renderedChildren","normalizeHighlightOptions","StyledText","_extends","classNames","$as","$color","$fontFamily","$fontSize","$fontWeight","$lineHeight","$noWrap","$wordBreak","$theme","$variant","displayName"],"mappings":";;;;;;;;;;AAaA,MAAMA,cAAc,GAAG,MAAM,CAAA;AAC7B,MAAMC,SAAS,GAAG,cAAc,CAAA;;AAEhC;AACA;AACA;AACA;AACA;AACA,MAAMC,sBAAsB,GAAGA,CAACC,IAAY,EAAEC,OAAmC,KAAkB;EACjG,MAAMC,MAAmB,GAAG,EAAE,CAAA;EAC9B,IAAIC,YAAY,GAAG,EAAE,CAAA;EACrB,IAAIC,eAAe,GAAG,EAAE,CAAA;EACxB,IAAIC,QAAQ,GAAG,CAAC,CAAA;;AAEhB;AACA,EAAA,MAAMC,KAAK,GAAGC,KAAK,CAACC,IAAI,CAACR,IAAI,CAAC,CAAA;AAE9B,EAAA,KAAK,MAAMS,IAAI,IAAIH,KAAK,EAAE;AACxB,IAAA,IAAII,UAAU,CAACD,IAAI,CAAC,EAAE;AACpB;AACA,MAAA,IAAIN,YAAY,EAAE;AAChBD,QAA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pBsB,IAAAA,WAAW,EAAErB,UAAW;AACxBsB,IAAAA,WAAW,EAAEpB,UAAW;AACxBqB,IAAAA,OAAO,EAAEpB,MAAO;AAChBqB,IAAAA,UAAU,EAAEjB,SAAU;AACtBkB,IAAAA,MAAM,EAAErB,KAAM;AACdsB,IAAAA,QAAQ,EAAEpB,OAAAA;AAAQ,GAAA,CAAA,EAEjBM,gBACS,CAAC,CAAA;AAEjB,CAAC,EAAC;AACF3B,IAAI,CAACS,SAAS,GAAGhC,SAAS,CAAA;AAC1BuB,IAAI,CAAC0C,WAAW,GAAGlE,cAAc;;;;"}
1
+ {"version":3,"file":"Text2.js","sources":["../../src/components/text/Text.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode, RefObject } from 'react';\nimport classNames from 'classnames';\nimport { Comp, FontFamily, getStylingTransientProps } from '../../types';\nimport { StyledText, StyledHighlightMarker } from './styles';\nimport { TextProps } from './types';\nimport { useTheme } from '../theme';\nimport { warnOnAliasProps } from '../../utils/warnAliasProps';\nimport {\n isNonAscii,\n replaceInvisibleChars,\n normalizeHighlightOptions,\n NormalizedHighlightOptions,\n} from '../../utils/highlightNonAscii';\n\nconst COMPONENT_NAME = 'Text';\nconst CLASSNAME = 'redsift-text';\n\nconst TEXT_ALIAS_WARNINGS = [\n { prop: 'kind', use: 'variant' },\n { prop: 'appearance', use: 'variant' },\n { prop: 'size', use: 'fontSize', hint: 'Text uses fontSize / variant for sizing.' },\n { prop: 'weight', use: 'fontWeight' },\n { prop: 'level', use: 'as', hint: 'For headings (h1-h6) use the Heading component, not Text.' },\n { prop: 'tag', use: 'as' },\n { prop: 'slot', use: 'children', hint: 'Text does not implement a slot API; pass content as children.' },\n];\n\n/**\n * Processes a string and wraps consecutive non-ASCII characters in highlight markers.\n * Groups consecutive non-ASCII characters to minimize DOM nodes.\n * Invisible characters are replaced with visible indicators (•).\n */\nconst highlightNonAsciiChars = (text: string, options: NormalizedHighlightOptions): ReactNode[] => {\n const result: ReactNode[] = [];\n let currentAscii = '';\n let currentNonAscii = '';\n let keyIndex = 0;\n\n // Use Array.from to correctly handle Unicode surrogate pairs (e.g., emojis)\n const chars = Array.from(text);\n\n for (const char of chars) {\n if (isNonAscii(char)) {\n // Flush ASCII buffer\n if (currentAscii) {\n result.push(currentAscii);\n currentAscii = '';\n }\n currentNonAscii += char;\n } else {\n // Flush non-ASCII buffer\n if (currentNonAscii) {\n result.push(\n <StyledHighlightMarker key={keyIndex++} $font={options.font} $background={options.background}>\n {replaceInvisibleChars(currentNonAscii)}\n </StyledHighlightMarker>\n );\n currentNonAscii = '';\n }\n currentAscii += char;\n }\n }\n\n // Flush remaining buffers\n if (currentAscii) {\n result.push(currentAscii);\n }\n if (currentNonAscii) {\n result.push(\n <StyledHighlightMarker key={keyIndex} $font={options.font} $background={options.background}>\n {replaceInvisibleChars(currentNonAscii)}\n </StyledHighlightMarker>\n );\n }\n\n return result;\n};\n\n/**\n * Text renders text content with consistent styling. By default renders a\n * `<span>` but can be changed via the `as` prop.\n *\n * Variants: `body`, `button`, `caption`, `inherit`\n * Semantic elements: `span` (default), `p`, `b`, `i`, `u`, `abbr`, `cite`,\n * `del`, `em`, `ins`, `kbd`, `mark`, `s`, `samp`, `sub`, `sup`\n *\n * @example\n * // Basic text\n * <Text>Hello world</Text>\n *\n * @example\n * // Typography variants\n * <Text variant=\"body\">Body text for paragraphs</Text>\n * <Text variant=\"button\">Button-style text</Text>\n * <Text variant=\"caption\">Small caption text</Text>\n *\n * @example\n * // Semantic elements\n * <Text as=\"p\">Paragraph element</Text>\n * <Text as=\"b\">Bold text</Text>\n * <Text as=\"em\">Emphasized text</Text>\n * <Text as=\"mark\">Highlighted text</Text>\n * <Text as=\"kbd\">Keyboard input</Text>\n *\n * @example\n * // Custom styling\n * <Text color=\"grey\" fontSize=\"14px\" fontWeight={600}>Custom styled</Text>\n *\n * @example\n * // Truncated text with ellipsis\n * <Text noWrap>Very long text that will be truncated with ellipsis...</Text>\n *\n * @example\n * // Caption with color\n * <Text variant=\"caption\" color=\"grey\">Last updated: Jan 2024</Text>\n *\n * @example\n * // Highlight non-ASCII characters (useful for IDN domain names)\n * <Text highlightNonAscii>ƅankofamerica.com</Text>\n */\nexport const Text: Comp<TextProps, HTMLDivElement> = forwardRef((props, ref) => {\n warnOnAliasProps(COMPONENT_NAME, props as unknown as Record<string, unknown>, TEXT_ALIAS_WARNINGS);\n const { transientProps, otherProps } = getStylingTransientProps(props);\n\n const {\n as,\n children,\n className,\n color,\n fontFamily = FontFamily.poppins,\n fontSize,\n fontWeight,\n highlightNonAscii,\n lineHeight,\n noWrap,\n theme: propsTheme,\n variant,\n wordBreak,\n ...forwardedProps\n } = otherProps;\n\n const theme = useTheme(propsTheme);\n\n // Process children to highlight non-ASCII characters if enabled and children is a string\n let renderedChildren = children;\n if (highlightNonAscii && typeof children === 'string') {\n const options = normalizeHighlightOptions(highlightNonAscii);\n renderedChildren = highlightNonAsciiChars(children, options);\n }\n\n return (\n <StyledText\n as={as}\n {...forwardedProps}\n {...transientProps}\n className={classNames(Text.className, className)}\n ref={ref as RefObject<HTMLDivElement>}\n $as={as}\n $color={color}\n $fontFamily={fontFamily}\n $fontSize={fontSize}\n $fontWeight={fontWeight}\n $lineHeight={lineHeight}\n $noWrap={noWrap}\n $wordBreak={wordBreak}\n $theme={theme}\n $variant={variant}\n >\n {renderedChildren}\n </StyledText>\n );\n});\nText.className = CLASSNAME;\nText.displayName = COMPONENT_NAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","TEXT_ALIAS_WARNINGS","prop","use","hint","highlightNonAsciiChars","text","options","result","currentAscii","currentNonAscii","keyIndex","chars","Array","from","char","isNonAscii","push","React","createElement","StyledHighlightMarker","key","$font","font","$background","background","replaceInvisibleChars","Text","forwardRef","props","ref","warnOnAliasProps","transientProps","otherProps","getStylingTransientProps","as","children","className","color","fontFamily","FontFamily","poppins","fontSize","fontWeight","highlightNonAscii","lineHeight","noWrap","theme","propsTheme","variant","wordBreak","forwardedProps","_objectWithoutProperties","_excluded","useTheme","renderedChildren","normalizeHighlightOptions","StyledText","_extends","classNames","$as","$color","$fontFamily","$fontSize","$fontWeight","$lineHeight","$noWrap","$wordBreak","$theme","$variant","displayName"],"mappings":";;;;;;;;;;;AAcA,MAAMA,cAAc,GAAG,MAAM,CAAA;AAC7B,MAAMC,SAAS,GAAG,cAAc,CAAA;AAEhC,MAAMC,mBAAmB,GAAG,CAC1B;AAAEC,EAAAA,IAAI,EAAE,MAAM;AAAEC,EAAAA,GAAG,EAAE,SAAA;AAAU,CAAC,EAChC;AAAED,EAAAA,IAAI,EAAE,YAAY;AAAEC,EAAAA,GAAG,EAAE,SAAA;AAAU,CAAC,EACtC;AAAED,EAAAA,IAAI,EAAE,MAAM;AAAEC,EAAAA,GAAG,EAAE,UAAU;AAAEC,EAAAA,IAAI,EAAE,0CAAA;AAA2C,CAAC,EACnF;AAAEF,EAAAA,IAAI,EAAE,QAAQ;AAAEC,EAAAA,GAAG,EAAE,YAAA;AAAa,CAAC,EACrC;AAAED,EAAAA,IAAI,EAAE,OAAO;AAAEC,EAAAA,GAAG,EAAE,IAAI;AAAEC,EAAAA,IAAI,EAAE,2DAAA;AAA4D,CAAC,EAC/F;AAAEF,EAAAA,IAAI,EAAE,KAAK;AAAEC,EAAAA,GAAG,EAAE,IAAA;AAAK,CAAC,EAC1B;AAAED,EAAAA,IAAI,EAAE,MAAM;AAAEC,EAAAA,GAAG,EAAE,UAAU;AAAEC,EAAAA,IAAI,EAAE,+DAAA;AAAgE,CAAC,CACzG,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,sBAAsB,GAAGA,CAACC,IAAY,EAAEC,OAAmC,KAAkB;EACjG,MAAMC,MAAmB,GAAG,EAAE,CAAA;EAC9B,IAAIC,YAAY,GAAG,EAAE,CAAA;EACrB,IAAIC,eAAe,GAAG,EAAE,CAAA;EACxB,IAAIC,QAAQ,GAAG,CAAC,CAAA;;AAEhB;AACA,EAAA,MAAMC,KAAK,GAAGC,KAAK,CA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Ac,EAAA;IAClBK,SAAS,EAAEsB,UAAU,CAAChC,IAAI,CAACU,SAAS,EAAEA,SAAS,CAAE;AACjDP,IAAAA,GAAG,EAAEA,GAAiC;AACtC8B,IAAAA,GAAG,EAAEzB,EAAG;AACR0B,IAAAA,MAAM,EAAEvB,KAAM;AACdwB,IAAAA,WAAW,EAAEvB,UAAW;AACxBwB,IAAAA,SAAS,EAAErB,QAAS;AACpBsB,IAAAA,WAAW,EAAErB,UAAW;AACxBsB,IAAAA,WAAW,EAAEpB,UAAW;AACxBqB,IAAAA,OAAO,EAAEpB,MAAO;AAChBqB,IAAAA,UAAU,EAAEjB,SAAU;AACtBkB,IAAAA,MAAM,EAAErB,KAAM;AACdsB,IAAAA,QAAQ,EAAEpB,OAAAA;AAAQ,GAAA,CAAA,EAEjBM,gBACS,CAAC,CAAA;AAEjB,CAAC,EAAC;AACF5B,IAAI,CAACU,SAAS,GAAGrC,SAAS,CAAA;AAC1B2B,IAAI,CAAC2C,WAAW,GAAGvE,cAAc;;;;"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Dev-mode warning when a known mis-aliased prop is passed to a primitive.
3
+ *
4
+ * Catches the common SOFA-6 / ODM-2933 failure mode where AI agents pass
5
+ * props from other UI libraries (Chakra `kind`, Mantine `appearance`,
6
+ * MUI `level`, etc.) that are HTML-valid (so React doesn't warn) but
7
+ * silently ignored by the DS primitive.
8
+ *
9
+ * Each (component, propName) pair warns once per session.
10
+ */
11
+
12
+ const seen = new Set();
13
+ /**
14
+ * Warn (once) for any prop in `props` that matches an entry in `aliases`.
15
+ *
16
+ * @param componentName Component name used in the warning message.
17
+ * @param props The component's runtime props (post-destructure spread).
18
+ * @param aliases Known mis-aliased prop entries.
19
+ */
20
+ function warnOnAliasProps(componentName, props, aliases) {
21
+ if (process.env.NODE_ENV === 'production') return;
22
+ if (!props) return;
23
+ for (const {
24
+ prop,
25
+ use,
26
+ hint
27
+ } of aliases) {
28
+ if (!(prop in props)) continue;
29
+ const key = `${componentName}:${prop}`;
30
+ if (seen.has(key)) continue;
31
+ seen.add(key);
32
+ const tail = hint ? ` ${hint}` : '';
33
+ console.error(`[${componentName}] Unknown prop \`${prop}\` — did you mean \`${use}\`? ` + `${componentName} does not accept \`${prop}\`; the value will be passed through to the DOM.${tail}`);
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Reset the warn-once cache. Test-only.
39
+ * @internal
40
+ */
41
+ function __resetAliasWarnings() {
42
+ seen.clear();
43
+ }
44
+
45
+ export { __resetAliasWarnings as _, warnOnAliasProps as w };
46
+ //# sourceMappingURL=warnAliasProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warnAliasProps.js","sources":["../../src/utils/warnAliasProps.ts"],"sourcesContent":["/**\n * Dev-mode warning when a known mis-aliased prop is passed to a primitive.\n *\n * Catches the common SOFA-6 / ODM-2933 failure mode where AI agents pass\n * props from other UI libraries (Chakra `kind`, Mantine `appearance`,\n * MUI `level`, etc.) that are HTML-valid (so React doesn't warn) but\n * silently ignored by the DS primitive.\n *\n * Each (component, propName) pair warns once per session.\n */\n\nconst seen = new Set<string>();\n\nexport type AliasWarning = {\n /** Prop name to detect (e.g. `direction`). */\n prop: string;\n /** Suggested correct prop name (e.g. `flexDirection`). */\n use: string;\n /** Optional extra context appended to the warning. */\n hint?: string;\n};\n\n/**\n * Warn (once) for any prop in `props` that matches an entry in `aliases`.\n *\n * @param componentName Component name used in the warning message.\n * @param props The component's runtime props (post-destructure spread).\n * @param aliases Known mis-aliased prop entries.\n */\nexport function warnOnAliasProps(componentName: string, props: Record<string, unknown>, aliases: AliasWarning[]): void {\n if (process.env.NODE_ENV === 'production') return;\n if (!props) return;\n\n for (const { prop, use, hint } of aliases) {\n if (!(prop in props)) continue;\n const key = `${componentName}:${prop}`;\n if (seen.has(key)) continue;\n seen.add(key);\n const tail = hint ? ` ${hint}` : '';\n console.error(\n `[${componentName}] Unknown prop \\`${prop}\\` — did you mean \\`${use}\\`? ` +\n `${componentName} does not accept \\`${prop}\\`; the value will be passed through to the DOM.${tail}`\n );\n }\n}\n\n/**\n * Reset the warn-once cache. Test-only.\n * @internal\n */\nexport function __resetAliasWarnings(): void {\n seen.clear();\n}\n"],"names":["seen","Set","warnOnAliasProps","componentName","props","aliases","process","env","NODE_ENV","prop","use","hint","key","has","add","tail","console","error","__resetAliasWarnings","clear"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,IAAI,GAAG,IAAIC,GAAG,EAAU,CAAA;AAW9B;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,gBAAgBA,CAACC,aAAqB,EAAEC,KAA8B,EAAEC,OAAuB,EAAQ;AACrH,EAAA,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE,OAAA;EAC3C,IAAI,CAACJ,KAAK,EAAE,OAAA;AAEZ,EAAA,KAAK,MAAM;IAAEK,IAAI;IAAEC,GAAG;AAAEC,IAAAA,IAAAA;GAAM,IAAIN,OAAO,EAAE;AACzC,IAAA,IAAI,EAAEI,IAAI,IAAIL,KAAK,CAAC,EAAE,SAAA;AACtB,IAAA,MAAMQ,GAAG,GAAI,CAAA,EAAET,aAAc,CAAA,CAAA,EAAGM,IAAK,CAAC,CAAA,CAAA;AACtC,IAAA,IAAIT,IAAI,CAACa,GAAG,CAACD,GAAG,CAAC,EAAE,SAAA;AACnBZ,IAAAA,IAAI,CAACc,GAAG,CAACF,GAAG,CAAC,CAAA;IACb,MAAMG,IAAI,GAAGJ,IAAI,GAAI,IAAGA,IAAK,CAAA,CAAC,GAAG,EAAE,CAAA;AACnCK,IAAAA,OAAO,CAACC,KAAK,CACV,IAAGd,aAAc,CAAA,iBAAA,EAAmBM,IAAK,CAAsBC,oBAAAA,EAAAA,GAAI,CAAK,IAAA,CAAA,GACtE,GAAEP,aAAc,CAAA,mBAAA,EAAqBM,IAAK,CAAkDM,gDAAAA,EAAAA,IAAK,EACtG,CAAC,CAAA;AACH,GAAA;AACF,CAAA;;AAEA;AACA;AACA;AACA;AACO,SAASG,oBAAoBA,GAAS;EAC3ClB,IAAI,CAACmB,KAAK,EAAE,CAAA;AACd;;;;"}
@@ -0,0 +1,55 @@
1
+ import React__default from 'react';
2
+
3
+ /**
4
+ * Walk children and warn if any child has a displayName in the restricted set.
5
+ * Used to detect nesting of compound sub-components inside each other.
6
+ *
7
+ * @example
8
+ * // Inside DataCard, check that Body/Listbox don't contain other sub-components
9
+ * warnOnNestedSubComponents(bodyChildren, 'DataCard', 'DataCardBody', SUB_NAMES);
10
+ */
11
+ function warnOnNestedSubComponents(children, componentName, parentName, restrictedDisplayNames) {
12
+ if (process.env.NODE_ENV === 'production') return;
13
+ React__default.Children.forEach(children, child => {
14
+ var _child$type;
15
+ if (! /*#__PURE__*/React__default.isValidElement(child)) return;
16
+ const childDisplayName = (_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName;
17
+ if (childDisplayName && restrictedDisplayNames.has(childDisplayName)) {
18
+ console.error(`[${componentName}] <${childDisplayName}> was rendered inside <${parentName}>. ` + `${componentName} sub-components must be direct children of <${componentName}>, ` + 'not nested inside each other.');
19
+ }
20
+ });
21
+ }
22
+
23
+ /**
24
+ * Walk children and warn if any child's displayName is NOT in the allowed set.
25
+ * Used for components that silently drop unrecognised children (e.g. Card, Breadcrumbs).
26
+ * Fragments, nulls, strings, and numbers are ignored.
27
+ */
28
+ function warnOnUnknownChildren(children, componentName, allowedDisplayNames) {
29
+ if (process.env.NODE_ENV === 'production') return;
30
+ React__default.Children.forEach(children, child => {
31
+ var _child$type2;
32
+ if (! /*#__PURE__*/React__default.isValidElement(child)) return;
33
+ // Skip fragments — they're a transparent grouping mechanism
34
+ if (child.type === React__default.Fragment) return;
35
+ const childDisplayName = (_child$type2 = child.type) === null || _child$type2 === void 0 ? void 0 : _child$type2.displayName;
36
+ if (!childDisplayName || !allowedDisplayNames.has(childDisplayName)) {
37
+ const label = childDisplayName || (typeof child.type === 'string' ? child.type : 'unknown');
38
+ console.error(`[${componentName}] Unexpected child <${label}> will be ignored. ` + `${componentName} only accepts these sub-components as children: ` + `${[...allowedDisplayNames].join(', ')}.`);
39
+ }
40
+ });
41
+ }
42
+
43
+ /**
44
+ * Warn when a sub-component is rendered outside its required parent.
45
+ * Call from the sub-component after reading its context.
46
+ */
47
+ function warnOnMissingContext(contextValue, componentName, parentName) {
48
+ if (process.env.NODE_ENV === 'production') return;
49
+ if (contextValue === null || contextValue === undefined) {
50
+ console.error(`[${componentName}] <${componentName}> was rendered outside of <${parentName}>. ` + `${componentName} must be a child of ${parentName} to function correctly.`);
51
+ }
52
+ }
53
+
54
+ export { warnOnUnknownChildren as a, warnOnMissingContext as b, warnOnNestedSubComponents as w };
55
+ //# sourceMappingURL=warnCompoundMisuse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warnCompoundMisuse.js","sources":["../../src/utils/warnCompoundMisuse.ts"],"sourcesContent":["import React from 'react';\n\n/**\n * Walk children and warn if any child has a displayName in the restricted set.\n * Used to detect nesting of compound sub-components inside each other.\n *\n * @example\n * // Inside DataCard, check that Body/Listbox don't contain other sub-components\n * warnOnNestedSubComponents(bodyChildren, 'DataCard', 'DataCardBody', SUB_NAMES);\n */\nexport function warnOnNestedSubComponents(\n children: React.ReactNode,\n componentName: string,\n parentName: string,\n restrictedDisplayNames: Set<string>\n): void {\n if (process.env.NODE_ENV === 'production') return;\n\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement(child)) return;\n\n const childDisplayName = (child.type as any)?.displayName;\n if (childDisplayName && restrictedDisplayNames.has(childDisplayName)) {\n console.error(\n `[${componentName}] <${childDisplayName}> was rendered inside <${parentName}>. ` +\n `${componentName} sub-components must be direct children of <${componentName}>, ` +\n 'not nested inside each other.'\n );\n }\n });\n}\n\n/**\n * Walk children and warn if any child's displayName is NOT in the allowed set.\n * Used for components that silently drop unrecognised children (e.g. Card, Breadcrumbs).\n * Fragments, nulls, strings, and numbers are ignored.\n */\nexport function warnOnUnknownChildren(\n children: React.ReactNode,\n componentName: string,\n allowedDisplayNames: Set<string>\n): void {\n if (process.env.NODE_ENV === 'production') return;\n\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement(child)) return;\n // Skip fragments — they're a transparent grouping mechanism\n if (child.type === React.Fragment) return;\n\n const childDisplayName = (child.type as any)?.displayName;\n if (!childDisplayName || !allowedDisplayNames.has(childDisplayName)) {\n const label = childDisplayName || (typeof child.type === 'string' ? child.type : 'unknown');\n console.error(\n `[${componentName}] Unexpected child <${label}> will be ignored. ` +\n `${componentName} only accepts these sub-components as children: ` +\n `${[...allowedDisplayNames].join(', ')}.`\n );\n }\n });\n}\n\n/**\n * Warn when a sub-component is rendered outside its required parent.\n * Call from the sub-component after reading its context.\n */\nexport function warnOnMissingContext(contextValue: unknown, componentName: string, parentName: string): void {\n if (process.env.NODE_ENV === 'production') return;\n\n if (contextValue === null || contextValue === undefined) {\n console.error(\n `[${componentName}] <${componentName}> was rendered outside of <${parentName}>. ` +\n `${componentName} must be a child of ${parentName} to function correctly.`\n );\n }\n}\n"],"names":["warnOnNestedSubComponents","children","componentName","parentName","restrictedDisplayNames","process","env","NODE_ENV","React","Children","forEach","child","_child$type","isValidElement","childDisplayName","type","displayName","has","console","error","warnOnUnknownChildren","allowedDisplayNames","_child$type2","Fragment","label","join","warnOnMissingContext","contextValue","undefined"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,yBAAyBA,CACvCC,QAAyB,EACzBC,aAAqB,EACrBC,UAAkB,EAClBC,sBAAmC,EAC7B;AACN,EAAA,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE,OAAA;EAE3CC,cAAK,CAACC,QAAQ,CAACC,OAAO,CAACT,QAAQ,EAAGU,KAAK,IAAK;AAAA,IAAA,IAAAC,WAAA,CAAA;AAC1C,IAAA,IAAI,eAACJ,cAAK,CAACK,cAAc,CAACF,KAAK,CAAC,EAAE,OAAA;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