@vc-shell/framework 1.1.3 → 1.1.5

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.
Files changed (136) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/core/directives/loading/styles.css +1 -1
  3. package/core/plugins/modularity/README.md +347 -17
  4. package/core/plugins/modularity/loader.ts +217 -3
  5. package/dist/core/plugins/modularity/loader.d.ts +4 -0
  6. package/dist/core/plugins/modularity/loader.d.ts.map +1 -1
  7. package/dist/framework.js +1 -1
  8. package/dist/{index-DRL7VovM.js → index-BBHl6nap.js} +1 -1
  9. package/dist/{index-BKR3ecN5.js → index-BG6N4UCY.js} +1 -1
  10. package/dist/{index-Cv6c_1IG.js → index-Bv5as3SI.js} +1 -1
  11. package/dist/{index-BUHouW8T.js → index-C4VyqVxv.js} +1 -1
  12. package/dist/{index-Ek7_XgGk.js → index-CKLiFGZ-.js} +1 -1
  13. package/dist/{index-B83didIY.js → index-CTmAMa_1.js} +1 -1
  14. package/dist/{index-C6tcHNVl.js → index-CtGZgIiV.js} +1 -1
  15. package/dist/{index-DyGIijU2.js → index-D13Jcezf.js} +1 -1
  16. package/dist/{index-CnQ56kqq.js → index-DbpKygJh.js} +1 -1
  17. package/dist/{index-Dfcy8w9c.js → index-DgCtSr4P.js} +1 -1
  18. package/dist/{index-TSGli7LX.js → index-Dh1XjfgY.js} +1 -1
  19. package/dist/{index-BW3krAiY.js → index-DpDbQQg6.js} +1 -1
  20. package/dist/{index-CxMfHOup.js → index-DwuQbDJG.js} +1 -1
  21. package/dist/{index-xFQltarK.js → index-Fhuqbkq2.js} +1 -1
  22. package/dist/{index-BN-_cebP.js → index-JTAZpxKF.js} +1 -1
  23. package/dist/{index-UnPPbmRc.js → index-MKD2CP5c.js} +49617 -48276
  24. package/dist/{index-CGyGGihY.js → index-Q3k1PYzc.js} +1 -1
  25. package/dist/index.css +3 -3
  26. package/dist/shared/components/generic-dropdown/generic-dropdown.vue.d.ts.map +1 -1
  27. package/dist/shared/components/settings-menu-item/settings-menu-item.vue.d.ts.map +1 -1
  28. package/dist/tsconfig.tsbuildinfo +1 -1
  29. package/dist/ui/components/atoms/vc-icon/composables/index.d.ts +3 -0
  30. package/dist/ui/components/atoms/vc-icon/composables/index.d.ts.map +1 -0
  31. package/dist/ui/components/atoms/vc-icon/composables/use-icon-type.d.ts +22 -0
  32. package/dist/ui/components/atoms/vc-icon/composables/use-icon-type.d.ts.map +1 -0
  33. package/dist/ui/components/atoms/vc-icon/composables/use-icon.d.ts +30 -0
  34. package/dist/ui/components/atoms/vc-icon/composables/use-icon.d.ts.map +1 -0
  35. package/dist/ui/components/atoms/vc-icon/index.d.ts +1 -0
  36. package/dist/ui/components/atoms/vc-icon/index.d.ts.map +1 -1
  37. package/dist/ui/components/atoms/vc-icon/types.d.ts +31 -0
  38. package/dist/ui/components/atoms/vc-icon/types.d.ts.map +1 -0
  39. package/dist/ui/components/atoms/vc-icon/vc-bootstrap-icon.vue.d.ts +18 -4
  40. package/dist/ui/components/atoms/vc-icon/vc-bootstrap-icon.vue.d.ts.map +1 -1
  41. package/dist/ui/components/atoms/vc-icon/vc-fontawesome-icon.vue.d.ts +15 -2
  42. package/dist/ui/components/atoms/vc-icon/vc-fontawesome-icon.vue.d.ts.map +1 -1
  43. package/dist/ui/components/atoms/vc-icon/vc-icon-examples.vue.d.ts.map +1 -1
  44. package/dist/ui/components/atoms/vc-icon/vc-icon-test.vue.d.ts.map +1 -1
  45. package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts +11 -6
  46. package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts.map +1 -1
  47. package/dist/ui/components/atoms/vc-icon/vc-lucide-icon.vue.d.ts +21 -4
  48. package/dist/ui/components/atoms/vc-icon/vc-lucide-icon.vue.d.ts.map +1 -1
  49. package/dist/ui/components/atoms/vc-icon/vc-material-icon.vue.d.ts +30 -4
  50. package/dist/ui/components/atoms/vc-icon/vc-material-icon.vue.d.ts.map +1 -1
  51. package/dist/ui/components/atoms/vc-icon/vc-svg-icon.vue.d.ts +33 -0
  52. package/dist/ui/components/atoms/vc-icon/vc-svg-icon.vue.d.ts.map +1 -0
  53. package/dist/ui/components/atoms/vc-widget/vc-widget.vue.d.ts.map +1 -1
  54. package/dist/ui/components/molecules/vc-pagination/vc-pagination.vue.d.ts.map +1 -1
  55. package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue.d.ts.map +1 -1
  56. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/props.d.ts +14 -0
  57. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/props.d.ts.map +1 -0
  58. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-base-button.vue.d.ts +2 -13
  59. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-base-button.vue.d.ts.map +1 -1
  60. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-circle-button.vue.d.ts +1 -1
  61. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-circle-button.vue.d.ts.map +1 -1
  62. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue.d.ts.map +1 -1
  63. package/dist/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue.d.ts +1 -1
  64. package/dist/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue.d.ts.map +1 -1
  65. package/dist/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue.d.ts +1 -1
  66. package/dist/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue.d.ts.map +1 -1
  67. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-body/vc-table-body.vue.d.ts +1 -1
  68. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-body/vc-table-body.vue.d.ts.map +1 -1
  69. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-columns-header/vc-table-columns-header.vue.d.ts +1 -1
  70. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-columns-header/vc-table-columns-header.vue.d.ts.map +1 -1
  71. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-row/vc-table-row.vue.d.ts +1 -1
  72. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-row/vc-table-row.vue.d.ts.map +1 -1
  73. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/vc-table-desktop-view.vue.d.ts +1 -1
  74. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/vc-table-desktop-view.vue.d.ts.map +1 -1
  75. package/dist/ui/components/organisms/vc-table/_internal/vc-table-mobile-view/vc-table-mobile-view.vue.d.ts +1 -1
  76. package/dist/ui/components/organisms/vc-table/_internal/vc-table-mobile-view/vc-table-mobile-view.vue.d.ts.map +1 -1
  77. package/dist/ui/components/organisms/vc-table/composables/useTableActions.d.ts +1 -1
  78. package/dist/ui/components/organisms/vc-table/composables/useTableActions.d.ts.map +1 -1
  79. package/dist/ui/components/organisms/vc-table/composables/useTableColumnReorder.d.ts +1 -1
  80. package/dist/ui/components/organisms/vc-table/composables/useTableColumnReorder.d.ts.map +1 -1
  81. package/dist/ui/components/organisms/vc-table/composables/useTableColumnResize.d.ts +1 -1
  82. package/dist/ui/components/organisms/vc-table/composables/useTableColumnResize.d.ts.map +1 -1
  83. package/dist/ui/components/organisms/vc-table/composables/useTableRowReorder.d.ts +1 -1
  84. package/dist/ui/components/organisms/vc-table/composables/useTableRowReorder.d.ts.map +1 -1
  85. package/dist/ui/components/organisms/vc-table/composables/useTableSelection.d.ts +1 -1
  86. package/dist/ui/components/organisms/vc-table/composables/useTableSelection.d.ts.map +1 -1
  87. package/dist/ui/components/organisms/vc-table/composables/useTableState.d.ts +1 -1
  88. package/dist/ui/components/organisms/vc-table/composables/useTableState.d.ts.map +1 -1
  89. package/dist/ui/components/organisms/vc-table/types.d.ts +36 -0
  90. package/dist/ui/components/organisms/vc-table/types.d.ts.map +1 -0
  91. package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts +2 -34
  92. package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
  93. package/package.json +4 -4
  94. package/shared/components/generic-dropdown/generic-dropdown.vue +1 -1
  95. package/shared/components/settings-menu-item/settings-menu-item.vue +1 -6
  96. package/shared/components/user-dropdown-button/_internal/user-info.vue +3 -3
  97. package/ui/components/atoms/vc-icon/README.md +198 -220
  98. package/ui/components/atoms/vc-icon/composables/index.ts +2 -0
  99. package/ui/components/atoms/vc-icon/composables/use-icon-type.ts +83 -0
  100. package/ui/components/atoms/vc-icon/composables/use-icon.ts +129 -0
  101. package/ui/components/atoms/vc-icon/index.ts +1 -0
  102. package/ui/components/atoms/vc-icon/types.ts +36 -0
  103. package/ui/components/atoms/vc-icon/vc-bootstrap-icon.vue +111 -10
  104. package/ui/components/atoms/vc-icon/vc-fontawesome-icon.vue +119 -17
  105. package/ui/components/atoms/vc-icon/vc-icon-examples.vue +485 -124
  106. package/ui/components/atoms/vc-icon/vc-icon-test.vue +399 -209
  107. package/ui/components/atoms/vc-icon/vc-icon.stories.ts +502 -56
  108. package/ui/components/atoms/vc-icon/vc-icon.vue +240 -155
  109. package/ui/components/atoms/vc-icon/vc-lucide-icon.vue +163 -33
  110. package/ui/components/atoms/vc-icon/vc-material-icon.vue +136 -30
  111. package/ui/components/atoms/vc-icon/vc-svg-icon.vue +168 -0
  112. package/ui/components/atoms/vc-widget/vc-widget.stories.ts +13 -0
  113. package/ui/components/atoms/vc-widget/vc-widget.vue +2 -0
  114. package/ui/components/molecules/vc-multivalue/vc-multivalue.vue +1 -1
  115. package/ui/components/molecules/vc-pagination/vc-pagination.vue +23 -14
  116. package/ui/components/organisms/vc-app/_internal/vc-app-bar/_internal/AppBarHeader.vue +2 -2
  117. package/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue +2 -3
  118. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/props.ts +14 -0
  119. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-base-button.vue +1 -12
  120. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-circle-button.vue +1 -1
  121. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue +65 -32
  122. package/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue +1 -1
  123. package/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue +1 -1
  124. package/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-body/vc-table-body.vue +1 -1
  125. package/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-columns-header/vc-table-columns-header.vue +1 -1
  126. package/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-row/vc-table-row.vue +1 -1
  127. package/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/vc-table-desktop-view.vue +1 -1
  128. package/ui/components/organisms/vc-table/_internal/vc-table-mobile-view/vc-table-mobile-view.vue +1 -1
  129. package/ui/components/organisms/vc-table/composables/useTableActions.ts +1 -1
  130. package/ui/components/organisms/vc-table/composables/useTableColumnReorder.ts +1 -1
  131. package/ui/components/organisms/vc-table/composables/useTableColumnResize.ts +1 -1
  132. package/ui/components/organisms/vc-table/composables/useTableRowReorder.ts +1 -1
  133. package/ui/components/organisms/vc-table/composables/useTableSelection.ts +1 -1
  134. package/ui/components/organisms/vc-table/composables/useTableState.ts +1 -1
  135. package/ui/components/organisms/vc-table/types.ts +32 -0
  136. package/ui/components/organisms/vc-table/vc-table.vue +2 -30
