-
Notifications
You must be signed in to change notification settings - Fork 13
Feat add char limits bank acc form #1407
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
Merged
Zishan-7
merged 6 commits into
peanut-wallet-dev
from
feat/add-char-limits-bank-acc-form
Nov 7, 2025
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
17b9993
add max and min chars on input fields
Zishan-7 4c6c493
feat: Add select filed for state
Zishan-7 d28ce2f
fix: remove unused animations
Zishan-7 9931edd
Merge remote-tracking branch 'origin/peanut-wallet-dev' into feat/add…
Zishan-7 ce4c790
fix: issues
Zishan-7 bd6b341
refactor: replace hardcoded street address max length with constant i…
Zishan-7 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,103 @@ | ||
| 'use client' | ||
|
|
||
| import { forwardRef } from 'react' | ||
| import { | ||
| Root, | ||
| Trigger, | ||
| Value, | ||
| Icon as SelectIcon, | ||
| Portal, | ||
| Content, | ||
| Viewport, | ||
| Item, | ||
| ItemText, | ||
| ItemIndicator, | ||
| } from '@radix-ui/react-select' | ||
| import { twMerge } from 'tailwind-merge' | ||
| import { Icon } from '@/components/Global/Icons/Icon' | ||
|
|
||
| export interface BaseSelectOption { | ||
| label: string | ||
| value: string | ||
| } | ||
|
|
||
| interface BaseSelectProps { | ||
| options: BaseSelectOption[] | ||
| placeholder?: string | ||
| value?: string | ||
| onValueChange?: (value: string) => void | ||
| onBlur?: () => void | ||
| className?: string | ||
| disabled?: boolean | ||
| error?: boolean | ||
| } | ||
|
|
||
| const BaseSelect = forwardRef<HTMLButtonElement, BaseSelectProps>( | ||
| ({ options, placeholder = 'Select...', value, onValueChange, onBlur, className, disabled, error }, ref) => { | ||
| return ( | ||
| <Root | ||
| value={value} | ||
| onValueChange={onValueChange} | ||
| disabled={disabled} | ||
| onOpenChange={(open) => { | ||
| // Trigger onBlur when the select closes | ||
| if (!open && onBlur) { | ||
| onBlur() | ||
| } | ||
| }} | ||
| > | ||
| <Trigger | ||
| ref={ref} | ||
| className={twMerge( | ||
| 'flex h-12 w-full items-center justify-between rounded-sm border border-n-1 bg-white px-4 text-sm font-bold text-n-1 outline-none transition-colors placeholder:text-n-3', | ||
| 'disabled:cursor-not-allowed disabled:opacity-50', | ||
| 'focus:border-primary-1', | ||
| error && 'border-error', | ||
| className | ||
| )} | ||
| > | ||
| <Value placeholder={placeholder} className="text-n-1 data-[placeholder]:text-n-3" /> | ||
| <SelectIcon> | ||
| <Icon name="chevron-down" className="size-4 text-n-1" /> | ||
| </SelectIcon> | ||
| </Trigger> | ||
|
|
||
| <Portal> | ||
| <Content | ||
| className={twMerge( | ||
| 'relative z-50 max-h-80 overflow-hidden rounded-sm border border-n-1 bg-white shadow-lg' | ||
| )} | ||
| position="popper" | ||
| sideOffset={4} | ||
| align="start" | ||
| style={{ width: 'var(--radix-select-trigger-width)' }} | ||
| > | ||
| <Viewport className="w-full p-1"> | ||
| {options.map((option) => ( | ||
| <Item | ||
| key={option.value} | ||
| value={option.value} | ||
| className={twMerge( | ||
| 'relative flex w-full cursor-pointer select-none items-center rounded-sm px-3 py-2 text-sm font-bold outline-none', | ||
| 'transition-colors', | ||
| 'hover:bg-grey-2 focus:bg-grey-2', | ||
| 'data-[state=checked]:bg-primary-1 data-[state=checked]:font-bold data-[state=checked]:text-white' | ||
| )} | ||
| > | ||
| <ItemText className="text-sm font-bold">{option.label}</ItemText> | ||
| <ItemIndicator className="ml-auto"> | ||
| <Icon name="check" className="size-4" /> | ||
| </ItemIndicator> | ||
| </Item> | ||
| ))} | ||
| </Viewport> | ||
| </Content> | ||
| </Portal> | ||
| </Root> | ||
| ) | ||
| } | ||
| ) | ||
|
|
||
| BaseSelect.displayName = 'BaseSelect' | ||
|
|
||
| export default BaseSelect |
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 |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| export * from './Card' | ||
| export * from './Button' | ||
| export * from './BaseSelect' |
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
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
Zishan-7 marked this conversation as resolved.
Show resolved
Hide resolved
|
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,99 @@ | ||
| /** | ||
| * US States with ISO 3166-2 subdivision codes | ||
| * Format: US-XX where XX is the two-letter state code | ||
| */ | ||
| export const US_STATES = [ | ||
| { name: 'Alabama', code: 'AL' }, | ||
| { name: 'Alaska', code: 'AK' }, | ||
| { name: 'Arizona', code: 'AZ' }, | ||
| { name: 'Arkansas', code: 'AR' }, | ||
| { name: 'California', code: 'CA' }, | ||
| { name: 'Colorado', code: 'CO' }, | ||
| { name: 'Connecticut', code: 'CT' }, | ||
| { name: 'Delaware', code: 'DE' }, | ||
| { name: 'Florida', code: 'FL' }, | ||
| { name: 'Georgia', code: 'GA' }, | ||
| { name: 'Hawaii', code: 'HI' }, | ||
| { name: 'Idaho', code: 'ID' }, | ||
| { name: 'Illinois', code: 'IL' }, | ||
| { name: 'Indiana', code: 'IN' }, | ||
| { name: 'Iowa', code: 'IA' }, | ||
| { name: 'Kansas', code: 'KS' }, | ||
| { name: 'Kentucky', code: 'KY' }, | ||
| { name: 'Louisiana', code: 'LA' }, | ||
| { name: 'Maine', code: 'ME' }, | ||
| { name: 'Maryland', code: 'MD' }, | ||
| { name: 'Massachusetts', code: 'MA' }, | ||
| { name: 'Michigan', code: 'MI' }, | ||
| { name: 'Minnesota', code: 'MN' }, | ||
| { name: 'Mississippi', code: 'MS' }, | ||
| { name: 'Missouri', code: 'MO' }, | ||
| { name: 'Montana', code: 'MT' }, | ||
| { name: 'Nebraska', code: 'NE' }, | ||
| { name: 'Nevada', code: 'NV' }, | ||
| { name: 'New Hampshire', code: 'NH' }, | ||
| { name: 'New Jersey', code: 'NJ' }, | ||
| { name: 'New Mexico', code: 'NM' }, | ||
| { name: 'New York', code: 'NY' }, | ||
| { name: 'North Carolina', code: 'NC' }, | ||
| { name: 'North Dakota', code: 'ND' }, | ||
| { name: 'Ohio', code: 'OH' }, | ||
| { name: 'Oklahoma', code: 'OK' }, | ||
| { name: 'Oregon', code: 'OR' }, | ||
| { name: 'Pennsylvania', code: 'PA' }, | ||
| { name: 'Rhode Island', code: 'RI' }, | ||
| { name: 'South Carolina', code: 'SC' }, | ||
| { name: 'South Dakota', code: 'SD' }, | ||
| { name: 'Tennessee', code: 'TN' }, | ||
| { name: 'Texas', code: 'TX' }, | ||
| { name: 'Utah', code: 'UT' }, | ||
| { name: 'Vermont', code: 'VT' }, | ||
| { name: 'Virginia', code: 'VA' }, | ||
| { name: 'Washington', code: 'WA' }, | ||
| { name: 'West Virginia', code: 'WV' }, | ||
| { name: 'Wisconsin', code: 'WI' }, | ||
| { name: 'Wyoming', code: 'WY' }, | ||
| ] as const | ||
|
|
||
| export type USStateCode = (typeof US_STATES)[number]['code'] | ||
|
|
||
| /** | ||
| * Mexican States with ISO 3166-2 subdivision codes | ||
| * Format: MX-XXX where XXX is the three-letter state code | ||
| */ | ||
| export const MX_STATES = [ | ||
| { name: 'Aguascalientes', code: 'AGU' }, | ||
| { name: 'Baja California', code: 'BCN' }, | ||
| { name: 'Baja California Sur', code: 'BCS' }, | ||
| { name: 'Campeche', code: 'CAM' }, | ||
| { name: 'Chiapas', code: 'CHP' }, | ||
| { name: 'Chihuahua', code: 'CHH' }, | ||
| { name: 'Ciudad de México', code: 'CMX' }, | ||
| { name: 'Coahuila', code: 'COA' }, | ||
| { name: 'Colima', code: 'COL' }, | ||
| { name: 'Durango', code: 'DUR' }, | ||
| { name: 'Guanajuato', code: 'GUA' }, | ||
| { name: 'Guerrero', code: 'GRO' }, | ||
| { name: 'Hidalgo', code: 'HID' }, | ||
| { name: 'Jalisco', code: 'JAL' }, | ||
| { name: 'México', code: 'MEX' }, | ||
| { name: 'Michoacán', code: 'MIC' }, | ||
| { name: 'Morelos', code: 'MOR' }, | ||
| { name: 'Nayarit', code: 'NAY' }, | ||
| { name: 'Nuevo León', code: 'NLE' }, | ||
| { name: 'Oaxaca', code: 'OAX' }, | ||
| { name: 'Puebla', code: 'PUE' }, | ||
| { name: 'Querétaro', code: 'QUE' }, | ||
| { name: 'Quintana Roo', code: 'ROO' }, | ||
| { name: 'San Luis Potosí', code: 'SLP' }, | ||
| { name: 'Sinaloa', code: 'SIN' }, | ||
| { name: 'Sonora', code: 'SON' }, | ||
| { name: 'Tabasco', code: 'TAB' }, | ||
| { name: 'Tamaulipas', code: 'TAM' }, | ||
| { name: 'Tlaxcala', code: 'TLA' }, | ||
| { name: 'Veracruz', code: 'VER' }, | ||
| { name: 'Yucatán', code: 'YUC' }, | ||
| { name: 'Zacatecas', code: 'ZAC' }, | ||
| ] as const | ||
|
|
||
| export type MXStateCode = (typeof MX_STATES)[number]['code'] |
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.