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.0 #213

Merged
merged 36 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f64f0ff
wip: Table component
jaieds Dec 13, 2024
555addd
fix: TailwindCSS not bundled in storybook
jaieds Dec 13, 2024
6e7eb2f
fix: Asterisk missing on required input label
jaieds Dec 13, 2024
752778c
Update changelog.txt
jaieds Dec 13, 2024
b082558
fix: Preview font family and box sizing
jaieds Dec 13, 2024
a4aa436
chore: Added comment
jaieds Dec 13, 2024
e48f340
fix: Checkbox alignment and added a story
jaieds Dec 13, 2024
0711a66
wip: Table component
jaieds Dec 13, 2024
2b52c0f
wip: Selection handler and logic implementation
jaieds Dec 13, 2024
f16951e
Updated selection logic
jaieds Dec 13, 2024
6497ffe
Update default-config.js
jaieds Dec 13, 2024
dad0e7e
fix: Spacing and divider issues
jaieds Dec 13, 2024
2450b0d
Created story for the table component
jaieds Dec 13, 2024
e41502c
Updated table story source code
jaieds Dec 13, 2024
8e0054a
chore: Lint
jaieds Dec 13, 2024
35147cd
fix: Accessibility issues
jaieds Dec 13, 2024
9190129
Removed unused types
jaieds Dec 13, 2024
54f86a1
Removed invalid exports
jaieds Dec 13, 2024
27bd55e
Removed story
jaieds Dec 13, 2024
5b6aead
Merge pull request #205 from brainstormforce/required-asterisk
vrundakansara Dec 13, 2024
831cbe4
Updated Table component story
jaieds Dec 13, 2024
fd9054f
chore: Lint
jaieds Dec 13, 2024
c64cfb5
Merge pull request #206 from brainstormforce/component/table
vrundakansara Dec 13, 2024
d533216
Merge pull request #207 from brainstormforce/dev
vrundakansara Dec 13, 2024
c4ba9fa
fix: Divider between table body and footer not visible
jaieds Dec 13, 2024
40e959f
Merge pull request #208 from brainstormforce/component/table
vrundakansara Dec 13, 2024
d0042f1
fix: Table not exported from Force-UI
jaieds Dec 13, 2024
a99c924
Merge pull request #209 from brainstormforce/component/table
vrundakansara Dec 13, 2024
5553787
Merge pull request #210 from brainstormforce/dev
vrundakansara Dec 13, 2024
c15f6e3
fix: Table Checkbox column width
jaieds Dec 14, 2024
394019e
Updated display value
jaieds Dec 14, 2024
f59436b
fix: Pagination component type
jaieds Dec 14, 2024
e4e0209
Merge pull request #211 from brainstormforce/component/table
vrundakansara Dec 16, 2024
a9e5d94
Merge pull request #212 from brainstormforce/dev
vrundakansara Dec 16, 2024
6b8f70b
Bump version and updated change log and readme
jaieds Dec 16, 2024
9a1fd99
Merge pull request #214 from brainstormforce/version-bump-1.3.0
vrundakansara Dec 16, 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
6 changes: 3 additions & 3 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import type { Preview } from '@storybook/react';

import '../src/tailwind.css';
/** @type { import('@storybook/react').Preview } */
import '../dist/style.css';

