@5ive-souls/controls 0.0.6 → 0.0.7

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.
@@ -2,17 +2,18 @@ import { jsx as i, jsxs as D } from "react/jsx-runtime";
2
2
  import c from "react";
3
3
  import { Wizard as j } from "../Wizard/Wizard.js";
4
4
  import { WizardPanel as U } from "../Wizard/WizardPanel/WizardPanel.js";
5
- import { makeStyles as H, tokens as k, Text as $, Divider as A, mergeClasses as J, Textarea as K, RadioGroup as Q, Radio as X, Dropdown as Y, Option as Z, Checkbox as ee, Input as ne, Field as te } from "@fluentui/react-components";
5
+ import { makeStyles as H, tokens as v, Text as $, Divider as A, mergeClasses as J, Textarea as K, RadioGroup as Q, Radio as X, Dropdown as Y, Option as Z, Checkbox as ee, Input as ne, Field as te } from "@fluentui/react-components";
6
6
  import { Device as ae } from "../FiveSoulsProvider/FiveSouls.Types.js";
7
7
  import "../FiveSoulsProvider/deviceContext.js";
8
8
  import { useDevice as ie } from "../FiveSoulsProvider/useDevice.js";
9
- import { FlexBox as v } from "../FlexBox/FlexBox.js";
9
+ import { FlexBox as b } from "../FlexBox/FlexBox.js";
10
10
  import { FlexBoxItem as se } from "../FlexBox/FlexBoxItem/FlexBoxItem.js";
11
11
  import "../FlexBox/FlexBoxItemResizer/FlexBoxItemResizer.js";
