@workday/canvas-kit-docs 8.0.0-alpha.235-next.6 → 8.0.0-alpha.237-next.8
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/commonjs/lib/specs.js +326 -0
- package/dist/es6/lib/specs.js +326 -0
- package/dist/mdx/8.0-UPGRADE-GUIDE.mdx +24 -1
- package/dist/mdx/preview-react/segmented-control/SegmentedControl.mdx +203 -0
- package/dist/mdx/preview-react/segmented-control/SegmentedControlModel.splitprops.tsx +10 -0
- package/dist/mdx/preview-react/segmented-control/examples/Basic.tsx +31 -0
- package/dist/mdx/preview-react/segmented-control/examples/Disabled.tsx +31 -0
- package/dist/mdx/preview-react/segmented-control/examples/Dynamic.tsx +42 -0
- package/dist/mdx/preview-react/segmented-control/examples/RTL.tsx +30 -0
- package/dist/mdx/preview-react/segmented-control/examples/Sizes.tsx +78 -0
- package/dist/mdx/preview-react/segmented-control/examples/TextAndIcon.tsx +19 -0
- package/dist/mdx/preview-react/segmented-control/examples/TextOnly.tsx +12 -0
- package/dist/mdx/preview-react/segmented-control/examples/Vertical.tsx +31 -0
- package/package.json +3 -3
- package/dist/mdx/react/_examples/SegmentedControlWithText.mdx +0 -12
|
@@ -2952,6 +2952,332 @@ module.exports = {specifications: [
|
|
|
2952
2952
|
}
|
|
2953
2953
|
]
|
|
2954
2954
|
},
|
|
2955
|
+
{
|
|
2956
|
+
"type": "file",
|
|
2957
|
+
"name": "SegmentedControl.spec.ts",
|
|
2958
|
+
"children": [
|
|
2959
|
+
{
|
|
2960
|
+
"type": "describe",
|
|
2961
|
+
"name": "SegmentedControl",
|
|
2962
|
+
"children": [
|
|
2963
|
+
{
|
|
2964
|
+
"type": "describe",
|
|
2965
|
+
"name": "given the [Preview/Segmented Control/React, Basic] story is rendered",
|
|
2966
|
+
"children": [
|
|
2967
|
+
{
|
|
2968
|
+
"type": "it",
|
|
2969
|
+
"name": "should pass axe checks"
|
|
2970
|
+
},
|
|
2971
|
+
{
|
|
2972
|
+
"type": "it",
|
|
2973
|
+
"name": "should have an element with a role of \"group\""
|
|
2974
|
+
},
|
|
2975
|
+
{
|
|
2976
|
+
"type": "it",
|
|
2977
|
+
"name": "should have a group element with a aria-label attribute"
|
|
2978
|
+
},
|
|
2979
|
+
{
|
|
2980
|
+
"type": "it",
|
|
2981
|
+
"name": "should have button elements inside the \"group\""
|
|
2982
|
+
},
|
|
2983
|
+
{
|
|
2984
|
+
"type": "it",
|
|
2985
|
+
"name": "should have \"aria-pressed=true\" for the first button"
|
|
2986
|
+
},
|
|
2987
|
+
{
|
|
2988
|
+
"type": "it",
|
|
2989
|
+
"name": "should have \"aria-pressed=false\" for the second button"
|
|
2990
|
+
},
|
|
2991
|
+
{
|
|
2992
|
+
"type": "it",
|
|
2993
|
+
"name": "should have a data-id attribute on the first button"
|
|
2994
|
+
},
|
|
2995
|
+
{
|
|
2996
|
+
"type": "it",
|
|
2997
|
+
"name": "should have a label"
|
|
2998
|
+
},
|
|
2999
|
+
{
|
|
3000
|
+
"type": "describe",
|
|
3001
|
+
"name": "when the button is hovered",
|
|
3002
|
+
"children": [
|
|
3003
|
+
{
|
|
3004
|
+
"type": "it",
|
|
3005
|
+
"name": "should open the tooltip"
|
|
3006
|
+
}
|
|
3007
|
+
]
|
|
3008
|
+
},
|
|
3009
|
+
{
|
|
3010
|
+
"type": "describe",
|
|
3011
|
+
"name": "when the button is focused",
|
|
3012
|
+
"children": [
|
|
3013
|
+
{
|
|
3014
|
+
"type": "it",
|
|
3015
|
+
"name": "should open the tooltip"
|
|
3016
|
+
}
|
|
3017
|
+
]
|
|
3018
|
+
},
|
|
3019
|
+
{
|
|
3020
|
+
"type": "describe",
|
|
3021
|
+
"name": "when the first button is active and focused",
|
|
3022
|
+
"children": [
|
|
3023
|
+
{
|
|
3024
|
+
"type": "describe",
|
|
3025
|
+
"name": "when the tab key is pressed",
|
|
3026
|
+
"children": [
|
|
3027
|
+
{
|
|
3028
|
+
"type": "it",
|
|
3029
|
+
"name": "should focus on the second button"
|
|
3030
|
+
},
|
|
3031
|
+
{
|
|
3032
|
+
"type": "describe",
|
|
3033
|
+
"name": "when the space key is pressed",
|
|
3034
|
+
"children": [
|
|
3035
|
+
{
|
|
3036
|
+
"type": "it",
|
|
3037
|
+
"name": "should not have \"aria-pressed\" on the first button"
|
|
3038
|
+
},
|
|
3039
|
+
{
|
|
3040
|
+
"type": "it",
|
|
3041
|
+
"name": "should have \"aria-pressed=true\" on the second button"
|
|
3042
|
+
}
|
|
3043
|
+
]
|
|
3044
|
+
},
|
|
3045
|
+
{
|
|
3046
|
+
"type": "describe",
|
|
3047
|
+
"name": "when the enter key is pressed",
|
|
3048
|
+
"children": [
|
|
3049
|
+
{
|
|
3050
|
+
"type": "it",
|
|
3051
|
+
"name": "should not have \"aria-pressed\" on the first button"
|
|
3052
|
+
},
|
|
3053
|
+
{
|
|
3054
|
+
"type": "it",
|
|
3055
|
+
"name": "should have \"aria-pressed=true\" on the second button"
|
|
3056
|
+
}
|
|
3057
|
+
]
|
|
3058
|
+
}
|
|
3059
|
+
]
|
|
3060
|
+
},
|
|
3061
|
+
{
|
|
3062
|
+
"type": "describe",
|
|
3063
|
+
"name": "when the tab+shift is pressed",
|
|
3064
|
+
"children": [
|
|
3065
|
+
{
|
|
3066
|
+
"type": "it",
|
|
3067
|
+
"name": "should focus on the last button"
|
|
3068
|
+
}
|
|
3069
|
+
]
|
|
3070
|
+
}
|
|
3071
|
+
]
|
|
3072
|
+
}
|
|
3073
|
+
]
|
|
3074
|
+
},
|
|
3075
|
+
{
|
|
3076
|
+
"type": "describe",
|
|
3077
|
+
"name": "given the [Preview/Segmented Control/React, Vertical] story is rendered",
|
|
3078
|
+
"children": [
|
|
3079
|
+
{
|
|
3080
|
+
"type": "it",
|
|
3081
|
+
"name": "should pass axe checks"
|
|
3082
|
+
},
|
|
3083
|
+
{
|
|
3084
|
+
"type": "it",
|
|
3085
|
+
"name": "should have an element with a role of \"group\""
|
|
3086
|
+
},
|
|
3087
|
+
{
|
|
3088
|
+
"type": "it",
|
|
3089
|
+
"name": "should have a group element with a aria-label attribute"
|
|
3090
|
+
},
|
|
3091
|
+
{
|
|
3092
|
+
"type": "it",
|
|
3093
|
+
"name": "should have button elements inside the \"group\""
|
|
3094
|
+
},
|
|
3095
|
+
{
|
|
3096
|
+
"type": "it",
|
|
3097
|
+
"name": "should have \"aria-pressed=true\" for the first button"
|
|
3098
|
+
},
|
|
3099
|
+
{
|
|
3100
|
+
"type": "it",
|
|
3101
|
+
"name": "should have \"aria-pressed=false\" for the second button"
|
|
3102
|
+
},
|
|
3103
|
+
{
|
|
3104
|
+
"type": "it",
|
|
3105
|
+
"name": "should have a data-id attribute on the first button"
|
|
3106
|
+
},
|
|
3107
|
+
{
|
|
3108
|
+
"type": "it",
|
|
3109
|
+
"name": "should have a label"
|
|
3110
|
+
},
|
|
3111
|
+
{
|
|
3112
|
+
"type": "describe",
|
|
3113
|
+
"name": "when the button is hovered",
|
|
3114
|
+
"children": [
|
|
3115
|
+
{
|
|
3116
|
+
"type": "it",
|
|
3117
|
+
"name": "should open the tooltip"
|
|
3118
|
+
}
|
|
3119
|
+
]
|
|
3120
|
+
},
|
|
3121
|
+
{
|
|
3122
|
+
"type": "describe",
|
|
3123
|
+
"name": "when the button is focused",
|
|
3124
|
+
"children": [
|
|
3125
|
+
{
|
|
3126
|
+
"type": "it",
|
|
3127
|
+
"name": "should open the tooltip"
|
|
3128
|
+
}
|
|
3129
|
+
]
|
|
3130
|
+
},
|
|
3131
|
+
{
|
|
3132
|
+
"type": "describe",
|
|
3133
|
+
"name": "when the first button is active and focused",
|
|
3134
|
+
"children": [
|
|
3135
|
+
{
|
|
3136
|
+
"type": "describe",
|
|
3137
|
+
"name": "when the tab key is pressed",
|
|
3138
|
+
"children": [
|
|
3139
|
+
{
|
|
3140
|
+
"type": "it",
|
|
3141
|
+
"name": "should focus on the second button"
|
|
3142
|
+
},
|
|
3143
|
+
{
|
|
3144
|
+
"type": "describe",
|
|
3145
|
+
"name": "when the space key is pressed",
|
|
3146
|
+
"children": [
|
|
3147
|
+
{
|
|
3148
|
+
"type": "it",
|
|
3149
|
+
"name": "should not have \"aria-pressed\" on the first button"
|
|
3150
|
+
},
|
|
3151
|
+
{
|
|
3152
|
+
"type": "it",
|
|
3153
|
+
"name": "should have \"aria-pressed=true\" on the second button"
|
|
3154
|
+
}
|
|
3155
|
+
]
|
|
3156
|
+
},
|
|
3157
|
+
{
|
|
3158
|
+
"type": "describe",
|
|
3159
|
+
"name": "when the enter key is pressed",
|
|
3160
|
+
"children": [
|
|
3161
|
+
{
|
|
3162
|
+
"type": "it",
|
|
3163
|
+
"name": "should not have \"aria-pressed\" on the first button"
|
|
3164
|
+
},
|
|
3165
|
+
{
|
|
3166
|
+
"type": "it",
|
|
3167
|
+
"name": "should have \"aria-pressed=true\" on the second button"
|
|
3168
|
+
}
|
|
3169
|
+
]
|
|
3170
|
+
}
|
|
3171
|
+
]
|
|
3172
|
+
},
|
|
3173
|
+
{
|
|
3174
|
+
"type": "describe",
|
|
3175
|
+
"name": "when the tab+shift is pressed",
|
|
3176
|
+
"children": [
|
|
3177
|
+
{
|
|
3178
|
+
"type": "it",
|
|
3179
|
+
"name": "should focus on the last button"
|
|
3180
|
+
}
|
|
3181
|
+
]
|
|
3182
|
+
}
|
|
3183
|
+
]
|
|
3184
|
+
}
|
|
3185
|
+
]
|
|
3186
|
+
},
|
|
3187
|
+
{
|
|
3188
|
+
"type": "describe",
|
|
3189
|
+
"name": "given the [Preview/Segmented Control/React, Disabled] story is rendered",
|
|
3190
|
+
"children": [
|
|
3191
|
+
{
|
|
3192
|
+
"type": "describe",
|
|
3193
|
+
"name": "all buttons should be disabled",
|
|
3194
|
+
"children": [
|
|
3195
|
+
{
|
|
3196
|
+
"type": "it",
|
|
3197
|
+
"name": "should have \"[aria-pressed]\" for all buttons"
|
|
3198
|
+
},
|
|
3199
|
+
{
|
|
3200
|
+
"type": "it",
|
|
3201
|
+
"name": "should have \"[disabled]\" for all buttons"
|
|
3202
|
+
}
|
|
3203
|
+
]
|
|
3204
|
+
},
|
|
3205
|
+
{
|
|
3206
|
+
"type": "describe",
|
|
3207
|
+
"name": "when the disabled button is clicked",
|
|
3208
|
+
"children": [
|
|
3209
|
+
{
|
|
3210
|
+
"type": "it",
|
|
3211
|
+
"name": "should not set \"[aria-pressed=true]\" on the disabled button"
|
|
3212
|
+
}
|
|
3213
|
+
]
|
|
3214
|
+
}
|
|
3215
|
+
]
|
|
3216
|
+
},
|
|
3217
|
+
{
|
|
3218
|
+
"type": "describe",
|
|
3219
|
+
"name": "given the [Preview/Segmented Control/React, rtl] story is rendered",
|
|
3220
|
+
"children": [
|
|
3221
|
+
{
|
|
3222
|
+
"type": "describe",
|
|
3223
|
+
"name": "when the first button is active and focused",
|
|
3224
|
+
"children": [
|
|
3225
|
+
{
|
|
3226
|
+
"type": "describe",
|
|
3227
|
+
"name": "when the tab key is pressed",
|
|
3228
|
+
"children": [
|
|
3229
|
+
{
|
|
3230
|
+
"type": "it",
|
|
3231
|
+
"name": "should focus on the second button"
|
|
3232
|
+
},
|
|
3233
|
+
{
|
|
3234
|
+
"type": "describe",
|
|
3235
|
+
"name": "when the space key is pressed",
|
|
3236
|
+
"children": [
|
|
3237
|
+
{
|
|
3238
|
+
"type": "it",
|
|
3239
|
+
"name": "should not have \"aria-pressed\" on the first button"
|
|
3240
|
+
},
|
|
3241
|
+
{
|
|
3242
|
+
"type": "it",
|
|
3243
|
+
"name": "should have \"aria-pressed=true\" on the second button"
|
|
3244
|
+
}
|
|
3245
|
+
]
|
|
3246
|
+
},
|
|
3247
|
+
{
|
|
3248
|
+
"type": "describe",
|
|
3249
|
+
"name": "when the enter key is pressed",
|
|
3250
|
+
"children": [
|
|
3251
|
+
{
|
|
3252
|
+
"type": "it",
|
|
3253
|
+
"name": "should not have \"aria-pressed\" on the first button"
|
|
3254
|
+
},
|
|
3255
|
+
{
|
|
3256
|
+
"type": "it",
|
|
3257
|
+
"name": "should have \"aria-pressed=true\" on the second button"
|
|
3258
|
+
}
|
|
3259
|
+
]
|
|
3260
|
+
}
|
|
3261
|
+
]
|
|
3262
|
+
},
|
|
3263
|
+
{
|
|
3264
|
+
"type": "describe",
|
|
3265
|
+
"name": "when the tab+shift is pressed",
|
|
3266
|
+
"children": [
|
|
3267
|
+
{
|
|
3268
|
+
"type": "it",
|
|
3269
|
+
"name": "should focus on the last button"
|
|
3270
|
+
}
|
|
3271
|
+
]
|
|
3272
|
+
}
|
|
3273
|
+
]
|
|
3274
|
+
}
|
|
3275
|
+
]
|
|
3276
|
+
}
|
|
3277
|
+
]
|
|
3278
|
+
}
|
|
3279
|
+
]
|
|
3280
|
+
},
|
|
2955
3281
|
{
|
|
2956
3282
|
"type": "file",
|
|
2957
3283
|
"name": "Select.spec.ts",
|
package/dist/es6/lib/specs.js
CHANGED
|
@@ -2952,6 +2952,332 @@ module.exports = {specifications: [
|
|
|
2952
2952
|
}
|
|
2953
2953
|
]
|
|
2954
2954
|
},
|
|
2955
|
+
{
|
|
2956
|
+
"type": "file",
|
|
2957
|
+
"name": "SegmentedControl.spec.ts",
|
|
2958
|
+
"children": [
|
|
2959
|
+
{
|
|
2960
|
+
"type": "describe",
|
|
2961
|
+
"name": "SegmentedControl",
|
|
2962
|
+
"children": [
|
|
2963
|
+
{
|
|
2964
|
+
"type": "describe",
|
|
2965
|
+
"name": "given the [Preview/Segmented Control/React, Basic] story is rendered",
|
|
2966
|
+
"children": [
|
|
2967
|
+
{
|
|
2968
|
+
"type": "it",
|
|
2969
|
+
"name": "should pass axe checks"
|
|
2970
|
+
},
|
|
2971
|
+
{
|
|
2972
|
+
"type": "it",
|
|
2973
|
+
"name": "should have an element with a role of \"group\""
|
|
2974
|
+
},
|
|
2975
|
+
{
|
|
2976
|
+
"type": "it",
|
|
2977
|
+
"name": "should have a group element with a aria-label attribute"
|
|
2978
|
+
},
|
|
2979
|
+
{
|
|
2980
|
+
"type": "it",
|
|
2981
|
+
"name": "should have button elements inside the \"group\""
|
|
2982
|
+
},
|
|
2983
|
+
{
|
|
2984
|
+
"type": "it",
|
|
2985
|
+
"name": "should have \"aria-pressed=true\" for the first button"
|
|
2986
|
+
},
|
|
2987
|
+
{
|
|
2988
|
+
"type": "it",
|
|
2989
|
+
"name": "should have \"aria-pressed=false\" for the second button"
|
|
2990
|
+
},
|
|
2991
|
+
{
|
|
2992
|
+
"type": "it",
|
|
2993
|
+
"name": "should have a data-id attribute on the first button"
|
|
2994
|
+
},
|
|
2995
|
+
{
|
|
2996
|
+
"type": "it",
|
|
2997
|
+
"name": "should have a label"
|
|
2998
|
+
},
|
|
2999
|
+
{
|
|
3000
|
+
"type": "describe",
|
|
3001
|
+
"name": "when the button is hovered",
|
|
3002
|
+
"children": [
|
|
3003
|
+
{
|
|
3004
|
+
"type": "it",
|
|
3005
|
+
"name": "should open the tooltip"
|
|
3006
|
+
}
|
|
3007
|
+
]
|
|
3008
|
+
},
|
|
3009
|
+
{
|
|
3010
|
+
"type": "describe",
|
|
3011
|
+
"name": "when the button is focused",
|
|
3012
|
+
"children": [
|
|
3013
|
+
{
|
|
3014
|
+
"type": "it",
|
|
3015
|
+
"name": "should open the tooltip"
|
|
3016
|
+
}
|
|
3017
|
+
]
|
|
3018
|
+
},
|
|
3019
|
+
{
|
|
3020
|
+
"type": "describe",
|
|
3021
|
+
"name": "when the first button is active and focused",
|
|
3022
|
+
"children": [
|
|
3023
|
+
{
|
|
3024
|
+
"type": "describe",
|
|
3025
|
+
"name": "when the tab key is pressed",
|
|
3026
|
+
"children": [
|
|
3027
|
+
{
|
|
3028
|
+
"type": "it",
|
|
3029
|
+
"name": "should focus on the second button"
|
|
3030
|
+
},
|
|
3031
|
+
{
|
|
3032
|
+
"type": "describe",
|
|
3033
|
+
"name": "when the space key is pressed",
|
|
3034
|
+
"children": [
|
|
3035
|
+
{
|
|
3036
|
+
"type": "it",
|
|
3037
|
+
"name": "should not have \"aria-pressed\" on the first button"
|
|
3038
|
+
},
|
|
3039
|
+
{
|
|
3040
|
+
"type": "it",
|
|
3041
|
+
"name": "should have \"aria-pressed=true\" on the second button"
|
|
3042
|
+
}
|
|
3043
|
+
]
|
|
3044
|
+
},
|
|
3045
|
+
{
|
|
3046
|
+
"type": "describe",
|
|
3047
|
+
"name": "when the enter key is pressed",
|
|
3048
|
+
"children": [
|
|
3049
|
+
{
|
|
3050
|
+
"type": "it",
|
|
3051
|
+
"name": "should not have \"aria-pressed\" on the first button"
|
|
3052
|
+
},
|
|
3053
|
+
{
|
|
3054
|
+
"type": "it",
|
|
3055
|
+
"name": "should have \"aria-pressed=true\" on the second button"
|
|
3056
|
+
}
|
|
3057
|
+
]
|
|
3058
|
+
}
|
|
3059
|
+
]
|
|
3060
|
+
},
|
|
3061
|
+
{
|
|
3062
|
+
"type": "describe",
|
|
3063
|
+
"name": "when the tab+shift is pressed",
|
|
3064
|
+
"children": [
|
|
3065
|
+
{
|
|
3066
|
+
"type": "it",
|
|
3067
|
+
"name": "should focus on the last button"
|
|
3068
|
+
}
|
|
3069
|
+
]
|
|
3070
|
+
}
|
|
3071
|
+
]
|
|
3072
|
+
}
|
|
3073
|
+
]
|
|
3074
|
+
},
|
|
3075
|
+
{
|
|
3076
|
+
"type": "describe",
|
|
3077
|
+
"name": "given the [Preview/Segmented Control/React, Vertical] story is rendered",
|
|
3078
|
+
"children": [
|
|
3079
|
+
{
|
|
3080
|
+
"type": "it",
|
|
3081
|
+
"name": "should pass axe checks"
|
|
3082
|
+
},
|
|
3083
|
+
{
|
|
3084
|
+
"type": "it",
|
|
3085
|
+
"name": "should have an element with a role of \"group\""
|
|
3086
|
+
},
|
|
3087
|
+
{
|
|
3088
|
+
"type": "it",
|
|
3089
|
+
"name": "should have a group element with a aria-label attribute"
|
|
3090
|
+
},
|
|
3091
|
+
{
|
|
3092
|
+
"type": "it",
|
|
3093
|
+
"name": "should have button elements inside the \"group\""
|
|
3094
|
+
},
|
|
3095
|
+
{
|
|
3096
|
+
"type": "it",
|
|
3097
|
+
"name": "should have \"aria-pressed=true\" for the first button"
|
|
3098
|
+
},
|
|
3099
|
+
{
|
|
3100
|
+
"type": "it",
|
|
3101
|
+
"name": "should have \"aria-pressed=false\" for the second button"
|
|
3102
|
+
},
|
|
3103
|
+
{
|
|
3104
|
+
"type": "it",
|
|
3105
|
+
"name": "should have a data-id attribute on the first button"
|
|
3106
|
+
},
|
|
3107
|
+
{
|
|
3108
|
+
"type": "it",
|
|
3109
|
+
"name": "should have a label"
|
|
3110
|
+
},
|
|
3111
|
+
{
|
|
3112
|
+
"type": "describe",
|
|
3113
|
+
"name": "when the button is hovered",
|
|
3114
|
+
"children": [
|
|
3115
|
+
{
|
|
3116
|
+
"type": "it",
|
|
3117
|
+
"name": "should open the tooltip"
|
|
3118
|
+
}
|
|
3119
|
+
]
|
|
3120
|
+
},
|
|
3121
|
+
{
|
|
3122
|
+
"type": "describe",
|
|
3123
|
+
"name": "when the button is focused",
|
|
3124
|
+
"children": [
|
|
3125
|
+
{
|
|
3126
|
+
"type": "it",
|
|
3127
|
+
"name": "should open the tooltip"
|
|
3128
|
+
}
|
|
3129
|
+
]
|
|
3130
|
+
},
|
|
3131
|
+
{
|
|
3132
|
+
"type": "describe",
|
|
3133
|
+
"name": "when the first button is active and focused",
|
|
3134
|
+
"children": [
|
|
3135
|
+
{
|
|
3136
|
+
"type": "describe",
|
|
3137
|
+
"name": "when the tab key is pressed",
|
|
3138
|
+
"children": [
|
|
3139
|
+
{
|
|
3140
|
+
"type": "it",
|
|
3141
|
+
"name": "should focus on the second button"
|
|
3142
|
+
},
|
|
3143
|
+
{
|
|
3144
|
+
"type": "describe",
|
|
3145
|
+
"name": "when the space key is pressed",
|
|
3146
|
+
"children": [
|
|
3147
|
+
{
|
|
3148
|
+
"type": "it",
|
|
3149
|
+
"name": "should not have \"aria-pressed\" on the first button"
|
|
3150
|
+
},
|
|
3151
|
+
{
|
|
3152
|
+
"type": "it",
|
|
3153
|
+
"name": "should have \"aria-pressed=true\" on the second button"
|
|
3154
|
+
}
|
|
3155
|
+
]
|
|
3156
|
+
},
|
|
3157
|
+
{
|
|
3158
|
+
"type": "describe",
|
|
3159
|
+
"name": "when the enter key is pressed",
|
|
3160
|
+
"children": [
|
|
3161
|
+
{
|
|
3162
|
+
"type": "it",
|
|
3163
|
+
"name": "should not have \"aria-pressed\" on the first button"
|
|
3164
|
+
},
|
|
3165
|
+
{
|
|
3166
|
+
"type": "it",
|
|
3167
|
+
"name": "should have \"aria-pressed=true\" on the second button"
|
|
3168
|
+
}
|
|
3169
|
+
]
|
|
3170
|
+
}
|
|
3171
|
+
]
|
|
3172
|
+
},
|
|
3173
|
+
{
|
|
3174
|
+
"type": "describe",
|
|
3175
|
+
"name": "when the tab+shift is pressed",
|
|
3176
|
+
"children": [
|
|
3177
|
+
{
|
|
3178
|
+
"type": "it",
|
|
3179
|
+
"name": "should focus on the last button"
|
|
3180
|
+
}
|
|
3181
|
+
]
|
|
3182
|
+
}
|
|
3183
|
+
]
|
|
3184
|
+
}
|
|
3185
|
+
]
|
|
3186
|
+
},
|
|
3187
|
+
{
|
|
3188
|
+
"type": "describe",
|
|
3189
|
+
"name": "given the [Preview/Segmented Control/React, Disabled] story is rendered",
|
|
3190
|
+
"children": [
|
|
3191
|
+
{
|
|
3192
|
+
"type": "describe",
|
|
3193
|
+
"name": "all buttons should be disabled",
|
|
3194
|
+
"children": [
|
|
3195
|
+
{
|
|
3196
|
+
"type": "it",
|
|
3197
|
+
"name": "should have \"[aria-pressed]\" for all buttons"
|
|
3198
|
+
},
|
|
3199
|
+
{
|
|
3200
|
+
"type": "it",
|
|
3201
|
+
"name": "should have \"[disabled]\" for all buttons"
|
|
3202
|
+
}
|
|
3203
|
+
]
|
|
3204
|
+
},
|
|
3205
|
+
{
|
|
3206
|
+
"type": "describe",
|
|
3207
|
+
"name": "when the disabled button is clicked",
|
|
3208
|
+
"children": [
|
|
3209
|
+
{
|
|
3210
|
+
"type": "it",
|
|
3211
|
+
"name": "should not set \"[aria-pressed=true]\" on the disabled button"
|
|
3212
|
+
}
|
|
3213
|
+
]
|
|
3214
|
+
}
|
|
3215
|
+
]
|
|
3216
|
+
},
|
|
3217
|
+
{
|
|
3218
|
+
"type": "describe",
|
|
3219
|
+
"name": "given the [Preview/Segmented Control/React, rtl] story is rendered",
|
|
3220
|
+
"children": [
|
|
3221
|
+
{
|
|
3222
|
+
"type": "describe",
|
|
3223
|
+
"name": "when the first button is active and focused",
|
|
3224
|
+
"children": [
|
|
3225
|
+
{
|
|
3226
|
+
"type": "describe",
|
|
3227
|
+
"name": "when the tab key is pressed",
|
|
3228
|
+
"children": [
|
|
3229
|
+
{
|
|
3230
|
+
"type": "it",
|
|
3231
|
+
"name": "should focus on the second button"
|
|
3232
|
+
},
|
|
3233
|
+
{
|
|
3234
|
+
"type": "describe",
|
|
3235
|
+
"name": "when the space key is pressed",
|
|
3236
|
+
"children": [
|
|
3237
|
+
{
|
|
3238
|
+
"type": "it",
|
|
3239
|
+
"name": "should not have \"aria-pressed\" on the first button"
|
|
3240
|
+
},
|
|
3241
|
+
{
|
|
3242
|
+
"type": "it",
|
|
3243
|
+
"name": "should have \"aria-pressed=true\" on the second button"
|
|
3244
|
+
}
|
|
3245
|
+
]
|
|
3246
|
+
},
|
|
3247
|
+
{
|
|
3248
|
+
"type": "describe",
|
|
3249
|
+
"name": "when the enter key is pressed",
|
|
3250
|
+
"children": [
|
|
3251
|
+
{
|
|
3252
|
+
"type": "it",
|
|
3253
|
+
"name": "should not have \"aria-pressed\" on the first button"
|
|
3254
|
+
},
|
|
3255
|
+
{
|
|
3256
|
+
"type": "it",
|
|
3257
|
+
"name": "should have \"aria-pressed=true\" on the second button"
|
|
3258
|
+
}
|
|
3259
|
+
]
|
|
3260
|
+
}
|
|
3261
|
+
]
|
|
3262
|
+
},
|
|
3263
|
+
{
|
|
3264
|
+
"type": "describe",
|
|
3265
|
+
"name": "when the tab+shift is pressed",
|
|
3266
|
+
"children": [
|
|
3267
|
+
{
|
|
3268
|
+
"type": "it",
|
|
3269
|
+
"name": "should focus on the last button"
|
|
3270
|
+
}
|
|
3271
|
+
]
|
|
3272
|
+
}
|
|
3273
|
+
]
|
|
3274
|
+
}
|
|
3275
|
+
]
|
|
3276
|
+
}
|
|
3277
|
+
]
|
|
3278
|
+
}
|
|
3279
|
+
]
|
|
3280
|
+
},
|
|
2955
3281
|
{
|
|
2956
3282
|
"type": "file",
|
|
2957
3283
|
"name": "Select.spec.ts",
|
|
@@ -355,7 +355,30 @@ text with built-in support for our Canvas type tokens.
|
|
|
355
355
|
|
|
356
356
|
### Segmented Control (Preview)
|
|
357
357
|
|
|
358
|
-
|
|
358
|
+
Redesigned Segmented Control has been added to
|
|
359
|
+
[Preview package](https://github.com/Workday/canvas-kit/pull/1819). The main functionality change
|
|
360
|
+
between this component and one from main package is supporting a text variants of buttons. The
|
|
361
|
+
component has a new design that aligns to the Canvas Kit system.
|
|
362
|
+
|
|
363
|
+
Some key aspects of the component to note include:
|
|
364
|
+
|
|
365
|
+
- Usage: Best used for switching between different views of the same content. Use Tabs for switching
|
|
366
|
+
between content that is related but not the same. Segments are mutually exclusive and can contain
|
|
367
|
+
text and/or icons.
|
|
368
|
+
- Shape: The component will continue to feature squared corners to visually distinguish these
|
|
369
|
+
controls and their purpose from standard buttons.
|
|
370
|
+
- Color: Active/selected segment is white, French Vanilla 100 with a gray, Licorice 200 border
|
|
371
|
+
against a light gray, Soap 200 container to make these controls less prominent than standard
|
|
372
|
+
buttons.
|
|
373
|
+
- Tooltips: Canvas Tooltips showing text labels will be added for Icon-only variants to improve
|
|
374
|
+
accessibility for ambiguous icons.
|
|
375
|
+
- Container: A container around the Segmented Control component has been added. Since it will be
|
|
376
|
+
released as a net-new component in Preview and no updates will be made to the current Segmented
|
|
377
|
+
Control component in the main package for v8, this update will not impact design or development.
|
|
378
|
+
|
|
379
|
+
Since it is a net-new component in the preview package and no updates will be made to the current
|
|
380
|
+
Segmented Control component in the main package for v8, this update will not impact design or
|
|
381
|
+
development.
|
|
359
382
|
|
|
360
383
|
---
|
|
361
384
|
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
|
|
2
|
+
import {Specifications} from '@workday/canvas-kit-docs';
|
|
3
|
+
|
|
4
|
+
import Basic from './examples/Basic';
|
|
5
|
+
import Disabled from './examples/Disabled';
|
|
6
|
+
import TextAndIcon from './examples/TextAndIcon';
|
|
7
|
+
import TextOnly from './examples/TextOnly';
|
|
8
|
+
import Sizes from './examples/Sizes';
|
|
9
|
+
import Vertical from './examples/Vertical';
|
|
10
|
+
import RTL from './examples/RTL';
|
|
11
|
+
import Dynamic from './examples/Dynamic';
|
|
12
|
+
import {
|
|
13
|
+
SegmentedControlModelConfigComponent,
|
|
14
|
+
SegmentedControlStateComponent,
|
|
15
|
+
SegmentedControlEventsComponent,
|
|
16
|
+
} from './SegmentedControlModel.splitprops.tsx';
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# Canvas Kit Segmented Control
|
|
20
|
+
|
|
21
|
+
Segmented Control is a
|
|
22
|
+
[compound component](/getting-started/for-developers/resources/compound-components/) that represents
|
|
23
|
+
a linear group of two, three or four buttons allowing the selection of a specific value. This is a
|
|
24
|
+
controlled component.
|
|
25
|
+
|
|
26
|
+
[> Workday Design Reference](https://design.workday.com/components/buttons/action-bar)
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
yarn add @workday/canvas-kit-preview-react
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
### Basic Example
|
|
37
|
+
|
|
38
|
+
In a basic example of a `SegmentedControl` there are four icon buttons in group. Each button is
|
|
39
|
+
paired with a tooltip to explain the button function in text. Default values of `SegmentedControl`
|
|
40
|
+
are specified for size (as `medium`) and orientation (as `horizontal`). All buttons should have the
|
|
41
|
+
same type and only one of them can be active at a time.
|
|
42
|
+
|
|
43
|
+
`SegmentedControl` includes a container `SegmentedControl` component and the following
|
|
44
|
+
subcomponents: `SegmentedControl.List` which contains a `SegmentedControl.Item`.
|
|
45
|
+
|
|
46
|
+
<ExampleCodeBlock code={Basic} />
|
|
47
|
+
|
|
48
|
+
### Variations Example
|
|
49
|
+
|
|
50
|
+
`SegmentedControl` can be used with diferent buttons: text only, text with icon or icon only.
|
|
51
|
+
|
|
52
|
+
#### Text And Icon
|
|
53
|
+
|
|
54
|
+
<ExampleCodeBlock code={TextAndIcon} />
|
|
55
|
+
|
|
56
|
+
#### Text Only
|
|
57
|
+
|
|
58
|
+
<ExampleCodeBlock code={TextOnly} />
|
|
59
|
+
|
|
60
|
+
#### Icon Only (vertical)
|
|
61
|
+
|
|
62
|
+
`SegmentedControl` icon only buttons can be placed horizontally or vertically. Be aware that
|
|
63
|
+
vertical orientation must be used only for icon only buttons.
|
|
64
|
+
|
|
65
|
+
<ExampleCodeBlock code={Vertical} />
|
|
66
|
+
|
|
67
|
+
### Sizes Example
|
|
68
|
+
|
|
69
|
+
`SegmentedControl` has three different size: `small`, `medium` (default size) and `large`.
|
|
70
|
+
|
|
71
|
+
<ExampleCodeBlock code={Sizes} />
|
|
72
|
+
|
|
73
|
+
### Disabled Example
|
|
74
|
+
|
|
75
|
+
`SegmentedControl`can be disabled by adding`disabled` prop to the whole container. This will disable
|
|
76
|
+
all buttons.
|
|
77
|
+
|
|
78
|
+
<ExampleCodeBlock code={Disabled} />
|
|
79
|
+
|
|
80
|
+
### RTL Example
|
|
81
|
+
|
|
82
|
+
`SegmentedControl` supports right-to-left languages when specified in the `CanvasProvider` `theme`.
|
|
83
|
+
|
|
84
|
+
<ExampleCodeBlock code={RTL} />
|
|
85
|
+
|
|
86
|
+
### Dynamic Items Example
|
|
87
|
+
|
|
88
|
+
The `SegmentedControl.Item` component takes in an optional `index` property if you want to specify
|
|
89
|
+
the position of a button. If not defined, by default it will append items to the end. In this
|
|
90
|
+
example, our items are stored as an array in the state.
|
|
91
|
+
|
|
92
|
+
<ExampleCodeBlock code={Dynamic} />
|
|
93
|
+
|
|
94
|
+
## Components
|
|
95
|
+
|
|
96
|
+
### SegmentedControl
|
|
97
|
+
|
|
98
|
+
#### Usage
|
|
99
|
+
|
|
100
|
+
`SegmentedControl` is a container component that is responsible for creating a
|
|
101
|
+
`SegmentedControlModel` and sharing it with its subcomponents using React context. It does not
|
|
102
|
+
represent a real element.
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
<SegmentedControl items={[]}>{/* Child components */}</SegmentedControl>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Alternatively, you may pass in a model using the hoisted model pattern.
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
const model = useSegmentedControlModel({
|
|
112
|
+
items: [],
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
<SegmentedControl model={model}>{/* Child components */}</SegmentedControl>;
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
#### Props
|
|
119
|
+
|
|
120
|
+
Note that if you pass in a `model` configured with `useSegmentedControlModel`, configuration props
|
|
121
|
+
passed to `SegmentedControl` will be ignored.
|
|
122
|
+
|
|
123
|
+
<ArgsTable of={SegmentedControl} />
|
|
124
|
+
|
|
125
|
+
### SegmentedControl.List
|
|
126
|
+
|
|
127
|
+
#### Usage
|
|
128
|
+
|
|
129
|
+
`SegmentedControl.List` is a `Stack` element. It is a container for `SegmentedControl.Item`
|
|
130
|
+
subcomponents.
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
<SegmentedControl.List>{/* SegmentedControl.Items */}</SegmentedControl.List>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### Props
|
|
137
|
+
|
|
138
|
+
`SegmentedControl.List` requires to set `aria-label` prop. Undocumented props are spread to the
|
|
139
|
+
underlying `Stack` element.
|
|
140
|
+
|
|
141
|
+
<ArgsTable of={SegmentedControl.List} />
|
|
142
|
+
|
|
143
|
+
### SegmentedControl.Item
|
|
144
|
+
|
|
145
|
+
#### Usage
|
|
146
|
+
|
|
147
|
+
`SegmentedControl.Item` is a `button` element built on `BaseButton`. `SegmentedControl.Item` has
|
|
148
|
+
`data-id` prop to handle `onSelect` properly.
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
<SegmentedControl.Item data-id="table">Table</SegmentedControl.Item>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
#### Props
|
|
155
|
+
|
|
156
|
+
Undocumented props are spread to the underlying `BaseButton` component.
|
|
157
|
+
|
|
158
|
+
<ArgsTable of={SegmentedControl.Item} />
|
|
159
|
+
|
|
160
|
+
## Model
|
|
161
|
+
|
|
162
|
+
If `SegmentedControl` was stripped of all its markup, attributes, and styling, what would remain is
|
|
163
|
+
the [model](/getting-started/for-developers/resources/compound-components/#models). The model is an
|
|
164
|
+
object composed of two parts: `state` which describes the current snapshot in time of the component
|
|
165
|
+
and `events` which describes events that can be sent to the model.
|
|
166
|
+
|
|
167
|
+
By default, `SegmentedControl` will create a model and share it internally with its subcomponents
|
|
168
|
+
using React context. Alternatively, if you need direct access to the model's `state` and `events`
|
|
169
|
+
outside of the `SegmentedControl` component, you may configure your own model with
|
|
170
|
+
`useSegmentedControlModel` and pass it to `SegmentedControl` via a pattern called
|
|
171
|
+
[hoisting the model](/getting-started/for-developers/resources/compound-components/#configuring-a-model).
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
const model = useSegmentedControlModel({
|
|
175
|
+
items: [],
|
|
176
|
+
initialValue: 'table',
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
<SegmentedControl model={model}>{/* Child components */}</SegmentedControl>;
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Config
|
|
183
|
+
|
|
184
|
+
`useSegmentedControlModel` accepts a configuration object with the following properties and returns
|
|
185
|
+
a `SegmentedControlModel` with `state` and `events` properties.
|
|
186
|
+
|
|
187
|
+
<ArgsTable of={SegmentedControlModelConfigComponent} />
|
|
188
|
+
|
|
189
|
+
### State
|
|
190
|
+
|
|
191
|
+
The `SegmentedControlModel` `state` is an object with the following properties.
|
|
192
|
+
|
|
193
|
+
<ArgsTable of={SegmentedControlStateComponent} />
|
|
194
|
+
|
|
195
|
+
### Events
|
|
196
|
+
|
|
197
|
+
The `SegmentedControlModel` `events` is an object with the following properties.
|
|
198
|
+
|
|
199
|
+
<ArgsTable of={SegmentedControlEventsComponent} />
|
|
200
|
+
|
|
201
|
+
## Specifications
|
|
202
|
+
|
|
203
|
+
<Specifications file="SegmentedControl.spec.ts" name="SegmentedControl" />
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {useSegmentedControlModel} from '@workday/canvas-kit-preview-react/segmented-control';
|
|
3
|
+
|
|
4
|
+
type SegmentedControlModelConfig = Partial<typeof useSegmentedControlModel.defaultConfig> &
|
|
5
|
+
typeof useSegmentedControlModel.requiredConfig;
|
|
6
|
+
type Model = ReturnType<typeof useSegmentedControlModel>;
|
|
7
|
+
|
|
8
|
+
export const SegmentedControlModelConfigComponent = (_: SegmentedControlModelConfig) => <div />;
|
|
9
|
+
export const SegmentedControlStateComponent = (_: Model['state']) => <div />;
|
|
10
|
+
export const SegmentedControlEventsComponent = (_: Model['events']) => <div />;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
|
|
3
|
+
import {
|
|
4
|
+
gridIcon,
|
|
5
|
+
listViewIcon,
|
|
6
|
+
listDetailIcon,
|
|
7
|
+
pieChartIcon,
|
|
8
|
+
} from '@workday/canvas-system-icons-web';
|
|
9
|
+
|
|
10
|
+
export default () => (
|
|
11
|
+
<SegmentedControl>
|
|
12
|
+
<SegmentedControl.List aria-label="View type">
|
|
13
|
+
<SegmentedControl.Item data-id="table" icon={gridIcon} tooltipProps={{title: 'Table'}} />
|
|
14
|
+
<SegmentedControl.Item
|
|
15
|
+
data-id="list-view"
|
|
16
|
+
icon={listViewIcon}
|
|
17
|
+
tooltipProps={{title: 'List'}}
|
|
18
|
+
/>
|
|
19
|
+
<SegmentedControl.Item
|
|
20
|
+
data-id="list-detail"
|
|
21
|
+
icon={listDetailIcon}
|
|
22
|
+
tooltipProps={{title: 'Detail'}}
|
|
23
|
+
/>
|
|
24
|
+
<SegmentedControl.Item
|
|
25
|
+
data-id="diagrams"
|
|
26
|
+
icon={pieChartIcon}
|
|
27
|
+
tooltipProps={{title: 'Diagram'}}
|
|
28
|
+
/>
|
|
29
|
+
</SegmentedControl.List>
|
|
30
|
+
</SegmentedControl>
|
|
31
|
+
);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
|
|
3
|
+
import {
|
|
4
|
+
gridIcon,
|
|
5
|
+
listViewIcon,
|
|
6
|
+
listDetailIcon,
|
|
7
|
+
pieChartIcon,
|
|
8
|
+
} from '@workday/canvas-system-icons-web';
|
|
9
|
+
|
|
10
|
+
export default () => (
|
|
11
|
+
<SegmentedControl disabled>
|
|
12
|
+
<SegmentedControl.List aria-label="View type">
|
|
13
|
+
<SegmentedControl.Item data-id="table" icon={gridIcon} tooltipProps={{title: 'Table'}} />
|
|
14
|
+
<SegmentedControl.Item
|
|
15
|
+
data-id="list-view"
|
|
16
|
+
icon={listViewIcon}
|
|
17
|
+
tooltipProps={{title: 'List'}}
|
|
18
|
+
/>
|
|
19
|
+
<SegmentedControl.Item
|
|
20
|
+
data-id="list-detail"
|
|
21
|
+
icon={listDetailIcon}
|
|
22
|
+
tooltipProps={{title: 'Detail'}}
|
|
23
|
+
/>
|
|
24
|
+
<SegmentedControl.Item
|
|
25
|
+
data-id="diagrams"
|
|
26
|
+
icon={pieChartIcon}
|
|
27
|
+
tooltipProps={{title: 'Diagram'}}
|
|
28
|
+
/>
|
|
29
|
+
</SegmentedControl.List>
|
|
30
|
+
</SegmentedControl>
|
|
31
|
+
);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
SegmentedControl,
|
|
4
|
+
useSegmentedControlModel,
|
|
5
|
+
} from '@workday/canvas-kit-preview-react/segmented-control';
|
|
6
|
+
import {
|
|
7
|
+
gridIcon,
|
|
8
|
+
listViewIcon,
|
|
9
|
+
listDetailIcon,
|
|
10
|
+
pieChartIcon,
|
|
11
|
+
} from '@workday/canvas-system-icons-web';
|
|
12
|
+
|
|
13
|
+
export default () => {
|
|
14
|
+
const [viewType, setViewType] = React.useState('table');
|
|
15
|
+
|
|
16
|
+
const model = useSegmentedControlModel({
|
|
17
|
+
items: [
|
|
18
|
+
{id: 'table', icon: gridIcon, label: 'Table'},
|
|
19
|
+
{id: 'list', icon: listViewIcon, label: 'List'},
|
|
20
|
+
{id: 'detail', icon: listDetailIcon, label: 'Detail'},
|
|
21
|
+
{id: 'diagram', icon: pieChartIcon, label: 'Diagram'},
|
|
22
|
+
],
|
|
23
|
+
size: 'small',
|
|
24
|
+
initialValue: viewType,
|
|
25
|
+
onSelect: data => {
|
|
26
|
+
console.log(`${data.id} is selected`);
|
|
27
|
+
setViewType(data.id);
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<SegmentedControl model={model}>
|
|
33
|
+
<SegmentedControl.List aria-label="View type">
|
|
34
|
+
{item => (
|
|
35
|
+
<SegmentedControl.Item data-id={item.id} icon={item.icon}>
|
|
36
|
+
{item.label}
|
|
37
|
+
</SegmentedControl.Item>
|
|
38
|
+
)}
|
|
39
|
+
</SegmentedControl.List>
|
|
40
|
+
</SegmentedControl>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {CanvasProvider, ContentDirection} from '@workday/canvas-kit-react/common';
|
|
3
|
+
import {
|
|
4
|
+
gridIcon,
|
|
5
|
+
listViewIcon,
|
|
6
|
+
listDetailIcon,
|
|
7
|
+
pieChartIcon,
|
|
8
|
+
} from '@workday/canvas-system-icons-web';
|
|
9
|
+
import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
|
|
10
|
+
|
|
11
|
+
export default () => (
|
|
12
|
+
<CanvasProvider theme={{canvas: {direction: ContentDirection.RTL}}}>
|
|
13
|
+
<SegmentedControl initialValue="list-detail">
|
|
14
|
+
<SegmentedControl.List aria-label="View type">
|
|
15
|
+
<SegmentedControl.Item data-id="table" icon={gridIcon}>
|
|
16
|
+
שולחן
|
|
17
|
+
</SegmentedControl.Item>
|
|
18
|
+
<SegmentedControl.Item data-id="list-view" icon={listViewIcon}>
|
|
19
|
+
רשימה
|
|
20
|
+
</SegmentedControl.Item>
|
|
21
|
+
<SegmentedControl.Item data-id="list-detail" icon={listDetailIcon}>
|
|
22
|
+
פרטים
|
|
23
|
+
</SegmentedControl.Item>
|
|
24
|
+
<SegmentedControl.Item data-id="diagrams" icon={pieChartIcon}>
|
|
25
|
+
תרשים
|
|
26
|
+
</SegmentedControl.Item>
|
|
27
|
+
</SegmentedControl.List>
|
|
28
|
+
</SegmentedControl>
|
|
29
|
+
</CanvasProvider>
|
|
30
|
+
);
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Box} from '@workday/canvas-kit-react/layout';
|
|
3
|
+
import {
|
|
4
|
+
gridIcon,
|
|
5
|
+
listViewIcon,
|
|
6
|
+
listDetailIcon,
|
|
7
|
+
pieChartIcon,
|
|
8
|
+
} from '@workday/canvas-system-icons-web';
|
|
9
|
+
import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
|
|
10
|
+
import {BodyText} from '@workday/canvas-kit-react/text';
|
|
11
|
+
|
|
12
|
+
export default () => (
|
|
13
|
+
<>
|
|
14
|
+
<Box marginBottom="xxs">
|
|
15
|
+
<BodyText size="medium" fontWeight="bold">
|
|
16
|
+
Small
|
|
17
|
+
</BodyText>
|
|
18
|
+
<SegmentedControl size="small">
|
|
19
|
+
<SegmentedControl.List aria-label="View type">
|
|
20
|
+
<SegmentedControl.Item data-id="table" icon={gridIcon}>
|
|
21
|
+
Table
|
|
22
|
+
</SegmentedControl.Item>
|
|
23
|
+
<SegmentedControl.Item data-id="list-view" icon={listViewIcon}>
|
|
24
|
+
List
|
|
25
|
+
</SegmentedControl.Item>
|
|
26
|
+
<SegmentedControl.Item data-id="list-detail" icon={listDetailIcon}>
|
|
27
|
+
Detail
|
|
28
|
+
</SegmentedControl.Item>
|
|
29
|
+
<SegmentedControl.Item data-id="diagrams" icon={pieChartIcon}>
|
|
30
|
+
Diagram
|
|
31
|
+
</SegmentedControl.Item>
|
|
32
|
+
</SegmentedControl.List>
|
|
33
|
+
</SegmentedControl>
|
|
34
|
+
</Box>
|
|
35
|
+
<Box>
|
|
36
|
+
<BodyText size="medium" fontWeight="bold">
|
|
37
|
+
Medium
|
|
38
|
+
</BodyText>
|
|
39
|
+
<SegmentedControl size="medium">
|
|
40
|
+
<SegmentedControl.List aria-label="View type">
|
|
41
|
+
<SegmentedControl.Item data-id="table" icon={gridIcon}>
|
|
42
|
+
Table
|
|
43
|
+
</SegmentedControl.Item>
|
|
44
|
+
<SegmentedControl.Item data-id="list-view" icon={listViewIcon}>
|
|
45
|
+
List
|
|
46
|
+
</SegmentedControl.Item>
|
|
47
|
+
<SegmentedControl.Item data-id="list-detail" icon={listDetailIcon}>
|
|
48
|
+
Detail
|
|
49
|
+
</SegmentedControl.Item>
|
|
50
|
+
<SegmentedControl.Item data-id="diagrams" icon={pieChartIcon}>
|
|
51
|
+
Diagram
|
|
52
|
+
</SegmentedControl.Item>
|
|
53
|
+
</SegmentedControl.List>
|
|
54
|
+
</SegmentedControl>
|
|
55
|
+
</Box>
|
|
56
|
+
<Box>
|
|
57
|
+
<BodyText size="medium" fontWeight="bold">
|
|
58
|
+
Large
|
|
59
|
+
</BodyText>
|
|
60
|
+
<SegmentedControl size="large">
|
|
61
|
+
<SegmentedControl.List aria-label="Content view type">
|
|
62
|
+
<SegmentedControl.Item data-id="table" icon={gridIcon}>
|
|
63
|
+
Table
|
|
64
|
+
</SegmentedControl.Item>
|
|
65
|
+
<SegmentedControl.Item data-id="list-view" icon={listViewIcon}>
|
|
66
|
+
List
|
|
67
|
+
</SegmentedControl.Item>
|
|
68
|
+
<SegmentedControl.Item data-id="list-detail" icon={listDetailIcon}>
|
|
69
|
+
Detail
|
|
70
|
+
</SegmentedControl.Item>
|
|
71
|
+
<SegmentedControl.Item data-id="diagrams" icon={pieChartIcon}>
|
|
72
|
+
Diagram
|
|
73
|
+
</SegmentedControl.Item>
|
|
74
|
+
</SegmentedControl.List>
|
|
75
|
+
</SegmentedControl>
|
|
76
|
+
</Box>
|
|
77
|
+
</>
|
|
78
|
+
);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {gridIcon, listViewIcon, pieChartIcon} from '@workday/canvas-system-icons-web';
|
|
3
|
+
import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
|
|
4
|
+
|
|
5
|
+
export default () => (
|
|
6
|
+
<SegmentedControl>
|
|
7
|
+
<SegmentedControl.List aria-label="View type">
|
|
8
|
+
<SegmentedControl.Item data-id="table" icon={gridIcon}>
|
|
9
|
+
Table
|
|
10
|
+
</SegmentedControl.Item>
|
|
11
|
+
<SegmentedControl.Item data-id="list" icon={listViewIcon}>
|
|
12
|
+
List
|
|
13
|
+
</SegmentedControl.Item>
|
|
14
|
+
<SegmentedControl.Item data-id="diagram" icon={pieChartIcon}>
|
|
15
|
+
Diagram
|
|
16
|
+
</SegmentedControl.Item>
|
|
17
|
+
</SegmentedControl.List>
|
|
18
|
+
</SegmentedControl>
|
|
19
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
|
|
3
|
+
|
|
4
|
+
export default () => (
|
|
5
|
+
<SegmentedControl>
|
|
6
|
+
<SegmentedControl.List aria-label="View type">
|
|
7
|
+
<SegmentedControl.Item data-id="table">Table</SegmentedControl.Item>
|
|
8
|
+
<SegmentedControl.Item data-id="list">List</SegmentedControl.Item>
|
|
9
|
+
<SegmentedControl.Item data-id="diagram">Diagram</SegmentedControl.Item>
|
|
10
|
+
</SegmentedControl.List>
|
|
11
|
+
</SegmentedControl>
|
|
12
|
+
);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
|
|
3
|
+
import {
|
|
4
|
+
gridIcon,
|
|
5
|
+
listViewIcon,
|
|
6
|
+
listDetailIcon,
|
|
7
|
+
pieChartIcon,
|
|
8
|
+
} from '@workday/canvas-system-icons-web';
|
|
9
|
+
|
|
10
|
+
export default () => (
|
|
11
|
+
<SegmentedControl orientation="vertical">
|
|
12
|
+
<SegmentedControl.List aria-label="View type">
|
|
13
|
+
<SegmentedControl.Item data-id="table" icon={gridIcon} tooltipProps={{title: 'Table'}} />
|
|
14
|
+
<SegmentedControl.Item
|
|
15
|
+
data-id="list-view"
|
|
16
|
+
icon={listViewIcon}
|
|
17
|
+
tooltipProps={{title: 'List'}}
|
|
18
|
+
/>
|
|
19
|
+
<SegmentedControl.Item
|
|
20
|
+
data-id="list-detail"
|
|
21
|
+
icon={listDetailIcon}
|
|
22
|
+
tooltipProps={{title: 'Detail'}}
|
|
23
|
+
/>
|
|
24
|
+
<SegmentedControl.Item
|
|
25
|
+
data-id="diagram"
|
|
26
|
+
icon={pieChartIcon}
|
|
27
|
+
tooltipProps={{title: 'Diagram'}}
|
|
28
|
+
/>
|
|
29
|
+
</SegmentedControl.List>
|
|
30
|
+
</SegmentedControl>
|
|
31
|
+
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.237-next.8+1ef11282",
|
|
4
4
|
"description": "Documentation components of Canvas Kit components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@storybook/csf": "0.0.1",
|
|
45
|
-
"@workday/canvas-kit-react": "^8.0.0-alpha.
|
|
45
|
+
"@workday/canvas-kit-react": "^8.0.0-alpha.237-next.8+1ef11282"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"fs-extra": "^10.0.0",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"mkdirp": "^1.0.3",
|
|
51
51
|
"typescript": "4.1"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "1ef1128221ebca60befb34f81a02546d3abbb7e9"
|
|
54
54
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import Basic from './examples/SegmentControlWithText';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
# Canvas Kit Examples
|
|
5
|
-
|
|
6
|
-
## SegmentControl With Text
|
|
7
|
-
|
|
8
|
-
As of `v7`, IconButton was removed, so SegmentControl was changed to support new buttons with
|
|
9
|
-
icon only. This example shows how you use SegmentControl with text until CK
|
|
10
|
-
starts supporting text in SegmentControl buttons. If you'd like to follow along, we have an [open issue](https://github.com/Workday/canvas-kit/issues/207) to enhance the SegmentedControl
|
|
11
|
-
|
|
12
|
-
<ExampleCodeBlock code={Basic} />
|