@viasat/beam-react 2.10.1 → 2.11.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/chunks/{FloatingUI.context.2kPXcTvi.js → FloatingUI.context.DtJA57si.js} +123 -109
- package/chunks/FloatingUI.context.Du9g2lSg.js +1 -0
- package/lib/Dialog/Dialog.Header.cjs.js +1 -1
- package/lib/Dialog/Dialog.Header.es.js +1 -1
- package/lib/Dialog/Dialog.Trigger.cjs.js +1 -1
- package/lib/Dialog/Dialog.Trigger.es.js +1 -1
- package/lib/Dialog/Dialog.d.ts +1 -1
- package/lib/FloatingUI/FloatingUI.content.cjs.js +1 -1
- package/lib/FloatingUI/FloatingUI.content.es.js +1 -2
- package/lib/FloatingUI/FloatingUI.context.cjs.js +1 -1
- package/lib/FloatingUI/FloatingUI.context.d.ts +7 -2
- package/lib/FloatingUI/FloatingUI.context.es.js +1 -1
- package/lib/FloatingUI/FloatingUI.root.cjs.js +1 -1
- package/lib/FloatingUI/FloatingUI.root.es.js +1 -1
- package/lib/FloatingUI/FloatingUI.trigger.cjs.js +1 -1
- package/lib/FloatingUI/FloatingUI.trigger.close.cjs.js +1 -1
- package/lib/FloatingUI/FloatingUI.trigger.close.es.js +1 -1
- package/lib/FloatingUI/FloatingUI.trigger.es.js +1 -1
- package/lib/Menu/ActionListContextWrapper.cjs.js +1 -1
- package/lib/Menu/ActionListContextWrapper.es.js +1 -1
- package/lib/Menu/Menu.cjs.js +1 -1
- package/lib/Menu/Menu.d.ts +1 -1
- package/lib/Menu/Menu.es.js +42 -40
- package/lib/Popover/Popover.content.cjs.js +1 -1
- package/lib/Popover/Popover.content.es.js +1 -1
- package/lib/Popover/Popover.d.ts +6 -1
- package/lib/Popover/Popover.trigger.cjs.js +1 -1
- package/lib/Popover/Popover.trigger.es.js +1 -1
- package/lib/Tooltip/Tooltip.cjs.js +1 -1
- package/lib/Tooltip/Tooltip.es.js +1 -1
- package/lib/wip/Panel/Panel.Header.Row.cjs.js +1 -1
- package/lib/wip/Panel/Panel.Header.Row.es.js +17 -17
- package/lib/wip/Panel/Panel.cjs.js +1 -1
- package/lib/wip/Panel/Panel.context.d.ts +6 -5
- package/lib/wip/Panel/Panel.d.ts +1 -1
- package/lib/wip/Panel/Panel.es.js +69 -68
- package/lib/wip/Panel/Panel.helpers.cjs.js +1 -1
- package/lib/wip/Panel/Panel.helpers.d.ts +6 -1
- package/lib/wip/Panel/Panel.helpers.es.js +49 -27
- package/lib/wip/Panel/Panel.types.d.ts +34 -0
- package/lib/wip/Panel/index.d.ts +1 -1
- package/package.json +6 -6
- package/chunks/FloatingUI.context.BULqADss.js +0 -1
package/lib/Menu/Menu.es.js
CHANGED
|
@@ -1,52 +1,53 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as b, useRef as I, useCallback as
|
|
3
|
-
import { Popover as
|
|
4
|
-
import { useMenuContext as
|
|
5
|
-
import { MenuPopoverContent as
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useState as b, useRef as I, useCallback as u, useMemo as y } from "react";
|
|
3
|
+
import { Popover as M } from "../Popover/Popover.es.js";
|
|
4
|
+
import { useMenuContext as W, MenuContext as D } from "./Menu.context.es.js";
|
|
5
|
+
import { MenuPopoverContent as z } from "./Menu.PopoverContent.es.js";
|
|
6
6
|
import { MenuTrigger as E } from "./Menu.Trigger.es.js";
|
|
7
7
|
import { safePolygon as _ } from "@floating-ui/react";
|
|
8
8
|
import { ActionListContextWrapper as j } from "./ActionListContextWrapper.es.js";
|
|
9
9
|
import { useActionListContext as K } from "../ActionList/ActionList.context.es.js";
|
|
10
|
-
const S = "12rem",
|
|
10
|
+
const S = "12rem", m = ({
|
|
11
11
|
children: A,
|
|
12
|
-
open:
|
|
13
|
-
onOpenChange:
|
|
14
|
-
maxHeight:
|
|
12
|
+
open: F,
|
|
13
|
+
onOpenChange: P,
|
|
14
|
+
maxHeight: r,
|
|
15
15
|
minWidth: f,
|
|
16
16
|
maxWidth: d,
|
|
17
|
+
size: R,
|
|
17
18
|
...o
|
|
18
19
|
}) => {
|
|
19
|
-
const e =
|
|
20
|
-
(
|
|
21
|
-
|
|
20
|
+
const e = W(), [p, h] = b(null), v = I([]), g = I([]), t = e === void 0, n = !t, [T, k] = b(o.defaultOpen ?? !1), w = F ?? T, s = P ?? k, O = u(
|
|
21
|
+
(i) => {
|
|
22
|
+
s(!1, i, "click"), e == null || e.close();
|
|
22
23
|
},
|
|
23
|
-
[
|
|
24
|
-
), C =
|
|
25
|
-
(
|
|
26
|
-
e == null || e.open(
|
|
24
|
+
[s, e]
|
|
25
|
+
), C = u(
|
|
26
|
+
(i) => {
|
|
27
|
+
e == null || e.open(i), s(!0);
|
|
27
28
|
},
|
|
28
|
-
[
|
|
29
|
-
),
|
|
29
|
+
[s, e]
|
|
30
|
+
), l = y(
|
|
30
31
|
() => ({
|
|
31
32
|
parentMenuContext: e,
|
|
32
33
|
minWidth: f ?? (e == null ? void 0 : e.minWidth) ?? S,
|
|
33
34
|
maxWidth: d ?? (e == null ? void 0 : e.maxWidth),
|
|
34
|
-
maxHeight:
|
|
35
|
+
maxHeight: r ?? (e == null ? void 0 : e.maxHeight),
|
|
35
36
|
close: O,
|
|
36
37
|
open: C
|
|
37
38
|
}),
|
|
38
|
-
[O,
|
|
39
|
-
),
|
|
40
|
-
(
|
|
41
|
-
|
|
39
|
+
[O, r, d, f, C, e]
|
|
40
|
+
), x = u(
|
|
41
|
+
(i, c, H) => {
|
|
42
|
+
c !== "checkbox" && c !== "radio" && c !== "flyout" && l.close(H);
|
|
42
43
|
},
|
|
43
|
-
[
|
|
44
|
-
),
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
|
|
44
|
+
[l]
|
|
45
|
+
), L = y(() => [m], []), N = K();
|
|
46
|
+
return /* @__PURE__ */ a(D.Provider, { value: l, children: /* @__PURE__ */ a(
|
|
47
|
+
M,
|
|
47
48
|
{
|
|
48
|
-
open:
|
|
49
|
-
onOpenChange:
|
|
49
|
+
open: w,
|
|
50
|
+
onOpenChange: s,
|
|
50
51
|
placement: t ? "bottom-start" : "right-start",
|
|
51
52
|
openOnClick: t,
|
|
52
53
|
openOnHover: {
|
|
@@ -58,6 +59,7 @@ const S = "12rem", u = ({
|
|
|
58
59
|
})
|
|
59
60
|
},
|
|
60
61
|
openOnFocus: n,
|
|
62
|
+
size: R ?? !r,
|
|
61
63
|
flip: !0,
|
|
62
64
|
hideArrow: !0,
|
|
63
65
|
portalled: o.portalled ?? !0,
|
|
@@ -73,7 +75,7 @@ const S = "12rem", u = ({
|
|
|
73
75
|
},
|
|
74
76
|
listNavigation: {
|
|
75
77
|
enabled: !0,
|
|
76
|
-
listRef:
|
|
78
|
+
listRef: v,
|
|
77
79
|
activeIndex: p,
|
|
78
80
|
onNavigate: h,
|
|
79
81
|
loop: !0,
|
|
@@ -85,7 +87,7 @@ const S = "12rem", u = ({
|
|
|
85
87
|
},
|
|
86
88
|
typeahead: {
|
|
87
89
|
enabled: !0,
|
|
88
|
-
listRef:
|
|
90
|
+
listRef: g,
|
|
89
91
|
activeIndex: p,
|
|
90
92
|
onMatch: h,
|
|
91
93
|
...o.typeahead
|
|
@@ -95,24 +97,24 @@ const S = "12rem", u = ({
|
|
|
95
97
|
role: "menu",
|
|
96
98
|
...o.role
|
|
97
99
|
},
|
|
98
|
-
children: /* @__PURE__ */
|
|
100
|
+
children: /* @__PURE__ */ a(
|
|
99
101
|
j,
|
|
100
102
|
{
|
|
101
|
-
elementsRef:
|
|
102
|
-
labelsRef:
|
|
103
|
+
elementsRef: v,
|
|
104
|
+
labelsRef: g,
|
|
103
105
|
itemsFocusable: !1,
|
|
104
|
-
onItemClick:
|
|
106
|
+
onItemClick: x,
|
|
105
107
|
insideMenu: !0,
|
|
106
|
-
allowChildrenTypes:
|
|
107
|
-
parentContext:
|
|
108
|
+
allowChildrenTypes: L,
|
|
109
|
+
parentContext: N,
|
|
108
110
|
children: A
|
|
109
111
|
}
|
|
110
112
|
)
|
|
111
113
|
}
|
|
112
114
|
) });
|
|
113
115
|
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
+
m.Trigger = E;
|
|
117
|
+
m.PopoverContent = z;
|
|
116
118
|
export {
|
|
117
|
-
|
|
119
|
+
m as Menu
|
|
118
120
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),u=require("clsx"),l=require("../../chunks/popover.module.Dum8SaSU.js"),p=require("../../chunks/classNames.DAeKwerT.js"),t=require("../../chunks/constants.hwjHOsvT.js");require("../../chunks/FloatingUI.context.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),u=require("clsx"),l=require("../../chunks/popover.module.Dum8SaSU.js"),p=require("../../chunks/classNames.DAeKwerT.js"),t=require("../../chunks/constants.hwjHOsvT.js");require("../../chunks/FloatingUI.context.Du9g2lSg.js");require("react");require("@floating-ui/react");const m=require("../FloatingUI/FloatingUI.content.cjs.js"),q=require("./Popover.context.cjs.js");function o({children:r,className:n,...s}){const{theme:e,appearance:i}=q.usePopoverContext(),{baseClassNamePrefix:a}=p.getBEMClassNames("popover");return c.jsx(m.Content,{className:u(e&&t.themeClassName(e),l.popoverStyles[a],i==="inverse"&&t.BEAM_INVERSE,n),...s,children:r})}o.displayName="Popover.Content";exports.Content=o;
|
|
@@ -3,7 +3,7 @@ import a from "clsx";
|
|
|
3
3
|
import { p as n } from "../../chunks/popover.module.C6KFea25.js";
|
|
4
4
|
import { g as i } from "../../chunks/classNames.BTJmrO_L.js";
|
|
5
5
|
import { t as f, c as C } from "../../chunks/constants.CKKGf1-i.js";
|
|
6
|
-
import "../../chunks/FloatingUI.context.
|
|
6
|
+
import "../../chunks/FloatingUI.context.DtJA57si.js";
|
|
7
7
|
import "react";
|
|
8
8
|
import "@floating-ui/react";
|
|
9
9
|
import { Content as c } from "../FloatingUI/FloatingUI.content.es.js";
|
package/lib/Popover/Popover.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Trigger, CloseTrigger } from './Popover.trigger';
|
|
|
4
4
|
import { FloatingUIProps } from '../FloatingUI/FloatingUI.context';
|
|
5
5
|
import { Spacing, ThemeTypes } from '@viasat/beam-shared/utils';
|
|
6
6
|
import { MiddlewareModifier } from '@viasat/beam-shared/components/floatingui';
|
|
7
|
-
import { Placement, AutoPlacementOptions, FlipOptions, ShiftOptions, HideOptions, OffsetOptions, UseHoverProps, UseClickProps, UseFocusProps, FloatingPortalProps, UseFloatingOptions, UseRoleProps } from '@floating-ui/react';
|
|
7
|
+
import { Placement, AutoPlacementOptions, FlipOptions, ShiftOptions, HideOptions, OffsetOptions, UseHoverProps, UseClickProps, UseFocusProps, FloatingPortalProps, UseFloatingOptions, UseRoleProps, SizeOptions } from '@floating-ui/react';
|
|
8
8
|
import { FocusManagerProps } from '../FloatingUI/FloatingUI.content';
|
|
9
9
|
export interface PopoverProps extends Omit<FloatingUIProps, 'arrow' | 'offset'> {
|
|
10
10
|
/**
|
|
@@ -57,6 +57,11 @@ export interface PopoverProps extends Omit<FloatingUIProps, 'arrow' | 'offset'>
|
|
|
57
57
|
* <a href="https://floating-ui.com/docs/hide#options" target="_blank" rel="noopener noreferrer">HideOptions</a>
|
|
58
58
|
*/
|
|
59
59
|
autoHiding?: boolean | HideOptions;
|
|
60
|
+
/**
|
|
61
|
+
* Constrain the floating element's size to fit within available space.
|
|
62
|
+
* <a href="https://floating-ui.com/docs/size#options" target="_blank" rel="noopener noreferrer">SizeOptions</a>
|
|
63
|
+
*/
|
|
64
|
+
size?: boolean | SizeOptions;
|
|
60
65
|
/**
|
|
61
66
|
* Middleware functions to modify the behavior of the floating element
|
|
62
67
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime");require("../../chunks/FloatingUI.context.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime");require("../../chunks/FloatingUI.context.Du9g2lSg.js");const t=require("../FloatingUI/FloatingUI.trigger.cjs.js"),s=require("../FloatingUI/FloatingUI.trigger.close.cjs.js");require("../FloatingUI/FloatingUI.content.cjs.js");require("react");const g=({children:e,...r})=>i.jsx(t.Trigger,{...r,children:e});g.displayName="Popover.Trigger";const o=({children:e,...r})=>i.jsx(s.CloseTrigger,{...r,children:e});o.displayName="Popover.CloseTrigger";exports.CloseTrigger=o;exports.Trigger=g;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import "../../chunks/FloatingUI.context.
|
|
2
|
+
import "../../chunks/FloatingUI.context.DtJA57si.js";
|
|
3
3
|
import { Trigger as g } from "../FloatingUI/FloatingUI.trigger.es.js";
|
|
4
4
|
import { CloseTrigger as i } from "../FloatingUI/FloatingUI.trigger.close.es.js";
|
|
5
5
|
import "../FloatingUI/FloatingUI.content.es.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var N=require("../../assets/Tooltip.css");Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),g=require("react"),h=require("../FloatingUI/FloatingUI.root.cjs.js"),d=require("../FloatingUI/FloatingUI.trigger.cjs.js");require("../../chunks/FloatingUI.context.
|
|
1
|
+
var N=require("../../assets/Tooltip.css");Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),g=require("react"),h=require("../FloatingUI/FloatingUI.root.cjs.js"),d=require("../FloatingUI/FloatingUI.trigger.cjs.js");require("../../chunks/FloatingUI.context.Du9g2lSg.js");const w=require("../FloatingUI/FloatingUI.content.cjs.js"),p=require("../../chunks/tokens.Bc11gmpN.js"),j=require("../../chunks/classNames.DAeKwerT.js");require("../../chunks/constants.hwjHOsvT.js");const u=require("../../utils/hooks/index.cjs.js"),x=require("clsx"),b=require("../../chunks/CSSLookup.DESAWWRT.js"),l={"bm-light":"bm-light","bm-dark":"bm-dark","bm-inverse":"bm-inverse","bm-tooltip__icon-trigger":"bm-tooltip__icon-trigger","bm-tooltip":"bm-tooltip","bm-tooltip__arrow":"bm-tooltip__arrow","bm-tooltip__icon-trigger--disabled":"bm-tooltip__icon-trigger--disabled","bm-tooltip__icon-trigger--xs":"bm-tooltip__icon-trigger--xs","bm-tooltip__icon-trigger--sm":"bm-tooltip__icon-trigger--sm","bm-tooltip__icon-trigger--md":"bm-tooltip__icon-trigger--md","bm-tooltip__icon-trigger--lg":"bm-tooltip__icon-trigger--lg","bm-tooltip__icon-trigger--xl":"bm-tooltip__icon-trigger--xl"},{baseClassNamePrefix:I,subElementClassPrefix:_}=j.getBEMClassNames("tooltip");function f({children:e,portalled:r=!1,text:i,disabled:t,showDelay:a,role:c,...n}){const s=u.useCSSLookup(p.bmCompTooltipSpaceArrow),m=u.useCSSLookup(p.bmCompTooltipSpaceOffset),C=g.useMemo(()=>({edgePadding:b.parseSizeString(s),className:l[`${_}arrow`],hide:!1}),[s]),T=t?{}:{openOnHover:{restMs:a},openOnFocus:!0,openOnSelected:!0},q=c||{enabled:!0,role:"tooltip"};return o.jsxs(h.FloatingUIRoot,{...T,arrow:C,offset:b.parseSizeString(m),portalled:r,transitionConfig:{duration:{open:0,close:200}},role:q,...n,children:[o.jsx(S.Provider,{value:{disabled:t},children:o.jsx(d.Trigger,{children:e})}),o.jsx(F,{theme:n.theme,children:i})]})}const S=g.createContext({disabled:!1}),k=g.forwardRef(({children:e,size:r="md",type:i="button",className:t,...a},c)=>{const{disabled:n}=g.useContext(S),s=`${_}icon-trigger`,m=x(l[`${s}--${r}`],l[s],n&&l[`${_}icon-trigger--disabled`],t);return o.jsx(d.Trigger,{children:o.jsx("button",{ref:c,type:i,disabled:n,className:m,...a,"aria-label":"tooltip trigger",children:e})})});function F({children:e,theme:r,className:i,...t}){return o.jsx(w.Content,{className:x(r,l[I],i),...t,children:e})}exports.Tooltip=f;exports.TooltipIconTrigger=k;exports.default=f;
|
|
@@ -3,7 +3,7 @@ import { jsx as t, jsxs as w } from "react/jsx-runtime";
|
|
|
3
3
|
import { createContext as h, forwardRef as T, useContext as S, useMemo as N } from "react";
|
|
4
4
|
import { FloatingUIRoot as P } from "../FloatingUI/FloatingUI.root.es.js";
|
|
5
5
|
import { Trigger as _ } from "../FloatingUI/FloatingUI.trigger.es.js";
|
|
6
|
-
import "../../chunks/FloatingUI.context.
|
|
6
|
+
import "../../chunks/FloatingUI.context.DtJA57si.js";
|
|
7
7
|
import { Content as k } from "../FloatingUI/FloatingUI.content.es.js";
|
|
8
8
|
import { j as v, k as O } from "../../chunks/tokens.BD_71qmL.js";
|
|
9
9
|
import { g as $ } from "../../chunks/classNames.BTJmrO_L.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("clsx"),m=require("../../../chunks/classNames.DAeKwerT.js");require("../../../chunks/constants.hwjHOsvT.js");const _=require("../../CloseButton/CloseButton.cjs.js"),b=require("./Panel.context.cjs.js"),s=require("../../../chunks/panel.module.BX1x4FlX.js"),{subElementClassPrefix:C}=m.getBEMClassNames("panel"),t=`${C}header`,l=({children:o,className:n,...a})=>{const{dismissible:r,closeButtonAriaLabel:i,requestClose:c}=b.usePanelContext(),u=d(s.styles[`${t}__row`],n);return e.jsxs("div",{className:u,...a,children:[o,r&&e.jsx("div",{className:s.styles[`${t}__close-button`],children:e.jsx(_.CloseButton,{"aria-label":i,onClick:()=>c("closeButton"),size:"lg"})})]})};l.displayName="Panel.Header.Row";exports.Row=l;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as c, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import p from "clsx";
|
|
3
3
|
import { g as d } from "../../../chunks/classNames.BTJmrO_L.js";
|
|
4
4
|
import "../../../chunks/constants.CKKGf1-i.js";
|
|
5
|
-
import { CloseButton as
|
|
6
|
-
import { usePanelContext as
|
|
7
|
-
import { s as
|
|
8
|
-
const { subElementClassPrefix:
|
|
9
|
-
children:
|
|
10
|
-
className:
|
|
11
|
-
...
|
|
5
|
+
import { CloseButton as u } from "../../CloseButton/CloseButton.es.js";
|
|
6
|
+
import { usePanelContext as f } from "./Panel.context.es.js";
|
|
7
|
+
import { s as e } from "../../../chunks/panel.module.BVm3KvDs.js";
|
|
8
|
+
const { subElementClassPrefix: C } = d("panel"), o = `${C}header`, b = ({
|
|
9
|
+
children: t,
|
|
10
|
+
className: l,
|
|
11
|
+
...a
|
|
12
12
|
}) => {
|
|
13
|
-
const { dismissible:
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const { dismissible: r, closeButtonAriaLabel: i, requestClose: m } = f(), n = p(e[`${o}__row`], l);
|
|
14
|
+
return /* @__PURE__ */ c("div", { className: n, ...a, children: [
|
|
15
|
+
t,
|
|
16
|
+
r && /* @__PURE__ */ s("div", { className: e[`${o}__close-button`], children: /* @__PURE__ */ s(
|
|
17
|
+
u,
|
|
18
18
|
{
|
|
19
|
-
"aria-label":
|
|
20
|
-
onClick: () =>
|
|
19
|
+
"aria-label": i,
|
|
20
|
+
onClick: () => m("closeButton"),
|
|
21
21
|
size: "lg"
|
|
22
22
|
}
|
|
23
23
|
) })
|
|
24
24
|
] });
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
b.displayName = "Panel.Header.Row";
|
|
27
27
|
export {
|
|
28
|
-
|
|
28
|
+
b as Row
|
|
29
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("clsx"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("clsx"),U=require("../../../chunks/classNames.DAeKwerT.js");require("../../../chunks/constants.hwjHOsvT.js");const N=require("./Panel.context.cjs.js"),B=require("./Panel.Header.cjs.js"),T=require("./Panel.Body.cjs.js"),A=require("./Panel.Footer.cjs.js"),t=require("./Panel.helpers.cjs.js"),H=require("../../FloatingUI/FloatingUI.root.cjs.js"),M=require("../../FloatingUI/FloatingUI.content.cjs.js"),E=require("../../Divider/Divider.cjs.js"),n=require("../../../chunks/panel.module.BX1x4FlX.js"),{baseClassNamePrefix:s}=U.getBEMClassNames("panel"),a=({position:o,className:d})=>e.jsx(E.Divider,{borderColor:"01",orientation:o==="bottom"?"horizontal":"vertical",className:d}),l=({children:o,className:d,padding:j="md",onOpenChange:q,open:v,size:c,dismissible:C=!0,closeButtonAriaLabel:$="Close panel",kind:r="inline",position:p,divider:h=!0,isAnimated:P=!0,onBeforeClose:I,...y})=>{const i=t.getResolvedPanelPosition(p),x=u(n.styles[s],n.styles[`${s}--${r}`],c&&n.styles[`${s}--size-${c}`],n.styles[`${s}--padding-${j}`],n.styles[`${s}--position-${i}`],d),f=u(n.styles[`${s}__inline-wrapper`],c==="full"&&n.styles[`${s}__inline-wrapper--full`]),{requestClose:w,handleOverlayOpenChange:D}=t.usePanelClose(I,q),m={dismissible:C,closeButtonAriaLabel:$,position:p,requestClose:w},{inlineStatus:F,isInlineVisible:b}=t.useInlineTransition(r==="inline"?v:void 0,P),{showDivider:g,dividerBefore:S,dividerAfter:O}=t.getPanelDividerState(h,i),R=r==="overlay"?u(n.styles[`${s}__overlay-divider`],n.styles[`${s}__overlay-divider--${i}`]):void 0,_=g&&b;return r==="inline"?b?e.jsxs(N.PanelContext.Provider,{value:m,children:[S&&_&&e.jsx(a,{position:i}),e.jsx("div",{className:f,"data-position":i,"data-status":F,children:e.jsxs("div",{className:n.styles[`${s}__inline-wrapper-content`],children:[i==="bottom"&&_&&e.jsx(a,{position:i}),e.jsx("aside",{className:x,...y,children:o})]})}),O&&_&&e.jsx(a,{position:i})]}):null:e.jsx(N.PanelContext.Provider,{value:m,children:e.jsx(H.FloatingUIRoot,{open:v,onOpenChange:D,portalled:!0,transitionConfig:{duration:P?t.PANEL_TRANSITION_DURATION_MS:0},children:e.jsxs(M.Content,{className:x,skipFloatingStyles:!0,overlay:!0,...y,"data-position":i,children:[o,g&&e.jsx(a,{position:i,className:R})]})})})};l.displayName="Panel";l.Header=B.Header;l.Body=T.Body;l.Footer=A.Footer;exports.Panel=l;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PanelPosition } from './Panel.types';
|
|
1
|
+
import { PanelCloseReason, PanelPosition } from './Panel.types';
|
|
2
2
|
export interface PanelContextValue {
|
|
3
3
|
/**
|
|
4
4
|
* Whether to show a dismissible button
|
|
@@ -8,14 +8,15 @@ export interface PanelContextValue {
|
|
|
8
8
|
* Aria label for the dismissible button
|
|
9
9
|
*/
|
|
10
10
|
closeButtonAriaLabel?: string;
|
|
11
|
-
/**
|
|
12
|
-
* Callback when panel open state changes
|
|
13
|
-
*/
|
|
14
|
-
onOpenChange?: (open: boolean) => void;
|
|
15
11
|
/**
|
|
16
12
|
* Panel position (determines divider placement)
|
|
17
13
|
*/
|
|
18
14
|
position?: PanelPosition;
|
|
15
|
+
/**
|
|
16
|
+
* Request the panel to close for the given reason. Runs `onBeforeClose` if
|
|
17
|
+
* provided and only calls `onOpenChange(false)` when the guard returns `true`.
|
|
18
|
+
*/
|
|
19
|
+
requestClose: (reason: PanelCloseReason) => void;
|
|
19
20
|
}
|
|
20
21
|
export declare const PanelContext: import('react').Context<PanelContextValue | undefined>;
|
|
21
22
|
export declare const usePanelContext: () => PanelContextValue;
|
package/lib/wip/Panel/Panel.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PanelProps } from './Panel.types';
|
|
2
2
|
export declare const Panel: {
|
|
3
|
-
({ children, className: _className, padding, onOpenChange, open, size, dismissible, closeButtonAriaLabel, kind, position, divider, isAnimated, ...props }: PanelProps): JSX.Element | null;
|
|
3
|
+
({ children, className: _className, padding, onOpenChange, open, size, dismissible, closeButtonAriaLabel, kind, position, divider, isAnimated, onBeforeClose, ...props }: PanelProps): JSX.Element | null;
|
|
4
4
|
displayName: string;
|
|
5
5
|
Header: {
|
|
6
6
|
({ children, className: _className, divider, ...props }: import('./Panel.Header').PanelHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,105 +1,106 @@
|
|
|
1
1
|
import { jsxs as p, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import v from "clsx";
|
|
3
|
-
import { g as
|
|
3
|
+
import { g as A } from "../../../chunks/classNames.BTJmrO_L.js";
|
|
4
4
|
import "../../../chunks/constants.CKKGf1-i.js";
|
|
5
|
-
import { PanelContext as
|
|
6
|
-
import { Header as
|
|
7
|
-
import { Body as
|
|
8
|
-
import { Footer as
|
|
9
|
-
import { useInlineTransition as
|
|
10
|
-
import { FloatingUIRoot as
|
|
11
|
-
import { Content as
|
|
12
|
-
import { Divider as
|
|
13
|
-
import { s as
|
|
14
|
-
const { baseClassNamePrefix:
|
|
5
|
+
import { PanelContext as h } from "./Panel.context.es.js";
|
|
6
|
+
import { Header as j } from "./Panel.Header.es.js";
|
|
7
|
+
import { Body as E } from "./Panel.Body.es.js";
|
|
8
|
+
import { Footer as H } from "./Panel.Footer.es.js";
|
|
9
|
+
import { usePanelClose as M, useInlineTransition as U, getPanelDividerState as V, PANEL_TRANSITION_DURATION_MS as q, getResolvedPanelPosition as L } from "./Panel.helpers.es.js";
|
|
10
|
+
import { FloatingUIRoot as W } from "../../FloatingUI/FloatingUI.root.es.js";
|
|
11
|
+
import { Content as z } from "../../FloatingUI/FloatingUI.content.es.js";
|
|
12
|
+
import { Divider as G } from "../../Divider/Divider.es.js";
|
|
13
|
+
import { s as o } from "../../../chunks/panel.module.BVm3KvDs.js";
|
|
14
|
+
const { baseClassNamePrefix: i } = A("panel"), a = ({
|
|
15
15
|
position: t,
|
|
16
|
-
className:
|
|
16
|
+
className: s
|
|
17
17
|
}) => /* @__PURE__ */ r(
|
|
18
|
-
|
|
18
|
+
G,
|
|
19
19
|
{
|
|
20
20
|
borderColor: "01",
|
|
21
21
|
orientation: t === "bottom" ? "horizontal" : "vertical",
|
|
22
|
-
className:
|
|
22
|
+
className: s
|
|
23
23
|
}
|
|
24
|
-
),
|
|
24
|
+
), l = ({
|
|
25
25
|
children: t,
|
|
26
|
-
className:
|
|
27
|
-
padding:
|
|
28
|
-
onOpenChange:
|
|
29
|
-
open:
|
|
26
|
+
className: s,
|
|
27
|
+
padding: y = "md",
|
|
28
|
+
onOpenChange: g,
|
|
29
|
+
open: c,
|
|
30
30
|
size: d,
|
|
31
|
-
dismissible:
|
|
31
|
+
dismissible: I = !0,
|
|
32
32
|
closeButtonAriaLabel: x = "Close panel",
|
|
33
33
|
kind: n = "inline",
|
|
34
34
|
position: u,
|
|
35
35
|
divider: D = !0,
|
|
36
|
-
isAnimated:
|
|
37
|
-
|
|
36
|
+
isAnimated: f = !0,
|
|
37
|
+
onBeforeClose: b,
|
|
38
|
+
...N
|
|
38
39
|
}) => {
|
|
39
|
-
const e =
|
|
40
|
-
i
|
|
41
|
-
|
|
42
|
-
d &&
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
),
|
|
47
|
-
|
|
48
|
-
d === "full" &&
|
|
49
|
-
),
|
|
50
|
-
dismissible:
|
|
40
|
+
const e = L(u), $ = v(
|
|
41
|
+
o[i],
|
|
42
|
+
o[`${i}--${n}`],
|
|
43
|
+
d && o[`${i}--size-${d}`],
|
|
44
|
+
o[`${i}--padding-${y}`],
|
|
45
|
+
o[`${i}--position-${e}`],
|
|
46
|
+
s
|
|
47
|
+
), O = v(
|
|
48
|
+
o[`${i}__inline-wrapper`],
|
|
49
|
+
d === "full" && o[`${i}__inline-wrapper--full`]
|
|
50
|
+
), { requestClose: R, handleOverlayOpenChange: S } = M(b, g), C = {
|
|
51
|
+
dismissible: I,
|
|
51
52
|
closeButtonAriaLabel: x,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}, { inlineStatus:
|
|
55
|
-
n === "inline" ?
|
|
56
|
-
|
|
57
|
-
), { showDivider:
|
|
53
|
+
position: u,
|
|
54
|
+
requestClose: R
|
|
55
|
+
}, { inlineStatus: w, isInlineVisible: _ } = U(
|
|
56
|
+
n === "inline" ? c : void 0,
|
|
57
|
+
f
|
|
58
|
+
), { showDivider: P, dividerBefore: B, dividerAfter: F } = V(
|
|
58
59
|
D,
|
|
59
60
|
e
|
|
60
|
-
),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
) : void 0, m =
|
|
64
|
-
return n === "inline" ?
|
|
65
|
-
|
|
61
|
+
), T = n === "overlay" ? v(
|
|
62
|
+
o[`${i}__overlay-divider`],
|
|
63
|
+
o[`${i}__overlay-divider--${e}`]
|
|
64
|
+
) : void 0, m = P && _;
|
|
65
|
+
return n === "inline" ? _ ? /* @__PURE__ */ p(h.Provider, { value: C, children: [
|
|
66
|
+
B && m && /* @__PURE__ */ r(a, { position: e }),
|
|
66
67
|
/* @__PURE__ */ r(
|
|
67
68
|
"div",
|
|
68
69
|
{
|
|
69
|
-
className:
|
|
70
|
+
className: O,
|
|
70
71
|
"data-position": e,
|
|
71
|
-
"data-status":
|
|
72
|
-
children: /* @__PURE__ */ p("div", { className:
|
|
73
|
-
e === "bottom" && m && /* @__PURE__ */ r(
|
|
74
|
-
/* @__PURE__ */ r("aside", { className:
|
|
72
|
+
"data-status": w,
|
|
73
|
+
children: /* @__PURE__ */ p("div", { className: o[`${i}__inline-wrapper-content`], children: [
|
|
74
|
+
e === "bottom" && m && /* @__PURE__ */ r(a, { position: e }),
|
|
75
|
+
/* @__PURE__ */ r("aside", { className: $, ...N, children: t })
|
|
75
76
|
] })
|
|
76
77
|
}
|
|
77
78
|
),
|
|
78
|
-
|
|
79
|
-
] }) : null : /* @__PURE__ */ r(
|
|
80
|
-
|
|
79
|
+
F && m && /* @__PURE__ */ r(a, { position: e })
|
|
80
|
+
] }) : null : /* @__PURE__ */ r(h.Provider, { value: C, children: /* @__PURE__ */ r(
|
|
81
|
+
W,
|
|
81
82
|
{
|
|
82
|
-
open:
|
|
83
|
-
onOpenChange:
|
|
83
|
+
open: c,
|
|
84
|
+
onOpenChange: S,
|
|
84
85
|
portalled: !0,
|
|
85
86
|
transitionConfig: {
|
|
86
|
-
duration:
|
|
87
|
+
duration: f ? q : 0
|
|
87
88
|
},
|
|
88
89
|
children: /* @__PURE__ */ p(
|
|
89
|
-
|
|
90
|
+
z,
|
|
90
91
|
{
|
|
91
|
-
className:
|
|
92
|
+
className: $,
|
|
92
93
|
skipFloatingStyles: !0,
|
|
93
94
|
overlay: !0,
|
|
94
|
-
|
|
95
|
+
...N,
|
|
95
96
|
"data-position": e,
|
|
96
97
|
children: [
|
|
97
98
|
t,
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
P && /* @__PURE__ */ r(
|
|
100
|
+
a,
|
|
100
101
|
{
|
|
101
102
|
position: e,
|
|
102
|
-
className:
|
|
103
|
+
className: T
|
|
103
104
|
}
|
|
104
105
|
)
|
|
105
106
|
]
|
|
@@ -108,10 +109,10 @@ const { baseClassNamePrefix: o } = F("panel"), l = ({
|
|
|
108
109
|
}
|
|
109
110
|
) });
|
|
110
111
|
};
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
l.displayName = "Panel";
|
|
113
|
+
l.Header = j;
|
|
114
|
+
l.Body = E;
|
|
115
|
+
l.Footer = H;
|
|
115
116
|
export {
|
|
116
|
-
|
|
117
|
+
l as Panel
|
|
117
118
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),a=400,f=e=>e||"end",o=(e,t)=>{const s=e&&t!=="full";return{showDivider:s,dividerBefore:s&&t!=="start"&&t!=="bottom",dividerAfter:s&&t==="start"}},m=e=>e==="escape-key"?"escapeKey":e==="outside-press"?"outsidePress":"programmatic",v=(e,t)=>{const s=c.useCallback(u=>{if(!e){t==null||t(!1);return}const r=e(u);r instanceof Promise?r.then(i=>{i&&(t==null||t(!1))}).catch(()=>{}):r&&(t==null||t(!1))},[e,t]),l=c.useCallback((u,r,i)=>{u?t==null||t(!0):s(m(i))},[t,s]);return{requestClose:s,handleOverlayOpenChange:l}},I=(e,t)=>{const[s,l]=c.useState(void 0),[u,r]=c.useState(e!==!1);return c.useEffect(()=>{if(!t){r(e!==!1),l(void 0);return}if(e!==void 0)if(e){r(!0),l("close");let i;const d=requestAnimationFrame(()=>{i=requestAnimationFrame(()=>l("open"))});return()=>{cancelAnimationFrame(d),cancelAnimationFrame(i)}}else{l("close");const i=setTimeout(()=>{r(!1),l(void 0)},a);return()=>clearTimeout(i)}},[t,e]),{inlineStatus:s,isInlineVisible:u}};exports.PANEL_TRANSITION_DURATION_MS=a;exports.getPanelDividerState=o;exports.getResolvedPanelPosition=f;exports.useInlineTransition=I;exports.usePanelClose=v;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OpenChangeReason } from '@floating-ui/react';
|
|
2
|
+
import { PanelCloseReason, PanelPosition, PanelProps } from './Panel.types';
|
|
2
3
|
export declare const PANEL_TRANSITION_DURATION_MS = 400;
|
|
3
4
|
export type PanelInlineStatus = 'open' | 'close' | undefined;
|
|
4
5
|
export declare const getResolvedPanelPosition: (position?: PanelPosition) => PanelPosition;
|
|
@@ -7,6 +8,10 @@ export declare const getPanelDividerState: (divider: boolean, position?: PanelPo
|
|
|
7
8
|
dividerBefore: boolean;
|
|
8
9
|
dividerAfter: boolean;
|
|
9
10
|
};
|
|
11
|
+
export declare const usePanelClose: (onBeforeClose: PanelProps["onBeforeClose"], onOpenChange: PanelProps["onOpenChange"]) => {
|
|
12
|
+
requestClose: (reason: PanelCloseReason) => void;
|
|
13
|
+
handleOverlayOpenChange: (nextOpen: boolean, _event?: Event, floatingReason?: OpenChangeReason) => void;
|
|
14
|
+
};
|
|
10
15
|
export declare const useInlineTransition: (open: boolean | undefined, isAnimated: boolean) => {
|
|
11
16
|
inlineStatus: PanelInlineStatus;
|
|
12
17
|
isInlineVisible: boolean;
|