@react-fabric/core 1.0.0-beta.17 → 1.0.0-beta.18
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 +4 -3
- package/dist/cjs/components/button/Button.module.css +1 -1
- package/dist/cjs/components/chip/Chip.js +2 -1
- package/dist/cjs/components/chip/Chip.module.css +1 -1
- package/dist/cjs/components/menu/Menu.js +16 -0
- package/dist/cjs/hooks/useNavigator.js +1 -1
- package/dist/cjs/overlays/alert/Alert.js +4 -4
- package/dist/cjs/overlays/alert/Alert.module.css +1 -1
- package/dist/cjs/typography/Text.js +1 -1
- package/dist/cjs/typography/Title.js +1 -1
- package/dist/cjs/typography/Typography.module.css +1 -1
- package/dist/esm/components/badge/Badge.js +4 -3
- package/dist/esm/components/button/Button.module.css +1 -1
- package/dist/esm/components/chip/Chip.js +2 -1
- package/dist/esm/components/chip/Chip.module.css +1 -1
- package/dist/esm/components/menu/Menu.js +17 -1
- package/dist/esm/hooks/useNavigator.js +1 -1
- package/dist/esm/overlays/alert/Alert.js +4 -4
- package/dist/esm/overlays/alert/Alert.module.css +1 -1
- package/dist/esm/typography/Text.js +1 -1
- package/dist/esm/typography/Title.js +1 -1
- package/dist/esm/typography/Typography.module.css +1 -1
- package/dist/types/components/badge/Badge.d.ts +5 -1
- package/dist/types/components/button/Button.d.ts +1 -1
- package/dist/types/core/responsive/Responsive.d.ts +1 -1
- package/package.json +3 -3
- package/src/components/badge/Badge.tsx +7 -2
- package/src/components/button/Button.module.css +7 -0
- package/src/components/button/Button.tsx +1 -1
- package/src/components/chip/Chip.module.css +3 -0
- package/src/components/chip/Chip.tsx +2 -1
- package/src/components/menu/Menu.tsx +20 -0
- package/src/core/responsive/Responsive.tsx +1 -1
- package/src/hooks/useNavigator.tsx +1 -1
- package/src/overlays/alert/Alert.module.css +1 -1
- package/src/overlays/alert/Alert.tsx +6 -4
- package/src/typography/Text.tsx +1 -1
- package/src/typography/Title.tsx +0 -1
- package/src/typography/Typography.module.css +2 -0
|
@@ -9,7 +9,7 @@ var Icon = require('../icon/Icon.js');
|
|
|
9
9
|
var Badge_module = require('./Badge.module.css');
|
|
10
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
11
|
|
|
12
|
-
var _excluded = ["ref", "className", "value", "max", "ping", "block", "placement", "children", "forButton", "icon", "iconBg", "iconColor", "rtlFlip"];
|
|
12
|
+
var _excluded = ["ref", "className", "value", "max", "ping", "block", "inline", "placement", "children", "forButton", "icon", "iconBg", "iconColor", "rtlFlip"];
|
|
13
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
15
|
var getBadgeProps = function getBadgeProps(badge) {
|
|
@@ -33,6 +33,7 @@ var Badge = function Badge(_ref) {
|
|
|
33
33
|
max = _ref.max,
|
|
34
34
|
ping = _ref.ping,
|
|
35
35
|
block = _ref.block,
|
|
36
|
+
inline = _ref.inline,
|
|
36
37
|
_ref$placement = _ref.placement,
|
|
37
38
|
placement = _ref$placement === void 0 ? "top-end" : _ref$placement,
|
|
38
39
|
children = _ref.children,
|
|
@@ -59,14 +60,14 @@ var Badge = function Badge(_ref) {
|
|
|
59
60
|
* wrap children in a relative div to float badge, wrapper allows for floating a badge on elements with overflow hidden
|
|
60
61
|
*/
|
|
61
62
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
62
|
-
className: classNames(forButton ? "contents" : "relative", block ? "block" : "inline-block"),
|
|
63
|
+
className: classNames(forButton || inline ? "contents" : "relative", block ? "block" : "inline-block"),
|
|
63
64
|
children: [children && /*#__PURE__*/react.cloneElement(children, _objectSpread(_objectSpread({}, rest), {}, {
|
|
64
65
|
ref: innerRef
|
|
65
66
|
})), (!!ping || label) && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
66
67
|
"data-ref": "badge",
|
|
67
68
|
"data-ping": ping,
|
|
68
69
|
"data-placement": placement,
|
|
69
|
-
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-5 pointer-events-none", forButton && !placement ? "relative" : "absolute"),
|
|
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-5 pointer-events-none", forButton && !placement || inline ? "relative" : "absolute"),
|
|
70
71
|
children: [label && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
71
72
|
className: "p-1",
|
|
72
73
|
children: label
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer comp{.buttonWrapper{--color:theme(colors.primary.500);border-radius:var(--rounding);font-size:1rem;& .button{background-color:var(--bg);background-image:var(--click-gradient);border-radius:inherit;color:var(--text);outline:1px solid var(--outline);&.spinOnHover:hover .buttonIcon{& :global{animation:spin 2s linear infinite}}&>*{pointer-events:none}&:not(:disabled) input[type=file]{pointer-events:auto;&::-webkit-file-upload-button{cursor:pointer;inset:0;position:absolute}}}& .rounded{border-radius:9999px}& .buttonLabel{line-height:1;order:1;padding:.5em 1em;&+.altIcon{margin-inline-start:-1em}}& .buttonChild{line-height:1;order:1;padding:.5em}& .buttonIcon{font-size:1.125em;padding:.3889em}& :global(.hotkey-label){align-self:center;order:3}& .altIcon{align-self:center;order:4;padding:.125em .5em}& [data-ref=badge]{align-self:center;margin-inline-end:.5em;order:2}}.buttonGroup{&>.buttonWrapper{flex:0 1 1em}&:not(.flex)+&:not(.flex){margin-inline-start:.5rem}}}@layer util{.buttonWrapper{&[data-size=xs]{font-size:.625rem}&[data-size=sm]{font-size:.875rem}&[data-size=md]{font-size:1.125rem}&[data-size=lg]{font-size:1.25rem}&[data-size=xl]{font-size:1.5rem}}.button{--bg:color-mix(in lab,var(--fabric-bg) 99%,var(--tint));--outline:color-mix(in lab,var(--bg) 90%,var(--fabric-text));--text:color-mix(in lab,var(--color) 80%,var(--fabric-text));--bg-hover:color-mix(in lab,var(--color) 18%,var(--fabric-bg));--bg-click:color-mix(in lab,var(--color) 25%,var(--fabric-bg));--bg-active:color-mix(in lab,var(--color) 36%,var(--fabric-bg));&[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)}&[data-variant=outline]{--outline:var(--color)}&[data-variant=solid]{--outline:var(--color);--bg:color-mix(in lab,var(--color) 96%,var(--fabric-text));--text:theme(colors.white);--bg-hover:color-mix(in lab,var(--color) 90%,var(--fabric-bg));--bg-click:color-mix(in lab,var(--color) 80%,theme(colors.black));--bg-active:color-mix(in lab,var(--color) 70%,theme(colors.black));& :global(.hotkey-label){background-color:theme(backgroundColor.dark/30%);color:theme(colors.white/70%)}}&[data-variant=link]{--bg:transparent;--outline:transparent;background-image:none;box-shadow:none}&[data-color=invert]{--bg:theme(backgroundColor.invert);--text:color-mix(in lab,var(--color) 90%,theme(textColor.invert));--bg-hover:color-mix(in lab,var(--color) 15%,theme(backgroundColor.invert));--bg-click:color-mix(in lab,var(--color) 35%,theme(backgroundColor.invert))}}.buttonIcon[data-align=start]{order:0;&+.buttonLabel[data-colored-icon=false]{margin-inline-start:-1em}}.buttonIcon[data-align=end]{order:2;&~.buttonLabel[data-colored-icon=false]{margin-inline-end:-1em}}}@layer var{.buttonWrapper{height:unset;padding:unset;&[data-disabled=true]{cursor:not-allowed;& .button{background-image:var(--active-gradient);opacity:.5;pointer-events:none}}&[data-loading=true]{cursor:wait;& .button{background-image:var(--progress-gradient);background-size:1em 1em;pointer-events:none;& :global{animation:bgprogress .75s linear infinite}}& .button:not([data-variant=solid]){background-color:color-mix(in lab,var(--color) 15%,var(--fabric-bg))}}&:global(.btn-dashed)>.button{color:theme(colors.tint.600);outline:1px dashed theme(colors.tint.600);&[data-invalid=true]{background-color:theme(colors.danger.100);color:theme(colors.danger.600);outline:1px dashed theme(colors.danger.600)}}}.button{--tw-ring-color:var(--color);&:hover{background-color:var(--bg-hover)}&:active{background-color:var(--bg-click);background-image:var(--active-gradient);.buttonIcon,.buttonLabel{transform:translateY(1px)}}&[data-active=true],&[data-checked=true],&[data-dropdown-open=true]{background-color:var(--bg-active);background-image:none}&[data-active=true],&[data-dropdown-open=true]{pointer-events:none}}.buttonGroup{&>.buttonWrapper{margin:0;& .button[data-variant=link]{--outline:theme(backgroundColor.base)}}&:not(.vertical){&>:not(:first-child){&:before{border-inline-start:.5px solid theme(borderColor.base);content:"";inset-block:5%;inset-inline-start:-.5px;position:absolute}}&.separator>:not(:first-child){margin-inline-start:2px;&:before{inset-inline-start:-1.5px}}&>:not(:last-child) .button{border-end-end-radius:0;border-start-end-radius:0}&>:not(:first-child) .button{border-end-start-radius:0;border-start-start-radius:0}}&.vertical{&>:not(:first-child){&:before{border-block-start:.5px solid theme(borderColor.base);content:"";inset-block-start:-.5px;inset-inline:5%;position:absolute}}&.separator>:not(:first-child){margin-block-start:1px;&:before{inset-block-start:-1px}}&>:not(:last-child) .button{border-end-end-radius:0;border-end-start-radius:0}&>:not(:first-child) .button{border-start-end-radius:0;border-start-start-radius:0}}}}
|
|
1
|
+
@layer comp{.buttonWrapper{--color:theme(colors.primary.500);border-radius:var(--rounding);font-size:1rem;& .button{background-color:var(--bg);background-image:var(--click-gradient);border-radius:inherit;color:var(--text);outline:1px solid var(--outline);&.spinOnHover:hover .buttonIcon{& :global{animation:spin 2s linear infinite}}&>*{pointer-events:none}&:not(:disabled) input[type=file]{pointer-events:auto;&::-webkit-file-upload-button{cursor:pointer;inset:0;position:absolute}}}& .rounded{border-radius:9999px}& .buttonLabel{line-height:1;order:1;padding:.5em 1em;&+.altIcon{margin-inline-start:-1em}}& .buttonChild{line-height:1;order:1;padding:.5em}& .buttonIcon{font-size:1.125em;padding:.3889em}& :global(.hotkey-label){align-self:center;order:3}& .altIcon{align-self:center;order:4;padding:.125em .5em}& [data-ref=badge]{align-self:center;margin-inline-end:.5em;order:2}}.buttonGroup{&>.buttonWrapper{flex:0 1 1em}&:not(.flex)+&:not(.flex){margin-inline-start:.5rem}}}@layer util{.buttonWrapper{&[data-size=xs]{font-size:.625rem}&[data-size=sm]{font-size:.875rem}&[data-size=md]{font-size:1.125rem}&[data-size=lg]{font-size:1.25rem}&[data-size=xl]{font-size:1.5rem}}.button{--bg:color-mix(in lab,var(--fabric-bg) 99%,var(--tint));--outline:color-mix(in lab,var(--bg) 90%,var(--fabric-text));--text:color-mix(in lab,var(--color) 80%,var(--fabric-text));--bg-hover:color-mix(in lab,var(--color) 18%,var(--fabric-bg));--bg-click:color-mix(in lab,var(--color) 25%,var(--fabric-bg));--bg-active:color-mix(in lab,var(--color) 36%,var(--fabric-bg));&[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)}&[data-variant=outline]{--outline:var(--color)}&[data-variant=soft]{--bg:color-mix(in lab,var(--color) 25%,var(--fabric-bg));--bg-hover:color-mix(in lab,var(--color) 35%,var(--fabric-bg));--bg-click:color-mix(in lab,var(--color) 50%,theme(colors.tint.50));--bg-active:color-mix(in lab,var(--color) 50%,theme(colors.tint.50))}&[data-variant=solid]{--outline:var(--color);--bg:color-mix(in lab,var(--color) 96%,var(--fabric-text));--text:theme(colors.white);--bg-hover:color-mix(in lab,var(--color) 90%,var(--fabric-bg));--bg-click:color-mix(in lab,var(--color) 80%,theme(colors.black));--bg-active:color-mix(in lab,var(--color) 70%,theme(colors.black));& :global(.hotkey-label){background-color:theme(backgroundColor.dark/30%);color:theme(colors.white/70%)}}&[data-variant=link]{--bg:transparent;--outline:transparent;background-image:none;box-shadow:none}&[data-color=invert]{--bg:theme(backgroundColor.invert);--text:color-mix(in lab,var(--color) 90%,theme(textColor.invert));--bg-hover:color-mix(in lab,var(--color) 15%,theme(backgroundColor.invert));--bg-click:color-mix(in lab,var(--color) 35%,theme(backgroundColor.invert))}}.buttonIcon[data-align=start]{order:0;&+.buttonLabel[data-colored-icon=false]{margin-inline-start:-1em}}.buttonIcon[data-align=end]{order:2;&~.buttonLabel[data-colored-icon=false]{margin-inline-end:-1em}}}@layer var{.buttonWrapper{height:unset;padding:unset;&[data-disabled=true]{cursor:not-allowed;& .button{background-image:var(--active-gradient);opacity:.5;pointer-events:none}}&[data-loading=true]{cursor:wait;& .button{background-image:var(--progress-gradient);background-size:1em 1em;pointer-events:none;& :global{animation:bgprogress .75s linear infinite}}& .button:not([data-variant=solid]){background-color:color-mix(in lab,var(--color) 15%,var(--fabric-bg))}}&:global(.btn-dashed)>.button{color:theme(colors.tint.600);outline:1px dashed theme(colors.tint.600);&[data-invalid=true]{background-color:theme(colors.danger.100);color:theme(colors.danger.600);outline:1px dashed theme(colors.danger.600)}}}.button{--tw-ring-color:var(--color);&:hover{background-color:var(--bg-hover)}&:active{background-color:var(--bg-click);background-image:var(--active-gradient);.buttonIcon,.buttonLabel{transform:translateY(1px)}}&[data-active=true],&[data-checked=true],&[data-dropdown-open=true]{background-color:var(--bg-active);background-image:none}&[data-active=true],&[data-dropdown-open=true]{pointer-events:none}}.buttonGroup{&>.buttonWrapper{margin:0;& .button[data-variant=link]{--outline:theme(backgroundColor.base)}}&:not(.vertical){&>:not(:first-child){&:before{border-inline-start:.5px solid theme(borderColor.base);content:"";inset-block:5%;inset-inline-start:-.5px;position:absolute}}&.separator>:not(:first-child){margin-inline-start:2px;&:before{inset-inline-start:-1.5px}}&>:not(:last-child) .button{border-end-end-radius:0;border-start-end-radius:0}&>:not(:first-child) .button{border-end-start-radius:0;border-start-start-radius:0}}&.vertical{&>:not(:first-child){&:before{border-block-start:.5px solid theme(borderColor.base);content:"";inset-block-start:-.5px;inset-inline:5%;position:absolute}}&.separator>:not(:first-child){margin-block-start:1px;&:before{inset-block-start:-1px}}&>:not(:last-child) .button{border-end-end-radius:0;border-end-start-radius:0}&>:not(:first-child) .button{border-start-end-radius:0;border-start-start-radius:0}}}}
|
|
@@ -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
|
|
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),
|
|
70
70
|
style: styles,
|
|
71
71
|
"data-variant": variant,
|
|
72
72
|
"data-inner-clickable": !!onClick,
|
|
@@ -84,6 +84,7 @@ var Chip = function Chip(_ref) {
|
|
|
84
84
|
children: children
|
|
85
85
|
}), onRemove && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
86
86
|
role: "none",
|
|
87
|
+
"data-inner-cliackable": true,
|
|
87
88
|
className: classNames(Chip_module.chipRemove, "cursor-pointer pe-1 opacity-65 hover:opacity-90"),
|
|
88
89
|
onClick: removeHandler,
|
|
89
90
|
children: "\xD7"
|
|
@@ -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);outline:1px solid color-mix(in lab,currentcolor 20%,var(--fabric-bg));outline-offset:-1px;&>.chipLabel{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
|
+
@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.25;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))}}}}}
|
|
@@ -137,6 +137,16 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
137
137
|
});
|
|
138
138
|
}, 100);
|
|
139
139
|
}, [isOpen]);
|
|
140
|
+
react$1.useEffect(function () {
|
|
141
|
+
if ((!isNested || isOpen) && activeIndex) {
|
|
142
|
+
setTimeout(function () {
|
|
143
|
+
var _elementsRef$current$;
|
|
144
|
+
(_elementsRef$current$ = elementsRef.current[activeIndex]) === null || _elementsRef$current$ === void 0 || _elementsRef$current$.scrollIntoView({
|
|
145
|
+
block: "nearest"
|
|
146
|
+
});
|
|
147
|
+
}, 100);
|
|
148
|
+
}
|
|
149
|
+
}, [isOpen, activeIndex]);
|
|
140
150
|
return /*#__PURE__*/jsxRuntime.jsxs(react.FloatingNode, {
|
|
141
151
|
id: nodeId,
|
|
142
152
|
children: [isNested && /*#__PURE__*/jsxRuntime.jsx(MenuItem.MenuItem, _objectSpread(_objectSpread({}, getReferenceProps(_objectSpread(_objectSpread({}, rest), {}, {
|
|
@@ -189,6 +199,7 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
189
199
|
};
|
|
190
200
|
var Menu = function Menu(props) {
|
|
191
201
|
var parentId = react.useFloatingParentNodeId();
|
|
202
|
+
var tree = react.useFloatingTree();
|
|
192
203
|
if (parentId === null) {
|
|
193
204
|
return /*#__PURE__*/jsxRuntime.jsx(react.FloatingTree, {
|
|
194
205
|
children: /*#__PURE__*/jsxRuntime.jsx(MenuComponent, _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -196,6 +207,11 @@ var Menu = function Menu(props) {
|
|
|
196
207
|
}))
|
|
197
208
|
});
|
|
198
209
|
}
|
|
210
|
+
if (tree) {
|
|
211
|
+
return /*#__PURE__*/jsxRuntime.jsx(MenuComponent, _objectSpread(_objectSpread({}, props), {}, {
|
|
212
|
+
menuClassName: props.className
|
|
213
|
+
}));
|
|
214
|
+
}
|
|
199
215
|
return /*#__PURE__*/jsxRuntime.jsx(MenuComponent, _objectSpread({}, props));
|
|
200
216
|
};
|
|
201
217
|
|
|
@@ -23,7 +23,7 @@ var useNavigator = function useNavigator() {
|
|
|
23
23
|
}, [totalCount]);
|
|
24
24
|
var headLabel = react.useMemo(function () {
|
|
25
25
|
return /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
26
|
-
className: "text-muted leading-
|
|
26
|
+
className: "text-muted leading-none select-none",
|
|
27
27
|
children: [currentIndex + 1, "/", totalCount]
|
|
28
28
|
});
|
|
29
29
|
}, [currentIndex, totalCount]);
|
|
@@ -114,15 +114,15 @@ var Alert = function Alert(_ref) {
|
|
|
114
114
|
className: classNames("area-[icon] text-lg py-2"),
|
|
115
115
|
children: iconType
|
|
116
116
|
}), /*#__PURE__*/jsxRuntime.jsx(Title.Title, {
|
|
117
|
-
className: "font-medium area-[title]",
|
|
117
|
+
className: "font-medium area-[title] self-center",
|
|
118
118
|
children: title
|
|
119
|
-
}), /*#__PURE__*/jsxRuntime.jsx("
|
|
119
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
120
120
|
className: "area-[message] py-4",
|
|
121
121
|
children: message
|
|
122
122
|
}), type === "prompt" && /*#__PURE__*/jsxRuntime.jsx("input", {
|
|
123
123
|
value: value,
|
|
124
124
|
placeholder: placeholder,
|
|
125
|
-
className: classNames("border rounded
|
|
125
|
+
className: classNames("area-[input] appearance-none outline-0 ring-".concat(color, "-500 border rounded border-").concat(color, "-200 w-full px-2 py-1")),
|
|
126
126
|
ref: function ref(e) {
|
|
127
127
|
return e != null && setTimeout(function () {
|
|
128
128
|
return e.focus();
|
|
@@ -158,7 +158,7 @@ var Alert = function Alert(_ref) {
|
|
|
158
158
|
variant: "solid",
|
|
159
159
|
color: color,
|
|
160
160
|
onClick: function onClick() {
|
|
161
|
-
return handleClose(true);
|
|
161
|
+
return handleClose(type === "prompt" ? value : true);
|
|
162
162
|
},
|
|
163
163
|
children: okLabel !== null && okLabel !== void 0 ? okLabel : t("action.ok", "OK")
|
|
164
164
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer comp{.alert{gap:.5rem 1rem;grid-template:"icon title" auto "
|
|
1
|
+
@layer comp{.alert{gap:.5rem 1rem;grid-template:"icon title" auto "message message" auto "input input" auto "actions actions" auto/auto 1fr;margin-top:-100%;opacity:0;transition:margin .4s,opacity .3s .2s;z-index:var(--z-overlay);&[data-show=true]{margin-top:0;opacity:1}}}
|
|
@@ -98,7 +98,7 @@ var Text = function Text(_ref) {
|
|
|
98
98
|
"--text-clamp": showMore ? "unset" : clamp !== null && clamp !== void 0 ? clamp : "unset"
|
|
99
99
|
},
|
|
100
100
|
children: /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread({
|
|
101
|
-
className: classNames(Typography_module.text, "
|
|
101
|
+
className: classNames(Typography_module.text, "mixed-lang px-[2px] whitespace-pre-wrap", family && "font-".concat(family), bg && getColor.getBgClass(bg), color && getColor.getColorClass(color), clamp && "line-clamp-1"),
|
|
102
102
|
style: styles
|
|
103
103
|
}, aria), {}, {
|
|
104
104
|
children: children
|
|
@@ -48,7 +48,7 @@ var Title = function Title(_ref) {
|
|
|
48
48
|
}, [bg, color, size, align], "Title styles");
|
|
49
49
|
var E = as !== null && as !== void 0 ? as : "p";
|
|
50
50
|
return /*#__PURE__*/jsxRuntime.jsx(E, _objectSpread(_objectSpread({
|
|
51
|
-
className: classNames(Typography_module.title,
|
|
51
|
+
className: classNames(Typography_module.title, className, family && "font-".concat(family), !as && "text-lg", bg && getColor.getBgClass(bg), color && getColor.getColorClass(color)),
|
|
52
52
|
style: styles
|
|
53
53
|
}, aria), {}, {
|
|
54
54
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer comp{.title{line-height:1.125}.moreLink{margin:-.25rem 0 .25rem;text-align:end;&>span{color:theme(colors.accent.700);cursor:pointer;font-size:.75rem;user-select:none;&:hover{color:theme(colors.accent.500);text-decoration:underline;text-underline-offset:2px}}}}@layer util{.text{-webkit-line-clamp:var(--text-clamp)}.abbr{--abbr-color:var(--accent);color:color-mix(in lab,var(--abbr-color) 50%,var(--fabric-text))}.mark{--mark-color:var(--primary);background-color:color-mix(in lab,var(--mark-color) 25%,var(--fabric-bg))}}
|
|
1
|
+
@layer comp{.title{line-height:1.125;padding:4px 2px;white-space:prewrap}.moreLink{margin:-.25rem 0 .25rem;text-align:end;&>span{color:theme(colors.accent.700);cursor:pointer;font-size:.75rem;user-select:none;&:hover{color:theme(colors.accent.500);text-decoration:underline;text-underline-offset:2px}}}}@layer util{.text{-webkit-line-clamp:var(--text-clamp)}.abbr{--abbr-color:var(--accent);color:color-mix(in lab,var(--abbr-color) 50%,var(--fabric-text))}.mark{--mark-color:var(--primary);background-color:color-mix(in lab,var(--mark-color) 25%,var(--fabric-bg))}}
|
|
@@ -9,7 +9,7 @@ import { Icon } from '../icon/Icon.js';
|
|
|
9
9
|
import classes from './Badge.module.css';
|
|
10
10
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
11
11
|
|
|
12
|
-
var _excluded = ["ref", "className", "value", "max", "ping", "block", "placement", "children", "forButton", "icon", "iconBg", "iconColor", "rtlFlip"];
|
|
12
|
+
var _excluded = ["ref", "className", "value", "max", "ping", "block", "inline", "placement", "children", "forButton", "icon", "iconBg", "iconColor", "rtlFlip"];
|
|
13
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
15
|
var getBadgeProps = function getBadgeProps(badge) {
|
|
@@ -33,6 +33,7 @@ var Badge = function Badge(_ref) {
|
|
|
33
33
|
max = _ref.max,
|
|
34
34
|
ping = _ref.ping,
|
|
35
35
|
block = _ref.block,
|
|
36
|
+
inline = _ref.inline,
|
|
36
37
|
_ref$placement = _ref.placement,
|
|
37
38
|
placement = _ref$placement === void 0 ? "top-end" : _ref$placement,
|
|
38
39
|
children = _ref.children,
|
|
@@ -59,14 +60,14 @@ var Badge = function Badge(_ref) {
|
|
|
59
60
|
* wrap children in a relative div to float badge, wrapper allows for floating a badge on elements with overflow hidden
|
|
60
61
|
*/
|
|
61
62
|
return /*#__PURE__*/jsxs("div", {
|
|
62
|
-
className: classNames(forButton ? "contents" : "relative", block ? "block" : "inline-block"),
|
|
63
|
+
className: classNames(forButton || inline ? "contents" : "relative", block ? "block" : "inline-block"),
|
|
63
64
|
children: [children && /*#__PURE__*/cloneElement(children, _objectSpread(_objectSpread({}, rest), {}, {
|
|
64
65
|
ref: innerRef
|
|
65
66
|
})), (!!ping || label) && /*#__PURE__*/jsxs("div", {
|
|
66
67
|
"data-ref": "badge",
|
|
67
68
|
"data-ping": ping,
|
|
68
69
|
"data-placement": placement,
|
|
69
|
-
className: classNames(classes.badge, className, "inline-block p-px min-w-2 min-h-2 text-center select-none rounded-full leading-none z-5 pointer-events-none", forButton && !placement ? "relative" : "absolute"),
|
|
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-5 pointer-events-none", forButton && !placement || inline ? "relative" : "absolute"),
|
|
70
71
|
children: [label && /*#__PURE__*/jsx("span", {
|
|
71
72
|
className: "p-1",
|
|
72
73
|
children: label
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer comp{.buttonWrapper{--color:theme(colors.primary.500);border-radius:var(--rounding);font-size:1rem;& .button{background-color:var(--bg);background-image:var(--click-gradient);border-radius:inherit;color:var(--text);outline:1px solid var(--outline);&.spinOnHover:hover .buttonIcon{& :global{animation:spin 2s linear infinite}}&>*{pointer-events:none}&:not(:disabled) input[type=file]{pointer-events:auto;&::-webkit-file-upload-button{cursor:pointer;inset:0;position:absolute}}}& .rounded{border-radius:9999px}& .buttonLabel{line-height:1;order:1;padding:.5em 1em;&+.altIcon{margin-inline-start:-1em}}& .buttonChild{line-height:1;order:1;padding:.5em}& .buttonIcon{font-size:1.125em;padding:.3889em}& :global(.hotkey-label){align-self:center;order:3}& .altIcon{align-self:center;order:4;padding:.125em .5em}& [data-ref=badge]{align-self:center;margin-inline-end:.5em;order:2}}.buttonGroup{&>.buttonWrapper{flex:0 1 1em}&:not(.flex)+&:not(.flex){margin-inline-start:.5rem}}}@layer util{.buttonWrapper{&[data-size=xs]{font-size:.625rem}&[data-size=sm]{font-size:.875rem}&[data-size=md]{font-size:1.125rem}&[data-size=lg]{font-size:1.25rem}&[data-size=xl]{font-size:1.5rem}}.button{--bg:color-mix(in lab,var(--fabric-bg) 99%,var(--tint));--outline:color-mix(in lab,var(--bg) 90%,var(--fabric-text));--text:color-mix(in lab,var(--color) 80%,var(--fabric-text));--bg-hover:color-mix(in lab,var(--color) 18%,var(--fabric-bg));--bg-click:color-mix(in lab,var(--color) 25%,var(--fabric-bg));--bg-active:color-mix(in lab,var(--color) 36%,var(--fabric-bg));&[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)}&[data-variant=outline]{--outline:var(--color)}&[data-variant=solid]{--outline:var(--color);--bg:color-mix(in lab,var(--color) 96%,var(--fabric-text));--text:theme(colors.white);--bg-hover:color-mix(in lab,var(--color) 90%,var(--fabric-bg));--bg-click:color-mix(in lab,var(--color) 80%,theme(colors.black));--bg-active:color-mix(in lab,var(--color) 70%,theme(colors.black));& :global(.hotkey-label){background-color:theme(backgroundColor.dark/30%);color:theme(colors.white/70%)}}&[data-variant=link]{--bg:transparent;--outline:transparent;background-image:none;box-shadow:none}&[data-color=invert]{--bg:theme(backgroundColor.invert);--text:color-mix(in lab,var(--color) 90%,theme(textColor.invert));--bg-hover:color-mix(in lab,var(--color) 15%,theme(backgroundColor.invert));--bg-click:color-mix(in lab,var(--color) 35%,theme(backgroundColor.invert))}}.buttonIcon[data-align=start]{order:0;&+.buttonLabel[data-colored-icon=false]{margin-inline-start:-1em}}.buttonIcon[data-align=end]{order:2;&~.buttonLabel[data-colored-icon=false]{margin-inline-end:-1em}}}@layer var{.buttonWrapper{height:unset;padding:unset;&[data-disabled=true]{cursor:not-allowed;& .button{background-image:var(--active-gradient);opacity:.5;pointer-events:none}}&[data-loading=true]{cursor:wait;& .button{background-image:var(--progress-gradient);background-size:1em 1em;pointer-events:none;& :global{animation:bgprogress .75s linear infinite}}& .button:not([data-variant=solid]){background-color:color-mix(in lab,var(--color) 15%,var(--fabric-bg))}}&:global(.btn-dashed)>.button{color:theme(colors.tint.600);outline:1px dashed theme(colors.tint.600);&[data-invalid=true]{background-color:theme(colors.danger.100);color:theme(colors.danger.600);outline:1px dashed theme(colors.danger.600)}}}.button{--tw-ring-color:var(--color);&:hover{background-color:var(--bg-hover)}&:active{background-color:var(--bg-click);background-image:var(--active-gradient);.buttonIcon,.buttonLabel{transform:translateY(1px)}}&[data-active=true],&[data-checked=true],&[data-dropdown-open=true]{background-color:var(--bg-active);background-image:none}&[data-active=true],&[data-dropdown-open=true]{pointer-events:none}}.buttonGroup{&>.buttonWrapper{margin:0;& .button[data-variant=link]{--outline:theme(backgroundColor.base)}}&:not(.vertical){&>:not(:first-child){&:before{border-inline-start:.5px solid theme(borderColor.base);content:"";inset-block:5%;inset-inline-start:-.5px;position:absolute}}&.separator>:not(:first-child){margin-inline-start:2px;&:before{inset-inline-start:-1.5px}}&>:not(:last-child) .button{border-end-end-radius:0;border-start-end-radius:0}&>:not(:first-child) .button{border-end-start-radius:0;border-start-start-radius:0}}&.vertical{&>:not(:first-child){&:before{border-block-start:.5px solid theme(borderColor.base);content:"";inset-block-start:-.5px;inset-inline:5%;position:absolute}}&.separator>:not(:first-child){margin-block-start:1px;&:before{inset-block-start:-1px}}&>:not(:last-child) .button{border-end-end-radius:0;border-end-start-radius:0}&>:not(:first-child) .button{border-start-end-radius:0;border-start-start-radius:0}}}}
|
|
1
|
+
@layer comp{.buttonWrapper{--color:theme(colors.primary.500);border-radius:var(--rounding);font-size:1rem;& .button{background-color:var(--bg);background-image:var(--click-gradient);border-radius:inherit;color:var(--text);outline:1px solid var(--outline);&.spinOnHover:hover .buttonIcon{& :global{animation:spin 2s linear infinite}}&>*{pointer-events:none}&:not(:disabled) input[type=file]{pointer-events:auto;&::-webkit-file-upload-button{cursor:pointer;inset:0;position:absolute}}}& .rounded{border-radius:9999px}& .buttonLabel{line-height:1;order:1;padding:.5em 1em;&+.altIcon{margin-inline-start:-1em}}& .buttonChild{line-height:1;order:1;padding:.5em}& .buttonIcon{font-size:1.125em;padding:.3889em}& :global(.hotkey-label){align-self:center;order:3}& .altIcon{align-self:center;order:4;padding:.125em .5em}& [data-ref=badge]{align-self:center;margin-inline-end:.5em;order:2}}.buttonGroup{&>.buttonWrapper{flex:0 1 1em}&:not(.flex)+&:not(.flex){margin-inline-start:.5rem}}}@layer util{.buttonWrapper{&[data-size=xs]{font-size:.625rem}&[data-size=sm]{font-size:.875rem}&[data-size=md]{font-size:1.125rem}&[data-size=lg]{font-size:1.25rem}&[data-size=xl]{font-size:1.5rem}}.button{--bg:color-mix(in lab,var(--fabric-bg) 99%,var(--tint));--outline:color-mix(in lab,var(--bg) 90%,var(--fabric-text));--text:color-mix(in lab,var(--color) 80%,var(--fabric-text));--bg-hover:color-mix(in lab,var(--color) 18%,var(--fabric-bg));--bg-click:color-mix(in lab,var(--color) 25%,var(--fabric-bg));--bg-active:color-mix(in lab,var(--color) 36%,var(--fabric-bg));&[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)}&[data-variant=outline]{--outline:var(--color)}&[data-variant=soft]{--bg:color-mix(in lab,var(--color) 25%,var(--fabric-bg));--bg-hover:color-mix(in lab,var(--color) 35%,var(--fabric-bg));--bg-click:color-mix(in lab,var(--color) 50%,theme(colors.tint.50));--bg-active:color-mix(in lab,var(--color) 50%,theme(colors.tint.50))}&[data-variant=solid]{--outline:var(--color);--bg:color-mix(in lab,var(--color) 96%,var(--fabric-text));--text:theme(colors.white);--bg-hover:color-mix(in lab,var(--color) 90%,var(--fabric-bg));--bg-click:color-mix(in lab,var(--color) 80%,theme(colors.black));--bg-active:color-mix(in lab,var(--color) 70%,theme(colors.black));& :global(.hotkey-label){background-color:theme(backgroundColor.dark/30%);color:theme(colors.white/70%)}}&[data-variant=link]{--bg:transparent;--outline:transparent;background-image:none;box-shadow:none}&[data-color=invert]{--bg:theme(backgroundColor.invert);--text:color-mix(in lab,var(--color) 90%,theme(textColor.invert));--bg-hover:color-mix(in lab,var(--color) 15%,theme(backgroundColor.invert));--bg-click:color-mix(in lab,var(--color) 35%,theme(backgroundColor.invert))}}.buttonIcon[data-align=start]{order:0;&+.buttonLabel[data-colored-icon=false]{margin-inline-start:-1em}}.buttonIcon[data-align=end]{order:2;&~.buttonLabel[data-colored-icon=false]{margin-inline-end:-1em}}}@layer var{.buttonWrapper{height:unset;padding:unset;&[data-disabled=true]{cursor:not-allowed;& .button{background-image:var(--active-gradient);opacity:.5;pointer-events:none}}&[data-loading=true]{cursor:wait;& .button{background-image:var(--progress-gradient);background-size:1em 1em;pointer-events:none;& :global{animation:bgprogress .75s linear infinite}}& .button:not([data-variant=solid]){background-color:color-mix(in lab,var(--color) 15%,var(--fabric-bg))}}&:global(.btn-dashed)>.button{color:theme(colors.tint.600);outline:1px dashed theme(colors.tint.600);&[data-invalid=true]{background-color:theme(colors.danger.100);color:theme(colors.danger.600);outline:1px dashed theme(colors.danger.600)}}}.button{--tw-ring-color:var(--color);&:hover{background-color:var(--bg-hover)}&:active{background-color:var(--bg-click);background-image:var(--active-gradient);.buttonIcon,.buttonLabel{transform:translateY(1px)}}&[data-active=true],&[data-checked=true],&[data-dropdown-open=true]{background-color:var(--bg-active);background-image:none}&[data-active=true],&[data-dropdown-open=true]{pointer-events:none}}.buttonGroup{&>.buttonWrapper{margin:0;& .button[data-variant=link]{--outline:theme(backgroundColor.base)}}&:not(.vertical){&>:not(:first-child){&:before{border-inline-start:.5px solid theme(borderColor.base);content:"";inset-block:5%;inset-inline-start:-.5px;position:absolute}}&.separator>:not(:first-child){margin-inline-start:2px;&:before{inset-inline-start:-1.5px}}&>:not(:last-child) .button{border-end-end-radius:0;border-start-end-radius:0}&>:not(:first-child) .button{border-end-start-radius:0;border-start-start-radius:0}}&.vertical{&>:not(:first-child){&:before{border-block-start:.5px solid theme(borderColor.base);content:"";inset-block-start:-.5px;inset-inline:5%;position:absolute}}&.separator>:not(:first-child){margin-block-start:1px;&:before{inset-block-start:-1px}}&>:not(:last-child) .button{border-end-end-radius:0;border-end-start-radius:0}&>:not(:first-child) .button{border-start-end-radius:0;border-start-start-radius:0}}}}
|
|
@@ -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
|
|
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),
|
|
70
70
|
style: styles,
|
|
71
71
|
"data-variant": variant,
|
|
72
72
|
"data-inner-clickable": !!onClick,
|
|
@@ -84,6 +84,7 @@ var Chip = function Chip(_ref) {
|
|
|
84
84
|
children: children
|
|
85
85
|
}), onRemove && /*#__PURE__*/jsx("span", {
|
|
86
86
|
role: "none",
|
|
87
|
+
"data-inner-cliackable": true,
|
|
87
88
|
className: classNames(classes.chipRemove, "cursor-pointer pe-1 opacity-65 hover:opacity-90"),
|
|
88
89
|
onClick: removeHandler,
|
|
89
90
|
children: "\xD7"
|
|
@@ -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);outline:1px solid color-mix(in lab,currentcolor 20%,var(--fabric-bg));outline-offset:-1px;&>.chipLabel{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
|
+
@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.25;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))}}}}}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
5
5
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
6
|
-
import { useFloatingParentNodeId,
|
|
6
|
+
import { useFloatingParentNodeId, useFloatingTree, FloatingTree, useFloatingNodeId, useFloating, offset, flip, shift, autoUpdate, useHover, safePolygon, useClick, useRole, useDismiss, useListNavigation, useTypeahead, useInteractions, FloatingNode, FloatingList, FloatingOverlay, FloatingFocusManager, FloatingPortal } from '@floating-ui/react';
|
|
7
7
|
import { mergeRefs, cloneChildren } from '@react-fabric/utilities';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import { useState, useRef, useEffect, useCallback, cloneElement, Fragment } from 'react';
|
|
@@ -137,6 +137,16 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
137
137
|
});
|
|
138
138
|
}, 100);
|
|
139
139
|
}, [isOpen]);
|
|
140
|
+
useEffect(function () {
|
|
141
|
+
if ((!isNested || isOpen) && activeIndex) {
|
|
142
|
+
setTimeout(function () {
|
|
143
|
+
var _elementsRef$current$;
|
|
144
|
+
(_elementsRef$current$ = elementsRef.current[activeIndex]) === null || _elementsRef$current$ === void 0 || _elementsRef$current$.scrollIntoView({
|
|
145
|
+
block: "nearest"
|
|
146
|
+
});
|
|
147
|
+
}, 100);
|
|
148
|
+
}
|
|
149
|
+
}, [isOpen, activeIndex]);
|
|
140
150
|
return /*#__PURE__*/jsxs(FloatingNode, {
|
|
141
151
|
id: nodeId,
|
|
142
152
|
children: [isNested && /*#__PURE__*/jsx(MenuItem, _objectSpread(_objectSpread({}, getReferenceProps(_objectSpread(_objectSpread({}, rest), {}, {
|
|
@@ -189,6 +199,7 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
189
199
|
};
|
|
190
200
|
var Menu = function Menu(props) {
|
|
191
201
|
var parentId = useFloatingParentNodeId();
|
|
202
|
+
var tree = useFloatingTree();
|
|
192
203
|
if (parentId === null) {
|
|
193
204
|
return /*#__PURE__*/jsx(FloatingTree, {
|
|
194
205
|
children: /*#__PURE__*/jsx(MenuComponent, _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -196,6 +207,11 @@ var Menu = function Menu(props) {
|
|
|
196
207
|
}))
|
|
197
208
|
});
|
|
198
209
|
}
|
|
210
|
+
if (tree) {
|
|
211
|
+
return /*#__PURE__*/jsx(MenuComponent, _objectSpread(_objectSpread({}, props), {}, {
|
|
212
|
+
menuClassName: props.className
|
|
213
|
+
}));
|
|
214
|
+
}
|
|
199
215
|
return /*#__PURE__*/jsx(MenuComponent, _objectSpread({}, props));
|
|
200
216
|
};
|
|
201
217
|
|
|
@@ -23,7 +23,7 @@ var useNavigator = function useNavigator() {
|
|
|
23
23
|
}, [totalCount]);
|
|
24
24
|
var headLabel = useMemo(function () {
|
|
25
25
|
return /*#__PURE__*/jsxs("span", {
|
|
26
|
-
className: "text-muted leading-
|
|
26
|
+
className: "text-muted leading-none select-none",
|
|
27
27
|
children: [currentIndex + 1, "/", totalCount]
|
|
28
28
|
});
|
|
29
29
|
}, [currentIndex, totalCount]);
|
|
@@ -114,15 +114,15 @@ var Alert = function Alert(_ref) {
|
|
|
114
114
|
className: classNames("area-[icon] text-lg py-2"),
|
|
115
115
|
children: iconType
|
|
116
116
|
}), /*#__PURE__*/jsx(Title, {
|
|
117
|
-
className: "font-medium area-[title]",
|
|
117
|
+
className: "font-medium area-[title] self-center",
|
|
118
118
|
children: title
|
|
119
|
-
}), /*#__PURE__*/jsx("
|
|
119
|
+
}), /*#__PURE__*/jsx("div", {
|
|
120
120
|
className: "area-[message] py-4",
|
|
121
121
|
children: message
|
|
122
122
|
}), type === "prompt" && /*#__PURE__*/jsx("input", {
|
|
123
123
|
value: value,
|
|
124
124
|
placeholder: placeholder,
|
|
125
|
-
className: classNames("border rounded
|
|
125
|
+
className: classNames("area-[input] appearance-none outline-0 ring-".concat(color, "-500 border rounded border-").concat(color, "-200 w-full px-2 py-1")),
|
|
126
126
|
ref: function ref(e) {
|
|
127
127
|
return e != null && setTimeout(function () {
|
|
128
128
|
return e.focus();
|
|
@@ -158,7 +158,7 @@ var Alert = function Alert(_ref) {
|
|
|
158
158
|
variant: "solid",
|
|
159
159
|
color: color,
|
|
160
160
|
onClick: function onClick() {
|
|
161
|
-
return handleClose(true);
|
|
161
|
+
return handleClose(type === "prompt" ? value : true);
|
|
162
162
|
},
|
|
163
163
|
children: okLabel !== null && okLabel !== void 0 ? okLabel : t("action.ok", "OK")
|
|
164
164
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer comp{.alert{gap:.5rem 1rem;grid-template:"icon title" auto "
|
|
1
|
+
@layer comp{.alert{gap:.5rem 1rem;grid-template:"icon title" auto "message message" auto "input input" auto "actions actions" auto/auto 1fr;margin-top:-100%;opacity:0;transition:margin .4s,opacity .3s .2s;z-index:var(--z-overlay);&[data-show=true]{margin-top:0;opacity:1}}}
|
|
@@ -98,7 +98,7 @@ var Text = function Text(_ref) {
|
|
|
98
98
|
"--text-clamp": showMore ? "unset" : clamp !== null && clamp !== void 0 ? clamp : "unset"
|
|
99
99
|
},
|
|
100
100
|
children: /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
|
|
101
|
-
className: classNames(classes.text, "
|
|
101
|
+
className: classNames(classes.text, "mixed-lang px-[2px] whitespace-pre-wrap", family && "font-".concat(family), bg && getBgClass(bg), color && getColorClass(color), clamp && "line-clamp-1"),
|
|
102
102
|
style: styles
|
|
103
103
|
}, aria), {}, {
|
|
104
104
|
children: children
|
|
@@ -48,7 +48,7 @@ var Title = function Title(_ref) {
|
|
|
48
48
|
}, [bg, color, size, align], "Title styles");
|
|
49
49
|
var E = as !== null && as !== void 0 ? as : "p";
|
|
50
50
|
return /*#__PURE__*/jsx(E, _objectSpread(_objectSpread({
|
|
51
|
-
className: classNames(classes.title,
|
|
51
|
+
className: classNames(classes.title, className, family && "font-".concat(family), !as && "text-lg", bg && getBgClass(bg), color && getColorClass(color)),
|
|
52
52
|
style: styles
|
|
53
53
|
}, aria), {}, {
|
|
54
54
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer comp{.title{line-height:1.125}.moreLink{margin:-.25rem 0 .25rem;text-align:end;&>span{color:theme(colors.accent.700);cursor:pointer;font-size:.75rem;user-select:none;&:hover{color:theme(colors.accent.500);text-decoration:underline;text-underline-offset:2px}}}}@layer util{.text{-webkit-line-clamp:var(--text-clamp)}.abbr{--abbr-color:var(--accent);color:color-mix(in lab,var(--abbr-color) 50%,var(--fabric-text))}.mark{--mark-color:var(--primary);background-color:color-mix(in lab,var(--mark-color) 25%,var(--fabric-bg))}}
|
|
1
|
+
@layer comp{.title{line-height:1.125;padding:4px 2px;white-space:prewrap}.moreLink{margin:-.25rem 0 .25rem;text-align:end;&>span{color:theme(colors.accent.700);cursor:pointer;font-size:.75rem;user-select:none;&:hover{color:theme(colors.accent.500);text-decoration:underline;text-underline-offset:2px}}}}@layer util{.text{-webkit-line-clamp:var(--text-clamp)}.abbr{--abbr-color:var(--accent);color:color-mix(in lab,var(--abbr-color) 50%,var(--fabric-text))}.mark{--mark-color:var(--primary);background-color:color-mix(in lab,var(--mark-color) 25%,var(--fabric-bg))}}
|
|
@@ -4,6 +4,10 @@ export interface BadgeProps extends CssProp, RefProp, IconProps, Partial<ChildPr
|
|
|
4
4
|
* make wrapper a block element
|
|
5
5
|
*/
|
|
6
6
|
block?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* inline badge
|
|
9
|
+
*/
|
|
10
|
+
inline?: boolean;
|
|
7
11
|
/**
|
|
8
12
|
* badge value
|
|
9
13
|
*/
|
|
@@ -22,4 +26,4 @@ export interface BadgeProps extends CssProp, RefProp, IconProps, Partial<ChildPr
|
|
|
22
26
|
placement?: "top-start" | "top-end" | "bottom-start" | "bottom-end" | "top" | "bottom" | "start" | "end";
|
|
23
27
|
}
|
|
24
28
|
export declare const getBadgeProps: (badge?: string | number | BadgeType) => AnyObject;
|
|
25
|
-
export declare const Badge: ({ ref, className, value, max, ping, block, placement, children, forButton, icon, iconBg, iconColor, rtlFlip, ...rest }: BadgeProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare const Badge: ({ ref, className, value, max, ping, block, inline, placement, children, forButton, icon, iconBg, iconColor, rtlFlip, ...rest }: BadgeProps) => import("react/jsx-runtime").JSX.Element;
|
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.18",
|
|
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.18",
|
|
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": "4795fee60aa3e7411934a688f7c53e42ca3297ed"
|
|
60
60
|
}
|
|
@@ -43,6 +43,10 @@ export interface BadgeProps
|
|
|
43
43
|
* make wrapper a block element
|
|
44
44
|
*/
|
|
45
45
|
block?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* inline badge
|
|
48
|
+
*/
|
|
49
|
+
inline?: boolean;
|
|
46
50
|
/**
|
|
47
51
|
* badge value
|
|
48
52
|
*/
|
|
@@ -90,6 +94,7 @@ export const Badge = ({
|
|
|
90
94
|
max,
|
|
91
95
|
ping,
|
|
92
96
|
block,
|
|
97
|
+
inline,
|
|
93
98
|
placement = "top-end",
|
|
94
99
|
children,
|
|
95
100
|
// @ts-expect-error ignore
|
|
@@ -120,7 +125,7 @@ export const Badge = ({
|
|
|
120
125
|
return (
|
|
121
126
|
<div
|
|
122
127
|
className={classNames(
|
|
123
|
-
forButton ? "contents" : "relative",
|
|
128
|
+
forButton || inline ? "contents" : "relative",
|
|
124
129
|
block ? "block" : "inline-block",
|
|
125
130
|
)}
|
|
126
131
|
>
|
|
@@ -138,7 +143,7 @@ export const Badge = ({
|
|
|
138
143
|
classes.badge,
|
|
139
144
|
className,
|
|
140
145
|
"inline-block p-px min-w-2 min-h-2 text-center select-none rounded-full leading-none z-5 pointer-events-none",
|
|
141
|
-
forButton && !placement ? "relative" : "absolute",
|
|
146
|
+
(forButton && !placement) || inline ? "relative" : "absolute",
|
|
142
147
|
)}
|
|
143
148
|
>
|
|
144
149
|
{label && <span className="p-1">{label}</span>}
|
|
@@ -166,6 +166,13 @@
|
|
|
166
166
|
--outline: var(--color);
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
&[data-variant="soft"] {
|
|
170
|
+
--bg: color-mix(in lab, var(--color) 25%, var(--fabric-bg));
|
|
171
|
+
--bg-hover: color-mix(in lab, var(--color) 35%, var(--fabric-bg));
|
|
172
|
+
--bg-click: color-mix(in lab, var(--color) 50%, theme(colors.tint.50));
|
|
173
|
+
--bg-active: color-mix(in lab, var(--color) 50%, theme(colors.tint.50));
|
|
174
|
+
}
|
|
175
|
+
|
|
169
176
|
&[data-variant="solid"] {
|
|
170
177
|
--outline: var(--color);
|
|
171
178
|
--bg: color-mix(in lab, var(--color) 96%, var(--fabric-text));
|
|
@@ -25,13 +25,16 @@
|
|
|
25
25
|
.chip {
|
|
26
26
|
--blank-gradient: linear-gradient(to bottom, #00000005 0%, #0000 10%);
|
|
27
27
|
|
|
28
|
+
font-size: 0.875rem;
|
|
28
29
|
color: theme(colors.tint.500);
|
|
30
|
+
|
|
29
31
|
background-image: var(--blank-gradient);
|
|
30
32
|
outline: 1px solid color-mix(in lab, currentcolor 20%, var(--fabric-bg));
|
|
31
33
|
outline-offset: -1px;
|
|
32
34
|
|
|
33
35
|
& > .chipLabel {
|
|
34
36
|
padding: 0 0.5em;
|
|
37
|
+
line-height: 1.25;
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
& > .chipIcon {
|
|
@@ -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
|
|
159
|
+
"select-none inline-flex flex-nowrap items-center max-w-72 rounded",
|
|
160
160
|
rounded && "rounded-full",
|
|
161
161
|
!!onClick && classes.clickable,
|
|
162
162
|
disabled && classes.disabled,
|
|
@@ -185,6 +185,7 @@ export const Chip = <Tag extends React.ElementType = "div">({
|
|
|
185
185
|
{onRemove && (
|
|
186
186
|
<span
|
|
187
187
|
role="none"
|
|
188
|
+
data-inner-cliackable
|
|
188
189
|
className={classNames(
|
|
189
190
|
classes.chipRemove,
|
|
190
191
|
"cursor-pointer pe-1 opacity-65 hover:opacity-90",
|
|
@@ -186,6 +186,16 @@ const MenuComponent = ({
|
|
|
186
186
|
);
|
|
187
187
|
}, [isOpen]);
|
|
188
188
|
|
|
189
|
+
useEffect(() => {
|
|
190
|
+
if ((!isNested || isOpen) && activeIndex) {
|
|
191
|
+
setTimeout(() => {
|
|
192
|
+
elementsRef.current[activeIndex]?.scrollIntoView({
|
|
193
|
+
block: "nearest",
|
|
194
|
+
});
|
|
195
|
+
}, 100);
|
|
196
|
+
}
|
|
197
|
+
}, [isOpen, activeIndex]);
|
|
198
|
+
|
|
189
199
|
return (
|
|
190
200
|
<FloatingNode id={nodeId}>
|
|
191
201
|
{isNested && (
|
|
@@ -259,6 +269,7 @@ const MenuComponent = ({
|
|
|
259
269
|
|
|
260
270
|
export const Menu = (props: MenuProps) => {
|
|
261
271
|
const parentId = useFloatingParentNodeId();
|
|
272
|
+
const tree = useFloatingTree();
|
|
262
273
|
|
|
263
274
|
if (parentId === null) {
|
|
264
275
|
return (
|
|
@@ -271,5 +282,14 @@ export const Menu = (props: MenuProps) => {
|
|
|
271
282
|
);
|
|
272
283
|
}
|
|
273
284
|
|
|
285
|
+
if (tree) {
|
|
286
|
+
return (
|
|
287
|
+
<MenuComponent
|
|
288
|
+
{...(props as AnyObject)}
|
|
289
|
+
menuClassName={props.className}
|
|
290
|
+
/>
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
|
|
274
294
|
return <MenuComponent {...props} />;
|
|
275
295
|
};
|
|
@@ -43,7 +43,7 @@ export const useNavigator = (totalCount = 0, defaultIndex = 0) => {
|
|
|
43
43
|
);
|
|
44
44
|
const headLabel = useMemo(
|
|
45
45
|
() => (
|
|
46
|
-
<span className="text-muted leading-
|
|
46
|
+
<span className="text-muted leading-none select-none">
|
|
47
47
|
{currentIndex + 1}/{totalCount}
|
|
48
48
|
</span>
|
|
49
49
|
),
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
.alert {
|
|
26
26
|
z-index: var(--z-overlay);
|
|
27
27
|
|
|
28
|
-
grid-template: "icon title" auto "
|
|
28
|
+
grid-template: "icon title" auto "message message" auto "input input" auto "actions actions" auto / auto 1fr;
|
|
29
29
|
gap: 0.5rem 1rem;
|
|
30
30
|
|
|
31
31
|
margin-top: -100%;
|
|
@@ -190,14 +190,16 @@ export const Alert = ({
|
|
|
190
190
|
{iconType}
|
|
191
191
|
</div>
|
|
192
192
|
|
|
193
|
-
<Title className="font-medium area-[title]">
|
|
194
|
-
|
|
193
|
+
<Title className="font-medium area-[title] self-center">
|
|
194
|
+
{title}
|
|
195
|
+
</Title>
|
|
196
|
+
<div className="area-[message] py-4">{message}</div>
|
|
195
197
|
{type === "prompt" && (
|
|
196
198
|
<input
|
|
197
199
|
value={value}
|
|
198
200
|
placeholder={placeholder}
|
|
199
201
|
className={classNames(
|
|
200
|
-
|
|
202
|
+
`area-[input] appearance-none outline-0 ring-${color}-500 border rounded border-${color}-200 w-full px-2 py-1`,
|
|
201
203
|
)}
|
|
202
204
|
ref={(e) => e != null && setTimeout(() => e.focus(), 100)}
|
|
203
205
|
onBlur={(e) => e.target.focus()}
|
|
@@ -228,7 +230,7 @@ export const Alert = ({
|
|
|
228
230
|
size="sm"
|
|
229
231
|
variant="solid"
|
|
230
232
|
color={color}
|
|
231
|
-
onClick={() => handleClose(true)}
|
|
233
|
+
onClick={() => handleClose(type === "prompt" ? value : true)}
|
|
232
234
|
>
|
|
233
235
|
{okLabel ?? t("action.ok", "OK")}
|
|
234
236
|
</Button>
|
package/src/typography/Text.tsx
CHANGED
|
@@ -165,7 +165,7 @@ export const Text = ({
|
|
|
165
165
|
<div
|
|
166
166
|
className={classNames(
|
|
167
167
|
classes.text,
|
|
168
|
-
"
|
|
168
|
+
"mixed-lang px-[2px] whitespace-pre-wrap",
|
|
169
169
|
family && `font-${family}`,
|
|
170
170
|
bg && getBgClass(bg),
|
|
171
171
|
color && getColorClass(color),
|
package/src/typography/Title.tsx
CHANGED