@@ -1,117 +1,80 @@
1
1
  # VcIcon Component
2
2
 
3
- The `VcIcon` component is a versatile icon component that supports multiple icon libraries:
3
+ The `VcIcon` component is a versatile and flexible icon component that provides unified access to multiple icon libraries:
4
4
 
5
- - Font Awesome
6
5
  - Material Symbols
7
6
  - Bootstrap Icons
8
7
  - Lucide Icons
9
- - Custom SVG Components
8
+ - Font Awesome (legacy support)
9
+ - Custom SVG Icons
10
10
 
11
- ## Installation
11
+ ## Features
12
12
 
13
- Before using specific icon types, make sure to install the corresponding libraries:
14
-
15
- ### Font Awesome
16
-
17
- ```bash
18
- npm install @fortawesome/fontawesome-free
19
- ```
20
-
21
- Add to your main.js/ts:
22
- ```js
23
- import '@fortawesome/fontawesome-free/css/all.css';
24
- ```
25
-
26
- ### Material Icons
27
-
28
- ```bash
29
- npm install material-symbols
30
- ```
31
-
32
- Add to your main.js/ts:
33
- ```js
34
- import 'material-symbols';
35
- ```
36
-
37
- ### Bootstrap Icons
38
-
39
- ```bash
40
- npm install bootstrap-icons
41
- ```
42
-
43
- Add to your main.js/ts:
44
- ```js
45
- import 'bootstrap-icons/font/bootstrap-icons.css';
46
- ```
47
-
48
- ### Lucide Icons
49
-
50
- ```bash
51
- npm install lucide-vue-next
52
- ```
53
-
54
- Register the icons you need:
55
- ```js
56
- // For local component usage
57
- import { HomeIcon, UserIcon } from 'lucide-vue-next';
58
-
59
- // For global registration
60
- import { createApp } from 'vue';
61
- import { LucideVue } from 'lucide-vue-next';
62
- import App from './App.vue';
63
-
64
- const app = createApp(App);
65
- app.use(LucideVue, {
66
- componentPrefix: '' // optional - default is 'Lucide'
67
- });
68
- ```
13
+ - **Unified API** for all icon types
14
+ - **Consistent sizing** across different icon libraries
15
+ - **Automatic icon detection** based on prefix
16
+ - **Color variants** for status indicators
17
+ - **Customizable sizing** via props or CSS
18
+ - **Container support** for consistent spacing
19
+ - **SVG icon support** with customizable parameters
69
20
 
