@dashadmin/dash-styles 1.3.25 → 1.3.26

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.
Files changed (60) hide show
  1. package/dist/index.cjs +979 -0
  2. package/dist/index.d.cts +1181 -0
  3. package/dist/index.d.ts +1181 -0
  4. package/dist/index.js +193 -166
  5. package/package.json +42 -41
  6. package/{dist → src}/dash-css-transformer.less +5 -2
  7. package/src/helpers/getAllCssVariablesFromStyleSheets.tsx +46 -0
  8. package/src/index.tsx +1052 -0
  9. package/{dist → src}/styles/header.less +3 -0
  10. package/{dist → src}/styles/tabs.less +7 -0
  11. package/{dist → src}/variables/breakpoints.less +1 -1
  12. package/dist/helpers/getAllCssVariablesFromStyleSheets.js +0 -1
  13. /package/{dist → src}/assets/fonts/Montserrat-Black.ttf +0 -0
  14. /package/{dist → src}/assets/fonts/Montserrat-Bold.ttf +0 -0
  15. /package/{dist → src}/assets/fonts/Montserrat-Medium.ttf +0 -0
  16. /package/{dist → src}/assets/fonts/Montserrat-Regular.ttf +0 -0
  17. /package/{dist → src}/assets/fonts/Montserrat-SemiBold.ttf +0 -0
  18. /package/{dist → src}/dash-variables.less +0 -0
  19. /package/{dist → src}/dash.less +0 -0
  20. /package/{dist → src}/index.tsx.suffixed +0 -0
  21. /package/{dist → src}/styles/button.less +0 -0
  22. /package/{dist → src}/styles/buttons.less +0 -0
  23. /package/{dist → src}/styles/card.less +0 -0
  24. /package/{dist → src}/styles/common.less +0 -0
  25. /package/{dist → src}/styles/components/notfound.less +0 -0
  26. /package/{dist → src}/styles/extra.less +0 -0
  27. /package/{dist → src}/styles/filters.less +0 -0
  28. /package/{dist → src}/styles/forms.less +0 -0
  29. /package/{dist → src}/styles/framed.less +0 -0
  30. /package/{dist → src}/styles/input.copy.less +0 -0
  31. /package/{dist → src}/styles/input.less +0 -0
  32. /package/{dist → src}/styles/layout.less +0 -0
  33. /package/{dist → src}/styles/links.less +0 -0
  34. /package/{dist → src}/styles/loader.less +0 -0
  35. /package/{dist → src}/styles/login.less +0 -0
  36. /package/{dist → src}/styles/modal.less +0 -0
  37. /package/{dist → src}/styles/module.less +0 -0
  38. /package/{dist → src}/styles/mui-overrides.less +0 -0
  39. /package/{dist → src}/styles/notification.less +0 -0
  40. /package/{dist → src}/styles/pages/profile.less +0 -0
  41. /package/{dist → src}/styles/pagination.less +0 -0
  42. /package/{dist → src}/styles/popover.less +0 -0
  43. /package/{dist → src}/styles/react-admin/common.less +0 -0
  44. /package/{dist → src}/styles/react-admin/toolbar.less +0 -0
  45. /package/{dist → src}/styles/root.less +0 -0
  46. /package/{dist → src}/styles/sidebar.less +0 -0
  47. /package/{dist → src}/styles/splash.less +0 -0
  48. /package/{dist → src}/styles/static.less +0 -0
  49. /package/{dist → src}/styles/stats.less +0 -0
  50. /package/{dist → src}/styles/svg.less +0 -0
  51. /package/{dist → src}/styles/switch.less +0 -0
  52. /package/{dist → src}/styles/table.less +0 -0
  53. /package/{dist → src}/styles/tags.less +0 -0
  54. /package/{dist → src}/styles/toast.less +0 -0
  55. /package/{dist → src}/styles/toolbar.less +0 -0
  56. /package/{dist → src}/styles/transition.less +0 -0
  57. /package/{dist → src}/styles/uploader.less +0 -0
  58. /package/{dist → src}/variables/colors.less +0 -0
  59. /package/{dist → src}/variables/dash-colors.less +0 -0
  60. /package/{dist → src}/variables/sizes.less +0 -0
