@redsift/products 11.6.0-alpha.0 → 11.6.0-muiv5-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/{_internal → _virtual}/_rollupPluginBabelHelpers.js +1 -1
  2. package/_virtual/jsx-runtime.js +4 -0
  3. package/_virtual/jsx-runtime.js.map +1 -0
  4. package/_virtual/react-jsx-runtime.development.js +4 -0
  5. package/_virtual/react-jsx-runtime.development.js.map +1 -0
  6. package/_virtual/react-jsx-runtime.production.min.js +4 -0
  7. package/_virtual/react-jsx-runtime.production.min.js.map +1 -0
  8. package/components/radar/index.d.ts +55 -0
  9. package/components/radar/index.js +25 -0
  10. package/components/radar/index.js.map +1 -0
  11. package/components/radar-button/RadarButton.d.ts +8 -0
  12. package/{_internal → components/radar-button}/RadarButton.js +2 -2
  13. package/components/radar-button/RadarButton.js.map +1 -0
  14. package/components/radar-dialog/PulsedRadarImage.js +437 -0
  15. package/components/radar-dialog/PulsedRadarImage.js.map +1 -0
  16. package/components/radar-dialog/RadarDialog.js +146 -0
  17. package/components/radar-dialog/RadarDialog.js.map +1 -0
  18. package/components/radar-dialog/RadarSimpleDialog.d.ts +15 -0
  19. package/components/radar-dialog/RadarSimpleDialog.js +23 -0
  20. package/components/radar-dialog/RadarSimpleDialog.js.map +1 -0
  21. package/components/radar-dialog/ScatterGrid.js +1548 -0
  22. package/components/radar-dialog/ScatterGrid.js.map +1 -0
  23. package/components/radar-item/RadarItem.d.ts +9 -0
  24. package/{_internal → components/radar-item}/RadarItem.js +2 -2
  25. package/components/radar-item/RadarItem.js.map +1 -0
  26. package/components/radar-menu-button/RadarMenuButton.d.ts +35 -0
  27. package/{_internal/RadarSimpleMenuButton.js → components/radar-menu-button/RadarMenuButton.js} +3 -39
  28. package/components/radar-menu-button/RadarMenuButton.js.map +1 -0
  29. package/components/radar-menu-button/RadarSimpleMenuButton.d.ts +13 -0
  30. package/components/radar-menu-button/RadarSimpleMenuButton.js +42 -0
  31. package/components/radar-menu-button/RadarSimpleMenuButton.js.map +1 -0
  32. package/index.d.ts +5 -199
  33. package/index.js +5 -4
  34. package/index.js.map +1 -1
  35. package/package.json +5 -5
  36. package/packages/popovers/src/components/dialog/Dialog.js +56 -0
  37. package/packages/popovers/src/components/dialog/Dialog.js.map +1 -0
  38. package/packages/popovers/src/components/dialog/context.js +6 -0
  39. package/packages/popovers/src/components/dialog/context.js.map +1 -0
  40. package/packages/popovers/src/components/dialog/types.js +20 -0
  41. package/packages/popovers/src/components/dialog/types.js.map +1 -0
  42. package/packages/popovers/src/components/dialog/useDialog.js +95 -0
  43. package/packages/popovers/src/components/dialog/useDialog.js.map +1 -0
  44. package/packages/popovers/src/components/dialog/useDialogContext.js +13 -0
  45. package/packages/popovers/src/components/dialog/useDialogContext.js.map +1 -0
  46. package/packages/popovers/src/components/dialog-content/DialogContent.js +97 -0
  47. package/packages/popovers/src/components/dialog-content/DialogContent.js.map +1 -0
  48. package/packages/popovers/src/components/dialog-content/intl/en-US.json.js +7 -0
  49. package/packages/popovers/src/components/dialog-content/intl/en-US.json.js.map +1 -0
  50. package/packages/popovers/src/components/dialog-content/intl/fr-FR.json.js +7 -0
  51. package/packages/popovers/src/components/dialog-content/intl/fr-FR.json.js.map +1 -0
  52. package/packages/popovers/src/components/dialog-content/intl/index.js +10 -0
  53. package/packages/popovers/src/components/dialog-content/intl/index.js.map +1 -0
  54. package/packages/popovers/src/components/dialog-content/styles.js +77 -0
  55. package/packages/popovers/src/components/dialog-content/styles.js.map +1 -0
  56. package/packages/popovers/src/components/dialog-content-actions/DialogContentActions.js +38 -0
  57. package/packages/popovers/src/components/dialog-content-actions/DialogContentActions.js.map +1 -0
  58. package/packages/popovers/src/components/dialog-content-actions/styles.js +20 -0
  59. package/packages/popovers/src/components/dialog-content-actions/styles.js.map +1 -0
  60. package/packages/popovers/src/components/dialog-content-body/DialogContentBody.js +49 -0
  61. package/packages/popovers/src/components/dialog-content-body/DialogContentBody.js.map +1 -0
  62. package/packages/popovers/src/components/dialog-content-body/styles.js +65 -0
  63. package/packages/popovers/src/components/dialog-content-body/styles.js.map +1 -0
  64. package/packages/popovers/src/components/dialog-content-header/DialogContentHeader.js +86 -0
  65. package/packages/popovers/src/components/dialog-content-header/DialogContentHeader.js.map +1 -0
  66. package/packages/popovers/src/components/dialog-content-header/styles.js +31 -0
  67. package/packages/popovers/src/components/dialog-content-header/styles.js.map +1 -0
  68. package/packages/popovers/src/components/dialog-trigger/DialogTrigger.js +47 -0
  69. package/packages/popovers/src/components/dialog-trigger/DialogTrigger.js.map +1 -0
  70. package/popovers/src/components/dialog/types.d.ts +50 -0
  71. package/popovers/src/components/dialog-content/types.d.ts +12 -0
  72. package/popovers/src/components/dialog-content-body/types.d.ts +12 -0
  73. package/popovers/src/components/dialog-content-header/types.d.ts +27 -0
  74. package/popovers/src/components/dialog-trigger/types.d.ts +10 -0
  75. package/_internal/RadarButton.js.map +0 -1
  76. package/_internal/RadarItem.js.map +0 -1
  77. package/_internal/RadarSimpleDialog.js +0 -8810
  78. package/_internal/RadarSimpleDialog.js.map +0 -1
  79. package/_internal/RadarSimpleMenuButton.js.map +0 -1
  80. package/_internal/radar-button.js +0 -2
  81. package/_internal/radar-button.js.map +0 -1
  82. package/_internal/radar-dialog.js +0 -2
  83. package/_internal/radar-dialog.js.map +0 -1
  84. package/_internal/radar-item.js +0 -2
  85. package/_internal/radar-item.js.map +0 -1
  86. package/_internal/radar-menu-button.js +0 -2
  87. package/_internal/radar-menu-button.js.map +0 -1
  88. package/_internal/radar.js +0 -23
  89. package/_internal/radar.js.map +0 -1
  90. /package/{_internal → _virtual}/_rollupPluginBabelHelpers.js.map +0 -0
