frappe-ui 0.1.177 → 0.1.178

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frappe-ui",
3
- "version": "0.1.177",
3
+ "version": "0.1.178",
4
4
  "description": "A set of components and utilities for rapid UI development",
5
5
  "main": "./src/index.ts",
6
6
  "type": "module",
@@ -32,7 +32,6 @@
32
32
  "dependencies": {
33
33
  "@floating-ui/vue": "^1.1.6",
34
34
  "@headlessui/vue": "^1.7.14",
35
- "@iconify-json/lucide": "^1.2.57",
36
35
  "@popperjs/core": "^2.11.2",
37
36
  "@tailwindcss/forms": "^0.5.3",
38
37
  "@tailwindcss/typography": "^0.5.16",
@@ -68,6 +67,7 @@
68
67
  "highlight.js": "^11.11.1",
69
68
  "idb-keyval": "^6.2.0",
70
69
  "lowlight": "^3.3.0",
70
+ "lucide-static": "^0.479.0",
71
71
  "marked": "^15.0.12",
72
72
  "ora": "5.4.1",
73
73
  "prettier": "^3.3.2",
@@ -5,12 +5,12 @@ import { Button } from '../Button'
5
5
  const actions = [
6
6
  {
7
7
  label: 'Edit',
8
- icon: LucideEdit,
8
+ icon: 'edit',
9
9
  onClick: () => console.log('Edit clicked'),
10
10
  },
11
11
  {
12
12
  label: 'Delete',
13
- icon: LucideTrash2,
13
+ icon: 'trash-2',
14
14
  onClick: () => console.log('Delete clicked'),
15
15
  },
16
16
  ]
@@ -21,42 +21,42 @@ const groupedActions = [
21
21
  items: [
22
22
  {
23
23
  label: 'Edit',
24
- icon: LucideEdit,
24
+ icon: 'edit',
25
25
  onClick: () => console.log('Edit clicked'),
26
26
  },
27
27
  {
28
28
  label: 'Duplicate',
29
- icon: LucideCopy,
29
+ icon: 'copy',
30
30
  onClick: () => console.log('Duplicate clicked'),
31
31
  },
32
32
  {
33
33
  label: 'More Actions',
34
- icon: LucideMoreHorizontal,
34
+ icon: 'more-horizontal',
35
35
  submenu: [
36
36
  {
37
37
  label: 'Archive',
38
- icon: LucideArchive,
38
+ icon: 'archive',
39
39
  onClick: () => console.log('Archive clicked'),
40
40
  },
41
41
  {
42
42
  label: 'Export',
43
- icon: LucideDownload,
43
+ icon: 'download',
44
44
  submenu: [
45
45
  {
46
46
  label: 'Export as PDF',
47
- icon: LucideFileText,
47
+ icon: 'file-text',
48
48
  onClick: () => console.log('Export as PDF clicked'),
49
49
  },
50
50
  {
51
51
  label: 'Export as CSV',
52
- icon: LucideFile,
52
+ icon: 'file',
53
53
  onClick: () => console.log('Export as CSV clicked'),
54
54
  },
55
55
  ],
56
56
  },
57
57
  {
58
58
  label: 'Share',
59
- icon: LucideShare,
59
+ icon: 'share',
60
60
  onClick: () => console.log('Share clicked'),
61
61
  },
62
62
  ],
@@ -68,7 +68,7 @@ const groupedActions = [
68
68
  items: [
69
69
  {
70
70
  label: 'Delete',
71
- icon: LucideTrash2,
71
+ icon: 'trash-2',
72
72
  onClick: () => console.log('Delete clicked'),
73
73
  },
74
74
  ],
@@ -78,19 +78,19 @@ const groupedActions = [
78
78
  const submenuActions = [
79
79
  {
80
80
  label: 'New',
81
- icon: LucidePlus,
81
+ icon: 'plus',
82
82
  submenu: [
83
83
  {
84
84
  group: 'Documents',
85
85
  items: [
86
86
  {
87
87
  label: 'New Document',
88
- icon: LucideFilePlus,
88
+ icon: 'file-plus',
89
89
  onClick: () => console.log('New Document clicked'),
90
90
  },
91
91
  {
92
92
  label: 'New Template',
93
- icon: LucideFileText,
93
+ icon: 'file-text',
94
94
  onClick: () => console.log('New Template clicked'),
95
95
  },
96
96
  ],
@@ -100,12 +100,12 @@ const submenuActions = [
100
100
  items: [
101
101
  {
102
102
  label: 'New Folder',
103
- icon: LucideFolderPlus,
103
+ icon: 'folder-plus',
104
104
  onClick: () => console.log('New Folder clicked'),
105
105
  },
106
106
  {
107
107
  label: 'New Project',
108
- icon: LucideBriefcase,
108
+ icon: 'briefcase',
109
109
  onClick: () => console.log('New Project clicked'),
110
110
  },
111
111
  ],
@@ -114,21 +114,21 @@ const submenuActions = [
114
114
  },
115
115
  {
116
116
  label: 'Edit',
117
- icon: LucideEdit,
117
+ icon: 'edit',
118
118
  onClick: () => console.log('Edit clicked'),
119
119
  },
120
120
  {
121
121
  label: 'Share',
122
- icon: LucideShare,
122
+ icon: 'share',
123
123
  submenu: [
124
124
  {
125
125
  label: 'Share with Link',
126
- icon: LucideLink,
126
+ icon: 'link',
127
127
  onClick: () => console.log('Share with Link clicked'),
128
128
  },
129
129
  {
130
130
  label: 'Share with Email',
131
- icon: LucideMail,
131
+ icon: 'mail',
132
132
  onClick: () => console.log('Share with Email clicked'),
133
133
  },
134
134
  {
@@ -136,12 +136,12 @@ const submenuActions = [
136
136
  items: [
137
137
  {
138
138
  label: 'Share Settings',
139
- icon: LucideSettings,
139
+ icon: 'settings',
140
140
  onClick: () => console.log('Share Settings clicked'),
141
141
  },
142
142
  {
143
143
  label: 'Permission Management',
144
- icon: LucideShield,
144
+ icon: 'shield',
145
145
  onClick: () => console.log('Permission Management clicked'),
146
146
  },
147
147
  ],
@@ -1,12 +1,9 @@
1
- import { FunctionalComponent } from 'vue'
2
1
  import { RouterLinkProps } from 'vue-router'
3
2
  import { ButtonProps } from '../Button'
4
3
 
5
- export type Icon = string | FunctionalComponent
6
-
7
4
  export type DropdownOption = {
8
5
  label: string
9
- icon?: Icon
6
+ icon?: string | null
10
7
  component?: any
11
8
  onClick?: () => void
12
9
  route?: RouterLinkProps['to']
package/src/style.css CHANGED
@@ -3,7 +3,3 @@
3
3
  @tailwind base;
4
4
  @tailwind components;
5
5
  @tailwind utilities;
6
-
7
- svg[data-lucide] * {
8
- stroke-width: 1.5 !important;
9
- }
@@ -1,7 +1,8 @@
1
+ import * as LucideIcons from 'lucide-static'
1
2
  import AutoImport from 'unplugin-auto-import/vite'
2
- import IconsResolver from 'unplugin-icons/resolver'
3
3
  import Icons from 'unplugin-icons/vite'
4
4
  import Components from 'unplugin-vue-components/vite'
5
+ import IconsResolver from 'unplugin-icons/resolver'
5
6
 
6
7
  export function lucideIcons() {
7
8
  const resolverObj = {
@@ -16,11 +17,52 @@ export function lucideIcons() {
16
17
  AutoImport(resolverObj),
17
18
  Components(resolverObj),
18
19
  Icons({
19
- iconCustomizer: (collection, icon, props) => {
20
- if (collection === 'lucide') {
21
- props['data-lucide'] = icon
22
- }
20
+ customCollections: {
21
+ lucide: getIcons(),
23
22
  },
24
23
  }),
25
24
  ]
26
25
  }
26
+
27
+ function getIcons() {
28
+ let icons = {}
29
+ for (const icon in LucideIcons) {
30
+ if (icon === 'default') {
31
+ continue
32
+ }
33
+ let iconSvg = LucideIcons[icon]
34
+
35
+ // set stroke-width to 1.5
36
+ if (typeof iconSvg === 'string' && iconSvg.includes('stroke-width')) {
37
+ iconSvg = iconSvg.replace(/stroke-width="2"/g, 'stroke-width="1.5"')
38
+ }
39
+ icons[icon] = iconSvg
40
+
41
+ let dashKeys = camelToDash(icon)
42
+ for (let dashKey of dashKeys) {
43
+ if (dashKey !== icon) {
44
+ icons[dashKey] = iconSvg
45
+ }
46
+ }
47
+ }
48
+ return icons
49
+ }
50
+
51
+ function camelToDash(key) {
52
+ // barChart2 -> bar-chart-2
53
+ let withNumber = key.replace(/[A-Z0-9]/g, (m) => '-' + m.toLowerCase())
54
+ if (withNumber.startsWith('-')) {
55
+ withNumber = withNumber.substring(1)
56
+ }
57
+ // barChart2 -> bar-chart2
58
+ let withoutNumber = key.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase())
59
+ if (withoutNumber.startsWith('-')) {
60
+ withoutNumber = withoutNumber.substring(1)
61
+ }
62
+
63
+ if (withNumber !== withoutNumber) {
64
+ // both are required because unplugin icon resolver doesn't put a dash before numbers
65
+ return [withNumber, withoutNumber]
66
+ }
67
+ return [withNumber]
68
+ }