const preview: Preview = {
parameters: {
controls: {
Expand All @@ -20,7 +20,7 @@ const preview: Preview = {
},
decorators: [
(Story) => (
<div style={{ fontFamily: 'Figtree, sans-serif' }}>
<div className="[&_*]:[font-family:Figtree,sans-serif] [&_*]:box-border">
<Story />
</div>
),
Expand Down
8 changes: 7 additions & 1 deletion 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.2.2"
"@bsf/force-ui": "git+https://github.com/brainstormforce/force-ui#1.3.0"
}
```

Expand All @@ -25,6 +25,12 @@ And run the following command to install the package -
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
```

<br />

2. Once you install @bsf/force-ui you need to wrap your tailwind css configurations with the `withTW()` function coming from @bsf/force-ui/withTW.
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 1.3.0 - 16th December, 2024
- New - Table component.
- Fixed - Asterisk missing on required input label.

Version 1.2.2 - 4th December, 2024
- Improvement - Removed margin and added new props to the Line Chart component for customizability.

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.2.2",
"version": "1.3.0",
"description": "Library of components for the BSF project",
"main": "./dist/force-ui.js",
"module": "./dist/force-ui.js",
Expand Down
4 changes: 2 additions & 2 deletions src/components/checkbox/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ export const CheckboxComponent = (
return (
<div
className={ cn(
'inline-flex items-center gap-2',
'inline-flex items-center justify-center gap-2',
!! label && 'items-start',
disabled && 'cursor-not-allowed'
) }
>
<label
className={ cn(
'relative flex items-center rounded-full p-0.5',
'relative flex items-center justify-center rounded-full p-0.5',
! disabled && 'cursor-pointer'
) }
htmlFor={ checkboxId }
Expand Down
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ export { default as LineChart } from './line-chart';
export { default as PieChart } from './pie-chart';
export { default as AreaChart } from './area-chart';
export { default as Dropzone } from './dropzone';
export { default as Table } from './table';
10 changes: 10 additions & 0 deletions src/components/input/input.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,13 @@ WithPrefixSuffix.args = {
suffix: '#',
defaultValue: '',
};

// Required Input with Label
export const Required = Template.bind( {} );
Required.args = {
type: 'text',
size: 'sm',
required: true,
label: 'Required Input',
defaultValue: 'Required Input',
};
12 changes: 9 additions & 3 deletions src/components/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import React, {
forwardRef,
useRef,
type ReactNode,
LabelHTMLAttributes,
} from 'react';
import { nanoid } from 'nanoid';
import { cn } from '@/utilities/functions';
import { Upload, X } from 'lucide-react';
import Label from '../label';

export declare interface InputProps {
/** Unique identifier for the input element. */
Expand Down Expand Up @@ -52,6 +54,9 @@ export declare interface InputProps {

/** Placeholder text for the input field. */
placeholder?: string;

/** Indicates whether the input is required. */
required?: boolean;
}

export const InputComponent = (
Expand Down Expand Up @@ -245,12 +250,13 @@ export const InputComponent = (
return null;
}
return (
<label
className={ cn( labelClasses[ size ], 'text-field-label' ) }
<Label<LabelHTMLAttributes<HTMLLabelElement>>
className={ cn( labelClasses[ size ] ) }
htmlFor={ inputId }
{ ...( props?.required && { required: true } ) }
>
{ label }
</label>
</Label>
);
}, [ label, size, inputId ] );

Expand Down
9 changes: 6 additions & 3 deletions src/components/label/label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface LabelProps {
}

const Label = forwardRef(
(
<T extends object>(
{
children = null,
tag: Tag = 'label',
Expand All @@ -26,7 +26,7 @@ const Label = forwardRef(
variant = 'neutral', // neutral, help, error, disabled
required = false,
...props
}: LabelProps,
}: LabelProps & T,
ref: React.Ref<HTMLElement>
) => {
// Base classes. - Mandatory classes.
Expand Down Expand Up @@ -78,4 +78,7 @@ const Label = forwardRef(
}
);

export default Label;
export default Label as <T extends object>(
props: LabelProps & T,
ref: React.Ref<HTMLElement>
) => React.ReactNode;
14 changes: 4 additions & 10 deletions src/components/pagination/pagination.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
createContext,
useContext,
forwardRef,
type ReactNode,
type ElementType,
} from 'react';
import { createContext, useContext, forwardRef, type ReactNode } from 'react';
import { cn, callAll } from '@/utilities/functions';
import { ChevronLeft, ChevronRight } from 'lucide-react';
import { disabledClassNames, sizeClassNames } from './component-style';
Expand Down Expand Up @@ -33,14 +27,14 @@ export interface PaginationProps extends PaginationCommonProps {
disabled?: boolean;
}

export interface PaginationItemProps extends PaginationCommonProps {
export interface PaginationItemProps
extends PaginationCommonProps,
PaginationButtonProps {
/** Marks the pagination item as active. */
isActive?: boolean;
}

export interface PaginationButtonProps extends PaginationCommonProps {
/** The element type of the pagination button. */
as?: ElementType;
/** Marks the button as active. */
isActive?: boolean;
/** Disables the button. */
Expand Down
1 change: 1 addition & 0 deletions src/components/table/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './table';
Loading
Loading