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

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
@@ -1,31 +1,3 @@
1
- /**
2
- * tippy's `trigger` space-string, parsed into the three discrete Floating UI
3
- * interaction hooks.
4
- *
5
- * WHY THIS EXISTS AS A SEPARATE, PURE FUNCTION. tippy takes ONE prop —
6
- * `trigger="mouseenter focus"` — and does its own tokenising
7
- * (`splitBySpaces(instance.props.trigger).forEach(...)` in
8
- * `tippy.js/dist/tippy.cjs.js`). Floating UI has no equivalent: it has three
9
- * separate Hooks (`useClick`, `useHover`, `useFocus`), each with its own
10
- * `enabled` flag. `Popover` and `Tooltip` both publish `trigger` as a documented
11
- * prop and 62 consumer call sites pass it, so the string has to survive — which
12
- * means exactly one place has to own the string → flags translation. This is it,
13
- * and it is a pure function so it can be reasoned about (and later tested)
14
- * without mounting anything.
15
- *
16
- * It lives in `src/utils/` rather than `src/hooks/` deliberately: it calls no
17
- * Hook, has no React import, and `useFloatingPopover` is not its only plausible
18
- * caller — a `<Popover>` that needs to know "does this trigger imply hover?" for
19
- * a styling decision can ask without pulling in a Hook.
20
- */
21
- /**
22
- * Which Floating UI interaction Hooks a tippy trigger string turns on.
23
- *
24
- * All three are REQUIRED and always present. This is a computed result, not a
25
- * bag of options: "the caller did not mention hover" and "hover is off" are the
26
- * same statement here, and an optional member would let a caller write
27
- * `if (parsed.hover === undefined)` as though there were a third state.
28
- */
29
1
  export interface ParsedTrigger {
30
2
  /** `click` token present → `useClick`. */
31
3
  click: boolean;
@@ -34,59 +6,17 @@ export interface ParsedTrigger {
34
6
  /** `focus` or `focusin` token present → `useFocus`. */
35
7
  focus: boolean;
36
8
  }
37
- /**
38
- * tippy's own default, measured — `tippy.js/dist/tippy.cjs.js`:
39
- *
40
- * ```js
41
- * var defaultProps = Object.assign({
42
- * …
43
- * trigger: 'mouseenter focus',
44
- * …
45
- * }, pluginProps, renderProps);
46
- * ```
47
- *
48
- * `Tooltip.tsx` declares no default for `trigger` and passes `undefined`
49
- * straight through, so `undefined` HAS ALWAYS MEANT `'mouseenter focus'` for
50
- * every tooltip in the library and in both consumers. `parseTrigger(undefined)`
51
- * therefore has to return hover+focus, not nothing — see the `trigger`
52
- * parameter's note.
53
- *
54
- * (`Popover.tsx` declares its own default, `'click focus'`, so it never relies
55
- * on this one.)
56
- */
57
9
  export declare const TIPPY_DEFAULT_TRIGGER = "mouseenter focus";
58
10
  /**
59
- * Parses a tippy `trigger` prop into `{ click, hover, focus }`.
60
- *
61
- * THE THREE INPUTS THAT ARE EASY TO GET WRONG, all of them in use:
62
- *
63
- * - **`undefined`** (and `null`) means "tippy's default", i.e. hover+focus. It
64
- * does NOT mean "no triggers". Every `<Tooltip>` in the library that does not
65
- * pass `trigger` relies on this.
66
- * - **`''`** means NO TRIGGERS AT ALL, and it is used. Measured, in BOTH
67
- * consumers — `mb-main-client/src/components/assets/sales_overlay.tsx:246` and
68
- * `ntb-dam/client/src/components/assets/sales_overlay.js:245`:
69
- *
70
- * ```jsx
71
- * trigger={assetsHasAllRequiredData ? "" : "mouseenter focus"}
72
- * ```
73
- *
74
- * i.e. `''` is how that call site turns the tooltip OFF conditionally. Return
75
- * anything truthy for it and a tooltip appears where the consumer suppressed
76
- * one. `''.split(/\s+/)` is `['']`, which is why the `filter(Boolean)`
77
- * below is load-bearing rather than tidiness — without it `''` would be
78
- * treated as an unrecognised token, which happens to give the same answer here
79
- * but would stop doing so the moment a token were matched loosely.
80
- * - **A controlled popover ignores the result entirely.** That decision is NOT
81
- * made here: this function reports what the string says, and
82
- * `useFloatingPopover` is what gates the Hooks off when `visible` is a
83
- * boolean. Keeping the two apart means the parse stays testable and the
84
- * controlled-mode rule lives in one place instead of two.
11
+ * Parses a tippy trigger string into Floating UI Hook flags.
85
12
  *
86
- * Whitespace is split on `/\s+/` and not `' '`, matching tippy's
87
- * `splitBySpaces`, so `'click\n focus'` parses the same way tippy parses it.
13
+ * Three inputs are easy to get wrong: `undefined`/`null` → tippy default (hover+focus,
14
+ * NOT "no triggers"); `''` → no triggers (used in sales overlays to conditionally
15
+ * suppress tooltips); filter(Boolean) is load-bearing (empty string splits to ['']
16
+ * which would otherwise be treated as an unrecognised token). Controlled mode is
17
+ * NOT handled here — useFloatingPopover gates the Hooks based on visible.
88
18
  *
89
- * @param trigger tippy's `trigger` prop. `undefined`/`null` → the tippy default
90
- * (`'mouseenter focus'`); `''` → nothing enabled
19
+ * @param trigger tippy's trigger prop; `undefined`/`null` → 'mouseenter focus';
20
+ * `''` → all flags false
91
21
  */
92
22
  export declare function parseTrigger(trigger?: string | null): ParsedTrigger;