@clearstory/drywall-react 7.0.0 → 7.1.0

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.
@@ -13,7 +13,7 @@ const u = ({ sx: o, ...t }) => /* @__PURE__ */ r(
13
13
  {
14
14
  position: "absolute",
15
15
  right: 12,
16
- top: 12
16
+ top: 8
17
17
  },
18
18
  ...Array.isArray(o) ? o : [o]
19
19
  ],
@@ -0,0 +1,2 @@
1
+ import { Components, Theme } from '@mui/material';
2
+ export declare const MuiDialogTitle: Partial<Components<Theme>["MuiDialogTitle"]>;
@@ -0,0 +1,11 @@
1
+ const e = {
2
+ styleOverrides: {
3
+ root: () => ({
4
+ lineHeight: "28px",
5
+ padding: "10px 24px"
6
+ })
7
+ }
8
+ };
9
+ export {
10
+ e as MuiDialogTitle
11
+ };
@@ -1,7 +1,9 @@
1
1
  import e from "./no-system-props.js";
2
+ import l from "./prefer-vars-palette.js";
2
3
  const r = {
3
4
  rules: {
4
- "no-system-props": e
5
+ "no-system-props": e,
6
+ "prefer-vars-palette": l
5
7
  },
6
8
  configs: {}
7
9
  };
@@ -11,19 +13,21 @@ r.configs.recommended = {
11
13
  "@clearstory/drywall-react": r
12
14
  },
13
15
  rules: {
14
- "@clearstory/drywall-react/no-system-props": "error"
16
+ "@clearstory/drywall-react/no-system-props": "error",
17
+ "@clearstory/drywall-react/prefer-vars-palette": "error"
15
18
  }
16
19
  };
