@indielayer/ui 1.0.0-alpha.7 → 1.0.0

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 (209) hide show
  1. package/README.md +6 -3
  2. package/lib/index.cjs.js +1 -15
  3. package/lib/index.es.js +4453 -3651
  4. package/lib/nuxt.js +2 -1
  5. package/package.json +16 -6
  6. package/src/common/icons.ts +15 -0
  7. package/src/common/utils.ts +68 -0
  8. package/src/components/alert/Alert.theme.ts +57 -0
  9. package/src/components/alert/Alert.vue +51 -127
  10. package/src/components/alert/__tests__/Alert.spec.ts +14 -0
  11. package/src/components/avatar/Avatar.theme.ts +39 -0
  12. package/src/components/avatar/Avatar.vue +58 -96
  13. package/src/components/avatar/__tests__/Avatar.spec.ts +11 -0
  14. package/src/components/badge/Badge.theme.ts +13 -0
  15. package/src/components/badge/Badge.vue +58 -65
  16. package/src/components/badge/__tests__/Badge.spec.ts +11 -0
  17. package/src/components/breadcrumbs/Breadcrumbs.theme.ts +9 -0
  18. package/src/components/breadcrumbs/Breadcrumbs.vue +34 -24
  19. package/src/components/breadcrumbs/__tests__/Breadcrumbs.spec.ts +11 -0
  20. package/src/components/button/Button.theme.ts +234 -0
  21. package/src/components/button/Button.vue +94 -356
  22. package/src/components/button/ButtonGroup.theme.ts +5 -0
  23. package/src/components/button/ButtonGroup.vue +30 -29
  24. package/src/components/button/__tests__/ Button.spec.ts +11 -0
  25. package/src/components/button/__tests__/ ButtonGroup.spec.ts +11 -0
  26. package/src/components/card/Card.theme.ts +7 -0
  27. package/src/components/card/Card.vue +18 -11
  28. package/src/components/card/__tests__/Card.spec.ts +11 -0
  29. package/src/components/checkbox/Checkbox.theme.ts +92 -0
  30. package/src/components/checkbox/Checkbox.vue +69 -156
  31. package/src/components/checkbox/__tests__/Checkbox.spec.ts +11 -0
  32. package/src/components/collapse/Collapse.theme.ts +11 -0
  33. package/src/components/collapse/Collapse.vue +99 -118
  34. package/src/components/collapse/__tests__/Collapse.spec.ts +11 -0
  35. package/src/components/container/Container.theme.ts +7 -0
  36. package/src/components/container/Container.vue +17 -9
  37. package/src/components/container/__tests__/Container.spec.ts +11 -0
  38. package/src/components/divider/Divider.theme.ts +11 -0
  39. package/src/components/divider/Divider.vue +22 -18
  40. package/src/components/divider/__tests__/Divider.spec.ts +11 -0
  41. package/src/components/drawer/Drawer.theme.ts +9 -0
  42. package/src/components/drawer/Drawer.vue +160 -177
  43. package/src/components/drawer/__tests__/Drawer.spec.ts +11 -0
  44. package/src/components/form/Form.theme.ts +7 -0
  45. package/src/components/form/Form.vue +90 -73
  46. package/src/components/form/__tests__/Form.spec.ts +11 -0
  47. package/src/components/helpers/InputError.tsx +14 -0
  48. package/src/components/icon/Icon.theme.ts +16 -0
  49. package/src/components/icon/Icon.vue +72 -88
  50. package/src/components/icon/__tests__/Icon.spec.ts +11 -0
  51. package/src/components/image/Image.theme.ts +7 -0
  52. package/src/components/image/Image.vue +22 -23
  53. package/src/components/image/__tests__/Image.spec.ts +11 -0
  54. package/src/components/index.ts +3 -3
  55. package/src/components/input/Input.theme.ts +44 -0
  56. package/src/components/input/Input.vue +97 -130
  57. package/src/components/input/__tests__/Input.spec.ts +11 -0
  58. package/src/components/link/Link.theme.ts +26 -0
  59. package/src/components/link/Link.vue +41 -66
  60. package/src/components/link/__tests__/Link.spec.ts +11 -0
  61. package/src/components/menu/Menu.theme.ts +7 -0
  62. package/src/components/menu/Menu.vue +54 -45
  63. package/src/components/menu/MenuItem.theme.ts +107 -0
  64. package/src/components/menu/MenuItem.vue +97 -199
  65. package/src/components/menu/__tests__/Menu.spec.ts +11 -0
  66. package/src/components/menu/__tests__/MenuItem.spec.ts +11 -0
  67. package/src/components/modal/Modal.theme.ts +29 -0
  68. package/src/components/modal/Modal.vue +78 -101
  69. package/src/components/modal/__tests__/Modal.spec.ts +11 -0
  70. package/src/components/notifications/Notifications.theme.ts +11 -0
  71. package/src/components/notifications/Notifications.vue +233 -247
  72. package/src/components/notifications/__tests__/Notifications.spec.ts +11 -0
  73. package/src/components/pagination/Pagination.theme.ts +27 -0
  74. package/src/components/pagination/Pagination.vue +142 -164
  75. package/src/components/pagination/PaginationItem.theme.ts +14 -0
  76. package/src/components/pagination/PaginationItem.vue +26 -33
  77. package/src/components/pagination/__tests__/Pagination.spec.ts +11 -0
  78. package/src/components/pagination/__tests__/PaginationItem.spec.ts +11 -0
  79. package/src/components/popover/Popover.theme.ts +9 -0
  80. package/src/components/popover/Popover.vue +153 -101
  81. package/src/components/popover/PopoverContainer.theme.ts +7 -0
  82. package/src/components/popover/PopoverContainer.vue +17 -9
  83. package/src/components/popover/__tests__/Popover.spec.ts +11 -0
  84. package/src/components/popover/__tests__/PopoverContainer.spec.ts +11 -0
  85. package/src/components/progress/Progress.theme.ts +26 -0
  86. package/src/components/progress/Progress.vue +29 -53
  87. package/src/components/progress/__tests__/Progress.spec.ts +11 -0
  88. package/src/components/radio/Radio.theme.ts +121 -0
  89. package/src/components/radio/Radio.vue +81 -158
  90. package/src/components/radio/__tests__/Radio.spec.ts +11 -0
  91. package/src/components/scroll/Scroll.theme.ts +7 -0
  92. package/src/components/scroll/Scroll.vue +34 -36
  93. package/src/components/scroll/__tests__/Scroll.spec.ts +11 -0
  94. package/src/components/select/Select.theme.ts +54 -0
  95. package/src/components/select/Select.vue +219 -273
  96. package/src/components/select/__tests__/Select.spec.ts +11 -0
  97. package/src/components/skeleton/Skeleton.theme.ts +7 -0
  98. package/src/components/skeleton/Skeleton.vue +17 -9
  99. package/src/components/skeleton/__tests__/Skeleton.spec.ts +11 -0
  100. package/src/components/slider/Slider.theme.ts +30 -0
  101. package/src/components/slider/Slider.vue +135 -168
  102. package/src/components/slider/__tests__/Slider.spec.ts +11 -0
  103. package/src/components/spacer/{Spacer.vue → Spacer.tsx} +3 -6
  104. package/src/components/spacer/__tests__/Spacer.spec.ts +11 -0
  105. package/src/components/spinner/Spinner.vue +10 -34
  106. package/src/components/spinner/__tests__/Spinner.spec.ts +11 -0
  107. package/src/components/tab/Tab.theme.ts +22 -0
  108. package/src/components/tab/Tab.vue +89 -93
  109. package/src/components/tab/TabGroup.theme.ts +43 -0
  110. package/src/components/tab/TabGroup.vue +94 -127
  111. package/src/components/tab/__tests__/Tab.spec.ts +11 -0
  112. package/src/components/tab/__tests__/TabGroup.spec.ts +11 -0
  113. package/src/components/table/Table.theme.ts +19 -0
  114. package/src/components/table/Table.vue +136 -147
  115. package/src/components/table/{TableBody.vue → TableBody.tsx} +3 -8
  116. package/src/components/table/TableCell.theme.ts +27 -0
  117. package/src/components/table/TableCell.vue +30 -58
  118. package/src/components/table/TableHead.tsx +14 -0
  119. package/src/components/table/TableHeader.vue +18 -20
  120. package/src/components/table/TableRow.vue +23 -20
  121. package/src/components/table/__tests__/Table.spec.ts +11 -0
  122. package/src/components/tag/Tag.theme.ts +32 -0
  123. package/src/components/tag/Tag.vue +40 -68
  124. package/src/components/tag/__tests__/Tag.spec.ts +11 -0
  125. package/src/components/textarea/Textarea.theme.ts +62 -0
  126. package/src/components/textarea/Textarea.vue +100 -115
  127. package/src/components/textarea/__tests__/Textarea.spec.ts +11 -0
  128. package/src/components/toggle/Toggle.theme.ts +51 -0
  129. package/src/components/toggle/Toggle.vue +51 -81
  130. package/src/components/toggle/__tests__/Toggle.spec.ts +11 -0
  131. package/src/components/tooltip/Tooltip.theme.ts +51 -0
  132. package/src/components/tooltip/Tooltip.vue +9 -14
  133. package/src/components/tooltip/__tests__/Tooltip.spec.ts +11 -0
  134. package/src/composables/colors-utils.ts +68 -68
  135. package/src/composables/colors.ts +18 -6
  136. package/src/composables/common.ts +1 -0
  137. package/src/composables/css.ts +7 -2
  138. package/src/composables/index.ts +1 -1
  139. package/src/composables/inputtable.ts +1 -1
  140. package/src/composables/interactive.ts +8 -4
  141. package/src/composables/keys.ts +1 -0
  142. package/src/composables/notifications.ts +10 -0
  143. package/src/composables/theme.ts +88 -0
  144. package/src/create.ts +9 -4
  145. package/src/exports/nuxt.js +2 -1
  146. package/src/version.ts +1 -1
  147. package/volar.d.ts +1 -0
  148. package/lib/components/alert/Alert.vue.d.ts +0 -42
  149. package/lib/components/avatar/Avatar.vue.d.ts +0 -49
  150. package/lib/components/badge/Badge.vue.d.ts +0 -75
  151. package/lib/components/breadcrumbs/Breadcrumbs.vue.d.ts +0 -30
  152. package/lib/components/button/Button.vue.d.ts +0 -87
  153. package/lib/components/button/ButtonGroup.vue.d.ts +0 -49
  154. package/lib/components/card/Card.vue.d.ts +0 -17
  155. package/lib/components/checkbox/Checkbox.vue.d.ts +0 -81
  156. package/lib/components/collapse/Collapse.vue.d.ts +0 -47
  157. package/lib/components/container/Container.vue.d.ts +0 -14
  158. package/lib/components/divider/Divider.vue.d.ts +0 -10
  159. package/lib/components/drawer/Drawer.vue.d.ts +0 -73
  160. package/lib/components/form/Form.vue.d.ts +0 -46
  161. package/lib/components/icon/Icon.vue.d.ts +0 -40
  162. package/lib/components/image/Image.vue.d.ts +0 -8
  163. package/lib/components/index.d.ts +0 -45
  164. package/lib/components/input/Input.vue.d.ts +0 -117
  165. package/lib/components/link/Link.vue.d.ts +0 -36
  166. package/lib/components/menu/Menu.vue.d.ts +0 -62
  167. package/lib/components/menu/MenuItem.vue.d.ts +0 -114
  168. package/lib/components/modal/Modal.vue.d.ts +0 -34
  169. package/lib/components/notifications/Notifications.vue.d.ts +0 -104
  170. package/lib/components/pagination/Pagination.vue.d.ts +0 -58
  171. package/lib/components/pagination/PaginationItem.vue.d.ts +0 -32
  172. package/lib/components/popover/Popover.vue.d.ts +0 -64
  173. package/lib/components/popover/PopoverContainer.vue.d.ts +0 -14
  174. package/lib/components/progress/Progress.vue.d.ts +0 -42
  175. package/lib/components/radio/Radio.vue.d.ts +0 -79
  176. package/lib/components/scroll/Scroll.vue.d.ts +0 -29
  177. package/lib/components/select/Select.vue.d.ts +0 -100
  178. package/lib/components/skeleton/Skeleton.vue.d.ts +0 -14
  179. package/lib/components/slider/Slider.vue.d.ts +0 -96
  180. package/lib/components/spacer/Spacer.vue.d.ts +0 -2
  181. package/lib/components/spinner/Spinner.vue.d.ts +0 -16
  182. package/lib/components/tab/Tab.vue.d.ts +0 -52
  183. package/lib/components/tab/TabGroup.vue.d.ts +0 -61
  184. package/lib/components/table/Table.vue.d.ts +0 -82
  185. package/lib/components/table/TableBody.vue.d.ts +0 -2
  186. package/lib/components/table/TableCell.vue.d.ts +0 -33
  187. package/lib/components/table/TableHead.vue.d.ts +0 -2
  188. package/lib/components/table/TableHeader.vue.d.ts +0 -33
  189. package/lib/components/table/TableRow.vue.d.ts +0 -23
  190. package/lib/components/tag/Tag.vue.d.ts +0 -45
  191. package/lib/components/textarea/Textarea.vue.d.ts +0 -106
  192. package/lib/components/toggle/Toggle.vue.d.ts +0 -79
  193. package/lib/components/tooltip/Tooltip.vue.d.ts +0 -2
  194. package/lib/composables/colors-utils.d.ts +0 -8
  195. package/lib/composables/colors.d.ts +0 -26
  196. package/lib/composables/common.d.ts +0 -14
  197. package/lib/composables/css.d.ts +0 -5
  198. package/lib/composables/index.d.ts +0 -7
  199. package/lib/composables/inputtable.d.ts +0 -37
  200. package/lib/composables/interactive.d.ts +0 -10
  201. package/lib/composables/keys.d.ts +0 -7
  202. package/lib/composables/notification.d.ts +0 -1
  203. package/lib/create.d.ts +0 -12
  204. package/lib/index.d.ts +0 -6
  205. package/lib/install.d.ts +0 -4
  206. package/lib/style.css +0 -1
  207. package/lib/version.d.ts +0 -2
  208. package/src/components/table/TableHead.vue +0 -15
  209. package/src/composables/notification.ts +0 -10
