@elliemae/ds-tooltip-v3 3.53.0-next.9 → 3.54.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/react-desc-prop-types.js +0 -6
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/typescript-testing/typescript-tooltip-v3-valid.js +0 -22
- package/dist/cjs/typescript-testing/typescript-tooltip-v3-valid.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +0 -6
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-tooltip-v3-valid.js +0 -22
- package/dist/esm/typescript-testing/typescript-tooltip-v3-valid.js.map +2 -2
- package/dist/types/react-desc-prop-types.d.ts +0 -6
- package/dist/types/tests/DSTooltipV3.validatePropIsStable.test.d.ts +1 -0
- package/package.json +10 -9
|
@@ -47,17 +47,11 @@ const DSTooltipV3PropTypes = {
|
|
|
47
47
|
children: import_ds_props_helpers.PropTypes.node.description("Element to tie the tooltip to, must be a single node").isRequired,
|
|
48
48
|
withoutPortal: import_ds_props_helpers.PropTypes.bool.description("Whether or not the tooltip content should appear in a DOM portal or not").defaultValue(true),
|
|
49
49
|
withoutArrow: import_ds_props_helpers.PropTypes.bool.description("Whether or not the tooltip should use the arrow").defaultValue(false),
|
|
50
|
-
boundaryElement: import_ds_props_helpers.PropTypes.element.description(
|
|
51
|
-
'Bounding element to calculate upon, defaults to "clippingParents",which are the scrolling containers that may cause element to be partially or fully cut off'
|
|
52
|
-
).defaultValue(void 0),
|
|
53
50
|
withoutAnimation: import_ds_props_helpers.PropTypes.bool.description("Whether or not the popper context menu should be animated").defaultValue(false),
|
|
54
51
|
animationDuration: import_ds_props_helpers.PropTypes.number.description("Popper context menus Animation duration in ms").defaultValue(100),
|
|
55
52
|
portalDOMContainer: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.node, import_ds_props_helpers.PropTypes.oneOf([null])]).description("When using portal, the container in which to append the DOM content, defaults to document body").defaultValue(void 0),
|
|
56
53
|
startPlacementPreference: import_ds_props_helpers.PropTypes.oneOf(import_constants.PLACEMENT).description("start placement preferences, as per popperjs placement option").defaultValue("'top'"),
|
|
57
|
-
placementOrderPreference: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.oneOf(import_constants.PLACEMENT)).description('Array of placement preferences, as per popperjs "flip" placement option').defaultValue("['top', 'bottom', 'left', 'right']"),
|
|
58
|
-
zIndex: import_ds_props_helpers.PropTypes.number.description("popperjs content z-index").defaultValue(1),
|
|
59
54
|
customOffset: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.number).description("placement offset array").defaultValue([0, 14]),
|
|
60
|
-
modifiers: import_ds_props_helpers.PropTypes.array.description("modifiers array for full-custom tooltip-js override, https://popper.js.org/docs/v2/modifiers/").defaultValue(1),
|
|
61
55
|
id: import_ds_props_helpers.PropTypes.string.description("Optional id appended to data-testid").defaultValue(""),
|
|
62
56
|
onOpen: import_ds_props_helpers.PropTypes.func.description("Optional callback to be invoked when the tooltip opens").defaultValue("() => {}"),
|
|
63
57
|
onClose: import_ds_props_helpers.PropTypes.func.description("Optional callback to be invoked when the tooltip closes").defaultValue("() => {}"),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/react-desc-prop-types.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import type { DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\nimport { PLACEMENT, TEXT_ALIGNMENT } from './constants.js';\n\nexport declare namespace DSTooltipV3T {\n export type Placement =\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'left-end'\n | 'left'\n | 'left-start';\n export type TextAlignment = 'left' | 'right' | 'center' | 'justify' | 'initial' | 'inherit';\n\n export interface DefaultProps {\n onOpen: () => void;\n onClose: () => void;\n id: string;\n textAlign: TextAlignment;\n wrapWords: boolean;\n startPlacementPreference: Placement;\n applyTooltipOverflowWrap: boolean;\n customOffset?: [number, number];\n }\n\n export interface OptionalProps {\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,8BAA0B;AAC1B,uBAA0C;
|
|
4
|
+
"sourcesContent": ["import type { DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\nimport { PLACEMENT, TEXT_ALIGNMENT } from './constants.js';\n\nexport declare namespace DSTooltipV3T {\n export type Placement =\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'left-end'\n | 'left'\n | 'left-start';\n export type TextAlignment = 'left' | 'right' | 'center' | 'justify' | 'initial' | 'inherit';\n\n export interface DefaultProps {\n onOpen: () => void;\n onClose: () => void;\n id: string;\n textAlign: TextAlignment;\n wrapWords: boolean;\n startPlacementPreference: Placement;\n applyTooltipOverflowWrap: boolean;\n customOffset?: [number, number];\n }\n\n export interface OptionalProps {\n withoutPortal?: boolean;\n withoutArrow?: boolean;\n withoutAnimation?: boolean;\n animationDuration?: number;\n portalDOMContainer?: HTMLElement;\n showPopover?: boolean;\n Text?: React.ComponentType<Record<string, unknown>>;\n textProps?: Record<string, unknown>;\n text?: string;\n }\n\n export interface RequiredProps {\n children: React.ReactNode;\n }\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n // Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n // XstyledProps,\n RequiredProps {}\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n // Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n // XstyledProps,\n RequiredProps {}\n}\n\nexport const DSTooltipV3PropTypes: DSPropTypesSchema<DSTooltipV3T.Props> = {\n text: PropTypes.string\n .description(\n 'Tooltip text to be displayed on hover/focus. If both `text` and `Text` are provided, only `Text` will take precedence.',\n )\n .isRequiredIf((props: Record<string, unknown>) => !props.Text),\n textAlign: PropTypes.oneOf(TEXT_ALIGNMENT as unknown as unknown[])\n .description('Tooltip text alignment')\n .defaultValue('left'),\n applyTooltipOverflowWrap: PropTypes.bool\n .description(\n 'when a tooltip is present, the tooltip text may be too long to fit in the pill. If true, the tooltip will wrap to the next line using overflow-wrap',\n )\n .defaultValue(false),\n wrapWords: PropTypes.bool\n .description('Break words into a new line. Useful when words exceed tooltip max-lenght.')\n .defaultValue(false),\n children: PropTypes.node.description('Element to tie the tooltip to, must be a single node').isRequired,\n withoutPortal: PropTypes.bool\n .description('Whether or not the tooltip content should appear in a DOM portal or not')\n .defaultValue(true),\n withoutArrow: PropTypes.bool.description('Whether or not the tooltip should use the arrow').defaultValue(false),\n withoutAnimation: PropTypes.bool\n .description('Whether or not the popper context menu should be animated')\n .defaultValue(false),\n animationDuration: PropTypes.number.description('Popper context menus Animation duration in ms').defaultValue(100),\n portalDOMContainer: PropTypes.oneOfType([PropTypes.node, PropTypes.oneOf([null])])\n .description('When using portal, the container in which to append the DOM content, defaults to document body')\n .defaultValue(undefined),\n startPlacementPreference: PropTypes.oneOf(PLACEMENT)\n .description('start placement preferences, as per popperjs placement option')\n .defaultValue(\"'top'\"),\n customOffset: PropTypes.arrayOf(PropTypes.number).description('placement offset array').defaultValue([0, 14]),\n id: PropTypes.string.description('Optional id appended to data-testid').defaultValue(''),\n onOpen: PropTypes.func.description('Optional callback to be invoked when the tooltip opens').defaultValue('() => {}'),\n onClose: PropTypes.func\n .description('Optional callback to be invoked when the tooltip closes')\n .defaultValue('() => {}'),\n showPopover: PropTypes.bool.description('Whether or not the tooltip should be always shown'),\n Text: PropTypes.func\n .description(\n 'Custom component (HTML/JSX) to be displayed in the tooltip. If both `text` and `Text` are provided, only `Text` will take precedence.',\n )\n .isRequiredIf((props: Record<string, unknown>) => !props.text),\n textProps: PropTypes.object.description(\n 'Props to be passed to the custom Text component, if provided, used mainly to avoiding inline components definition to improve performance',\n ),\n};\n\nexport const DSTooltipV3PropTypesSchema = DSTooltipV3PropTypes as unknown as ValidationMap<DSTooltipV3T.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,8BAA0B;AAC1B,uBAA0C;AA2DnC,MAAM,uBAA8D;AAAA,EACzE,MAAM,kCAAU,OACb;AAAA,IACC;AAAA,EACF,EACC,aAAa,CAAC,UAAmC,CAAC,MAAM,IAAI;AAAA,EAC/D,WAAW,kCAAU,MAAM,+BAAsC,EAC9D,YAAY,wBAAwB,EACpC,aAAa,MAAM;AAAA,EACtB,0BAA0B,kCAAU,KACjC;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AAAA,EACrB,WAAW,kCAAU,KAClB,YAAY,2EAA2E,EACvF,aAAa,KAAK;AAAA,EACrB,UAAU,kCAAU,KAAK,YAAY,sDAAsD,EAAE;AAAA,EAC7F,eAAe,kCAAU,KACtB,YAAY,yEAAyE,EACrF,aAAa,IAAI;AAAA,EACpB,cAAc,kCAAU,KAAK,YAAY,iDAAiD,EAAE,aAAa,KAAK;AAAA,EAC9G,kBAAkB,kCAAU,KACzB,YAAY,2DAA2D,EACvE,aAAa,KAAK;AAAA,EACrB,mBAAmB,kCAAU,OAAO,YAAY,+CAA+C,EAAE,aAAa,GAAG;AAAA,EACjH,oBAAoB,kCAAU,UAAU,CAAC,kCAAU,MAAM,kCAAU,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAC9E,YAAY,gGAAgG,EAC5G,aAAa,MAAS;AAAA,EACzB,0BAA0B,kCAAU,MAAM,0BAAS,EAChD,YAAY,+DAA+D,EAC3E,aAAa,OAAO;AAAA,EACvB,cAAc,kCAAU,QAAQ,kCAAU,MAAM,EAAE,YAAY,wBAAwB,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC;AAAA,EAC5G,IAAI,kCAAU,OAAO,YAAY,qCAAqC,EAAE,aAAa,EAAE;AAAA,EACvF,QAAQ,kCAAU,KAAK,YAAY,wDAAwD,EAAE,aAAa,UAAU;AAAA,EACpH,SAAS,kCAAU,KAChB,YAAY,yDAAyD,EACrE,aAAa,UAAU;AAAA,EAC1B,aAAa,kCAAU,KAAK,YAAY,mDAAmD;AAAA,EAC3F,MAAM,kCAAU,KACb;AAAA,IACC;AAAA,EACF,EACC,aAAa,CAAC,UAAmC,CAAC,MAAM,IAAI;AAAA,EAC/D,WAAW,kCAAU,OAAO;AAAA,IAC1B;AAAA,EACF;AACF;AAEO,MAAM,6BAA6B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -24,9 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
var React = __toESM(require("react"));
|
|
25
25
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
26
|
var import__ = require("../index.js");
|
|
27
|
-
const mockPlacementOrderPreference = ["bottom-start", "bottom", "bottom-end"];
|
|
28
27
|
const mockCustomOffset = [0, 0];
|
|
29
|
-
const mockModifiers = [{}];
|
|
30
28
|
const testRequiredProps = {};
|
|
31
29
|
const TextComponentThatReceivesProps = (props) => {
|
|
32
30
|
const { title, description } = props;
|
|
@@ -38,15 +36,11 @@ const TextComponentThatReceivesProps = (props) => {
|
|
|
38
36
|
};
|
|
39
37
|
const FixedTextComponent = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: " hello world! " });
|
|
40
38
|
const testOptionalProps = {
|
|
41
|
-
zIndex: 1,
|
|
42
39
|
withoutPortal: false,
|
|
43
40
|
withoutArrow: false,
|
|
44
41
|
withoutAnimation: false,
|
|
45
|
-
boundaryElement: void 0,
|
|
46
42
|
animationDuration: 1e3,
|
|
47
43
|
portalDOMContainer: void 0,
|
|
48
|
-
placementOrderPreference: mockPlacementOrderPreference,
|
|
49
|
-
modifiers: mockModifiers,
|
|
50
44
|
showPopover: true,
|
|
51
45
|
Text: TextComponentThatReceivesProps,
|
|
52
46
|
textProps: {
|
|
@@ -103,17 +97,13 @@ const testExplicitDefinition = {
|
|
|
103
97
|
wrapWords: false,
|
|
104
98
|
applyTooltipOverflowWrap: false,
|
|
105
99
|
text: "",
|
|
106
|
-
zIndex: 1,
|
|
107
100
|
withoutPortal: false,
|
|
108
101
|
withoutArrow: false,
|
|
109
102
|
withoutAnimation: false,
|
|
110
|
-
boundaryElement: void 0,
|
|
111
103
|
animationDuration: 1e3,
|
|
112
104
|
portalDOMContainer: void 0,
|
|
113
105
|
startPlacementPreference: "bottom",
|
|
114
|
-
placementOrderPreference: mockPlacementOrderPreference,
|
|
115
106
|
customOffset: mockCustomOffset,
|
|
116
|
-
modifiers: mockModifiers,
|
|
117
107
|
showPopover: true
|
|
118
108
|
};
|
|
119
109
|
const testExplicitDefinitionWithBoth = {
|
|
@@ -139,17 +129,13 @@ const testInferedTypeCompatibility = {
|
|
|
139
129
|
wrapWords: false,
|
|
140
130
|
applyTooltipOverflowWrap: false,
|
|
141
131
|
text: "",
|
|
142
|
-
zIndex: 1,
|
|
143
132
|
withoutPortal: false,
|
|
144
133
|
withoutArrow: false,
|
|
145
134
|
withoutAnimation: false,
|
|
146
|
-
boundaryElement: void 0,
|
|
147
135
|
animationDuration: 1e3,
|
|
148
136
|
portalDOMContainer: void 0,
|
|
149
137
|
startPlacementPreference: "bottom",
|
|
150
|
-
placementOrderPreference: mockPlacementOrderPreference,
|
|
151
138
|
customOffset: mockCustomOffset,
|
|
152
|
-
modifiers: mockModifiers,
|
|
153
139
|
showPopover: true
|
|
154
140
|
};
|
|
155
141
|
const testDefinitionAsConst = {
|
|
@@ -161,17 +147,13 @@ const testDefinitionAsConst = {
|
|
|
161
147
|
textAlign: "center",
|
|
162
148
|
wrapWords: false,
|
|
163
149
|
text: "",
|
|
164
|
-
zIndex: 1,
|
|
165
150
|
withoutPortal: false,
|
|
166
151
|
withoutArrow: false,
|
|
167
152
|
withoutAnimation: false,
|
|
168
|
-
boundaryElement: void 0,
|
|
169
153
|
animationDuration: 1e3,
|
|
170
154
|
portalDOMContainer: void 0,
|
|
171
155
|
startPlacementPreference: "bottom",
|
|
172
|
-
placementOrderPreference: mockPlacementOrderPreference,
|
|
173
156
|
customOffset: mockCustomOffset,
|
|
174
|
-
modifiers: mockModifiers,
|
|
175
157
|
showPopover: true
|
|
176
158
|
};
|
|
177
159
|
const ExampleUsageComponent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
@@ -189,17 +171,13 @@ const ExampleUsageComponent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)
|
|
|
189
171
|
textAlign: "center",
|
|
190
172
|
wrapWords: false,
|
|
191
173
|
text: "",
|
|
192
|
-
zIndex: 1,
|
|
193
174
|
withoutPortal: false,
|
|
194
175
|
withoutArrow: false,
|
|
195
176
|
withoutAnimation: false,
|
|
196
|
-
boundaryElement: void 0,
|
|
197
177
|
animationDuration: 1e3,
|
|
198
178
|
portalDOMContainer: void 0,
|
|
199
179
|
startPlacementPreference: "bottom",
|
|
200
|
-
placementOrderPreference: ["bottom-start", "bottom", "bottom-end"],
|
|
201
180
|
customOffset: [0, 0],
|
|
202
|
-
modifiers: [],
|
|
203
181
|
showPopover: true,
|
|
204
182
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {})
|
|
205
183
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-tooltip-v3-valid.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSTooltipV3 } from '../index.js';\nimport type { DSTooltipV3T } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSTooltipV3T.Props;\ntype ComponentPropsInternals = DSTooltipV3T.InternalProps;\ntype ComponentPropsDefaultProps = DSTooltipV3T.DefaultProps;\ntype ComponentPropsOptionalProps = DSTooltipV3T.OptionalProps;\ntype ComponentPropsRequiredProps = DSTooltipV3T.RequiredProps;\n\nconst
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSTooltipV3 } from '../index.js';\nimport type { DSTooltipV3T } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSTooltipV3T.Props;\ntype ComponentPropsInternals = DSTooltipV3T.InternalProps;\ntype ComponentPropsDefaultProps = DSTooltipV3T.DefaultProps;\ntype ComponentPropsOptionalProps = DSTooltipV3T.OptionalProps;\ntype ComponentPropsRequiredProps = DSTooltipV3T.RequiredProps;\n\nconst mockCustomOffset: DSTooltipV3T.DefaultProps['customOffset'] = [0, 0];\n\nconst testRequiredProps: Omit<ComponentPropsRequiredProps, 'children'> = {};\n\nconst TextComponentThatReceivesProps: Required<DSTooltipV3T.Props>['Text'] = (props) => {\n const { title, description } = props as unknown as {\n title: string;\n description: string;\n };\n return (\n <span>\n {title} - {description}\n </span>\n );\n};\nconst FixedTextComponent: Required<DSTooltipV3T.Props>['Text'] = (props) => <span> hello world! </span>;\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n withoutPortal: false,\n withoutArrow: false,\n withoutAnimation: false,\n animationDuration: 1000,\n portalDOMContainer: undefined,\n showPopover: true,\n Text: TextComponentThatReceivesProps,\n textProps: {\n title: 'Custom Tooltip Title',\n description: 'Custom Tooltip Description',\n },\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n id: '',\n onOpen: () => {},\n onClose: () => {},\n};\n\n// we omit children because children MUST be passed ALWAYS via the JSX composition react pattern\nconst testProps: Omit<ComponentPropsForApp, 'children'> = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n id: 'id',\n onOpen: () => {},\n onClose: () => {},\n textAlign: 'center',\n wrapWords: false,\n startPlacementPreference: 'bottom',\n applyTooltipOverflowWrap: false,\n customOffset: mockCustomOffset,\n};\n\n// we omit children because children MUST be passed ALWAYS via the JSX composition react pattern\nconst testInternalProps: Omit<ComponentPropsInternals, 'children'> = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// we omit children because children MUST be passed ALWAYS via the JSX composition react pattern\nconst testExplicitDefinition: Omit<ComponentPropsForApp, 'children'> = {\n id: 'id',\n onOpen: () => {},\n onClose: () => {},\n textAlign: 'center',\n wrapWords: false,\n applyTooltipOverflowWrap: false,\n text: '',\n withoutPortal: false,\n withoutArrow: false,\n withoutAnimation: false,\n animationDuration: 1000,\n portalDOMContainer: undefined,\n startPlacementPreference: 'bottom',\n customOffset: mockCustomOffset,\n showPopover: true,\n};\n\nconst testExplicitDefinitionWithBoth: Omit<ComponentPropsForApp, 'children'> = {\n ...testExplicitDefinition,\n text: 'String does not takes precedence',\n Text: FixedTextComponent,\n};\n\nconst testExplicitDefinitionWithOnlyTextComponent: Omit<ComponentPropsForApp, 'children'> = {\n ...testExplicitDefinition,\n Text: FixedTextComponent,\n};\nconst testExplicitDefinitionWithOnlyTextString: Omit<ComponentPropsForApp, 'children'> = {\n ...testExplicitDefinition,\n text: 'String Tooltip',\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n id: 'id',\n onOpen: () => {},\n onClose: () => {},\n textAlign: 'center',\n wrapWords: false,\n applyTooltipOverflowWrap: false,\n text: '',\n withoutPortal: false,\n withoutArrow: false,\n withoutAnimation: false,\n animationDuration: 1000,\n portalDOMContainer: undefined,\n startPlacementPreference: 'bottom',\n customOffset: mockCustomOffset,\n showPopover: true,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n id: 'id',\n onOpen: () => {},\n onClose: () => {},\n textAlign: 'center',\n wrapWords: false,\n text: '',\n withoutPortal: false,\n withoutArrow: false,\n withoutAnimation: false,\n animationDuration: 1000,\n portalDOMContainer: undefined,\n startPlacementPreference: 'bottom',\n customOffset: mockCustomOffset,\n showPopover: true,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSTooltipV3 {...testExplicitDefinition}>\n <div></div>\n </DSTooltipV3>\n <DSTooltipV3 {...testInferedTypeCompatibility}>\n <div></div>\n </DSTooltipV3>\n <DSTooltipV3 {...testDefinitionAsConst}>\n <div></div>\n </DSTooltipV3>\n {/* works with inline values */}\n <DSTooltipV3\n id=\"id\"\n onOpen={() => {}}\n onClose={() => {}}\n textAlign=\"center\"\n wrapWords={false}\n text=\"\"\n withoutPortal={false}\n withoutArrow={false}\n withoutAnimation={false}\n animationDuration={1000}\n portalDOMContainer={undefined}\n startPlacementPreference=\"bottom\"\n customOffset={[0, 0]}\n showPopover\n >\n <div />\n </DSTooltipV3>\n\n {/* with both text and Text, Text takes precedence */}\n <DSTooltipV3 {...testExplicitDefinitionWithBoth}>\n <div>Hover me (Text Component takes precedence)</div>\n </DSTooltipV3>\n\n {/* with only Text Component */}\n <DSTooltipV3 {...testExplicitDefinitionWithOnlyTextComponent}>\n <div>Hover me (only Text Component)</div>\n </DSTooltipV3>\n\n {/* with only Text String */}\n <DSTooltipV3 {...testExplicitDefinitionWithOnlyTextString}>\n <div>Hover me (only text string)</div>\n </DSTooltipV3>\n </>\n);\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -13,17 +13,11 @@ const DSTooltipV3PropTypes = {
|
|
|
13
13
|
children: PropTypes.node.description("Element to tie the tooltip to, must be a single node").isRequired,
|
|
14
14
|
withoutPortal: PropTypes.bool.description("Whether or not the tooltip content should appear in a DOM portal or not").defaultValue(true),
|
|
15
15
|
withoutArrow: PropTypes.bool.description("Whether or not the tooltip should use the arrow").defaultValue(false),
|
|
16
|
-
boundaryElement: PropTypes.element.description(
|
|
17
|
-
'Bounding element to calculate upon, defaults to "clippingParents",which are the scrolling containers that may cause element to be partially or fully cut off'
|
|
18
|
-
).defaultValue(void 0),
|
|
19
16
|
withoutAnimation: PropTypes.bool.description("Whether or not the popper context menu should be animated").defaultValue(false),
|
|
20
17
|
animationDuration: PropTypes.number.description("Popper context menus Animation duration in ms").defaultValue(100),
|
|
21
18
|
portalDOMContainer: PropTypes.oneOfType([PropTypes.node, PropTypes.oneOf([null])]).description("When using portal, the container in which to append the DOM content, defaults to document body").defaultValue(void 0),
|
|
22
19
|
startPlacementPreference: PropTypes.oneOf(PLACEMENT).description("start placement preferences, as per popperjs placement option").defaultValue("'top'"),
|
|
23
|
-
placementOrderPreference: PropTypes.arrayOf(PropTypes.oneOf(PLACEMENT)).description('Array of placement preferences, as per popperjs "flip" placement option').defaultValue("['top', 'bottom', 'left', 'right']"),
|
|
24
|
-
zIndex: PropTypes.number.description("popperjs content z-index").defaultValue(1),
|
|
25
20
|
customOffset: PropTypes.arrayOf(PropTypes.number).description("placement offset array").defaultValue([0, 14]),
|
|
26
|
-
modifiers: PropTypes.array.description("modifiers array for full-custom tooltip-js override, https://popper.js.org/docs/v2/modifiers/").defaultValue(1),
|
|
27
21
|
id: PropTypes.string.description("Optional id appended to data-testid").defaultValue(""),
|
|
28
22
|
onOpen: PropTypes.func.description("Optional callback to be invoked when the tooltip opens").defaultValue("() => {}"),
|
|
29
23
|
onClose: PropTypes.func.description("Optional callback to be invoked when the tooltip closes").defaultValue("() => {}"),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\nimport { PLACEMENT, TEXT_ALIGNMENT } from './constants.js';\n\nexport declare namespace DSTooltipV3T {\n export type Placement =\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'left-end'\n | 'left'\n | 'left-start';\n export type TextAlignment = 'left' | 'right' | 'center' | 'justify' | 'initial' | 'inherit';\n\n export interface DefaultProps {\n onOpen: () => void;\n onClose: () => void;\n id: string;\n textAlign: TextAlignment;\n wrapWords: boolean;\n startPlacementPreference: Placement;\n applyTooltipOverflowWrap: boolean;\n customOffset?: [number, number];\n }\n\n export interface OptionalProps {\n
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,iBAAiB;AAC1B,SAAS,WAAW,sBAAsB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\nimport { PLACEMENT, TEXT_ALIGNMENT } from './constants.js';\n\nexport declare namespace DSTooltipV3T {\n export type Placement =\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'left-end'\n | 'left'\n | 'left-start';\n export type TextAlignment = 'left' | 'right' | 'center' | 'justify' | 'initial' | 'inherit';\n\n export interface DefaultProps {\n onOpen: () => void;\n onClose: () => void;\n id: string;\n textAlign: TextAlignment;\n wrapWords: boolean;\n startPlacementPreference: Placement;\n applyTooltipOverflowWrap: boolean;\n customOffset?: [number, number];\n }\n\n export interface OptionalProps {\n withoutPortal?: boolean;\n withoutArrow?: boolean;\n withoutAnimation?: boolean;\n animationDuration?: number;\n portalDOMContainer?: HTMLElement;\n showPopover?: boolean;\n Text?: React.ComponentType<Record<string, unknown>>;\n textProps?: Record<string, unknown>;\n text?: string;\n }\n\n export interface RequiredProps {\n children: React.ReactNode;\n }\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n // Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n // XstyledProps,\n RequiredProps {}\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n // Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n // XstyledProps,\n RequiredProps {}\n}\n\nexport const DSTooltipV3PropTypes: DSPropTypesSchema<DSTooltipV3T.Props> = {\n text: PropTypes.string\n .description(\n 'Tooltip text to be displayed on hover/focus. If both `text` and `Text` are provided, only `Text` will take precedence.',\n )\n .isRequiredIf((props: Record<string, unknown>) => !props.Text),\n textAlign: PropTypes.oneOf(TEXT_ALIGNMENT as unknown as unknown[])\n .description('Tooltip text alignment')\n .defaultValue('left'),\n applyTooltipOverflowWrap: PropTypes.bool\n .description(\n 'when a tooltip is present, the tooltip text may be too long to fit in the pill. If true, the tooltip will wrap to the next line using overflow-wrap',\n )\n .defaultValue(false),\n wrapWords: PropTypes.bool\n .description('Break words into a new line. Useful when words exceed tooltip max-lenght.')\n .defaultValue(false),\n children: PropTypes.node.description('Element to tie the tooltip to, must be a single node').isRequired,\n withoutPortal: PropTypes.bool\n .description('Whether or not the tooltip content should appear in a DOM portal or not')\n .defaultValue(true),\n withoutArrow: PropTypes.bool.description('Whether or not the tooltip should use the arrow').defaultValue(false),\n withoutAnimation: PropTypes.bool\n .description('Whether or not the popper context menu should be animated')\n .defaultValue(false),\n animationDuration: PropTypes.number.description('Popper context menus Animation duration in ms').defaultValue(100),\n portalDOMContainer: PropTypes.oneOfType([PropTypes.node, PropTypes.oneOf([null])])\n .description('When using portal, the container in which to append the DOM content, defaults to document body')\n .defaultValue(undefined),\n startPlacementPreference: PropTypes.oneOf(PLACEMENT)\n .description('start placement preferences, as per popperjs placement option')\n .defaultValue(\"'top'\"),\n customOffset: PropTypes.arrayOf(PropTypes.number).description('placement offset array').defaultValue([0, 14]),\n id: PropTypes.string.description('Optional id appended to data-testid').defaultValue(''),\n onOpen: PropTypes.func.description('Optional callback to be invoked when the tooltip opens').defaultValue('() => {}'),\n onClose: PropTypes.func\n .description('Optional callback to be invoked when the tooltip closes')\n .defaultValue('() => {}'),\n showPopover: PropTypes.bool.description('Whether or not the tooltip should be always shown'),\n Text: PropTypes.func\n .description(\n 'Custom component (HTML/JSX) to be displayed in the tooltip. If both `text` and `Text` are provided, only `Text` will take precedence.',\n )\n .isRequiredIf((props: Record<string, unknown>) => !props.text),\n textProps: PropTypes.object.description(\n 'Props to be passed to the custom Text component, if provided, used mainly to avoiding inline components definition to improve performance',\n ),\n};\n\nexport const DSTooltipV3PropTypesSchema = DSTooltipV3PropTypes as unknown as ValidationMap<DSTooltipV3T.Props>;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,iBAAiB;AAC1B,SAAS,WAAW,sBAAsB;AA2DnC,MAAM,uBAA8D;AAAA,EACzE,MAAM,UAAU,OACb;AAAA,IACC;AAAA,EACF,EACC,aAAa,CAAC,UAAmC,CAAC,MAAM,IAAI;AAAA,EAC/D,WAAW,UAAU,MAAM,cAAsC,EAC9D,YAAY,wBAAwB,EACpC,aAAa,MAAM;AAAA,EACtB,0BAA0B,UAAU,KACjC;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AAAA,EACrB,WAAW,UAAU,KAClB,YAAY,2EAA2E,EACvF,aAAa,KAAK;AAAA,EACrB,UAAU,UAAU,KAAK,YAAY,sDAAsD,EAAE;AAAA,EAC7F,eAAe,UAAU,KACtB,YAAY,yEAAyE,EACrF,aAAa,IAAI;AAAA,EACpB,cAAc,UAAU,KAAK,YAAY,iDAAiD,EAAE,aAAa,KAAK;AAAA,EAC9G,kBAAkB,UAAU,KACzB,YAAY,2DAA2D,EACvE,aAAa,KAAK;AAAA,EACrB,mBAAmB,UAAU,OAAO,YAAY,+CAA+C,EAAE,aAAa,GAAG;AAAA,EACjH,oBAAoB,UAAU,UAAU,CAAC,UAAU,MAAM,UAAU,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAC9E,YAAY,gGAAgG,EAC5G,aAAa,MAAS;AAAA,EACzB,0BAA0B,UAAU,MAAM,SAAS,EAChD,YAAY,+DAA+D,EAC3E,aAAa,OAAO;AAAA,EACvB,cAAc,UAAU,QAAQ,UAAU,MAAM,EAAE,YAAY,wBAAwB,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC;AAAA,EAC5G,IAAI,UAAU,OAAO,YAAY,qCAAqC,EAAE,aAAa,EAAE;AAAA,EACvF,QAAQ,UAAU,KAAK,YAAY,wDAAwD,EAAE,aAAa,UAAU;AAAA,EACpH,SAAS,UAAU,KAChB,YAAY,yDAAyD,EACrE,aAAa,UAAU;AAAA,EAC1B,aAAa,UAAU,KAAK,YAAY,mDAAmD;AAAA,EAC3F,MAAM,UAAU,KACb;AAAA,IACC;AAAA,EACF,EACC,aAAa,CAAC,UAAmC,CAAC,MAAM,IAAI;AAAA,EAC/D,WAAW,UAAU,OAAO;AAAA,IAC1B;AAAA,EACF;AACF;AAEO,MAAM,6BAA6B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { DSTooltipV3 } from "../index.js";
|
|
4
|
-
const mockPlacementOrderPreference = ["bottom-start", "bottom", "bottom-end"];
|
|
5
4
|
const mockCustomOffset = [0, 0];
|
|
6
|
-
const mockModifiers = [{}];
|
|
7
5
|
const testRequiredProps = {};
|
|
8
6
|
const TextComponentThatReceivesProps = (props) => {
|
|
9
7
|
const { title, description } = props;
|
|
@@ -15,15 +13,11 @@ const TextComponentThatReceivesProps = (props) => {
|
|
|
15
13
|
};
|
|
16
14
|
const FixedTextComponent = (props) => /* @__PURE__ */ jsx("span", { children: " hello world! " });
|
|
17
15
|
const testOptionalProps = {
|
|
18
|
-
zIndex: 1,
|
|
19
16
|
withoutPortal: false,
|
|
20
17
|
withoutArrow: false,
|
|
21
18
|
withoutAnimation: false,
|
|
22
|
-
boundaryElement: void 0,
|
|
23
19
|
animationDuration: 1e3,
|
|
24
20
|
portalDOMContainer: void 0,
|
|
25
|
-
placementOrderPreference: mockPlacementOrderPreference,
|
|
26
|
-
modifiers: mockModifiers,
|
|
27
21
|
showPopover: true,
|
|
28
22
|
Text: TextComponentThatReceivesProps,
|
|
29
23
|
textProps: {
|
|
@@ -80,17 +74,13 @@ const testExplicitDefinition = {
|
|
|
80
74
|
wrapWords: false,
|
|
81
75
|
applyTooltipOverflowWrap: false,
|
|
82
76
|
text: "",
|
|
83
|
-
zIndex: 1,
|
|
84
77
|
withoutPortal: false,
|
|
85
78
|
withoutArrow: false,
|
|
86
79
|
withoutAnimation: false,
|
|
87
|
-
boundaryElement: void 0,
|
|
88
80
|
animationDuration: 1e3,
|
|
89
81
|
portalDOMContainer: void 0,
|
|
90
82
|
startPlacementPreference: "bottom",
|
|
91
|
-
placementOrderPreference: mockPlacementOrderPreference,
|
|
92
83
|
customOffset: mockCustomOffset,
|
|
93
|
-
modifiers: mockModifiers,
|
|
94
84
|
showPopover: true
|
|
95
85
|
};
|
|
96
86
|
const testExplicitDefinitionWithBoth = {
|
|
@@ -116,17 +106,13 @@ const testInferedTypeCompatibility = {
|
|
|
116
106
|
wrapWords: false,
|
|
117
107
|
applyTooltipOverflowWrap: false,
|
|
118
108
|
text: "",
|
|
119
|
-
zIndex: 1,
|
|
120
109
|
withoutPortal: false,
|
|
121
110
|
withoutArrow: false,
|
|
122
111
|
withoutAnimation: false,
|
|
123
|
-
boundaryElement: void 0,
|
|
124
112
|
animationDuration: 1e3,
|
|
125
113
|
portalDOMContainer: void 0,
|
|
126
114
|
startPlacementPreference: "bottom",
|
|
127
|
-
placementOrderPreference: mockPlacementOrderPreference,
|
|
128
115
|
customOffset: mockCustomOffset,
|
|
129
|
-
modifiers: mockModifiers,
|
|
130
116
|
showPopover: true
|
|
131
117
|
};
|
|
132
118
|
const testDefinitionAsConst = {
|
|
@@ -138,17 +124,13 @@ const testDefinitionAsConst = {
|
|
|
138
124
|
textAlign: "center",
|
|
139
125
|
wrapWords: false,
|
|
140
126
|
text: "",
|
|
141
|
-
zIndex: 1,
|
|
142
127
|
withoutPortal: false,
|
|
143
128
|
withoutArrow: false,
|
|
144
129
|
withoutAnimation: false,
|
|
145
|
-
boundaryElement: void 0,
|
|
146
130
|
animationDuration: 1e3,
|
|
147
131
|
portalDOMContainer: void 0,
|
|
148
132
|
startPlacementPreference: "bottom",
|
|
149
|
-
placementOrderPreference: mockPlacementOrderPreference,
|
|
150
133
|
customOffset: mockCustomOffset,
|
|
151
|
-
modifiers: mockModifiers,
|
|
152
134
|
showPopover: true
|
|
153
135
|
};
|
|
154
136
|
const ExampleUsageComponent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -166,17 +148,13 @@ const ExampleUsageComponent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
|
166
148
|
textAlign: "center",
|
|
167
149
|
wrapWords: false,
|
|
168
150
|
text: "",
|
|
169
|
-
zIndex: 1,
|
|
170
151
|
withoutPortal: false,
|
|
171
152
|
withoutArrow: false,
|
|
172
153
|
withoutAnimation: false,
|
|
173
|
-
boundaryElement: void 0,
|
|
174
154
|
animationDuration: 1e3,
|
|
175
155
|
portalDOMContainer: void 0,
|
|
176
156
|
startPlacementPreference: "bottom",
|
|
177
|
-
placementOrderPreference: ["bottom-start", "bottom", "bottom-end"],
|
|
178
157
|
customOffset: [0, 0],
|
|
179
|
-
modifiers: [],
|
|
180
158
|
showPopover: true,
|
|
181
159
|
children: /* @__PURE__ */ jsx("div", {})
|
|
182
160
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-tooltip-v3-valid.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSTooltipV3 } from '../index.js';\nimport type { DSTooltipV3T } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSTooltipV3T.Props;\ntype ComponentPropsInternals = DSTooltipV3T.InternalProps;\ntype ComponentPropsDefaultProps = DSTooltipV3T.DefaultProps;\ntype ComponentPropsOptionalProps = DSTooltipV3T.OptionalProps;\ntype ComponentPropsRequiredProps = DSTooltipV3T.RequiredProps;\n\nconst
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSTooltipV3 } from '../index.js';\nimport type { DSTooltipV3T } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSTooltipV3T.Props;\ntype ComponentPropsInternals = DSTooltipV3T.InternalProps;\ntype ComponentPropsDefaultProps = DSTooltipV3T.DefaultProps;\ntype ComponentPropsOptionalProps = DSTooltipV3T.OptionalProps;\ntype ComponentPropsRequiredProps = DSTooltipV3T.RequiredProps;\n\nconst mockCustomOffset: DSTooltipV3T.DefaultProps['customOffset'] = [0, 0];\n\nconst testRequiredProps: Omit<ComponentPropsRequiredProps, 'children'> = {};\n\nconst TextComponentThatReceivesProps: Required<DSTooltipV3T.Props>['Text'] = (props) => {\n const { title, description } = props as unknown as {\n title: string;\n description: string;\n };\n return (\n <span>\n {title} - {description}\n </span>\n );\n};\nconst FixedTextComponent: Required<DSTooltipV3T.Props>['Text'] = (props) => <span> hello world! </span>;\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n withoutPortal: false,\n withoutArrow: false,\n withoutAnimation: false,\n animationDuration: 1000,\n portalDOMContainer: undefined,\n showPopover: true,\n Text: TextComponentThatReceivesProps,\n textProps: {\n title: 'Custom Tooltip Title',\n description: 'Custom Tooltip Description',\n },\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n id: '',\n onOpen: () => {},\n onClose: () => {},\n};\n\n// we omit children because children MUST be passed ALWAYS via the JSX composition react pattern\nconst testProps: Omit<ComponentPropsForApp, 'children'> = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n id: 'id',\n onOpen: () => {},\n onClose: () => {},\n textAlign: 'center',\n wrapWords: false,\n startPlacementPreference: 'bottom',\n applyTooltipOverflowWrap: false,\n customOffset: mockCustomOffset,\n};\n\n// we omit children because children MUST be passed ALWAYS via the JSX composition react pattern\nconst testInternalProps: Omit<ComponentPropsInternals, 'children'> = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// we omit children because children MUST be passed ALWAYS via the JSX composition react pattern\nconst testExplicitDefinition: Omit<ComponentPropsForApp, 'children'> = {\n id: 'id',\n onOpen: () => {},\n onClose: () => {},\n textAlign: 'center',\n wrapWords: false,\n applyTooltipOverflowWrap: false,\n text: '',\n withoutPortal: false,\n withoutArrow: false,\n withoutAnimation: false,\n animationDuration: 1000,\n portalDOMContainer: undefined,\n startPlacementPreference: 'bottom',\n customOffset: mockCustomOffset,\n showPopover: true,\n};\n\nconst testExplicitDefinitionWithBoth: Omit<ComponentPropsForApp, 'children'> = {\n ...testExplicitDefinition,\n text: 'String does not takes precedence',\n Text: FixedTextComponent,\n};\n\nconst testExplicitDefinitionWithOnlyTextComponent: Omit<ComponentPropsForApp, 'children'> = {\n ...testExplicitDefinition,\n Text: FixedTextComponent,\n};\nconst testExplicitDefinitionWithOnlyTextString: Omit<ComponentPropsForApp, 'children'> = {\n ...testExplicitDefinition,\n text: 'String Tooltip',\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n id: 'id',\n onOpen: () => {},\n onClose: () => {},\n textAlign: 'center',\n wrapWords: false,\n applyTooltipOverflowWrap: false,\n text: '',\n withoutPortal: false,\n withoutArrow: false,\n withoutAnimation: false,\n animationDuration: 1000,\n portalDOMContainer: undefined,\n startPlacementPreference: 'bottom',\n customOffset: mockCustomOffset,\n showPopover: true,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n id: 'id',\n onOpen: () => {},\n onClose: () => {},\n textAlign: 'center',\n wrapWords: false,\n text: '',\n withoutPortal: false,\n withoutArrow: false,\n withoutAnimation: false,\n animationDuration: 1000,\n portalDOMContainer: undefined,\n startPlacementPreference: 'bottom',\n customOffset: mockCustomOffset,\n showPopover: true,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSTooltipV3 {...testExplicitDefinition}>\n <div></div>\n </DSTooltipV3>\n <DSTooltipV3 {...testInferedTypeCompatibility}>\n <div></div>\n </DSTooltipV3>\n <DSTooltipV3 {...testDefinitionAsConst}>\n <div></div>\n </DSTooltipV3>\n {/* works with inline values */}\n <DSTooltipV3\n id=\"id\"\n onOpen={() => {}}\n onClose={() => {}}\n textAlign=\"center\"\n wrapWords={false}\n text=\"\"\n withoutPortal={false}\n withoutArrow={false}\n withoutAnimation={false}\n animationDuration={1000}\n portalDOMContainer={undefined}\n startPlacementPreference=\"bottom\"\n customOffset={[0, 0]}\n showPopover\n >\n <div />\n </DSTooltipV3>\n\n {/* with both text and Text, Text takes precedence */}\n <DSTooltipV3 {...testExplicitDefinitionWithBoth}>\n <div>Hover me (Text Component takes precedence)</div>\n </DSTooltipV3>\n\n {/* with only Text Component */}\n <DSTooltipV3 {...testExplicitDefinitionWithOnlyTextComponent}>\n <div>Hover me (only Text Component)</div>\n </DSTooltipV3>\n\n {/* with only Text String */}\n <DSTooltipV3 {...testExplicitDefinitionWithOnlyTextString}>\n <div>Hover me (only text string)</div>\n </DSTooltipV3>\n </>\n);\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
/// <reference types="prop-types" />
|
|
3
1
|
import type { DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';
|
|
4
2
|
export declare namespace DSTooltipV3T {
|
|
5
3
|
type Placement = 'top-start' | 'top' | 'top-end' | 'right-start' | 'right' | 'right-end' | 'bottom-end' | 'bottom' | 'bottom-start' | 'left-end' | 'left' | 'left-start';
|
|
@@ -15,15 +13,11 @@ export declare namespace DSTooltipV3T {
|
|
|
15
13
|
customOffset?: [number, number];
|
|
16
14
|
}
|
|
17
15
|
interface OptionalProps {
|
|
18
|
-
zIndex?: number;
|
|
19
16
|
withoutPortal?: boolean;
|
|
20
17
|
withoutArrow?: boolean;
|
|
21
18
|
withoutAnimation?: boolean;
|
|
22
|
-
boundaryElement?: HTMLElement;
|
|
23
19
|
animationDuration?: number;
|
|
24
20
|
portalDOMContainer?: HTMLElement;
|
|
25
|
-
placementOrderPreference?: Placement[];
|
|
26
|
-
modifiers?: Record<string, unknown>[];
|
|
27
21
|
showPopover?: boolean;
|
|
28
22
|
Text?: React.ComponentType<Record<string, unknown>>;
|
|
29
23
|
textProps?: Record<string, unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-tooltip-v3",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.54.0-beta.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Tooltip V3",
|
|
6
6
|
"files": [
|
|
@@ -36,20 +36,21 @@
|
|
|
36
36
|
"indent": 4
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@elliemae/ds-button": "3.
|
|
40
|
-
"@elliemae/ds-floating-context": "3.
|
|
41
|
-
"@elliemae/ds-props-helpers": "3.
|
|
42
|
-
"@elliemae/ds-shared": "3.
|
|
43
|
-
"@elliemae/ds-system": "3.
|
|
39
|
+
"@elliemae/ds-button": "3.54.0-beta.1",
|
|
40
|
+
"@elliemae/ds-floating-context": "3.54.0-beta.1",
|
|
41
|
+
"@elliemae/ds-props-helpers": "3.54.0-beta.1",
|
|
42
|
+
"@elliemae/ds-shared": "3.54.0-beta.1",
|
|
43
|
+
"@elliemae/ds-system": "3.54.0-beta.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@elliemae/pui-cli": "9.0.0-next.
|
|
46
|
+
"@elliemae/pui-cli": "9.0.0-next.65",
|
|
47
47
|
"jest": "~29.7.0",
|
|
48
48
|
"react": "^18.3.1",
|
|
49
49
|
"react-dom": "^18.3.1",
|
|
50
50
|
"styled-components": "~5.3.9",
|
|
51
|
-
"@elliemae/ds-grid": "3.
|
|
52
|
-
"@elliemae/ds-monorepo-devops": "3.
|
|
51
|
+
"@elliemae/ds-grid": "3.54.0-beta.1",
|
|
52
|
+
"@elliemae/ds-monorepo-devops": "3.54.0-beta.1",
|
|
53
|
+
"@elliemae/ds-test-utils": "3.54.0-beta.1"
|
|
53
54
|
},
|
|
54
55
|
"peerDependencies": {
|
|
55
56
|
"react": "^18.3.1",
|