package/index.d.ts CHANGED
@@ -1,199 +1,5 @@
1
- import * as React$1 from 'react';
2
- import React__default, { ReactNode, ComponentProps } from 'react';
3
- import * as _redsift_design_system from '@redsift/design-system';
4
- import { ButtonColor, Theme, ValueOf, ContainerProps, HeadingProps, IconProps, StylingProps, Comp, ButtonProps } from '@redsift/design-system';
5
- import * as _redsift_pickers from '@redsift/pickers';
6
- import { ItemProps, MenuButtonProps, MenuButtonContentProps, MenuButtonContentHeaderProps, MenuButtonContentMenuProps } from '@redsift/pickers';
7
-
8
- /**
9
- * Component variant.
10
- */
11
- declare const DialogSize: {
12
- readonly small: "small";
13
- readonly medium: "medium";
14
- readonly large: "large";
15
- readonly xlarge: "xlarge";
16
- };
17
- type DialogSize = ValueOf<typeof DialogSize>;
18
- /**
19
- * Component props.
20
- */
21
- interface DialogProps {
22
- /** Button color that will be forward to the trigger. */
23
- color?: ButtonColor;
24
- /** Children. Can only be DialogTrigger and DialogContent. */
25
- children: ReactNode;
26
- /**
27
- * Default open status.
28
- * Used for uncontrolled version.
29
- */
30
- defaultOpen?: boolean;
31
- /** Whether the Close icon button is displayed or not. */
32
- hasCloseButton?: boolean;
33
- /** Which element to initially focus. Can be either a number (tabbable index), a ref to en element, or a shortcut pointing towards a section of the dialog. See the accessibility section in the documentation to know which one to use. */
34
- initialFocus?: number | React.MutableRefObject<HTMLElement | null> | 'header' | 'body' | 'actions';
35
- /**
36
- * Whether the component is opened or not.
37
- * Used for controlled version.
38
- */
39
- isOpen?: boolean;
40
- /** Method to handle component change. */
41
- onOpen?: (open: boolean) => void;
42
- /** Dialog size. */
43
- size?: DialogSize | {
44
- width?: string;
45
- maxWidth?: string;
46
- minWidth?: string;
47
- };
48
- /** Theme. */
49
- theme?: Theme;
50
- /** Class name to append to the trigger. */
51
- triggerClassName?: string;
52
- }
53
-
54
- /**
55
- * Component props.
56
- */
57
- interface DialogContentBodyProps extends ComponentProps<'div'>, ContainerProps {
58
- /** Theme. */
59
- theme?: Theme;
60
- }
61
-
62
- /**
63
- * Component props.
64
- */
65
- interface DialogContentHeaderProps extends ComponentProps<'div'> {
66
- /** Header. */
67
- header?: string;
68
- /** Heading props allowing to override the component rendered by the heading without changing its style. */
69
- headingProps?: Pick<HeadingProps, 'as' | 'noWrap' | 'variant'>;
70
- /** Subheader */
71
- subheader?: string;
72
- /**
73
- * Can be a string or an array of strings containing `d` property of the `path` SVG element.<br />
74
- * Can also be a ReactElement.
75
- */
76
- icon?: IconProps['icon'];
77
- /** Custom props to pass to the Icon component. */
78
- iconProps?: Omit<IconProps, 'ref' | 'icon'>;
79
- /** Whether the card is loading or not. */
80
- isLoading?: boolean;
81
- /** Theme. */
82
- theme?: Theme;
83
- }
84
-
85
- /**
86
- * Component props.
87
- */
88
- interface DialogContentProps extends ComponentProps<'div'> {
89
- /** Theme. */
90
- theme?: Theme;
91
- }
92
-
93
- /**
94
- * Component props.
95
- */
96
- interface DialogTriggerProps extends ComponentProps<'button'>, StylingProps {
97
- }
98
-
99
- /**
100
- * The RadarSimpleDialog component.
101
- */
102
- type RadarSimpleDialogProps = Comp<Omit<DialogProps, 'children'> & {
103
- header?: ReactNode;
104
- trigger?: Omit<DialogTriggerProps, 'ref'>;
105
- } & Pick<DialogContentBodyProps, 'children'>, HTMLDivElement>;
106
-
107
- declare const RadarSimple: {
108
- Dialog: RadarSimpleDialogProps;
109
- MenuButton: _redsift_design_system.Comp<Omit<_redsift_pickers.MenuButtonProps, "children"> & {
110
- title: string;
111
- subtitle?: string | undefined;
112
- icon?: Omit<_redsift_design_system.IconProps, "ref"> | undefined;
113
- } & Pick<_redsift_pickers.MenuButtonContentMenuProps, "children">, HTMLDivElement>;
114
- };
115
- declare const Radar: {
116
- Button: _redsift_design_system.Comp<_redsift_design_system.ButtonProps, HTMLButtonElement>;
117
- Dialog: React$1.FC<DialogProps> & {
118
- displayName?: string | undefined;
119
- className?: string | undefined;
120
- } & {
121
- Trigger: _redsift_design_system.Comp<DialogTriggerProps, HTMLButtonElement>;
122
- Content: _redsift_design_system.Comp<DialogContentProps & {
123
- backgroundPosition?: "top" | "bottom" | undefined;
124
- }, HTMLDivElement> & {
125
- Header: _redsift_design_system.Comp<DialogContentHeaderProps, HTMLDivElement>;
126
- Body: _redsift_design_system.Comp<DialogContentBodyProps, HTMLDivElement>;
127
- };
128
- };
129
- Item: _redsift_design_system.Comp<_redsift_design_system.ItemProps, HTMLDivElement>;
130
- MenuButton: React$1.FC<_redsift_pickers.MenuButtonProps> & {
131
- displayName?: string | undefined;
132
- className?: string | undefined;
133
- } & {
134
- Trigger: _redsift_design_system.Comp<_redsift_pickers.MenuButtonTriggerProps, HTMLButtonElement>;
135
- Content: _redsift_design_system.Comp<_redsift_pickers.MenuButtonContentProps, HTMLDivElement> & {
136
- Header: _redsift_design_system.Comp<_redsift_pickers.MenuButtonContentHeaderProps, HTMLDivElement>;
137
- Menu: _redsift_design_system.Comp<_redsift_pickers.MenuButtonContentMenuProps, HTMLDivElement>;
138
- Footer: _redsift_design_system.Comp<_redsift_pickers.MenuButtonContentFooterProps, HTMLDivElement>;
139
- };
140
- };
141
- Simple: {
142
- Dialog: RadarSimpleDialogProps;
143
- MenuButton: _redsift_design_system.Comp<Omit<_redsift_pickers.MenuButtonProps, "children"> & {
144
- title: string;
145
- subtitle?: string | undefined;
146
- icon?: Omit<_redsift_design_system.IconProps, "ref"> | undefined;
147
- } & Pick<_redsift_pickers.MenuButtonContentMenuProps, "children">, HTMLDivElement>;
148
- };
149
- };
150
-
151
- /**
152
- * The RadarButton component.
153
- */
154
- declare const RadarButton: Comp<ButtonProps, HTMLButtonElement>;
155
-
156
- /**
157
- * The RadarItem component.
158
- */
159
- declare const RadarItem: Comp<ItemProps, HTMLDivElement>;
160
-
161
- /**
162
- * The RadarMenuButton component.
163
- */
164
- declare const BaseRadarMenuButton: React__default.FC<MenuButtonProps> & {
165
- displayName?: string;
166
- className?: string;
167
- };
168
- declare const RadarMenuButtonTrigger: Comp<_redsift_pickers.MenuButtonTriggerProps, HTMLButtonElement>;
169
- declare const BaseRadarMenuButtonContent: Comp<MenuButtonContentProps, HTMLDivElement>;
170
- declare const RadarMenuButtonContentHeader: Comp<MenuButtonContentHeaderProps, HTMLDivElement>;
171
- declare const RadarMenuButtonContentMenu: Comp<MenuButtonContentMenuProps, HTMLDivElement>;
172
- declare const RadarMenuButtonContentFooter: Comp<_redsift_pickers.MenuButtonContentFooterProps, HTMLDivElement>;
173
- declare const RadarMenuButtonContent: Comp<MenuButtonContentProps, HTMLDivElement> & {
174
- Header: Comp<MenuButtonContentHeaderProps, HTMLDivElement>;
175
- Menu: Comp<MenuButtonContentMenuProps, HTMLDivElement>;
176
- Footer: Comp<_redsift_pickers.MenuButtonContentFooterProps, HTMLDivElement>;
177
- };
178
- declare const RadarMenuButton: React__default.FC<MenuButtonProps> & {
179
- displayName?: string | undefined;
180
- className?: string | undefined;
181
- } & {
182
- Trigger: Comp<_redsift_pickers.MenuButtonTriggerProps, HTMLButtonElement>;
183
- Content: Comp<MenuButtonContentProps, HTMLDivElement> & {
184
- Header: Comp<MenuButtonContentHeaderProps, HTMLDivElement>;
185
- Menu: Comp<MenuButtonContentMenuProps, HTMLDivElement>;
186
- Footer: Comp<_redsift_pickers.MenuButtonContentFooterProps, HTMLDivElement>;
187
- };
188
- };
189
-
190
- /**
191
- * The RadarSimpleMenuButton component.
192
- */
193
- declare const RadarSimpleMenuButton: Comp<Omit<MenuButtonProps, 'children'> & {
194
- title: string;
195
- subtitle?: string;
196
- icon?: Omit<IconProps, 'ref'>;
197
- } & Pick<MenuButtonContentMenuProps, 'children'>, HTMLDivElement>;
198
-
199
- export { BaseRadarMenuButton, BaseRadarMenuButtonContent, Radar, RadarButton, RadarItem, RadarMenuButton, RadarMenuButtonContent, RadarMenuButtonContentFooter, RadarMenuButtonContentHeader, RadarMenuButtonContentMenu, RadarMenuButtonTrigger, RadarSimple, RadarSimpleMenuButton };
1
+ export { Radar, RadarSimple } from './components/radar/index.js';
2
+ export { RadarButton } from './components/radar-button/RadarButton.js';
3
+ export { RadarItem } from './components/radar-item/RadarItem.js';
4
+ export { BaseRadarMenuButton, BaseRadarMenuButtonContent, RadarMenuButton, RadarMenuButtonContent, RadarMenuButtonContentFooter, RadarMenuButtonContentHeader, RadarMenuButtonContentMenu, RadarMenuButtonTrigger } from './components/radar-menu-button/RadarMenuButton.js';
5
+ export { RadarSimpleMenuButton } from './components/radar-menu-button/RadarSimpleMenuButton.js';
package/index.js CHANGED
@@ -1,5 +1,6 @@
1
- export { Radar, RadarSimple } from './_internal/radar.js';
2
- export { R as RadarButton } from './_internal/RadarButton.js';
3
- export { R as RadarItem } from './_internal/RadarItem.js';
4
- export { B as BaseRadarMenuButton, a as BaseRadarMenuButtonContent, f as RadarMenuButton, e as RadarMenuButtonContent, d as RadarMenuButtonContentFooter, b as RadarMenuButtonContentHeader, c as RadarMenuButtonContentMenu, R as RadarMenuButtonTrigger, g as RadarSimpleMenuButton } from './_internal/RadarSimpleMenuButton.js';
1
+ export { Radar, RadarSimple } from './components/radar/index.js';
2
+ export { RadarButton } from './components/radar-button/RadarButton.js';
3
+ export { RadarItem } from './components/radar-item/RadarItem.js';
4
+ export { BaseRadarMenuButton, BaseRadarMenuButtonContent, RadarMenuButton, RadarMenuButtonContent, RadarMenuButtonContentFooter, RadarMenuButtonContentHeader, RadarMenuButtonContentMenu, RadarMenuButtonTrigger } from './components/radar-menu-button/RadarMenuButton.js';
5
+ export { RadarSimpleMenuButton } from './components/radar-menu-button/RadarSimpleMenuButton.js';
5
6
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
package/package.json CHANGED
@@ -30,11 +30,11 @@
30
30
  "test": "yarn test:unit && yarn test:storybook"
