@stamcat/craftsman 0.0.62 → 0.1.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stamcat/craftsman",
3
- "version": "0.0.62",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "description": "A powerful, lightweight framework for design systems",
6
6
  "repository": {
@@ -33,9 +33,13 @@
33
33
  "@atlaskit/pragmatic-drag-and-drop": "^3.0.0",
34
34
  "@floating-ui/react-dom": "^2.1.0",
35
35
  "@wojtekmaj/react-daterange-picker": "^7.1.0",
36
+ "ag-grid-community": "^36.2.0",
37
+ "ag-grid-react": "^36.2.0",
38
+ "chart.js": "^4.5.1",
36
39
  "dompurify": "^3.4.0",
37
40
  "embla-carousel-react": "^8.6.0",
38
41
  "react": "^19.0.0",
42
+ "react-chartjs-2": "^5.3.1",
39
43
  "react-date-picker": "^12.0.0",
40
44
  "react-datetime-picker": "^7.0.0",
41
45
  "react-device-detect": "^2.2.0",
@@ -92,6 +96,7 @@
92
96
  "is-weakref": "npm:@socketregistry/is-weakref@^1",
93
97
  "is-weakset": "npm:@socketregistry/is-weakset@^1",
94
98
  "isarray": "npm:@socketregistry/isarray@^1",
99
+ "js-yaml": "4.3.2",
95
100
  "object-keys": "npm:@socketregistry/object-keys@^1",
96
101
  "object.assign": "npm:@socketregistry/object.assign@^1",
97
102
  "object.fromentries": "npm:@socketregistry/object.fromentries@^1",
@@ -165,6 +170,7 @@
165
170
  "is-weakref": "npm:@socketregistry/is-weakref@^1",
166
171
  "is-weakset": "npm:@socketregistry/is-weakset@^1",
167
172
  "isarray": "npm:@socketregistry/isarray@^1",
173
+ "js-yaml": "4.3.2",
168
174
  "object-keys": "npm:@socketregistry/object-keys@^1",
169
175
  "object.assign": "npm:@socketregistry/object.assign@^1",
170
176
  "object.fromentries": "npm:@socketregistry/object.fromentries@^1",
@@ -129,6 +129,46 @@ toast.warning("Unsaved changes.");
129
129
  toast.info("New version available.");
130
130
  ```
131
131
 
132
+ ## Charts (react-chartjs-2)
133
+
134
+ Craftsman uses `react-chartjs-2` directly, without modification — there is no Craftsman `Chart` wrapper component. Consumers install `react-chartjs-2` and its `chart.js` peer dependency themselves and use the upstream API exactly as documented at https://react-chartjs-2.js.org/examples.
135
+
136
+ Import:
137
+
138
+ ```tsx
139
+ import { Chart as ChartJS, CategoryScale, LinearScale, BarElement, Tooltip, Legend } from "chart.js";
140
+ import { Bar } from "react-chartjs-2";
141
+
142
+ // Register only the controllers/elements/scales/plugins the chart type needs — chart.js is tree-shakeable.
143
+ ChartJS.register(CategoryScale, LinearScale, BarElement, Tooltip, Legend);
144
+ ```
145
+
146
+ Usage:
147
+
148
+ - Every chart type used (`Bar`, `Line`, `Pie`, `Doughnut`, `PolarArea`, `Radar`, `Scatter`, `Bubble`, `Chart` for mixed types) must have its corresponding `chart.js` pieces registered once at module scope before render.
149
+ - Dataset colors must be literal color values (hex/`rgba()`), not CSS variables (`var(--blue500)`) — chart.js draws to a `<canvas>` 2D context, which cannot resolve CSS custom properties. Use `colors` and `hexToRgba` from `@stamcat/craftsman/styles` (see the [craftsman-style-utilities skill](../craftsman-style-utilities/SKILL.md)) to stay on-palette instead of hard-coding hex strings inline.
150
+ - See `src/stories/organisms/Charts.stories.tsx` in this repo for a full worked example of every chart type from the react-chartjs-2 examples page.
151
+
152
+ ## Tables (ag-grid-community)
153
+
154
+ Craftsman does not wrap `ag-grid-community`/`ag-grid-react` with a custom component. We use them directly, without modification, for advanced data visualization tables (large sortable/filterable datasets) — exactly as documented upstream at https://www.ag-grid.com/react-data-grid/.
155
+
156
+ Import:
157
+
158
+ ```tsx
159
+ import { AllCommunityModule, ModuleRegistry, themeQuartz } from "ag-grid-community";
160
+ import { AgGridReact } from "ag-grid-react";
161
+
162
+ // Register only the Community module — do not register Enterprise modules without a license.
163
+ ModuleRegistry.registerModules([AllCommunityModule]);
164
+ ```
165
+
166
+ Usage:
167
+
168
+ - Only the **free Community feature set** is used/showcased in this repo: client-side sorting, filtering, pagination, row selection, cell rendering/formatting, quick filter, and CSV export.
169
+ - AG Grid also sells **Enterprise-only** features (row grouping, pivoting, master/detail, server-side row model, Excel export, and others). These require registering separate Enterprise modules and a commercial license key. Do not enable or suggest Enterprise modules unless the consumer confirms they hold an AG Grid Enterprise license — it is the consumer's responsibility to obtain and configure that license.
170
+ - See `src/stories/organisms/Tables.stories.tsx` in this repo for worked Community-only examples.
171
+
132
172
  ## Code Generation Patterns to Prefer
133
173
 
134
174
  1. Generate fully typed React usage examples.
@@ -17,6 +17,8 @@ Behavior notes:
17
17
 
18
18
  - `type` defaults to `"button"`.
19
19
  - For `variant !== "default"`, variant is appended to `className` (for example `"primary"`).
20
+ - `primary` and `secondary` share a distinct filled look (blue background, white text); `default` is a base outlined look; `text` is a borderless, underline-on-hover link style.
21
+ - A `<button>` element can wrap arbitrary content (icons, custom markup, anything) purely so it stays usable by screen readers and other automated/assistive services — the native semantics and keyboard behavior come for free. Not every `<button>` should visually look like a button though, so styling is opt-in via class names rather than the bare element: base button styles (`%button-styles`) are scoped to the `.button` class the component always applies, not the bare `button` element — plain `<button>` markup without that class receives no library styling.
20
22
  - `className` is preserved and merged after component classes.
21
23
  - Theme component overrides are selector-based CSS emitted by `ThemeProvider`; `theme.components.*` accepts JS style objects or raw CSS/Sass strings for the target selector.
22
24
  - If `children` is empty (per `isEmpty`), the component renders nothing.
@@ -1,6 +1,12 @@
1
1
  @use "../../utilities/functions" as u;
2
2
 
3
3
  @layer cf-base {
4
+ %button-reset {
5
+ background: none;
6
+ border: none;
7
+ color: #{u.color("text")};
8
+ }
9
+
4
10
  %text-link {
5
11
  padding: 0;
6
12
  border: none;
@@ -18,7 +24,7 @@
18
24
  }
19
25
  }
20
26
  }
21
-
27
+
22
28
  %button-styles {
23
29
  --btn-size: 1;
24
30
  color: var(--blue600);
@@ -47,7 +53,16 @@
47
53
  background-color: var(--blue700);
48
54
  }
49
55
  }
50
-
56
+
57
+ &.secondary {
58
+ color: var(--white);
59
+ background-color: var(--blue500);
60
+
61
+ &:hover {
62
+ background-color: var(--blue700);
63
+ }
64
+ }
65
+
51
66
  &.text {
52
67
  @extend %text-link;
53
68
  }
@@ -58,7 +73,7 @@
58
73
  border-color: #{u.color("gray200")};
59
74
  color: #{u.color("gray400")};
60
75
 
61
- &.primary {
76
+ &.primary, &.secondary {
62
77
  border-color: #{u.color("gray200")};
63
78
  background-color: #{u.color("gray400")};
64
79
  color: #{u.color("gray200")};
@@ -59,8 +59,10 @@
59
59
  code {
60
60
  @extend %code;
61
61
  }
62
-
63
62
  button {
63
+ @extend %button-reset;
64
+ }
65
+ .button {
64
66
  @extend %button-styles;
65
67
  }
66
68