pns-component-library 1.6.6 → 1.6.8

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
@@ -4,15 +4,15 @@ A comprehensive Vue 3 component library built with modern development practices,
4
4
 
5
5
  ## 🚀 Features
6
6
 
7
- - **11 Production-Ready Components** - Form controls, layout components, and utility components
8
- - **2 Powerful Composables** - Reusable logic for common patterns
7
+ - **15 Production-Ready Components** - Form controls, layout components, and utility components
8
+ - **3 Powerful Composables** - Reusable logic for common patterns
9
9
  - **2 Custom Directives** - Loading states and UI enhancements
10
10
  - **Vue 3 Composition API** - Modern, performant, and type-safe
11
11
  - **Fully Responsive UI & UX** - Components automatically adapt to all screen sizes with optimized mobile-first design and touch-friendly interactions
12
12
  - **Accessibility** - ARIA attributes and keyboard navigation support
13
13
  - **Customizable Themes** - Multiple built-in color schemes
14
14
 
15
- > Newly released public components: `DropdownMenu`, `Badge`, `FloatingActionButton`, `DynamicColorResponsiveButton`.
15
+ > Newly released public components: `DropdownMenu`, `Badge`, `FloatingActionButton`, `DynamicColorResponsiveButton`, `Snackbar`.
16
16
 
17
17
  ## 🆕 What's New
18
18
 
@@ -886,6 +886,144 @@ Toast notification component for user feedback.
886
886
  />
887
887
  ```
888
888
 
889
+ #### Snackbar
890
+ Bottom-positioned snackbar component with optional action button, auto-dismiss, and responsive layout. Supports both static usage and programmatic creation via `FloatingSnackbar` composable.
891
+
892
+ ##### Attributes
893
+
894
+ | Attribute | Description | Type | Default |
895
+ |-----------|-------------|------|---------|
896
+ | content | snackbar message text | `string` | — |
897
+ | action | action button label (optional) | `string` | — |
898
+ | padding_size | padding size | `'normal' \| 'large'` | `'normal'` |
899
+ | with_close_icon | show close icon | `boolean` | `true` |
900
+ | customized_class | custom CSS class | `string` | — |
901
+ | mounted_programmatically | internal flag for programmatic mounting | `boolean` | `false` |
902
+ | hide_after | auto-hide after milliseconds (0 = never, default: 3000) | `number` | `3000` |
903
+
904
+ ##### Events
905
+
906
+ | Event | Description | Parameters |
907
+ |-------|-------------|------------|
908
+ | close | triggers when snackbar is closed | — |
909
+ | action | triggers when action button is clicked | — |
910
+
911
+ ##### Slots
912
+
913
+ | Name | Description |
914
+ |------|-------------|
915
+ | default | custom snackbar content (overrides `content` prop) |
916
+
917
+ ##### Layout Behavior
918
+
919
+ - **Row Layout** (default): Content on left, action button + close icon on right
920
+ - Used when action button text is ≤10 characters
921
+ - **Stacked Layout** (column): Content above, action button + close icon below (right-aligned)
922
+ - Automatically triggered when action button text is >10 characters
923
+ - Prevents text overflow and maintains readability
924
+
925
+ ##### Padding Specifications
926
+
927
+ | Size | Top/Bottom | Left | Right |
928
+ |------|-----------|------|-------|
929
+ | normal | 0px | 16px | 0px |
930
+ | large | 10px | 16px | 0px |
931
+
932
+ > **Note**: Text content has internal padding of 14px top/bottom and 14px right for proper spacing.
933
+
934
+ ##### Usage
935
+
936
+ ```vue
937
+ <template>
938
+ <!-- Basic snackbar with action -->
939
+ <Snackbar
940
+ content="File deleted successfully"
941
+ action="Undo"
942
+ :with_close_icon="true"
943
+ />
944
+
945
+ <!-- Snackbar without action button -->
946
+ <Snackbar
947
+ content="Changes saved"
948
+ :with_close_icon="true"
949
+ />
950
+
951
+ <!-- Snackbar with larger padding -->
952
+ <Snackbar
953
+ content="Snackbar with larger padding"
954
+ action="Action"
955
+ padding_size="large"
956
+ />
957
+
958
+ <!-- Snackbar with long action text (auto stacked layout) -->
959
+ <Snackbar
960
+ content="This will use column layout"
961
+ action="Long Action Button"
962
+ />
963
+
964
+ <!-- Disable auto-hide -->
965
+ <Snackbar
966
+ content="This will not auto-hide"
967
+ action="Dismiss"
968
+ :hide_after="0"
969
+ />
970
+
971
+ <!-- With event handlers -->
972
+ <Snackbar
973
+ content="Click action to see event"
974
+ action="Click Me"
975
+ @action="handleAction"
976
+ @close="handleClose"
977
+ />
978
+ </template>
979
+
980
+ <script setup>
981
+ function handleAction() {
982
+ console.log('Action clicked')
983
+ }
984
+
985
+ function handleClose() {
986
+ console.log('Snackbar closed')
987
+ }
988
+ </script>
989
+ ```
990
+
991
+ ##### FloatingSnackbar Composable
992
+
993
+ For programmatic snackbar creation (recommended approach):
994
+
995
+ ```javascript
996
+ import { FloatingSnackbar } from 'pns-component-library'
997
+
998
+ // Basic usage
999
+ FloatingSnackbar({
1000
+ content: 'File deleted successfully',
1001
+ action: 'Undo',
1002
+ with_close_icon: true,
1003
+ onAction: () => {
1004
+ console.log('Undo clicked')
1005
+ },
1006
+ onClose: () => {
1007
+ console.log('Snackbar closed')
1008
+ }
1009
+ })
1010
+
1011
+ // Without auto-hide
1012
+ FloatingSnackbar({
1013
+ content: 'This will not auto-hide',
1014
+ action: 'Dismiss',
1015
+ hide_after: 0
1016
+ })
1017
+
1018
+ // With custom slot content
1019
+ FloatingSnackbar({
1020
+ action: 'Action',
1021
+ with_close_icon: true
1022
+ }, {
1023
+ default: () => h('div', { style: { fontWeight: 'bold' } }, 'Custom content')
1024
+ })
1025
+ ```
1026
+
889
1027
  #### WholePageErrorPopup
890
1028
  Full-page error overlay for critical error states.
891
1029