31
31
  },
32
32
  "types": "index.d.ts",
33
- "version": "11.6.0-alpha.0",
33
+ "version": "11.6.0-muiv5-alpha.0",
34
34
  "dependencies": {
35
- "@redsift/design-system": "^11.6.0-alpha.0",
36
- "@redsift/icons": "^11.6.0-alpha.0",
37
- "@redsift/pickers": "^11.6.0-alpha.0",
35
+ "@redsift/design-system": "^11.6.0-muiv5-alpha.0",
36
+ "@redsift/icons": "^11.6.0-muiv5-alpha.0",
37
+ "@redsift/pickers": "^11.6.0-muiv5-alpha.0",
38
38
  "classnames": "^2.3.1",
39
39
  "styled-components": "^5.3.5"
40
40
  },
@@ -95,5 +95,5 @@
95
95
  "react-dom": ">=17",
96
96
  "styled-components": "^5.3.5"
97
97
  },
98
- "gitHead": "e04229cbb20aa9315bf0fa1ada9ac34590ec52af"
98
+ "gitHead": "479124ec4716c2bc55894b4fd7477e9c7814afee"
99
99
  }
@@ -0,0 +1,56 @@
1
+ import React__default from 'react';
2
+ import { useTheme, partitionComponents, isComponent, ThemeProvider } from '@redsift/design-system';
3
+ import { DialogContext } from './context.js';
4
+ import { DialogSize } from './types.js';
5
+ import { useDialog } from './useDialog.js';
6
+ import { DialogTrigger } from '../dialog-trigger/DialogTrigger.js';
7
+ import { DialogContent } from '../dialog-content/DialogContent.js';
8
+
9
+ const COMPONENT_NAME = 'Dialog';
10
+ const CLASSNAME = 'redsift-dialog';
11
+
12
+ /**
13
+ * The Dialog component.
14
+ */
15
+ const BaseDialog = props => {
16
+ const {
17
+ color,
18
+ children,
19
+ defaultOpen,
20
+ hasCloseButton = true,
21
+ initialFocus,
22
+ isOpen,
23
+ onOpen,
24
+ size = DialogSize.medium,
25
+ theme: propsTheme,
26
+ triggerClassName
27
+ } = props;
28
+ const theme = useTheme(propsTheme);
29
+ const dialog = useDialog({
30
+ color,
31
+ defaultOpen,
32
+ hasCloseButton,
33
+ initialFocus,
34
+ isOpen,
35
+ onOpen,
36
+ size,
37
+ triggerClassName
38
+ });
39
+ const [[trigger], [content]] = partitionComponents(React__default.Children.toArray(children), [isComponent('DialogTrigger'), isComponent('DialogContent')]);
40
+ return /*#__PURE__*/React__default.createElement(ThemeProvider, {
41
+ value: {
42
+ theme
43
+ }
44
+ }, /*#__PURE__*/React__default.createElement(DialogContext.Provider, {
45
+ value: dialog
46
+ }, trigger && isComponent('DialogTrigger')(trigger) ? trigger : null, content && isComponent('DialogContent')(content) ? content : null));
47
+ };
48
+ BaseDialog.className = CLASSNAME;
49
+ BaseDialog.displayName = COMPONENT_NAME;
50
+ const Dialog = Object.assign(BaseDialog, {
51
+ Trigger: DialogTrigger,
52
+ Content: DialogContent
53
+ });
54
+
55
+ export { BaseDialog, Dialog };
56
+ //# sourceMappingURL=Dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dialog.js","sources":["../../../../../../../popovers/src/components/dialog/Dialog.tsx"],"sourcesContent":["import React from 'react';\nimport { partitionComponents, isComponent, useTheme, ThemeProvider } from '@redsift/design-system';\nimport { DialogContent } from '../dialog-content';\nimport { DialogTrigger } from '../dialog-trigger';\n\nimport { DialogContext } from './context';\nimport { DialogProps, DialogSize } from './types';\nimport { useDialog } from './useDialog';\n\nconst COMPONENT_NAME = 'Dialog';\nconst CLASSNAME = 'redsift-dialog';\n\n/**\n * The Dialog component.\n */\nexport const BaseDialog: React.FC<DialogProps> & {\n displayName?: string;\n className?: string;\n} = (props) => {\n const {\n color,\n children,\n defaultOpen,\n hasCloseButton = true,\n initialFocus,\n isOpen,\n onOpen,\n size = DialogSize.medium,\n theme: propsTheme,\n triggerClassName,\n } = props;\n\n const theme = useTheme(propsTheme);\n\n const dialog = useDialog({\n color,\n defaultOpen,\n hasCloseButton,\n initialFocus,\n isOpen,\n onOpen,\n size,\n triggerClassName,\n });\n\n const [[trigger], [content]] = partitionComponents(React.Children.toArray(children), [\n isComponent('DialogTrigger'),\n isComponent('DialogContent'),\n ]);\n\n return (\n <ThemeProvider value={{ theme }}>\n <DialogContext.Provider value={dialog}>\n {trigger && isComponent('DialogTrigger')(trigger) ? trigger : null}\n {content && isComponent('DialogContent')(content) ? content : null}\n </DialogContext.Provider>\n </ThemeProvider>\n );\n};\nBaseDialog.className = CLASSNAME;\nBaseDialog.displayName = COMPONENT_NAME;\n\nexport const Dialog = Object.assign(BaseDialog, {\n Trigger: DialogTrigger,\n Content: DialogContent,\n});\n"],"names":["COMPONENT_NAME","CLASSNAME","BaseDialog","props","color","children","defaultOpen","hasCloseButton","initialFocus","isOpen","onOpen","size","DialogSize","medium","theme","propsTheme","triggerClassName","useTheme","dialog","useDialog","trigger","content","partitionComponents","React","Children","toArray","isComponent","createElement","ThemeProvider","value","DialogContext","Provider","className","displayName","Dialog","Object","assign","Trigger","DialogTrigger","Content","DialogContent"],"mappings":";;;;;;;;AASA,MAAMA,cAAc,GAAG,QAAQ,CAAA;AAC/B,MAAMC,SAAS,GAAG,gBAAgB,CAAA;;AAElC;AACA;AACA;AACaC,MAAAA,UAGZ,GAAIC,KAAK,IAAK;EACb,MAAM;IACJC,KAAK;IACLC,QAAQ;IACRC,WAAW;AACXC,IAAAA,cAAc,GAAG,IAAI;IACrBC,YAAY;IACZC,MAAM;IACNC,MAAM;IACNC,IAAI,GAAGC,UAAU,CAACC,MAAM;AACxBC,IAAAA,KAAK,EAAEC,UAAU;AACjBC,IAAAA,gBAAAA;AACF,GAAC,GAAGb,KAAK,CAAA;AAET,EAAA,MAAMW,KAAK,GAAGG,QAAQ,CAACF,UAAU,CAAC,CAAA;EAElC,MAAMG,MAAM,GAAGC,SAAS,CAAC;IACvBf,KAAK;IACLE,WAAW;IACXC,cAAc;IACdC,YAAY;IACZC,MAAM;IACNC,MAAM;IACNC,IAAI;AACJK,IAAAA,gBAAAA;AACF,GAAC,CAAC,CAAA;AAEF,EAAA,MAAM,CAAC,CAACI,OAAO,CAAC,EAAE,CAACC,OAAO,CAAC,CAAC,GAAGC,mBAAmB,CAACC,cAAK,CAACC,QAAQ,CAACC,OAAO,CAACpB,QAAQ,CAAC,EAAE,CACnFqB,WAAW,CAAC,eAAe,CAAC,EAC5BA,WAAW,CAAC,eAAe,CAAC,CAC7B,CAAC,CAAA;AAEF,EAAA,oBACEH,cAAA,CAAAI,aAAA,CAACC,aAAa,EAAA;AAACC,IAAAA,KAAK,EAAE;AAAEf,MAAAA,KAAAA;AAAM,KAAA;AAAE,GAAA,eAC9BS,cAAA,CAAAI,aAAA,CAACG,aAAa,CAACC,QAAQ,EAAA;AAACF,IAAAA,KAAK,EAAEX,MAAAA;AAAO,GAAA,EACnCE,OAAO,IAAIM,WAAW,CAAC,eAAe,CAAC,CAACN,OAAO,CAAC,GAAGA,OAAO,GAAG,IAAI,EACjEC,OAAO,IAAIK,WAAW,CAAC,eAAe,CAAC,CAACL,OAAO,CAAC,GAAGA,OAAO,GAAG,IACxC,CACX,CAAC,CAAA;AAEpB,EAAC;AACDnB,UAAU,CAAC8B,SAAS,GAAG/B,SAAS,CAAA;AAChCC,UAAU,CAAC+B,WAAW,GAAGjC,cAAc,CAAA;AAEhC,MAAMkC,MAAM,GAAGC,MAAM,CAACC,MAAM,CAAClC,UAAU,EAAE;AAC9CmC,EAAAA,OAAO,EAAEC,aAAa;AACtBC,EAAAA,OAAO,EAAEC,aAAAA;AACX,CAAC;;;;"}
@@ -0,0 +1,6 @@
1
+ import React__default from 'react';
2
+
3
+ const DialogContext = /*#__PURE__*/React__default.createContext(null);
4
+
5
+ export { DialogContext };
6
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sources":["../../../../../../../popovers/src/components/dialog/context.ts"],"sourcesContent":["import React from 'react';\nimport { DialogState } from './types';\n\nexport const DialogContext = React.createContext<DialogState | null>(null);\n"],"names":["DialogContext","React","createContext"],"mappings":";;AAGO,MAAMA,aAAa,gBAAGC,cAAK,CAACC,aAAa,CAAqB,IAAI;;;;"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Context props.
3
+ */
4
+
5
+ /**
6
+ * Component variant.
7
+ */
8
+ const DialogSize = {
9
+ small: 'small',
10
+ medium: 'medium',
11
+ large: 'large',
12
+ xlarge: 'xlarge'
13
+ };
14
+
15
+ /**
16
+ * Component props.
17
+ */
18
+
19
+ export { DialogSize };
20
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":["../../../../../../../popovers/src/components/dialog/types.ts"],"sourcesContent":["import { Dispatch, ReactNode, SetStateAction } from 'react';\nimport { ButtonColor, Theme, ValueOf } from '@redsift/design-system';\nimport { useDialog } from './useDialog';\n\n/**\n * Context props.\n */\nexport type DialogState =\n | (ReturnType<typeof useDialog> & {\n setLabelId: Dispatch<SetStateAction<string | undefined>>;\n setDescriptionId: Dispatch<SetStateAction<string | undefined>>;\n /** Class name to append to the trigger. */\n readonly triggerClassName?: string;\n })\n | null;\n\n/**\n * Component variant.\n */\nexport const DialogSize = {\n small: 'small',\n medium: 'medium',\n large: 'large',\n xlarge: 'xlarge',\n} as const;\nexport type DialogSize = ValueOf<typeof DialogSize>;\n\n/**\n * Component props.\n */\nexport interface DialogProps {\n /** Button color that will be forward to the trigger. */\n color?: ButtonColor;\n /** Children. Can only be DialogTrigger and DialogContent. */\n children: ReactNode;\n /**\n * Default open status.\n * Used for uncontrolled version.\n */\n defaultOpen?: boolean;\n /** Whether the Close icon button is displayed or not. */\n hasCloseButton?: boolean;\n /** Which element to initially focus. Can be either a number (tabbable index), a ref to en element, or a shortcut pointing towards a section of the dialog. See the accessibility section in the documentation to know which one to use. */\n initialFocus?: number | React.MutableRefObject<HTMLElement | null> | 'header' | 'body' | 'actions';\n /**\n * Whether the component is opened or not.\n * Used for controlled version.\n */\n isOpen?: boolean;\n /** Method to handle component change. */\n onOpen?: (open: boolean) => void;\n /** Dialog size. */\n size?: DialogSize | { width?: string; maxWidth?: string; minWidth?: string };\n /** Theme. */\n theme?: Theme;\n /** Class name to append to the trigger. */\n triggerClassName?: string;\n}\n\nexport type StyledDialogProps = DialogProps;\n"],"names":["DialogSize","small","medium","large","xlarge"],"mappings":"AAIA;AACA;AACA;;AAUA;AACA;AACA;AACO,MAAMA,UAAU,GAAG;AACxBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,MAAM,EAAE,QAAA;AACV,EAAU;;AAGV;AACA;AACA;;;;"}
@@ -0,0 +1,95 @@
1
+ import { objectSpread2 as _objectSpread2 } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import React__default, { useRef, useState, useEffect, useCallback } from 'react';
3
+ import { useFloating, useDismiss, useRole, useInteractions } from '../../../../../node_modules/@floating-ui/react/dist/floating-ui.react.mjs.js';
4
+ import { DialogSize } from './types.js';
5
+
6
+ const sizeToDimension = size => {
7
+ if (typeof size !== 'string') {
8
+ return size;
9
+ }
10
+ switch (size) {
11
+ case DialogSize.small:
12
+ return {
13
+ width: '540px'
14
+ };
15
+ case DialogSize.large:
16
+ return {
17
+ width: '800px'
18
+ };
19
+ case DialogSize.xlarge:
20
+ return {
21
+ width: '80vw'
22
+ };
23
+ case DialogSize.medium:
24
+ default:
25
+ return {
26
+ width: '700px'
27
+ };
28
+ }
29
+ };
30
+ function useDialog(_ref) {
31
+ let {
32
+ color,
33
+ defaultOpen,
34
+ hasCloseButton,
35
+ initialFocus,
36
+ isOpen: propsIsOpen,
37
+ onOpen,
38
+ size,
39
+ triggerClassName
40
+ } = _ref;
41
+ const headerRef = useRef(null);
42
+ const bodyRef = useRef(null);
43
+ const actionsRef = useRef(null);
44
+ const [labelId, setLabelId] = React__default.useState();
45
+ const [descriptionId, setDescriptionId] = React__default.useState();
46
+ const [isOpen, setIsOpen] = useState(propsIsOpen !== null && propsIsOpen !== void 0 ? propsIsOpen : defaultOpen);
47
+ const {
48
+ width,
49
+ minWidth,
50
+ maxWidth
51
+ } = sizeToDimension(size);
52
+ useEffect(() => {
53
+ setIsOpen(propsIsOpen !== null && propsIsOpen !== void 0 ? propsIsOpen : defaultOpen);
54
+ }, [propsIsOpen, defaultOpen]);
55
+ const handleOpen = useCallback(collapsed => {
56
+ if (onOpen) {
57
+ onOpen(collapsed);
58
+ }
59
+ if (propsIsOpen === undefined || propsIsOpen === null) {
60
+ setIsOpen(collapsed);
61
+ }
62
+ }, [onOpen]);
63
+ const data = useFloating({
64
+ open: isOpen,
65
+ onOpenChange: handleOpen
66
+ });
67
+ const context = data.context;
68
+ const dismiss = useDismiss(context, {
69
+ outsidePressEvent: 'mousedown'
70
+ });
71
+ const role = useRole(context);
72
+ const interactions = useInteractions([dismiss, role]);
73
+ return React__default.useMemo(() => _objectSpread2(_objectSpread2(_objectSpread2({
74
+ color,
75
+ isOpen,
76
+ handleOpen
77
+ }, interactions), data), {}, {
78
+ labelId,
79
+ descriptionId,
80
+ setLabelId,
81
+ setDescriptionId,
82
+ hasCloseButton,
83
+ initialFocus,
84
+ width,
85
+ minWidth,
86
+ maxWidth,
87
+ headerRef,
88
+ bodyRef,
89
+ actionsRef,
90
+ triggerClassName
91
+ }), [color, isOpen, handleOpen, interactions, data, labelId, descriptionId, hasCloseButton, initialFocus, width, minWidth, maxWidth, headerRef, bodyRef, actionsRef, triggerClassName]);
92
+ }
93
+
94
+ export { sizeToDimension, useDialog };
95
+ //# sourceMappingURL=useDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDialog.js","sources":["../../../../../../../popovers/src/components/dialog/useDialog.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { useFloating, useDismiss, useRole, useInteractions } from '@floating-ui/react';\nimport { DialogProps, DialogSize } from './types';\n\nexport const sizeToDimension = (\n size: DialogSize | { width?: string; maxWidth?: string; minWidth?: string }\n): { width?: string; maxWidth?: string; minWidth?: string } => {\n if (typeof size !== 'string') {\n return size;\n }\n\n switch (size) {\n case DialogSize.small:\n return { width: '540px' };\n case DialogSize.large:\n return { width: '800px' };\n case DialogSize.xlarge:\n return { width: '80vw' };\n case DialogSize.medium:\n default:\n return { width: '700px' };\n }\n};\n\nexport function useDialog({\n color,\n defaultOpen,\n hasCloseButton,\n initialFocus,\n isOpen: propsIsOpen,\n onOpen,\n size,\n triggerClassName,\n}: Omit<DialogProps, 'children'>) {\n const headerRef = useRef(null);\n const bodyRef = useRef(null);\n const actionsRef = useRef(null);\n const [labelId, setLabelId] = React.useState<string | undefined>();\n const [descriptionId, setDescriptionId] = React.useState<string | undefined>();\n\n const [isOpen, setIsOpen] = useState(propsIsOpen ?? defaultOpen);\n\n const { width, minWidth, maxWidth } = sizeToDimension(size!);\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 open: isOpen,\n onOpenChange: handleOpen,\n });\n\n const context = data.context;\n\n const dismiss = useDismiss(context, { outsidePressEvent: 'mousedown' });\n const role = useRole(context);\n\n const interactions = useInteractions([dismiss, role]);\n\n return React.useMemo(\n () => ({\n color,\n isOpen,\n handleOpen,\n ...interactions,\n ...data,\n labelId,\n descriptionId,\n setLabelId,\n setDescriptionId,\n hasCloseButton,\n initialFocus,\n width,\n minWidth,\n maxWidth,\n headerRef,\n bodyRef,\n actionsRef,\n triggerClassName,\n }),\n [\n color,\n isOpen,\n handleOpen,\n interactions,\n data,\n labelId,\n descriptionId,\n hasCloseButton,\n initialFocus,\n width,\n minWidth,\n maxWidth,\n headerRef,\n bodyRef,\n actionsRef,\n triggerClassName,\n ]\n );\n}\n"],"names":["sizeToDimension","size","DialogSize","small","width","large","xlarge","medium","useDialog","_ref","color","defaultOpen","hasCloseButton","initialFocus","isOpen","propsIsOpen","onOpen","triggerClassName","headerRef","useRef","bodyRef","actionsRef","labelId","setLabelId","React","useState","descriptionId","setDescriptionId","setIsOpen","minWidth","maxWidth","useEffect","handleOpen","useCallback","collapsed","undefined","data","useFloating","open","onOpenChange","context","dismiss","useDismiss","outsidePressEvent","role","useRole","interactions","useInteractions","useMemo","_objectSpread"],"mappings":";;;;;AAIaA,MAAAA,eAAe,GAC1BC,IAA2E,IACd;AAC7D,EAAA,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;AAC5B,IAAA,OAAOA,IAAI,CA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AAc;IACdC,YAAY;IACZT,KAAK;IACLyB,QAAQ;IACRC,QAAQ;IACRZ,SAAS;IACTE,OAAO;IACPC,UAAU;AACVJ,IAAAA,gBAAAA;AAAgB,GAAA,CAChB,EACF,CACEP,KAAK,EACLI,MAAM,EACNkB,UAAU,EACVc,YAAY,EACZV,IAAI,EACJd,OAAO,EACPI,aAAa,EACbd,cAAc,EACdC,YAAY,EACZT,KAAK,EACLyB,QAAQ,EACRC,QAAQ,EACRZ,SAAS,EACTE,OAAO,EACPC,UAAU,EACVJ,gBAAgB,CAEpB,CAAC,CAAA;AACH;;;;"}
@@ -0,0 +1,13 @@
1
+ import React__default from 'react';
2
+ import { DialogContext } from './context.js';
3
+
4
+ const useDialogContext = () => {
5
+ const context = React__default.useContext(DialogContext);
6
+ if (context == null) {
7
+ throw new Error('Dialog components must be wrapped in <Dialog />');
8
+ }
9
+ return context;
10
+ };
11
+
12
+ export { useDialogContext };
13
+ //# sourceMappingURL=useDialogContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDialogContext.js","sources":["../../../../../../../popovers/src/components/dialog/useDialogContext.tsx"],"sourcesContent":["import React from 'react';\nimport { DialogContext } from './context';\n\nexport const useDialogContext = () => {\n const context = React.useContext(DialogContext);\n\n if (context == null) {\n throw new Error('Dialog components must be wrapped in <Dialog />');\n }\n\n return context;\n};\n"],"names":["useDialogContext","context","React","useContext","DialogContext","Error"],"mappings":";;;AAGaA,MAAAA,gBAAgB,GAAGA,MAAM;AACpC,EAAA,MAAMC,OAAO,GAAGC,cAAK,CAACC,UAAU,CAACC,aAAa,CAAC,CAAA;EAE/C,IAAIH,OAAO,IAAI,IAAI,EAAE;AACnB,IAAA,MAAM,IAAII,KAAK,CAAC,iDAAiD,CAAC,CAAA;AACpE,GAAA;AAEA,EAAA,OAAOJ,OAAO,CAAA;AAChB;;;;"}
@@ -0,0 +1,97 @@
1
+ import { objectWithoutProperties as _objectWithoutProperties, extends as _extends, objectSpread2 as _objectSpread2 } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import React__default, { forwardRef, useContext } from 'react';
3
+ import classNames from 'classnames';
4
+ import { useTransitionStyles, useMergeRefs, FloatingPortal, FloatingFocusManager } from '../../../../../node_modules/@floating-ui/react/dist/floating-ui.react.mjs.js';
5
+ import { mdiClose } from '@redsift/icons';
6
+ import { AppContainerContext, useTheme, useMessageFormatter, partitionComponents, isComponent, IconButton } from '@redsift/design-system';
7
+ import intlMessages from './intl/index.js';
8
+ import { StyledFloatingOverlay, StyledDialogContent } from './styles.js';
9
+ import { DialogContentHeader } from '../dialog-content-header/DialogContentHeader.js';
10
+ import { DialogContentBody } from '../dialog-content-body/DialogContentBody.js';
11
+ import { DialogContentActions } from '../dialog-content-actions/DialogContentActions.js';
12
+ import { useDialogContext } from '../dialog/useDialogContext.js';
13
+
14
+ const _excluded = ["children", "className", "style", "theme"];
15
+ const COMPONENT_NAME = 'DialogContent';
16
+ const CLASSNAME = 'redsift-dialog-content';
17
+
18
+ /**
19
+ * The DialogContent component.
20
+ */
21
+ const BaseDialogContent = /*#__PURE__*/forwardRef((props, ref) => {
22
+ const {
23
+ children,
24
+ className,
25
+ style,
26
+ theme: propsTheme
27
+ } = props,
28
+ forwardedProps = _objectWithoutProperties(props, _excluded);
29
+ const appContainerState = useContext(AppContainerContext);
30
+ const {
31
+ context: floatingContext,
32
+ getFloatingProps,
33
+ refs,
34
+ labelId,
35
+ descriptionId,
36
+ handleOpen,
37
+ hasCloseButton,
38
+ initialFocus: propsInitialFocus,
39
+ width,
40
+ minWidth,
41
+ maxWidth,
42
+ headerRef,
43
+ bodyRef,
44
+ actionsRef
45
+ } = useDialogContext();
46
+ const theme = useTheme(propsTheme);
47
+ const {
48
+ isMounted,
49
+ styles
50
+ } = useTransitionStyles(floatingContext);
51
+ const dialogRef = useMergeRefs([refs.setFloating, ref]);
52
+ const format = useMessageFormatter(intlMessages);
53
+ const [[header], [body], [actions]] = partitionComponents(React__default.Children.toArray(children), [isComponent('DialogContentHeader'), isComponent('DialogContentBody'), isComponent('DialogContentActions')]);
54
+ const initialFocus = propsInitialFocus === 'header' ? headerRef : propsInitialFocus === 'body' ? bodyRef : propsInitialFocus === 'actions' ? actionsRef : propsInitialFocus ? propsInitialFocus : undefined;
55
+ return /*#__PURE__*/React__default.createElement(FloatingPortal, {
56
+ root: appContainerState === null || appContainerState === void 0 ? void 0 : appContainerState.appContainerRef.current
57
+ }, isMounted && /*#__PURE__*/React__default.createElement(StyledFloatingOverlay, {
58
+ lockScroll: true,
59
+ style: styles
60
+ }, /*#__PURE__*/React__default.createElement(FloatingFocusManager, {
61
+ context: floatingContext,
62
+ initialFocus: initialFocus ? initialFocus : undefined
63
+ }, /*#__PURE__*/React__default.createElement(StyledDialogContent, _extends({
64
+ $theme: theme,
65
+ className: classNames(DialogContent.className, className)
66
+ }, forwardedProps, {
67
+ ref: dialogRef,
68
+ "aria-labelledby": labelId,
69
+ "aria-describedby": descriptionId
70
+ }, getFloatingProps(props), {
71
+ style: _objectSpread2(_objectSpread2({}, styles), style),
72
+ $width: width,
73
+ $minWidth: minWidth,
74
+ $maxWidth: maxWidth
75
+ }), !header && !body && !actions ? /*#__PURE__*/React__default.createElement(DialogContentBody, null, children) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, header || hasCloseButton ? /*#__PURE__*/React__default.createElement("div", {
76
+ className: `${BaseDialogContent.className}__header`
77
+ }, header, hasCloseButton ? /*#__PURE__*/React__default.createElement(IconButton, {
78
+ theme: theme,
79
+ "aria-label": format('close'),
80
+ className: `${BaseDialogContent.className}-header__icon-button`,
81
+ color: "grey",
82
+ icon: mdiClose,
83
+ onClick: () => handleOpen(false)
84
+ }) : null) : null, body || actions ? /*#__PURE__*/React__default.createElement("div", {
85
+ className: `${BaseDialogContent.className}__content`
86
+ }, body, actions) : null)))));
87
+ });
88
+ BaseDialogContent.className = CLASSNAME;
89
+ BaseDialogContent.displayName = COMPONENT_NAME;
90
+ const DialogContent = Object.assign(BaseDialogContent, {
91
+ Header: DialogContentHeader,
92
+ Body: DialogContentBody,
93
+ Actions: DialogContentActions
94
+ });
95
+
96
+ export { BaseDialogContent, DialogContent };
97
+ //# sourceMappingURL=DialogContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DialogContent.js","sources":["../../../../../../../popovers/src/components/dialog-content/DialogContent.tsx"],"sourcesContent":["import React, { forwardRef, useContext } from 'react';\nimport classNames from 'classnames';\nimport { useMergeRefs, FloatingPortal, FloatingFocusManager, useTransitionStyles } from '@floating-ui/react';\nimport { mdiClose } from '@redsift/icons';\n\nimport { AppContainerContext, useMessageFormatter } from '@redsift/design-system';\nimport intlMessages from './intl';\n\nimport { Comp, IconButton, isComponent, partitionComponents, useTheme } from '@redsift/design-system';\nimport { DialogContentProps } from './types';\nimport { useDialogContext } from '../dialog';\nimport { StyledDialogContent, StyledFloatingOverlay } from './styles';\nimport { DialogContentActions } from '../dialog-content-actions';\nimport { DialogContentBody } from '../dialog-content-body';\nimport { DialogContentHeader } from '../dialog-content-header';\n\nconst COMPONENT_NAME = 'DialogContent';\nconst CLASSNAME = 'redsift-dialog-content';\n\n/**\n * The DialogContent component.\n */\nexport const BaseDialogContent: Comp<DialogContentProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { children, className, style, theme: propsTheme, ...forwardedProps } = props;\n const appContainerState = useContext(AppContainerContext);\n const {\n context: floatingContext,\n getFloatingProps,\n refs,\n labelId,\n descriptionId,\n handleOpen,\n hasCloseButton,\n initialFocus: propsInitialFocus,\n width,\n minWidth,\n maxWidth,\n headerRef,\n bodyRef,\n actionsRef,\n } = useDialogContext();\n const theme = useTheme(propsTheme);\n const { isMounted, styles } = useTransitionStyles(floatingContext);\n const dialogRef = useMergeRefs([refs.setFloating, ref]);\n\n const format = useMessageFormatter(intlMessages);\n\n const [[header], [body], [actions]] = partitionComponents(React.Children.toArray(children), [\n isComponent('DialogContentHeader'),\n isComponent('DialogContentBody'),\n isComponent('DialogContentActions'),\n ]);\n\n const initialFocus: number | React.MutableRefObject<HTMLElement | null> | undefined =\n propsInitialFocus === 'header'\n ? headerRef\n : propsInitialFocus === 'body'\n ? bodyRef\n : propsInitialFocus === 'actions'\n ? actionsRef\n : propsInitialFocus\n ? propsInitialFocus\n : undefined;\n\n return (\n <FloatingPortal root={appContainerState?.appContainerRef.current}>\n {isMounted && (\n <StyledFloatingOverlay lockScroll style={styles}>\n <FloatingFocusManager context={floatingContext} initialFocus={initialFocus ? initialFocus : undefined}>\n <StyledDialogContent\n $theme={theme!}\n className={classNames(DialogContent.className, className)}\n {...forwardedProps}\n ref={dialogRef}\n aria-labelledby={labelId}\n aria-describedby={descriptionId}\n {...getFloatingProps(props)}\n style={{ ...styles, ...style }}\n $width={width}\n $minWidth={minWidth}\n $maxWidth={maxWidth}\n >\n {!header && !body && !actions ? (\n <DialogContentBody>{children}</DialogContentBody>\n ) : (\n <>\n {header || hasCloseButton ? (\n <div className={`${BaseDialogContent.className}__header`}>\n {header}\n\n {hasCloseButton ? (\n <IconButton\n theme={theme}\n aria-label={format('close')}\n className={`${BaseDialogContent.className}-header__icon-button`}\n color=\"grey\"\n icon={mdiClose}\n onClick={() => handleOpen(false)}\n />\n ) : null}\n </div>\n ) : null}\n {body || actions ? (\n <div className={`${BaseDialogContent.className}__content`}>\n {body}\n {actions}\n </div>\n ) : null}\n </>\n )}\n </StyledDialogContent>\n </FloatingFocusManager>\n </StyledFloatingOverlay>\n )}\n </FloatingPortal>\n );\n});\nBaseDialogContent.className = CLASSNAME;\nBaseDialogContent.displayName = COMPONENT_NAME;\n\nexport const DialogContent = Object.assign(BaseDialogContent, {\n Header: DialogContentHeader,\n Body: DialogContentBody,\n Actions: DialogContentActions,\n});\n"],"names":["COMPONENT_NAME","CLASSNAME","BaseDialogContent","forwardRef","props","ref","children","className","style","theme","propsTheme","forwardedProps","_objectWithoutProperties","_excluded","appContainerState","useContext","AppContainerContext","context","floatingContext","getFloatingProps","refs","labelId","descriptionId","handleOpen","hasCloseButton","initialFocus","propsInitialFocus","width","minWidth","maxWidth","headerRef","bodyRef","actionsRef","useDialogContext","useTheme","isMounted","styles","useTransitionStyles","dialogRef","useMergeRefs","setFloating","format","useMessageFormatter","intlMessages","header","body","actions","partitionComponents","React","Children","toArray","isComponent","undefined","createElement","FloatingPortal","root","appContainerRef","current","StyledFloatingOverlay","lockScroll","FloatingFocusManager","StyledDialogContent","_extends","$theme","classNames","DialogContent","_objectSpread","$width","$minWidth","$maxWidth","DialogContentBody","Fragment","IconButton","color","icon","mdiClose","onClick","displayName","Object","assign","Header","DialogContentHeader","Body","Actions","DialogContentActions"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAMA,cAAc,GAAG,eAAe,CAAA;AACtC,MAAMC,SAAS,GAAG,wBAAwB,CAAA;;AAE1C;AACA;AACA;AACO,MAAMC,iBAA2D,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EACpG,MAAM;MAAEC,QAAQ;MAAEC,SAAS;MAAEC,KAAK;AAAEC,MAAAA,KAAK,EAAEC,UAAAA;AAA8B,KAAC,GAAGN,KAAK;AAAxBO,IAAAA,cAAc,GAAAC,wBAAA,CAAKR,KAAK,EAAAS,SAAA,CAAA,CAAA;AAClF,EAAA,MAAMC,iBAAiB,GAAGC,UAAU,CAACC,mBAAmB,CAAC,CAAA;EACzD,MAAM;AACJC,IAAAA,OAAO,EAAEC,eAAe;IACxBC,gBAAgB;IAChBC,IAAI;IACJC,OAAO;IACPC,aAAa;IACbC,UAAU;IACVC,cAAc;AACdC,IAAAA,YAAY,EAAEC,iBAAiB;IAC/BC,KAAK;IACLC,QAAQ;IACRC,QAAQ;IACRC,SAAS;IACTC,OAAO;AACPC,IAAAA,UAAAA;GACD,GAAGC,gBAAgB,EAAE,CAAA;AACtB,EAAA,MAAMxB,KAAK,GAAGyB,QAAQ,CAACxB,UAAU,CAAC,CAAA;EAClC,MAAM;IAAEyB,SAAS;AAAEC,IAAAA,MAAAA;AAAO,GAAC,GAAGC,mBA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C,CAAC,GACA,IACD,CAAC,GACJ,IAAI,EACPsB,IAAI,IAAIC,OAAO,gBACdE,cAAA,CAAAK,aAAA,CAAA,KAAA,EAAA;AAAK9C,IAAAA,SAAS,EAAG,CAAA,EAAEL,iBAAiB,CAACK,SAAU,CAAA,SAAA,CAAA;GAC5CsC,EAAAA,IAAI,EACJC,OACE,CAAC,GACJ,IACJ,CAEe,CACD,CACD,CAEX,CAAC,CAAA;AAErB,CAAC,EAAC;AACF5C,iBAAiB,CAACK,SAAS,GAAGN,SAAS,CAAA;AACvCC,iBAAiB,CAAC2E,WAAW,GAAG7E,cAAc,CAAA;AAEvC,MAAMiE,aAAa,GAAGa,MAAM,CAACC,MAAM,CAAC7E,iBAAiB,EAAE;AAC5D8E,EAAAA,MAAM,EAAEC,mBAAmB;AAC3BC,EAAAA,IAAI,EAAEZ,iBAAiB;AACvBa,EAAAA,OAAO,EAAEC,oBAAAA;AACX,CAAC;;;;"}
@@ -0,0 +1,7 @@
1
+ var close = "Close";
2
+ var enUS = {
3
+ close: close
4
+ };
5
+
6
+ export { close, enUS as default };
7
+ //# sourceMappingURL=en-US.json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en-US.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,7 @@
1
+ var close = "Fermer";
2
+ var frFR = {
3
+ close: close
4
+ };
5
+
6
+ export { close, frFR as default };
7
+ //# sourceMappingURL=fr-FR.json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fr-FR.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,10 @@
1
+ import enUS from './en-US.json.js';
2
+ import frFR from './fr-FR.json.js';
3
+
4
+ var intlMessages = {
5
+ 'en-US': enUS,
6
+ 'fr-FR': frFR
7
+ };
8
+
9
+ export { intlMessages as default };
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../../../../popovers/src/components/dialog-content/intl/index.ts"],"sourcesContent":["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"],"names":["enUS","frFR"],"mappings":";;;AAGA,mBAAe;AACb,EAAA,OAAO,EAAEA,IAAI;AACb,EAAA,OAAO,EAAEC,IAAAA;AACX,CAAC;;;;"}