Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
35cc2a5
Update changelog.txt
jaieds Dec 18, 2024
45a8f00
fix: Line chart responsive issue
jaieds Dec 23, 2024
5b04b4b
fix: Table component responsive issue
jaieds Dec 23, 2024
ecf9376
Merge pull request #227 from brainstormforce/responsive-line-chart
vrundakansara Dec 23, 2024
52f17d5
wip: Select component with option group
jaieds Dec 24, 2024
2825b61
Added option group in select component
jaieds Dec 25, 2024
5e00404
fix: Showing checkmark on incorrect item
jaieds Dec 25, 2024
d3ced57
Added a new story for the select group
jaieds Dec 25, 2024
f4e5f46
Updated change log
jaieds Dec 25, 2024
7cc093a
Bump version
jaieds Dec 25, 2024
c372962
Update changelog.txt
jaieds Dec 25, 2024
2e046ea
set full width to the select trigger wrapper
jaieds Dec 25, 2024
0631171
version bump
jaieds Dec 26, 2024
87ebfc5
fix: Clicking on the hint text toggles checkbox/switch
jaieds Dec 26, 2024
7c70009
Updated font size of the help text
jaieds Dec 26, 2024
f87266f
fix: Label component help text font-weight
jaieds Dec 26, 2024
f4b8132
Updated checkbox help text color
jaieds Dec 26, 2024
b067466
fix: Focus ring offset
jaieds Dec 26, 2024
8cca616
Merge pull request #228 from brainstormforce/select-component/option-…
vrundakansara Dec 27, 2024
0fae377
Merge pull request #231 from brainstormforce/dev
vrundakansara Dec 27, 2024
a659e01
Updated the table component design
jaieds Dec 27, 2024
6245aec
Merge branch 'dev' into uat-bugs/table-component
jaieds Dec 27, 2024
b417816
Update changelog.txt
jaieds Dec 27, 2024
6e9bc8d
Merge pull request #232 from brainstormforce/uat-bugs/table-component
vrundakansara Dec 27, 2024
111dca3
fix: Select combobox search icon size
jaieds Dec 27, 2024
eebe69f
imprv: Added a prop to set initial value
jaieds Dec 30, 2024
e2de5d8
fix: DatePicker crashing after selecting year
jaieds Dec 30, 2024
492e3ef
fix: Incorrect component name showing in the story
jaieds Dec 30, 2024
0d3eacb
imprv: DatePicker component initial value logic
jaieds Dec 30, 2024
898434c
Merge branch 'dev' into component-improvement/date-picker
jaieds Dec 30, 2024
0a4d06b
Merge branch 'staging' into component-improvement/date-picker
jaieds Dec 30, 2024
61b18e5
Merge pull request #233 from brainstormforce/uat-bugs/select-combobox
jaieds Dec 30, 2024
9d8ed58
Merge pull request #230 from brainstormforce/uat-bugs/focus-ring
jaieds Dec 30, 2024
329c0d1
Merge pull request #229 from brainstormforce/uat-bugs/help-text-size
jaieds Dec 30, 2024
631d0e7
Merge pull request #234 from brainstormforce/component-improvement/da…
jaieds Dec 30, 2024
be20b7f
Update changelog.txt
jaieds Dec 30, 2024
9dc4a8c
fix: DatePicker component UI of the presets variant
jaieds Dec 30, 2024
6b766b1
Update changelog.txt
jaieds Dec 30, 2024
d478007
chore: Lint
jaieds Dec 30, 2024
f384db9
Update changelog.txt
jaieds Dec 30, 2024
454ca36
fix: No background color in the preset section
jaieds Dec 30, 2024
f8a39cc
fix: invalid classname and current date indicator
jaieds Dec 30, 2024
4bc5511
Merge pull request #236 from brainstormforce/date-picker-and-change-log
jaieds Dec 30, 2024
165975e
fix: Presets button width
jaieds Dec 30, 2024
2241d0f
Merge pull request #237 from brainstormforce/date-picker-and-change-log
jaieds Dec 30, 2024
b7c481a
fix: Select story crashes after enabling multiple
jaieds Dec 31, 2024
f5ddb33
Added new design variation to the Drawer component
jaieds Dec 31, 2024
3378387
Updated footer border
jaieds Dec 31, 2024
3e740a4
Added a new prop to disable hover color for Badge
jaieds Dec 31, 2024
8013fc8
Update changelog.txt
jaieds Dec 31, 2024
dc8064b
Update changelog.txt
jaieds Dec 31, 2024
7d17eb7
Merge pull request #238 from brainstormforce/uat-bugs/drawer-component
vrundakansara Dec 31, 2024
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.3"
"@bsf/force-ui": "git+https://github.com/brainstormforce/force-ui#1.3.4"
}
```

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.3
npm i -S @bsf/force-ui@git+https://github.com/brainstormforce/force-ui.git#1.3.4
```

