@react-fabric/core 1.0.0-beta.44 → 1.0.0-beta.46

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.
@@ -134,7 +134,7 @@
134
134
  --text: color-mix(in lab, var(--color) 80%, var(--fabric-text));
135
135
  --bg-hover: color-mix(in lab, var(--color) 18%, var(--fabric-bg));
136
136
  --bg-click: color-mix(in lab, var(--color) 25%, var(--fabric-bg));
137
- --bg-active: color-mix(in lab, var(--color) 36%, var(--fabric-bg));
137
+ --bg-active: color-mix(in lab, var(--color) 24%, var(--fabric-bg));
138
138
 
139
139
  &[data-color="accent"] {
140
140
  --color: var(--color-accent-500);
@@ -56,20 +56,20 @@
56
56
  }
57
57
 
58
58
  &[data-focus="true"] {
59
- background-color: color(from var(--color) srgb r g b / 15%);
59
+ background-color: color-mix(in lab, var(--color) 15%, var(--fabric-bg));
60
60
  }
61
61
 
62
62
  &:active {
63
- background-color: color(from var(--color) srgb r g b / 35%);
63
+ background-color: color-mix(in lab, var(--color) 35%, var(--fabric-bg));
64
64
  }
65
65
 
66
66
  &[data-open="true"] {
67
- background-color: color(from var(--color) srgb r g b / 10%);
67
+ background-color: color-mix(in lab, var(--color) 10%, var(--fabric-bg));
68
68
  }
69
69
 
