@ntbjs/react-components 3.0.0-rc.1 → 3.0.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/README.md +34 -0
  2. package/build/data/Alert/Alert.js.map +1 -1
  3. package/build/data/Alert/Alert.styled.js.map +1 -1
  4. package/build/data/Badge/Badge.js.map +1 -1
  5. package/build/data/Badge/Badge.styled.js.map +1 -1
  6. package/build/data/Popover/Popover.js.map +1 -1
  7. package/build/data/Popover/Popover.styled.js.map +1 -1
  8. package/build/data/SeverityBadge/SeverityBadge.js.map +1 -1
  9. package/build/data/Tab/Tab.js.map +1 -1
  10. package/build/data/Tab/Tab.styled.js.map +1 -1
  11. package/build/data/Tabs/Tabs.js.map +1 -1
  12. package/build/data/Tabs/Tabs.styled.js.map +1 -1
  13. package/build/data/Tooltip/Tooltip.js.map +1 -1
  14. package/build/data/Tooltip/Tooltip.styled.js.map +1 -1
  15. package/build/data/VerificationStatusIcon/VerificationStatusIcon.js.map +1 -1
  16. package/build/data/VerificationStatusIcon/VerificationStatusIcon.styled.js.map +1 -1
  17. package/build/data/_shared/FloatingArrow.styled.js.map +1 -1
  18. package/build/hooks/useEventListner.js.map +1 -1
  19. package/build/hooks/useFloatingPopover.js.map +1 -1
  20. package/build/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  21. package/build/hooks/useOnClickOutside.js.map +1 -1
  22. package/build/hooks/useTooltipAutoShow.js.map +1 -1
  23. package/build/inputs/ActionButton/ActionButton.js.map +1 -1
  24. package/build/inputs/ActionButton/ActionButton.styled.js.map +1 -1
  25. package/build/inputs/Button/Button.js.map +1 -1
  26. package/build/inputs/Button/Button.styled.js.map +1 -1
  27. package/build/inputs/Checkbox/Checkbox.js.map +1 -1
  28. package/build/inputs/Checkbox/Checkbox.styled.js.map +1 -1
  29. package/build/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.js.map +1 -1
  30. package/build/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.styled.js.map +1 -1
  31. package/build/inputs/CompactStarRating/CompactStarRating.js.map +1 -1
  32. package/build/inputs/CompactStarRating/CompactStarRating.styled.js.map +1 -1
  33. package/build/inputs/CompactTextInput/CompactTextInput.js.map +1 -1
  34. package/build/inputs/CompactTextInput/CompactTextInput.styled.js.map +1 -1
  35. package/build/inputs/MultiLevelCheckbox/MultiLevelCheckbox.js.map +1 -1
  36. package/build/inputs/MultiLevelCheckbox/MultiLevelCheckbox.styled.js.map +1 -1
  37. package/build/inputs/MultiLevelCheckbox/types.js.map +1 -1
  38. package/build/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.js.map +1 -1
  39. package/build/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.styled.js.map +1 -1
  40. package/build/inputs/MultiSelect/MultiSelect.js.map +1 -1
  41. package/build/inputs/MultiSelect/MultiSelect.styled.js.map +1 -1
  42. package/build/inputs/Radio/Radio.js.map +1 -1
  43. package/build/inputs/Radio/Radio.styled.js.map +1 -1
  44. package/build/inputs/Switch/Switch.styled.js.map +1 -1
  45. package/build/inputs/TextArea/TextArea.js.map +1 -1
  46. package/build/inputs/TextArea/TextArea.styled.js.map +1 -1
  47. package/build/inputs/TextInput/TextInput.js.map +1 -1
  48. package/build/inputs/TextInput/TextInput.styled.js.map +1 -1
  49. package/build/layout/InputGroup/InputGroup.js.map +1 -1
  50. package/build/layout/InputGroup/InputGroup.styled.js.map +1 -1
  51. package/build/layout/SectionSeparator/SectionSeparator.js.map +1 -1
  52. package/build/layout/SectionSeparator/SectionSeparator.styled.js.map +1 -1
  53. package/build/styles/utils/colors-export.d.ts +6 -25
  54. package/build/utils/dateTime.js.map +1 -1
  55. package/build/utils/defaultTheme.js.map +1 -1
  56. package/build/utils/getElementRef.js.map +1 -1
  57. package/build/utils/parseTrigger.js.map +1 -1
  58. package/build/widgets/AssetAction/AssetAction.js.map +1 -1
  59. package/build/widgets/AssetAction/AssetAction.styled.js.map +1 -1
  60. package/build/widgets/AssetActionsBase/AssetActionsBase.js.map +1 -1
  61. package/build/widgets/AssetActionsBase/AssetActionsBase.styled.js.map +1 -1
  62. package/build/widgets/AssetGallery/AssetGallery.js.map +1 -1
  63. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.js.map +1 -1
  64. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.styled.js.map +1 -1
  65. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.js.map +1 -1
  66. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.js.map +1 -1
  67. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.js.map +1 -1
  68. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.styled.js.map +1 -1
  69. package/build/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.js.map +1 -1
  70. package/build/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.styled.js.map +1 -1
  71. package/build/widgets/ContextMenu/ContextMenu.js.map +1 -1
  72. package/build/widgets/ContextMenu/ContextMenu.styled.js.map +1 -1
  73. package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.js.map +1 -1
  74. package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.styled.js.map +1 -1
  75. package/build/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.js.map +1 -1
  76. package/build/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.styled.js.map +1 -1
  77. package/build/widgets/InfoCard/InfoCard.js.map +1 -1
  78. package/build/widgets/InfoCard/InfoCard.styled.js.map +1 -1
  79. package/build/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.js.map +1 -1
  80. package/build/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.styled.js.map +1 -1
  81. package/build/widgets/Instructions/Instructions.js.map +1 -1
  82. package/build/widgets/Instructions/Instructions.styled.js.map +1 -1
  83. package/build/widgets/ProgressBar/ProgressBar.js.map +1 -1
  84. package/build/widgets/ProgressBar/ProgressBar.styled.js.map +1 -1
  85. package/build/widgets/SummaryCard/SummaryCard.js.map +1 -1
  86. package/build/widgets/SummaryCard/SummaryCard.styled.js.map +1 -1
  87. package/package.json +8 -1
  88. package/styles/utils/colors-export.d.ts +6 -25
  89. package/types/components/data/Alert/Alert.styled.d.ts +6 -37
  90. package/types/components/data/Badge/Badge.d.ts +1 -9
  91. package/types/components/data/Badge/Badge.styled.d.ts +0 -99
  92. package/types/components/data/Popover/Popover.d.ts +11 -100
  93. package/types/components/data/Tab/Tab.d.ts +1 -14
  94. package/types/components/data/Tabs/Tabs.styled.d.ts +1 -17
  95. package/types/components/data/Tooltip/Tooltip.d.ts +4 -50
  96. package/types/components/data/VerificationStatusIcon/VerificationStatusIcon.styled.d.ts +3 -22
  97. package/types/components/data/_shared/FloatingArrow.styled.d.ts +1 -101
  98. package/types/components/inputs/ActionButton/ActionButton.styled.d.ts +2 -20
  99. package/types/components/inputs/Button/Button.styled.d.ts +0 -42
  100. package/types/components/inputs/Checkbox/Checkbox.d.ts +0 -9
  101. package/types/components/inputs/Checkbox/Checkbox.styled.d.ts +6 -10
  102. package/types/components/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.styled.d.ts +4 -57
  103. package/types/components/inputs/CompactStarRating/CompactStarRating.styled.d.ts +3 -55
  104. package/types/components/inputs/CompactTextInput/CompactTextInput.styled.d.ts +4 -32
  105. package/types/components/inputs/MultiLevelCheckbox/MultiLevelCheckbox.styled.d.ts +2 -10
  106. package/types/components/inputs/MultiLevelCheckbox/types.d.ts +3 -46
  107. package/types/components/inputs/MultiSelect/MultiSelect.d.ts +0 -57
  108. package/types/components/inputs/MultiSelect/MultiSelect.styled.d.ts +0 -65
  109. package/types/components/inputs/Radio/Radio.styled.d.ts +3 -3
  110. package/types/components/inputs/Switch/Switch.styled.d.ts +3 -7
  111. package/types/components/inputs/TextArea/TextArea.d.ts +0 -4
  112. package/types/components/inputs/TextArea/TextArea.styled.d.ts +5 -7
  113. package/types/components/inputs/TextInput/TextInput.styled.d.ts +1 -1
  114. package/types/components/layout/SectionSeparator/SectionSeparator.styled.d.ts +2 -9
  115. package/types/components/widgets/AssetAction/AssetAction.styled.d.ts +2 -7
  116. package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.d.ts +0 -12
  117. package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.d.ts +7 -55
  118. package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.styled.d.ts +7 -43
  119. package/types/components/widgets/AssetGallery/asset.types.d.ts +31 -148
  120. package/types/components/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.styled.d.ts +6 -20
  121. package/types/components/widgets/ContextMenu/ContextMenu.d.ts +1 -17
  122. package/types/components/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.styled.d.ts +5 -13
  123. package/types/components/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.d.ts +0 -18
  124. package/types/components/widgets/InfoCard/InfoCard.styled.d.ts +2 -19
  125. package/types/components/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.styled.d.ts +9 -19
  126. package/types/components/widgets/Instructions/Instructions.styled.d.ts +2 -14
  127. package/types/components/widgets/ProgressBar/ProgressBar.styled.d.ts +6 -43
  128. package/types/components/widgets/SummaryCard/SummaryCard.styled.d.ts +7 -46
  129. package/types/hooks/useElementSize.d.ts +3 -14
  130. package/types/hooks/useEventListner.d.ts +6 -38
  131. package/types/hooks/useFloatingPopover.d.ts +9 -90
  132. package/types/hooks/useIsomorphicLayoutEffect.d.ts +0 -23
  133. package/types/hooks/useOnClickOutside.d.ts +5 -23
  134. package/types/hooks/useTooltipAutoShow.d.ts +8 -57
  135. package/types/styles/utils/colors-export.d.ts +6 -25
  136. package/types/utils/dateTime.d.ts +2 -7
  137. package/types/utils/defaultTheme.d.ts +13 -92
  138. package/types/utils/getElementRef.d.ts +0 -19
  139. package/types/utils/parseTrigger.d.ts +8 -78
