@redsift/design-system 11.6.0-muiv5-alpha.2 → 11.6.0-muiv5-alpha.4
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/components/alert/Alert.js +8 -8
- package/components/alert/Alert.js.map +1 -1
- package/components/app-bar/AppBar.js +11 -11
- package/components/app-bar/AppBar.js.map +1 -1
- package/components/app-container/AppContainer.js +16 -16
- package/components/app-container/AppContainer.js.map +1 -1
- package/components/app-container/context.js +2 -2
- package/components/app-container/context.js.map +1 -1
- package/components/app-content/AppContent.js +2 -2
- package/components/app-content/AppContent.js.map +1 -1
- package/components/app-side-panel/AppSidePanel.js +8 -8
- package/components/app-side-panel/AppSidePanel.js.map +1 -1
- package/components/app-side-panel/useAppSidePanel.js +2 -2
- package/components/app-side-panel/useAppSidePanel.js.map +1 -1
- package/components/badge/Badge.js +2 -2
- package/components/badge/Badge.js.map +1 -1
- package/components/breadcrumb-item/BreadcrumbItem.js +2 -2
- package/components/breadcrumb-item/BreadcrumbItem.js.map +1 -1
- package/components/breadcrumbs/Breadcrumbs.js +7 -7
- package/components/breadcrumbs/Breadcrumbs.js.map +1 -1
- package/components/button/Button.js +7 -7
- package/components/button/Button.js.map +1 -1
- package/components/button-group/ButtonGroup.js +4 -4
- package/components/button-group/ButtonGroup.js.map +1 -1
- package/components/button-link/ButtonLink.js +6 -6
- package/components/button-link/ButtonLink.js.map +1 -1
- package/components/card/Card.js +7 -7
- package/components/card/Card.js.map +1 -1
- package/components/card-actions/CardActions.js +2 -2
- package/components/card-actions/CardActions.js.map +1 -1
- package/components/card-body/CardBody.js +2 -2
- package/components/card-body/CardBody.js.map +1 -1
- package/components/card-header/CardHeader.js +7 -7
- package/components/card-header/CardHeader.js.map +1 -1
- package/components/checkbox/Checkbox.js +7 -7
- package/components/checkbox/Checkbox.js.map +1 -1
- package/components/checkbox-group/CheckboxGroup.js +7 -7
- package/components/checkbox-group/CheckboxGroup.js.map +1 -1
- package/components/checkbox-group/context.js +2 -2
- package/components/checkbox-group/context.js.map +1 -1
- package/components/conditional-wrapper/ConditionalWrapper.js +2 -2
- package/components/conditional-wrapper/ConditionalWrapper.js.map +1 -1
- package/components/detailed-card/DetailedCard.js +20 -20
- package/components/detailed-card/DetailedCard.js.map +1 -1
- package/components/detailed-card/types.d.ts +10 -1
- package/components/detailed-card-collapsible-section-items/DetailedCardCollapsibleSectionItems.js +3 -3
- package/components/detailed-card-collapsible-section-items/DetailedCardCollapsibleSectionItems.js.map +1 -1
- package/components/detailed-card-header/DetailedCardHeader.js +4 -4
- package/components/detailed-card-header/DetailedCardHeader.js.map +1 -1
- package/components/detailed-card-section/DetailedCardSection.js +10 -10
- package/components/detailed-card-section/DetailedCardSection.js.map +1 -1
- package/components/detailed-card-section-item/DetailedCardSectionItem.js +12 -12
- package/components/detailed-card-section-item/DetailedCardSectionItem.js.map +1 -1
- package/components/flexbox/Flexbox.js +3 -3
- package/components/flexbox/Flexbox.js.map +1 -1
- package/components/focus-within-group/FocusWithinGroup.js +2 -2
- package/components/focus-within-group/FocusWithinGroup.js.map +1 -1
- package/components/focus-within-group/context.js +2 -2
- package/components/focus-within-group/context.js.map +1 -1
- package/components/grid/Grid.js +3 -3
- package/components/grid/Grid.js.map +1 -1
- package/components/grid-item/GridItem.js +2 -2
- package/components/grid-item/GridItem.js.map +1 -1
- package/components/heading/Heading.js +2 -2
- package/components/heading/Heading.js.map +1 -1
- package/components/icon/Icon.js +5 -5
- package/components/icon/Icon.js.map +1 -1
- package/components/icon-button/IconButton.js +6 -6
- package/components/icon-button/IconButton.js.map +1 -1
- package/components/icon-button-link/IconButtonLink.js +5 -5
- package/components/icon-button-link/IconButtonLink.js.map +1 -1
- package/components/item/Item.js +19 -19
- package/components/item/Item.js.map +1 -1
- package/components/link/Link.js +5 -5
- package/components/link/Link.js.map +1 -1
- package/components/link-button/LinkButton.js +5 -5
- package/components/link-button/LinkButton.js.map +1 -1
- package/components/listbox/ActiveDescendantListbox.d.ts +1 -1
- package/components/listbox/ActiveDescendantListbox.js +3 -3
- package/components/listbox/ActiveDescendantListbox.js.map +1 -1
- package/components/listbox/Listbox.js +8 -8
- package/components/listbox/Listbox.js.map +1 -1
- package/components/listbox/RovingTabindexListbox.d.ts +1 -1
- package/components/listbox/RovingTabindexListbox.js +3 -3
- package/components/listbox/RovingTabindexListbox.js.map +1 -1
- package/components/listbox/context.js +2 -2
- package/components/listbox/context.js.map +1 -1
- package/components/number/Number.js +2 -2
- package/components/number/Number.js.map +1 -1
- package/components/number-field/NumberField.js +16 -16
- package/components/number-field/NumberField.js.map +1 -1
- package/components/pill/Pill.js +10 -10
- package/components/pill/Pill.js.map +1 -1
- package/components/progress-bar/ProgressBar.js +2 -2
- package/components/progress-bar/ProgressBar.js.map +1 -1
- package/components/radio/Radio.js +6 -6
- package/components/radio/Radio.js.map +1 -1
- package/components/radio-group/RadioGroup.js +7 -7
- package/components/radio-group/RadioGroup.js.map +1 -1
- package/components/radio-group/context.js +2 -2
- package/components/radio-group/context.js.map +1 -1
- package/components/shield/Shield.js +5 -5
- package/components/shield/Shield.js.map +1 -1
- package/components/side-navigation-menu/SideNavigationMenu.js +16 -16
- package/components/side-navigation-menu/SideNavigationMenu.js.map +1 -1
- package/components/side-navigation-menu/context.js +2 -2
- package/components/side-navigation-menu/context.js.map +1 -1
- package/components/side-navigation-menu-bar/SideNavigationMenuBar.js +7 -7
- package/components/side-navigation-menu-bar/SideNavigationMenuBar.js.map +1 -1
- package/components/side-navigation-menu-bar/context.js +2 -2
- package/components/side-navigation-menu-bar/context.js.map +1 -1
- package/components/side-navigation-menu-bar/useSideNavigationMenuBar.js +4 -4
- package/components/side-navigation-menu-bar/useSideNavigationMenuBar.js.map +1 -1
- package/components/side-navigation-menu-item/SideNavigationMenuItem.js +9 -9
- package/components/side-navigation-menu-item/SideNavigationMenuItem.js.map +1 -1
- package/components/skeleton/Skeleton.js +4 -4
- package/components/skeleton/Skeleton.js.map +1 -1
- package/components/skeleton-circle/SkeletonCircle.js +4 -4
- package/components/skeleton-circle/SkeletonCircle.js.map +1 -1
- package/components/skeleton-text/SkeletonText.js +4 -4
- package/components/skeleton-text/SkeletonText.js.map +1 -1
- package/components/spinner/Spinner.js +2 -2
- package/components/spinner/Spinner.js.map +1 -1
- package/components/switch/Switch.js +9 -9
- package/components/switch/Switch.js.map +1 -1
- package/components/switch-group/SwitchGroup.js +7 -7
- package/components/switch-group/SwitchGroup.js.map +1 -1
- package/components/switch-group/context.js +2 -2
- package/components/switch-group/context.js.map +1 -1
- package/components/text/Text.js +2 -2
- package/components/text/Text.js.map +1 -1
- package/components/text-area/TextArea.js +11 -11
- package/components/text-area/TextArea.js.map +1 -1
- package/components/text-field/TextField.js +13 -13
- package/components/text-field/TextField.js.map +1 -1
- package/components/theme/context.js +2 -2
- package/components/theme/context.js.map +1 -1
- package/package.json +6 -2
- package/react-aria/react-aria/focus/useFocusable.js +2 -2
- package/react-aria/react-aria/focus/useFocusable.js.map +1 -1
- package/react-aria/react-aria/i18n/context.js +4 -4
- package/react-aria/react-aria/i18n/context.js.map +1 -1
- package/react-aria/react-aria/interactions/context.js +2 -2
- package/react-aria/react-aria/interactions/context.js.map +1 -1
- package/react-aria/react-aria/ssr/SSRProvider.js +13 -13
- package/react-aria/react-aria/ssr/SSRProvider.js.map +1 -1
- package/react-aria/react-aria/utils/mergeProps.js +2 -2
- package/react-aria/react-aria/utils/mergeProps.js.map +1 -1
- package/react-aria/react-aria/utils/useLayoutEffect.js +2 -2
- package/react-aria/react-aria/utils/useLayoutEffect.js.map +1 -1
- package/utils/filterComponents.js +2 -2
- package/utils/filterComponents.js.map +1 -1
- package/utils/isComponent.js +2 -2
- package/utils/isComponent.js.map +1 -1
- package/utils/useId.js +4 -4
- package/utils/useId.js.map +1 -1
- package/_virtual/jsx-runtime.js +0 -4
- package/_virtual/jsx-runtime.js.map +0 -1
- package/_virtual/react-jsx-runtime.development.js +0 -4
- package/_virtual/react-jsx-runtime.development.js.map +0 -1
- package/_virtual/react-jsx-runtime.production.min.js +0 -4
- package/_virtual/react-jsx-runtime.production.min.js.map +0 -1
- package/packages/popovers/src/components/tooltip/Tooltip.js +0 -62
- package/packages/popovers/src/components/tooltip/Tooltip.js.map +0 -1
- package/packages/popovers/src/components/tooltip/context.js +0 -6
- package/packages/popovers/src/components/tooltip/context.js.map +0 -1
- package/packages/popovers/src/components/tooltip/types.js +0 -28
- package/packages/popovers/src/components/tooltip/types.js.map +0 -1
- package/packages/popovers/src/components/tooltip/useTooltip.js +0 -78
- package/packages/popovers/src/components/tooltip/useTooltip.js.map +0 -1
- package/packages/popovers/src/components/tooltip/useTooltipContext.js +0 -13
- package/packages/popovers/src/components/tooltip/useTooltipContext.js.map +0 -1
- package/packages/popovers/src/components/tooltip-content/TooltipContent.js +0 -80
- package/packages/popovers/src/components/tooltip-content/TooltipContent.js.map +0 -1
- package/packages/popovers/src/components/tooltip-content/styles.js +0 -128
- package/packages/popovers/src/components/tooltip-content/styles.js.map +0 -1
- package/packages/popovers/src/components/tooltip-trigger/TooltipTrigger.js +0 -47
- package/packages/popovers/src/components/tooltip-trigger/TooltipTrigger.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeProps.js","sources":["../../../../src/react-aria/react-aria/utils/mergeProps.ts"],"sourcesContent":["/* eslint-disable prefer-const */\n// @ts-nocheck\n/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { chain } from './chain';\nimport clsx from 'clsx';\nimport { mergeIds } from './useId';\n\ninterface Props {\n [key: string]: any;\n}\n\ntype PropsArg = Props | null | undefined;\n\n// taken from: https://stackoverflow.com/questions/51603250/typescript-3-parameter-list-intersection-type/51604379#51604379\ntype TupleTypes<T> = { [P in keyof T]: T[P] } extends { [key: number]: infer V } ? NullToObject<V> : never;\ntype NullToObject<T> = T extends null | undefined ? {} : T;\n// eslint-disable-next-line no-undef, @typescript-eslint/no-unused-vars\ntype UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;\n\n/**\n * Merges multiple props objects together. Event handlers are chained,\n * classNames are combined, and ids are deduplicated - different ids\n * will trigger a side-effect and re-render components hooked up with `useId`.\n * For all other props, the last prop object overrides all previous ones.\n * @param args - Multiple sets of props to merge together.\n */\nexport function mergeProps<T extends PropsArg[]>(...args: T): UnionToIntersection<TupleTypes<T>> {\n // Start with a base clone of the first argument. This is a lot faster than starting\n // with an empty object and adding properties as we go.\n let result: Props = { ...args[0] };\n for (let i = 1; i < args.length; i++) {\n let props = args[i];\n for (let key in props) {\n let a = result[key];\n let b = props[key];\n\n // Chain events\n if (\n typeof a === 'function' &&\n typeof b === 'function' &&\n // This is a lot faster than a regex.\n key[0] === 'o' &&\n key[1] === 'n' &&\n key.charCodeAt(2) >= /* 'A' */ 65 &&\n key.charCodeAt(2) <= /* 'Z' */ 90\n ) {\n result[key] = chain(a, b);\n\n // Merge classnames, sometimes classNames are empty string which eval to false, so we just need to do a type check\n } else if (\n (key === 'className' || key === 'UNSAFE_className') &&\n typeof a === 'string' &&\n typeof b === 'string'\n ) {\n result[key] = clsx(a, b);\n } else if (key === 'id' && a && b) {\n result.id = mergeIds(a, b);\n // Override others\n } else {\n result[key] = b !== undefined ? b : a;\n }\n }\n }\n\n return result as UnionToIntersection<TupleTypes<T>>;\n}\n"],"names":["mergeProps","result","_objectSpread","arguments","length","undefined","i","props","key","a","b","charCodeAt","chain","clsx","id","mergeIds"],"mappings":";;;;;AAwBA;;AAGA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,UAAUA,GAAuE;AAC/F;AACA;EACA,IAAIC,MAAa,GAAAC,cAAA,CAAAC,EAAAA,EAAAA,SAAA,CAAAC,MAAA,IAAAC,CAAAA,GAAAA,SAAA,GAAAF,SAAA,CAAiB,CAAA,CAAA,CAAA,CAAA;AAClC,EAAA,KAAK,IAAIG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,SAAA,CAAKC,MAAM,EAAEE,CAAC,EAAE,EAAE;AACpC,IAAA,IAAIC,KAAK,GAAQD,CAAC,GAAA,CAAA,IAAAH,SAAA,CAAAC,MAAA,IAADE,CAAC,GAAAD,SAAA,GAAAF,SAAA,CAADG,CAAC,CAAC,CAAA;AACnB,IAAA,KAAK,IAAIE,GAAG,IAAID,KAAK,EAAE;AACrB,MAAA,IAAIE,CAAC,GAAGR,MAAM,CAACO,GAAG,CAAC,CAAA;AACnB,MAAA,IAAIE,CAAC,GAAGH,KAAK,CAACC,GAAG,CAAC,CAAA;;AAElB;MACA,IACE,OAAOC,CAAC,KAAK,UAAU,IACvB,OAAOC,CAAC,KAAK,UAAU;AACvB;AACAF,MAAAA,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IACdA,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IACdA,GAAG,CAACG,UAAU,CAAC,CAAC,CAAC,aAAc,EAAE,IACjCH,GAAG,CAACG,UAAU,CAAC,CAAC,CAAC,aAAc,EAAE,EACjC;QACAV,MAAM,CAACO,GAAG,CAAC,GAAGI,KAAK,CAACH,CAAC,EAAEC,CAAC,CAAC,CAAA;;AAEzB;OACD,MAAM,IACL,CAACF,GAAG,KAAK,WAAW,IAAIA,GAAG,KAAK,kBAAkB,KAClD,OAAOC,CAAC,KAAK,QAAQ,IACrB,OAAOC,CAAC,KAAK,QAAQ,EACrB;QACAT,MAAM,CAACO,GAAG,CAAC,GAAGK,
|
|
1
|
+
{"version":3,"file":"mergeProps.js","sources":["../../../../src/react-aria/react-aria/utils/mergeProps.ts"],"sourcesContent":["/* eslint-disable prefer-const */\n// @ts-nocheck\n/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { chain } from './chain';\nimport clsx from 'clsx';\nimport { mergeIds } from './useId';\n\ninterface Props {\n [key: string]: any;\n}\n\ntype PropsArg = Props | null | undefined;\n\n// taken from: https://stackoverflow.com/questions/51603250/typescript-3-parameter-list-intersection-type/51604379#51604379\ntype TupleTypes<T> = { [P in keyof T]: T[P] } extends { [key: number]: infer V } ? NullToObject<V> : never;\ntype NullToObject<T> = T extends null | undefined ? {} : T;\n// eslint-disable-next-line no-undef, @typescript-eslint/no-unused-vars\ntype UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;\n\n/**\n * Merges multiple props objects together. Event handlers are chained,\n * classNames are combined, and ids are deduplicated - different ids\n * will trigger a side-effect and re-render components hooked up with `useId`.\n * For all other props, the last prop object overrides all previous ones.\n * @param args - Multiple sets of props to merge together.\n */\nexport function mergeProps<T extends PropsArg[]>(...args: T): UnionToIntersection<TupleTypes<T>> {\n // Start with a base clone of the first argument. This is a lot faster than starting\n // with an empty object and adding properties as we go.\n let result: Props = { ...args[0] };\n for (let i = 1; i < args.length; i++) {\n let props = args[i];\n for (let key in props) {\n let a = result[key];\n let b = props[key];\n\n // Chain events\n if (\n typeof a === 'function' &&\n typeof b === 'function' &&\n // This is a lot faster than a regex.\n key[0] === 'o' &&\n key[1] === 'n' &&\n key.charCodeAt(2) >= /* 'A' */ 65 &&\n key.charCodeAt(2) <= /* 'Z' */ 90\n ) {\n result[key] = chain(a, b);\n\n // Merge classnames, sometimes classNames are empty string which eval to false, so we just need to do a type check\n } else if (\n (key === 'className' || key === 'UNSAFE_className') &&\n typeof a === 'string' &&\n typeof b === 'string'\n ) {\n result[key] = clsx(a, b);\n } else if (key === 'id' && a && b) {\n result.id = mergeIds(a, b);\n // Override others\n } else {\n result[key] = b !== undefined ? b : a;\n }\n }\n }\n\n return result as UnionToIntersection<TupleTypes<T>>;\n}\n"],"names":["mergeProps","result","_objectSpread","arguments","length","undefined","i","props","key","a","b","charCodeAt","chain","clsx","id","mergeIds"],"mappings":";;;;;AAwBA;;AAGA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,UAAUA,GAAuE;AAC/F;AACA;EACA,IAAIC,MAAa,GAAAC,cAAA,CAAAC,EAAAA,EAAAA,SAAA,CAAAC,MAAA,IAAAC,CAAAA,GAAAA,SAAA,GAAAF,SAAA,CAAiB,CAAA,CAAA,CAAA,CAAA;AAClC,EAAA,KAAK,IAAIG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,SAAA,CAAKC,MAAM,EAAEE,CAAC,EAAE,EAAE;AACpC,IAAA,IAAIC,KAAK,GAAQD,CAAC,GAAA,CAAA,IAAAH,SAAA,CAAAC,MAAA,IAADE,CAAC,GAAAD,SAAA,GAAAF,SAAA,CAADG,CAAC,CAAC,CAAA;AACnB,IAAA,KAAK,IAAIE,GAAG,IAAID,KAAK,EAAE;AACrB,MAAA,IAAIE,CAAC,GAAGR,MAAM,CAACO,GAAG,CAAC,CAAA;AACnB,MAAA,IAAIE,CAAC,GAAGH,KAAK,CAACC,GAAG,CAAC,CAAA;;AAElB;MACA,IACE,OAAOC,CAAC,KAAK,UAAU,IACvB,OAAOC,CAAC,KAAK,UAAU;AACvB;AACAF,MAAAA,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IACdA,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IACdA,GAAG,CAACG,UAAU,CAAC,CAAC,CAAC,aAAc,EAAE,IACjCH,GAAG,CAACG,UAAU,CAAC,CAAC,CAAC,aAAc,EAAE,EACjC;QACAV,MAAM,CAACO,GAAG,CAAC,GAAGI,KAAK,CAACH,CAAC,EAAEC,CAAC,CAAC,CAAA;;AAEzB;OACD,MAAM,IACL,CAACF,GAAG,KAAK,WAAW,IAAIA,GAAG,KAAK,kBAAkB,KAClD,OAAOC,CAAC,KAAK,QAAQ,IACrB,OAAOC,CAAC,KAAK,QAAQ,EACrB;QACAT,MAAM,CAACO,GAAG,CAAC,GAAGK,IAAI,CAACJ,CAAC,EAAEC,CAAC,CAAC,CAAA;OACzB,MAAM,IAAIF,GAAG,KAAK,IAAI,IAAIC,CAAC,IAAIC,CAAC,EAAE;QACjCT,MAAM,CAACa,EAAE,GAAGC,QAAQ,CAACN,CAAC,EAAEC,CAAC,CAAC,CAAA;AAC1B;AACF,OAAC,MAAM;QACLT,MAAM,CAACO,GAAG,CAAC,GAAGE,CAAC,KAAKL,SAAS,GAAGK,CAAC,GAAGD,CAAC,CAAA;AACvC,OAAA;AACF,KAAA;AACF,GAAA;AAEA,EAAA,OAAOR,MAAM,CAAA;AACf;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -15,7 +15,7 @@ import React__default from 'react';
|
|
|
15
15
|
// During SSR, React emits a warning when calling useLayoutEffect.
|
|
16
16
|
// Since neither useLayoutEffect nor useEffect run on the server,
|
|
17
17
|
// we can suppress this by replace it with a noop on the server.
|
|
18
|
-
const useLayoutEffect = typeof document !== 'undefined' ?
|
|
18
|
+
const useLayoutEffect = typeof document !== 'undefined' ? React.useLayoutEffect : () => {};
|
|
19
19
|
|
|
20
20
|
export { useLayoutEffect };
|
|
21
21
|
//# sourceMappingURL=useLayoutEffect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLayoutEffect.js","sources":["../../../../src/react-aria/react-aria/utils/useLayoutEffect.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport React from 'react';\n\n// During SSR, React emits a warning when calling useLayoutEffect.\n// Since neither useLayoutEffect nor useEffect run on the server,\n// we can suppress this by replace it with a noop on the server.\nexport const useLayoutEffect = typeof document !== 'undefined'\n ? React.useLayoutEffect\n : () => {};\n"],"names":["useLayoutEffect","document","React"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACaA,MAAAA,eAAe,GAAG,OAAOC,QAAQ,KAAK,WAAW,GAC1DC,
|
|
1
|
+
{"version":3,"file":"useLayoutEffect.js","sources":["../../../../src/react-aria/react-aria/utils/useLayoutEffect.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport React from 'react';\n\n// During SSR, React emits a warning when calling useLayoutEffect.\n// Since neither useLayoutEffect nor useEffect run on the server,\n// we can suppress this by replace it with a noop on the server.\nexport const useLayoutEffect = typeof document !== 'undefined'\n ? React.useLayoutEffect\n : () => {};\n"],"names":["useLayoutEffect","document","React"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACaA,MAAAA,eAAe,GAAG,OAAOC,QAAQ,KAAK,WAAW,GAC1DC,KAAK,CAACF,eAAe,GACrB,MAAM;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { isComponent } from './isComponent.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -10,7 +10,7 @@ import { isComponent } from './isComponent.js';
|
|
|
10
10
|
const filterComponents = component => children => {
|
|
11
11
|
const components = Array.isArray(component) ? component : [component];
|
|
12
12
|
const childArray = [];
|
|
13
|
-
|
|
13
|
+
React.Children.forEach(children, child => {
|
|
14
14
|
components.forEach(comp => {
|
|
15
15
|
if (isComponent(comp)(child)) {
|
|
16
16
|
childArray.push(child);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filterComponents.js","sources":["../../src/utils/filterComponents.ts"],"sourcesContent":["import React, { ReactNode, ReactElement } from 'react';\nimport { Comp } from '../types';\nimport { isComponent } from './isComponent';\n\n/**\n * Create an array containing only valid and specific components.\n *\n * @param component React function component or the component name\n * @return an array of components\n */\nexport const filterComponents =\n (component: Comp<any, any> | string | Comp<any, any>[] | string[]) =>\n (children: ReactNode): ReactElement[] => {\n const components = Array.isArray(component) ? component : [component];\n const childArray: ReactElement[] = [];\n\n React.Children.forEach(children, (child) => {\n components.forEach((comp) => {\n if (isComponent(comp)(child)) {\n childArray.push(child);\n }\n });\n });\n\n return childArray;\n };\n"],"names":["filterComponents","component","children","components","Array","isArray","childArray","React","Children","forEach","child","comp","isComponent","push"],"mappings":";;;AAIA;AACA;AACA;AACA;AACA;AACA;MACaA,gBAAgB,GAC1BC,SAAgE,IAChEC,QAAmB,IAAqB;AACvC,EAAA,MAAMC,UAAU,GAAGC,KAAK,CAACC,OAAO,CAACJ,SAAS,CAAC,GAAGA,SAAS,GAAG,CAACA,SAAS,CAAC,CAAA;EACrE,MAAMK,UAA0B,GAAG,EAAE,CAAA;EAErCC,
|
|
1
|
+
{"version":3,"file":"filterComponents.js","sources":["../../src/utils/filterComponents.ts"],"sourcesContent":["import React, { ReactNode, ReactElement } from 'react';\nimport { Comp } from '../types';\nimport { isComponent } from './isComponent';\n\n/**\n * Create an array containing only valid and specific components.\n *\n * @param component React function component or the component name\n * @return an array of components\n */\nexport const filterComponents =\n (component: Comp<any, any> | string | Comp<any, any>[] | string[]) =>\n (children: ReactNode): ReactElement[] => {\n const components = Array.isArray(component) ? component : [component];\n const childArray: ReactElement[] = [];\n\n React.Children.forEach(children, (child) => {\n components.forEach((comp) => {\n if (isComponent(comp)(child)) {\n childArray.push(child);\n }\n });\n });\n\n return childArray;\n };\n"],"names":["filterComponents","component","children","components","Array","isArray","childArray","React","Children","forEach","child","comp","isComponent","push"],"mappings":";;;AAIA;AACA;AACA;AACA;AACA;AACA;MACaA,gBAAgB,GAC1BC,SAAgE,IAChEC,QAAmB,IAAqB;AACvC,EAAA,MAAMC,UAAU,GAAGC,KAAK,CAACC,OAAO,CAACJ,SAAS,CAAC,GAAGA,SAAS,GAAG,CAACA,SAAS,CAAC,CAAA;EACrE,MAAMK,UAA0B,GAAG,EAAE,CAAA;EAErCC,KAAK,CAACC,QAAQ,CAACC,OAAO,CAACP,QAAQ,EAAGQ,KAAK,IAAK;AAC1CP,IAAAA,UAAU,CAACM,OAAO,CAAEE,IAAI,IAAK;AAC3B,MAAA,IAAIC,WAAW,CAACD,IAAI,CAAC,CAACD,KAAK,CAAC,EAAE;AAC5BJ,QAAAA,UAAU,CAACO,IAAI,CAACH,KAAK,CAAC,CAAA;AACxB,OAAA;AACF,KAAC,CAAC,CAAA;AACJ,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOJ,UAAU,CAAA;AACnB;;;;"}
|
package/utils/isComponent.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Create a predicate function that checks if a ReactNode is a react element from the given component.
|
|
@@ -8,7 +8,7 @@ import React__default from 'react';
|
|
|
8
8
|
*/
|
|
9
9
|
const isComponent = component => instance => {
|
|
10
10
|
const componentName = typeof component === 'string' ? component : component.displayName;
|
|
11
|
-
return /*#__PURE__*/
|
|
11
|
+
return /*#__PURE__*/React.isValidElement(instance) && instance.type.displayName === componentName;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export { isComponent };
|
package/utils/isComponent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isComponent.js","sources":["../../src/utils/isComponent.ts"],"sourcesContent":["import React, { ReactNode, ReactElement } from 'react';\nimport { Comp } from '../types';\n\n/**\n * Create a predicate function that checks if a ReactNode is a react element from the given component.\n *\n * @param component React function component or the component name\n * @return predicate returning true if value is instance of the component\n */\nexport const isComponent =\n <C>(component: Comp<C, any> | string) =>\n (instance: ReactNode): instance is ReactElement => {\n const componentName = typeof component === 'string' ? component : component.displayName;\n\n return React.isValidElement(instance) && (instance.type as Comp<any>).displayName === componentName;\n };\n"],"names":["isComponent","component","instance","componentName","displayName","React","isValidElement","type"],"mappings":";;AAGA;AACA;AACA;AACA;AACA;AACA;MACaA,WAAW,GAClBC,SAAgC,IACnCC,QAAmB,IAA+B;EACjD,MAAMC,aAAa,GAAG,OAAOF,SAAS,KAAK,QAAQ,GAAGA,SAAS,GAAGA,SAAS,CAACG,WAAW,CAAA;AAEvF,EAAA,oBAAOC,
|
|
1
|
+
{"version":3,"file":"isComponent.js","sources":["../../src/utils/isComponent.ts"],"sourcesContent":["import React, { ReactNode, ReactElement } from 'react';\nimport { Comp } from '../types';\n\n/**\n * Create a predicate function that checks if a ReactNode is a react element from the given component.\n *\n * @param component React function component or the component name\n * @return predicate returning true if value is instance of the component\n */\nexport const isComponent =\n <C>(component: Comp<C, any> | string) =>\n (instance: ReactNode): instance is ReactElement => {\n const componentName = typeof component === 'string' ? component : component.displayName;\n\n return React.isValidElement(instance) && (instance.type as Comp<any>).displayName === componentName;\n };\n"],"names":["isComponent","component","instance","componentName","displayName","React","isValidElement","type"],"mappings":";;AAGA;AACA;AACA;AACA;AACA;AACA;MACaA,WAAW,GAClBC,SAAgC,IACnCC,QAAmB,IAA+B;EACjD,MAAMC,aAAa,GAAG,OAAOF,SAAS,KAAK,QAAQ,GAAGA,SAAS,GAAGA,SAAS,CAACG,WAAW,CAAA;AAEvF,EAAA,oBAAOC,KAAK,CAACC,cAAc,CAACJ,QAAQ,CAAC,IAAKA,QAAQ,CAACK,IAAI,CAAeH,WAAW,KAAKD,aAAa,CAAA;AACrG;;;;"}
|
package/utils/useId.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
3
|
let globalPrefix = 'rsi';
|
|
4
4
|
let lastId = 0;
|
|
@@ -20,8 +20,8 @@ const getIds = (count, prefix) => {
|
|
|
20
20
|
return ids;
|
|
21
21
|
};
|
|
22
22
|
function usePrevious(value) {
|
|
23
|
-
const ref =
|
|
24
|
-
|
|
23
|
+
const ref = React.useRef();
|
|
24
|
+
React.useEffect(() => {
|
|
25
25
|
ref.current = value;
|
|
26
26
|
});
|
|
27
27
|
return ref.current;
|
|
@@ -29,7 +29,7 @@ function usePrevious(value) {
|
|
|
29
29
|
const useId = function () {
|
|
30
30
|
let count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
31
31
|
let prefix = arguments.length > 1 ? arguments[1] : undefined;
|
|
32
|
-
const idsListRef =
|
|
32
|
+
const idsListRef = React.useRef([]);
|
|
33
33
|
const prevCount = usePrevious(count);
|
|
34
34
|
const prevPrefix = usePrevious(prefix);
|
|
35
35
|
if (count !== prevCount || prevPrefix !== prefix) {
|
package/utils/useId.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useId.js","sources":["../../src/utils/useId.ts"],"sourcesContent":["import React from 'react';\n\nlet globalPrefix = 'rsi';\nlet lastId = 0;\nexport const nextId = (localPrefix?: string | null): string => {\n lastId++;\n return `${localPrefix || globalPrefix}${lastId}`;\n};\n\nexport const resetId = (): void => {\n lastId = 0;\n};\n\nexport const setPrefix = (newPrefix: string): void => {\n globalPrefix = newPrefix;\n};\n\nconst getIds = (count: number, prefix?: string) => {\n const ids = [];\n for (let i = 0; i < count; i++) {\n ids.push(nextId(prefix));\n }\n return ids;\n};\n\nfunction usePrevious(value: unknown) {\n const ref = React.useRef<unknown>();\n React.useEffect(() => {\n ref.current = value;\n });\n return ref.current;\n}\n\nexport const useId = (count = 1, prefix?: string): string[] => {\n const idsListRef = React.useRef<string[]>([]);\n const prevCount = usePrevious(count);\n const prevPrefix = usePrevious(prefix);\n\n if (count !== prevCount || prevPrefix !== prefix) {\n idsListRef.current = getIds(count, prefix);\n }\n\n return idsListRef.current;\n};\n"],"names":["globalPrefix","lastId","nextId","localPrefix","resetId","setPrefix","newPrefix","getIds","count","prefix","ids","i","push","usePrevious","value","ref","React","useRef","useEffect","current","useId","arguments","length","undefined","idsListRef","prevCount","prevPrefix"],"mappings":";;AAEA,IAAIA,YAAY,GAAG,KAAK,CAAA;AACxB,IAAIC,MAAM,GAAG,CAAC,CAAA;AACDC,MAAAA,MAAM,GAAIC,WAA2B,IAAa;AAC7DF,EAAAA,MAAM,EAAE,CAAA;AACR,EAAA,OAAQ,GAAEE,WAAW,IAAIH,YAAa,CAAA,EAAEC,MAAO,CAAC,CAAA,CAAA;AAClD,EAAC;AAEYG,MAAAA,OAAO,GAAGA,MAAY;AACjCH,EAAAA,MAAM,GAAG,CAAC,CAAA;AACZ,EAAC;AAEYI,MAAAA,SAAS,GAAIC,SAAiB,IAAW;AACpDN,EAAAA,YAAY,GAAGM,SAAS,CAAA;AAC1B,EAAC;AAED,MAAMC,MAAM,GAAGA,CAACC,KAAa,EAAEC,MAAe,KAAK;EACjD,MAAMC,GAAG,GAAG,EAAE,CAAA;EACd,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,KAAK,EAAEG,CAAC,EAAE,EAAE;AAC9BD,IAAAA,GAAG,CAACE,IAAI,CAACV,MAAM,CAACO,MAAM,CAAC,CAAC,CAAA;AAC1B,GAAA;AACA,EAAA,OAAOC,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,SAASG,WAAWA,CAACC,KAAc,EAAE;AACnC,EAAA,MAAMC,GAAG,GAAGC,
|
|
1
|
+
{"version":3,"file":"useId.js","sources":["../../src/utils/useId.ts"],"sourcesContent":["import React from 'react';\n\nlet globalPrefix = 'rsi';\nlet lastId = 0;\nexport const nextId = (localPrefix?: string | null): string => {\n lastId++;\n return `${localPrefix || globalPrefix}${lastId}`;\n};\n\nexport const resetId = (): void => {\n lastId = 0;\n};\n\nexport const setPrefix = (newPrefix: string): void => {\n globalPrefix = newPrefix;\n};\n\nconst getIds = (count: number, prefix?: string) => {\n const ids = [];\n for (let i = 0; i < count; i++) {\n ids.push(nextId(prefix));\n }\n return ids;\n};\n\nfunction usePrevious(value: unknown) {\n const ref = React.useRef<unknown>();\n React.useEffect(() => {\n ref.current = value;\n });\n return ref.current;\n}\n\nexport const useId = (count = 1, prefix?: string): string[] => {\n const idsListRef = React.useRef<string[]>([]);\n const prevCount = usePrevious(count);\n const prevPrefix = usePrevious(prefix);\n\n if (count !== prevCount || prevPrefix !== prefix) {\n idsListRef.current = getIds(count, prefix);\n }\n\n return idsListRef.current;\n};\n"],"names":["globalPrefix","lastId","nextId","localPrefix","resetId","setPrefix","newPrefix","getIds","count","prefix","ids","i","push","usePrevious","value","ref","React","useRef","useEffect","current","useId","arguments","length","undefined","idsListRef","prevCount","prevPrefix"],"mappings":";;AAEA,IAAIA,YAAY,GAAG,KAAK,CAAA;AACxB,IAAIC,MAAM,GAAG,CAAC,CAAA;AACDC,MAAAA,MAAM,GAAIC,WAA2B,IAAa;AAC7DF,EAAAA,MAAM,EAAE,CAAA;AACR,EAAA,OAAQ,GAAEE,WAAW,IAAIH,Y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;AACpC,EAAA,MAAMkB,UAAU,GAAGb,WAAW,CAACJ,MAAM,CAAC,CAAA;AAEtC,EAAA,IAAID,KAAK,KAAKiB,SAAS,IAAIC,UAAU,KAAKjB,MAAM,EAAE;IAChDe,UAAU,CAACL,OAAO,GAAGZ,MAAM,CAACC,KAAK,EAAEC,MAAM,CAAC,CAAA;AAC5C,GAAA;EAEA,OAAOe,UAAU,CAACL,OAAO,CAAA;AAC3B;;;;"}
|
package/_virtual/jsx-runtime.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-runtime.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-jsx-runtime.development.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-jsx-runtime.production.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { TooltipContext } from './context.js';
|
|
3
|
-
import { TooltipPlacement } from './types.js';
|
|
4
|
-
import { useTooltip } from './useTooltip.js';
|
|
5
|
-
import { ThemeProvider } from '../../../../../components/theme/context.js';
|
|
6
|
-
import { TooltipTrigger } from '../tooltip-trigger/TooltipTrigger.js';
|
|
7
|
-
import { TooltipContent } from '../tooltip-content/TooltipContent.js';
|
|
8
|
-
import { useTheme } from '../../../../../components/theme/useTheme.js';
|
|
9
|
-
import { partitionComponents } from '../../../../../utils/partitionComponents.js';
|
|
10
|
-
import { isComponent } from '../../../../../utils/isComponent.js';
|
|
11
|
-
|
|
12
|
-
const COMPONENT_NAME = 'Tooltip';
|
|
13
|
-
const CLASSNAME = 'redsift-tooltip';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* The Tooltip component.
|
|
17
|
-
*/
|
|
18
|
-
const BaseTooltip = props => {
|
|
19
|
-
const {
|
|
20
|
-
children,
|
|
21
|
-
color,
|
|
22
|
-
defaultOpen,
|
|
23
|
-
delay = 300,
|
|
24
|
-
isOpen,
|
|
25
|
-
offset,
|
|
26
|
-
onOpen,
|
|
27
|
-
placement = TooltipPlacement.top,
|
|
28
|
-
theme: propsTheme,
|
|
29
|
-
tooltipId,
|
|
30
|
-
triggerClassName
|
|
31
|
-
} = props;
|
|
32
|
-
const theme = useTheme ? useTheme(propsTheme) : undefined;
|
|
33
|
-
const tooltip = useTooltip({
|
|
34
|
-
color,
|
|
35
|
-
defaultOpen,
|
|
36
|
-
delay,
|
|
37
|
-
placement,
|
|
38
|
-
isOpen,
|
|
39
|
-
offset,
|
|
40
|
-
onOpen,
|
|
41
|
-
tooltipId,
|
|
42
|
-
theme,
|
|
43
|
-
triggerClassName
|
|
44
|
-
});
|
|
45
|
-
const [[trigger], [content]] = partitionComponents(React__default.Children.toArray(children), [isComponent('TooltipTrigger'), isComponent('TooltipContent')]);
|
|
46
|
-
return /*#__PURE__*/React__default.createElement(ThemeProvider, {
|
|
47
|
-
value: {
|
|
48
|
-
theme
|
|
49
|
-
}
|
|
50
|
-
}, /*#__PURE__*/React__default.createElement(TooltipContext.Provider, {
|
|
51
|
-
value: tooltip
|
|
52
|
-
}, trigger && isComponent('TooltipTrigger')(trigger) ? trigger : null, content && isComponent('TooltipContent')(content) ? content : null));
|
|
53
|
-
};
|
|
54
|
-
BaseTooltip.className = CLASSNAME;
|
|
55
|
-
BaseTooltip.displayName = COMPONENT_NAME;
|
|
56
|
-
const Tooltip = Object.assign(BaseTooltip, {
|
|
57
|
-
Trigger: TooltipTrigger,
|
|
58
|
-
Content: TooltipContent
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
export { BaseTooltip, Tooltip };
|
|
62
|
-
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sources":["../../../../../../../popovers/src/components/tooltip/Tooltip.tsx"],"sourcesContent":["import React from 'react';\nimport { partitionComponents, isComponent, useTheme } from '@redsift/design-system';\nimport { TooltipContent } from '../tooltip-content';\nimport { TooltipTrigger } from '../tooltip-trigger';\n\nimport { TooltipContext } from './context';\nimport { TooltipPlacement, TooltipProps } from './types';\nimport { useTooltip } from './useTooltip';\n\nimport { ThemeProvider } from '../../../../design-system/src/components/theme/context';\n\nconst COMPONENT_NAME = 'Tooltip';\nconst CLASSNAME = 'redsift-tooltip';\n\n/**\n * The Tooltip component.\n */\nexport const BaseTooltip: React.FC<TooltipProps> & {\n displayName?: string;\n className?: string;\n} = (props) => {\n const {\n children,\n color,\n defaultOpen,\n delay = 300,\n isOpen,\n offset,\n onOpen,\n placement = TooltipPlacement.top,\n theme: propsTheme,\n tooltipId,\n triggerClassName,\n } = props;\n\n const theme = useTheme ? useTheme(propsTheme) : undefined;\n\n const tooltip = useTooltip({\n color,\n defaultOpen,\n delay,\n placement,\n isOpen,\n offset,\n onOpen,\n tooltipId,\n theme,\n triggerClassName,\n });\n\n const [[trigger], [content]] = partitionComponents(React.Children.toArray(children), [\n isComponent('TooltipTrigger'),\n isComponent('TooltipContent'),\n ]);\n\n return (\n <ThemeProvider value={{ theme }}>\n <TooltipContext.Provider value={tooltip}>\n {trigger && isComponent('TooltipTrigger')(trigger) ? trigger : null}\n {content && isComponent('TooltipContent')(content) ? content : null}\n </TooltipContext.Provider>\n </ThemeProvider>\n );\n};\nBaseTooltip.className = CLASSNAME;\nBaseTooltip.displayName = COMPONENT_NAME;\n\nexport const Tooltip = Object.assign(BaseTooltip, {\n Trigger: TooltipTrigger,\n Content: TooltipContent,\n});\n"],"names":["COMPONENT_NAME","CLASSNAME","BaseTooltip","props","children","color","defaultOpen","delay","isOpen","offset","onOpen","placement","TooltipPlacement","top","theme","propsTheme","tooltipId","triggerClassName","useTheme","undefined","tooltip","useTooltip","trigger","content","partitionComponents","React","Children","toArray","isComponent","createElement","ThemeProvider","value","TooltipContext","Provider","className","displayName","Toolt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C,gBAAgB,CAAC,CAACN,OAAO,CAAC,GAAGA,OAAO,GAAG,IAAI,EAClEC,OAAO,IAAIK,WAAW,CAAC,gBAAgB,CAAC,CAACL,OAAO,CAAC,GAAGA,OAAO,GAAG,IACxC,CACZ,CAAC,CAAA;AAEpB,EAAC;AACDrB,WAAW,CAACgC,SAAS,GAAGjC,SAAS,CAAA;AACjCC,WAAW,CAACiC,WAAW,GAAGnC,cAAc,CAAA;AAEjC,MAAMoC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAACpC,WAAW,EAAE;AAChDqC,EAAAA,OAAO,EAAEC,cAAc;AACvBC,EAAAA,OAAO,EAAEC,cAAAA;AACX,CAAC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sources":["../../../../../../../popovers/src/components/tooltip/context.ts"],"sourcesContent":["import React from 'react';\nimport { TooltipState } from './types';\n\nexport const TooltipContext = React.createContext<TooltipState | null>(null);\n"],"names":["TooltipContext","React","createContext"],"mappings":";;AAGO,MAAMA,cAAc,gBAAGC,cAAK,CAACC,aAAa,CAAsB,IAAI;;;;"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Context props.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Component variant.
|
|
7
|
-
*/
|
|
8
|
-
const TooltipPlacement = {
|
|
9
|
-
top: 'top',
|
|
10
|
-
right: 'right',
|
|
11
|
-
bottom: 'bottom',
|
|
12
|
-
left: 'left',
|
|
13
|
-
'top-start': 'top-start',
|
|
14
|
-
'top-end': 'top-end',
|
|
15
|
-
'right-start': 'right-start',
|
|
16
|
-
'right-end': 'right-end',
|
|
17
|
-
'bottom-start': 'bottom-start',
|
|
18
|
-
'bottom-end': 'bottom-end',
|
|
19
|
-
'left-start': 'left-start',
|
|
20
|
-
'left-end': 'left-end'
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Component props.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
export { TooltipPlacement };
|
|
28
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../../../../../popovers/src/components/tooltip/types.ts"],"sourcesContent":["import { ReactNode } from 'react';\nimport { ButtonColor, Theme, ValueOf } from '@redsift/design-system';\nimport { useTooltip } from './useTooltip';\n\n/**\n * Context props.\n */\nexport type TooltipState =\n | (ReturnType<typeof useTooltip> & {\n /** Class name to append to the trigger. */\n readonly triggerClassName?: string;\n })\n | null;\n\n/**\n * Component variant.\n */\nexport const TooltipPlacement = {\n top: 'top',\n right: 'right',\n bottom: 'bottom',\n left: 'left',\n 'top-start': 'top-start',\n 'top-end': 'top-end',\n 'right-start': 'right-start',\n 'right-end': 'right-end',\n 'bottom-start': 'bottom-start',\n 'bottom-end': 'bottom-end',\n 'left-start': 'left-start',\n 'left-end': 'left-end',\n} as const;\nexport type TooltipPlacement = ValueOf<typeof TooltipPlacement>;\n\n/**\n * Component props.\n */\nexport interface TooltipProps {\n /** Button color that will be forward to the trigger. */\n color?: ButtonColor;\n /** Children. Can only be TooltipTrigger and TooltilContent. */\n children: ReactNode;\n /**\n * Default open status.\n * Used for uncontrolled version.\n */\n defaultOpen?: boolean;\n /** Delay time (in ms) for the tooltip to show up. */\n delay?: number;\n /** Default placement of the tooltip. */\n placement?: TooltipPlacement | 'client-point';\n /**\n * Whether the component is opened or not.\n * Used for controlled version.\n */\n isOpen?: boolean;\n /** Space between trigger and content (in pixels). */\n offset?: number;\n /** Method to handle component change. */\n onOpen?: (open: boolean) => void;\n /** Id to the tooltip content. */\n tooltipId?: string;\n /** Theme. */\n theme?: Theme;\n /** Class name to append to the trigger. */\n triggerClassName?: string;\n}\n\nexport type StyledTooltipProps = TooltipProps;\n"],"names":["TooltipPlacement","top","right","bottom","left"],"mappings":"AAIA;AACA;AACA;;AAQA;AACA;AACA;AACO,MAAMA,gBAAgB,GAAG;AAC9BC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,IAAI,EAAE,MAAM;AACZ,EAAA,WAAW,EAAE,WAAW;AACxB,EAAA,SAAS,EAAE,SAAS;AACpB,EAAA,aAAa,EAAE,aAAa;AAC5B,EAAA,WAAW,EAAE,WAAW;AACxB,EAAA,cAAc,EAAE,cAAc;AAC9B,EAAA,YAAY,EAAE,YAAY;AAC1B,EAAA,YAAY,EAAE,YAAY;AAC1B,EAAA,UAAU,EAAE,UAAA;AACd,EAAU;;AAGV;AACA;AACA;;;;"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { objectSpread2 as _objectSpread2 } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React__default, { useRef, useState, useEffect, useCallback } from 'react';
|
|
3
|
-
import { useFloating, useClientPoint, useHover, safePolygon, useFocus, useDismiss, useRole, useInteractions } from '../../../../../node_modules/@floating-ui/react/dist/floating-ui.react.mjs.js';
|
|
4
|
-
import { autoUpdate } from '../../../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js';
|
|
5
|
-
import { offset, flip, shift, arrow } from '../../../../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs.js';
|
|
6
|
-
import { useId } from '../../../../../utils/useId.js';
|
|
7
|
-
|
|
8
|
-
function useTooltip(_ref) {
|
|
9
|
-
let {
|
|
10
|
-
color,
|
|
11
|
-
defaultOpen,
|
|
12
|
-
delay,
|
|
13
|
-
placement,
|
|
14
|
-
isOpen: propsIsOpen,
|
|
15
|
-
offset: propsOffset,
|
|
16
|
-
onOpen,
|
|
17
|
-
tooltipId: propsTooltipId,
|
|
18
|
-
triggerClassName
|
|
19
|
-
} = _ref;
|
|
20
|
-
const arrowRef = useRef(null);
|
|
21
|
-
const [isOpen, setIsOpen] = useState(propsIsOpen !== null && propsIsOpen !== void 0 ? propsIsOpen : defaultOpen);
|
|
22
|
-
const [_id] = useId();
|
|
23
|
-
const tooltipId = propsTooltipId !== null && propsTooltipId !== void 0 ? propsTooltipId : _id;
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
setIsOpen(propsIsOpen !== null && propsIsOpen !== void 0 ? propsIsOpen : defaultOpen);
|
|
26
|
-
}, [propsIsOpen, defaultOpen]);
|
|
27
|
-
const handleOpen = useCallback(collapsed => {
|
|
28
|
-
if (onOpen) {
|
|
29
|
-
onOpen(collapsed);
|
|
30
|
-
}
|
|
31
|
-
if (propsIsOpen === undefined || propsIsOpen === null) {
|
|
32
|
-
setIsOpen(collapsed);
|
|
33
|
-
}
|
|
34
|
-
}, [onOpen]);
|
|
35
|
-
const data = useFloating({
|
|
36
|
-
placement: placement === 'client-point' ? 'left' : placement,
|
|
37
|
-
open: isOpen,
|
|
38
|
-
onOpenChange: handleOpen,
|
|
39
|
-
whileElementsMounted: autoUpdate,
|
|
40
|
-
middleware: [offset(propsOffset !== null && propsOffset !== void 0 ? propsOffset : 8), flip({
|
|
41
|
-
fallbackAxisSideDirection: 'start'
|
|
42
|
-
}), shift({
|
|
43
|
-
padding: 8
|
|
44
|
-
}), arrow({
|
|
45
|
-
element: arrowRef
|
|
46
|
-
})]
|
|
47
|
-
});
|
|
48
|
-
const context = data.context;
|
|
49
|
-
const clientPoint = useClientPoint(context, {
|
|
50
|
-
enabled: placement === 'client-point'
|
|
51
|
-
});
|
|
52
|
-
const hover = useHover(context, {
|
|
53
|
-
move: false,
|
|
54
|
-
delay: {
|
|
55
|
-
open: delay,
|
|
56
|
-
close: 0
|
|
57
|
-
},
|
|
58
|
-
handleClose: safePolygon()
|
|
59
|
-
});
|
|
60
|
-
const focus = useFocus(context);
|
|
61
|
-
const dismiss = useDismiss(context);
|
|
62
|
-
const role = useRole(context, {
|
|
63
|
-
role: 'tooltip'
|
|
64
|
-
});
|
|
65
|
-
const interactions = useInteractions([hover, focus, dismiss, role, clientPoint]);
|
|
66
|
-
return React__default.useMemo(() => _objectSpread2(_objectSpread2(_objectSpread2({
|
|
67
|
-
color,
|
|
68
|
-
isOpen,
|
|
69
|
-
handleOpen
|
|
70
|
-
}, interactions), data), {}, {
|
|
71
|
-
arrowRef,
|
|
72
|
-
tooltipId,
|
|
73
|
-
triggerClassName
|
|
74
|
-
}), [color, isOpen, handleOpen, interactions, data, arrowRef, tooltipId, triggerClassName]);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export { useTooltip };
|
|
78
|
-
//# sourceMappingURL=useTooltip.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTooltip.js","sources":["../../../../../../../popovers/src/components/tooltip/useTooltip.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport {\n useFloating,\n arrow,\n autoUpdate,\n offset,\n flip,\n safePolygon,\n shift,\n useHover,\n useFocus,\n useDismiss,\n useRole,\n useInteractions,\n useClientPoint,\n} from '@floating-ui/react';\nimport { TooltipProps } from './types';\nimport { useId } from '@redsift/design-system';\n\nexport function useTooltip({\n color,\n defaultOpen,\n delay,\n placement,\n isOpen: propsIsOpen,\n offset: propsOffset,\n onOpen,\n tooltipId: propsTooltipId,\n triggerClassName,\n}: Omit<TooltipProps, 'children'>) {\n const arrowRef = useRef(null);\n const [isOpen, setIsOpen] = useState(propsIsOpen ?? defaultOpen);\n\n const [_id] = useId();\n const tooltipId = propsTooltipId ?? _id;\n\n useEffect(() => {\n setIsOpen(propsIsOpen ?? defaultOpen);\n }, [propsIsOpen, defaultOpen]);\n\n const handleOpen = useCallback(\n (collapsed: boolean) => {\n if (onOpen) {\n onOpen(collapsed);\n }\n if (propsIsOpen === undefined || propsIsOpen === null) {\n setIsOpen(collapsed);\n }\n },\n [onOpen]\n );\n\n const data = useFloating({\n placement: placement === 'client-point' ? 'left' : placement,\n open: isOpen,\n onOpenChange: handleOpen,\n whileElementsMounted: autoUpdate,\n middleware: [\n offset(propsOffset ?? 8),\n flip({\n fallbackAxisSideDirection: 'start',\n }),\n shift({ padding: 8 }),\n arrow({\n element: arrowRef,\n }),\n ],\n });\n\n const context = data.context;\n const clientPoint = useClientPoint(context, { enabled: placement === 'client-point' });\n\n const hover = useHover(context, {\n move: false,\n delay: {\n open: delay,\n close: 0,\n },\n handleClose: safePolygon(),\n });\n const focus = useFocus(context);\n const dismiss = useDismiss(context);\n const role = useRole(context, { role: 'tooltip' });\n\n const interactions = useInteractions([hover, focus, dismiss, role, clientPoint]);\n\n return React.useMemo(\n () => ({\n color,\n isOpen,\n handleOpen,\n ...interactions,\n ...data,\n arrowRef,\n tooltipId,\n triggerClassName,\n }),\n [color, isOpen, handleOpen, interactions, data, arrowRef, tooltipId, triggerClassName]\n );\n}\n"],"names":["useTooltip","_ref","color","defaultOpen","delay","placement","isOpen","propsIsOpen","offset","propsOffset","onOpen","tooltipId","propsTooltipId","triggerClassName","arrowRef","useRef","setIsOpen","useState","_id","useId","useEffect","handleOpen","useCallback","collapsed","undefined","data","useFloating","open","onOpenChange","whileElementsMounted","autoUpdate","middleware","flip","fallbackAxisSideDirection","shift","padding","arrow","element","context","clientPoint","useClientPoint","enabled","hover","useHover","move","close","handleClose","safePolygon","focus","useFocus","dismiss","useDismiss","role","useRole","interactions","useInteractions","React","useMemo","_objectSpread"],"mappings":";;;;;;;AAmBO,SAASA,UAAUA,CAAAC,IAAA,EAUS;EAAA,IAVR;IACzBC,KAAK;IACLC,WAAW;IACXC,KAAK;IACLC,SAAS;AACTC,IAAAA,MAAM,EAAEC,WAAW;AACnBC,IAAAA,MAAM,EAAEC,WAAW;IACnBC,MAAM;AACNC,IAAAA,SAAS,EAAEC,cAAc;AACzBC,IAAAA,gBAAAA;AAC8B,GAAC,GAAAZ,IAAA,CAAA;AAC/B,EAAA,MAAMa,QAAQ,GAAGC,MAAM,CAAC,IAAI,CAAC,CAAA;AAC7B,EAAA,MAAM,CAACT,MAAM,EAAEU,SAAS,CAAC,GAAGC,QAAQ,CAACV,WAAW,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,SAAS,EAAEE,gBAAgB,CACvF,CAAC,CAAA;AACH;;;;"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { TooltipContext } from './context.js';
|
|
3
|
-
|
|
4
|
-
const useTooltipContext = () => {
|
|
5
|
-
const context = React__default.useContext(TooltipContext);
|
|
6
|
-
if (context == null) {
|
|
7
|
-
throw new Error('Tooltip components must be wrapped in <Tooltip />');
|
|
8
|
-
}
|
|
9
|
-
return context;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export { useTooltipContext };
|
|
13
|
-
//# sourceMappingURL=useTooltipContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTooltipContext.js","sources":["../../../../../../../popovers/src/components/tooltip/useTooltipContext.tsx"],"sourcesContent":["import React from 'react';\nimport { TooltipContext } from './context';\n\nexport const useTooltipContext = () => {\n const context = React.useContext(TooltipContext);\n\n if (context == null) {\n throw new Error('Tooltip components must be wrapped in <Tooltip />');\n }\n\n return context;\n};\n"],"names":["useTooltipContext","context","React","useContext","TooltipContext","Error"],"mappings":";;;AAGaA,MAAAA,iBAAiB,GAAGA,MAAM;AACrC,EAAA,MAAMC,OAAO,GAAGC,cAAK,CAACC,UAAU,CAACC,cAAc,CAAC,CAAA;EAEhD,IAAIH,OAAO,IAAI,IAAI,EAAE;AACnB,IAAA,MAAM,IAAII,KAAK,CAAC,mDAAmD,CAAC,CAAA;AACtE,GAAA;AAEA,EAAA,OAAOJ,OAAO,CAAA;AAChB;;;;"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { extends as _extends, objectSpread2 as _objectSpread2 } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React__default, { forwardRef, useContext } from 'react';
|
|
3
|
-
import { useMergeRefs, FloatingPortal } from '../../../../../node_modules/@floating-ui/react/dist/floating-ui.react.mjs.js';
|
|
4
|
-
import { StyledTooltipContent } from './styles.js';
|
|
5
|
-
import classNames from 'classnames';
|
|
6
|
-
import { useTooltipContext } from '../tooltip/useTooltipContext.js';
|
|
7
|
-
import { AppContainerContext } from '../../../../../components/app-container/context.js';
|
|
8
|
-
import { useTheme } from '../../../../../components/theme/useTheme.js';
|
|
9
|
-
|
|
10
|
-
const COMPONENT_NAME = 'TooltipContent';
|
|
11
|
-
const CLASSNAME = 'redsift-tooltip-content';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* The TooltipContent component.
|
|
15
|
-
*/
|
|
16
|
-
const TooltipContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
17
|
-
const {
|
|
18
|
-
children,
|
|
19
|
-
className,
|
|
20
|
-
style,
|
|
21
|
-
theme: propsTheme
|
|
22
|
-
} = props;
|
|
23
|
-
const appContainerState = useContext(AppContainerContext);
|
|
24
|
-
const {
|
|
25
|
-
getFloatingProps,
|
|
26
|
-
isOpen,
|
|
27
|
-
placement,
|
|
28
|
-
refs,
|
|
29
|
-
strategy,
|
|
30
|
-
x,
|
|
31
|
-
y,
|
|
32
|
-
middlewareData: {
|
|
33
|
-
arrow: {
|
|
34
|
-
x: arrowX,
|
|
35
|
-
y: arrowY
|
|
36
|
-
} = {}
|
|
37
|
-
}
|
|
38
|
-
} = useTooltipContext();
|
|
39
|
-
const theme = useTheme ? useTheme(propsTheme) : undefined;
|
|
40
|
-
const popoverRef = useMergeRefs([refs.setFloating, ref]);
|
|
41
|
-
const {
|
|
42
|
-
arrowRef
|
|
43
|
-
} = useTooltipContext();
|
|
44
|
-
const staticSide = {
|
|
45
|
-
top: 'bottom',
|
|
46
|
-
right: 'left',
|
|
47
|
-
bottom: 'top',
|
|
48
|
-
left: 'right'
|
|
49
|
-
}[placement.split('-')[0]];
|
|
50
|
-
return /*#__PURE__*/React__default.createElement(FloatingPortal, {
|
|
51
|
-
root: appContainerState === null || appContainerState === void 0 ? void 0 : appContainerState.appContainerRef.current
|
|
52
|
-
}, isOpen && /*#__PURE__*/React__default.createElement(StyledTooltipContent, _extends({
|
|
53
|
-
className: classNames(TooltipContent.className, className),
|
|
54
|
-
ref: popoverRef,
|
|
55
|
-
$theme: theme
|
|
56
|
-
}, getFloatingProps(props), {
|
|
57
|
-
style: _objectSpread2({
|
|
58
|
-
position: strategy,
|
|
59
|
-
top: y !== null && y !== void 0 ? y : 0,
|
|
60
|
-
left: x !== null && x !== void 0 ? x : 0,
|
|
61
|
-
visibility: x == null ? 'hidden' : 'visible'
|
|
62
|
-
}, style),
|
|
63
|
-
$placement: placement
|
|
64
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
65
|
-
ref: arrowRef,
|
|
66
|
-
className: `${TooltipContent.className}__arrow`,
|
|
67
|
-
style: {
|
|
68
|
-
left: arrowX != null ? `${arrowX}px` : '',
|
|
69
|
-
top: arrowY != null ? `${arrowY}px` : '',
|
|
70
|
-
[staticSide]: '-6px'
|
|
71
|
-
}
|
|
72
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
73
|
-
className: `${TooltipContent.className}__inner`
|
|
74
|
-
}, children)));
|
|
75
|
-
});
|
|
76
|
-
TooltipContent.className = CLASSNAME;
|
|
77
|
-
TooltipContent.displayName = COMPONENT_NAME;
|
|
78
|
-
|
|
79
|
-
export { TooltipContent };
|
|
80
|
-
//# sourceMappingURL=TooltipContent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipContent.js","sources":["../../../../../../../popovers/src/components/tooltip-content/TooltipContent.tsx"],"sourcesContent":["import React, { forwardRef, useContext } from 'react';\nimport { useMergeRefs, FloatingPortal } from '@floating-ui/react';\n\nimport { AppContainerContext, Comp, useTheme } from '@redsift/design-system';\nimport { TooltipContentProps } from './types';\nimport { TooltipPlacement, useTooltipContext } from '../tooltip';\nimport { StyledTooltipContent } from './styles';\nimport classNames from 'classnames';\n\nconst COMPONENT_NAME = 'TooltipContent';\nconst CLASSNAME = 'redsift-tooltip-content';\n\n/**\n * The TooltipContent component.\n */\nexport const TooltipContent: Comp<TooltipContentProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { children, className, style, theme: propsTheme } = props;\n const appContainerState = useContext(AppContainerContext);\n const {\n getFloatingProps,\n isOpen,\n placement,\n refs,\n strategy,\n x,\n y,\n middlewareData: { arrow: { x: arrowX, y: arrowY } = {} },\n } = useTooltipContext();\n const theme = useTheme ? useTheme(propsTheme) : undefined;\n const popoverRef = useMergeRefs([refs.setFloating, ref]);\n\n const { arrowRef } = useTooltipContext();\n\n const staticSide = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n }[placement.split('-')[0]];\n\n return (\n <FloatingPortal root={appContainerState?.appContainerRef.current}>\n {isOpen && (\n <StyledTooltipContent\n className={classNames(TooltipContent.className, className)}\n ref={popoverRef}\n $theme={theme!}\n {...getFloatingProps(props)}\n style={{\n position: strategy,\n top: y ?? 0,\n left: x ?? 0,\n visibility: x == null ? 'hidden' : 'visible',\n ...style,\n }}\n $placement={placement as TooltipPlacement}\n >\n <div\n ref={arrowRef}\n className={`${TooltipContent.className}__arrow`}\n style={{\n left: arrowX != null ? `${arrowX}px` : '',\n top: arrowY != null ? `${arrowY}px` : '',\n [staticSide!]: '-6px',\n }}\n />\n <div className={`${TooltipContent.className}__inner`}>{children}</div>\n </StyledTooltipContent>\n )}\n </FloatingPortal>\n );\n});\nTooltipContent.className = CLASSNAME;\nTooltipContent.displayName = COMPONENT_NAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","TooltipContent","forwardRef","props","ref","children","className","style","theme","propsTheme","appContainerState","useContext","AppContainerContext","getFloatingProps","isOpen","placement","refs","strategy","x","y","middlewareData","arrow","arrowX","arrowY","useTooltipContext","useTheme","undefined","popoverRef","useMergeRefs","setFloating","arrowRef","staticSide","top","right","bottom","left","split","React","createElement","FloatingPortal","root","appContainerRef","current","StyledTooltipContent","_extends","classNames","$theme","_objectSpread","position","visibility","$placement","displayName"],"mappings":";;;;;;;;;AASA,MAAMA,cAAc,GAAG,gBAAgB,CA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