@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.
Files changed (71) hide show
  1. package/action-bar/lib/ActionBar.tsx +43 -30
  2. package/common/lib/styles/accessibleHide.ts +2 -2
  3. package/common/lib/theming/README.md +189 -25
  4. package/common/lib/theming/breakpoints.ts +296 -16
  5. package/common/lib/theming/types.ts +191 -1
  6. package/dist/commonjs/action-bar/lib/ActionBar.d.ts.map +1 -1
  7. package/dist/commonjs/action-bar/lib/ActionBar.js +35 -27
  8. package/dist/commonjs/button/lib/parts/ButtonLabel.d.ts +1 -1
  9. package/dist/commonjs/common/lib/styles/accessibleHide.d.ts +2 -2
  10. package/dist/commonjs/common/lib/styles/accessibleHide.d.ts.map +1 -1
  11. package/dist/commonjs/common/lib/theming/breakpoints.d.ts +287 -6
  12. package/dist/commonjs/common/lib/theming/breakpoints.d.ts.map +1 -1
  13. package/dist/commonjs/common/lib/theming/breakpoints.js +192 -10
  14. package/dist/commonjs/common/lib/theming/types.d.ts +191 -1
  15. package/dist/commonjs/common/lib/theming/types.d.ts.map +1 -1
  16. package/dist/commonjs/common/lib/utils/components.d.ts +1 -1
  17. package/dist/commonjs/pagination/lib/Pagination/PageList.d.ts +1 -1
  18. package/dist/commonjs/pagination/lib/Pagination/Pagination.d.ts +5 -5
  19. package/dist/commonjs/pagination/lib/Pagination/common/List.d.ts +1 -1
  20. package/dist/commonjs/pagination/lib/Pagination/common/utils/space.d.ts +28 -28
  21. package/dist/commonjs/tokens/index.d.ts +3 -20
  22. package/dist/commonjs/tokens/index.d.ts.map +1 -1
  23. package/dist/commonjs/tokens/index.js +3 -6
  24. package/dist/commonjs/tokens/lib/depth.d.ts +109 -3
  25. package/dist/commonjs/tokens/lib/depth.d.ts.map +1 -1
  26. package/dist/commonjs/tokens/lib/depth.js +40 -5
  27. package/dist/es6/action-bar/lib/ActionBar.d.ts.map +1 -1
  28. package/dist/es6/action-bar/lib/ActionBar.js +33 -22
  29. package/dist/es6/button/lib/parts/ButtonLabel.d.ts +1 -1
  30. package/dist/es6/common/lib/styles/accessibleHide.d.ts +2 -2
  31. package/dist/es6/common/lib/styles/accessibleHide.d.ts.map +1 -1
  32. package/dist/es6/common/lib/theming/breakpoints.d.ts +287 -6
  33. package/dist/es6/common/lib/theming/breakpoints.d.ts.map +1 -1
  34. package/dist/es6/common/lib/theming/breakpoints.js +192 -10
  35. package/dist/es6/common/lib/theming/types.d.ts +191 -1
  36. package/dist/es6/common/lib/theming/types.d.ts.map +1 -1
  37. package/dist/es6/pagination/lib/Pagination/PageList.d.ts +1 -1
  38. package/dist/es6/pagination/lib/Pagination/Pagination.d.ts +5 -5
  39. package/dist/es6/pagination/lib/Pagination/common/List.d.ts +1 -1
  40. package/dist/es6/pagination/lib/Pagination/common/utils/space.d.ts +28 -28
  41. package/dist/es6/tokens/index.d.ts +3 -20
  42. package/dist/es6/tokens/index.d.ts.map +1 -1
  43. package/dist/es6/tokens/index.js +1 -1
  44. package/dist/es6/tokens/lib/depth.d.ts +109 -3
  45. package/dist/es6/tokens/lib/depth.d.ts.map +1 -1
  46. package/dist/es6/tokens/lib/depth.js +40 -2
  47. package/package.json +5 -6
  48. package/tokens/README.md +5 -12
  49. package/tokens/index.ts +2 -2
  50. package/tokens/lib/depth.ts +125 -3
  51. package/ts3.5/dist/commonjs/button/lib/parts/ButtonLabel.d.ts +1 -1
  52. package/ts3.5/dist/commonjs/common/lib/styles/accessibleHide.d.ts +2 -2
  53. package/ts3.5/dist/commonjs/common/lib/theming/breakpoints.d.ts +287 -6
  54. package/ts3.5/dist/commonjs/common/lib/theming/types.d.ts +191 -1
  55. package/ts3.5/dist/commonjs/common/lib/utils/components.d.ts +1 -1
  56. package/ts3.5/dist/commonjs/pagination/lib/Pagination/PageList.d.ts +1 -1
  57. package/ts3.5/dist/commonjs/pagination/lib/Pagination/Pagination.d.ts +5 -5
  58. package/ts3.5/dist/commonjs/pagination/lib/Pagination/common/List.d.ts +1 -1
  59. package/ts3.5/dist/commonjs/pagination/lib/Pagination/common/utils/space.d.ts +28 -28
  60. package/ts3.5/dist/commonjs/tokens/index.d.ts +3 -20
  61. package/ts3.5/dist/commonjs/tokens/lib/depth.d.ts +109 -3
  62. package/ts3.5/dist/es6/button/lib/parts/ButtonLabel.d.ts +1 -1
  63. package/ts3.5/dist/es6/common/lib/styles/accessibleHide.d.ts +2 -2
  64. package/ts3.5/dist/es6/common/lib/theming/breakpoints.d.ts +287 -6
  65. package/ts3.5/dist/es6/common/lib/theming/types.d.ts +191 -1
  66. package/ts3.5/dist/es6/pagination/lib/Pagination/PageList.d.ts +1 -1
  67. package/ts3.5/dist/es6/pagination/lib/Pagination/Pagination.d.ts +5 -5
  68. package/ts3.5/dist/es6/pagination/lib/Pagination/common/List.d.ts +1 -1
  69. package/ts3.5/dist/es6/pagination/lib/Pagination/common/utils/space.d.ts +28 -28
  70. package/ts3.5/dist/es6/tokens/index.d.ts +3 -20
  71. package/ts3.5/dist/es6/tokens/lib/depth.d.ts +109 -3