<br />
Expand Down
35 changes: 24 additions & 11 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
Version 1.3.4 - 31th December, 2024
- Improvement - Enhanced the UI of the Table and Line chart component for responsive design.
- Improvement - Added option group to the Select component.
- Improvement - Updated the Table component design.
- Improvement - Added support for controlling selected dates through the 'selected' prop in DatePicker component.
- Improvement - Enhanced the UI of the Drawer component.
- Improvement - Added a new prop to the Badge component to disable hover effect.
- Fixed - Adjusted search icon size in Select combobox for better visual consistency.
- Fixed - Focus ring offset of Select, Switch, Checkbox, and dropdown component.
- Fixed - Checkbox/Switch toggle behavior with hint text and adjusted help text size.
- Fixed - DatePicker component crash when navigating through years.
- Fixed - DatePicker component UI styles for better visual consistency.

Version 1.3.3 - 20th December, 2024
Fixed - React `Each child in a list should have a unique "key" prop` console warning.
Fixed - Toaster content overlapping with the close button.
- Fixed - React `Each child in a list should have a unique "key" prop` console warning.
- Fixed - Toaster content overlapping with the close button.

Version 1.3.2 - 17th December, 2024
Fixed - Adjusted the color of the Switch component label and help text.
- Fixed - Adjusted the color of the Switch component label and help text.

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.
- 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.
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.3",
"version": "1.3.4",
"description": "Library of components for the BSF project",
"main": "./dist/force-ui.js",
"module": "./dist/force-ui.js",
Expand Down
6 changes: 3 additions & 3 deletions src/components/accordion/accordion.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export default {
},
tags: [ 'autodocs' ],
subcomponents: {
Item: Accordion.Item,
Trigger: Accordion.Trigger,
Content: Accordion.Content,
'Accordion.Item': Accordion.Item,
'Accordion.Trigger': Accordion.Trigger,
'Accordion.Content': Accordion.Content,
},
decorators: [
( Story ) => (
Expand Down
34 changes: 26 additions & 8 deletions src/components/badge/badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ export interface BadgeProps {
* Custom Icon for the badge.
*/
icon?: ReactNode;
/**
* Disable hover effect.
* @default false
*/
disableHover?: boolean;
/**
* Defines if the badge is disabled.
*/
Expand Down Expand Up @@ -60,12 +65,13 @@ const Badge = forwardRef<Ref, BadgeProps>(
onClose = () => {},
closable = false,
onMouseDown = () => {},
disableHover = false,
},
ref
) => {
// Base classes - Mandatory classes
const baseClasses =
'font-medium border-badge-border-gray flex items-center justify-center border border-solid box-border max-w-full';
'font-medium border-badge-border-gray flex items-center justify-center border border-solid box-border max-w-full transition-colors duration-150 ease-in-out';

// Size classes - Based on the size prop
const sizeClasses = {
Expand All @@ -82,18 +88,29 @@ const Badge = forwardRef<Ref, BadgeProps>(
rounded: 'rounded',
};

// Hover classes - Based on the variant prop
const hoverClasses = {
neutral: 'hover:bg-badge-hover-gray',
red: 'hover:bg-badge-hover-red',
yellow: 'hover:bg-badge-hover-yellow',
green: 'hover:bg-badge-hover-green',
blue: 'hover:bg-badge-hover-sky',
inverse: 'hover:bg-badge-hover-inverse',
disabled: 'hover:bg-badge-hover-disabled',
};

// Variant classes - Based on the variant prop
const variantClasses = {
neutral:
'bg-badge-background-gray hover:bg-badge-hover-gray text-badge-color-gray border-badge-border-gray',
red: 'bg-badge-background-red hover:bg-badge-hover-red text-badge-color-red border-badge-border-red',
yellow: 'bg-badge-background-yellow hover:bg-badge-hover-yellow text-badge-color-yellow border-badge-border-yellow',
green: 'bg-badge-background-green hover:bg-badge-hover-green text-badge-color-green border-badge-border-green',
blue: 'bg-badge-background-sky hover:bg-badge-hover-sky text-badge-color-sky border-badge-border-sky',
'bg-badge-background-gray text-badge-color-gray border-badge-border-gray',
red: 'bg-badge-background-red text-badge-color-red border-badge-border-red',
yellow: 'bg-badge-background-yellow text-badge-color-yellow border-badge-border-yellow',
green: 'bg-badge-background-green text-badge-color-green border-badge-border-green',
blue: 'bg-badge-background-sky text-badge-color-sky border-badge-border-sky',
inverse:
'bg-background-inverse hover:bg-badge-hover-inverse text-text-inverse border-background-inverse',
'bg-background-inverse text-text-inverse border-background-inverse',
disabled:
'bg-badge-background-disabled hover:bg-badge-hover-disabled text-badge-color-disabled border-badge-border-disabled disabled cursor-not-allowed',
'bg-badge-background-disabled text-badge-color-disabled border-badge-border-disabled disabled cursor-not-allowed',
};

let filteredClasses = '';
Expand Down Expand Up @@ -127,6 +144,7 @@ const Badge = forwardRef<Ref, BadgeProps>(
typeClasses[ type ],
'gap-0.5',
filteredClasses,
! disableHover && hoverClasses[ variant ],
className
) }
ref={ ref }
Expand Down
30 changes: 12 additions & 18 deletions src/components/checkbox/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import { nanoid } from 'nanoid';
import { cn } from '@/utilities/functions';
import { Check, Minus } from 'lucide-react';
import Label from '../label/label';

// Types for Component Props
export declare interface CheckboxProps {
Expand Down Expand Up @@ -59,7 +60,7 @@ export const CheckboxComponent = (
checkbox: 'size-4 rounded gap-1',
icon: 'size-3',
text: 'text-sm', // text class for sm
description: 'text-xs',
description: 'text-sm',
gap: 'gap-0.5',
},
md: {
Expand All @@ -73,7 +74,7 @@ export const CheckboxComponent = (
const colorClassNames = {
primary: {
checkbox:
'border-border-strong hover:border-border-interactive checked:border-border-interactive bg-white checked:bg-toggle-on checked:hover:bg-toggle-on-hover checked:hover:border-toggle-on-hover focus:ring-2 focus:ring-offset-4 focus:ring-focus',
'border-border-strong hover:border-border-interactive checked:border-border-interactive bg-white checked:bg-toggle-on checked:hover:bg-toggle-on-hover checked:hover:border-toggle-on-hover focus:ring-2 focus:ring-offset-2 focus:ring-focus',
icon: 'text-white',
},
};
Expand Down Expand Up @@ -116,27 +117,30 @@ export const CheckboxComponent = (
return (
<div className={ sizeClassNames[ size ].gap }>
{ label?.heading && (
<p
<Label
className={ cn(
'text-text-primary font-medium leading-4 m-0',
sizeClassNames[ size ].text,
sizeClassNames[ size ].gap,
disabled && 'text-text-disabled'
) }
htmlFor={ checkboxId }
>
{ label?.heading }
</p>
</Label>
) }
{ label?.description && (
<p
<Label
tag="p"
className={ cn(
'text-text-secondary font-normal leading-5 m-0',
'font-normal leading-5 m-0',
sizeClassNames[ size ].description,
disabled && 'text-text-disabled'
) }
variant="help"
>
{ label?.description }
</p>
</Label>
) }
</div>
);
Expand Down Expand Up @@ -187,17 +191,7 @@ export const CheckboxComponent = (
) }
</span>
</label>
{ !! label && (
<label
className={ cn(
'cursor-pointer',
disabled && 'cursor-not-allowed'
) }
htmlFor={ checkboxId }
>
{ renderLabel() }
</label>
) }
{ !! label && renderLabel() }
</div>
);
};
Expand Down
14 changes: 4 additions & 10 deletions src/components/datepicker/datepicker-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ const DatePickerComponent = ( {
}
};

const handleYearClick = ( { yearValue }: { yearValue: number } ) => {
const handleYearClick = ( yearValue: number ) => {
setSelectedYear( yearValue );
setShowYearSelect( false );
setShowMonthSelect( true );
Expand Down Expand Up @@ -245,13 +245,7 @@ const DatePickerComponent = ( {
<Button
key={ yearValue }
variant="ghost"
onClick={ () =>
handleYearClick(
yearValue as unknown as {
yearValue: number;
}
)
}
onClick={ () => handleYearClick( yearValue ) }
className={ cn(
'h-10 w-full text-center font-normal relative',
yearValue === selectedYear &&
Expand Down Expand Up @@ -367,7 +361,7 @@ const DatePickerComponent = ( {

// Common class for disabled outside days
const disabledOutsideClass =
'bg-transperant opacity-50 text-text-disabled cursor-auto';
'bg-transparent opacity-50 text-text-disabled cursor-auto';

const buttonClasses = cn(
'h-10 w-10 flex items-center justify-center transition text-text-secondary relative text-sm',
Expand Down Expand Up @@ -397,7 +391,7 @@ const DatePickerComponent = ( {
>
{ ( ! showOutsideDates || ( isPartOfRange && shouldShowDay ) ) &&
format( day.date, 'd' ) }
{ isToday && (
{ isToday && shouldShowDay && (
<span className="absolute h-1 w-1 bg-background-brand rounded-full bottom-1"></span>
) }
</button>
Expand Down
32 changes: 24 additions & 8 deletions src/components/datepicker/datepicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
subWeeks,
subMonths,
} from 'date-fns';
import { getDefaultSelectedValue } from './utils';

export interface DatePickerProps {
/** Defines the selection selectionType of the date picker: single, range, or multiple dates. */
Expand All @@ -33,6 +34,8 @@ export interface DatePickerProps {
showOutsideDays?: boolean;
/** Show or hide the footer. */
isFooter?: boolean;
/** Selected date value. */
selected?: Date | Date[] | TDateRange | null;
}

const DatePicker = ( {
Expand All @@ -46,17 +49,30 @@ const DatePicker = ( {
cancelButtonText = 'Cancel',
showOutsideDays = true,
isFooter = true,
selected,
...props
}: DatePickerProps ) => {
const [ selectedDates, setSelectedDates ] = useState<
TDateRange | Date | Date[] | null
>( () => {
if ( selectionType === 'multiple' ) {
return [];
} else if ( selectionType === 'range' ) {
return { from: null, to: null };
if ( ! selected ) {
return getDefaultSelectedValue( selectionType );
}
return null;

// Type guards for different selection types
const isValidMultiple =
selectionType === 'multiple' && Array.isArray( selected );
const isValidRange =
selectionType === 'range' && 'from' in selected && 'to' in selected;
const isValidSingle =
selectionType === 'single' && selected instanceof Date;

// Return selected if valid, otherwise return default value
if ( isValidMultiple || isValidRange || isValidSingle ) {
return selected;
}

return getDefaultSelectedValue( selectionType );
} );

const handleSelect = ( selectedDate: Date | Date[] | TDateRange | null ) => {
Expand Down Expand Up @@ -192,13 +208,13 @@ const DatePicker = ( {
if ( variant === 'presets' ) {
return (
<div className="flex flex-row shadow-datepicker-wrapper">
<div className="flex flex-col gap-1 p-3 items-start border border-solid border-border-subtle border-r-0 rounded-tl-md rounded-bl-md">
<div className="flex flex-col gap-1 p-3 items-start border border-solid border-border-subtle border-r-0 rounded-tl-md rounded-bl-md bg-background-primary">
{ presets.map( ( preset, index ) => (
<Button
key={ index }
onClick={ () => handlePresetClick( preset.range ) }
variant="ghost"
className="font-medium text-sm"
className="text-left font-medium text-sm text-nowrap w-full"
>
{ preset.label }
</Button>
Expand All @@ -218,7 +234,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 bg-background-primary">
<div className="flex justify-end p-2 gap-3 border-l border-r border-t-0 border-b border-solid border-border-subtle bg-background-primary rounded-br-md">
<Button
variant="outline"
onClick={ handleCancelClick }
Expand Down
10 changes: 10 additions & 0 deletions src/components/datepicker/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@ export const formatWeekdayName = ( date: Date ) => {
export const generateYearRange = ( start: number, count = 24 ) => {
return Array.from( { length: count }, ( _, i ) => start + i );
};

export const getDefaultSelectedValue = ( type: string ) => {
if ( type === 'multiple' ) {
return [];
}
if ( type === 'range' ) {
return { from: null, to: null };
}
return null;
};
2 changes: 1 addition & 1 deletion src/components/drawer/drawer-body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const DrawerBody = ( { children, className, ...props }: DrawerBodyProps ) => {
return (
<div
className={ cn(
'px-5 flex flex-col flex-1 overflow-y-auto overflow-x-hidden',
'px-5 pb-4 pt-2 flex flex-col flex-1 overflow-y-auto overflow-x-hidden',
className
) }
{ ...props }
Expand Down
4 changes: 3 additions & 1 deletion src/components/drawer/drawer-footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ const DrawerFooter = ( { children, className }: DrawerFooterProps ) => {
return (
<div
className={ cn(
'p-5 flex justify-end gap-3 mt-auto',
'px-5 py-4 flex justify-end gap-3 mt-auto',
{
'bg-background-secondary': design === 'footer-divided',
'border-t border-b-0 border-x-0 border-solid border-border-subtle':
design === 'footer-bordered',
},
className
) }
Expand Down
Loading
Loading