@react-fabric/core 1.0.0-beta.45 → 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.
@@ -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"
@@ -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
@@ -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"
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-fabric/core",
3
- "version": "1.0.0-beta.45",
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.45",
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": "37d7cbcd99da40553f4ac775c3332d5281565936"
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
  );
@@ -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",