jcicl 1.0.58 → 1.0.60

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.
@@ -129,7 +129,6 @@ const ce = (e) => S || (S = re(e)), se = F(/* @__PURE__ */ t("path", {
129
129
 
130
130
  h1 {
131
131
  font-size: 32px;
132
- line-height: 1;
133
132
  margin: 0;
134
133
  margin-left: calc(${L.constants.navDefaultWidth}px * 2);
135
134
  white-space: nowrap;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jcicl",
3
3
  "private": false,
4
- "version": "1.0.58",
4
+ "version": "1.0.60",
5
5
  "description": "Component library for the websites of Johnson County Iowa",
6
6
  "license": "MIT",
7
7
  "homepage": "https://devops.jc.net/JCIT/Business%20Solutions%20Delivery/_git/JCComponentLibrary?path=%2FREADME.md&version=GBmaster",
package/utils.d.ts CHANGED
@@ -6,6 +6,7 @@ export declare const isValidZipCode: (zip: string) => boolean;
6
6
  export declare const isValidCityName: (city: string) => boolean;
7
7
  export declare const formatDate: (date: string, style?: "mmddyyyy") => string;
8
8
  export declare const formatDateTime: (dateTime: string) => string;
9
+ export declare const calculateAge: (birthDateString: string) => number;
9
10
  export declare const formatAddress: (address: {
10
11
  line1: string;
11
12
  line2?: string | null;
package/utils.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import a from "./theme.js";
2
- import { u as m } from "./.chunks/useMediaQuery.js";
3
- const D = () => m(`(max-width: ${a.screenSizes.mobile})`), S = () => m(`(max-width: ${a.screenSizes.tablet})`), w = (t) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t.trim()), R = (t) => {
2
+ import { u as l } from "./.chunks/useMediaQuery.js";
3
+ const Z = () => l(`(max-width: ${a.screenSizes.mobile})`), w = () => l(`(max-width: ${a.screenSizes.tablet})`), R = (t) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t.trim()), T = (t) => {
4
4
  if (!t) return !1;
5
5
  const e = t.replace(/\D/g, "");
6
6
  return !!(t.trim() == e && e.length >= 10 && e.length <= 16 || /^\s*(?:\+?1\s*(?:[-\s]\s*)?)?(?:\(\s*\d{3}\s*\)|\d{3})(?:\s*[-\s]\s*)?\d{3}(?:\s*[-\s]\s*)?\d{4}(?:\s*(?:#|x\.?|ext\.?|extension)\s*\d{1,6})?\s*$/.test(t.trim()));
7
- }, b = (t) => /^\d{5}(?:\s*-?\s*\d{4})?$/.test(t), C = (t) => /^[a-zA-Z\s'.-]+$/.test(t), T = (t, e = "mmddyyyy") => e === "mmddyyyy" ? (/* @__PURE__ */ new Date(t.replace(" ", "T").replace("Z", "") + "Z")).toLocaleDateString("en-US", {
7
+ }, C = (t) => /^\d{5}(?:\s*-?\s*\d{4})?$/.test(t), S = (t) => /^[a-zA-Z\s'.-]+$/.test(t), b = (t, e = "mmddyyyy") => e === "mmddyyyy" ? (/* @__PURE__ */ new Date(t.replace(" ", "T").replace("Z", "") + "Z")).toLocaleDateString("en-US", {
8
8
  timeZone: "America/Chicago",
9
9
  month: "numeric",
10
10
  day: "numeric",
11
11
  year: "numeric"
12
- }) : t, z = (t) => {
12
+ }) : t, A = (t) => {
13
13
  try {
14
14
  return (/* @__PURE__ */ new Date(t.replace(" ", "T").replace("Z", "") + "Z")).toLocaleString("en-US", {
15
15
  timeZone: "America/Chicago",
@@ -23,10 +23,16 @@ const D = () => m(`(max-width: ${a.screenSizes.mobile})`), S = () => m(`(max-wid
23
23
  } catch {
24
24
  return t;
25
25
  }
26
- }, A = (t) => {
27
- const { line1: e, line2: n, city: s, state: i, zip: o } = t;
26
+ }, z = (t) => {
27
+ t = t.slice(0, 10) + "T00:00:00";
28
+ const e = /* @__PURE__ */ new Date(), i = new Date(t);
29
+ let s = e.getFullYear() - i.getFullYear();
30
+ const n = e.getMonth() - i.getMonth();
31
+ return (n < 0 || n === 0 && e.getDate() < i.getDate()) && s--, s;
32
+ }, N = (t) => {
33
+ const { line1: e, line2: i, city: s, state: n, zip: o } = t;
28
34
  let r = e || "";
29
- return n && (r.length > 0 && (r += ", "), r += n), s && (r.length > 0 && (r += ", "), r += s), i && (r.length > 0 && (r += ", "), r += i), o && (r += ` ${p(o)[0]}`), r;
35
+ return i && (r.length > 0 && (r += ", "), r += i), s && (r.length > 0 && (r += ", "), r += s), n && (r.length > 0 && (r += ", "), r += n), o && (r += ` ${p(o)[0]}`), r;
30
36
  }, $ = (t) => {
31
37
  if (t > 3 && t < 21) return "th";
32
38
  switch (t % 10) {
@@ -39,7 +45,7 @@ const D = () => m(`(max-width: ${a.screenSizes.mobile})`), S = () => m(`(max-wid
39
45
  default:
40
46
  return "th";
41
47
  }
42
- }, N = (t) => {
48
+ }, P = (t) => {
43
49
  try {
44
50
  const e = /* @__PURE__ */ new Date(t.replace(" ", "T").replace("Z", "") + "Z"), s = new Intl.DateTimeFormat("en-US", {
45
51
  timeZone: "America/Chicago",
@@ -49,37 +55,38 @@ const D = () => m(`(max-width: ${a.screenSizes.mobile})`), S = () => m(`(max-wid
49
55
  hour: "numeric",
50
56
  minute: "2-digit",
51
57
  hour12: !0
52
- }).formatToParts(e), i = (g) => {
58
+ }).formatToParts(e), n = (h) => {
53
59
  var c;
54
- return ((c = s.find((y) => y.type === g)) == null ? void 0 : c.value) ?? "";
55
- }, o = i("month") + ".", r = Number(i("day")), u = i("year"), l = i("hour"), d = i("minute"), f = i("dayPeriod").toLowerCase(), h = $(r);
56
- return `${o} ${r}${h}, ${u}, ${l}:${d}${f}`;
60
+ return ((c = s.find((y) => y.type === h)) == null ? void 0 : c.value) ?? "";
61
+ }, o = n("month") + ".", r = Number(n("day")), u = n("year"), m = n("hour"), d = n("minute"), f = n("dayPeriod").toLowerCase(), g = $(r);
62
+ return `${o} ${r}${g}, ${u}, ${m}:${d}${f}`;
57
63
  } catch {
58
64
  return t;
59
65
  }
60
- }, P = (t) => {
66
+ }, v = (t) => {
61
67
  if (t == null) return ["", void 0];
62
68
  let e = t.replace(/\D/g, "") || "";
63
69
  e.at(0) == "1" && (e = e.slice(1));
64
- const n = e.slice(0, 3), s = e.slice(3, 6), i = e.slice(6, 10), o = e.slice(10, 16);
70
+ const i = e.slice(0, 3), s = e.slice(3, 6), n = e.slice(6, 10), o = e.slice(10, 16);
65
71
  let r = e;
66
- return e.length >= 4 && (r = `(${n}) ${e.slice(3)}`), e.length >= 7 && (r = `(${n}) ${s}-${e.slice(6)}`), e.length > 10 && (r = `(${n}) ${s}-${i} ext. ${o}`), [r, e.slice(0, 16)];
72
+ return e.length >= 4 && (r = `(${i}) ${e.slice(3)}`), e.length >= 7 && (r = `(${i}) ${s}-${e.slice(6)}`), e.length > 10 && (r = `(${i}) ${s}-${n} ext. ${o}`), [r, e.slice(0, 16)];
67
73
  }, p = (t) => {
68
74
  if (!t) return ["", void 0];
69
75
  const e = t.replace(/\D/g, "");
70
76
  return e.length <= 5 ? [e, e] : [`${e.slice(0, 5)}-${e.slice(5, 9)}`, e.slice(0, 9)];
71
77
  };
72
78
  export {
73
- A as formatAddress,
74
- T as formatDate,
75
- z as formatDateTime,
76
- P as formatPhoneNumber,
77
- N as formatTimestamp,
79
+ z as calculateAge,
80
+ N as formatAddress,
81
+ b as formatDate,
82
+ A as formatDateTime,
83
+ v as formatPhoneNumber,
84
+ P as formatTimestamp,
78
85
  p as formatZipCode,
79
- D as isMobile,
80
- S as isTablet,
81
- C as isValidCityName,
82
- w as isValidEmail,
83
- R as isValidPhoneNumber,
84
- b as isValidZipCode
86
+ Z as isMobile,
87
+ w as isTablet,
88
+ S as isValidCityName,
89
+ R as isValidEmail,
90
+ T as isValidPhoneNumber,
91
+ C as isValidZipCode
85
92
  };