luna-components-library 1.1.39 → 1.1.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -125,28 +125,35 @@ const isValid = validators.isEmail('user@luna.com'); // true
125
125
  All components use TypeScript with specific types for better type safety and IntelliSense. The library follows a minimal documentation approach with descriptive type names instead of extensive JSDoc comments.
126
126
 
127
127
  ### Button
128
- A versatile button component with multiple variants and sizes.
128
+ A versatile button component with multiple variants, sizes, icons, and rounded style.
129
129
 
130
130
  ```jsx
131
- <Button
132
- variant="primary"
133
- size="md"
134
- onClick={handleClick}
135
- disabled={false}
136
- >
137
- Button Text
138
- </Button>
131
+ // Basic
132
+ <Button variant="primary" size="md" onClick={handleClick}>Click Me</Button>
133
+
134
+ // Rounded (pill)
135
+ <Button variant="primary" rounded>Rounded</Button>
136
+
137
+ // With icon
138
+ <Button variant="primary" icon="🚀">Deploy</Button>
139
+ <Button variant="outline" icon="→" iconPosition="right">Next</Button>
140
+
141
+ // Icon only
142
+ <Button variant="danger" rounded icon="✕" />
139
143
  ```
140
144
 
141
145
  **Props:**
142
- - `children`: React.ReactNode - Button content
146
+ - `children?: React.ReactNode` - Button content (optional when using icon only)
143
147
  - `variant?: ButtonVariant` - Button style (default: 'primary')
144
- - `size?: ButtonSize` - Button size (default: 'md')
148
+ - `size?: ButtonSize` - Button size (default: 'sm')
149
+ - `rounded?: boolean` - Pill/circle shape (default: false)
150
+ - `icon?: React.ReactNode` - Icon element, emoji, or any ReactNode
151
+ - `iconPosition?: 'left' | 'right'` - Icon placement (default: 'left')
145
152
  - `onClick?: React.MouseEventHandler<HTMLButtonElement>` - Click handler
146
153
  - `disabled?: boolean` - Disable button (default: false)
147
154
  - `className?: string` - Additional CSS classes
148
155
  - `style?: React.CSSProperties` - Custom inline styles
149
- - `...props`: any - Additional HTML button attributes (spreads all native button props)
156
+ - `...props`: any - Additional HTML button attributes
150
157
 
151
158
  **Types:**
152
159
  ```typescript
@@ -155,15 +162,15 @@ type ButtonSize = 'sm' | 'md' | 'lg';
155
162
  ```
156
163
 
157
164
  **Variants:**
158
- - `primary` - Blue background button
159
- - `secondary` - Gray background button
165
+ - `primary` - Blue background
166
+ - `secondary` - Gray background
160
167
  - `outline` - Transparent with border
161
- - `success` - Green background button
162
- - `danger` - Red background button
163
- - `warning` - Yellow background button
164
- - `info` - Cyan background button
165
- - `dark` - Dark gray background button
166
- - `light` - Light gray background button
168
+ - `success` - Green background
169
+ - `danger` - Red background
170
+ - `warning` - Yellow background
171
+ - `info` - Cyan background
172
+ - `dark` - Dark gray background
173
+ - `light` - Light gray background
167
174
  - `link` - Blue text link with hover effects
168
175
 
169
176
  ### Card
