jcicl 1.0.76 → 1.0.78

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.
Files changed (76) hide show
  1. package/.chunks/Button.js +7 -6
  2. package/.chunks/ButtonBase.js +2 -1
  3. package/.chunks/CircularProgress.js +9 -8
  4. package/.chunks/DefaultPropsProvider.js +322 -336
  5. package/.chunks/Paper.js +6 -5
  6. package/.chunks/Popper.js +1 -1
  7. package/.chunks/Portal.js +13 -13
  8. package/.chunks/SwitchBase.js +14 -13
  9. package/.chunks/TextField.js +2 -1
  10. package/.chunks/clsx.js +16 -0
  11. package/.chunks/createSvgIcon.js +14 -13
  12. package/.chunks/eye.js +45 -0
  13. package/.chunks/index.js +19 -18
  14. package/AppContainer/AppContainer.js +323 -319
  15. package/Button/Button.js +80 -82
  16. package/Divider/Divider.js +13 -12
  17. package/EditableDetailItemWithIcon/EditableDetailItemWithIcon.d.ts +3 -2
  18. package/EditableDetailItemWithIcon/EditableDetailItemWithIcon.js +39 -39
  19. package/EditableInfoCard/EditableInfoCard.d.ts +1 -1
  20. package/EditableInfoCard/EditableInfoCard.js +25 -25
  21. package/ErrorBoundary/ErrorBoundary.d.ts +5 -5
  22. package/ErrorBoundary/ErrorBoundary.js +21 -19
  23. package/FormComponents/FormComponents.d.ts +1 -2
  24. package/FormContext/createFormContext.js +70 -62
  25. package/FormFields/FormFields.d.ts +1 -1
  26. package/FormFields/FormFields.js +31 -31
  27. package/FormInput/FormInput.d.ts +5 -3
  28. package/FormInput/FormInput.js +10 -8
  29. package/Input/Input.d.ts +6 -1
  30. package/Input/Input.js +35 -100
  31. package/LabeledCheckbox/LabeledCheckbox.js +7 -6
  32. package/LabeledDropdown/LabeledDropdown.d.ts +3 -0
  33. package/LabeledDropdown/LabeledDropdown.js +720 -795
  34. package/LabeledFormattedInput/LabeledFormattedInput.d.ts +23 -0
  35. package/LabeledFormattedInput/LabeledFormattedInput.js +95 -0
  36. package/LabeledFormattedInput/index.d.ts +1 -0
  37. package/LabeledFormattedInput/index.js +4 -0
  38. package/LabeledInput/LabeledInput.js +39 -51
  39. package/LabeledRadio/LabeledRadio.js +7 -6
  40. package/Memo/Memo.js +6 -5
  41. package/Nav/Nav.d.ts +1 -1
  42. package/Pagination/Pagination.d.ts +1 -2
  43. package/Pagination/Pagination.js +25 -24
  44. package/README.md +11 -6
  45. package/Stepper/Stepper.js +4 -3
  46. package/Table/Table.d.ts +7 -5
  47. package/Table/Table.js +5575 -5633
  48. package/Timer/Timer.js +26 -26
  49. package/Toast/Toaster.js +9 -9
  50. package/Tooltip/Tooltip.js +5 -4
  51. package/WelcomeCard/WelcomeCard.d.ts +1 -5
  52. package/WelcomeCard/WelcomeCard.js +45 -101
  53. package/assets/style.css +1 -1
  54. package/assets/tailwind.css +2 -2
  55. package/cn.d.ts +2 -0
  56. package/cn.js +2990 -0
  57. package/constants.d.ts +6 -0
  58. package/constants.js +55 -0
  59. package/cursorPositioning.d.ts +7 -0
  60. package/cursorPositioning.js +13 -0
  61. package/formatters.d.ts +17 -0
  62. package/formatters.js +83 -0
  63. package/inputTypes.d.ts +1 -0
  64. package/inputTypes.js +1 -0
  65. package/logger.d.ts +13 -0
  66. package/logger.js +9 -0
  67. package/maskers.d.ts +6 -0
  68. package/maskers.js +15 -0
  69. package/package.json +2 -1
  70. package/theme.d.ts +1 -0
  71. package/theme.js +9 -8
  72. package/themeUtils.js +58 -79
  73. package/utils.d.ts +8 -18
  74. package/utils.js +39 -89
  75. package/validators.d.ts +5 -0
  76. package/validators.js +12 -0
