@redsift/popovers 11.9.4 → 12.0.0-muiv5

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/CONTRIBUTING.md CHANGED
@@ -62,10 +62,6 @@ The Design System is following a monorepo architecture, providing multiple packa
62
62
 
63
63
  This package provides ready-to-use implementation of components with a customize style to fit Red Sift's use cases. It is based on all other packages.
64
64
 
65
- - _Deprecated_ `@redsift/design-system-legacy`
66
-
67
- This package contains all components prior to the 6.0.0 version. These components are deprecated and contributing to this package is discouraged since it will be removed in the future.
68
-
69
65
  Please make sure to work inside the correct package when making contribution.
70
66
 
71
67
  If you need something inside more than one package, do not duplicate the code. Place it inside one package, export it from this package and import it inside the others.
@@ -410,8 +406,8 @@ yarn build:charts
410
406
  yarn build:dashboard
411
407
  yarn build:design-system
412
408
  yarn build:icons
413
- yarn build:legacy
414
409
  yarn build:table
410
+ yarn build:products
415
411
  ```
416
412
 
417
413
  ## Publishing a release
@@ -1,9 +1,9 @@
1
- import { a as _objectWithoutProperties, b as _extends } from './_rollupPluginBabelHelpers.js';
1
+ import { _ as _objectSpread2, a as _objectWithoutProperties, b as _extends } from './_rollupPluginBabelHelpers.js';
2
2
  import React, { forwardRef } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { useMergeRefs } from '@floating-ui/react';
5
+ import { baseContainer, getContainerStylingTransientProps } from '@redsift/design-system';
5
6
  import styled from 'styled-components';
6
- import { baseContainer } from '@redsift/design-system';
7
7
  import { u as useDialogContext } from './useDialogContext.js';
8
8
 
9
9
  /**
@@ -21,7 +21,7 @@ const StyledDialogContentActions = styled.div`
21
21
  }
22
22
  `;
23
23
 
24
- const _excluded = ["children", "className", "flexDirection"];
24
+ const _excluded = ["children", "className"];
25
25
  const COMPONENT_NAME = 'DialogContentActions';
26
26
  const CLASSNAME = 'redsift-dialog-content-actions';
27
27
 
@@ -29,19 +29,23 @@ const CLASSNAME = 'redsift-dialog-content-actions';
29
29
  * The DialogContentActions component.
30
30
  */
31
31
  const DialogContentActions = /*#__PURE__*/forwardRef((props, ref) => {
32
+ const propsWithDefaults = _objectSpread2({
33
+ flexDirection: 'row'
34
+ }, props);
35
+ const {
36
+ transientProps,
37
+ otherProps
38
+ } = getContainerStylingTransientProps(propsWithDefaults);
32
39
  const {
33
40
  children,
34
- className,
35
- flexDirection = 'row'
36
- } = props,
37
- forwardedProps = _objectWithoutProperties(props, _excluded);
41
+ className
42
+ } = otherProps,
43
+ forwardedProps = _objectWithoutProperties(otherProps, _excluded);
38
44
  const {
39
45
  actionsRef,
40
46
  initialFocus
41
47
  } = useDialogContext();
42
- return /*#__PURE__*/React.createElement(StyledDialogContentActions, _extends({
43
- flexDirection: flexDirection
44
- }, forwardedProps, {
48
+ return /*#__PURE__*/React.createElement(StyledDialogContentActions, _extends({}, forwardedProps, transientProps, {
45
49
  className: classNames(DialogContentActions.className, className),
46
50
  ref: useMergeRefs([ref, actionsRef]),
47
51
  tabIndex: initialFocus === 'actions' ? -1 : undefined
@@ -1 +1 @@
1
- {"version":3,"file":"DialogContentActions.js","sources":["../../src/components/dialog-content-actions/styles.ts","../../src/components/dialog-content-actions/DialogContentActions.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { baseContainer } from '@redsift/design-system';\nimport { StyledDialogContentActionsProps } from './types';\n\n/**\n * Component style.\n */\nexport const StyledDialogContentActions = styled.div<StyledDialogContentActionsProps>`\n display: flex;\n ${baseContainer}\n\n margin-top: 8px;\n margin-bottom: 8px;\n\n &:focus-visible {\n outline: none;\n }\n`;\n","import React, { forwardRef } from 'react';\nimport classNames from 'classnames';\nimport { useMergeRefs } from '@floating-ui/react';\n\nimport { Comp } from '@redsift/design-system';\nimport { StyledDialogContentActions } from './styles';\nimport { DialogContentActionsProps } from './types';\nimport { useDialogContext } from '../dialog';\n\nconst COMPONENT_NAME = 'DialogContentActions';\nconst CLASSNAME = 'redsift-dialog-content-actions';\n\n/**\n * The DialogContentActions component.\n */\nexport const DialogContentActions: Comp<DialogContentActionsProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { children, className, flexDirection = 'row', ...forwardedProps } = props;\n\n const { actionsRef, initialFocus } = useDialogContext();\n\n return (\n <StyledDialogContentActions\n flexDirection={flexDirection}\n {...forwardedProps}\n className={classNames(DialogContentActions.className, className)}\n ref={useMergeRefs([ref, actionsRef])}\n tabIndex={initialFocus === 'actions' ? -1 : undefined}\n >\n {children}\n </StyledDialogContentActions>\n );\n});\nDialogContentActions.className = CLASSNAME;\nDialogContentActions.displayName = COMPONENT_NAME;\n"],"names":["StyledDialogContentActions","styled","div","baseContainer","COMPONENT_NAME","CLASSNAME","DialogContentActions","forwardRef","props","ref","children","className","flexDirection","forwardedProps","_objectWithoutProperties","_excluded","actionsRef","initialFocus","useDialogContext","React","createElement","_extends","classNames","useMergeRefs","tabIndex","undefined","displayName"],"mappings":";;;;;;;;AAIA;AACA;AACA;AACO,MAAMA,0BAA0B,GAAGC,MAAM,CAACC,GAAqC,CAAA;AACtF;AACA,EAAA,EAAIC,aAAc,CAAA;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;ACRD,MAAMC,cAAc,GAAG,sBAAsB,CAAA;AAC7C,MAAMC,SAAS,GAAG,gCAAgC,CAAA;;AAElD;AACA;AACA;AACO,MAAMC,oBAAqE,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAC9G,MAAM;MAAEC,QAAQ;MAAEC,SAAS;AAAEC,MAAAA,aAAa,GAAG,KAAA;AAAyB,KAAC,GAAGJ,KAAK;AAAxBK,IAAAA,cAAc,GAAAC,wBAAA,CAAKN,KAAK,EAAAO,SAAA,CAAA,CAAA;EAE/E,MAAM;IAAEC,UAAU;AAAEC,IAAAA,YAAAA;GAAc,GAAGC,gBAAgB,EAAE,CAAA;AAEvD,EAAA,oBACEC,KAAA,CAAAC,aAAA,CAACpB,0BAA0B,EAAAqB,QAAA,CAAA;AACzBT,IAAAA,aAAa,EAAEA,aAAAA;AAAc,GAAA,EACzBC,cAAc,EAAA;IAClBF,SAAS,EAAEW,UAAU,CAAChB,oBAAoB,CAACK,SAAS,EAAEA,SAAS,CAAE;IACjEF,GAAG,EAAEc,YAAY,CAAC,CAACd,GAAG,EAAEO,UAAU,CAAC,CAAE;AACrCQ,IAAAA,QAAQ,EAAEP,YAAY,KAAK,SAAS,GAAG,CAAC,CAAC,GAAGQ,SAAAA;AAAU,GAAA,CAAA,EAErDf,QACyB,CAAC,CAAA;AAEjC,CAAC,EAAC;AACFJ,oBAAoB,CAACK,SAAS,GAAGN,SAAS,CAAA;AAC1CC,oBAAoB,CAACoB,WAAW,GAAGtB,cAAc;;;;"}
1
+ {"version":3,"file":"DialogContentActions.js","sources":["../../src/components/dialog-content-actions/styles.ts","../../src/components/dialog-content-actions/DialogContentActions.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { baseContainer } from '@redsift/design-system';\nimport { StyledDialogContentActionsProps } from './types';\n\n/**\n * Component style.\n */\nexport const StyledDialogContentActions = styled.div<StyledDialogContentActionsProps>`\n display: flex;\n ${baseContainer}\n\n margin-top: 8px;\n margin-bottom: 8px;\n\n &:focus-visible {\n outline: none;\n }\n`;\n","import React, { forwardRef } from 'react';\nimport classNames from 'classnames';\nimport { useMergeRefs } from '@floating-ui/react';\n\nimport { Comp, getContainerStylingTransientProps } from '@redsift/design-system';\nimport { StyledDialogContentActions } from './styles';\nimport { DialogContentActionsProps } from './types';\nimport { useDialogContext } from '../dialog';\n\nconst COMPONENT_NAME = 'DialogContentActions';\nconst CLASSNAME = 'redsift-dialog-content-actions';\n\n/**\n * The DialogContentActions component.\n */\nexport const DialogContentActions: Comp<DialogContentActionsProps, HTMLDivElement> = forwardRef((props, ref) => {\n const propsWithDefaults = {\n flexDirection: 'row' as const,\n ...props,\n };\n\n const { transientProps, otherProps } = getContainerStylingTransientProps(propsWithDefaults);\n\n const { children, className, ...forwardedProps } = otherProps;\n\n const { actionsRef, initialFocus } = useDialogContext();\n\n return (\n <StyledDialogContentActions\n {...forwardedProps}\n {...transientProps}\n className={classNames(DialogContentActions.className, className)}\n ref={useMergeRefs([ref, actionsRef])}\n tabIndex={initialFocus === 'actions' ? -1 : undefined}\n >\n {children}\n </StyledDialogContentActions>\n );\n});\nDialogContentActions.className = CLASSNAME;\nDialogContentActions.displayName = COMPONENT_NAME;\n"],"names":["StyledDialogContentActions","styled","div","baseContainer","COMPONENT_NAME","CLASSNAME","DialogContentActions","forwardRef","props","ref","propsWithDefaults","_objectSpread","flexDirection","transientProps","otherProps","getContainerStylingTransientProps","children","className","forwardedProps","_objectWithoutProperties","_excluded","actionsRef","initialFocus","useDialogContext","React","createElement","_extends","classNames","useMergeRefs","tabIndex","undefined","displayName"],"mappings":";;;;;;;;AAIA;AACA;AACA;AACO,MAAMA,0BAA0B,GAAGC,MAAM,CAACC,GAAqC,CAAA;AACtF;AACA,EAAA,EAAIC,aAAc,CAAA;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;ACRD,MAAMC,cAAc,GAAG,sBAAsB,CAAA;AAC7C,MAAMC,SAAS,GAAG,gCAAgC,CAAA;;AAElD;AACA;AACA;AACO,MAAMC,oBAAqE,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAC9G,MAAMC,iBAAiB,GAAAC,cAAA,CAAA;AACrBC,IAAAA,aAAa,EAAE,KAAA;AAAc,GAAA,EAC1BJ,KAAK,CACT,CAAA;EAED,MAAM;IAAEK,cAAc;AAAEC,IAAAA,UAAAA;AAAW,GAAC,GAAGC,iCAAiC,CAACL,iBAAiB,CAAC,CAAA;EAE3F,MAAM;MAAEM,QAAQ;AAAEC,MAAAA,SAAAA;AAA6B,KAAC,GAAGH,UAAU;AAA7BI,IAAAA,cAAc,GAAAC,wBAAA,CAAKL,UAAU,EAAAM,SAAA,CAAA,CAAA;EAE7D,MAAM;IAAEC,UAAU;AAAEC,IAAAA,YAAAA;GAAc,GAAGC,gBAAgB,EAAE,CAAA;EAEvD,oBACEC,KAAA,CAAAC,aAAA,CAACzB,0BAA0B,EAAA0B,QAAA,CAAA,EAAA,EACrBR,cAAc,EACdL,cAAc,EAAA;IAClBI,SAAS,EAAEU,UAAU,CAACrB,oBAAoB,CAACW,SAAS,EAAEA,SAAS,CAAE;IACjER,GAAG,EAAEmB,YAAY,CAAC,CAACnB,GAAG,EAAEY,UAAU,CAAC,CAAE;AACrCQ,IAAAA,QAAQ,EAAEP,YAAY,KAAK,SAAS,GAAG,CAAC,CAAC,GAAGQ,SAAAA;AAAU,GAAA,CAAA,EAErDd,QACyB,CAAC,CAAA;AAEjC,CAAC,EAAC;AACFV,oBAAoB,CAACW,SAAS,GAAGZ,SAAS,CAAA;AAC1CC,oBAAoB,CAACyB,WAAW,GAAG3B,cAAc;;;;"}
@@ -2,8 +2,8 @@ import { a as _objectWithoutProperties, b as _extends } from './_rollupPluginBab
2
2
  import React, { forwardRef } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { useMergeRefs } from '@floating-ui/react';
5
- import { baseContainer, useBoundingClientRect } from '@redsift/design-system';
6
- import styled, { css } from 'styled-components';
5
+ import { baseContainer, getContainerStylingTransientProps, useBoundingClientRect } from '@redsift/design-system';
6
+ import styled from 'styled-components';
7
7
  import { u as useDialogContext } from './useDialogContext.js';
8
8
 
9
9
  /**
@@ -13,15 +13,12 @@ const StyledDialogContentBody = styled.div`
13
13
  ${baseContainer}