70
21
  ## Basic Usage
71
22
 
72
- ### New Unified Syntax (Recommended)
73
-
74
- Use a consistent naming approach with library prefix for all icon types:
75
-
76
23
  ```vue
77
24
  <template>
78
- <!-- Font Awesome Icon (unchanged, already has prefix) -->
79
- <VcIcon icon="fas fa-home" />
80
-
81
- <!-- Material Icon with prefix -->
25
+ <!-- Material Icon -->
82
26
  <VcIcon icon="material-home" />
83
27
 
84
- <!-- Bootstrap Icon (unchanged, already has prefix) -->
28
+ <!-- Bootstrap Icon -->
85
29
  <VcIcon icon="bi-house" />
86
30
 
87
- <!-- Lucide Icon with prefix -->
31
+ <!-- Lucide Icon -->
88
32
  <VcIcon icon="lucide-home" />
89
33
 
90
- <!-- Direct component usage (for tree-shaking) -->
34
+ <!-- Font Awesome Icon -->
35
+ <VcIcon icon="fas fa-home" />
36
+
37
+ <!-- Custom SVG Component -->
91
38
  <VcIcon :icon="HomeIcon" />
39
+
40
+ <!-- External SVG Icon -->
41
+ <VcIcon icon="svg:/assets/icons/home.svg" />
92
42
  </template>
93
43
 
94
44
  <script setup lang="ts">
95
45
  import { HomeIcon } from 'lucide-vue-next';
96
- import VcIcon from 'path/to/vc-icon.vue';
46
+ import { VcIcon } from '@framework/ui/components/atoms/vc-icon';
97
47
  </script>
98
48
  ```