12
- import { ClassNames as b } from "../ClassNames.js";
12
+ import { ClassNames as F } from "../ClassNames.js";
13
13
  const oe = H({
14
14
  root: {
15
15
  width: "100%",
16
+ height: "100%",
16
17
  boxSizing: "border-box"
17
18
  },
18
19
  radio: {
@@ -20,8 +21,8 @@ const oe = H({
20
21
  flexBasis: "0px"
21
22
  }
22
23
  }), be = (M) => {
23
- const { metaData: F, readonly: d, onSubmit: x, className: R, ref: E, action: m, target: O, strings: f, wizardStrings: V, onFieldChanged: z, id: _ } = M, { sections: u, results: o } = F, S = oe(), l = c.useReducer((e) => e + 1, 0)[1], I = ie(), p = c.useRef({}), h = c.useCallback((e, n) => {
24
- const a = p.current;
24
+ const { metaData: x, readonly: d, onSubmit: f, className: R, ref: E, action: m, target: O, strings: z, wizardStrings: V, onFieldChanged: S, id: _ } = M, { sections: u, results: o } = x, p = oe(), l = c.useReducer((e) => e + 1, 0)[1], I = ie(), h = c.useRef({}), g = c.useCallback((e, n) => {
25
+ const a = h.current;
25
26
  if (!(e in a))
26
27
  return;
27
28
  const t = a[e];
@@ -47,30 +48,30 @@ const oe = H({
47
48
  }
48
49
  }, [l]);
49
50
  c.useEffect(() => {
50
- const e = p.current;
51
+ const e = h.current;
51
52
  for (const n in e) {
52
53
  const a = e[n];
53
- a && h(n, o[a.dependantOn]);
54
+ a && g(n, o[a.dependantOn]);
54
55
  }
55
- }, [h, o]);
56
+ }, [g, o]);
56
57
  const q = (e) => "key" in e, r = (e, n) => {
57
58
  const a = o[e.key];
58
- o[e.key] = n, h(e.key, n), z && z(e.key, a, n);
59
+ o[e.key] = n, g(e.key, n), S && S(e.key, a, n);
59
60
  };
60
61
  let C = 0;
61
62
  const B = (e) => (C++, /* @__PURE__ */ i(
62
- v,
63
+ b,
63
64
  {
64
- className: b.FormFieldGroup,
65
+ className: F.FormFieldGroup,
65
66
  horizontal: I != ae.Mobile,
66
- childrenGap: k.spacingHorizontalM,
67
+ childrenGap: v.spacingHorizontalM,
67
68
  alignItems: "start",
68
- children: e.fields.map((n) => w(n))
69
+ children: e.fields.map((n) => N(n))
69
70
  },
70
71
  "field-group-" + C
71
- )), w = (e) => {
72
+ )), N = (e) => {
72
73
  let n;
73
- e.dependantOn && (p.current[e.dependantOn] = e);
74
+ e.dependantOn && (h.current[e.dependantOn] = e);
74
75
  const a = d || e.disabled;
75
76
  return e.multiLine ? n = /* @__PURE__ */ i(
76
77
  K,
@@ -96,7 +97,7 @@ const oe = H({
96
97
  readOnly: d,
97
98
  label: t,
98
99
  value: t,
99
- className: S.radio
100
+ className: p.radio
100
101
  },
101
102
  t
102
103
  ))
@@ -133,7 +134,7 @@ const oe = H({
133
134
  se,
134
135
  {
135
136
  id: `field-${e.key}`,
136
- className: b.FormField,
137
+ className: F.FormField,
137
138
  grow: e.doNotFill ? 0 : 1,
138
139
  children: /* @__PURE__ */ i(
139
140
  te,
@@ -150,47 +151,47 @@ const oe = H({
150
151
  );
151
152
  }, T = (e, n, a) => {
152
153
  u.forEach((t) => {
153
- g(t, e, n, a);
154
+ y(t, e, n, a);
154
155
  });
155
- }, g = (e, n, a, t) => {
156
+ }, y = (e, n, a, t) => {
156
157
  e.fields.forEach((s) => {
157
158
  q(s) ? n(s, t) : a(s, t);
158
159
  });
159
- }, y = (e, n) => {
160
+ }, k = (e, n) => {
160
161
  if (e.required && o[e.key] === void 0) {
161
- if (e.validationMessage = f ? f.fieldRequired : "This field is required.", n) {
162
+ if (e.validationMessage = z ? z.fieldRequired : "This field is required.", n) {
162
163
  const a = n;
163
164
  a.missingFields++;
164
165
  }
165
166
  } else
166
167
  e.validationMessage = "";
167
- }, G = (e, n) => {
168
+ }, w = (e, n) => {
168
169
  e.fields.forEach((a) => {
169
- y(a, n);
170
+ k(a, n);
170
171
  });
171
172
  }, W = (e, n) => {
172
173
  const a = u[e], t = { missingFields: 0 };
173
- return g(a, y, G, t), l(), t.missingFields <= 0;
174
+ return y(a, k, w, t), l(), t.missingFields <= 0;
174
175
  }, P = () => {
175
176
  const e = { missingFields: 0 };
176
- T(y, G, e), e.missingFields > 0 ? l() : x && !m && x(F.results);
177
- }, N = [];
177
+ T(k, w, e), e.missingFields > 0 ? l() : f && !m && f(x.results);
178
+ }, G = [];
178
179
  return u.forEach((e, n) => {
179
180
  const a = [];
180
- g(e, (t) => {
181
- a.push(w(t));
181
+ y(e, (t) => {
182
+ a.push(N(t));
182
183
  }, (t) => {
183
184
  a.push(B(t));
184
- }), N.push(
185
- /* @__PURE__ */ i(U, { title: e.title, children: /* @__PURE__ */ D(v, { fill: !0, childrenGap: k.spacingVerticalM, children: [
185
+ }), G.push(
186
+ /* @__PURE__ */ i(U, { title: e.title, children: /* @__PURE__ */ D(b, { fill: !0, childrenGap: v.spacingVerticalM, children: [
186
187
  e.message && /* @__PURE__ */ D("div", { children: [
187
188
  /* @__PURE__ */ i($, { children: e.message }),
188
189
  /* @__PURE__ */ i(A, { appearance: "brand" })
189
190
  ] }),
190
- /* @__PURE__ */ i(v, { fill: !0, childrenGap: k.spacingVerticalM, children: a })
191
+ /* @__PURE__ */ i(b, { fill: !0, childrenGap: v.spacingVerticalM, children: a })
191
192
  ] }) }, "WizardPanel-" + n)
192
193
  );
193
- }), /* @__PURE__ */ i("div", { id: _, className: J(b.DynamicForm, S.root, R), ref: E, children: /* @__PURE__ */ i("form", { action: m, target: O, children: /* @__PURE__ */ i(j, { onSubmit: P, onNavigatePanel: W, readonly: d, asForm: m != null, strings: V, children: N }) }) });
194
+ }), /* @__PURE__ */ i("div", { id: _, className: J(F.DynamicForm, p.root, R), ref: E, children: /* @__PURE__ */ i("form", { action: m, target: O, className: p.root, children: /* @__PURE__ */ i(j, { onSubmit: P, onNavigatePanel: W, readonly: d, asForm: m != null, strings: V, children: G }) }) });
194
195
  };
195
196
  export {
196
197
  be as DynamicForm
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5ive-souls/controls",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Collection of react components built on the Fluent UI framework.",
5
5
  "keywords": [
6
6
  "react",
Binary file