70
70
  &.active {
71
71
  pointer-events: none;
72
- background-color: color(from var(--color) srgb r g b / 20%);
72
+ background-color: color-mix(in lab, var(--color) 20%, var(--fabric-bg));
73
73
 
74
74
  & > div {
75
75
  box-shadow: 4px 0 0 var(--color) inset;
@@ -21,7 +21,45 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
- @layer theme {
24
+ @layer theme {
25
+ :root {
26
+ /* app default primary */
27
+ --color-primary: var(--color-denim-500);
28
+ --color-accent: var(--color-jade-500);
29
+ --color-tint: var(--color-silver-500);
30
+
31
+ /* default rounding */
32
+ --rounding: 0.25rem;
33
+ --rounding-cap: 0.25rem;
34
+ --gutter: 0.5rem;
35
+
36
+ /* z levels */
37
+ --z-overlay-mask: 25;
38
+ --z-overlay: 30;
39
+ --z-popover-mask: 45;
40
+ --z-popover: 50;
41
+ --z-tooltip: 60;
42
+ --z-notifications: 60;
43
+ }
44
+
45
+ [data-rounding="sm"] {
46
+ /* default rounding */
47
+ --rounding: 2px;
48
+ --rounding-cap: 2px;
49
+ }
50
+
51
+ [data-rounding="md"] {
52
+ /* default rounding */
53
+ --rounding: 0.5rem;
54
+ --rounding-cap: 0.5rem;
55
+ }
56
+
57
+ [data-rounding="full"] {
58
+ /* default rounding */
59
+ --rounding: 9999px;
60
+ --rounding-cap: 0.5rem;
61
+ }
62
+
25
63
  [data-color-scheme="light"] {
26
64
  --fabric-bg: var(--color-white);
27
65
  --fabric-text: var(--color-black);
@@ -43,27 +81,7 @@
43
81
  }
44
82
  }
45
83
 
46
- @layer base {
47
- :root {
48
- /* app default primary */
49
- --color-primary: var(--color-denim-500);
50
- --color-accent: var(--color-jade-500);
51
- --color-tint: var(--color-silver-500);
52
-
53
- /* default rounding */
54
- --rounding: 0.25rem;
55
- --rounding-cap: 0.25rem;
56
- --gutter: 0.5rem;
57
-
58
- /* z levels */
59
- --z-overlay-mask: 25;
60
- --z-overlay: 30;
61
- --z-popover-mask: 45;
62
- --z-popover: 50;
63
- --z-tooltip: 60;
64
- --z-notifications: 60;
65
- }
66
-
84
+ @layer theme {
67
85
  [data-color-scheme] {
68
86
  /* primary */
69
87
  --color-primary-50: color-mix(in oklab, var(--color-primary) 10%, var(--fabric-bg));
@@ -366,28 +384,6 @@
366
384
  --border-color-light: color-mix(in oklab, var(--color-white) 75%, var(--color-tint));
367
385
 
368
386
  color: color-mix(in lab, var(--fabric-text) 95%, var(--color-tint));
369
- background-color: color-mix(
370
- in lab,
371
- var(--fabric-bg) 92%,
372
- var(--color-tint)
373
- );
387
+ background-color: color-mix(in lab, var(--fabric-bg) 92%, var(--color-tint));
374
388
  }
375
-
376
- [data-rounding="sm"] {
377
- /* default rounding */
378
- --rounding: 2px;
379
- --rounding-cap: 2px;
380
- }
381
-
382
- [data-rounding="md"] {
383
- /* default rounding */
384
- --rounding: 0.5rem;
385
- --rounding-cap: 0.5rem;
386
- }
387
-
388
- [data-rounding="full"] {
389
- /* default rounding */
390
- --rounding: 9999px;
391
- --rounding-cap: 0.5rem;
392
- }
393
- }
389
+ }
@@ -81,6 +81,10 @@
81
81
  unicode-bidi: plaintext;
82
82
  }
83
83
 
84
+ @utility flex-auto {
85
+ flex: 0 0 auto;
86
+ }
87
+
84
88
  @utility flex-full {
85
89
  flex: 1 1 100%;
86
90
  }
@@ -123,11 +123,7 @@ var DropdownElement = function DropdownElement(_ref) {
123
123
  context: context,
124
124
  modal: true,
125
125
  children: /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread(_objectSpread({
126
- ref: function ref(el) {
127
- var _el$querySelector;
128
- refs.setFloating(el);
129
- el === null || el === void 0 || (_el$querySelector = el.querySelector("input,textarea,button")) === null || _el$querySelector === void 0 || _el$querySelector.focus();
130
- },
126
+ ref: refs.setFloating,
131
127
  style: _objectSpread({
132
128
  minWidth: minWidth,
133
129
  zIndex: "var(--z-popover)"
@@ -73,13 +73,13 @@ var EmptyContent = function EmptyContent(_ref) {
73
73
  children: [utilities.isString(icon) && /*#__PURE__*/jsxRuntime.jsx(Icon.Icon, {
74
74
  icon: icon
75
75
  }), /*#__PURE__*/react.isValidElement(icon) && icon, !icon && /*#__PURE__*/jsxRuntime.jsx(DefaultIcon, {})]
76
- }), title && /*#__PURE__*/jsxRuntime.jsx("p", {
76
+ }), title && /*#__PURE__*/jsxRuntime.jsx("div", {
77
77
  className: "font-medium text-center text-dimmed",
78
78
  style: {
79
79
  fontSize: "1.5em"
80
80
  },
81
81
  children: title
82
- }), /*#__PURE__*/jsxRuntime.jsx("p", {
82
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
83
83
  className: "font-medium text-center text-muted",
84
84
  style: {
85
85
  fontSize: "0.875em"
@@ -61,7 +61,7 @@ var Tab = function Tab(_ref) {
61
61
  disabled: disabled,
62
62
  "data-color": color,
63
63
  "data-inner-clickable": true,
64
- className: classNames("fabric-tabButton", className, active && "active pointer-events-none", active && activeClassName, disabled && "text-tint-500 pointer-events-none", tabFlex ? "flex-1" : "flex-initial max-w-36", minimal ? "min-w-6" : "min-w-18", "flex items-center justify-center px-1 rounded overflow-hidden"),
64
+ className: classNames("fabric-tabButton", className, active && "active pointer-events-none", active && activeClassName, disabled && "text-tint-500 pointer-events-none", tabFlex ? "flex-1" : "flex-initial max-w-36", minimal ? "min-w-6" : "min-w-18", "flex items-center justify-center px-1 rounded overflow-hidden cursor-pointer"),
65
65
  onClick: function onClick() {
66
66
  return !active && (_onClick === null || _onClick === void 0 ? void 0 : _onClick(id));
67
67
  },
@@ -3,6 +3,7 @@
3
3
  var utilities = require('@react-fabric/utilities');
4
4
  var classNames = require('classnames');
5
5
  var react = require('react');
6
+ var Global = require('../../context/Global.js');
6
7
  var jsxRuntime = require('react/jsx-runtime');
7
8
 
8
9
  /*
@@ -39,6 +40,8 @@ var ThemeProvider = function ThemeProvider(_ref) {
39
40
  tintColor = _ref.tintColor,
40
41
  colorScheme = _ref.colorScheme,
41
42
  rounding = _ref.rounding;
43
+ var _useApplicationContex = Global.useApplicationContext(),
44
+ currentColorScheme = _useApplicationContex.currentColorScheme;
42
45
  var styles = react.useMemo(function () {
43
46
  var ret = {};
44
47
  if (primaryColor && utilities.isColor(primaryColor)) {
@@ -63,7 +66,7 @@ var ThemeProvider = function ThemeProvider(_ref) {
63
66
  }, [primaryColor, accentColor, tintColor]);
64
67
  return /*#__PURE__*/jsxRuntime.jsx("div", {
65
68
  style: styles,
66
- "data-color-scheme": colorScheme,
69
+ "data-color-scheme": colorScheme !== null && colorScheme !== void 0 ? colorScheme : currentColorScheme,
67
70
  "data-rounding": rounding,
68
71
  className: classNames("fabric-themeProvider", "contents theme-base", branding),
69
72
  children: children
@@ -92,8 +92,9 @@ var Tooltip = function Tooltip(_ref) {
92
92
  var copyEl = react.useMemo(function () {
93
93
  if (copyContent) {
94
94
  var copyText = utilities.isString(copyContent) ? copyContent : content;
95
- var handler = function handler() {
95
+ var handler = function handler(e) {
96
96
  setIsOpen(false);
97
+ e.stopPropagation();
97
98
  void navigator.clipboard.writeText(copyText.toString());
98
99
  };
99
100
  return /*#__PURE__*/jsxRuntime.jsx("span", {
@@ -123,11 +123,7 @@ var DropdownElement = function DropdownElement(_ref) {
123
123
  context: context,
124
124
  modal: true,
125
125
  children: /*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({
126
- ref: function ref(el) {
127
- var _el$querySelector;
128
- refs.setFloating(el);
129
- el === null || el === void 0 || (_el$querySelector = el.querySelector("input,textarea,button")) === null || _el$querySelector === void 0 || _el$querySelector.focus();
130
- },
126
+ ref: refs.setFloating,
131
127
  style: _objectSpread({
132
128
  minWidth: minWidth,
133
129
  zIndex: "var(--z-popover)"
@@ -73,13 +73,13 @@ var EmptyContent = function EmptyContent(_ref) {
73
73
  children: [isString(icon) && /*#__PURE__*/jsx(Icon, {
74
74
  icon: icon
75
75
  }), /*#__PURE__*/isValidElement(icon) && icon, !icon && /*#__PURE__*/jsx(DefaultIcon, {})]
76
- }), title && /*#__PURE__*/jsx("p", {
76
+ }), title && /*#__PURE__*/jsx("div", {
77
77
  className: "font-medium text-center text-dimmed",
78
78
  style: {
79
79
  fontSize: "1.5em"
80
80
  },
81
81
  children: title
82
- }), /*#__PURE__*/jsx("p", {
82
+ }), /*#__PURE__*/jsx("div", {
83
83
  className: "font-medium text-center text-muted",
84
84
  style: {
85
85
  fontSize: "0.875em"
@@ -61,7 +61,7 @@ var Tab = function Tab(_ref) {
61
61
  disabled: disabled,
62
62
  "data-color": color,
63
63
  "data-inner-clickable": true,
64
- className: classNames("fabric-tabButton", className, active && "active pointer-events-none", active && activeClassName, disabled && "text-tint-500 pointer-events-none", tabFlex ? "flex-1" : "flex-initial max-w-36", minimal ? "min-w-6" : "min-w-18", "flex items-center justify-center px-1 rounded overflow-hidden"),
64
+ className: classNames("fabric-tabButton", className, active && "active pointer-events-none", active && activeClassName, disabled && "text-tint-500 pointer-events-none", tabFlex ? "flex-1" : "flex-initial max-w-36", minimal ? "min-w-6" : "min-w-18", "flex items-center justify-center px-1 rounded overflow-hidden cursor-pointer"),
65
65
  onClick: function onClick() {
66
66
  return !active && (_onClick === null || _onClick === void 0 ? void 0 : _onClick(id));
67
67
  },
@@ -3,6 +3,7 @@
3
3
  import { isColor } from '@react-fabric/utilities';
4
4
  import classNames from 'classnames';
5
5
  import { useMemo } from 'react';
6
+ import { useApplicationContext } from '../../context/Global.js';
6
7
  import { jsx } from 'react/jsx-runtime';
7
8
 
8
9
  /*
@@ -39,6 +40,8 @@ var ThemeProvider = function ThemeProvider(_ref) {
39
40
  tintColor = _ref.tintColor,
40
41
  colorScheme = _ref.colorScheme,
41
42
  rounding = _ref.rounding;
43
+ var _useApplicationContex = useApplicationContext(),
44
+ currentColorScheme = _useApplicationContex.currentColorScheme;
42
45
  var styles = useMemo(function () {
43
46
  var ret = {};
44
47
  if (primaryColor && isColor(primaryColor)) {
@@ -63,7 +66,7 @@ var ThemeProvider = function ThemeProvider(_ref) {
63
66
  }, [primaryColor, accentColor, tintColor]);
64
67
  return /*#__PURE__*/jsx("div", {
65
68
  style: styles,
66
- "data-color-scheme": colorScheme,
69
+ "data-color-scheme": colorScheme !== null && colorScheme !== void 0 ? colorScheme : currentColorScheme,
67
70
  "data-rounding": rounding,
68
71
  className: classNames("fabric-themeProvider", "contents theme-base", branding),
69
72
  children: children
@@ -92,8 +92,9 @@ var Tooltip = function Tooltip(_ref) {
92
92
  var copyEl = useMemo(function () {
93
93
  if (copyContent) {
94
94
  var copyText = isString(copyContent) ? copyContent : content;
95
- var handler = function handler() {
95
+ var handler = function handler(e) {
96
96
  setIsOpen(false);
97
+ e.stopPropagation();
97
98
  void navigator.clipboard.writeText(copyText.toString());
98
99
  };
99
100
  return /*#__PURE__*/jsx("span", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-fabric/core",
3
- "version": "1.0.0-beta.44",
3
+ "version": "1.0.0-beta.46",
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.44",
39
+ "@react-fabric/utilities": "^1.0.0-beta.46",
40
40
  "@tailwindcss/postcss": "~4.0.14",
41
41
  "boring-avatars": "^1.10.2",
42
42
  "classnames": "^2.5.1",
@@ -54,5 +54,5 @@
54
54
  "node": ">=18.12.0",
55
55
  "npm": ">=8.19.0"
56
56
  },
57
- "gitHead": "5c05c100917811fa40b30c98b94fd396b1f68ea9"
57
+ "gitHead": "0dfc20b9c84712bb1cb5205c22464e8a1eb2341c"
58
58
  }
@@ -237,12 +237,7 @@ const DropdownElement = ({
237
237
  <FloatingOverlay />
238
238
  <FloatingFocusManager context={context} modal>
239
239
  <div
240
- ref={(el) => {
241
- refs.setFloating(el);
242
- el
243
- ?.querySelector<HTMLElement>("input,textarea,button")
244
- ?.focus();
245
- }}
240
+ ref={refs.setFloating}
246
241
  style={{
247
242
  minWidth,
248
243
  zIndex: "var(--z-popover)",
@@ -137,19 +137,19 @@ export const EmptyContent = ({
137
137
  {!icon && <DefaultIcon />}
138
138
  </div>
139
139
  {title && (
140
- <p
140
+ <div
141
141
  className="font-medium text-center text-dimmed"
142
142
  style={{ fontSize: "1.5em" }}
143
143
  >
144
144
  {title}
145
- </p>
145
+ </div>
146
146
  )}
147
- <p
147
+ <div
148
148
  className="font-medium text-center text-muted"
149
149
  style={{ fontSize: "0.875em" }}
150
150
  >
151
151
  {message}
152
- </p>
152
+ </div>
153
153
  <div className="flex gap-1 pt-6">{children}</div>
154
154
  </div>
155
155
  );
@@ -144,7 +144,7 @@ export const Tab = <Tag extends React.ElementType = "button">({
144
144
  disabled && "text-tint-500 pointer-events-none",
145
145
  tabFlex ? "flex-1" : "flex-initial max-w-36",
146
146
  minimal ? "min-w-6" : "min-w-18",
147
- "flex items-center justify-center px-1 rounded overflow-hidden",
147
+ "flex items-center justify-center px-1 rounded overflow-hidden cursor-pointer",
148
148
  )}
149
149
  onClick={() => !active && onClick?.(id)}
150
150
  ref={ref as AnyObject}
@@ -25,6 +25,7 @@ import { isColor } from "@react-fabric/utilities";
25
25
  import classNames from "classnames";
26
26
  import { useMemo } from "react";
27
27
  import { type ChildrenProp } from "../../types";
28
+ import { useApplicationContext } from "../../context/Global";
28
29
 
29
30
  export interface ThemeProps {
30
31
  /**
@@ -71,6 +72,7 @@ export const ThemeProvider = ({
71
72
  colorScheme,
72
73
  rounding,
73
74
  }: ThemeProps & ChildrenProp) => {
75
+ const { currentColorScheme } = useApplicationContext();
74
76
  const styles = useMemo(() => {
75
77
  const ret: KeyValue = {};
76
78
  if (primaryColor && isColor(primaryColor)) {
@@ -97,7 +99,7 @@ export const ThemeProvider = ({
97
99
  return (
98
100
  <div
99
101
  style={styles}
100
- data-color-scheme={colorScheme}
102
+ data-color-scheme={colorScheme ?? currentColorScheme}
101
103
  data-rounding={rounding}
102
104
  className={classNames(
103
105
  "fabric-themeProvider",
@@ -45,6 +45,7 @@ import {
45
45
  useMemo,
46
46
  useRef,
47
47
  useState,
48
+ type MouseEvent,
48
49
  type ReactElement,
49
50
  } from "react";
50
51
  import { Icon } from "../../components/icon/Icon";
@@ -147,8 +148,9 @@ export const Tooltip = ({
147
148
  const copyEl = useMemo(() => {
148
149
  if (copyContent) {
149
150
  const copyText: AnyObject = isString(copyContent) ? copyContent : content;
150
- const handler = () => {
151
+ const handler = (e: MouseEvent) => {
151
152
  setIsOpen(false);
153
+ e.stopPropagation();
152
154
  void navigator.clipboard.writeText(copyText.toString());
153
155
  };
154
156
  return (