@@ -626,67 +633,69 @@ const MyComponent = () => {
626
633
  ```
627
634
 
628
635
  ### Input
629
- A versatile input component with multiple variants, sizes, masks, currency formatting, and types.
636
+ A versatile input component with multiple variants, sizes, masks, currency formatting, icons, and required indicator.
630
637
 
631
638
  ```jsx
632
- <Input
633
- inputSize="md"
634
- variant="primary"
635
- type="text"
636
- placeholder="Enter your text here"
637
- value={inputValue}
638
- onChange={(value) => setInputValue(value)}
639
- className="custom-class"
640
- id="my-input"
641
- >
642
- Input Label
643
- </Input>
639
+ // Basic
640
+ <Input variant="primary" placeholder="Enter text">Label</Input>
641
+
642
+ // With icon
643
+ <Input icon="🔍" placeholder="Search...">Search</Input>
644
+ <Input icon="🔒" iconPosition="right" variant="danger" placeholder="Password">Password</Input>
645
+
646
+ // Required indicator
647
+ <Input isRequired variant="primary" placeholder="Email">Email</Input>
648
+
649
+ // Currency
650
+ <Input useCurrency currency="USD" locale="en-US" placeholder="$0.00">Price</Input>
651
+
652
+ // Mask
653
+ <Input mask="(999) 999-9999" placeholder="(555) 000-0000">Phone</Input>
644
654
  ```
645
655
 
646
656
  **Props:**
647
- - `children?: React.ReactNode` - Label content for the input
648
- - `variant?: InputVariant` - Input style variant (default: 'none')
657
+ - `children?: React.ReactNode` - Label content
658
+ - `variant?: InputVariant` - Border color variant (default: 'none')
649
659
  - `inputSize?: InputSize` - Input size (default: 'md')
650
660
  - `type?: InputType` - HTML input type (default: 'text')
651
661
  - `placeholder?: string` - Placeholder text
652
- - `value?: string` - Input value
662
+ - `value?: string` - Controlled value
653
663
  - `onChange?: (value: string) => void` - Change handler
654
664
  - `onFocus?: () => void` - Focus handler
655
665
  - `onBlur?: () => void` - Blur handler
656
666
  - `disabled?: boolean` - Disable input (default: false)
657
- - `required?: boolean` - Required field (default: false)
667
+ - `required?: boolean` - HTML required attribute (default: false)
668
+ - `isRequired?: boolean` - Shows a red `*` next to the label (default: false)
658
669
  - `readOnly?: boolean` - Read-only input (default: false)
670
+ - `icon?: React.ReactNode` - Icon inside the input (emoji, SVG, component)
671
+ - `iconPosition?: 'left' | 'right'` - Icon placement (default: 'left')
659
672
  - `className?: string` - Additional CSS classes
660
673
  - `style?: React.CSSProperties` - Custom inline styles
661
- - `id?: string` - HTML id attribute for label association
674
+ - `id?: string` - HTML id for label association
662
675
  - `name?: string` - HTML name attribute
663
- - `classNames?: InputClassNames` - Custom class names for sub-elements
664
- - `styles?: InputStyles` - Custom inline styles per element
665
- - `mask?: string` - Input mask pattern (e.g. "(999) 999-9999")
666
- - `maskChar?: string` - Mask placeholder character (default: '_')
676
+ - `classNames?: InputClassNames` - Custom class names per sub-element
677
+ - `styles?: InputStyles` - Custom inline styles per sub-element
678
+ - `mask?: string` - Input mask pattern (e.g. `"(999) 999-9999"`)
679
+ - `maskChar?: string` - Mask placeholder character (default: `'_'`)
667
680
  - `useCurrency?: boolean` - Enable currency formatting
668
- - `currency?: string` - Currency code (e.g. "USD", "CRC")
669
- - `locale?: string` - Locale for formatting (e.g. "en-US", "es-CR")
681
+ - `currency?: string` - Currency code (e.g. `"USD"`, `"CRC"`)
682
+ - `locale?: string` - Locale for formatting (e.g. `"en-US"`, `"es-CR"`)
670
683
  - `minFractionDigits?: number` - Minimum fraction digits (default: 0)
671
684
  - `maxFractionDigits?: number` - Maximum fraction digits (default: 2)
672
- - `aria-label?: string` - ARIA label for accessibility
685
+ - `aria-label?: string` - ARIA label
673
686
  - `aria-labelledby?: string` - ARIA labelledby
674
687
  - `...props`: any - Additional HTML input attributes
675
688
 
676
689
  **Types:**
677
690
  ```typescript
678
- type InputVariant = 'none' | 'primary' | 'secondary' | 'outline' | 'danger' | 'success';
691
+ type InputVariant = 'none' | 'primary' | 'secondary' | 'outline' | 'danger' | 'success' | 'warning' | 'info' | 'dark' | 'light' | 'link';
679
692
  type InputSize = 'sm' | 'md' | 'lg' | 'xl';
680
693
  type InputType = 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'search' | 'date' | 'time' | 'datetime-local' | 'month' | 'week' | 'color' | 'file' | 'hidden' | 'image' | 'range' | 'reset' | 'submit';
681
694
  ```
682
695
 
683
- **Variants:**
684
- - `none` - Default styling with border
685
- - `primary` - Blue focus ring
686
- - `secondary` - Gray focus ring
687
- - `outline` - Border only
688
- - `danger` - Red focus ring
689
- - `success` - Green focus ring
696
+ **Focus behavior:** Border increases from `1px` to `2px` on focus, using the variant color. On blur it returns to `1px` with the same variant color.
697
+
698
+ **Variants:** Each variant applies a distinct border color — `primary` (blue), `secondary` (gray), `danger` (red), `success` (green), `warning` (yellow), `info` (cyan), `dark`, `light`, `outline` (default gray), `none` (default gray).
690
699
 
691
700
  **Size Options:**
692
701
  - `sm` - Small padding and text