@autoguru/overdrive 2.7.0-next.6 → 2.7.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/CHANGELOG.md +155 -115
- package/lib/components/Alert/Alert.treat.ts +1 -1
- package/lib/components/Alert/Alert.tsx +8 -9
- package/lib/components/Badge/Badge.tsx +12 -3
- package/lib/components/Box/useBoxStyles.treat.ts +2 -1
- package/lib/components/Box/useBoxStyles.ts +2 -2
- package/lib/components/Button/Button.tsx +3 -0
- package/lib/components/Columns/Column.treat.ts +1 -1
- package/lib/components/Columns/Column.tsx +4 -1
- package/lib/components/Columns/Columns.treat.ts +1 -1
- package/lib/components/Columns/Columns.tsx +4 -1
- package/lib/components/Icon/Icon.treat.ts +1 -1
- package/lib/components/Icon/Icon.tsx +4 -1
- package/lib/components/Inline/Inline.tsx +1 -1
- package/lib/components/NumberInput/NumberInput.tsx +70 -14
- package/lib/components/Section/Section.treat.ts +1 -1
- package/lib/components/Stack/Stack.treat.ts +1 -1
- package/lib/components/StandardModal/StandardModal.tsx +1 -0
- package/lib/components/Text/useTextStyles.treat.ts +1 -1
- package/lib/components/Toaster/Toast.tsx +8 -0
- package/lib/components/private/InputBase/withEnhancedInput.tsx +2 -2
- package/lib/hooks/useAttachedBoxes/useAttachedBoxes.treat.ts +2 -1
- package/lib/hooks/useAttachedBoxes/useAttachedBoxes.tsx +9 -4
- package/lib/hooks/useNegativeMargin/useNegativeMarginLeft.treat.ts +1 -1
- package/lib/hooks/useNegativeMargin/useNegativeMarginLeft.ts +4 -1
- package/lib/hooks/useNegativeMargin/useNegativeMarginTop.treat.ts +1 -1
- package/lib/hooks/useNegativeMargin/useNegativeMarginTop.ts +4 -1
- package/lib/hooks/useResponsiveValue/useResponsiveValue.ts +4 -1
- package/lib/index.ts +4 -0
- package/lib/themes/makeTheme.ts +3 -0
- package/lib/themes/tokens.ts +0 -4
- package/lib/utils/index.ts +0 -3
- package/package.json +27 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,109 @@
|
|
|
1
1
|
# @autoguru/overdrive
|
|
2
2
|
|
|
3
|
+
## 2.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f982d1c: Upgraded to react v18 alpha
|
|
8
|
+
- 0fa7afd: Overdsrive: Gets compiled into javascripts and typescript types
|
|
9
|
+
- 7033333: Hooks: New useAttachedBoxes helper hook
|
|
10
|
+
- f15d951: Hooks: New useResponsiveValue value hook
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- b7e6aae: Adds relese script
|
|
15
|
+
- 25dda76: Attached Boxes: Accept default box props
|
|
16
|
+
- 85e9ceb: StandardModal: Hides it's frame overflow
|
|
17
|
+
- d08c689: Badge: Gets new large size
|
|
18
|
+
- 96a8299: NumberInput: Gets new preventMouseWheel prop to prevent value
|
|
19
|
+
change while scrolling
|
|
20
|
+
- fd3cea4: AttachedBoxes: Do not get default paddings
|
|
21
|
+
- 7f2122b: Adds more utils root export
|
|
22
|
+
- b7e6aae: Overdrive: Gets files list added to package.json
|
|
23
|
+
- b7e6aae: Fixes main file
|
|
24
|
+
- 006435e: StandardModal: Gets narrow and skinny sizes
|
|
25
|
+
- d89cd04: LoadingBox Accepts default Box props
|
|
26
|
+
- b7e6aae: Overdrive index main index files fixed
|
|
27
|
+
- ded7b5d: Inputs: Get their hover states going to a darker shade
|
|
28
|
+
- 8b1f6df: useResponsiveValue: Gets exported from libs root
|
|
29
|
+
- fd3cea4: AttachedBoxes: Accept external classnames
|
|
30
|
+
- ff9a789: Sets index.ts as main entry file
|
|
31
|
+
- ba85147: Overdrive: Multiple export changes
|
|
32
|
+
- 5c1b018: Publish command: Nolonger compiles to JS
|
|
33
|
+
|
|
34
|
+
## 2.7.0-next.18
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Overdrive: Multiple export changes
|
|
39
|
+
|
|
40
|
+
## 2.7.0-next.17
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- Badge: Gets new large size
|
|
45
|
+
|
|
46
|
+
## 2.7.0-next.16
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- Publish command: Nolonger compiles to JS
|
|
51
|
+
|
|
52
|
+
## 2.7.0-next.15
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- Adds more utils root export
|
|
57
|
+
|
|
58
|
+
## 2.7.0-next.14
|
|
59
|
+
|
|
60
|
+
### Patch Changes
|
|
61
|
+
|
|
62
|
+
- Sets index.ts as main entry file
|
|
63
|
+
|
|
64
|
+
## 2.7.0-next.13
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- Fixes main file
|
|
69
|
+
|
|
70
|
+
## 2.7.0-next.12
|
|
71
|
+
|
|
72
|
+
### Patch Changes
|
|
73
|
+
|
|
74
|
+
- Overdrive index main index files fixed
|
|
75
|
+
|
|
76
|
+
## 2.7.0-next.11
|
|
77
|
+
|
|
78
|
+
### Patch Changes
|
|
79
|
+
|
|
80
|
+
- Overdrive: Gets files list added to package.json
|
|
81
|
+
|
|
82
|
+
## 2.7.0-next.10
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- Adds relese script
|
|
87
|
+
|
|
88
|
+
## 2.7.0-next.9
|
|
89
|
+
|
|
90
|
+
### Minor Changes
|
|
91
|
+
|
|
92
|
+
- Overdsrive: Gets compiled into javascripts and typescript types
|
|
93
|
+
|
|
94
|
+
## 2.7.0-next.8
|
|
95
|
+
|
|
96
|
+
### Patch Changes
|
|
97
|
+
|
|
98
|
+
- NumberInput: Gets new preventMouseWheel prop to prevent value change while
|
|
99
|
+
scrolling
|
|
100
|
+
|
|
101
|
+
## 2.7.0-next.7
|
|
102
|
+
|
|
103
|
+
### Patch Changes
|
|
104
|
+
|
|
105
|
+
- StandardModal: Hides it's frame overflow
|
|
106
|
+
|
|
3
107
|
## 2.7.0-next.6
|
|
4
108
|
|
|
5
109
|
### Patch Changes
|
|
@@ -312,19 +416,7 @@
|
|
|
312
416
|
**Example:**
|
|
313
417
|
|
|
314
418
|
```jsx
|
|
315
|
-
<Tabs active={0}>
|
|
316
|
-
<TabList>
|
|
317
|
-
<Tab>tab 1</Tab>
|
|
318
|
-
<Tab>tab 2</Tab>
|
|
319
|
-
</TabList>
|
|
320
|
-
<TabPanes>
|
|
321
|
-
<TabPane>tab 1 content</TabPane>
|
|
322
|
-
<TabPane>
|
|
323
|
-
{/* Will still be in the DOM, and React comeponet to have state retained */}
|
|
324
|
-
tab 2 content
|
|
325
|
-
</TabPane>
|
|
326
|
-
</TabPanes>
|
|
327
|
-
</Tabs>
|
|
419
|
+
<Tabs active={0}>> > > > > > > } t > ></Tabs>
|
|
328
420
|
```
|
|
329
421
|
|
|
330
422
|
- 7131a5f: **Tabs:** Fixes a visual quirk when indications are mixed with
|
|
@@ -386,10 +478,7 @@
|
|
|
386
478
|
**FEATURES**
|
|
387
479
|
|
|
388
480
|
```jsx
|
|
389
|
-
<Stack is="ul">
|
|
390
|
-
<BulletText>Point A</BulletText>
|
|
391
|
-
<BulletText>Point B</BulletText>
|
|
392
|
-
</Stack>
|
|
481
|
+
<Stack is="ul">> ></Stack>
|
|
393
482
|
```
|
|
394
483
|
|
|
395
484
|
which already wraps each child in an `li`.
|
|
@@ -429,24 +518,7 @@
|
|
|
429
518
|
### Example
|
|
430
519
|
|
|
431
520
|
```jsx
|
|
432
|
-
<Table columnTemplate="repeat(2, auto)">
|
|
433
|
-
<TableRowGroup>
|
|
434
|
-
<TableRow>
|
|
435
|
-
<TableHeadCell>Col 1</TableHeadCell>
|
|
436
|
-
<TableHeadCell>Col 2</TableHeadCell>
|
|
437
|
-
</TableRow>
|
|
438
|
-
</TableRowGroup>
|
|
439
|
-
<TableRowGroup>
|
|
440
|
-
<TableRow>
|
|
441
|
-
<TableCell>Row 1, Col 1</TableCell>
|
|
442
|
-
<TableCell>Row 1, Col 2</TableCell>
|
|
443
|
-
</TableRow>
|
|
444
|
-
<TableRow>
|
|
445
|
-
<TableCell>Row 2, Col 1</TableCell>
|
|
446
|
-
<TableCell>Row 2, Col 2</TableCell>
|
|
447
|
-
</TableRow>
|
|
448
|
-
</TableRowGroup>
|
|
449
|
-
</Table>
|
|
521
|
+
<Table columnTemplate="repeat(2, auto)">></Table>
|
|
450
522
|
```
|
|
451
523
|
|
|
452
524
|
### Sticky Header
|
|
@@ -454,17 +526,17 @@
|
|
|
454
526
|
```diff
|
|
455
527
|
-<Table columnTemplate="repeat(2, auto)">
|
|
456
528
|
+<Table stickyHead columnTemplate="repeat(2, auto)">
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
529
|
+
>
|
|
530
|
+
>
|
|
531
|
+
>
|
|
460
532
|
```
|
|
461
533
|
|
|
462
534
|
### Sorting Columns
|
|
463
535
|
|
|
464
536
|
```diff
|
|
465
537
|
<Table columnTemplate="repeat(2, auto)">
|
|
466
|
-
|
|
467
|
-
|
|
538
|
+
>
|
|
539
|
+
>
|
|
468
540
|
- <TableHeadCell>Col 1</TableHeadCell>
|
|
469
541
|
+ <TableHeadCell sort="asc" onSortChange={}>Col 1</TableHeadCell>
|
|
470
542
|
```
|
|
@@ -479,10 +551,10 @@
|
|
|
479
551
|
|
|
480
552
|
```diff
|
|
481
553
|
<Table columnTemplate="repeat(2, auto)">
|
|
482
|
-
|
|
554
|
+
>
|
|
483
555
|
- <TableRow>
|
|
484
556
|
+ <TableRow onClick={}>
|
|
485
|
-
|
|
557
|
+
>
|
|
486
558
|
```
|
|
487
559
|
|
|
488
560
|
Please note; that if you're also tracking clicks of cell buttons, to check
|
|
@@ -512,8 +584,8 @@
|
|
|
512
584
|
```jsx
|
|
513
585
|
<VisuallyHidden>hello screen reader</VisuallyHidden>
|
|
514
586
|
<Text>
|
|
515
|
-
|
|
516
|
-
|
|
587
|
+
o
|
|
588
|
+
>
|
|
517
589
|
</Text>
|
|
518
590
|
```
|
|
519
591
|
|
|
@@ -523,7 +595,7 @@
|
|
|
523
595
|
|
|
524
596
|
```jsx
|
|
525
597
|
<Text is="span" display="inlineBlock">
|
|
526
|
-
|
|
598
|
+
k
|
|
527
599
|
</Text>
|
|
528
600
|
```
|
|
529
601
|
|
|
@@ -566,7 +638,7 @@
|
|
|
566
638
|
|
|
567
639
|
```jsx
|
|
568
640
|
<Box display="flex" width="full" justifyContent="center">
|
|
569
|
-
|
|
641
|
+
>
|
|
570
642
|
</Box>
|
|
571
643
|
```
|
|
572
644
|
|
|
@@ -582,9 +654,9 @@
|
|
|
582
654
|
<Stack is="ul"
|
|
583
655
|
- spacing="3">
|
|
584
656
|
+ space="3">
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
657
|
+
>
|
|
658
|
+
>
|
|
659
|
+
>
|
|
588
660
|
</Stack>
|
|
589
661
|
```
|
|
590
662
|
|
|
@@ -595,12 +667,7 @@
|
|
|
595
667
|
**FEATURES**
|
|
596
668
|
|
|
597
669
|
```jsx
|
|
598
|
-
<Inline dividers>
|
|
599
|
-
<Text>Mazda</Text>
|
|
600
|
-
<Text>CX3</Text>
|
|
601
|
-
<Text>Petrol</Text>
|
|
602
|
-
<Text>2020</Text>
|
|
603
|
-
</Inline>
|
|
670
|
+
<Inline dividers>> > > ></Inline>
|
|
604
671
|
```
|
|
605
672
|
|
|
606
673
|
- a0fce92: Text: Exposes a new white-space nowrap prop
|
|
@@ -636,14 +703,7 @@
|
|
|
636
703
|
**FEATURES**
|
|
637
704
|
|
|
638
705
|
```jsx
|
|
639
|
-
<Tabs>
|
|
640
|
-
<TabList scrollable>
|
|
641
|
-
<Tab>This</Tab>
|
|
642
|
-
<Tab>Tab</Tab>
|
|
643
|
-
<Tab>Might</Tab>
|
|
644
|
-
<Tab>Scroll</Tab>
|
|
645
|
-
</TabList>
|
|
646
|
-
</Tabs>
|
|
706
|
+
<Tabs>> > > > > ></Tabs>
|
|
647
707
|
```
|
|
648
708
|
|
|
649
709
|
- 729dfdd: Input: Notchless inputs will no longer break when part of a flex
|
|
@@ -659,17 +719,7 @@
|
|
|
659
719
|
would not have worked:
|
|
660
720
|
|
|
661
721
|
```jsx
|
|
662
|
-
<Stack>
|
|
663
|
-
<p>line 0</p>
|
|
664
|
-
{isEnabled && (
|
|
665
|
-
<>
|
|
666
|
-
<p>Line 1</p>
|
|
667
|
-
<p>Line 2</p>
|
|
668
|
-
<p>Line 3</p>
|
|
669
|
-
</>
|
|
670
|
-
)}
|
|
671
|
-
<p>line 4</p>
|
|
672
|
-
</Stack>
|
|
722
|
+
<Stack>> ( > > > > > } ></Stack>
|
|
673
723
|
```
|
|
674
724
|
|
|
675
725
|
> which would have the past not had lines 1-3 spaced evenly.
|
|
@@ -716,12 +766,12 @@
|
|
|
716
766
|
```diff
|
|
717
767
|
- <Box className={clsx(styles.one, styles.two)}>
|
|
718
768
|
+ <Box className={[styles.one, styles.two]}>
|
|
719
|
-
|
|
769
|
+
o
|
|
720
770
|
</Box>
|
|
721
771
|
|
|
722
772
|
- <Box className={clsx({[styles.one]: maybeDoMe}, styles.two)}>
|
|
723
773
|
+ <Box className={[{[styles.one]: maybeDoMe}, styles.two]}>
|
|
724
|
-
|
|
774
|
+
o
|
|
725
775
|
</Box>
|
|
726
776
|
```
|
|
727
777
|
|
|
@@ -747,9 +797,8 @@
|
|
|
747
797
|
`<AutoSuggest>` can now be given a `autoWidth` prop that will auto the width
|
|
748
798
|
in relation to setting the width, or for it to be automatic.
|
|
749
799
|
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
- `autoWidth={false}` means to set to the width of the select input.
|
|
800
|
+
- `autoWidth={true}` means, size the flyout to the width of flyout children "automatically"
|
|
801
|
+
- `autoWidth={false}` means to set to the width of the select input.
|
|
753
802
|
|
|
754
803
|
eg:
|
|
755
804
|
|
|
@@ -757,15 +806,15 @@
|
|
|
757
806
|
|
|
758
807
|
// size to the width of the flyout children
|
|
759
808
|
<AutoSuggest
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
809
|
+
"
|
|
810
|
+
}
|
|
811
|
+
h
|
|
763
812
|
/>
|
|
764
813
|
|
|
765
814
|
// size to the width of the input (current behaviour)
|
|
766
815
|
<AutoSuggest
|
|
767
|
-
|
|
768
|
-
|
|
816
|
+
"
|
|
817
|
+
}
|
|
769
818
|
/>
|
|
770
819
|
|
|
771
820
|
```
|
|
@@ -840,16 +889,16 @@
|
|
|
840
889
|
```jsx
|
|
841
890
|
// Input
|
|
842
891
|
<div>
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
892
|
+
g
|
|
893
|
+
>
|
|
894
|
+
>
|
|
895
|
+
>
|
|
847
896
|
</div>
|
|
848
897
|
|
|
849
898
|
// Result
|
|
850
899
|
<body>
|
|
851
|
-
|
|
852
|
-
|
|
900
|
+
>
|
|
901
|
+
>
|
|
853
902
|
</body>
|
|
854
903
|
```
|
|
855
904
|
|
|
@@ -863,8 +912,8 @@
|
|
|
863
912
|
backdrop. Also; if you wish to remove the fadeIn/fadeOut animation, a
|
|
864
913
|
`transition?: boolean` can also be provided.
|
|
865
914
|
|
|
866
|
-
|
|
867
|
-
|
|
915
|
+
- Removes `<ModalPortal />` in favor of `<Modal />`
|
|
916
|
+
- Deprecated `withModal`, which could simply just use the Modal component
|
|
868
917
|
|
|
869
918
|
Worth noting that a `role="presentation"` is applied to the `Modal`, so
|
|
870
919
|
consumers should be applying a `role="none presentation"` to their direct
|
|
@@ -874,7 +923,7 @@
|
|
|
874
923
|
|
|
875
924
|
```jsx
|
|
876
925
|
<Modal isOpen={true} onRequestClose={function() {}}>
|
|
877
|
-
|
|
926
|
+
>
|
|
878
927
|
</Modal>
|
|
879
928
|
```
|
|
880
929
|
|
|
@@ -896,10 +945,10 @@
|
|
|
896
945
|
|
|
897
946
|
```
|
|
898
947
|
<Tabs>
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
948
|
+
>
|
|
949
|
+
>
|
|
950
|
+
>
|
|
951
|
+
>
|
|
903
952
|
</Tabs>
|
|
904
953
|
```
|
|
905
954
|
|
|
@@ -918,11 +967,9 @@
|
|
|
918
967
|
|
|
919
968
|
Breakpoints have been amended to follow (mobile first):
|
|
920
969
|
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
- `largeDesktop` is taken as a 1920x1080 less 25%, so any device larger
|
|
925
|
-
than 1440px
|
|
970
|
+
- `tablet` is iPad Mini width less 25%, so any device greater than 768px
|
|
971
|
+
- `desktop` we are considering as iPad Pro width less 25%, so any device larger than 1024px
|
|
972
|
+
- `largeDesktop` is taken as a 1920x1080 less 25%, so any device larger than 1440px
|
|
926
973
|
|
|
927
974
|
all at landscape.
|
|
928
975
|
|
|
@@ -934,11 +981,7 @@
|
|
|
934
981
|
eg:
|
|
935
982
|
|
|
936
983
|
```jsx
|
|
937
|
-
<Inline>
|
|
938
|
-
<Badge colour="green" label="Success" />
|
|
939
|
-
<Badge colour="red" label="Danger" />
|
|
940
|
-
<Badge colour="blue" label="Information" />
|
|
941
|
-
</Inline>
|
|
984
|
+
<Inline>> > ></Inline>
|
|
942
985
|
```
|
|
943
986
|
|
|
944
987
|
**`<Section />`**
|
|
@@ -960,10 +1003,7 @@
|
|
|
960
1003
|
|
|
961
1004
|
```jsx
|
|
962
1005
|
<Section width="medium" paddingX={['3', , 'none']}>
|
|
963
|
-
|
|
964
|
-
<Column width="2/3">...</Column>
|
|
965
|
-
<Column width="1/3">...</Column>
|
|
966
|
-
</Columns>
|
|
1006
|
+
>
|
|
967
1007
|
</Section>
|
|
968
1008
|
```
|
|
969
1009
|
|
|
@@ -1000,7 +1040,7 @@
|
|
|
1000
1040
|
```diff
|
|
1001
1041
|
-<Actions className="test">
|
|
1002
1042
|
+<Actions>
|
|
1003
|
-
|
|
1043
|
+
.
|
|
1004
1044
|
</Actions>
|
|
1005
1045
|
```
|
|
1006
1046
|
|
|
@@ -1012,9 +1052,9 @@
|
|
|
1012
1052
|
|
|
1013
1053
|
**A few changes**
|
|
1014
1054
|
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1055
|
+
- `OverdriveProvider` must now be provider
|
|
1056
|
+
- `ToastProvider` must also be provided when using a `useToast`
|
|
1057
|
+
- `@autoguru/overdrive/reset` must be given first.
|
|
1018
1058
|
|
|
1019
1059
|
... and a whole series of other things. Please consult to the PR (#273) to
|
|
1020
1060
|
get a better idea of what's changed.
|
|
@@ -19,23 +19,22 @@ import { Text, useTextStyles } from '../Text';
|
|
|
19
19
|
|
|
20
20
|
import * as styleRefs from './Alert.treat';
|
|
21
21
|
|
|
22
|
+
type Intent = keyof Omit<
|
|
23
|
+
typeof styleRefs.intent,
|
|
24
|
+
'neutral' | 'shine' | 'primary' | 'secondary'
|
|
25
|
+
>;
|
|
26
|
+
|
|
22
27
|
export interface Props {
|
|
23
28
|
children: ReactChild;
|
|
24
29
|
className?: string;
|
|
25
|
-
intent?:
|
|
30
|
+
intent?: Intent;
|
|
26
31
|
inline?: boolean;
|
|
27
32
|
dismissible?: boolean;
|
|
28
33
|
|
|
29
34
|
onRequestClose?: ComponentProps<typeof Button>['onClick'];
|
|
30
35
|
}
|
|
31
36
|
|
|
32
|
-
const
|
|
33
|
-
keyof Omit<
|
|
34
|
-
typeof styleRefs.intent,
|
|
35
|
-
'neutral' | 'shine' | 'primary' | 'secondary'
|
|
36
|
-
>,
|
|
37
|
-
IconType
|
|
38
|
-
> = {
|
|
37
|
+
const iconMapForIntent: Record<Intent, IconType> = {
|
|
39
38
|
danger: AlertCircleIcon,
|
|
40
39
|
information: InformationIcon,
|
|
41
40
|
success: CheckCircleIcon,
|
|
@@ -70,7 +69,7 @@ export const Alert: FunctionComponent<Props> = ({
|
|
|
70
69
|
<Columns noWrap spaceX="2">
|
|
71
70
|
<Column noShrink alignSelf="top">
|
|
72
71
|
<Icon
|
|
73
|
-
icon={
|
|
72
|
+
icon={iconMapForIntent[intent]}
|
|
74
73
|
size="medium"
|
|
75
74
|
className={useBoxStyles({
|
|
76
75
|
marginY: '2',
|
|
@@ -14,13 +14,21 @@ export interface Props {
|
|
|
14
14
|
colour?: keyof typeof styleRefs.colours.default;
|
|
15
15
|
className?: string;
|
|
16
16
|
look?: 'standard' | 'inverted';
|
|
17
|
+
size?: 'standard' | 'large';
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export const Badge = memo<Props>(
|
|
20
|
-
({
|
|
21
|
+
({
|
|
22
|
+
label,
|
|
23
|
+
colour = 'neutral',
|
|
24
|
+
look = 'standard',
|
|
25
|
+
size = 'standard',
|
|
26
|
+
className = '',
|
|
27
|
+
}) => {
|
|
28
|
+
const isStandardSize = size === 'standard';
|
|
21
29
|
const styles = useStyles(styleRefs);
|
|
22
30
|
const textStyles = useTextStyles({
|
|
23
|
-
size: '2',
|
|
31
|
+
size: isStandardSize ? '2' : '4',
|
|
24
32
|
noWrap: true,
|
|
25
33
|
fontWeight: 'semiBold',
|
|
26
34
|
colour: 'unset',
|
|
@@ -43,7 +51,8 @@ export const Badge = memo<Props>(
|
|
|
43
51
|
]}
|
|
44
52
|
overflow="hidden"
|
|
45
53
|
display="block"
|
|
46
|
-
|
|
54
|
+
paddingX={isStandardSize ? '1' : '4'}
|
|
55
|
+
paddingY={isStandardSize ? '1' : '2'}
|
|
47
56
|
borderRadius="1">
|
|
48
57
|
<Box
|
|
49
58
|
is="span"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { style, styleMap } from 'treat';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { mapTokenToProperty } from '../../utils/mapTokenToProperty';
|
|
4
|
+
import { makeResponsiveStyle } from '../../utils/responsiveProps';
|
|
4
5
|
|
|
5
6
|
export const padding = {
|
|
6
7
|
top: makeResponsiveStyle((theme) => theme.space, 'paddingTop'),
|
|
@@ -3,8 +3,8 @@ import type { JSXElementConstructor } from 'react';
|
|
|
3
3
|
import { useStyles } from 'react-treat';
|
|
4
4
|
import type { Theme } from 'treat/theme';
|
|
5
5
|
|
|
6
|
-
import type { ResponsiveProp } from '../../utils';
|
|
7
|
-
import { resolveResponsiveStyle } from '../../utils';
|
|
6
|
+
import type { ResponsiveProp } from '../../utils/responsiveProps';
|
|
7
|
+
import { resolveResponsiveStyle } from '../../utils/responsiveProps';
|
|
8
8
|
|
|
9
9
|
import * as resetStyleRefs from '../../reset/reset.treat';
|
|
10
10
|
import * as styleRefs from './useBoxStyles.treat';
|
|
@@ -169,8 +169,11 @@ export const Button = forwardRef<HTMLButtonElement, Props>(
|
|
|
169
169
|
</Box>
|
|
170
170
|
);
|
|
171
171
|
|
|
172
|
+
|
|
172
173
|
return isValidElement(Component)
|
|
174
|
+
// @ts-ignore
|
|
173
175
|
? cloneElement(Component, { ref, ...props }, child)
|
|
176
|
+
// @ts-ignore
|
|
174
177
|
: createElement(Component, { ref, ...props }, child);
|
|
175
178
|
},
|
|
176
179
|
);
|
|
@@ -3,7 +3,10 @@ import * as React from 'react';
|
|
|
3
3
|
import { ComponentProps, forwardRef, ReactNode, useContext } from 'react';
|
|
4
4
|
import { useStyles } from 'react-treat';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
resolveResponsiveStyle,
|
|
8
|
+
ResponsiveProp,
|
|
9
|
+
} from '../../utils/responsiveProps';
|
|
7
10
|
import { Box } from '../Box';
|
|
8
11
|
|
|
9
12
|
import { ColumnContext } from './Columns';
|
|
@@ -9,7 +9,10 @@ import {
|
|
|
9
9
|
useNegativeMarginLeft,
|
|
10
10
|
useNegativeMarginTop,
|
|
11
11
|
} from '../../hooks/useNegativeMargin/useNegativeMargin';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
resolveResponsiveStyle,
|
|
14
|
+
ResponsiveProp,
|
|
15
|
+
} from '../../utils/responsiveProps';
|
|
13
16
|
import { Box } from '../Box';
|
|
14
17
|
|
|
15
18
|
import * as styleRefs from './Columns.treat';
|
|
@@ -4,7 +4,10 @@ import * as React from 'react';
|
|
|
4
4
|
import { cloneElement, memo } from 'react';
|
|
5
5
|
import { useStyles } from 'react-treat';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
resolveResponsiveStyle,
|
|
9
|
+
ResponsiveProp,
|
|
10
|
+
} from '../../utils/responsiveProps';
|
|
8
11
|
import type { BoxStyleProps } from '../Box';
|
|
9
12
|
import { Box, useBoxStyles } from '../Box';
|
|
10
13
|
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
useNegativeMarginLeft,
|
|
9
9
|
useNegativeMarginTop,
|
|
10
10
|
} from '../../hooks/useNegativeMargin/useNegativeMargin';
|
|
11
|
-
import type { ResponsiveProp } from '../../utils';
|
|
11
|
+
import type { ResponsiveProp } from '../../utils/responsiveProps';
|
|
12
12
|
import type { BoxStyleProps } from '../Box';
|
|
13
13
|
import { Box } from '../Box';
|
|
14
14
|
import { Text } from '../Text';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
2
3
|
|
|
3
4
|
import { Box } from '../Box';
|
|
4
5
|
import { withEnhancedInput } from '../private/InputBase';
|
|
@@ -8,27 +9,82 @@ const isEdge: boolean =
|
|
|
8
9
|
|
|
9
10
|
const type = isEdge ? 'text' : 'number';
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
Partial<Pick<HTMLInputElement, 'min' | 'max' | 'step'>>
|
|
13
|
-
|
|
12
|
+
interface Props
|
|
13
|
+
extends Partial<Pick<HTMLInputElement, 'min' | 'max' | 'step'>> {
|
|
14
|
+
preventMouseWheel?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const NumberInput = withEnhancedInput<Props>(
|
|
14
18
|
({
|
|
15
|
-
field,
|
|
19
|
+
field: { ref, ...incomingFieldProps },
|
|
16
20
|
eventHandlers,
|
|
17
21
|
validation,
|
|
18
22
|
isLoading,
|
|
19
23
|
suffixed,
|
|
20
24
|
prefixed,
|
|
25
|
+
preventMouseWheel = false,
|
|
21
26
|
...rest
|
|
22
|
-
}) =>
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
}) => {
|
|
28
|
+
const inputRef = useRef<HTMLInputElement>(ref?.current);
|
|
29
|
+
|
|
30
|
+
const preventWheel = useCallback<EventListener>((e) => {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
e.stopPropagation();
|
|
33
|
+
}, []);
|
|
34
|
+
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
let mouseWheelListener;
|
|
37
|
+
let onWheelListener;
|
|
38
|
+
let wheelListener;
|
|
39
|
+
if (preventMouseWheel && inputRef?.current) {
|
|
40
|
+
mouseWheelListener = inputRef.current.addEventListener(
|
|
41
|
+
'mousewheel',
|
|
42
|
+
preventWheel,
|
|
43
|
+
);
|
|
44
|
+
onWheelListener = inputRef.current.addEventListener(
|
|
45
|
+
'onwheel',
|
|
46
|
+
preventWheel,
|
|
47
|
+
);
|
|
48
|
+
wheelListener = inputRef.current.addEventListener(
|
|
49
|
+
'wheel',
|
|
50
|
+
preventWheel,
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return () => {
|
|
55
|
+
if (mouseWheelListener)
|
|
56
|
+
// Standard
|
|
57
|
+
inputRef.current.removeEventListener(
|
|
58
|
+
'mousewheel',
|
|
59
|
+
mouseWheelListener,
|
|
60
|
+
);
|
|
61
|
+
if (onWheelListener)
|
|
62
|
+
// Chrome
|
|
63
|
+
inputRef.current.removeEventListener(
|
|
64
|
+
'onwheel',
|
|
65
|
+
onWheelListener,
|
|
66
|
+
);
|
|
67
|
+
if (wheelListener)
|
|
68
|
+
// Safari
|
|
69
|
+
inputRef.current.removeEventListener(
|
|
70
|
+
'wheel',
|
|
71
|
+
wheelListener,
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
}, [preventMouseWheel, inputRef.current]);
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<Box
|
|
78
|
+
is="input"
|
|
79
|
+
ref={inputRef}
|
|
80
|
+
{...eventHandlers}
|
|
81
|
+
{...incomingFieldProps}
|
|
82
|
+
{...rest}
|
|
83
|
+
autoComplete="off"
|
|
84
|
+
type={type}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
},
|
|
32
88
|
{
|
|
33
89
|
primitiveType: type,
|
|
34
90
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Style, style, styleMap } from 'treat';
|
|
2
2
|
import type { Theme } from 'treat/theme';
|
|
3
3
|
|
|
4
|
-
import { mapTokenToProperty } from '../../utils';
|
|
4
|
+
import { mapTokenToProperty } from '../../utils/mapTokenToProperty';
|
|
5
5
|
|
|
6
6
|
export const root = style(({ typography }) => ({
|
|
7
7
|
selectors: {
|
|
@@ -136,22 +136,28 @@ export const useToast = (): ToastFn => {
|
|
|
136
136
|
intent: 'information',
|
|
137
137
|
});
|
|
138
138
|
|
|
139
|
+
// @ts-ignore
|
|
139
140
|
fn.primary = (message, duration = DEFAULT_DURATION) =>
|
|
140
141
|
void addToast({
|
|
141
142
|
message,
|
|
142
143
|
duration,
|
|
144
|
+
// @ts-ignore
|
|
143
145
|
intent: 'primary',
|
|
144
146
|
});
|
|
147
|
+
// @ts-ignore
|
|
145
148
|
fn.secondary = (message, duration = DEFAULT_DURATION) =>
|
|
146
149
|
void addToast({
|
|
147
150
|
message,
|
|
148
151
|
duration,
|
|
152
|
+
// @ts-ignore
|
|
149
153
|
intent: 'secondary',
|
|
150
154
|
});
|
|
155
|
+
// @ts-ignore
|
|
151
156
|
fn.shine = (message, duration = DEFAULT_DURATION) =>
|
|
152
157
|
void addToast({
|
|
153
158
|
message,
|
|
154
159
|
duration,
|
|
160
|
+
// @ts-ignore
|
|
155
161
|
intent: 'shine',
|
|
156
162
|
});
|
|
157
163
|
fn.success = (message, duration = DEFAULT_DURATION) =>
|
|
@@ -160,10 +166,12 @@ export const useToast = (): ToastFn => {
|
|
|
160
166
|
duration,
|
|
161
167
|
intent: 'success',
|
|
162
168
|
});
|
|
169
|
+
// @ts-ignore
|
|
163
170
|
fn.neutral = (message, duration = DEFAULT_DURATION) =>
|
|
164
171
|
void addToast({
|
|
165
172
|
message,
|
|
166
173
|
duration,
|
|
174
|
+
// @ts-ignore
|
|
167
175
|
intent: 'neutral',
|
|
168
176
|
});
|
|
169
177
|
fn.danger = (message, duration = DEFAULT_DURATION) =>
|
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
forwardRef,
|
|
11
11
|
KeyboardEventHandler,
|
|
12
12
|
MouseEventHandler,
|
|
13
|
+
MutableRefObject,
|
|
13
14
|
ReactNode,
|
|
14
15
|
Ref,
|
|
15
|
-
RefObject,
|
|
16
16
|
useCallback,
|
|
17
17
|
useState,
|
|
18
18
|
} from 'react';
|
|
@@ -84,7 +84,7 @@ export type WrappedComponentProps<IncomingProps, PrimitiveElementType> = {
|
|
|
84
84
|
EnhanceInputPrimitiveProps,
|
|
85
85
|
'placeholder' | 'hintText' | 'fieldIcon'
|
|
86
86
|
> & {
|
|
87
|
-
ref:
|
|
87
|
+
ref: MutableRefObject<PrimitiveElementType>;
|
|
88
88
|
};
|
|
89
89
|
fieldIcon?: EnhanceInputPrimitiveProps['fieldIcon'];
|
|
90
90
|
isFocused?: boolean;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { ComponentProps, FunctionComponent } from 'react';
|
|
3
4
|
import { useStyles } from 'react-treat';
|
|
4
|
-
|
|
5
|
-
import
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
getEarliestKnownToken,
|
|
8
|
+
resolveResponsiveStyle,
|
|
9
|
+
ResponsiveProp,
|
|
10
|
+
} from '../../../lib/utils/responsiveProps';
|
|
6
11
|
import { Box } from '../../components';
|
|
7
|
-
import { ResponsiveProp } from '../../../dist/lib/utils';
|
|
8
12
|
import { useMedia } from '../useMedia';
|
|
9
|
-
|
|
13
|
+
|
|
14
|
+
import * as styleRefs from './useAttachedBoxes.treat';
|
|
10
15
|
|
|
11
16
|
interface Props extends Pick<ComponentProps<typeof Box>, 'backgroundColour'> {
|
|
12
17
|
count: number;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { useStyles } from 'react-treat';
|
|
2
2
|
import { Theme } from 'treat/theme';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
resolveResponsiveStyle,
|
|
6
|
+
ResponsiveProp,
|
|
7
|
+
} from '../../utils/responsiveProps';
|
|
5
8
|
|
|
6
9
|
import * as styleRefs from './useNegativeMarginLeft.treat';
|
|
7
10
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { useStyles } from 'react-treat';
|
|
2
2
|
import { Theme } from 'treat/theme';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
resolveResponsiveStyle,
|
|
6
|
+
ResponsiveProp,
|
|
7
|
+
} from '../../utils/responsiveProps';
|
|
5
8
|
|
|
6
9
|
import * as styleRefs from './useNegativeMarginTop.treat';
|
|
7
10
|
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { useMedia } from '../..';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
getEarliestKnownToken,
|
|
4
|
+
ResponsiveProp,
|
|
5
|
+
} from '../../utils/responsiveProps';
|
|
3
6
|
|
|
4
7
|
export function useResponsiveValue<T extends string | number | boolean>(
|
|
5
8
|
responsiveValue: ResponsiveProp<T>,
|
package/lib/index.ts
CHANGED
|
@@ -4,3 +4,7 @@ export { useMedia } from './hooks/useMedia';
|
|
|
4
4
|
export { useResponsiveValue } from './hooks/useResponsiveValue';
|
|
5
5
|
export { useAttachedBoxes } from './hooks/useAttachedBoxes';
|
|
6
6
|
export { useId, arrayRingLookup } from './utils';
|
|
7
|
+
export {
|
|
8
|
+
makeResponsiveStyle,
|
|
9
|
+
resolveResponsiveStyle,
|
|
10
|
+
} from './utils/responsiveProps';
|
package/lib/themes/makeTheme.ts
CHANGED
|
@@ -29,7 +29,9 @@ const createUtils = (tokens: Tokens) => ({
|
|
|
29
29
|
|
|
30
30
|
Object.assign(styles, {
|
|
31
31
|
'@media': {
|
|
32
|
+
// @ts-ignore
|
|
32
33
|
...styles['@media'],
|
|
34
|
+
// @ts-ignore
|
|
33
35
|
[`screen and (min-width: ${tokens.breakpoints[query]}px)`]: style,
|
|
34
36
|
},
|
|
35
37
|
});
|
|
@@ -46,6 +48,7 @@ const decorateTokens = (tokens: Tokens) => ({
|
|
|
46
48
|
|
|
47
49
|
export type OverdriveTheme = ReturnType<typeof decorateTokens>;
|
|
48
50
|
|
|
51
|
+
// @ts-ignore
|
|
49
52
|
export const makeTheme = (tokens: Tokens, debugName) =>
|
|
50
53
|
createTheme(decorateTokens(tokens), debugName);
|
|
51
54
|
|
package/lib/themes/tokens.ts
CHANGED
package/lib/utils/index.ts
CHANGED
|
@@ -90,9 +90,6 @@ export const hex2rgba = (c, alpha = '1') =>
|
|
|
90
90
|
.match(/../g)
|
|
91
91
|
.map((x) => Number(`0x${x}`))},${alpha})`;
|
|
92
92
|
|
|
93
|
-
export { mapTokenToProperty } from './mapTokenToProperty';
|
|
94
|
-
export * from './responsiveProps';
|
|
95
|
-
|
|
96
93
|
export const ownerWindow = (node?: Node): Window =>
|
|
97
94
|
ownerDocument(node)?.defaultView || window;
|
|
98
95
|
export const ownerDocument = (node?: Node): Document =>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autoguru/overdrive",
|
|
3
|
-
"version": "2.7.0
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "Overdrive is a product component library, and design system for AutoGuru.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"component",
|
|
@@ -20,29 +20,43 @@
|
|
|
20
20
|
"./lib/theme/**/*",
|
|
21
21
|
"./lib/themes/**/*"
|
|
22
22
|
],
|
|
23
|
-
"
|
|
24
|
-
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc",
|
|
25
|
+
"prepublishOnly": "yarn run build",
|
|
26
|
+
"watch": "tsc --watch"
|
|
27
|
+
},
|
|
28
|
+
"types": "./dist/main.d.ts",
|
|
29
|
+
"main": "index.ts",
|
|
30
|
+
"devDependencies": {
|
|
25
31
|
"@autoguru/icons": "^1.7.4",
|
|
32
|
+
"@autoguru/tsconfig": "1.0.79",
|
|
26
33
|
"@autoguru/utilities": "^1.0.98",
|
|
27
34
|
"@popperjs/core": "^2.7.0",
|
|
35
|
+
"@types/react": "^17.0.16",
|
|
36
|
+
"@types/react-dom": "^17.0.9",
|
|
28
37
|
"clsx": "^1.1.1",
|
|
29
38
|
"colord": "^2.0.1",
|
|
30
39
|
"csstype": "^3.0.7",
|
|
40
|
+
"eslint-plugin-jest": "^24.4.0",
|
|
41
|
+
"react": "^18.0.0-alpha-b9934d6db-20210805",
|
|
42
|
+
"react-dom": "^18.0.0-alpha-b9934d6db-20210805",
|
|
31
43
|
"react-focus-lock": "^2.5.0",
|
|
32
44
|
"react-keyed-flatten-children": "^1.3.0",
|
|
33
|
-
"react-treat": "^2.0.1"
|
|
34
|
-
},
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"@autoguru/tsconfig": "1.0.79",
|
|
37
|
-
"@types/react": "^17.0.16",
|
|
38
|
-
"@types/react-dom": "^17.0.9",
|
|
39
|
-
"eslint-plugin-jest": "^24.4.0",
|
|
40
|
-
"react": "^18.0.0-alpha-19092ac8c-20210803",
|
|
41
|
-
"react-dom": "^18.0.0-alpha-19092ac8c-20210803",
|
|
45
|
+
"react-treat": "^2.0.1",
|
|
42
46
|
"treat": "2.0.4"
|
|
43
47
|
},
|
|
44
48
|
"peerDependencies": {
|
|
49
|
+
"@autoguru/icons": "^1.7.4",
|
|
50
|
+
"@autoguru/utilities": "^1.0.98",
|
|
51
|
+
"@popperjs/core": "^2.7.0",
|
|
52
|
+
"clsx": "^1.1.1",
|
|
53
|
+
"colord": "^2.0.1",
|
|
54
|
+
"csstype": "^3.0.7",
|
|
45
55
|
"react": ">=16.8",
|
|
46
|
-
"react-dom": ">=16.8"
|
|
56
|
+
"react-dom": ">=16.8",
|
|
57
|
+
"react-focus-lock": "^2.5.0",
|
|
58
|
+
"react-keyed-flatten-children": "^1.3.0",
|
|
59
|
+
"react-treat": "^2.0.1",
|
|
60
|
+
"treat": "2.0.4"
|
|
47
61
|
}
|
|
48
62
|
}
|