@matteoaliano/forest-ui 0.3.2 → 0.3.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/bin/sync.mjs +30 -1
- package/dist/{chunk-GZ6FQWHG.mjs → chunk-G2ZXCZKP.mjs} +926 -803
- package/dist/chunk-G2ZXCZKP.mjs.map +1 -0
- package/dist/{index-CSpNzZHg.d.mts → index-BCXD47YU.d.mts} +72 -84
- package/dist/{index-CSpNzZHg.d.ts → index-BCXD47YU.d.ts} +72 -84
- package/dist/index.d.mts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +1001 -855
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +68 -56
- package/dist/index.mjs.map +1 -1
- package/dist/theme.d.mts +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +927 -801
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +1 -1
- package/guidelines/FOREST_BE_GUIDELINES.md +1 -1
- package/guidelines/FOREST_FE_GUIDELINES.md +1 -1
- package/guidelines/FOREST_UI_GUIDELINES.md +37 -2
- package/package.json +2 -1
- package/skills/forest-agency/SKILL.md +84 -0
- package/skills/forest-agency/references/components.md +93 -0
- package/skills/forest-agency/references/patterns.md +256 -0
- package/skills/forest-external/SKILL.md +86 -0
- package/skills/forest-external/references/components.md +93 -0
- package/skills/forest-external/references/patterns.md +256 -0
- package/skills/forest-internal/SKILL.md +86 -0
- package/skills/forest-internal/references/components.md +93 -0
- package/skills/forest-internal/references/patterns.md +256 -0
- package/dist/chunk-GZ6FQWHG.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { bg, navColors, text, forestTheme, getPreset, buildTheme, lineHeight, fontSize } from './chunk-
|
|
2
|
-
export { alpha, avatarColors, bg, border, breadcrumbColors, buildTheme, buildThemeOptions, buttonColors, chartColors,
|
|
1
|
+
import { bg, navColors, text, forestTheme, getPreset, buildTheme, lineHeight, fontSize } from './chunk-G2ZXCZKP.mjs';
|
|
2
|
+
export { alpha, avatarColors, base, bg, border, breadcrumbColors, buildTheme, buildThemeOptions, buttonColors, chartColors, container, display, error, fg, focusRings, fontFamily, fontSize, fontWeight, forestAgencyPreset, forestExternalPreset, forestInternalPreset, forestTheme, forestThemeOptions, getAvailablePresets, getPreset, iconColors, info, lineHeight, navColors, radius, registerPreset, sliderColors, spacing, success, text, toggleColors, shadows as tokenShadows, warning, widths } from './chunk-G2ZXCZKP.mjs';
|
|
3
3
|
import React2, { forwardRef, createContext, useMemo, useState, useCallback, useContext } from 'react';
|
|
4
4
|
import { ThemeProvider, useTheme } from '@mui/material/styles';
|
|
5
5
|
import CssBaseline from '@mui/material/CssBaseline';
|
|
@@ -121,17 +121,17 @@ function ForestProvider({
|
|
|
121
121
|
function Autocomplete(props) {
|
|
122
122
|
return /* @__PURE__ */ jsx(MuiAutocomplete, { ...props });
|
|
123
123
|
}
|
|
124
|
-
function Button({ ...props }) {
|
|
125
|
-
return /* @__PURE__ */ jsx(MuiButton, { variant
|
|
124
|
+
function Button({ variant = "contained", ...props }) {
|
|
125
|
+
return /* @__PURE__ */ jsx(MuiButton, { variant, ...props });
|
|
126
126
|
}
|
|
127
|
-
function ButtonGroup(props) {
|
|
128
|
-
return /* @__PURE__ */ jsx(MuiButtonGroup, { variant
|
|
127
|
+
function ButtonGroup({ variant = "contained", ...props }) {
|
|
128
|
+
return /* @__PURE__ */ jsx(MuiButtonGroup, { variant, ...props });
|
|
129
129
|
}
|
|
130
130
|
function Checkbox(props) {
|
|
131
131
|
return /* @__PURE__ */ jsx(MuiCheckbox, { ...props });
|
|
132
132
|
}
|
|
133
|
-
function Fab(props) {
|
|
134
|
-
return /* @__PURE__ */ jsx(MuiFab, { color
|
|
133
|
+
function Fab({ color = "primary", ...props }) {
|
|
134
|
+
return /* @__PURE__ */ jsx(MuiFab, { color, ...props });
|
|
135
135
|
}
|
|
136
136
|
function RadioGroup(props) {
|
|
137
137
|
return /* @__PURE__ */ jsx(MuiRadioGroup, { ...props });
|
|
@@ -169,40 +169,51 @@ function MultiSelect({
|
|
|
169
169
|
return (_a = labelMap.get(v)) != null ? _a : v;
|
|
170
170
|
}).join(", ");
|
|
171
171
|
const labelId = label ? `forest-multiselect-${String(label).replace(/\s+/g, "-").toLowerCase()}` : void 0;
|
|
172
|
-
return /* @__PURE__ */ jsxs(
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
172
|
+
return /* @__PURE__ */ jsxs(
|
|
173
|
+
MuiFormControl,
|
|
174
|
+
{
|
|
175
|
+
fullWidth: rest.fullWidth,
|
|
176
|
+
disabled: rest.disabled,
|
|
177
|
+
error: rest.error,
|
|
178
|
+
size: rest.size,
|
|
179
|
+
color: rest.color,
|
|
180
|
+
variant: rest.variant,
|
|
181
|
+
children: [
|
|
182
|
+
label && /* @__PURE__ */ jsx(MuiInputLabel, { id: labelId, shrink: value.length > 0, children: label }),
|
|
183
|
+
/* @__PURE__ */ jsxs(
|
|
184
|
+
MuiSelect,
|
|
185
|
+
{
|
|
186
|
+
labelId,
|
|
187
|
+
label,
|
|
188
|
+
multiple: true,
|
|
189
|
+
notched: value.length > 0,
|
|
190
|
+
value,
|
|
191
|
+
onChange: handleChange,
|
|
192
|
+
displayEmpty: true,
|
|
193
|
+
renderValue: renderValue2,
|
|
194
|
+
...rest,
|
|
195
|
+
children: [
|
|
196
|
+
selectAll && /* @__PURE__ */ jsx(
|
|
197
|
+
"li",
|
|
198
|
+
{
|
|
199
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
200
|
+
onClick: (e) => {
|
|
201
|
+
e.stopPropagation();
|
|
202
|
+
handleSelectAll();
|
|
203
|
+
},
|
|
204
|
+
children: /* @__PURE__ */ jsx(MuiButton, { size: "small", variant: "text", children: allSelected ? "Deselect All" : selectAllLabel })
|
|
205
|
+
}
|
|
206
|
+
),
|
|
207
|
+
options.map((option) => /* @__PURE__ */ jsxs(MuiMenuItem, { value: option.value, children: [
|
|
208
|
+
/* @__PURE__ */ jsx(MuiCheckbox, { checked: value.includes(option.value) }),
|
|
209
|
+
/* @__PURE__ */ jsx(MuiListItemText, { primary: option.label })
|
|
210
|
+
] }, option.value))
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
);
|
|
206
217
|
}
|
|
207
218
|
function Switch(props) {
|
|
208
219
|
return /* @__PURE__ */ jsx(MuiSwitch, { ...props });
|
|
@@ -221,6 +232,7 @@ function Search({
|
|
|
221
232
|
onChange,
|
|
222
233
|
onClear,
|
|
223
234
|
placeholder = "Search\u2026",
|
|
235
|
+
variant = "outlined",
|
|
224
236
|
slotProps,
|
|
225
237
|
...props
|
|
226
238
|
}) {
|
|
@@ -241,7 +253,7 @@ function Search({
|
|
|
241
253
|
return /* @__PURE__ */ jsx(
|
|
242
254
|
MuiTextField,
|
|
243
255
|
{
|
|
244
|
-
variant
|
|
256
|
+
variant,
|
|
245
257
|
placeholder,
|
|
246
258
|
value: currentValue,
|
|
247
259
|
onChange: handleChange,
|
|
@@ -352,11 +364,11 @@ function Badge(props) {
|
|
|
352
364
|
var CloseOutlined_default = createSvgIcon(/* @__PURE__ */ jsx("path", {
|
|
353
365
|
d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
|
|
354
366
|
}), "CloseOutlined");
|
|
355
|
-
function Chip(props) {
|
|
367
|
+
function Chip({ deleteIcon = /* @__PURE__ */ jsx(CloseOutlined_default, {}), ...props }) {
|
|
356
368
|
return /* @__PURE__ */ jsx(
|
|
357
369
|
MuiChip,
|
|
358
370
|
{
|
|
359
|
-
deleteIcon
|
|
371
|
+
deleteIcon,
|
|
360
372
|
...props
|
|
361
373
|
}
|
|
362
374
|
);
|
|
@@ -406,8 +418,8 @@ function TableRow(props) {
|
|
|
406
418
|
function DataGrid(props) {
|
|
407
419
|
return /* @__PURE__ */ jsx(DataGrid$1, { ...props });
|
|
408
420
|
}
|
|
409
|
-
function Tooltip(props) {
|
|
410
|
-
return /* @__PURE__ */ jsx(MuiTooltip, { arrow
|
|
421
|
+
function Tooltip({ arrow = true, ...props }) {
|
|
422
|
+
return /* @__PURE__ */ jsx(MuiTooltip, { arrow, ...props });
|
|
411
423
|
}
|
|
412
424
|
function Typography(props) {
|
|
413
425
|
return /* @__PURE__ */ jsx(MuiTypography, { ...props });
|
|
@@ -682,8 +694,8 @@ function SidebarItem({
|
|
|
682
694
|
function useChartColors(count) {
|
|
683
695
|
const theme = useTheme();
|
|
684
696
|
const chart = theme.palette.chart;
|
|
685
|
-
const
|
|
686
|
-
return
|
|
697
|
+
const colors = chart.series.map((s) => s.fg);
|
|
698
|
+
return colors.slice(0, Math.min(count, colors.length));
|
|
687
699
|
}
|
|
688
700
|
function formatDate(date) {
|
|
689
701
|
if (!date) return "";
|
|
@@ -794,7 +806,7 @@ function CustomTooltip(props) {
|
|
|
794
806
|
}
|
|
795
807
|
);
|
|
796
808
|
}
|
|
797
|
-
function LineChart({ series, colors
|
|
809
|
+
function LineChart({ series, colors, ...props }) {
|
|
798
810
|
var _a, _b;
|
|
799
811
|
const theme = useTheme();
|
|
800
812
|
const chart = theme.palette.chart;
|
|
@@ -811,7 +823,7 @@ function LineChart({ series, colors: colors2, ...props }) {
|
|
|
811
823
|
LineChart$1,
|
|
812
824
|
{
|
|
813
825
|
series: modifiedSeries != null ? modifiedSeries : [],
|
|
814
|
-
colors:
|
|
826
|
+
colors: colors != null ? colors : seriesColors,
|
|
815
827
|
grid: { horizontal: true },
|
|
816
828
|
slots: {
|
|
817
829
|
axisContent: CustomTooltip
|
|
@@ -875,12 +887,12 @@ function LineChart({ series, colors: colors2, ...props }) {
|
|
|
875
887
|
}
|
|
876
888
|
);
|
|
877
889
|
}
|
|
878
|
-
function BarChart({ series, colors
|
|
890
|
+
function BarChart({ series, colors, ...props }) {
|
|
879
891
|
var _a, _b;
|
|
880
892
|
const theme = useTheme();
|
|
881
893
|
const chart = theme.palette.chart;
|
|
882
894
|
const seriesColors = useChartColors((_a = series == null ? void 0 : series.length) != null ? _a : 0);
|
|
883
|
-
const resolvedColors =
|
|
895
|
+
const resolvedColors = colors != null ? colors : seriesColors;
|
|
884
896
|
const modifiedSeries = series == null ? void 0 : series.map((s, idx) => {
|
|
885
897
|
var _a2;
|
|
886
898
|
const baseColor = s.color || resolvedColors[idx % resolvedColors.length];
|
|
@@ -896,7 +908,7 @@ function BarChart({ series, colors: colors2, ...props }) {
|
|
|
896
908
|
BarChart$1,
|
|
897
909
|
{
|
|
898
910
|
series: modifiedSeries != null ? modifiedSeries : [],
|
|
899
|
-
colors:
|
|
911
|
+
colors: colors != null ? colors : seriesColors,
|
|
900
912
|
grid: { horizontal: true },
|
|
901
913
|
borderRadius: 4,
|
|
902
914
|
slots: {
|
|
@@ -974,7 +986,7 @@ function BarChart({ series, colors: colors2, ...props }) {
|
|
|
974
986
|
}
|
|
975
987
|
);
|
|
976
988
|
}
|
|
977
|
-
function PieChart({ series, colors
|
|
989
|
+
function PieChart({ series, colors, ...props }) {
|
|
978
990
|
var _a, _b, _c, _d;
|
|
979
991
|
const theme = useTheme();
|
|
980
992
|
const chart = theme.palette.chart;
|
|
@@ -991,7 +1003,7 @@ function PieChart({ series, colors: colors2, ...props }) {
|
|
|
991
1003
|
PieChart$1,
|
|
992
1004
|
{
|
|
993
1005
|
series: modifiedSeries != null ? modifiedSeries : [],
|
|
994
|
-
colors:
|
|
1006
|
+
colors: colors != null ? colors : seriesColors,
|
|
995
1007
|
slotProps: {
|
|
996
1008
|
legend: {
|
|
997
1009
|
itemMarkWidth: 12,
|