@patterninc/pattern-ui 0.0.0-main.202610070722.e4b4a045849e → 0.0.0-main.202610080441.d12ae32dfdcb
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/dist/components/DevTools/DevTools.js +104 -85
- package/dist/components/Metric/Metric.js +296 -258
- package/dist/locales/en/messages.js +1 -1
- package/dist/locales/es/messages.js +1 -1
- package/dist/locales/fr/messages.js +1 -1
- package/dist/locales/pl/messages.js +1 -1
- package/dist/locales/pseudo-LOCALE/messages.js +1 -1
- package/dist/locales/zh/messages.js +1 -1
- package/package.json +1 -1
- package/src/components/DevTools/DevTools.tsx +48 -22
- package/src/components/Metric/Metric.tsx +70 -40
- package/src/locales/en/messages.po +6 -0
- package/src/locales/en/messages.ts +1 -1
- package/src/locales/es/messages.po +6 -0
- package/src/locales/es/messages.ts +1 -1
- package/src/locales/fr/messages.po +6 -0
- package/src/locales/fr/messages.ts +1 -1
- package/src/locales/pl/messages.po +6 -0
- package/src/locales/pl/messages.ts +1 -1
- package/src/locales/pseudo-LOCALE/messages.po +6 -0
- package/src/locales/pseudo-LOCALE/messages.ts +1 -1
- package/src/locales/zh/messages.po +6 -0
- package/src/locales/zh/messages.ts +1 -1
|
@@ -40,7 +40,7 @@ function usePatternUiDevTools() {
|
|
|
40
40
|
return enabled;
|
|
41
41
|
}
|
|
42
42
|
function DevToolsFab(t0) {
|
|
43
|
-
const $ = c(
|
|
43
|
+
const $ = c(49);
|
|
44
44
|
const { onOpen, qaTestId } = t0;
|
|
45
45
|
const { _: _t } = useLingui();
|
|
46
46
|
const [savedPosition, setSavedPosition] = useLocalStorage(DEVTOOLS_FAB_POSITION_KEY, null);
|
|
@@ -114,46 +114,63 @@ function DevToolsFab(t0) {
|
|
|
114
114
|
} else t6 = $[13];
|
|
115
115
|
useEventListener("resize", t6);
|
|
116
116
|
let t7;
|
|
117
|
-
if ($[14]
|
|
118
|
-
t7 = (pointerId) => {
|
|
117
|
+
if ($[14] !== setSavedPosition) {
|
|
118
|
+
t7 = (pointerId, commit) => {
|
|
119
119
|
const drag = dragRef.current;
|
|
120
120
|
if (!drag || pointerId !== drag.pointerId) return;
|
|
121
|
+
const didDrag = didDragRef.current;
|
|
121
122
|
dragRef.current = null;
|
|
122
|
-
didDragRef.current = false;
|
|
123
123
|
setIsDragging(false);
|
|
124
|
+
if (!didDrag) {
|
|
125
|
+
setDragPosition(null);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (!commit) {
|
|
129
|
+
setDragPosition(null);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
124
132
|
setDragPosition(null);
|
|
133
|
+
setSavedPosition(clampDevToolsFabPosition({
|
|
134
|
+
x: drag.originX + (drag.latestX - drag.startX),
|
|
135
|
+
y: drag.originY + (drag.latestY - drag.startY)
|
|
136
|
+
}, {
|
|
137
|
+
width: window.innerWidth,
|
|
138
|
+
height: window.innerHeight,
|
|
139
|
+
size: drag.size
|
|
140
|
+
}));
|
|
125
141
|
};
|
|
126
|
-
$[14] =
|
|
127
|
-
|
|
128
|
-
|
|
142
|
+
$[14] = setSavedPosition;
|
|
143
|
+
$[15] = t7;
|
|
144
|
+
} else t7 = $[15];
|
|
145
|
+
const finishDrag = t7;
|
|
129
146
|
const t8 = isDragging ? false : void 0;
|
|
130
147
|
let t9;
|
|
131
|
-
if ($[
|
|
148
|
+
if ($[16] !== _t) {
|
|
132
149
|
t9 = _t({ id: "IdoT3W" });
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
} else t9 = $[
|
|
150
|
+
$[16] = _t;
|
|
151
|
+
$[17] = t9;
|
|
152
|
+
} else t9 = $[17];
|
|
136
153
|
const t10 = isDragging ? "cursor-grabbing" : "cursor-grab";
|
|
137
154
|
const t11 = !position && "right-4 bottom-4";
|
|
138
155
|
let t12;
|
|
139
|
-
if ($[
|
|
156
|
+
if ($[18] !== t10 || $[19] !== t11) {
|
|
140
157
|
t12 = cn("pointer-events-auto fixed z-9999 flex size-10 touch-none items-center justify-center rounded-full bg-primary-lighter text-primary-base select-none hover:bg-primary-light focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-base", t10, t11);
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
} else t12 = $[
|
|
158
|
+
$[18] = t10;
|
|
159
|
+
$[19] = t11;
|
|
160
|
+
$[20] = t12;
|
|
161
|
+
} else t12 = $[20];
|
|
145
162
|
let t13;
|
|
146
|
-
if ($[
|
|
163
|
+
if ($[21] !== position) {
|
|
147
164
|
t13 = position ? {
|
|
148
165
|
left: position.x,
|
|
149
166
|
top: position.y
|
|
150
167
|
} : void 0;
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
} else t13 = $[
|
|
168
|
+
$[21] = position;
|
|
169
|
+
$[22] = t13;
|
|
170
|
+
} else t13 = $[22];
|
|
154
171
|
let t14;
|
|
155
172
|
let t15;
|
|
156
|
-
if ($[
|
|
173
|
+
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
157
174
|
t14 = (event) => {
|
|
158
175
|
if (event.button !== 0) return;
|
|
159
176
|
const rect = event.currentTarget.getBoundingClientRect();
|
|
@@ -163,7 +180,9 @@ function DevToolsFab(t0) {
|
|
|
163
180
|
startY: event.clientY,
|
|
164
181
|
originX: rect.left,
|
|
165
182
|
originY: rect.top,
|
|
166
|
-
size: rect.width || 40
|
|
183
|
+
size: rect.width || 40,
|
|
184
|
+
latestX: event.clientX,
|
|
185
|
+
latestY: event.clientY
|
|
167
186
|
};
|
|
168
187
|
didDragRef.current = false;
|
|
169
188
|
event.currentTarget.setPointerCapture(event.pointerId);
|
|
@@ -171,6 +190,8 @@ function DevToolsFab(t0) {
|
|
|
171
190
|
t15 = (event_0) => {
|
|
172
191
|
const drag_0 = dragRef.current;
|
|
173
192
|
if (!drag_0 || event_0.pointerId !== drag_0.pointerId) return;
|
|
193
|
+
drag_0.latestX = event_0.clientX;
|
|
194
|
+
drag_0.latestY = event_0.clientY;
|
|
174
195
|
const dx = event_0.clientX - drag_0.startX;
|
|
175
196
|
const dy = event_0.clientY - drag_0.startY;
|
|
176
197
|
if (!didDragRef.current && !hasExceededDevToolsFabDragThreshold(dx, dy)) return;
|
|
@@ -185,71 +206,67 @@ function DevToolsFab(t0) {
|
|
|
185
206
|
size: drag_0.size
|
|
186
207
|
}));
|
|
187
208
|
};
|
|
188
|
-
$[
|
|
189
|
-
$[
|
|
209
|
+
$[23] = t14;
|
|
210
|
+
$[24] = t15;
|
|
190
211
|
} else {
|
|
191
|
-
t14 = $[
|
|
192
|
-
t15 = $[
|
|
212
|
+
t14 = $[23];
|
|
213
|
+
t15 = $[24];
|
|
193
214
|
}
|
|
194
215
|
let t16;
|
|
195
|
-
|
|
216
|
+
let t17;
|
|
217
|
+
let t18;
|
|
218
|
+
if ($[25] !== finishDrag) {
|
|
196
219
|
t16 = (event_1) => {
|
|
197
220
|
const drag_1 = dragRef.current;
|
|
198
221
|
if (!drag_1 || event_1.pointerId !== drag_1.pointerId) return;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
y: drag_1.originY + (event_1.clientY - drag_1.startY)
|
|
207
|
-
}, {
|
|
208
|
-
width: window.innerWidth,
|
|
209
|
-
height: window.innerHeight,
|
|
210
|
-
size: drag_1.size
|
|
211
|
-
}));
|
|
222
|
+
drag_1.latestX = event_1.clientX;
|
|
223
|
+
drag_1.latestY = event_1.clientY;
|
|
224
|
+
const dx_0 = event_1.clientX - drag_1.startX;
|
|
225
|
+
const dy_0 = event_1.clientY - drag_1.startY;
|
|
226
|
+
if (hasExceededDevToolsFabDragThreshold(dx_0, dy_0)) didDragRef.current = true;
|
|
227
|
+
if (didDragRef.current) event_1.preventDefault();
|
|
228
|
+
finishDrag(event_1.pointerId, true);
|
|
212
229
|
};
|
|
213
|
-
$[24] = setSavedPosition;
|
|
214
|
-
$[25] = t16;
|
|
215
|
-
} else t16 = $[25];
|
|
216
|
-
let t17;
|
|
217
|
-
let t18;
|
|
218
|
-
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
219
230
|
t17 = (event_2) => {
|
|
220
|
-
|
|
231
|
+
finishDrag(event_2.pointerId, false);
|
|
221
232
|
};
|
|
222
233
|
t18 = (event_3) => {
|
|
223
|
-
|
|
234
|
+
finishDrag(event_3.pointerId, true);
|
|
224
235
|
};
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
236
|
+
$[25] = finishDrag;
|
|
237
|
+
$[26] = t16;
|
|
238
|
+
$[27] = t17;
|
|
239
|
+
$[28] = t18;
|
|
227
240
|
} else {
|
|
228
|
-
|
|
229
|
-
|
|
241
|
+
t16 = $[26];
|
|
242
|
+
t17 = $[27];
|
|
243
|
+
t18 = $[28];
|
|
230
244
|
}
|
|
231
245
|
let t19;
|
|
232
|
-
if ($[
|
|
233
|
-
t19 = () => {
|
|
234
|
-
if (didDragRef.current) {
|
|
246
|
+
if ($[29] !== onOpen) {
|
|
247
|
+
t19 = (event_4) => {
|
|
248
|
+
if (event_4.detail === 0 || !didDragRef.current) {
|
|
235
249
|
didDragRef.current = false;
|
|
250
|
+
onOpen();
|
|
236
251
|
return;
|
|
237
252
|
}
|
|
238
|
-
|
|
253
|
+
event_4.preventDefault();
|
|
254
|
+
event_4.stopPropagation();
|
|
255
|
+
didDragRef.current = false;
|
|
239
256
|
};
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
} else t19 = $[
|
|
257
|
+
$[29] = onOpen;
|
|
258
|
+
$[30] = t19;
|
|
259
|
+
} else t19 = $[30];
|
|
243
260
|
let t20;
|
|
244
|
-
if ($[
|
|
261
|
+
if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
|
|
245
262
|
t20 = /* @__PURE__ */ jsx(CodeIcon, {
|
|
246
263
|
size: 20,
|
|
247
264
|
color: "primary-base"
|
|
248
265
|
});
|
|
249
|
-
$[
|
|
250
|
-
} else t20 = $[
|
|
266
|
+
$[31] = t20;
|
|
267
|
+
} else t20 = $[31];
|
|
251
268
|
let t21;
|
|
252
|
-
if ($[
|
|
269
|
+
if ($[32] !== qaTestId || $[33] !== t12 || $[34] !== t13 || $[35] !== t16 || $[36] !== t17 || $[37] !== t18 || $[38] !== t19 || $[39] !== t9) {
|
|
253
270
|
t21 = /* @__PURE__ */ jsx(TooltipTrigger, {
|
|
254
271
|
asChild: true,
|
|
255
272
|
children: /* @__PURE__ */ jsx("button", {
|
|
@@ -267,31 +284,33 @@ function DevToolsFab(t0) {
|
|
|
267
284
|
children: t20
|
|
268
285
|
})
|
|
269
286
|
});
|
|
270
|
-
$[
|
|
271
|
-
$[
|
|
272
|
-
$[
|
|
273
|
-
$[
|
|
274
|
-
$[
|
|
275
|
-
$[
|
|
276
|
-
$[
|
|
277
|
-
|
|
287
|
+
$[32] = qaTestId;
|
|
288
|
+
$[33] = t12;
|
|
289
|
+
$[34] = t13;
|
|
290
|
+
$[35] = t16;
|
|
291
|
+
$[36] = t17;
|
|
292
|
+
$[37] = t18;
|
|
293
|
+
$[38] = t19;
|
|
294
|
+
$[39] = t9;
|
|
295
|
+
$[40] = t21;
|
|
296
|
+
} else t21 = $[40];
|
|
278
297
|
let t22;
|
|
279
|
-
if ($[
|
|
298
|
+
if ($[41] !== _t) {
|
|
280
299
|
t22 = _t({ id: "85Fz0S" });
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
283
|
-
} else t22 = $[
|
|
300
|
+
$[41] = _t;
|
|
301
|
+
$[42] = t22;
|
|
302
|
+
} else t22 = $[42];
|
|
284
303
|
let t23;
|
|
285
|
-
if ($[
|
|
304
|
+
if ($[43] !== t22) {
|
|
286
305
|
t23 = /* @__PURE__ */ jsx(TooltipContent, {
|
|
287
306
|
side: "left",
|
|
288
307
|
children: t22
|
|
289
308
|
});
|
|
290
|
-
$[
|
|
291
|
-
$[
|
|
292
|
-
} else t23 = $[
|
|
309
|
+
$[43] = t22;
|
|
310
|
+
$[44] = t23;
|
|
311
|
+
} else t23 = $[44];
|
|
293
312
|
let t24;
|
|
294
|
-
if ($[
|
|
313
|
+
if ($[45] !== t21 || $[46] !== t23 || $[47] !== t8) {
|
|
295
314
|
t24 = /* @__PURE__ */ jsx(TooltipProvider, {
|
|
296
315
|
delayDuration: 0,
|
|
297
316
|
children: /* @__PURE__ */ jsxs(Tooltip, {
|
|
@@ -299,11 +318,11 @@ function DevToolsFab(t0) {
|
|
|
299
318
|
children: [t21, t23]
|
|
300
319
|
})
|
|
301
320
|
});
|
|
302
|
-
$[
|
|
303
|
-
$[
|
|
304
|
-
$[
|
|
305
|
-
$[
|
|
306
|
-
} else t24 = $[
|
|
321
|
+
$[45] = t21;
|
|
322
|
+
$[46] = t23;
|
|
323
|
+
$[47] = t8;
|
|
324
|
+
$[48] = t24;
|
|
325
|
+
} else t24 = $[48];
|
|
307
326
|
return t24;
|
|
308
327
|
}
|
|
309
328
|
function DevTools(t0) {
|