14
14
 
15
15
  overflow-y: auto;
16
- ${_ref => {
16
+ max-height: ${_ref => {
17
17
  let {
18
- $marginTop,
19
- $marginBottom
18
+ $maxHeight
20
19
  } = _ref;
21
- return css`
22
- max-height: calc(100vh - ${$marginTop + $marginBottom}px);
23
- `;
24
- }}
20
+ return $maxHeight;
21
+ }};
25
22
 
26
23
  font-family: var(--redsift-typography-body-font-family);
27
24
  font-size: var(--redsift-typography-body-font-size);
@@ -74,11 +71,15 @@ const CLASSNAME = 'redsift-dialog-content-body';
74
71
  * The DialogContentBody component.
75
72
  */
76
73
  const DialogContentBody = /*#__PURE__*/forwardRef((props, ref) => {
74
+ const {
75
+ transientProps,
76
+ otherProps
77
+ } = getContainerStylingTransientProps(props);
77
78
  const {
78
79
  children,
79
80
  className
80
- } = props,
81
- forwardedProps = _objectWithoutProperties(props, _excluded);
81
+ } = otherProps,
82
+ forwardedProps = _objectWithoutProperties(otherProps, _excluded);
82
83
  const {
83
84
  actionsRef,
84
85
  bodyRef,
@@ -94,12 +95,16 @@ const DialogContentBody = /*#__PURE__*/forwardRef((props, ref) => {
94
95
  } = useBoundingClientRect(actionsRef, [children, actionsRef]);
95
96
 
96
97
  /* istanbul ignore next */
97
- return /*#__PURE__*/React.createElement(StyledDialogContentBody, _extends({}, forwardedProps, {
98
+ const marginTop = Math.max(headerHeight, hasCloseButton ? 40 : 0) + 32;
99
+ const marginBottom = (actionsHeight === 0 ? 0 : actionsHeight + 16) + 32;
100
+ const maxHeight = `calc(100vh - ${marginTop + marginBottom}px)`;
101
+ return /*#__PURE__*/React.createElement(StyledDialogContentBody, _extends({}, forwardedProps, transientProps, {
98
102
  className: classNames(DialogContentBody.className, className),
99
103
  ref: useMergeRefs([ref, bodyRef]),
100
104
  tabIndex: initialFocus === 'body' ? -1 : undefined,
101
- $marginTop: Math.max(headerHeight, hasCloseButton ? 40 : 0) + 32,
102
- $marginBottom: (actionsHeight === 0 ? 0 : actionsHeight + 16) + 32
105
+ $marginTop: `${marginTop}px`,
106
+ $marginBottom: `${marginBottom}px`,
107
+ $maxHeight: maxHeight
103
108
  }), children);
104
109
  });
105
110
  DialogContentBody.className = CLASSNAME;
@@ -1 +1 @@
1
- {"version":3,"file":"DialogContentBody.js","sources":["../../src/components/dialog-content-body/styles.ts","../../src/components/dialog-content-body/DialogContentBody.tsx"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { baseContainer } from '@redsift/design-system';\nimport { StyledDialogContentBodyProps } from './types';\n\n/**\n * Component style.\n */\nexport const StyledDialogContentBody = styled.div<StyledDialogContentBodyProps>`\n ${baseContainer}\n\n overflow-y: auto;\n ${({ $marginTop, $marginBottom }) => css`\n max-height: calc(100vh - ${$marginTop + $marginBottom}px);\n `}\n\n font-family: var(--redsift-typography-body-font-family);\n font-size: var(--redsift-typography-body-font-size);\n font-weight: var(--redsift-typography-body-font-weight);\n line-height: var(--redsift-typography-body-line-height);\n padding: 0 24px;\n margin: 16px -24px;\n\n &:focus-visible {\n outline: none;\n }\n\n scrollbar-color: var(--redsift-color-neutral-mid-grey) transparent;\n scrollbar-width: thin;\n\n &::-webkit-scrollbar {\n block-size: 9px;\n inline-size: 9px;\n }\n\n &::-webkit-scrollbar-thumb {\n background-clip: padding-box;\n background-color: var(--redsift-color-neutral-mid-grey);\n border-radius: 0px;\n border-left: 2px solid transparent;\n border-right: 2px solid transparent;\n }\n\n &::-webkit-scrollbar-track {\n background-color: transparent;\n }\n\n &::-webkit-scrollbar-thumb:horizontal,\n &::-webkit-scrollbar-thumb:vertical {\n &:hover {\n background-color: var(--redsift-color-neutral-x-dark-grey);\n }\n }\n\n &::-webkit-scrollbar-corner {\n visibility: hidden;\n }\n`;\n","import React, { forwardRef } from 'react';\nimport classNames from 'classnames';\nimport { useMergeRefs } from '@floating-ui/react';\n\nimport { Comp, useBoundingClientRect } from '@redsift/design-system';\nimport { StyledDialogContentBody } from './styles';\nimport { DialogContentBodyProps } from './types';\nimport { useDialogContext } from '../dialog';\n\nconst COMPONENT_NAME = 'DialogContentBody';\nconst CLASSNAME = 'redsift-dialog-content-body';\n\n/**\n * The DialogContentBody component.\n */\nexport const DialogContentBody: Comp<DialogContentBodyProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { children, className, ...forwardedProps } = props;\n\n const { actionsRef, bodyRef, hasCloseButton, headerRef, initialFocus } = useDialogContext();\n\n const { height: headerHeight = 0 } = useBoundingClientRect(headerRef as any, [children, headerRef]);\n const { height: actionsHeight = 0 } = useBoundingClientRect(actionsRef as any, [children, actionsRef]);\n\n /* istanbul ignore next */\n return (\n <StyledDialogContentBody\n {...forwardedProps}\n className={classNames(DialogContentBody.className, className)}\n ref={useMergeRefs([ref, bodyRef])}\n tabIndex={initialFocus === 'body' ? -1 : undefined}\n $marginTop={Math.max(headerHeight, hasCloseButton ? 40 : 0) + 32}\n $marginBottom={(actionsHeight === 0 ? 0 : actionsHeight + 16) + 32}\n >\n {children}\n </StyledDialogContentBody>\n );\n});\nDialogContentBody.className = CLASSNAME;\nDialogContentBody.displayName = COMPONENT_NAME;\n"],"names":["StyledDialogContentBody","styled","div","baseContainer","_ref","$marginTop","$marginBottom","css","COMPONENT_NAME","CLASSNAME","DialogContentBody","forwardRef","props","ref","children","className","forwardedProps","_objectWithoutProperties","_excluded","actionsRef","bodyRef","hasCloseButton","headerRef","initialFocus","useDialogContext","height","headerHeight","useBoundingClientRect","actionsHeight","React","createElement","_extends","classNames","useMergeRefs","tabIndex","undefined","Math","max","displayName"],"mappings":";;;;;;;;AAIA;AACA;AACA;AACO,MAAMA,uBAAuB,GAAGC,MAAM,CAACC,GAAkC,CAAA;AAChF,EAAA,EAAIC,aAAc,CAAA;AAClB;AACA;AACA,EAAA,EAAIC,IAAA,IAAA;EAAA,IAAC;IAAEC,UAAU;AAAEC,IAAAA,aAAAA;AAAc,GAAC,GAAAF,IAAA,CAAA;AAAA,EAAA,OAAKG,GAAI,CAAA;AAC3C,6BAA+BF,EAAAA,UAAU,GAAGC,aAAc,CAAA;AAC1D,EAAG,CAAA,CAAA;AAAA,CAAC,CAAA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;AC/CD,MAAME,cAAc,GAAG,mBAAmB,CAAA;AAC1C,MAAMC,SAAS,GAAG,6BAA6B,CAAA;;AAE/C;AACA;AACA;AACO,MA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A;AACvCC,iBAAiB,CAAC4B,WAAW,GAAG9B,cAAc;;;;"}
1
+ {"version":3,"file":"DialogContentBody.js","sources":["../../src/components/dialog-content-body/styles.ts","../../src/components/dialog-content-body/DialogContentBody.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { baseContainer } from '@redsift/design-system';\nimport { StyledDialogContentBodyProps } from './types';\n\n/**\n * Component style.\n */\nexport const StyledDialogContentBody = styled.div<StyledDialogContentBodyProps>`\n ${baseContainer}\n\n overflow-y: auto;\n max-height: ${({ $maxHeight }) => $maxHeight};\n\n font-family: var(--redsift-typography-body-font-family);\n font-size: var(--redsift-typography-body-font-size);\n font-weight: var(--redsift-typography-body-font-weight);\n line-height: var(--redsift-typography-body-line-height);\n padding: 0 24px;\n margin: 16px -24px;\n\n &:focus-visible {\n outline: none;\n }\n\n scrollbar-color: var(--redsift-color-neutral-mid-grey) transparent;\n scrollbar-width: thin;\n\n &::-webkit-scrollbar {\n block-size: 9px;\n inline-size: 9px;\n }\n\n &::-webkit-scrollbar-thumb {\n background-clip: padding-box;\n background-color: var(--redsift-color-neutral-mid-grey);\n border-radius: 0px;\n border-left: 2px solid transparent;\n border-right: 2px solid transparent;\n }\n\n &::-webkit-scrollbar-track {\n background-color: transparent;\n }\n\n &::-webkit-scrollbar-thumb:horizontal,\n &::-webkit-scrollbar-thumb:vertical {\n &:hover {\n background-color: var(--redsift-color-neutral-x-dark-grey);\n }\n }\n\n &::-webkit-scrollbar-corner {\n visibility: hidden;\n }\n`;\n","import React, { forwardRef } from 'react';\nimport classNames from 'classnames';\nimport { useMergeRefs } from '@floating-ui/react';\n\nimport { Comp, getContainerStylingTransientProps, useBoundingClientRect } from '@redsift/design-system';\nimport { StyledDialogContentBody } from './styles';\nimport { DialogContentBodyProps } from './types';\nimport { useDialogContext } from '../dialog';\n\nconst COMPONENT_NAME = 'DialogContentBody';\nconst CLASSNAME = 'redsift-dialog-content-body';\n\n/**\n * The DialogContentBody component.\n */\nexport const DialogContentBody: Comp<DialogContentBodyProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { transientProps, otherProps } = getContainerStylingTransientProps(props);\n\n const { children, className, ...forwardedProps } = otherProps;\n\n const { actionsRef, bodyRef, hasCloseButton, headerRef, initialFocus } = useDialogContext();\n\n const { height: headerHeight = 0 } = useBoundingClientRect(headerRef as any, [children, headerRef]);\n const { height: actionsHeight = 0 } = useBoundingClientRect(actionsRef as any, [children, actionsRef]);\n\n /* istanbul ignore next */\n const marginTop = Math.max(headerHeight, hasCloseButton ? 40 : 0) + 32;\n const marginBottom = (actionsHeight === 0 ? 0 : actionsHeight + 16) + 32;\n const maxHeight = `calc(100vh - ${marginTop + marginBottom}px)`;\n\n return (\n <StyledDialogContentBody\n {...forwardedProps}\n {...transientProps}\n className={classNames(DialogContentBody.className, className)}\n ref={useMergeRefs([ref, bodyRef])}\n tabIndex={initialFocus === 'body' ? -1 : undefined}\n $marginTop={`${marginTop}px`}\n $marginBottom={`${marginBottom}px`}\n $maxHeight={maxHeight}\n >\n {children}\n </StyledDialogContentBody>\n );\n});\nDialogContentBody.className = CLASSNAME;\nDialogContentBody.displayName = COMPONENT_NAME;\n"],"names":["StyledDialogContentBody","styled","div","baseContainer","_ref","$maxHeight","COMPONENT_NAME","CLASSNAME","DialogContentBody","forwardRef","props","ref","transientProps","otherProps","getContainerStylingTransientProps","children","className","forwardedProps","_objectWithoutProperties","_excluded","actionsRef","bodyRef","hasCloseButton","headerRef","initialFocus","useDialogContext","height","headerHeight","useBoundingClientRect","actionsHeight","marginTop","Math","max","marginBottom","maxHeight","React","createElement","_extends","classNames","useMergeRefs","tabIndex","undefined","$marginTop","$marginBottom","displayName"],"mappings":";;;;;;;;AAIA;AACA;AACA;AACO,MAAMA,uBAAuB,GAAGC,MAAM,CAACC,GAAkC,CAAA;AAChF,EAAA,EAAIC,aAAc,CAAA;AAClB;AACA;AACA,cAAA,EAAgBC,IAAA,IAAA;EAAA,IAAC;AAAEC,IAAAA,UAAAA;AAAW,GAAC,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;AACtE,EAAA,MAAMW,YAAY,GAAG,CAACJ,aAAa,KAAK,CAAC,GAAG,CAAC,GAAGA,aAAa,GAAG,EAAE,IAAI,EAAE,CAAA;AACxE,EAAA,MAAMK,SAAS,GAAI,CAAA,aAAA,EAAeJ,SAAS,GAAGG,YAAa,CAAI,GAAA,CAAA,CAAA;EAE/D,oBACEE,KAAA,CAAAC,aAAA,CAACpC,uBAAuB,EAAAqC,QAAA,CAAA,EAAA,EAClBpB,cAAc,EACdL,cAAc,EAAA;IAClBI,SAAS,EAAEsB,UAAU,CAAC9B,iBAAiB,CAACQ,SAAS,EAAEA,SAAS,CAAE;IAC9DL,GAAG,EAAE4B,YAAY,CAAC,CAAC5B,GAAG,EAAEU,OAAO,CAAC,CAAE;IAClCmB,QAAQ,EAAEhB,YAAY,KAAK,MAAM,GAAG,CAAC,CAAC,GAAGiB,SAAU;IACnDC,UAAU,EAAG,CAAEZ,EAAAA,SAAU,CAAI,EAAA,CAAA;IAC7Ba,aAAa,EAAG,CAAEV,EAAAA,YAAa,CAAI,EAAA,CAAA;AACnC5B,IAAAA,UAAU,EAAE6B,SAAAA;AAAU,GAAA,CAAA,EAErBnB,QACsB,CAAC,CAAA;AAE9B,CAAC,EAAC;AACFP,iBAAiB,CAACQ,SAAS,GAAGT,SAAS,CAAA;AACvCC,iBAAiB,CAACoC,WAAW,GAAGtC,cAAc;;;;"}
@@ -1,8 +1,8 @@
1
- import { a as _objectWithoutProperties, b as _extends } from './_rollupPluginBabelHelpers.js';
1
+ import { _ as _objectSpread2, a as _objectWithoutProperties, b as _extends } from './_rollupPluginBabelHelpers.js';
2
2
  import React, { forwardRef } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { useMergeRefs } from '@floating-ui/react';
5
- import { baseStyling, baseFlexbox, useId, Skeleton, Heading, Icon } from '@redsift/design-system';
5
+ import { baseStyling, baseFlexbox, getStylingTransientProps, getFlexLayoutTransientProps, useId, Skeleton, Heading, Icon } from '@redsift/design-system';
6
6
  import styled from 'styled-components';
7
7
  import { u as useDialogContext } from './useDialogContext.js';
8
8
 
@@ -40,6 +40,18 @@ const CLASSNAME = 'redsift-dialog-content-header';
40
40
  * The DialogContentHeader component.
41
41
  */
42
42
  const DialogContentHeader = /*#__PURE__*/forwardRef((props, ref) => {
43
+ const propsWithDefaults = _objectSpread2({
44
+ flexDirection: 'column'
45
+ }, props);
46
+ const {
47
+ transientProps: stylingTransientProps,
48
+ otherProps: propsWithoutStyling
49
+ } = getStylingTransientProps(propsWithDefaults);
50
+ const {
51
+ transientProps: flexTransientProps,
52
+ otherProps
53
+ } = getFlexLayoutTransientProps(propsWithoutStyling);
54
+ const transientProps = _objectSpread2(_objectSpread2({}, stylingTransientProps), flexTransientProps);
43
55
  const {
44
56
  children,
45
57
  className,
@@ -50,8 +62,8 @@ const DialogContentHeader = /*#__PURE__*/forwardRef((props, ref) => {
50
62
  isLoading,
51
63
  subheader,
52
64
  theme
53
- } = props,
54
- forwardedProps = _objectWithoutProperties(props, _excluded);
65
+ } = otherProps,
66
+ forwardedProps = _objectWithoutProperties(otherProps, _excluded);
55
67
  const {
56
68
  setLabelId,
57
69
  setDescriptionId,
@@ -74,7 +86,7 @@ const DialogContentHeader = /*#__PURE__*/forwardRef((props, ref) => {
74
86
  setDescriptionId(descriptionId);
75
87
  return () => setDescriptionId(undefined);
76
88
  }, [descriptionId, setDescriptionId]);
77
- return /*#__PURE__*/React.createElement(StyledDialogContentHeader, _extends({}, forwardedProps, {
89
+ return /*#__PURE__*/React.createElement(StyledDialogContentHeader, _extends({}, forwardedProps, transientProps, {
78
90
  className: classNames(DialogContentHeader.className, className),
79
91
  ref: useMergeRefs([ref, headerRef]),
80
92
  tabIndex: initialFocus === 'header' ? -1 : undefined
@@ -1 +1 @@
1
- {"version":3,"file":"DialogContentHeader.js","sources":["../../src/components/dialog-content-header/styles.ts","../../src/components/dialog-content-header/DialogContentHeader.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { StyledDialogContentHeaderProps } from './types';\nimport { baseFlexbox, baseStyling } from '@redsift/design-system';\n\n/**\n * Component style.\n */\nexport const StyledDialogContentHeader = styled.div<StyledDialogContentHeaderProps>`\n display: flex;\n flex-direction: column;\n width: 100%;\n ${baseStyling}\n ${baseFlexbox}\n\n .redsift-dialog-content-header__header {\n align-items: center;\n display: flex;\n gap: 8px;\n padding: 10px 0px;\n margin: 0px;\n }\n\n .redsift-dialog-content-header__subheader {\n font-family: var(--redsift-typography-body-font-family);\n font-size: var(--redsift-typography-body-font-size);\n font-weight: var(--redsift-typography-body-font-weight);\n line-height: var(--redsift-typography-body-line-height);\n }\n`;\n","import React, { forwardRef } from 'react';\nimport classNames from 'classnames';\nimport { useMergeRefs } from '@floating-ui/react';\n\nimport { Icon, Heading, Comp, useId, Skeleton } from '@redsift/design-system';\nimport { StyledDialogContentHeader } from './styles';\nimport { DialogContentHeaderProps } from './types';\nimport { useDialogContext } from '../dialog';\n\nconst COMPONENT_NAME = 'DialogContentHeader';\nconst CLASSNAME = 'redsift-dialog-content-header';\n\n/**\n * The DialogContentHeader component.\n */\nexport const DialogContentHeader: Comp<DialogContentHeaderProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { children, className, header, headingProps, icon, iconProps, isLoading, subheader, theme, ...forwardedProps } =\n props;\n\n const { setLabelId, setDescriptionId, headerRef, initialFocus } = useDialogContext();\n const [labelId] = useId();\n const [descriptionId] = useId();\n\n // Only sets `aria-labelledby` on the Dialog root element\n // if this component is mounted inside it.\n React.useLayoutEffect(() => {\n setLabelId(labelId);\n return () => setLabelId(undefined);\n }, [labelId, setLabelId]);\n\n // Only sets `aria-describedby` on the Dialog root element\n // if this component is mounted inside it.\n React.useLayoutEffect(() => {\n setDescriptionId(descriptionId);\n return () => setDescriptionId(undefined);\n }, [descriptionId, setDescriptionId]);\n\n return (\n <StyledDialogContentHeader\n {...forwardedProps}\n className={classNames(DialogContentHeader.className, className)}\n ref={useMergeRefs([ref, headerRef])}\n tabIndex={initialFocus === 'header' ? -1 : undefined}\n >\n {subheader ? (\n <Skeleton.Text theme={theme} variant=\"body\" isLoaded={!isLoading}>\n <div className={`${DialogContentHeader.className}__subheader`}>{subheader}</div>\n </Skeleton.Text>\n ) : null}\n {header ? (\n <Skeleton.Text\n theme={theme}\n variant={headingProps?.variant || 'h2'}\n isLoaded={!isLoading}\n marginTop=\"10px\"\n marginBottom=\"10px\"\n >\n <Heading\n theme={theme}\n as=\"h2\"\n color=\"black\"\n className={`${DialogContentHeader.className}__header`}\n variant=\"h2\"\n {...headingProps}\n >\n {icon ? <Icon theme={theme} icon={icon} aria-hidden=\"true\" size=\"large\" {...iconProps} /> : null}\n {header}\n </Heading>\n </Skeleton.Text>\n ) : null}\n {children ? <div id={descriptionId}>{children}</div> : null}\n </StyledDialogContentHeader>\n );\n});\nDialogContentHeader.className = CLASSNAME;\nDialogContentHeader.displayName = COMPONENT_NAME;\n"],"names":["StyledDialogContentHeader","styled","div","baseStyling","baseFlexbox","COMPONENT_NAME","CLASSNAME","DialogContentHeader","forwardRef","props","ref","children","className","header","headingProps","icon","iconProps","isLoading","subheader","theme","forwardedProps","_objectWithoutProperties","_excluded","setLabelId","setDescriptionId","headerRef","initialFocus","useDialogContext","labelId","useId","descriptionId","React","useLayoutEffect","undefined","createElement","_extends","classNames","useMergeRefs","tabIndex","Skeleton","Text","variant","isLoaded","marginTop","marginBottom","Heading","as","color","Icon","size","id","displayName"],"mappings":";;;;;;;;AAIA;AACA;AACA;AACO,MAAMA,yBAAyB,GAAGC,MAAM,CAACC,GAAoC,CAAA;AACpF;AACA;AACA;AACA,EAAA,EAAIC,WAAY,CAAA;AAChB,EAAA,EAAIC,WAAY,CAAA;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;ACnBD,MAAMC,cAAc,GAAG,qBAAqB,CAAA;AAC5C,MAAMC,SAAS,GAAG,+BAA+B,CAAA;;AAEjD;AACA;AACA;AACO,MAAMC,mBAA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AAA,EAAKjC,SAAS,CAAG,CAAC,GAAG,IAAI,EAC/FH,MACM,CACI,CAAC,GACd,IAAI,EACPF,QAAQ,gBAAGoB,KAAA,CAAAG,aAAA,CAAA,KAAA,EAAA;AAAKgB,IAAAA,EAAE,EAAEpB,aAAAA;AAAc,GAAA,EAAEnB,QAAc,CAAC,GAAG,IAC9B,CAAC,CAAA;AAEhC,CAAC,EAAC;AACFJ,mBAAmB,CAACK,SAAS,GAAGN,SAAS,CAAA;AACzCC,mBAAmB,CAAC4C,WAAW,GAAG9C,cAAc;;;;"}
1
+ {"version":3,"file":"DialogContentHeader.js","sources":["../../src/components/dialog-content-header/styles.ts","../../src/components/dialog-content-header/DialogContentHeader.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { StyledDialogContentHeaderProps } from './types';\nimport { baseFlexbox, baseStyling } from '@redsift/design-system';\n\n/**\n * Component style.\n */\nexport const StyledDialogContentHeader = styled.div<StyledDialogContentHeaderProps>`\n display: flex;\n flex-direction: column;\n width: 100%;\n ${baseStyling}\n ${baseFlexbox}\n\n .redsift-dialog-content-header__header {\n align-items: center;\n display: flex;\n gap: 8px;\n padding: 10px 0px;\n margin: 0px;\n }\n\n .redsift-dialog-content-header__subheader {\n font-family: var(--redsift-typography-body-font-family);\n font-size: var(--redsift-typography-body-font-size);\n font-weight: var(--redsift-typography-body-font-weight);\n line-height: var(--redsift-typography-body-line-height);\n }\n`;\n","import React, { forwardRef } from 'react';\nimport classNames from 'classnames';\nimport { useMergeRefs } from '@floating-ui/react';\n\nimport {\n Icon,\n Heading,\n Comp,\n getStylingTransientProps,\n getFlexLayoutTransientProps,\n useId,\n Skeleton,\n} from '@redsift/design-system';\nimport { StyledDialogContentHeader } from './styles';\nimport { DialogContentHeaderProps } from './types';\nimport { useDialogContext } from '../dialog';\n\nconst COMPONENT_NAME = 'DialogContentHeader';\nconst CLASSNAME = 'redsift-dialog-content-header';\n\n/**\n * The DialogContentHeader component.\n */\nexport const DialogContentHeader: Comp<DialogContentHeaderProps, HTMLDivElement> = forwardRef((props, ref) => {\n const propsWithDefaults = {\n flexDirection: 'column' as const,\n ...props,\n };\n const { transientProps: stylingTransientProps, otherProps: propsWithoutStyling } =\n getStylingTransientProps(propsWithDefaults);\n const { transientProps: flexTransientProps, otherProps } = getFlexLayoutTransientProps(propsWithoutStyling);\n const transientProps = { ...stylingTransientProps, ...flexTransientProps };\n\n const { children, className, header, headingProps, icon, iconProps, isLoading, subheader, theme, ...forwardedProps } =\n otherProps;\n\n const { setLabelId, setDescriptionId, headerRef, initialFocus } = useDialogContext();\n const [labelId] = useId();\n const [descriptionId] = useId();\n\n // Only sets `aria-labelledby` on the Dialog root element\n // if this component is mounted inside it.\n React.useLayoutEffect(() => {\n setLabelId(labelId);\n return () => setLabelId(undefined);\n }, [labelId, setLabelId]);\n\n // Only sets `aria-describedby` on the Dialog root element\n // if this component is mounted inside it.\n React.useLayoutEffect(() => {\n setDescriptionId(descriptionId);\n return () => setDescriptionId(undefined);\n }, [descriptionId, setDescriptionId]);\n\n return (\n <StyledDialogContentHeader\n {...forwardedProps}\n {...transientProps}\n className={classNames(DialogContentHeader.className, className)}\n ref={useMergeRefs([ref, headerRef])}\n tabIndex={initialFocus === 'header' ? -1 : undefined}\n >\n {subheader ? (\n <Skeleton.Text theme={theme} variant=\"body\" isLoaded={!isLoading}>\n <div className={`${DialogContentHeader.className}__subheader`}>{subheader}</div>\n </Skeleton.Text>\n ) : null}\n {header ? (\n <Skeleton.Text\n theme={theme}\n variant={headingProps?.variant || 'h2'}\n isLoaded={!isLoading}\n marginTop=\"10px\"\n marginBottom=\"10px\"\n >\n <Heading\n theme={theme}\n as=\"h2\"\n color=\"black\"\n className={`${DialogContentHeader.className}__header`}\n variant=\"h2\"\n {...headingProps}\n >\n {icon ? <Icon theme={theme} icon={icon} aria-hidden=\"true\" size=\"large\" {...iconProps} /> : null}\n {header}\n </Heading>\n </Skeleton.Text>\n ) : null}\n {children ? <div id={descriptionId}>{children}</div> : null}\n </StyledDialogContentHeader>\n );\n});\nDialogContentHeader.className = CLASSNAME;\nDialogContentHeader.displayName = COMPONENT_NAME;\n"],"names":["StyledDialogContentHeader","styled","div","baseStyling","baseFlexbox","COMPONENT_NAME","CLASSNAME","DialogContentHeader","forwardRef","props","ref","propsWithDefaults","_objectSpread","flexDirection","transientProps","stylingTransientProps","otherProps","propsWithoutStyling","getStylingTransientProps","flexTransientProps","getFlexLayoutTransientProps","children","className","header","headingProps","icon","iconProps","isLoading","subheader","theme","forwardedProps","_objectWithoutProperties","_excluded","setLabelId","setDescriptionId","headerRef","initialFocus","useDialogContext","labelId","useId","descriptionId","React","useLayoutEffect","undefined","createElement","_extends","classNames","useMergeRefs","tabIndex","Skeleton","Text","variant","isLoaded","marginTop","marginBottom","Heading","as","color","Icon","size","id","displayName"],"mappings":";;;;;;;;AAIA;AACA;AACA;AACO,MAAMA,yBAAyB,GAAGC,MAAM,CAACC,GAAoC,CAAA;AACpF;AACA;AACA;AACA,EAAA,EAAIC,WAAY,CAAA;AAChB,EAAA,EAAIC,WAAY,CAAA;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;ACXD,MAAMC,cAAc,GAAG,qBAAqB,CAAA;AAC5C,MAAMC,SAAS,GAAG,+BAA+B,CAAA;;AAEjD;AACA;AACA;AACO,MAAMC,mBAAmE,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAC5G,MAAMC,iBAAiB,GAAAC,cAAA,CAAA;AACrBC,IAAAA,aAAa,EAAE,QAAA;AAAiB,GAAA,EAC7BJ,KAAK,CACT,CAAA;EACD,MAAM;AAAEK,IAAAA,cAAc,EAAEC,qBAAqB;AAAEC,IAAAA,UAAU,EAAEC,mBAAAA;AAAoB,GAAC,GAC9EC,wBAAwB,CAACP,iBAAiB,CAAC,CAAA;EAC7C,MAAM;AAAEG,IAAAA,cAAc,EAAEK,kBAAkB;AAAEH,IA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,QAAA,CAAA;AAAChB,IAAAA,KAAK,EAAEA,KAAM;AAACJ,IAAAA,IAAI,EAAEA,IAAK;AAAC,IAAA,aAAA,EAAY,MAAM;AAACkC,IAAAA,IAAI,EAAC,OAAA;AAAO,GAAA,EAAKjC,SAAS,CAAG,CAAC,GAAG,IAAI,EAC/FH,MACM,CACI,CAAC,GACd,IAAI,EACPF,QAAQ,gBAAGoB,KAAA,CAAAG,aAAA,CAAA,KAAA,EAAA;AAAKgB,IAAAA,EAAE,EAAEpB,aAAAA;AAAc,GAAA,EAAEnB,QAAc,CAAC,GAAG,IAC9B,CAAC,CAAA;AAEhC,CAAC,EAAC;AACFd,mBAAmB,CAACe,SAAS,GAAGhB,SAAS,CAAA;AACzCC,mBAAmB,CAACsD,WAAW,GAAGxD,cAAc;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { a as _objectWithoutProperties, b as _extends } from './_rollupPluginBabelHelpers.js';
2
2
  import React, { forwardRef } from 'react';
3
3
  import classNames from 'classnames';
4
- import { baseStyling, useTheme, useMessageFormatter, Flexbox, Text, RedsiftTypographyFontWeightSemiBold, IconButton, isComponent, Spinner, Icon, NotificationsColorPalette } from '@redsift/design-system';
4
+ import { baseStyling, getStylingTransientProps, useTheme, useMessageFormatter, Flexbox, Text, RedsiftTypographyFontWeightSemiBold, IconButton, isComponent, Spinner, Icon, NotificationsColorPalette } from '@redsift/design-system';
5
5
  import { mdiClose, mdiAlert, mdiCheckCircle, mdiAlertCircle, mdiInformation } from '@redsift/icons';
6
6
  import styled, { css } from 'styled-components';
7
7
 
@@ -87,7 +87,7 @@ const StyledToast = styled.div`
87
87
  }}
88
88
  `;
89
89
 
90
- const _excluded = ["children", "className", "closeButton", "closeToast", "theme", "title", "variant"];
90
+ const _excluded = ["children", "className", "closeButton", "closeToast", "theme", "title", "variant", "toastProps"];
91
91
  const COMPONENT_NAME = 'Toast';
92
92
  const CLASSNAME = 'redsift-toast';
93
93
  const getVariant = variant => {
@@ -124,6 +124,10 @@ const getVariant = variant => {
124
124
  * The Toast component.
125
125
  */
126
126
  const Toast = /*#__PURE__*/forwardRef((props, ref) => {
127
+ const {
128
+ transientProps,
129
+ otherProps
130
+ } = getStylingTransientProps(props);
127
131
  const {
128
132
  children,
129
133
  className,
@@ -131,13 +135,15 @@ const Toast = /*#__PURE__*/forwardRef((props, ref) => {
131
135
  closeToast,
132
136
  theme: propsTheme,
133
137
  title,
134
- variant = 'info'
135
- } = props,
136
- forwardedProps = _objectWithoutProperties(props, _excluded);
138
+ variant = 'info',
139
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
140
+ toastProps
141
+ } = otherProps,
142
+ forwardedProps = _objectWithoutProperties(otherProps, _excluded);
137
143
  const theme = useTheme(propsTheme);
138
144
  const format = useMessageFormatter(intlMessages);
139
145
  const icon = getVariant(variant);
140
- return /*#__PURE__*/React.createElement(StyledToast, _extends({}, forwardedProps, {
146
+ return /*#__PURE__*/React.createElement(StyledToast, _extends({}, forwardedProps, transientProps, {
141
147
  className: classNames(Toast.className, className),
142
148
  ref: ref,
143
149
  $hasTitle: Boolean(title),
@@ -1 +1 @@
1
- {"version":3,"file":"Toast2.js","sources":["../../src/components/toast/types.ts","../../src/components/toast/intl/index.ts","../../src/components/toast/styles.ts","../../src/components/toast/Toast.tsx"],"sourcesContent":["import { ComponentProps, ReactNode } from 'react';\nimport { ValueOf, SizingProps, SpacingProps, Theme } from '@redsift/design-system';\n\n/**\n * Component variant.\n */\nexport const ToastVariant = {\n success: 'success',\n error: 'error',\n warning: 'warning',\n info: 'info',\n loading: 'loading',\n} as const;\nexport type ToastVariant = ValueOf<typeof ToastVariant>;\n\nexport const ToastPlacement = {\n 'top-right': 'top-right',\n 'top-center': 'top-center',\n 'top-left': 'top-left',\n 'bottom-right': 'bottom-right',\n 'bottom-center': 'bottom-center',\n 'bottom-left': 'bottom-left',\n} as const;\nexport type ToastPlacement = ValueOf<typeof ToastPlacement>;\n\n/**\n * Component props.\n */\nexport interface ToastProps extends Omit<ComponentProps<'div'>, 'id' | 'style'>, SpacingProps, SizingProps {\n /** Whether the component has a close button or not. */\n closeButton?: boolean | ReactNode;\n /** Title. */\n title?: string;\n /** Theme. */\n theme?: Theme;\n /** Variant */\n variant?: ToastVariant;\n}\n\nexport type StyledToastProps = Omit<ToastProps, 'variant' | 'id'> & {\n $hasTitle: boolean;\n $variant: ToastProps['variant'];\n $theme: Theme;\n};\n","import enUS from './en-US.json';\nimport frFR from './fr-FR.json';\n\nexport default {\n 'en-US': enUS,\n 'fr-FR': frFR,\n};\n","import styled, { css } from 'styled-components';\nimport { baseStyling } from '@redsift/design-system';\nimport { StyledToastProps } from './types';\n\n/**\n * Component style.\n */\nexport const StyledToast = styled.div<StyledToastProps>`\n ${baseStyling}\n\n color: var(--redsift-color-neutral-x-dark-grey);\n\n padding: 16px;\n box-shadow: 0px 2px 4px -1px rgb(0 0 0 / 20%), 0px 4px 5px rgb(0 0 0 / 14%), 0px 1px 10px rgb(0 0 0 / 12%);\n\n ${({ $hasTitle, $variant }) => css`\n background-color: ${$variant === 'loading'\n ? 'var(--redsift-color-neutral-white)'\n : `var(--redsift-color-notifications-${$variant}-hover)`};\n\n .redsift-toast-header__icon-button {\n background-color: transparent;\n padding: 0px;\n .redsift-icon {\n color: var(--redsift-color-neutral-x-dark-grey);\n }\n\n &:hover,\n &:focus-visible {\n background-color: var(--redsift-color-notifications-${$variant}-active);\n\n .redsift-icon {\n color: var(--redsift-color-neutral-x-dark-grey);\n }\n }\n }\n\n .redsift-toast__content {\n margin-top: ${$hasTitle ? '8px' : '-24px'};\n margin-left: 38px;\n }\n `}\n`;\n","import React, { forwardRef, RefObject } from 'react';\nimport classNames from 'classnames';\n\nimport { useMessageFormatter } from '@redsift/design-system';\nimport intlMessages from './intl';\n\nimport { mdiAlert, mdiAlertCircle, mdiCheckCircle, mdiClose, mdiInformation } from '@redsift/icons';\nimport {\n NotificationsColorPalette,\n Comp,\n Icon,\n Flexbox,\n Spinner,\n Text,\n isComponent,\n ButtonColor,\n IconButton,\n RedsiftTypographyFontWeightSemiBold,\n useTheme,\n} from '@redsift/design-system';\nimport { StyledToast } from './styles';\nimport { ToastProps, ToastVariant } from './types';\n\nconst COMPONENT_NAME = 'Toast';\nconst CLASSNAME = 'redsift-toast';\n\nconst getVariant = (variant: ToastVariant) => {\n switch (variant) {\n case ToastVariant.info:\n default:\n return <Icon icon={mdiInformation} color={NotificationsColorPalette.info} />;\n case ToastVariant.error:\n return <Icon icon={mdiAlertCircle} color={NotificationsColorPalette.error} />;\n case ToastVariant.success:\n return <Icon icon={mdiCheckCircle} color={NotificationsColorPalette.success} />;\n case ToastVariant.warning:\n return <Icon icon={mdiAlert} color={NotificationsColorPalette.warning} />;\n case ToastVariant.loading:\n return <Spinner size=\"small\" />;\n }\n};\n\n/**\n * The Toast component.\n */\nexport const Toast: Comp<ToastProps & { closeToast?: () => void }, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n children,\n className,\n closeButton = true,\n closeToast,\n theme: propsTheme,\n title,\n variant = 'info',\n ...forwardedProps\n } = props;\n\n const theme = useTheme(propsTheme);\n\n const format = useMessageFormatter(intlMessages);\n\n const icon = getVariant(variant!);\n\n return (\n <StyledToast\n {...forwardedProps}\n className={classNames(Toast.className, className)}\n ref={ref as RefObject<HTMLDivElement>}\n $hasTitle={Boolean(title)}\n $variant={variant}\n $theme={theme}\n >\n <Flexbox className={`${Toast.className}__header`} justifyContent=\"space-between\" alignItems=\"center\">\n <Flexbox justifyContent=\"space-between\" flexDirection=\"column\" gap=\"0\">\n <Flexbox className={`${Toast.className}-header__title`} gap=\"14px\" alignItems=\"flex-start\">\n {icon}\n {title ? <Text fontWeight={RedsiftTypographyFontWeightSemiBold}>{title}</Text> : null}\n </Flexbox>\n\n {children ? <div className={`${Toast.className}__content`}>{children}</div> : null}\n </Flexbox>\n\n {closeButton === true ? (\n <IconButton\n aria-label={format('close')}\n className={`${Toast.className}-header__icon-button`}\n icon={mdiClose}\n onClick={closeToast}\n />\n ) : isComponent('Button')(closeButton) || isComponent('IconButton')(closeButton) ? (\n React.cloneElement(closeButton, {\n color: variant === 'loading' ? 'info' : (variant as ButtonColor),\n onClick: () => {\n closeButton.props.onClick?.();\n closeToast?.();\n },\n })\n ) : null}\n </Flexbox>\n </StyledToast>\n );\n});\nToast.className = CLASSNAME;\nToast.displayName = COMPONENT_NAME;\n"],"names":["ToastVariant","success","error","warning","info","loading","ToastPlacement","enUS","frFR","StyledToast","styled","div","baseStyling","_ref","$hasTitle","$variant","css","COMPONENT_NAME","CLASSNAME","getVariant","variant","React","createElement","Icon","icon","mdiInformation","color","NotificationsColorPalette","mdiAlertCircle","mdiCheckCircle","mdiAlert","Spinner","size","Toast","forwardRef","props","ref","children","className","closeButton","closeToast","theme","propsTheme","title","forwardedProps","_objectWithoutProperties","_excluded","useTheme","format","useMessageFormatter","intlMessages","_extends","classNames","Boolean","$theme","Flexbox","justifyContent","alignItems","flexDirection","gap","Text","fontWeight","RedsiftTypographyFontWeightSemiBold","IconButton","mdiClose","onClick","isComponent","cloneElement","_closeButton$props$on","_closeButton$props","call","displayName"],"mappings":";;;;;;;AAGA;AACA;AACA;AACO,MAAMA,YAAY,GAAG;AAC1BC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,OAAO,EAAE,SAAA;AACX,EAAU;AAGH,MAAMC,cAAc,GAAG;AAC5B,EAAA,WAAW,EAAE,WAAW;AACxB,EAAA,YAAY,EAAE,YAAY;AAC1B,EAAA,UAAU,EAAE,UAAU;AACtB,EAAA,cAAc,EAAE,cAAc;AAC9B,EAAA,eAAe,EAAE,eAAe;AAChC,EAAA,aAAa,EAAE,aAAA;AACjB,EAAU;;AAGV;AACA;AACA;;;;;;;;;;;;ACxBA,mBAAe;AACb,EAAA,OAAO,EAAEC,IAAI;AACb,EAAA,OAAO,EAAEC,IAAAA;AACX,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pDd,IAAAA,IAAI,EAAEwC,QAAS;AACfC,IAAAA,OAAO,EAAEzB,UAAAA;GACV,CAAC,GACA0B,WAAW,CAAC,QAAQ,CAAC,CAAC3B,WAAW,CAAC,IAAI2B,WAAW,CAAC,YAAY,CAAC,CAAC3B,WAAW,CAAC,gBAC9ElB,KAAK,CAAC8C,YAAY,CAAC5B,WAAW,EAAE;AAC9Bb,IAAAA,KAAK,EAAEN,OAAO,KAAK,SAAS,GAAG,MAAM,GAAIA,OAAuB;IAChE6C,OAAO,EAAEA,MAAM;MAAA,IAAAG,qBAAA,EAAAC,kBAAA,CAAA;AACb,MAAA,CAAAD,qBAAA,GAAAC,CAAAA,kBAAA,GAAA9B,WAAW,CAACJ,KAAK,EAAC8B,OAAO,MAAA,IAAA,IAAAG,qBAAA,KAAzBA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,qBAAA,CAAAE,IAAA,CAAAD,kBAA4B,CAAC,CAAA;AAC7B7B,MAAAA,UAAU,KAAVA,IAAAA,IAAAA,UAAU,KAAVA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,UAAU,EAAI,CAAA;AAChB,KAAA;AACF,GAAC,CAAC,GACA,IACG,CACE,CAAC,CAAA;AAElB,CAAC,EAAC;AACFP,KAAK,CAACK,SAAS,GAAGpB,SAAS,CAAA;AAC3Be,KAAK,CAACsC,WAAW,GAAGtD,cAAc;;;;"}
1
+ {"version":3,"file":"Toast2.js","sources":["../../src/components/toast/types.ts","../../src/components/toast/intl/index.ts","../../src/components/toast/styles.ts","../../src/components/toast/Toast.tsx"],"sourcesContent":["import { ComponentProps, ReactNode } from 'react';\nimport { ValueOf, SizingProps, SpacingProps, StylingTransientProps, Theme } from '@redsift/design-system';\n\n/**\n * Component variant.\n */\nexport const ToastVariant = {\n success: 'success',\n error: 'error',\n warning: 'warning',\n info: 'info',\n loading: 'loading',\n} as const;\nexport type ToastVariant = ValueOf<typeof ToastVariant>;\n\nexport const ToastPlacement = {\n 'top-right': 'top-right',\n 'top-center': 'top-center',\n 'top-left': 'top-left',\n 'bottom-right': 'bottom-right',\n 'bottom-center': 'bottom-center',\n 'bottom-left': 'bottom-left',\n} as const;\nexport type ToastPlacement = ValueOf<typeof ToastPlacement>;\n\n/**\n * Component props.\n */\nexport interface ToastProps extends Omit<ComponentProps<'div'>, 'id' | 'style'>, SpacingProps, SizingProps {\n /** Whether the component has a close button or not. */\n closeButton?: boolean | ReactNode;\n /** Title. */\n title?: string;\n /** Theme. */\n theme?: Theme;\n /** Variant */\n variant?: ToastVariant;\n}\n\nexport interface StyledToastProps extends ComponentProps<'div'>, StylingTransientProps {\n $hasTitle: boolean;\n $variant: ToastProps['variant'];\n $theme: Theme;\n}\n","import enUS from './en-US.json';\nimport frFR from './fr-FR.json';\n\nexport default {\n 'en-US': enUS,\n 'fr-FR': frFR,\n};\n","import styled, { css } from 'styled-components';\nimport { baseStyling } from '@redsift/design-system';\nimport { StyledToastProps } from './types';\n\n/**\n * Component style.\n */\nexport const StyledToast = styled.div<StyledToastProps>`\n ${baseStyling}\n\n color: var(--redsift-color-neutral-x-dark-grey);\n\n padding: 16px;\n box-shadow: 0px 2px 4px -1px rgb(0 0 0 / 20%), 0px 4px 5px rgb(0 0 0 / 14%), 0px 1px 10px rgb(0 0 0 / 12%);\n\n ${({ $hasTitle, $variant }) => css`\n background-color: ${$variant === 'loading'\n ? 'var(--redsift-color-neutral-white)'\n : `var(--redsift-color-notifications-${$variant}-hover)`};\n\n .redsift-toast-header__icon-button {\n background-color: transparent;\n padding: 0px;\n .redsift-icon {\n color: var(--redsift-color-neutral-x-dark-grey);\n }\n\n &:hover,\n &:focus-visible {\n background-color: var(--redsift-color-notifications-${$variant}-active);\n\n .redsift-icon {\n color: var(--redsift-color-neutral-x-dark-grey);\n }\n }\n }\n\n .redsift-toast__content {\n margin-top: ${$hasTitle ? '8px' : '-24px'};\n margin-left: 38px;\n }\n `}\n`;\n","import React, { forwardRef, RefObject } from 'react';\nimport classNames from 'classnames';\n\nimport { useMessageFormatter } from '@redsift/design-system';\nimport intlMessages from './intl';\n\nimport { mdiAlert, mdiAlertCircle, mdiCheckCircle, mdiClose, mdiInformation } from '@redsift/icons';\nimport {\n NotificationsColorPalette,\n Comp,\n getStylingTransientProps,\n Icon,\n Flexbox,\n Spinner,\n Text,\n isComponent,\n ButtonColor,\n IconButton,\n RedsiftTypographyFontWeightSemiBold,\n useTheme,\n} from '@redsift/design-system';\nimport { StyledToast } from './styles';\nimport { ToastProps, ToastVariant } from './types';\nimport { ToastContentProps } from 'react-toastify';\n\nconst COMPONENT_NAME = 'Toast';\nconst CLASSNAME = 'redsift-toast';\n\nconst getVariant = (variant: ToastVariant) => {\n switch (variant) {\n case ToastVariant.info:\n default:\n return <Icon icon={mdiInformation} color={NotificationsColorPalette.info} />;\n case ToastVariant.error:\n return <Icon icon={mdiAlertCircle} color={NotificationsColorPalette.error} />;\n case ToastVariant.success:\n return <Icon icon={mdiCheckCircle} color={NotificationsColorPalette.success} />;\n case ToastVariant.warning:\n return <Icon icon={mdiAlert} color={NotificationsColorPalette.warning} />;\n case ToastVariant.loading:\n return <Spinner size=\"small\" />;\n }\n};\n\n/**\n * The Toast component.\n */\nexport const Toast: Comp<ToastProps & Partial<ToastContentProps>, HTMLDivElement> = forwardRef((props, ref) => {\n const { transientProps, otherProps } = getStylingTransientProps(props);\n\n const {\n children,\n className,\n closeButton = true,\n closeToast,\n theme: propsTheme,\n title,\n variant = 'info',\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n toastProps,\n ...forwardedProps\n } = otherProps;\n\n const theme = useTheme(propsTheme);\n\n const format = useMessageFormatter(intlMessages);\n\n const icon = getVariant(variant!);\n\n return (\n <StyledToast\n {...forwardedProps}\n {...transientProps}\n className={classNames(Toast.className, className)}\n ref={ref as RefObject<HTMLDivElement>}\n $hasTitle={Boolean(title)}\n $variant={variant}\n $theme={theme}\n >\n <Flexbox className={`${Toast.className}__header`} justifyContent=\"space-between\" alignItems=\"center\">\n <Flexbox justifyContent=\"space-between\" flexDirection=\"column\" gap=\"0\">\n <Flexbox className={`${Toast.className}-header__title`} gap=\"14px\" alignItems=\"flex-start\">\n {icon}\n {title ? <Text fontWeight={RedsiftTypographyFontWeightSemiBold}>{title}</Text> : null}\n </Flexbox>\n\n {children ? <div className={`${Toast.className}__content`}>{children}</div> : null}\n </Flexbox>\n\n {closeButton === true ? (\n <IconButton\n aria-label={format('close')}\n className={`${Toast.className}-header__icon-button`}\n icon={mdiClose}\n onClick={closeToast}\n />\n ) : isComponent('Button')(closeButton) || isComponent('IconButton')(closeButton) ? (\n React.cloneElement(closeButton, {\n color: variant === 'loading' ? 'info' : (variant as ButtonColor),\n onClick: () => {\n closeButton.props.onClick?.();\n closeToast?.();\n },\n })\n ) : null}\n </Flexbox>\n </StyledToast>\n );\n});\nToast.className = CLASSNAME;\nToast.displayName = COMPONENT_NAME;\n"],"names":["ToastVariant","success","error","warning","info","loading","ToastPlacement","enUS","frFR","StyledToast","styled","div","baseStyling","_ref","$hasTitle","$variant","css","COMPONENT_NAME","CLASSNAME","getVariant","variant","React","createElement","Icon","icon","mdiInformation","color","NotificationsColorPalette","mdiAlertCircle","mdiCheckCircle","mdiAlert","Spinner","size","Toast","forwardRef","props","ref","transientProps","otherProps","getStylingTransientProps","children","className","closeButton","closeToast","theme","propsTheme","title","toastProps","forwardedProps","_objectWithoutProperties","_excluded","useTheme","format","useMessageFormatter","intlMessages","_extends","classNames","Boolean","$theme","Flexbox","justifyContent","alignItems","flexDirection","gap","Text","fontWeight","RedsiftTypographyFontWeightSemiBold","IconButton","mdiClose","onClick","isComponent","cloneElement","_closeButton$props$on","_closeButton$props","call","displayName"],"mappings":";;;;;;;AAGA;AACA;AACA;AACO,MAAMA,YAAY,GAAG;AAC1BC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,IAAI,EAAE,MAAM;AACZC,E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AA;AAChB,KAAA;AACF,GAAC,CAAC,GACA,IACG,CACE,CAAC,CAAA;AAElB,CAAC,EAAC;AACFV,KAAK,CAACQ,SAAS,GAAGvB,SAAS,CAAA;AAC3Be,KAAK,CAAC0C,WAAW,GAAG1D,cAAc;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { b as _extends, _ as _objectSpread2 } from './_rollupPluginBabelHelpers.js';
2
2
  import React, { forwardRef, useContext } from 'react';
3
3
  import { useMergeRefs, FloatingPortal } from '@floating-ui/react';
4
- import { baseContainer, Theme, AppContainerContext, useTheme } from '@redsift/design-system';
4
+ import { baseContainer, Theme, getContainerStylingTransientProps, AppContainerContext, useTheme } from '@redsift/design-system';
5
5
  import styled, { css } from 'styled-components';
6
6
  import classNames from 'classnames';
7
7
  import { u as useToggletipContext } from './useToggletipContext.js';
@@ -160,12 +160,16 @@ const CLASSNAME = 'redsift-toggletip-content';
160
160
  * The ToggletipContent component.
161
161
  */
162
162
  const ToggletipContent = /*#__PURE__*/forwardRef((props, ref) => {
163
+ const {
164
+ transientProps,
165
+ otherProps
166
+ } = getContainerStylingTransientProps(props);
163
167
  const {
164
168
  children,
165
169
  className,
166
170
  style,
167
171
  theme: propsTheme
168
- } = props;
172
+ } = otherProps;
169
173
  const appContainerState = useContext(AppContainerContext);
170
174
  const {
171
175
  getFloatingProps,
@@ -199,7 +203,7 @@ const ToggletipContent = /*#__PURE__*/forwardRef((props, ref) => {
199
203
  className: classNames(ToggletipContent.className, className),
200
204
  ref: popoverRef,
201
205
  $theme: theme
202
- }, getFloatingProps(props), {
206
+ }, getFloatingProps(otherProps), transientProps, {
203
207
  style: _objectSpread2({
204
208
  position: strategy,
205
209
  top: y !== null && y !== void 0 ? y : 0,
@@ -1 +1 @@
1
- {"version":3,"file":"ToggletipContent.js","sources":["../../src/components/toggletip/types.ts","../../src/components/toggletip-content/styles.ts","../../src/components/toggletip-content/ToggletipContent.tsx"],"sourcesContent":["import { Dispatch, ReactNode, SetStateAction } from 'react';\nimport { ButtonColor, Theme, ValueOf } from '@redsift/design-system';\nimport { useToggletip } from './useToggletip';\n\n/**\n * Context props.\n */\nexport type HiddenToggletipState = {\n /** Whether the toggletip should be hidden or removed from the DOM. */\n hideInsteadOfClose?: boolean;\n /** Method to set the hideInsteadOfClose prop. */\n setHideInsteadOfClose?: Dispatch<SetStateAction<boolean>>;\n};\nexport type ToggletipState =\n | (ReturnType<typeof useToggletip> & {\n /** Class name to append to the trigger. */\n readonly triggerClassName?: string;\n } & HiddenToggletipState)\n | null;\n\n/**\n * Component variant.\n */\nexport const ToggletipPlacement = {\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 ToggletipPlacement = ValueOf<typeof ToggletipPlacement>;\n\n/**\n * Component props.\n */\nexport interface ToggletipProps {\n /** Toggletip content width. Can be either based on the trigger, the available space or define with a number of pixels. */\n width?: 'trigger-width' | 'available-width' | number;\n /** Toggletip content min width. Can be either based on the trigger, the available space or define with a number of pixels. */\n minWidth?: 'trigger-width' | 'available-width' | number;\n /** Toggletip content max width. Can be either based on the trigger, the available space or define with a number of pixels. */\n maxWidth?: 'trigger-width' | 'available-width' | number;\n /** Button color that will be forward to the trigger. */\n color?: ButtonColor;\n /** Children. Can only be ToggletipTrigger and ToggletipContent. */\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 toggletip. */\n placement?: ToggletipPlacement | 'client-point';\n /** Whether the toggletip is a modal or not. */\n isModal?: boolean;\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 /** Allows other components to be treated as trigger and content. */\n overrideDisplayName?: {\n content?: string;\n trigger?: string;\n };\n /** Id to the toggletip content. */\n toggletipId?: string;\n /** Role to apply to the toggletip. */\n role?: 'dialog';\n /** Theme. */\n theme?: Theme;\n /** Class name to append to the trigger. */\n triggerClassName?: string;\n}\n\nexport type StyledToggletipProps = ToggletipProps;\n","import styled, { css } from 'styled-components';\nimport { Theme, baseContainer } from '@redsift/design-system';\nimport { ToggletipPlacement } from '../toggletip';\nimport { StyledToggletipContentProps } from './types';\n\n/**\n * Component style.\n */\nexport const StyledToggletipContent = styled.div<StyledToggletipContentProps>`\n ${baseContainer}\n ${({ $theme }) => css`\n color: var(--redsift-color-neutral-${$theme === Theme.dark ? 'white' : 'x-dark-grey'});\n background-color: var(--redsift-color-neutral-${$theme === Theme.dark ? 'black' : 'white'});\n `}\n\n align-items: center;\n border-radius: 4px;\n box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2);\n display: flex;\n filter: drop-shadow(0px 4px 5px rgba(0, 0, 0, 0.14)) drop-shadow(0px 1px 10px rgba(0, 0, 0, 0.12));\n font-family: var(--redsift-typography-toggletip-font-family);\n font-size: var(--redsift-typography-toggletip-font-size);\n font-weight: var(--redsift-typography-toggletip-font-weight);\n line-height: var(--redsift-typography-toggletip-line-height);\n max-width: calc(100vw - 48px);\n padding: 4px 8px;\n z-index: var(--redsift-layout-z-index-toggletip);\n\n .redsift-toggletip-content__arrow {\n position: absolute;\n width: 0;\n height: 0;\n border-color: ${({ $theme }) =>\n $theme === Theme.dark ? css`var(--redsift-color-neutral-black)` : css`var(--redsift-color-neutral-white)`};\n border-style: solid;\n }\n\n ${({ $placement }) => {\n switch ($placement) {\n case ToggletipPlacement['right-start']:\n return css`\n border-bottom-left-radius: 0;\n `;\n case ToggletipPlacement['right-end']:\n return css`\n border-top-left-radius: 0;\n `;\n case ToggletipPlacement['left-start']:\n return css`\n border-bottom-right-radius: 0;\n `;\n case ToggletipPlacement['left-end']:\n return css`\n border-top-right-radius: 0;\n `;\n default:\n return css``;\n }\n }}\n\n ${({ $placement }) => {\n switch ($placement) {\n case ToggletipPlacement.left:\n case ToggletipPlacement['left-end']:\n case ToggletipPlacement['left-start']:\n return css`\n .redsift-toggletip-content__arrow {\n border-width: 6px 0 6px 6px;\n border-top-color: transparent;\n border-right-color: transparent;\n border-bottom-color: transparent;\n }\n `;\n case ToggletipPlacement.top:\n case ToggletipPlacement['top-end']:\n case ToggletipPlacement['top-start']:\n return css`\n .redsift-toggletip-content__arrow {\n border-width: 6px 6px 0;\n border-right-color: transparent;\n border-bottom-color: transparent;\n border-left-color: transparent;\n }\n `;\n case ToggletipPlacement.right:\n case ToggletipPlacement['right-end']:\n case ToggletipPlacement['right-start']:\n return css`\n .redsift-toggletip-content__arrow {\n border-width: 6px 6px 6px 0;\n border-top-color: transparent;\n border-bottom-color: transparent;\n border-left-color: transparent;\n }\n `;\n case ToggletipPlacement.bottom:\n case ToggletipPlacement['bottom-end']:\n case ToggletipPlacement['bottom-start']:\n default:\n return css`\n .redsift-toggletip-content__arrow {\n border-width: 0 6px 6px;\n border-top-color: transparent;\n border-right-color: transparent;\n border-left-color: transparent;\n }\n `;\n }\n }}\n`;\n","import React, { forwardRef, useContext } from 'react';\nimport { useMergeRefs, FloatingPortal } from '@floating-ui/react';\n\nimport { AppContainerContext, Comp, useTheme } from '@redsift/design-system';\nimport { ToggletipContentProps } from './types';\nimport { ToggletipPlacement, useToggletipContext } from '../toggletip';\nimport { StyledToggletipContent } from './styles';\nimport classNames from 'classnames';\n\nconst COMPONENT_NAME = 'ToggletipContent';\nconst CLASSNAME = 'redsift-toggletip-content';\n\n/**\n * The ToggletipContent component.\n */\nexport const ToggletipContent: Comp<ToggletipContentProps, 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 } = useToggletipContext();\n const theme = useTheme ? useTheme(propsTheme) : undefined;\n const popoverRef = useMergeRefs([refs.setFloating, ref]);\n\n const { arrowRef } = useToggletipContext();\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 <StyledToggletipContent\n className={classNames(ToggletipContent.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 ToggletipPlacement}\n >\n <div\n ref={arrowRef}\n className={`${ToggletipContent.className}__arrow`}\n style={{\n left: arrowX != null ? `${arrowX}px` : '',\n top: arrowY != null ? `${arrowY}px` : '',\n [staticSide!]: '-6px',\n }}\n />\n <div className={`${ToggletipContent.className}__inner`}>{children}</div>\n </StyledToggletipContent>\n )}\n </FloatingPortal>\n );\n});\nToggletipContent.className = CLASSNAME;\nToggletipContent.displayName = COMPONENT_NAME;\n"],"names":["ToggletipPlacement","top","right","bottom","left","StyledToggletipContent","styled","div","baseContainer","_ref","$theme","css","Theme","dark","_ref2","_ref3","$placement","_ref4","COMPONENT_NAME","CLASSNAME","ToggletipContent","forwardRef","props","ref","children","className","style","theme","propsTheme","appContainerState","useContext","AppContainerContext","getFloatingProps","isOpen","placement","refs","strategy","x","y","middlewareData","arrow","arrowX","arrowY","useToggletipContext","useTheme","undefined","popoverRef","useMergeRefs","setFloating","arrowRef","staticSide","split","React","createElement","FloatingPortal","root","appContainerRef","current","_extends","classNames","_objectSpread","position","visibility","displayName"],"mappings":";;;;;;;;AAIA;AACA;AACA;;AAcA;AACA;AACA;AACO,MAAMA,kBAAkB,GAAG;AAChCC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,KAAK,EAAE,OAAO;AACdC,E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AAClDC,IAAAA,KAAK,EAAE;MACLtB,IAAI,EAAEqC,MAAM,IAAI,IAAI,GAAI,CAAEA,EAAAA,MAAO,CAAG,EAAA,CAAA,GAAG,EAAE;MACzCxC,GAAG,EAAEyC,MAAM,IAAI,IAAI,GAAI,CAAEA,EAAAA,MAAO,CAAG,EAAA,CAAA,GAAG,EAAE;AACxC,MAAA,CAACQ,UAAU,GAAI,MAAA;AACjB,KAAA;AAAE,GACH,CAAC,eACFE,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAK5B,IAAAA,SAAS,EAAG,CAAA,EAAEL,gBAAgB,CAACK,SAAU,CAAA,OAAA,CAAA;GAAWD,EAAAA,QAAc,CACjD,CAEZ,CAAC,CAAA;AAErB,CAAC,EAAC;AACFJ,gBAAgB,CAACK,SAAS,GAAGN,SAAS,CAAA;AACtCC,gBAAgB,CAAC2C,WAAW,GAAG7C,cAAc;;;;"}
1
+ {"version":3,"file":"ToggletipContent.js","sources":["../../src/components/toggletip/types.ts","../../src/components/toggletip-content/styles.ts","../../src/components/toggletip-content/ToggletipContent.tsx"],"sourcesContent":["import { Dispatch, ReactNode, SetStateAction } from 'react';\nimport { ButtonColor, Theme, ValueOf } from '@redsift/design-system';\nimport { useToggletip } from './useToggletip';\n\n/**\n * Context props.\n */\nexport type HiddenToggletipState = {\n /** Whether the toggletip should be hidden or removed from the DOM. */\n hideInsteadOfClose?: boolean;\n /** Method to set the hideInsteadOfClose prop. */\n setHideInsteadOfClose?: Dispatch<SetStateAction<boolean>>;\n};\nexport type ToggletipState =\n | (ReturnType<typeof useToggletip> & {\n /** Class name to append to the trigger. */\n readonly triggerClassName?: string;\n } & HiddenToggletipState)\n | null;\n\n/**\n * Component variant.\n */\nexport const ToggletipPlacement = {\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 ToggletipPlacement = ValueOf<typeof ToggletipPlacement>;\n\n/**\n * Component props.\n */\nexport interface ToggletipProps {\n /** Toggletip content width. Can be either based on the trigger, the available space or define with a number of pixels. */\n width?: 'trigger-width' | 'available-width' | number;\n /** Toggletip content min width. Can be either based on the trigger, the available space or define with a number of pixels. */\n minWidth?: 'trigger-width' | 'available-width' | number;\n /** Toggletip content max width. Can be either based on the trigger, the available space or define with a number of pixels. */\n maxWidth?: 'trigger-width' | 'available-width' | number;\n /** Button color that will be forward to the trigger. */\n color?: ButtonColor;\n /** Children. Can only be ToggletipTrigger and ToggletipContent. */\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 toggletip. */\n placement?: ToggletipPlacement | 'client-point';\n /** Whether the toggletip is a modal or not. */\n isModal?: boolean;\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 /** Allows other components to be treated as trigger and content. */\n overrideDisplayName?: {\n content?: string;\n trigger?: string;\n };\n /** Id to the toggletip content. */\n toggletipId?: string;\n /** Role to apply to the toggletip. */\n role?: 'dialog';\n /** Theme. */\n theme?: Theme;\n /** Class name to append to the trigger. */\n triggerClassName?: string;\n}\n\nexport type StyledToggletipProps = ToggletipProps;\n","import styled, { css } from 'styled-components';\nimport { Theme, baseContainer } from '@redsift/design-system';\nimport { ToggletipPlacement } from '../toggletip';\nimport { StyledToggletipContentProps } from './types';\n\n/**\n * Component style.\n */\nexport const StyledToggletipContent = styled.div<StyledToggletipContentProps>`\n ${baseContainer}\n ${({ $theme }) => css`\n color: var(--redsift-color-neutral-${$theme === Theme.dark ? 'white' : 'x-dark-grey'});\n background-color: var(--redsift-color-neutral-${$theme === Theme.dark ? 'black' : 'white'});\n `}\n\n align-items: center;\n border-radius: 4px;\n box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2);\n display: flex;\n filter: drop-shadow(0px 4px 5px rgba(0, 0, 0, 0.14)) drop-shadow(0px 1px 10px rgba(0, 0, 0, 0.12));\n font-family: var(--redsift-typography-toggletip-font-family);\n font-size: var(--redsift-typography-toggletip-font-size);\n font-weight: var(--redsift-typography-toggletip-font-weight);\n line-height: var(--redsift-typography-toggletip-line-height);\n max-width: calc(100vw - 48px);\n padding: 4px 8px;\n z-index: var(--redsift-layout-z-index-toggletip);\n\n .redsift-toggletip-content__arrow {\n position: absolute;\n width: 0;\n height: 0;\n border-color: ${({ $theme }) =>\n $theme === Theme.dark ? css`var(--redsift-color-neutral-black)` : css`var(--redsift-color-neutral-white)`};\n border-style: solid;\n }\n\n ${({ $placement }) => {\n switch ($placement) {\n case ToggletipPlacement['right-start']:\n return css`\n border-bottom-left-radius: 0;\n `;\n case ToggletipPlacement['right-end']:\n return css`\n border-top-left-radius: 0;\n `;\n case ToggletipPlacement['left-start']:\n return css`\n border-bottom-right-radius: 0;\n `;\n case ToggletipPlacement['left-end']:\n return css`\n border-top-right-radius: 0;\n `;\n default:\n return css``;\n }\n }}\n\n ${({ $placement }) => {\n switch ($placement) {\n case ToggletipPlacement.left:\n case ToggletipPlacement['left-end']:\n case ToggletipPlacement['left-start']:\n return css`\n .redsift-toggletip-content__arrow {\n border-width: 6px 0 6px 6px;\n border-top-color: transparent;\n border-right-color: transparent;\n border-bottom-color: transparent;\n }\n `;\n case ToggletipPlacement.top:\n case ToggletipPlacement['top-end']:\n case ToggletipPlacement['top-start']:\n return css`\n .redsift-toggletip-content__arrow {\n border-width: 6px 6px 0;\n border-right-color: transparent;\n border-bottom-color: transparent;\n border-left-color: transparent;\n }\n `;\n case ToggletipPlacement.right:\n case ToggletipPlacement['right-end']:\n case ToggletipPlacement['right-start']:\n return css`\n .redsift-toggletip-content__arrow {\n border-width: 6px 6px 6px 0;\n border-top-color: transparent;\n border-bottom-color: transparent;\n border-left-color: transparent;\n }\n `;\n case ToggletipPlacement.bottom:\n case ToggletipPlacement['bottom-end']:\n case ToggletipPlacement['bottom-start']:\n default:\n return css`\n .redsift-toggletip-content__arrow {\n border-width: 0 6px 6px;\n border-top-color: transparent;\n border-right-color: transparent;\n border-left-color: transparent;\n }\n `;\n }\n }}\n`;\n","import React, { forwardRef, useContext } from 'react';\nimport { useMergeRefs, FloatingPortal } from '@floating-ui/react';\n\nimport { AppContainerContext, Comp, getContainerStylingTransientProps, useTheme } from '@redsift/design-system';\nimport { ToggletipContentProps } from './types';\nimport { ToggletipPlacement, useToggletipContext } from '../toggletip';\nimport { StyledToggletipContent } from './styles';\nimport classNames from 'classnames';\n\nconst COMPONENT_NAME = 'ToggletipContent';\nconst CLASSNAME = 'redsift-toggletip-content';\n\n/**\n * The ToggletipContent component.\n */\nexport const ToggletipContent: Comp<ToggletipContentProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { transientProps, otherProps } = getContainerStylingTransientProps(props);\n\n const { children, className, style, theme: propsTheme } = otherProps;\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 } = useToggletipContext();\n const theme = useTheme ? useTheme(propsTheme) : undefined;\n const popoverRef = useMergeRefs([refs.setFloating, ref]);\n\n const { arrowRef } = useToggletipContext();\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 <StyledToggletipContent\n className={classNames(ToggletipContent.className, className)}\n ref={popoverRef}\n $theme={theme!}\n {...getFloatingProps(otherProps)}\n {...transientProps}\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 ToggletipPlacement}\n >\n <div\n ref={arrowRef}\n className={`${ToggletipContent.className}__arrow`}\n style={{\n left: arrowX != null ? `${arrowX}px` : '',\n top: arrowY != null ? `${arrowY}px` : '',\n [staticSide!]: '-6px',\n }}\n />\n <div className={`${ToggletipContent.className}__inner`}>{children}</div>\n </StyledToggletipContent>\n )}\n </FloatingPortal>\n );\n});\nToggletipContent.className = CLASSNAME;\nToggletipContent.displayName = COMPONENT_NAME;\n"],"names":["ToggletipPlacement","top","right","bottom","left","StyledToggletipContent","styled","div","baseContainer","_ref","$theme","css","Theme","dark","_ref2","_ref3","$placement","_ref4","COMPONENT_NAME","CLASSNAME","ToggletipContent","forwardRef","props","ref","transientProps","otherProps","getContainerStylingTransientProps","children","className","style","theme","propsTheme","appContainerState","useContext","AppContainerContext","getFloatingProps","isOpen","placement","refs","strategy","x","y","middlewareData","arrow","arrowX","arrowY","useToggletipContext","useTheme","undefined","popoverRef","useMergeRefs","setFloating","arrowRef","staticSide","split","React","createElement","FloatingPortal","root","appContainerRef","current","_extends","classNames","_objectSpread","position","visibility","displayName"],"mappings":";;;;;;;;AAIA;AACA;AACA;;AAcA;AACA;AACA;AACO,MAAMA,kBAAkB,GAAG;AAChCC,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;;ACpCA;AACA;AACA;AACO,MAAMC,sBAAsB,GAAGC,MAAM,CAACC,GAAiC,CAAA;AAC9E,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E,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAK5B,IAAAA,SAAS,EAAG,CAAA,EAAER,gBAAgB,CAACQ,SAAU,CAAA,OAAA,CAAA;GAAWD,EAAAA,QAAc,CACjD,CAEZ,CAAC,CAAA;AAErB,CAAC,EAAC;AACFP,gBAAgB,CAACQ,SAAS,GAAGT,SAAS,CAAA;AACtCC,gBAAgB,CAAC8C,WAAW,GAAGhD,cAAc;;;;"}
@@ -53,11 +53,11 @@ const ToggletipTrigger = /*#__PURE__*/forwardRef((props, ref) => {
53
53
  type: "button",
54
54
  "aria-expanded": isOpen,
55
55
  onClick: undefined,
56
- onKeyDown: e => {
57
- if (e.key === 'Enter' || e.key === ' ' || e.key === 'Spacebar' || e.code === 'Space') {
58
- e.preventDefault();
56
+ onKeyDown: event => {
57
+ if (event.key === 'Enter' || event.key === ' ' || event.key === 'Spacebar' || event.code === 'Space') {
58
+ event.preventDefault();
59
59
  if (props.onClick) {
60
- props.onClick(e);
60
+ props.onClick(event);
61
61
  } else {
62
62
  handleOpen(!isOpen);
63
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ToggletipTrigger.js","sources":["../../src/components/toggletip-trigger/styles.ts","../../src/components/toggletip-trigger/ToggletipTrigger.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { StyledToggletipTriggerProps } from './types';\nimport { focusRing } from '@redsift/design-system';\n\n/**\n * Component style.\n */\nexport const StyledToggletipTrigger = styled.button<StyledToggletipTriggerProps>`\n background: none;\n border: none;\n padding: 0;\n margin: 0;\n font: inherit;\n color: inherit;\n text-decoration: inherit;\n cursor: default;\n display: inline-flex;\n\n ${focusRing}\n`;\n","import React, { forwardRef, ReactElement } from 'react';\nimport { useMergeRefs } from '@floating-ui/react';\n\nimport { Comp } from '@redsift/design-system';\nimport { useToggletipContext } from '../toggletip';\nimport { ToggletipTriggerProps } from './types';\nimport classNames from 'classnames';\nimport { StyledToggletipTrigger } from './styles';\n\nconst COMPONENT_NAME = 'ToggletipTrigger';\nconst CLASSNAME = 'redsift-toggletip-trigger';\n\n/**\n * The ToggletipTrigger component.\n */\nexport const ToggletipTrigger: Comp<ToggletipTriggerProps, HTMLButtonElement> = forwardRef((props, ref) => {\n const { children } = props;\n\n const { getReferenceProps, isOpen, handleOpen, refs, toggletipId, triggerClassName, color } = useToggletipContext();\n const childrenRef = (children as any).ref;\n const triggerRef = useMergeRefs([refs.setReference, ref, childrenRef]);\n\n if (React.isValidElement(children)) {\n return (\n <StyledToggletipTrigger\n {...getReferenceProps({\n ref: triggerRef,\n ...props,\n 'aria-describedby': toggletipId,\n })}\n type=\"button\"\n aria-expanded={isOpen}\n onClick={undefined}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ' || e.key === 'Spacebar' || e.code === 'Space') {\n e.preventDefault();\n if (props.onClick) {\n props.onClick(e as never);\n } else {\n handleOpen(!isOpen);\n }\n }\n }}\n className={classNames(triggerClassName)}\n >\n {React.cloneElement(children as ReactElement, {\n ...children.props,\n isActive: isOpen,\n color: color ?? children.props.color,\n })}\n </StyledToggletipTrigger>\n );\n }\n\n return null;\n});\nToggletipTrigger.className = CLASSNAME;\nToggletipTrigger.displayName = COMPONENT_NAME;\n"],"names":["StyledToggletipTrigger","styled","button","focusRing","COMPONENT_NAME","CLASSNAME","ToggletipTrigger","forwardRef","props","ref","children","getReferenceProps","isOpen","handleOpen","refs","toggletipId","triggerClassName","color","useToggletipContext","childrenRef","triggerRef","useMergeRefs","setReference","React","isValidElement","createElement","_extends","_objectSpread","type","onClick","undefined","onKeyDown","e","key","code","preventDefault","className","classNames","cloneElement","isActive","displayName"],"mappings":";;;;;;;;AAIA;AACA;AACA;AACO,MAAMA,sBAAsB,GAAGC,MAAM,CAACC,MAAoC,CAAA;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAA,EAAIC,SAAU,CAAA;AACd,CAAC;;ACVD,MAAMC,cAAc,GAAG,kBAAkB,CAAA;AACzC,MAAMC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AAK,CAACqB,OAAO,CAACG,CAAU,CAAC,CAAA;AAC3B,WAAC,MAAM;YACLnB,UAAU,CAAC,CAACD,MAAM,CAAC,CAAA;AACrB,WAAA;AACF,SAAA;OACA;MACFwB,SAAS,EAAEC,UAAU,CAACrB,gBAAgB,CAAA;AAAE,KAAA,CAAA,eAEvCO,KAAK,CAACe,YAAY,CAAC5B,QAAQ,EAAAiB,cAAA,CAAAA,cAAA,CAAA,EAAA,EACvBjB,QAAQ,CAACF,KAAK,CAAA,EAAA,EAAA,EAAA;AACjB+B,MAAAA,QAAQ,EAAE3B,MAAM;MAChBK,KAAK,EAAEA,KAAK,KAAA,IAAA,IAALA,KAAK,KAAA,KAAA,CAAA,GAALA,KAAK,GAAIP,QAAQ,CAACF,KAAK,CAACS,KAAAA;AAAK,KAAA,CACrC,CACqB,CAAC,CAAA;AAE7B,GAAA;AAEA,EAAA,OAAO,IAAI,CAAA;AACb,CAAC,EAAC;AACFX,gBAAgB,CAAC8B,SAAS,GAAG/B,SAAS,CAAA;AACtCC,gBAAgB,CAACkC,WAAW,GAAGpC,cAAc;;;;"}
1
+ {"version":3,"file":"ToggletipTrigger.js","sources":["../../src/components/toggletip-trigger/styles.ts","../../src/components/toggletip-trigger/ToggletipTrigger.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { StyledToggletipTriggerProps } from './types';\nimport { focusRing } from '@redsift/design-system';\n\n/**\n * Component style.\n */\nexport const StyledToggletipTrigger = styled.button<StyledToggletipTriggerProps>`\n background: none;\n border: none;\n padding: 0;\n margin: 0;\n font: inherit;\n color: inherit;\n text-decoration: inherit;\n cursor: default;\n display: inline-flex;\n\n ${focusRing}\n`;\n","import React, { forwardRef, ReactElement } from 'react';\nimport { useMergeRefs } from '@floating-ui/react';\n\nimport { Comp } from '@redsift/design-system';\nimport { useToggletipContext } from '../toggletip';\nimport { ToggletipTriggerProps } from './types';\nimport classNames from 'classnames';\nimport { StyledToggletipTrigger } from './styles';\n\nconst COMPONENT_NAME = 'ToggletipTrigger';\nconst CLASSNAME = 'redsift-toggletip-trigger';\n\n/**\n * The ToggletipTrigger component.\n */\nexport const ToggletipTrigger: Comp<ToggletipTriggerProps, HTMLButtonElement> = forwardRef((props, ref) => {\n const { children } = props;\n\n const { getReferenceProps, isOpen, handleOpen, refs, toggletipId, triggerClassName, color } = useToggletipContext();\n const childrenRef = (children as any).ref;\n const triggerRef = useMergeRefs([refs.setReference, ref, childrenRef]);\n\n if (React.isValidElement(children)) {\n return (\n <StyledToggletipTrigger\n {...getReferenceProps({\n ref: triggerRef,\n ...props,\n 'aria-describedby': toggletipId,\n })}\n type=\"button\"\n aria-expanded={isOpen}\n onClick={undefined}\n onKeyDown={(event: React.KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === 'Enter' || event.key === ' ' || event.key === 'Spacebar' || event.code === 'Space') {\n event.preventDefault();\n if (props.onClick) {\n props.onClick(event as never);\n } else {\n handleOpen(!isOpen);\n }\n }\n }}\n className={classNames(triggerClassName)}\n >\n {React.cloneElement(children as ReactElement, {\n ...children.props,\n isActive: isOpen,\n color: color ?? children.props.color,\n })}\n </StyledToggletipTrigger>\n );\n }\n\n return null;\n});\nToggletipTrigger.className = CLASSNAME;\nToggletipTrigger.displayName = COMPONENT_NAME;\n"],"names":["StyledToggletipTrigger","styled","button","focusRing","COMPONENT_NAME","CLASSNAME","ToggletipTrigger","forwardRef","props","ref","children","getReferenceProps","isOpen","handleOpen","refs","toggletipId","triggerClassName","color","useToggletipContext","childrenRef","triggerRef","useMergeRefs","setReference","React","isValidElement","createElement","_extends","_objectSpread","type","onClick","undefined","onKeyDown","event","key","code","preventDefault","className","classNames","cloneElement","isActive","displayName"],"mappings":";;;;;;;;AAIA;AACA;AACA;AACO,MAAMA,sBAAsB,GAAGC,MAAM,CAACC,MAAoC,CAAA;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAA,EAAIC,SAAU,CAAA;AACd,CAAC;;ACVD,MAAMC,cAAc,GA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qB,OAAO,EAAE;AACjBrB,YAAAA,KAAK,CAACqB,OAAO,CAACG,KAAc,CAAC,CAAA;AAC/B,WAAC,MAAM;YACLnB,UAAU,CAAC,CAACD,MAAM,CAAC,CAAA;AACrB,WAAA;AACF,SAAA;OACA;MACFwB,SAAS,EAAEC,UAAU,CAACrB,gBAAgB,CAAA;AAAE,KAAA,CAAA,eAEvCO,KAAK,CAACe,YAAY,CAAC5B,QAAQ,EAAAiB,cAAA,CAAAA,cAAA,CAAA,EAAA,EACvBjB,QAAQ,CAACF,KAAK,CAAA,EAAA,EAAA,EAAA;AACjB+B,MAAAA,QAAQ,EAAE3B,MAAM;MAChBK,KAAK,EAAEA,KAAK,KAAA,IAAA,IAALA,KAAK,KAAA,KAAA,CAAA,GAALA,KAAK,GAAIP,QAAQ,CAACF,KAAK,CAACS,KAAAA;AAAK,KAAA,CACrC,CACqB,CAAC,CAAA;AAE7B,GAAA;AAEA,EAAA,OAAO,IAAI,CAAA;AACb,CAAC,EAAC;AACFX,gBAAgB,CAAC8B,SAAS,GAAG/B,SAAS,CAAA;AACtCC,gBAAgB,CAACkC,WAAW,GAAGpC,cAAc;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { b as _extends, _ as _objectSpread2 } from './_rollupPluginBabelHelpers.js';
2
2
  import React, { forwardRef, useContext } from 'react';
3
3
  import { useMergeRefs, FloatingPortal } from '@floating-ui/react';
4
- import { baseContainer, Theme, AppContainerContext, useTheme } from '@redsift/design-system';
4
+ import { baseContainer, Theme, getContainerStylingTransientProps, AppContainerContext, useTheme } from '@redsift/design-system';
5
5
  import styled, { css } from 'styled-components';
6
6
  import classNames from 'classnames';
7
7
  import { u as useTooltipContext } from './useTooltipContext.js';
@@ -134,12 +134,16 @@ const CLASSNAME = 'redsift-tooltip-content';
134
134
  * The TooltipContent component.
135
135
  */
136
136
  const TooltipContent = /*#__PURE__*/forwardRef((props, ref) => {
137
+ const {
138
+ transientProps,
139
+ otherProps
140
+ } = getContainerStylingTransientProps(props);
137
141
  const {
138
142
  children,
139
143
  className,
140
144
  style,
141
145
  theme: propsTheme
142
- } = props;
146
+ } = otherProps;
143
147
  const appContainerState = useContext(AppContainerContext);
144
148
  const {
145
149
  getFloatingProps,
@@ -173,7 +177,7 @@ const TooltipContent = /*#__PURE__*/forwardRef((props, ref) => {
173
177
  className: classNames(TooltipContent.className, className),
174
178
  ref: popoverRef,
175
179
  $theme: theme
176
- }, getFloatingProps(props), {
180
+ }, getFloatingProps(otherProps), transientProps, {
177
181
  style: _objectSpread2({
178
182
  position: strategy,
179
183
  top: y !== null && y !== void 0 ? y : 0,