Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.3.1 #218

Merged
merged 21 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Using Force UI as a dependency in package.json -

```json
"dependencies": {
"@bsf/force-ui": "git+https://github.com/brainstormforce/force-ui#1.3.0"
"@bsf/force-ui": "git+https://github.com/brainstormforce/force-ui#1.3.1"
}
```

Expand All @@ -28,7 +28,7 @@ npm install
Or you can directly run the following command to install the package -

```bash
npm i -S @bsf/force-ui@git+https://github.com/brainstormforce/force-ui.git#1.3.0
npm i -S @bsf/force-ui@git+https://github.com/brainstormforce/force-ui.git#1.3.1
```

<br />
Expand Down
10 changes: 10 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
Version 1.3.1 - 17th December, 2024
Fixed - The underline issue to enhance visual consistency.
Fixed - Issue with the Select component where a check mark was displayed even when no item was selected.
Fixed - Design mismatch in the Switch component.
Fixed - Text, icon size, alignment, and color inconsistencies in the Date Picker to ensure a uniform appearance.
Fixed - Input ref not pointing to the input field.
Fixed - Icon size and alignment issues in the Menu component for better visual clarity.
Fixed - Sidebar height not being overridable.
Improvement - Removed backdrop blur to enhance performance and visual clarity.

Version 1.3.0 - 16th December, 2024
- New - Table component.
- Fixed - Asterisk missing on required input label.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bsf/force-ui",
"version": "1.3.0",
"version": "1.3.1",
"description": "Library of components for the BSF project",
"main": "./dist/force-ui.js",
"module": "./dist/force-ui.js",
Expand Down
34 changes: 21 additions & 13 deletions src/components/datepicker/datepicker-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,10 @@ const DatePickerComponent = ( {
onClick={ handlePrevButtonClick }
className="bg-background-primary border-none cursor-pointer"
aria-label="Previous Button"
>
<ChevronLeft className="h-4 w-4" />
</Button>
icon={
<ChevronLeft className="h-4 w-4 text-button-tertiary-color" />
}
/>

<Button
variant="ghost"
Expand All @@ -232,9 +233,10 @@ const DatePickerComponent = ( {
onClick={ handleNextButtonClick }
className="bg-background-primary border-none cursor-pointer"
aria-label="Next Button"
>
<ChevronRight className="h-4 w-4" />
</Button>
icon={
<ChevronRight className="h-4 w-4 text-button-tertiary-color" />
}
/>
</div>

{ showYearSelect && (
Expand All @@ -255,7 +257,9 @@ const DatePickerComponent = ( {
yearValue === selectedYear &&
yearValue !==
new Date().getFullYear() &&
'bg-background-brand text-text-on-color hover:bg-background-brand hover:text-black'
'bg-background-brand text-text-on-color hover:bg-background-brand hover:text-black',
yearValue === new Date().getFullYear() &&
'font-semibold'
) }
>
{ yearValue }
Expand Down Expand Up @@ -287,7 +291,11 @@ const DatePickerComponent = ( {
customMonthProps.calendarMonth.date.getFullYear() &&
customMonthProps.calendarMonth.date.getFullYear() !==
new Date().getFullYear() &&
'bg-background-brand text-text-on-color hover:bg-background-brand hover:text-black'
'bg-background-brand text-text-on-color hover:bg-background-brand hover:text-black',
monthIndex === new Date().getMonth() &&
new Date().getFullYear() ===
selectedYear &&
'font-semibold'
) }
>
{ format( new Date( 0, monthIndex ), 'MMM' ) }
Expand All @@ -312,7 +320,7 @@ const DatePickerComponent = ( {
{ weekdays.map( ( weekday, weekdayIndex ) => (
<button
key={ weekdayIndex }
className="h-10 w-10 px-1.5 py-2 text-center text-muted-foreground text-[0.8rem] font-normal content-center bg-transparent border-none"
className="h-10 w-10 px-1.5 py-2 text-center text-text-secondary text-sm font-normal content-center bg-transparent border-none shrink-0"
>
{ weekday }
</button>
Expand Down Expand Up @@ -362,7 +370,7 @@ const DatePickerComponent = ( {
'bg-transperant opacity-50 text-text-disabled cursor-auto';

const buttonClasses = cn(
'h-10 w-10 flex items-center justify-center transition text-text-secondary relative',
'h-10 w-10 flex items-center justify-center transition text-text-secondary relative text-sm',
'border-none rounded',
( isSelected || isPartOfRange ) && ( ! isOutside || isPreviousMonth )
? 'bg-background-brand text-text-on-color'
Expand All @@ -383,7 +391,7 @@ const DatePickerComponent = ( {
return (
<button
onClick={ handleClick }
className={ buttonClasses }
className={ cn( buttonClasses, isToday && 'font-semibold' ) }
disabled={ isDisabled || isOutside }
aria-label={ format( day.date, 'EEEE, MMMM do, yyyy' ) }
>
Expand Down Expand Up @@ -523,12 +531,12 @@ const DatePickerComponent = ( {
// showHead={false}
classNames={ {
months: monthsClassName,
month: 'flex flex-col p-2 gap-1 text-center border border-border-subtle rounded-md w-full',
month: 'flex flex-col p-2 gap-1 text-center w-full',
caption: 'relative flex justify-center items-center',
table: 'w-full border-separate border-spacing-0',
head_row: 'flex mb-1',
head_cell:
'text-muted-foreground rounded-md w-10 font-normal text-[0.8rem]',
'text-muted-foreground rounded-md w-10 font-normal text-sm',
row: 'flex w-full mt-2',
cell: 'h-10 w-10 text-center text-sm p-0 relative',
day: 'h-10 w-10 p-0 font-normal bg-background-primary text-current',
Expand Down
6 changes: 3 additions & 3 deletions src/components/datepicker/datepicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const DatePicker = ( {
}
footer={
isFooter && (
<div className="flex justify-end p-2 gap-3 border border-solid border-border-subtle border-t-0 rounded-md rounded-tl-none rounded-tr-none">
<div className="flex bg-background-primary justify-end p-2 gap-3 border border-solid border-border-subtle border-t-0 rounded-md rounded-tl-none rounded-tr-none">
<Button
variant="outline"
onClick={ handleCancelClick }
Expand Down Expand Up @@ -175,7 +175,7 @@ const DatePicker = ( {
variant={ variant }
width="w-auto"
footer={
<div className="flex justify-end p-2 gap-3 border border-solid border-border-subtle border-t-0 rounded-md rounded-tl-none rounded-tr-none">
<div className="flex bg-background-primary justify-end p-2 gap-3 border border-solid border-border-subtle border-t-0 rounded-md rounded-tl-none rounded-tr-none">
<Button variant="outline" onClick={ handleCancelClick }>
{ cancelButtonText }
</Button>
Expand Down Expand Up @@ -218,7 +218,7 @@ const DatePicker = ( {
width="w-auto"
numberOfMonths={ 2 }
footer={
<div className="flex justify-end p-2 gap-3 border border-solid border-border-subtle border-t-0 rounded-md rounded-tl-none rounded-tr-none">
<div className="flex justify-end p-2 gap-3 border border-solid border-border-subtle border-t-0 rounded-md rounded-tl-none rounded-tr-none bg-background-primary">
<Button
variant="outline"
onClick={ handleCancelClick }
Expand Down
2 changes: 1 addition & 1 deletion src/components/dialog/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export const DialogBackdrop = ( {
{ open && (
<motion.div
className={ cn(
'fixed inset-0 -z-10 bg-background-inverse/90 backdrop-blur-sm',
'fixed inset-0 -z-10 bg-background-inverse/90',
className
) }
{ ...props }
Expand Down
2 changes: 1 addition & 1 deletion src/components/drawer/drawer-backdrop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const DrawerBackdrop = ( { className, ...props }: DrawerBackdropProps ) => {
{ open && (
<motion.div
className={ cn(
'fixed inset-0 -z-10 bg-background-inverse/90 backdrop-blur-sm',
'fixed inset-0 -z-10 bg-background-inverse/90',
className
) }
{ ...props }
Expand Down
5 changes: 3 additions & 2 deletions src/components/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { nanoid } from 'nanoid';
import { cn } from '@/utilities/functions';
import { Upload, X } from 'lucide-react';
import Label from '../label';
import { mergeRefs } from '@/components/toaster/utils';

export declare interface InputProps {
/** Unique identifier for the input element. */
Expand Down Expand Up @@ -275,7 +276,7 @@ export const InputComponent = (
) }
>
<input
ref={ ref }
ref={ mergeRefs( inputRef, ref ) }
id={ inputId }
type="file"
className={ cn(
Expand Down Expand Up @@ -318,7 +319,7 @@ export const InputComponent = (
>
{ getPrefix() }
<input
ref={ inputRef }
ref={ mergeRefs( inputRef, ref ) }
id={ inputId }
type={ type }
className={ cn(
Expand Down
30 changes: 15 additions & 15 deletions src/components/menu-item/menu-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export const MenuList = ( {
md: 'text-sm',
}?.[ size ?? 'md' ];
const iconSizeClasses = {
sm: '[&>svg]:size-4',
md: '[&>svg]:size-5',
sm: 'size-4',
md: 'size-5',
}?.[ size ?? 'md' ];

const handleToggle = () => {
Expand Down Expand Up @@ -127,23 +127,23 @@ export const MenuList = ( {

{ arrow && (
<motion.span
variants={ arrowAnimationVariants }
animate={ isOpen ? 'open' : 'closed' }
className="flex items-center text-border-strong"
initial="hidden"
animate={ getArrowAnimationVariant() }
exit="hidden"
variants={ arrowFadeVariants }
transition={ { duration: 0.15 } }
className={ cn(
'flex items-center text-border-strong',
iconSizeClasses
) }
>
<motion.div
initial="hidden"
animate={ getArrowAnimationVariant() }
exit="hidden"
variants={ arrowFadeVariants }
<motion.span
className="inline-flex p-1"
variants={ arrowAnimationVariants }
animate={ isOpen ? 'open' : 'closed' }
transition={ { duration: 0.15 } }
>
<ChevronDown />
</motion.div>
<ChevronDown
className={ cn( 'shrink-0', iconSizeClasses ) }
/>
</motion.span>
</motion.span>
) }
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/radio-button/radio-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ export const RadioButtonComponent = (
<>
<Switch
defaultValue={ false }
size={ size === 'md' ? 'lg' : 'sm' }
size={ size }
onChange={ () => {
if ( ! multiSelection ) {
// Toggle the switch on or off
Expand Down
4 changes: 2 additions & 2 deletions src/components/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ export function SelectOptions( {

const initialSelectedValueIndex = useMemo( () => {
const currentValue = getValues();
let indexValue = 0;
let indexValue = -1;

if ( currentValue ) {
indexValue = Children.toArray( children ).findIndex(
Expand All @@ -315,7 +315,7 @@ export function SelectOptions( {
);
}

return indexValue === -1 ? 0 : indexValue;
return indexValue;
}, [ value, selected, children ] );

useLayoutEffect( () => {
Expand Down
16 changes: 2 additions & 14 deletions src/components/sidebar/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ export interface SidebarProps extends SidebarCommonProps {
onCollapseChange?: ( isCollapsed: boolean ) => void;
/** Determines if the Sidebar can be collapsed or not. If true, a collapse button is shown. */
collapsible?: boolean;
/** Determines whether the Sidebar should occupy the full screen height. */
screenHeight?: boolean;
/** Controls whether a border should appear on the right of the Sidebar. */
borderOn?: boolean;
}
Expand All @@ -55,7 +53,6 @@ export const Sidebar = ( {
className,
onCollapseChange,
collapsible = true,
screenHeight = true,
borderOn = true,
...props
}: SidebarProps ) => {
Expand Down Expand Up @@ -88,14 +85,6 @@ export const Sidebar = ( {
const storedState = safeLocalStorage.get( 'sidebar-collapsed' );
setIsCollapsed( storedState ? storedState : false );
}

if ( sideBarRef.current ) {
if ( !! screenHeight ) {
sideBarRef.current.style.height = `${ window.innerHeight }px`;
} else {
sideBarRef.current.style.height = 'auto';
}
}
};

window.addEventListener( 'resize', handleScreenResize );
Expand All @@ -104,7 +93,7 @@ export const Sidebar = ( {
return () => {
window.removeEventListener( 'resize', handleScreenResize );
};
}, [ screenHeight, collapsible ] );
}, [ collapsible ] );

return (
<SidebarContext.Provider
Expand All @@ -113,10 +102,9 @@ export const Sidebar = ( {
<div
ref={ sideBarRef }
className={ cn(
'overflow-auto w-72 px-4 py-4 gap-4 flex flex-col bg-background-primary',
'h-full overflow-auto w-72 px-4 py-4 gap-4 flex flex-col bg-background-primary',
borderOn &&
'border-0 border-r border-solid border-border-subtle',
!! screenHeight && 'h-screen',
'transition-all duration-200',
isCollapsed && 'w-16 px-2',
className
Expand Down
6 changes: 3 additions & 3 deletions src/components/switch/switch.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ const Template: StoryFn<SwitchProps> = ( { defaultValue, size, ...args } ) => {
export const Basic = Template.bind( {} );
Basic.args = {
defaultValue: false,
size: 'lg',
size: 'sm',
disabled: false,
};

export const WithLabel = Template.bind( {} );
WithLabel.args = {
defaultValue: true,
size: 'lg',
size: 'sm',
disabled: false,
label: { heading: 'Switch Label', description: 'Switch Description' },
};

export const Disabled = Template.bind( {} );
Disabled.args = {
size: 'lg',
size: 'sm',
disabled: true,
label: {
heading: 'Disabled Switch',
Expand Down
Loading
Loading