@autoguru/overdrive 2.7.0-next.9 → 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 +136 -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/Section/Section.treat.ts +1 -1
- package/lib/components/Stack/Stack.treat.ts +1 -1
- package/lib/components/Text/useTextStyles.treat.ts +1 -1
- package/lib/components/Toaster/Toast.tsx +8 -0
- 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 +21 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,90 @@
|
|
|
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
|
+
|
|
3
88
|
## 2.7.0-next.9
|
|
4
89
|
|
|
5
90
|
### Minor Changes
|
|
@@ -331,19 +416,7 @@
|
|
|
331
416
|
**Example:**
|
|
332
417
|
|
|
333
418
|
```jsx
|
|
334
|
-
<Tabs active={0}>
|
|
335
|
-
<TabList>
|
|
336
|
-
<Tab>tab 1</Tab>
|
|
337
|
-
<Tab>tab 2</Tab>
|
|
338
|
-
</TabList>
|
|
339
|
-
<TabPanes>
|
|
340
|
-
<TabPane>tab 1 content</TabPane>
|
|
341
|
-
<TabPane>
|
|
342
|
-
{/* Will still be in the DOM, and React comeponet to have state retained */}
|
|
343
|
-
tab 2 content
|
|
344
|
-
</TabPane>
|
|
345
|
-
</TabPanes>
|
|
346
|
-
</Tabs>
|
|
419
|
+
<Tabs active={0}>> > > > > > > } t > ></Tabs>
|
|
347
420
|
```
|
|
348
421
|
|
|
349
422
|
- 7131a5f: **Tabs:** Fixes a visual quirk when indications are mixed with
|
|
@@ -405,10 +478,7 @@
|
|
|
405
478
|
**FEATURES**
|
|
406
479
|
|
|
407
480
|
```jsx
|
|
408
|
-
<Stack is="ul">
|
|
409
|
-
<BulletText>Point A</BulletText>
|
|
410
|
-
<BulletText>Point B</BulletText>
|
|
411
|
-
</Stack>
|
|
481
|
+
<Stack is="ul">> ></Stack>
|
|
412
482
|
```
|
|
413
483
|
|
|
414
484
|
which already wraps each child in an `li`.
|
|
@@ -448,24 +518,7 @@
|
|
|
448
518
|
### Example
|
|
449
519
|
|
|
450
520
|
```jsx
|
|
451
|
-
<Table columnTemplate="repeat(2, auto)">
|
|
452
|
-
<TableRowGroup>
|
|
453
|
-
<TableRow>
|
|
454
|
-
<TableHeadCell>Col 1</TableHeadCell>
|
|
455
|
-
<TableHeadCell>Col 2</TableHeadCell>
|
|
456
|
-
</TableRow>
|
|
457
|
-
</TableRowGroup>
|
|
458
|
-
<TableRowGroup>
|
|
459
|
-
<TableRow>
|
|
460
|
-
<TableCell>Row 1, Col 1</TableCell>
|
|
461
|
-
<TableCell>Row 1, Col 2</TableCell>
|
|
462
|
-
</TableRow>
|
|
463
|
-
<TableRow>
|
|
464
|
-
<TableCell>Row 2, Col 1</TableCell>
|
|
465
|
-
<TableCell>Row 2, Col 2</TableCell>
|
|
466
|
-
</TableRow>
|
|
467
|
-
</TableRowGroup>
|
|
468
|
-
</Table>
|
|
521
|
+
<Table columnTemplate="repeat(2, auto)">></Table>
|
|
469
522
|
```
|
|
470
523
|
|
|
471
524
|
### Sticky Header
|
|
@@ -473,17 +526,17 @@
|
|
|
473
526
|
```diff
|
|
474
527
|
-<Table columnTemplate="repeat(2, auto)">
|
|
475
528
|
+<Table stickyHead columnTemplate="repeat(2, auto)">
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
529
|
+
>
|
|
530
|
+
>
|
|
531
|
+
>
|
|
479
532
|
```
|
|
480
533
|
|
|
481
534
|
### Sorting Columns
|
|
482
535
|
|
|
483
536
|
```diff
|
|
484
537
|
<Table columnTemplate="repeat(2, auto)">
|
|
485
|
-
|
|
486
|
-
|
|
538
|
+
>
|
|
539
|
+
>
|
|
487
540
|
- <TableHeadCell>Col 1</TableHeadCell>
|
|
488
541
|
+ <TableHeadCell sort="asc" onSortChange={}>Col 1</TableHeadCell>
|
|
489
542
|
```
|
|
@@ -498,10 +551,10 @@
|
|
|
498
551
|
|
|
499
552
|
```diff
|
|
500
553
|
<Table columnTemplate="repeat(2, auto)">
|
|
501
|
-
|
|
554
|
+
>
|
|
502
555
|
- <TableRow>
|
|
503
556
|
+ <TableRow onClick={}>
|
|
504
|
-
|
|
557
|
+
>
|
|
505
558
|
```
|
|
506
559
|
|
|
507
560
|
Please note; that if you're also tracking clicks of cell buttons, to check
|
|
@@ -531,8 +584,8 @@
|
|
|
531
584
|
```jsx
|
|
532
585
|
<VisuallyHidden>hello screen reader</VisuallyHidden>
|
|
533
586
|
<Text>
|
|
534
|
-
|
|
535
|
-
|
|
587
|
+
o
|
|
588
|
+
>
|
|
536
589
|
</Text>
|
|
537
590
|
```
|
|
538
591
|
|
|
@@ -542,7 +595,7 @@
|
|
|
542
595
|
|
|
543
596
|
```jsx
|
|
544
597
|
<Text is="span" display="inlineBlock">
|
|
545
|
-
|
|
598
|
+
k
|
|
546
599
|
</Text>
|
|
547
600
|
```
|
|
548
601
|
|
|
@@ -585,7 +638,7 @@
|
|
|
585
638
|
|
|
586
639
|
```jsx
|
|
587
640
|
<Box display="flex" width="full" justifyContent="center">
|
|
588
|
-
|
|
641
|
+
>
|
|
589
642
|
</Box>
|
|
590
643
|
```
|
|
591
644
|
|
|
@@ -601,9 +654,9 @@
|
|
|
601
654
|
<Stack is="ul"
|
|
602
655
|
- spacing="3">
|
|
603
656
|
+ space="3">
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
657
|
+
>
|
|
658
|
+
>
|
|
659
|
+
>
|
|
607
660
|
</Stack>
|
|
608
661
|
```
|
|
609
662
|
|
|
@@ -614,12 +667,7 @@
|
|
|
614
667
|
**FEATURES**
|
|
615
668
|
|
|
616
669
|
```jsx
|
|
617
|
-
<Inline dividers>
|
|
618
|
-
<Text>Mazda</Text>
|
|
619
|
-
<Text>CX3</Text>
|
|
620
|
-
<Text>Petrol</Text>
|
|
621
|
-
<Text>2020</Text>
|
|
622
|
-
</Inline>
|
|
670
|
+
<Inline dividers>> > > ></Inline>
|
|
623
671
|
```
|
|
624
672
|
|
|
625
673
|
- a0fce92: Text: Exposes a new white-space nowrap prop
|
|
@@ -655,14 +703,7 @@
|
|
|
655
703
|
**FEATURES**
|
|
656
704
|
|
|
657
705
|
```jsx
|
|
658
|
-
<Tabs>
|
|
659
|
-
<TabList scrollable>
|
|
660
|
-
<Tab>This</Tab>
|
|
661
|
-
<Tab>Tab</Tab>
|
|
662
|
-
<Tab>Might</Tab>
|
|
663
|
-
<Tab>Scroll</Tab>
|
|
664
|
-
</TabList>
|
|
665
|
-
</Tabs>
|
|
706
|
+
<Tabs>> > > > > ></Tabs>
|
|
666
707
|
```
|
|
667
708
|
|
|
668
709
|
- 729dfdd: Input: Notchless inputs will no longer break when part of a flex
|
|
@@ -678,17 +719,7 @@
|
|
|
678
719
|
would not have worked:
|
|
679
720
|
|
|
680
721
|
```jsx
|
|
681
|
-
<Stack>
|
|
682
|
-
<p>line 0</p>
|
|
683
|
-
{isEnabled && (
|
|
684
|
-
<>
|
|
685
|
-
<p>Line 1</p>
|
|
686
|
-
<p>Line 2</p>
|
|
687
|
-
<p>Line 3</p>
|
|
688
|
-
</>
|
|
689
|
-
)}
|
|
690
|
-
<p>line 4</p>
|
|
691
|
-
</Stack>
|
|
722
|
+
<Stack>> ( > > > > > } ></Stack>
|
|
692
723
|
```
|
|
693
724
|
|
|
694
725
|
> which would have the past not had lines 1-3 spaced evenly.
|
|
@@ -735,12 +766,12 @@
|
|
|
735
766
|
```diff
|
|
736
767
|
- <Box className={clsx(styles.one, styles.two)}>
|
|
737
768
|
+ <Box className={[styles.one, styles.two]}>
|
|
738
|
-
|
|
769
|
+
o
|
|
739
770
|
</Box>
|
|
740
771
|
|
|
741
772
|
- <Box className={clsx({[styles.one]: maybeDoMe}, styles.two)}>
|
|
742
773
|
+ <Box className={[{[styles.one]: maybeDoMe}, styles.two]}>
|
|
743
|
-
|
|
774
|
+
o
|
|
744
775
|
</Box>
|
|
745
776
|
```
|
|
746
777
|
|
|
@@ -766,9 +797,8 @@
|
|
|
766
797
|
`<AutoSuggest>` can now be given a `autoWidth` prop that will auto the width
|
|
767
798
|
in relation to setting the width, or for it to be automatic.
|
|
768
799
|
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
- `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.
|
|
772
802
|
|
|
773
803
|
eg:
|
|
774
804
|
|
|
@@ -776,15 +806,15 @@
|
|
|
776
806
|
|
|
777
807
|
// size to the width of the flyout children
|
|
778
808
|
<AutoSuggest
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
809
|
+
"
|
|
810
|
+
}
|
|
811
|
+
h
|
|
782
812
|
/>
|
|
783
813
|
|
|
784
814
|
// size to the width of the input (current behaviour)
|
|
785
815
|
<AutoSuggest
|
|
786
|
-
|
|
787
|
-
|
|
816
|
+
"
|
|
817
|
+
}
|
|
788
818
|
/>
|
|
789
819
|
|
|
790
820
|
```
|
|
@@ -859,16 +889,16 @@
|
|
|
859
889
|
```jsx
|
|
860
890
|
// Input
|
|
861
891
|
<div>
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
892
|
+
g
|
|
893
|
+
>
|
|
894
|
+
>
|
|
895
|
+
>
|
|
866
896
|
</div>
|
|
867
897
|
|
|
868
898
|
// Result
|
|
869
899
|
<body>
|
|
870
|
-
|
|
871
|
-
|
|
900
|
+
>
|
|
901
|
+
>
|
|
872
902
|
</body>
|
|
873
903
|
```
|
|
874
904
|
|
|
@@ -882,8 +912,8 @@
|
|
|
882
912
|
backdrop. Also; if you wish to remove the fadeIn/fadeOut animation, a
|
|
883
913
|
`transition?: boolean` can also be provided.
|
|
884
914
|
|
|
885
|
-
|
|
886
|
-
|
|
915
|
+
- Removes `<ModalPortal />` in favor of `<Modal />`
|
|
916
|
+
- Deprecated `withModal`, which could simply just use the Modal component
|
|
887
917
|
|
|
888
918
|
Worth noting that a `role="presentation"` is applied to the `Modal`, so
|
|
889
919
|
consumers should be applying a `role="none presentation"` to their direct
|
|
@@ -893,7 +923,7 @@
|
|
|
893
923
|
|
|
894
924
|
```jsx
|
|
895
925
|
<Modal isOpen={true} onRequestClose={function() {}}>
|
|
896
|
-
|
|
926
|
+
>
|
|
897
927
|
</Modal>
|
|
898
928
|
```
|
|
899
929
|
|
|
@@ -915,10 +945,10 @@
|
|
|
915
945
|
|
|
916
946
|
```
|
|
917
947
|
<Tabs>
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
948
|
+
>
|
|
949
|
+
>
|
|
950
|
+
>
|
|
951
|
+
>
|
|
922
952
|
</Tabs>
|
|
923
953
|
```
|
|
924
954
|
|
|
@@ -937,11 +967,9 @@
|
|
|
937
967
|
|
|
938
968
|
Breakpoints have been amended to follow (mobile first):
|
|
939
969
|
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
- `largeDesktop` is taken as a 1920x1080 less 25%, so any device larger
|
|
944
|
-
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
|
|
945
973
|
|
|
946
974
|
all at landscape.
|
|
947
975
|
|
|
@@ -953,11 +981,7 @@
|
|
|
953
981
|
eg:
|
|
954
982
|
|
|
955
983
|
```jsx
|
|
956
|
-
<Inline>
|
|
957
|
-
<Badge colour="green" label="Success" />
|
|
958
|
-
<Badge colour="red" label="Danger" />
|
|
959
|
-
<Badge colour="blue" label="Information" />
|
|
960
|
-
</Inline>
|
|
984
|
+
<Inline>> > ></Inline>
|
|
961
985
|
```
|
|
962
986
|
|
|
963
987
|
**`<Section />`**
|
|
@@ -979,10 +1003,7 @@
|
|
|
979
1003
|
|
|
980
1004
|
```jsx
|
|
981
1005
|
<Section width="medium" paddingX={['3', , 'none']}>
|
|
982
|
-
|
|
983
|
-
<Column width="2/3">...</Column>
|
|
984
|
-
<Column width="1/3">...</Column>
|
|
985
|
-
</Columns>
|
|
1006
|
+
>
|
|
986
1007
|
</Section>
|
|
987
1008
|
```
|
|
988
1009
|
|
|
@@ -1019,7 +1040,7 @@
|
|
|
1019
1040
|
```diff
|
|
1020
1041
|
-<Actions className="test">
|
|
1021
1042
|
+<Actions>
|
|
1022
|
-
|
|
1043
|
+
.
|
|
1023
1044
|
</Actions>
|
|
1024
1045
|
```
|
|
1025
1046
|
|
|
@@ -1031,9 +1052,9 @@
|
|
|
1031
1052
|
|
|
1032
1053
|
**A few changes**
|
|
1033
1054
|
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1055
|
+
- `OverdriveProvider` must now be provider
|
|
1056
|
+
- `ToastProvider` must also be provided when using a `useToast`
|
|
1057
|
+
- `@autoguru/overdrive/reset` must be given first.
|
|
1037
1058
|
|
|
1038
1059
|
... and a whole series of other things. Please consult to the PR (#273) to
|
|
1039
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,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) =>
|
|
@@ -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 '../../../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",
|
|
@@ -26,29 +26,37 @@
|
|
|
26
26
|
"watch": "tsc --watch"
|
|
27
27
|
},
|
|
28
28
|
"types": "./dist/main.d.ts",
|
|
29
|
-
"main": "
|
|
30
|
-
"
|
|
29
|
+
"main": "index.ts",
|
|
30
|
+
"devDependencies": {
|
|
31
31
|
"@autoguru/icons": "^1.7.4",
|
|
32
|
+
"@autoguru/tsconfig": "1.0.79",
|
|
32
33
|
"@autoguru/utilities": "^1.0.98",
|
|
33
34
|
"@popperjs/core": "^2.7.0",
|
|
35
|
+
"@types/react": "^17.0.16",
|
|
36
|
+
"@types/react-dom": "^17.0.9",
|
|
34
37
|
"clsx": "^1.1.1",
|
|
35
38
|
"colord": "^2.0.1",
|
|
36
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",
|
|
37
43
|
"react-focus-lock": "^2.5.0",
|
|
38
44
|
"react-keyed-flatten-children": "^1.3.0",
|
|
39
|
-
"react-treat": "^2.0.1"
|
|
40
|
-
},
|
|
41
|
-
"devDependencies": {
|
|
42
|
-
"@autoguru/tsconfig": "1.0.79",
|
|
43
|
-
"@types/react": "^17.0.16",
|
|
44
|
-
"@types/react-dom": "^17.0.9",
|
|
45
|
-
"eslint-plugin-jest": "^24.4.0",
|
|
46
|
-
"react": "^18.0.0-alpha-19092ac8c-20210803",
|
|
47
|
-
"react-dom": "^18.0.0-alpha-19092ac8c-20210803",
|
|
45
|
+
"react-treat": "^2.0.1",
|
|
48
46
|
"treat": "2.0.4"
|
|
49
47
|
},
|
|
50
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",
|
|
51
55
|
"react": ">=16.8",
|
|
52
|
-
"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"
|
|
53
61
|
}
|
|
54
62
|
}
|