99
49
 
100
- ### Legacy Syntax (Still Supported)
50
+ ## Icon Sizing
51
+
52
+ The component provides predefined sizes that are consistent across all icon types:
101
53
 
102
54
  ```vue
103
55
  <template>
104
- <!-- Font Awesome Icon -->
105
- <VcIcon icon="fas fa-home" />
106
-
107
- <!-- Material Icon (no prefix needed) -->
108
- <VcIcon icon="home" />
109
-
110
- <!-- Bootstrap Icon -->
111
- <VcIcon icon="bi-house" />
56
+ <VcIcon icon="material-home" size="xs" /> <!-- 12px -->
57
+ <VcIcon icon="material-home" size="s" /> <!-- 14px -->
58
+ <VcIcon icon="material-home" size="m" /> <!-- 18px (default) -->
59
+ <VcIcon icon="material-home" size="l" /> <!-- 20px -->
60
+ <VcIcon icon="material-home" size="xl" /> <!-- 22px -->
61
+ <VcIcon icon="material-home" size="xxl" /> <!-- 30px -->
62
+ <VcIcon icon="material-home" size="xxxl" /> <!-- 64px -->
112
63
 
113
- <!-- Lucide Icon with explicit type parameter -->
114
- <VcIcon icon="HomeIcon" type="lucide" />
64
+ <!-- Custom size (in pixels) -->
65
+ <VcIcon icon="material-home" :customSize="42" />
66
+ </template>
67
+ ```
68
+
69
+ ## Color Variants
70
+
71
+ Use the `variant` prop to apply predefined colors for status indicators:
72
+
73
+ ```vue
74
+ <template>
75
+ <VcIcon icon="material-check_circle" variant="success" /> <!-- Success (green) -->
76
+ <VcIcon icon="material-warning" variant="warning" /> <!-- Warning (yellow) -->
77
+ <VcIcon icon="material-error" variant="danger" /> <!-- Danger (red) -->
115
78
  </template>
116
79
  ```