@@ -1,25 +1,26 @@
1
- import { jsxs as n, jsx as e } from "react/jsx-runtime";
2
- import m from "react";
3
- import { n as a } from "../.chunks/emotion-styled.browser.esm.js";
4
- import { Flex as i } from "../Flex/Flex.js";
5
- import s from "../theme.js";
6
- const h = a(i)`
1
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
+ import h from "react";
3
+ import { n as p } from "../.chunks/emotion-styled.browser.esm.js";
4
+ import { Flex as l } from "../Flex/Flex.js";
5
+ import n from "../theme.js";
6
+ import { logger as u } from "../logger.js";
7
+ const x = p(l)`
7
8
  width: 100%;
8
9
  font-size: 24px;
9
- color: ${s.colors.maroon};
10
- background-color: ${s.colors.lightRed}aa;
10
+ color: ${n.colors.maroon};
11
+ background-color: ${n.colors.lightRed}aa;
11
12
  padding: 16px;
12
13
  border-radius: 8px;
13
- box-shadow: 0 0 13px -3px ${s.colors.maroon} inset;
14
+ box-shadow: 0 0 13px -3px ${n.colors.maroon} inset;
14
15
  flex-direction: column;
15
16
  p {
16
17
  margin: 0;
17
18
  }
18
- `, u = a("p")`
19
+ `, f = p("p")`
19
20
  font-size: 16px;
20
21
  margin: 0 0 0 32px !important;
