luna-components-library 1.1.51 → 1.1.52
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 +189 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,7 +33,8 @@ Luna Library is fully standalone. All styles are encapsulated within the compone
|
|
|
33
33
|
import { useState } from 'react';
|
|
34
34
|
import {
|
|
35
35
|
Button, Input, Card, Typed, Accordion, ProgressBar, Spinner,
|
|
36
|
-
Preloader, ScrollTop, Modal, WhatsApp, DataTable
|
|
36
|
+
Preloader, ScrollTop, Modal, WhatsApp, DataTable,
|
|
37
|
+
Toast, MultiSelect, Popconfirm, QRCode, FloatingButton
|
|
37
38
|
} from 'luna-components-library';
|
|
38
39
|
|
|
39
40
|
function App() {
|
|
@@ -842,9 +843,191 @@ interface DataTableColumn {
|
|
|
842
843
|
}
|
|
843
844
|
```
|
|
844
845
|
|
|
846
|
+
### Toast
|
|
847
|
+
A notification component with severity levels, auto-dismiss, and animated entry/exit.
|
|
845
848
|
|
|
849
|
+
```jsx
|
|
850
|
+
const [visible, setVisible] = useState(false);
|
|
851
|
+
|
|
852
|
+
<Toast
|
|
853
|
+
visible={visible}
|
|
854
|
+
severity="success"
|
|
855
|
+
summary="Saved!"
|
|
856
|
+
detail="Your changes have been saved."
|
|
857
|
+
life={3000}
|
|
858
|
+
position="top-right"
|
|
859
|
+
onClose={() => setVisible(false)}
|
|
860
|
+
/>
|
|
861
|
+
```
|
|
862
|
+
|
|
863
|
+
**Props:**
|
|
864
|
+
- `visible: boolean` - Whether the toast is shown
|
|
865
|
+
- `onClose: () => void` - Called when the toast is dismissed
|
|
866
|
+
- `severity?: ToastSeverity` - Visual style (default: `'info'`)
|
|
867
|
+
- `summary?: string` - Bold title text
|
|
868
|
+
- `detail?: string` - Body text
|
|
869
|
+
- `life?: number` - Auto-dismiss delay in ms (no auto-dismiss if omitted)
|
|
870
|
+
- `position?: ToastPosition` - Screen position (default: `'top-right'`)
|
|
871
|
+
- `classNames?: ToastClassNames` - Custom class names per sub-element
|
|
872
|
+
- `styles?: ToastStyles` - Custom inline styles per sub-element
|
|
873
|
+
- `className?: string` - Additional CSS classes
|
|
874
|
+
|
|
875
|
+
**Types:**
|
|
876
|
+
```typescript
|
|
877
|
+
type ToastSeverity = 'success' | 'info' | 'warn' | 'error';
|
|
878
|
+
type ToastPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';
|
|
879
|
+
```
|
|
880
|
+
|
|
881
|
+
### MultiSelect
|
|
882
|
+
A multi-value dropdown with chip display, search filter, and select-all support.
|
|
883
|
+
|
|
884
|
+
```jsx
|
|
885
|
+
const [selected, setSelected] = useState([]);
|
|
886
|
+
|
|
887
|
+
<MultiSelect
|
|
888
|
+
options={[
|
|
889
|
+
{ label: 'React', value: 'react' },
|
|
890
|
+
{ label: 'Vue', value: 'vue' },
|
|
891
|
+
{ label: 'Angular', value: 'angular' },
|
|
892
|
+
]}
|
|
893
|
+
value={selected}
|
|
894
|
+
onChange={setSelected}
|
|
895
|
+
placeholder="Select frameworks"
|
|
896
|
+
display="chip"
|
|
897
|
+
filter
|
|
898
|
+
selectAll
|
|
899
|
+
/>
|
|
900
|
+
```
|
|
901
|
+
|
|
902
|
+
**Props:**
|
|
903
|
+
- `options: MultiSelectOption[]` - Array of options
|
|
904
|
+
- `value: any[]` - Array of selected values
|
|
905
|
+
- `onChange: (value: any[]) => void` - Selection change handler
|
|
906
|
+
- `placeholder?: string` - Placeholder text (default: `'Select Items'`)
|
|
907
|
+
- `display?: 'comma' | 'chip'` - How selected values are shown (default: `'comma'`)
|
|
908
|
+
- `filter?: boolean` - Show search input (default: `true`)
|
|
909
|
+
- `filterPlaceholder?: string` - Search input placeholder (default: `'Search...'`)
|
|
910
|
+
- `selectAll?: boolean` - Show select-all checkbox (default: `true`)
|
|
911
|
+
- `maxSelectedLabels?: number` - Max labels before showing count (default: `3`)
|
|
912
|
+
- `disabled?: boolean` - Disable the component (default: `false`)
|
|
913
|
+
- `classNames?: MultiSelectClassNames` - Custom class names per sub-element
|
|
914
|
+
- `styles?: MultiSelectStyles` - Custom inline styles per sub-element
|
|
915
|
+
- `className?: string` - Additional CSS classes
|
|
916
|
+
- `id?: string` - HTML id
|
|
846
917
|
|
|
918
|
+
**MultiSelectOption Interface:**
|
|
919
|
+
```typescript
|
|
920
|
+
interface MultiSelectOption {
|
|
921
|
+
label: string;
|
|
922
|
+
value: any;
|
|
923
|
+
disabled?: boolean;
|
|
924
|
+
}
|
|
925
|
+
```
|
|
847
926
|
|
|
927
|
+
### Popconfirm
|
|
928
|
+
A confirmation popover that wraps any trigger element and asks for user confirmation before proceeding.
|
|
929
|
+
|
|
930
|
+
```jsx
|
|
931
|
+
<Popconfirm
|
|
932
|
+
title="Delete this item?"
|
|
933
|
+
description="This action cannot be undone."
|
|
934
|
+
onConfirm={handleDelete}
|
|
935
|
+
onCancel={() => console.log('Cancelled')}
|
|
936
|
+
okText="Delete"
|
|
937
|
+
cancelText="Cancel"
|
|
938
|
+
position="top"
|
|
939
|
+
>
|
|
940
|
+
<Button variant="danger">Delete</Button>
|
|
941
|
+
</Popconfirm>
|
|
942
|
+
```
|
|
943
|
+
|
|
944
|
+
**Props:**
|
|
945
|
+
- `title: React.ReactNode` - Confirmation question
|
|
946
|
+
- `children: React.ReactElement` - Trigger element (any clickable component)
|
|
947
|
+
- `onConfirm: () => void` - Called when user confirms
|
|
948
|
+
- `description?: React.ReactNode` - Optional secondary text
|
|
949
|
+
- `onCancel?: () => void` - Called when user cancels
|
|
950
|
+
- `okText?: string` - Confirm button label (default: `'Yes'`)
|
|
951
|
+
- `cancelText?: string` - Cancel button label (default: `'No'`)
|
|
952
|
+
- `position?: PopconfirmPosition` - Popover placement (default: `'top'`)
|
|
953
|
+
- `disabled?: boolean` - Prevent popover from opening (default: `false`)
|
|
954
|
+
- `classNames?: PopconfirmClassNames` - Custom class names per sub-element
|
|
955
|
+
- `styles?: PopconfirmStyles` - Custom inline styles per sub-element
|
|
956
|
+
- `className?: string` - Additional CSS classes
|
|
957
|
+
|
|
958
|
+
**Types:**
|
|
959
|
+
```typescript
|
|
960
|
+
type PopconfirmPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
961
|
+
```
|
|
962
|
+
|
|
963
|
+
### QRCode
|
|
964
|
+
Generates a QR code image for any string value using the QRServer API (zero client-side dependencies).
|
|
965
|
+
|
|
966
|
+
```jsx
|
|
967
|
+
<QRCode
|
|
968
|
+
value="https://luna-components-demo.netlify.app"
|
|
969
|
+
size={200}
|
|
970
|
+
color="#000000"
|
|
971
|
+
bgColor="#ffffff"
|
|
972
|
+
bordered
|
|
973
|
+
errorCorrectionLevel="M"
|
|
974
|
+
/>
|
|
975
|
+
```
|
|
976
|
+
|
|
977
|
+
**Props:**
|
|
978
|
+
- `value: string` - The data to encode in the QR code
|
|
979
|
+
- `size?: number` - Width and height in pixels (default: `160`)
|
|
980
|
+
- `color?: string` - Foreground color hex (default: `'000000'`)
|
|
981
|
+
- `bgColor?: string` - Background color hex (default: `'ffffff'`)
|
|
982
|
+
- `bordered?: boolean` - Show a border around the QR (default: `true`)
|
|
983
|
+
- `errorCorrectionLevel?: 'L' | 'M' | 'Q' | 'H'` - Error correction level (default: `'M'`)
|
|
984
|
+
- `classNames?: QRCodeClassNames` - Custom class names per sub-element
|
|
985
|
+
- `styles?: QRCodeStyles` - Custom inline styles per sub-element
|
|
986
|
+
- `className?: string` - Additional CSS classes
|
|
987
|
+
|
|
988
|
+
### FloatingButton
|
|
989
|
+
A fixed-position button that can appear on scroll or always be visible, useful for floating action buttons.
|
|
990
|
+
|
|
991
|
+
```jsx
|
|
992
|
+
// Always visible
|
|
993
|
+
<FloatingButton
|
|
994
|
+
position="bottom-right"
|
|
995
|
+
visible={true}
|
|
996
|
+
onClick={handleClick}
|
|
997
|
+
backgroundColor="#2563eb"
|
|
998
|
+
color="#ffffff"
|
|
999
|
+
>
|
|
1000
|
+
<PlusIcon />
|
|
1001
|
+
</FloatingButton>
|
|
1002
|
+
|
|
1003
|
+
// Appears after scrolling
|
|
1004
|
+
<FloatingButton
|
|
1005
|
+
position="middle-right"
|
|
1006
|
+
threshold={300}
|
|
1007
|
+
onClick={handleClick}
|
|
1008
|
+
>
|
|
1009
|
+
<ChatIcon />
|
|
1010
|
+
</FloatingButton>
|
|
1011
|
+
```
|
|
1012
|
+
|
|
1013
|
+
**Props:**
|
|
1014
|
+
- `children: React.ReactNode` - Button content
|
|
1015
|
+
- `position?: FloatingPosition` - Screen position (default: `'bottom-right'`)
|
|
1016
|
+
- `visible?: boolean` - Force visibility regardless of scroll (default: `false`)
|
|
1017
|
+
- `threshold?: number` - Scroll distance before appearing (default: `100`)
|
|
1018
|
+
- `size?: number` - Button size in pixels (default: `48`)
|
|
1019
|
+
- `backgroundColor?: string` - Background color (default: `'#2563eb'`)
|
|
1020
|
+
- `color?: string` - Icon/text color (default: `'#ffffff'`)
|
|
1021
|
+
- `zIndex?: number` - Z-index (default: `1000`)
|
|
1022
|
+
- `onClick?: () => void` - Click handler
|
|
1023
|
+
- `className?: string` - Additional CSS classes
|
|
1024
|
+
- `style?: React.CSSProperties` - Custom inline styles
|
|
1025
|
+
- `aria-label?: string` - Accessibility label
|
|
1026
|
+
|
|
1027
|
+
**Types:**
|
|
1028
|
+
```typescript
|
|
1029
|
+
type FloatingPosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | 'middle-right' | 'middle-left';
|
|
1030
|
+
```
|
|
848
1031
|
|
|
849
1032
|
## 🛠️ Utilities & Hooks
|
|
850
1033
|
|
|
@@ -1107,8 +1290,12 @@ luna-library/
|
|
|
1107
1290
|
│ │ ├── Button.tsx
|
|
1108
1291
|
│ │ ├── Card.tsx
|
|
1109
1292
|
│ │ ├── DataTable.tsx
|
|
1293
|
+
│ │ ├── FloatingButton.tsx
|
|
1294
|
+
│ │ ├── MultiSelect.tsx
|
|
1295
|
+
│ │ ├── Popconfirm.tsx
|
|
1296
|
+
│ │ ├── QRCode.tsx
|
|
1297
|
+
│ │ ├── Toast.tsx
|
|
1110
1298
|
│ │ ├── ... (Other UI Components)
|
|
1111
|
-
|
|
1112
1299
|
│ │ └── index.ts
|
|
1113
1300
|
│ ├── styles.ts # Design tokens and shared style functions
|
|
1114
1301
|
│ ├── types.ts # Shared TypeScript types
|
package/package.json
CHANGED