@@ -0,0 +1,234 @@
1
+ import type { ThemeParams } from '../../composables/theme'
2
+
3
+ export default {
4
+ classes: {
5
+ wrapper({ props, slots, data }: ThemeParams) {
6
+ /*tw*/
7
+ const classes = ['relative transition duration-150 focus:outline-none inline-flex items-center justify-center font-medium whitespace-nowrap overflow-hidden align-middle active:!shadow-none border']
8
+
9
+ // radius
10
+ if (!data.isButtonGroup) classes.push(props.rounded ? 'rounded-full' : 'rounded-md')
11
+
12
+ // shadow
13
+ if (!props.flat && !props.light && !props.ghost && !props.disabled && !props.loading) classes.push('shadow-sm')
14
+
15
+ // size
16
+ if (props.size === 'xs') classes.push(slots.default ? `py-1 text-xs ${props.icon ? 'px-2' : 'px-3'}` : 'leading-none p-1')
17
+ else if (props.size === 'sm') classes.push(slots.default ? `py-2 text-sm ${props.icon ? 'px-3' : 'px-4'}` : 'leading-none p-2')
18
+ else if (props.size === 'lg') classes.push(slots.default ? `py-3 text-lg ${props.icon ? 'px-4' : 'px-6'}` : 'leading-none p-3')
19
+ else if (props.size === 'xl') classes.push(slots.default ? `py-4 text-xl ${props.icon ? 'px-6' : 'px-6'}` : 'leading-none p-4')
20
+ else classes.push(slots.default ? `py-2 ${props.icon ? 'px-4' : 'px-5'}` : 'leading-none p-2')
21
+
22
+ // cursor
23
+ if (props.disabled) classes.push('cursor-not-allowed')
24
+ else if (props.loading) classes.push('cursor-default')
25
+ else classes.push('cursor-pointer')
26
+
27
+ return classes
28
+ },
29
+
30
+ iconLeft: ({ slots }: ThemeParams) => slots.default ? 'mr-2' : 'm-0.5',
31
+
32
+ iconRight: ({ slots }: ThemeParams) => slots.default ? 'ml-2' : 'm-0.5',
33
+ },
34
+
35
+ styles({ props, colors, css, data }: ThemeParams) {
36
+ const gray = colors.getPalette('gray')
37
+ const color = props.color ? colors.getPalette(props.color) : gray
38
+ const vars: (object | string)[] = []
39
+
40
+ const isLight = props.color && props.light
41
+ const isDefault = !props.color && !props.ghost
42
+
43
+ if (props.glow) vars.push(css.get('glow', colors.getColorOpacity(props.color ? color[500] : gray[500], 0.5)))
44
+
45
+ if (isDefault) {
46
+ if (props.disabled) {
47
+ vars.push(css.variables({
48
+ bg: gray[50],
49
+ text: gray[300],
50
+ border: gray[200],
51
+ dark: {
52
+ bg: gray[900],
53
+ text: gray[600],
54
+ border: gray[700],
55
+ },
56
+ }))
57
+ } else {
58
+ vars.push(css.variables({
59
+ bg: 'white',
60
+ text: gray[800],
61
+ border: gray[300],
62
+ hover: { bg: !props.loading ? gray[100] : '' },
63
+ active: { bg: !props.loading ? gray[200] : '' },
64
+ dark: {
65
+ bg: gray[800],
66
+ text: 'white',
67
+ border: gray[700],
68
+ hover: { bg: !props.loading ? gray[700] : '', border: gray[600] },
69
+ active: { bg: !props.loading ? gray[600] : '', border: gray[500] },
70
+ },
71
+ }))
72
+ }
73
+ }
74
+
75
+ // light
76
+ else if (isLight) {
77
+ if (!props.outlined || props.disabled) vars.push(css.get('border', 'transparent'))
78
+
79
+ if (props.disabled) {
80
+ vars.push(css.variables({
81
+ bg: color[50],
82
+ text: color[200],
83
+ border: 'transparent',
84
+ dark: {
85
+ bg: gray[800],
86
+ text: color[900],
87
+ border: 'transparent',
88
+ },
89
+ }))
90
+ } else {
91
+ vars.push(css.variables({
92
+ bg: color[50],
93
+ text: color[600],
94
+ border: props.outlined ? color[500] : 'transparent',
95
+ hover: { bg: !props.loading ? color[100] : '' },
96
+ active: { bg: !props.loading ? color[200] : '' },
97
+ dark: {
98
+ bg: color[900],
99
+ text: color[200],
100
+ border: props.outlined ? color[500] : 'transparent',
101
+ hover: { bg: !props.loading ? color[800] : '' },
102
+ active: { bg: !props.loading ? color[700] : '' },
103
+ },
104
+ }))
105
+ }
106
+ }
107
+
108
+ // ghost
109
+ else if (props.ghost) {
110
+ if (!props.outlined) vars.push(css.get('border', 'transparent'))
111
+
112
+ if (props.color) {
113
+ if (props.disabled) {
114
+ vars.push(css.variables({
115
+ text: color[200],
116
+ dark: {
117
+ text: color[700],
118
+ },
119
+ }))
120
+ } else {
121
+ vars.push(css.variables({
122
+ text: color[600],
123
+ dark: {
124
+ text: color[500],
125
+ },
126
+ }))
127
+ if (!props.loading) {
128
+ vars.push(css.variables({
129
+ hover: { bg: color[50] },
130
+ active: { bg: color[100] },
131
+ dark: {
132
+ hover: { bg: gray[800] },
133
+ active: { bg: gray[700] },
134
+ },
135
+ }))
136
+ }
137
+ }
138
+ } else {
139
+ if (props.disabled) {
140
+ vars.push(css.variables({
141
+ text: gray[200],
142
+ dark: {
143
+ text: gray[700],
144
+ },
145
+ }))
146
+ } else {
147
+ vars.push(css.variables({
148
+ text: gray[800],
149
+ dark: {
150
+ text: 'white',
151
+ },
152
+ }))
153
+ if (!props.loading) {
154
+ vars.push(css.variables({
155
+ hover: { bg: gray[100] },
156
+ active: { bg: gray[200] },
157
+ dark: {
158
+ hover: { bg: gray[800] },
159
+ active: { bg: gray[700] },
160
+ },
161
+ }))
162
+ }
163
+ }
164
+ }
165
+ }
166
+
167
+ else {
168
+ // outlined
169
+ if (props.outlined) {
170
+ if (props.disabled) {
171
+ vars.push(css.variables({
172
+ text: color[200],
173
+ border: color[200],
174
+ dark: {
175
+ text: color[700],
176
+ border: color[700],
177
+ },
178
+ }))
179
+ } else {
180
+ vars.push(css.variables({
181
+ text: color[600],
182
+ border: color[600],
183
+ dark: {
184
+ text: color[500],
185
+ border: color[500],
186
+ },
187
+ }))
188
+ if (!props.loading) {
189
+ vars.push(css.variables({
190
+ hover: { bg: color[100] },
191
+ active: { bg: color[200] },
192
+ dark: {
193
+ hover: { bg: gray[800] },
194
+ active: { bg: gray[700] },
195
+ },
196
+ }))
197
+ }
198
+ }
199
+ } else {
200
+ // filled
201
+ vars.push(css.variables({
202
+ text: '#fff',
203
+ border: !data.isButtonGroup ? 'transparent' : color[600],
204
+ dark: {
205
+ text: '#fff',
206
+ border: !data.isButtonGroup ? 'transparent' : color[500],
207
+ },
208
+ }))
209
+ if (props.disabled) {
210
+ vars.push(css.variables({
211
+ bg: color[100],
212
+ dark: {
213
+ text: color[700],
214
+ bg: color[900],
215
+ },
216
+ }))
217
+ } else {
218
+ vars.push(css.variables({
219
+ bg: color[500],
220
+ hover: { bg: !props.loading ? color[600] : '' },
221
+ active: { bg: !props.loading ? color[800] : '' },
222
+ dark: {
223
+ bg: color[600],
224
+ hover: { bg: !props.loading ? color[700] : '' },
225
+ active: { bg: !props.loading ? color[800] : '' },
226
+ },
227
+ }))
228
+ }
229
+ }
230
+ }
231
+
232
+ return vars
233
+ },
234
+ }