@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.
- package/README.md +34 -0
- package/build/data/Alert/Alert.js.map +1 -1
- package/build/data/Alert/Alert.styled.js.map +1 -1
- package/build/data/Badge/Badge.js.map +1 -1
- package/build/data/Badge/Badge.styled.js.map +1 -1
- package/build/data/Popover/Popover.js.map +1 -1
- package/build/data/Popover/Popover.styled.js.map +1 -1
- package/build/data/SeverityBadge/SeverityBadge.js.map +1 -1
- package/build/data/Tab/Tab.js.map +1 -1
- package/build/data/Tab/Tab.styled.js.map +1 -1
- package/build/data/Tabs/Tabs.js.map +1 -1
- package/build/data/Tabs/Tabs.styled.js.map +1 -1
- package/build/data/Tooltip/Tooltip.js.map +1 -1
- package/build/data/Tooltip/Tooltip.styled.js.map +1 -1
- package/build/data/VerificationStatusIcon/VerificationStatusIcon.js.map +1 -1
- package/build/data/VerificationStatusIcon/VerificationStatusIcon.styled.js.map +1 -1
- package/build/data/_shared/FloatingArrow.styled.js.map +1 -1
- package/build/hooks/useEventListner.js.map +1 -1
- package/build/hooks/useFloatingPopover.js.map +1 -1
- package/build/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/build/hooks/useOnClickOutside.js.map +1 -1
- package/build/hooks/useTooltipAutoShow.js.map +1 -1
- package/build/inputs/ActionButton/ActionButton.js.map +1 -1
- package/build/inputs/ActionButton/ActionButton.styled.js.map +1 -1
- package/build/inputs/Button/Button.js.map +1 -1
- package/build/inputs/Button/Button.styled.js.map +1 -1
- package/build/inputs/Checkbox/Checkbox.js.map +1 -1
- package/build/inputs/Checkbox/Checkbox.styled.js.map +1 -1
- package/build/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.js.map +1 -1
- package/build/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.styled.js.map +1 -1
- package/build/inputs/CompactStarRating/CompactStarRating.js.map +1 -1
- package/build/inputs/CompactStarRating/CompactStarRating.styled.js.map +1 -1
- package/build/inputs/CompactTextInput/CompactTextInput.js.map +1 -1
- package/build/inputs/CompactTextInput/CompactTextInput.styled.js.map +1 -1
- package/build/inputs/MultiLevelCheckbox/MultiLevelCheckbox.js.map +1 -1
- package/build/inputs/MultiLevelCheckbox/MultiLevelCheckbox.styled.js.map +1 -1
- package/build/inputs/MultiLevelCheckbox/types.js.map +1 -1
- package/build/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.js.map +1 -1
- package/build/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.styled.js.map +1 -1
- package/build/inputs/MultiSelect/MultiSelect.js.map +1 -1
- package/build/inputs/MultiSelect/MultiSelect.styled.js.map +1 -1
- package/build/inputs/Radio/Radio.js.map +1 -1
- package/build/inputs/Radio/Radio.styled.js.map +1 -1
- package/build/inputs/Switch/Switch.styled.js.map +1 -1
- package/build/inputs/TextArea/TextArea.js.map +1 -1
- package/build/inputs/TextArea/TextArea.styled.js.map +1 -1
- package/build/inputs/TextInput/TextInput.js.map +1 -1
- package/build/inputs/TextInput/TextInput.styled.js.map +1 -1
- package/build/layout/InputGroup/InputGroup.js.map +1 -1
- package/build/layout/InputGroup/InputGroup.styled.js.map +1 -1
- package/build/layout/SectionSeparator/SectionSeparator.js.map +1 -1
- package/build/layout/SectionSeparator/SectionSeparator.styled.js.map +1 -1
- package/build/styles/utils/colors-export.d.ts +6 -25
- package/build/utils/dateTime.js.map +1 -1
- package/build/utils/defaultTheme.js.map +1 -1
- package/build/utils/getElementRef.js.map +1 -1
- package/build/utils/parseTrigger.js.map +1 -1
- package/build/widgets/AssetAction/AssetAction.js.map +1 -1
- package/build/widgets/AssetAction/AssetAction.styled.js.map +1 -1
- package/build/widgets/AssetActionsBase/AssetActionsBase.js.map +1 -1
- package/build/widgets/AssetActionsBase/AssetActionsBase.styled.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGallery.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.styled.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.styled.js.map +1 -1
- package/build/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.js.map +1 -1
- package/build/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.styled.js.map +1 -1
- package/build/widgets/ContextMenu/ContextMenu.js.map +1 -1
- package/build/widgets/ContextMenu/ContextMenu.styled.js.map +1 -1
- package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.js.map +1 -1
- package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.styled.js.map +1 -1
- package/build/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.js.map +1 -1
- package/build/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.styled.js.map +1 -1
- package/build/widgets/InfoCard/InfoCard.js.map +1 -1
- package/build/widgets/InfoCard/InfoCard.styled.js.map +1 -1
- package/build/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.js.map +1 -1
- package/build/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.styled.js.map +1 -1
- package/build/widgets/Instructions/Instructions.js.map +1 -1
- package/build/widgets/Instructions/Instructions.styled.js.map +1 -1
- package/build/widgets/ProgressBar/ProgressBar.js.map +1 -1
- package/build/widgets/ProgressBar/ProgressBar.styled.js.map +1 -1
- package/build/widgets/SummaryCard/SummaryCard.js.map +1 -1
- package/build/widgets/SummaryCard/SummaryCard.styled.js.map +1 -1
- package/package.json +8 -1
- package/styles/utils/colors-export.d.ts +6 -25
- package/types/components/data/Alert/Alert.styled.d.ts +6 -37
- package/types/components/data/Badge/Badge.d.ts +1 -9
- package/types/components/data/Badge/Badge.styled.d.ts +0 -99
- package/types/components/data/Popover/Popover.d.ts +11 -100
- package/types/components/data/Tab/Tab.d.ts +1 -14
- package/types/components/data/Tabs/Tabs.styled.d.ts +1 -17
- package/types/components/data/Tooltip/Tooltip.d.ts +4 -50
- package/types/components/data/VerificationStatusIcon/VerificationStatusIcon.styled.d.ts +3 -22
- package/types/components/data/_shared/FloatingArrow.styled.d.ts +1 -101
- package/types/components/inputs/ActionButton/ActionButton.styled.d.ts +2 -20
- package/types/components/inputs/Button/Button.styled.d.ts +0 -42
- package/types/components/inputs/Checkbox/Checkbox.d.ts +0 -9
- package/types/components/inputs/Checkbox/Checkbox.styled.d.ts +6 -10
- package/types/components/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.styled.d.ts +4 -57
- package/types/components/inputs/CompactStarRating/CompactStarRating.styled.d.ts +3 -55
- package/types/components/inputs/CompactTextInput/CompactTextInput.styled.d.ts +4 -32
- package/types/components/inputs/MultiLevelCheckbox/MultiLevelCheckbox.styled.d.ts +2 -10
- package/types/components/inputs/MultiLevelCheckbox/types.d.ts +3 -46
- package/types/components/inputs/MultiSelect/MultiSelect.d.ts +0 -57
- package/types/components/inputs/MultiSelect/MultiSelect.styled.d.ts +0 -65
- package/types/components/inputs/Radio/Radio.styled.d.ts +3 -3
- package/types/components/inputs/Switch/Switch.styled.d.ts +3 -7
- package/types/components/inputs/TextArea/TextArea.d.ts +0 -4
- package/types/components/inputs/TextArea/TextArea.styled.d.ts +5 -7
- package/types/components/inputs/TextInput/TextInput.styled.d.ts +1 -1
- package/types/components/layout/SectionSeparator/SectionSeparator.styled.d.ts +2 -9
- package/types/components/widgets/AssetAction/AssetAction.styled.d.ts +2 -7
- package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.d.ts +0 -12
- package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.d.ts +7 -55
- package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.styled.d.ts +7 -43
- package/types/components/widgets/AssetGallery/asset.types.d.ts +31 -148
- package/types/components/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.styled.d.ts +6 -20
- package/types/components/widgets/ContextMenu/ContextMenu.d.ts +1 -17
- package/types/components/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.styled.d.ts +5 -13
- package/types/components/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.d.ts +0 -18
- package/types/components/widgets/InfoCard/InfoCard.styled.d.ts +2 -19
- package/types/components/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.styled.d.ts +9 -19
- package/types/components/widgets/Instructions/Instructions.styled.d.ts +2 -14
- package/types/components/widgets/ProgressBar/ProgressBar.styled.d.ts +6 -43
- package/types/components/widgets/SummaryCard/SummaryCard.styled.d.ts +7 -46
- package/types/hooks/useElementSize.d.ts +3 -14
- package/types/hooks/useEventListner.d.ts +6 -38
- package/types/hooks/useFloatingPopover.d.ts +9 -90
- package/types/hooks/useIsomorphicLayoutEffect.d.ts +0 -23
- package/types/hooks/useOnClickOutside.d.ts +5 -23
- package/types/hooks/useTooltipAutoShow.d.ts +8 -57
- package/types/styles/utils/colors-export.d.ts +6 -25
- package/types/utils/dateTime.d.ts +2 -7
- package/types/utils/defaultTheme.d.ts +13 -92
- package/types/utils/getElementRef.d.ts +0 -19
- 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
|
|
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
|
-
*
|
|
87
|
-
*
|
|
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
|
|
90
|
-
*
|
|
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;
|