@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/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { bg, navColors, text, forestTheme, getPreset, buildTheme, lineHeight, fontSize } from './chunk-GZ6FQWHG.mjs';
2
- export { alpha, avatarColors, bg, border, breadcrumbColors, buildTheme, buildThemeOptions, buttonColors, chartColors, colors, container, display, fg, focusRings, fontFamily, fontSize, fontWeight, forestAgencyPreset, forestExternalPreset, forestInternalPreset, forestTheme, forestThemeOptions, getAvailablePresets, getPreset, iconColors, lineHeight, navColors, radius, registerPreset, sliderColors, spacing, text, toggleColors, shadows as tokenShadows, widths } from './chunk-GZ6FQWHG.mjs';
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: "contained", ...props });
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: "contained", ...props });
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: "primary", ...props });
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(MuiFormControl, { fullWidth: true, children: [
173
- label && /* @__PURE__ */ jsx(MuiInputLabel, { id: labelId, shrink: value.length > 0, children: label }),
174
- /* @__PURE__ */ jsxs(
175
- MuiSelect,
176
- {
177
- labelId,
178
- label,
179
- multiple: true,
180
- notched: value.length > 0,
181
- value,
182
- onChange: handleChange,
183
- displayEmpty: true,
184
- renderValue: renderValue2,
185
- ...rest,
186
- children: [
187
- selectAll && /* @__PURE__ */ jsx(
188
- "li",
189
- {
190
- onMouseDown: (e) => e.preventDefault(),
191
- onClick: (e) => {
192
- e.stopPropagation();
193
- handleSelectAll();
194
- },
195
- children: /* @__PURE__ */ jsx(MuiButton, { size: "small", variant: "text", children: allSelected ? "Deselect All" : selectAllLabel })
196
- }
197
- ),
198
- options.map((option) => /* @__PURE__ */ jsxs(MuiMenuItem, { value: option.value, children: [
199
- /* @__PURE__ */ jsx(MuiCheckbox, { checked: value.includes(option.value) }),
200
- /* @__PURE__ */ jsx(MuiListItemText, { primary: option.label })
201
- ] }, option.value))
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: "outlined",
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: /* @__PURE__ */ jsx(CloseOutlined_default, {}),
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: true, ...props });
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 colors2 = chart.series.map((s) => s.fg);
686
- return colors2.slice(0, Math.min(count, colors2.length));
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: colors2, ...props }) {
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: colors2 != null ? colors2 : seriesColors,
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: colors2, ...props }) {
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 = colors2 != null ? colors2 : seriesColors;
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: colors2 != null ? colors2 : seriesColors,
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: colors2, ...props }) {
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: colors2 != null ? colors2 : seriesColors,
1006
+ colors: colors != null ? colors : seriesColors,
995
1007
  slotProps: {
996
1008
  legend: {
997
1009
  itemMarkWidth: 12,