@hybridcore/ui 1.4.11 → 1.4.12

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,38 +1,40 @@
1
- import { jsx as t, jsxs as u, Fragment as T } from "react/jsx-runtime";
2
- import { useState as Y } from "react";
1
+ import { jsx as t, jsxs as u, Fragment as F } from "react/jsx-runtime";
2
+ import { useState as S } from "react";
3
3
  import r from "dayjs";
4
- import { RadioButtonUnchecked as D, CheckCircle as L, KeyboardArrowUp as B, KeyboardArrowDown as W } from "@mui/icons-material";
5
- import { Typography as M, FormLabel as z, FormGroup as $, Button as j } from "@mui/material";
6
- import { DatePicker as P } from "@mui/x-date-pickers";
4
+ import { RadioButtonUnchecked as T, CheckCircle as Y, KeyboardArrowUp as D, KeyboardArrowDown as B } from "@mui/icons-material";
5
+ import { Typography as y, FormLabel as W, FormGroup as z, Button as $ } from "@mui/material";
6
+ import { DatePicker as M } from "@mui/x-date-pickers";
7
7
  import { T as b } from "../../TextField-D87qTh1k.js";
8
8
  import { B as h } from "../../Box-BPyg-Ybm.js";
9
- import { F as k } from "../../FormControlLabel-D9KFjcIx.js";
10
- import { C as w } from "../../Checkbox-qy3cjvnb.js";
11
- import { F as A } from "../../InputLabel-CWkW8NtU.js";
9
+ import { F as O } from "../../FormControlLabel-D9KFjcIx.js";
10
+ import { C as P } from "../../Checkbox-qy3cjvnb.js";
11
+ import { F as j } from "../../InputLabel-CWkW8NtU.js";
12
12
  function X({
13
13
  property: e,
14
- value: l,
14
+ value: a,
15
15
  size: s = "medium",
16
16
  variant: d,
17
17
  onChange: x
18
18
  }) {
19
- var g, I, V, C, y;
20
- const c = (o) => (n) => {
21
- let a = { ...l };
19
+ var g, I, V, C, L;
20
+ const f = (o) => (n) => {
21
+ let l = { ...a };
22
22
  const i = n.target.type === "checkbox" ? n.target.checked : n.target.value;
23
- a[o] = String(i), x({
24
- [n.target.name]: a
23
+ l[o] = String(i), x({
24
+ [n.target.name]: l
25
25
  });
26
- }, F = (o) => {
27
- var f;
28
- const n = { ...l }, { value: a, checked: i, name: m } = o.target;
29
- i ? (n.list || (n.list = []), n.list.push(a)) : n.list = (f = n.list) == null ? void 0 : f.filter((S) => S !== a), x({
26
+ }, k = (o) => {
27
+ var c;
28
+ const n = { ...a }, { value: l, checked: i, name: m } = o.target;
29
+ i ? (n.atLeastOneOf || (n.atLeastOneOf = []), n.atLeastOneOf.push(l)) : n.atLeastOneOf = (c = n.atLeastOneOf) == null ? void 0 : c.filter(
30
+ (w) => w !== l
31
+ ), x({
30
32
  [m]: n
31
33
  });
32
34
  }, p = (o) => (n) => {
33
- let a = { ...l };
34
- a[o] = r(n).format("YYYY-MM-DD"), x({
35
- [e.propertyId]: a
35
+ let l = { ...a };
36
+ l[o] = r(n).format("YYYY-MM-DD"), x({
37
+ [e.propertyId]: l
36
38
  });
37
39
  };
38
40
  if (["string", "text", "list"].includes(e.type))
@@ -41,9 +43,9 @@ function X({
41
43
  {
42
44
  label: e.name,
43
45
  name: e.propertyId,
44
- value: l.exact ?? e.defaultValue ?? "",
46
+ value: a.exact ?? e.defaultValue ?? "",
45
47
  size: s,
46
- onChange: c("exact"),
48
+ onChange: f("exact"),
47
49
  variant: d,
48
50
  type: "text",
49
51
  multiline: e.type === "text",
@@ -62,9 +64,9 @@ function X({
62
64
  {
63
65
  label: `${e.name} (Min)`,
64
66
  name: e.propertyId,
65
- value: l.min ?? e.defaultValue ?? "",
67
+ value: a.min ?? e.defaultValue ?? "",
66
68
  size: s,
67
- onChange: c("min"),
69
+ onChange: f("min"),
68
70
  variant: d,
69
71
  type: "number",
70
72
  disabled: !e.editable,
@@ -74,15 +76,15 @@ function X({
74
76
  }
75
77
  }
76
78
  ),
77
- /* @__PURE__ */ t(M, { px: 1, children: "-" }),
79
+ /* @__PURE__ */ t(y, { px: 1, children: "-" }),
78
80
  /* @__PURE__ */ t(
79
81
  b,
80
82
  {
81
83
  label: `${e.name} (Max)`,
82
84
  name: e.propertyId,
83
- value: l.max ?? e.defaultValue ?? "",
85
+ value: a.max ?? e.defaultValue ?? "",
84
86
  size: s,
85
- onChange: c("max"),
87
+ onChange: f("max"),
86
88
  variant: d,
87
89
  type: "number",
88
90
  disabled: !e.editable,
@@ -94,13 +96,13 @@ function X({
94
96
  )
95
97
  ] });
96
98
  if (e.type === "date") {
97
- const o = "DD/MM/YYYY", n = "YYYY-MM-DD", a = l.min && r(l.min, n, !0).isValid() ? r(l.min, n) : null, i = l.max && r(l.max, n, !0).isValid() ? r(l.max, n) : null;
99
+ const o = "DD/MM/YYYY", n = "YYYY-MM-DD", l = a.min && r(a.min, n, !0).isValid() ? r(a.min, n) : null, i = a.max && r(a.max, n, !0).isValid() ? r(a.max, n) : null;
98
100
  return /* @__PURE__ */ u(h, { mb: 2, display: "flex", alignItems: "end", children: [
99
101
  /* @__PURE__ */ t(
100
- P,
102
+ M,
101
103
  {
102
104
  label: `${e.name} (Min)`,
103
- value: a,
105
+ value: l,
104
106
  format: o,
105
107
  views: ["year", "month", "day"],
106
108
  slotProps: {
@@ -116,14 +118,14 @@ function X({
116
118
  onChange: p("min")
117
119
  }
118
120
  ),
119
- /* @__PURE__ */ t(M, { px: 1, children: "-" }),
121
+ /* @__PURE__ */ t(y, { px: 1, children: "-" }),
120
122
  /* @__PURE__ */ t(
121
- P,
123
+ M,
122
124
  {
123
125
  label: `${e.name} (Max)`,
124
126
  value: i,
125
127
  format: o,
126
- minDate: a !== null ? a : void 0,
128
+ minDate: l !== null ? l : void 0,
127
129
  views: ["year", "month", "day"],
128
130
  slotProps: {
129
131
  textField: {
@@ -142,18 +144,18 @@ function X({
142
144
  }
143
145
  if (e.type === "boolean")
144
146
  return /* @__PURE__ */ t(h, { mb: 2, children: /* @__PURE__ */ t(
145
- k,
147
+ O,
146
148
  {
147
149
  label: e.name,
148
150
  control: /* @__PURE__ */ t(
149
- w,
151
+ P,
150
152
  {
151
153
  size: s,
152
154
  name: e.propertyId,
153
- checked: !!l,
154
- icon: /* @__PURE__ */ t(D, {}),
155
- checkedIcon: /* @__PURE__ */ t(L, {}),
156
- onChange: c("exact")
155
+ checked: !!a,
156
+ icon: /* @__PURE__ */ t(T, {}),
157
+ checkedIcon: /* @__PURE__ */ t(Y, {}),
158
+ onChange: f("exact")
157
159
  }
158
160
  ),
159
161
  slotProps: {
@@ -164,23 +166,23 @@ function X({
164
166
  }
165
167
  ) });
166
168
  if (e.type === "enum" || e.type === "composite-list" && ((I = (g = e.dataTypeInfo) == null ? void 0 : g.innerType) == null ? void 0 : I.type) === "enum") {
167
- const [o, n] = Y(!1), a = 10;
169
+ const [o, n] = S(!1), l = 10;
168
170
  let i = [];
169
- return (V = e.dataTypeInfo) != null && V.enumValues && (i = e.dataTypeInfo.enumValues), (y = (C = e.dataTypeInfo) == null ? void 0 : C.innerType) != null && y.enumValues && (i = e.dataTypeInfo.innerType.enumValues), /* @__PURE__ */ u(h, { mb: 2, children: [
170
- /* @__PURE__ */ u(A, { fullWidth: !0, component: "fieldset", variant: d, children: [
171
- /* @__PURE__ */ t(z, { component: "legend", sx: { mb: 1 }, children: e.name }),
172
- /* @__PURE__ */ t($, { children: i.slice(0, o ? 9999 : a).map((m, f) => /* @__PURE__ */ t(
173
- k,
171
+ return (V = e.dataTypeInfo) != null && V.enumValues && (i = e.dataTypeInfo.enumValues), (L = (C = e.dataTypeInfo) == null ? void 0 : C.innerType) != null && L.enumValues && (i = e.dataTypeInfo.innerType.enumValues), /* @__PURE__ */ u(h, { mb: 2, children: [
172
+ /* @__PURE__ */ u(j, { fullWidth: !0, component: "fieldset", variant: d, children: [
173
+ /* @__PURE__ */ t(W, { component: "legend", sx: { mb: 1 }, children: e.name }),
174
+ /* @__PURE__ */ t(z, { children: i.slice(0, o ? 9999 : l).map((m, c) => /* @__PURE__ */ t(
175
+ O,
174
176
  {
175
177
  label: m,
176
178
  control: /* @__PURE__ */ t(
177
- w,
179
+ P,
178
180
  {
179
181
  name: e.propertyId,
180
182
  value: m,
181
183
  size: "small",
182
- checked: l.list ? l.list.includes(m) : !1,
183
- onChange: F
184
+ checked: a.atLeastOneOf ? a.atLeastOneOf.includes(m) : !1,
185
+ onChange: k
184
186
  }
185
187
  ),
186
188
  componentsProps: {
@@ -189,15 +191,15 @@ function X({
189
191
  }
190
192
  }
191
193
  },
192
- f
194
+ c
193
195
  )) })
194
196
  ] }),
195
- i.length > a && /* @__PURE__ */ u(
196
- j,
197
+ i.length > l && /* @__PURE__ */ u(
198
+ $,
197
199
  {
198
200
  size: "small",
199
201
  sx: { p: 0, textTransform: "none" },
200
- endIcon: o ? /* @__PURE__ */ t(B, {}) : /* @__PURE__ */ t(W, {}),
202
+ endIcon: o ? /* @__PURE__ */ t(D, {}) : /* @__PURE__ */ t(B, {}),
201
203
  onClick: () => n((m) => !m),
202
204
  children: [
203
205
  "Show ",
@@ -207,7 +209,7 @@ function X({
207
209
  )
208
210
  ] });
209
211
  }
210
- return /* @__PURE__ */ t(T, {});
212
+ return /* @__PURE__ */ t(F, {});
211
213
  }
212
214
  export {
213
215
  X as default
package/dist/main.d.ts CHANGED
@@ -1070,7 +1070,7 @@ declare namespace FV {
1070
1070
  min?: string;
1071
1071
  max?: string;
1072
1072
  exact?: string;
1073
- list?: string[];
1073
+ atLeastOneOf?: Array<string | number>;
1074
1074
  }
1075
1075
 
1076
1076
  interface SearchResults {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hybridcore/ui",
3
3
  "description": "Hybrid Core UI Library",
4
- "version": "1.4.11",
4
+ "version": "1.4.12",
5
5
  "author": "Hybrid Core",
6
6
  "license": "ISC",
7
7
  "type": "module",