@clearstory/drywall-react 4.2.1 → 4.2.3

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.
@@ -1,4 +1,7 @@
1
1
  const t = {
2
+ defaultProps: {
3
+ color: "info"
4
+ },
2
5
  styleOverrides: {
3
6
  root: ({ ownerState: r, theme: o }) => {
4
7
  const s = [
@@ -122,11 +122,11 @@ const b = [
122
122
  "typography",
123
123
  // other common system props
124
124
  "spacing"
125
- ], S = ["Box", "Stack", "Typography", "Link"], w = {
125
+ ], S = ["Box", "Stack", "Typography", "Link"], $ = {
126
126
  Typography: ["color"],
127
127
  // semantic colors only
128
128
  Link: ["color"]
129
- }, T = {
129
+ }, j = {
130
130
  meta: {
131
131
  type: "problem",
132
132
  docs: {
@@ -140,64 +140,64 @@ const b = [
140
140
  },
141
141
  schema: []
142
142
  },
143
- create(s) {
144
- const o = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), g = s.getSourceCode();
143
+ create(p) {
144
+ const o = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), g = p.getSourceCode();
145
145
  return {
146
- ImportDeclaration(l) {
147
- const e = l;
148
- e.source.value === "@clearstory/drywall-react" && e.specifiers.forEach((r) => {
146
+ ImportDeclaration(m) {
147
+ const t = m;
148
+ t.source.value === "@clearstory/drywall-react" && t.specifiers.forEach((r) => {
149
149
  r.type === "ImportSpecifier" && r.imported && S.includes(r.imported.name) ? o.add(r.local.name) : r.type === "ImportNamespaceSpecifier" && u.add(r.local.name);
150
150
  });
151
151
  },
152
- JSXOpeningElement(l) {
153
- const e = l;
152
+ JSXOpeningElement(m) {
153
+ const t = m;
154
154
  let r;
155
- if ("name" in e.name) {
156
- if (r = e.name.name, !o.has(r))
155
+ if ("name" in t.name) {
156
+ if (r = t.name.name, !o.has(r))
157
157
  return;
158
- } else if (e.name.type === "JSXMemberExpression") {
159
- const a = e.name.object.name;
160
- if (r = e.name.property.name, !u.has(a) || !S.includes(r))
158
+ } else if (t.name.type === "JSXMemberExpression") {
159
+ const l = t.name.object.name;
160
+ if (r = t.name.property.name, !u.has(l) || !S.includes(r))
161
161
  return;
162
162
  } else
163
163
  return;
164
- const p = [];
164
+ const a = [];
165
165
  let x = null;
166
- e.attributes.forEach((a) => {
167
- const t = a;
168
- if (t.type !== "JSXAttribute" || !t.name)
166
+ t.attributes.forEach((l) => {
167
+ const e = l;
168
+ if (e.type !== "JSXAttribute" || !e.name)
169
169
  return;
170
- const d = t.name.name;
170
+ const d = e.name.name;
171
171
  if (d === "sx") {
172
- x = t;
172
+ x = e;
173
173
  return;
174
174
  }
175
175
  if (!b.includes(d))
176
176
  return;
177
- const y = w[r];
177
+ const y = $[r];
178
178
  if (y && y.includes(d))
179
- if (d === "color" && t.value) {
180
- const h = $(t.value);
179
+ if (d === "color" && e.value) {
180
+ const h = w(e.value);
181
181
  if (C(h))
182
182
  return;
183
183
  } else
184
184
  return;
185
- p.push(
186
- t
185
+ a.push(
186
+ e
187
187
  );
188
- }), p.forEach((a) => {
189
- s.report({
190
- node: a,
188
+ }), a.forEach((l) => {
189
+ p.report({
190
+ node: l,
191
191
  messageId: "systemProp",
192
192
  data: {
193
- prop: a.name.name,
193
+ prop: l.name.name,
194
194
  component: r
195
195
  },
196
- fix(t) {
196
+ fix(e) {
197
197
  return I(
198
- t,
199
- l,
200
- p,
198
+ e,
199
+ m,
200
+ a,
201
201
  x,
202
202
  g
203
203
  );
@@ -208,9 +208,9 @@ const b = [
208
208
  };
209
209
  }
210
210
  };
211
- function $(s) {
212
- if (!s) return null;
213
- const o = s;
211
+ function w(p) {
212
+ if (!p) return null;
213
+ const o = p;
214
214
  if (o.type === "Literal")
215
215
  return String(o.value);
216
216
  if (o.type === "JSXExpressionContainer" && o.expression) {
@@ -221,7 +221,7 @@ function $(s) {
221
221
  }
222
222
  return null;
223
223
  }
224
- function C(s) {
224
+ function C(p) {
225
225
  return [
226
226
  "inherit",
227
227
  "primary",
@@ -230,55 +230,56 @@ function C(s) {
230
230
  "warning",
231
231
  "info",
232
232
  "success"
233
- ].includes(s || "");
233
+ ].includes(p || "");
234
234
  }
235
- function I(s, o, u, g, l) {
236
- const e = o, r = "name" in e.name ? e.name.name : e.name.type === "JSXMemberExpression" ? `${e.name.object.name}.${e.name.property.name}` : "UnknownComponent", p = u.map((i) => {
237
- const n = i.name.name, m = i.value;
238
- if (!m)
235
+ function I(p, o, u, g, m) {
236
+ const t = o, r = "name" in t.name ? t.name.name : t.name.type === "JSXMemberExpression" ? `${t.name.object.name}.${t.name.property.name}` : "UnknownComponent", a = u.map((i) => {
237
+ const n = i.name.name, s = i.value;
238
+ if (!s)
239
239
  return `${n}: true`;
240
- const c = m;
240
+ const c = s;
241
241
  if (c.type === "Literal")
242
242
  return `${n}: ${JSON.stringify(c.value)}`;
243
243
  if (c.type === "JSXExpressionContainer" && c.expression) {
244
- const f = l.getText(c.expression);
244
+ const f = m.getText(c.expression);
245
245
  return `${n}: ${f}`;
246
246
  }
247
247
  return `${n}: true`;
248
248
  }), x = new Set(
249
249
  u.map((i) => i.name.name)
250
- ), a = [];
251
- e.attributes.forEach((i) => {
250
+ ), l = [];
251
+ t.attributes.forEach((i) => {
252
252
  const n = i;
253
253
  if (n.type !== "JSXAttribute" || !n.name) {
254
- a.push(l.getText(i));
254
+ l.push(m.getText(i));
255
255
  return;
256
256
  }
257
- const m = n.name.name;
258
- x.has(m) || m === "sx" && g || a.push(l.getText(i));
257
+ const s = n.name.name;
258
+ x.has(s) || s === "sx" && g || l.push(m.getText(i));
259
259
  });
260
- let t;
260
+ let e;
261
261
  if (g) {
262
- const i = l.getText(g.value);
262
+ const i = m.getText(g.value);
263
263
  if (i.startsWith("{") && i.endsWith("}")) {
264
264
  const n = i.slice(1, -1).trim();
265
- if (n.startsWith("{") && n.endsWith("}"))
266
- t = `sx={{ ${p.join(", ")}, ...${n} }}`;
267
- else if (n.startsWith("[") && n.endsWith("]"))
268
- t = `sx={[{ ${p.join(", ")} }, ...${n}]}`;
265
+ if (n.startsWith("{") && n.endsWith("}")) {
266
+ const s = n.slice(1, -1).trim(), c = s.includes("...");
267
+ s ? c ? e = `sx={{ ${a.join(", ")}, ...${n} }}` : e = `sx={{ ${a.join(", ")}, ${s} }}` : e = `sx={{ ${a.join(", ")} }}`;
268
+ } else if (n.startsWith("[") && n.endsWith("]"))
269
+ e = `sx={[{ ${a.join(", ")} }, ...${n}]}`;
269
270
  else {
270
- const m = n.trimStart(), f = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(
271
- m
272
- ) ? m : n;
273
- t = `sx={[{ ${p.join(", ")} }, ...(Array.isArray(${f}) ? ${f} : [${f}])]}`;
271
+ const s = n.trimStart(), f = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(
272
+ s
273
+ ) ? s : n;
274
+ e = `sx={[{ ${a.join(", ")} }, ...(Array.isArray(${f}) ? ${f} : [${f}])]}`;
274
275
  }
275
276
  } else
276
- t = `sx={{ ${p.join(", ")} }}`;
277
+ e = `sx={{ ${a.join(", ")} }}`;
277
278
  } else
278
- t = `sx={{ ${p.join(", ")} }}`;
279
- const d = [...a, t], y = d.length > 0 ? " " + d.join(" ") : "", h = `<${r}${y}${e.selfClosing ? " />" : ">"}`;
280
- return [s.replaceText(o, h)];
279
+ e = `sx={{ ${a.join(", ")} }}`;
280
+ const d = [...l, e], y = d.length > 0 ? " " + d.join(" ") : "", h = `<${r}${y}${t.selfClosing ? " />" : ">"}`;
281
+ return [p.replaceText(o, h)];
281
282
  }
282
283
  export {
283
- T as default
284
+ j as default
284
285
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clearstory/drywall-react",
3
- "version": "4.2.1",
3
+ "version": "4.2.3",
4
4
  "license": "UNLICENSED",
5
5
  "description": "a Clearstory software design system",
6
6
  "type": "module",