diff --git a/.editorconfig b/.editorconfig index 3ce9044524..409a2dd74a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,4 +8,4 @@ end_of_line = lf indent_size = 2 indent_style = space insert_final_newline = true -trim_trailing_whitespace = true +trim_trailing_whitespace = true \ No newline at end of file diff --git a/design-system/src/theme-provider.tsx b/design-system/src/theme-provider.tsx index 7b1b608584..1a3fb96261 100644 --- a/design-system/src/theme-provider.tsx +++ b/design-system/src/theme-provider.tsx @@ -65,13 +65,17 @@ const applyTheme = ({ }; type ThemeProviderProps = { - parentSelector: typeof defaultParentSelector; - theme: string; + parentSelector?: typeof defaultParentSelector; + theme?: string; themeOverrides?: Record; }; -const ThemeProvider = (props: ThemeProviderProps) => { - const parentSelectorRef = useRef(props.parentSelector); +const ThemeProvider = ({ + parentSelector = defaultParentSelector, + theme = 'default', + ...props +}: ThemeProviderProps) => { + const parentSelectorRef = useRef(parentSelector); const themeNameRef = useRef(); const themeOverridesRef = useRef>(); @@ -80,26 +84,22 @@ const ThemeProvider = (props: ThemeProviderProps) => { // provided include a new object with the same theme overrides // (eg: users providing an inline object as prop to the ThemeProvider) if ( - themeNameRef.current !== props.theme || + themeNameRef.current !== theme || !isEqual(themeOverridesRef.current, props.themeOverrides) ) { - themeNameRef.current = props.theme; + themeNameRef.current = theme; themeOverridesRef.current = props.themeOverrides; applyTheme({ - newTheme: props.theme, + newTheme: theme, parentSelector: parentSelectorRef.current, themeOverrides: props.themeOverrides, }); } - }, [props.theme, props.themeOverrides]); + }, [theme, props.themeOverrides]); return null; }; -ThemeProvider.defaultProps = { - parentSelector: defaultParentSelector, - theme: 'default', -}; type TUseThemeResult = { theme: ThemeName; diff --git a/packages/calendar-utils/src/calendar-body/calendar-body.tsx b/packages/calendar-utils/src/calendar-body/calendar-body.tsx index 47592f159f..81807ed55f 100644 --- a/packages/calendar-utils/src/calendar-body/calendar-body.tsx +++ b/packages/calendar-utils/src/calendar-body/calendar-body.tsx @@ -79,11 +79,10 @@ export type TCalendarBody = { theme?: Theme; }; -const defaultProps: Pick = { - isClearable: true, -}; - -export const CalendarBody = (props: TCalendarBody) => { +export const CalendarBody = ({ + isClearable = true, + ...props +}: TCalendarBody) => { const [isFocused, toggleIsFocused] = useToggleState(false); const onInputFocus = props.inputProps?.onFocus; @@ -130,18 +129,29 @@ export const CalendarBody = (props: TCalendarBody) => { return ( -
+
- {!disabledOrReadOnly && props.hasSelection && props.isClearable && ( + {!disabledOrReadOnly && props.hasSelection && isClearable && ( { )}