Skip to content

Commit

Permalink
Prevent adding classname attribute for react wrapped components (#108)
Browse files Browse the repository at this point in the history
Co-authored-by: Frédéric Collonval <[email protected]>
  • Loading branch information
fcollonval and fcollonval authored Jun 25, 2024
1 parent 9d0de6f commit bbe93e8
Show file tree
Hide file tree
Showing 51 changed files with 81 additions and 39 deletions.
2 changes: 1 addition & 1 deletion packages/react-components/lib/Accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ provideJupyterDesignSystem().register(jpAccordion());

export const Accordion = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const { expandMode, ...filteredProps } = props;
const { className, expandMode, ...filteredProps } = props;

/** Event listeners - run once */
useEventListener(ref, 'change', props.onChange);
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/lib/AccordionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ provideJupyterDesignSystem().register(jpAccordionItem());

export const AccordionItem = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const { headingLevel, id, expanded, ...filteredProps } = props;
const { className, headingLevel, id, expanded, ...filteredProps } = props;

/** Event listeners - run once */
useEventListener(ref, 'change', props.onChange);
Expand Down
1 change: 1 addition & 0 deletions packages/react-components/lib/Anchor.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ provideJupyterDesignSystem().register(jpAnchor());
export const Anchor = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const {
className,
appearance,
download,
href,
Expand Down
1 change: 1 addition & 0 deletions packages/react-components/lib/AnchoredRegion.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ provideJupyterDesignSystem().register(jpAnchoredRegion());
export const AnchoredRegion = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const {
className,
horizontalViewportLock,
horizontalInset,
verticalViewportLock,
Expand Down
3 changes: 2 additions & 1 deletion packages/react-components/lib/Avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ provideJupyterDesignSystem().register(jpAvatar());

export const Avatar = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const { src, alt, fill, color, link, shape, ...filteredProps } = props;
const { className, src, alt, fill, color, link, shape, ...filteredProps } =
props;

/** Properties - run whenever a property has changed */

Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/lib/Badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ provideJupyterDesignSystem().register(jpBadge());

export const Badge = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const { fill, color, circular, ...filteredProps } = props;
const { className, fill, color, circular, ...filteredProps } = props;

/** Properties - run whenever a property has changed */
useProperties(ref, 'circular', props.circular);
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/lib/Breadcrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ provideJupyterDesignSystem().register(jpBreadcrumb());

export const Breadcrumb = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const { ...filteredProps } = props;
const { className, ...filteredProps } = props;

/** Properties - run whenever a property has changed */

Expand Down
1 change: 1 addition & 0 deletions packages/react-components/lib/BreadcrumbItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ provideJupyterDesignSystem().register(jpBreadcrumbItem());
export const BreadcrumbItem = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const {
className,
download,
href,
hreflang,
Expand Down
5 changes: 3 additions & 2 deletions packages/react-components/lib/Button.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import {
Button as ButtonElement,
type ButtonScale
type ButtonScale,
type ButtonAppearance
} from '@jupyter/web-components';

export type { ButtonElement };
export type { ButtonAppearance, ButtonElement, ButtonScale };

export interface ButtonProps
extends Omit<React.AllHTMLAttributes<HTMLElement>, 'form'> {
Expand Down
1 change: 1 addition & 0 deletions packages/react-components/lib/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ provideJupyterDesignSystem().register(jpButton());
export const Button = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const {
className,
minimal,
appearance,
form,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/lib/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ provideJupyterDesignSystem().register(jpCard());

export const Card = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const { ...filteredProps } = props;
const { className, ...filteredProps } = props;

/** Properties - run whenever a property has changed */

Expand Down
1 change: 1 addition & 0 deletions packages/react-components/lib/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ provideJupyterDesignSystem().register(jpCheckbox());
export const Checkbox = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const {
className,
readonly,
readOnly,
indeterminate,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/lib/Combobox.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
type ComboboxScale
} from '@jupyter/web-components';

export type { ComboboxElement };
export type { ComboboxElement, ComboboxScale };

export interface ComboboxProps
extends Omit<React.AllHTMLAttributes<HTMLElement>, 'onChange' | 'onInput'> {
Expand Down
8 changes: 2 additions & 6 deletions packages/react-components/lib/Combobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@ import {
jpCombobox,
provideJupyterDesignSystem
} from '@jupyter/web-components';
import React, {
forwardRef,
useEffect,
useImperativeHandle,
useRef
} from 'react';
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
import { useEventListener, useProperties } from './react-utils.js';
provideJupyterDesignSystem().register(jpCombobox());

export const Combobox = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const {
className,
autowidth,
minimal,
open,
Expand Down
1 change: 1 addition & 0 deletions packages/react-components/lib/DataGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ provideJupyterDesignSystem().register(jpDataGrid());
export const DataGrid = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const {
className,
noTabbing,
generateHeader,
gridTemplateColumns,
Expand Down
10 changes: 8 additions & 2 deletions packages/react-components/lib/DataGridCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ provideJupyterDesignSystem().register(jpDataGridCell());

export const DataGridCell = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const { cellType, gridColumn, rowData, columnDefinition, ...filteredProps } =
props;
const {
className,
cellType,
gridColumn,
rowData,
columnDefinition,
...filteredProps
} = props;

/** Event listeners - run once */
useEventListener(ref, 'cell-focused', props.onCellFocused);
Expand Down
1 change: 1 addition & 0 deletions packages/react-components/lib/DataGridRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ provideJupyterDesignSystem().register(jpDataGridRow());
export const DataGridRow = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const {
className,
gridTemplateColumns,
rowType,
rowData,
Expand Down
12 changes: 10 additions & 2 deletions packages/react-components/lib/DateField.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,16 @@ provideJupyterDesignSystem().register(jpDateField());

export const DateField = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const { autofocus, step, max, min, disabled, required, ...filteredProps } =
props;
const {
className,
autofocus,
step,
max,
min,
disabled,
required,
...filteredProps
} = props;

/** Event listeners - run once */
useEventListener(ref, 'input', props.onInput);
Expand Down
1 change: 1 addition & 0 deletions packages/react-components/lib/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ provideJupyterDesignSystem().register(jpDialog());
export const Dialog = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const {
className,
trapFocus,
ariaDescribedby,
ariaLabelledby,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/lib/Disclosure.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ provideJupyterDesignSystem().register(jpDisclosure());

export const Disclosure = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const { appearance, title, expanded, ...filteredProps } = props;
const { className, appearance, title, expanded, ...filteredProps } = props;

/** Event listeners - run once */
useEventListener(ref, 'toggle', props.onToggle);
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/lib/Divider.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ provideJupyterDesignSystem().register(jpDivider());

export const Divider = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const { role, orientation, ...filteredProps } = props;
const { className, role, orientation, ...filteredProps } = props;

/** Properties - run whenever a property has changed */

Expand Down
1 change: 1 addition & 0 deletions packages/react-components/lib/Listbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ provideJupyterDesignSystem().register(jpListbox());
export const Listbox = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const {
className,
multiple,
size,
length,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/lib/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ provideJupyterDesignSystem().register(jpMenu());

export const Menu = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const { ...filteredProps } = props;
const { className, ...filteredProps } = props;

/** Properties - run whenever a property has changed */

Expand Down
3 changes: 2 additions & 1 deletion packages/react-components/lib/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ provideJupyterDesignSystem().register(jpMenuItem());

export const MenuItem = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const { role, disabled, expanded, checked, ...filteredProps } = props;
const { className, role, disabled, expanded, checked, ...filteredProps } =
props;

/** Event listeners - run once */
useEventListener(ref, 'expanded-change', props.onExpand);
Expand Down
1 change: 1 addition & 0 deletions packages/react-components/lib/NumberField.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ provideJupyterDesignSystem().register(jpNumberField());
export const NumberField = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const {
className,
readonly,
hideStep,
appearance,
Expand Down
1 change: 1 addition & 0 deletions packages/react-components/lib/Option.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ provideJupyterDesignSystem().register(jpOption());
export const Option = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const {
className,
selected,
value,
checked,
Expand Down
1 change: 1 addition & 0 deletions packages/react-components/lib/Picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ provideJupyterDesignSystem().register(jpPicker());
export const Picker = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const {
className,
filterSelected,
filterQuery,
selection,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/lib/PickerList.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ provideJupyterDesignSystem().register(jpPickerList());

export const PickerList = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const { ...filteredProps } = props;
const { className, ...filteredProps } = props;

/** Properties - run whenever a property has changed */

Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/lib/PickerListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ provideJupyterDesignSystem().register(jpPickerListItem());

export const PickerListItem = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const { value, contentsTemplate, ...filteredProps } = props;
const { className, value, contentsTemplate, ...filteredProps } = props;

/** Properties - run whenever a property has changed */
useProperties(ref, 'contentsTemplate', props.contentsTemplate);
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/lib/PickerMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ provideJupyterDesignSystem().register(jpPickerMenu());

export const PickerMenu = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const { suggestionsAvailableText, ...filteredProps } = props;
const { className, suggestionsAvailableText, ...filteredProps } = props;

/** Properties - run whenever a property has changed */
useProperties(
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/lib/PickerMenuOption.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ provideJupyterDesignSystem().register(jpPickerMenuOption());

export const PickerMenuOption = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const { value, contentsTemplate, ...filteredProps } = props;
const { className, value, contentsTemplate, ...filteredProps } = props;

/** Properties - run whenever a property has changed */
useProperties(ref, 'contentsTemplate', props.contentsTemplate);
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/lib/Progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ provideJupyterDesignSystem().register(jpProgress());

export const Progress = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const { value, min, max, paused, ...filteredProps } = props;
const { className, value, min, max, paused, ...filteredProps } = props;

/** Properties - run whenever a property has changed */
useProperties(ref, 'value', props.value);
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/lib/ProgressRing.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ provideJupyterDesignSystem().register(jpProgressRing());

export const ProgressRing = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const { value, min, max, paused, ...filteredProps } = props;
const { className, value, min, max, paused, ...filteredProps } = props;

/** Properties - run whenever a property has changed */
useProperties(ref, 'value', props.value);
Expand Down
1 change: 1 addition & 0 deletions packages/react-components/lib/Radio.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ provideJupyterDesignSystem().register(jpRadio());
export const Radio = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const {
className,
readonly,
readOnly,
name,
Expand Down
1 change: 1 addition & 0 deletions packages/react-components/lib/RadioGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ provideJupyterDesignSystem().register(jpRadioGroup());
export const RadioGroup = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const {
className,
readonly,
disabled,
name,
Expand Down
1 change: 1 addition & 0 deletions packages/react-components/lib/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ provideJupyterDesignSystem().register(jpSearch());
export const Search = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const {
className,
readonly,
appearance,
placeholder,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/lib/Select.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
type SelectScale
} from '@jupyter/web-components';

export type { SelectElement };
export type { SelectElement, SelectScale };

export interface SelectProps
extends Omit<
Expand Down
1 change: 1 addition & 0 deletions packages/react-components/lib/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ provideJupyterDesignSystem().register(jpSelect());
export const Select = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const {
className,
autowidth,
minimal,
open,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/lib/Skeleton.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ provideJupyterDesignSystem().register(jpSkeleton());

export const Skeleton = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const { fill, shape, pattern, shimmer, ...filteredProps } = props;
const { className, fill, shape, pattern, shimmer, ...filteredProps } = props;

/** Properties - run whenever a property has changed */
useProperties(ref, 'shimmer', props.shimmer);
Expand Down
1 change: 1 addition & 0 deletions packages/react-components/lib/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ provideJupyterDesignSystem().register(jpSlider());
export const Slider = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const {
className,
readonly,
orientation,
mode,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/lib/SliderLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ provideJupyterDesignSystem().register(jpSliderLabel());

export const SliderLabel = forwardRef((props, forwardedRef) => {
const ref = useRef(null);
const { hideMark, disabled, position, ...filteredProps } = props;
const { className, hideMark, disabled, position, ...filteredProps } = props;

/** Properties - run whenever a property has changed */

Expand Down
Loading

0 comments on commit bbe93e8

Please sign in to comment.