diff --git a/.all-contributorsrc b/.all-contributorsrc index ea8e748a7295..8e35967872d8 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -165,6 +165,15 @@ "a11y" ] }, + { + "login": "erifsx", + "name": "Eric Marcoux", + "avatar_url": "https://avatars3.githubusercontent.com/u/997572?v=4", + "profile": "https://github.com/erifsx", + "contributions": [ + "code" + ] + }, { "login": "vpicone", "name": "Vince Picone", diff --git a/README.md b/README.md index a49cb7d437d8..cf749e7b7ec4 100644 --- a/README.md +++ b/README.md @@ -102,144 +102,145 @@ check out our [Contributing Guide](/.github/CONTRIBUTING.md) and our
DAK

πŸ’» πŸ“– πŸ‘€ ️️️️♿️
Josefina Mancilla

πŸ’» πŸ“– πŸ‘€ ️️️️♿️
emyarod

πŸ’» πŸ“– πŸ‘€ ️️️️♿️ -
Vince Picone

πŸ’» πŸ“– πŸ‘€ ️️️️♿️ +
Eric Marcoux

πŸ’» +
Vince Picone

πŸ’» πŸ“– πŸ‘€ ️️️️♿️
jillianhowarth

πŸ–‹ 🎨 πŸ‘€
Ricardo Henriquez

πŸ’» πŸ“– πŸ‘€ ️️️️♿️
johnbister

🎨 πŸ‘€
Dominik Brugger

πŸ’» 🚧
Jan Hassel

πŸ’» πŸ“– ️️️️♿️ 🎨
Alexander Lyon

πŸ’» -
Rosie Z

πŸ’» +
Rosie Z

πŸ’»
Nishith P

πŸ“–
Eric Charpentier

πŸ’»
Luiza Mendes

πŸ’» 🚧
Akmal Hakimi Mohd Zamri

πŸ’»
sanjitbauli

πŸ“–
Laszlo Moczo

πŸ’» -
LMapes

πŸ–‹ πŸ“– +
LMapes

πŸ–‹ πŸ“–
conradennis

🎨
Eric Liu

πŸ’» πŸ“–
Richard VΕ‘ianskΓ½

πŸ’»
Lee Chase

πŸ’» πŸ“–
Anton

πŸ’»
Panpan Lin

πŸ“– -
Ashley Harrison

πŸ’» +
Ashley Harrison

πŸ’»
Jen Downs

πŸ’» πŸ“– ️️️️♿️
Abdul Rehman

πŸ’»
MIchael Dudley

🎨
David Bradshaw

πŸ’»
Simon Finney

πŸ’» ️️️️♿️
Attila Bartha

πŸ’» -
λ°°ν•˜λžŒ

πŸ’» +
λ°°ν•˜λžŒ

πŸ’»
Yohanna Gadelrab

πŸ“–
Akira Sudoh

πŸ’» πŸ“– ️️️️♿️ πŸš‡
Oyinkan Oyetunmibi

πŸ“–
pbenson322

πŸ“–
Abbey Hart

πŸ’» πŸ“– ️️️️♿️
Lucas

πŸ’» -
Dylan Klohr

πŸ“– +
Dylan Klohr

πŸ“–
Gilli Sigurdsson

🎨
kennylam

πŸ’» ️️️️♿️
SΓ©bastien

πŸ’»
Dusan Milko

πŸ’»
Taras Polovyi

πŸ’»
Chris Connors

🎨 πŸ“– -
David Conner

πŸ’» ️️️️♿️ +
David Conner

πŸ’» ️️️️♿️
Harish Mohanani

πŸ’»
Frivalszky-Mayer PΓ©ter

πŸ’» ️️️️♿️
s100

πŸ’»
Taranveer Virk

πŸ’»
Niall Cargill

πŸ“–
Matt Chapman

πŸ’» -
Boston Cartwright

πŸ’» +
Boston Cartwright

πŸ’»
DavidSCChen

πŸ’»
molyholy

πŸ’»
Scott Dickerson

πŸ’»
Evgeniy Podgaetskiy

πŸ’»
CassidyJensen

πŸ’» ️️️️♿️
Zsolt Lattmann

πŸ’» -
Conrad Schmidt

πŸ’» +
Conrad Schmidt

πŸ’»
Ignacio Becerra

πŸ’»
Swapnil Patil

πŸ“–
Fei Z

πŸ’»
Ignas Ausiejus

πŸ“–
Ryan O. Mackey

πŸ’»
DΓ‘vid HalΓ‘sz

πŸ’» -
Bill Guigue

πŸ’» +
Bill Guigue

πŸ’»
szymonbrandys

πŸ’»
Adam Alston

πŸ“–
Krithika S Udupa

πŸ“–
Eshin Griffith

πŸ’»
@RianTavaresOn

πŸ’» 🎨
ColbyJohnIBM

πŸ’» -
HΓ₯kon

πŸ’» πŸ“– +
HΓ₯kon

πŸ’» πŸ“–
Tanner Summers

πŸ’»
Zhen Wang

πŸ’» πŸ“–
Cathal Kenneally

πŸ’»
Joel Humberto GΓ³mez Paredes

πŸ’»
James Nash

πŸ’» πŸ“–
Jakub Faliszewski

πŸ’» -
Nick Gong

πŸ’» +
Nick Gong

πŸ’»
Hannele Valtanen

πŸ’»
Llam4u

πŸ’» πŸ›
G. Torres

πŸ’»
Fiona

πŸ’»
kindoflew

πŸ’»
Mario Gueyraud

πŸ’» -
Dongjoon Lee

πŸ’» +
Dongjoon Lee

πŸ’»
ShankarV-CodeJunkie

πŸ’»
dario platania

πŸ’»
Mateusz KrzyΕΌanowski

πŸ’»
jpsorensen

πŸ’»
jae kaplan

πŸš‡
Sierra Wetmore

πŸ’» -
kcprevatt

πŸ’» +
kcprevatt

πŸ’»
Marcin Lewandowski

πŸ’»
remolueoend

πŸ’»
Jesse Hull

πŸ’» ️️️️♿️
Ashvin Warrier

πŸ’»
GalvinGao

πŸ’»
Bianca Sparxs

πŸ’» -
Mahmoud Abdulazim

πŸ’» +
Mahmoud Abdulazim

πŸ’»
Dave Steinberg

πŸ’»
Seong-Hyun Ryoo

πŸ’»
Pratik Karad

πŸ’» ️️️️♿️
Gerzon

πŸ’»
Guilherme Datilio Ribeiro

πŸ’» πŸ“– ️️️️♿️ πŸ‘€
Josef Kubíček

πŸ’» -
Sunny Johal

πŸ’» +
Sunny Johal

πŸ’»
Steven Black

πŸ’» ️️️️♿️
Mark Judy

πŸ’»
Anton Tsymuk

πŸ’» diff --git a/packages/react/src/components/Toggle/Toggle.js b/packages/react/src/components/Toggle/Toggle.tsx similarity index 72% rename from packages/react/src/components/Toggle/Toggle.js rename to packages/react/src/components/Toggle/Toggle.tsx index f233e02393ec..d5f0c4470046 100644 --- a/packages/react/src/components/Toggle/Toggle.js +++ b/packages/react/src/components/Toggle/Toggle.tsx @@ -1,16 +1,99 @@ /** - * Copyright IBM Corp. 2021 + * Copyright IBM Corp. 2021, 2023 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ -import React, { useRef } from 'react'; +import React, { KeyboardEventHandler, MouseEventHandler, useRef } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { useControllableState } from '../../internal/useControllableState'; import { usePrefix } from '../../internal/usePrefix'; +type ExcludedAttributes = + | 'aria-labelledby' + | 'aria-checked' + | 'type' + | 'role' + | 'id' + | 'size' + | 'onClick'; + +export interface ToggleProps + extends Omit< + React.ButtonHTMLAttributes, + ExcludedAttributes + > { + /** + * Specify another element's id to be used as the label for this toggle + */ + 'aria-labelledby'?: string; + + /** + * Provide an id that unique represents the underlying `