@@ -8,122 +8,22 @@ import type { NtbTheme } from '../../../utils/defaultTheme';
8
8
  * `Tooltip.styled.ts` sets `background: gray-700` unconditionally and has no border.
9
9
  */
10
10
  export type FloatingArrowSurface = 'popover' | 'tooltip';
11
- /**
12
- * THE ARROW'S GEOMETRY, PER SURFACE — and the numbers are derived, not chosen.
13
- *
14
- * `height` is how far the arrow protrudes from the floating element, because
15
- * `FloatingArrow` positions its `<svg>` at `[side]: '100%'`. It is therefore the term
16
- * `useFloatingPopover` adds to the main-axis offset, which is why the popover height is
17
- * IMPORTED from there rather than written twice: the offset maths and the rendered
18
- * triangle must be the same number or the arrow sits at the wrong gap.
19
- *
20
- * `popover` — from `Popover.styled.ts`'s override, `border-width: 15px 13px 0`: a triangle
21
- * 15px tall on a 13+13 = **26px** base. The full derivation, including why the `+15` in
22
- * `Popover.tsx` was never a fudge, is on `DEFAULT_ARROW_HEIGHT`.
23
- *
24
- * `tooltip` — `Tooltip.styled.ts` never overrode the geometry, so the numbers come from
25
- * `tippy.js/dist/tippy.css`, and they are the **VISIBLE** triangle rather than the declared
26
- * one. THE ONE PIXEL THE FIRST DRAFT OF THIS COMMENT CALLED UNAVOIDABLE IS NOT: it
27
- * disappears once the hidden part of tippy's triangle is subtracted instead of being
28
- * carried. The measurement, from the four rules that describe a top-placed tooltip arrow:
29
- *
30
- * .tippy-arrow { width: 16px; height: 16px }
31
- * .tippy-box[data-placement^=top] > .tippy-arrow { bottom: 0 }
32
- * .tippy-box[data-placement^=top] > .tippy-arrow:before {
33
- * bottom: -7px; border-width: 8px 8px 0 }
34
- *
35
- * 1. The 16x16 arrow box sits with its bottom edge ON the box's bottom edge.
36
- * 2. The `:before` border-triangle is 8px tall on a 16px base, positioned `bottom: -7px`,
37
- * so its apex is 7px OUTSIDE the box and its 16px-wide base is 1px INSIDE it.
38
- * 3. Therefore only 7 of the 8px are ever visible, and at the box edge — 1px down from a
39
- * 16px base on an 8px triangle — the triangle has already narrowed to
40
- * 16 x (1 - 1/8) = **14px**.
41
- * 4. So the triangle a user sees is **14px wide at the box edge and 7px tall**, which is
42
- * `FloatingArrow`'s own default geometry, and `FloatingArrow` overlapping nothing is
43
- * exactly right: there is nothing to overlap. The 1px tippy hides is the same
44
- * `gray-700` as the box behind it (this surface has no border), so it was never
45
- * contributing a pixel.
46
- *
47
- * The offset that goes with it is tippy's own default `[0, 10]` passed straight through,
48
- * with `arrowHeight: 0` handed to `useFloatingPopover` — see the block comment at
49
- * `TOOLTIP_OFFSET` in `Tooltip.tsx`, which is where the reason that `Tooltip` does NOT add
50
- * the arrow height while `Popover` does is written down. Box 10px out, tip 3px out, in both
51
- * implementations.
52
- *
53
- * `strokeWidth` is `FloatingArrow`'s border width in px. `0` means the outline `<path>` is
54
- * not rendered at all, which is why the `tooltip` surface needs no `stroke` rule.
55
- */
56
11
  export declare const POPOVER_ARROW: {
57
12
  readonly width: 26;
58
13
  readonly height: 15;
59
14
  readonly strokeWidth: 1;
60
15
  };
