@scmlatam/web-ui 0.1.8 → 0.1.10

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,4 @@
1
- import { _ as f } from "./main-jEaTxT8e.js";
1
+ import { _ as f } from "./main-BmrLsV9L.js";
2
2
  const o = {
3
3
  config: {
4
4
  isInitialized: !1
@@ -41716,7 +41716,7 @@ async function zw(e) {
41716
41716
  return;
41717
41717
  const {
41718
41718
  default: t
41719
- } = await import("./get-context-C1qO2p6C.js"), r = await t();
41719
+ } = await import("./get-context-DOucrlL_.js"), r = await t();
41720
41720
  if (!e || !Vw(r))
41721
41721
  return;
41722
41722
  const o = y({}, e, {
@@ -52173,17 +52173,18 @@ const dA = vt(/* @__PURE__ */ p("path", {
52173
52173
  values: o,
52174
52174
  placeholder: n,
52175
52175
  disabled: s,
52176
- white: l
52177
- }) => /* @__PURE__ */ p(Ii, { children: /* @__PURE__ */ ne(vs, { fullWidth: !0, focused: !0, children: [
52176
+ fullWidth: l,
52177
+ white: a
52178
+ }) => /* @__PURE__ */ p(Ii, { children: /* @__PURE__ */ ne(vs, { fullWidth: l, focused: !0, children: [
52178
52179
  /* @__PURE__ */ p(
52179
52180
  Fs,
52180
52181
  {
52181
52182
  id: `filter-table-label-${e}`,
52182
52183
  sx: {
52183
- color: l ? "black" : "white",
52184
+ color: a ? "black" : "white",
52184
52185
  position: "absolute",
52185
52186
  "&.Mui-focused": {
52186
- color: l ? "black" : "white"
52187
+ color: a ? "black" : "white"
52187
52188
  },
52188
52189
  '&[data-shrink="false"]': {
52189
52190
  transform: "translateY(12px) translateX(12px)"
@@ -52199,10 +52200,10 @@ const dA = vt(/* @__PURE__ */ p("path", {
52199
52200
  id: `filter-${e}`,
52200
52201
  value: t,
52201
52202
  label: e,
52202
- onChange: (a) => r(a.target.value),
52203
+ onChange: (c) => r(c.target.value),
52203
52204
  color: "gr-yellow",
52204
52205
  sx: {
52205
- color: l ? "black" : "white"
52206
+ color: a ? "black" : "white"
52206
52207
  },
52207
52208
  IconComponent: dA,
52208
52209
  MenuProps: {
@@ -52217,18 +52218,18 @@ const dA = vt(/* @__PURE__ */ p("path", {
52217
52218
  },
52218
52219
  MenuListProps: {
52219
52220
  sx: {
52220
- backgroundColor: l ? "white" : et["gr-base-dark"].main,
52221
+ backgroundColor: a ? "white" : et["gr-base-dark"].main,
52221
52222
  "& .MuiMenuItem-root": {
52222
- backgroundColor: l ? "white" : et["gr-base-dark"].main,
52223
- color: l ? "black" : "white",
52223
+ backgroundColor: a ? "white" : et["gr-base-dark"].main,
52224
+ color: a ? "black" : "white",
52224
52225
  "&:hover": {
52225
- backgroundColor: l ? "white" : et["gr-base-dark"].main
52226
+ backgroundColor: a ? "white" : et["gr-base-dark"].main
52226
52227
  },
52227
52228
  "&.Mui-selected": {
52228
- backgroundColor: l ? "white" : et["gr-base-dark"].main
52229
+ backgroundColor: a ? "white" : et["gr-base-dark"].main
52229
52230
  },
52230
52231
  "&.Mui-focusVisible": {
52231
- backgroundColor: l ? "white" : et["gr-base-dark"].main
52232
+ backgroundColor: a ? "white" : et["gr-base-dark"].main
52232
52233
  }
52233
52234
  }
52234
52235
  }
@@ -52238,7 +52239,7 @@ const dA = vt(/* @__PURE__ */ p("path", {
52238
52239
  disabled: s,
52239
52240
  children: [
52240
52241
  /* @__PURE__ */ p(lo, { sx: { mt: 2 }, disabled: !0, value: "", children: /* @__PURE__ */ p("em", { children: n }) }),
52241
- o.map((a) => /* @__PURE__ */ p(lo, { value: a.value, children: a.label }, a.value))
52242
+ o.map((c) => /* @__PURE__ */ p(lo, { value: c.value, children: c.label }, c.value))
52242
52243
  ]
52243
52244
  }
52244
52245
  )
@@ -57570,7 +57571,7 @@ const oL = ({
57570
57571
  }
57571
57572
  }
57572
57573
  },
57573
- renderValue: (l) => l.join(", "),
57574
+ renderValue: (l) => o.filter((a) => l.includes(a.value)).map((a) => a.label).join(", "),
57574
57575
  displayEmpty: !0,
57575
57576
  disabled: s,
57576
57577
  multiple: !0,
@@ -57650,7 +57651,8 @@ const oL = ({
57650
57651
  setMultiValue: c,
57651
57652
  values: n,
57652
57653
  placeholder: "Seleccionar",
57653
- disabled: !1
57654
+ disabled: !1,
57655
+ fullWidth: !1
57654
57656
  }
57655
57657
  ) : /* @__PURE__ */ p(
57656
57658
  cE,
@@ -57661,6 +57663,7 @@ const oL = ({
57661
57663
  values: n,
57662
57664
  placeholder: "Seleccionar",
57663
57665
  disabled: !1,
57666
+ fullWidth: !1,
57664
57667
  white: !1
57665
57668
  }
57666
57669
  ),
@@ -57672,6 +57675,7 @@ const oL = ({
57672
57675
  setMultiValue: V,
57673
57676
  values: m,
57674
57677
  placeholder: "Seleccionar",
57678
+ fullWidth: !1,
57675
57679
  disabled: !1
57676
57680
  }
57677
57681
  ) : /* @__PURE__ */ p(
@@ -57683,6 +57687,7 @@ const oL = ({
57683
57687
  values: m,
57684
57688
  placeholder: "Seleccionar",
57685
57689
  disabled: !1,
57690
+ fullWidth: !1,
57686
57691
  white: !1
57687
57692
  }
57688
57693
  ),
@@ -59203,19 +59208,20 @@ const hL = vt(/* @__PURE__ */ p("path", {
59203
59208
  value: t,
59204
59209
  setValue: r,
59205
59210
  disabled: o,
59206
- white: n
59211
+ fullWidth: n,
59212
+ white: s
59207
59213
  }) => /* @__PURE__ */ p(Ii, { children: /* @__PURE__ */ p(sm, { dateAdapter: XA, children: /* @__PURE__ */ p(
59208
59214
  NM,
59209
59215
  {
59210
59216
  label: e,
59211
59217
  value: t,
59212
- onChange: (s) => {
59213
- r(s);
59218
+ onChange: (l) => {
59219
+ r(l);
59214
59220
  },
59215
59221
  InputProps: {
59216
59222
  sx: {
59217
59223
  borderRadius: "16px",
59218
- color: n ? "black !important" : "white !important"
59224
+ color: s ? "black !important" : "white !important"
59219
59225
  }
59220
59226
  },
59221
59227
  size: "small",
@@ -59223,19 +59229,19 @@ const hL = vt(/* @__PURE__ */ p("path", {
59223
59229
  slotProps: {
59224
59230
  textField: {
59225
59231
  InputLabelProps: {
59226
- sx: { color: n ? "black !important" : "white !important" }
59232
+ sx: { color: s ? "black !important" : "white !important" }
59227
59233
  }
59228
59234
  }
59229
59235
  },
59230
59236
  focused: !0,
59231
59237
  format: "YYYY-MM-DD",
59232
59238
  disabled: o,
59233
- fullWidth: !0,
59239
+ fullWidth: n,
59234
59240
  endAdornment: /* @__PURE__ */ p(
59235
59241
  Uu,
59236
59242
  {
59237
59243
  position: "end",
59238
- sx: { color: n ? "black" : "white" },
59244
+ sx: { color: s ? "black" : "white" },
59239
59245
  children: /* @__PURE__ */ p(hL, { sx: { height: "18px", mt: "-4px" } })
59240
59246
  }
59241
59247
  )
@@ -59268,66 +59274,117 @@ const hL = vt(/* @__PURE__ */ p("path", {
59268
59274
  )
59269
59275
  }
59270
59276
  ) });
59271
- }, KL = ({ open: e, setOpen: t, fields: r, onClickSave: o }) => {
59272
- const [n, s] = mr(!1), l = (u, m) => {
59273
- switch (u.type) {
59274
- case "text":
59275
- return /* @__PURE__ */ p(Wt, { size: u.ncolumn, sx: { mb: "20px" }, children: /* @__PURE__ */ p(
59276
- hn,
59277
+ }, KL = ({
59278
+ title: e,
59279
+ alert: t,
59280
+ action: r,
59281
+ fields: o,
59282
+ open: n,
59283
+ setOpen: s,
59284
+ onClickSave: l
59285
+ }) => {
59286
+ const [a, c] = mr(!1), u = (d, M) => {
59287
+ switch (d.element) {
59288
+ case "TextField":
59289
+ return /* @__PURE__ */ p(
59290
+ Wt,
59277
59291
  {
59278
- fullWidth: !0,
59279
- variant: "outlined",
59280
- label: u.label,
59281
- type: u.type,
59282
- placeholder: u.placeholder,
59283
- focused: !0,
59284
- value: u.value,
59285
- onChange: (E) => {
59286
- u.setValue(E.target.value);
59287
- }
59288
- }
59289
- ) }, m);
59290
- case "select":
59291
- return /* @__PURE__ */ p(Wt, { size: u.ncolumn, sx: { mb: "20px" }, children: /* @__PURE__ */ p(
59292
- cE,
59292
+ size: d.ncolumn,
59293
+ sx: { mb: "20px" },
59294
+ children: /* @__PURE__ */ p(
59295
+ hn,
59296
+ {
59297
+ fullWidth: !0,
59298
+ variant: "outlined",
59299
+ label: d.label,
59300
+ type: d.type,
59301
+ placeholder: d.placeholder,
59302
+ focused: !0,
59303
+ value: d.value,
59304
+ onChange: (V) => {
59305
+ d.setValue(V.target.value);
59306
+ },
59307
+ disabled: d.disable || r.actionButton.loading
59308
+ }
59309
+ )
59310
+ },
59311
+ M
59312
+ );
59313
+ case "SelectField":
59314
+ return /* @__PURE__ */ p(
59315
+ Wt,
59293
59316
  {
59294
- label: u.label,
59295
- placeholder: u.placeholder,
59296
- value: u.value,
59297
- setValue: u.setValue,
59298
- values: u.values,
59299
- disabled: !1,
59300
- white: !0
59301
- }
59302
- ) }, m);
59303
- case "date":
59304
- return /* @__PURE__ */ p(Wt, { size: u.ncolumn, sx: { mb: "20px" }, children: /* @__PURE__ */ p(
59305
- VL,
59317
+ size: d.ncolumn,
59318
+ sx: { mb: "20px" },
59319
+ children: /* @__PURE__ */ p(
59320
+ cE,
59321
+ {
59322
+ label: d.label,
59323
+ placeholder: d.placeholder,
59324
+ value: d.value,
59325
+ setValue: d.setValue,
59326
+ values: d.values,
59327
+ disabled: d.disable || r.actionButton.loading,
59328
+ fullWidth: !0,
59329
+ white: !0
59330
+ }
59331
+ )
59332
+ },
59333
+ M
59334
+ );
59335
+ case "DateField":
59336
+ return /* @__PURE__ */ p(
59337
+ Wt,
59306
59338
  {
59307
- label: u.label,
59308
- value: u.value,
59309
- setValue: u.setValue,
59310
- disabled: !1,
59311
- white: !0
59312
- }
59313
- ) }, m);
59339
+ size: d.ncolumn,
59340
+ sx: { mb: "20px" },
59341
+ children: /* @__PURE__ */ p(
59342
+ VL,
59343
+ {
59344
+ label: d.label,
59345
+ value: d.value,
59346
+ setValue: d.setValue,
59347
+ disabled: d.disable || r.actionButton.loading,
59348
+ fullWidth: !0,
59349
+ white: !0
59350
+ }
59351
+ )
59352
+ },
59353
+ M
59354
+ );
59314
59355
  default:
59315
59356
  return /* @__PURE__ */ p(Ii, {});
59316
59357
  }
59317
- }, a = () => {
59318
- r.forEach((u) => {
59319
- u.setValue(u.initialValue);
59320
- }), s(!1);
59321
- }, c = (u) => {
59322
- u.some(
59323
- (E) => E.value !== E.initialValue
59324
- ) ? s(!0) : t(!1);
59358
+ }, m = () => {
59359
+ o.forEach((d) => {
59360
+ switch (d.element) {
59361
+ case "TextField":
59362
+ d.setValue(
59363
+ d.initialValue
59364
+ );
59365
+ break;
59366
+ case "SelectField":
59367
+ d.setValue(
59368
+ d.initialValue
59369
+ );
59370
+ break;
59371
+ case "DateField":
59372
+ d.setValue(
59373
+ d.initialValue
59374
+ );
59375
+ break;
59376
+ }
59377
+ }), c(!1);
59378
+ }, E = (d) => {
59379
+ d.some(
59380
+ (V) => V.value !== V.initialValue
59381
+ ) ? c(!0) : s(!1);
59325
59382
  };
59326
59383
  return /* @__PURE__ */ p(Ii, { children: /* @__PURE__ */ ne(
59327
59384
  Lf,
59328
59385
  {
59329
- open: e,
59330
- onClose: () => t(!1),
59386
+ open: n,
59387
+ onClose: () => E(o),
59331
59388
  PaperComponent: zL,
59332
59389
  "aria-labelledby": "draggable-dialog-title",
59333
59390
  children: [
@@ -59341,10 +59398,10 @@ const hL = vt(/* @__PURE__ */ p("path", {
59341
59398
  padding: 0
59342
59399
  },
59343
59400
  id: "draggable-dialog-title",
59344
- children: "Agregar empleado"
59401
+ children: e
59345
59402
  }
59346
59403
  ),
59347
- n && /* @__PURE__ */ p(
59404
+ a && /* @__PURE__ */ p(
59348
59405
  xI,
59349
59406
  {
59350
59407
  sx: {
@@ -59359,9 +59416,9 @@ const hL = vt(/* @__PURE__ */ p("path", {
59359
59416
  sx: {
59360
59417
  borderRadius: "24px",
59361
59418
  bgcolor: "#FFEFE5",
59362
- border: (u) => `1px solid ${u.palette["gr-orange"].main}`,
59419
+ border: (d) => `1px solid ${d.palette["gr-orange"].main}`,
59363
59420
  "& .MuiAlert-icon": {
59364
- color: (u) => u.palette["gr-orange"].main
59421
+ color: (d) => d.palette["gr-orange"].main
59365
59422
  }
59366
59423
  },
59367
59424
  action: /* @__PURE__ */ ne(nr, { sx: { mt: 3.75 }, children: [
@@ -59370,8 +59427,8 @@ const hL = vt(/* @__PURE__ */ p("path", {
59370
59427
  {
59371
59428
  color: "gr-grey",
59372
59429
  size: "small",
59373
- onClick: () => s(!1),
59374
- children: /* @__PURE__ */ p("b", { children: "SI" })
59430
+ onClick: () => c(!1),
59431
+ children: /* @__PURE__ */ p("b", { children: t.actionButton.buttonText })
59375
59432
  }
59376
59433
  ),
59377
59434
  /* @__PURE__ */ p(
@@ -59380,21 +59437,21 @@ const hL = vt(/* @__PURE__ */ p("path", {
59380
59437
  color: "gr-grey",
59381
59438
  size: "small",
59382
59439
  onClick: () => {
59383
- a(), t(!1);
59440
+ m(), s(!1);
59384
59441
  },
59385
- children: /* @__PURE__ */ p("b", { children: "NO" })
59442
+ children: /* @__PURE__ */ p("b", { children: t.cancelButton.buttonText })
59386
59443
  }
59387
59444
  )
59388
59445
  ] }),
59389
59446
  children: [
59390
- /* @__PURE__ */ p(gf, { children: "Hay cambios sin guardar" }),
59391
- /* @__PURE__ */ p(pr, { variant: "body2", children: "¿Desea continuar?" })
59447
+ /* @__PURE__ */ p(gf, { children: t.title }),
59448
+ /* @__PURE__ */ p(pr, { variant: "body2", children: t.message })
59392
59449
  ]
59393
59450
  }
59394
59451
  )
59395
59452
  }
59396
59453
  ),
59397
- /* @__PURE__ */ p(xI, { sx: { padding: 0, margin: 0 }, children: /* @__PURE__ */ p(Wt, { container: !0, spacing: 2, sx: { mt: 1 }, children: r.map((u, m) => l(u, m)) }) }),
59454
+ /* @__PURE__ */ p(xI, { sx: { padding: 0, margin: 0 }, children: /* @__PURE__ */ p(Wt, { container: !0, spacing: 2, sx: { mt: 1 }, children: o.map((d, M) => u(d, M)) }) }),
59398
59455
  /* @__PURE__ */ ne(
59399
59456
  Xf,
59400
59457
  {
@@ -59411,14 +59468,14 @@ const hL = vt(/* @__PURE__ */ p("path", {
59411
59468
  {
59412
59469
  variant: "outlined",
59413
59470
  autoFocus: !0,
59414
- onClick: () => c(r),
59471
+ onClick: () => E(o),
59415
59472
  sx: {
59416
59473
  minWidth: "130px",
59417
59474
  borderRadius: "44px",
59418
59475
  fontWeight: "500"
59419
59476
  },
59420
59477
  color: "gr-base-dark",
59421
- children: "Cancel"
59478
+ children: r.cancelButton.buttonText
59422
59479
  }
59423
59480
  ),
59424
59481
  /* @__PURE__ */ p(
@@ -59428,8 +59485,8 @@ const hL = vt(/* @__PURE__ */ p("path", {
59428
59485
  onClick: () => {
59429
59486
  console.log(
59430
59487
  "data",
59431
- r.map((u) => ({ label: u.label, value: u.value }))
59432
- ), o();
59488
+ o.map((d) => ({ label: d.label, value: d.value }))
59489
+ ), l();
59433
59490
  },
59434
59491
  sx: {
59435
59492
  minWidth: "130px",
@@ -59439,7 +59496,9 @@ const hL = vt(/* @__PURE__ */ p("path", {
59439
59496
  },
59440
59497
  color: "gr-base-dark",
59441
59498
  disableElevation: !0,
59442
- children: "Agregar"
59499
+ disabled: r.actionButton.disabled,
59500
+ loading: r.actionButton.loading,
59501
+ children: r.actionButton.buttonText
59443
59502
  }
59444
59503
  )
59445
59504
  ]
package/dist/web-ui.d.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  import { Context } from 'react';
2
2
  import { ContextMenu } from '../components/table/types/types';
3
3
  import { CoreProps } from './types/types';
4
+ import { DateFieldForm } from './form/types/types';
4
5
  import { Dayjs } from 'dayjs';
5
6
  import { Dispatch } from 'react';
6
- import { Field } from './form/types/types';
7
- import { FieldType } from './form/types/types';
8
7
  import { FormProps } from './form/types/types';
9
8
  import { FormProps as FormProps_2 } from './types/types';
10
9
  import { GridRowSelectionModel } from '@mui/x-data-grid';
@@ -17,10 +16,12 @@ import { PageProps } from './core/types/types';
17
16
  import { PaginationModel } from './table/types/types';
18
17
  import { RouteItem } from './core/types/types';
19
18
  import { Row } from './table/types/types';
19
+ import { SelectFieldForm } from './form/types/types';
20
20
  import { SetStateAction } from 'react';
21
21
  import { TableProps } from './table/types/types';
22
22
  import { TableProps as TableProps_2 } from './types/types';
23
23
  import { TableProviderProps } from './table/types/types';
24
+ import { TextFieldForm } from './form/types/types';
24
25
  import { Theme } from '@mui/material';
25
26
  import { ToolbarProps } from './table/types/types';
26
27
  import { ValueItem } from './select/types/types';
@@ -36,11 +37,9 @@ declare interface CoreProviderProps {
36
37
  children: React.ReactNode;
37
38
  }
38
39
 
39
- export { Field }
40
+ export { DateFieldForm }
40
41
 
41
- export { FieldType }
42
-
43
- export declare const Form: ({ open, setOpen, fields, onClickSave }: FormProps_2) => JSX.Element;
42
+ export declare const Form: ({ title, alert, action, fields, open, setOpen, onClickSave, }: FormProps_2) => JSX.Element;
44
43
 
45
44
  export { FormProps }
46
45
 
@@ -75,12 +74,16 @@ export { RouteItem }
75
74
 
76
75
  export { Row }
77
76
 
77
+ export { SelectFieldForm }
78
+
78
79
  export declare const Table: (props: TableProps_2) => JSX.Element;
79
80
 
80
81
  export { TableProps }
81
82
 
82
83
  export { TableProviderProps }
83
84
 
85
+ export { TextFieldForm }
86
+
84
87
  export { ToolbarProps }
85
88
 
86
89
  export declare const useTable: () => {
package/dist/web-ui.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as o, b as r, c as s, F as b, G as t, a as C, T, u as i } from "./main-jEaTxT8e.js";
1
+ import { C as o, b as r, c as s, F as b, G as t, a as C, T, u as i } from "./main-BmrLsV9L.js";
2
2
  export {
3
3
  o as Core,
4
4
  r as CoreContext,