-
Notifications
You must be signed in to change notification settings - Fork 10
Feature: Add Alert, MultiSelect, TimePicker and MonthPicker components #97
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
Open
b1ink0
wants to merge
20
commits into
develop
Choose a base branch
from
feat/new-components
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
d1e4b1a
Add default value to Select
b1ink0 8c524bb
Fix custom listview resize
b1ink0 ce80467
Refactor for better readability
b1ink0 5281669
Add missing useCallbacks and comments
b1ink0 e4166cc
Add Alert component
b1ink0 ff0146f
Add MultiSelect component
b1ink0 2bb0fdd
Add TimePicker component
b1ink0 73a07d0
Add keyboard support for TimePicker component
b1ink0 3b59985
Refactor TimePicker component for improved readability and functionality
b1ink0 ac0b957
Fix MultiSelect component folder name casing
b1ink0 2f8b3b8
Fix option selecton logic, eliminate usage of random function
b1ink0 544f946
Improve TimePicker component readability
b1ink0 1083ecc
Fix MultiSelect component file name casing
b1ink0 f7e8dff
Fix conflicting TimePicker component type
b1ink0 8691643
Fix not working clear search in MultiSelect
b1ink0 be2fe34
Fix Select component value handling
b1ink0 e9d3983
Refactor time parsing and formatting functions for improved clarity
b1ink0 efdc6b7
Fix nitpicks
b1ink0 1200c68
Merge branch 'develop' into feat/new-components
b1ink0 56be7d9
Add MonthPicker component
b1ink0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
154 changes: 154 additions & 0 deletions
154
packages/frappe-ui-react/src/components/alert/alert.stories.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,154 @@ | ||
| import type { Meta, StoryObj } from "@storybook/react-vite"; | ||
| import { useState } from "react"; | ||
|
|
||
| import Alert from "./alert"; | ||
| import { Button } from "../button"; | ||
| import { BadgeInfo } from "lucide-react"; | ||
|
|
||
| export default { | ||
| title: "Components/Alert", | ||
| component: Alert, | ||
| argTypes: { | ||
| title: { | ||
| control: "text", | ||
| description: "The title text of the alert", | ||
| }, | ||
| theme: { | ||
| control: { | ||
| type: "select", | ||
| options: ["yellow", "blue", "red", "green"], | ||
| }, | ||
| description: "Color theme of the alert", | ||
| }, | ||
| variant: { | ||
| control: { | ||
| type: "select", | ||
| options: ["subtle", "outline"], | ||
| }, | ||
| description: "Visual variant of the alert", | ||
| }, | ||
| description: { | ||
| control: "text", | ||
| description: "Description text displayed below the title", | ||
| }, | ||
| dismissable: { | ||
| control: "boolean", | ||
| description: "Whether the alert can be dismissed", | ||
| }, | ||
| visible: { | ||
| control: "boolean", | ||
| description: "Controls the visibility of the alert (controlled mode)", | ||
| }, | ||
| icon: { | ||
| control: false, | ||
| description: "Custom icon to display in the alert", | ||
| }, | ||
| footer: { | ||
| control: false, | ||
| description: "Custom footer content for the alert", | ||
| }, | ||
| }, | ||
| parameters: { | ||
| docs: { | ||
| source: { | ||
| type: "dynamic", | ||
| }, | ||
| }, | ||
| layout: "centered", | ||
| }, | ||
| tags: ["autodocs"], | ||
| } as Meta<typeof Alert>; | ||
|
|
||
| type Story = StoryObj<typeof Alert>; | ||
|
|
||
| const AlertTemplate: Story = { | ||
| render: (args) => ( | ||
| <div className="w-[500px]"> | ||
| <Alert {...args} /> | ||
| </div> | ||
| ), | ||
| }; | ||
|
|
||
| export const Success: Story = { | ||
| ...AlertTemplate, | ||
| args: { | ||
| title: "Source successfully added", | ||
| description: | ||
| "Discover the new feature to enhance your experience. See how it can help you.", | ||
| theme: "green", | ||
| }, | ||
| }; | ||
|
|
||
| export const Warning: Story = { | ||
| ...AlertTemplate, | ||
| args: { | ||
| title: "Source successfully added", | ||
| description: | ||
| "Discover the new feature to enhance your experience. See how it can help you.", | ||
| theme: "yellow", | ||
| }, | ||
| }; | ||
|
|
||
| export const Error: Story = { | ||
| ...AlertTemplate, | ||
| args: { | ||
| title: "Source successfully added", | ||
| description: | ||
| "Discover the new feature to enhance your experience. See how it can help you.", | ||
| theme: "red", | ||
| }, | ||
| }; | ||
|
|
||
| export const Info: Story = { | ||
| ...AlertTemplate, | ||
| args: { | ||
| title: "Source successfully added", | ||
| description: | ||
| "Discover the new feature to enhance your experience. See how it can help you.", | ||
| theme: "blue", | ||
| }, | ||
| }; | ||
|
|
||
| export const ControlledState: Story = { | ||
| render: (args) => { | ||
| const [visible, setVisible] = useState(true); | ||
|
|
||
| return ( | ||
| <div className="min-w-[500px] min-h-34 w-[500px]"> | ||
| <Button | ||
| variant="solid" | ||
| label="Toggle Alert" | ||
| onClick={() => setVisible(!visible)} | ||
| className="mb-3" | ||
| /> | ||
|
|
||
| <Alert | ||
| {...args} | ||
| visible={visible} | ||
| onVisibleChange={setVisible} | ||
| title="Source successfully added" | ||
| description="Discover the new feature to enhance your experience. See how it can help you." | ||
| /> | ||
| </div> | ||
| ); | ||
| }, | ||
| args: {}, | ||
| }; | ||
|
|
||
| export const CustomSlots: Story = { | ||
| render: (args) => ( | ||
| <div className="w-[500px]"> | ||
| <Alert | ||
| {...args} | ||
| title="Your trial ends soon!" | ||
| variant="outline" | ||
| description="Upgrade to keep enjoying features and future technical support." | ||
| icon={() => <BadgeInfo className="w-4 h-4" />} | ||
| footer={() => ( | ||
| <Button className="w-full" variant="solid" label="Update now" /> | ||
| )} | ||
| /> | ||
| </div> | ||
| ), | ||
| args: {}, | ||
| }; |
121 changes: 82 additions & 39 deletions
121
packages/frappe-ui-react/src/components/alert/alert.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.