gridsmith-ui 0.29.1 → 0.30.1
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 +94 -0
- package/README.md +5 -1
- package/dist/DropdownMenu-DqT7ZQ0D.d.ts +39 -0
- package/dist/charts.js +24 -9
- package/dist/charts.js.map +1 -1
- package/dist/chat.js +7 -7
- package/dist/{chunk-MFAWJSMJ.js → chunk-6C2IUMY7.js} +4 -23
- package/dist/chunk-6C2IUMY7.js.map +1 -0
- package/dist/{chunk-OYNUU346.js → chunk-7QLXYRPD.js} +3 -12
- package/dist/chunk-7QLXYRPD.js.map +1 -0
- package/dist/{chunk-FD4YED7O.js → chunk-DBHVJ7Z3.js} +5 -49
- package/dist/chunk-DBHVJ7Z3.js.map +1 -0
- package/dist/chunk-IELIF4PJ.js +110 -0
- package/dist/chunk-IELIF4PJ.js.map +1 -0
- package/dist/chunk-ISONVOA7.js +316 -0
- package/dist/chunk-ISONVOA7.js.map +1 -0
- package/dist/{chunk-4TUJXDRU.js → chunk-KMKBOTFR.js} +93 -32
- package/dist/chunk-KMKBOTFR.js.map +1 -0
- package/dist/{chunk-MKFWHWBK.js → chunk-L6HWACK7.js} +7 -7
- package/dist/chunk-L6HWACK7.js.map +1 -0
- package/dist/chunk-LJYSVZMI.js +25 -0
- package/dist/chunk-LJYSVZMI.js.map +1 -0
- package/dist/{chunk-6A5RHW2W.js → chunk-NEUWZUK6.js} +4 -5
- package/dist/chunk-NEUWZUK6.js.map +1 -0
- package/dist/chunk-NKUCS67T.js +13 -0
- package/dist/chunk-NKUCS67T.js.map +1 -0
- package/dist/{chunk-RECCCA7Z.js → chunk-OVHBQT3Z.js} +6 -5
- package/dist/chunk-OVHBQT3Z.js.map +1 -0
- package/dist/{chunk-I3MTQ3CS.js → chunk-OX3NNMWG.js} +6 -6
- package/dist/{chunk-I3MTQ3CS.js.map → chunk-OX3NNMWG.js.map} +1 -1
- package/dist/{chunk-ZI3OQDET.js → chunk-R5QXMNW7.js} +297 -15
- package/dist/chunk-R5QXMNW7.js.map +1 -0
- package/dist/chunk-SJZWEBHL.js +58 -0
- package/dist/chunk-SJZWEBHL.js.map +1 -0
- package/dist/{chunk-FUKSLQ77.js → chunk-SLRTSBCJ.js} +91 -51
- package/dist/chunk-SLRTSBCJ.js.map +1 -0
- package/dist/chunk-T52LAFKG.js +1350 -0
- package/dist/chunk-T52LAFKG.js.map +1 -0
- package/dist/chunk-TYNDXMBV.js +105 -0
- package/dist/chunk-TYNDXMBV.js.map +1 -0
- package/dist/{chunk-37WOC7F7.js → chunk-UDJOIVKQ.js} +31 -113
- package/dist/chunk-UDJOIVKQ.js.map +1 -0
- package/dist/{chunk-RJEUQ7RL.js → chunk-ULCACQSA.js} +47 -90
- package/dist/chunk-ULCACQSA.js.map +1 -0
- package/dist/{chunk-HP7WUZPK.js → chunk-WIUGPZOH.js} +10 -3
- package/dist/chunk-WIUGPZOH.js.map +1 -0
- package/dist/{chunk-JTU7OBYJ.js → chunk-YL5KD5RC.js} +4 -3
- package/dist/chunk-YL5KD5RC.js.map +1 -0
- package/dist/data-grid.d.ts +25 -6
- package/dist/data-grid.js +180 -58
- package/dist/data-grid.js.map +1 -1
- package/dist/editor-mentions.js +4 -5
- package/dist/editor-mentions.js.map +1 -1
- package/dist/editor.js +11 -8
- package/dist/editor.js.map +1 -1
- package/dist/{feather-FNBQ74RR.js → feather-XFFEFLTV.js} +5 -3
- package/dist/feather-XFFEFLTV.js.map +1 -0
- package/dist/{heroicons-DODCSYWD.js → heroicons-L6DOHBEA.js} +5 -3
- package/dist/heroicons-L6DOHBEA.js.map +1 -0
- package/dist/icons.d.ts +1 -1
- package/dist/icons.js +1 -1
- package/dist/index.d.ts +138 -39
- package/dist/index.js +846 -1667
- package/dist/index.js.map +1 -1
- package/dist/kanban.d.ts +26 -8
- package/dist/kanban.js +204 -79
- package/dist/kanban.js.map +1 -1
- package/dist/{lucide-ZWE3EPGP.js → lucide-JOORDTO6.js} +5 -3
- package/dist/lucide-JOORDTO6.js.map +1 -0
- package/dist/{phosphor-DIHPA4AJ.js → phosphor-TKGDYNGR.js} +5 -3
- package/dist/phosphor-TKGDYNGR.js.map +1 -0
- package/dist/resizable.js +47 -16
- package/dist/resizable.js.map +1 -1
- package/dist/roots.css +12 -8
- package/dist/{table-utils-CxnpFHRF.d.ts → table-utils-BXkP-2Hx.d.ts} +3 -1
- package/dist/{tabler-D3VYTSGI.js → tabler-YGETLYRU.js} +5 -3
- package/dist/tabler-YGETLYRU.js.map +1 -0
- package/dist/tokens.css +14 -0
- package/dist/utils.js.map +1 -1
- package/dist/virtualized.d.ts +6 -1
- package/dist/virtualized.js +17 -13
- package/dist/virtualized.js.map +1 -1
- package/dist-static/tokens.css +14 -0
- package/package.json +1 -1
- package/dist/chunk-37WOC7F7.js.map +0 -1
- package/dist/chunk-4TUJXDRU.js.map +0 -1
- package/dist/chunk-6A5RHW2W.js.map +0 -1
- package/dist/chunk-FD4YED7O.js.map +0 -1
- package/dist/chunk-FUKSLQ77.js.map +0 -1
- package/dist/chunk-HP7WUZPK.js.map +0 -1
- package/dist/chunk-JTU7OBYJ.js.map +0 -1
- package/dist/chunk-MFAWJSMJ.js.map +0 -1
- package/dist/chunk-MKFWHWBK.js.map +0 -1
- package/dist/chunk-OYNUU346.js.map +0 -1
- package/dist/chunk-QM4SJKWV.js +0 -51
- package/dist/chunk-QM4SJKWV.js.map +0 -1
- package/dist/chunk-QNHVPE2B.js +0 -117
- package/dist/chunk-QNHVPE2B.js.map +0 -1
- package/dist/chunk-RECCCA7Z.js.map +0 -1
- package/dist/chunk-RJEUQ7RL.js.map +0 -1
- package/dist/chunk-WH2FUFAC.js +0 -15
- package/dist/chunk-WH2FUFAC.js.map +0 -1
- package/dist/chunk-ZI3OQDET.js.map +0 -1
- package/dist/feather-FNBQ74RR.js.map +0 -1
- package/dist/heroicons-DODCSYWD.js.map +0 -1
- package/dist/lucide-ZWE3EPGP.js.map +0 -1
- package/dist/phosphor-DIHPA4AJ.js.map +0 -1
- package/dist/tabler-D3VYTSGI.js.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { useShellPreferences, PREFERENCE_HOUSE_DEFAULTS } from './chunk-TYNDXMBV.js';
|
|
3
3
|
import { useInputModality } from './chunk-7RKC5C7G.js';
|
|
4
4
|
import { useReportedChange, useOptionalFormContext, FormChangeCtx } from './chunk-72SDAX54.js';
|
|
5
|
-
import { RowsCtx } from './chunk-
|
|
5
|
+
import { ControlSizeContext, triggerType, RowsCtx, Button } from './chunk-ULCACQSA.js';
|
|
6
6
|
import { useRevealFocus } from './chunk-HTXP5BMM.js';
|
|
7
|
-
import { usePopupFocus, focusAfterRemoval, usePressMarks, focusInitial } from './chunk-
|
|
8
|
-
import { useTextOverflow
|
|
7
|
+
import { useFocusLeave, usePopupFocus, focusAfterRemoval, usePressMarks, focusInitial, focusAfterSelfRemoval } from './chunk-R5QXMNW7.js';
|
|
8
|
+
import { useTextOverflow } from './chunk-IELIF4PJ.js';
|
|
9
|
+
import { AutoTooltip } from './chunk-UDJOIVKQ.js';
|
|
10
|
+
import { Icon, warnOnce } from './chunk-L6HWACK7.js';
|
|
9
11
|
import { Slot } from './chunk-7Q46JXSK.js';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { useLatest } from './chunk-WH2FUFAC.js';
|
|
13
|
-
import { cn, ERROR_HAS_FOCUS_RING, FIELD_HAS_FOCUS_RING, ERROR_FOCUS_RING, FIELD_FOCUS_RING, FOCUS_RING, ERROR_ACTIVE_RING, ACTIVE_RING, ERROR_FOCUS_WITHIN_RING, FIELD_FOCUS_WITHIN_RING, GLASS_DROPDOWN } from './chunk-JTU7OBYJ.js';
|
|
12
|
+
import { useLatest, usePosition } from './chunk-WIUGPZOH.js';
|
|
13
|
+
import { cn, ERROR_HAS_FOCUS_RING, FIELD_HAS_FOCUS_RING, ERROR_FOCUS_RING, FIELD_FOCUS_RING, FOCUS_RING, ERROR_ACTIVE_RING, ACTIVE_RING, ERROR_FOCUS_WITHIN_RING, FIELD_FOCUS_WITHIN_RING, GLASS_DROPDOWN } from './chunk-YL5KD5RC.js';
|
|
14
14
|
import { createContext, useContext, useRef, useCallback, useEffect, useId, useState, Children, isValidElement, useMemo, cloneElement, useLayoutEffect } from 'react';
|
|
15
15
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
16
16
|
import { createPortal } from 'react-dom';
|
|
@@ -281,6 +281,7 @@ function useFieldControl(own, options = {}) {
|
|
|
281
281
|
const ids = [own["aria-describedby"], field?.describedBy, noteId].filter(Boolean).join(" ").split(/\s+/).filter(Boolean);
|
|
282
282
|
return {
|
|
283
283
|
id,
|
|
284
|
+
label: own["aria-label"],
|
|
284
285
|
labelId: own["aria-labelledby"] ?? field?.labelId,
|
|
285
286
|
describedBy: [...new Set(ids)].join(" ") || void 0,
|
|
286
287
|
invalid,
|
|
@@ -303,40 +304,26 @@ function Field({ label, children, hint, error, required, labelAction, hideLabel
|
|
|
303
304
|
const child = typeof children === "function" ? null : Children.only(children);
|
|
304
305
|
const childProps = child && isValidElement(child) ? child.props : null;
|
|
305
306
|
const latest = useLatest({ validate, childProps, id, mode, left, showing: !!checkError, form });
|
|
306
|
-
const check =
|
|
307
|
+
const check = () => {
|
|
307
308
|
const { validate: fn, childProps: props, id: controlId } = latest.current;
|
|
308
309
|
if (!fn) return void 0;
|
|
309
310
|
const value = props && "value" in props ? props.value : props && "checked" in props ? props.checked : document.getElementById(controlId)?.value;
|
|
310
311
|
const message = fn(value);
|
|
311
312
|
return typeof message === "string" && message.length > 0 ? message : void 0;
|
|
312
|
-
}
|
|
313
|
-
const show =
|
|
313
|
+
};
|
|
314
|
+
const show = (message) => {
|
|
314
315
|
const { form: f, id: controlId } = latest.current;
|
|
315
316
|
if (f) f.setError(controlId, message);
|
|
316
317
|
else setLocalError(message);
|
|
317
|
-
}
|
|
318
|
+
};
|
|
318
319
|
const register = form?.register;
|
|
319
320
|
const checks = !!validate;
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
if (leaving.current) {
|
|
327
|
-
clearTimeout(leaving.current);
|
|
328
|
-
leaving.current = null;
|
|
329
|
-
}
|
|
330
|
-
};
|
|
331
|
-
const onBlurCapture = () => {
|
|
332
|
-
if (!validate) return;
|
|
333
|
-
if (leaving.current) clearTimeout(leaving.current);
|
|
334
|
-
leaving.current = setTimeout(() => {
|
|
335
|
-
leaving.current = null;
|
|
336
|
-
setLeft(true);
|
|
337
|
-
if (latest.current.mode !== "onSubmit" || latest.current.showing) show(check());
|
|
338
|
-
}, 0);
|
|
339
|
-
};
|
|
321
|
+
const checkNow = useLatest(check);
|
|
322
|
+
useEffect(() => register && checks ? register(id, () => checkNow.current()) : void 0, [register, checks, id, checkNow]);
|
|
323
|
+
const leave = useFocusLeave(() => {
|
|
324
|
+
setLeft(true);
|
|
325
|
+
if (latest.current.mode !== "onSubmit" || latest.current.showing) show(check());
|
|
326
|
+
});
|
|
340
327
|
const recheck = () => {
|
|
341
328
|
if (!validate) return;
|
|
342
329
|
setTimeout(() => {
|
|
@@ -379,7 +366,7 @@ function Field({ label, children, hint, error, required, labelAction, hideLabel
|
|
|
379
366
|
"div",
|
|
380
367
|
{
|
|
381
368
|
className: cn("flex flex-col gap-ds-1.5 max-w-[var(--ds-form-max,none)]", className),
|
|
382
|
-
...validate ? {
|
|
369
|
+
...validate ? { ...leave, onInputCapture: recheck } : {},
|
|
383
370
|
children: [
|
|
384
371
|
hideLabel && !labelAction ? labelNode : /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-ds-2", children: [
|
|
385
372
|
labelNode,
|
|
@@ -424,6 +411,7 @@ function Dropdown({
|
|
|
424
411
|
const triggerId = control.id ?? generatedId;
|
|
425
412
|
const labelSpanId = `${triggerId}-label`;
|
|
426
413
|
const labelledBy = control.labelId ? `${control.labelId} ${triggerId}` : label && !ariaLabel ? `${labelSpanId} ${triggerId}` : void 0;
|
|
414
|
+
const listLabelledBy = control.labelId ?? (label && !ariaLabel ? labelSpanId : void 0);
|
|
427
415
|
const invalid = control.invalid;
|
|
428
416
|
const size = sizeProp ?? contextSize ?? "md";
|
|
429
417
|
const [open, setOpen] = useState(false);
|
|
@@ -571,6 +559,8 @@ function Dropdown({
|
|
|
571
559
|
groups.get(g).push(opt);
|
|
572
560
|
}
|
|
573
561
|
const hasGroups = Array.from(groups.keys()).some((k) => k !== "");
|
|
562
|
+
const drawn = hasGroups ? Array.from(groups.values()).flat() : filtered;
|
|
563
|
+
const stopId = (drawn.find((o) => selectedValues.includes(o.id)) ?? drawn[0])?.id;
|
|
574
564
|
const handleSelect = (id) => {
|
|
575
565
|
if (multiple) {
|
|
576
566
|
const arr = selectedValues.includes(id) ? selectedValues.filter((v) => v !== id) : [...selectedValues, id];
|
|
@@ -667,12 +657,13 @@ function Dropdown({
|
|
|
667
657
|
className: cn("w-full bg-transparent text-[var(--ds-text-primary)] placeholder:text-[var(--ds-text-muted)] outline-none", size === "sm" ? "text-xs" : "text-sm")
|
|
668
658
|
}
|
|
669
659
|
) }),
|
|
670
|
-
/* @__PURE__ */ jsx("div", { ref: setListbox, role: "listbox", className: "overflow-y-auto scroll-p-[4px]", style: { padding: "max(var(--ds-space-1), 4px)", maxHeight: "var(--ds-dropdown-max-height)" }, children: filtered.length === 0 ? /* @__PURE__ */ jsx("p", { className: cn("text-[var(--ds-text-muted)] text-center py-ds-4", size === "sm" ? "text-xs" : "text-sm"), children: "No options found" }) : hasGroups ? Array.from(groups.entries()).map(([group, opts]) => /* @__PURE__ */ jsxs("div", { children: [
|
|
660
|
+
/* @__PURE__ */ jsx("div", { ref: setListbox, role: "listbox", "aria-labelledby": listLabelledBy, "aria-label": listLabelledBy ? void 0 : ariaLabel, "aria-multiselectable": multiple || void 0, className: "overflow-y-auto scroll-p-[4px]", style: { padding: "max(var(--ds-space-1), 4px)", maxHeight: "var(--ds-dropdown-max-height)" }, children: filtered.length === 0 ? /* @__PURE__ */ jsx("p", { className: cn("text-[var(--ds-text-muted)] text-center py-ds-4", size === "sm" ? "text-xs" : "text-sm"), children: "No options found" }) : hasGroups ? Array.from(groups.entries()).map(([group, opts]) => /* @__PURE__ */ jsxs("div", { children: [
|
|
671
661
|
group && /* @__PURE__ */ jsx("p", { className: "text-2xs font-medium uppercase tracking-wider text-[var(--ds-text-muted)] px-ds-2 pt-ds-2 pb-ds-1", children: group }),
|
|
672
662
|
opts.map((opt) => /* @__PURE__ */ jsx(
|
|
673
663
|
OptionButton,
|
|
674
664
|
{
|
|
675
665
|
opt,
|
|
666
|
+
tabStop: opt.id === stopId,
|
|
676
667
|
isSelected: selectedValues.includes(opt.id),
|
|
677
668
|
multiple,
|
|
678
669
|
onSelect: handleSelect,
|
|
@@ -684,6 +675,7 @@ function Dropdown({
|
|
|
684
675
|
OptionButton,
|
|
685
676
|
{
|
|
686
677
|
opt,
|
|
678
|
+
tabStop: opt.id === stopId,
|
|
687
679
|
isSelected: selectedValues.includes(opt.id),
|
|
688
680
|
multiple,
|
|
689
681
|
onSelect: handleSelect,
|
|
@@ -704,7 +696,7 @@ function Dropdown({
|
|
|
704
696
|
className: "inline-flex items-center gap-ds-1 text-xs rounded-[var(--ds-radius-sm)] bg-[var(--ds-bg-muted)] text-[var(--ds-text-secondary)] px-ds-1.5 py-ds-0.5",
|
|
705
697
|
children: [
|
|
706
698
|
opt.label,
|
|
707
|
-
/* @__PURE__ */ jsx(
|
|
699
|
+
/* @__PURE__ */ jsx(AutoTooltip, { content: `Remove ${opt.label}`, children: /* @__PURE__ */ jsx(
|
|
708
700
|
"button",
|
|
709
701
|
{
|
|
710
702
|
type: "button",
|
|
@@ -717,7 +709,7 @@ function Dropdown({
|
|
|
717
709
|
"aria-label": `Remove ${opt.label}`,
|
|
718
710
|
children: /* @__PURE__ */ jsx(Icon, { name: "close", size: 10 })
|
|
719
711
|
}
|
|
720
|
-
)
|
|
712
|
+
) })
|
|
721
713
|
]
|
|
722
714
|
},
|
|
723
715
|
v
|
|
@@ -727,6 +719,7 @@ function Dropdown({
|
|
|
727
719
|
}
|
|
728
720
|
function OptionButton({
|
|
729
721
|
opt,
|
|
722
|
+
tabStop,
|
|
730
723
|
isSelected,
|
|
731
724
|
multiple,
|
|
732
725
|
onSelect,
|
|
@@ -739,7 +732,7 @@ function OptionButton({
|
|
|
739
732
|
role: "option",
|
|
740
733
|
"data-option-id": opt.id,
|
|
741
734
|
"aria-selected": isSelected,
|
|
742
|
-
tabIndex: -1,
|
|
735
|
+
tabIndex: tabStop ? 0 : -1,
|
|
743
736
|
onClick: () => onSelect(opt.id),
|
|
744
737
|
className: cn(
|
|
745
738
|
"w-full text-left cursor-pointer rounded-[var(--ds-radius-sm)]",
|
|
@@ -785,7 +778,8 @@ function NumberInput({
|
|
|
785
778
|
className,
|
|
786
779
|
error = false,
|
|
787
780
|
allowDecimals,
|
|
788
|
-
id
|
|
781
|
+
id,
|
|
782
|
+
"aria-label": ariaLabel
|
|
789
783
|
}) {
|
|
790
784
|
const onChange = useReportedChange(onChangeProp, value);
|
|
791
785
|
useInputModality();
|
|
@@ -872,12 +866,23 @@ function NumberInput({
|
|
|
872
866
|
e.preventDefault();
|
|
873
867
|
decrement();
|
|
874
868
|
}
|
|
869
|
+
const plain = !e.shiftKey && !e.ctrlKey && !e.metaKey && !e.altKey;
|
|
870
|
+
if (e.key === "Home" && plain && Number.isFinite(min)) {
|
|
871
|
+
e.preventDefault();
|
|
872
|
+
commitValue(min);
|
|
873
|
+
}
|
|
874
|
+
if (e.key === "End" && plain && Number.isFinite(max)) {
|
|
875
|
+
e.preventDefault();
|
|
876
|
+
commitValue(max);
|
|
877
|
+
}
|
|
875
878
|
},
|
|
876
|
-
[increment, decrement]
|
|
879
|
+
[increment, decrement, commitValue, min, max]
|
|
877
880
|
);
|
|
878
881
|
const s = sizes[size];
|
|
879
882
|
const atMin = value <= min;
|
|
880
883
|
const atMax = value >= max;
|
|
884
|
+
const shown = focused ? draft : String(value);
|
|
885
|
+
const holdsNumber = Number.isFinite(parseFloat(shown)) && Number.isFinite(value);
|
|
881
886
|
return /* @__PURE__ */ jsxs(
|
|
882
887
|
"div",
|
|
883
888
|
{
|
|
@@ -934,9 +939,14 @@ function NumberInput({
|
|
|
934
939
|
ref: inputRef,
|
|
935
940
|
id,
|
|
936
941
|
type: "text",
|
|
942
|
+
role: "spinbutton",
|
|
943
|
+
"aria-label": ariaLabel,
|
|
944
|
+
"aria-valuenow": holdsNumber ? value : void 0,
|
|
945
|
+
"aria-valuemin": Number.isFinite(min) ? min : void 0,
|
|
946
|
+
"aria-valuemax": Number.isFinite(max) ? max : void 0,
|
|
937
947
|
inputMode: decimals ? "decimal" : "numeric",
|
|
938
948
|
"aria-invalid": error || void 0,
|
|
939
|
-
value:
|
|
949
|
+
value: shown,
|
|
940
950
|
onChange: handleInput,
|
|
941
951
|
onFocus: handleFocus,
|
|
942
952
|
onBlur: handleBlur,
|
|
@@ -1094,11 +1104,13 @@ function contentTop(el) {
|
|
|
1094
1104
|
}
|
|
1095
1105
|
function LoadMore({ hasMore, onLoadMore, loadMoreLabel, currentPage, scroll, className }) {
|
|
1096
1106
|
const marker = useRef(null);
|
|
1107
|
+
const button = useRef(null);
|
|
1097
1108
|
const load = useLatest(onLoadMore);
|
|
1098
1109
|
const loadedAt = useRef(null);
|
|
1110
|
+
const [held, setHeld] = useState(false);
|
|
1099
1111
|
useEffect(() => {
|
|
1100
1112
|
const el = marker.current;
|
|
1101
|
-
if (!scroll || !hasMore || !el || typeof IntersectionObserver === "undefined") return;
|
|
1113
|
+
if (!scroll || !hasMore || !el || held || typeof IntersectionObserver === "undefined") return;
|
|
1102
1114
|
const observer = new IntersectionObserver((entries) => {
|
|
1103
1115
|
if (!entries.some((e) => e.isIntersecting)) return;
|
|
1104
1116
|
const at = contentTop(el);
|
|
@@ -1115,13 +1127,35 @@ function LoadMore({ hasMore, onLoadMore, loadMoreLabel, currentPage, scroll, cla
|
|
|
1115
1127
|
observer.disconnect();
|
|
1116
1128
|
window.removeEventListener("scroll", rearm, { capture: true });
|
|
1117
1129
|
};
|
|
1118
|
-
}, [scroll, hasMore, currentPage, load]);
|
|
1130
|
+
}, [scroll, hasMore, currentPage, load, held]);
|
|
1131
|
+
useEffect(() => {
|
|
1132
|
+
const b = button.current;
|
|
1133
|
+
if (b && document.activeElement === b) b.scrollIntoView?.({ block: "nearest" });
|
|
1134
|
+
}, [currentPage]);
|
|
1119
1135
|
if (!hasMore) return null;
|
|
1120
1136
|
return /* @__PURE__ */ jsxs("div", { "data-ds-pager": "", "data-pagination-mode": scroll ? "infinite-scroll" : "load-more", className: cn("flex flex-col items-center", className), children: [
|
|
1121
1137
|
scroll && /* @__PURE__ */ jsx("div", { ref: marker, "data-load-more-trigger": "", "aria-hidden": "true", className: "h-px w-full" }),
|
|
1122
|
-
/* @__PURE__ */ jsx(
|
|
1138
|
+
/* @__PURE__ */ jsx(
|
|
1139
|
+
Button,
|
|
1140
|
+
{
|
|
1141
|
+
ref: button,
|
|
1142
|
+
type: "button",
|
|
1143
|
+
variant: "secondary",
|
|
1144
|
+
onClick: onLoadMore,
|
|
1145
|
+
onFocus: (e) => setHeld(scroll && byKeyboard(e.currentTarget)),
|
|
1146
|
+
onBlur: () => setHeld(false),
|
|
1147
|
+
children: loadMoreLabel ?? "Load more"
|
|
1148
|
+
}
|
|
1149
|
+
)
|
|
1123
1150
|
] });
|
|
1124
1151
|
}
|
|
1152
|
+
function byKeyboard(el) {
|
|
1153
|
+
try {
|
|
1154
|
+
return el.matches(":focus-visible");
|
|
1155
|
+
} catch {
|
|
1156
|
+
return true;
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1125
1159
|
function PageNumbers({ currentPage, totalPages, onPageChange, pageSize: pageSizeProp, pageSizeOptions, onPageSizeChange, className }) {
|
|
1126
1160
|
const pages = buildPageRange(currentPage, totalPages);
|
|
1127
1161
|
const preferences = useShellPreferences();
|
|
@@ -1144,11 +1178,14 @@ function PageNumbers({ currentPage, totalPages, onPageChange, pageSize: pageSize
|
|
|
1144
1178
|
) })
|
|
1145
1179
|
] }),
|
|
1146
1180
|
totalPages > 1 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-ds-1", children: [
|
|
1147
|
-
/* @__PURE__ */ jsx(
|
|
1181
|
+
/* @__PURE__ */ jsx(AutoTooltip, { content: "Previous page", children: /* @__PURE__ */ jsx(
|
|
1148
1182
|
"button",
|
|
1149
1183
|
{
|
|
1150
1184
|
type: "button",
|
|
1151
|
-
onClick: () =>
|
|
1185
|
+
onClick: (e) => {
|
|
1186
|
+
focusAfterSelfRemoval(e.currentTarget);
|
|
1187
|
+
onPageChange(currentPage - 1);
|
|
1188
|
+
},
|
|
1152
1189
|
disabled: currentPage <= 1,
|
|
1153
1190
|
"aria-label": "Previous page",
|
|
1154
1191
|
className: cn(
|
|
@@ -1163,7 +1200,7 @@ function PageNumbers({ currentPage, totalPages, onPageChange, pageSize: pageSize
|
|
|
1163
1200
|
),
|
|
1164
1201
|
children: /* @__PURE__ */ jsx(Icon, { name: "chevron-right", size: 16, className: "rotate-180" })
|
|
1165
1202
|
}
|
|
1166
|
-
),
|
|
1203
|
+
) }),
|
|
1167
1204
|
pages.map(
|
|
1168
1205
|
(p, i) => p === "..." ? /* @__PURE__ */ jsx(EllipsisJumper, { totalPages, onPageChange }, `ellipsis-${i}`) : /* @__PURE__ */ jsx(
|
|
1169
1206
|
"button",
|
|
@@ -1184,11 +1221,14 @@ function PageNumbers({ currentPage, totalPages, onPageChange, pageSize: pageSize
|
|
|
1184
1221
|
p
|
|
1185
1222
|
)
|
|
1186
1223
|
),
|
|
1187
|
-
/* @__PURE__ */ jsx(
|
|
1224
|
+
/* @__PURE__ */ jsx(AutoTooltip, { content: "Next page", children: /* @__PURE__ */ jsx(
|
|
1188
1225
|
"button",
|
|
1189
1226
|
{
|
|
1190
1227
|
type: "button",
|
|
1191
|
-
onClick: () =>
|
|
1228
|
+
onClick: (e) => {
|
|
1229
|
+
focusAfterSelfRemoval(e.currentTarget);
|
|
1230
|
+
onPageChange(currentPage + 1);
|
|
1231
|
+
},
|
|
1192
1232
|
disabled: currentPage >= totalPages,
|
|
1193
1233
|
"aria-label": "Next page",
|
|
1194
1234
|
className: cn(
|
|
@@ -1203,7 +1243,7 @@ function PageNumbers({ currentPage, totalPages, onPageChange, pageSize: pageSize
|
|
|
1203
1243
|
),
|
|
1204
1244
|
children: /* @__PURE__ */ jsx(Icon, { name: "chevron-right", size: 16 })
|
|
1205
1245
|
}
|
|
1206
|
-
)
|
|
1246
|
+
) })
|
|
1207
1247
|
] })
|
|
1208
1248
|
] });
|
|
1209
1249
|
}
|
|
@@ -1370,5 +1410,5 @@ function useWholeListCheck(component, length, pager) {
|
|
|
1370
1410
|
}
|
|
1371
1411
|
|
|
1372
1412
|
export { AddAnotherRowCtx, CHECK_FILL, Dropdown, Field, FilterRowContext, InlineFieldError, Input, Label, NumberInput, OutsideField, Pagination, Popover, SWITCH_KNOB_MOTION, SWITCH_KNOB_OFF, SWITCH_KNOB_ON, SWITCH_TRACK_OFF, SWITCH_TRACK_ON, Textarea, Toggle, pagerPart, useField, useFieldControl, usePagination, useWholeListCheck };
|
|
1373
|
-
//# sourceMappingURL=chunk-
|
|
1374
|
-
//# sourceMappingURL=chunk-
|
|
1413
|
+
//# sourceMappingURL=chunk-SLRTSBCJ.js.map
|
|
1414
|
+
//# sourceMappingURL=chunk-SLRTSBCJ.js.map
|