@fluentui/react-dialog 9.4.3 → 9.5.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.
- package/CHANGELOG.json +21 -6
- package/CHANGELOG.md +16 -7
- package/dist/index.d.ts +3 -4
- package/lib/components/DialogTrigger/DialogTrigger.js +3 -4
- package/lib/components/DialogTrigger/DialogTrigger.js.map +1 -1
- package/lib/components/DialogTrigger/useDialogTrigger.js +0 -2
- package/lib/components/DialogTrigger/useDialogTrigger.js.map +1 -1
- package/lib-commonjs/components/DialogTrigger/DialogTrigger.js.map +1 -1
- package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js +0 -2
- package/lib-commonjs/components/DialogTrigger/useDialogTrigger.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,22 @@
|
|
|
2
2
|
"name": "@fluentui/react-dialog",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Thu, 06 Apr 2023 23:59:47 GMT",
|
|
6
|
+
"tag": "@fluentui/react-dialog_v9.5.0",
|
|
7
|
+
"version": "9.5.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
12
|
+
"package": "@fluentui/react-dialog",
|
|
13
|
+
"commit": "ba56da096fffa6b2f114a910afbf12482313ba28",
|
|
14
|
+
"comment": "feat: removes aria-expanded from DialogTrigger"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Tue, 04 Apr 2023 18:44:48 GMT",
|
|
6
21
|
"tag": "@fluentui/react-dialog_v9.4.3",
|
|
7
22
|
"version": "9.4.3",
|
|
8
23
|
"comments": {
|
|
@@ -17,31 +32,31 @@
|
|
|
17
32
|
"author": "beachball",
|
|
18
33
|
"package": "@fluentui/react-dialog",
|
|
19
34
|
"comment": "Bump @fluentui/react-utilities to v9.7.3",
|
|
20
|
-
"commit": "
|
|
35
|
+
"commit": "6778d76bbbad7e1975c151c797f28c2708cde2ce"
|
|
21
36
|
},
|
|
22
37
|
{
|
|
23
38
|
"author": "beachball",
|
|
24
39
|
"package": "@fluentui/react-dialog",
|
|
25
40
|
"comment": "Bump @fluentui/react-context-selector to v9.1.16",
|
|
26
|
-
"commit": "
|
|
41
|
+
"commit": "6778d76bbbad7e1975c151c797f28c2708cde2ce"
|
|
27
42
|
},
|
|
28
43
|
{
|
|
29
44
|
"author": "beachball",
|
|
30
45
|
"package": "@fluentui/react-dialog",
|
|
31
46
|
"comment": "Bump @fluentui/react-aria to v9.3.16",
|
|
32
|
-
"commit": "
|
|
47
|
+
"commit": "6778d76bbbad7e1975c151c797f28c2708cde2ce"
|
|
33
48
|
},
|
|
34
49
|
{
|
|
35
50
|
"author": "beachball",
|
|
36
51
|
"package": "@fluentui/react-dialog",
|
|
37
52
|
"comment": "Bump @fluentui/react-tabster to v9.6.3",
|
|
38
|
-
"commit": "
|
|
53
|
+
"commit": "6778d76bbbad7e1975c151c797f28c2708cde2ce"
|
|
39
54
|
},
|
|
40
55
|
{
|
|
41
56
|
"author": "beachball",
|
|
42
57
|
"package": "@fluentui/react-dialog",
|
|
43
58
|
"comment": "Bump @fluentui/react-portal to v9.2.4",
|
|
44
|
-
"commit": "
|
|
59
|
+
"commit": "6778d76bbbad7e1975c151c797f28c2708cde2ce"
|
|
45
60
|
}
|
|
46
61
|
]
|
|
47
62
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,22 +1,31 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-dialog
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 06 Apr 2023 23:59:47 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.5.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.5.0)
|
|
8
|
+
|
|
9
|
+
Thu, 06 Apr 2023 23:59:47 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-dialog_v9.4.3..@fluentui/react-dialog_v9.5.0)
|
|
11
|
+
|
|
12
|
+
### Minor changes
|
|
13
|
+
|
|
14
|
+
- feat: removes aria-expanded from DialogTrigger ([PR #27372](https://github.com/microsoft/fluentui/pull/27372) by bernardo.sunderhus@gmail.com)
|
|
15
|
+
|
|
7
16
|
## [9.4.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.4.3)
|
|
8
17
|
|
|
9
|
-
Tue, 04 Apr 2023 18:
|
|
18
|
+
Tue, 04 Apr 2023 18:44:48 GMT
|
|
10
19
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-dialog_v9.4.1..@fluentui/react-dialog_v9.4.3)
|
|
11
20
|
|
|
12
21
|
### Patches
|
|
13
22
|
|
|
14
23
|
- fix: DialogContent scrollbar always visible ([PR #27367](https://github.com/microsoft/fluentui/pull/27367) by bernardo.sunderhus@gmail.com)
|
|
15
|
-
- Bump @fluentui/react-utilities to v9.7.3 ([PR #
|
|
16
|
-
- Bump @fluentui/react-context-selector to v9.1.16 ([PR #
|
|
17
|
-
- Bump @fluentui/react-aria to v9.3.16 ([PR #
|
|
18
|
-
- Bump @fluentui/react-tabster to v9.6.3 ([PR #
|
|
19
|
-
- Bump @fluentui/react-portal to v9.2.4 ([PR #
|
|
24
|
+
- Bump @fluentui/react-utilities to v9.7.3 ([PR #27434](https://github.com/microsoft/fluentui/pull/27434) by beachball)
|
|
25
|
+
- Bump @fluentui/react-context-selector to v9.1.16 ([PR #27434](https://github.com/microsoft/fluentui/pull/27434) by beachball)
|
|
26
|
+
- Bump @fluentui/react-aria to v9.3.16 ([PR #27434](https://github.com/microsoft/fluentui/pull/27434) by beachball)
|
|
27
|
+
- Bump @fluentui/react-tabster to v9.6.3 ([PR #27434](https://github.com/microsoft/fluentui/pull/27434) by beachball)
|
|
28
|
+
- Bump @fluentui/react-portal to v9.2.4 ([PR #27434](https://github.com/microsoft/fluentui/pull/27434) by beachball)
|
|
20
29
|
|
|
21
30
|
## [9.4.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-dialog_v9.4.1)
|
|
22
31
|
|
package/dist/index.d.ts
CHANGED
|
@@ -283,10 +283,9 @@ export declare type DialogTitleState = ComponentState<DialogTitleSlots>;
|
|
|
283
283
|
* and configures them to be the trigger that will open or close a `Dialog`.
|
|
284
284
|
* This component should only accept one child.
|
|
285
285
|
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
* in that case the user must provide a `controlled state`
|
|
286
|
+
* This component sole purpose is to avoid opting out of the internal controlled open state of a `Dialog`
|
|
287
|
+
* Besides being a trigger that opens/close a dialog through context this component doesn't do much,
|
|
288
|
+
* making it basically unnecessary in cases where the trigger is outside of the `Dialog` component.
|
|
290
289
|
*/
|
|
291
290
|
export declare const DialogTrigger: React_2.FC<DialogTriggerProps>;
|
|
292
291
|
|
|
@@ -6,10 +6,9 @@ import { renderDialogTrigger_unstable } from './renderDialogTrigger';
|
|
|
6
6
|
* and configures them to be the trigger that will open or close a `Dialog`.
|
|
7
7
|
* This component should only accept one child.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* in that case the user must provide a `controlled state`
|
|
9
|
+
* This component sole purpose is to avoid opting out of the internal controlled open state of a `Dialog`
|
|
10
|
+
* Besides being a trigger that opens/close a dialog through context this component doesn't do much,
|
|
11
|
+
* making it basically unnecessary in cases where the trigger is outside of the `Dialog` component.
|
|
13
12
|
*/
|
|
14
13
|
export const DialogTrigger = props => {
|
|
15
14
|
const state = useDialogTrigger_unstable(props);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useDialogTrigger_unstable","renderDialogTrigger_unstable","DialogTrigger","props","state","displayName","isFluentTriggerComponent"],"sources":["../../../src/components/DialogTrigger/DialogTrigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useDialogTrigger_unstable } from './useDialogTrigger';\nimport { renderDialogTrigger_unstable } from './renderDialogTrigger';\nimport type { DialogTriggerProps } from './DialogTrigger.types';\nimport type { FluentTriggerComponent } from '@fluentui/react-utilities';\n\n/**\n * A non-visual component that wraps its child\n * and configures them to be the trigger that will open or close a `Dialog`.\n * This component should only accept one child.\n *\n *
|
|
1
|
+
{"version":3,"names":["React","useDialogTrigger_unstable","renderDialogTrigger_unstable","DialogTrigger","props","state","displayName","isFluentTriggerComponent"],"sources":["../../../src/components/DialogTrigger/DialogTrigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useDialogTrigger_unstable } from './useDialogTrigger';\nimport { renderDialogTrigger_unstable } from './renderDialogTrigger';\nimport type { DialogTriggerProps } from './DialogTrigger.types';\nimport type { FluentTriggerComponent } from '@fluentui/react-utilities';\n\n/**\n * A non-visual component that wraps its child\n * and configures them to be the trigger that will open or close a `Dialog`.\n * This component should only accept one child.\n *\n * This component sole purpose is to avoid opting out of the internal controlled open state of a `Dialog`\n * Besides being a trigger that opens/close a dialog through context this component doesn't do much,\n * making it basically unnecessary in cases where the trigger is outside of the `Dialog` component.\n */\nexport const DialogTrigger: React.FC<DialogTriggerProps> = props => {\n const state = useDialogTrigger_unstable(props);\n\n return renderDialogTrigger_unstable(state);\n};\n\nDialogTrigger.displayName = 'DialogTrigger';\n// type casting here is required to ensure internal type FluentTriggerComponent is not leaked\n(DialogTrigger as FluentTriggerComponent).isFluentTriggerComponent = true;\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,4BAA4B,QAAQ;AAI7C;;;;;;;;;AASA,OAAO,MAAMC,aAAA,GAA8CC,KAAA,IAAS;EAClE,MAAMC,KAAA,GAAQJ,yBAAA,CAA0BG,KAAA;EAExC,OAAOF,4BAAA,CAA6BG,KAAA;AACtC;AAEAF,aAAA,CAAcG,WAAW,GAAG;AAC5B;AACCH,aAAA,CAAyCI,wBAAwB,GAAG,IAAI"}
|
|
@@ -18,7 +18,6 @@ export const useDialogTrigger_unstable = props => {
|
|
|
18
18
|
} = props;
|
|
19
19
|
const child = getTriggerChild(children);
|
|
20
20
|
const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);
|
|
21
|
-
const open = useDialogContext_unstable(ctx => ctx.open);
|
|
22
21
|
const {
|
|
23
22
|
triggerAttributes
|
|
24
23
|
} = useModalAttributes();
|
|
@@ -35,7 +34,6 @@ export const useDialogTrigger_unstable = props => {
|
|
|
35
34
|
});
|
|
36
35
|
const triggerChildProps = {
|
|
37
36
|
...(child === null || child === void 0 ? void 0 : child.props),
|
|
38
|
-
'aria-expanded': open,
|
|
39
37
|
ref: child === null || child === void 0 ? void 0 : child.ref,
|
|
40
38
|
onClick: handleClick,
|
|
41
39
|
...triggerAttributes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useModalAttributes","applyTriggerPropsToChildren","getTriggerChild","useEventCallback","useDialogContext_unstable","useDialogSurfaceContext_unstable","useARIAButtonProps","useDialogTrigger_unstable","props","isInsideSurfaceDialog","children","disableButtonEnhancement","action","child","requestOpenChange","ctx","
|
|
1
|
+
{"version":3,"names":["React","useModalAttributes","applyTriggerPropsToChildren","getTriggerChild","useEventCallback","useDialogContext_unstable","useDialogSurfaceContext_unstable","useARIAButtonProps","useDialogTrigger_unstable","props","isInsideSurfaceDialog","children","disableButtonEnhancement","action","child","requestOpenChange","ctx","triggerAttributes","handleClick","event","_child_props","_child_props_onClick","onClick","call","isDefaultPrevented","type","open","triggerChildProps","ref","ariaButtonTriggerChildProps"],"sources":["../../../src/components/DialogTrigger/useDialogTrigger.ts"],"sourcesContent":["import * as React from 'react';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';\nimport type { DialogTriggerProps, DialogTriggerState } from './DialogTrigger.types';\nimport { useDialogContext_unstable, useDialogSurfaceContext_unstable } from '../../contexts';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\n\n/**\n * Create the state required to render DialogTrigger.\n * Clones the only child component and adds necessary event handling behaviours to open a popup Dialog\n *\n * @param props - props from this instance of DialogTrigger\n */\nexport const useDialogTrigger_unstable = (props: DialogTriggerProps): DialogTriggerState => {\n const isInsideSurfaceDialog = useDialogSurfaceContext_unstable();\n\n const { children, disableButtonEnhancement = false, action = isInsideSurfaceDialog ? 'close' : 'open' } = props;\n\n const child = getTriggerChild(children);\n\n const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);\n\n const { triggerAttributes } = useModalAttributes();\n\n const handleClick = useEventCallback(\n (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>) => {\n child?.props.onClick?.(event);\n if (!event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n type: 'triggerClick',\n open: action === 'open',\n });\n }\n },\n );\n\n const triggerChildProps = {\n ...child?.props,\n ref: child?.ref,\n onClick: handleClick,\n ...triggerAttributes,\n } as const;\n\n const ariaButtonTriggerChildProps = useARIAButtonProps(\n child?.type === 'button' || child?.type === 'a' ? child.type : 'div',\n {\n ...triggerChildProps,\n type: 'button',\n },\n );\n\n return {\n children: applyTriggerPropsToChildren(\n children,\n disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps,\n ),\n };\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,kBAAkB,QAAQ;AACnC,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,gBAAgB,QAAQ;AAE/E,SAASC,yBAAyB,EAAEC,gCAAgC,QAAQ;AAC5E,SAASC,kBAAkB,QAAQ;AAEnC;;;;;;AAMA,OAAO,MAAMC,yBAAA,GAA6BC,KAAA,IAAkD;EAC1F,MAAMC,qBAAA,GAAwBJ,gCAAA;EAE9B,MAAM;IAAEK,QA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9E;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/DialogTrigger/DialogTrigger.js"],"sourcesContent":["import * as React from 'react';\nimport { useDialogTrigger_unstable } from './useDialogTrigger';\nimport { renderDialogTrigger_unstable } from './renderDialogTrigger';\n/**\n * A non-visual component that wraps its child\n * and configures them to be the trigger that will open or close a `Dialog`.\n * This component should only accept one child.\n *\n *
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/DialogTrigger/DialogTrigger.js"],"sourcesContent":["import * as React from 'react';\nimport { useDialogTrigger_unstable } from './useDialogTrigger';\nimport { renderDialogTrigger_unstable } from './renderDialogTrigger';\n/**\n * A non-visual component that wraps its child\n * and configures them to be the trigger that will open or close a `Dialog`.\n * This component should only accept one child.\n *\n * This component sole purpose is to avoid opting out of the internal controlled open state of a `Dialog`\n * Besides being a trigger that opens/close a dialog through context this component doesn't do much,\n * making it basically unnecessary in cases where the trigger is outside of the `Dialog` component.\n */\nexport const DialogTrigger = props => {\n const state = useDialogTrigger_unstable(props);\n return renderDialogTrigger_unstable(state);\n};\nDialogTrigger.displayName = 'DialogTrigger';\n// type casting here is required to ensure internal type FluentTriggerComponent is not leaked\nDialogTrigger.isFluentTriggerComponent = true;\n//# sourceMappingURL=DialogTrigger.js.map"],"names":["DialogTrigger","props","state","useDialogTrigger_unstable","renderDialogTrigger_unstable","displayName","isFluentTriggerComponent"],"mappings":";;;;+BAYaA;;aAAAA;;;6DAZU;kCACmB;qCACG;AAUtC,MAAMA,gBAAgBC,CAAAA,QAAS;IACpC,MAAMC,QAAQC,IAAAA,2CAAyB,EAACF;IACxC,OAAOG,IAAAA,iDAA4B,EAACF;AACtC;AACAF,cAAcK,WAAW,GAAG;AAC5B,6FAA6F;AAC7FL,cAAcM,wBAAwB,GAAG,IAAI,EAC7C,yCAAyC"}
|
|
@@ -17,7 +17,6 @@ const useDialogTrigger_unstable = (props)=>{
|
|
|
17
17
|
const { children , disableButtonEnhancement =false , action =isInsideSurfaceDialog ? 'close' : 'open' } = props;
|
|
18
18
|
const child = (0, _reactUtilities.getTriggerChild)(children);
|
|
19
19
|
const requestOpenChange = (0, _contexts.useDialogContext_unstable)((ctx)=>ctx.requestOpenChange);
|
|
20
|
-
const open = (0, _contexts.useDialogContext_unstable)((ctx)=>ctx.open);
|
|
21
20
|
const { triggerAttributes } = (0, _reactTabster.useModalAttributes)();
|
|
22
21
|
const handleClick = (0, _reactUtilities.useEventCallback)((event)=>{
|
|
23
22
|
var _child_props, _child_props_onClick;
|
|
@@ -32,7 +31,6 @@ const useDialogTrigger_unstable = (props)=>{
|
|
|
32
31
|
});
|
|
33
32
|
const triggerChildProps = {
|
|
34
33
|
...child === null || child === void 0 ? void 0 : child.props,
|
|
35
|
-
'aria-expanded': open,
|
|
36
34
|
ref: child === null || child === void 0 ? void 0 : child.ref,
|
|
37
35
|
onClick: handleClick,
|
|
38
36
|
...triggerAttributes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/components/DialogTrigger/useDialogTrigger.js"],"sourcesContent":["import * as React from 'react';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';\nimport { useDialogContext_unstable, useDialogSurfaceContext_unstable } from '../../contexts';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\n/**\n * Create the state required to render DialogTrigger.\n * Clones the only child component and adds necessary event handling behaviours to open a popup Dialog\n *\n * @param props - props from this instance of DialogTrigger\n */\nexport const useDialogTrigger_unstable = props => {\n const isInsideSurfaceDialog = useDialogSurfaceContext_unstable();\n const {\n children,\n disableButtonEnhancement = false,\n action = isInsideSurfaceDialog ? 'close' : 'open'\n } = props;\n const child = getTriggerChild(children);\n const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);\n const
|
|
1
|
+
{"version":3,"sources":["../../../lib/components/DialogTrigger/useDialogTrigger.js"],"sourcesContent":["import * as React from 'react';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities';\nimport { useDialogContext_unstable, useDialogSurfaceContext_unstable } from '../../contexts';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\n/**\n * Create the state required to render DialogTrigger.\n * Clones the only child component and adds necessary event handling behaviours to open a popup Dialog\n *\n * @param props - props from this instance of DialogTrigger\n */\nexport const useDialogTrigger_unstable = props => {\n const isInsideSurfaceDialog = useDialogSurfaceContext_unstable();\n const {\n children,\n disableButtonEnhancement = false,\n action = isInsideSurfaceDialog ? 'close' : 'open'\n } = props;\n const child = getTriggerChild(children);\n const requestOpenChange = useDialogContext_unstable(ctx => ctx.requestOpenChange);\n const {\n triggerAttributes\n } = useModalAttributes();\n const handleClick = useEventCallback(event => {\n var _child_props, _child_props_onClick;\n (_child_props_onClick = (_child_props = child === null || child === void 0 ? void 0 : child.props).onClick) === null || _child_props_onClick === void 0 ? void 0 : _child_props_onClick.call(_child_props, event);\n if (!event.isDefaultPrevented()) {\n requestOpenChange({\n event,\n type: 'triggerClick',\n open: action === 'open'\n });\n }\n });\n const triggerChildProps = {\n ...(child === null || child === void 0 ? void 0 : child.props),\n ref: child === null || child === void 0 ? void 0 : child.ref,\n onClick: handleClick,\n ...triggerAttributes\n };\n const ariaButtonTriggerChildProps = useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', {\n ...triggerChildProps,\n type: 'button'\n });\n return {\n children: applyTriggerPropsToChildren(children, disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps)\n };\n};\n//# sourceMappingURL=useDialogTrigger.js.map"],"names":["useDialogTrigger_unstable","props","isInsideSurfaceDialog","useDialogSurfaceContext_unstable","children","disableButtonEnhancement","action","child","getTriggerChild","requestOpenChange","useDialogContext_unstable","ctx","triggerAttributes","useModalAttributes","handleClick","useEventCallback","event","_child_props","_child_props_onClick","onClick","call","isDefaultPrevented","type","open","triggerChildProps","ref","ariaButtonTriggerChildProps","useARIAButtonProps","applyTriggerPropsToChildren"],"mappings":";;;;+BAWaA;;aAAAA;;;6DAXU;8BACY;gCAC4C;0BACH;2BACzC;AAO5B,MAAMA,4BAA4BC,CAAAA,QAAS;IAChD,MAAMC,wBAAwBC,IAAAA,0CAAgC;IAC9D,MAAM,EACJC,SAAQ,EACRC,0BAA2B,KAAK,CAAA,EAChCC,QAASJ,wBAAwB,UAAU,MAAM,CAAA,EAClD,GAAGD;IACJ,MAAMM,QAAQC,IAAAA,+BAAe,EAACJ;IAC9B,MAAMK,oBAAoBC,IAAAA,mCAAyB,EAACC,CAAAA,MAAOA,IAAIF,iBAAiB;IAChF,MAAM,EACJG,kBAAiB,EAClB,GAAGC,IAAAA,gCAAkB;IACtB,MAAMC,cAAcC,IAAAA,gCAAgB,EAACC,CAAAA,QAAS;QAC5C,IAAIC,cAAcC;QACjBA,CAAAA,uBAAuB,AAACD,CAAAA,eAAeV,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAI,KAAK,IAAIA,MAAMN,KAAK,AAAD,EAAGkB,OAAO,AAAD,MAAO,IAAI,IAAID,yBAAyB,KAAK,IAAI,KAAK,IAAIA,qBAAqBE,IAAI,CAACH,cAAcD,MAAM;QACjN,IAAI,CAACA,MAAMK,kBAAkB,IAAI;YAC/BZ,kBAAkB;gBAChBO;gBACAM,MAAM;gBACNC,MAAMjB,WAAW;YACnB;QACF,CAAC;IACH;IACA,MAAMkB,oBAAoB;QACxB,GAAIjB,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAI,KAAK,IAAIA,MAAMN,KAAK;QAC7DwB,KAAKlB,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAI,KAAK,IAAIA,MAAMkB,GAAG;QAC5DN,SAASL;QACT,GAAGF,iBAAiB;IACtB;IACA,MAAMc,8BAA8BC,IAAAA,6BAAkB,EAAC,AAACpB,CAAAA,UAAU,IAAI,IAAIA,UA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