@workday/canvas-kit-react 11.0.0-alpha.718-next.0 → 11.0.0-alpha.726-next.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/collection/lib/useCursorListModel.tsx +1 -1
- package/common/lib/CanvasProvider.tsx +2 -2
- package/common/lib/theming/useThemedRing.ts +1 -1
- package/dist/commonjs/collection/lib/useCursorListModel.js +1 -1
- package/dist/commonjs/common/lib/CanvasProvider.d.ts.map +1 -1
- package/dist/commonjs/common/lib/CanvasProvider.js +2 -2
- package/dist/commonjs/common/lib/theming/useThemedRing.d.ts +1 -1
- package/dist/commonjs/common/lib/theming/useThemedRing.js +1 -1
- package/dist/commonjs/layout/lib/utils/mergeStyles.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/mergeStyles.js +3 -8
- package/dist/commonjs/select/lib/hooks/useSelectInput.d.ts.map +1 -1
- package/dist/commonjs/select/lib/hooks/useSelectInput.js +30 -1
- package/dist/commonjs/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/useTabsModel.js +2 -4
- package/dist/es6/collection/lib/useCursorListModel.js +1 -1
- package/dist/es6/common/lib/CanvasProvider.d.ts.map +1 -1
- package/dist/es6/common/lib/CanvasProvider.js +2 -2
- package/dist/es6/common/lib/theming/useThemedRing.d.ts +1 -1
- package/dist/es6/common/lib/theming/useThemedRing.js +1 -1
- package/dist/es6/layout/lib/utils/mergeStyles.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/mergeStyles.js +3 -8
- package/dist/es6/select/lib/hooks/useSelectInput.d.ts.map +1 -1
- package/dist/es6/select/lib/hooks/useSelectInput.js +30 -1
- package/dist/es6/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/dist/es6/tabs/lib/useTabsModel.js +2 -4
- package/layout/lib/utils/mergeStyles.ts +3 -11
- package/package.json +4 -5
- package/select/lib/hooks/useSelectInput.ts +33 -1
- package/tabs/lib/useTabsModel.tsx +3 -4
- package/action-bar/LICENSE +0 -51
- package/action-bar/README.md +0 -6
- package/avatar/LICENSE +0 -51
- package/avatar/README.md +0 -111
- package/badge/LICENSE +0 -51
- package/badge/README.md +0 -127
- package/banner/LICENSE +0 -51
- package/banner/README.md +0 -7
- package/breadcrumbs/LICENSE +0 -52
- package/breadcrumbs/README.md +0 -9
- package/button/LICENSE +0 -51
- package/button/README.md +0 -272
- package/card/LICENSE +0 -51
- package/card/README.md +0 -7
- package/checkbox/LICENSE +0 -51
- package/checkbox/README.md +0 -7
- package/collection/LICENSE +0 -52
- package/collection/README.md +0 -32
- package/color-picker/LICENSE +0 -51
- package/color-picker/README.md +0 -13
- package/combobox/LICENSE +0 -52
- package/combobox/README.md +0 -7
- package/common/LICENSE +0 -51
- package/common/README.md +0 -467
- package/dialog/LICENSE +0 -52
- package/dialog/README.md +0 -10
- package/form-field/LICENSE +0 -51
- package/form-field/README.md +0 -5
- package/icon/LICENSE +0 -51
- package/icon/README.md +0 -428
- package/layout/LICENSE +0 -52
- package/layout/README.md +0 -151
- package/loading-dots/LICENSE +0 -51
- package/loading-dots/README.md +0 -7
- package/menu/LICENSE +0 -52
- package/menu/README.md +0 -32
- package/modal/README.md +0 -12
- package/pagination/LICENSE +0 -51
- package/pagination/README.md +0 -7
- package/popup/LICENSE +0 -51
- package/popup/README.md +0 -12
- package/radio/LICENSE +0 -51
- package/radio/README.md +0 -7
- package/segmented-control/LICENSE +0 -51
- package/segmented-control/README.md +0 -56
- package/select/README.md +0 -12
- package/side-panel/README.md +0 -174
- package/skeleton/README.md +0 -7
- package/status-indicator/LICENSE +0 -51
- package/status-indicator/README.md +0 -7
- package/switch/README.md +0 -7
- package/table/LICENSE +0 -51
- package/table/README.md +0 -7
- package/tabs/LICENSE +0 -51
- package/tabs/README.md +0 -7
- package/testing/LICENSE +0 -52
- package/testing/README.md +0 -6
- package/text/LICENSE +0 -52
- package/text/README.md +0 -5
- package/text-area/LICENSE +0 -51
- package/text-area/README.md +0 -7
- package/text-input/LICENSE +0 -51
- package/text-input/README.md +0 -7
- package/toast/LICENSE +0 -52
- package/toast/README.md +0 -5
- package/tokens/LICENSE +0 -51
- package/tokens/README.md +0 -427
- package/tooltip/LICENSE +0 -51
- package/tooltip/README.md +0 -77
package/tokens/README.md
DELETED
|
@@ -1,427 +0,0 @@
|
|
|
1
|
-
# Canvas Kit Tokens
|
|
2
|
-
|
|
3
|
-
Canvas Kit Tokens contains values and base styles that are shared across the kit.
|
|
4
|
-
|
|
5
|
-
Includes:
|
|
6
|
-
|
|
7
|
-
- [Canvas Kit Tokens](#canvas-kit-tokens)
|
|
8
|
-
- [Installation](#installation)
|
|
9
|
-
- [Colors](#colors)
|
|
10
|
-
- [Usage](#usage)
|
|
11
|
-
- [Semantic constants](#semantic-constants)
|
|
12
|
-
- [Border Radius](#border-radius)
|
|
13
|
-
- [Space](#space)
|
|
14
|
-
- [Usage](#usage-1)
|
|
15
|
-
- [Depth](#depth)
|
|
16
|
-
- [Usage](#usage-2)
|
|
17
|
-
- [Type](#type)
|
|
18
|
-
- [Fonts](#fonts)
|
|
19
|
-
- [Rem Units](#rem-units)
|
|
20
|
-
- [Object Structure](#object-structure)
|
|
21
|
-
- [Levels (Hierarchy)](#levels-hierarchy)
|
|
22
|
-
- [Usage](#usage-3)
|
|
23
|
-
- [Quick Reference](#quick-reference)
|
|
24
|
-
- [Title](#title)
|
|
25
|
-
- [Heading](#heading)
|
|
26
|
-
- [Body](#body)
|
|
27
|
-
- [Subtext](#subtext)
|
|
28
|
-
- [Properties](#properties)
|
|
29
|
-
- [Usage](#usage-4)
|
|
30
|
-
- [Quick Reference](#quick-reference-1)
|
|
31
|
-
- [Font Families](#font-families)
|
|
32
|
-
- [Font Sizes](#font-sizes)
|
|
33
|
-
- [Font Weights](#font-weights)
|
|
34
|
-
- [Variants](#variants)
|
|
35
|
-
- [Usage](#usage-5)
|
|
36
|
-
- [Creating Combinations](#creating-combinations)
|
|
37
|
-
|
|
38
|
-
## Installation
|
|
39
|
-
|
|
40
|
-
```sh
|
|
41
|
-
yarn add @workday/canvas-kit-react
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Colors
|
|
45
|
-
|
|
46
|
-
Workday Canvas Colors are directly exported from `@workday/canvas-colors-web`. Colors come in shades
|
|
47
|
-
from 100 (lighter) - 600 (darker). These can be used directly, but
|
|
48
|
-
[semantic constants](#semantic-constants) are preferred.
|
|
49
|
-
|
|
50
|
-
Colors (100-600):
|
|
51
|
-
|
|
52
|
-
- Cinnamon
|
|
53
|
-
- Peach
|
|
54
|
-
- Chili Mango
|
|
55
|
-
- Cantaloupe
|
|
56
|
-
- Sour Lemon
|
|
57
|
-
- Juicy Pear
|
|
58
|
-
- Kiwi
|
|
59
|
-
- Green Apple
|
|
60
|
-
- Watermelon
|
|
61
|
-
- Jewel
|
|
62
|
-
- Toothpaste
|
|
63
|
-
- Blueberry
|
|
64
|
-
- Plum
|
|
65
|
-
- Berry Smoothie
|
|
66
|
-
- Blackberry
|
|
67
|
-
- Island Punch
|
|
68
|
-
- Grape Soda
|
|
69
|
-
- Pomegranate
|
|
70
|
-
- Fruit Punch
|
|
71
|
-
- Root Beer
|
|
72
|
-
- Toasted Marshmallow
|
|
73
|
-
- Coconut
|
|
74
|
-
- Cappuccino
|
|
75
|
-
- Soap
|
|
76
|
-
- Licorice
|
|
77
|
-
- French Vanilla
|
|
78
|
-
- Black Pepper
|
|
79
|
-
|
|
80
|
-
### Usage
|
|
81
|
-
|
|
82
|
-
```tsx
|
|
83
|
-
import {colors} from '@workday/canvas-kit-react/tokens';
|
|
84
|
-
|
|
85
|
-
colors.blueberry400;
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
> Each of the colors have a gradient version as well
|
|
89
|
-
|
|
90
|
-
```tsx
|
|
91
|
-
import {colors} from '@workday/canvas-kit-react/tokens';
|
|
92
|
-
|
|
93
|
-
colors.gradients.blueberry;
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### Semantic constants
|
|
97
|
-
|
|
98
|
-
To ensure consistency across implementations, our semantic constants should be used wherever
|
|
99
|
-
possible. This allows us to swap out the color of a button or icon for example, without having to
|
|
100
|
-
find every instance of it and change the color manually.
|
|
101
|
-
|
|
102
|
-
We have several semantic groupings:
|
|
103
|
-
|
|
104
|
-
- `commonColors`
|
|
105
|
-
- `buttonColors`
|
|
106
|
-
- `delete`
|
|
107
|
-
- `primary`
|
|
108
|
-
- `secondary`
|
|
109
|
-
- `iconColors`
|
|
110
|
-
- `statusColors`
|
|
111
|
-
- `typeColors`
|
|
112
|
-
|
|
113
|
-
```tsx
|
|
114
|
-
import {iconColors} from '@workday/canvas-kit-react/tokens';
|
|
115
|
-
|
|
116
|
-
iconColors.hover;
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
## Border Radius
|
|
120
|
-
|
|
121
|
-
Border Radius variables are in a "t-shirt size" format. Border Radius values are in `px` format.
|
|
122
|
-
|
|
123
|
-
| Variable | Size (px) |
|
|
124
|
-
| -------- | --------- |
|
|
125
|
-
| `zero` | `0` |
|
|
126
|
-
| `s` | `'2px'` |
|
|
127
|
-
| `m` | `'4px'` |
|
|
128
|
-
| `l` | `'8px'` |
|
|
129
|
-
| `circle` | `'999px'` |
|
|
130
|
-
|
|
131
|
-
## Space
|
|
132
|
-
|
|
133
|
-
Space variables are in a "t-shirt size" format. Space values are in `rem` format (`space`)
|
|
134
|
-
|
|
135
|
-
| Variable | Size (rem) | Size (calculated pixels) |
|
|
136
|
-
| -------- | ----------- | ------------------------ |
|
|
137
|
-
| `zero` | `'0rem'` | `0px` |
|
|
138
|
-
| `xxxs` | `'0.25rem'` | `4px` |
|
|
139
|
-
| `xxs` | `'0.5rem'` | `8px` |
|
|
140
|
-
| `xs` | `'0.75rem'` | `12px` |
|
|
141
|
-
| `s` | `'1rem'` | `16px` |
|
|
142
|
-
| `m` | `'1.5rem'` | `24px` |
|
|
143
|
-
| `l` | `'2rem'` | `32px` |
|
|
144
|
-
| `xl` | `'2.5rem'` | `40px` |
|
|
145
|
-
| `xxl` | `'4rem'` | `64px` |
|
|
146
|
-
| `xxxl` | `'5rem'` | `80px` |
|
|
147
|
-
|
|
148
|
-
The following space types are also provided: `CanvasSpace`, `CanvasSpaceValues`.
|
|
149
|
-
|
|
150
|
-
Below are descriptions of these types:
|
|
151
|
-
|
|
152
|
-
| Name | Description |
|
|
153
|
-
| ------------------- | ------------------------------------- |
|
|
154
|
-
| `CanvasSpace` | `space` object with string rem values |
|
|
155
|
-
| `CanvasSpaceValues` | string rem values for CanvasSpace |
|
|
156
|
-
|
|
157
|
-
### Usage
|
|
158
|
-
|
|
159
|
-
```tsx
|
|
160
|
-
import {space} from '@workday/canvas-kit-react/tokens';
|
|
161
|
-
|
|
162
|
-
const iconSize = '1.25rem';
|
|
163
|
-
|
|
164
|
-
const buttonSyles = {
|
|
165
|
-
paddingTop: `calc(${space.xs} + 2px)`,
|
|
166
|
-
paddingInlineStart: space.s,
|
|
167
|
-
paddingBottom: space.xs,
|
|
168
|
-
paddingInlineEnd: `calc(${space.s} + ${iconSize})`,
|
|
169
|
-
};
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
## Depth
|
|
173
|
-
|
|
174
|
-
Depth is the relative distance between surfaces in the z-axis. It provides delineation, focus, and
|
|
175
|
-
priority with shadows and layering. There are seven depth levels, `none`, `1`, `2`, `3`, `4`, `5`
|
|
176
|
-
and `6`. `none` is a special value to remove depth styles. All other levels only apply box-shadow
|
|
177
|
-
styles.
|
|
178
|
-
|
|
179
|
-
### Usage
|
|
180
|
-
|
|
181
|
-
```tsx
|
|
182
|
-
import {depth} from '@workday/canvas-kit-react/tokens';
|
|
183
|
-
|
|
184
|
-
const CustomCard = () => {
|
|
185
|
-
return <div css={depth[1]}>A standard-depth card</div>;
|
|
186
|
-
};
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
## Type
|
|
190
|
-
|
|
191
|
-
Our type tokens are the heart of all our typography. These tokens are designed to help you easily
|
|
192
|
-
create consistent type throughout your application while also providing flexibility when needed.
|
|
193
|
-
There are several important aspects to understand in order to put them to best use:
|
|
194
|
-
|
|
195
|
-
- Fonts
|
|
196
|
-
- `Rem` Units
|
|
197
|
-
- Object Structure
|
|
198
|
-
- Hierarchy
|
|
199
|
-
- Properties
|
|
200
|
-
- Variants
|
|
201
|
-
- Creating Combinations
|
|
202
|
-
|
|
203
|
-
### Fonts
|
|
204
|
-
|
|
205
|
-
To use the Canvas Kit font
|
|
206
|
-
[install and import the `@workday/canvas-kit-react-fonts` module](https://github.com/Workday/canvas-kit/tree/master/modules/fonts/react).
|
|
207
|
-
|
|
208
|
-
> **Note:** This module sources fonts from the Workday CDN.
|
|
209
|
-
|
|
210
|
-
### Rem Units
|
|
211
|
-
|
|
212
|
-
Canvas Kit v5 introduced `rem` units (instead of `px`) to our type tokens. This update follows the
|
|
213
|
-
guidance [from the WCAG spec](https://www.w3.org/TR/WCAG21/#resize-text) and provides better support
|
|
214
|
-
for users who change their browser's default font size. If you'd like to learn more about `rem` and
|
|
215
|
-
relative units, you can review this
|
|
216
|
-
[documentation](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units#ems_and_rems).
|
|
217
|
-
|
|
218
|
-
> **Note:** We are using `16px` as our base font-size for these values. This is a browser standard
|
|
219
|
-
> and also fairly common across Workday. However, _if your body text is set to a value other than
|
|
220
|
-
> `16px`_, you will need to adjust that value for text to render properly.
|
|
221
|
-
|
|
222
|
-
### Object Structure
|
|
223
|
-
|
|
224
|
-
The `type` tokens are divided into three main parts:
|
|
225
|
-
|
|
226
|
-
- `levels` (the type hierarchy)
|
|
227
|
-
- `properties` (`fontFamilies`, `fontSizes`, and `fontWeights`)
|
|
228
|
-
- `variants` (modifiers for type styles)
|
|
229
|
-
|
|
230
|
-
Each part serves its own purpose but is also designed to be combined with the others. Knowing how
|
|
231
|
-
and when to combine tokens is key to getting the most out of them.
|
|
232
|
-
|
|
233
|
-
### Levels (Hierarchy)
|
|
234
|
-
|
|
235
|
-
Type `levels` contain our type hierarchy. When applying type styles, we recommend using these tokens
|
|
236
|
-
first, as they handle the vast majority of styling for you for most use cases. Each size applies
|
|
237
|
-
`fontFamily`, `fontSize`, `fontWeight`, `lineHeight`, `letterSpacing`, and `color` styles for you,
|
|
238
|
-
so you can create consistent type quickly and easily. The type hierarchy is now organized in four
|
|
239
|
-
levels:
|
|
240
|
-
|
|
241
|
-
| Hierarchy Levels | Description |
|
|
242
|
-
| ---------------- | ----------------------------------------------------- |
|
|
243
|
-
| `title` | Intended for large page titles |
|
|
244
|
-
| `heading` | Intended for headings and large text |
|
|
245
|
-
| `body` | Intended for standard body text |
|
|
246
|
-
| `subtext` | Intended for small subtext content or in tight spaces |
|
|
247
|
-
|
|
248
|
-
And each level has three sizes: `large`, `medium`, and `small`. This organization allows the
|
|
249
|
-
hierarchy to provide guidance for usage while also not being mapped to particular semantic elements.
|
|
250
|
-
|
|
251
|
-
#### Usage
|
|
252
|
-
|
|
253
|
-
```tsx
|
|
254
|
-
import {type} from '@workday/canvas-kit-react/tokens';
|
|
255
|
-
|
|
256
|
-
const ContentSection = () => (
|
|
257
|
-
<section>
|
|
258
|
-
<h2 css={type.levels.heading.large}>Section Heading</h2>
|
|
259
|
-
<p css={type.levels.subtext.large}>This is section body text.</p>
|
|
260
|
-
</section>
|
|
261
|
-
);
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
#### Quick Reference
|
|
265
|
-
|
|
266
|
-
Here's a quick reference guide for the font-sizes and font-weights of each level's sizes:
|
|
267
|
-
|
|
268
|
-
##### Title
|
|
269
|
-
|
|
270
|
-
_Intended for large page titles_
|
|
271
|
-
|
|
272
|
-
| Size | Properties |
|
|
273
|
-
| -------- | ------------------------------------------------------- |
|
|
274
|
-
| `large` | fontSize: `56px` (`3/5rem`), fontWeight: `bold` (`700`) |
|
|
275
|
-
| `medium` | fontSize: `48px` (`3rem`), fontWeight: `bold` (`700`) |
|
|
276
|
-
| `small` | fontSize: `40px` (`2.5rem`), fontWeight: `bold` (`700`) |
|
|
277
|
-
|
|
278
|
-
##### Heading
|
|
279
|
-
|
|
280
|
-
_Intended for headings and large text_
|
|
281
|
-
|
|
282
|
-
| Size | Properties |
|
|
283
|
-
| -------- | -------------------------------------------------------- |
|
|
284
|
-
| `large` | fontSize: `32px` (`2rem`), fontWeight: `bold` (`700`) |
|
|
285
|
-
| `medium` | fontSize: `28px` (`1.75rem`), fontWeight: `bold` (`700`) |
|
|
286
|
-
| `small` | fontSize: `24px` (`1.5rem`), fontWeight: `bold` (`700`) |
|
|
287
|
-
|
|
288
|
-
##### Body
|
|
289
|
-
|
|
290
|
-
_Intended for standard body text_
|
|
291
|
-
|
|
292
|
-
| Size | Properties |
|
|
293
|
-
| -------- | ------------------------------------------------------------ |
|
|
294
|
-
| `large` | fontSize: `20px` (`1.25rem`), fontWeight: `regular` (`400`) |
|
|
295
|
-
| `medium` | fontSize: `18px` (`1.125rem`), fontWeight: `regular` (`400`) |
|
|
296
|
-
| `small` | fontSize: `16px` (`1rem`), fontWeight: `regular` (`400`) |
|
|
297
|
-
|
|
298
|
-
##### Subtext
|
|
299
|
-
|
|
300
|
-
_Intended for small subtext content or in tight spaces_
|
|
301
|
-
|
|
302
|
-
| Size | Properties |
|
|
303
|
-
| -------- | ------------------------------------------------------------ |
|
|
304
|
-
| `large` | fontSize: `14px` (`0.875rem`), fontWeight: `regular` (`400`) |
|
|
305
|
-
| `medium` | fontSize: `12px` (`0.75rem`), fontWeight: `regular` (`400`) |
|
|
306
|
-
| `small` | fontSize: `10px` (`0.625rem`), fontWeight: `regular` (`400`) |
|
|
307
|
-
|
|
308
|
-
### Properties
|
|
309
|
-
|
|
310
|
-
As previously mentioned, you'll most often you will want to reach for `levels`, but in some
|
|
311
|
-
situations you may only need to set one or two type values for styling. Type `properties` give you
|
|
312
|
-
an atomic-level of control when you want to explicitly set a particular value.
|
|
313
|
-
|
|
314
|
-
| Property | Description |
|
|
315
|
-
| -------------- | ---------------------------------------------------------------- |
|
|
316
|
-
| `fontFamilies` | Contains font-family tokens: `default` and `monospace` |
|
|
317
|
-
| `fontSizes` | Contains font-size tokens: keys are in `px`, values are in `rem` |
|
|
318
|
-
| `fontWeights` | Contains font-weight tokens: `regular`, `medium`, and `bold` |
|
|
319
|
-
|
|
320
|
-
#### Usage
|
|
321
|
-
|
|
322
|
-
Here's an example using `fontFamilies`, `fontSizes`, and `fontWeights`.
|
|
323
|
-
|
|
324
|
-
> _Note:_ `fontSizes` keys are in pixel values as a convenient reference, but the values are the
|
|
325
|
-
> base-16 rem equivalent. E.g. `fontSizes[12]` returns `0.75rem`.
|
|
326
|
-
|
|
327
|
-
```tsx
|
|
328
|
-
import {type} from '@workday/canvas-kit-react/tokens';
|
|
329
|
-
|
|
330
|
-
const customTextStyles = {
|
|
331
|
-
fontFamily: type.properties.fontFamilies.default,
|
|
332
|
-
fontSize: type.properties.fontSizes[16],
|
|
333
|
-
fontWeight: type.properties.fontWeights.medium,
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
const CustomText = () => (
|
|
337
|
-
<p css={customTextStyles}>This is custom Roboto medium text using type properties.</p>
|
|
338
|
-
);
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
#### Quick Reference
|
|
342
|
-
|
|
343
|
-
Here's a quick reference guide for the values contained in each property:
|
|
344
|
-
|
|
345
|
-
##### Font Families
|
|
346
|
-
|
|
347
|
-
| Name | Value |
|
|
348
|
-
| ----------- | ------------------------------------------------------------ |
|
|
349
|
-
| `default` | `"Roboto", "Helvetica Neue", "Helvetica", Arial, sans-serif` |
|
|
350
|
-
| `monospace` | `"Roboto Mono", "Courier New", Courier, monospace` |
|
|
351
|
-
|
|
352
|
-
##### Font Sizes
|
|
353
|
-
|
|
354
|
-
| Name (`px`) | Value (`rem`) |
|
|
355
|
-
| ----------- | ------------- |
|
|
356
|
-
| `10` | `'0.625rem'` |
|
|
357
|
-
| `12` | `'0.75rem'` |
|
|
358
|
-
| `14` | `'0.875rem'` |
|
|
359
|
-
| `16` | `'1rem'` |
|
|
360
|
-
| `18` | `'1.125rem'` |
|
|
361
|
-
| `20` | `'1.25rem'` |
|
|
362
|
-
| `24` | `'1.5rem'` |
|
|
363
|
-
| `28` | `'1.75rem'` |
|
|
364
|
-
| `32` | `'2rem'` |
|
|
365
|
-
| `40` | `'2.5rem'` |
|
|
366
|
-
| `48` | `'3rem'` |
|
|
367
|
-
| `56` | `'3.5rem'` |
|
|
368
|
-
|
|
369
|
-
##### Font Weights
|
|
370
|
-
|
|
371
|
-
| Name | Value |
|
|
372
|
-
| --------- | ----- |
|
|
373
|
-
| `regular` | `400` |
|
|
374
|
-
| `medium` | `500` |
|
|
375
|
-
| `bold` | `700` |
|
|
376
|
-
|
|
377
|
-
### Variants
|
|
378
|
-
|
|
379
|
-
Variants are type style modifiers. You'll often use them in conjunction with other type tokens. We
|
|
380
|
-
support three type variants:
|
|
381
|
-
|
|
382
|
-
| Name | Description |
|
|
383
|
-
| --------- | ------------------------------------------------- |
|
|
384
|
-
| `error` | Used for making errors more visible |
|
|
385
|
-
| `hint` | Used for help text and secondary content |
|
|
386
|
-
| `inverse` | Used for any text on a dark or colored background |
|
|
387
|
-
|
|
388
|
-
#### Usage
|
|
389
|
-
|
|
390
|
-
```tsx
|
|
391
|
-
import {type} from '@workday/canvas-kit-react/tokens';
|
|
392
|
-
|
|
393
|
-
const HintText = (props) => (
|
|
394
|
-
<label css={{ ...type.levels.subtext.medium, type.variants.hint }} {...props}>
|
|
395
|
-
Example Hint Variant Label
|
|
396
|
-
</label>
|
|
397
|
-
);
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
### Creating Combinations
|
|
401
|
-
|
|
402
|
-
As previously mentioned, in most cases all you'll need will be the `levels` of the type hierarchy.
|
|
403
|
-
But these tokens can also be used to create style combinations when necessary. Below is an example:
|
|
404
|
-
|
|
405
|
-
```tsx
|
|
406
|
-
import {type} from '@workday/canvas-kit-react/tokens';
|
|
407
|
-
|
|
408
|
-
const listItemBaseStyles = {
|
|
409
|
-
padding: 0,
|
|
410
|
-
...type.levels.subtext.large,
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
interface InverseListItemProps {
|
|
414
|
-
isActive?: boolean;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
const InverseListItem = (props: InverseListItemProps) => {
|
|
418
|
-
const listItemActiveStyles = props.isActive
|
|
419
|
-
? {
|
|
420
|
-
fontWeight: type.properties.fontWeight.medium,
|
|
421
|
-
...type.variants.inverse,
|
|
422
|
-
}
|
|
423
|
-
: {};
|
|
424
|
-
|
|
425
|
-
return <li css={{...listItemBaseStyles, ...listItemActiveStyles}}>First List Item</li>;
|
|
426
|
-
};
|
|
427
|
-
```
|
package/tooltip/LICENSE
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
Apache License, Version 2.0 Apache License Version 2.0, January 2004
|
|
2
|
-
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
9
|
-
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
10
|
-
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
11
|
-
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
12
|
-
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
13
|
-
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
14
|
-
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
15
|
-
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
16
|
-
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
17
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
18
|
-
|
|
19
|
-
2. Grant of Copyright License.
|
|
20
|
-
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
21
|
-
|
|
22
|
-
3. Grant of Patent License.
|
|
23
|
-
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
24
|
-
|
|
25
|
-
4. Redistribution.
|
|
26
|
-
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
27
|
-
You must give any other recipients of the Work or Derivative Works a copy of this License; and You must cause any modified files to carry prominent notices stating that You changed the files; and You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
28
|
-
|
|
29
|
-
5. Submission of Contributions.
|
|
30
|
-
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
31
|
-
|
|
32
|
-
6. Trademarks.
|
|
33
|
-
This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
34
|
-
|
|
35
|
-
7. Disclaimer of Warranty.
|
|
36
|
-
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
37
|
-
|
|
38
|
-
8. Limitation of Liability.
|
|
39
|
-
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
40
|
-
|
|
41
|
-
9. Accepting Warranty or Additional Liability.
|
|
42
|
-
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
43
|
-
|
|
44
|
-
END OF TERMS AND CONDITIONS
|
|
45
|
-
|
|
46
|
-
©2020. Workday, Inc. All rights reserved. Workday and the Workday logo are registered trademarks of Workday, Inc. All other brand and product names are trademarks or registered trademarks of their respective holders.
|
|
47
|
-
|
|
48
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
|
|
49
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
50
|
-
|
|
51
|
-
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
package/tooltip/README.md
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
# Canvas Kit Tooltip
|
|
2
|
-
|
|
3
|
-
A Tooltip component that renders information/text when the user hovers over an element. A tooltip is
|
|
4
|
-
used to label or describe an element. By default, a tooltip will label an element. This is useful
|
|
5
|
-
for TertiaryButtons that render just an icon. A tooltip can also be used to describe additional
|
|
6
|
-
information about an element
|
|
7
|
-
|
|
8
|
-
[> Workday Design Reference](https://design.workday.com/components/popups/tooltips)
|
|
9
|
-
|
|
10
|
-
## Installation
|
|
11
|
-
|
|
12
|
-
```sh
|
|
13
|
-
yarn add @workday/canvas-kit-react
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Usage
|
|
17
|
-
|
|
18
|
-
```tsx
|
|
19
|
-
import * as React from 'react';
|
|
20
|
-
|
|
21
|
-
import {Tooltip} from '@workday/canvas-kit-react/tooltip';
|
|
22
|
-
import {TertiaryButton} from '@workday/canvas-kit-react/button';
|
|
23
|
-
|
|
24
|
-
const TooltipExample = () => {
|
|
25
|
-
return (
|
|
26
|
-
<Tooltip title="Close">
|
|
27
|
-
<TertiaryButton icon={xIcon} aria-label="Close" />
|
|
28
|
-
</Tooltip>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Static Properties
|
|
34
|
-
|
|
35
|
-
> None
|
|
36
|
-
|
|
37
|
-
## Component Props
|
|
38
|
-
|
|
39
|
-
### Required
|
|
40
|
-
|
|
41
|
-
#### title: string | React.ReactNode
|
|
42
|
-
|
|
43
|
-
> This should be a string in most cases. HTML is supported, but only text is understood by assistive
|
|
44
|
-
> technology. This is true for both `label` and `describe` modes.
|
|
45
|
-
|
|
46
|
-
#### children: React.ReactNode
|
|
47
|
-
|
|
48
|
-
> The target (anchor element) for the Tooltip.
|
|
49
|
-
>
|
|
50
|
-
> **Note:** This **must** be an Element, StyledComponent or any other component that forwards extra
|
|
51
|
-
> props to an Element. Tooltip works running `React.cloneElement` on the children and adds extra
|
|
52
|
-
> properties like aria attributes and event handlers. This is currently a limitation of the Tooltip
|
|
53
|
-
> component. Functionality will not work if this condition isn't met
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
### Optional
|
|
58
|
-
|
|
59
|
-
#### type: 'label' | 'describe'
|
|
60
|
-
|
|
61
|
-
> Determines the tooltip type for accessibility.
|
|
62
|
-
>
|
|
63
|
-
> - `label`: Sets the accessible name for the wrapped element. Use for icons or if tooltip `title`
|
|
64
|
-
> prop is the same as the text content of the wrapped element. E.g. TertiaryButtons that render an
|
|
65
|
-
> icon or Ellipsis tooltips.
|
|
66
|
-
> - `describe`: Sets `aria-describedby` of the wrapped element. Use if the tooltip has additional
|
|
67
|
-
> information about the target. **Note**: Assistive technology may ignore `describe` techniques
|
|
68
|
-
> based on verbosity settings. Consider an alternate way to inform a user of additional important
|
|
69
|
-
> information.
|
|
70
|
-
|
|
71
|
-
Default: `'label'`
|
|
72
|
-
|
|
73
|
-
#### placement: PopperJS.Placement
|
|
74
|
-
|
|
75
|
-
> Sets the placement preference used by PopperJS.
|
|
76
|
-
|
|
77
|
-
Default: `'top'`
|