61
- /**
62
- * See `POPOVER_ARROW` — same derivation, from tippy's unmodified default geometry, reduced
63
- * to the part of it that is visible. 14x7 and not 16x8; the numbers coincide with
64
- * `FloatingArrow`'s own defaults, which is a result rather than a shortcut and is why they
65
- * are written out anyway.
66
- */
67
16
  export declare const TOOLTIP_ARROW: {
68
17
  readonly width: 14;
69
18
  readonly height: 7;
70
19
  readonly strokeWidth: 0;
71
20
  };
72
21
  /**
73
- * Props of `SharedFloatingArrow`, i.e. what this file's `.attrs()` callback reads and what
74
- * a call site may set. Both optional per §J.5 — every wrapper spreads `{...props}` onto its
75
- * styled root, and a required transient prop manufactures TS2769 there.
22
+ * Props of `SharedFloatingArrow`. data-arrow-surface reaches DOM (rules select on it); theme is declared for .attrs() callback.
76
23
  */
77
24
  interface FloatingArrowStyleProps {
78
- /**
79
- * styled-components' theme. Declared for the same reason `Popover.styled.ts` declares
80
- * it — this is `styled(ThirdPartyComponent)`, so the outer props are
81
- * `FloatingArrowProps extends React.ComponentPropsWithRef<'svg'>` and nothing in there
82
- * is `theme`. `.attrs(applyDefaultTheme)` fills it in for the interpolations below.
83
- */
84
25
  theme?: NtbTheme;
85
- /**
86
- * Which colour pair to use. NOT `$`-prefixed on purpose: it has to REACH THE DOM,
87
- * because the rules below select on it. `shouldForwardProp` forwards it precisely
88
- * because it does not start with `$`.
89
- *
90
- * Hyphenated, so a call site could pass it without this declaration — TypeScript does
91
- * not excess-property-check JSX attribute names that are not valid identifiers. It is
92
- * declared anyway because the `.attrs()` callback READS it, and a read does need the
93
- * declaration.
94
- */
95
26
  'data-arrow-surface'?: FloatingArrowSurface;
96
27
  }
97
- /**
98
- * The themed arrow. Render it inside the floating element with `context`, `ref` and the
99
- * geometry from `POPOVER_ARROW` / `TOOLTIP_ARROW`:
100
- *
101
- * ```tsx
102
- * <S.SharedFloatingArrow ref={arrowRef} context={context} {...POPOVER_ARROW} />
103
- * ```
104
- *
105
- * `ref` IS REQUIRED BY `FloatingArrow` ITSELF — it warns in development without one and
106
- * the `arrow()` middleware has nothing to measure. `useFloatingPopover` returns the
107
- * matching `arrowRef`.
108
- *
109
- * ================== THE THREE-PATH STRUCTURE, WHICH THE CSS DEPENDS ON ==================
110
- *
111
- * `FloatingArrow` renders, in order (measured in
112
- * `@floating-ui/react/dist/floating-ui.react.esm.js`):
113
- *
114
- * 1. an OUTLINE `<path>`, ONLY when `strokeWidth > 0`, with `fill="none"` and
115
- * `stroke-width: strokeWidth * 2 + 1`;
116
- * 2. the FILL `<path>`, whose `stroke` attribute it sets to the value of the `fill`
117
- * PROP — its way of covering the inner half of (1)'s stroke so a `strokeWidth: 1`
118
- * renders as a 1px border rather than 1.5px;
119
- * 3. a `<clipPath>`, which is not a `<path>`.
120
- *
121
- * We colour by CSS rather than by the `fill`/`stroke` PROPS because the theme is chosen by
122
- * a `body` class at runtime and a prop would have to be computed in JS, which cannot see
123
- * which class is set. That leaves (2)'s `stroke` attribute unset, so the rules below set it
124
- * explicitly — `& > path:last-of-type`, which is (2) whether or not (1) is present.
125
- * Without that rule (2) would INHERIT the CSS `stroke` and the border would read ~1.5px
126
- * instead of the 1px it replaces.
127
- */
128
28
  export declare const SharedFloatingArrow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<Omit<import("@floating-ui/react").FloatingArrowProps, "ref"> & import("react").RefAttributes<SVGSVGElement>, Omit<import("@floating-ui/react").FloatingArrowProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>, FloatingArrowStyleProps>, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<import("@floating-ui/react").FloatingArrowProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>, keyof import("react").Component<any, {}, any>>;
