@viasat/beam-react 2.55.2 → 2.57.0
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.
- package/CHANGELOG.md +20 -0
- package/assets/dataTable.css +1 -1
- package/chunks/{DateField.Segment.CwhRnhtq.js → DateField.Segment.BMXzpxgl.js} +27 -26
- package/chunks/DateField.Segment.BqMaeKLk.js +1 -0
- package/chunks/dataTable.B2EH91vH.js +1 -0
- package/chunks/{dataTable.DQQX95em.js → dataTable.B_4qCCp1.js} +5 -3
- package/chunks/use-isomorphic-layout-effect.browser.esm.CkGv31zs.js +1 -0
- package/chunks/use-isomorphic-layout-effect.browser.esm.DERp5kr6.js +5 -0
- package/lib/wip/DataTable/DataTable.Body.cjs.js +1 -1
- package/lib/wip/DataTable/DataTable.Body.es.js +1 -1
- package/lib/wip/DataTable/DataTable.Cell.cjs.js +1 -1
- package/lib/wip/DataTable/DataTable.Cell.es.js +1 -1
- package/lib/wip/DataTable/DataTable.ColumnHeader.cjs.js +1 -1
- package/lib/wip/DataTable/DataTable.ColumnHeader.es.js +1 -1
- package/lib/wip/DataTable/DataTable.Footer.cjs.js +1 -1
- package/lib/wip/DataTable/DataTable.Footer.es.js +1 -1
- package/lib/wip/DataTable/DataTable.Head.cjs.js +1 -1
- package/lib/wip/DataTable/DataTable.Head.es.js +1 -1
- package/lib/wip/DataTable/DataTable.Header.cjs.js +1 -1
- package/lib/wip/DataTable/DataTable.Header.es.js +1 -1
- package/lib/wip/DataTable/DataTable.Row.cjs.js +1 -1
- package/lib/wip/DataTable/DataTable.Row.es.js +1 -1
- package/lib/wip/DataTable/DataTable.Toolbar.cjs.js +1 -1
- package/lib/wip/DataTable/DataTable.Toolbar.es.js +1 -1
- package/lib/wip/DataTable/DataTable.cjs.js +1 -1
- package/lib/wip/DataTable/DataTable.context.d.ts +5 -5
- package/lib/wip/DataTable/DataTable.d.ts +22 -11
- package/lib/wip/DataTable/DataTable.es.js +88 -62
- package/lib/wip/DataTable/DataTable.types.d.ts +56 -14
- package/lib/wip/DateField/DateField.Segment.cjs.js +1 -1
- package/lib/wip/DateField/DateField.Segment.es.js +3 -2
- package/lib/wip/DateField/DateField.Segments.cjs.js +1 -1
- package/lib/wip/DateField/DateField.Segments.es.js +1 -1
- package/lib/wip/DateField/DateField.cjs.js +1 -1
- package/lib/wip/DateField/DateField.devWarnings.cjs.js +1 -0
- package/lib/wip/DateField/DateField.devWarnings.d.ts +15 -0
- package/lib/wip/DateField/DateField.devWarnings.es.js +22 -0
- package/lib/wip/DateField/DateField.es.js +186 -177
- package/lib/wip/DateField/DateField.utils.cjs.js +1 -1
- package/lib/wip/DateField/DateField.utils.d.ts +7 -5
- package/lib/wip/DateField/DateField.utils.es.js +84 -70
- package/lib/wip/ErrorBoundary/ErrorBoundary.cjs.js +1 -0
- package/lib/wip/ErrorBoundary/ErrorBoundary.d.ts +28 -0
- package/lib/wip/ErrorBoundary/ErrorBoundary.es.js +19 -0
- package/lib/wip/ErrorBoundary/index.cjs.js +1 -0
- package/lib/wip/ErrorBoundary/index.d.ts +2 -0
- package/lib/wip/ErrorBoundary/index.es.js +4 -0
- package/lib/wip/index.cjs.js +1 -1
- package/lib/wip/index.d.ts +1 -0
- package/lib/wip/index.es.js +17 -15
- package/package.json +7 -7
- package/utils/hooks/useId.cjs.js +1 -1
- package/utils/hooks/useId.es.js +7 -8
- package/chunks/DateField.Segment.CqFLhMYA.js +0 -1
- package/chunks/dataTable.BeVtkYp6.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../../chunks/constants.CgMu0_1M.js");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../../chunks/constants.CgMu0_1M.js");const A=require("../../../chunks/helpers.BIckGIbP.js"),d=require("./DateField.validation.cjs.js"),l="en-US",N=new Intl.DateTimeFormat("en-US",{month:"long"}),w=e=>N.format(new Date(2e3,e-1,1)),u=31,i=12,m=1,f=9999,M=(e,t,n)=>Math.min(n,Math.max(t,e)),T=(e,t)=>((e-1)%t+t)%t+1,F=2024,P=(e,t)=>t==null?31:new Date(e??F,t,0).getDate(),R=()=>{const e=new Date;return{day:e.getDate(),month:e.getMonth()+1,year:e.getFullYear()}},o=e=>e instanceof Date&&!Number.isNaN(e.getTime()),I=(e,t,n,r)=>{if(n==="min")return e==="year"?null:1;if(n==="max")return e==="year"?null:e==="day"?r.daysInMonth:i;if(t==null){if(e==="year")return r.today.year;const E=e==="day"?u:i;return n>0?1:E}if(e==="year")return M(t+n,m,f);const a=e==="day"?u:i;return T(t+n,a)},L={day:"",month:"",year:""},h=e=>{const{day:t,month:n,year:r}=e;if(t==null||n==null||r==null)return null;const a=new Date(r,n-1,t);return a.setFullYear(r),Number.isNaN(a.getTime())||a.getFullYear()!==r||a.getMonth()!==n-1||a.getDate()!==t?null:a},Y=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.getTime()===t.getTime(),s=A.dateToDayKey,O=e=>o(e)?s(e):null,V=(e,t,n)=>{const r=s(e);return!(o(t)&&r<s(t)||o(n)&&r>s(n))},_=(e,t)=>o(e)&&o(t)&&s(e)>s(t),C=(e,t,n)=>{if(_(t,n))return e;const r=s(e);return o(t)&&r<s(t)?new Date(t.getFullYear(),t.getMonth(),t.getDate()):o(n)&&r>s(n)?new Date(n.getFullYear(),n.getMonth(),n.getDate()):e},X=e=>{if(!o(e))return"";const t=String(e.getFullYear()).padStart(4,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`},p=e=>e.type==="literal",D=e=>e.filter(t=>!p(t)).map(t=>t.type),b=new Date(2020,0,2),G=new Set([8206,8207,8234,8235,8236,8237,8238,8294,8295,8296,8297]),H=e=>[...e].filter(t=>!G.has(t.codePointAt(0)??-1)).join(""),K=new Set(["day","month","year","literal"]),y=3,S=e=>{try{const t=new Intl.DateTimeFormat(e,{year:"numeric",month:"2-digit",day:"2-digit",calendar:"gregory"}).formatToParts(b).filter(r=>K.has(r.type)).map(r=>({type:r.type,value:r.type==="literal"?H(r.value):""})),n=D(t);return n.length===y&&new Set(n).size===y?t:null}catch{return null}},g=new Map,$=e=>{try{return new Intl.Locale(e).toString()}catch{return e.toLowerCase()}},k=e=>{try{return Intl.DateTimeFormat.supportedLocalesOf([e]).length>0}catch{return!1}},U=e=>{const t=$(e),n=g.get(t);if(n)return n;const r=k(e);!r&&process.env.NODE_ENV!=="production"&&console.warn(`DateField: locale "${e}" is not supported; falling back to ${l}.`);const a=(r?S(e):null)??S(l);if(!a)throw new Error(`DateField: Intl cannot resolve ${l} date parts`);return g.set(t,a),a},j=()=>g.clear(),q=e=>o(e)?{day:String(e.getDate()).padStart(2,"0"),month:String(e.getMonth()+1).padStart(2,"0"),year:String(e.getFullYear()).padStart(4,"0")}:L,c=(e,t)=>{if(t===""||e==="year"&&t.length<d.SEGMENT_MAX_LENGTH.year)return null;const n=parseInt(t,10);return Number.isNaN(n)||n===0?null:n},v=e=>h({day:c("day",e.day),month:c("month",e.month),year:c("year",e.year)}),z=(e,t)=>t===""?"":t.padStart(d.SEGMENT_MAX_LENGTH[e],"0"),B=(e,t,n)=>t===""?{displayValue:n,isPlaceholder:!0}:{displayValue:t.padStart(d.SEGMENT_MAX_LENGTH[e],"0"),isPlaceholder:!1},W=e=>{const t=window.getSelection();if(!t)return;const n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)},J=e=>{var n;if(!e)return;const t=(n=window.getSelection)==null?void 0:n.call(window);t&&t.rangeCount>0&&e.contains(t.anchorNode)&&t.removeAllRanges()};exports.DAY_SPIN_MAX=u;exports.DEFAULT_LOCALE=l;exports.MONTH_MAX=i;exports.YEAR_MAX=f;exports.YEAR_MIN=m;exports.__clearDatePartsCache=j;exports.adjustSegmentValue=I;exports.clamp=M;exports.clampDateToRange=C;exports.clearSelectionWithin=J;exports.dateKeyOrNull=O;exports.deriveValue=h;exports.deriveValueFromText=v;exports.getDateParts=U;exports.getDaysInMonth=P;exports.getMonthName=w;exports.getSegmentDisplay=B;exports.getSegmentOrder=D;exports.isDateInRange=V;exports.isLiteralPart=p;exports.isMinMaxMisconfigured=_;exports.isSameDateValue=Y;exports.isValidDate=o;exports.normalizeSegmentText=z;exports.segmentNumber=c;exports.segmentTextFromValue=q;exports.selectElementContents=W;exports.toISODateString=X;exports.todayParts=R;exports.wrapInRange=T;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Nullable } from '@viasat/beam-shared/utils/types';
|
|
2
2
|
import { DateFieldPart, SegmentAdjustment, SegmentText, SegmentType, SegmentValues } from './DateField.types';
|
|
3
|
+
export declare const DEFAULT_LOCALE = "en-US";
|
|
3
4
|
/** Returns the locale month name for a 1-based month (1 = January). */
|
|
4
5
|
export declare const getMonthName: (month: number) => string;
|
|
5
6
|
/**
|
|
@@ -48,6 +49,8 @@ export declare const todayParts: () => {
|
|
|
48
49
|
month: number;
|
|
49
50
|
year: number;
|
|
50
51
|
};
|
|
52
|
+
/** True for a `Date` instance that isn't `Invalid Date`. */
|
|
53
|
+
export declare const isValidDate: (value: unknown) => value is Date;
|
|
51
54
|
/** Context passed into {@link adjustSegmentValue} — kept pure by the caller. */
|
|
52
55
|
export interface AdjustSegmentContext {
|
|
53
56
|
/** Days in the current month (use {@link getDaysInMonth} to compute). */
|
|
@@ -124,11 +127,10 @@ export declare const isLiteralPart: (part: DateFieldPart) => part is DateFieldPa
|
|
|
124
127
|
export declare const getSegmentOrder: (parts: ReadonlyArray<DateFieldPart>) => ReadonlyArray<SegmentType>;
|
|
125
128
|
/**
|
|
126
129
|
* Locale-derived segment order + separators (DF-8), memoized per locale. Falls
|
|
127
|
-
* back to
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* error boundary, instead of crashing the bundle at import.
|
|
130
|
+
* back to {@link DEFAULT_LOCALE} for any locale Intl can't resolve to the three
|
|
131
|
+
* date segments. Resolved lazily on first use, so a broken Intl (which can't
|
|
132
|
+
* render the field anyway — `getMonthName` needs it too) surfaces at render,
|
|
133
|
+
* catchable by an error boundary, instead of crashing the bundle at import.
|
|
132
134
|
*/
|
|
133
135
|
export declare const getDateParts: (locale: string) => ReadonlyArray<DateFieldPart>;
|
|
134
136
|
/** @internal — test-only. Clears the per-locale parts cache for Intl isolation. */
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import "../../../chunks/constants.Cruz2A1w.js";
|
|
2
2
|
import { a as S } from "../../../chunks/helpers.CiQfGwdc.js";
|
|
3
|
-
import { SEGMENT_MAX_LENGTH as
|
|
4
|
-
const
|
|
3
|
+
import { SEGMENT_MAX_LENGTH as g } from "./DateField.validation.es.js";
|
|
4
|
+
const l = "en-US", h = new Intl.DateTimeFormat("en-US", { month: "long" }), $ = (t) => h.format(new Date(2e3, t - 1, 1)), d = 31, c = 12, p = 1, T = 9999, M = (t, e, n) => Math.min(n, Math.max(e, t)), A = (t, e) => ((t - 1) % e + e) % e + 1, E = 2024, k = (t, e) => e == null ? 31 : new Date(t ?? E, e, 0).getDate(), X = () => {
|
|
5
5
|
const t = /* @__PURE__ */ new Date();
|
|
6
6
|
return { day: t.getDate(), month: t.getMonth() + 1, year: t.getFullYear() };
|
|
7
|
-
},
|
|
7
|
+
}, s = (t) => t instanceof Date && !Number.isNaN(t.getTime()), b = (t, e, n, r) => {
|
|
8
8
|
if (n === "min") return t === "year" ? null : 1;
|
|
9
9
|
if (n === "max")
|
|
10
|
-
return t === "year" ? null : t === "day" ? r.daysInMonth :
|
|
10
|
+
return t === "year" ? null : t === "day" ? r.daysInMonth : c;
|
|
11
11
|
if (e == null) {
|
|
12
12
|
if (t === "year") return r.today.year;
|
|
13
|
-
const
|
|
14
|
-
return n > 0 ? 1 :
|
|
13
|
+
const m = t === "day" ? d : c;
|
|
14
|
+
return n > 0 ? 1 : m;
|
|
15
15
|
}
|
|
16
|
-
if (t === "year") return M(e + n,
|
|
17
|
-
const
|
|
18
|
-
return
|
|
19
|
-
},
|
|
16
|
+
if (t === "year") return M(e + n, p, T);
|
|
17
|
+
const a = t === "day" ? d : c;
|
|
18
|
+
return A(e + n, a);
|
|
19
|
+
}, N = { day: "", month: "", year: "" }, w = (t) => {
|
|
20
20
|
const { day: e, month: n, year: r } = t;
|
|
21
21
|
if (e == null || n == null || r == null) return null;
|
|
22
|
-
const
|
|
23
|
-
return
|
|
24
|
-
},
|
|
25
|
-
const r =
|
|
26
|
-
return !(
|
|
27
|
-
},
|
|
28
|
-
if (
|
|
29
|
-
const r =
|
|
30
|
-
return
|
|
31
|
-
},
|
|
32
|
-
if (!
|
|
22
|
+
const a = new Date(r, n - 1, e);
|
|
23
|
+
return a.setFullYear(r), Number.isNaN(a.getTime()) || a.getFullYear() !== r || a.getMonth() !== n - 1 || a.getDate() !== e ? null : a;
|
|
24
|
+
}, H = (t, e) => t == null && e == null ? !0 : t == null || e == null ? !1 : t.getTime() === e.getTime(), o = S, U = (t) => s(t) ? o(t) : null, B = (t, e, n) => {
|
|
25
|
+
const r = o(t);
|
|
26
|
+
return !(s(e) && r < o(e) || s(n) && r > o(n));
|
|
27
|
+
}, D = (t, e) => s(t) && s(e) && o(t) > o(e), G = (t, e, n) => {
|
|
28
|
+
if (D(e, n)) return t;
|
|
29
|
+
const r = o(t);
|
|
30
|
+
return s(e) && r < o(e) ? new Date(e.getFullYear(), e.getMonth(), e.getDate()) : s(n) && r > o(n) ? new Date(n.getFullYear(), n.getMonth(), n.getDate()) : t;
|
|
31
|
+
}, j = (t) => {
|
|
32
|
+
if (!s(t)) return "";
|
|
33
33
|
const e = String(t.getFullYear()).padStart(4, "0"), n = String(t.getMonth() + 1).padStart(2, "0"), r = String(t.getDate()).padStart(2, "0");
|
|
34
34
|
return `${e}-${n}-${r}`;
|
|
35
|
-
},
|
|
36
|
-
(e) => !
|
|
35
|
+
}, _ = (t) => t.type === "literal", F = (t) => t.filter(
|
|
36
|
+
(e) => !_(e)
|
|
37
37
|
).map((e) => e.type), P = new Date(2020, 0, 2), R = /* @__PURE__ */ new Set([
|
|
38
38
|
8206,
|
|
39
39
|
8207,
|
|
@@ -46,87 +46,101 @@ const m = new Intl.DateTimeFormat("en-US", { month: "long" }), L = (t) => m.form
|
|
|
46
46
|
8295,
|
|
47
47
|
8296,
|
|
48
48
|
8297
|
|
49
|
-
]),
|
|
49
|
+
]), I = (t) => [...t].filter((e) => !R.has(e.codePointAt(0) ?? -1)).join(""), Y = /* @__PURE__ */ new Set(["day", "month", "year", "literal"]), y = 3, f = (t) => {
|
|
50
50
|
try {
|
|
51
51
|
const e = new Intl.DateTimeFormat(t, {
|
|
52
52
|
year: "numeric",
|
|
53
53
|
month: "2-digit",
|
|
54
54
|
day: "2-digit",
|
|
55
55
|
calendar: "gregory"
|
|
56
|
-
}).formatToParts(P).filter((r) =>
|
|
56
|
+
}).formatToParts(P).filter((r) => Y.has(r.type)).map((r) => ({
|
|
57
57
|
type: r.type,
|
|
58
|
-
value: r.type === "literal" ?
|
|
59
|
-
})), n =
|
|
60
|
-
return n.length ===
|
|
58
|
+
value: r.type === "literal" ? I(r.value) : ""
|
|
59
|
+
})), n = F(e);
|
|
60
|
+
return n.length === y && new Set(n).size === y ? e : null;
|
|
61
61
|
} catch {
|
|
62
62
|
return null;
|
|
63
63
|
}
|
|
64
|
-
},
|
|
65
|
-
let e = t;
|
|
64
|
+
}, u = /* @__PURE__ */ new Map(), L = (t) => {
|
|
66
65
|
try {
|
|
67
|
-
|
|
66
|
+
return new Intl.Locale(t).toString();
|
|
68
67
|
} catch {
|
|
69
|
-
|
|
68
|
+
return t.toLowerCase();
|
|
70
69
|
}
|
|
71
|
-
|
|
70
|
+
}, C = (t) => {
|
|
71
|
+
try {
|
|
72
|
+
return Intl.DateTimeFormat.supportedLocalesOf([t]).length > 0;
|
|
73
|
+
} catch {
|
|
74
|
+
return !1;
|
|
75
|
+
}
|
|
76
|
+
}, z = (t) => {
|
|
77
|
+
const e = L(t), n = u.get(e);
|
|
72
78
|
if (n) return n;
|
|
73
|
-
const r =
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
const r = C(t);
|
|
80
|
+
!r && process.env.NODE_ENV !== "production" && console.warn(
|
|
81
|
+
`DateField: locale "${t}" is not supported; falling back to ${l}.`
|
|
82
|
+
);
|
|
83
|
+
const a = (r ? f(t) : null) ?? f(l);
|
|
84
|
+
if (!a)
|
|
85
|
+
throw new Error(
|
|
86
|
+
`DateField: Intl cannot resolve ${l} date parts`
|
|
87
|
+
);
|
|
88
|
+
return u.set(e, a), a;
|
|
89
|
+
}, W = () => u.clear(), q = (t) => s(t) ? {
|
|
78
90
|
day: String(t.getDate()).padStart(2, "0"),
|
|
79
91
|
month: String(t.getMonth() + 1).padStart(2, "0"),
|
|
80
92
|
year: String(t.getFullYear()).padStart(4, "0")
|
|
81
|
-
} :
|
|
82
|
-
if (e === "" || t === "year" && e.length <
|
|
93
|
+
} : N, i = (t, e) => {
|
|
94
|
+
if (e === "" || t === "year" && e.length < g.year) return null;
|
|
83
95
|
const n = parseInt(e, 10);
|
|
84
96
|
return Number.isNaN(n) || n === 0 ? null : n;
|
|
85
|
-
},
|
|
97
|
+
}, J = (t) => w({
|
|
86
98
|
day: i("day", t.day),
|
|
87
99
|
month: i("month", t.month),
|
|
88
100
|
year: i("year", t.year)
|
|
89
|
-
}),
|
|
90
|
-
displayValue: e.padStart(
|
|
101
|
+
}), Q = (t, e) => e === "" ? "" : e.padStart(g[t], "0"), Z = (t, e, n) => e === "" ? { displayValue: n, isPlaceholder: !0 } : {
|
|
102
|
+
displayValue: e.padStart(g[t], "0"),
|
|
91
103
|
isPlaceholder: !1
|
|
92
|
-
},
|
|
104
|
+
}, v = (t) => {
|
|
93
105
|
const e = window.getSelection();
|
|
94
106
|
if (!e) return;
|
|
95
107
|
const n = document.createRange();
|
|
96
108
|
n.selectNodeContents(t), e.removeAllRanges(), e.addRange(n);
|
|
97
|
-
},
|
|
109
|
+
}, x = (t) => {
|
|
98
110
|
var n;
|
|
99
111
|
if (!t) return;
|
|
100
112
|
const e = (n = window.getSelection) == null ? void 0 : n.call(window);
|
|
101
113
|
e && e.rangeCount > 0 && t.contains(e.anchorNode) && e.removeAllRanges();
|
|
102
114
|
};
|
|
103
115
|
export {
|
|
104
|
-
|
|
105
|
-
l as
|
|
116
|
+
d as DAY_SPIN_MAX,
|
|
117
|
+
l as DEFAULT_LOCALE,
|
|
118
|
+
c as MONTH_MAX,
|
|
106
119
|
T as YEAR_MAX,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
120
|
+
p as YEAR_MIN,
|
|
121
|
+
W as __clearDatePartsCache,
|
|
122
|
+
b as adjustSegmentValue,
|
|
110
123
|
M as clamp,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
G as clampDateToRange,
|
|
125
|
+
x as clearSelectionWithin,
|
|
126
|
+
U as dateKeyOrNull,
|
|
127
|
+
w as deriveValue,
|
|
128
|
+
J as deriveValueFromText,
|
|
129
|
+
z as getDateParts,
|
|
130
|
+
k as getDaysInMonth,
|
|
131
|
+
$ as getMonthName,
|
|
132
|
+
Z as getSegmentDisplay,
|
|
133
|
+
F as getSegmentOrder,
|
|
134
|
+
B as isDateInRange,
|
|
135
|
+
_ as isLiteralPart,
|
|
136
|
+
D as isMinMaxMisconfigured,
|
|
137
|
+
H as isSameDateValue,
|
|
138
|
+
s as isValidDate,
|
|
139
|
+
Q as normalizeSegmentText,
|
|
126
140
|
i as segmentNumber,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
141
|
+
q as segmentTextFromValue,
|
|
142
|
+
v as selectElementContents,
|
|
143
|
+
j as toISODateString,
|
|
144
|
+
X as todayParts,
|
|
145
|
+
A as wrapInRange
|
|
132
146
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react");class a extends s.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,o){var r,t;(t=(r=this.props).onError)==null||t.call(r,e,o)}render(){return this.state.hasError?this.props.fallback:this.props.children}}exports.ErrorBoundary=a;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Component, ErrorInfo, ReactNode } from 'react';
|
|
2
|
+
export interface ErrorBoundaryProps {
|
|
3
|
+
/** Rendered normally; a render/commit error anywhere below is caught. */
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** Rendered instead of `children` once a descendant throws. */
|
|
6
|
+
fallback: ReactNode;
|
|
7
|
+
/** Called when an error is caught — use for logging/telemetry. */
|
|
8
|
+
onError?: (error: Error, info: ErrorInfo) => void;
|
|
9
|
+
}
|
|
10
|
+
interface ErrorBoundaryState {
|
|
11
|
+
hasError: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Generic React error boundary: renders `fallback` when a descendant throws
|
|
15
|
+
* during render or commit, instead of letting the error crash the whole tree.
|
|
16
|
+
* Consumers own the fallback UI and any logging via `onError`.
|
|
17
|
+
*
|
|
18
|
+
* Must be a class component — React exposes error boundaries only through the
|
|
19
|
+
* `getDerivedStateFromError` / `componentDidCatch` lifecycle, which has no hook
|
|
20
|
+
* equivalent.
|
|
21
|
+
*/
|
|
22
|
+
export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
23
|
+
state: ErrorBoundaryState;
|
|
24
|
+
static getDerivedStateFromError(): ErrorBoundaryState;
|
|
25
|
+
componentDidCatch(error: Error, info: ErrorInfo): void;
|
|
26
|
+
render(): ReactNode;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Component as e } from "react";
|
|
2
|
+
class p extends e {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments), this.state = { hasError: !1 };
|
|
5
|
+
}
|
|
6
|
+
static getDerivedStateFromError() {
|
|
7
|
+
return { hasError: !0 };
|
|
8
|
+
}
|
|
9
|
+
componentDidCatch(o, s) {
|
|
10
|
+
var r, t;
|
|
11
|
+
(t = (r = this.props).onError) == null || t.call(r, o, s);
|
|
12
|
+
}
|
|
13
|
+
render() {
|
|
14
|
+
return this.state.hasError ? this.props.fallback : this.props.children;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
p as ErrorBoundary
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./ErrorBoundary.cjs.js");exports.ErrorBoundary=r.ErrorBoundary;
|
package/lib/wip/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./DataTable/DataTable.cjs.js"),l=require("./DataTable/DataTable.Header.cjs.js"),t=require("./DataTable/DataTable.Toolbar.cjs.js"),b=require("./DataTable/DataTable.Head.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./DataTable/DataTable.cjs.js"),l=require("./DataTable/DataTable.Header.cjs.js"),t=require("./DataTable/DataTable.Toolbar.cjs.js"),b=require("./DataTable/DataTable.Head.cjs.js"),r=require("./DataTable/DataTable.ColumnHeader.cjs.js"),T=require("./DataTable/DataTable.Body.cjs.js"),o=require("./DataTable/DataTable.Row.cjs.js"),i=require("./DataTable/DataTable.Cell.cjs.js"),_=require("./DataTable/DataTable.Footer.cjs.js"),a=require("./DataTable/DataTable.context.cjs.js"),D=require("./DataTable/useBeamTable.cjs.js"),u=require("./DateField/DateField.cjs.js"),d=require("./ErrorBoundary/ErrorBoundary.cjs.js");exports.DataTable=e.DataTable;exports.DataTableHeader=l.DataTableHeader;exports.DataTableToolbar=t.DataTableToolbar;exports.DataTableHead=b.DataTableHead;exports.DataTableColumnHeader=r.DataTableColumnHeader;exports.DataTableBody=T.DataTableBody;exports.DataTableRow=o.DataTableRow;exports.DataTableCell=i.DataTableCell;exports.DataTableFooter=_.DataTableFooter;exports.DataTableProvider=a.DataTableProvider;exports.useDataTable=a.useDataTable;exports.useBeamTable=D.useBeamTable;exports.DateField=u.DateField;exports.ErrorBoundary=d.ErrorBoundary;
|
package/lib/wip/index.d.ts
CHANGED
package/lib/wip/index.es.js
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import { DataTable as o } from "./DataTable/DataTable.es.js";
|
|
2
2
|
import { DataTableHeader as t } from "./DataTable/DataTable.Header.es.js";
|
|
3
3
|
import { DataTableToolbar as m } from "./DataTable/DataTable.Toolbar.es.js";
|
|
4
|
-
import { DataTableHead as
|
|
5
|
-
import { DataTableColumnHeader as
|
|
4
|
+
import { DataTableHead as f } from "./DataTable/DataTable.Head.es.js";
|
|
5
|
+
import { DataTableColumnHeader as x } from "./DataTable/DataTable.ColumnHeader.es.js";
|
|
6
6
|
import { DataTableBody as D } from "./DataTable/DataTable.Body.es.js";
|
|
7
7
|
import { DataTableRow as u } from "./DataTable/DataTable.Row.es.js";
|
|
8
|
-
import { DataTableCell as
|
|
9
|
-
import { DataTableFooter as
|
|
10
|
-
import { DataTableProvider as
|
|
11
|
-
import { useBeamTable as
|
|
12
|
-
import { DateField as
|
|
8
|
+
import { DataTableCell as H } from "./DataTable/DataTable.Cell.es.js";
|
|
9
|
+
import { DataTableFooter as n } from "./DataTable/DataTable.Footer.es.js";
|
|
10
|
+
import { DataTableProvider as y, useDataTable as C } from "./DataTable/DataTable.context.es.js";
|
|
11
|
+
import { useBeamTable as v } from "./DataTable/useBeamTable.es.js";
|
|
12
|
+
import { DateField as E } from "./DateField/DateField.es.js";
|
|
13
|
+
import { ErrorBoundary as R } from "./ErrorBoundary/ErrorBoundary.es.js";
|
|
13
14
|
export {
|
|
14
15
|
o as DataTable,
|
|
15
16
|
D as DataTableBody,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
H as DataTableCell,
|
|
18
|
+
x as DataTableColumnHeader,
|
|
19
|
+
n as DataTableFooter,
|
|
20
|
+
f as DataTableHead,
|
|
20
21
|
t as DataTableHeader,
|
|
21
|
-
|
|
22
|
+
y as DataTableProvider,
|
|
22
23
|
u as DataTableRow,
|
|
23
24
|
m as DataTableToolbar,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
E as DateField,
|
|
26
|
+
R as ErrorBoundary,
|
|
27
|
+
v as useBeamTable,
|
|
28
|
+
C as useDataTable
|
|
27
29
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viasat/beam-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.57.0",
|
|
4
4
|
"description": "React component library for the Beam design system",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Viasat",
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@viasat/beam-fonts": "2.
|
|
64
|
-
"@viasat/beam-shared": "2.
|
|
65
|
-
"@viasat/beam-styles": "2.
|
|
66
|
-
"@viasat/beam-tokens": "2.
|
|
67
|
-
"@viasat/beam-icons": "2.
|
|
68
|
-
"@viasat/beam-react-claude-plugin": "2.
|
|
63
|
+
"@viasat/beam-fonts": "2.57.0",
|
|
64
|
+
"@viasat/beam-shared": "2.57.0",
|
|
65
|
+
"@viasat/beam-styles": "2.57.0",
|
|
66
|
+
"@viasat/beam-tokens": "2.57.0",
|
|
67
|
+
"@viasat/beam-icons": "2.57.0",
|
|
68
|
+
"@viasat/beam-react-claude-plugin": "2.57.0",
|
|
69
69
|
"clsx": "^1.2.1",
|
|
70
70
|
"@floating-ui/react": "^0.26.18",
|
|
71
71
|
"@stepperize/react": "^5.1.5",
|
package/utils/hooks/useId.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),a=require("../safeReact.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),a=require("../../chunks/use-isomorphic-layout-effect.browser.esm.CkGv31zs.js"),i=require("../safeReact.cjs.js"),f=require("../../chunks/constants.CgMu0_1M.js");function l(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const r=l(u);let s=!1,d=0;const c=()=>`${f.prefix}-${Math.random().toString(36).slice(2,6)}${d++}`;function g(){const[e,t]=r.useState(()=>s?c():void 0);return a.index(()=>{e==null&&t(c())},[]),r.useEffect(()=>{s=!0},[]),e}const p=i.SafeReact.useId,b=p||g;exports.useId=b;
|
package/utils/hooks/useId.es.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as t from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { SafeReact as
|
|
2
|
+
import { i as n } from "../../chunks/use-isomorphic-layout-effect.browser.esm.DERp5kr6.js";
|
|
3
|
+
import { SafeReact as i } from "../safeReact.es.js";
|
|
4
4
|
import { p as a } from "../../chunks/constants.Cruz2A1w.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const r = () => `${a}-${Math.random().toString(36).slice(2, 6)}${u++}`;
|
|
5
|
+
let o = !1, f = 0;
|
|
6
|
+
const r = () => `${a}-${Math.random().toString(36).slice(2, 6)}${f++}`;
|
|
8
7
|
function c() {
|
|
9
8
|
const [e, s] = t.useState(
|
|
10
9
|
() => (
|
|
@@ -12,13 +11,13 @@ function c() {
|
|
|
12
11
|
o ? r() : void 0
|
|
13
12
|
)
|
|
14
13
|
);
|
|
15
|
-
return
|
|
14
|
+
return n(() => {
|
|
16
15
|
e == null && s(r());
|
|
17
16
|
}, []), t.useEffect(() => {
|
|
18
17
|
o = !0;
|
|
19
18
|
}, []), e;
|
|
20
19
|
}
|
|
21
|
-
const d =
|
|
20
|
+
const d = i.useId, p = d || c;
|
|
22
21
|
export {
|
|
23
|
-
|
|
22
|
+
p as useId
|
|
24
23
|
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var j=require("../assets/DateField.css");const R=require("react/jsx-runtime"),$=require("clsx"),d=require("react"),k=require("./classNames.BFQUGnCN.js"),y=require("../lib/wip/DateField/DateField.utils.cjs.js"),I="date-field",{baseClassNamePrefix:S,classModifierPrefix:w,subElementClassPrefix:s}=k.getBEMClassNames(I),c={field:`${s}field`,segments:`${s}segments`,segment:`${s}segment`,separator:`${s}separator`,srStatus:`${s}sr-status`},_={"bm-light":"bm-light","bm-dark":"bm-dark","bm-inverse":"bm-inverse","bm-enterprise":"bm-enterprise","bm-consumer":"bm-consumer","bm-date-field":"bm-date-field","bm-date-field--disabled":"bm-date-field--disabled","bm-date-field--error":"bm-date-field--error","bm-date-field__field":"bm-date-field__field","bm-date-field__segment":"bm-date-field__segment","bm-date-field--read-only":"bm-date-field--read-only","bm-date-field--fluid":"bm-date-field--fluid","bm-date-field__segments":"bm-date-field__segments","bm-date-field__separator":"bm-date-field__separator","bm-date-field__sr-status":"bm-date-field__sr-status"},B={day:"day",month:"month",year:"year"},L=({type:i,value:g,valueMin:p,valueMax:C,displayValue:n,isPlaceholder:x,valueText:v,invalid:E,role:l,isActive:t,disabled:m,readOnly:o,onFocus:h,onBlur:D,onInput:N,onKeyDown:F,segmentRef:f})=>{const a=!m&&!o,b=d.useRef(null),M=d.useCallback(e=>{b.current=e,f(e)},[f]),q=e=>{if(!a)return;const u=e.currentTarget,r=e.nativeEvent.data;r!=null&&r.length===1&&N(i,r),u.textContent!==n&&(u.textContent=n)};d.useLayoutEffect(()=>{if(!t||!a)return;const e=b.current;e&&y.selectElementContents(e)},[n,t,a]);const P=l==="spinbutton"?{"aria-valuenow":g??void 0,"aria-valuemin":p,"aria-valuemax":C,"aria-valuetext":v}:{"aria-multiline":!1};return R.jsx("span",{ref:M,role:l,"aria-label":B[i],...P,"aria-disabled":m||void 0,"aria-readonly":o||void 0,"aria-invalid":E||void 0,contentEditable:a&&t,suppressContentEditableWarning:!0,tabIndex:t?0:-1,inputMode:a?"numeric":void 0,spellCheck:!1,autoCorrect:"off",autoCapitalize:"off","data-segment":i,"data-active":t,"data-placeholder":x,onFocus:h,onBlur:D,onInput:q,onKeyDown:e=>F(i,e),onMouseUp:e=>e.preventDefault(),className:$(_[c.segment]),children:n})};exports.DateFieldSegment=L;exports.baseClassNamePrefix=S;exports.classModifierPrefix=w;exports.staticDateFieldClassNames=c;exports.styles=_;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var r=require("../assets/dataTable.css");const t=require("./classNames.BFQUGnCN.js"),b=require("./constants.CgMu0_1M.js"),l={"bm-light":"bm-light","bm-dark":"bm-dark","bm-inverse":"bm-inverse","bm-enterprise":"bm-enterprise","bm-consumer":"bm-consumer","bm-data-table-container":"bm-data-table-container","bm-data-table__toolbar":"bm-data-table__toolbar","bm-data-table":"bm-data-table","bm-data-table__header":"bm-data-table__header","bm-data-table__head":"bm-data-table__head","bm-data-table__column-header":"bm-data-table__column-header","bm-data-table__body":"bm-data-table__body","bm-data-table__row":"bm-data-table__row","bm-data-table__cell":"bm-data-table__cell","bm-data-table__footer":"bm-data-table__footer","bm-data-table--sm":"bm-data-table--sm","bm-data-table--md":"bm-data-table--md","bm-data-table--lg":"bm-data-table--lg"},m="data-table",{baseClassNamePrefix:e,classModifierPrefix:s,subElementClassPrefix:a}=t.getBEMClassNames(m),d=b.allSizes.md,o={container:`${e}-container`,toolbar:`${a}toolbar`,header:`${a}header`,head:`${a}head`,columnHeader:`${a}column-header`,body:`${a}body`,row:`${a}row`,cell:`${a}cell`,footer:`${a}footer`};exports.DEFAULT_DATATABLE_DENSITY=d;exports.baseClassNamePrefix=e;exports.classModifierPrefix=s;exports.staticDataTableClassNames=o;exports.styles=l;
|