@graphty/compact-mantine 0.7.0 → 0.8.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/dist/index.d.ts CHANGED
@@ -436,9 +436,11 @@ export declare const COMPACT_SIZING: {
436
436
  * @param props.defaultOpacity - The opacity shown while the reader has set none of their own
437
437
  * @param props.onColorChange - Called with the new colour, or with `undefined` when the control is reset
438
438
  * @param props.onOpacityChange - Called with the new opacity, or with `undefined` when the control is reset
439
+ * @param props.onChange - Called once per gesture with both halves of the colour, whichever of them moved
439
440
  * @param props.label - The field's name, drawn above the control and used to name the group
440
441
  * @param props.showOpacity - Whether to offer an opacity box beside the colour
441
442
  * @param props.disabled - Whether the control cannot be used at all
443
+ * @param props.disabledReason - One sentence saying why the control is off, drawn only while it is off
442
444
  * @param props.onFocus - Called when the hex box or the opacity box takes focus
443
445
  * @param props.onBlur - Called when the hex box or the opacity box loses focus
444
446
  * @returns The joined colour control, and its reset button when something has been set
@@ -456,7 +458,7 @@ export declare const COMPACT_SIZING: {
456
458
  * </PopoutManager>
457
459
  * ```
458
460
  */
459
- export declare function CompactColorInput({ color, defaultColor, opacity, defaultOpacity, onColorChange, onOpacityChange, label, showOpacity, disabled, onFocus, onBlur, }: CompactColorInputProps): default_2.JSX.Element;
461
+ export declare function CompactColorInput({ color, defaultColor, opacity, defaultOpacity, onColorChange, onOpacityChange, onChange, label, showOpacity, disabled, disabledReason, onFocus, onBlur, }: CompactColorInputProps): default_2.JSX.Element;
460
462
 
461
463
  /**
462
464
  * Props for the CompactColorInput component.
@@ -499,6 +501,46 @@ export declare interface CompactColorInputProps {
499
501
  * The percentage comes first; the event that caused the change is second.
500
502
  */
501
503
  onOpacityChange?: ChangeHandler<number | undefined>;
504
+ /**
505
+ * Called once per gesture with BOTH halves of the colour, whichever of them
506
+ * moved.
507
+ *
508
+ * Reach for this one, alone, whenever you drive the control from your own
509
+ * state. `onColorChange` and `onOpacityChange` are kept for call sites that
510
+ * already use them, but they cannot carry a gesture that moves both halves
511
+ * at once.
512
+ *
513
+ * THE DEFECT THIS REPAIRS, reproduced at runtime rather than reasoned
514
+ * about: dragging in the picker used to call `onColorChange` and then
515
+ * `onOpacityChange` back to back inside one React batch. A controlled
516
+ * consumer builds its next state out of the props it is holding -- the only
517
+ * snapshot it has -- and both callbacks run against the SAME pre-gesture
518
+ * snapshot, so the second one writes a state rebuilt from a colour the
519
+ * first one had already replaced. A test in this package
520
+ * (tests/components/CompactColorInput.test.tsx, "the two separate callbacks
521
+ * cannot carry one gesture") drives a picker swatch and watches the second
522
+ * write arrive as `{opacity: 50}` with the new colour gone. The application
523
+ * had already forked this whole component to escape it.
524
+ *
525
+ * Both halves are always passed, so a consumer never has to remember which
526
+ * one moved -- the same shape `GradientEditor` already uses for its stops
527
+ * and its direction. `undefined` keeps its meaning from the props: the
528
+ * reader has chosen nothing for that half and the default is showing.
529
+ *
530
+ * Supplying this ALONGSIDE `onColorChange` or `onOpacityChange` makes every
531
+ * gesture write twice. Pick one route.
532
+ * @example
533
+ * ```tsx
534
+ * <CompactColorInput
535
+ * label="Fill"
536
+ * color={style.color}
537
+ * opacity={style.opacity}
538
+ * defaultColor="#5B8FF9"
539
+ * onChange={(color, opacity) => { setStyle({...style, color, opacity}); }}
540
+ * />
541
+ * ```
542
+ */
543
+ onChange?: (color: string | undefined, opacity: number | undefined, event?: default_2.SyntheticEvent) => void;
502
544
  /**
503
545
  * The field's name, drawn above the control and used to name the group the
504
546
  * three controls sit in.
@@ -522,6 +564,22 @@ export declare interface CompactColorInputProps {
522
564
  * @default false
523
565
  */
524
566
  disabled?: boolean;
567
+ /**
568
+ * One sentence saying why the control is off, shown only while `disabled`
569
+ * is true.
570
+ *
571
+ * It is appended to the control's own name after a full stop and drawn as
572
+ * the tooltip -- "Glow colour. Glow is not drawn yet" -- and it also joins
573
+ * the accessible description of the swatch, the hex box and the opacity
574
+ * box, so the reason reaches a pointer user and a screen reader user alike.
575
+ * With no `label` to append to, the sentence stands on its own.
576
+ *
577
+ * THE DEFECT THIS REPAIRS: a disabled colour control used to be dimmed and
578
+ * silent, so a reader who could not open the picker had no route at all to
579
+ * learning why -- spec:6641 asks for the one reason to travel with the
580
+ * disabled ink, and until now this component had nowhere to put it.
581
+ */
582
+ disabledReason?: string;
525
583
  /** Called when the hex box or the opacity box takes focus. Forwarded unchanged. */
526
584
  onFocus?: default_2.FocusEventHandler<HTMLInputElement>;
527
585
  /**
@@ -902,8 +960,8 @@ export declare const compactThemeOverride: {
902
960
  } | undefined;
903
961
  radius?: {
904
962
  [x: string & {}]: string | undefined;
905
- xs?: string | undefined;
906
963
  sm?: string | undefined;
964
+ xs?: string | undefined;
907
965
  md?: string | undefined;
908
966
  lg?: string | undefined;
909
967
  xl?: string | undefined;
@@ -912,40 +970,40 @@ export declare const compactThemeOverride: {
912
970
  spacing?: {
913
971
  [x: number]: string | undefined;
914
972
  [x: string & {}]: string | undefined;
915
- xs?: string | undefined;
916
973
  sm?: string | undefined;
974
+ xs?: string | undefined;
917
975
  md?: string | undefined;
918
976
  lg?: string | undefined;
919
977
  xl?: string | undefined;
920
978
  } | undefined;
921
979
  fontSizes?: {
922
980
  [x: string & {}]: string | undefined;
923
- xs?: string | undefined;
924
981
  sm?: string | undefined;
982
+ xs?: string | undefined;
925
983
  md?: string | undefined;
926
984
  lg?: string | undefined;
927
985
  xl?: string | undefined;
928
986
  } | undefined;
929
987
  lineHeights?: {
930
988
  [x: string & {}]: string | undefined;
931
- xs?: string | undefined;
932
989
  sm?: string | undefined;
990
+ xs?: string | undefined;
933
991
  md?: string | undefined;
934
992
  lg?: string | undefined;
935
993
  xl?: string | undefined;
936
994
  } | undefined;
937
995
  breakpoints?: {
938
996
  [x: string & {}]: string | undefined;
939
- xs?: string | undefined;
940
997
  sm?: string | undefined;
998
+ xs?: string | undefined;
941
999
  md?: string | undefined;
942
1000
  lg?: string | undefined;
943
1001
  xl?: string | undefined;
944
1002
  } | undefined;
945
1003
  shadows?: {
946
1004
  [x: string & {}]: string | undefined;
947
- xs?: string | undefined;
948
1005
  sm?: string | undefined;
1006
+ xs?: string | undefined;
949
1007
  md?: string | undefined;
950
1008
  lg?: string | undefined;
951
1009
  xl?: string | undefined;
@@ -2704,6 +2762,7 @@ export declare interface IconGroupOption {
2704
2762
  * @param props.labelledBy - The `id` of the element that already names the group
2705
2763
  * @param props.name - The name shared by the group's radio inputs
2706
2764
  * @param props.disabled - Whether the whole group cannot be used
2765
+ * @param props.disabledReason - One sentence saying why the group is off, drawn only while it is off
2707
2766
  * @param props.hybrid - Draw the word beside the drawing on the selected option only
2708
2767
  * @param props.width - How wide the track is drawn, or `"fill"` to take the rest of the row
2709
2768
  * @param props.trailing - The row's 24px trailing slot
@@ -2781,6 +2840,23 @@ export declare interface IconGroupRowProps {
2781
2840
  * @default false
2782
2841
  */
2783
2842
  disabled?: boolean;
2843
+ /**
2844
+ * One sentence saying why the whole group is off, shown only while
2845
+ * `disabled` is true.
2846
+ *
2847
+ * It is appended to the group's own name after a full stop and drawn as the
2848
+ * row's tooltip -- "Node shape. Load data first" -- and it joins the
2849
+ * group's accessible description, so the reason reaches a pointer user and
2850
+ * a screen reader user alike. With no `label` to append to, the sentence
2851
+ * stands on its own.
2852
+ *
2853
+ * It says nothing about one option: a single unavailable choice is
2854
+ * `disabled` on that option, and its own word still names it. THE DEFECT
2855
+ * THIS REPAIRS: a whole group drawn dimmed with no explanation reads as a
2856
+ * broken control, which is what spec:6641 forbids -- and until now this row
2857
+ * had nowhere to put the one reason.
2858
+ */
2859
+ disabledReason?: string;
2784
2860
  /**
2785
2861
  * Draw the word beside the drawing on the selected option only.
2786
2862
  *
@@ -4774,6 +4850,7 @@ export declare interface SparklineRowProps {
4774
4850
  * @param props.suffix - A unit written after the number
4775
4851
  * @param props.hideControls - Whether to leave out the up and down steppers, which are left out by default
4776
4852
  * @param props.disabled - Whether the control cannot be used at all
4853
+ * @param props.disabledReason - One sentence saying why the control is off, drawn only while it is off
4777
4854
  * @param props.onFocus - Called when the control takes focus
4778
4855
  * @param props.onBlur - Called when the control loses focus, after the number has been committed
4779
4856
  * @returns The number box, and its reset button when a number has been entered
@@ -4792,7 +4869,7 @@ export declare interface SparklineRowProps {
4792
4869
  * />
4793
4870
  * ```
4794
4871
  */
4795
- export declare function StyleNumberInput({ label, value, defaultValue, onChange, min, max, step, decimalScale, suffix, hideControls, disabled, onFocus, onBlur, }: StyleNumberInputProps): default_2.JSX.Element;
4872
+ export declare function StyleNumberInput({ label, value, defaultValue, onChange, min, max, step, decimalScale, suffix, hideControls, disabled, disabledReason, onFocus, onBlur, }: StyleNumberInputProps): default_2.JSX.Element;
4796
4873
 
4797
4874
  /**
4798
4875
  * Props for the StyleNumberInput component.
@@ -4846,6 +4923,22 @@ export declare interface StyleNumberInputProps {
4846
4923
  * @default false
4847
4924
  */
4848
4925
  disabled?: boolean;
4926
+ /**
4927
+ * One sentence saying why the control is off, shown only while `disabled`
4928
+ * is true.
4929
+ *
4930
+ * It is appended to the control's own name after a full stop and drawn as
4931
+ * the tooltip -- "Width. Load data first" -- and it also joins the
4932
+ * control's accessible description, so a screen reader reads the reason out
4933
+ * instead of announcing an unexplained unavailable control.
4934
+ *
4935
+ * Write it as a whole sentence naming what would make the control usable
4936
+ * again. THE DEFECT THIS REPAIRS: a disabled control here used to be dimmed
4937
+ * and silent, so a reader who could not type into it had no route at all to
4938
+ * learning why -- spec:6641 asks for the reason to travel with the ink, and
4939
+ * until now this component had nowhere to put it.
4940
+ */
4941
+ disabledReason?: string;
4849
4942
  /** Called when the control takes focus. Forwarded unchanged. */
4850
4943
  onFocus?: default_2.FocusEventHandler<HTMLInputElement>;
4851
4944
  /**
@@ -4877,6 +4970,7 @@ export declare interface StyleNumberInputProps {
4877
4970
  * @param props.options - The choices offered
4878
4971
  * @param props.onChange - Called with the new choice, or with `undefined` when the control is reset
4879
4972
  * @param props.disabled - Whether the control cannot be used at all
4973
+ * @param props.disabledReason - One sentence saying why the control is off, drawn only while it is off
4880
4974
  * @param props.onFocus - Called when the control takes focus
4881
4975
  * @param props.onBlur - Called when the control loses focus
4882
4976
  * @returns The dropdown, and its reset button when a choice has been made
@@ -4896,7 +4990,7 @@ export declare interface StyleNumberInputProps {
4896
4990
  * />
4897
4991
  * ```
4898
4992
  */
4899
- export declare function StyleSelect({ label, value, defaultValue, options, onChange, disabled, onFocus, onBlur, }: StyleSelectProps): default_2.JSX.Element;
4993
+ export declare function StyleSelect({ label, value, defaultValue, options, onChange, disabled, disabledReason, onFocus, onBlur, }: StyleSelectProps): default_2.JSX.Element;
4900
4994
 
4901
4995
  /**
4902
4996
  * One choice in a {@link StyleSelect}.
@@ -4943,6 +5037,23 @@ export declare interface StyleSelectProps {
4943
5037
  * @default false
4944
5038
  */
4945
5039
  disabled?: boolean;
5040
+ /**
5041
+ * One sentence saying why the control is off, shown only while `disabled`
5042
+ * is true.
5043
+ *
5044
+ * It is appended to the control's own name after a full stop and drawn as
5045
+ * the tooltip -- "Fill. Load data first" -- and it also joins the control's
5046
+ * accessible description, so a screen reader reads the reason out instead
5047
+ * of announcing an unexplained unavailable control.
5048
+ *
5049
+ * Write it as a whole sentence naming what would make the control usable
5050
+ * again, not as a restatement that it is off. THE DEFECT THIS REPAIRS: a
5051
+ * disabled control here used to be dimmed and silent, so a reader who could
5052
+ * not press it had no route at all to learning why -- spec:6641 asks for
5053
+ * the reason to travel with the ink, and until now this component had
5054
+ * nowhere to put it.
5055
+ */
5056
+ disabledReason?: string;
4946
5057
  /** Called when the control takes focus. Forwarded unchanged. */
4947
5058
  onFocus?: default_2.FocusEventHandler<HTMLInputElement>;
4948
5059
  /** Called when the control loses focus. Forwarded unchanged. */
@@ -4986,6 +5097,9 @@ export declare const SWATCH_COLORS_HEXA: readonly ["#5B8FF9FF", "#FF6B6BFF", "#6
4986
5097
  * @param props.control - Which control to draw: a 16px checkbox, or a 28x16 switch for a live mode
4987
5098
  * @param props.trailing - What to put in the fixed 24px slot at the end of the row
4988
5099
  * @param props.disabled - Whether the toggle can be changed
5100
+ * @param props.disabledReason - One sentence saying why the toggle is off, drawn only while it is off
5101
+ * @param props.bound - Whether the boolean comes from a data attribute rather than being set by hand
5102
+ * @param props.boundDescription - What a screen reader says about a bound row, defaulting to `fieldBound`
4989
5103
  * @param props.onFocus - Called when the control takes focus
4990
5104
  * @param props.onBlur - Called when the control loses focus
4991
5105
  * @returns The toggle row
@@ -4997,7 +5111,7 @@ export declare const SWATCH_COLORS_HEXA: readonly ["#5B8FF9FF", "#FF6B6BFF", "#6
4997
5111
  * </ToggleRowGroup>
4998
5112
  * ```
4999
5113
  */
5000
- export declare function ToggleRow({ label, checked, defaultChecked, onChange, control, trailing, disabled, onFocus, onBlur, }: ToggleRowProps): default_2.JSX.Element;
5114
+ export declare function ToggleRow({ label, checked, defaultChecked, onChange, control, trailing, disabled, disabledReason, bound, boundDescription, onFocus, onBlur, }: ToggleRowProps): default_2.JSX.Element;
5001
5115
 
5002
5116
  /**
5003
5117
  * The column two or more toggle rows are packed into.
@@ -5126,6 +5240,48 @@ export declare interface ToggleRowProps {
5126
5240
  * unavailable rather than merely looking it.
5127
5241
  */
5128
5242
  disabled?: boolean;
5243
+ /**
5244
+ * One sentence saying why the toggle is off, shown only while `disabled` is
5245
+ * true.
5246
+ *
5247
+ * It is appended to the row's own word after a full stop and becomes the
5248
+ * row's tooltip -- "Legend. Nothing is encoded yet" -- and it joins the
5249
+ * control's accessible description, so the reason reaches a pointer user
5250
+ * and a screen reader user alike.
5251
+ *
5252
+ * THE DEFECT THIS REPAIRS, and it was the sharper half of the two: this row
5253
+ * used to hardcode its tooltip as `wrapperProps = {title: label}`, so a
5254
+ * call site could not append a reason even by hand. A disabled toggle was
5255
+ * therefore dimmed and permanently unexplained, which is what spec:6641
5256
+ * forbids. The caller supplies the sentence; the library never invents one,
5257
+ * because only the call site knows what would turn the control back on.
5258
+ */
5259
+ disabledReason?: string;
5260
+ /**
5261
+ * Whether the boolean comes from a data attribute rather than being set by
5262
+ * hand.
5263
+ *
5264
+ * The row draws a filled attribute glyph beside its word -- the same filled
5265
+ * glyph `PanelField` uses to say the same thing -- so a panel can say "this
5266
+ * follows the data" without spending a row on a fixed-or-by-attribute
5267
+ * switch. A boolean channel can be bound just as a numeric one can, and
5268
+ * until now `PanelField` was the only control in the library able to say
5269
+ * so, which is why a bound boolean had to be drawn as a number field or not
5270
+ * drawn at all.
5271
+ * @default false
5272
+ */
5273
+ bound?: boolean;
5274
+ /**
5275
+ * What a screen reader says about a row whose value comes from a data
5276
+ * attribute. Only used when `bound` is set.
5277
+ *
5278
+ * Defaults to the `fieldBound` string, so translating it once through
5279
+ * `LabelsProvider` covers every bound control in the panel. Pass it here
5280
+ * only to say something more specific about one row, and pass an empty
5281
+ * string to say nothing -- byte for byte the contract `PanelField` already
5282
+ * documents.
5283
+ */
5284
+ boundDescription?: string;
5129
5285
  /** Called when the control takes focus. */
5130
5286
  onFocus?: default_2.FocusEventHandler<HTMLInputElement>;
5131
5287
  /** Called when the control loses focus. */
@@ -5160,6 +5316,9 @@ export declare interface ToggleRowProps {
5160
5316
  * @param props.defaultChecked - Whether the toggle starts on, when the component keeps its own state
5161
5317
  * @param props.onChange - Called with the new state first and the event that caused it second
5162
5318
  * @param props.disabled - Whether the toggle can be changed
5319
+ * @param props.disabledReason - One sentence saying why the toggle is off, drawn only while it is off
5320
+ * @param props.bound - Whether the boolean comes from a data attribute rather than being set by hand
5321
+ * @param props.boundDescription - What a screen reader says about a bound toggle, defaulting to `fieldBound`
5163
5322
  * @param props.onFocus - Called when the checkbox takes focus
5164
5323
  * @param props.onBlur - Called when the checkbox loses focus
5165
5324
  * @param props.children - The controls shown only while the feature is on
@@ -5172,7 +5331,7 @@ export declare interface ToggleRowProps {
5172
5331
  * </ToggleWithContent>
5173
5332
  * ```
5174
5333
  */
5175
- export declare function ToggleWithContent({ label, checked, defaultChecked, onChange, disabled, onFocus, onBlur, children, }: ToggleWithContentProps): default_2.JSX.Element;
5334
+ export declare function ToggleWithContent({ label, checked, defaultChecked, onChange, disabled, disabledReason, bound, boundDescription, onFocus, onBlur, children, }: ToggleWithContentProps): default_2.JSX.Element;
5176
5335
 
5177
5336
  /**
5178
5337
  * Props for the ToggleWithContent component.
@@ -5215,6 +5374,47 @@ export declare interface ToggleWithContentProps {
5215
5374
  * revealed; disable them yourself if they should not be touched either.
5216
5375
  */
5217
5376
  disabled?: boolean;
5377
+ /**
5378
+ * One sentence saying why the toggle is off, shown only while `disabled` is
5379
+ * true.
5380
+ *
5381
+ * It is appended to the toggle's own word after a full stop and becomes its
5382
+ * tooltip -- "Glow. Glow is not drawn yet" -- and it joins the control's
5383
+ * accessible description, so the reason reaches a pointer user and a screen
5384
+ * reader user alike.
5385
+ *
5386
+ * THE DEFECT THIS REPAIRS: a feature that cannot be turned on yet used to
5387
+ * be drawn as a dimmed checkbox with nothing to say for itself, which reads
5388
+ * as a broken control rather than as an unfinished feature. spec:6641 asks
5389
+ * for the one reason to travel with the disabled ink; until now this
5390
+ * component had nowhere to put it. The caller supplies the sentence -- only
5391
+ * the call site knows what would turn the feature back on.
5392
+ */
5393
+ disabledReason?: string;
5394
+ /**
5395
+ * Whether the boolean comes from a data attribute rather than being set by
5396
+ * hand.
5397
+ *
5398
+ * The toggle draws a filled attribute glyph beside its word -- the same
5399
+ * filled glyph `PanelField` uses to say the same thing -- so a panel can
5400
+ * say "this follows the data" without spending a row on a
5401
+ * fixed-or-by-attribute switch. A boolean channel can be bound just as a
5402
+ * numeric one can, and until now `PanelField` was the only control in the
5403
+ * library able to say so.
5404
+ * @default false
5405
+ */
5406
+ bound?: boolean;
5407
+ /**
5408
+ * What a screen reader says about a toggle whose value comes from a data
5409
+ * attribute. Only used when `bound` is set.
5410
+ *
5411
+ * Defaults to the `fieldBound` string, so translating it once through
5412
+ * `LabelsProvider` covers every bound control in the panel. Pass it here
5413
+ * only to say something more specific about one toggle, and pass an empty
5414
+ * string to say nothing -- byte for byte the contract `PanelField` already
5415
+ * documents.
5416
+ */
5417
+ boundDescription?: string;
5218
5418
  /** Called when the checkbox takes focus. */
5219
5419
  onFocus?: default_2.FocusEventHandler<HTMLInputElement>;
5220
5420
  /** Called when the checkbox loses focus. */
@@ -5434,9 +5634,6 @@ export declare function usePanelLabels(): boolean;
5434
5634
  */
5435
5635
  export declare function usePopoutRegion(): string | null;
5436
5636
 
5437
- /** The released version of this package. */
5438
- export declare const VERSION = "0.6.0";
5439
-
5440
5637
  export { }
5441
5638
 
5442
5639