21
22
  `;
22
- class D extends m.Component {
23
+ class C extends h.Component {
23
24
  constructor(r) {
24
25
  super(r), this.state = { hasError: !1, error: null, errorInfo: null };
25
26
  }
@@ -27,17 +28,18 @@ class D extends m.Component {
27
28
  return { hasError: !0, error: r };
28
29
  }
29
30
  componentDidCatch(r, t) {
30
- console.error("Error:", r), this.setState({ ...this.state, errorInfo: t });
31
+ u.error("Error:", r), this.setState({ errorInfo: t });
31
32
  }
32
33
  render() {
33
- const { title: r, children: t, showDetails: l = !0 } = this.props;
34
+ var s;
35
+ const { title: r, children: t, showDetails: c = !0 } = this.props;
34
36
  if (this.state.hasError) {
35
- const { error: p, errorInfo: o } = this.state;
36
- return /* @__PURE__ */ n(i, { column: !0, width: "100%", alignItems: "center", gap: "32px", padding: "16px 64px", children: [
37
+ const { error: d, errorInfo: o } = this.state;
38
+ return /* @__PURE__ */ i(l, { column: !0, width: "100%", alignItems: "center", gap: "32px", padding: "16px 64px", children: [
37
39
  /* @__PURE__ */ e("h1", { children: r }),
38
- l && /* @__PURE__ */ n(h, { children: [
39
- /* @__PURE__ */ e("p", { children: `${p}` }),
40
- o == null ? void 0 : o.componentStack.split("at").map((c, d) => d > 0 && /* @__PURE__ */ e(u, { children: `at ${c}` }))
40
+ c && /* @__PURE__ */ i(x, { children: [
41
+ /* @__PURE__ */ e("p", { children: `${d}` }),
42
+ (s = o == null ? void 0 : o.componentStack) == null ? void 0 : s.split("at").map((m, a) => a > 0 && /* @__PURE__ */ e(f, { children: `at ${m}` }, a))
41
43
  ] })
42
44
  ] });
43
45
  }
@@ -45,5 +47,5 @@ class D extends m.Component {
45
47
  }
46
48
  }
47
49
  export {
48
- D as default
50
+ C as default
49
51
  };
@@ -4,8 +4,7 @@ import { PropsWithChildren, HTMLAttributes } from 'react';
4
4
  interface WithCustomTheme {
5
5
  customTheme: CustomThemeProps;
6
6
  }
7
- interface FormSectionProps extends HTMLAttributes<HTMLDivElement> {
8
- }
7
+ type FormSectionProps = HTMLAttributes<HTMLDivElement>;
9
8
  export declare const FormSection: React.FC<PropsWithChildren<FormSectionProps>>;
10
9
  export declare const FormSectionStyles: import('@emotion/styled').StyledComponent<{
11
10
  theme?: import('@emotion/react').Theme;
@@ -1,88 +1,96 @@
1
1
  import { jsx as w } from "react/jsx-runtime";
2
- import { createContext as E, useState as P, useCallback as C, useEffect as $, useMemo as k } from "react";
3
- import { formatPhoneNumber as D, formatZipCode as N } from "../utils.js";
4
- function S(v) {
5
- const { name: t, defaultValues: s = {}, onInputChangeExtensions: d = [], submit: n, debug: i = !1 } = v, f = E({
6
- onFormInputChange: () => console.error(`Failed to update form input. ${t}FormContext not initialized`),
7
- formData: s,
8
- setFormData: () => console.error(`Failed to set form data. ${t}FormContext not initialized`),
9
- resetForm: () => console.error(`Failed to reset form. ${t}FormContext not initialized`)
2
+ import { createContext as E, useState as P, useCallback as N, useEffect as $, useMemo as k } from "react";
3
+ import "../utils.js";
4
+ import { logger as x } from "../logger.js";
5
+ import { formatPhoneNumber as S, formatZipCode as D, formatSSN as A } from "../formatters.js";
6
+ function j(v) {
7
+ const { name: o, defaultValues: c = {}, onInputChangeExtensions: m = [], submit: l, debug: n = !1 } = v, d = E({
8
+ onFormInputChange: () => x.error(`Failed to update form input. ${o}FormContext not initialized`),
9
+ formData: c,
10
+ setFormData: () => x.error(`Failed to set form data. ${o}FormContext not initialized`),
11
+ resetForm: () => x.error(`Failed to reset form. ${o}FormContext not initialized`)
10
12
  });
11
- return { Context: f, Provider: ({ children: F }) => {
12
- const [o, l] = P(s), p = C(
13
- (a, e, u) => {
14
- l((c) => {
15
- let r;
16
- if (u === "checkbox")
17
- r = e.target.checked;
18
- else if (u === "multiDropdown") {
19
- const m = e.target.value;
20
- Array.isArray(m) ? r = m.map((z) => z.value) : r = [];
21
- } else if (u === "phone") {
22
- const [, m] = D(e.target.value);
23
- r = m;
24
- } else if (u === "zip") {
25
- const [, m] = N(e.target.value);
26
- r = m;
13
+ return { Context: d, Provider: ({ children: C }) => {
14
+ const [r, u] = P(c), p = N(
15
+ (i, t, a) => {
16
+ u((f) => {
17
+ let e;
18
+ if (a === "checkbox")
19
+ e = t.target.checked;
20
+ else if (a === "multiDropdown") {
21
+ const s = t.target.value;
22
+ Array.isArray(s) ? e = s.map((z) => z.value) : e = [];
23
+ } else if (a === "phone") {
24
+ const [, s] = S(t.target.value);
25
+ e = s;
26
+ } else if (a === "zip") {
27
+ const [, s] = D(t.target.value);
28
+ e = s;
29
+ } else if (a === "ssn") {
30
+ const [, s] = A(t.target.value);
31
+ e = s;
27
32
  } else
28
- r = e.target.value;
29
- return r === "undefined" && (r = void 0), { ...c, [a]: r };
33
+ e = t.target.value;
34
+ return e === "undefined" && (e = void 0), { ...f, [i]: e };
30
35
  });
31
36
  let g;
32
- if (u === "checkbox")
33
- g = e.target.checked;
34
- else if (u === "phone") {
35
- const [, c] = D(e.target.value);
36
- g = c;
37
- } else if (u === "zip") {
38
- const [, c] = N(e.target.value);
39
- g = c;
37
+ if (a === "checkbox")
38
+ g = t.target.checked;
39
+ else if (a === "phone") {
40
+ const [, f] = S(t.target.value);
41
+ g = f;
42
+ } else if (a === "zip") {
43
+ const [, f] = D(t.target.value);
44
+ g = f;
40
45
  } else
41
- g = e.target.value === "undefined" ? void 0 : e.target.value;
42
- d.forEach((c) => {
43
- c(a, g, l);
46
+ g = t.target.value === "undefined" ? void 0 : t.target.value;
47
+ m.forEach((f) => {
48
+ f(i, g, u);
44
49
  });
45
50
  },
46
- [d]
47
- ), h = C(() => l(s), [s]);
51
+ // onInputChangeExtensions is captured from the factory closure (not React state/props);
52
+ // it can never change for the lifetime of this Provider, so it's not a valid dep.
53
+ []
54
+ ), h = N(() => u(c), []);
48
55
  $(() => {
49
- i && console.log(`[${t}Form] Updated form data:`, o);
50
- }, [o]);
56
+ n && x.log(`[${o}Form] Updated form data:`, r);
57
+ }, [r]);
51
58
  const b = k(
52
59
  () => ({
53
60
  onFormInputChange: p,
54
- formData: o,
55
- setFormData: l,
61
+ formData: r,
62
+ setFormData: u,
56
63
  resetForm: h,
57
- ...n ? { submit: () => n(o) } : {}
64
+ ...l ? { submit: () => l(r) } : {}
58
65
  }),
59
- [o, p, h, n]
66
+ // submit is factory-closure-stable; only formData and the memoized callbacks can change.
67
+ [r, p, h]
60
68
  );
61
- return /* @__PURE__ */ w(f.Provider, { value: b, children: F });
69
+ return /* @__PURE__ */ w(d.Provider, { value: b, children: C });
62
70
  } };
63
71
  }
64
- function V(v = "dateOfBirth", t = "age") {
65
- return (s, d, n) => {
66
- if (s === v && d && typeof d == "string") {
67
- const i = d.split("-");
68
- if (i.length !== 3) {
69
- n((a) => ({ ...a, [t]: void 0 }));
72
+ function B(v = "dateOfBirth", o = "age") {
73
+ return (c, m, l) => {
74
+ if (c === v && m && typeof m == "string") {
75
+ const n = m.split("-");
76
+ if (n.length !== 3) {
77
+ l((i) => ({ ...i, [o]: void 0 }));
70
78
  return;
71
79
  }
72
- const f = Number(i[0]), x = Number(i[1]), F = Number(i[2]), o = /* @__PURE__ */ new Date(), l = o.getFullYear(), p = o.getMonth() + 1, h = o.getDate();
73
- if (f > l || f < 1900) {
74
- n((a) => ({ ...a, [t]: void 0 }));
80
+ const d = Number(n[0]), F = Number(n[1]), C = Number(n[2]), r = /* @__PURE__ */ new Date(), u = r.getFullYear(), p = r.getMonth() + 1, h = r.getDate();
81
+ if (d > u || d < 1900) {
82
+ l((i) => ({ ...i, [o]: void 0 }));
75
83
  return;
76
84
  }
77
- let b = l - f;
78
- (x > p || x === p && F > h) && (b -= 1), n((a) => ({
79
- ...a,
80
- [t]: String(b)
85
+ let b = u - d;
86
+ (F > p || F === p && C > h) && (b -= 1), l((i) => ({
87
+ ...i,
88
+ [o]: String(b)
81
89
  }));
82
- } else s === v && n((i) => ({ ...i, [t]: void 0 }));
90
+ } else c === v && l((n) => ({ ...n, [o]: void 0 }));
83
91
  };
84
92
  }
85
93
  export {
86
- V as createDobToAgeExtension,
87
- S as createFormContext
94
+ B as createDobToAgeExtension,
95
+ j as createFormContext
88
96
  };
@@ -18,7 +18,7 @@ export type FormFieldsProps = {
18
18
  gap?: number;
19
19
  noLabel?: boolean;
20
20
  checkboxContainer?: boolean;
21
- formDefaults: Record<string, any>;
21
+ formDefaults: Record<string, unknown>;
22
22
  onChange: (key: string, e: React.ChangeEvent<HTMLInputElement>, type?: string) => void;
23
23
  compact?: boolean;
24
24
  };
@@ -1,10 +1,10 @@
1
- import { jsxs as b, Fragment as C, jsx as m } from "react/jsx-runtime";
2
- import { FormInput as h } from "../FormInput/FormInput.js";
3
- import { FormSectionTitle as T, FormFieldGrid as j, FormTextLine as L, FormFieldCheckboxContainer as G } from "../FormComponents/FormComponents.js";
1
+ import { jsxs as b, Fragment as T, jsx as m } from "react/jsx-runtime";
2
+ import { FormInput as s } from "../FormInput/FormInput.js";
3
+ import { FormSectionTitle as g, FormFieldGrid as j, FormTextLine as I, FormFieldCheckboxContainer as L } from "../FormComponents/FormComponents.js";
4
4
  import "../AvatarWithImage/AvatarWithImage.js";
5
5
  import "../Button/Button.js";
6
6
  import "../Divider/Divider.js";
7
- import { Flex as I } from "../Flex/Flex.js";
7
+ import { Flex as V } from "../Flex/Flex.js";
8
8
  import "../Grid/Grid.js";
9
9
  import "../Icon/Icon.js";
10
10
  import "../Input/Input.js";
@@ -13,7 +13,7 @@ import "../ListButton/ListButton.js";
13
13
  import "../Loading/Loading.js";
14
14
  import "../ScrollContainer/ScrollContainer.js";
15
15
  import "react";
16
- import { isTablet as S } from "../utils.js";
16
+ import { useIsTablet as G } from "../utils.js";
17
17
  import "../CustomAlert/CustomAlert.js";
18
18
  import "react-dom";
19
19
  import "../Accordion/Accordion.js";
@@ -30,68 +30,68 @@ import "../.chunks/AppHeader.js";
30
30
  import "../EditableInfoCard/EditableInfoCard.js";
31
31
  import "../Nav/Nav.js";
32
32
  import "../AppContainer/AppContainer.js";
33
- const co = ({
33
+ const eo = ({
34
34
  title: a,
35
- fields: s,
35
+ fields: h,
36
36
  columns: f,
37
37
  columnsOverride: w,
38
- gap: D = 21,
38
+ gap: C = 21,
39
39
  noLabel: x = !1,
40
40
  checkboxContainer: F = !1,
41
41
  compact: v = !1,
42
42
  formDefaults: n,
43
- onChange: e
43
+ onChange: d
44
44
  }) => {
45
- const g = f ?? (S() ? 2 : 3);
46
- return /* @__PURE__ */ b(C, { children: [
47
- a && /* @__PURE__ */ m(T, { children: a }),
48
- !F && /* @__PURE__ */ m(j, { columns: g, columnsOverride: w, gap: D, children: s.map(({ key: r, label: l, type: o, limit: c, options: u, defaultValue: t, ...d }) => {
45
+ const D = G();
46
+ return /* @__PURE__ */ b(T, { children: [
47
+ a && /* @__PURE__ */ m(g, { children: a }),
48
+ !F && /* @__PURE__ */ m(j, { columns: f ?? (D ? 2 : 3), columnsOverride: w, gap: C, children: h.map(({ key: r, label: p, type: o, limit: c, options: e, defaultValue: t, ...u }) => {
49
49
  const i = n[r] !== void 0 ? n[r] : t !== void 0 ? t : o === "multiDropdown" ? [] : o === "checkbox" ? !1 : "";
50
- return v ? /* @__PURE__ */ b(I, { column: !0, gap: "21px", children: [
51
- /* @__PURE__ */ m(L, { children: l }),
50
+ return v ? /* @__PURE__ */ b(V, { column: !0, gap: "21px", children: [
51
+ /* @__PURE__ */ m(I, { children: p }),
52
52
  /* @__PURE__ */ m(
53
- h,
53
+ s,
54
54
  {
55
- onChange: (p) => e(r, p, o),
55
+ onChange: (l) => d(r, l, o),
56
56
  type: o,
57
57
  limit: c,
58
58
  ...o === "checkbox" ? { checked: !!i } : { value: i },
59
59
  noLabel: !0,
60
- options: u,
60
+ options: e,
61
61
  multiple: o === "multiDropdown",
62
- ...d
62
+ ...u
63
63
  }
64
64
  )
65
65
  ] }, r) : /* @__PURE__ */ m(
66
- h,
66
+ s,
67
67
  {
68
- onChange: (p) => e(r, p, o),
69
- label: l,
68
+ onChange: (l) => d(r, l, o),
69
+ label: p,
70
70
  type: o,
71
71
  limit: c,
72
72
  ...o === "checkbox" ? { checked: !!i } : { value: i },
73
73
  noLabel: x || v,
74
- options: u,
74
+ options: e,
75
75
  multiple: o === "multiDropdown",
76
- ...d
76
+ ...u
77
77
  },
78
78
  r
79
79
  );
80
80
  }) }),
81
- F && /* @__PURE__ */ m(G, { children: s.map(({ key: r, label: l, type: o, limit: c, options: u, defaultValue: t, ...d }) => {
81
+ F && /* @__PURE__ */ m(L, { children: h.map(({ key: r, label: p, type: o, limit: c, options: e, defaultValue: t, ...u }) => {
82
82
  const i = n[r] !== void 0 ? n[r] : t !== void 0 ? t : o === "multiDropdown" ? [] : o === "checkbox" ? !1 : "";
83
83
  return /* @__PURE__ */ m(
84
- h,
84
+ s,
85
85
  {
86
- onChange: (p) => e(r, p, o),
87
- label: l,
86
+ onChange: (l) => d(r, l, o),
87
+ label: p,
88
88
  type: o,
89
89
  limit: c,
90
90
  ...o === "checkbox" ? { checked: !!i } : { defaultValue: i },
91
91
  noLabel: x,
92
- options: u,
92
+ options: e,
93
93
  multiple: o === "multiDropdown",
94
- ...d
94
+ ...u
95
95
  },
96
96
  r
97
97
  );
@@ -99,5 +99,5 @@ const co = ({
99
99
  ] });
100
100
  };
101
101
  export {
102
- co as default
102
+ eo as default
103
103
  };
@@ -4,12 +4,14 @@ import { LabeledCheckboxProps } from '../LabeledCheckbox';
4
4
  import { LabeledRadioProps } from '../LabeledRadio';
5
5
  import { LabeledDropdownProps, DropdownOption } from '../LabeledDropdown';
6
6
  import { LabeledTextAreaProps } from '../LabeledTextArea/LabeledTextArea';
7
- export type AllInputProps = LabeledInputProps & LabeledCheckboxProps & LabeledRadioProps & LabeledDropdownProps & LabeledCurrencyInputProps & LabeledTextAreaProps;
8
- export type FormInputType = 'checkbox' | 'currency' | 'date' | 'dropdown' | 'email' | 'multiDropdown' | 'number' | 'phone' | 'radio' | 'text' | 'textarea' | 'url' | 'zip';
7
+ import { LabeledFormattedInputProps } from '../LabeledFormattedInput';
8
+ import { FormInputType } from '../inputTypes';
9
+ export type AllInputProps = LabeledInputProps & LabeledCheckboxProps & LabeledRadioProps & LabeledDropdownProps & LabeledCurrencyInputProps & LabeledTextAreaProps & LabeledFormattedInputProps;
10
+ export { type FormInputType } from '../inputTypes';
9
11
  type ConflictingKeys = 'onChange' | 'options' | 'value' | 'checked' | 'defaultValue' | 'label';
10
12
  export type FormInputProps = Partial<Omit<AllInputProps, ConflictingKeys | 'type'>> & {
11
13
  type?: FormInputType;
12
- onChange?: (event: any, ...args: any[]) => void;
14
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>, ...args: unknown[]) => void;
13
15
  options?: DropdownOption[];
14
16
  value?: unknown;
15
17
  checked?: boolean;
@@ -1,15 +1,17 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { LabeledInput as t } from "../LabeledInput/LabeledInput.js";
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { LabeledInput as o } from "../LabeledInput/LabeledInput.js";
3
3
  import { LabeledCurrencyInput as m } from "../LabeledCurrencyInput/LabeledCurrencyInput.js";
4
4
  import { LabeledCheckbox as a } from "../LabeledCheckbox/LabeledCheckbox.js";
5
5
  import { LabeledRadio as d } from "../LabeledRadio/LabeledRadio.js";
6
6
  import { LabeledDropdown as f } from "../LabeledDropdown/LabeledDropdown.js";
7
- import { LabeledTextArea as n } from "../LabeledTextArea/LabeledTextArea.js";
8
- const p = (r) => {
9
- const { type: e = "text" } = r;
10
- return e === "dropdown" || e === "multiDropdown" ? /* @__PURE__ */ o(f, { ...r }) : e === "checkbox" ? /* @__PURE__ */ o(a, { ...r }) : e === "radio" ? /* @__PURE__ */ o(d, { ...r }) : e === "currency" ? /* @__PURE__ */ o(m, { ...r }) : e === "textarea" ? /* @__PURE__ */ o(n, { ...r }) : /* @__PURE__ */ o(t, { ...r, type: e });
7
+ import { LabeledTextArea as i } from "../LabeledTextArea/LabeledTextArea.js";
8
+ import { LabeledFormattedInput as n } from "../LabeledFormattedInput/LabeledFormattedInput.js";
9
+ import { formattedOrMaskedTypes as b } from "../utils.js";
10
+ const k = (e) => {
11
+ const { type: r = "text" } = e;
12
+ return r === "dropdown" || r === "multiDropdown" ? /* @__PURE__ */ t(f, { ...e }) : r === "checkbox" ? /* @__PURE__ */ t(a, { ...e }) : r === "radio" ? /* @__PURE__ */ t(d, { ...e }) : r === "currency" ? /* @__PURE__ */ t(m, { ...e }) : r === "textarea" ? /* @__PURE__ */ t(i, { ...e }) : b.has(r) ? /* @__PURE__ */ t(n, { ...e, type: r }) : /* @__PURE__ */ t(o, { ...e, type: r });
11
13
  };
12
14
  export {
13
- p as FormInput,
14
- p as default
15
+ k as FormInput,
16
+ k as default
15
17
  };
package/Input/Input.d.ts CHANGED
@@ -1,6 +1,11 @@
1
1
  import { TextFieldProps as MuiTextFieldProps } from '@mui/material/TextField';
2
- export type InputProps = Omit<MuiTextFieldProps, 'variant'> & {
2
+ import { FormInputType } from '../FormInput';
3
+ export type InputValue = string | number | undefined;
4
+ export type InputProps = Omit<MuiTextFieldProps, 'variant' | 'type' | 'value'> & {
5
+ type?: FormInputType;
6
+ value?: InputValue;
3
7
  borderFocusColor?: string;
8
+ className?: string;
4
9
  };
5
10
  export declare const Input: React.FC<InputProps>;
6
11
  export default Input;
package/Input/Input.js CHANGED
@@ -1,105 +1,40 @@
1
- import { jsx as x } from "react/jsx-runtime";
2
- import { useRef as g, useState as T, useLayoutEffect as k } from "react";
3
- import { n as R } from "../.chunks/emotion-styled.browser.esm.js";
4
- import { c } from "../.chunks/emotion-react.browser.esm.js";
5
- import b from "../theme.js";
6
- import { useThemeColors as V } from "../ThemeContext.js";
7
- import { formatPhoneNumber as D, formatZipCode as F } from "../utils.js";
8
- import { T as I } from "../.chunks/TextField.js";
9
- const v = R(I, {
10
- shouldForwardProp: (t) => t != "borderFocusColor"
11
- })(({ borderFocusColor: t, type: o, disabled: n }) => ({
12
- ...c`
13
- background-color: ${b.colors.white};
14
- border-radius: 0;
15
- height: 18px;
16
-
17
- input {
18
- transition: 313ms all ease-out;
19
- height: 15px;
20
- padding: 2px 0;
21
- border-radius: 0;
22
- border-bottom: 1px solid ${b.colors.gray};
23
- width: 100%;
24
-
25
- &:focus-visible {
26
- ${o !== "date" && !n && c`
27
- box-shadow: 0 -5px 4px -4px ${t} inset;
28
- `}
29
- }
30
-
31
- ::-webkit-calendar-picker-indicator {
32
- cursor: pointer;
33
- transition: 201ms all ease-out;
34
- outline: none !important;
35
-
36
- &:hover,
37
- :focus-visible {
38
- box-shadow:
39
- 0 -5px 4px -4px ${t} inset,
40
- 0 5px 4px -4px ${t} inset;
41
- }
42
- }
43
- }
44
-
45
- &:hover,
46
- :focus-visible {
47
- input {
48
- ${o !== "date" && !n && c`
49
- box-shadow: 0 -5px 4px -4px ${t} inset;
50
- `}
51
- }
52
- }
53
-
54
- fieldset {
55
- border-radius: 0;
56
- border: none;
57
- }
58
-
59
- &.Mui-focused {
60
- fieldset {
61
- border: none;
62
- }
63
- }
64
- `
65
- })), q = ({
66
- borderFocusColor: t,
1
+ import { jsx as n, Fragment as d } from "react/jsx-runtime";
2
+ import { cn as a } from "../cn.js";
3
+ import i from "../theme.js";
4
+ import { useThemeColors as l } from "../ThemeContext.js";
5
+ import { T as c } from "../.chunks/TextField.js";
6
+ const h = "bg-white !rounded-none !h-[18px] [&_fieldset]:!rounded-none [&_fieldset]:!border-none [&_.Mui-focused_fieldset]:!border-none", x = "[&:has(.MuiFormHelperText-root)]:!h-[40px] [&:has(.MuiFormHelperText-root)]:transition-all [&:has(.MuiFormHelperText-root)]:duration-[201ms] [&:has(.MuiFormHelperText-root)]:ease-out [&_.MuiFormHelperText-root]:!mt-px [&_.MuiFormHelperText-root]:!mr-0 [&_.MuiFormHelperText-root]:text-right", m = "[&_input]:h-[15px] [&_input]:w-full [&_input]:rounded-none [&_input]:px-0 [&_input]:py-[2px]", _ = "[&_.MuiInputBase-root]:rounded-none [&_.MuiInputBase-root]:border-b [&_.MuiInputBase-root]:border-b-[var(--border-color)] [&_.MuiInputBase-root]:!shadow-[var(--default-shadow)] [&_.MuiInputBase-root:hover]:!shadow-[var(--active-shadow)] [&_.MuiInputBase-root:has(input:focus-visible)]:!shadow-[var(--active-shadow)] [&_.MuiInputBase-root]:transition-all [&_.MuiInputBase-root]:duration-[313ms] [&_.MuiInputBase-root]:ease-out", w = "[&_input::-webkit-calendar-picker-indicator]:cursor-pointer [&_input::-webkit-calendar-picker-indicator]:transition-all [&_input::-webkit-calendar-picker-indicator]:duration-[201ms] [&_input::-webkit-calendar-picker-indicator]:ease-out [&_input::-webkit-calendar-picker-indicator]:!outline-none [&_input::-webkit-calendar-picker-indicator:hover]:shadow-[var(--indicator-shadow)] [&_input::-webkit-calendar-picker-indicator:focus-visible]:shadow-[var(--indicator-shadow)]", b = a(
7
+ h,
8
+ x,
9
+ m,
10
+ w,
11
+ _
12
+ ), M = ["text", "password", "email", "date", "number"], B = ({
13
+ borderFocusColor: o,
67
14
  // border primary
68
- type: o,
69
- ...n
15
+ type: t,
16
+ value: s,
17
+ className: u,
18
+ ...e
70
19
  }) => {
71
- const p = V();
72
- if (o === "phone" || o === "zip") {
73
- var d = o === "phone" ? D : F;
74
- const { value: m, defaultValue: f, onChange: l, ...w } = n, u = g(null), a = g(null), [s, $] = T(null), C = (e, r) => {
75
- let h = 0;
76
- for (let i = 0; i < e.length; i++)
77
- if (/\d/.test(e[i]) && (h++, h === r))
78
- return i + 1;
79
- return e.length;
80
- }, S = (e) => {
81
- const r = e.target.selectionStart ?? 0;
82
- a.current = e.target.value.slice(0, r).replace(/\D/g, "").length, $(e.target.value), l == null || l(e);
83
- };
84
- return k(() => {
85
- if (!u.current || a.current == null) return;
86
- const e = d(s)[0], r = C(e, a.current);
87
- u.current.setSelectionRange(r, r);
88
- }, [m, f, s]), /* @__PURE__ */ x(
89
- v,
90
- {
91
- ...w,
92
- type: o,
93
- borderFocusColor: t || p.themeColor,
94
- inputRef: u,
95
- value: d(s ?? (m || f))[0],
96
- onChange: S
97
- }
98
- );
99
- }
100
- return /* @__PURE__ */ x(v, { borderFocusColor: t || p.themeColor, type: o, ...n });
20
+ const r = l(), p = {
21
+ "--border-color": i.colors.gray,
22
+ "--default-shadow": e.error === !0 ? `inset 0 -5px 4px -4px ${i.colors.error}` : void 0,
23
+ "--active-shadow": t !== "date" && !e.disabled ? `inset 0 -5px 4px -4px ${e.error ? i.colors.error : o || r.themeColor}` : "none",
24
+ "--indicator-shadow": `inset 0 -5px 4px -4px ${o || r.themeColor}, inset 0 5px 4px -4px ${o || r.themeColor}`
25
+ };
26
+ return /* @__PURE__ */ n(d, { children: /* @__PURE__ */ n(
27
+ c,
28
+ {
29
+ ...e,
30
+ type: t && M.includes(t) ? t : "text",
31
+ value: s,
32
+ className: a(b, u),
33
+ style: { ...e.style, ...p }
34
+ }
35
+ ) });
101
36
  };
102
37
  export {
103
- q as Input,
104
- q as default
38
+ B as Input,
39
+ B as default
105
40
  };
@@ -3,7 +3,8 @@ import { n as B } from "../.chunks/emotion-styled.browser.esm.js";
3
3
  import { c as g } from "../.chunks/emotion-react.browser.esm.js";
4
4
  import { useThemeColors as P } from "../ThemeContext.js";
5
5
  import * as f from "react";
6
- import { a as R, g as T, s as M, r as N, b as p, e as z, u as L, c as V, P as o, d as H } from "../.chunks/DefaultPropsProvider.js";
6
+ import { a as R, g as T, s as M, r as N, c as p, d as z, u as L, P as o, b as V } from "../.chunks/DefaultPropsProvider.js";
7
+ import { c as H } from "../.chunks/clsx.js";
7
8
  import { S as E } from "../.chunks/SwitchBase.js";
8
9
  import { c as b } from "../.chunks/createSvgIcon.js";
9
10
  import { m as F } from "../.chunks/memoTheme.js";
@@ -27,7 +28,7 @@ const u = R("MuiCheckbox", ["root", "checked", "disabled", "indeterminate", "col
27
28
  size: i
28
29
  } = e, s = {
29
30
  root: ["root", a && "indeterminate", `color${p(n)}`, `size${p(i)}`]
30
- }, c = H(s, W, t);
31
+ }, c = V(s, W, t);
31
32
  return {
32
33
  ...t,
33
34
  // forward the disabled and checked classes to the SwitchBase
@@ -129,7 +130,7 @@ const u = R("MuiCheckbox", ["root", "checked", "disabled", "indeterminate", "col
129
130
  }),
130
131
  ownerState: v,
131
132
  ref: a,
132
- className: V(y.root, j),
133
+ className: H(y.root, j),
133
134
  ...$,
134
135
  classes: y
135
136
  });
@@ -269,7 +270,7 @@ const w = B("div", { shouldForwardProp: (e) => !["customTheme"].includes(e) })((
269
270
  }
270
271
  `}
271
272
  `
272
- })), ce = ({
273
+ })), ie = ({
273
274
  label: e,
274
275
  colon: t = !0,
275
276
  displayMode: a = !1,
@@ -290,6 +291,6 @@ const w = B("div", { shouldForwardProp: (e) => !["customTheme"].includes(e) })((
290
291
  ] });
291
292
  };
292
293
  export {
293
- ce as LabeledCheckbox,
294
- ce as default
294
+ ie as LabeledCheckbox,
295
+ ie as default
295
296
  };
@@ -12,6 +12,9 @@ export type LabeledDropdownProps = {
12
12
  minWidth?: string;
13
13
  onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
14
14
  multiple?: boolean;
15
+ required?: boolean;
16
+ error?: boolean;
17
+ helperText?: string;
15
18
  } & AutocompleteProps<DropdownOption, boolean, boolean, boolean>;
16
19
  export declare const LabeledDropdown: React.FC<LabeledDropdownProps>;
17
20
  export default LabeledDropdown;