@react-fabric/core 1.0.0-beta.18 → 1.0.0-beta.20
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/dist/cjs/components/badge/Badge.js +1 -1
- package/dist/cjs/components/chip/Chip.js +1 -1
- package/dist/cjs/components/chip/Chip.module.css +1 -1
- package/dist/cjs/components/icon/Icon.module.css +1 -1
- package/dist/cjs/components/panel/Panel.js +1 -1
- package/dist/cjs/components/tabpanel/TabPanel.js +1 -1
- package/dist/cjs/components/tabpanel/TabPanel.module.css +1 -1
- package/dist/cjs/core/section/Section.module.css +1 -1
- package/dist/cjs/overlays/flyout/Flyout.js +39 -42
- package/dist/cjs/overlays/modal/Modal.js +0 -2
- package/dist/esm/components/badge/Badge.js +1 -1
- package/dist/esm/components/chip/Chip.js +1 -1
- package/dist/esm/components/chip/Chip.module.css +1 -1
- package/dist/esm/components/icon/Icon.module.css +1 -1
- package/dist/esm/components/panel/Panel.js +1 -1
- package/dist/esm/components/tabpanel/TabPanel.js +1 -1
- package/dist/esm/components/tabpanel/TabPanel.module.css +1 -1
- package/dist/esm/core/section/Section.module.css +1 -1
- package/dist/esm/overlays/flyout/Flyout.js +39 -42
- package/dist/esm/overlays/modal/Modal.js +0 -2
- package/dist/types/components/tabpanel/TabPanel.d.ts +3 -3
- package/dist/types/index.d.ts +1 -0
- package/dist/types/types/index.d.ts +4 -1
- package/package.json +3 -3
- package/src/components/badge/Badge.tsx +1 -1
- package/src/components/chip/Chip.module.css +1 -1
- package/src/components/chip/Chip.tsx +1 -1
- package/src/components/icon/Icon.module.css +0 -1
- package/src/components/panel/Panel.tsx +1 -1
- package/src/components/tabpanel/TabPanel.module.css +0 -4
- package/src/components/tabpanel/TabPanel.tsx +4 -3
- package/src/core/section/Section.module.css +1 -1
- package/src/index.ts +1 -0
- package/src/overlays/flyout/Flyout.tsx +57 -61
- package/src/overlays/modal/Modal.tsx +0 -3
- package/src/types/index.ts +5 -9
|
@@ -67,7 +67,7 @@ var Badge = function Badge(_ref) {
|
|
|
67
67
|
"data-ref": "badge",
|
|
68
68
|
"data-ping": ping,
|
|
69
69
|
"data-placement": placement,
|
|
70
|
-
className: classNames(Badge_module.badge, className, "inline-block p-px min-w-2 min-h-2 text-center select-none rounded-full leading-none z-
|
|
70
|
+
className: classNames(Badge_module.badge, className, "inline-block p-px min-w-2 min-h-2 text-center select-none rounded-full leading-none z-2 pointer-events-none", forButton && !placement || inline ? "relative" : "absolute"),
|
|
71
71
|
children: [label && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
72
72
|
className: "p-1",
|
|
73
73
|
children: label
|
|
@@ -66,7 +66,7 @@ var Chip = function Chip(_ref) {
|
|
|
66
66
|
return /*#__PURE__*/jsxRuntime.jsxs(E, _objectSpread(_objectSpread({
|
|
67
67
|
ref: ref,
|
|
68
68
|
role: "term",
|
|
69
|
-
className: classNames(Chip_module.chip, className, color && getColor.getColorClass(color), "select-none inline-flex flex-nowrap items-center max-w-72 rounded", rounded && "rounded-full", !!onClick && Chip_module.clickable, disabled && Chip_module.disabled),
|
|
69
|
+
className: classNames(Chip_module.chip, className, color && getColor.getColorClass(color), "select-none inline-flex flex-nowrap items-center align-middle max-w-72 rounded", rounded && "rounded-full", !!onClick && Chip_module.clickable, disabled && Chip_module.disabled),
|
|
70
70
|
style: styles,
|
|
71
71
|
"data-variant": variant,
|
|
72
72
|
"data-inner-clickable": !!onClick,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer comp{.chip{--blank-gradient:linear-gradient(180deg,#00000005 0%,#0000 10%);background-image:var(--blank-gradient);color:theme(colors.tint.500);font-size:.875rem;outline:1px solid color-mix(in lab,currentcolor 20%,var(--fabric-bg));outline-offset:-1px;&>.chipLabel{line-height:1.
|
|
1
|
+
@layer comp{.chip{--blank-gradient:linear-gradient(180deg,#00000005 0%,#0000 10%);background-image:var(--blank-gradient);color:theme(colors.tint.500);font-size:.875rem;outline:1px solid color-mix(in lab,currentcolor 20%,var(--fabric-bg));outline-offset:-1px;&>.chipLabel{line-height:1.5;padding:0 .5em}&>.chipIcon{&+.chipLabel{margin-inline-start:-.5em}}&.clickable{background-image:var(--click-gradient);cursor:pointer;&.disabled{opacity:.5;pointer-events:none}}}}@layer var{.chip{background-color:color-mix(in lab,currentcolor 10%,var(--fabric-bg));height:unset;padding:unset;&[data-variant=outline]{box-shadow:0 0 2px color-mix(in lab,currentcolor 50%,var(--tint)) inset;outline-color:color-mix(in lab,currentcolor 50%,var(--fabric-bg))}>*{color:color-mix(in lab,currentcolor 50%,var(--fabric-text))}&.clickable{&:hover{background-color:color-mix(in lab,currentcolor 20%,var(--fabric-bg))}&:active,&[data-dropdown-open=true]{background-color:color-mix(in lab,currentcolor 15%,var(--fabric-bg));background-image:var(--active-gradient)}&[data-dropdown-open=true]{pointer-events:none}}&[data-variant=solid]{background-color:color-mix(in lab,currentcolor 35%,var(--fabric-bg));outline-color:color-mix(in lab,currentcolor 50%,var(--fabric-bg));&>*{color:color-mix(in lab,currentcolor 5%,var(--fabric-text))}&.clickable{&:hover{background-color:color-mix(in lab,currentcolor 45%,var(--fabric-bg))}&:active,&[data-dropdown-open=true]{background-color:color-mix(in lab,currentcolor 30%,var(--fabric-bg))}}}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer comp{.icon{height:1em;position:relative;vertical-align:-.125em;width:1em;&>i,&>img,&>svg{
|
|
1
|
+
@layer comp{.icon{height:1em;position:relative;vertical-align:-.125em;width:1em;&>i,&>img,&>svg{display:block;height:1em;line-height:1;object-fit:cover;overflow:hidden;pointer-events:none;width:1em;fill:currentcolor}&>i:before{line-height:1}&[data-clickable=true]{opacity:.75;&:hover{background-color:theme(colors.text/10%);opacity:.9}&:active{opacity:.5}}}[dir=rtl] .icon[data-flip=true]{transform:scaleX(-1)}}
|
|
@@ -91,7 +91,7 @@ var Panel = function Panel(_ref) {
|
|
|
91
91
|
className: classNames(titleClassName, "flex-1 select-none truncate", title && "py-1 first:px-2"),
|
|
92
92
|
children: title
|
|
93
93
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
94
|
-
className: "px-1",
|
|
94
|
+
className: "px-1 leading-none",
|
|
95
95
|
children: actions
|
|
96
96
|
}), hasTools && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
97
97
|
role: "none",
|
|
@@ -62,7 +62,7 @@ var TabPanel = function TabPanel(_ref) {
|
|
|
62
62
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
63
63
|
className: classNames(TabPanel_module.tabHeader, headerClassName, justify && "justify-".concat(justify), ["start", "end"].includes(orientation) && "flex-col", "flex flex-nowrap overflow-hidden items-center"),
|
|
64
64
|
children: [prepend, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
65
|
-
className: classNames(TabPanel_module.tabList, justify && "justify-".concat(justify), ["start", "end"].includes(orientation) && "flex-col", "flex flex-1 flex-nowrap overflow-auto scroll-thin"),
|
|
65
|
+
className: classNames(TabPanel_module.tabList, justify && "justify-".concat(justify), ["start", "end"].includes(orientation) && "flex-col", ["bottom", "end"].includes(orientation) ? "self-start" : "self-end", "flex flex-1 flex-nowrap overflow-auto scroll-thin"),
|
|
66
66
|
style: {
|
|
67
67
|
gap: gap
|
|
68
68
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer comp{.tabPanel{--color:theme(colors.primary.500);&>.tabHeader{grid-area:tablist;&>.tabList>.tabButton{&[data-color=accent]{--color:theme(colors.accent.500)}&[data-color=info]{--color:theme(colors.info.500)}&[data-color=danger]{--color:theme(colors.danger.500)}&[data-color=success]{--color:theme(colors.success.500)}&[data-color=warning]{--color:theme(colors.warning.500)}&:not(:global(.active)):hover{background-color:theme(colors.tint.100/50%);color:color-mix(in lab,var(--color) 65%,var(--fabric-text))}&:global(.active){--active-color:var(--color);color:color-mix(in lab,var(--color) 65%,var(--fabric-text));font-weight:500}}}&[data-variant=outline]{& .tabList>.tabButton:global(.active){--active-color:theme(backgroundColor.base);--active-border:0 0 0 1px theme(borderColor.base) inset;background-color:theme(backgroundColor.base)}}&[data-variant=solid]{& .tabList>.tabButton:global(.active){background-color:var(--color);color:theme(colors.white)}}&[data-variant=soft]{& .tabList>.tabButton:global(.active){background-color:color-mix(in lab,var(--color) 20%,var(--fabric-bg))}}&[data-orientation=top]{grid-template:"tablist" auto "content" 1fr/1fr
|
|
1
|
+
@layer comp{.tabPanel{--color:theme(colors.primary.500);&>.tabHeader{grid-area:tablist;&>.tabList>.tabButton{&[data-color=accent]{--color:theme(colors.accent.500)}&[data-color=info]{--color:theme(colors.info.500)}&[data-color=danger]{--color:theme(colors.danger.500)}&[data-color=success]{--color:theme(colors.success.500)}&[data-color=warning]{--color:theme(colors.warning.500)}&:not(:global(.active)):hover{background-color:theme(colors.tint.100/50%);color:color-mix(in lab,var(--color) 65%,var(--fabric-text))}&:global(.active){--active-color:var(--color);color:color-mix(in lab,var(--color) 65%,var(--fabric-text));font-weight:500}}}&[data-variant=outline]{& .tabList>.tabButton:global(.active){--active-color:theme(backgroundColor.base);--active-border:0 0 0 1px theme(borderColor.base) inset;background-color:theme(backgroundColor.base)}}&[data-variant=solid]{& .tabList>.tabButton:global(.active){background-color:var(--color);color:theme(colors.white)}}&[data-variant=soft]{& .tabList>.tabButton:global(.active){background-color:color-mix(in lab,var(--color) 20%,var(--fabric-bg))}}&[data-orientation=top]{grid-template:"tablist" auto "content" 1fr/1fr;.tabHeader{box-shadow:inset 0 -1px 0 theme(borderColor.dimmed)}}&[data-orientation=bottom]{grid-template:"content" 1fr "tablist" auto/1fr;.tabHeader{box-shadow:inset 0 1px 0 theme(borderColor.dimmed);margin-top:1px}}&[data-orientation=start]{grid-template:"tablist content" 1fr/auto 1fr;.tabHeader{box-shadow:inset -1px 0 0 theme(borderColor.dimmed)}}&[data-orientation=end]{grid-template:"content tablist" 1fr/1fr auto;.tabHeader{box-shadow:inset 1px 0 0 theme(borderColor.dimmed)}}}}@layer util{.tabPanel{& .tabList>.tabButton:global(.active){pointer-events:none}&[data-orientation=top] .tabList{&>.tabButton:global(.active){box-shadow:0 -2px 0 var(--active-color) inset,var(--active-border,0 0 0 transparent)}}&[data-orientation=bottom] .tabList{&>.tabButton:global(.active){box-shadow:0 2px 0 var(--active-color) inset,var(--active-border,0 0 0 transparent)}}&[data-orientation=start] .tabList{&>.tabButton:global(.active){box-shadow:-2px 0 0 var(--active-color) inset,var(--active-border,0 0 0 transparent)}}&[data-orientation=end] .tabList{&>.tabButton:global(.active){box-shadow:2px 0 0 var(--active-color) inset,var(--active-border,0 0 0 transparent)}}&[data-orientation=top] .tabList>.tabButton{border-end-end-radius:0;border-end-start-radius:0;margin-top:2px;margin-inline:1px}&[data-orientation=bottom] .tabList>.tabButton{border-start-end-radius:0;border-start-start-radius:0;margin-bottom:2px;margin-inline:1px}&[data-orientation=start] .tabList>.tabButton{border-end-end-radius:0;border-start-end-radius:0;margin-block:1px;margin-inline-start:2px}&[data-orientation=end] .tabList>.tabButton{border-end-start-radius:0;border-start-start-radius:0;margin-block:1px;margin-inline-end:2px}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer comp{.section{grid-template:"head head head" auto "side-s content side-e" 1fr "foot foot foot" auto/auto 1fr auto}}
|
|
1
|
+
@layer comp{.section{grid-template:". loader ." auto "head head head" auto "side-s content side-e" 1fr "foot foot foot" auto/auto 1fr auto}}
|
|
@@ -47,6 +47,7 @@ var Flyout = function Flyout(_ref) {
|
|
|
47
47
|
context = _useFloating.context;
|
|
48
48
|
var dismiss = react.useDismiss(context, {
|
|
49
49
|
outsidePressEvent: "mousedown",
|
|
50
|
+
outsidePress: !hideMask,
|
|
50
51
|
escapeKey: true
|
|
51
52
|
});
|
|
52
53
|
var role = react.useRole(context);
|
|
@@ -73,9 +74,7 @@ var Flyout = function Flyout(_ref) {
|
|
|
73
74
|
}, [onBeforeClose, onClose]);
|
|
74
75
|
react$1.useEffect(function () {
|
|
75
76
|
setTimeout(function () {
|
|
76
|
-
var _refs$floating$curren2;
|
|
77
77
|
refs.floating.current && (refs.floating.current.dataset.show = "true");
|
|
78
|
-
(_refs$floating$curren2 = refs.floating.current) === null || _refs$floating$curren2 === void 0 || (_refs$floating$curren2 = _refs$floating$curren2.querySelector('[role="dialog"]')) === null || _refs$floating$curren2 === void 0 || _refs$floating$curren2.focus();
|
|
79
78
|
}, 50);
|
|
80
79
|
}, []);
|
|
81
80
|
var tryClosing = react$1.useCallback(function (e) {
|
|
@@ -103,47 +102,45 @@ var Flyout = function Flyout(_ref) {
|
|
|
103
102
|
children: /*#__PURE__*/jsxRuntime.jsx(Wrapper, {
|
|
104
103
|
children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
|
|
105
104
|
context: context,
|
|
106
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
children: /*#__PURE__*/jsxRuntime.jsxs(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
})]
|
|
138
|
-
}), loading && /*#__PURE__*/jsxRuntime.jsx(Animations.Loading, {}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
139
|
-
role: "dialog",
|
|
140
|
-
className: classNames(Flyout_module.flyoutBody, "flex-1 grid overflow-hidden"),
|
|
141
|
-
tabIndex: 0,
|
|
142
|
-
children: children
|
|
105
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
106
|
+
"data-align": align,
|
|
107
|
+
className: classNames(Flyout_module.flyout, "fixed inset-y-0 overflow-hidden flex flex-col flex-nowrap pointer-events-auto shadow-xl", align === "start" ? "start-0" : "end-0", size === "sm" && "w-[20rem]", size === "md" && "w-[40rem]", size === "lg" && "w-[60vw]", size === "xl" && "w-[80vw]"),
|
|
108
|
+
style: {
|
|
109
|
+
width: width,
|
|
110
|
+
minWidth: minWidth
|
|
111
|
+
},
|
|
112
|
+
onMouseUpCapture: tryClosing,
|
|
113
|
+
ref: refs.setFloating
|
|
114
|
+
}, getFloatingProps()), aria), aria), {}, {
|
|
115
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(HotKeyWrapper.HotKeyWrapper, {
|
|
116
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(HeadFoot.Header, {
|
|
117
|
+
flex: true,
|
|
118
|
+
className: classNames(Flyout_module.flyoutHeader, headerClassName),
|
|
119
|
+
children: [icon && /*#__PURE__*/jsxRuntime.jsx(Icon.Icon, {
|
|
120
|
+
icon: icon,
|
|
121
|
+
bg: iconBg,
|
|
122
|
+
color: iconColor,
|
|
123
|
+
className: classNames(iconClassName, "p-1"),
|
|
124
|
+
rtlFlip: rtlFlip
|
|
125
|
+
}), /*#__PURE__*/jsxRuntime.jsx("label", {
|
|
126
|
+
className: "flex-1 truncate py-2 px-1",
|
|
127
|
+
children: title
|
|
128
|
+
}), actions, /*#__PURE__*/jsxRuntime.jsx(Icon.Icon, {
|
|
129
|
+
"data-ref": "panelClose",
|
|
130
|
+
className: classNames(Flyout_module.panelAction, "cursor-pointer p-1 text-xl self-stretch"),
|
|
131
|
+
icon: icons.CoreIcons.close,
|
|
132
|
+
onClick: function onClick() {
|
|
133
|
+
return handleClose(false);
|
|
134
|
+
}
|
|
143
135
|
})]
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
|
|
136
|
+
}), loading && /*#__PURE__*/jsxRuntime.jsx(Animations.Loading, {}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
137
|
+
role: "dialog",
|
|
138
|
+
className: classNames(Flyout_module.flyoutBody, "flex-1 grid overflow-hidden"),
|
|
139
|
+
tabIndex: 0,
|
|
140
|
+
children: children
|
|
141
|
+
})]
|
|
142
|
+
})
|
|
143
|
+
}))
|
|
147
144
|
})
|
|
148
145
|
})
|
|
149
146
|
});
|
|
@@ -71,9 +71,7 @@ var Modal = function Modal(_ref) {
|
|
|
71
71
|
}, [onBeforeClose, onClose]);
|
|
72
72
|
react$1.useEffect(function () {
|
|
73
73
|
setTimeout(function () {
|
|
74
|
-
var _refs$floating$curren2;
|
|
75
74
|
refs.floating.current && (refs.floating.current.dataset.show = "true");
|
|
76
|
-
(_refs$floating$curren2 = refs.floating.current) === null || _refs$floating$curren2 === void 0 || (_refs$floating$curren2 = _refs$floating$curren2.querySelector("[role='dialog']")) === null || _refs$floating$curren2 === void 0 || _refs$floating$curren2.focus();
|
|
77
75
|
}, 50);
|
|
78
76
|
}, []);
|
|
79
77
|
return /*#__PURE__*/jsxRuntime.jsx(react.FloatingPortal, {
|
|
@@ -67,7 +67,7 @@ var Badge = function Badge(_ref) {
|
|
|
67
67
|
"data-ref": "badge",
|
|
68
68
|
"data-ping": ping,
|
|
69
69
|
"data-placement": placement,
|
|
70
|
-
className: classNames(classes.badge, className, "inline-block p-px min-w-2 min-h-2 text-center select-none rounded-full leading-none z-
|
|
70
|
+
className: classNames(classes.badge, className, "inline-block p-px min-w-2 min-h-2 text-center select-none rounded-full leading-none z-2 pointer-events-none", forButton && !placement || inline ? "relative" : "absolute"),
|
|
71
71
|
children: [label && /*#__PURE__*/jsx("span", {
|
|
72
72
|
className: "p-1",
|
|
73
73
|
children: label
|
|
@@ -66,7 +66,7 @@ var Chip = function Chip(_ref) {
|
|
|
66
66
|
return /*#__PURE__*/jsxs(E, _objectSpread(_objectSpread({
|
|
67
67
|
ref: ref,
|
|
68
68
|
role: "term",
|
|
69
|
-
className: classNames(classes.chip, className, color && getColorClass(color), "select-none inline-flex flex-nowrap items-center max-w-72 rounded", rounded && "rounded-full", !!onClick && classes.clickable, disabled && classes.disabled),
|
|
69
|
+
className: classNames(classes.chip, className, color && getColorClass(color), "select-none inline-flex flex-nowrap items-center align-middle max-w-72 rounded", rounded && "rounded-full", !!onClick && classes.clickable, disabled && classes.disabled),
|
|
70
70
|
style: styles,
|
|
71
71
|
"data-variant": variant,
|
|
72
72
|
"data-inner-clickable": !!onClick,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer comp{.chip{--blank-gradient:linear-gradient(180deg,#00000005 0%,#0000 10%);background-image:var(--blank-gradient);color:theme(colors.tint.500);font-size:.875rem;outline:1px solid color-mix(in lab,currentcolor 20%,var(--fabric-bg));outline-offset:-1px;&>.chipLabel{line-height:1.
|
|
1
|
+
@layer comp{.chip{--blank-gradient:linear-gradient(180deg,#00000005 0%,#0000 10%);background-image:var(--blank-gradient);color:theme(colors.tint.500);font-size:.875rem;outline:1px solid color-mix(in lab,currentcolor 20%,var(--fabric-bg));outline-offset:-1px;&>.chipLabel{line-height:1.5;padding:0 .5em}&>.chipIcon{&+.chipLabel{margin-inline-start:-.5em}}&.clickable{background-image:var(--click-gradient);cursor:pointer;&.disabled{opacity:.5;pointer-events:none}}}}@layer var{.chip{background-color:color-mix(in lab,currentcolor 10%,var(--fabric-bg));height:unset;padding:unset;&[data-variant=outline]{box-shadow:0 0 2px color-mix(in lab,currentcolor 50%,var(--tint)) inset;outline-color:color-mix(in lab,currentcolor 50%,var(--fabric-bg))}>*{color:color-mix(in lab,currentcolor 50%,var(--fabric-text))}&.clickable{&:hover{background-color:color-mix(in lab,currentcolor 20%,var(--fabric-bg))}&:active,&[data-dropdown-open=true]{background-color:color-mix(in lab,currentcolor 15%,var(--fabric-bg));background-image:var(--active-gradient)}&[data-dropdown-open=true]{pointer-events:none}}&[data-variant=solid]{background-color:color-mix(in lab,currentcolor 35%,var(--fabric-bg));outline-color:color-mix(in lab,currentcolor 50%,var(--fabric-bg));&>*{color:color-mix(in lab,currentcolor 5%,var(--fabric-text))}&.clickable{&:hover{background-color:color-mix(in lab,currentcolor 45%,var(--fabric-bg))}&:active,&[data-dropdown-open=true]{background-color:color-mix(in lab,currentcolor 30%,var(--fabric-bg))}}}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer comp{.icon{height:1em;position:relative;vertical-align:-.125em;width:1em;&>i,&>img,&>svg{
|
|
1
|
+
@layer comp{.icon{height:1em;position:relative;vertical-align:-.125em;width:1em;&>i,&>img,&>svg{display:block;height:1em;line-height:1;object-fit:cover;overflow:hidden;pointer-events:none;width:1em;fill:currentcolor}&>i:before{line-height:1}&[data-clickable=true]{opacity:.75;&:hover{background-color:theme(colors.text/10%);opacity:.9}&:active{opacity:.5}}}[dir=rtl] .icon[data-flip=true]{transform:scaleX(-1)}}
|
|
@@ -91,7 +91,7 @@ var Panel = function Panel(_ref) {
|
|
|
91
91
|
className: classNames(titleClassName, "flex-1 select-none truncate", title && "py-1 first:px-2"),
|
|
92
92
|
children: title
|
|
93
93
|
}), /*#__PURE__*/jsx("div", {
|
|
94
|
-
className: "px-1",
|
|
94
|
+
className: "px-1 leading-none",
|
|
95
95
|
children: actions
|
|
96
96
|
}), hasTools && /*#__PURE__*/jsxs("div", {
|
|
97
97
|
role: "none",
|
|
@@ -62,7 +62,7 @@ var TabPanel = function TabPanel(_ref) {
|
|
|
62
62
|
children: [/*#__PURE__*/jsxs("div", {
|
|
63
63
|
className: classNames(classes.tabHeader, headerClassName, justify && "justify-".concat(justify), ["start", "end"].includes(orientation) && "flex-col", "flex flex-nowrap overflow-hidden items-center"),
|
|
64
64
|
children: [prepend, /*#__PURE__*/jsx("div", {
|
|
65
|
-
className: classNames(classes.tabList, justify && "justify-".concat(justify), ["start", "end"].includes(orientation) && "flex-col", "flex flex-1 flex-nowrap overflow-auto scroll-thin"),
|
|
65
|
+
className: classNames(classes.tabList, justify && "justify-".concat(justify), ["start", "end"].includes(orientation) && "flex-col", ["bottom", "end"].includes(orientation) ? "self-start" : "self-end", "flex flex-1 flex-nowrap overflow-auto scroll-thin"),
|
|
66
66
|
style: {
|
|
67
67
|
gap: gap
|
|
68
68
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer comp{.tabPanel{--color:theme(colors.primary.500);&>.tabHeader{grid-area:tablist;&>.tabList>.tabButton{&[data-color=accent]{--color:theme(colors.accent.500)}&[data-color=info]{--color:theme(colors.info.500)}&[data-color=danger]{--color:theme(colors.danger.500)}&[data-color=success]{--color:theme(colors.success.500)}&[data-color=warning]{--color:theme(colors.warning.500)}&:not(:global(.active)):hover{background-color:theme(colors.tint.100/50%);color:color-mix(in lab,var(--color) 65%,var(--fabric-text))}&:global(.active){--active-color:var(--color);color:color-mix(in lab,var(--color) 65%,var(--fabric-text));font-weight:500}}}&[data-variant=outline]{& .tabList>.tabButton:global(.active){--active-color:theme(backgroundColor.base);--active-border:0 0 0 1px theme(borderColor.base) inset;background-color:theme(backgroundColor.base)}}&[data-variant=solid]{& .tabList>.tabButton:global(.active){background-color:var(--color);color:theme(colors.white)}}&[data-variant=soft]{& .tabList>.tabButton:global(.active){background-color:color-mix(in lab,var(--color) 20%,var(--fabric-bg))}}&[data-orientation=top]{grid-template:"tablist" auto "content" 1fr/1fr
|
|
1
|
+
@layer comp{.tabPanel{--color:theme(colors.primary.500);&>.tabHeader{grid-area:tablist;&>.tabList>.tabButton{&[data-color=accent]{--color:theme(colors.accent.500)}&[data-color=info]{--color:theme(colors.info.500)}&[data-color=danger]{--color:theme(colors.danger.500)}&[data-color=success]{--color:theme(colors.success.500)}&[data-color=warning]{--color:theme(colors.warning.500)}&:not(:global(.active)):hover{background-color:theme(colors.tint.100/50%);color:color-mix(in lab,var(--color) 65%,var(--fabric-text))}&:global(.active){--active-color:var(--color);color:color-mix(in lab,var(--color) 65%,var(--fabric-text));font-weight:500}}}&[data-variant=outline]{& .tabList>.tabButton:global(.active){--active-color:theme(backgroundColor.base);--active-border:0 0 0 1px theme(borderColor.base) inset;background-color:theme(backgroundColor.base)}}&[data-variant=solid]{& .tabList>.tabButton:global(.active){background-color:var(--color);color:theme(colors.white)}}&[data-variant=soft]{& .tabList>.tabButton:global(.active){background-color:color-mix(in lab,var(--color) 20%,var(--fabric-bg))}}&[data-orientation=top]{grid-template:"tablist" auto "content" 1fr/1fr;.tabHeader{box-shadow:inset 0 -1px 0 theme(borderColor.dimmed)}}&[data-orientation=bottom]{grid-template:"content" 1fr "tablist" auto/1fr;.tabHeader{box-shadow:inset 0 1px 0 theme(borderColor.dimmed);margin-top:1px}}&[data-orientation=start]{grid-template:"tablist content" 1fr/auto 1fr;.tabHeader{box-shadow:inset -1px 0 0 theme(borderColor.dimmed)}}&[data-orientation=end]{grid-template:"content tablist" 1fr/1fr auto;.tabHeader{box-shadow:inset 1px 0 0 theme(borderColor.dimmed)}}}}@layer util{.tabPanel{& .tabList>.tabButton:global(.active){pointer-events:none}&[data-orientation=top] .tabList{&>.tabButton:global(.active){box-shadow:0 -2px 0 var(--active-color) inset,var(--active-border,0 0 0 transparent)}}&[data-orientation=bottom] .tabList{&>.tabButton:global(.active){box-shadow:0 2px 0 var(--active-color) inset,var(--active-border,0 0 0 transparent)}}&[data-orientation=start] .tabList{&>.tabButton:global(.active){box-shadow:-2px 0 0 var(--active-color) inset,var(--active-border,0 0 0 transparent)}}&[data-orientation=end] .tabList{&>.tabButton:global(.active){box-shadow:2px 0 0 var(--active-color) inset,var(--active-border,0 0 0 transparent)}}&[data-orientation=top] .tabList>.tabButton{border-end-end-radius:0;border-end-start-radius:0;margin-top:2px;margin-inline:1px}&[data-orientation=bottom] .tabList>.tabButton{border-start-end-radius:0;border-start-start-radius:0;margin-bottom:2px;margin-inline:1px}&[data-orientation=start] .tabList>.tabButton{border-end-end-radius:0;border-start-end-radius:0;margin-block:1px;margin-inline-start:2px}&[data-orientation=end] .tabList>.tabButton{border-end-start-radius:0;border-start-start-radius:0;margin-block:1px;margin-inline-end:2px}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer comp{.section{grid-template:"head head head" auto "side-s content side-e" 1fr "foot foot foot" auto/auto 1fr auto}}
|
|
1
|
+
@layer comp{.section{grid-template:". loader ." auto "head head head" auto "side-s content side-e" 1fr "foot foot foot" auto/auto 1fr auto}}
|
|
@@ -47,6 +47,7 @@ var Flyout = function Flyout(_ref) {
|
|
|
47
47
|
context = _useFloating.context;
|
|
48
48
|
var dismiss = useDismiss(context, {
|
|
49
49
|
outsidePressEvent: "mousedown",
|
|
50
|
+
outsidePress: !hideMask,
|
|
50
51
|
escapeKey: true
|
|
51
52
|
});
|
|
52
53
|
var role = useRole(context);
|
|
@@ -73,9 +74,7 @@ var Flyout = function Flyout(_ref) {
|
|
|
73
74
|
}, [onBeforeClose, onClose]);
|
|
74
75
|
useEffect(function () {
|
|
75
76
|
setTimeout(function () {
|
|
76
|
-
var _refs$floating$curren2;
|
|
77
77
|
refs.floating.current && (refs.floating.current.dataset.show = "true");
|
|
78
|
-
(_refs$floating$curren2 = refs.floating.current) === null || _refs$floating$curren2 === void 0 || (_refs$floating$curren2 = _refs$floating$curren2.querySelector('[role="dialog"]')) === null || _refs$floating$curren2 === void 0 || _refs$floating$curren2.focus();
|
|
79
78
|
}, 50);
|
|
80
79
|
}, []);
|
|
81
80
|
var tryClosing = useCallback(function (e) {
|
|
@@ -103,47 +102,45 @@ var Flyout = function Flyout(_ref) {
|
|
|
103
102
|
children: /*#__PURE__*/jsx(Wrapper, {
|
|
104
103
|
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
105
104
|
context: context,
|
|
106
|
-
children: /*#__PURE__*/jsx(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
children: /*#__PURE__*/jsxs(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
})]
|
|
138
|
-
}), loading && /*#__PURE__*/jsx(Loading, {}), /*#__PURE__*/jsx("div", {
|
|
139
|
-
role: "dialog",
|
|
140
|
-
className: classNames(classes.flyoutBody, "flex-1 grid overflow-hidden"),
|
|
141
|
-
tabIndex: 0,
|
|
142
|
-
children: children
|
|
105
|
+
children: /*#__PURE__*/jsx("div", _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
106
|
+
"data-align": align,
|
|
107
|
+
className: classNames(classes.flyout, "fixed inset-y-0 overflow-hidden flex flex-col flex-nowrap pointer-events-auto shadow-xl", align === "start" ? "start-0" : "end-0", size === "sm" && "w-[20rem]", size === "md" && "w-[40rem]", size === "lg" && "w-[60vw]", size === "xl" && "w-[80vw]"),
|
|
108
|
+
style: {
|
|
109
|
+
width: width,
|
|
110
|
+
minWidth: minWidth
|
|
111
|
+
},
|
|
112
|
+
onMouseUpCapture: tryClosing,
|
|
113
|
+
ref: refs.setFloating
|
|
114
|
+
}, getFloatingProps()), aria), aria), {}, {
|
|
115
|
+
children: /*#__PURE__*/jsxs(HotKeyWrapper, {
|
|
116
|
+
children: [/*#__PURE__*/jsxs(Header, {
|
|
117
|
+
flex: true,
|
|
118
|
+
className: classNames(classes.flyoutHeader, headerClassName),
|
|
119
|
+
children: [icon && /*#__PURE__*/jsx(Icon, {
|
|
120
|
+
icon: icon,
|
|
121
|
+
bg: iconBg,
|
|
122
|
+
color: iconColor,
|
|
123
|
+
className: classNames(iconClassName, "p-1"),
|
|
124
|
+
rtlFlip: rtlFlip
|
|
125
|
+
}), /*#__PURE__*/jsx("label", {
|
|
126
|
+
className: "flex-1 truncate py-2 px-1",
|
|
127
|
+
children: title
|
|
128
|
+
}), actions, /*#__PURE__*/jsx(Icon, {
|
|
129
|
+
"data-ref": "panelClose",
|
|
130
|
+
className: classNames(classes.panelAction, "cursor-pointer p-1 text-xl self-stretch"),
|
|
131
|
+
icon: CoreIcons.close,
|
|
132
|
+
onClick: function onClick() {
|
|
133
|
+
return handleClose(false);
|
|
134
|
+
}
|
|
143
135
|
})]
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
|
|
136
|
+
}), loading && /*#__PURE__*/jsx(Loading, {}), /*#__PURE__*/jsx("div", {
|
|
137
|
+
role: "dialog",
|
|
138
|
+
className: classNames(classes.flyoutBody, "flex-1 grid overflow-hidden"),
|
|
139
|
+
tabIndex: 0,
|
|
140
|
+
children: children
|
|
141
|
+
})]
|
|
142
|
+
})
|
|
143
|
+
}))
|
|
147
144
|
})
|
|
148
145
|
})
|
|
149
146
|
});
|
|
@@ -71,9 +71,7 @@ var Modal = function Modal(_ref) {
|
|
|
71
71
|
}, [onBeforeClose, onClose]);
|
|
72
72
|
useEffect(function () {
|
|
73
73
|
setTimeout(function () {
|
|
74
|
-
var _refs$floating$curren2;
|
|
75
74
|
refs.floating.current && (refs.floating.current.dataset.show = "true");
|
|
76
|
-
(_refs$floating$curren2 = refs.floating.current) === null || _refs$floating$curren2 === void 0 || (_refs$floating$curren2 = _refs$floating$curren2.querySelector("[role='dialog']")) === null || _refs$floating$curren2 === void 0 || _refs$floating$curren2.focus();
|
|
77
75
|
}, 50);
|
|
78
76
|
}, []);
|
|
79
77
|
return /*#__PURE__*/jsx(FloatingPortal, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
2
|
import { type CallbackReturn, type ChildrenProp } from "../../types";
|
|
3
3
|
import { Tab } from "./Tab";
|
|
4
4
|
export interface TabPanelProps extends ChildrenProp<typeof Tab> {
|
|
@@ -33,11 +33,11 @@ export interface TabPanelProps extends ChildrenProp<typeof Tab> {
|
|
|
33
33
|
/**
|
|
34
34
|
* append element
|
|
35
35
|
*/
|
|
36
|
-
append?:
|
|
36
|
+
append?: ReactNode;
|
|
37
37
|
/**
|
|
38
38
|
* prepend element
|
|
39
39
|
*/
|
|
40
|
-
prepend?:
|
|
40
|
+
prepend?: ReactNode;
|
|
41
41
|
/**
|
|
42
42
|
* change handler
|
|
43
43
|
*/
|
package/dist/types/index.d.ts
CHANGED
|
@@ -15,5 +15,6 @@ export * from "./hooks/useResizeObserver";
|
|
|
15
15
|
export * from "./hooks/useStorage";
|
|
16
16
|
export { HotKey } from "./hotkeys/HotKey";
|
|
17
17
|
export { HotKeyLabel } from "./hotkeys/HotKeyLabel";
|
|
18
|
+
export { type ModalProps } from "./types";
|
|
18
19
|
export { CoreIcons } from "./types/icons";
|
|
19
20
|
export { ApplicationProvider, useApplicationContext, useGlobals, useNotificationService, } from "./context/Global";
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { type Placement } from "@floating-ui/react";
|
|
2
2
|
import { type JSXElementConstructor, type Ref } from "react";
|
|
3
|
+
export type ModalProps<P = unknown> = P & {
|
|
4
|
+
onClose?: (...args: AnyObject) => void;
|
|
5
|
+
};
|
|
3
6
|
export type SizeType = "xs" | "sm" | "md" | "lg" | "xl";
|
|
4
7
|
export type SizeTypeWithZero = "xs" | "sm" | "md" | "lg" | "xl" | 0;
|
|
5
8
|
export type ColorType = "primary" | "accent" | "info" | "danger" | "success" | "warning";
|
|
@@ -54,7 +57,7 @@ export interface TestProps {
|
|
|
54
57
|
*/
|
|
55
58
|
"data-test-value"?: AnyObject;
|
|
56
59
|
}
|
|
57
|
-
export type Elements<T> = React.ReactElement<T> | React.
|
|
60
|
+
export type Elements<T> = React.ReactElement<T> | React.ReactNode;
|
|
58
61
|
export type AriaProps = React.AriaAttributes;
|
|
59
62
|
/**
|
|
60
63
|
* For wrapping components
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-fabric/core",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.20",
|
|
4
4
|
"description": "RUF: Core package",
|
|
5
5
|
"author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@floating-ui/react": "^0.26.24",
|
|
39
|
-
"@react-fabric/utilities": "^1.0.0-beta.
|
|
39
|
+
"@react-fabric/utilities": "^1.0.0-beta.20",
|
|
40
40
|
"@tailwindcss/container-queries": "^0.1.1",
|
|
41
41
|
"@tailwindcss/forms": "^0.5.7",
|
|
42
42
|
"@tailwindcss/typography": "^0.5.13",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"node": ">=18.12.0",
|
|
57
57
|
"npm": ">=8.19.0"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "b265afe1779c1654fc9cf8d9de6e7396b64515d3"
|
|
60
60
|
}
|
|
@@ -142,7 +142,7 @@ export const Badge = ({
|
|
|
142
142
|
className={classNames(
|
|
143
143
|
classes.badge,
|
|
144
144
|
className,
|
|
145
|
-
"inline-block p-px min-w-2 min-h-2 text-center select-none rounded-full leading-none z-
|
|
145
|
+
"inline-block p-px min-w-2 min-h-2 text-center select-none rounded-full leading-none z-2 pointer-events-none",
|
|
146
146
|
(forButton && !placement) || inline ? "relative" : "absolute",
|
|
147
147
|
)}
|
|
148
148
|
>
|
|
@@ -156,7 +156,7 @@ export const Chip = <Tag extends React.ElementType = "div">({
|
|
|
156
156
|
classes.chip,
|
|
157
157
|
className,
|
|
158
158
|
color && getColorClass(color),
|
|
159
|
-
"select-none inline-flex flex-nowrap items-center max-w-72 rounded",
|
|
159
|
+
"select-none inline-flex flex-nowrap items-center align-middle max-w-72 rounded",
|
|
160
160
|
rounded && "rounded-full",
|
|
161
161
|
!!onClick && classes.clickable,
|
|
162
162
|
disabled && classes.disabled,
|
|
@@ -87,7 +87,6 @@
|
|
|
87
87
|
|
|
88
88
|
&[data-orientation="top"] {
|
|
89
89
|
grid-template: "tablist" auto "content" 1fr / 1fr;
|
|
90
|
-
padding-inline: 2px;
|
|
91
90
|
|
|
92
91
|
.tabHeader {
|
|
93
92
|
box-shadow: 0 -1px 0 theme(borderColor.dimmed) inset;
|
|
@@ -96,7 +95,6 @@
|
|
|
96
95
|
|
|
97
96
|
&[data-orientation="bottom"] {
|
|
98
97
|
grid-template: "content" 1fr "tablist" auto / 1fr;
|
|
99
|
-
padding-inline: 2px;
|
|
100
98
|
|
|
101
99
|
.tabHeader {
|
|
102
100
|
margin-top: 1px;
|
|
@@ -106,7 +104,6 @@
|
|
|
106
104
|
|
|
107
105
|
&[data-orientation="start"] {
|
|
108
106
|
grid-template: "tablist content" 1fr / auto 1fr;
|
|
109
|
-
padding-block: 2px;
|
|
110
107
|
|
|
111
108
|
.tabHeader {
|
|
112
109
|
box-shadow: -1px 0 0 theme(borderColor.dimmed) inset;
|
|
@@ -115,7 +112,6 @@
|
|
|
115
112
|
|
|
116
113
|
&[data-orientation="end"] {
|
|
117
114
|
grid-template: "content tablist" 1fr / 1fr auto;
|
|
118
|
-
padding-block: 2px;
|
|
119
115
|
|
|
120
116
|
.tabHeader {
|
|
121
117
|
box-shadow: 1px 0 0 theme(borderColor.dimmed) inset;
|
|
@@ -25,7 +25,7 @@ import classNames from "classnames";
|
|
|
25
25
|
import {
|
|
26
26
|
Children,
|
|
27
27
|
cloneElement,
|
|
28
|
-
type
|
|
28
|
+
type ReactNode,
|
|
29
29
|
useCallback,
|
|
30
30
|
useEffect,
|
|
31
31
|
useMemo,
|
|
@@ -68,11 +68,11 @@ export interface TabPanelProps extends ChildrenProp<typeof Tab> {
|
|
|
68
68
|
/**
|
|
69
69
|
* append element
|
|
70
70
|
*/
|
|
71
|
-
append?:
|
|
71
|
+
append?: ReactNode;
|
|
72
72
|
/**
|
|
73
73
|
* prepend element
|
|
74
74
|
*/
|
|
75
|
-
prepend?:
|
|
75
|
+
prepend?: ReactNode;
|
|
76
76
|
/**
|
|
77
77
|
* change handler
|
|
78
78
|
*/
|
|
@@ -156,6 +156,7 @@ export const TabPanel = ({
|
|
|
156
156
|
classes.tabList,
|
|
157
157
|
justify && `justify-${justify}`,
|
|
158
158
|
["start", "end"].includes(orientation) && "flex-col",
|
|
159
|
+
["bottom", "end"].includes(orientation) ? "self-start" : "self-end",
|
|
159
160
|
"flex flex-1 flex-nowrap overflow-auto scroll-thin",
|
|
160
161
|
)}
|
|
161
162
|
style={{ gap }}
|
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
@layer comp {
|
|
25
25
|
.section {
|
|
26
|
-
grid-template: "head head head" auto "side-s content side-e" 1fr "foot foot foot" auto / auto 1fr auto;
|
|
26
|
+
grid-template: ". loader ." auto "head head head" auto "side-s content side-e" 1fr "foot foot foot" auto / auto 1fr auto;
|
|
27
27
|
}
|
|
28
28
|
}
|
package/src/index.ts
CHANGED
|
@@ -140,6 +140,7 @@ export const Flyout = ({
|
|
|
140
140
|
});
|
|
141
141
|
const dismiss = useDismiss(context, {
|
|
142
142
|
outsidePressEvent: "mousedown",
|
|
143
|
+
outsidePress: !hideMask,
|
|
143
144
|
escapeKey: true,
|
|
144
145
|
});
|
|
145
146
|
const role = useRole(context);
|
|
@@ -173,9 +174,6 @@ export const Flyout = ({
|
|
|
173
174
|
useEffect(() => {
|
|
174
175
|
setTimeout(() => {
|
|
175
176
|
refs.floating.current && (refs.floating.current.dataset.show = "true");
|
|
176
|
-
refs.floating.current
|
|
177
|
-
?.querySelector<HTMLElement>('[role="dialog"]')
|
|
178
|
-
?.focus();
|
|
179
177
|
}, 50);
|
|
180
178
|
}, []);
|
|
181
179
|
|
|
@@ -214,68 +212,66 @@ export const Flyout = ({
|
|
|
214
212
|
<FloatingPortal>
|
|
215
213
|
<Wrapper>
|
|
216
214
|
<FloatingFocusManager context={context}>
|
|
217
|
-
<
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
>
|
|
239
|
-
<
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
{icon && (
|
|
245
|
-
<Icon
|
|
246
|
-
icon={icon}
|
|
247
|
-
bg={iconBg}
|
|
248
|
-
color={iconColor}
|
|
249
|
-
className={classNames(iconClassName, "p-1")}
|
|
250
|
-
rtlFlip={rtlFlip}
|
|
251
|
-
/>
|
|
252
|
-
)}
|
|
253
|
-
<label className="flex-1 truncate py-2 px-1">{title}</label>
|
|
254
|
-
{actions}
|
|
215
|
+
<div
|
|
216
|
+
data-align={align}
|
|
217
|
+
className={classNames(
|
|
218
|
+
classes.flyout,
|
|
219
|
+
"fixed inset-y-0 overflow-hidden flex flex-col flex-nowrap pointer-events-auto shadow-xl",
|
|
220
|
+
align === "start" ? "start-0" : "end-0",
|
|
221
|
+
size === "sm" && "w-[20rem]",
|
|
222
|
+
size === "md" && "w-[40rem]",
|
|
223
|
+
size === "lg" && "w-[60vw]",
|
|
224
|
+
size === "xl" && "w-[80vw]",
|
|
225
|
+
)}
|
|
226
|
+
style={{
|
|
227
|
+
width,
|
|
228
|
+
minWidth,
|
|
229
|
+
}}
|
|
230
|
+
onMouseUpCapture={tryClosing}
|
|
231
|
+
ref={refs.setFloating}
|
|
232
|
+
{...getFloatingProps()}
|
|
233
|
+
{...aria}
|
|
234
|
+
{...aria}
|
|
235
|
+
>
|
|
236
|
+
<HotKeyWrapper>
|
|
237
|
+
<Header
|
|
238
|
+
flex
|
|
239
|
+
className={classNames(classes.flyoutHeader, headerClassName)}
|
|
240
|
+
>
|
|
241
|
+
{icon && (
|
|
255
242
|
<Icon
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
icon={CoreIcons.close}
|
|
262
|
-
onClick={() => handleClose(false)}
|
|
243
|
+
icon={icon}
|
|
244
|
+
bg={iconBg}
|
|
245
|
+
color={iconColor}
|
|
246
|
+
className={classNames(iconClassName, "p-1")}
|
|
247
|
+
rtlFlip={rtlFlip}
|
|
263
248
|
/>
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
249
|
+
)}
|
|
250
|
+
<label className="flex-1 truncate py-2 px-1">{title}</label>
|
|
251
|
+
{actions}
|
|
252
|
+
<Icon
|
|
253
|
+
data-ref="panelClose"
|
|
268
254
|
className={classNames(
|
|
269
|
-
classes.
|
|
270
|
-
"
|
|
255
|
+
classes.panelAction,
|
|
256
|
+
"cursor-pointer p-1 text-xl self-stretch",
|
|
271
257
|
)}
|
|
272
|
-
{
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
258
|
+
icon={CoreIcons.close}
|
|
259
|
+
onClick={() => handleClose(false)}
|
|
260
|
+
/>
|
|
261
|
+
</Header>
|
|
262
|
+
{loading && <Loading />}
|
|
263
|
+
<div
|
|
264
|
+
role="dialog"
|
|
265
|
+
className={classNames(
|
|
266
|
+
classes.flyoutBody,
|
|
267
|
+
"flex-1 grid overflow-hidden",
|
|
268
|
+
)}
|
|
269
|
+
{...({ tabIndex: 0 } as AnyObject)}
|
|
270
|
+
>
|
|
271
|
+
{children}
|
|
272
|
+
</div>
|
|
273
|
+
</HotKeyWrapper>
|
|
274
|
+
</div>
|
|
279
275
|
</FloatingFocusManager>
|
|
280
276
|
</Wrapper>
|
|
281
277
|
</FloatingPortal>
|
|
@@ -163,9 +163,6 @@ export const Modal = ({
|
|
|
163
163
|
useEffect(() => {
|
|
164
164
|
setTimeout(() => {
|
|
165
165
|
refs.floating.current && (refs.floating.current.dataset.show = "true");
|
|
166
|
-
refs.floating.current
|
|
167
|
-
?.querySelector<HTMLElement>("[role='dialog']")
|
|
168
|
-
?.focus();
|
|
169
166
|
}, 50);
|
|
170
167
|
}, []);
|
|
171
168
|
|
package/src/types/index.ts
CHANGED
|
@@ -25,6 +25,10 @@
|
|
|
25
25
|
import { type Placement } from "@floating-ui/react";
|
|
26
26
|
import { type JSXElementConstructor, type Ref } from "react";
|
|
27
27
|
|
|
28
|
+
export type ModalProps<P = unknown> = P & {
|
|
29
|
+
onClose?: (...args: AnyObject) => void;
|
|
30
|
+
};
|
|
31
|
+
|
|
28
32
|
export type SizeType = "xs" | "sm" | "md" | "lg" | "xl";
|
|
29
33
|
|
|
30
34
|
export type SizeTypeWithZero = "xs" | "sm" | "md" | "lg" | "xl" | 0;
|
|
@@ -122,15 +126,7 @@ export interface TestProps {
|
|
|
122
126
|
"data-test-value"?: AnyObject;
|
|
123
127
|
}
|
|
124
128
|
|
|
125
|
-
export type Elements<T> =
|
|
126
|
-
| React.ReactElement<T>
|
|
127
|
-
| React.ReactPortal
|
|
128
|
-
| React.ReactNode
|
|
129
|
-
| string
|
|
130
|
-
| number
|
|
131
|
-
| boolean
|
|
132
|
-
| null
|
|
133
|
-
| undefined;
|
|
129
|
+
export type Elements<T> = React.ReactElement<T> | React.ReactNode;
|
|
134
130
|
|
|
135
131
|
export type AriaProps = React.AriaAttributes;
|
|
136
132
|
|