package/dist/index.js CHANGED
@@ -1,91 +1,103 @@
1
- import { defaultTheme as u } from "react-admin";
2
- import { deepmerge as g } from "@mui/utils";
3
- import { theme as v } from "antd";
4
- const h = (n) => {
5
- const c = {};
6
- for (let a = 0; a < document.styleSheets.length; a++)
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+
33
+ // src/index.tsx
34
+ import { defaultTheme } from "react-admin";
35
+ import { deepmerge } from "@mui/utils";
36
+ import { theme as antdTheme } from "antd";
37
+ var getAllCssVariablesFromStyleSheets = (selector) => {
38
+ var _a;
39
+ const cssVariables = {};
40
+ for (let i = 0; i < document.styleSheets.length; i++) {
7
41
  try {
8
- const e = document.styleSheets[a];
9
- if (e.ownerNode?.id === "dash-theme-variables" || !e.cssRules) continue;
10
- for (let o = 0; o < e.cssRules.length; o++) {
11
- const l = e.cssRules[o];
12
- if (l.selectorText === n) {
13
- const r = l.style;
14
- for (let i = 0; i < r.length; i++) {
15
- const t = r[i];
16
- t.startsWith("--") && (c[t] = r.getPropertyValue(t).trim());
42
+ const styleSheet = document.styleSheets[i];
43
+ if (((_a = styleSheet.ownerNode) == null ? void 0 : _a.id) === "dash-theme-variables") continue;
44
+ if (!styleSheet.cssRules) continue;
45
+ for (let j = 0; j < styleSheet.cssRules.length; j++) {
46
+ const rule = styleSheet.cssRules[j];
47
+ if (rule.selectorText === selector) {
48
+ const style = rule.style;
49
+ for (let k = 0; k < style.length; k++) {
50
+ const prop = style[k];
51
+ if (prop.startsWith("--")) {
52
+ cssVariables[prop] = style.getPropertyValue(prop).trim();
53
+ }
17
54
  }
18
55
  }
19
56
  }
20
57
  } catch (e) {
21
58
  console.warn("Could not access stylesheet:", e);
22
59
  }
23
- return c;
24
- }, p = (n) => {
25
- const { tenantSettings: c, colors: a, ...e } = n || {}, o = document.documentElement.getAttribute("data-theme") || "dark", l = h(":root"), r = (t, s, b = null) => {
26
- if (a) {
27
- const d = a[`${s}--${b || o}`];
28
- return d ? { [t]: d } : {};
29
- } else if (l[`--${s}--${b || o}`]) {
30
- const d = l[`--${s}--${b || o}`];
31
- return d ? { [t]: d } : {};
32
- } else
60
+ }
61
+ return cssVariables;
62
+ };
63
+ var defaultOptions = (options) => {
64
+ const _a = options || {}, { tenantSettings, colors } = _a, otherOptions = __objRest(_a, ["tenantSettings", "colors"]);
65
+ const currentTheme = document.documentElement.getAttribute("data-theme") || "dark";
66
+ const cssVars = getAllCssVariablesFromStyleSheets(":root");
67
+ const _color = (key, colorKey, mode = null) => {
68
+ if (colors) {
69
+ const colorValue = colors[`${colorKey}--${mode || currentTheme}`];
70
+ return colorValue ? { [key]: colorValue } : {};
71
+ } else if (cssVars[`--${colorKey}--${mode || currentTheme}`]) {
72
+ const cssVarValue = cssVars[`--${colorKey}--${mode || currentTheme}`];
73
+ return cssVarValue ? { [key]: cssVarValue } : {};
74
+ } else {
33
75
  return {};
34
- }, i = (t = "light") => {
35
- const s = {
36
- mode: t,
37
- background: {
38
- ...r("default", "module-bg", t),
39
- ...r("paper", "module-bg", t)
40
- },
41
- primary: {
42
- //..._color('main', 'primary-color', mode),
43
- //..._color('main', 'highlight-color', mode),
44
- ...r("main", "btn-bg", t),
45
- ...r("contrastText", "primary-contrast", t)
46
- },
47
- secondary: {
48
- ...r("main", "secondary-color", t)
49
- },
50
- text: {
51
- ...r("primary", "text-color", t),
52
- ...r("secondary", "text-light", t),
53
- ...r("disabled", "disabled-color", t)
54
- },
55
- action: {
56
- ...r("active", "component-active-bg", t),
57
- ...r("hover", "component-hover-bg", t),
58
- ...r("disabled", "disabled-color", t),
59
- ...r("disabledBackground", "disabled-bg", t)
60
- },
61
- //..._color('divider', 'component-border-split', mode),
62
- ...r("border", "border-color", t),
63
- error: {
64
- ...r("main", "alert-error-bg", t),
65
- ...r("contrastText", "alert-error-title", t)
66
- },
67
- warning: {
68
- ...r("main", "alert-warning-bg", t),
69
- ...r("contrastText", "alert-warning-title", t)
70
- },
71
- info: {
72
- ...r("main", "alert-info-bg", t),
73
- ...r("contrastText", "alert-info-title", t)
74
- },
75
- success: {
76
- ...r("main", "alert-success-bg", t),
77
- ...r("contrastText", "alert-success-title", t)
78
- },
79
- common: {
80
- ...r("black", "text-color", t),
81
- ...r("white", "text-contrast", t)
82
- },
83
- variant: {
84
- ...r("containedBg", "btn-bg", t)
85
- }
86
- };
76
+ }
77
+ };
78
+ const createPalette = (mode = "light") => {
79
+ const palette = __spreadProps(__spreadValues({
80
+ mode,
81
+ background: __spreadValues(__spreadValues({}, _color("default", "module-bg", mode)), _color("paper", "module-bg", mode)),
82
+ primary: __spreadValues(__spreadValues({}, _color("main", "btn-bg", mode)), _color("contrastText", "primary-contrast", mode)),
83
+ secondary: __spreadValues({}, _color("main", "secondary-color", mode)),
84
+ text: __spreadValues(__spreadValues(__spreadValues({}, _color("primary", "text-color", mode)), _color("secondary", "text-light", mode)), _color("disabled", "disabled-color", mode)),
85
+ action: __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, _color("active", "component-active-bg", mode)), _color("hover", "component-hover-bg", mode)), _color("disabled", "disabled-color", mode)), _color("disabledBackground", "disabled-bg", mode))
86
+ }, _color("border", "border-color", mode)), {
87
+ error: __spreadValues(__spreadValues({}, _color("main", "alert-error-bg", mode)), _color("contrastText", "alert-error-title", mode)),
88
+ warning: __spreadValues(__spreadValues({}, _color("main", "alert-warning-bg", mode)), _color("contrastText", "alert-warning-title", mode)),
89
+ info: __spreadValues(__spreadValues({}, _color("main", "alert-info-bg", mode)), _color("contrastText", "alert-info-title", mode)),
90
+ success: __spreadValues(__spreadValues({}, _color("main", "alert-success-bg", mode)), _color("contrastText", "alert-success-title", mode)),
91
+ common: __spreadValues(__spreadValues({}, _color("black", "text-color", mode)), _color("white", "text-contrast", mode)),
92
+ variant: __spreadValues({}, _color("containedBg", "btn-bg", mode))
93
+ });
87
94
  return Object.fromEntries(
88
- Object.entries(s).filter(([b, d]) => typeof d == "object" && d !== null ? Object.keys(d).length > 0 : d !== void 0)
95
+ Object.entries(palette).filter(([_, value]) => {
96
+ if (typeof value === "object" && value !== null) {
97
+ return Object.keys(value).length > 0;
98
+ }
99
+ return value !== void 0;
100
+ })
89
101
  );
90
102
  };
91
103
  return {
@@ -100,14 +112,14 @@ const h = (n) => {
100
112
  // Enable both light and dark color schemes - NO 'system' to force light/dark only
101
113
  colorSchemes: {
102
114
  light: {
103
- palette: i("light")
115
+ palette: createPalette("light")
104
116
  },
105
117
  dark: {
106
- palette: i("dark")
118
+ palette: createPalette("dark")
107
119
  }
108
120
  },
109
- defaultColorScheme: o || "dark",
110
- palette: i(o),
121
+ defaultColorScheme: currentTheme || "dark",
122
+ palette: createPalette(currentTheme),
111
123
  // Don't put your custom CSS variables in the palette
112
124
  // Instead, use them directly in component overrides
113
125
  typography: {
@@ -804,124 +816,139 @@ const h = (n) => {
804
816
  }
805
817
  }
806
818
  };
807
- }, x = (n) => {
808
- const c = p(n || {}), { palette: a, colorSchemes: e, defaultColorScheme: o, cssVariables: l, ...r } = c;
809
- return r;
810
- }, M = (n, c) => {
811
- const { tenantSettings: a, colors: e, ...o } = c || {}, l = {
812
- cssVariables: !0,
813
- ...p(c)
819
+ };
820
+ var defaultComponentOverrides = (options) => {
821
+ const full = defaultOptions(options || {});
822
+ const _a = full, { palette, colorSchemes, defaultColorScheme, cssVariables } = _a, safeOptions = __objRest(_a, ["palette", "colorSchemes", "defaultColorScheme", "cssVariables"]);
823
+ return safeOptions;
824
+ };
825
+ var appTheme = (muiThemeOptions, options) => {
826
+ const _a = options || {}, { tenantSettings, colors } = _a, otherOptions = __objRest(_a, ["tenantSettings", "colors"]);
827
+ const baseTheme = __spreadValues({
828
+ cssVariables: true
829
+ }, defaultOptions(options));
830
+ const theme = muiThemeOptions ? deepmerge(deepmerge(defaultTheme, baseTheme), muiThemeOptions) : deepmerge(defaultTheme, baseTheme);
831
+ return theme;
832
+ };
833
+ var getAntTheme = (options) => {
834
+ const { colors } = options || {};
835
+ const currentTheme = document.documentElement.getAttribute("data-theme") || "dark";
836
+ const cssVars = getAllCssVariablesFromStyleSheets(":root");
837
+ const resolve = (colorKey) => {
838
+ const suffixed = `--${colorKey}--${currentTheme}`;
839
+ if (colors == null ? void 0 : colors[`${colorKey}--${currentTheme}`]) {
840
+ return colors[`${colorKey}--${currentTheme}`];
841
+ }
842
+ if (cssVars[suffixed]) {
843
+ return cssVars[suffixed];
844
+ }
845
+ if (cssVars[`--${colorKey}`]) {
846
+ return cssVars[`--${colorKey}`];
847
+ }
848
+ return void 0;
814
849
  };
815
- return n ? g(g(u, l), n) : g(u, l);
816
- }, k = (n) => {
817
- const { colors: c } = n || {}, a = document.documentElement.getAttribute("data-theme") || "dark", e = h(":root"), o = (r) => {
818
- const i = `--${r}--${a}`;
819
- if (c?.[`${r}--${a}`])
820
- return c[`${r}--${a}`];
821
- if (e[i])
822
- return e[i];
823
- if (e[`--${r}`])
824
- return e[`--${r}`];
825
- }, l = {
850
+ const token = {
826
851
  // Core
827
- colorPrimary: o("btn-bg"),
828
- colorSuccess: o("alert-success-bg"),
829
- colorWarning: o("alert-warning-bg"),
830
- colorError: o("alert-error-bg"),
831
- colorInfo: o("alert-info-bg"),
852
+ colorPrimary: resolve("btn-bg"),
853
+ colorSuccess: resolve("alert-success-bg"),
854
+ colorWarning: resolve("alert-warning-bg"),
855
+ colorError: resolve("alert-error-bg"),
856
+ colorInfo: resolve("alert-info-bg"),
832
857
  // Text
833
- colorText: o("text-color"),
834
- colorTextSecondary: o("text-light-color"),
835
- colorTextDisabled: o("disabled-color"),
858
+ colorText: resolve("text-color"),
859
+ colorTextSecondary: resolve("text-light-color"),
860
+ colorTextDisabled: resolve("disabled-color"),
836
861
  // Background
837
- colorBgBase: o("bodybg-primary"),
838
- colorBgContainer: o("component-bg"),
839
- colorBgElevated: o("module-bg"),
840
- colorBgLayout: o("body-bg"),
862
+ colorBgBase: resolve("bodybg-primary"),
863
+ colorBgContainer: resolve("component-bg"),
864
+ colorBgElevated: resolve("module-bg"),
865
+ colorBgLayout: resolve("body-bg"),
841
866
  // Borders
842
- colorBorder: o("border-color"),
843
- colorSplit: o("border-color-split"),
867
+ colorBorder: resolve("border-color"),
868
+ colorSplit: resolve("border-color-split"),
844
869
  // Typography
845
870
  fontSize: 14,
846
871
  borderRadius: 6
847
872
  };
848
- return Object.keys(l).forEach((r) => {
849
- l[r] === void 0 && delete l[r];
850
- }), {
851
- cssVar: !0,
852
- hashed: !1,
853
- algorithm: a === "dark" ? v.darkAlgorithm : v.defaultAlgorithm,
854
- token: l,
873
+ Object.keys(token).forEach((k) => {
874
+ if (token[k] === void 0) delete token[k];
875
+ });
876
+ return {
877
+ cssVar: true,
878
+ hashed: false,
879
+ algorithm: currentTheme === "dark" ? antdTheme.darkAlgorithm : antdTheme.defaultAlgorithm,
880
+ token,
855
881
  components: {
856
882
  Table: {
857
- headerBg: o("table-header-bg"),
858
- headerColor: o("table-header-color"),
859
- rowHoverBg: o("component-hover-bg"),
860
- rowSelectedBg: o("component-active-bg"),
861
- borderColor: o("border-color"),
862
- footerBg: o("component-bg")
883
+ headerBg: resolve("table-header-bg"),
884
+ headerColor: resolve("table-header-color"),
885
+ rowHoverBg: resolve("component-hover-bg"),
886
+ rowSelectedBg: resolve("component-active-bg"),
887
+ borderColor: resolve("border-color"),
888
+ footerBg: resolve("component-bg")
863
889
  },
864
890
  Button: {
865
- colorPrimary: o("btn-bg"),
866
- colorPrimaryHover: o("highlight-color"),
867
- colorPrimaryActive: o("btn-active-bg"),
868
- defaultBg: o("secondary-color"),
869
- defaultColor: o("text-color"),
870
- defaultBorderColor: o("border-color")
891
+ colorPrimary: resolve("btn-bg"),
892
+ colorPrimaryHover: resolve("highlight-color"),
893
+ colorPrimaryActive: resolve("btn-active-bg"),
894
+ defaultBg: resolve("secondary-color"),
895
+ defaultColor: resolve("text-color"),
896
+ defaultBorderColor: resolve("border-color")
871
897
  },
872
898
  Input: {
873
- colorBgContainer: o("component-bg"),
874
- colorBorder: o("border-color"),
875
- colorText: o("text-color"),
876
- activeBorderColor: o("primary-color"),
877
- hoverBorderColor: o("primary-color")
899
+ colorBgContainer: resolve("component-bg"),
900
+ colorBorder: resolve("border-color"),
901
+ colorText: resolve("text-color"),
902
+ activeBorderColor: resolve("primary-color"),
903
+ hoverBorderColor: resolve("primary-color")
878
904
  },
879
905
  Select: {
880
- colorBgContainer: o("component-bg"),
881
- colorBorder: o("border-color"),
882
- colorText: o("text-color")
906
+ colorBgContainer: resolve("component-bg"),
907
+ colorBorder: resolve("border-color"),
908
+ colorText: resolve("text-color")
883
909
  },
884
910
  Dropdown: {
885
- colorBgElevated: o("component-bg"),
886
- colorText: o("text-color")
911
+ colorBgElevated: resolve("component-bg"),
912
+ colorText: resolve("text-color")
887
913
  },
888
914
  Modal: {
889
- contentBg: o("component-bg"),
890
- headerBg: o("component-bg"),
891
- titleColor: o("text-color")
915
+ contentBg: resolve("component-bg"),
916
+ headerBg: resolve("component-bg"),
917
+ titleColor: resolve("text-color")
892
918
  },
893
919
  Layout: {
894
- headerBg: o("primary-color"),
895
- bodyBg: o("bodybg-primary"),
896
- siderBg: o("sidebar-bg")
920
+ headerBg: resolve("primary-color"),
921
+ bodyBg: resolve("bodybg-primary"),
922
+ siderBg: resolve("sidebar-bg")
897
923
  },
898
924
  Menu: {
899
925
  itemBg: "transparent",
900
- itemColor: o("text-color"),
901
- itemHoverBg: o("component-hover-bg"),
902
- itemSelectedBg: o("component-active-bg"),
903
- itemSelectedColor: o("highlight-color")
926
+ itemColor: resolve("text-color"),
927
+ itemHoverBg: resolve("component-hover-bg"),
928
+ itemSelectedBg: resolve("component-active-bg"),
929
+ itemSelectedColor: resolve("highlight-color")
904
930
  },
905
931
  Card: {
906
- colorBgContainer: o("component-bg"),
907
- colorBorderSecondary: o("border-color")
932
+ colorBgContainer: resolve("component-bg"),
933
+ colorBorderSecondary: resolve("border-color")
908
934
  },
909
935
  Tooltip: {
910
- colorBgSpotlight: o("module-bg"),
911
- colorTextLightSolid: o("text-color")
936
+ colorBgSpotlight: resolve("module-bg"),
937
+ colorTextLightSolid: resolve("text-color")
912
938
  },
913
939
  Tabs: {
914
- itemColor: o("text-color"),
915
- itemSelectedColor: o("highlight-color"),
916
- inkBarColor: o("highlight-color")
940
+ itemColor: resolve("text-color"),
941
+ itemSelectedColor: resolve("highlight-color"),
942
+ inkBarColor: resolve("highlight-color")
917
943
  }
918
944
  }
919
945
  };
920
946
  };
947
+ var index_default = appTheme;
921
948
  export {
922
- M as appTheme,
923
- M as default,
924
- x as defaultComponentOverrides,
925
- p as defaultOptions,
926
- k as getAntTheme
949
+ appTheme,
950
+ index_default as default,
951
+ defaultComponentOverrides,
952
+ defaultOptions,
953
+ getAntTheme
927
954
  };
package/package.json CHANGED
@@ -1,42 +1,43 @@
1
1
  {
2
- "name": "@dashadmin/dash-styles",
3
- "version": "1.3.25",
4
- "private": false,
5
- "main": "dist/index.js",
6
- "exports": {
7
- ".": {
8
- "import": "./dist/index.js"
9
- },
10
- "./src/*": {
11
- "import": "./dist/*.js"
12
- },
13
- "./dash.less": {
14
- "import": "./dist/dash.less"
15
- },
16
- "./styles/*": {
17
- "import": "./dist/styles/*"
18
- }
19
- },
20
- "license": "MIT",
21
- "devDependencies": {
22
- "vite": "^5.2.0",
23
- "rollup": "^4.0.0"
24
- },
25
- "dependencies": {
26
- "@mui/utils": "^7.3.10",
27
- "react-admin": "5.14.7"
28
- },
29
- "peerDependencies": {
30
- "antd": ">=5.0.0"
31
- },
32
- "publishConfig": {
33
- "name": "@dashadmin/dash-styles",
34
- "access": "public"
35
- },
36
- "files": [
37
- "dist"
38
- ],
39
- "scripts": {
40
- "build": "rm -rf dist && node ../dash-build/compile.mjs && vite build"
41
- }
42
- }
2
+ "name": "@dashadmin/dash-styles",
3
+ "version": "1.3.26",
4
+ "main": "dist/index.cjs",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js",
9
+ "require": "./dist/index.cjs"
10
+ },
11
+ "./dash.less": {
12
+ "import": "./src/dash.less",
13
+ "require": "./src/dash.less"
14
+ },
15
+ "./styles/*": {
16
+ "import": "./src/styles/*",
17
+ "require": "./src/styles/*"
18
+ }
19
+ },
20
+ "license": "MIT",
21
+ "devDependencies": {},
22
+ "dependencies": {
23
+ "@mui/utils": "^7.3.10",
24
+ "react-admin": "5.14.6"
25
+ },
26
+ "peerDependencies": {
27
+ "antd": ">=5.0.0"
28
+ },
29
+ "module": "dist/index.js",
30
+ "types": "dist/index.d.ts",
31
+ "publishConfig": {
32
+ "access": "public",
33
+ "registry": "https://registry.npmjs.org"
34
+ },
35
+ "scripts": {
36
+ "build": "tsup"
37
+ },
38
+ "files": [
39
+ "dist",
40
+ "src"
41
+ ],
42
+ "type": "module"
43
+ }
@@ -376,8 +376,11 @@
376
376
  // Widths
377
377
  --min-body-width: 575px;
378
378
  --sidebar-mini-drawer-width: 100px;
379
- --sidebar-large-width: 255px;
380
- --sidebar-small-width: 60px;
379
+ // Layout dimensions are NOT runtime-injected like colors; they must reference the
380
+ // LESS vars so per-app overrides in apps/<app>/src/dash-variables.less take effect
381
+ // (the Vite `additionalData` imports dash defaults -> app overrides -> this transformer).
382
+ --sidebar-large-width: @sidebar-large-width;
383
+ --sidebar-small-width: @sidebar-small-width;
381
384
  --sidebar-horizontal-height: 120px;
382
385
 
383
386
  --app-sidebar-width: 230px;
@@ -0,0 +1,46 @@
1
+ const getAllCssVariablesFromStyleSheets = (selector: string) => {
2
+
3
+ const cssVariables = {};
4
+
5
+ // Loop through all style sheets
6
+ for (let i = 0; i < document.styleSheets.length; i++) {
7
+ try {
8
+ const styleSheet = document.styleSheets[i];
9
+ // Skip if the stylesheet is from a different origin and can't be accessed
10
+ if (!styleSheet.cssRules) continue;
11
+
12
+ // Loop through all CSS rules in the stylesheet
13
+ for (let j = 0; j < styleSheet.cssRules.length; j++) {
14
+ const rule = styleSheet.cssRules[j];
15
+
16
+ // Check if it's a style rule (type 1)
17
+
18
+ /* @ts-ignore */
19
+ if (rule.selectorText === selector) {
20
+
21
+ /* @ts-ignore */
22
+ const style = rule.style;
23
+
24
+ // Loop through all style properties
25
+ for (let k = 0; k < style.length; k++) {
26
+ const prop = style[k];
27
+ if (prop.startsWith('--')) {
28
+ //console.log(prop,style.getPropertyValue(prop).trim());
29
+ cssVariables[prop] = style.getPropertyValue(prop).trim();
30
+ }
31
+ }
32
+ }
33
+
34
+ }
35
+ } catch (e) {
36
+ // Skip cross-origin stylesheets that throw security errors
37
+ console.warn('Could not access stylesheet:', e);
38
+ }
39
+ }
40
+
41
+
42
+ return cssVariables;
43
+ };
44
+
45
+
46
+ export default getAllCssVariablesFromStyleSheets;