117
80
 
@@ -120,176 +83,191 @@ import VcIcon from 'path/to/vc-icon.vue';
120
83
  | Prop | Type | Default | Description |
121
84
  |------|------|---------|-------------|
122
85
  | `icon` | `string \| Component` | `"fas fa-square-full"` | The icon to display. Can be a string identifier or a component instance |
123
- | `size` | `"xs" \| "s" \| "m" \| "l" \| "xl" \| "xxl" \| "xxxl"` | `"m"` | Size of the icon |
124
- | `variant` | `"warning" \| "danger" \| "success"` | `undefined` | Color variant |
125
- | `type` | `"fontawesome" \| "material" \| "bootstrap" \| "lucide" \| "custom" \| "auto"` | `"auto"` | Icon library type. Use `auto` for automatic detection (legacy) |
126
- | `materialIconType` | `"outlined" \| "rounded" \| "sharp"` | `"outlined"` | Type of Material icon |
127
- | `materialIconFill` | `number` | `0` | Fill property for Material icons |
128
- | `materialIconWeight` | `number` | `400` | Weight property for Material icons |
129
- | `materialIconGrade` | `number` | `0` | Grade property for Material icons |
130
- | `strokeWidth` | `number` | `2` | Stroke width for Lucide icons |
86
+ | `size` | `"xs" \| "s" \| "m" \| "l" \| "xl" \| "xxl" \| "xxxl"` | `"m"` | Predefined size of the icon |
87
+ | `variant` | `"warning" \| "danger" \| "success"` | `undefined` | Color variant for status indication |
88
+ | `useContainer` | `boolean` | `true` | Whether to wrap the icon in a container for consistent spacing |
89
+ | `customSize` | `number` | `undefined` | Custom size in pixels (overrides `size` prop) |
90
+ | `basePath` | `string` | `"/assets/icons"` | Base path for SVG icons (only for SVG icons) |
131
91
 
132
- ## Auto Detection
92
+ ## Size Normalization
133
93
 
134
- The component automatically detects the icon type based on the icon name:
94
+ The component automatically normalizes icon sizes across different libraries, ensuring they appear visually consistent when using the same size prop.
135
95
 
136
- - **Prefixed approach (recommended):**
137
- - `material-name` → Material icon
138
- - `lucide-name` → Lucide icon
139
- - `bi-name` → Bootstrap icon
140
- - `fa-name` or `fas fa-name` → Font Awesome icon
141
-
142
- - **Legacy approach (still supported):**
143
- - Strings containing `fa-` are treated as Font Awesome icons
144
- - Strings starting with `bi-` are treated as Bootstrap icons
145
- - Strings ending with `Icon` are treated as Lucide icons
146
- - Other strings without these patterns are treated as Material icons
147
- - Component instances are treated as custom SVG components
148
-
149
- ## Size Mapping
150
-
151
- The component maps the size prop to pixel values:
152
-
153
- - `xs`: 12px
154
- - `s`: 14px
155
- - `m`: 18px
156
- - `l`: 20px
157
- - `xl`: 22px
158
- - `xxl`: 30px
159
- - `xxxl`: 64px
160
-
161
- > **Note about icon sizing:**
162
- >
163
- > Different icon libraries have naturally different sizing characteristics:
164
- > - **Font Awesome** icons are used as the base sizes (reference standard)
165
- > - **Bootstrap Icons** require a slight reduction (factor 0.95)
166
- > - **Material Icons** require a slight increase (factor 1.1)
167
- > - **Lucide Icons** (SVG) require a significant increase (factor 1.2)
168
- >
169
- > The `VcIcon` component automatically applies the necessary adjustments for visual consistency across all icon types. Thanks to this, developers can specify the same size (`size="m"`) for all icons and achieve a visually consistent result.
170
-
171
- ## Examples
172
-
173
- ### Font Awesome
96
+ This normalization is achieved through scaling factors for each icon library:
174
97
 