129
29
  export default SharedFloatingArrow;
@@ -1,27 +1,9 @@
1
1
  /**
2
- * Props of the one styled component in this file. Value types from
3
- * `ActionButton.tsx`'s propTypes; all optional per §J.5 — and here that is not
4
- * theoretical, `ActionButton.tsx` spreads `{...props}` onto this root, which is the
5
- * measured TS2769 case.
6
- *
7
- * `disabled` is deliberately ABSENT: it is a real `ButtonHTMLAttributes` member, the
8
- * component passes it, and the template only uses the `&:disabled` CSS pseudo-class
9
- * rather than reading the prop. Nothing to declare. §J.9, first row.
2
+ * Props of the styled ActionButton. `disabled` is absent: it's a real ButtonHTMLAttributes member.
10
3
  */
11
4
  export interface ActionButtonStyleProps {
12
5
  /**
13
- * `actionWidthHeight` — `PropTypes.array`, `[width, height]` in px, defaulted to
14
- * `[40, 40]` BY THE COMPONENT (which is not a default here, so still optional).
15
- * `number[]` rather than `[number, number]`: the propTypes accept any array and the
16
- * template only ever indexes `[0]` and `[1]`.
17
- *
18
- * NOTE FOR THE `strictNullChecks` FLIP: these seven reads are UNGUARDED
19
- * (`props.$actionWidthHeight[0]`, not `props.$actionWidthHeight?.[0]`), unlike every
20
- * other transient prop in the converted files. They compile today because
21
- * `strictNullChecks` is off; when it is turned on at the end of the migration this
22
- * is the site that needs either `?.` plus a fallback or a required prop, and either
23
- * is a behaviour question rather than a typing one — so it is recorded, not changed
24
- * here. (`$backgroundColors` below is already read with `?.`.)
6
+ * Width and height `[width, height]` in px. Unguarded array access—needs `?.` when strictNullChecks flips.
25
7
  */
26
8
  $actionWidthHeight?: number[];
27
9
  /** `backgroundColors` — `PropTypes.arrayOf(PropTypes.string)`, `[dark, light]`. */
@@ -1,57 +1,15 @@
1
1
  import type { ReactNode } from 'react';
2
- /**
3
- * `size` — `PropTypes.oneOf(['x-small', 'small', 'normal', 'large'])`, component default
4
- * `'normal'`. Closed on purpose (§J.6): `Button` and `ButtonContent` compare against
5
- * three of the four members, so a mistyped size is TS2367 rather than a dead branch.
6
- *
7
- * IT HAS NO `$`, AND THAT IS A DEFECT. `size` is not a member of
8
- * `ButtonHTMLAttributes` (it is an `<input>`/`<select>` attribute), which is why the
9
- * five reads of it were TS2339, and `shouldForwardProp` forwards every non-`$` prop —
10
- * so `size="normal"` is on every rendered `<button>` and every `ButtonContent`
11
- * `<div>` today, and both are in the recorded render baseline. Fix = rename `$size` at
12
- * both ends; removes a DOM attribute → C10 with its re-record. §E.4 third case.
13
- */
14
2
  type ButtonSize = 'x-small' | 'small' | 'normal' | 'large';
15
- /**
16
- * `dropdownItems` — `PropTypes.node`, an array of `ContextMenuItem`s.
17
- *
18
- * `ReactNode` and not `boolean`: the templates only ever test it for truthiness, but
19
- * what is passed is the node itself, and recording what the code does is the rule
20
- * (§J.6). It is transient, so it never reaches the DOM.
21
- */
22
3
  type DropdownItems = ReactNode;
23
- /**
24
- * `Button`'s props — nine of them, which is why they are a named interface here rather
25
- * than inline. All optional per §J.5, and here that is load-bearing twice over:
26
- * `Button.tsx` spreads `{...props}` onto this root, and it renders `S.Button` at three
27
- * sites that pass different subsets (only the two dropdown sites pass
28
- * `$singleactiongap`).
29
- *
30
- * `disabled` is deliberately ABSENT: on a `styled.button` it is a genuine
31
- * `ButtonHTMLAttributes` member, so the read at `props.disabled &&` already typechecks
32
- * and the attribute belongs on the element (§J.9, first row).
33
- */
34
4
  export interface ButtonStyleProps {
35
- /** `border` — `PropTypes.number`, default `2`. Interpolated as `${…}px`, so a string
36
- * here would already render `border: 2pxpx solid`. */
37
5
  $border?: number;
38
- /** `secondary` — `PropTypes.bool`. */
39
6
  $secondary?: boolean;
40
- /** `outlined` — `PropTypes.bool`. */
41
7
  $outlined?: boolean;
42
- /** `dropdownItems` — see `DropdownItems`. */
43
8
  $dropdownItems?: DropdownItems;
44
- /** `block` — `PropTypes.bool`, default `false`. Full-width. */
45
9
  $block?: boolean;
46
- /** `size` — see `ButtonSize`. Leaks to the DOM; see there. */
47
10
  size?: ButtonSize;
48
- /** `singleAction` — `PropTypes.bool`, default `false`. */
49
11
  $singleaction?: boolean;
50
- /** `singleActionGap` — `PropTypes.number`, default `34`. Interpolated as `${…}px`.
51
- * Passed only at the two dropdown `S.Button` sites, which is one of the reasons
52
- * every member here is optional. */
53
12
  $singleactiongap?: number;
54
- /** `width` — `PropTypes.number`, the custom `min-width`, interpolated as `${…}px`. */
55
13
  $width?: number;
56
14
  }
57
15
  export declare const Button: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>>, ButtonStyleProps>, never>> & string;
@@ -26,15 +26,6 @@ type Props = {
26
26
  name?: string;
27
27
  /**
28
28
  * The checkbox' value
29
- *
30
- * `string | number`, not the `PropTypes.string` this replaces. `MultiLevelCheckbox`
31
- * renders `<Checkbox value={node.value} …>` and a node's value is
32
- * `MultiLevelCheckboxNodeValue = string | number`, so a numeric value reaches this
33
- * prop through a public API today and `oneOf`-style validation never noticed because
34
- * the two components' propTypes were never compared. The value is forwarded
35
- * unchanged onto `<input type="checkbox">`, whose own React type is
36
- * `string | number | readonly string[]`, so this widening records reality and emits
37
- * identical markup.
38
29
  */
39
30
  value?: string | number;
40
31
  /**
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * `variant` — `PropTypes.oneOf(['green', 'black'])`, carried as `$variant` by both
3
- * `Checkbox` and `CheckboxLabel`. Closed on purpose (§J.6): both templates compare
3
+ * `Checkbox` and `CheckboxLabel`. Closed on purpose: both templates compare
4
4
  * `=== 'black'`, and with a closed union a mistyped variant name is TS2367 rather
5
5
  * than a branch that silently never fires.
6
6
  */
@@ -11,23 +11,19 @@ export declare const Checkbox: import("styled-components/dist/types").IStyledCom
11
11
  export declare const CheckIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>, never>, never>> & string;
12
12
  export declare const IndeterminateCheckIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>, never>, never>> & string;
13
13
  interface CheckboxLabelStyleProps {
14
- /** `muted` — `PropTypes.bool`. Fades the `&::before` box only. Leaks to the DOM. */
14
+ /** `muted` — fades the checkbox box. Leaks to DOM. */
15
15
  muted?: boolean;
16
- /** `readOnly` — `PropTypes.bool`. Leaks to the DOM. */
16
+ /** `readOnly` — leaks to DOM. */
17
17
  readOnly?: boolean;
18
- /** `disabled` — `PropTypes.bool`. Leaks to the DOM. */
18
+ /** `disabled` — leaks to DOM. */
19
19
  disabled?: boolean;
20
- /** `variant` — see `CheckboxVariant`. Properly transient. */
20
+ /** `variant` — closed union, properly transient. */
21
21
  $variant?: CheckboxVariant;
22
22
  }
23
23
  export declare const CheckboxLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>>, CheckboxLabelStyleProps>, never>> & string;
24
24
  export declare const CheckboxVisualLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>, never>, never>> & string;
25
25
  export declare const Description: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>>, {
26
- /**
27
- * `error` — the component derives `hasError` (`isBoolean(error) ? error :
28
- * !isEmpty(error)`) and passes that, so `boolean` and not the
29
- * `bool | string` that `error`'s own propTypes allow.
30
- */
26
+ /** `error` — narrowed to `boolean` after `hasError` derivation. */
31
27
  $error?: boolean;
32
28
  }>, never>> & string;
33
29
  export {};
@@ -9,9 +9,9 @@ import type { PartialNtbTheme } from '../../../utils/defaultTheme';
9
9
  * carried WITHOUT a `$` to `Control`, `ValueContainer` and `Placeholder` — see
10
10
  * `ControlStyleProps` for why that is not a DOM leak here.
11
11
  *
12
- * Closed on purpose (§J.6): the templates below compare against this value 14 times, so a
12
+ * Closed on purpose: the templates below compare against this value 14 times, so a
13
13
  * mistyped state name is TS2367 rather than a branch that silently never fires. `''` is a
14
- * member because the component defaults `type = ''` (tsx line 172).
14
+ * member because the component defaults `type = ''`.
15
15
  */
16
16
  type CompactAutocompleteSelectType = '' | 'error' | 'warning' | 'instructions-warning' | 'loading' | 'success';
17
17
  /**
@@ -43,38 +43,16 @@ interface SelectThemeProp {
43
43
  theme?: PartialNtbTheme;
44
44
  }
45
45
  declare const AsyncCreatableSelectPaginate: import("react-select-async-paginate").WithAsyncPaginateType;
46
- /**
47
- * The WRITTEN type of the four `styled(<react-select component>)` exports below. Same
48
- * mechanism, same wording and the same audit as `SelectWrapper` in
49
- * `src/components/inputs/MultiSelect/MultiSelect.styled.ts` — read that one; it is the
50
- * canonical note. §G.4.
51
- *
52
- * Short version: the INFERRED type is correct and unprintable. Under `--declaration` its
53
- * printed form expands to react-select's `PublicBaseSelectProps` and
54
- * `StateManagerAdditionalProps`, which `react-select`'s `exports` map does not serve, so
55
- * tsc reported 8 x TS2883 here and — because `noEmitOnError` is false — silently declined
56
- * to write this file's `.d.ts` at all. That in turn erased the props of the PUBLISHED
57
- * `CompactAutocompleteSelect` declaration down to
58
- * `ForwardRefExoticComponent<RefAttributes<unknown>>`, a closed props type with zero
59
- * members: the exact §G.4 poison, arriving from react-select rather than from `allowJs`.
60
- *
61
- * tsc prints a generic alias APPLICATION by reference, so `SelectWrapper<typeof Select>`
62
- * is writeable where the expansion is not. `Omit<ComponentProps<C>, keyof P> & P` is
63
- * styled-components' own `Substitute<OuterProps, P>`, so no prop is widened or narrowed.
64
- */
65
46
  type SelectWrapper<C extends React.ComponentType<any>> = React.ComponentType<Omit<React.ComponentProps<C>, keyof SelectWrapperStyleProps> & SelectWrapperStyleProps>;
66
47
  type AsyncCreatablePaginateWrapper = SelectWrapper<typeof AsyncCreatableSelectPaginate>;
67
- /**
68
- * The four select wrappers share this: `$hasLabel` for `sharedStyle`'s sake, `theme` for
69
- * react-select's sake, and `disabled` — which is a deferred defect, see below.
70
- */
71
48
  export interface SelectWrapperStyleProps extends SelectThemeProp {
72
49
  /** `!isEmpty(label)` — narrows the control to 66.66% so the label gets the other third. */
73
50
  $hasLabel?: boolean;
51
+ /** `disabled` — unused; fix (repoint to `isDisabled`) changes rendered CSS. */
74
52
  disabled?: boolean;
75
53
  }
76
54
  interface DisabledStyleProps {
77
- /** `disabled` — dims and blocks the pointer. Also reaches the DOM; see above. */
55
+ /** `disabled` — dims and blocks the pointer. Leaks to DOM. */
78
56
  disabled?: boolean;
79
57
  }
80
58
  export declare const CompactAutocompleteSelect: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>>, DisabledStyleProps>, never>> & string;
@@ -85,37 +63,6 @@ export declare const AsyncCreatableAutocompleteSelect: AsyncCreatablePaginateWra
85
63
  export declare const AsyncAutocompleteSelect: SelectWrapper<typeof AsyncPaginate>;
86
64
  export declare const AutocompletSelect: SelectWrapper<typeof Select>;
87
65
  export declare const AutocompletCreatableSelect: SelectWrapper<typeof CreatableSelect>;
88
- /**
89
- * Props of `Control`, the react-select control wrapper.
90
- *
91
- * `edit` and `type` HAVE NO `$` AND STILL DO NOT LEAK TO THE DOM, which makes this the one
92
- * benign member of §E.4's non-`$` list in this file and worth stating so nobody "fixes" it
93
- * blind. There is no `withConfig`/`shouldForwardProp` on a `styled(<component>)` — there is
94
- * no DOM element to filter for — and react-select's `Control` renders only its
95
- * `innerProps` onto the `<div>`, ignoring props it does not know. So
96
- * `<S.Control edit={edit} type={type} …>` (tsx line 193) reaches the template and stops
97
- * there. Prefixing them would be tidier but is not a bug fix, and it still touches two
98
- * files for no type benefit.
99
- *
100
- * `isFocused` is deliberately ABSENT: it is a real `ControlProps` member, so the template's
101
- * seven reads of it already typecheck. §J.9's first case.
102
- *
103
- * ================== DEFERRED DEFECT in this component's template =====================
104
- * `!props.type === 'instructions-warning'` (the `isFocused` border-color rule, ~40 lines
105
- * down; the note has to live here because backticks cannot appear inside the styled
106
- * template) NEGATES FIRST AND THEN COMPARES A BOOLEAN TO A STRING. It is always false, so
107
- * that whole `border-color` rule is dead — a FOCUSED control has never received the
108
- * gray-600 border.
109
- *
110
- * That is the 5th and last remaining error in this file, TS2367 "This comparison appears
111
- * to be unintentional because the types 'boolean' and 'string' have no overlap", and NO
112
- * ANNOTATION CAN REMOVE IT: `!props.type` is `boolean` whatever `type` is declared as,
113
- * `any` included. It is a defect in the expression, and §E.1 rule 3 says fix the code, not
114
- * the type. The fix is `props.type !== 'instructions-warning'`, which ACTIVATES a rule that
115
- * has never fired on the most visible state of the component — C9 for the fix, C10 for the
116
- * re-record, not this commit. §J.8.
117
- * ====================================================================================
118
- */
119
66
  interface ControlStyleProps extends SelectThemeProp {
120
67
  /** `edit` (`PropTypes.bool`) — grey "this is editable" background. */
121
68
  edit?: boolean;
@@ -1,12 +1,3 @@
1
- /**
2
- * `CompactStarRating.tsx`'s `type` prop, from its
3
- * `PropTypes.oneOf(['', 'error', 'warning', 'loading', 'success'])`. The component
4
- * defaults it to `''`, so `''` is a member — this is the propTypes verbatim.
5
- *
6
- * Carried WITHOUT a `$` by `starsWidth`, which is a defect in its own right (see
7
- * there). `Star` / `StarFill` / `CheckIconContainer` also branch on a `type`, but
8
- * theirs is not this one — see the notes at those three.
9
- */
10
1
  type CompactStarRatingType = '' | 'error' | 'warning' | 'loading' | 'success';
11
2
  export declare const CompactStarRating: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>, {
12
3
  /** `readOnly` — `PropTypes.bool`. Leaks to the DOM; see above. */
@@ -21,61 +12,18 @@ export declare const SuccessContainer: import("styled-components/dist/types").IS
21
12
  interface StarsWidthStyleProps {
22
13
  /** `edit` — `PropTypes.bool`. Shows the editable-affordance background. */
23
14
  $edit?: boolean;
24
- /**
25
- * `type` — see `CompactStarRatingType`. HAS NO `$`, AND THAT IS A DEFECT: this is a
26
- * `styled.div`, `type` is not a member of `HTMLAttributes<HTMLDivElement>`, and
27
- * `shouldForwardProp` forwards it — so `type="error"` / `type="loading"` etc. is on
28
- * this `<div>` in the render baseline whenever the prop is non-empty. Fix = rename
29
- * `$type`; removes a DOM attribute → C10 with its re-record. §E.4 third case.
30
- */
15
+ /** `type` — see `CompactStarRatingType`. Leaks to DOM; defect not fixed. */
31
16
  type?: CompactStarRatingType;
32
17
  /** `readOnly` — `PropTypes.bool`. Leaks to the DOM the same way. */
33
18
  readOnly?: boolean;
34
- /**
35
- * `success` IS DECLARED BECAUSE THE NESTED `css<{ success?: boolean }>` BLOCK BELOW
36
- * READS IT, NOT BECAUSE ANYTHING PASSES IT. Nothing does — `CompactStarRating.tsx`
37
- * renders `<S.starsWidth $edit={edit} type={type} readOnly={readOnly}>` and there is
38
- * no other importer — so `props.success` is always `undefined` and that block's
39
- * animation is unconditionally `fadeOut`. The success-fade-IN state of this component
40
- * is unimplemented. A DIFFERENT DEFECT from the `fadeIn` branch removed from
41
- * `SuccessContainer` above, and left alone deliberately: `fadeIn` was a mistyped
42
- * identifier that never existed as a prop, whereas `success` WAS a real
43
- * `PropTypes.bool` (added by `4ed910a`) that `b5d59e7`/`7e46b9d` deleted from the
44
- * component while leaving this read behind. Deciding between restoring the prop and
45
- * deleting the block is its own call, on its own commit.
46
- *
47
- * Without this member the interpolation is TS2345, and the reason is the WEAK-TYPE
48
- * RULE (§J.7): `{ success?: boolean }` is all-optional, assignability to a weak type
49
- * requires at least one member in common, and the host had none — measured verbatim as
50
- * "…has no properties in common with type '{ success?: boolean; }'". Same shape as
51
- * `CompactTextInput`'s `StyledLink` / `linkColor`.
52
- *
53
- * It also has no `$`, but since nothing passes it, it does not currently leak.
54
- */
19
+ /** `success` — unused prop, declared for weak-type assignment compatibility. */
55
20
  success?: boolean;
56
21
  }
57
22
  export declare const starsWidth: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>, StarsWidthStyleProps>, never>> & string;
58
- /**
59
- * The props `Star` and `StarFill` share — they are byte-identical templates apart from
60
- * one `type === 'error'` block, and the JSX passes them the same set.
61
- *
62
- * `disabled` is deliberately ABSENT: on a `styled.button` it is a genuine
63
- * `ButtonHTMLAttributes` member, so the read already typechecks and the attribute
64
- * belongs on the element (§J.9 first row).
65
- *
66
- * `type` IS ALSO DELIBERATELY ABSENT, AND THAT IS WHY FOUR TS2367 ERRORS SURVIVE IN
67
- * THIS FILE. See the note above `StarFill`.
68
- */
69
23
  interface StarStyleProps {
70
24
  /** `hover && key + 1 <= tempRating` — derived in the component, so `boolean`. */
71
25
  $hover?: boolean;
72
- /**
73
- * `readOnly` — `PropTypes.bool`. HAS NO `$`, AND THAT IS A DEFECT: `readOnly` is NOT a
74
- * member of `ButtonHTMLAttributes` (unlike `disabled`), and `shouldForwardProp`
75
- * forwards it, so `readonly=""` is on every rendered star `<button>` today and is in
76
- * the recorded render baseline. Fix = rename `$readOnly`; removes a DOM attribute →
77
- * C10 with its re-record. §E.4 third case.
78
- */
26
+ /** `readOnly` — `PropTypes.bool`. Leaks to DOM; defect not fixed. */
79
27
  readOnly?: boolean;
80
28
  }
81
29
  export declare const Star: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>>, StarStyleProps>, never>> & string;
@@ -1,14 +1,4 @@
1
- /**
2
- * `CompactTextInput.tsx`'s `type` prop, from its
3
- * `PropTypes.oneOf(['', 'error', 'warning', 'loading', 'success'])`, carried across
4
- * the `shouldForwardProp` boundary as `$type` by both `Input` and
5
- * `InputIconContainer`.
6
- *
7
- * Closed on purpose, not widened to `string`. The templates below branch on this
8
- * value 20 times; with a closed union a mistyped state name is TS2367 rather than a
9
- * branch that silently never fires. `''` is a member because the component defaults
10
- * `type = ''` — this union is the propTypes verbatim, not a tidied version of it.
11
- */
1
+ /** Closed union: branches 20 times below, so mistyped state names are TS2367 not silent no-ops. */
12
2
  type CompactTextInputType = '' | 'error' | 'warning' | 'loading' | 'success';
13
3
  export declare const CompactTextInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>, never>, never>> & string;
14
4
  export declare const Label: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>>, {
@@ -23,27 +13,9 @@ export declare const InputIconContainer: import("styled-components/dist/types").
23
13
  $type?: CompactTextInputType;
24
14
  }>, never>> & string;
25
15
  /**
26
- * Props of `Input`.
27
- *
28
- * Every member is transient, so `shouldForwardProp` filters all of them out of the DOM.
29
- * `$haslink` is lower-case by existing convention at both ends; renaming it would be a
30
- * two-file change for no type benefit.
31
- *
32
- * `$inputType` WAS `inputtype`, WITH NO `$`, AND THAT WAS A DOM LEAK — now fixed.
33
- * It is a style/behaviour input (the `.attrs()` callback turns it into the real `type`
34
- * attribute), but without the `$` prefix `shouldForwardProp` forwarded it verbatim too,
35
- * so `inputtype="text"` was on every rendered `<input>` — visible in seven entries of the
36
- * recorded render baseline (`inputs/CompactTextInput` and its five variants, plus
37
- * `layout/InputGroup`). §E.4's third case, and the fix is the `$` prefix.
38
- *
39
- * The PUBLIC prop is unaffected: `CompactTextInput.tsx` still takes `inputType` and maps
40
- * it to this transient prop internally, so no consumer has to react. (Grepped: neither
41
- * `mb-main-client/src` nor `ntb-dam/client/src` mentions `inputtype` or `inputType` at
42
- * all, and no stylesheet in `src` selects on `[inputtype]`.)
43
- *
44
- * `readOnly` and `disabled` are read by the template too and are deliberately ABSENT
45
- * from this interface: both are real `InputHTMLAttributes` members, so those reads
46
- * already typecheck and declaring them would add nothing. §J.9.
16
+ * Props of `Input`. All members transient (filtered by shouldForwardProp).
17
+ * DOM leak fixed: `$inputType` (was `inputtype` without $, on every rendered input).
18
+ * `readOnly` and `disabled` absent intentionally: they're real InputHTMLAttributes members.
47
19
  */
48
20
  interface InputStyleProps {
49
21
  /** `type` — see `CompactTextInputType`. Branched on 20 times below. */
@@ -1,14 +1,6 @@
1
- /**
2
- * Props of the two components that take the expand/collapse state across the
3
- * `shouldForwardProp` boundary.
4
- *
5
- * `MultiLevelCheckbox.tsx` passes `$expanded={expanded || expandedBySearch}` at both
6
- * sites (lines 263 and 302) — two `useState<boolean>` values OR'd together, hence
7
- * `boolean`. Optional, per §J.5: nothing supplies a default and the templates are
8
- * written for its absence (`props.$expanded && css`…``).
9
- */
1
+ /** Transient prop for two styled components; optional (templates handle absence). */
10
2
  interface ExpandedStyleProps {
11
- /** `expanded || expandedBySearch` — opens the `grid-template-rows` / rotates the caret. */
3
+ /** `expanded || expandedBySearch` — opens the grid-template-rows / rotates the caret. */
12
4
  $expanded?: boolean;
13
5
  }
14
6
  export declare const MultiLevelCheckbox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, import("react").DetailedHTMLProps<import("react").FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>>, never>, never>> & string;
@@ -1,42 +1,10 @@
1
1
  import PropTypes from 'prop-types';
2
- /**
3
- * The option tree `MultiLevelCheckbox` and `MultiLevelCheckboxSelect` render.
4
- *
5
- * TWO THINGS IN HERE, DESPITE THE FILE NAME: the types, and `findChildValues` —
6
- * a runtime helper both components call. The helper predates the file's name;
7
- * moving it is a separate commit.
8
- */
9
- /**
10
- * A node's identity.
11
- *
12
- * `string | number` RATHER THAN THE `PropTypes.any` IT REPLACES, because three
13
- * runtime uses constrain it and none of them accepts an arbitrary value: it is
14
- * the React `key` of every rendered `CheckboxTree`, it is the `value` of the
15
- * underlying `<input type="checkbox">`, and it is compared with `===` and
16
- * `Array.prototype.includes` against the `checked` array the consumer owns.
17
- * An object here already renders as `[object Object]` and breaks reconciliation,
18
- * so `any` was permission for a bug rather than a description of the API.
19
- *
20
- * Every value in the stories is a string.
21
- */
2
+ /** Node identity: React key, checkbox value, and included() target; objects would break reconciliation. */
22
3
  export type MultiLevelCheckboxNodeValue = string | number;
23
4
  /**
24
5
  * One option, with any number of levels of children under it.
25
6
  *
26
- * GENUINELY RECURSIVE, WHICH THE propTypes AT THE BOTTOM ARE NOT — and the
27
- * recursion is the accurate description, not an improvement invented here:
28
- *
29
- * - `NodeType` validates exactly two levels and then gives up (`children:
30
- * PropTypes.array`), because a self-referential `PropTypes.shape` is not
31
- * expressible without a lazy indirection. Its own comment says so.
32
- * - `findChildValues` below, `hasChildrenSelected`, `hasAllChildrenSelected`,
33
- * `getLabelByValue` and `CheckboxTree` itself all recurse without a depth
34
- * limit, and the stories ship four-level trees
35
- * (`sport → idrettsgren → golf → minigolf`).
36
- *
37
- * So the propTypes silently accepted anything below level two while the
38
- * components happily walked it. This interface is what the code has always
39
- * meant.
7
+ * Genuinely recursive (propTypes truncate at two levels); code recurses without depth limit.
40
8
  */
41
9
  export interface MultiLevelCheckboxNode {
42
10
  /** Shown next to the checkbox, and what the `search` prop matches against. */
@@ -48,18 +16,7 @@ export interface MultiLevelCheckboxNode {
48
16
  */
49
17
  children?: MultiLevelCheckboxNode[];
50
18
  }
51
- /**
52
- * Every descendant value under `node`, depth-first, excluding `node` itself.
53
- *
54
- * Callers pass `[node.value, ...findChildValues(node)]` when they want the node
55
- * included, which is why it is excluded here.
56
- *
57
- * Guards on `Array.isArray(node.children)`, so a node whose `children` is
58
- * `undefined` — or something the type says it cannot be — yields `[]` rather
59
- * than throwing. There is no cycle protection: a node reachable from its own
60
- * subtree recurses until the stack runs out. That is pre-existing, and the tree
61
- * comes from the consumer.
62
- */
19
+ /** Every descendant value under node, depth-first, excluding node itself (callers add node back). */
63
20
  export declare function findChildValues(node: MultiLevelCheckboxNode): MultiLevelCheckboxNodeValue[];
64
21
  export declare const NodeType: PropTypes.Requireable<PropTypes.InferProps<{
65
22
  label: PropTypes.Validator<string>;