@workday/canvas-kit-docs 14.0.0-alpha.1201-next.0 → 14.0.0-alpha.1206-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/dist/es6/lib/docs.js +0 -204
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.js +5 -5
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.ts +5 -5
- package/dist/mdx/14.0-UPGRADE-GUIDE.mdx +28 -9
- package/dist/mdx/preview-react/multi-select/MultiSelect.mdx +8 -1
- package/dist/mdx/preview-react/multi-select/examples/InitialSelectedItems.tsx +129 -0
- package/package.json +6 -6
package/dist/es6/lib/docs.js
CHANGED
|
@@ -65041,23 +65041,6 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
65041
65041
|
],
|
|
65042
65042
|
"tags": {}
|
|
65043
65043
|
},
|
|
65044
|
-
{
|
|
65045
|
-
"kind": "property",
|
|
65046
|
-
"name": "isThemeable",
|
|
65047
|
-
"required": false,
|
|
65048
|
-
"type": {
|
|
65049
|
-
"kind": "primitive",
|
|
65050
|
-
"value": "boolean"
|
|
65051
|
-
},
|
|
65052
|
-
"description": "",
|
|
65053
|
-
"declarations": [
|
|
65054
|
-
{
|
|
65055
|
-
"name": "isThemeable",
|
|
65056
|
-
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/react/button/lib/TertiaryButton.tsx"
|
|
65057
|
-
}
|
|
65058
|
-
],
|
|
65059
|
-
"tags": {}
|
|
65060
|
-
},
|
|
65061
65044
|
{
|
|
65062
65045
|
"kind": "property",
|
|
65063
65046
|
"name": "iconPosition",
|
|
@@ -96063,23 +96046,6 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
96063
96046
|
],
|
|
96064
96047
|
"tags": {}
|
|
96065
96048
|
},
|
|
96066
|
-
{
|
|
96067
|
-
"kind": "property",
|
|
96068
|
-
"name": "isThemeable",
|
|
96069
|
-
"required": false,
|
|
96070
|
-
"type": {
|
|
96071
|
-
"kind": "primitive",
|
|
96072
|
-
"value": "boolean"
|
|
96073
|
-
},
|
|
96074
|
-
"description": "",
|
|
96075
|
-
"declarations": [
|
|
96076
|
-
{
|
|
96077
|
-
"name": "isThemeable",
|
|
96078
|
-
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/react/button/lib/TertiaryButton.tsx"
|
|
96079
|
-
}
|
|
96080
|
-
],
|
|
96081
|
-
"tags": {}
|
|
96082
|
-
},
|
|
96083
96049
|
{
|
|
96084
96050
|
"kind": "property",
|
|
96085
96051
|
"name": "iconPosition",
|
|
@@ -115961,23 +115927,6 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
115961
115927
|
],
|
|
115962
115928
|
"tags": {}
|
|
115963
115929
|
},
|
|
115964
|
-
{
|
|
115965
|
-
"kind": "property",
|
|
115966
|
-
"name": "isThemeable",
|
|
115967
|
-
"required": false,
|
|
115968
|
-
"type": {
|
|
115969
|
-
"kind": "primitive",
|
|
115970
|
-
"value": "boolean"
|
|
115971
|
-
},
|
|
115972
|
-
"description": "",
|
|
115973
|
-
"declarations": [
|
|
115974
|
-
{
|
|
115975
|
-
"name": "isThemeable",
|
|
115976
|
-
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/react/button/lib/TertiaryButton.tsx"
|
|
115977
|
-
}
|
|
115978
|
-
],
|
|
115979
|
-
"tags": {}
|
|
115980
|
-
},
|
|
115981
115930
|
{
|
|
115982
115931
|
"kind": "property",
|
|
115983
115932
|
"name": "iconPosition",
|
|
@@ -117486,23 +117435,6 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
117486
117435
|
],
|
|
117487
117436
|
"tags": {}
|
|
117488
117437
|
},
|
|
117489
|
-
{
|
|
117490
|
-
"kind": "property",
|
|
117491
|
-
"name": "isThemeable",
|
|
117492
|
-
"required": false,
|
|
117493
|
-
"type": {
|
|
117494
|
-
"kind": "primitive",
|
|
117495
|
-
"value": "boolean"
|
|
117496
|
-
},
|
|
117497
|
-
"description": "",
|
|
117498
|
-
"declarations": [
|
|
117499
|
-
{
|
|
117500
|
-
"name": "isThemeable",
|
|
117501
|
-
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/react/button/lib/TertiaryButton.tsx"
|
|
117502
|
-
}
|
|
117503
|
-
],
|
|
117504
|
-
"tags": {}
|
|
117505
|
-
},
|
|
117506
117438
|
{
|
|
117507
117439
|
"kind": "property",
|
|
117508
117440
|
"name": "as",
|
|
@@ -118698,23 +118630,6 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
118698
118630
|
],
|
|
118699
118631
|
"tags": {}
|
|
118700
118632
|
},
|
|
118701
|
-
{
|
|
118702
|
-
"kind": "property",
|
|
118703
|
-
"name": "isThemeable",
|
|
118704
|
-
"required": false,
|
|
118705
|
-
"type": {
|
|
118706
|
-
"kind": "primitive",
|
|
118707
|
-
"value": "boolean"
|
|
118708
|
-
},
|
|
118709
|
-
"description": "",
|
|
118710
|
-
"declarations": [
|
|
118711
|
-
{
|
|
118712
|
-
"name": "isThemeable",
|
|
118713
|
-
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/react/button/lib/TertiaryButton.tsx"
|
|
118714
|
-
}
|
|
118715
|
-
],
|
|
118716
|
-
"tags": {}
|
|
118717
|
-
},
|
|
118718
118633
|
{
|
|
118719
118634
|
"kind": "property",
|
|
118720
118635
|
"name": "as",
|
|
@@ -291573,23 +291488,6 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
291573
291488
|
],
|
|
291574
291489
|
"tags": {}
|
|
291575
291490
|
},
|
|
291576
|
-
{
|
|
291577
|
-
"kind": "property",
|
|
291578
|
-
"name": "isThemeable",
|
|
291579
|
-
"required": false,
|
|
291580
|
-
"type": {
|
|
291581
|
-
"kind": "primitive",
|
|
291582
|
-
"value": "boolean"
|
|
291583
|
-
},
|
|
291584
|
-
"description": "",
|
|
291585
|
-
"declarations": [
|
|
291586
|
-
{
|
|
291587
|
-
"name": "isThemeable",
|
|
291588
|
-
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/react/button/lib/TertiaryButton.tsx"
|
|
291589
|
-
}
|
|
291590
|
-
],
|
|
291591
|
-
"tags": {}
|
|
291592
|
-
},
|
|
291593
291491
|
{
|
|
291594
291492
|
"kind": "property",
|
|
291595
291493
|
"name": "iconPosition",
|
|
@@ -297163,23 +297061,6 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
297163
297061
|
],
|
|
297164
297062
|
"tags": {}
|
|
297165
297063
|
},
|
|
297166
|
-
{
|
|
297167
|
-
"kind": "property",
|
|
297168
|
-
"name": "isThemeable",
|
|
297169
|
-
"required": false,
|
|
297170
|
-
"type": {
|
|
297171
|
-
"kind": "primitive",
|
|
297172
|
-
"value": "boolean"
|
|
297173
|
-
},
|
|
297174
|
-
"description": "",
|
|
297175
|
-
"declarations": [
|
|
297176
|
-
{
|
|
297177
|
-
"name": "isThemeable",
|
|
297178
|
-
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/react/button/lib/TertiaryButton.tsx"
|
|
297179
|
-
}
|
|
297180
|
-
],
|
|
297181
|
-
"tags": {}
|
|
297182
|
-
},
|
|
297183
297064
|
{
|
|
297184
297065
|
"kind": "property",
|
|
297185
297066
|
"name": "iconPosition",
|
|
@@ -297672,23 +297553,6 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
297672
297553
|
],
|
|
297673
297554
|
"tags": {}
|
|
297674
297555
|
},
|
|
297675
|
-
{
|
|
297676
|
-
"kind": "property",
|
|
297677
|
-
"name": "isThemeable",
|
|
297678
|
-
"required": false,
|
|
297679
|
-
"type": {
|
|
297680
|
-
"kind": "primitive",
|
|
297681
|
-
"value": "boolean"
|
|
297682
|
-
},
|
|
297683
|
-
"description": "",
|
|
297684
|
-
"declarations": [
|
|
297685
|
-
{
|
|
297686
|
-
"name": "isThemeable",
|
|
297687
|
-
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/react/button/lib/TertiaryButton.tsx"
|
|
297688
|
-
}
|
|
297689
|
-
],
|
|
297690
|
-
"tags": {}
|
|
297691
|
-
},
|
|
297692
297556
|
{
|
|
297693
297557
|
"kind": "property",
|
|
297694
297558
|
"name": "iconPosition",
|
|
@@ -298181,23 +298045,6 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
298181
298045
|
],
|
|
298182
298046
|
"tags": {}
|
|
298183
298047
|
},
|
|
298184
|
-
{
|
|
298185
|
-
"kind": "property",
|
|
298186
|
-
"name": "isThemeable",
|
|
298187
|
-
"required": false,
|
|
298188
|
-
"type": {
|
|
298189
|
-
"kind": "primitive",
|
|
298190
|
-
"value": "boolean"
|
|
298191
|
-
},
|
|
298192
|
-
"description": "",
|
|
298193
|
-
"declarations": [
|
|
298194
|
-
{
|
|
298195
|
-
"name": "isThemeable",
|
|
298196
|
-
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/react/button/lib/TertiaryButton.tsx"
|
|
298197
|
-
}
|
|
298198
|
-
],
|
|
298199
|
-
"tags": {}
|
|
298200
|
-
},
|
|
298201
298048
|
{
|
|
298202
298049
|
"kind": "property",
|
|
298203
298050
|
"name": "iconPosition",
|
|
@@ -298690,23 +298537,6 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
298690
298537
|
],
|
|
298691
298538
|
"tags": {}
|
|
298692
298539
|
},
|
|
298693
|
-
{
|
|
298694
|
-
"kind": "property",
|
|
298695
|
-
"name": "isThemeable",
|
|
298696
|
-
"required": false,
|
|
298697
|
-
"type": {
|
|
298698
|
-
"kind": "primitive",
|
|
298699
|
-
"value": "boolean"
|
|
298700
|
-
},
|
|
298701
|
-
"description": "",
|
|
298702
|
-
"declarations": [
|
|
298703
|
-
{
|
|
298704
|
-
"name": "isThemeable",
|
|
298705
|
-
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/react/button/lib/TertiaryButton.tsx"
|
|
298706
|
-
}
|
|
298707
|
-
],
|
|
298708
|
-
"tags": {}
|
|
298709
|
-
},
|
|
298710
298540
|
{
|
|
298711
298541
|
"kind": "property",
|
|
298712
298542
|
"name": "iconPosition",
|
|
@@ -317855,23 +317685,6 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
317855
317685
|
],
|
|
317856
317686
|
"tags": {}
|
|
317857
317687
|
},
|
|
317858
|
-
{
|
|
317859
|
-
"kind": "property",
|
|
317860
|
-
"name": "isThemeable",
|
|
317861
|
-
"required": false,
|
|
317862
|
-
"type": {
|
|
317863
|
-
"kind": "primitive",
|
|
317864
|
-
"value": "boolean"
|
|
317865
|
-
},
|
|
317866
|
-
"description": "",
|
|
317867
|
-
"declarations": [
|
|
317868
|
-
{
|
|
317869
|
-
"name": "isThemeable",
|
|
317870
|
-
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/react/button/lib/TertiaryButton.tsx"
|
|
317871
|
-
}
|
|
317872
|
-
],
|
|
317873
|
-
"tags": {}
|
|
317874
|
-
},
|
|
317875
317688
|
{
|
|
317876
317689
|
"kind": "property",
|
|
317877
317690
|
"name": "iconPosition",
|
|
@@ -393600,23 +393413,6 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
393600
393413
|
],
|
|
393601
393414
|
"tags": {}
|
|
393602
393415
|
},
|
|
393603
|
-
{
|
|
393604
|
-
"kind": "property",
|
|
393605
|
-
"name": "isThemeable",
|
|
393606
|
-
"required": false,
|
|
393607
|
-
"type": {
|
|
393608
|
-
"kind": "primitive",
|
|
393609
|
-
"value": "boolean"
|
|
393610
|
-
},
|
|
393611
|
-
"description": "",
|
|
393612
|
-
"declarations": [
|
|
393613
|
-
{
|
|
393614
|
-
"name": "isThemeable",
|
|
393615
|
-
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/react/button/lib/TertiaryButton.tsx"
|
|
393616
|
-
}
|
|
393617
|
-
],
|
|
393618
|
-
"tags": {}
|
|
393619
|
-
},
|
|
393620
393416
|
{
|
|
393621
393417
|
"kind": "property",
|
|
393622
393418
|
"name": "iconPosition",
|
|
@@ -18,11 +18,11 @@ export const packageJSONFile = `{
|
|
|
18
18
|
"@emotion/react": "11.11.4",
|
|
19
19
|
"@types/react": "18.2.60",
|
|
20
20
|
"@types/react-dom": "18.2.19",
|
|
21
|
-
"@workday/canvas-kit-labs-react": "13.2.
|
|
22
|
-
"@workday/canvas-kit-preview-react": "13.2.
|
|
23
|
-
"@workday/canvas-kit-react": "13.2.
|
|
24
|
-
"@workday/canvas-kit-react-fonts": "^13.2.
|
|
25
|
-
"@workday/canvas-kit-styling": "13.2.
|
|
21
|
+
"@workday/canvas-kit-labs-react": "13.2.18",
|
|
22
|
+
"@workday/canvas-kit-preview-react": "13.2.18",
|
|
23
|
+
"@workday/canvas-kit-react": "13.2.18",
|
|
24
|
+
"@workday/canvas-kit-react-fonts": "^13.2.18",
|
|
25
|
+
"@workday/canvas-kit-styling": "13.2.18",
|
|
26
26
|
"@workday/canvas-system-icons-web": "3.0.22",
|
|
27
27
|
"@workday/canvas-tokens-web": "2.0.0"
|
|
28
28
|
},
|
|
@@ -18,11 +18,11 @@ export const packageJSONFile = `{
|
|
|
18
18
|
"@emotion/react": "11.11.4",
|
|
19
19
|
"@types/react": "18.2.60",
|
|
20
20
|
"@types/react-dom": "18.2.19",
|
|
21
|
-
"@workday/canvas-kit-labs-react": "13.2.
|
|
22
|
-
"@workday/canvas-kit-preview-react": "13.2.
|
|
23
|
-
"@workday/canvas-kit-react": "13.2.
|
|
24
|
-
"@workday/canvas-kit-react-fonts": "^13.2.
|
|
25
|
-
"@workday/canvas-kit-styling": "13.2.
|
|
21
|
+
"@workday/canvas-kit-labs-react": "13.2.18",
|
|
22
|
+
"@workday/canvas-kit-preview-react": "13.2.18",
|
|
23
|
+
"@workday/canvas-kit-react": "13.2.18",
|
|
24
|
+
"@workday/canvas-kit-react-fonts": "^13.2.18",
|
|
25
|
+
"@workday/canvas-kit-styling": "13.2.18",
|
|
26
26
|
"@workday/canvas-system-icons-web": "3.0.22",
|
|
27
27
|
"@workday/canvas-tokens-web": "2.0.0"
|
|
28
28
|
},
|
|
@@ -11,6 +11,7 @@ any questions.
|
|
|
11
11
|
- [Theming](#theming)
|
|
12
12
|
- [Component Updates](#component-updates)
|
|
13
13
|
- [Branding Changes](#branding-changes)
|
|
14
|
+
- [Buttons](#buttons)
|
|
14
15
|
- [Card](#card)
|
|
15
16
|
- [Count Badge](#count-badge)
|
|
16
17
|
- [Expandable](#expandable)
|
|
@@ -93,16 +94,17 @@ yarn remove @workday/canvas-kit-codemod
|
|
|
93
94
|
- `CanvasThemePalette` has been updated to include a `lighter` color.
|
|
94
95
|
- `CanvasTheme` has been updated to include a `lighter` color.
|
|
95
96
|
|
|
96
|
-
|
|
97
97
|
## Component Updates
|
|
98
98
|
|
|
99
99
|
### Branding Changes 💅
|
|
100
100
|
|
|
101
|
-
Several components have been refactored to reflect our new brand direction. Most of these changes
|
|
101
|
+
Several components have been refactored to reflect our new brand direction. Most of these changes
|
|
102
|
+
revolve around the use of our new brand colors.
|
|
102
103
|
|
|
103
104
|
The following components have been updated:
|
|
104
105
|
|
|
105
106
|
- `Breadcrumbs` [#3270](https://github.com/Workday/canvas-kit/pull/3270)
|
|
107
|
+
- `Buttons` [#3394](https://github.com/Workday/canvas-kit/pull/3394)
|
|
106
108
|
- `ColorPicker` (Main) [#3307](https://github.com/Workday/canvas-kit/pull/3307)
|
|
107
109
|
- `ColorPicker` (preview) [#3307](https://github.com/Workday/canvas-kit/pull/3307)
|
|
108
110
|
- `LoadingDots` (Main) [#3393](https://github.com/Workday/canvas-kit/pull/3393)
|
|
@@ -113,6 +115,20 @@ The following components have been updated:
|
|
|
113
115
|
- `ToolbarDropdownButton` [#3293](https://github.com/Workday/canvas-kit/pull/3293)
|
|
114
116
|
- `ToolbarIconButton` [#3293](https://github.com/Workday/canvas-kit/pull/3293)
|
|
115
117
|
|
|
118
|
+
### Buttons
|
|
119
|
+
|
|
120
|
+
#### TertiaryButton
|
|
121
|
+
|
|
122
|
+
The `TertiaryButton` component no longer supports the `isThemable` prop.
|
|
123
|
+
To customize the appearance of `TertiaryButton`, use the `cs` prop for custom styles or the `colors`
|
|
124
|
+
prop for palette-based color overrides.
|
|
125
|
+
|
|
126
|
+
The shape of `TertiaryButton` has changed to have rounded corners, aligning with other buttons and
|
|
127
|
+
our new brand direction.
|
|
128
|
+
|
|
129
|
+
If you need to override default styles, follow
|
|
130
|
+
[this guide](https://workday.github.io/canvas-kit/?path=/docs/components-buttons--docs#custom-styles)
|
|
131
|
+
|
|
116
132
|
### Card 🚨
|
|
117
133
|
|
|
118
134
|
**PR:** [#3350](https://github.com/Workday/canvas-kit/pull/3350)
|
|
@@ -208,9 +224,8 @@ spacing between card elements.
|
|
|
208
224
|
|
|
209
225
|
The `CountBadge` component has been updated to reflect our new brand direction.
|
|
210
226
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
`low` emphasis for the badge.
|
|
227
|
+
Additionally, a new `emphasis` prop has been added, allowing you to choose between `high` and `low`
|
|
228
|
+
emphasis for the badge.
|
|
214
229
|
|
|
215
230
|
**Count Badge variants in v14**
|
|
216
231
|
|
|
@@ -237,7 +252,8 @@ These changes are only **visual** and should not affect the functionality of the
|
|
|
237
252
|
|
|
238
253
|
**PR:** [#3390](https://github.com/Workday/canvas-kit/pull/3390)
|
|
239
254
|
|
|
240
|
-
- `Hyperlink` and `ExternalHyperlink` now have a `standalone` and `standalone-inverse` variant. This
|
|
255
|
+
- `Hyperlink` and `ExternalHyperlink` now have a `standalone` and `standalone-inverse` variant. This
|
|
256
|
+
removes the underline text decoration for use outside the context of body text.
|
|
241
257
|
|
|
242
258
|
**HyperLink and ExternalHyperlink in v14**
|
|
243
259
|
|
|
@@ -248,14 +264,17 @@ These changes are only **visual** and should not affect the functionality of the
|
|
|
248
264
|
<ExternalHyperlink variant="standalone-inverse" href="#external-hyperlink">External Hyperlink</ExternalHyperlink>
|
|
249
265
|
```
|
|
250
266
|
|
|
251
|
-
> **Note:** Only use the `standalone` or `standalone-inverse` variant in cases where the
|
|
267
|
+
> **Note:** Only use the `standalone` or `standalone-inverse` variant in cases where the
|
|
268
|
+
> `<HyperLink>` and `<ExternalHyperlink>` are used outside the context of body text.
|
|
252
269
|
|
|
253
270
|
### Loading Dots
|
|
254
271
|
|
|
255
272
|
**PR:** [#3393](https://github.com/Workday/canvas-kit/pull/3393)
|
|
256
273
|
|
|
257
|
-
- We've updated the colors to match brand refresh. The default color changes from
|
|
258
|
-
|
|
274
|
+
- We've updated the colors to match brand refresh. The default color changes from
|
|
275
|
+
`system.color.bg.alt.strong` to `system.color.bg.muted.strong`.
|
|
276
|
+
- `LoadingDots` now has a `inverse` variant. Use this variant when the Loading Dots are on a dark
|
|
277
|
+
background or image.
|
|
259
278
|
|
|
260
279
|
```tsx
|
|
261
280
|
<LoadingDots variant="inverse" />
|
|
@@ -10,6 +10,7 @@ import Disabled from './examples/Disabled';
|
|
|
10
10
|
import Error from './examples/Error';
|
|
11
11
|
import Complex from './examples/Complex';
|
|
12
12
|
import Icons from './examples/Icons';
|
|
13
|
+
import InitialSelectedItems from './examples/InitialSelectedItems';
|
|
13
14
|
import Controlled from './examples/Controlled';
|
|
14
15
|
import Searching from './examples/Searching';
|
|
15
16
|
|
|
@@ -109,4 +110,10 @@ dynamically load items as the user navigates the available options.
|
|
|
109
110
|
> Don't rely too much on the exact behavior of the search input. For example, the search input may
|
|
110
111
|
> be cleared when the user blurs the field.
|
|
111
112
|
|
|
112
|
-
<ExampleCodeBlock code={Searching} />
|
|
113
|
+
<ExampleCodeBlock code={Searching} />
|
|
114
|
+
|
|
115
|
+
### Initial Selected Items
|
|
116
|
+
|
|
117
|
+
You can set `initialSelectedIds` to the value that you want initially selected.
|
|
118
|
+
|
|
119
|
+
<ExampleCodeBlock code={InitialSelectedItems} />
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import React, {useEffect} from 'react';
|
|
2
|
+
|
|
3
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
4
|
+
|
|
5
|
+
import {createStyles} from '@workday/canvas-kit-styling';
|
|
6
|
+
import {LoadReturn} from '@workday/canvas-kit-react/collection';
|
|
7
|
+
import {CanvasProvider, useMountLayout} from '@workday/canvas-kit-react/common';
|
|
8
|
+
import {useComboboxLoader} from '@workday/canvas-kit-react/combobox';
|
|
9
|
+
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
10
|
+
|
|
11
|
+
import {MultiSelect, useMultiSelectModel} from '@workday/canvas-kit-preview-react/multi-select';
|
|
12
|
+
import {StyledMenuItem} from '@workday/canvas-kit-react/menu';
|
|
13
|
+
|
|
14
|
+
const mainContentStyles = createStyles({
|
|
15
|
+
padding: system.space.x4,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const colors = ['Red', 'Blue', 'Purple', 'Green', 'Pink'];
|
|
19
|
+
const fruits = ['Apple', 'Orange', 'Banana', 'Grape', 'Lemon', 'Lime'];
|
|
20
|
+
const options = Array(1000)
|
|
21
|
+
.fill('')
|
|
22
|
+
.map((_, index) => {
|
|
23
|
+
return {
|
|
24
|
+
id: `${index + 1}`,
|
|
25
|
+
text: `${colors[index % colors.length]} ${fruits[index % fruits.length]} ${index + 1}`,
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export default () => {
|
|
30
|
+
const [value, setValue] = React.useState('');
|
|
31
|
+
|
|
32
|
+
const {model, loader} = useComboboxLoader(
|
|
33
|
+
{
|
|
34
|
+
// You can start with any number that makes sense.
|
|
35
|
+
total: 0,
|
|
36
|
+
initialSelectedIds: ['3', '5'],
|
|
37
|
+
|
|
38
|
+
// Pick whatever number makes sense for your API
|
|
39
|
+
pageSize: 500,
|
|
40
|
+
|
|
41
|
+
// A load function that will be called by the loader. You must return a promise that returns
|
|
42
|
+
// an object like `{items: [], total: 0}`. The `items` will be merged into the loader's cache
|
|
43
|
+
async load({pageNumber, pageSize, filter}) {
|
|
44
|
+
return new Promise<LoadReturn<(typeof options)[0]>>(resolve => {
|
|
45
|
+
// simulate a server response by resolving after a period of time
|
|
46
|
+
setTimeout(() => {
|
|
47
|
+
// simulate paging and filtering based on pre-computed items
|
|
48
|
+
const start = (pageNumber - 1) * pageSize;
|
|
49
|
+
const end = start + pageSize;
|
|
50
|
+
const filteredItems = options.filter(item => {
|
|
51
|
+
if (filter === '' || typeof filter !== 'string') {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
return item.text.toLowerCase().includes(filter.toLowerCase());
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const total = filteredItems.length;
|
|
58
|
+
const items = filteredItems.slice(start, end);
|
|
59
|
+
|
|
60
|
+
resolve({
|
|
61
|
+
items,
|
|
62
|
+
total,
|
|
63
|
+
});
|
|
64
|
+
}, 300);
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
onShow() {
|
|
68
|
+
// The `shouldLoad` cancels while the combobox menu is hidden, so let's load when it is
|
|
69
|
+
// visible
|
|
70
|
+
loader.load();
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
useMultiSelectModel
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
loader.load();
|
|
78
|
+
}, [loader]);
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<CanvasProvider>
|
|
82
|
+
<>
|
|
83
|
+
<form
|
|
84
|
+
onSubmit={e => {
|
|
85
|
+
console.log('form submitted');
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
<main className={mainContentStyles}>
|
|
90
|
+
<MultiSelect model={model}>
|
|
91
|
+
<FormField orientation="horizontalStart">
|
|
92
|
+
<FormField.Label>Fruits</FormField.Label>
|
|
93
|
+
<FormField.Input
|
|
94
|
+
as={MultiSelect.SearchInput}
|
|
95
|
+
placeholder="Search"
|
|
96
|
+
removeLabel="Remove"
|
|
97
|
+
name="toppings"
|
|
98
|
+
onChange={e => {
|
|
99
|
+
setValue(e.currentTarget.value);
|
|
100
|
+
}}
|
|
101
|
+
value={value}
|
|
102
|
+
/>
|
|
103
|
+
<MultiSelect.Popper>
|
|
104
|
+
<MultiSelect.Card>
|
|
105
|
+
{model.state.items.length === 0 && (
|
|
106
|
+
<StyledMenuItem as="span">No Results Found</StyledMenuItem>
|
|
107
|
+
)}
|
|
108
|
+
{model.state.items.length > 0 && (
|
|
109
|
+
<MultiSelect.List maxHeight={200}>
|
|
110
|
+
{item =>
|
|
111
|
+
item ? (
|
|
112
|
+
<MultiSelect.Item data-id={item.id}>
|
|
113
|
+
<MultiSelect.Item.Text>{item.text}</MultiSelect.Item.Text>
|
|
114
|
+
</MultiSelect.Item>
|
|
115
|
+
) : undefined
|
|
116
|
+
}
|
|
117
|
+
</MultiSelect.List>
|
|
118
|
+
)}
|
|
119
|
+
</MultiSelect.Card>
|
|
120
|
+
</MultiSelect.Popper>
|
|
121
|
+
</FormField>
|
|
122
|
+
</MultiSelect>
|
|
123
|
+
</main>
|
|
124
|
+
</form>
|
|
125
|
+
<div>Selected: {value}</div>
|
|
126
|
+
</>
|
|
127
|
+
</CanvasProvider>
|
|
128
|
+
);
|
|
129
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "14.0.0-alpha.
|
|
3
|
+
"version": "14.0.0-alpha.1206-next.0",
|
|
4
4
|
"description": "Documentation components of Canvas Kit components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"@emotion/styled": "^11.6.0",
|
|
46
46
|
"@stackblitz/sdk": "^1.11.0",
|
|
47
47
|
"@storybook/csf": "0.0.1",
|
|
48
|
-
"@workday/canvas-kit-labs-react": "^14.0.0-alpha.
|
|
49
|
-
"@workday/canvas-kit-preview-react": "^14.0.0-alpha.
|
|
50
|
-
"@workday/canvas-kit-react": "^14.0.0-alpha.
|
|
51
|
-
"@workday/canvas-kit-styling": "^14.0.0-alpha.
|
|
48
|
+
"@workday/canvas-kit-labs-react": "^14.0.0-alpha.1206-next.0",
|
|
49
|
+
"@workday/canvas-kit-preview-react": "^14.0.0-alpha.1206-next.0",
|
|
50
|
+
"@workday/canvas-kit-react": "^14.0.0-alpha.1206-next.0",
|
|
51
|
+
"@workday/canvas-kit-styling": "^14.0.0-alpha.1206-next.0",
|
|
52
52
|
"@workday/canvas-system-icons-web": "^3.0.35",
|
|
53
53
|
"@workday/canvas-tokens-web": "3.0.0-alpha.12",
|
|
54
54
|
"markdown-to-jsx": "^7.2.0",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"mkdirp": "^1.0.3",
|
|
62
62
|
"typescript": "5.0"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "5f2128b722fff5b086358ff3bd3ab009b0e07ef4"
|
|
65
65
|
}
|