@react-fabric/core 1.0.0-beta.52 → 1.0.0-beta.53

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.
@@ -95,7 +95,7 @@
95
95
 
96
96
  .fabric-breadcrumbs[data-variant="modern"] {
97
97
  & > .fabric-breadcrumbLink {
98
- --linkcolor: color-mix(in lab, var(--color) 50%, var(--fabric-bg));
98
+ --linkcolor: color-mix(in lab, var(--color) 35%, var(--fabric-bg));
99
99
 
100
100
  position: relative;
101
101
  list-style: none;
@@ -164,11 +164,11 @@
164
164
  }
165
165
 
166
166
  &:hover {
167
- --linkcolor: color-mix(in lab, var(--color) 65%, var(--fabric-bg));
167
+ --linkcolor: color-mix(in lab, var(--color) 40%, var(--fabric-bg));
168
168
  }
169
169
 
170
170
  &:active {
171
- --linkcolor: color-mix(in lab, var(--color) 35%, var(--fabric-bg));
171
+ --linkcolor: color-mix(in lab, var(--color) 45%, var(--fabric-bg));
172
172
  }
173
173
  }
174
174
  }
@@ -70,6 +70,8 @@
70
70
  &.active {
71
71
  pointer-events: none;
72
72
  background-color: color-mix(in lab, var(--color) 20%, var(--fabric-bg));
73
+ border-start-start-radius: 0;
74
+ border-end-start-radius: 0;
73
75
 
74
76
  & > div {
75
77
  box-shadow: 4px 0 0 var(--color) inset;
@@ -112,14 +112,14 @@
112
112
 
113
113
  &::before {
114
114
  height: 32px;
115
- border: 1px solid var(--color-tint-700);
115
+ border: 1px solid var(--color-tint-500);
116
116
  border-width: 0 1.5px;
117
117
  }
118
118
 
119
119
  &:hover::before,
120
120
  &:active::before {
121
121
  height: 100%;
122
- background-color: var(--color-primary-600);
122
+ background-color: var(--color-primary-300);
123
123
  border-color: var(--bg-color-base);
124
124
  border-width: 0 1.25px;
125
125
  }
@@ -81,8 +81,8 @@
81
81
  unicode-bidi: plaintext;
82
82
  }
83
83
 
84
- @utility flex-auto {
85
- flex: 0 0 auto;
84
+ @utility flex-content {
85
+ flex: 0 1 auto;
86
86
  }
87
87
 
88
88
  @utility flex-full {
@@ -95,7 +95,7 @@ var Badge = function Badge(_ref) {
95
95
  "data-ref": "badge",
96
96
  "data-ping": ping,
97
97
  "data-placement": placement,
98
- className: classNames("fabric-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"),
98
+ className: classNames("fabric-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 flex-content" : "absolute"),
99
99
  children: [label && /*#__PURE__*/jsxRuntime.jsx("span", {
100
100
  className: "p-1",
101
101
  children: label
@@ -51,7 +51,7 @@ var Breadcrumbs = function Breadcrumbs(_ref) {
51
51
  color = _ref.color,
52
52
  aria = _objectWithoutProperties(_ref, _excluded);
53
53
  var _useMemo = react.useMemo(function () {
54
- var nodeList = react.Children.toArray(children);
54
+ var nodeList = react.Children.toArray(children).filter(Boolean);
55
55
  if (nodeList.length > 7) {
56
56
  return [nodeList.slice(0, 3), nodeList.slice(3, -3), nodeList.slice(-3)];
57
57
  }
@@ -174,7 +174,7 @@ var Button = function Button(_ref) {
174
174
  className: classNames("fabric-buttonLabel", "truncate"),
175
175
  "data-colored-icon": !!iconBg,
176
176
  children: children
177
- }), !utilities.isNil(badge) && /*#__PURE__*/jsxRuntime.jsx(Badge.Badge, _objectSpread({}, badgeProps)), hotKey && /*#__PURE__*/jsxRuntime.jsx(HotKeyLabel.HotKeyLabel, {
177
+ }), !utilities.isNil(badge) && /*#__PURE__*/jsxRuntime.jsx(Badge.Badge, _objectSpread({}, badgeProps)), hotKey && children && /*#__PURE__*/jsxRuntime.jsx(HotKeyLabel.HotKeyLabel, {
178
178
  keyCombo: hotKey
179
179
  }), altIcon && /*#__PURE__*/jsxRuntime.jsx(Icon.Icon, {
180
180
  className: "fabric-altIcon",
@@ -130,7 +130,7 @@ var MenuItem = function MenuItem(_ref) {
130
130
  ref: utilities.mergeRefs(ref, elRef),
131
131
  "data-dropdown-dismiss": true,
132
132
  "data-color": color,
133
- className: classNames("fabric-menuItem cursor-pointer", className, active && "active", minimal && "minimal", disabled && "disabled", "rounded-capped relative max-w-[50vw] my-0.5"),
133
+ className: classNames("fabric-menuItem cursor-pointer", className, active && "active", minimal && "minimal", disabled && "disabled", "rounded relative max-w-[50vw] my-0.5"),
134
134
  "data-active": active,
135
135
  "data-open": childOpen,
136
136
  disabled: disabled,
@@ -106,7 +106,7 @@ var Col = function Col(_ref3) {
106
106
  stretchContent = _ref3.stretchContent,
107
107
  aria = _objectWithoutProperties(_ref3, _excluded3);
108
108
  return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread({
109
- className: classNames("fabric-col", className, stretchContent && "stretchContent", flex === "fill" && "flex-1", flex === "full" && "flex-full", flex === "auto" && "flex-auto", flex === "initial" && "flex-initial", flex === "content" && "flex-none", align && "self-".concat(align), truncate && "truncate")
109
+ className: classNames("fabric-col", className, stretchContent && "stretchContent", flex === "fill" && "flex-1", flex === "full" && "flex-full", flex === "auto" && "flex-auto", flex === "initial" && "flex-initial", flex === "content" && "flex-content", align && "self-".concat(align), truncate && "truncate")
110
110
  }, aria), {}, {
111
111
  children: children
112
112
  }));
@@ -1,46 +1,30 @@
1
1
  'use strict';
2
2
 
3
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
+ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
3
5
  var classNames = require('classnames');
4
6
  var ErrorBoundary = require('../boundary/ErrorBoundary.js');
5
7
  var jsxRuntime = require('react/jsx-runtime');
6
8
 
7
- /*
8
- * React Fabric
9
- * @version: 1.0.0
10
- *
11
- *
12
- * The MIT License (MIT)
13
- * Copyright (c) 2024 Adarsh Pastakia
14
- *
15
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
16
- * and associated documentation files (the "Software"), to deal in the Software without restriction,
17
- * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
18
- * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
19
- * subject to the following conditions:
20
- *
21
- * The above copyright notice and this permission notice shall be included in all copies or substantial
22
- * portions of the Software.
23
- *
24
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
25
- * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
- */
29
-
9
+ var _excluded = ["children", "className", "dir", "ref"];
10
+ 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; }
11
+ 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; }
30
12
  var Section = function Section(_ref) {
31
13
  var children = _ref.children,
32
14
  className = _ref.className,
33
15
  dir = _ref.dir,
34
- ref = _ref.ref;
35
- return /*#__PURE__*/jsxRuntime.jsx("div", {
16
+ ref = _ref.ref,
17
+ rest = _objectWithoutProperties(_ref, _excluded);
18
+ return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread({
36
19
  "data-ref": "section",
37
20
  dir: dir,
38
- ref: ref,
21
+ ref: ref
22
+ }, rest), {}, {
39
23
  className: classNames("fabric-section", className, "grid area-content overflow-hidden"),
40
24
  children: /*#__PURE__*/jsxRuntime.jsx(ErrorBoundary.ErrorBoundary, {
41
25
  children: children
42
26
  })
43
- });
27
+ }));
44
28
  };
45
29
 
46
30
  exports.Section = Section;
@@ -95,7 +95,7 @@ var Badge = function Badge(_ref) {
95
95
  "data-ref": "badge",
96
96
  "data-ping": ping,
97
97
  "data-placement": placement,
98
- className: classNames("fabric-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"),
98
+ className: classNames("fabric-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 flex-content" : "absolute"),
99
99
  children: [label && /*#__PURE__*/jsx("span", {
100
100
  className: "p-1",
101
101
  children: label
@@ -51,7 +51,7 @@ var Breadcrumbs = function Breadcrumbs(_ref) {
51
51
  color = _ref.color,
52
52
  aria = _objectWithoutProperties(_ref, _excluded);
53
53
  var _useMemo = useMemo(function () {
54
- var nodeList = Children.toArray(children);
54
+ var nodeList = Children.toArray(children).filter(Boolean);
55
55
  if (nodeList.length > 7) {
56
56
  return [nodeList.slice(0, 3), nodeList.slice(3, -3), nodeList.slice(-3)];
57
57
  }
@@ -174,7 +174,7 @@ var Button = function Button(_ref) {
174
174
  className: classNames("fabric-buttonLabel", "truncate"),
175
175
  "data-colored-icon": !!iconBg,
176
176
  children: children
177
- }), !isNil(badge) && /*#__PURE__*/jsx(Badge, _objectSpread({}, badgeProps)), hotKey && /*#__PURE__*/jsx(HotKeyLabel, {
177
+ }), !isNil(badge) && /*#__PURE__*/jsx(Badge, _objectSpread({}, badgeProps)), hotKey && children && /*#__PURE__*/jsx(HotKeyLabel, {
178
178
  keyCombo: hotKey
179
179
  }), altIcon && /*#__PURE__*/jsx(Icon, {
180
180
  className: "fabric-altIcon",
@@ -130,7 +130,7 @@ var MenuItem = function MenuItem(_ref) {
130
130
  ref: mergeRefs(ref, elRef),
131
131
  "data-dropdown-dismiss": true,
132
132
  "data-color": color,
133
- className: classNames("fabric-menuItem cursor-pointer", className, active && "active", minimal && "minimal", disabled && "disabled", "rounded-capped relative max-w-[50vw] my-0.5"),
133
+ className: classNames("fabric-menuItem cursor-pointer", className, active && "active", minimal && "minimal", disabled && "disabled", "rounded relative max-w-[50vw] my-0.5"),
134
134
  "data-active": active,
135
135
  "data-open": childOpen,
136
136
  disabled: disabled,
@@ -106,7 +106,7 @@ var Col = function Col(_ref3) {
106
106
  stretchContent = _ref3.stretchContent,
107
107
  aria = _objectWithoutProperties(_ref3, _excluded3);
108
108
  return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
109
- className: classNames("fabric-col", className, stretchContent && "stretchContent", flex === "fill" && "flex-1", flex === "full" && "flex-full", flex === "auto" && "flex-auto", flex === "initial" && "flex-initial", flex === "content" && "flex-none", align && "self-".concat(align), truncate && "truncate")
109
+ className: classNames("fabric-col", className, stretchContent && "stretchContent", flex === "fill" && "flex-1", flex === "full" && "flex-full", flex === "auto" && "flex-auto", flex === "initial" && "flex-initial", flex === "content" && "flex-content", align && "self-".concat(align), truncate && "truncate")
110
110
  }, aria), {}, {
111
111
  children: children
112
112
  }));
@@ -1,46 +1,30 @@
1
1
  'use client';
2
2
 
3
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
3
5
  import classNames from 'classnames';
4
6
  import { ErrorBoundary } from '../boundary/ErrorBoundary.js';
5
7
  import { jsx } from 'react/jsx-runtime';
6
8
 
7
- /*
8
- * React Fabric
9
- * @version: 1.0.0
10
- *
11
- *
12
- * The MIT License (MIT)
13
- * Copyright (c) 2024 Adarsh Pastakia
14
- *
15
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
16
- * and associated documentation files (the "Software"), to deal in the Software without restriction,
17
- * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
18
- * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
19
- * subject to the following conditions:
20
- *
21
- * The above copyright notice and this permission notice shall be included in all copies or substantial
22
- * portions of the Software.
23
- *
24
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
25
- * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
- */
29
-
9
+ var _excluded = ["children", "className", "dir", "ref"];
10
+ 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; }
11
+ 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; }
30
12
  var Section = function Section(_ref) {
31
13
  var children = _ref.children,
32
14
  className = _ref.className,
33
15
  dir = _ref.dir,
34
- ref = _ref.ref;
35
- return /*#__PURE__*/jsx("div", {
16
+ ref = _ref.ref,
17
+ rest = _objectWithoutProperties(_ref, _excluded);
18
+ return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
36
19
  "data-ref": "section",
37
20
  dir: dir,
38
- ref: ref,
21
+ ref: ref
22
+ }, rest), {}, {
39
23
  className: classNames("fabric-section", className, "grid area-content overflow-hidden"),
40
24
  children: /*#__PURE__*/jsx(ErrorBoundary, {
41
25
  children: children
42
26
  })
43
- });
27
+ }));
44
28
  };
45
29
 
46
30
  export { Section };
@@ -1,4 +1,4 @@
1
- import { type ChildrenProp, type CssProp, type RefProp } from "../../types";
1
+ import { TestProps, type ChildrenProp, type CssProp, type RefProp } from "../../types";
2
2
  /**
3
3
  * A component that represents a section of content within a page, with templated grid layout.
4
4
  * It can be used to group related content together and can be styled with additional CSS classes.
@@ -17,6 +17,6 @@ import { type ChildrenProp, type CssProp, type RefProp } from "../../types";
17
17
  *
18
18
  * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-application--section} for more details.
19
19
  */
20
- export declare const Section: ({ children, className, dir, ref, }: ChildrenProp & CssProp & RefProp<HTMLDivElement> & {
20
+ export declare const Section: ({ children, className, dir, ref, ...rest }: ChildrenProp & CssProp & TestProps & RefProp<HTMLDivElement> & {
21
21
  dir?: "ltr" | "rtl";
22
22
  }) => 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.52",
3
+ "version": "1.0.0-beta.53",
4
4
  "description": "RUF: Core package",
5
5
  "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
6
  "license": "MIT",
@@ -54,5 +54,5 @@
54
54
  "node": ">=18.12.0",
55
55
  "npm": ">=8.19.0"
56
56
  },
57
- "gitHead": "0eabb9d88d91af93d657bcc209b226fd576e8260"
57
+ "gitHead": "1042327831f9c908912c552d5c2704b765a6f9c2"
58
58
  }
@@ -170,7 +170,9 @@ export const Badge = ({
170
170
  "fabric-badge",
171
171
  className,
172
172
  "inline-block p-px min-w-2 min-h-2 text-center select-none rounded-full leading-none z-2 pointer-events-none",
173
- (forButton && !placement) || inline ? "relative" : "absolute",
173
+ (forButton && !placement) || inline
174
+ ? "relative flex-content"
175
+ : "absolute",
174
176
  )}
175
177
  >
176
178
  {label && <span className="p-1">{label}</span>}
@@ -83,7 +83,7 @@ export const Breadcrumbs = ({
83
83
  ...aria
84
84
  }: BreadcrumbProps) => {
85
85
  const [start, overflow, end] = useMemo(() => {
86
- const nodeList = Children.toArray(children as AnyObject);
86
+ const nodeList = Children.toArray(children as AnyObject).filter(Boolean);
87
87
  if (nodeList.length > 7) {
88
88
  return [nodeList.slice(0, 3), nodeList.slice(3, -3), nodeList.slice(-3)];
89
89
  }
@@ -329,7 +329,7 @@ export const Button = <Tag extends React.ElementType = "button">({
329
329
  </label>
330
330
  )}
331
331
  {!isNil(badge) && <Badge {...badgeProps} />}
332
- {hotKey && <HotKeyLabel keyCombo={hotKey} />}
332
+ {hotKey && children && <HotKeyLabel keyCombo={hotKey} />}
333
333
  {altIcon && (
334
334
  <Icon className={"fabric-altIcon"} icon={altIcon} rtlFlip />
335
335
  )}
@@ -171,7 +171,7 @@ export const MenuItem = <Tag extends React.ElementType = "button">({
171
171
  active && "active",
172
172
  minimal && "minimal",
173
173
  disabled && "disabled",
174
- "rounded-capped relative max-w-[50vw] my-0.5",
174
+ "rounded relative max-w-[50vw] my-0.5",
175
175
  )}
176
176
  data-active={active}
177
177
  data-open={childOpen}
@@ -218,7 +218,7 @@ export const Col = ({
218
218
  flex === "full" && "flex-full",
219
219
  flex === "auto" && "flex-auto",
220
220
  flex === "initial" && "flex-initial",
221
- flex === "content" && "flex-none",
221
+ flex === "content" && "flex-content",
222
222
  align && `self-${align}`,
223
223
  truncate && "truncate",
224
224
  )}
@@ -22,7 +22,12 @@
22
22
  */
23
23
 
24
24
  import classNames from "classnames";
25
- import { type ChildrenProp, type CssProp, type RefProp } from "../../types";
25
+ import {
26
+ TestProps,
27
+ type ChildrenProp,
28
+ type CssProp,
29
+ type RefProp,
30
+ } from "../../types";
26
31
  import { ErrorBoundary } from "../boundary/ErrorBoundary";
27
32
 
28
33
  /**
@@ -48,14 +53,17 @@ export const Section = ({
48
53
  className,
49
54
  dir,
50
55
  ref,
56
+ ...rest
51
57
  }: ChildrenProp &
52
58
  CssProp &
59
+ TestProps &
53
60
  RefProp<HTMLDivElement> & { dir?: "ltr" | "rtl" }) => {
54
61
  return (
55
62
  <div
56
63
  data-ref="section"
57
64
  dir={dir}
58
65
  ref={ref}
66
+ {...rest}
59
67
  className={classNames(
60
68
  "fabric-section",
61
69
  className,