@@ -9,43 +9,278 @@ export enum BreakpointKey {
9
9
  export type BreakpointFnParam = BreakpointKey | keyof typeof BreakpointKey;
10
10
 
11
11
  export type CanvasBreakpoints = {
12
- zero: number;
13
- s: number;
14
- m: number;
15
- l: number;
16
- xl: number;
12
+ /**
13
+ * ### Zero Breakpoint
14
+ *
15
+ * This breakpoint is useful when you need to set a media query `min-width` below small.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * import { useTheme } from '@workday/canvas-kit-react/common';
20
+ * import { space } from '@workday/canvas-kit-react/tokens';
21
+ *
22
+ * const theme = useTheme();
23
+ * const { values } = theme.canvas.breakpoints;
24
+ * const styles = {
25
+ * [`@media (min-width: ${values.zero}px)`]: {
26
+ * padding: space.xxs,
27
+ * },
28
+ * }
29
+ * ```
30
+ */
31
+ zero: 0;
32
+ /**
33
+ * ### Small Breakpoint
34
+ *
35
+ * The small breakpoint provides the `min-width` for mobile devices, such as phones and tablets.
36
+ * This size ranges from a min-width of 320px to a max-width of 767px.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * import { useTheme } from '@workday/canvas-kit-react/common';
41
+ * import { space } from '@workday/canvas-kit-react/tokens';
42
+ *
43
+ * const theme = useTheme();
44
+ * const { values } = theme.canvas.breakpoints;
45
+ * const styles = {
46
+ * [`@media (min-width: ${values.s}px)`]: {
47
+ * padding: space.xs,
48
+ * },
49
+ * }
50
+ * ```
51
+ */
52
+ s: 320;
53
+ /**
54
+ * ### Medium Breakpoint
55
+ *
56
+ * The medium breakpoint is the min-width for intended for medium screens, such as laptops.
57
+ * This size ranges from a min-width of 768px to a max-width of 1023px.
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * import { useTheme } from '@workday/canvas-kit-react/common';
62
+ * import { space } from '@workday/canvas-kit-react/tokens';
63
+ *
64
+ * const theme = useTheme();
65
+ * const { values } = theme.canvas.breakpoints;
66
+ * const styles = {
67
+ * [`@media (min-width: ${values.m}px)`]: {
68
+ * padding: space.s,
69
+ * },
70
+ * }
71
+ * ```
72
+ */
73
+ m: 768;
74
+ /**
75
+ * ### Large Breakpoint
76
+ *
77
+ * The large breakpoint is the min-width for intended for large screens, such as desktops.
78
+ * This size ranges from a min-width of 1024px to a max-width of 1439px.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * import { useTheme } from '@workday/canvas-kit-react/common';
83
+ * import { space } from '@workday/canvas-kit-react/tokens';
84
+ *
85
+ * const theme = useTheme();
86
+ * const { values } = theme.canvas.breakpoints;
87
+ * const styles = {
88
+ * [`@media (min-width: ${values.m}px)`]: {
89
+ * padding: space.s,
90
+ * },
91
+ * }
92
+ * ```
93
+ */
94
+ l: 1024;
95
+ /**
96
+ * ### Extra-Large Breakpoint
97
+ *
98
+ * The large breakpoint is the min-width for intended for extra-large screens, such as wide monitors and TVs.
99
+ * This size has a min-width of 1440px and no max-width.
100
+ *
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 { values } = theme.canvas.breakpoints;
108
+ * const styles = {
109
+ * [`@media (min-width: ${values.m}px)`]: {
110
+ * padding: space.s
111
+ * },
112
+ * }
113
+ * ```
114
+ */
115
+ xl: 1440;
17
116
  };
18
117
 
19
118
  export const breakpointKeys = ['zero', 's', 'm', 'l', 'xl'] as const;
20
119
 
120
+ /**
121
+ * ### Theme Breakpoint Values
122
+ *
123
+ * Breakpoints are used by media queries to conditionally apply or modify styles based on the viewport width.
124
+ * This allows the UI to be responsive to various screen sizes. This object provides five breakpoint values
125
+ * that correspond to the min-widths of our standard screen sizes.
126
+ *
127
+ * - `zero`: 0
128
+ * - `s`: 320
129
+ * - `m`: 768
130
+ * - `l`: 1024
131
+ * - `xl`: 1440
132
+ *
133
+ * And these are our standard screen size ranges:
134
+ *
135
+ * - `small` (320px - 767px) Used for mobile-sized screens
136
+ * - `medium` (768px - 1023px) Used for tablet-sized screens
137
+ * - `large` - (1024px - 1439px) Used for laptop and small desktop screens
138
+ * - `extra-large` (≥1440px) Used for very large screens
139
+ *
140
+ * Note: Some applications may only require a subset of screen sizes and not use all breakpoints.
141
+ *
142
+ */
21
143
  export const breakpoints: CanvasBreakpoints = {
22
144
  zero: 0,
23
- s: 600,
24
- m: 960,
25
- l: 1280,
26
- xl: 1920,
145
+ s: 320,
146
+ m: 768,
147
+ l: 1024,
148
+ xl: 1440,
27
149
  };
28
150
 
29
151
  const step = 0.5;
30
152
 
153
+ /**
154
+ * ### Up
155
+ *
156
+ * _Returns a media query above the `min-width` for the range of a given breakpoint_
157
+ *
158
+ * Given a `start` breakpoint key ("zero", "s", "m", "l", "xl"),
159
+ * this function returns a media query (string) using a `min-width`.
160
+ *
161
+ * @example
162
+ * ```ts
163
+ * import { useTheme } from '@workday/canvas-kit-react/common';
164
+ * import { space } from '@workday/canvas-kit-react/tokens';
165
+ *
166
+ * const theme = useTheme();
167
+ * const { up } = theme.canvas.breakpoints;
168
+ * const mediaQuery = up('l'); // Returns '@media (min-width: 1024px)'
169
+ * const styles = {
170
+ * [mediaQuery]: {
171
+ * padding: space.m,
172
+ * }
173
+ * };
174
+ * ```
175
+ */
31
176
  export function up(key: BreakpointFnParam) {
32
177
  const value = typeof breakpoints[key as BreakpointKey] === 'number' ? breakpoints[key] : key;
33
- return `@media (min-width:${value}px)`;
178
+ return `@media (min-width: ${value}px)`;
34
179
  }
35
180
 
36
- export function down(key: BreakpointFnParam) {
37
- const endIndex = breakpointKeys.indexOf(key as BreakpointKey) + 1;
181
+ /**
182
+ * ### Down
183
+ *
184
+ * _Returns a media query below the `max-width` for the range of a given breakpoint_
185
+ *
186
+ * Given an `end` breakpoint key ("zero", "s", "m", "l", "xl"),
187
+ * this function returns a media query (string) using a `max-width`.
188
+ *
189
+ * Note: This function subtracts `0.5px` from the next breakpoint value to prevent collisions.
190
+ * For example, `breakpoints.values.s`, has a `min-width` of `320px`, and the `max-width` is `767.5px`).
191
+ *
192
+ * If the `xl` breakpoint is provided, this function returns a media query with only a `min-width` of `0`,
193
+ * as seen in the second example below.
194
+ *
195
+ * @example
196
+ * ```ts
197
+ * import { useTheme } from '@workday/canvas-kit-react/common';
198
+ * import { space } from '@workday/canvas-kit-react/tokens';
199
+ *
200
+ * const theme = useTheme();
201
+ * const { down } = theme.canvas.breakpoints;
202
+ * const mediaQuery = down('m'); // Returns '@media (max-width: 1023.5px)'
203
+ * const styles = {
204
+ * [mediaQuery]: {
205
+ * padding: space.m,
206
+ * }
207
+ * };
208
+ * ```
209
+ *
210
+ * This example uses the `xl` breakpoint and only adds a `min-width` of `0` to the media query.
211
+ * @example
212
+ * ```ts
213
+ * import { useTheme } from '@workday/canvas-kit-react/common';
214
+ * import { space } from '@workday/canvas-kit-react/tokens';
215
+ *
216
+ * const theme = useTheme();
217
+ * const { down } = theme.canvas.breakpoints;
218
+ * const mediaQuery = down('xl'); // Returns '@media (min-width: 0)'
219
+ * const styles = {
220
+ * [mediaQuery]: {
221
+ * padding: space.m,
222
+ * }
223
+ * };
224
+ * ```
225
+ */
226
+ export function down(endKey: BreakpointFnParam) {
227
+ const endIndex = breakpointKeys.indexOf(endKey as BreakpointKey) + 1;
38
228
  const upperbound = breakpoints[breakpointKeys[endIndex]];
39
-
40
229
  if (endIndex === breakpointKeys.length) {
41
230
  // xl down applies to all sizes
42
231
  return up(BreakpointKey.zero);
43
232
  }
44
233
 
45
234
  const value = typeof upperbound === 'number' && endIndex > 0 ? upperbound : 0;
46
- return `@media (max-width:${value - step}px)`;
235
+ return `@media (max-width: ${value - step}px)`;
47
236
  }
48
237
 
238
+ /**
239
+ * ### Between
240
+ *
241
+ * _Returns a media query between two given breakpoints_
242
+ *
243
+ * Given `start` and `end` breakpoint keys ("zero", "s", "m", "l", "xl"),
244
+ * this function returns a media query (string) using a min-width and max-width.
245
+ *
246
+ * Note: This function subtracts `0.5px` from the next breakpoint value to prevent collisions.
247
+ * For example, `breakpoints.values.s`, has a `min-width` of `320px`, and the `max-width` is `767.5px`).
248
+ *
249
+ * If the `xl` breakpoint is provided, this function returns a media query with only a `min-width`,
250
+ * as seen in the second example below.
251
+ *
252
+ * @example
253
+ * ```ts
254
+ * import { useTheme } from '@workday/canvas-kit-react/common';
255
+ * import { space } from '@workday/canvas-kit-react/tokens';
256
+ *
257
+ * const theme = useTheme();
258
+ * const { between } = theme.canvas.breakpoints;
259
+ * // Returns '@media (min-width: 320px) and (max-width: 1023.5px)'
260
+ * const mediaQuery = between('s', 'm');
261
+ * const styles = {
262
+ * [mediaQuery]: {
263
+ * padding: space.s,
264
+ * }
265
+ * };
266
+ * ```
267
+ *
268
+ * This example uses `xl` as the `end` breakpoint and only adds a min-width to the media query.
269
+ * @example
270
+ * ```ts
271
+ * import { useTheme } from '@workday/canvas-kit-react/common';
272
+ * import { space } from '@workday/canvas-kit-react/tokens';
273
+ *
274
+ * const theme = useTheme();
275
+ * const { between } = theme.canvas.breakpoints;
276
+ * const mediaQuery = between('m', 'xl'); // Returns '@media (min-width: 768px)'
277
+ * const styles = {
278
+ * [mediaQuery]: {
279
+ * padding: space.s,
280
+ * }
281
+ * };
282
+ * ```
283
+ */
49
284
  export function between(start: BreakpointFnParam, end: BreakpointFnParam) {
50
285
  const endIndex = breakpointKeys.indexOf(end) + 1;
51
286
 
@@ -54,11 +289,56 @@ export function between(start: BreakpointFnParam, end: BreakpointFnParam) {
54
289
  }
55
290
 
56
291
  return (
57
- `@media (min-width:${breakpoints[start]}px) and ` +
58
- `(max-width:${breakpoints[breakpointKeys[endIndex]] - step}px)`
292
+ `@media (min-width: ${breakpoints[start]}px) and ` +
293
+ `(max-width: ${breakpoints[breakpointKeys[endIndex]] - step}px)`
59
294
  );
60
295
  }
61
296
 
297
+ /**
298
+ * ### Only
299
+ *
300
+ * _Returns a media query with a `min-width` and `max-width` for a given breakpoint_
301
+ *
302
+ * Given a breakpoint key ("zero", "s", "m", "l", "xl"),
303
+ * this function returns a media query (string) using a `min-width` and `max-width`.
304
+ *
305
+ * Note: This function subtracts `0.5px` from the next breakpoint value to prevent collisions.
306
+ * For example, `breakpoints.values.s`, has a `min-width` of `320px`, and the `max-width` is `767.5px`).
307
+ *
308
+ * If the `xl` breakpoint is provided, this function returns a media query with only a `min-width` of `1440px`,
309
+ * as seen in the second example below.
310
+ *
311
+ * @example
312
+ * ```ts
313
+ * import { useTheme } from '@workday/canvas-kit-react/common';
314
+ * import { space } from '@workday/canvas-kit-react/tokens';
315
+ *
316
+ * const theme = useTheme();
317
+ * const { only } = theme.canvas.breakpoints;
318
+ * const mediaQuery = only('s'); // Returns '@media (min-width: 320px) and (max-width: 767.5px)'
319
+ * const styles = {
320
+ * [mediaQuery]: {
321
+ * padding: space.s,
322
+ * }
323
+ * };
324
+ * ```
325
+ *
326
+ * This example uses the `xl` breakpoint and only adds a `min-width` of `1440px` to the media query.
327
+ * @example
328
+ * ```ts
329
+ * import { useTheme } from '@workday/canvas-kit-react/common';
330
+ * import { space } from '@workday/canvas-kit-react/tokens';
331
+ *
332
+ * const theme = useTheme();
333
+ * const { only } = theme.canvas.breakpoints;
334
+ * const mediaQuery = only('xl'); // Returns '@media (min-width: 1440px)'
335
+ * const styles = {
336
+ * [mediaQuery]: {
337
+ * padding: space.s,
338
+ * }
339
+ * };
340
+ * ```
341
+ */
62
342
  export function only(key: BreakpointFnParam) {
63
343
  return between(key, key);
64
344
  }
@@ -36,12 +36,202 @@ export interface CanvasTheme {
36
36
  success: CanvasThemePalette;
37
37
  neutral: CanvasThemePalette;
38
38
  };
39
+ /**
40
+ * ### Theme Breakpoints
41
+ *
42
+ * Breakpoints are used by media queries to conditionally apply or modify styles based on the viewport width.
43
+ * This allows the UI to be responsive to various screen sizes.
44
+ *
45
+ * This breakpoints object contains `values` and several helper functions: `up`, `down`, `between`, and `only`.
46
+ * You can find more detailed information by inspecting individual values and functions.
47
+ */
39
48
  breakpoints: {
49
+ /**
50
+ * ### Breakpoint Values
51
+ *
52
+ * This object provides five breakpoint values
53
+ * that correspond to the min-widths of our standard screen sizes.
54
+ *
55
+ * - `zero`: 0
56
+ * - `s`: 320
57
+ * - `m`: 768
58
+ * - `l`: 1024
59
+ * - `xl`: 1440
60
+ *
61
+ * And these are our standard screen size ranges:
62
+ *
63
+ * - `small` (320px - 767px) Used for mobile-sized screens
64
+ * - `medium` (768px - 1023px) Used for tablet-sized screens
65
+ * - `large` - (1024px - 1439px) Used for laptop and small desktop screens
66
+ * - `extra-large` (≥1440px) Used for very large screens
67
+ *
68
+ * Note: Some applications may only require a subset of screen sizes and not use all breakpoints.
69
+ *
70
+ */
40
71
  values: CanvasBreakpoints;
72
+ /**
73
+ * ### Up
74
+ *
75
+ * _Returns a media query above the `min-width` for the range of a given breakpoint_
76
+ *
77
+ * Given a `start` breakpoint key ("zero", "s", "m", "l", "xl"),
78
+ * this function returns a media query (string) using a `min-width`.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * import { useTheme } from '@workday/canvas-kit-react/common';
83
+ * import { space } from '@workday/canvas-kit-react/tokens';
84
+ *
85
+ * const theme = useTheme();
86
+ * const { up } = theme.canvas.breakpoints;
87
+ * const mediaQuery = up('l'); // Returns '@media (min-width: 1024px)'
88
+ * const styles = {
89
+ * [mediaQuery]: {
90
+ * padding: space.m,
91
+ * }
92
+ * };
93
+ * ```
94
+ */
41
95
  up: (key: BreakpointFnParam) => string;
96
+ /**
97
+ * ### Down
98
+ *
99
+ * _Returns a media query below the `max-width` for the range of a given breakpoint_
100
+ *
101
+ * Given an `end` breakpoint key ("zero", "s", "m", "l", "xl"),
102
+ * this function returns a media query (string) using a `max-width`.
103
+ *
104
+ * Note: This function subtracts `0.5px` from the next breakpoint value to prevent collisions.
105
+ * For example, `breakpoints.values.s`, has a `min-width` of `320px`, and the `max-width` is `767.5px`).
106
+ *
107
+ * If the `xl` breakpoint is provided, this function returns a media query with only a `min-width` of `0`,
108
+ * as seen in the second example below.
109
+ *
110
+ * @example
111
+ * ```ts
112
+ * import { useTheme } from '@workday/canvas-kit-react/common';
113
+ * import { space } from '@workday/canvas-kit-react/tokens';
114
+ *
115
+ * const theme = useTheme();
116
+ * const { down } = theme.canvas.breakpoints;
117
+ * const mediaQuery = down('m'); // Returns '@media (max-width: 1023.5px)'
118
+ * const styles = {
119
+ * [mediaQuery]: {
120
+ * padding: space.m,
121
+ * }
122
+ * };
123
+ * ```
124
+ *
125
+ * This example uses the `xl` breakpoint and only adds a `min-width` of `0` to the media query.
126
+ * @example
127
+ * ```ts
128
+ * import { useTheme } from '@workday/canvas-kit-react/common';
129
+ * import { space } from '@workday/canvas-kit-react/tokens';
130
+ *
131
+ * const theme = useTheme();
132
+ * const { down } = theme.canvas.breakpoints;
133
+ * const mediaQuery = down('xl'); // Returns '@media (min-width: 0)'
134
+ * const styles = {
135
+ * [mediaQuery]: {
136
+ * padding: space.m,
137
+ * }
138
+ * };
139
+ * ```
140
+ */
42
141
  down: (key: BreakpointFnParam) => string;
43
- only: (key: BreakpointFnParam) => string;
142
+ /**
143
+ * ### Between
144
+ *
145
+ * _Returns a media query between two given breakpoints_
146
+ *
147
+ * Given `start` and `end` breakpoint keys ("zero", "s", "m", "l", "xl"),
148
+ * this function returns a media query (string) using a min-width and max-width.
149
+ *
150
+ * Note: This function subtracts `0.5px` from the next breakpoint value to prevent collisions.
151
+ * For example, `breakpoints.values.s`, has a `min-width` of `320px`, and the `max-width` is `767.5px`).
152
+ *
153
+ * If the `xl` breakpoint is provided, this function returns a media query with only a `min-width`,
154
+ * as seen in the second example below.
155
+ *
156
+ * @example
157
+ * ```ts
158
+ * import { useTheme } from '@workday/canvas-kit-react/common';
159
+ * import { space } from '@workday/canvas-kit-react/tokens';
160
+ *
161
+ * const theme = useTheme();
162
+ * const { between } = theme.canvas.breakpoints;
163
+ * // Returns '@media (min-width: 320px) and (max-width: 1023.5px)'
164
+ * const mediaQuery = between('s', 'm');
165
+ * const styles = {
166
+ * [mediaQuery]: {
167
+ * padding: space.s,
168
+ * }
169
+ * };
170
+ * ```
171
+ *
172
+ * This example uses `xl` as the `end` breakpoint and only adds a min-width to the media query.
173
+ * @example
174
+ * ```ts
175
+ * import { useTheme } from '@workday/canvas-kit-react/common';
176
+ * import { space } from '@workday/canvas-kit-react/tokens';
177
+ *
178
+ * const theme = useTheme();
179
+ * const { between } = theme.canvas.breakpoints;
180
+ * const mediaQuery = between('m', 'xl'); // Returns '@media (min-width: 768px)'
181
+ * const styles = {
182
+ * [mediaQuery]: {
183
+ * padding: space.s,
184
+ * }
185
+ * };
186
+ * ```
187
+ */
44
188
  between: (start: BreakpointFnParam, end: BreakpointFnParam) => string;
189
+ /**
190
+ * ### Only
191
+ *
192
+ * _Returns a media query with a `min-width` and `max-width` for a given breakpoint_
193
+ *
194
+ * Given a breakpoint key ("zero", "s", "m", "l", "xl"),
195
+ * this function returns a media query (string) using a `min-width` and `max-width`.
196
+ *
197
+ * Note: This function subtracts `0.5px` from the next breakpoint value to prevent collisions.
198
+ * For example, `breakpoints.values.s`, has a `min-width` of `320px`, and the `max-width` is `767.5px`).
199
+ *
200
+ * If the `xl` breakpoint is provided, this function returns a media query with only a `min-width` of `1440px`,
201
+ * as seen in the second example below.
202
+ *
203
+ * @example
204
+ * ```ts
205
+ * import { useTheme } from '@workday/canvas-kit-react/common';
206
+ * import { space } from '@workday/canvas-kit-react/tokens';
207
+ *
208
+ * const theme = useTheme();
209
+ * const { only } = theme.canvas.breakpoints;
210
+ * const mediaQuery = only('s'); // Returns '@media (min-width: 320px) and (max-width: 767.5px)'
211
+ * const styles = {
212
+ * [mediaQuery]: {
213
+ * padding: space.s,
214
+ * }
215
+ * };
216
+ * ```
217
+ *
218
+ * This example uses the `xl` breakpoint and only adds a `min-width` of `1440px` to the media query.
219
+ * @example
220
+ * ```ts
221
+ * import { useTheme } from '@workday/canvas-kit-react/common';
222
+ * import { space } from '@workday/canvas-kit-react/tokens';
223
+ *
224
+ * const theme = useTheme();
225
+ * const { only } = theme.canvas.breakpoints;
226
+ * const mediaQuery = only('xl'); // Returns '@media (min-width: 1440px)'
227
+ * const styles = {
228
+ * [mediaQuery]: {
229
+ * padding: space.s,
230
+ * }
231
+ * };
232
+ * ```
233
+ */
234
+ only: (key: BreakpointFnParam) => string;
45
235
  };
46
236
  direction: ContentDirection;
47
237
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ActionBar.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/ActionBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC1E;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AA0CD,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC;IAC7D,MAAM;CASd"}
1
+ {"version":3,"file":"ActionBar.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/ActionBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC1E;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAuDD,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC;IAC7D,MAAM;CASd"}
@@ -41,49 +41,57 @@ var __importStar = (this && this.__importStar) || function (mod) {
41
41
  result["default"] = mod;
42
42
  return result;
43
43
  };
44
- var __importDefault = (this && this.__importDefault) || function (mod) {
45
- return (mod && mod.__esModule) ? mod : { "default": mod };
46
- };
47
44
  Object.defineProperty(exports, "__esModule", { value: true });
48
45
  var React = __importStar(require("react"));
49
- var styled_1 = __importDefault(require("@emotion/styled"));
46
+ var common_1 = require("@workday/canvas-kit-react/common");
50
47
  var tokens_1 = require("@workday/canvas-kit-react/tokens");
51
- var ActionBarContainer = styled_1.default('div')({
48
+ function getFixedStyles(fixed) {
49
+ if (fixed === void 0) { fixed = false; }
50
+ return fixed
51
+ ? {
52
+ position: 'fixed',
53
+ left: 0,
54
+ bottom: 0,
55
+ right: 0,
56
+ }
57
+ : {};
58
+ }
59
+ var ActionBarContainer = common_1.styled('div')({
52
60
  borderTop: "solid 1px " + tokens_1.colors.soap400,
53
61
  background: tokens_1.commonColors.background,
54
62
  padding: tokens_1.space.s,
55
63
  boxShadow: '0 -2px 4px rgba(0, 0, 0, 0.08)',
56
- '@media (max-width: 575px)': {
57
- padding: tokens_1.space.xxs,
58
- },
59
64
  }, function (_a) {
60
- var fixed = _a.fixed;
61
- return fixed && {
62
- position: 'fixed',
63
- left: 0,
64
- bottom: 0,
65
- right: 0,
66
- };
65
+ var _b;
66
+ var fixed = _a.fixed, theme = _a.theme;
67
+ return __assign(__assign({}, getFixedStyles(fixed)), (_b = {}, _b[theme.canvas.breakpoints.down('s')] = {
68
+ padding: tokens_1.space.xxs,
69
+ }, _b));
67
70
  });
68
- var ChildrenContainer = styled_1.default('div')({
71
+ var ChildrenContainer = common_1.styled('div')({
69
72
  display: 'inline-block',
70
73
  padding: "0 " + tokens_1.space.m,
71
74
  '*:not(:first-of-type)': {
72
75
  marginLeft: tokens_1.space.s,
73
76
  },
74
- '@media (max-width: 575px)': {
75
- display: 'flex',
76
- padding: tokens_1.space.xxs,
77
- justifyContent: 'center',
78
- flexDirection: 'row-reverse',
79
- '> *': {
80
- flex: 1,
81
- '&:not(:first-of-type)': {
82
- marginRight: tokens_1.space.s,
83
- marginLeft: 0,
77
+ }, function (_a) {
78
+ var _b;
79
+ var theme = _a.theme;
80
+ return (_b = {},
81
+ _b[theme.canvas.breakpoints.down('s')] = {
82
+ display: 'flex',
83
+ padding: tokens_1.space.xxs,
84
+ justifyContent: 'center',
85
+ flexDirection: 'row-reverse',
86
+ '> *': {
87
+ flex: 1,
88
+ '&:not(:first-of-type)': {
89
+ marginRight: tokens_1.space.s,
90
+ marginLeft: 0,
91
+ },
84
92
  },
85
93
  },
86
- },
94
+ _b);
87
95
  });
88
96
  var ActionBar = /** @class */ (function (_super) {
89
97
  __extends(ActionBar, _super);
@@ -1,3 +1,3 @@
1
1
  /// <reference types="@emotion/core" />
2
- export declare const ButtonLabel: import("@emotion/styled-base").StyledComponent<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "tabIndex" | "inputMode" | "is" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css">, import("../../../common").EmotionCanvasTheme>;
2
+ export declare const ButtonLabel: import("@emotion/styled-base").StyledComponent<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "css" | "style" | "title" | "dir" | "slot" | "children" | "hidden" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "inputMode" | "is" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture">, import("../../../common").EmotionCanvasTheme>;
3
3
  //# sourceMappingURL=ButtonLabel.d.ts.map