1 | import * as StyledSystem from "styled-system";
|
2 | import { BoxProps } from "../Box";
|
3 |
|
4 | interface IPseudoBoxProps {
|
5 | /**
|
6 | * Styles for CSS selector `&:after`
|
7 | *
|
8 | * NOTE:When using this, ensure the `content` is wrapped in a backtick.
|
9 | * @example
|
10 | * ```jsx
|
11 | * <PseudoBox _after={{content:`""` }}/>
|
12 | * ```
|
13 | */
|
14 | _after?: BoxProps & {
|
15 | content: string;
|
16 | };
|
17 | /**
|
18 | * Styles for CSS selector `&:before`
|
19 | *
|
20 | * NOTE:When using this, ensure the `content` is wrapped in a backtick.
|
21 | * @example
|
22 | * ```jsx
|
23 | * <PseudoBox _before={{content:`""` }}/>
|
24 | * ```
|
25 | */
|
26 | _before?: BoxProps & {
|
27 | content: string;
|
28 | };
|
29 | /**
|
30 | * Styles for CSS selector `&:focus`
|
31 | *
|
32 | */
|
33 | _focus?: BoxProps;
|
34 | /**
|
35 | * Styles for CSS selector `&:hover`
|
36 | */
|
37 | _hover?: BoxProps;
|
38 | /**
|
39 | * Styles for CSS Selector `&:active`
|
40 | */
|
41 | _active?: BoxProps;
|
42 | /**
|
43 | * Styles for CSS Selector `&[aria-pressed=true]`
|
44 | * Typically used to style the current "pressed" state of toggle buttons
|
45 | */
|
46 | _pressed?: BoxProps;
|
47 | /**
|
48 | * Styles to apply when the ARIA attribute `aria-selected` is `true`
|
49 | * - CSS selector `&[aria-selected=true]`
|
50 | */
|
51 | _selected?: BoxProps;
|
52 | /**
|
53 | * Styles to apply when a child of this element has received focus
|
54 | * - CSS Selector `&:focus-within`
|
55 | */
|
56 | _focusWithin?: BoxProps;
|
57 |
|
58 | /**
|
59 | * Styles to apply when the ARIA attribute `aria-invalid` is `true`
|
60 | * - CSS selector `&[aria-invalid=true]`
|
61 | */
|
62 | _invalid?: BoxProps;
|
63 | /**
|
64 | * Styles to apply when this element is disabled. The passed styles are applied to these CSS selectors:
|
65 | * - `&[aria-disabled=true]`
|
66 | * - `&:disabled`
|
67 | * - `&:disabled:focus`
|
68 | * - `&:disabled:hover`
|
69 | * - `&:focus[aria-disabled=true]`
|
70 | * - `&:hover[aria-disabled=true]`
|
71 | */
|
72 | _disabled?: BoxProps;
|
73 | /**
|
74 | * Styles to apply when the ARIA attribute `aria-grabbed` is `true`
|
75 | * - CSS selector `&[aria-grabbed=true]`
|
76 | */
|
77 | _grabbed?: BoxProps;
|
78 | /**
|
79 | * Styles to apply when the ARIA attribute `aria-expanded` is `true`
|
80 | * - CSS selector `&[aria-expanded=true]`
|
81 | */
|
82 | _expanded?: BoxProps;
|
83 | /**
|
84 | * Styles to apply when the ARIA attribute `aria-checked` is `true`
|
85 | * - CSS selector `&[aria-checked=true]`
|
86 | */
|
87 | _checked?: BoxProps;
|
88 | /**
|
89 | * Styles to apply when the ARIA attribute `aria-checked` is `mixed`
|
90 | * - CSS selector `&[aria-checked=mixed]`
|
91 | */
|
92 | _mixed?: BoxProps;
|
93 | /**
|
94 | * Styles for CSS Selector `&:nth-child(odd)`
|
95 | */
|
96 | _odd?: BoxProps;
|
97 | /**
|
98 | * Styles for CSS Selector `&:nth-child(even)`
|
99 | */
|
100 | _even?: BoxProps;
|
101 | /**
|
102 | * Styles for CSS Selector `&:visited`
|
103 | */
|
104 | _visited?: BoxProps;
|
105 | /**
|
106 | * Styles for CSS Selector `&:readonly`
|
107 | */
|
108 | _readOnly?: BoxProps;
|
109 | /**
|
110 | * Styles for CSS Selector `&:first-of-type`
|
111 | */
|
112 | _first?: BoxProps;
|
113 | /**
|
114 | * Styles for CSS Selector `&:last-of-type`
|
115 | */
|
116 | _last?: BoxProps;
|
117 | /**
|
118 | * Styles to apply when you hover on a parent that has `role=group`.
|
119 | */
|
120 | _groupHover?: BoxProps;
|
121 | /**
|
122 | * Styles for CSS Selector `&:not(:first-of-type)`
|
123 | */
|
124 | _notFirst?: BoxProps;
|
125 | /**
|
126 | * Styles for CSS Selector `&:not(:last-of-type)`
|
127 | */
|
128 | _notLast?: BoxProps;
|
129 | /**
|
130 | * Styles for CSS Selector `&::placeholder`.
|
131 | * Useful for inputs
|
132 | */
|
133 | _placeholder?: BoxProps;
|
134 | }
|
135 |
|
136 | export type PseudoBoxProps = IPseudoBoxProps & BoxProps;
|
137 |
|
138 | /**
|
139 | * PseudoBox is an interactive wrapper that composes `Box`
|
140 | * and converts common CSS pseudo-selectors to props for ease of styling.
|
141 | *
|
142 | * For example, to style `:hover` use `_hover`
|
143 | *
|
144 | * @example
|
145 | * ```jsx
|
146 | * <PseudoBox _hover={...} _focus={...}/>
|
147 | * ```
|
148 | */
|
149 | declare const PseudoBox: React.FC<PseudoBoxProps>;
|
150 |
|
151 | export default PseudoBox;
|