@workday/canvas-kit-react 6.0.0-alpha.0-next.21 → 6.0.0-alpha.0-next.27
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/action-bar/lib/ActionBar.tsx +43 -30
- package/common/lib/styles/accessibleHide.ts +2 -2
- package/common/lib/theming/README.md +189 -25
- package/common/lib/theming/breakpoints.ts +296 -16
- package/common/lib/theming/types.ts +191 -1
- package/dist/commonjs/action-bar/lib/ActionBar.d.ts.map +1 -1
- package/dist/commonjs/action-bar/lib/ActionBar.js +35 -27
- package/dist/commonjs/button/lib/parts/ButtonLabel.d.ts +1 -1
- package/dist/commonjs/common/lib/styles/accessibleHide.d.ts +2 -2
- package/dist/commonjs/common/lib/styles/accessibleHide.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/breakpoints.d.ts +287 -6
- package/dist/commonjs/common/lib/theming/breakpoints.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/breakpoints.js +192 -10
- package/dist/commonjs/common/lib/theming/types.d.ts +191 -1
- package/dist/commonjs/common/lib/theming/types.d.ts.map +1 -1
- package/dist/commonjs/common/lib/utils/components.d.ts +1 -1
- package/dist/commonjs/pagination/lib/Pagination/PageList.d.ts +1 -1
- package/dist/commonjs/pagination/lib/Pagination/Pagination.d.ts +5 -5
- package/dist/commonjs/pagination/lib/Pagination/common/List.d.ts +1 -1
- package/dist/commonjs/pagination/lib/Pagination/common/utils/space.d.ts +28 -28
- package/dist/commonjs/tokens/index.d.ts +3 -20
- package/dist/commonjs/tokens/index.d.ts.map +1 -1
- package/dist/commonjs/tokens/index.js +3 -6
- package/dist/commonjs/tokens/lib/depth.d.ts +109 -3
- package/dist/commonjs/tokens/lib/depth.d.ts.map +1 -1
- package/dist/commonjs/tokens/lib/depth.js +40 -5
- package/dist/es6/action-bar/lib/ActionBar.d.ts.map +1 -1
- package/dist/es6/action-bar/lib/ActionBar.js +33 -22
- package/dist/es6/button/lib/parts/ButtonLabel.d.ts +1 -1
- package/dist/es6/common/lib/styles/accessibleHide.d.ts +2 -2
- package/dist/es6/common/lib/styles/accessibleHide.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/breakpoints.d.ts +287 -6
- package/dist/es6/common/lib/theming/breakpoints.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/breakpoints.js +192 -10
- package/dist/es6/common/lib/theming/types.d.ts +191 -1
- package/dist/es6/common/lib/theming/types.d.ts.map +1 -1
- package/dist/es6/pagination/lib/Pagination/PageList.d.ts +1 -1
- package/dist/es6/pagination/lib/Pagination/Pagination.d.ts +5 -5
- package/dist/es6/pagination/lib/Pagination/common/List.d.ts +1 -1
- package/dist/es6/pagination/lib/Pagination/common/utils/space.d.ts +28 -28
- package/dist/es6/tokens/index.d.ts +3 -20
- package/dist/es6/tokens/index.d.ts.map +1 -1
- package/dist/es6/tokens/index.js +1 -1
- package/dist/es6/tokens/lib/depth.d.ts +109 -3
- package/dist/es6/tokens/lib/depth.d.ts.map +1 -1
- package/dist/es6/tokens/lib/depth.js +40 -2
- package/package.json +5 -6
- package/tokens/README.md +5 -12
- package/tokens/index.ts +2 -2
- package/tokens/lib/depth.ts +125 -3
- package/ts3.5/dist/commonjs/button/lib/parts/ButtonLabel.d.ts +1 -1
- package/ts3.5/dist/commonjs/common/lib/styles/accessibleHide.d.ts +2 -2
- package/ts3.5/dist/commonjs/common/lib/theming/breakpoints.d.ts +287 -6
- package/ts3.5/dist/commonjs/common/lib/theming/types.d.ts +191 -1
- package/ts3.5/dist/commonjs/common/lib/utils/components.d.ts +1 -1
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/PageList.d.ts +1 -1
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/Pagination.d.ts +5 -5
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/common/List.d.ts +1 -1
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/common/utils/space.d.ts +28 -28
- package/ts3.5/dist/commonjs/tokens/index.d.ts +3 -20
- package/ts3.5/dist/commonjs/tokens/lib/depth.d.ts +109 -3
- package/ts3.5/dist/es6/button/lib/parts/ButtonLabel.d.ts +1 -1
- package/ts3.5/dist/es6/common/lib/styles/accessibleHide.d.ts +2 -2
- package/ts3.5/dist/es6/common/lib/theming/breakpoints.d.ts +287 -6
- package/ts3.5/dist/es6/common/lib/theming/types.d.ts +191 -1
- package/ts3.5/dist/es6/pagination/lib/Pagination/PageList.d.ts +1 -1
- package/ts3.5/dist/es6/pagination/lib/Pagination/Pagination.d.ts +5 -5
- package/ts3.5/dist/es6/pagination/lib/Pagination/common/List.d.ts +1 -1
- package/ts3.5/dist/es6/pagination/lib/Pagination/common/utils/space.d.ts +28 -28
- package/ts3.5/dist/es6/tokens/index.d.ts +3 -20
- package/ts3.5/dist/es6/tokens/lib/depth.d.ts +109 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CSSProperties } from '@workday/canvas-kit-react/tokens';
|
|
2
2
|
/**
|
|
3
3
|
* A utility to hide content normal users while still making accessible to screenreaders
|
|
4
4
|
* See https://a11y-101.com/development/skip-link
|
|
5
5
|
*/
|
|
6
|
-
export declare const accessibleHide:
|
|
6
|
+
export declare const accessibleHide: CSSProperties;
|
|
7
7
|
//# sourceMappingURL=accessibleHide.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accessibleHide.d.ts","sourceRoot":"","sources":["../../../../../common/lib/styles/accessibleHide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"accessibleHide.d.ts","sourceRoot":"","sources":["../../../../../common/lib/styles/accessibleHide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,kCAAkC,CAAC;AAE/D;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,aAW5B,CAAC"}
|
|
@@ -7,16 +7,297 @@ export declare enum BreakpointKey {
|
|
|
7
7
|
}
|
|
8
8
|
export declare type BreakpointFnParam = BreakpointKey | keyof typeof BreakpointKey;
|
|
9
9
|
export declare type CanvasBreakpoints = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
/**
|
|
11
|
+
* ### Zero Breakpoint
|
|
12
|
+
*
|
|
13
|
+
* This breakpoint is useful when you need to set a media query `min-width` below small.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { useTheme } from '@workday/canvas-kit-react/common';
|
|
18
|
+
* import { space } from '@workday/canvas-kit-react/tokens';
|
|
19
|
+
*
|
|
20
|
+
* const theme = useTheme();
|
|
21
|
+
* const { values } = theme.canvas.breakpoints;
|
|
22
|
+
* const styles = {
|
|
23
|
+
* [`@media (min-width: ${values.zero}px)`]: {
|
|
24
|
+
* padding: space.xxs,
|
|
25
|
+
* },
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
zero: 0;
|
|
30
|
+
/**
|
|
31
|
+
* ### Small Breakpoint
|
|
32
|
+
*
|
|
33
|
+
* The small breakpoint provides the `min-width` for mobile devices, such as phones and tablets.
|
|
34
|
+
* This size ranges from a min-width of 320px to a max-width of 767px.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* import { useTheme } from '@workday/canvas-kit-react/common';
|
|
39
|
+
* import { space } from '@workday/canvas-kit-react/tokens';
|
|
40
|
+
*
|
|
41
|
+
* const theme = useTheme();
|
|
42
|
+
* const { values } = theme.canvas.breakpoints;
|
|
43
|
+
* const styles = {
|
|
44
|
+
* [`@media (min-width: ${values.s}px)`]: {
|
|
45
|
+
* padding: space.xs,
|
|
46
|
+
* },
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
s: 320;
|
|
51
|
+
/**
|
|
52
|
+
* ### Medium Breakpoint
|
|
53
|
+
*
|
|
54
|
+
* The medium breakpoint is the min-width for intended for medium screens, such as laptops.
|
|
55
|
+
* This size ranges from a min-width of 768px to a max-width of 1023px.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* import { useTheme } from '@workday/canvas-kit-react/common';
|
|
60
|
+
* import { space } from '@workday/canvas-kit-react/tokens';
|
|
61
|
+
*
|
|
62
|
+
* const theme = useTheme();
|
|
63
|
+
* const { values } = theme.canvas.breakpoints;
|
|
64
|
+
* const styles = {
|
|
65
|
+
* [`@media (min-width: ${values.m}px)`]: {
|
|
66
|
+
* padding: space.s,
|
|
67
|
+
* },
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
m: 768;
|
|
72
|
+
/**
|
|
73
|
+
* ### Large Breakpoint
|
|
74
|
+
*
|
|
75
|
+
* The large breakpoint is the min-width for intended for large screens, such as desktops.
|
|
76
|
+
* This size ranges from a min-width of 1024px to a max-width of 1439px.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* import { useTheme } from '@workday/canvas-kit-react/common';
|
|
81
|
+
* import { space } from '@workday/canvas-kit-react/tokens';
|
|
82
|
+
*
|
|
83
|
+
* const theme = useTheme();
|
|
84
|
+
* const { values } = theme.canvas.breakpoints;
|
|
85
|
+
* const styles = {
|
|
86
|
+
* [`@media (min-width: ${values.m}px)`]: {
|
|
87
|
+
* padding: space.s,
|
|
88
|
+
* },
|
|
89
|
+
* }
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
l: 1024;
|
|
93
|
+
/**
|
|
94
|
+
* ### Extra-Large Breakpoint
|
|
95
|
+
*
|
|
96
|
+
* The large breakpoint is the min-width for intended for extra-large screens, such as wide monitors and TVs.
|
|
97
|
+
* This size has a min-width of 1440px and no max-width.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* import { useTheme } from '@workday/canvas-kit-react/common';
|
|
102
|
+
* import { space } from '@workday/canvas-kit-react/tokens';
|
|
103
|
+
*
|
|
104
|
+
* const theme = useTheme();
|
|
105
|
+
* const { values } = theme.canvas.breakpoints;
|
|
106
|
+
* const styles = {
|
|
107
|
+
* [`@media (min-width: ${values.m}px)`]: {
|
|
108
|
+
* padding: space.s
|
|
109
|
+
* },
|
|
110
|
+
* }
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
xl: 1440;
|
|
15
114
|
};
|
|
16
115
|
export declare const breakpointKeys: readonly ["zero", "s", "m", "l", "xl"];
|
|
116
|
+
/**
|
|
117
|
+
* ### Theme Breakpoint Values
|
|
118
|
+
*
|
|
119
|
+
* Breakpoints are used by media queries to conditionally apply or modify styles based on the viewport width.
|
|
120
|
+
* This allows the UI to be responsive to various screen sizes. This object provides five breakpoint values
|
|
121
|
+
* that correspond to the min-widths of our standard screen sizes.
|
|
122
|
+
*
|
|
123
|
+
* - `zero`: 0
|
|
124
|
+
* - `s`: 320
|
|
125
|
+
* - `m`: 768
|
|
126
|
+
* - `l`: 1024
|
|
127
|
+
* - `xl`: 1440
|
|
128
|
+
*
|
|
129
|
+
* And these are our standard screen size ranges:
|
|
130
|
+
*
|
|
131
|
+
* - `small` (320px - 767px) Used for mobile-sized screens
|
|
132
|
+
* - `medium` (768px - 1023px) Used for tablet-sized screens
|
|
133
|
+
* - `large` - (1024px - 1439px) Used for laptop and small desktop screens
|
|
134
|
+
* - `extra-large` (≥1440px) Used for very large screens
|
|
135
|
+
*
|
|
136
|
+
* Note: Some applications may only require a subset of screen sizes and not use all breakpoints.
|
|
137
|
+
*
|
|
138
|
+
*/
|
|
17
139
|
export declare const breakpoints: CanvasBreakpoints;
|
|
140
|
+
/**
|
|
141
|
+
* ### Up
|
|
142
|
+
*
|
|
143
|
+
* _Returns a media query above the `min-width` for the range of a given breakpoint_
|
|
144
|
+
*
|
|
145
|
+
* Given a `start` breakpoint key ("zero", "s", "m", "l", "xl"),
|
|
146
|
+
* this function returns a media query (string) using a `min-width`.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```ts
|
|
150
|
+
* import { useTheme } from '@workday/canvas-kit-react/common';
|
|
151
|
+
* import { space } from '@workday/canvas-kit-react/tokens';
|
|
152
|
+
*
|
|
153
|
+
* const theme = useTheme();
|
|
154
|
+
* const { up } = theme.canvas.breakpoints;
|
|
155
|
+
* const mediaQuery = up('l'); // Returns '@media (min-width: 1024px)'
|
|
156
|
+
* const styles = {
|
|
157
|
+
* [mediaQuery]: {
|
|
158
|
+
* padding: space.m,
|
|
159
|
+
* }
|
|
160
|
+
* };
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
18
163
|
export declare function up(key: BreakpointFnParam): string;
|
|
19
|
-
|
|
164
|
+
/**
|
|
165
|
+
* ### Down
|
|
166
|
+
*
|
|
167
|
+
* _Returns a media query below the `max-width` for the range of a given breakpoint_
|
|
168
|
+
*
|
|
169
|
+
* Given an `end` breakpoint key ("zero", "s", "m", "l", "xl"),
|
|
170
|
+
* this function returns a media query (string) using a `max-width`.
|
|
171
|
+
*
|
|
172
|
+
* Note: This function subtracts `0.5px` from the next breakpoint value to prevent collisions.
|
|
173
|
+
* For example, `breakpoints.values.s`, has a `min-width` of `320px`, and the `max-width` is `767.5px`).
|
|
174
|
+
*
|
|
175
|
+
* If the `xl` breakpoint is provided, this function returns a media query with only a `min-width` of `0`,
|
|
176
|
+
* as seen in the second example below.
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```ts
|
|
180
|
+
* import { useTheme } from '@workday/canvas-kit-react/common';
|
|
181
|
+
* import { space } from '@workday/canvas-kit-react/tokens';
|
|
182
|
+
*
|
|
183
|
+
* const theme = useTheme();
|
|
184
|
+
* const { down } = theme.canvas.breakpoints;
|
|
185
|
+
* const mediaQuery = down('m'); // Returns '@media (max-width: 1023.5px)'
|
|
186
|
+
* const styles = {
|
|
187
|
+
* [mediaQuery]: {
|
|
188
|
+
* padding: space.m,
|
|
189
|
+
* }
|
|
190
|
+
* };
|
|
191
|
+
* ```
|
|
192
|
+
*
|
|
193
|
+
* This example uses the `xl` breakpoint and only adds a `min-width` of `0` to the media query.
|
|
194
|
+
* @example
|
|
195
|
+
* ```ts
|
|
196
|
+
* import { useTheme } from '@workday/canvas-kit-react/common';
|
|
197
|
+
* import { space } from '@workday/canvas-kit-react/tokens';
|
|
198
|
+
*
|
|
199
|
+
* const theme = useTheme();
|
|
200
|
+
* const { down } = theme.canvas.breakpoints;
|
|
201
|
+
* const mediaQuery = down('xl'); // Returns '@media (min-width: 0)'
|
|
202
|
+
* const styles = {
|
|
203
|
+
* [mediaQuery]: {
|
|
204
|
+
* padding: space.m,
|
|
205
|
+
* }
|
|
206
|
+
* };
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
export declare function down(endKey: BreakpointFnParam): string;
|
|
210
|
+
/**
|
|
211
|
+
* ### Between
|
|
212
|
+
*
|
|
213
|
+
* _Returns a media query between two given breakpoints_
|
|
214
|
+
*
|
|
215
|
+
* Given `start` and `end` breakpoint keys ("zero", "s", "m", "l", "xl"),
|
|
216
|
+
* this function returns a media query (string) using a min-width and max-width.
|
|
217
|
+
*
|
|
218
|
+
* Note: This function subtracts `0.5px` from the next breakpoint value to prevent collisions.
|
|
219
|
+
* For example, `breakpoints.values.s`, has a `min-width` of `320px`, and the `max-width` is `767.5px`).
|
|
220
|
+
*
|
|
221
|
+
* If the `xl` breakpoint is provided, this function returns a media query with only a `min-width`,
|
|
222
|
+
* as seen in the second example below.
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```ts
|
|
226
|
+
* import { useTheme } from '@workday/canvas-kit-react/common';
|
|
227
|
+
* import { space } from '@workday/canvas-kit-react/tokens';
|
|
228
|
+
*
|
|
229
|
+
* const theme = useTheme();
|
|
230
|
+
* const { between } = theme.canvas.breakpoints;
|
|
231
|
+
* // Returns '@media (min-width: 320px) and (max-width: 1023.5px)'
|
|
232
|
+
* const mediaQuery = between('s', 'm');
|
|
233
|
+
* const styles = {
|
|
234
|
+
* [mediaQuery]: {
|
|
235
|
+
* padding: space.s,
|
|
236
|
+
* }
|
|
237
|
+
* };
|
|
238
|
+
* ```
|
|
239
|
+
*
|
|
240
|
+
* This example uses `xl` as the `end` breakpoint and only adds a min-width to the media query.
|
|
241
|
+
* @example
|
|
242
|
+
* ```ts
|
|
243
|
+
* import { useTheme } from '@workday/canvas-kit-react/common';
|
|
244
|
+
* import { space } from '@workday/canvas-kit-react/tokens';
|
|
245
|
+
*
|
|
246
|
+
* const theme = useTheme();
|
|
247
|
+
* const { between } = theme.canvas.breakpoints;
|
|
248
|
+
* const mediaQuery = between('m', 'xl'); // Returns '@media (min-width: 768px)'
|
|
249
|
+
* const styles = {
|
|
250
|
+
* [mediaQuery]: {
|
|
251
|
+
* padding: space.s,
|
|
252
|
+
* }
|
|
253
|
+
* };
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
20
256
|
export declare function between(start: BreakpointFnParam, end: BreakpointFnParam): string;
|
|
257
|
+
/**
|
|
258
|
+
* ### Only
|
|
259
|
+
*
|
|
260
|
+
* _Returns a media query with a `min-width` and `max-width` for a given breakpoint_
|
|
261
|
+
*
|
|
262
|
+
* Given a breakpoint key ("zero", "s", "m", "l", "xl"),
|
|
263
|
+
* this function returns a media query (string) using a `min-width` and `max-width`.
|
|
264
|
+
*
|
|
265
|
+
* Note: This function subtracts `0.5px` from the next breakpoint value to prevent collisions.
|
|
266
|
+
* For example, `breakpoints.values.s`, has a `min-width` of `320px`, and the `max-width` is `767.5px`).
|
|
267
|
+
*
|
|
268
|
+
* If the `xl` breakpoint is provided, this function returns a media query with only a `min-width` of `1440px`,
|
|
269
|
+
* as seen in the second example below.
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```ts
|
|
273
|
+
* import { useTheme } from '@workday/canvas-kit-react/common';
|
|
274
|
+
* import { space } from '@workday/canvas-kit-react/tokens';
|
|
275
|
+
*
|
|
276
|
+
* const theme = useTheme();
|
|
277
|
+
* const { only } = theme.canvas.breakpoints;
|
|
278
|
+
* const mediaQuery = only('s'); // Returns '@media (min-width: 320px) and (max-width: 767.5px)'
|
|
279
|
+
* const styles = {
|
|
280
|
+
* [mediaQuery]: {
|
|
281
|
+
* padding: space.s,
|
|
282
|
+
* }
|
|
283
|
+
* };
|
|
284
|
+
* ```
|
|
285
|
+
*
|
|
286
|
+
* This example uses the `xl` breakpoint and only adds a `min-width` of `1440px` to the media query.
|
|
287
|
+
* @example
|
|
288
|
+
* ```ts
|
|
289
|
+
* import { useTheme } from '@workday/canvas-kit-react/common';
|
|
290
|
+
* import { space } from '@workday/canvas-kit-react/tokens';
|
|
291
|
+
*
|
|
292
|
+
* const theme = useTheme();
|
|
293
|
+
* const { only } = theme.canvas.breakpoints;
|
|
294
|
+
* const mediaQuery = only('xl'); // Returns '@media (min-width: 1440px)'
|
|
295
|
+
* const styles = {
|
|
296
|
+
* [mediaQuery]: {
|
|
297
|
+
* padding: space.s,
|
|
298
|
+
* }
|
|
299
|
+
* };
|
|
300
|
+
* ```
|
|
301
|
+
*/
|
|
21
302
|
export declare function only(key: BreakpointFnParam): string;
|
|
22
303
|
//# sourceMappingURL=breakpoints.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/breakpoints.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACvB,IAAI,SAAS;IACb,CAAC,MAAM;IACP,CAAC,MAAM;IACP,CAAC,MAAM;IACP,EAAE,OAAO;CACV;AAED,oBAAY,iBAAiB,GAAG,aAAa,GAAG,MAAM,OAAO,aAAa,CAAC;AAE3E,oBAAY,iBAAiB,GAAG;IAC9B,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/breakpoints.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACvB,IAAI,SAAS;IACb,CAAC,MAAM;IACP,CAAC,MAAM;IACP,CAAC,MAAM;IACP,EAAE,OAAO;CACV;AAED,oBAAY,iBAAiB,GAAG,aAAa,GAAG,MAAM,OAAO,aAAa,CAAC;AAE3E,oBAAY,iBAAiB,GAAG;IAC9B;;;;;;;;;;;;;;;;;;OAkBG;IACH,IAAI,EAAE,CAAC,CAAC;IACR;;;;;;;;;;;;;;;;;;;OAmBG;IACH,CAAC,EAAE,GAAG,CAAC;IACP;;;;;;;;;;;;;;;;;;;OAmBG;IACH,CAAC,EAAE,GAAG,CAAC;IACP;;;;;;;;;;;;;;;;;;;OAmBG;IACH,CAAC,EAAE,IAAI,CAAC;IACR;;;;;;;;;;;;;;;;;;;OAmBG;IACH,EAAE,EAAE,IAAI,CAAC;CACV,CAAC;AAEF,eAAO,MAAM,cAAc,wCAAyC,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,WAAW,EAAE,iBAMzB,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,EAAE,CAAC,GAAG,EAAE,iBAAiB,UAGxC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,iBAAiB,UAU7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,iBAAiB,UAWvE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,iBAAiB,UAE1C"}
|
|
@@ -9,39 +9,221 @@ var BreakpointKey;
|
|
|
9
9
|
BreakpointKey["xl"] = "xl";
|
|
10
10
|
})(BreakpointKey = exports.BreakpointKey || (exports.BreakpointKey = {}));
|
|
11
11
|
exports.breakpointKeys = ['zero', 's', 'm', 'l', 'xl'];
|
|
12
|
+
/**
|
|
13
|
+
* ### Theme Breakpoint Values
|
|
14
|
+
*
|
|
15
|
+
* Breakpoints are used by media queries to conditionally apply or modify styles based on the viewport width.
|
|
16
|
+
* This allows the UI to be responsive to various screen sizes. This object provides five breakpoint values
|
|
17
|
+
* that correspond to the min-widths of our standard screen sizes.
|
|
18
|
+
*
|
|
19
|
+
* - `zero`: 0
|
|
20
|
+
* - `s`: 320
|
|
21
|
+
* - `m`: 768
|
|
22
|
+
* - `l`: 1024
|
|
23
|
+
* - `xl`: 1440
|
|
24
|
+
*
|
|
25
|
+
* And these are our standard screen size ranges:
|
|
26
|
+
*
|
|
27
|
+
* - `small` (320px - 767px) Used for mobile-sized screens
|
|
28
|
+
* - `medium` (768px - 1023px) Used for tablet-sized screens
|
|
29
|
+
* - `large` - (1024px - 1439px) Used for laptop and small desktop screens
|
|
30
|
+
* - `extra-large` (≥1440px) Used for very large screens
|
|
31
|
+
*
|
|
32
|
+
* Note: Some applications may only require a subset of screen sizes and not use all breakpoints.
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
12
35
|
exports.breakpoints = {
|
|
13
36
|
zero: 0,
|
|
14
|
-
s:
|
|
15
|
-
m:
|
|
16
|
-
l:
|
|
17
|
-
xl:
|
|
37
|
+
s: 320,
|
|
38
|
+
m: 768,
|
|
39
|
+
l: 1024,
|
|
40
|
+
xl: 1440,
|
|
18
41
|
};
|
|
19
42
|
var step = 0.5;
|
|
43
|
+
/**
|
|
44
|
+
* ### Up
|
|
45
|
+
*
|
|
46
|
+
* _Returns a media query above the `min-width` for the range of a given breakpoint_
|
|
47
|
+
*
|
|
48
|
+
* Given a `start` breakpoint key ("zero", "s", "m", "l", "xl"),
|
|
49
|
+
* this function returns a media query (string) using a `min-width`.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* import { useTheme } from '@workday/canvas-kit-react/common';
|
|
54
|
+
* import { space } from '@workday/canvas-kit-react/tokens';
|
|
55
|
+
*
|
|
56
|
+
* const theme = useTheme();
|
|
57
|
+
* const { up } = theme.canvas.breakpoints;
|
|
58
|
+
* const mediaQuery = up('l'); // Returns '@media (min-width: 1024px)'
|
|
59
|
+
* const styles = {
|
|
60
|
+
* [mediaQuery]: {
|
|
61
|
+
* padding: space.m,
|
|
62
|
+
* }
|
|
63
|
+
* };
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
20
66
|
function up(key) {
|
|
21
67
|
var value = typeof exports.breakpoints[key] === 'number' ? exports.breakpoints[key] : key;
|
|
22
|
-
return "@media (min-width:" + value + "px)";
|
|
68
|
+
return "@media (min-width: " + value + "px)";
|
|
23
69
|
}
|
|
24
70
|
exports.up = up;
|
|
25
|
-
|
|
26
|
-
|
|
71
|
+
/**
|
|
72
|
+
* ### Down
|
|
73
|
+
*
|
|
74
|
+
* _Returns a media query below the `max-width` for the range of a given breakpoint_
|
|
75
|
+
*
|
|
76
|
+
* Given an `end` breakpoint key ("zero", "s", "m", "l", "xl"),
|
|
77
|
+
* this function returns a media query (string) using a `max-width`.
|
|
78
|
+
*
|
|
79
|
+
* Note: This function subtracts `0.5px` from the next breakpoint value to prevent collisions.
|
|
80
|
+
* For example, `breakpoints.values.s`, has a `min-width` of `320px`, and the `max-width` is `767.5px`).
|
|
81
|
+
*
|
|
82
|
+
* If the `xl` breakpoint is provided, this function returns a media query with only a `min-width` of `0`,
|
|
83
|
+
* as seen in the second example below.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* import { useTheme } from '@workday/canvas-kit-react/common';
|
|
88
|
+
* import { space } from '@workday/canvas-kit-react/tokens';
|
|
89
|
+
*
|
|
90
|
+
* const theme = useTheme();
|
|
91
|
+
* const { down } = theme.canvas.breakpoints;
|
|
92
|
+
* const mediaQuery = down('m'); // Returns '@media (max-width: 1023.5px)'
|
|
93
|
+
* const styles = {
|
|
94
|
+
* [mediaQuery]: {
|
|
95
|
+
* padding: space.m,
|
|
96
|
+
* }
|
|
97
|
+
* };
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* This example uses the `xl` breakpoint and only adds a `min-width` of `0` to the media query.
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* import { useTheme } from '@workday/canvas-kit-react/common';
|
|
104
|
+
* import { space } from '@workday/canvas-kit-react/tokens';
|
|
105
|
+
*
|
|
106
|
+
* const theme = useTheme();
|
|
107
|
+
* const { down } = theme.canvas.breakpoints;
|
|
108
|
+
* const mediaQuery = down('xl'); // Returns '@media (min-width: 0)'
|
|
109
|
+
* const styles = {
|
|
110
|
+
* [mediaQuery]: {
|
|
111
|
+
* padding: space.m,
|
|
112
|
+
* }
|
|
113
|
+
* };
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
function down(endKey) {
|
|
117
|
+
var endIndex = exports.breakpointKeys.indexOf(endKey) + 1;
|
|
27
118
|
var upperbound = exports.breakpoints[exports.breakpointKeys[endIndex]];
|
|
28
119
|
if (endIndex === exports.breakpointKeys.length) {
|
|
29
120
|
// xl down applies to all sizes
|
|
30
121
|
return up(BreakpointKey.zero);
|
|
31
122
|
}
|
|
32
123
|
var value = typeof upperbound === 'number' && endIndex > 0 ? upperbound : 0;
|
|
33
|
-
return "@media (max-width:" + (value - step) + "px)";
|
|
124
|
+
return "@media (max-width: " + (value - step) + "px)";
|
|
34
125
|
}
|
|
35
126
|
exports.down = down;
|
|
127
|
+
/**
|
|
128
|
+
* ### Between
|
|
129
|
+
*
|
|
130
|
+
* _Returns a media query between two given breakpoints_
|
|
131
|
+
*
|
|
132
|
+
* Given `start` and `end` breakpoint keys ("zero", "s", "m", "l", "xl"),
|
|
133
|
+
* this function returns a media query (string) using a min-width and max-width.
|
|
134
|
+
*
|
|
135
|
+
* Note: This function subtracts `0.5px` from the next breakpoint value to prevent collisions.
|
|
136
|
+
* For example, `breakpoints.values.s`, has a `min-width` of `320px`, and the `max-width` is `767.5px`).
|
|
137
|
+
*
|
|
138
|
+
* If the `xl` breakpoint is provided, this function returns a media query with only a `min-width`,
|
|
139
|
+
* as seen in the second example below.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```ts
|
|
143
|
+
* import { useTheme } from '@workday/canvas-kit-react/common';
|
|
144
|
+
* import { space } from '@workday/canvas-kit-react/tokens';
|
|
145
|
+
*
|
|
146
|
+
* const theme = useTheme();
|
|
147
|
+
* const { between } = theme.canvas.breakpoints;
|
|
148
|
+
* // Returns '@media (min-width: 320px) and (max-width: 1023.5px)'
|
|
149
|
+
* const mediaQuery = between('s', 'm');
|
|
150
|
+
* const styles = {
|
|
151
|
+
* [mediaQuery]: {
|
|
152
|
+
* padding: space.s,
|
|
153
|
+
* }
|
|
154
|
+
* };
|
|
155
|
+
* ```
|
|
156
|
+
*
|
|
157
|
+
* This example uses `xl` as the `end` breakpoint and only adds a min-width to the media query.
|
|
158
|
+
* @example
|
|
159
|
+
* ```ts
|
|
160
|
+
* import { useTheme } from '@workday/canvas-kit-react/common';
|
|
161
|
+
* import { space } from '@workday/canvas-kit-react/tokens';
|
|
162
|
+
*
|
|
163
|
+
* const theme = useTheme();
|
|
164
|
+
* const { between } = theme.canvas.breakpoints;
|
|
165
|
+
* const mediaQuery = between('m', 'xl'); // Returns '@media (min-width: 768px)'
|
|
166
|
+
* const styles = {
|
|
167
|
+
* [mediaQuery]: {
|
|
168
|
+
* padding: space.s,
|
|
169
|
+
* }
|
|
170
|
+
* };
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
36
173
|
function between(start, end) {
|
|
37
174
|
var endIndex = exports.breakpointKeys.indexOf(end) + 1;
|
|
38
175
|
if (endIndex === exports.breakpointKeys.length) {
|
|
39
176
|
return up(start);
|
|
40
177
|
}
|
|
41
|
-
return ("@media (min-width:" + exports.breakpoints[start] + "px) and " +
|
|
42
|
-
("(max-width:" + (exports.breakpoints[exports.breakpointKeys[endIndex]] - step) + "px)"));
|
|
178
|
+
return ("@media (min-width: " + exports.breakpoints[start] + "px) and " +
|
|
179
|
+
("(max-width: " + (exports.breakpoints[exports.breakpointKeys[endIndex]] - step) + "px)"));
|
|
43
180
|
}
|
|
44
181
|
exports.between = between;
|
|
182
|
+
/**
|
|
183
|
+
* ### Only
|
|
184
|
+
*
|
|
185
|
+
* _Returns a media query with a `min-width` and `max-width` for a given breakpoint_
|
|
186
|
+
*
|
|
187
|
+
* Given a breakpoint key ("zero", "s", "m", "l", "xl"),
|
|
188
|
+
* this function returns a media query (string) using a `min-width` and `max-width`.
|
|
189
|
+
*
|
|
190
|
+
* Note: This function subtracts `0.5px` from the next breakpoint value to prevent collisions.
|
|
191
|
+
* For example, `breakpoints.values.s`, has a `min-width` of `320px`, and the `max-width` is `767.5px`).
|
|
192
|
+
*
|
|
193
|
+
* If the `xl` breakpoint is provided, this function returns a media query with only a `min-width` of `1440px`,
|
|
194
|
+
* as seen in the second example below.
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```ts
|
|
198
|
+
* import { useTheme } from '@workday/canvas-kit-react/common';
|
|
199
|
+
* import { space } from '@workday/canvas-kit-react/tokens';
|
|
200
|
+
*
|
|
201
|
+
* const theme = useTheme();
|
|
202
|
+
* const { only } = theme.canvas.breakpoints;
|
|
203
|
+
* const mediaQuery = only('s'); // Returns '@media (min-width: 320px) and (max-width: 767.5px)'
|
|
204
|
+
* const styles = {
|
|
205
|
+
* [mediaQuery]: {
|
|
206
|
+
* padding: space.s,
|
|
207
|
+
* }
|
|
208
|
+
* };
|
|
209
|
+
* ```
|
|
210
|
+
*
|
|
211
|
+
* This example uses the `xl` breakpoint and only adds a `min-width` of `1440px` to the media query.
|
|
212
|
+
* @example
|
|
213
|
+
* ```ts
|
|
214
|
+
* import { useTheme } from '@workday/canvas-kit-react/common';
|
|
215
|
+
* import { space } from '@workday/canvas-kit-react/tokens';
|
|
216
|
+
*
|
|
217
|
+
* const theme = useTheme();
|
|
218
|
+
* const { only } = theme.canvas.breakpoints;
|
|
219
|
+
* const mediaQuery = only('xl'); // Returns '@media (min-width: 1440px)'
|
|
220
|
+
* const styles = {
|
|
221
|
+
* [mediaQuery]: {
|
|
222
|
+
* padding: space.s,
|
|
223
|
+
* }
|
|
224
|
+
* };
|
|
225
|
+
* ```
|
|
226
|
+
*/
|
|
45
227
|
function only(key) {
|
|
46
228
|
return between(key, key);
|
|
47
229
|
}
|