17
- const s = {
20
+ const t = {
18
21
  name: "@clearstory/drywall-react",
19
22
  plugins: {
20
23
  "@clearstory/drywall-react": r
21
24
  },
22
25
  rules: {
23
- "@clearstory/drywall-react/no-system-props": "error"
26
+ "@clearstory/drywall-react/no-system-props": "error",
27
+ "@clearstory/drywall-react/prefer-vars-palette": "error"
24
28
  }
25
29
  };
26
30
  export {
27
- s as default,
31
+ t as default,
28
32
  r as plugin
29
33
  };
@@ -0,0 +1,3 @@
1
+ import { Rule } from 'eslint';
2
+ declare const rule: Rule.RuleModule;
3
+ export default rule;
@@ -0,0 +1,190 @@
1
+ const b = /* @__PURE__ */ new Set([
2
+ "color",
3
+ "backgroundColor",
4
+ "bgcolor",
5
+ "background",
6
+ "borderColor",
7
+ "borderTopColor",
8
+ "borderRightColor",
9
+ "borderBottomColor",
10
+ "borderLeftColor",
11
+ "outlineColor",
12
+ "fill",
13
+ "stroke",
14
+ "caretColor",
15
+ "textDecorationColor",
16
+ "columnRuleColor"
17
+ ]), p = /* @__PURE__ */ new Set([
18
+ "inherit",
19
+ "transparent",
20
+ "currentColor",
21
+ "currentcolor",
22
+ "initial",
23
+ "unset",
24
+ "none"
25
+ ]), C = {
26
+ meta: {
27
+ type: "suggestion",
28
+ docs: {
29
+ description: "Enforce using vars.palette for color properties in sx props instead of string literals or theme.palette",
30
+ category: "Best Practices",
31
+ recommended: !0
32
+ },
33
+ messages: {
34
+ stringColor: 'Avoid string literal "{{value}}" for "{{property}}" in sx. Use vars.palette for type-safe, dark mode-friendly colors.',
35
+ useVarsPalette: "Use vars.palette instead of {{access}} for CSS variable-based dark mode support."
36
+ },
37
+ schema: []
38
+ },
39
+ create(t) {
40
+ return {
41
+ JSXOpeningElement(e) {
42
+ const r = e.attributes.find(
43
+ (s) => s.type === "JSXAttribute" && s.name?.name === "sx"
44
+ );
45
+ if (!r) return;
46
+ const o = r.value;
47
+ if (o && o.type === "JSXExpressionContainer") {
48
+ const s = o.expression;
49
+ y(t, s);
50
+ }
51
+ }
52
+ };
53
+ }
54
+ };
55
+ function y(t, e) {
56
+ if (e)
57
+ switch (e.type) {
58
+ case "ObjectExpression":
59
+ u(t, e);
60
+ break;
61
+ case "ArrowFunctionExpression":
62
+ case "FunctionExpression": {
63
+ d(t, e);
64
+ const n = g(e);
65
+ n && u(t, n);
66
+ break;
67
+ }
68
+ case "ArrayExpression": {
69
+ e.elements.forEach((r) => {
70
+ r && y(t, r);
71
+ });
72
+ break;
73
+ }
74
+ }
75
+ }
76
+ function u(t, e) {
77
+ e.properties.forEach((r) => {
78
+ if (r.type !== "Property") return;
79
+ const o = r, s = m(o.key, o.computed);
80
+ if (!s) return;
81
+ const i = o.value;
82
+ if (i.type === "ObjectExpression") {
83
+ u(t, i);
84
+ return;
85
+ }
86
+ if (b.has(s)) {
87
+ if (i.type === "ArrowFunctionExpression" || i.type === "FunctionExpression") {
88
+ d(t, i);
89
+ return;
90
+ }
91
+ if (i.type === "Literal") {
92
+ const a = i.value;
93
+ typeof a == "string" && !p.has(a) && t.report({
94
+ node: i,
95
+ messageId: "stringColor",
96
+ data: { value: a, property: s }
97
+ });
98
+ return;
99
+ }
100
+ if (i.type === "TemplateLiteral") {
101
+ const a = i;
102
+ if (a.expressions.length === 0) {
103
+ const c = a.quasis[0]?.value.raw;
104
+ c && !p.has(c) && t.report({
105
+ node: i,
106
+ messageId: "stringColor",
107
+ data: { value: c, property: s }
108
+ });
109
+ }
110
+ return;
111
+ }
112
+ if (i.type === "ConditionalExpression") {
113
+ const a = i;
114
+ l(t, a.consequent, s), l(t, a.alternate, s);
115
+ }
116
+ }
117
+ });
118
+ }
119
+ function l(t, e, n) {
120
+ if (e.type === "Literal") {
121
+ const r = e.value;
122
+ typeof r == "string" && !p.has(r) && t.report({
123
+ node: e,
124
+ messageId: "stringColor",
125
+ data: { value: r, property: n }
126
+ });
127
+ } else if (e.type === "ConditionalExpression") {
128
+ const r = e;
129
+ l(t, r.consequent, n), l(t, r.alternate, n);
130
+ }
131
+ }
132
+ function d(t, e) {
133
+ const n = e.params;
134
+ if (!n || n.length === 0) return;
135
+ const r = n[0];
136
+ if (r.type === "Identifier") {
137
+ const o = r.name, s = e.body;
138
+ f(t, s, o);
139
+ } else r.type === "ObjectPattern" && r.properties.forEach((s) => {
140
+ if (s.type !== "Property") return;
141
+ s.key.name === "palette" && t.report({
142
+ node: s,
143
+ messageId: "useVarsPalette",
144
+ data: { access: "destructured palette" }
145
+ });
146
+ });
147
+ }
148
+ function f(t, e, n) {
149
+ if (!(!e || typeof e != "object")) {
150
+ if (e.type === "MemberExpression") {
151
+ const r = e.object, o = e.property;
152
+ if (r.type === "Identifier" && r.name === n && o.name === "palette") {
153
+ t.report({
154
+ node: e,
155
+ messageId: "useVarsPalette",
156
+ data: { access: `${n}.palette` }
157
+ });
158
+ return;
159
+ }
160
+ }
161
+ for (const r of Object.keys(e)) {
162
+ if (r === "parent") continue;
163
+ const o = e[r];
164
+ o && typeof o == "object" && (Array.isArray(o) ? o.forEach((s) => {
165
+ s && typeof s == "object" && "type" in s && f(t, s, n);
166
+ }) : "type" in o && f(t, o, n));
167
+ }
168
+ }
169
+ }
170
+ function g(t) {
171
+ const e = t.body;
172
+ if (e.type === "ObjectExpression")
173
+ return e;
174
+ if (e.type === "BlockStatement") {
175
+ const n = e.body;
176
+ for (const r of n)
177
+ if (r.type === "ReturnStatement") {
178
+ const o = r.argument;
179
+ if (o?.type === "ObjectExpression")
180
+ return o;
181
+ }
182
+ }
183
+ return null;
184
+ }
185
+ function m(t, e) {
186
+ return t.type === "Identifier" && !e ? t.name || null : t.type === "Literal" && typeof t.value == "string" ? t.value : null;
187
+ }
188
+ export {
189
+ C as default
190
+ };
@@ -6,25 +6,26 @@ import { MuiButtonGroup as t } from "../components/ButtonGroup/ButtonGroup.theme
6
6
  import { MuiCard as u } from "../components/Card/Card.theme.js";
7
7
  import { MuiCheckbox as p } from "../components/Checkbox/Checkbox.theme.js";
8
8
  import { MuiChip as M } from "../components/Chip/Chip.theme.js";
9
- import { MuiFormControl as f } from "../components/FormControl/FormControl.theme.js";
10
- import { MuiFormControlLabel as e } from "../components/FormControlLabel/FormControlLabel.theme.js";
11
- import { MuiFormHelperText as n } from "../components/FormHelperText/FormHelper.theme.js";
9
+ import { MuiDialogTitle as f } from "../components/DialogTitle/DialogTitle.theme.js";
10
+ import { MuiFormControl as e } from "../components/FormControl/FormControl.theme.js";
11
+ import { MuiFormControlLabel as n } from "../components/FormControlLabel/FormControlLabel.theme.js";
12
+ import { MuiFormHelperText as l } from "../components/FormHelperText/FormHelper.theme.js";
12
13
  import { MuiFormLabel as a } from "../components/FormLabel/FormLabel.theme.js";
13
14
  import { MuiIconButton as c } from "../components/IconButton/IconButton.theme.js";
14
- import { MuiInputAdornment as l } from "../components/InputAdornment/InputAdornment.theme.js";
15
- import { MuiInputBase as B } from "../components/Input/Input.theme.js";
16
- import { MuiLink as s } from "../components/Link/Link.theme.js";
15
+ import { MuiInputAdornment as B } from "../components/InputAdornment/InputAdornment.theme.js";
16
+ import { MuiInputBase as s } from "../components/Input/Input.theme.js";
17
+ import { MuiLink as g } from "../components/Link/Link.theme.js";
17
18
  import { MuiList as C } from "../components/List/List.theme.js";
18
19
  import { MuiListItemButton as I } from "../components/ListItemButton/ListItemButton.theme.js";
19
20
  import { MuiMenuItem as L } from "../components/MenuItem/MenuItem.theme.js";
20
- import { MuiPaper as b } from "../components/Paper/Paper.theme.js";
21
- import { MuiRadio as d } from "../components/Radio/Radio.theme.js";
22
- import { MuiSelect as g } from "../components/Select/Select.theme.js";
21
+ import { MuiPaper as T } from "../components/Paper/Paper.theme.js";
22
+ import { MuiRadio as b } from "../components/Radio/Radio.theme.js";
23
+ import { MuiSelect as d } from "../components/Select/Select.theme.js";
23
24
  import { MuiSwitch as F } from "../components/Switch/Switch.theme.js";
24
- import { MuiTab as T } from "../components/Tab/Tab.theme.js";
25
- import { MuiToggleButton as h } from "../components/ToggleButton/ToggleButton.theme.js";
26
- import { MuiToggleButtonGroup as x } from "../components/ToggleButtonGroup/ToggleButtonGroup.theme.js";
27
- const _ = {
25
+ import { MuiTab as h } from "../components/Tab/Tab.theme.js";
26
+ import { MuiToggleButton as x } from "../components/ToggleButton/ToggleButton.theme.js";
27
+ import { MuiToggleButtonGroup as A } from "../components/ToggleButtonGroup/ToggleButtonGroup.theme.js";
28
+ const oo = {
28
29
  MuiAccordionSummary: o,
29
30
  MuiAutocomplete: r,
30
31
  MuiButton: m,
@@ -33,25 +34,26 @@ const _ = {
33
34
  MuiCard: u,
34
35
  MuiCheckbox: p,
35
36
  MuiChip: M,
36
- MuiFormControl: f,
37
- MuiFormControlLabel: e,
38
- MuiFormHelperText: n,
37
+ MuiDialogTitle: f,
38
+ MuiFormControl: e,
39
+ MuiFormControlLabel: n,
40
+ MuiFormHelperText: l,
39
41
  MuiIconButton: c,
40
- MuiInputAdornment: l,
41
- MuiInputBase: B,
42
- MuiLink: s,
42
+ MuiInputAdornment: B,
43
+ MuiInputBase: s,
44
+ MuiLink: g,
43
45
  MuiList: C,
44
46
  MuiListItemButton: I,
45
47
  MuiMenuItem: L,
46
48
  MuiFormLabel: a,
47
- MuiPaper: b,
48
- MuiRadio: d,
49
- MuiSelect: g,
49
+ MuiPaper: T,
50
+ MuiRadio: b,
51
+ MuiSelect: d,
50
52
  MuiSwitch: F,
51
- MuiTab: T,
52
- MuiToggleButton: h,
53
- MuiToggleButtonGroup: x
53
+ MuiTab: h,
54
+ MuiToggleButton: x,
55
+ MuiToggleButtonGroup: A
54
56
  };
55
57
  export {
56
- _ as components
58
+ oo as components
57
59
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clearstory/drywall-react",
3
- "version": "7.0.0",
3
+ "version": "7.1.0",
4
4
  "license": "UNLICENSED",
5
5
  "description": "a Clearstory software design system",
6
6
  "type": "module",
@@ -37,12 +37,12 @@
37
37
  "@mui/material": "7.3.7",
38
38
  "@mui/system": "7.3.7",
39
39
  "@mui/utils": "7.3.7",
40
- "@mui/x-date-pickers": "8.25.0",
40
+ "@mui/x-date-pickers": "8.27.0",
41
41
  "react-hot-toast": "2.6.0",
42
42
  "react-number-format": "^5.4.4"
43
43
  },
44
44
  "devDependencies": {
45
- "@chromatic-com/storybook": "^4.0.1",
45
+ "@chromatic-com/storybook": "^5.0.1",
46
46
  "@eslint/js": "^9.29.0",
47
47
  "@storybook/addon-a11y": "^10.0.5",
48
48
  "@storybook/addon-docs": "^10.0.5",