@pingux/astro 2.218.0 → 2.219.0
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/lib/cjs/components/NumberField/NumberField.d.ts +4 -0
- package/lib/cjs/components/NumberField/NumberField.js +21 -93
- package/lib/cjs/components/NumberField/NumberField.styles.d.ts +19 -0
- package/lib/cjs/components/NumberField/index.d.ts +1 -0
- package/lib/cjs/components/TableBase/TableBase.js +12 -6
- package/lib/cjs/components/TableBase/TableBase.mdx +14 -20
- package/lib/cjs/components/TableBase/TableBase.stories.js +148 -2
- package/lib/cjs/components/TableBase/TableBase.styles.d.ts +33 -0
- package/lib/cjs/components/TableBase/TableBase.styles.js +31 -5
- package/lib/cjs/components/TableBase/TableBase.test.js +243 -433
- package/lib/cjs/hooks/useField/useField.d.ts +2 -0
- package/lib/cjs/hooks/useSliderField/useSliderField.d.ts +3 -0
- package/lib/cjs/types/box.d.ts +1 -0
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.js +35 -24
- package/lib/cjs/types/numberField.d.ts +30 -0
- package/lib/cjs/types/numberField.js +6 -0
- package/lib/components/NumberField/NumberField.js +23 -95
- package/lib/components/TableBase/TableBase.js +12 -6
- package/lib/components/TableBase/TableBase.mdx +14 -20
- package/lib/components/TableBase/TableBase.stories.js +147 -1
- package/lib/components/TableBase/TableBase.styles.js +31 -5
- package/lib/components/TableBase/TableBase.test.js +243 -433
- package/lib/types/index.js +1 -0
- package/lib/types/numberField.js +1 -0
- package/package.json +1 -1
|
@@ -3013,6 +3013,7 @@ declare const useField: <T>(props: UseFieldProps<T>) => {
|
|
|
3013
3013
|
id?: string;
|
|
3014
3014
|
name: string;
|
|
3015
3015
|
};
|
|
3016
|
+
type?: string;
|
|
3016
3017
|
variant?: string;
|
|
3017
3018
|
as?: string | React.ReactNode | React.ElementType;
|
|
3018
3019
|
grid?: import("theme-ui").StylePropertyValue<import("csstype").Property.Grid | undefined>;
|
|
@@ -3776,6 +3777,7 @@ declare const useField: <T>(props: UseFieldProps<T>) => {
|
|
|
3776
3777
|
id?: string;
|
|
3777
3778
|
name: string;
|
|
3778
3779
|
};
|
|
3780
|
+
type?: string;
|
|
3779
3781
|
variant?: string;
|
|
3780
3782
|
as?: string | React.ReactNode | React.ElementType;
|
|
3781
3783
|
style?: React.CSSProperties | string;
|
|
@@ -284,6 +284,7 @@ declare const useSliderField: (props: UseSliderFieldProps) => {
|
|
|
284
284
|
id?: string;
|
|
285
285
|
name: string;
|
|
286
286
|
};
|
|
287
|
+
type?: string;
|
|
287
288
|
variant?: string;
|
|
288
289
|
as?: string | import("react").ReactNode | import("react").ElementType;
|
|
289
290
|
style?: import("react").CSSProperties | string;
|
|
@@ -1504,6 +1505,7 @@ declare const useSliderField: (props: UseSliderFieldProps) => {
|
|
|
1504
1505
|
id?: string;
|
|
1505
1506
|
name: string;
|
|
1506
1507
|
};
|
|
1508
|
+
type?: string;
|
|
1507
1509
|
variant: string;
|
|
1508
1510
|
as?: string | import("react").ReactNode | import("react").ElementType;
|
|
1509
1511
|
style?: import("react").CSSProperties | string;
|
|
@@ -3457,6 +3459,7 @@ declare const useSliderField: (props: UseSliderFieldProps) => {
|
|
|
3457
3459
|
id?: string;
|
|
3458
3460
|
name: string;
|
|
3459
3461
|
};
|
|
3462
|
+
type?: string;
|
|
3460
3463
|
as?: string | import("react").ReactNode | import("react").ElementType;
|
|
3461
3464
|
style?: import("react").CSSProperties | string;
|
|
3462
3465
|
grid?: import("theme-ui").StylePropertyValue<import("csstype").Property.Grid | undefined>;
|
package/lib/cjs/types/box.d.ts
CHANGED
package/lib/cjs/types/index.d.ts
CHANGED
package/lib/cjs/types/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context0, _context1, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23, _context24, _context25, _context26, _context27, _context28, _context29, _context30, _context31, _context32, _context33, _context34, _context35, _context36, _context37, _context38, _context39, _context40, _context41, _context42, _context43, _context44, _context45, _context46, _context47, _context48, _context49, _context50, _context51, _context52, _context53, _context54, _context55, _context56, _context57, _context58, _context59, _context60, _context61, _context62, _context63, _context64;
|
|
3
|
+
var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context0, _context1, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23, _context24, _context25, _context26, _context27, _context28, _context29, _context30, _context31, _context32, _context33, _context34, _context35, _context36, _context37, _context38, _context39, _context40, _context41, _context42, _context43, _context44, _context45, _context46, _context47, _context48, _context49, _context50, _context51, _context52, _context53, _context54, _context55, _context56, _context57, _context58, _context59, _context60, _context61, _context62, _context63, _context64, _context65;
|
|
4
4
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
5
5
|
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
6
6
|
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
@@ -480,8 +480,19 @@ _forEachInstanceProperty(_context41 = _Object$keys(_navSideBar)).call(_context41
|
|
|
480
480
|
}
|
|
481
481
|
});
|
|
482
482
|
});
|
|
483
|
+
var _numberField = require("./numberField");
|
|
484
|
+
_forEachInstanceProperty(_context42 = _Object$keys(_numberField)).call(_context42, function (key) {
|
|
485
|
+
if (key === "default" || key === "__esModule") return;
|
|
486
|
+
if (key in exports && exports[key] === _numberField[key]) return;
|
|
487
|
+
_Object$defineProperty(exports, key, {
|
|
488
|
+
enumerable: true,
|
|
489
|
+
get: function get() {
|
|
490
|
+
return _numberField[key];
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
});
|
|
483
494
|
var _overlayPanel = require("./overlayPanel");
|
|
484
|
-
_forEachInstanceProperty(
|
|
495
|
+
_forEachInstanceProperty(_context43 = _Object$keys(_overlayPanel)).call(_context43, function (key) {
|
|
485
496
|
if (key === "default" || key === "__esModule") return;
|
|
486
497
|
if (key in exports && exports[key] === _overlayPanel[key]) return;
|
|
487
498
|
_Object$defineProperty(exports, key, {
|
|
@@ -492,7 +503,7 @@ _forEachInstanceProperty(_context42 = _Object$keys(_overlayPanel)).call(_context
|
|
|
492
503
|
});
|
|
493
504
|
});
|
|
494
505
|
var _passwordField = require("./passwordField");
|
|
495
|
-
_forEachInstanceProperty(
|
|
506
|
+
_forEachInstanceProperty(_context44 = _Object$keys(_passwordField)).call(_context44, function (key) {
|
|
496
507
|
if (key === "default" || key === "__esModule") return;
|
|
497
508
|
if (key in exports && exports[key] === _passwordField[key]) return;
|
|
498
509
|
_Object$defineProperty(exports, key, {
|
|
@@ -503,7 +514,7 @@ _forEachInstanceProperty(_context43 = _Object$keys(_passwordField)).call(_contex
|
|
|
503
514
|
});
|
|
504
515
|
});
|
|
505
516
|
var _phoneNumberField = require("./phoneNumberField");
|
|
506
|
-
_forEachInstanceProperty(
|
|
517
|
+
_forEachInstanceProperty(_context45 = _Object$keys(_phoneNumberField)).call(_context45, function (key) {
|
|
507
518
|
if (key === "default" || key === "__esModule") return;
|
|
508
519
|
if (key in exports && exports[key] === _phoneNumberField[key]) return;
|
|
509
520
|
_Object$defineProperty(exports, key, {
|
|
@@ -514,7 +525,7 @@ _forEachInstanceProperty(_context44 = _Object$keys(_phoneNumberField)).call(_con
|
|
|
514
525
|
});
|
|
515
526
|
});
|
|
516
527
|
var _popoverContainer = require("./popoverContainer");
|
|
517
|
-
_forEachInstanceProperty(
|
|
528
|
+
_forEachInstanceProperty(_context46 = _Object$keys(_popoverContainer)).call(_context46, function (key) {
|
|
518
529
|
if (key === "default" || key === "__esModule") return;
|
|
519
530
|
if (key in exports && exports[key] === _popoverContainer[key]) return;
|
|
520
531
|
_Object$defineProperty(exports, key, {
|
|
@@ -525,7 +536,7 @@ _forEachInstanceProperty(_context45 = _Object$keys(_popoverContainer)).call(_con
|
|
|
525
536
|
});
|
|
526
537
|
});
|
|
527
538
|
var _popoverMenu = require("./popoverMenu");
|
|
528
|
-
_forEachInstanceProperty(
|
|
539
|
+
_forEachInstanceProperty(_context47 = _Object$keys(_popoverMenu)).call(_context47, function (key) {
|
|
529
540
|
if (key === "default" || key === "__esModule") return;
|
|
530
541
|
if (key in exports && exports[key] === _popoverMenu[key]) return;
|
|
531
542
|
_Object$defineProperty(exports, key, {
|
|
@@ -536,7 +547,7 @@ _forEachInstanceProperty(_context46 = _Object$keys(_popoverMenu)).call(_context4
|
|
|
536
547
|
});
|
|
537
548
|
});
|
|
538
549
|
var _progressBar = require("./progressBar");
|
|
539
|
-
_forEachInstanceProperty(
|
|
550
|
+
_forEachInstanceProperty(_context48 = _Object$keys(_progressBar)).call(_context48, function (key) {
|
|
540
551
|
if (key === "default" || key === "__esModule") return;
|
|
541
552
|
if (key in exports && exports[key] === _progressBar[key]) return;
|
|
542
553
|
_Object$defineProperty(exports, key, {
|
|
@@ -547,7 +558,7 @@ _forEachInstanceProperty(_context47 = _Object$keys(_progressBar)).call(_context4
|
|
|
547
558
|
});
|
|
548
559
|
});
|
|
549
560
|
var _requirementsList = require("./requirementsList");
|
|
550
|
-
_forEachInstanceProperty(
|
|
561
|
+
_forEachInstanceProperty(_context49 = _Object$keys(_requirementsList)).call(_context49, function (key) {
|
|
551
562
|
if (key === "default" || key === "__esModule") return;
|
|
552
563
|
if (key in exports && exports[key] === _requirementsList[key]) return;
|
|
553
564
|
_Object$defineProperty(exports, key, {
|
|
@@ -558,7 +569,7 @@ _forEachInstanceProperty(_context48 = _Object$keys(_requirementsList)).call(_con
|
|
|
558
569
|
});
|
|
559
570
|
});
|
|
560
571
|
var _rockerButtonGroup = require("./rockerButtonGroup");
|
|
561
|
-
_forEachInstanceProperty(
|
|
572
|
+
_forEachInstanceProperty(_context50 = _Object$keys(_rockerButtonGroup)).call(_context50, function (key) {
|
|
562
573
|
if (key === "default" || key === "__esModule") return;
|
|
563
574
|
if (key in exports && exports[key] === _rockerButtonGroup[key]) return;
|
|
564
575
|
_Object$defineProperty(exports, key, {
|
|
@@ -569,7 +580,7 @@ _forEachInstanceProperty(_context49 = _Object$keys(_rockerButtonGroup)).call(_co
|
|
|
569
580
|
});
|
|
570
581
|
});
|
|
571
582
|
var _scrollBox = require("./scrollBox");
|
|
572
|
-
_forEachInstanceProperty(
|
|
583
|
+
_forEachInstanceProperty(_context51 = _Object$keys(_scrollBox)).call(_context51, function (key) {
|
|
573
584
|
if (key === "default" || key === "__esModule") return;
|
|
574
585
|
if (key in exports && exports[key] === _scrollBox[key]) return;
|
|
575
586
|
_Object$defineProperty(exports, key, {
|
|
@@ -580,7 +591,7 @@ _forEachInstanceProperty(_context50 = _Object$keys(_scrollBox)).call(_context50,
|
|
|
580
591
|
});
|
|
581
592
|
});
|
|
582
593
|
var _searchField = require("./searchField");
|
|
583
|
-
_forEachInstanceProperty(
|
|
594
|
+
_forEachInstanceProperty(_context52 = _Object$keys(_searchField)).call(_context52, function (key) {
|
|
584
595
|
if (key === "default" || key === "__esModule") return;
|
|
585
596
|
if (key in exports && exports[key] === _searchField[key]) return;
|
|
586
597
|
_Object$defineProperty(exports, key, {
|
|
@@ -591,7 +602,7 @@ _forEachInstanceProperty(_context51 = _Object$keys(_searchField)).call(_context5
|
|
|
591
602
|
});
|
|
592
603
|
});
|
|
593
604
|
var _separator = require("./separator");
|
|
594
|
-
_forEachInstanceProperty(
|
|
605
|
+
_forEachInstanceProperty(_context53 = _Object$keys(_separator)).call(_context53, function (key) {
|
|
595
606
|
if (key === "default" || key === "__esModule") return;
|
|
596
607
|
if (key in exports && exports[key] === _separator[key]) return;
|
|
597
608
|
_Object$defineProperty(exports, key, {
|
|
@@ -602,7 +613,7 @@ _forEachInstanceProperty(_context52 = _Object$keys(_separator)).call(_context52,
|
|
|
602
613
|
});
|
|
603
614
|
});
|
|
604
615
|
var _ServerErrorBoundary = require("./ServerErrorBoundary");
|
|
605
|
-
_forEachInstanceProperty(
|
|
616
|
+
_forEachInstanceProperty(_context54 = _Object$keys(_ServerErrorBoundary)).call(_context54, function (key) {
|
|
606
617
|
if (key === "default" || key === "__esModule") return;
|
|
607
618
|
if (key in exports && exports[key] === _ServerErrorBoundary[key]) return;
|
|
608
619
|
_Object$defineProperty(exports, key, {
|
|
@@ -613,7 +624,7 @@ _forEachInstanceProperty(_context53 = _Object$keys(_ServerErrorBoundary)).call(_
|
|
|
613
624
|
});
|
|
614
625
|
});
|
|
615
626
|
var _shared = require("./shared");
|
|
616
|
-
_forEachInstanceProperty(
|
|
627
|
+
_forEachInstanceProperty(_context55 = _Object$keys(_shared)).call(_context55, function (key) {
|
|
617
628
|
if (key === "default" || key === "__esModule") return;
|
|
618
629
|
if (key in exports && exports[key] === _shared[key]) return;
|
|
619
630
|
_Object$defineProperty(exports, key, {
|
|
@@ -624,7 +635,7 @@ _forEachInstanceProperty(_context54 = _Object$keys(_shared)).call(_context54, fu
|
|
|
624
635
|
});
|
|
625
636
|
});
|
|
626
637
|
var _skeleton = require("./skeleton");
|
|
627
|
-
_forEachInstanceProperty(
|
|
638
|
+
_forEachInstanceProperty(_context56 = _Object$keys(_skeleton)).call(_context56, function (key) {
|
|
628
639
|
if (key === "default" || key === "__esModule") return;
|
|
629
640
|
if (key in exports && exports[key] === _skeleton[key]) return;
|
|
630
641
|
_Object$defineProperty(exports, key, {
|
|
@@ -635,7 +646,7 @@ _forEachInstanceProperty(_context55 = _Object$keys(_skeleton)).call(_context55,
|
|
|
635
646
|
});
|
|
636
647
|
});
|
|
637
648
|
var _Stepper = require("./Stepper");
|
|
638
|
-
_forEachInstanceProperty(
|
|
649
|
+
_forEachInstanceProperty(_context57 = _Object$keys(_Stepper)).call(_context57, function (key) {
|
|
639
650
|
if (key === "default" || key === "__esModule") return;
|
|
640
651
|
if (key in exports && exports[key] === _Stepper[key]) return;
|
|
641
652
|
_Object$defineProperty(exports, key, {
|
|
@@ -646,7 +657,7 @@ _forEachInstanceProperty(_context56 = _Object$keys(_Stepper)).call(_context56, f
|
|
|
646
657
|
});
|
|
647
658
|
});
|
|
648
659
|
var _switchField = require("./switchField");
|
|
649
|
-
_forEachInstanceProperty(
|
|
660
|
+
_forEachInstanceProperty(_context58 = _Object$keys(_switchField)).call(_context58, function (key) {
|
|
650
661
|
if (key === "default" || key === "__esModule") return;
|
|
651
662
|
if (key in exports && exports[key] === _switchField[key]) return;
|
|
652
663
|
_Object$defineProperty(exports, key, {
|
|
@@ -657,7 +668,7 @@ _forEachInstanceProperty(_context57 = _Object$keys(_switchField)).call(_context5
|
|
|
657
668
|
});
|
|
658
669
|
});
|
|
659
670
|
var _tab = require("./tab");
|
|
660
|
-
_forEachInstanceProperty(
|
|
671
|
+
_forEachInstanceProperty(_context59 = _Object$keys(_tab)).call(_context59, function (key) {
|
|
661
672
|
if (key === "default" || key === "__esModule") return;
|
|
662
673
|
if (key in exports && exports[key] === _tab[key]) return;
|
|
663
674
|
_Object$defineProperty(exports, key, {
|
|
@@ -668,7 +679,7 @@ _forEachInstanceProperty(_context58 = _Object$keys(_tab)).call(_context58, funct
|
|
|
668
679
|
});
|
|
669
680
|
});
|
|
670
681
|
var _table = require("./table");
|
|
671
|
-
_forEachInstanceProperty(
|
|
682
|
+
_forEachInstanceProperty(_context60 = _Object$keys(_table)).call(_context60, function (key) {
|
|
672
683
|
if (key === "default" || key === "__esModule") return;
|
|
673
684
|
if (key in exports && exports[key] === _table[key]) return;
|
|
674
685
|
_Object$defineProperty(exports, key, {
|
|
@@ -679,7 +690,7 @@ _forEachInstanceProperty(_context59 = _Object$keys(_table)).call(_context59, fun
|
|
|
679
690
|
});
|
|
680
691
|
});
|
|
681
692
|
var _tabs = require("./tabs");
|
|
682
|
-
_forEachInstanceProperty(
|
|
693
|
+
_forEachInstanceProperty(_context61 = _Object$keys(_tabs)).call(_context61, function (key) {
|
|
683
694
|
if (key === "default" || key === "__esModule") return;
|
|
684
695
|
if (key in exports && exports[key] === _tabs[key]) return;
|
|
685
696
|
_Object$defineProperty(exports, key, {
|
|
@@ -690,7 +701,7 @@ _forEachInstanceProperty(_context60 = _Object$keys(_tabs)).call(_context60, func
|
|
|
690
701
|
});
|
|
691
702
|
});
|
|
692
703
|
var _text = require("./text");
|
|
693
|
-
_forEachInstanceProperty(
|
|
704
|
+
_forEachInstanceProperty(_context62 = _Object$keys(_text)).call(_context62, function (key) {
|
|
694
705
|
if (key === "default" || key === "__esModule") return;
|
|
695
706
|
if (key in exports && exports[key] === _text[key]) return;
|
|
696
707
|
_Object$defineProperty(exports, key, {
|
|
@@ -701,7 +712,7 @@ _forEachInstanceProperty(_context61 = _Object$keys(_text)).call(_context61, func
|
|
|
701
712
|
});
|
|
702
713
|
});
|
|
703
714
|
var _textField = require("./textField");
|
|
704
|
-
_forEachInstanceProperty(
|
|
715
|
+
_forEachInstanceProperty(_context63 = _Object$keys(_textField)).call(_context63, function (key) {
|
|
705
716
|
if (key === "default" || key === "__esModule") return;
|
|
706
717
|
if (key in exports && exports[key] === _textField[key]) return;
|
|
707
718
|
_Object$defineProperty(exports, key, {
|
|
@@ -712,7 +723,7 @@ _forEachInstanceProperty(_context62 = _Object$keys(_textField)).call(_context62,
|
|
|
712
723
|
});
|
|
713
724
|
});
|
|
714
725
|
var _timefield = require("./timefield");
|
|
715
|
-
_forEachInstanceProperty(
|
|
726
|
+
_forEachInstanceProperty(_context64 = _Object$keys(_timefield)).call(_context64, function (key) {
|
|
716
727
|
if (key === "default" || key === "__esModule") return;
|
|
717
728
|
if (key in exports && exports[key] === _timefield[key]) return;
|
|
718
729
|
_Object$defineProperty(exports, key, {
|
|
@@ -723,7 +734,7 @@ _forEachInstanceProperty(_context63 = _Object$keys(_timefield)).call(_context63,
|
|
|
723
734
|
});
|
|
724
735
|
});
|
|
725
736
|
var _tooltipTrigger = require("./tooltipTrigger");
|
|
726
|
-
_forEachInstanceProperty(
|
|
737
|
+
_forEachInstanceProperty(_context65 = _Object$keys(_tooltipTrigger)).call(_context65, function (key) {
|
|
727
738
|
if (key === "default" || key === "__esModule") return;
|
|
728
739
|
if (key in exports && exports[key] === _tooltipTrigger[key]) return;
|
|
729
740
|
_Object$defineProperty(exports, key, {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UseFieldProps } from '../hooks/useField/useField';
|
|
3
|
+
import { TestingAttributes } from './shared/test';
|
|
4
|
+
export interface NumberFieldProps extends Omit<UseFieldProps<HTMLInputElement>, 'onChange'>, TestingAttributes {
|
|
5
|
+
/** A custom aria-label for the decrement button.
|
|
6
|
+
* If not provided, the localized string "Decrement" is used. */
|
|
7
|
+
decrementAriaLabel?: string;
|
|
8
|
+
/** A custom aria-label for the increment button.
|
|
9
|
+
* If not provided, the localized string "Increment" is used. */
|
|
10
|
+
incrementAriaLabel?: string;
|
|
11
|
+
/** Formatting options for the value displayed in the number field.
|
|
12
|
+
* This also affects what characters are allowed to be typed by the user.
|
|
13
|
+
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat)
|
|
14
|
+
*/
|
|
15
|
+
formatOptions?: Intl.NumberFormatOptions;
|
|
16
|
+
/** The amount that the input value changes with each increment or decrement "tick". */
|
|
17
|
+
step?: number;
|
|
18
|
+
/** The smallest value allowed for the input. */
|
|
19
|
+
minValue?: number;
|
|
20
|
+
/** The largest value allowed for the input. */
|
|
21
|
+
maxValue?: number;
|
|
22
|
+
/** The default value (uncontrolled). */
|
|
23
|
+
defaultValue?: number;
|
|
24
|
+
/** The current value (controlled). */
|
|
25
|
+
value?: number;
|
|
26
|
+
/** Handler that is called when the value changes. */
|
|
27
|
+
onChange?: (value: number) => void;
|
|
28
|
+
/** Handler that is called when a key is pressed. */
|
|
29
|
+
onKeyDown?: (e: React.KeyboardEvent) => void;
|
|
30
|
+
}
|
|
@@ -10,20 +10,17 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
|
10
10
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
11
11
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
12
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
-
import React, { forwardRef
|
|
13
|
+
import React, { forwardRef } from 'react';
|
|
14
14
|
import { mergeProps, useNumberField } from 'react-aria';
|
|
15
15
|
import { useNumberFieldState } from 'react-stately';
|
|
16
16
|
import { useLocale } from '@react-aria/i18n';
|
|
17
17
|
import omit from 'lodash/omit';
|
|
18
|
-
import PropTypes from 'prop-types';
|
|
19
18
|
import { v4 as uuid } from 'uuid';
|
|
20
19
|
import { Box, FieldHelperText, Icon, IconButton, Input, Label } from '../..';
|
|
21
|
-
import { useField, useGetTheme, usePropWarning } from '../../hooks';
|
|
20
|
+
import { useField, useGetTheme, useLocalOrForwardRef, usePropWarning } from '../../hooks';
|
|
22
21
|
import { getPendoID } from '../../utils/devUtils/constants/pendoID';
|
|
23
|
-
import { ariaAttributesBasePropTypes } from '../../utils/docUtils/ariaAttributes';
|
|
24
|
-
import { inputFieldAttributesBasePropTypes } from '../../utils/docUtils/fieldAttributes';
|
|
25
|
-
import { statusPropTypes } from '../../utils/docUtils/statusProp';
|
|
26
22
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
23
|
+
var displayName = 'NumberField';
|
|
27
24
|
var NumberField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
28
25
|
var helperText = props.helperText,
|
|
29
26
|
status = props.status;
|
|
@@ -38,9 +35,9 @@ var NumberField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
38
35
|
var state = useNumberFieldState(_objectSpread(_objectSpread({}, props), {}, {
|
|
39
36
|
locale: locale
|
|
40
37
|
}));
|
|
41
|
-
var inputRef =
|
|
42
|
-
var incrRef = React.useRef();
|
|
43
|
-
var decRef = React.useRef();
|
|
38
|
+
var inputRef = useLocalOrForwardRef(ref);
|
|
39
|
+
var incrRef = React.useRef(null);
|
|
40
|
+
var decRef = React.useRef(null);
|
|
44
41
|
var _useNumberField = useNumberField(props, state, inputRef),
|
|
45
42
|
labelProps = _useNumberField.labelProps,
|
|
46
43
|
groupProps = _useNumberField.groupProps,
|
|
@@ -53,16 +50,12 @@ var NumberField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
53
50
|
fieldControlWrapperProps = _useField.fieldControlWrapperProps,
|
|
54
51
|
fieldLabelProps = _useField.fieldLabelProps;
|
|
55
52
|
usePropWarning(props, 'disabled', 'isDisabled');
|
|
56
|
-
/* istanbul ignore next */
|
|
57
|
-
useImperativeHandle(ref, function () {
|
|
58
|
-
return inputRef.current;
|
|
59
|
-
});
|
|
60
53
|
var ControlArrows = ___EmotionJSX(Box, {
|
|
61
54
|
variant: "forms.numberField.arrows"
|
|
62
55
|
}, ___EmotionJSX(IconButton, _extends({}, incrementButtonProps, {
|
|
63
|
-
ref:
|
|
64
|
-
tabIndex:
|
|
65
|
-
p: !isOnyx
|
|
56
|
+
ref: incrRef,
|
|
57
|
+
tabIndex: 0,
|
|
58
|
+
p: !isOnyx ? 0 : undefined
|
|
66
59
|
}), ___EmotionJSX(Icon, {
|
|
67
60
|
icon: MenuUp,
|
|
68
61
|
size: numberFieldArrowSize,
|
|
@@ -71,9 +64,9 @@ var NumberField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
71
64
|
},
|
|
72
65
|
"aria-hidden": "true"
|
|
73
66
|
})), ___EmotionJSX(IconButton, _extends({}, decrementButtonProps, {
|
|
74
|
-
ref:
|
|
75
|
-
tabIndex:
|
|
76
|
-
p: !isOnyx
|
|
67
|
+
ref: decRef,
|
|
68
|
+
tabIndex: 0,
|
|
69
|
+
p: !isOnyx ? 0 : undefined
|
|
77
70
|
}), ___EmotionJSX(Icon, {
|
|
78
71
|
icon: MenuDown,
|
|
79
72
|
size: numberFieldArrowSize,
|
|
@@ -82,18 +75,16 @@ var NumberField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
82
75
|
},
|
|
83
76
|
"aria-hidden": "true"
|
|
84
77
|
})));
|
|
85
|
-
|
|
86
|
-
// this needed to remove console warning in React 16
|
|
87
|
-
// I believe once we update to 17 - we can remove this
|
|
78
|
+
var typedFieldControlInputProps = fieldControlInputProps;
|
|
88
79
|
var onInputFocus = function onInputFocus(e) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
inputProps.onFocus(e);
|
|
80
|
+
var _typedFieldControlInp, _inputProps$onFocus;
|
|
81
|
+
(_typedFieldControlInp = typedFieldControlInputProps.onFocus) === null || _typedFieldControlInp === void 0 || _typedFieldControlInp.call(typedFieldControlInputProps, e);
|
|
82
|
+
(_inputProps$onFocus = inputProps.onFocus) === null || _inputProps$onFocus === void 0 || _inputProps$onFocus.call(inputProps, e);
|
|
92
83
|
};
|
|
93
84
|
var onInputBlur = function onInputBlur(e) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
inputProps.onBlur(e);
|
|
85
|
+
var _typedFieldControlInp2, _inputProps$onBlur;
|
|
86
|
+
(_typedFieldControlInp2 = typedFieldControlInputProps.onBlur) === null || _typedFieldControlInp2 === void 0 || _typedFieldControlInp2.call(typedFieldControlInputProps, e);
|
|
87
|
+
(_inputProps$onBlur = inputProps.onBlur) === null || _inputProps$onBlur === void 0 || _inputProps$onBlur.call(inputProps, e);
|
|
97
88
|
};
|
|
98
89
|
var updatedFieldControlInputProps = _objectSpread(_objectSpread({}, fieldControlInputProps), {}, {
|
|
99
90
|
onFocus: onInputFocus,
|
|
@@ -103,13 +94,13 @@ var NumberField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
103
94
|
var updatedLabelProps = _objectSpread({}, mergeProps(fieldLabelProps, labelProps));
|
|
104
95
|
var inputPropsValue = inputProps.value || 0;
|
|
105
96
|
var inputPropsNumericValue = state.numberValue;
|
|
106
|
-
return ___EmotionJSX(Box, _extends({}, getPendoID(
|
|
97
|
+
return ___EmotionJSX(Box, _extends({}, getPendoID(displayName), fieldContainerProps), ___EmotionJSX(Label, updatedLabelProps), ___EmotionJSX(Box, _extends({
|
|
107
98
|
variant: "forms.numberField.noDefaultArrows"
|
|
108
99
|
}, groupProps), ___EmotionJSX(Box, _extends({
|
|
109
100
|
variant: "forms.numberField.arrowsWrapper"
|
|
110
101
|
}, fieldControlWrapperProps, {
|
|
111
102
|
role: "spinbutton",
|
|
112
|
-
"aria-valuetext": inputPropsValue,
|
|
103
|
+
"aria-valuetext": String(inputPropsValue),
|
|
113
104
|
"aria-valuenow": inputPropsNumericValue,
|
|
114
105
|
"aria-labelledby": updatedLabelProps.id
|
|
115
106
|
}), ___EmotionJSX(Input, _extends({
|
|
@@ -124,68 +115,5 @@ var NumberField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
124
115
|
id: helperTextId
|
|
125
116
|
}, helperText)));
|
|
126
117
|
});
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
/** A custom aria-label for the decrement button.
|
|
130
|
-
* If not provided, the localized string "Decrement" is used. */
|
|
131
|
-
decrementAriaLabel: PropTypes.string,
|
|
132
|
-
/** A custom aria-label for the increment button.
|
|
133
|
-
* If not provided, the localized string "Increment" is used. */
|
|
134
|
-
incrementAriaLabel: PropTypes.string,
|
|
135
|
-
/** Formatting options for the value displayed in the number field.
|
|
136
|
-
* This also affects what characters are allowed to be typed by the user.
|
|
137
|
-
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat)
|
|
138
|
-
* */
|
|
139
|
-
formatOptions: PropTypes.shape({}),
|
|
140
|
-
/** Whether the input is disabled. */
|
|
141
|
-
isDisabled: PropTypes.bool,
|
|
142
|
-
/** Whether the input can be selected but not changed by the user. */
|
|
143
|
-
isReadOnly: PropTypes.bool,
|
|
144
|
-
/** Whether user input is required on the input before form submission. */
|
|
145
|
-
isRequired: PropTypes.bool,
|
|
146
|
-
/** Whether the element should receive focus on render. */
|
|
147
|
-
hasAutoFocus: PropTypes.bool,
|
|
148
|
-
/**
|
|
149
|
-
* Callback fired when focus is lost on the input element.
|
|
150
|
-
*/
|
|
151
|
-
onBlur: PropTypes.func,
|
|
152
|
-
/**
|
|
153
|
-
* Callback fired when focus is lost on the input element.
|
|
154
|
-
*/
|
|
155
|
-
onFocus: PropTypes.func,
|
|
156
|
-
/** Handler that is called when the element's focus status changes. */
|
|
157
|
-
onFocusChange: PropTypes.func,
|
|
158
|
-
/** Handler that is called when a key is pressed. */
|
|
159
|
-
onKeyDown: PropTypes.func,
|
|
160
|
-
/** Handler that is called when a key is released. */
|
|
161
|
-
onKeyUp: PropTypes.func,
|
|
162
|
-
/** Temporary text that occupies the text input when it is empty. */
|
|
163
|
-
placeholder: PropTypes.string,
|
|
164
|
-
/** The amount that the input value changes with each increment or decrement "tick".
|
|
165
|
-
* The step prop can be used to snap the value to certain increments.
|
|
166
|
-
* You can read more about this prop here
|
|
167
|
-
* [Step values](https://react-spectrum.adobe.com/react-aria/useNumberField.html#step-values)
|
|
168
|
-
* */
|
|
169
|
-
step: PropTypes.number,
|
|
170
|
-
/** The smallest value allowed for the input. */
|
|
171
|
-
minValue: PropTypes.number,
|
|
172
|
-
/** The largest value allowed for the input. */
|
|
173
|
-
maxValue: PropTypes.number,
|
|
174
|
-
/** The rendered label for the field. */
|
|
175
|
-
label: PropTypes.node,
|
|
176
|
-
/** Text rendered below the input. */
|
|
177
|
-
helperText: PropTypes.node,
|
|
178
|
-
/** Props object that is spread directly into the helphint element. */
|
|
179
|
-
helpHintProps: PropTypes.shape({}),
|
|
180
|
-
/** If present this prop will cause a help hint to render in the label of the field. */
|
|
181
|
-
hintText: PropTypes.string,
|
|
182
|
-
/**
|
|
183
|
-
* Handler that is called when the value changes.
|
|
184
|
-
* (value: number) => void
|
|
185
|
-
*/
|
|
186
|
-
onChange: PropTypes.func,
|
|
187
|
-
/** The default value (uncontrolled). */
|
|
188
|
-
defaultValue: PropTypes.number,
|
|
189
|
-
/** The current value (controlled). */
|
|
190
|
-
value: PropTypes.number
|
|
191
|
-
}, statusPropTypes), ariaAttributesBasePropTypes), inputFieldAttributesBasePropTypes);
|
|
118
|
+
NumberField.displayName = displayName;
|
|
119
|
+
export default NumberField;
|
|
@@ -372,7 +372,8 @@ function Resizer(props) {
|
|
|
372
372
|
onResizeEnd: onResizeEnd
|
|
373
373
|
}, layoutState, ref),
|
|
374
374
|
resizerProps = _useTableColumnResize.resizerProps,
|
|
375
|
-
inputProps = _useTableColumnResize.inputProps
|
|
375
|
+
inputProps = _useTableColumnResize.inputProps,
|
|
376
|
+
isResizing = _useTableColumnResize.isResizing;
|
|
376
377
|
var _useFocusRing = useFocusRing(),
|
|
377
378
|
isFocusVisible = _useFocusRing.isFocusVisible,
|
|
378
379
|
focusProps = _useFocusRing.focusProps;
|
|
@@ -381,8 +382,9 @@ function Resizer(props) {
|
|
|
381
382
|
// keyboard events fired on the input (Enter to start resize, Escape/Tab to
|
|
382
383
|
// end it) bubble up to the element with the keyboard handlers.
|
|
383
384
|
|
|
384
|
-
var _useStatusClasses3 = useStatusClasses('', {
|
|
385
|
-
isFocused: isFocusVisible
|
|
385
|
+
var _useStatusClasses3 = useStatusClasses('resizer', {
|
|
386
|
+
isFocused: isFocusVisible,
|
|
387
|
+
isResizing: isResizing
|
|
386
388
|
}),
|
|
387
389
|
classNames = _useStatusClasses3.classNames;
|
|
388
390
|
return ___EmotionJSX(Box, _extends({
|
|
@@ -447,11 +449,15 @@ function TableColumnHeader(props) {
|
|
|
447
449
|
width: layoutState === null || layoutState === void 0 ? void 0 : layoutState.getColumnWidth(column.key),
|
|
448
450
|
position: 'relative'
|
|
449
451
|
}, column.props.sx)
|
|
450
|
-
}, mergeProps(columnHeaderProps,
|
|
452
|
+
}, mergeProps(columnHeaderProps, column.props)), ___EmotionJSX(Box, _extends({
|
|
453
|
+
as: "button",
|
|
454
|
+
type: "button",
|
|
451
455
|
isRow: true,
|
|
452
456
|
gap: "sm",
|
|
453
|
-
alignItems: "center"
|
|
454
|
-
|
|
457
|
+
alignItems: "center",
|
|
458
|
+
variant: "tableBase.sortButton",
|
|
459
|
+
"aria-label": "Sort by ".concat(column.textValue)
|
|
460
|
+
}, mergeProps(focusProps)), ___EmotionJSX(Text, {
|
|
455
461
|
as: "h4",
|
|
456
462
|
variant: "headText"
|
|
457
463
|
}, column.rendered), allowsSorting && sortIcon), allowsResizing && ___EmotionJSX(Resizer, {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
2
|
import * as TableBaseStories from './TableBase.stories';
|
|
3
|
+
import AccessibilityTable from '../../utils/docUtils/AccessibilityTable';
|
|
3
4
|
|
|
4
5
|
<Meta of={TableBaseStories} isTemplate />
|
|
5
6
|
|
|
@@ -42,23 +43,16 @@ This component requires these additional components:
|
|
|
42
43
|
|
|
43
44
|
### Accessibility
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
#### Screen Readers
|
|
59
|
-
|
|
60
|
-
This component uses the following attributes to assist screen readers:
|
|
61
|
-
- The **`aria-label`** attribute should be provided on the `TableBase` to give the table an accessible name. When a visible `TableCaption` is present, use **`aria-labelledby`** to associate the caption with the table instead.
|
|
62
|
-
- The **`aria-rowcount`** and **`aria-columncount`** attributes are used to indicate the total number of rows and columns in the grid structure.
|
|
63
|
-
- Each `Row` uses the **`aria-rowindex`** attribute to enumerate its position within the table.
|
|
64
|
-
- Each `Column` and `Cell` uses the **`aria-colindex`** attribute to enumerate its position within its row.
|
|
46
|
+
<AccessibilityTable keyboardRows={[
|
|
47
|
+
{ key: 'Tab', description: 'Moves focus into the table (from outside) or out of the table (to the next focusable element after it). The table is a single stop in the page tab sequence — Tab does not move focus between rows or cells within the table.' },
|
|
48
|
+
{ key: 'Shift + Tab', description: 'Moves focus out of the table to the previous focusable element (or into the table from after it).' },
|
|
49
|
+
{ key: 'Space or Enter', description: 'Triggers an action on the focused component, such as toggling row selection or sorting a column.' },
|
|
50
|
+
{ key: 'Arrow keys', description: 'Moves focus between rows and cells within the table.' },
|
|
51
|
+
{ key: 'Home or Page Up', description: 'Shifts the focus to the first row.' },
|
|
52
|
+
{ key: 'End or Page Down', description: 'Shifts the focus to the last visible row.' },
|
|
53
|
+
]} screenReaderRows={[
|
|
54
|
+
'The **`aria-label`** attribute should be provided on the `TableBase` to give the table an accessible name. When a visible `TableCaption` is present, use **`aria-labelledby`** to associate the caption with the table instead.',
|
|
55
|
+
'The **`aria-rowcount`** and **`aria-columncount`** attributes are used to indicate the total number of rows and columns in the grid structure.',
|
|
56
|
+
'Each `Row` uses the **`aria-rowindex`** attribute to enumerate its position within the table.',
|
|
57
|
+
'Each `Column` and `Cell` uses the **`aria-colindex`** attribute to enumerate its position within its row.',
|
|
58
|
+
]} />
|