@orbitcommerce/constellation 1.2.0 → 1.2.2
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 +30 -0
- package/dist/index.cjs +1419 -1273
- package/dist/index.d.cts +16 -5
- package/dist/index.d.ts +16 -5
- package/dist/modules/charts/BarChart.js +8 -2
- package/dist/modules/chunks/{chunk-BQPZL3XZ.js → chunk-5AJJKEPJ.js} +1 -1
- package/dist/modules/chunks/{chunk-IAI6LBP7.js → chunk-IJ34OAQ4.js} +1 -1
- package/dist/modules/chunks/{chunk-26BBBTBT.js → chunk-NYXMCKSQ.js} +15 -3
- package/dist/modules/chunks/{chunk-4FC4UJJ4.js → chunk-PKANW3SX.js} +1 -1
- package/dist/modules/chunks/{chunk-YZB2D4AP.js → chunk-T4URSDXR.js} +2 -2
- package/dist/modules/chunks/{chunk-2NOGHGEU.js → chunk-T5XBIQ5C.js} +97 -5
- package/dist/modules/chunks/{chunk-G7576I2R.js → chunk-T7Y6VU4F.js} +1 -1
- package/dist/modules/chunks/{chunk-LXZEAWTG.js → chunk-WAVDSHPC.js} +4 -2
- package/dist/modules/chunks/{chunk-QOYDJQTO.js → chunk-XGKIOBY6.js} +1 -1
- package/dist/modules/chunks/{chunk-MSWXH7V3.js → chunk-YCS3IVCC.js} +21 -0
- package/dist/modules/components/AddressBlock.js +12 -3
- package/dist/modules/components/AddressFields.js +3 -3
- package/dist/modules/components/ColorField.js +2 -2
- package/dist/modules/components/Combobox.js +2 -2
- package/dist/modules/components/ConditionBuilder.js +3 -3
- package/dist/modules/components/FigureStrip.js +1 -1
- package/dist/modules/components/FigureTabs.js +1 -1
- package/dist/modules/components/GradientEditor.js +3 -3
- package/dist/modules/components/MarkdownField.js +1 -1
- package/dist/modules/components/NumberInput.js +1 -1
- package/dist/modules/components/PlanComparison.js +1 -1
- package/dist/modules/components/PlanGrid.js +1 -1
- package/dist/modules/components/RadiusControl.js +2 -2
- package/dist/modules/components/RichTextEditor.js +2 -2
- package/dist/modules/components/SectionRail.js +6 -2
- package/dist/modules/components/SettingRow.js +3 -3
- package/dist/modules/components/SkeletonRow.js +1 -1
- package/dist/modules/components/SpacingBox.js +2 -2
- package/dist/modules/components/Table.js +1 -1
- package/dist/modules/components/TableReorder.js +1 -1
- package/dist/modules/components/Tabs.js +1 -1
- package/dist/modules/components/TimeZoneSelect.js +3 -3
- package/dist/modules/components/TreeSelect.js +2 -2
- package/dist/modules/components/UnitInput.js +2 -2
- package/dist/modules/components/ValueChange.js +1 -1
- package/dist/modules/components/WeeklyHours.js +3 -3
- package/dist/styles/components/address-block.css +10 -0
- package/dist/styles/components/card.css +2 -0
- package/dist/styles/components/color-field.css +4 -1
- package/dist/styles/components/figure-strip.css +14 -0
- package/dist/styles/components/plan-grid.css +8 -0
- package/dist/styles/components/radio-group.css +40 -0
- package/dist/styles/components/table.css +6 -21
- package/dist/styles/components/tabs.css +4 -0
- package/dist/styles.css +88 -22
- package/package.json +11 -11
package/dist/index.d.cts
CHANGED
|
@@ -2278,8 +2278,9 @@ interface TableFrameProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
2278
2278
|
}
|
|
2279
2279
|
/**
|
|
2280
2280
|
* The hairline frame a table sits in, with its own scroll area. `ref` goes to the scroll area (virtual rows need it).
|
|
2281
|
-
* While the table is wider than the frame, a soft shadow shows on each edge that has columns beyond it
|
|
2282
|
-
*
|
|
2281
|
+
* While the table is wider than the frame, a soft shadow shows on each edge that has columns beyond it: the end edge
|
|
2282
|
+
* while there are columns past it, the start edge once the table has left its start (the viewport carries
|
|
2283
|
+
* `data-scroll-end` and `data-scroll-start` while it can scroll that way).
|
|
2283
2284
|
*/
|
|
2284
2285
|
declare const TableFrame: react.ForwardRefExoticComponent<TableFrameProps & react.RefAttributes<HTMLDivElement>>;
|
|
2285
2286
|
interface TableProps extends TableHTMLAttributes<HTMLTableElement> {
|
|
@@ -4922,6 +4923,8 @@ interface FigureStripItem {
|
|
|
4922
4923
|
trendLoading?: boolean;
|
|
4923
4924
|
/** Nothing to show here (a zero, no data yet): the figure goes quiet instead of reading as news. */
|
|
4924
4925
|
quiet?: boolean;
|
|
4926
|
+
/** `text` sets a value that is words ("No closed deals yet") in body type, wrapping, where a figure's face would dwarf the numbers beside it. Default `figure`. */
|
|
4927
|
+
valueType?: 'figure' | 'text';
|
|
4925
4928
|
/** Colours the figure. For the one that needs chasing (`warning`), never decoration: figures stay ink. */
|
|
4926
4929
|
tone?: BadgeTone;
|
|
4927
4930
|
/** A dot beside the label, tying the figure to a series or a column. A tone name, or a CSS colour. */
|
|
@@ -4955,6 +4958,7 @@ interface FigureStripLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
|
4955
4958
|
'data-link': '';
|
|
4956
4959
|
'data-tone'?: BadgeTone;
|
|
4957
4960
|
'data-quiet'?: '';
|
|
4961
|
+
'data-value'?: 'text';
|
|
4958
4962
|
/** The cell has a trend after its figure. */
|
|
4959
4963
|
'data-trend'?: '';
|
|
4960
4964
|
}
|
|
@@ -7481,6 +7485,8 @@ interface RichTextEditorInstance {
|
|
|
7481
7485
|
on(event: 'transaction' | 'focus' | 'blur', callback: () => void): unknown;
|
|
7482
7486
|
off(event: 'transaction' | 'focus' | 'blur', callback: () => void): unknown;
|
|
7483
7487
|
readonly storage?: Record<string, unknown>;
|
|
7488
|
+
/** Cleared (null) by TipTap once the editor is destroyed; its text is not read then, as getText would throw. */
|
|
7489
|
+
readonly schema?: unknown;
|
|
7484
7490
|
/**
|
|
7485
7491
|
* Read for an empty selection, where the link tool inserts the destination's name as linked text, and for where a
|
|
7486
7492
|
* selected image is (`from`).
|
|
@@ -14994,7 +15000,8 @@ interface AddressBlockProps extends Omit<HTMLAttributes<HTMLDivElement>, 'childr
|
|
|
14994
15000
|
/** A quiet label above it: "Shipping address", "Deliver to". */
|
|
14995
15001
|
label?: ReactNode;
|
|
14996
15002
|
/**
|
|
14997
|
-
* `lines` (default): the address as lines, the addressee first in ink at 500, as an order and a customer show it
|
|
15003
|
+
* `lines` (default): the address as lines, the addressee first in ink at 500, as an order and a customer show it,
|
|
15004
|
+
* then the phone as a tel link and the email as a mailto link.
|
|
14998
15005
|
* `contact`: icon-led lines, a booking's: the email as a mailto link, the phone as a tel link, then the address.
|
|
14999
15006
|
*/
|
|
15000
15007
|
variant?: AddressBlockVariant;
|
|
@@ -15002,7 +15009,11 @@ interface AddressBlockProps extends Omit<HTMLAttributes<HTMLDivElement>, 'childr
|
|
|
15002
15009
|
size?: AddressBlockSize;
|
|
15003
15010
|
/** An email to show (the `contact` variant draws it first, as a mailto link). */
|
|
15004
15011
|
email?: string | null;
|
|
15005
|
-
/**
|
|
15012
|
+
/**
|
|
15013
|
+
* A phone to show, as a tap-to-call link: the last line of the address, or (in `contact`) an icon-led line. Defaults to the
|
|
15014
|
+
* address's own phone. The link dials the number as shown with its spaces, brackets and dashes taken out and a leading +
|
|
15015
|
+
* kept; a phone with no digits in it stays text.
|
|
15016
|
+
*/
|
|
15006
15017
|
phone?: string | null;
|
|
15007
15018
|
/** Shows the "Default shipping" badge. */
|
|
15008
15019
|
defaultShipping?: boolean;
|
|
@@ -15554,7 +15565,7 @@ interface PlanGridProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'>
|
|
|
15554
15565
|
onCurrencyChange?: (currency: string) => void;
|
|
15555
15566
|
/** The currency is set for the account and cannot change here. */
|
|
15556
15567
|
currencyDisabled?: boolean;
|
|
15557
|
-
/** One quiet line under every plan: "Prices exclude VAT, which is added at checkout." */
|
|
15568
|
+
/** One quiet line under every plan: "Prices exclude VAT, which is added at checkout." Words, or paragraphs of your own. */
|
|
15558
15569
|
footnote?: ReactNode;
|
|
15559
15570
|
/** Names the list of plans. */
|
|
15560
15571
|
'aria-label'?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -2278,8 +2278,9 @@ interface TableFrameProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
2278
2278
|
}
|
|
2279
2279
|
/**
|
|
2280
2280
|
* The hairline frame a table sits in, with its own scroll area. `ref` goes to the scroll area (virtual rows need it).
|
|
2281
|
-
* While the table is wider than the frame, a soft shadow shows on each edge that has columns beyond it
|
|
2282
|
-
*
|
|
2281
|
+
* While the table is wider than the frame, a soft shadow shows on each edge that has columns beyond it: the end edge
|
|
2282
|
+
* while there are columns past it, the start edge once the table has left its start (the viewport carries
|
|
2283
|
+
* `data-scroll-end` and `data-scroll-start` while it can scroll that way).
|
|
2283
2284
|
*/
|
|
2284
2285
|
declare const TableFrame: react.ForwardRefExoticComponent<TableFrameProps & react.RefAttributes<HTMLDivElement>>;
|
|
2285
2286
|
interface TableProps extends TableHTMLAttributes<HTMLTableElement> {
|
|
@@ -4922,6 +4923,8 @@ interface FigureStripItem {
|
|
|
4922
4923
|
trendLoading?: boolean;
|
|
4923
4924
|
/** Nothing to show here (a zero, no data yet): the figure goes quiet instead of reading as news. */
|
|
4924
4925
|
quiet?: boolean;
|
|
4926
|
+
/** `text` sets a value that is words ("No closed deals yet") in body type, wrapping, where a figure's face would dwarf the numbers beside it. Default `figure`. */
|
|
4927
|
+
valueType?: 'figure' | 'text';
|
|
4925
4928
|
/** Colours the figure. For the one that needs chasing (`warning`), never decoration: figures stay ink. */
|
|
4926
4929
|
tone?: BadgeTone;
|
|
4927
4930
|
/** A dot beside the label, tying the figure to a series or a column. A tone name, or a CSS colour. */
|
|
@@ -4955,6 +4958,7 @@ interface FigureStripLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
|
4955
4958
|
'data-link': '';
|
|
4956
4959
|
'data-tone'?: BadgeTone;
|
|
4957
4960
|
'data-quiet'?: '';
|
|
4961
|
+
'data-value'?: 'text';
|
|
4958
4962
|
/** The cell has a trend after its figure. */
|
|
4959
4963
|
'data-trend'?: '';
|
|
4960
4964
|
}
|
|
@@ -7481,6 +7485,8 @@ interface RichTextEditorInstance {
|
|
|
7481
7485
|
on(event: 'transaction' | 'focus' | 'blur', callback: () => void): unknown;
|
|
7482
7486
|
off(event: 'transaction' | 'focus' | 'blur', callback: () => void): unknown;
|
|
7483
7487
|
readonly storage?: Record<string, unknown>;
|
|
7488
|
+
/** Cleared (null) by TipTap once the editor is destroyed; its text is not read then, as getText would throw. */
|
|
7489
|
+
readonly schema?: unknown;
|
|
7484
7490
|
/**
|
|
7485
7491
|
* Read for an empty selection, where the link tool inserts the destination's name as linked text, and for where a
|
|
7486
7492
|
* selected image is (`from`).
|
|
@@ -14994,7 +15000,8 @@ interface AddressBlockProps extends Omit<HTMLAttributes<HTMLDivElement>, 'childr
|
|
|
14994
15000
|
/** A quiet label above it: "Shipping address", "Deliver to". */
|
|
14995
15001
|
label?: ReactNode;
|
|
14996
15002
|
/**
|
|
14997
|
-
* `lines` (default): the address as lines, the addressee first in ink at 500, as an order and a customer show it
|
|
15003
|
+
* `lines` (default): the address as lines, the addressee first in ink at 500, as an order and a customer show it,
|
|
15004
|
+
* then the phone as a tel link and the email as a mailto link.
|
|
14998
15005
|
* `contact`: icon-led lines, a booking's: the email as a mailto link, the phone as a tel link, then the address.
|
|
14999
15006
|
*/
|
|
15000
15007
|
variant?: AddressBlockVariant;
|
|
@@ -15002,7 +15009,11 @@ interface AddressBlockProps extends Omit<HTMLAttributes<HTMLDivElement>, 'childr
|
|
|
15002
15009
|
size?: AddressBlockSize;
|
|
15003
15010
|
/** An email to show (the `contact` variant draws it first, as a mailto link). */
|
|
15004
15011
|
email?: string | null;
|
|
15005
|
-
/**
|
|
15012
|
+
/**
|
|
15013
|
+
* A phone to show, as a tap-to-call link: the last line of the address, or (in `contact`) an icon-led line. Defaults to the
|
|
15014
|
+
* address's own phone. The link dials the number as shown with its spaces, brackets and dashes taken out and a leading +
|
|
15015
|
+
* kept; a phone with no digits in it stays text.
|
|
15016
|
+
*/
|
|
15006
15017
|
phone?: string | null;
|
|
15007
15018
|
/** Shows the "Default shipping" badge. */
|
|
15008
15019
|
defaultShipping?: boolean;
|
|
@@ -15554,7 +15565,7 @@ interface PlanGridProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'>
|
|
|
15554
15565
|
onCurrencyChange?: (currency: string) => void;
|
|
15555
15566
|
/** The currency is set for the account and cannot change here. */
|
|
15556
15567
|
currencyDisabled?: boolean;
|
|
15557
|
-
/** One quiet line under every plan: "Prices exclude VAT, which is added at checkout." */
|
|
15568
|
+
/** One quiet line under every plan: "Prices exclude VAT, which is added at checkout." Words, or paragraphs of your own. */
|
|
15558
15569
|
footnote?: ReactNode;
|
|
15559
15570
|
/** Names the list of plans. */
|
|
15560
15571
|
'aria-label'?: string;
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
TableHead,
|
|
24
24
|
TableHeaderCell,
|
|
25
25
|
TableRow
|
|
26
|
-
} from "../chunks/chunk-
|
|
26
|
+
} from "../chunks/chunk-T5XBIQ5C.js";
|
|
27
27
|
import "../chunks/chunk-EOTCMAM5.js";
|
|
28
28
|
import {
|
|
29
29
|
useKeepFocus
|
|
@@ -80,6 +80,8 @@ var MAX_BAR = 40;
|
|
|
80
80
|
var AXIS_OVERDRAW = 12;
|
|
81
81
|
var ROW = 32;
|
|
82
82
|
var LABEL_MIN = 44;
|
|
83
|
+
var LABEL_CHAR_W = 6;
|
|
84
|
+
var LABEL_GAP = 8;
|
|
83
85
|
var TILT_LINE = 11;
|
|
84
86
|
var TILT_BASE = 30;
|
|
85
87
|
var TILT_CHARS = 14;
|
|
@@ -308,7 +310,11 @@ var BarChart = forwardRef(function BarChart2({
|
|
|
308
310
|
};
|
|
309
311
|
const tiltDeg = tilted ? Math.min(90, Math.max(TILT_BASE, Math.asin(Math.min(1, TILT_LINE / Math.max(band, 1))) * 180 / Math.PI)) : 0;
|
|
310
312
|
const tiltRad = tiltDeg * Math.PI / 180;
|
|
311
|
-
const
|
|
313
|
+
const levelLabelRoom = Math.max(
|
|
314
|
+
LABEL_MIN,
|
|
315
|
+
Math.max(0, ...data.map((d) => Math.min(d.label.length, TILT_CHARS))) * LABEL_CHAR_W + LABEL_GAP
|
|
316
|
+
);
|
|
317
|
+
const labelStep = horizontal ? 1 : tilted ? Math.max(1, Math.ceil(TILT_LINE / Math.max(band, 1))) : Math.max(1, Math.ceil(levelLabelRoom / Math.max(band, 1)));
|
|
312
318
|
const tiltReach = tilted ? Math.min(TILT_MAX, Math.max(0, ...data.map((d) => Math.min(d.label.length, TILT_CHARS))) * 6.2) : 0;
|
|
313
319
|
const tiltRowH = tilted ? Math.max(56, Math.ceil(TILT_TOP + TILT_HALF + tiltReach * Math.sin(tiltRad) + TILT_HALF * Math.cos(tiltRad))) : 0;
|
|
314
320
|
const [lead, setLead] = useState(0);
|
|
@@ -6,6 +6,7 @@ var DETACH_BELOW = 280;
|
|
|
6
6
|
var PANEL_MAX_HEIGHT = 420;
|
|
7
7
|
var DEFAULT_RESERVE = 16;
|
|
8
8
|
var TOP_CLEARANCE = 104;
|
|
9
|
+
var MIN_ROOM_BELOW = 220;
|
|
9
10
|
function reserveBelow(el) {
|
|
10
11
|
const raw = getComputedStyle(el).getPropertyValue("--o-combobox-reserve").trim();
|
|
11
12
|
const px = /^\d*\.?\d+(px)?$/.test(raw) ? Number.parseFloat(raw) : Number.NaN;
|
|
@@ -31,6 +32,7 @@ function scrollParent(el) {
|
|
|
31
32
|
var reducedMotion = () => typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
32
33
|
function useComboboxPlacement(fieldRef, open, floating) {
|
|
33
34
|
const [narrow, setNarrow] = useState(false);
|
|
35
|
+
const [cramped, setCramped] = useState(false);
|
|
34
36
|
const [alignEnd, setAlignEnd] = useState(false);
|
|
35
37
|
const measureAlign = useCallback(() => {
|
|
36
38
|
const el = fieldRef.current;
|
|
@@ -50,17 +52,27 @@ function useComboboxPlacement(fieldRef, open, floating) {
|
|
|
50
52
|
return () => observer.disconnect();
|
|
51
53
|
}, [fieldRef, measureAlign]);
|
|
52
54
|
useEffect(() => {
|
|
55
|
+
if (!open) {
|
|
56
|
+
setCramped(false);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
53
59
|
const el = fieldRef.current;
|
|
54
|
-
if (!
|
|
60
|
+
if (!el) return;
|
|
55
61
|
const box = el.getBoundingClientRect();
|
|
56
62
|
const shortBy = box.bottom + PANEL_MAX_HEIGHT + reserveBelow(el) - window.innerHeight;
|
|
57
|
-
if (shortBy <= 0)
|
|
63
|
+
if (shortBy <= 0) {
|
|
64
|
+
setCramped(false);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
58
67
|
const scroller = scrollParent(el);
|
|
59
68
|
const frameTop = scroller ? scroller.getBoundingClientRect().top : 0;
|
|
60
69
|
const by = Math.min(shortBy, box.top - frameTop - TOP_CLEARANCE);
|
|
70
|
+
const reach = scroller ? scroller.scrollHeight - scroller.clientHeight - scroller.scrollTop : document.documentElement.scrollHeight - window.innerHeight - window.scrollY;
|
|
71
|
+
const moved = Math.min(Math.max(0, by), Math.max(0, reach));
|
|
72
|
+
setCramped(window.innerHeight - (box.bottom - moved) - reserveBelow(el) < MIN_ROOM_BELOW);
|
|
61
73
|
if (by > 0) (scroller ?? window).scrollBy?.({ top: by, behavior: reducedMotion() ? "auto" : "smooth" });
|
|
62
74
|
}, [open]);
|
|
63
|
-
const detached = floating || narrow;
|
|
75
|
+
const detached = floating || narrow || cramped;
|
|
64
76
|
return { detached, alignEnd: detached && alignEnd, measureAlign };
|
|
65
77
|
}
|
|
66
78
|
|
|
@@ -42,7 +42,7 @@ function normaliseValue(value) {
|
|
|
42
42
|
var DIGIT = /\p{Nd}/u;
|
|
43
43
|
function sanitise(text, locale, decimals, allowNegative) {
|
|
44
44
|
const { decimal, group } = localeSeparators(locale);
|
|
45
|
-
const
|
|
45
|
+
const wholeNumber = decimals === 0;
|
|
46
46
|
let kept = "";
|
|
47
47
|
for (const char of text) {
|
|
48
48
|
if (DIGIT.test(char)) {
|
|
@@ -50,7 +50,7 @@ function sanitise(text, locale, decimals, allowNegative) {
|
|
|
50
50
|
} else if (char === "-" || char === "\u2212") {
|
|
51
51
|
if (allowNegative) kept += char;
|
|
52
52
|
} else if (char === decimal || char === group || char === "," || char === "." || char === "\u066B" || char === "\u066C") {
|
|
53
|
-
if (!
|
|
53
|
+
if (!wholeNumber || char === decimal) kept += char;
|
|
54
54
|
} else if (/\s/.test(char)) {
|
|
55
55
|
kept += char;
|
|
56
56
|
}
|
|
@@ -31,6 +31,80 @@ import {
|
|
|
31
31
|
import { ArrowsInLineVerticalIcon } from "../icons/ArrowsInLineVerticalIcon.js";
|
|
32
32
|
import { ArrowsOutLineVerticalIcon } from "../icons/ArrowsOutLineVerticalIcon.js";
|
|
33
33
|
import { InfoIcon } from "../icons/InfoIcon.js";
|
|
34
|
+
|
|
35
|
+
// src/utils/scrollEdges.ts
|
|
36
|
+
function watchScrollEdges(scroller, target = scroller) {
|
|
37
|
+
let written;
|
|
38
|
+
const read = () => {
|
|
39
|
+
const offset = Math.abs(scroller.scrollLeft);
|
|
40
|
+
const room = scroller.scrollWidth - scroller.clientWidth;
|
|
41
|
+
const start = room > 1 && offset > 1;
|
|
42
|
+
const end = room > 1 && room - offset > 1;
|
|
43
|
+
if (start !== target.hasAttribute("data-scroll-start")) target.toggleAttribute("data-scroll-start", start);
|
|
44
|
+
if (end !== target.hasAttribute("data-scroll-end")) target.toggleAttribute("data-scroll-end", end);
|
|
45
|
+
const width = scroller.clientWidth;
|
|
46
|
+
if (width !== written) {
|
|
47
|
+
written = width;
|
|
48
|
+
target.style.setProperty("--o-scroll-inline", `${width}px`);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
read();
|
|
52
|
+
scroller.addEventListener("scroll", read, { passive: true });
|
|
53
|
+
const observed = /* @__PURE__ */ new Set();
|
|
54
|
+
let sizes;
|
|
55
|
+
const observe = (element) => {
|
|
56
|
+
if (!sizes || observed.has(element)) return;
|
|
57
|
+
observed.add(element);
|
|
58
|
+
sizes.observe(element);
|
|
59
|
+
};
|
|
60
|
+
const observeAll = () => {
|
|
61
|
+
observe(scroller);
|
|
62
|
+
for (const child of scroller.children) observe(child);
|
|
63
|
+
for (const table of scroller.querySelectorAll("table")) observe(table);
|
|
64
|
+
};
|
|
65
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
66
|
+
sizes = new ResizeObserver(read);
|
|
67
|
+
observeAll();
|
|
68
|
+
}
|
|
69
|
+
let mutations;
|
|
70
|
+
let cancelPending;
|
|
71
|
+
const refresh = () => {
|
|
72
|
+
cancelPending = void 0;
|
|
73
|
+
for (const element of observed) {
|
|
74
|
+
if (element !== scroller && !scroller.contains(element)) {
|
|
75
|
+
sizes?.unobserve(element);
|
|
76
|
+
observed.delete(element);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
observeAll();
|
|
80
|
+
read();
|
|
81
|
+
};
|
|
82
|
+
const schedule = () => {
|
|
83
|
+
if (cancelPending) return;
|
|
84
|
+
if (typeof requestAnimationFrame === "function") {
|
|
85
|
+
const frame = requestAnimationFrame(refresh);
|
|
86
|
+
cancelPending = () => cancelAnimationFrame(frame);
|
|
87
|
+
} else {
|
|
88
|
+
const timer = setTimeout(refresh, 0);
|
|
89
|
+
cancelPending = () => clearTimeout(timer);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
if (typeof MutationObserver !== "undefined") {
|
|
93
|
+
mutations = new MutationObserver(schedule);
|
|
94
|
+
mutations.observe(scroller, { childList: true, subtree: true });
|
|
95
|
+
}
|
|
96
|
+
return () => {
|
|
97
|
+
scroller.removeEventListener("scroll", read);
|
|
98
|
+
sizes?.disconnect();
|
|
99
|
+
mutations?.disconnect();
|
|
100
|
+
cancelPending?.();
|
|
101
|
+
target.removeAttribute("data-scroll-start");
|
|
102
|
+
target.removeAttribute("data-scroll-end");
|
|
103
|
+
target.style.removeProperty("--o-scroll-inline");
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// src/components/Table.tsx
|
|
34
108
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
35
109
|
var tableLabels = {
|
|
36
110
|
about: (column) => `About ${column}`,
|
|
@@ -138,14 +212,32 @@ function useHideBelow(hideBelow) {
|
|
|
138
212
|
useLayoutEffect(() => hideBelow === void 0 ? void 0 : watch(hideBelow), [hideBelow, watch]);
|
|
139
213
|
return hideBelow !== void 0 && width !== void 0 && width < hideBelow;
|
|
140
214
|
}
|
|
215
|
+
function setRef(ref, value) {
|
|
216
|
+
if (typeof ref === "function") ref(value);
|
|
217
|
+
else if (ref) ref.current = value;
|
|
218
|
+
}
|
|
141
219
|
function pinStyle(sticky, offset, style) {
|
|
142
220
|
if (sticky !== "start" || offset === void 0) return style;
|
|
143
221
|
return { ...style, "--o-table-sticky-offset": typeof offset === "number" ? `${offset}px` : offset };
|
|
144
222
|
}
|
|
145
223
|
var TableFrame = forwardRef(function TableFrame2({ height, footer, variant = "default", className, style, children, ...rest }, ref) {
|
|
224
|
+
const scrollRef = useRef(null);
|
|
225
|
+
const viewportRef = useRef(null);
|
|
226
|
+
const setScrollEl = useCallback(
|
|
227
|
+
(node) => {
|
|
228
|
+
scrollRef.current = node;
|
|
229
|
+
setRef(ref, node);
|
|
230
|
+
},
|
|
231
|
+
[ref]
|
|
232
|
+
);
|
|
233
|
+
useLayoutEffect(() => {
|
|
234
|
+
const scroll = scrollRef.current;
|
|
235
|
+
const viewport = viewportRef.current;
|
|
236
|
+
return scroll && viewport ? watchScrollEdges(scroll, viewport) : void 0;
|
|
237
|
+
}, []);
|
|
146
238
|
const scrollStyle = height === void 0 ? void 0 : { height: typeof height === "number" ? `${height}px` : height };
|
|
147
239
|
return /* @__PURE__ */ jsxs("div", { className: cx("o-table-frame", className), "data-variant": variant === "embedded" ? "embedded" : void 0, style, children: [
|
|
148
|
-
/* @__PURE__ */ jsx("div", { className: "o-table-frame__viewport", children: /* @__PURE__ */ jsx("div", { ref, className: "o-table-frame__scroll", style: scrollStyle, ...rest, children }) }),
|
|
240
|
+
/* @__PURE__ */ jsx("div", { ref: viewportRef, className: "o-table-frame__viewport", children: /* @__PURE__ */ jsx("div", { ref: setScrollEl, className: "o-table-frame__scroll", style: scrollStyle, ...rest, children }) }),
|
|
149
241
|
footer ? /* @__PURE__ */ jsx("div", { className: "o-table-frame__footer", children: footer }) : null
|
|
150
242
|
] });
|
|
151
243
|
});
|
|
@@ -161,7 +253,7 @@ var Table = forwardRef(function Table2({
|
|
|
161
253
|
...rest
|
|
162
254
|
}, ref) {
|
|
163
255
|
const local = useRef(null);
|
|
164
|
-
const
|
|
256
|
+
const setRef2 = useJoinedRef(ref, local);
|
|
165
257
|
const stackAt = typeof stack === "number" ? stack : void 0;
|
|
166
258
|
const { width, watch } = useBoxWidth(local, stackAt === void 0 ? NO_WIDTHS : [stackAt]);
|
|
167
259
|
const stacks = stack !== false;
|
|
@@ -171,7 +263,7 @@ var Table = forwardRef(function Table2({
|
|
|
171
263
|
return /* @__PURE__ */ jsx(
|
|
172
264
|
"table",
|
|
173
265
|
{
|
|
174
|
-
ref:
|
|
266
|
+
ref: setRef2,
|
|
175
267
|
className: cx("o-table", className),
|
|
176
268
|
"data-density": density,
|
|
177
269
|
"data-layout": layout,
|
|
@@ -250,7 +342,7 @@ var TableRow = forwardRef(function TableRow2({
|
|
|
250
342
|
}, ref) {
|
|
251
343
|
const role = useStackRole("row");
|
|
252
344
|
const local = useRef(null);
|
|
253
|
-
const
|
|
345
|
+
const setRef2 = useJoinedRef(ref, local);
|
|
254
346
|
const isLocked = locked === true;
|
|
255
347
|
useLockedControls(local, isLocked);
|
|
256
348
|
const depth = level !== void 0 && level > 0 ? Math.floor(level) : 0;
|
|
@@ -266,7 +358,7 @@ var TableRow = forwardRef(function TableRow2({
|
|
|
266
358
|
const row = /* @__PURE__ */ jsx(
|
|
267
359
|
"tr",
|
|
268
360
|
{
|
|
269
|
-
ref:
|
|
361
|
+
ref: setRef2,
|
|
270
362
|
className: cx("o-table__row", className),
|
|
271
363
|
"data-selected": dataFlag(selected),
|
|
272
364
|
"data-interactive": dataFlag(interactive && !isLocked),
|
|
@@ -132,13 +132,14 @@ var FigureStrip = forwardRef(function FigureStrip2({
|
|
|
132
132
|
"data-link": "",
|
|
133
133
|
"data-tone": item.tone,
|
|
134
134
|
"data-quiet": dataFlag(item.quiet),
|
|
135
|
+
"data-value": item.valueType === "text" ? "text" : void 0,
|
|
135
136
|
"data-trend": hasTrend(item),
|
|
136
137
|
children: words(item, false, true)
|
|
137
138
|
};
|
|
138
139
|
return /* @__PURE__ */ jsx(Fragment, { children: renderLink ? renderLink(link, item) : /* @__PURE__ */ jsx("a", { ...link }) }, item.key);
|
|
139
140
|
}
|
|
140
141
|
if (!selectable || item.selectable === false) {
|
|
141
|
-
return /* @__PURE__ */ jsx("div", { className: "o-figure", "data-tone": item.tone, "data-quiet": dataFlag(item.quiet), "data-trend": hasTrend(item), children: words(item, true) }, item.key);
|
|
142
|
+
return /* @__PURE__ */ jsx("div", { className: "o-figure", "data-tone": item.tone, "data-quiet": dataFlag(item.quiet), "data-value": item.valueType === "text" ? "text" : void 0, "data-trend": hasTrend(item), children: words(item, true) }, item.key);
|
|
142
143
|
}
|
|
143
144
|
const pressed = expandable ? open && item.key === active : item.key === active;
|
|
144
145
|
return /* @__PURE__ */ jsxs(
|
|
@@ -153,6 +154,7 @@ var FigureStrip = forwardRef(function FigureStrip2({
|
|
|
153
154
|
"data-previewed": dataFlag(expandable && preview === item.key && item.key !== active),
|
|
154
155
|
"data-tone": item.tone,
|
|
155
156
|
"data-quiet": dataFlag(item.quiet),
|
|
157
|
+
"data-value": item.valueType === "text" ? "text" : void 0,
|
|
156
158
|
"data-trend": hasTrend(item),
|
|
157
159
|
onClick: () => press(item.key),
|
|
158
160
|
onPointerEnter: expandable ? enter(item.key) : void 0,
|
|
@@ -167,7 +169,7 @@ var FigureStrip = forwardRef(function FigureStrip2({
|
|
|
167
169
|
);
|
|
168
170
|
}) }) : /* @__PURE__ */ jsx("dl", { ...listProps, children: items.map((item) => {
|
|
169
171
|
const after = followUp(item);
|
|
170
|
-
return /* @__PURE__ */ jsxs("div", { className: "o-figure", "data-tone": item.tone, "data-quiet": dataFlag(item.quiet), "data-trend": hasTrend(item), children: [
|
|
172
|
+
return /* @__PURE__ */ jsxs("div", { className: "o-figure", "data-tone": item.tone, "data-quiet": dataFlag(item.quiet), "data-value": item.valueType === "text" ? "text" : void 0, "data-trend": hasTrend(item), children: [
|
|
171
173
|
/* @__PURE__ */ jsx("dt", { className: "o-figure__label", id: labelId(item.key), children: heading(item) }),
|
|
172
174
|
/* @__PURE__ */ jsx("dd", { className: "o-figure__body", children: figure(item, true) }),
|
|
173
175
|
after ? /* @__PURE__ */ jsx("dd", { className: "o-figure__change", children: after }) : null,
|
|
@@ -55,6 +55,7 @@ function TabsImpl({ value, defaultValue, onValueChange, className, dir, onFocusC
|
|
|
55
55
|
const [own, setOwn] = useState(defaultValue);
|
|
56
56
|
const current = value !== void 0 ? value : own;
|
|
57
57
|
const context = useMemo(() => ({ value: current, scope }), [current, scope]);
|
|
58
|
+
const sent = useRef(null);
|
|
58
59
|
return /* @__PURE__ */ jsx(TabsContext.Provider, { value: context, children: /* @__PURE__ */ jsx(LayoutGroup, { id: scope, children: /* @__PURE__ */ jsx(
|
|
59
60
|
TabsPrimitive.Root,
|
|
60
61
|
{
|
|
@@ -67,6 +68,11 @@ function TabsImpl({ value, defaultValue, onValueChange, className, dir, onFocusC
|
|
|
67
68
|
value,
|
|
68
69
|
defaultValue,
|
|
69
70
|
onValueChange: (next) => {
|
|
71
|
+
if (sent.current === next) return;
|
|
72
|
+
sent.current = next;
|
|
73
|
+
queueMicrotask(() => {
|
|
74
|
+
sent.current = null;
|
|
75
|
+
});
|
|
70
76
|
setOwn(next);
|
|
71
77
|
onValueChange?.(next);
|
|
72
78
|
},
|
|
@@ -164,6 +170,9 @@ var TabsTrigger = forwardRef(function TabsTrigger2({
|
|
|
164
170
|
className,
|
|
165
171
|
children,
|
|
166
172
|
onPointerEnter,
|
|
173
|
+
onPointerDown,
|
|
174
|
+
onKeyDown,
|
|
175
|
+
onBlur,
|
|
167
176
|
...rest
|
|
168
177
|
}, ref) {
|
|
169
178
|
const tabs = useContext(TabsContext);
|
|
@@ -195,6 +204,18 @@ var TabsTrigger = forwardRef(function TabsTrigger2({
|
|
|
195
204
|
if (disabled) list.leave();
|
|
196
205
|
else list.enter(value);
|
|
197
206
|
},
|
|
207
|
+
onPointerDown: (event) => {
|
|
208
|
+
onPointerDown?.(event);
|
|
209
|
+
event.currentTarget.setAttribute("data-pointer-focus", "");
|
|
210
|
+
},
|
|
211
|
+
onKeyDown: (event) => {
|
|
212
|
+
event.currentTarget.removeAttribute("data-pointer-focus");
|
|
213
|
+
onKeyDown?.(event);
|
|
214
|
+
},
|
|
215
|
+
onBlur: (event) => {
|
|
216
|
+
event.currentTarget.removeAttribute("data-pointer-focus");
|
|
217
|
+
onBlur?.(event);
|
|
218
|
+
},
|
|
198
219
|
...rest,
|
|
199
220
|
children: [
|
|
200
221
|
hoverHere ? /* @__PURE__ */ jsx(
|
|
@@ -46,7 +46,15 @@ var addressBlockLabels = {
|
|
|
46
46
|
defaultShipping: "Default shipping",
|
|
47
47
|
defaultBilling: "Default billing"
|
|
48
48
|
};
|
|
49
|
-
var
|
|
49
|
+
var telHrefOf = (phone) => {
|
|
50
|
+
const match = phone.match(/\+?\s*\(?\d[\d\s().-]*/);
|
|
51
|
+
if (!match) return null;
|
|
52
|
+
const run = match[0];
|
|
53
|
+
const international = run.startsWith("+");
|
|
54
|
+
const digits = (international ? run.replace(/\(\s*0\s*\)/g, "") : run).replace(/\D/g, "");
|
|
55
|
+
if (digits === "") return null;
|
|
56
|
+
return `tel:${international ? "+" : ""}${digits}`;
|
|
57
|
+
};
|
|
50
58
|
var AddressBlock = forwardRef(function AddressBlock2({
|
|
51
59
|
address,
|
|
52
60
|
label,
|
|
@@ -70,6 +78,7 @@ var AddressBlock = forwardRef(function AddressBlock2({
|
|
|
70
78
|
const labels = useMemo(() => withDefaultLabels(addressBlockLabels, labelsProp), [labelsProp]);
|
|
71
79
|
const contact = variant === "contact";
|
|
72
80
|
const tel = part(phone ?? address?.phone);
|
|
81
|
+
const telHref = tel !== "" ? telHrefOf(tel) : null;
|
|
73
82
|
const mail = part(email);
|
|
74
83
|
const lines = addressToLines(address, { name: !contact });
|
|
75
84
|
const hasAddress = lines.length > 0;
|
|
@@ -100,7 +109,7 @@ var AddressBlock = forwardRef(function AddressBlock2({
|
|
|
100
109
|
] }) : null,
|
|
101
110
|
tel !== "" ? /* @__PURE__ */ jsxs("span", { className: "o-address__row", children: [
|
|
102
111
|
/* @__PURE__ */ jsx(PhoneIcon, { className: "o-address__icon" }),
|
|
103
|
-
/* @__PURE__ */ jsx("a", { className: "o-address__link", href:
|
|
112
|
+
telHref ? /* @__PURE__ */ jsx("a", { className: "o-address__link", href: telHref, children: tel }) : /* @__PURE__ */ jsx("span", { className: "o-address__text", children: tel })
|
|
104
113
|
] }) : null,
|
|
105
114
|
hasAddress ? /* @__PURE__ */ jsxs("span", { className: "o-address__row", "data-multiline": "", children: [
|
|
106
115
|
/* @__PURE__ */ jsx(MapPinIcon, { className: "o-address__icon" }),
|
|
@@ -108,7 +117,7 @@ var AddressBlock = forwardRef(function AddressBlock2({
|
|
|
108
117
|
] }) : null
|
|
109
118
|
] }) : /* @__PURE__ */ jsxs("address", { className: "o-address__body", children: [
|
|
110
119
|
lines.map((line, index) => /* @__PURE__ */ jsx("span", { className: "o-address__line", children: line }, index)),
|
|
111
|
-
tel !== "" ? /* @__PURE__ */ jsx("span", { className: "o-address__line", children: tel }) : null,
|
|
120
|
+
tel !== "" ? telHref ? /* @__PURE__ */ jsx("a", { className: "o-address__line o-address__link", href: telHref, children: tel }) : /* @__PURE__ */ jsx("span", { className: "o-address__line", children: tel }) : null,
|
|
112
121
|
mail !== "" ? /* @__PURE__ */ jsx("a", { className: "o-address__line o-address__link", href: `mailto:${mail}`, children: mail }) : null
|
|
113
122
|
] }),
|
|
114
123
|
map ? /* @__PURE__ */ jsx(Link, { className: "o-address__map", href: map, external: true, externalLabel: labels.newTab, size: size === "sm" ? "xs" : "sm", children: labels.viewMap }) : null,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
TimeZoneSelect
|
|
4
|
-
} from "../chunks/chunk-
|
|
4
|
+
} from "../chunks/chunk-5AJJKEPJ.js";
|
|
5
5
|
import {
|
|
6
6
|
COUNTRY_CURRENCIES,
|
|
7
7
|
currencyForCountry,
|
|
@@ -22,8 +22,8 @@ import "../chunks/chunk-IO3JRJYC.js";
|
|
|
22
22
|
import "../chunks/chunk-4YQLOFYE.js";
|
|
23
23
|
import {
|
|
24
24
|
Combobox
|
|
25
|
-
} from "../chunks/chunk-
|
|
26
|
-
import "../chunks/chunk-
|
|
25
|
+
} from "../chunks/chunk-T7Y6VU4F.js";
|
|
26
|
+
import "../chunks/chunk-NYXMCKSQ.js";
|
|
27
27
|
import "../chunks/chunk-DEBQQLOX.js";
|
|
28
28
|
import "../chunks/chunk-OO4FBAFL.js";
|
|
29
29
|
import {
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
colorFieldLabels,
|
|
7
7
|
themeColourGroups,
|
|
8
8
|
themeColourLabels
|
|
9
|
-
} from "../chunks/chunk-
|
|
10
|
-
import "../chunks/chunk-
|
|
9
|
+
} from "../chunks/chunk-IJ34OAQ4.js";
|
|
10
|
+
import "../chunks/chunk-YCS3IVCC.js";
|
|
11
11
|
import "../chunks/chunk-GC6UJB65.js";
|
|
12
12
|
import "../chunks/chunk-RYXMMARS.js";
|
|
13
13
|
import "../chunks/chunk-4SMTZLPN.js";
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
Combobox,
|
|
4
4
|
comboboxLabels
|
|
5
|
-
} from "../chunks/chunk-
|
|
6
|
-
import "../chunks/chunk-
|
|
5
|
+
} from "../chunks/chunk-T7Y6VU4F.js";
|
|
6
|
+
import "../chunks/chunk-NYXMCKSQ.js";
|
|
7
7
|
import "../chunks/chunk-DEBQQLOX.js";
|
|
8
8
|
import {
|
|
9
9
|
defaultComboboxFilter
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
TreeSelect
|
|
4
|
-
} from "../chunks/chunk-
|
|
4
|
+
} from "../chunks/chunk-PKANW3SX.js";
|
|
5
5
|
import "../chunks/chunk-V7LFKDIO.js";
|
|
6
6
|
import {
|
|
7
7
|
findTreeNode
|
|
@@ -29,8 +29,8 @@ import {
|
|
|
29
29
|
import "../chunks/chunk-A7DZQNQP.js";
|
|
30
30
|
import {
|
|
31
31
|
Combobox
|
|
32
|
-
} from "../chunks/chunk-
|
|
33
|
-
import "../chunks/chunk-
|
|
32
|
+
} from "../chunks/chunk-T7Y6VU4F.js";
|
|
33
|
+
import "../chunks/chunk-NYXMCKSQ.js";
|
|
34
34
|
import {
|
|
35
35
|
SegmentedControl
|
|
36
36
|
} from "../chunks/chunk-JCNIKI4N.js";
|