175
- ```vue
176
- <VcIcon icon="fas fa-home" />
177
- <VcIcon icon="far fa-user" />
178
- <VcIcon icon="fas fa-cog" size="xl" />
179
- <VcIcon icon="fas fa-exclamation-triangle" variant="warning" />
180
- ```
98
+ - **Font Awesome** (base reference): 1.0
99
+ - **Material Icons**: 1.3
100
+ - **Bootstrap Icons**: 0.95
101
+ - **Lucide Icons**: 1
181
102
 
182
- ### Material Icons
103
+ These scaling factors provide a consistent experience regardless of the icon library used.
183
104
 
184
- ```vue
185
- <!-- Legacy syntax -->
186
- <VcIcon icon="home" />
187
- <VcIcon icon="settings" materialIconType="rounded" />
188
-
189
- <!-- New syntax with prefix -->
190
- <VcIcon icon="material-home" />
191
- <VcIcon icon="material-settings" materialIconType="rounded" />
192
- <VcIcon icon="material-warning" variant="warning" size="xl" />
193
- ```
105
+ ## Icon Detection
194
106
 
195
- ### Bootstrap Icons
107
+ The component automatically detects the icon type based on the icon name:
196
108
 
197
- ```vue
198
- <VcIcon icon="bi-house" />
199
- <VcIcon icon="bi-person" />
200
- <VcIcon icon="bi-gear" size="xl" />
201
- <VcIcon icon="bi-exclamation-triangle" variant="warning" />
202
- ```
109
+ - Strings starting with `material-` → Material Symbols
110
+ - Strings starting with `bi-` → Bootstrap Icons
111
+ - Strings starting with `lucide-` → Lucide Icons
112
+ - Strings starting with `fa-` or containing `fa-` → Font Awesome
113
+ - Strings starting with `svg:` → SVG files
114
+ - Component instances → Custom components
115
+
116
+ ## Styling Icons with CSS
117
+
118
+ The `VcIcon` component supports inheriting size from CSS styles. This allows you to control the icon size through CSS styles applied to the parent element or directly to the icon component.
203
119
 
204
- ### Lucide Icons
120
+ ### Examples of CSS Styling
205
121
 
206
122
  ```vue
207
123
  <template>
208
- <!-- Legacy syntax with type parameter -->
209
- <VcIcon icon="HomeIcon" type="lucide" />
210
-
211
- <!-- New syntax with prefix -->
212
- <VcIcon icon="lucide-home" />
213
- <VcIcon icon="lucide-settings" size="xl" />
214
- <VcIcon icon="lucide-alert-triangle" variant="warning" />
215
-
216
- <!-- Direct component usage (preferred for tree-shaking) -->
217
- <VcIcon :icon="HomeIcon" />
124
+ <!-- Setting size through parent element -->
125
+ <div class="custom-icon-parent">
126
+ <VcIcon icon="fas fa-star" />
127
+ </div>
128
+
129
+ <!-- Inline styles -->
130
+ <div style="font-size: 32px;">
131
+ <VcIcon icon="material-home" />
132
+ </div>
133
+
134
+ <!-- Direct styling -->
135
+ <VcIcon
136
+ icon="bi-heart"
137
+ class="custom-icon"
138
+ />
139
+
140
+ <!-- Styling with hover effects -->
141
+ <VcIcon
142
+ icon="lucide-settings"
143
+ class="hover-icon"
144
+ />
218
145
  </template>
219
146
 
220
- <script setup>
221
- import { HomeIcon, SettingsIcon, AlertTriangle } from 'lucide-vue-next';
222
- </script>
147
+ <style>
148
+ .custom-icon-parent {
149
+ font-size: 24px; /* Icon will inherit this size */
150
+ }
151
+
152
+ .custom-icon {
153
+ font-size: 40px;
154
+ color: #f03e3e;
155
+ }
156
+
157
+ .hover-icon {
158
+ font-size: 24px;
159
+ transition: all 0.3s ease;
160
+ }
161
+
162
+ .hover-icon:hover {
163
+ font-size: 32px;
164
+ color: #4dabf7;
165
+ }
166
+ </style>
223
167
  ```
224
168
 
225
- ## Migration Guide
169
+ ### Size Priority
226
170
 
227
- ### From Custom SVG Components to Material Icons
171
+ The icon size is determined in the following order of priority:
228
172
 
