@graphty/compact-mantine 0.8.17 → 0.8.19

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/index.d.cts CHANGED
@@ -12,6 +12,7 @@ import { ReactNode } from 'react';
12
12
  import { ReactPortal } from 'react';
13
13
  import { RefAttributes } from 'react';
14
14
  import { RefObject } from 'react';
15
+ import { SegmentedControl as SegmentedControl_2 } from '@mantine/core';
15
16
  import { SyntheticEvent } from 'react';
16
17
  import { VariantColorsResolver } from '@mantine/core';
17
18
 
@@ -492,6 +493,8 @@ export declare interface CompactColorInputProps {
492
493
  * The colour comes first, as `#RRGGBB` in upper case; the event that caused
493
494
  * the change is second and is absent for a change made from the picker,
494
495
  * which reports none.
496
+ *
497
+ * Not called when `onChange` is supplied.
495
498
  */
496
499
  onColorChange?: ChangeHandler<string | undefined>;
497
500
  /**
@@ -499,6 +502,8 @@ export declare interface CompactColorInputProps {
499
502
  * reset to its default.
500
503
  *
501
504
  * The percentage comes first; the event that caused the change is second.
505
+ *
506
+ * Not called when `onChange` is supplied.
502
507
  */
503
508
  onOpacityChange?: ChangeHandler<number | undefined>;
504
509
  /**
@@ -527,8 +532,9 @@ export declare interface CompactColorInputProps {
527
532
  * and its direction. `undefined` keeps its meaning from the props: the
528
533
  * reader has chosen nothing for that half and the default is showing.
529
534
  *
530
- * Supplying this ALONGSIDE `onColorChange` or `onOpacityChange` makes every
531
- * gesture write twice. Pick one route.
535
+ * When this is supplied, `onColorChange` and `onOpacityChange` are not
536
+ * called: one gesture makes one write. Passing both routes logs a
537
+ * development warning naming the conflict.
532
538
  * @example
533
539
  * ```tsx
534
540
  * <CompactColorInput
@@ -1996,6 +2002,28 @@ export declare interface DataTableProps<TRow extends object> {
1996
2002
  * set of rows and costs a re-sort.
1997
2003
  */
1998
2004
  data: readonly TRow[];
2005
+ /**
2006
+ * How many rows there are in all, when `data` holds only a window of them.
2007
+ *
2008
+ * Set it to show a list too large to hand over whole -- the records of a
2009
+ * large graph, a server-side query. The table then scrolls the length of
2010
+ * `rowCount` rows, draws `data[0]` at position `rowOffset`, and calls
2011
+ * `onRangeChange` as rows come into view so the caller can hand over the
2012
+ * window that holds them. Sorting and searching become the caller's: the
2013
+ * table reports `onSortingChange` and `onFilterChange` and draws `data` in
2014
+ * the order given, and Control+A and Shift ranges select within `data`.
2015
+ *
2016
+ * Left out, `data` is every row and the table sorts and searches it itself.
2017
+ */
2018
+ rowCount?: number;
2019
+ /** Where `data[0]` sits among all `rowCount` rows. Defaults to `0`. */
2020
+ rowOffset?: number;
2021
+ /**
2022
+ * Called with the rows the table is drawing, as positions among all of
2023
+ * them: `start` inclusive, `end` exclusive. With `rowCount`, hand over a
2024
+ * window that covers them.
2025
+ */
2026
+ onRangeChange?: (start: number, end: number) => void;
1999
2027
  /**
2000
2028
  * The columns, in their natural order.
2001
2029
  *
@@ -3343,14 +3371,12 @@ export declare const PANEL_INK: {
3343
3371
  * token to serve a selected item is what made a chip's label and a bar's
3344
3372
  * fill unreadable, so the two roles are two tokens.
3345
3373
  *
3346
- * Two pairings on this token are still short of WCAG AA, and neither can
3347
- * be fixed by moving it. A chip labelled in the secondary text colour
3374
+ * One pairing on this token is still short of WCAG AA, and it cannot be
3375
+ * fixed by moving it. A chip labelled in the secondary text colour
3348
3376
  * measures 4.43:1 in the dark scheme against the 4.5:1 for text; the same
3349
- * chip labelled in the primary text colour measures 7.33:1. An accent fill
3350
- * on this track measures 2.11:1 (dark) and 2.73:1 (light) against the 3:1
3351
- * for a shape that carries meaning; the same fill on the panel measures
3352
- * 3.12:1 and 3.56:1. Both are settled where they are drawn, by choosing
3353
- * the ink or the ground, not by another value here.
3377
+ * chip labelled in the primary text colour measures 7.33:1, which is what
3378
+ * the row draws. An accent fill on this track measures 3.53:1 (dark) and
3379
+ * 3.86:1 (light), past the 3:1 for a shape that carries meaning.
3354
3380
  */
3355
3381
  readonly RAISED: "light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-5))";
3356
3382
  /**
@@ -3397,16 +3423,24 @@ export declare const PANEL_INK: {
3397
3423
  readonly DIVIDER: "light-dark(var(--mantine-color-gray-6), var(--mantine-color-dark-2))";
3398
3424
  /**
3399
3425
  * accent: a checked box, the highlighted bin, a filled micro-bar, the Run
3400
- * button (#1971c2 in the dark scheme, #228be6 in the light one).
3426
+ * button (#1971c2, blue-8, in the light scheme; #339af0, blue-5, in the
3427
+ * dark one).
3428
+ *
3429
+ * The theme sets `primaryShade` so the fill stands at least 3:1 off the
3430
+ * panel, a field and the raised surface in both schemes (WCAG 1.4.11):
3431
+ * 3.86:1 or more in the light scheme, 3.53:1 or more in the dark one.
3401
3432
  *
3402
3433
  * This token and `ON_ACCENT` follow a consumer's own `primaryColor`;
3403
3434
  * `WARNING`, `SUCCESS` and `DANGER` are stock Mantine yellow, green and
3404
- * red. The theme replaces only the `dark` ramp and sets no `primaryColor`,
3405
- * so none of the five is overridden here, and a consumer who sets one gets
3435
+ * red. The theme sets no `primaryColor`, so a consumer who sets one gets
3406
3436
  * it throughout.
3407
3437
  */
3408
3438
  readonly ACCENT: "var(--mantine-primary-color-filled)";
3409
- /** text and glyphs drawn on the accent (#ffffff) */
3439
+ /**
3440
+ * text and glyphs drawn on the accent: white in the light scheme (5.02:1)
3441
+ * and black in the dark one (7.02:1), chosen by the theme's `autoContrast`
3442
+ * from the fill's luminance, so both pass WCAG 1.4.3's 4.5:1.
3443
+ */
3410
3444
  readonly ON_ACCENT: "var(--mantine-primary-color-contrast)";
3411
3445
  /** the warning glyph on a departure line (#fab005) */
3412
3446
  readonly WARNING: "var(--mantine-color-yellow-6)";
@@ -4740,6 +4774,33 @@ export declare interface RankChipProps {
4740
4774
  children: default_2.ReactNode;
4741
4775
  }
4742
4776
 
4777
+ /**
4778
+ * Mantine's SegmentedControl, named by the `Input.Wrapper` around it.
4779
+ *
4780
+ * `Input.Wrapper` names its child with `<label for={id}>`, and only a control
4781
+ * that reads the wrapper's context takes that id. Mantine's SegmentedControl
4782
+ * does not, so inside a wrapper its radiogroup is announced with no name and
4783
+ * no description. This drop-in reads the wrapper's label and description ids
4784
+ * and puts them on the radiogroup as `aria-labelledby` and `aria-describedby`.
4785
+ * Either attribute passed by the caller wins. Outside a wrapper it is exactly
4786
+ * Mantine's control. A theme extension cannot do this, because a component's
4787
+ * theme defaults cannot read React context.
4788
+ *
4789
+ * Mantine's wrapper publishes a label id even when it renders no label, so a
4790
+ * wrapper with only a description or an error leaves `aria-labelledby`
4791
+ * pointing at no element. Browsers skip a missing id and fall back to any
4792
+ * `aria-label`, so give the control one in that case.
4793
+ * @param props - Mantine's SegmentedControl props
4794
+ * @returns The segmented control
4795
+ * @example
4796
+ * ```tsx
4797
+ * <Input.Wrapper label="Mode" description="How the graph is drawn">
4798
+ * <SegmentedControl data={["2D", "3D"]} />
4799
+ * </Input.Wrapper>
4800
+ * ```
4801
+ */
4802
+ export declare function SegmentedControl(props: default_2.ComponentProps<typeof SegmentedControl_2>): default_2.JSX.Element;
4803
+
4743
4804
  /**
4744
4805
  * The same chart at half the height, for a series rather than a distribution.
4745
4806
  *
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ import { ReactNode } from 'react';
12
12
  import { ReactPortal } from 'react';
13
13
  import { RefAttributes } from 'react';
14
14
  import { RefObject } from 'react';
15
+ import { SegmentedControl as SegmentedControl_2 } from '@mantine/core';
15
16
  import { SyntheticEvent } from 'react';
16
17
  import { VariantColorsResolver } from '@mantine/core';
17
18
 
@@ -492,6 +493,8 @@ export declare interface CompactColorInputProps {
492
493
  * The colour comes first, as `#RRGGBB` in upper case; the event that caused
493
494
  * the change is second and is absent for a change made from the picker,
494
495
  * which reports none.
496
+ *
497
+ * Not called when `onChange` is supplied.
495
498
  */
496
499
  onColorChange?: ChangeHandler<string | undefined>;
497
500
  /**
@@ -499,6 +502,8 @@ export declare interface CompactColorInputProps {
499
502
  * reset to its default.
500
503
  *
501
504
  * The percentage comes first; the event that caused the change is second.
505
+ *
506
+ * Not called when `onChange` is supplied.
502
507
  */
503
508
  onOpacityChange?: ChangeHandler<number | undefined>;
504
509
  /**
@@ -527,8 +532,9 @@ export declare interface CompactColorInputProps {
527
532
  * and its direction. `undefined` keeps its meaning from the props: the
528
533
  * reader has chosen nothing for that half and the default is showing.
529
534
  *
530
- * Supplying this ALONGSIDE `onColorChange` or `onOpacityChange` makes every
531
- * gesture write twice. Pick one route.
535
+ * When this is supplied, `onColorChange` and `onOpacityChange` are not
536
+ * called: one gesture makes one write. Passing both routes logs a
537
+ * development warning naming the conflict.
532
538
  * @example
533
539
  * ```tsx
534
540
  * <CompactColorInput
@@ -1996,6 +2002,28 @@ export declare interface DataTableProps<TRow extends object> {
1996
2002
  * set of rows and costs a re-sort.
1997
2003
  */
1998
2004
  data: readonly TRow[];
2005
+ /**
2006
+ * How many rows there are in all, when `data` holds only a window of them.
2007
+ *
2008
+ * Set it to show a list too large to hand over whole -- the records of a
2009
+ * large graph, a server-side query. The table then scrolls the length of
2010
+ * `rowCount` rows, draws `data[0]` at position `rowOffset`, and calls
2011
+ * `onRangeChange` as rows come into view so the caller can hand over the
2012
+ * window that holds them. Sorting and searching become the caller's: the
2013
+ * table reports `onSortingChange` and `onFilterChange` and draws `data` in
2014
+ * the order given, and Control+A and Shift ranges select within `data`.
2015
+ *
2016
+ * Left out, `data` is every row and the table sorts and searches it itself.
2017
+ */
2018
+ rowCount?: number;
2019
+ /** Where `data[0]` sits among all `rowCount` rows. Defaults to `0`. */
2020
+ rowOffset?: number;
2021
+ /**
2022
+ * Called with the rows the table is drawing, as positions among all of
2023
+ * them: `start` inclusive, `end` exclusive. With `rowCount`, hand over a
2024
+ * window that covers them.
2025
+ */
2026
+ onRangeChange?: (start: number, end: number) => void;
1999
2027
  /**
2000
2028
  * The columns, in their natural order.
2001
2029
  *
@@ -3343,14 +3371,12 @@ export declare const PANEL_INK: {
3343
3371
  * token to serve a selected item is what made a chip's label and a bar's
3344
3372
  * fill unreadable, so the two roles are two tokens.
3345
3373
  *
3346
- * Two pairings on this token are still short of WCAG AA, and neither can
3347
- * be fixed by moving it. A chip labelled in the secondary text colour
3374
+ * One pairing on this token is still short of WCAG AA, and it cannot be
3375
+ * fixed by moving it. A chip labelled in the secondary text colour
3348
3376
  * measures 4.43:1 in the dark scheme against the 4.5:1 for text; the same
3349
- * chip labelled in the primary text colour measures 7.33:1. An accent fill
3350
- * on this track measures 2.11:1 (dark) and 2.73:1 (light) against the 3:1
3351
- * for a shape that carries meaning; the same fill on the panel measures
3352
- * 3.12:1 and 3.56:1. Both are settled where they are drawn, by choosing
3353
- * the ink or the ground, not by another value here.
3377
+ * chip labelled in the primary text colour measures 7.33:1, which is what
3378
+ * the row draws. An accent fill on this track measures 3.53:1 (dark) and
3379
+ * 3.86:1 (light), past the 3:1 for a shape that carries meaning.
3354
3380
  */
3355
3381
  readonly RAISED: "light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-5))";
3356
3382
  /**
@@ -3397,16 +3423,24 @@ export declare const PANEL_INK: {
3397
3423
  readonly DIVIDER: "light-dark(var(--mantine-color-gray-6), var(--mantine-color-dark-2))";
3398
3424
  /**
3399
3425
  * accent: a checked box, the highlighted bin, a filled micro-bar, the Run
3400
- * button (#1971c2 in the dark scheme, #228be6 in the light one).
3426
+ * button (#1971c2, blue-8, in the light scheme; #339af0, blue-5, in the
3427
+ * dark one).
3428
+ *
3429
+ * The theme sets `primaryShade` so the fill stands at least 3:1 off the
3430
+ * panel, a field and the raised surface in both schemes (WCAG 1.4.11):
3431
+ * 3.86:1 or more in the light scheme, 3.53:1 or more in the dark one.
3401
3432
  *
3402
3433
  * This token and `ON_ACCENT` follow a consumer's own `primaryColor`;
3403
3434
  * `WARNING`, `SUCCESS` and `DANGER` are stock Mantine yellow, green and
3404
- * red. The theme replaces only the `dark` ramp and sets no `primaryColor`,
3405
- * so none of the five is overridden here, and a consumer who sets one gets
3435
+ * red. The theme sets no `primaryColor`, so a consumer who sets one gets
3406
3436
  * it throughout.
3407
3437
  */
3408
3438
  readonly ACCENT: "var(--mantine-primary-color-filled)";
3409
- /** text and glyphs drawn on the accent (#ffffff) */
3439
+ /**
3440
+ * text and glyphs drawn on the accent: white in the light scheme (5.02:1)
3441
+ * and black in the dark one (7.02:1), chosen by the theme's `autoContrast`
3442
+ * from the fill's luminance, so both pass WCAG 1.4.3's 4.5:1.
3443
+ */
3410
3444
  readonly ON_ACCENT: "var(--mantine-primary-color-contrast)";
3411
3445
  /** the warning glyph on a departure line (#fab005) */
3412
3446
  readonly WARNING: "var(--mantine-color-yellow-6)";
@@ -4740,6 +4774,33 @@ export declare interface RankChipProps {
4740
4774
  children: default_2.ReactNode;
4741
4775
  }
4742
4776
 
4777
+ /**
4778
+ * Mantine's SegmentedControl, named by the `Input.Wrapper` around it.
4779
+ *
4780
+ * `Input.Wrapper` names its child with `<label for={id}>`, and only a control
4781
+ * that reads the wrapper's context takes that id. Mantine's SegmentedControl
4782
+ * does not, so inside a wrapper its radiogroup is announced with no name and
4783
+ * no description. This drop-in reads the wrapper's label and description ids
4784
+ * and puts them on the radiogroup as `aria-labelledby` and `aria-describedby`.
4785
+ * Either attribute passed by the caller wins. Outside a wrapper it is exactly
4786
+ * Mantine's control. A theme extension cannot do this, because a component's
4787
+ * theme defaults cannot read React context.
4788
+ *
4789
+ * Mantine's wrapper publishes a label id even when it renders no label, so a
4790
+ * wrapper with only a description or an error leaves `aria-labelledby`
4791
+ * pointing at no element. Browsers skip a missing id and fall back to any
4792
+ * `aria-label`, so give the control one in that case.
4793
+ * @param props - Mantine's SegmentedControl props
4794
+ * @returns The segmented control
4795
+ * @example
4796
+ * ```tsx
4797
+ * <Input.Wrapper label="Mode" description="How the graph is drawn">
4798
+ * <SegmentedControl data={["2D", "3D"]} />
4799
+ * </Input.Wrapper>
4800
+ * ```
4801
+ */
4802
+ export declare function SegmentedControl(props: default_2.ComponentProps<typeof SegmentedControl_2>): default_2.JSX.Element;
4803
+
4743
4804
  /**
4744
4805
  * The same chart at half the height, for a series rather than a distribution.
4745
4806
  *