dynamic-mui 2.0.26 → 2.2.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/README.md +218 -37
- package/dist/AxisSharedComponents-BbsKw1BT.js +3 -0
- package/dist/AxisSharedComponents-xLtpOLH_.mjs +605 -0
- package/dist/ChartsAxis-CANvBdY9.mjs +47 -0
- package/dist/ChartsAxis-EZ7m_KrU.js +1 -0
- package/dist/ChartsGrid-BCRTvNTr.js +3 -0
- package/dist/ChartsGrid-C_HT7qpL.mjs +381 -0
- package/dist/ChartsWrapper-CM7EDyAK.js +5 -0
- package/dist/ChartsWrapper-CO5_Z6BD.mjs +1878 -0
- package/dist/ChartsXAxis-CPmuCRhq.mjs +487 -0
- package/dist/ChartsXAxis-DFFY1sPg.js +3 -0
- package/dist/ChartsYAxis-DLUMr9vG.mjs +392 -0
- package/dist/ChartsYAxis-fpevi1sP.js +1 -0
- package/dist/XmlShapeDeserializer-3yQdm0b0.mjs +237 -0
- package/dist/XmlShapeDeserializer-XKJAoqLc.js +1 -0
- package/dist/ai/client.d.ts +2 -0
- package/dist/ai/index.d.ts +4 -0
- package/dist/ai/mapping.d.ts +14 -0
- package/dist/ai/react/AIFill.d.ts +25 -0
- package/dist/ai/react/AIForm.d.ts +29 -0
- package/dist/ai/react/AIFormGenerator.d.ts +20 -0
- package/dist/ai/react/AISchemaReview.d.ts +18 -0
- package/dist/ai/react/AITextAssist.d.ts +35 -0
- package/dist/ai/react/AIVisionImport.d.ts +21 -0
- package/dist/ai/react/index.d.ts +6 -0
- package/dist/ai/types.d.ts +107 -0
- package/dist/clampAngle-BvZjnf53.mjs +11 -0
- package/dist/clampAngle-DpAsDoeT.js +1 -0
- package/dist/components/FormGenerator.d.ts +46 -1
- package/dist/components/controls/AddressField/addressfield.d.ts +2 -0
- package/dist/components/controls/Alert/alert.d.ts +3 -0
- package/dist/components/controls/AsyncAutocomplete/asyncautocomplete.d.ts +9 -0
- package/dist/components/controls/Button/button.d.ts +3 -0
- package/dist/components/controls/CascadeSelect/cascadeselect.d.ts +2 -0
- package/dist/components/controls/CheckBox/checkbox.d.ts +1 -1
- package/dist/components/controls/ChipSelect/chipselect.d.ts +3 -0
- package/dist/components/controls/ColorPicker/colorpicker.d.ts +3 -0
- package/dist/components/controls/Computed/computed.d.ts +7 -0
- package/dist/components/controls/ConsentField/consentfield.d.ts +3 -0
- package/dist/components/controls/CurrencyField/currencyfield.d.ts +2 -0
- package/dist/components/controls/DateRangePicker/daterangepicker.d.ts +3 -0
- package/dist/components/controls/EditableTable/editabletable.d.ts +2 -0
- package/dist/components/controls/FileUpload/fileupload.d.ts +3 -0
- package/dist/components/controls/FormWizard/formwizard.d.ts +2 -0
- package/dist/components/controls/GeoField/geofield.d.ts +6 -0
- package/dist/components/controls/IntlPhone/intlphone.d.ts +2 -0
- package/dist/components/controls/KeyValueField/keyvaluefield.d.ts +2 -0
- package/dist/components/controls/LocationField/locationfield.d.ts +1 -1
- package/dist/components/controls/MarkdownEditor/markdowneditor.d.ts +3 -0
- package/dist/components/controls/MatrixField/matrixfield.d.ts +3 -0
- package/dist/components/controls/MultiTextbox/multitextbox.d.ts +1 -1
- package/dist/components/controls/NpsScale/npsscale.d.ts +3 -0
- package/dist/components/controls/NumberField/numberfield.d.ts +1 -1
- package/dist/components/controls/NumberStepper/numberstepper.d.ts +2 -0
- package/dist/components/controls/OtpField/otpfield.d.ts +2 -0
- package/dist/components/controls/PasswordField/passwordfield.d.ts +2 -0
- package/dist/components/controls/PhoneField/phonefield.d.ts +2 -0
- package/dist/components/controls/Radio/radio.d.ts +1 -1
- package/dist/components/controls/Rating/rating.d.ts +3 -0
- package/dist/components/controls/RichTextEditor/richtexteditor.d.ts +3 -0
- package/dist/components/controls/Select/select.d.ts +1 -1
- package/dist/components/controls/Slider/slider.d.ts +3 -0
- package/dist/components/controls/SummaryField/summaryfield.d.ts +7 -0
- package/dist/components/controls/Switch/switch.d.ts +1 -1
- package/dist/components/controls/TagsInput/tagsinput.d.ts +3 -0
- package/dist/components/controls/TextField/textfield.d.ts +1 -1
- package/dist/components/controls/ToggleButtons/togglebuttons.d.ts +3 -0
- package/dist/components/controls/index.d.ts +60 -0
- package/dist/createSelector-B-9FwV16.mjs +430 -0
- package/dist/createSelector-f0oqn8Lr.js +7 -0
- package/dist/date-utils-CFUUt6NL.js +4 -0
- package/dist/date-utils-pGzaKb0p.mjs +477 -0
- package/dist/dynamic-mui.cjs.js +1 -1
- package/dist/dynamic-mui.es.js +19 -6
- package/dist/index--8Zky9Oh.js +299 -0
- package/dist/index-6WTs1Xy_.js +1 -0
- package/dist/index-B1R1akM2.js +1 -0
- package/dist/index-BW8_rRff.js +7 -0
- package/dist/index-BXFVK_GX.js +1 -0
- package/dist/index-B_KNUTjy.js +1 -0
- package/dist/index-BhaKvHkU.mjs +62051 -0
- package/dist/index-Bif92ima.js +1 -0
- package/dist/index-BnZOu8CL.js +1 -0
- package/dist/index-CDxpgRlR.mjs +7 -0
- package/dist/index-CThMfvtJ.mjs +2555 -0
- package/dist/index-CVqLvm8B.js +1 -0
- package/dist/index-CodJBIn6.mjs +1665 -0
- package/dist/index-Cr6Wp_S-.mjs +3141 -0
- package/dist/index-CslPwsrf.mjs +4 -0
- package/dist/index-CuV0MQzZ.mjs +1173 -0
- package/dist/{index-BGfWFaIb.mjs → index-DA0XouZs.mjs} +16 -16
- package/dist/index-DKS5Sz9e.js +14 -0
- package/dist/index-DSkYYZuW.mjs +4 -0
- package/dist/index-DU78_FiA.js +1 -0
- package/dist/index-D_mYhgJ0.js +10 -0
- package/dist/index-DcWfyXJp.mjs +92 -0
- package/dist/index-Dlimbnxj.mjs +2965 -0
- package/dist/index-MllWgTJ5.mjs +9372 -0
- package/dist/index-in5z9hUb.js +133 -0
- package/dist/index-qUW7FnZ-.mjs +20540 -0
- package/dist/index.browser-BSu11T_q.mjs +363 -0
- package/dist/index.browser-By7-GABP.js +4 -0
- package/dist/index.d.ts +4 -1
- package/dist/isDeepEqual-BHfPvf9U.mjs +393 -0
- package/dist/isDeepEqual-CqxZGVRk.js +1 -0
- package/dist/loadCognitoIdentity-DtYTy-DW.js +1 -0
- package/dist/loadCognitoIdentity-DzdR91GB.mjs +872 -0
- package/dist/loadSts-Cic6UToN.mjs +593 -0
- package/dist/loadSts-csbFP6zX.js +1 -0
- package/dist/noAuth-B8ui2kBg.mjs +71 -0
- package/dist/noAuth-JPA2o4dt.js +1 -0
- package/dist/playground/AIContext.d.ts +18 -0
- package/dist/playground/AIPanel.d.ts +10 -0
- package/dist/playground/DemoGallery.d.ts +6 -0
- package/dist/playground/Sidebar.d.ts +9 -1
- package/dist/playground/demoForms.d.ts +3 -0
- package/dist/playground/demoRecipes.d.ts +15 -0
- package/dist/playground/demoVariants.d.ts +11 -0
- package/dist/schema.d.ts +404 -0
- package/dist/theme/theme.d.ts +5 -0
- package/dist/types.d.ts +97 -10
- package/dist/useAxis-DSbfEtO7.js +3 -0
- package/dist/useAxis-SiNBMMWq.mjs +3010 -0
- package/dist/useChartContainerProps-Bl3hO-r1.mjs +5418 -0
- package/dist/useChartContainerProps-C_C_PZoi.js +12 -0
- package/dist/useItemHighlightedGetter-9CIwqsGj.js +1 -0
- package/dist/useItemHighlightedGetter-CTISrNdV.mjs +88 -0
- package/dist/util/helper.d.ts +2 -30
- package/dist/util/premiumStyles.d.ts +27 -0
- package/dist/util/rules.d.ts +35 -0
- package/package.json +2 -2
- package/dist/index-BHROoqH4.js +0 -1
- package/dist/index-S6BQaF_5.js +0 -465
- package/dist/index-Wtsz8Yiv.mjs +0 -102315
- package/dist/loadCognitoIdentity-CiUaDv6q.mjs +0 -935
- package/dist/loadCognitoIdentity-DN_MCNUl.js +0 -1
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
import { f as fe, w as D, c as ue, a as R, u as U, _ as x, b as $, d as K, e as Y, j as h, s as de, P as i } from "./index-BhaKvHkU.mjs";
|
|
2
|
+
import { e as xe, u as W, c as q, d as J, i as Q } from "./useAxis-SiNBMMWq.mjs";
|
|
3
|
+
import * as _ from "react";
|
|
4
|
+
import { e as pe, d as be, b as Z, l as he, g as ke, C as ee, c as me, f as ge, i as Te, u as Le, h as Se, j as ye, k as Ae, A as Pe } from "./AxisSharedComponents-xLtpOLH_.mjs";
|
|
5
|
+
import { c as Ie } from "./clampAngle-BvZjnf53.mjs";
|
|
6
|
+
function Me(t = !1) {
|
|
7
|
+
const [e, s] = _.useState(!1);
|
|
8
|
+
return fe(() => {
|
|
9
|
+
t || s(!0);
|
|
10
|
+
}, [t]), _.useEffect(() => {
|
|
11
|
+
t && s(!0);
|
|
12
|
+
}, [t]), e;
|
|
13
|
+
}
|
|
14
|
+
function Ce(t, e, s, n, a) {
|
|
15
|
+
const l = /* @__PURE__ */ new Map(), k = Ie(a?.angle ?? 0);
|
|
16
|
+
let c = 1, o = 1;
|
|
17
|
+
a?.textAnchor === "start" ? (c = 1 / 0, o = 1) : a?.textAnchor === "end" ? (c = 1, o = 1 / 0) : (c = 2, o = 2), k > 90 && k < 270 && ([c, o] = [o, c]), n && ([c, o] = [o, c]);
|
|
18
|
+
for (const r of t)
|
|
19
|
+
if (r.formattedValue) {
|
|
20
|
+
const p = Math.min((r.offset + r.labelOffset) * c, (e.left + e.width + e.right - r.offset - r.labelOffset) * o), f = (u) => be(u, {
|
|
21
|
+
width: p,
|
|
22
|
+
height: s,
|
|
23
|
+
angle: k,
|
|
24
|
+
measureText: (m) => Z(m, a)
|
|
25
|
+
});
|
|
26
|
+
l.set(r, pe(r.formattedValue.toString(), f));
|
|
27
|
+
}
|
|
28
|
+
return l;
|
|
29
|
+
}
|
|
30
|
+
const H = 5;
|
|
31
|
+
function Oe(t, e, s = 0) {
|
|
32
|
+
process.env.NODE_ENV !== "production" && s > 90 && s < -90 && D(["MUI X Charts: It seems you applied an angle larger than 90° or smaller than -90° to an axis text.", "This could cause some text overlapping.", "If you encounter a use case where it's needed, please open an issue."]);
|
|
33
|
+
const n = Math.min(Math.abs(s) % 180, Math.abs(Math.abs(s) % 180 - 180) % 180);
|
|
34
|
+
if (n < H)
|
|
35
|
+
return t;
|
|
36
|
+
if (n > 90 - H)
|
|
37
|
+
return e;
|
|
38
|
+
const a = xe(n), l = Math.atan2(e, t);
|
|
39
|
+
return a < l ? t / Math.cos(a) : e / Math.sin(a);
|
|
40
|
+
}
|
|
41
|
+
function je(t, {
|
|
42
|
+
tickLabelStyle: e,
|
|
43
|
+
tickLabelInterval: s,
|
|
44
|
+
tickLabelMinGap: n,
|
|
45
|
+
reverse: a,
|
|
46
|
+
isMounted: l,
|
|
47
|
+
isXInside: k
|
|
48
|
+
}) {
|
|
49
|
+
if (typeof s == "function")
|
|
50
|
+
return new Set(t.filter((f, u) => s(f.value, u)));
|
|
51
|
+
let c = 0;
|
|
52
|
+
const o = a ? -1 : 1, r = t.filter((f) => {
|
|
53
|
+
const {
|
|
54
|
+
offset: u,
|
|
55
|
+
labelOffset: m,
|
|
56
|
+
formattedValue: g
|
|
57
|
+
} = f;
|
|
58
|
+
if (g === "")
|
|
59
|
+
return !1;
|
|
60
|
+
const d = u + m;
|
|
61
|
+
return k(d);
|
|
62
|
+
}), p = we(r, e);
|
|
63
|
+
return new Set(r.filter((f, u) => {
|
|
64
|
+
const {
|
|
65
|
+
offset: m,
|
|
66
|
+
labelOffset: g
|
|
67
|
+
} = f, d = m + g;
|
|
68
|
+
if (u > 0 && o * d < o * (c + n))
|
|
69
|
+
return !1;
|
|
70
|
+
const {
|
|
71
|
+
width: L,
|
|
72
|
+
height: y
|
|
73
|
+
} = l ? ze(p, f) : {
|
|
74
|
+
width: 0,
|
|
75
|
+
height: 0
|
|
76
|
+
}, b = Oe(L, y, e?.angle), T = d - o * b / 2;
|
|
77
|
+
return u > 0 && o * T < o * (c + n) ? !1 : (c = d + o * b / 2, !0);
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
function ze(t, e) {
|
|
81
|
+
if (e.formattedValue === void 0)
|
|
82
|
+
return {
|
|
83
|
+
width: 0,
|
|
84
|
+
height: 0
|
|
85
|
+
};
|
|
86
|
+
let s = 0, n = 0;
|
|
87
|
+
for (const a of e.formattedValue.split(`
|
|
88
|
+
`)) {
|
|
89
|
+
const l = t.get(a);
|
|
90
|
+
l && (s = Math.max(s, l.width), n += l.height);
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
width: s,
|
|
94
|
+
height: n
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function we(t, e) {
|
|
98
|
+
const s = /* @__PURE__ */ new Set();
|
|
99
|
+
for (const n of t)
|
|
100
|
+
n.formattedValue && n.formattedValue.split(`
|
|
101
|
+
`).forEach((a) => s.add(a));
|
|
102
|
+
return he(s, e);
|
|
103
|
+
}
|
|
104
|
+
const te = (t) => {
|
|
105
|
+
const {
|
|
106
|
+
classes: e,
|
|
107
|
+
position: s,
|
|
108
|
+
id: n
|
|
109
|
+
} = t, a = {
|
|
110
|
+
root: ["root", "directionX", s, `id-${n}`],
|
|
111
|
+
line: ["line"],
|
|
112
|
+
tickContainer: ["tickContainer"],
|
|
113
|
+
tick: ["tick"],
|
|
114
|
+
tickLabel: ["tickLabel"],
|
|
115
|
+
label: ["label"]
|
|
116
|
+
};
|
|
117
|
+
return ue(a, ke, e);
|
|
118
|
+
}, G = 3, Ne = 4, se = {
|
|
119
|
+
disableLine: !1,
|
|
120
|
+
disableTicks: !1,
|
|
121
|
+
tickSize: 6,
|
|
122
|
+
tickLabelMinGap: 4
|
|
123
|
+
}, Xe = ["scale", "tickNumber", "reverse"];
|
|
124
|
+
function ie(t) {
|
|
125
|
+
const {
|
|
126
|
+
xAxis: e,
|
|
127
|
+
xAxisIds: s
|
|
128
|
+
} = W(), n = e[t.axisId ?? s[0]], {
|
|
129
|
+
scale: a,
|
|
130
|
+
tickNumber: l,
|
|
131
|
+
reverse: k
|
|
132
|
+
} = n, c = R(n, Xe), o = U({
|
|
133
|
+
props: x({}, c, t),
|
|
134
|
+
name: "MuiChartsXAxis"
|
|
135
|
+
}), r = x({}, se, o), {
|
|
136
|
+
position: p,
|
|
137
|
+
tickLabelStyle: f,
|
|
138
|
+
slots: u,
|
|
139
|
+
slotProps: m
|
|
140
|
+
} = r, g = $(), d = K(), L = te(r), y = p === "bottom" ? 1 : -1, b = u?.axisTick ?? "line", T = u?.axisTickLabel ?? ee, S = me((p === "bottom" ? 0 : 180) - (f?.angle ?? 0)), A = ge((p === "bottom" ? 0 : 180) - (f?.angle ?? 0)), M = Y({
|
|
141
|
+
elementType: T,
|
|
142
|
+
// @ts-expect-error `useSlotProps` applies `WithCommonProps` with adds a `style: React.CSSProperties` prop automatically.
|
|
143
|
+
externalSlotProps: m?.axisTickLabel,
|
|
144
|
+
// @ts-expect-error `useSlotProps` applies `WithCommonProps` with adds a `style: React.CSSProperties` prop automatically.
|
|
145
|
+
additionalProps: {
|
|
146
|
+
style: x({}, g.typography.caption, {
|
|
147
|
+
fontSize: 12,
|
|
148
|
+
lineHeight: 1.25,
|
|
149
|
+
textAnchor: d ? Te(S) : S,
|
|
150
|
+
dominantBaseline: A
|
|
151
|
+
}, f)
|
|
152
|
+
},
|
|
153
|
+
className: L.tickLabel,
|
|
154
|
+
ownerState: {}
|
|
155
|
+
});
|
|
156
|
+
return {
|
|
157
|
+
xScale: a,
|
|
158
|
+
defaultizedProps: r,
|
|
159
|
+
tickNumber: l,
|
|
160
|
+
positionSign: y,
|
|
161
|
+
classes: L,
|
|
162
|
+
Tick: b,
|
|
163
|
+
TickLabel: T,
|
|
164
|
+
axisTickLabelProps: M,
|
|
165
|
+
reverse: k
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function ve(t) {
|
|
169
|
+
const {
|
|
170
|
+
axisLabelHeight: e,
|
|
171
|
+
ordinalTimeTicks: s
|
|
172
|
+
} = t, {
|
|
173
|
+
xScale: n,
|
|
174
|
+
defaultizedProps: a,
|
|
175
|
+
tickNumber: l,
|
|
176
|
+
positionSign: k,
|
|
177
|
+
classes: c,
|
|
178
|
+
Tick: o,
|
|
179
|
+
TickLabel: r,
|
|
180
|
+
axisTickLabelProps: p,
|
|
181
|
+
reverse: f
|
|
182
|
+
} = ie(t), u = K(), m = Me(), {
|
|
183
|
+
disableTicks: g,
|
|
184
|
+
tickSize: d,
|
|
185
|
+
valueFormatter: L,
|
|
186
|
+
slotProps: y,
|
|
187
|
+
tickInterval: b,
|
|
188
|
+
tickLabelInterval: T,
|
|
189
|
+
tickPlacement: S,
|
|
190
|
+
tickLabelPlacement: A,
|
|
191
|
+
tickLabelMinGap: M,
|
|
192
|
+
tickSpacing: w,
|
|
193
|
+
height: O
|
|
194
|
+
} = a, j = q(), {
|
|
195
|
+
instance: P
|
|
196
|
+
} = J(), C = Le(), I = g ? 4 : d, N = Se({
|
|
197
|
+
scale: n,
|
|
198
|
+
tickNumber: l,
|
|
199
|
+
valueFormatter: L,
|
|
200
|
+
tickInterval: b,
|
|
201
|
+
tickPlacement: S,
|
|
202
|
+
tickLabelPlacement: A,
|
|
203
|
+
tickSpacing: w,
|
|
204
|
+
direction: "x",
|
|
205
|
+
ordinalTimeTicks: s
|
|
206
|
+
}), X = je(N, {
|
|
207
|
+
tickLabelStyle: p.style,
|
|
208
|
+
tickLabelInterval: T,
|
|
209
|
+
tickLabelMinGap: M,
|
|
210
|
+
reverse: f,
|
|
211
|
+
isMounted: m,
|
|
212
|
+
isXInside: P.isXInside
|
|
213
|
+
}), v = Math.max(0, O - (e > 0 ? e + Ne : 0) - I - G), E = C ? Ce(X, j, v, u, p.style) : new Map(Array.from(X).map((z) => [z, z.formattedValue]));
|
|
214
|
+
return /* @__PURE__ */ h.jsx(_.Fragment, {
|
|
215
|
+
children: N.map((z, ne) => {
|
|
216
|
+
const {
|
|
217
|
+
offset: V,
|
|
218
|
+
labelOffset: ae
|
|
219
|
+
} = z, oe = ae ?? 0, ce = k * (I + G), le = P.isXInside(V), F = E.get(z), re = X.has(z);
|
|
220
|
+
return /* @__PURE__ */ h.jsxs("g", {
|
|
221
|
+
transform: `translate(${V}, 0)`,
|
|
222
|
+
className: c.tickContainer,
|
|
223
|
+
children: [!g && le && /* @__PURE__ */ h.jsx(o, x({
|
|
224
|
+
y2: k * I,
|
|
225
|
+
className: c.tick
|
|
226
|
+
}, y?.axisTick)), F !== void 0 && re && /* @__PURE__ */ h.jsx(r, x({
|
|
227
|
+
x: oe,
|
|
228
|
+
y: ce
|
|
229
|
+
}, p, {
|
|
230
|
+
text: F
|
|
231
|
+
}))]
|
|
232
|
+
}, ne);
|
|
233
|
+
})
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
const B = {
|
|
237
|
+
tickSize: 6
|
|
238
|
+
}, _e = (t, e, s) => {
|
|
239
|
+
const n = t[e] ?? {}, a = s ?? B.tickSize, l = a * e * 2 + a;
|
|
240
|
+
return x({}, B, n, {
|
|
241
|
+
tickSize: n.tickSize ?? l
|
|
242
|
+
});
|
|
243
|
+
};
|
|
244
|
+
function Ee(t) {
|
|
245
|
+
const {
|
|
246
|
+
xScale: e,
|
|
247
|
+
defaultizedProps: s,
|
|
248
|
+
positionSign: n,
|
|
249
|
+
classes: a,
|
|
250
|
+
Tick: l,
|
|
251
|
+
TickLabel: k,
|
|
252
|
+
axisTickLabelProps: c
|
|
253
|
+
} = ie(t);
|
|
254
|
+
if (!Q(e))
|
|
255
|
+
throw new Error("MUI X Charts: ChartsGroupedXAxis only supports the `band` and `point` scale types.");
|
|
256
|
+
const {
|
|
257
|
+
disableTicks: o,
|
|
258
|
+
tickSize: r,
|
|
259
|
+
valueFormatter: p,
|
|
260
|
+
slotProps: f,
|
|
261
|
+
tickInterval: u,
|
|
262
|
+
tickPlacement: m,
|
|
263
|
+
tickLabelPlacement: g
|
|
264
|
+
} = s, d = s.groups, {
|
|
265
|
+
instance: L
|
|
266
|
+
} = J(), y = ye({
|
|
267
|
+
scale: e,
|
|
268
|
+
tickInterval: u,
|
|
269
|
+
tickPlacement: m,
|
|
270
|
+
tickLabelPlacement: g,
|
|
271
|
+
groups: d
|
|
272
|
+
});
|
|
273
|
+
return /* @__PURE__ */ h.jsx(_.Fragment, {
|
|
274
|
+
children: y.map((b, T) => {
|
|
275
|
+
const {
|
|
276
|
+
offset: S,
|
|
277
|
+
labelOffset: A
|
|
278
|
+
} = b, M = A ?? 0, w = L.isXInside(S), O = b.formattedValue, j = b.ignoreTick ?? !1, P = b.groupIndex ?? 0, C = _e(d, P, r), I = n * C.tickSize, N = n * (C.tickSize + G);
|
|
279
|
+
return /* @__PURE__ */ h.jsxs("g", {
|
|
280
|
+
transform: `translate(${S}, 0)`,
|
|
281
|
+
className: a.tickContainer,
|
|
282
|
+
"data-group-index": P,
|
|
283
|
+
children: [!o && !j && w && /* @__PURE__ */ h.jsx(l, x({
|
|
284
|
+
y2: I,
|
|
285
|
+
className: a.tick
|
|
286
|
+
}, f?.axisTick)), O !== void 0 && /* @__PURE__ */ h.jsx(k, x({
|
|
287
|
+
x: M,
|
|
288
|
+
y: N
|
|
289
|
+
}, c, {
|
|
290
|
+
style: x({}, c.style, C.tickLabelStyle),
|
|
291
|
+
text: O
|
|
292
|
+
}))]
|
|
293
|
+
}, T);
|
|
294
|
+
})
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
const Re = ["axis"], Ge = ["scale", "tickNumber", "reverse", "ordinalTimeTicks"], Ve = de(Pe, {
|
|
298
|
+
name: "MuiChartsXAxis",
|
|
299
|
+
slot: "Root"
|
|
300
|
+
})({});
|
|
301
|
+
function Fe(t) {
|
|
302
|
+
let {
|
|
303
|
+
axis: e
|
|
304
|
+
} = t, s = R(t, Re);
|
|
305
|
+
const {
|
|
306
|
+
scale: n,
|
|
307
|
+
ordinalTimeTicks: a
|
|
308
|
+
} = e, l = R(e, Ge), k = U({
|
|
309
|
+
props: x({}, l, s),
|
|
310
|
+
name: "MuiChartsXAxis"
|
|
311
|
+
}), c = x({}, se, k), {
|
|
312
|
+
position: o,
|
|
313
|
+
labelStyle: r,
|
|
314
|
+
offset: p,
|
|
315
|
+
slots: f,
|
|
316
|
+
slotProps: u,
|
|
317
|
+
sx: m,
|
|
318
|
+
disableLine: g,
|
|
319
|
+
label: d,
|
|
320
|
+
height: L
|
|
321
|
+
} = c, y = $(), b = te(c), {
|
|
322
|
+
left: T,
|
|
323
|
+
top: S,
|
|
324
|
+
width: A,
|
|
325
|
+
height: M
|
|
326
|
+
} = q(), w = o === "bottom" ? 1 : -1, O = f?.axisLine ?? "line", j = f?.axisLabel ?? ee, P = Y({
|
|
327
|
+
elementType: j,
|
|
328
|
+
// @ts-expect-error `useSlotProps` applies `WithCommonProps` with adds a `style: React.CSSProperties` prop automatically.
|
|
329
|
+
externalSlotProps: u?.axisLabel,
|
|
330
|
+
// @ts-expect-error `useSlotProps` applies `WithCommonProps` with adds a `style: React.CSSProperties` prop automatically.
|
|
331
|
+
additionalProps: {
|
|
332
|
+
style: x({}, y.typography.body1, {
|
|
333
|
+
lineHeight: 1,
|
|
334
|
+
fontSize: 14,
|
|
335
|
+
textAnchor: "middle",
|
|
336
|
+
dominantBaseline: o === "bottom" ? "text-after-edge" : "text-before-edge"
|
|
337
|
+
}, r)
|
|
338
|
+
},
|
|
339
|
+
ownerState: {}
|
|
340
|
+
});
|
|
341
|
+
if (o === "none")
|
|
342
|
+
return null;
|
|
343
|
+
const C = d ? Z(d, P.style).height : 0, I = n.domain(), X = Q(n) ? I.length === 0 : I.some(Ae);
|
|
344
|
+
let v = null;
|
|
345
|
+
X || (v = "groups" in e && Array.isArray(e.groups) ? /* @__PURE__ */ h.jsx(Ee, x({}, s)) : /* @__PURE__ */ h.jsx(ve, x({}, s, {
|
|
346
|
+
axisLabelHeight: C,
|
|
347
|
+
ordinalTimeTicks: a
|
|
348
|
+
})));
|
|
349
|
+
const E = {
|
|
350
|
+
x: T + A / 2,
|
|
351
|
+
y: w * L
|
|
352
|
+
};
|
|
353
|
+
return /* @__PURE__ */ h.jsxs(Ve, {
|
|
354
|
+
transform: `translate(0, ${o === "bottom" ? S + M + p : S - p})`,
|
|
355
|
+
className: b.root,
|
|
356
|
+
"data-axis-id": c.id,
|
|
357
|
+
sx: m,
|
|
358
|
+
children: [!g && /* @__PURE__ */ h.jsx(O, x({
|
|
359
|
+
x1: T,
|
|
360
|
+
x2: T + A,
|
|
361
|
+
className: b.line
|
|
362
|
+
}, u?.axisLine)), v, d && /* @__PURE__ */ h.jsx("g", {
|
|
363
|
+
className: b.label,
|
|
364
|
+
children: /* @__PURE__ */ h.jsx(j, x({}, E, P, {
|
|
365
|
+
text: d
|
|
366
|
+
}))
|
|
367
|
+
})]
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
function He(t) {
|
|
371
|
+
const {
|
|
372
|
+
xAxis: e,
|
|
373
|
+
xAxisIds: s
|
|
374
|
+
} = W(), n = e[t.axisId ?? s[0]];
|
|
375
|
+
return n ? /* @__PURE__ */ h.jsx(Fe, x({}, t, {
|
|
376
|
+
axis: n
|
|
377
|
+
})) : (D(`MUI X Charts: No axis found. The axisId "${t.axisId}" is probably invalid.`), null);
|
|
378
|
+
}
|
|
379
|
+
process.env.NODE_ENV !== "production" && (He.propTypes = {
|
|
380
|
+
// ----------------------------- Warning --------------------------------
|
|
381
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
382
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
383
|
+
// ----------------------------------------------------------------------
|
|
384
|
+
axis: i.oneOf(["x"]),
|
|
385
|
+
/**
|
|
386
|
+
* The id of the axis to render.
|
|
387
|
+
* If undefined, it will be the first defined axis.
|
|
388
|
+
*/
|
|
389
|
+
axisId: i.oneOfType([i.number, i.string]),
|
|
390
|
+
/**
|
|
391
|
+
* Override or extend the styles applied to the component.
|
|
392
|
+
*/
|
|
393
|
+
classes: i.object,
|
|
394
|
+
/**
|
|
395
|
+
* If true, the axis line is disabled.
|
|
396
|
+
* @default false
|
|
397
|
+
*/
|
|
398
|
+
disableLine: i.bool,
|
|
399
|
+
/**
|
|
400
|
+
* If true, the ticks are disabled.
|
|
401
|
+
* @default false
|
|
402
|
+
*/
|
|
403
|
+
disableTicks: i.bool,
|
|
404
|
+
/**
|
|
405
|
+
* The label of the axis.
|
|
406
|
+
*/
|
|
407
|
+
label: i.string,
|
|
408
|
+
/**
|
|
409
|
+
* The style applied to the axis label.
|
|
410
|
+
*/
|
|
411
|
+
labelStyle: i.object,
|
|
412
|
+
/**
|
|
413
|
+
* The props used for each component slot.
|
|
414
|
+
* @default {}
|
|
415
|
+
*/
|
|
416
|
+
slotProps: i.object,
|
|
417
|
+
/**
|
|
418
|
+
* Overridable component slots.
|
|
419
|
+
* @default {}
|
|
420
|
+
*/
|
|
421
|
+
slots: i.object,
|
|
422
|
+
sx: i.oneOfType([i.arrayOf(i.oneOfType([i.func, i.object, i.bool])), i.func, i.object]),
|
|
423
|
+
/**
|
|
424
|
+
* Defines which ticks are displayed.
|
|
425
|
+
* Its value can be:
|
|
426
|
+
* - 'auto' In such case the ticks are computed based on axis scale and other parameters.
|
|
427
|
+
* - a filtering function of the form `(value, index) => boolean` which is available only if the axis has "point" scale.
|
|
428
|
+
* - an array containing the values where ticks should be displayed.
|
|
429
|
+
* @see See {@link https://mui.com/x/react-charts/axis/#fixed-tick-positions}
|
|
430
|
+
* @default 'auto'
|
|
431
|
+
*/
|
|
432
|
+
tickInterval: i.oneOfType([i.oneOf(["auto"]), i.array, i.func]),
|
|
433
|
+
/**
|
|
434
|
+
* Defines which ticks get its label displayed. Its value can be:
|
|
435
|
+
* - 'auto' In such case, labels are displayed if they do not overlap with the previous one.
|
|
436
|
+
* - a filtering function of the form (value, index) => boolean. Warning: the index is tick index, not data ones.
|
|
437
|
+
* @default 'auto'
|
|
438
|
+
*/
|
|
439
|
+
tickLabelInterval: i.oneOfType([i.oneOf(["auto"]), i.func]),
|
|
440
|
+
/**
|
|
441
|
+
* The minimum gap in pixels between two tick labels.
|
|
442
|
+
* If two tick labels are closer than this minimum gap, one of them will be hidden.
|
|
443
|
+
* @default 4
|
|
444
|
+
*/
|
|
445
|
+
tickLabelMinGap: i.number,
|
|
446
|
+
/**
|
|
447
|
+
* The placement of ticks label. Can be the middle of the band, or the tick position.
|
|
448
|
+
* Only used if scale is 'band'.
|
|
449
|
+
* @default 'middle'
|
|
450
|
+
*/
|
|
451
|
+
tickLabelPlacement: i.oneOf(["middle", "tick"]),
|
|
452
|
+
/**
|
|
453
|
+
* The style applied to ticks text.
|
|
454
|
+
*/
|
|
455
|
+
tickLabelStyle: i.object,
|
|
456
|
+
/**
|
|
457
|
+
* Maximal step between two ticks.
|
|
458
|
+
* When using time data, the value is assumed to be in ms.
|
|
459
|
+
* Not supported by categorical axis (band, points).
|
|
460
|
+
*/
|
|
461
|
+
tickMaxStep: i.number,
|
|
462
|
+
/**
|
|
463
|
+
* Minimal step between two ticks.
|
|
464
|
+
* When using time data, the value is assumed to be in ms.
|
|
465
|
+
* Not supported by categorical axis (band, points).
|
|
466
|
+
*/
|
|
467
|
+
tickMinStep: i.number,
|
|
468
|
+
/**
|
|
469
|
+
* The number of ticks. This number is not guaranteed.
|
|
470
|
+
* Not supported by categorical axis (band, points).
|
|
471
|
+
*/
|
|
472
|
+
tickNumber: i.number,
|
|
473
|
+
/**
|
|
474
|
+
* The placement of ticks in regard to the band interval.
|
|
475
|
+
* Only used if scale is 'band'.
|
|
476
|
+
* @default 'extremities'
|
|
477
|
+
*/
|
|
478
|
+
tickPlacement: i.oneOf(["end", "extremities", "middle", "start"]),
|
|
479
|
+
/**
|
|
480
|
+
* The size of the ticks.
|
|
481
|
+
* @default 6
|
|
482
|
+
*/
|
|
483
|
+
tickSize: i.number
|
|
484
|
+
});
|
|
485
|
+
export {
|
|
486
|
+
He as C
|
|
487
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";const e=require("./index--8Zky9Oh.js"),S=require("./useAxis-DSbfEtO7.js"),Z=require("react"),d=require("./AxisSharedComponents-BbsKw1BT.js"),ee=require("./clampAngle-DpAsDoeT.js");function te(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(s,i,n.get?n:{enumerable:!0,get:()=>t[i]})}}return s.default=t,Object.freeze(s)}const X=te(Z);function se(t=!1){const[s,i]=X.useState(!1);return e.useEnhancedEffect(()=>{t||i(!0)},[t]),X.useEffect(()=>{t&&i(!0)},[t]),s}function ie(t,s,i,n,o){const c=new Map,T=ee.clampAngle(o?.angle??0);let r=1,a=1;o?.textAnchor==="start"?(r=1/0,a=1):o?.textAnchor==="end"?(r=1,a=1/0):(r=2,a=2),T>90&&T<270&&([r,a]=[a,r]),n&&([r,a]=[a,r]);for(const l of t)if(l.formattedValue){const f=Math.min((l.offset+l.labelOffset)*r,(s.left+s.width+s.right-l.offset-l.labelOffset)*a),p=u=>d.doesTextFitInRect(u,{width:f,height:i,angle:T,measureText:m=>d.getStringSize(m,o)});c.set(l,d.ellipsize(l.formattedValue.toString(),p))}return c}const D=5;function ne(t,s,i=0){process.env.NODE_ENV!=="production"&&i>90&&i<-90&&e.warnOnce(["MUI X Charts: It seems you applied an angle larger than 90° or smaller than -90° to an axis text.","This could cause some text overlapping.","If you encounter a use case where it's needed, please open an issue."]);const n=Math.min(Math.abs(i)%180,Math.abs(Math.abs(i)%180-180)%180);if(n<D)return t;if(n>90-D)return s;const o=S.deg2rad(n),c=Math.atan2(s,t);return o<c?t/Math.cos(o):s/Math.sin(o)}function oe(t,{tickLabelStyle:s,tickLabelInterval:i,tickLabelMinGap:n,reverse:o,isMounted:c,isXInside:T}){if(typeof i=="function")return new Set(t.filter((p,u)=>i(p.value,u)));let r=0;const a=o?-1:1,l=t.filter(p=>{const{offset:u,labelOffset:m,formattedValue:h}=p;if(h==="")return!1;const x=u+m;return T(x)}),f=re(l,s);return new Set(l.filter((p,u)=>{const{offset:m,labelOffset:h}=p,x=m+h;if(u>0&&a*x<a*(r+n))return!1;const{width:g,height:P}=c?ae(f,p):{width:0,height:0},b=ne(g,P,s?.angle),k=x-a*b/2;return u>0&&a*k<a*(r+n)?!1:(r=x+a*b/2,!0)}))}function ae(t,s){if(s.formattedValue===void 0)return{width:0,height:0};let i=0,n=0;for(const o of s.formattedValue.split(`
|
|
2
|
+
`)){const c=t.get(o);c&&(i=Math.max(i,c.width),n+=c.height)}return{width:i,height:n}}function re(t,s){const i=new Set;for(const n of t)n.formattedValue&&n.formattedValue.split(`
|
|
3
|
+
`).forEach(o=>i.add(o));return d.batchMeasureStrings(i,s)}const H=t=>{const{classes:s,position:i,id:n}=t,o={root:["root","directionX",i,`id-${n}`],line:["line"],tickContainer:["tickContainer"],tick:["tick"],tickLabel:["tickLabel"],label:["label"]};return e.composeClasses(o,d.getAxisUtilityClass,s)},v=3,ce=4,B={disableLine:!1,disableTicks:!1,tickSize:6,tickLabelMinGap:4},le=["scale","tickNumber","reverse"];function U(t){const{xAxis:s,xAxisIds:i}=S.useXAxes(),n=s[t.axisId??i[0]],{scale:o,tickNumber:c,reverse:T}=n,r=e._objectWithoutPropertiesLoose(n,le),a=e.useThemeProps({props:e._extends({},r,t),name:"MuiChartsXAxis"}),l=e._extends({},B,a),{position:f,tickLabelStyle:p,slots:u,slotProps:m}=l,h=e.useTheme(),x=e.useRtl(),g=H(l),P=f==="bottom"?1:-1,b=u?.axisTick??"line",k=u?.axisTickLabel??d.ChartsText,y=d.getDefaultTextAnchor((f==="bottom"?0:180)-(p?.angle??0)),L=d.getDefaultBaseline((f==="bottom"?0:180)-(p?.angle??0)),_=e.useSlotProps({elementType:k,externalSlotProps:m?.axisTickLabel,additionalProps:{style:e._extends({},h.typography.caption,{fontSize:12,lineHeight:1.25,textAnchor:x?d.invertTextAnchor(y):y,dominantBaseline:L},p)},className:g.tickLabel,ownerState:{}});return{xScale:o,defaultizedProps:l,tickNumber:c,positionSign:P,classes:g,Tick:b,TickLabel:k,axisTickLabelProps:_,reverse:T}}function pe(t){const{axisLabelHeight:s,ordinalTimeTicks:i}=t,{xScale:n,defaultizedProps:o,tickNumber:c,positionSign:T,classes:r,Tick:a,TickLabel:l,axisTickLabelProps:f,reverse:p}=U(t),u=e.useRtl(),m=se(),{disableTicks:h,tickSize:x,valueFormatter:g,slotProps:P,tickInterval:b,tickLabelInterval:k,tickPlacement:y,tickLabelPlacement:L,tickLabelMinGap:_,tickSpacing:E,height:C}=o,I=S.useDrawingArea(),{instance:A}=S.useChartContext(),O=d.useIsHydrated(),j=h?4:x,R=d.useTicks({scale:n,tickNumber:c,valueFormatter:g,tickInterval:b,tickPlacement:y,tickLabelPlacement:L,tickSpacing:E,direction:"x",ordinalTimeTicks:i}),z=oe(R,{tickLabelStyle:f.style,tickLabelInterval:k,tickLabelMinGap:_,reverse:p,isMounted:m,isXInside:A.isXInside}),w=Math.max(0,C-(s>0?s+ce:0)-j-v),N=O?ie(z,I,w,u,f.style):new Map(Array.from(z).map(M=>[M,M.formattedValue]));return e.jsxRuntimeExports.jsx(X.Fragment,{children:R.map((M,q)=>{const{offset:G,labelOffset:W}=M,K=W??0,Y=T*(j+v),J=A.isXInside(G),V=N.get(M),Q=z.has(M);return e.jsxRuntimeExports.jsxs("g",{transform:`translate(${G}, 0)`,className:r.tickContainer,children:[!h&&J&&e.jsxRuntimeExports.jsx(a,e._extends({y2:T*j,className:r.tick},P?.axisTick)),V!==void 0&&Q&&e.jsxRuntimeExports.jsx(l,e._extends({x:K,y:Y},f,{text:V}))]},q)})})}const F={tickSize:6},ue=(t,s,i)=>{const n=t[s]??{},o=i??F.tickSize,c=o*s*2+o;return e._extends({},F,n,{tickSize:n.tickSize??c})};function xe(t){const{xScale:s,defaultizedProps:i,positionSign:n,classes:o,Tick:c,TickLabel:T,axisTickLabelProps:r}=U(t);if(!S.isOrdinalScale(s))throw new Error("MUI X Charts: ChartsGroupedXAxis only supports the `band` and `point` scale types.");const{disableTicks:a,tickSize:l,valueFormatter:f,slotProps:p,tickInterval:u,tickPlacement:m,tickLabelPlacement:h}=i,x=i.groups,{instance:g}=S.useChartContext(),P=d.useTicksGrouped({scale:s,tickInterval:u,tickPlacement:m,tickLabelPlacement:h,groups:x});return e.jsxRuntimeExports.jsx(X.Fragment,{children:P.map((b,k)=>{const{offset:y,labelOffset:L}=b,_=L??0,E=g.isXInside(y),C=b.formattedValue,I=b.ignoreTick??!1,A=b.groupIndex??0,O=ue(x,A,l),j=n*O.tickSize,R=n*(O.tickSize+v);return e.jsxRuntimeExports.jsxs("g",{transform:`translate(${y}, 0)`,className:o.tickContainer,"data-group-index":A,children:[!a&&!I&&E&&e.jsxRuntimeExports.jsx(c,e._extends({y2:j,className:o.tick},p?.axisTick)),C!==void 0&&e.jsxRuntimeExports.jsx(T,e._extends({x:_,y:R},r,{style:e._extends({},r.style,O.tickLabelStyle),text:C}))]},k)})})}const de=["axis"],fe=["scale","tickNumber","reverse","ordinalTimeTicks"],be=e.styled(d.AxisRoot,{name:"MuiChartsXAxis",slot:"Root"})({});function Te(t){let{axis:s}=t,i=e._objectWithoutPropertiesLoose(t,de);const{scale:n,ordinalTimeTicks:o}=s,c=e._objectWithoutPropertiesLoose(s,fe),T=e.useThemeProps({props:e._extends({},c,i),name:"MuiChartsXAxis"}),r=e._extends({},B,T),{position:a,labelStyle:l,offset:f,slots:p,slotProps:u,sx:m,disableLine:h,label:x,height:g}=r,P=e.useTheme(),b=H(r),{left:k,top:y,width:L,height:_}=S.useDrawingArea(),E=a==="bottom"?1:-1,C=p?.axisLine??"line",I=p?.axisLabel??d.ChartsText,A=e.useSlotProps({elementType:I,externalSlotProps:u?.axisLabel,additionalProps:{style:e._extends({},P.typography.body1,{lineHeight:1,fontSize:14,textAnchor:"middle",dominantBaseline:a==="bottom"?"text-after-edge":"text-before-edge"},l)},ownerState:{}});if(a==="none")return null;const O=x?d.getStringSize(x,A.style).height:0,j=n.domain(),z=S.isOrdinalScale(n)?j.length===0:j.some(d.isInfinity);let w=null;z||(w="groups"in s&&Array.isArray(s.groups)?e.jsxRuntimeExports.jsx(xe,e._extends({},i)):e.jsxRuntimeExports.jsx(pe,e._extends({},i,{axisLabelHeight:O,ordinalTimeTicks:o})));const N={x:k+L/2,y:E*g};return e.jsxRuntimeExports.jsxs(be,{transform:`translate(0, ${a==="bottom"?y+_+f:y-f})`,className:b.root,"data-axis-id":r.id,sx:m,children:[!h&&e.jsxRuntimeExports.jsx(C,e._extends({x1:k,x2:k+L,className:b.line},u?.axisLine)),w,x&&e.jsxRuntimeExports.jsx("g",{className:b.label,children:e.jsxRuntimeExports.jsx(I,e._extends({},N,A,{text:x}))})]})}function $(t){const{xAxis:s,xAxisIds:i}=S.useXAxes(),n=s[t.axisId??i[0]];return n?e.jsxRuntimeExports.jsx(Te,e._extends({},t,{axis:n})):(e.warnOnce(`MUI X Charts: No axis found. The axisId "${t.axisId}" is probably invalid.`),null)}process.env.NODE_ENV!=="production"&&($.propTypes={axis:e.PropTypes.oneOf(["x"]),axisId:e.PropTypes.oneOfType([e.PropTypes.number,e.PropTypes.string]),classes:e.PropTypes.object,disableLine:e.PropTypes.bool,disableTicks:e.PropTypes.bool,label:e.PropTypes.string,labelStyle:e.PropTypes.object,slotProps:e.PropTypes.object,slots:e.PropTypes.object,sx:e.PropTypes.oneOfType([e.PropTypes.arrayOf(e.PropTypes.oneOfType([e.PropTypes.func,e.PropTypes.object,e.PropTypes.bool])),e.PropTypes.func,e.PropTypes.object]),tickInterval:e.PropTypes.oneOfType([e.PropTypes.oneOf(["auto"]),e.PropTypes.array,e.PropTypes.func]),tickLabelInterval:e.PropTypes.oneOfType([e.PropTypes.oneOf(["auto"]),e.PropTypes.func]),tickLabelMinGap:e.PropTypes.number,tickLabelPlacement:e.PropTypes.oneOf(["middle","tick"]),tickLabelStyle:e.PropTypes.object,tickMaxStep:e.PropTypes.number,tickMinStep:e.PropTypes.number,tickNumber:e.PropTypes.number,tickPlacement:e.PropTypes.oneOf(["end","extremities","middle","start"]),tickSize:e.PropTypes.number});exports.ChartsXAxis=$;
|