229
- ```vue
230
- <!-- Before -->
231
- <VcIcon icon="SearchIcon" />
232
- <VcIcon icon="HomeIcon" />
173
+ 1. `customSize` prop (highest priority)
174
+ 2. External CSS styles (font-size applied to the icon)
175
+ 3. Preset size via the `size` prop (lowest priority)
233
176
 
234
- <!-- After (legacy) -->
235
- <VcIcon icon="search" />
236
- <VcIcon icon="home" />
177
+ This allows flexible configuration of icon sizes in various usage contexts.
237
178
 
238
- <!-- After (new syntax) -->
239
- <VcIcon icon="material-search" />
240
- <VcIcon icon="material-home" />
241
- ```
179
+ ## Library-Specific Features
242
180
 
243
- ### From Font Awesome to Bootstrap Icons
181
+ ### Material Symbols
182
+
183
+ Material Symbols support additional customization properties:
244
184
 
245
185
  ```vue
246
- <!-- Before -->
247
- <VcIcon icon="fas fa-home" />
248
- <VcIcon icon="fas fa-user" />
249
- <VcIcon icon="fas fa-cog" />
250
-
251
- <!-- After -->
252
- <VcIcon icon="bi-house" />
253
- <VcIcon icon="bi-person" />
254
- <VcIcon icon="bi-gear" />
186
+ <template>
187
+ <!-- Different icon types -->
188
+ <VcIcon
189
+ icon="material-settings"
190
+ material-icon-type="outlined"
191
+ />
192
+ <VcIcon
193
+ icon="material-settings"
194
+ material-icon-type="rounded"
195
+ />
196
+ <VcIcon
197
+ icon="material-settings"
198
+ material-icon-type="sharp"
199
+ />
200
+
201
+ <!-- Fill variations -->
202
+ <VcIcon
203
+ icon="material-favorite"
204
+ :material-icon-fill="0"
205
+ />
206
+ <VcIcon
207
+ icon="material-favorite"
208
+ :material-icon-fill="0.5"
209
+ />
210
+ <VcIcon
211
+ icon="material-favorite"
212
+ :material-icon-fill="1"
213
+ />
214
+
215
+ <!-- Weight variations -->
216
+ <VcIcon
217
+ icon="material-favorite"
218
+ :material-icon-weight="100"
219
+ />
220
+ <VcIcon
221
+ icon="material-favorite"
222
+ :material-icon-weight="400"
223
+ />
224
+ <VcIcon
225
+ icon="material-favorite"
226
+ :material-icon-weight="700"
227
+ />
228
+ </template>
255
229
  ```
256
230
 
257
- ### From Material Icons to Lucide Icons
231
+ ### Using SVG Icons
232
+
233
+ You can use SVG icons with the `svg:` prefix:
258
234
 
259
235
  ```vue
260
- <!-- Before -->
261
- <VcIcon icon="home" />
262
- <VcIcon icon="settings" />
236
+ <template>
237
+ <!-- Using path relative to basePath -->
238
+ <VcIcon icon="svg:menu.svg" />
239
+
240
+ <!-- Using absolute path -->
241
+ <VcIcon icon="svg:/assets/icons/cart.svg" />
242
+
243
+ <!-- With custom base path -->
244
+ <VcIcon icon="svg:star.svg" basePath="/custom/icons/path" />
245
+
246
+ <!-- With stroke width -->
247
+ <VcIcon icon="svg:circle.svg" :stroke-width="1.5" />
248
+ </template>
249
+ ```
250
+
251
+ By default, SVG icons are looked up in `/assets/icons`, but this path can be changed using the `basePath` parameter.
263
252
 
264
- <!-- After (legacy) -->
265
- <VcIcon icon="HomeIcon" type="lucide" />
266
- <VcIcon icon="SettingsIcon" type="lucide" />
253
+ ## Container Support
267
254
 
268
- <!-- After (new syntax) -->
269
- <VcIcon icon="lucide-home" />
270
- <VcIcon icon="lucide-settings" />
255
+ The component can wrap icons in a container for consistent spacing:
271
256
 
272
- <!-- Or with direct components (preferred for tree-shaking) -->
257
+ ```vue
273
258
  <template>
274
- <VcIcon :icon="HomeIcon" />
275
- <VcIcon :icon="SettingsIcon" />
259
+ <!-- With container (default) -->
260
+ <VcIcon icon="material-home" />
261
+
262
+ <!-- Without container -->
263
+ <VcIcon icon="material-home" :use-container="false" />
276
264
  </template>
277
-
278
- <script setup>
279
- import { HomeIcon, SettingsIcon } from 'lucide-vue-next';
280
- </script>
281
265
  ```
282
266
 
283
- ## Icon Picker Tool
284
-
285
- To help developers choose the right icon name from each library, we recommend using these resources:
286
267
 
287
- - **Font Awesome**: [https://fontawesome.com/icons](https://fontawesome.com/icons)
288
- - **Material Symbols**: [https://fonts.google.com/icons](https://fonts.google.com/icons)
289
- - **Bootstrap Icons**: [https://icons.getbootstrap.com/](https://icons.getbootstrap.com/)
290
- - **Lucide Icons**: [https://lucide.dev/icons/](https://lucide.dev/icons/)
268
+ ## Best Practices
291
269
 
292
- ## Material Icon Documentation
293
- For a complete list of available Material icons, visit:
294
- - [Material Symbols Documentation](https://fonts.google.com/icons)
295
- - [Material Symbols Demo](https://marella.github.io/material-symbols/demo/)
270
+ 1. Use the prefixed syntax (`material-`, `bi-`, `lucide-`, etc.) for all icons
271
+ 2. Use the same `size` prop across different icon types for visual consistency
272
+ 3. Use the container feature for consistent spacing in complex layouts
273
+ 4. Leverage CSS styling for dynamic effects like hover states
@@ -0,0 +1,2 @@
1
+ export * from "./use-icon";
2
+ export * from "./use-icon-type";
@@ -0,0 +1,83 @@
1
+ import { computed } from "vue";
2
+ import type { Component } from "vue";
3
+ import type { IconType } from "../types";
4
+
5
+ interface UseIconTypeOptions {
6
+ /**
7
+ * Icon (string or component)
8
+ */
9
+ icon: string | Component;
10
+ }
11
+
12
+ /**
13
+ * Composable for determining the icon type
14
+ */
15
+ export function useIconType(options: UseIconTypeOptions) {
16
+ const { icon } = options;
17
+
18
+ // Determining the icon type
19
+ const iconType = computed((): IconType => {
20
+ if (typeof icon !== "string") {
21
+ return "custom";
22
+ }
23
+
24
+ // Determining by prefixes
25
+ if (icon.startsWith("fa-") || icon.includes("fa-")) {
26
+ return "fontawesome";
27
+ }
28
+
29
+ if (icon.startsWith("bi-")) {
30
+ return "bootstrap";
31
+ }
32
+
33
+ if (icon.startsWith("lucide-")) {
34
+ return "lucide";
35
+ }
36
+
37
+ if (icon.startsWith("material-")) {
38
+ return "material";
39
+ }
40
+
41
+ // For backward compatibility with Lucide, having the Icon suffix
42
+ if (icon.endsWith("Icon")) {
43
+ return "lucide";
44
+ }
45
+
46
+ // For backward compatibility with Material Icons without a prefix
47
+ return "material";
48
+ });
49
+
50
+ // Normalize the icon name (remove prefixes)
51
+ const normalizedIconName = computed(() => {
52
+ if (typeof icon !== "string") {
53
+ return icon;
54
+ }
55
+
56
+ if (iconType.value === "material" && icon.startsWith("material-")) {
57
+ return icon.replace(/^material-/, "");
58
+ }
59
+
60
+ if (iconType.value === "lucide" && icon.startsWith("lucide-")) {
61
+ const baseName = icon.replace(/^lucide-/, "");
62
+ // In Lucide, you need to convert the name to PascalCase and add the Icon suffix
63
+ const pascalCase = baseName
64
+ .split("-")
65
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
66
+ .join("");
67
+
68
+ return pascalCase.endsWith("Icon") ? pascalCase : `${pascalCase}Icon`;
69
+ }
70
+
71
+ return icon;
72
+ });
73
+
74
+ return {
75
+ iconType,
76
+ normalizedIconName,
77
+ isMaterialIcon: computed(() => iconType.value === "material"),
78
+ isBootstrapIcon: computed(() => iconType.value === "bootstrap"),
79
+ isLucideIcon: computed(() => iconType.value === "lucide"),
80
+ isFontAwesomeIcon: computed(() => iconType.value === "fontawesome"),
81
+ isCustomIcon: computed(() => iconType.value === "custom"),
82
+ };
83
+ }