sprintify-ui 0.0.8 → 0.0.9
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 +146 -41
- package/dist/sprintify-ui.es.js +260 -260
- package/dist/tailwindcss/index.js +46 -0
- package/package.json +3 -3
- package/src/components/BaseAutocomplete.stories.js +0 -1
- package/src/components/BaseAutocompleteFetch.stories.js +0 -1
- package/src/components/BaseBelongsTo.stories.js +0 -1
- package/src/components/BaseDatePicker.stories.js +0 -5
- package/src/components/BaseDateSelect.stories.js +41 -0
- package/src/components/BaseDateSelect.vue +1 -1
- package/src/components/BaseDescriptionList.stories.js +35 -0
- package/src/components/BaseDescriptionList.vue +3 -1
- package/src/components/BaseSkeleton.vue +1 -1
package/README.md
CHANGED
|
@@ -1,45 +1,65 @@
|
|
|
1
|
-
## Peer dependencies:
|
|
2
1
|
|
|
3
|
-
@vueuse/core
|
|
4
|
-
axios
|
|
5
|
-
lodash
|
|
6
|
-
luxon
|
|
7
|
-
pinia
|
|
8
|
-
qs
|
|
9
|
-
tailwindcss
|
|
10
|
-
vue
|
|
11
|
-
vue-18n
|
|
12
|
-
vue-router
|
|
13
2
|
|
|
14
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://sprintify.witify.io/img/logo/logo-side.svg" width="190" />
|
|
5
|
+
</p>
|
|
15
6
|
|
|
16
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
<img src="https://api.netlify.com/api/v1/badges/e95b44db-1c89-450d-99e1-887c9b261438/deploy-status" />
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
## About Sprintify UI
|
|
12
|
+
|
|
13
|
+
Sprintify UI is a Vue 3 components library for Vite projects using a Laravel backend.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
**Storybook Documentation**
|
|
17
|
+
https://sprintify-ui-storybook.netlify.app
|
|
18
|
+
|
|
19
|
+
## Getting started
|
|
20
|
+
|
|
21
|
+
### Peer dependencies:
|
|
22
|
+
|
|
23
|
+
`sprintify-ui` is highly opinionated and requires multiple dependencies :
|
|
24
|
+
|
|
25
|
+
`@vueuse/core`
|
|
26
|
+
`axios`
|
|
27
|
+
`lodash`
|
|
28
|
+
`luxon`
|
|
29
|
+
`pinia`
|
|
30
|
+
`qs`
|
|
31
|
+
`tailwindcss`
|
|
32
|
+
`vue`
|
|
33
|
+
`vue-18n`
|
|
34
|
+
`vue-router`
|
|
35
|
+
|
|
36
|
+
To install them all :
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm i @vueuse/core axios lodash luxon pinia qs tailwindcss vue vue-18n vue-router --save
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Basic Configuration
|
|
17
43
|
|
|
18
44
|
```ts
|
|
45
|
+
import axios from "axios";
|
|
46
|
+
import { createI18n } from "vue-i18n";
|
|
47
|
+
import { createRouter, createWebHistory } from "vue-router";
|
|
19
48
|
import SprintifyUI from "sprintify-ui";
|
|
20
49
|
|
|
21
|
-
// Import your
|
|
50
|
+
// Import your TailwindCSS *before* importing Sprintify UI CSS
|
|
22
51
|
import "../css/tailwind.css";
|
|
23
52
|
|
|
24
53
|
// Import Sprintify UI CSS
|
|
25
54
|
import "sprintify-ui/dist/style.css";
|
|
26
55
|
|
|
27
|
-
|
|
28
|
-
app.use(router);
|
|
29
|
-
app.use(i18n);
|
|
30
|
-
|
|
31
|
-
// Import Sprintify UI plugin
|
|
32
|
-
app.use(SprintifyUI);
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## i18n
|
|
56
|
+
/** Axios */
|
|
36
57
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
58
|
+
const http = axios.create({
|
|
59
|
+
credentials: true,
|
|
60
|
+
}),
|
|
40
61
|
|
|
41
|
-
|
|
42
|
-
import fr from "sprintify-ui/dist/lang/fr.json";
|
|
62
|
+
/** Vue i18n */
|
|
43
63
|
|
|
44
64
|
const messages = {
|
|
45
65
|
en: {},
|
|
@@ -54,33 +74,60 @@ const i18n = createI18n({
|
|
|
54
74
|
messages,
|
|
55
75
|
});
|
|
56
76
|
|
|
77
|
+
/** Vue Router */
|
|
78
|
+
|
|
79
|
+
const router = createRouter({
|
|
80
|
+
routes: [],
|
|
81
|
+
history: createWebHistory("admin"),
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
/** Vue Plugins */
|
|
85
|
+
|
|
86
|
+
// Import router and i18n *before* importing Sprintify UI plugin
|
|
87
|
+
app.use(i18n);
|
|
88
|
+
app.use(router);
|
|
89
|
+
app.use(createPinia());
|
|
90
|
+
|
|
91
|
+
// Import Sprintify UI plugin
|
|
92
|
+
app.use(SprintifyUI, {
|
|
93
|
+
i18n, // Import your i18n instance
|
|
94
|
+
http, // Default axios instance for <BaseAutocompleteFetch>, <BaseDataIterator>, etc...
|
|
95
|
+
upload_url: "/api/files/upload", // Default upload URL for <BaseFileUploader>
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
app.mount("#app");
|
|
99
|
+
|
|
57
100
|
```
|
|
58
101
|
|
|
59
|
-
|
|
102
|
+
### TailwindCSS
|
|
103
|
+
|
|
104
|
+
Make sure you have all the required tailwindCSS plugins installed:
|
|
60
105
|
|
|
61
|
-
|
|
106
|
+
```bash
|
|
107
|
+
npm i tailwindcss @tailwindcss/forms @tailwindcss/typography @tailwindcss/aspect-ratio @tailwindcss/line-clamp -D
|
|
108
|
+
```
|
|
62
109
|
|
|
63
|
-
|
|
110
|
+
#### Update tailwind.config.js
|
|
111
|
+
|
|
112
|
+
Update your content list :
|
|
113
|
+
|
|
114
|
+
```js
|
|
64
115
|
{
|
|
65
116
|
content: [
|
|
66
117
|
//...,
|
|
67
118
|
"./node_modules/sprintify-ui/src/**/*.ts",
|
|
68
119
|
"./node_modules/sprintify-ui/src/**/*.js",
|
|
69
120
|
"./node_modules/sprintify-ui/src/**/*.vue",
|
|
70
|
-
]
|
|
121
|
+
],
|
|
71
122
|
}
|
|
72
123
|
```
|
|
73
124
|
|
|
74
|
-
|
|
125
|
+
Update your plugin list :
|
|
75
126
|
|
|
76
|
-
```
|
|
77
|
-
npm i tailwindcss @tailwindcss/forms @tailwindcss/typography @tailwindcss/aspect-ratio @tailwindcss/line-clamp -D
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
Add them to your plugin list :
|
|
81
|
-
|
|
82
|
-
```
|
|
127
|
+
```js
|
|
83
128
|
plugins: [
|
|
129
|
+
//...,
|
|
130
|
+
require("sprintify-ui/tailwindcss"),
|
|
84
131
|
require("@tailwindcss/forms"),
|
|
85
132
|
require("@tailwindcss/typography"),
|
|
86
133
|
require("@tailwindcss/aspect-ratio"),
|
|
@@ -88,7 +135,7 @@ plugins: [
|
|
|
88
135
|
],
|
|
89
136
|
```
|
|
90
137
|
|
|
91
|
-
|
|
138
|
+
## Configure using unplugin-vue-components
|
|
92
139
|
|
|
93
140
|
Add a custom resolver
|
|
94
141
|
|
|
@@ -101,4 +148,62 @@ Components({
|
|
|
101
148
|
},
|
|
102
149
|
],
|
|
103
150
|
}),
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Notifications and Dialogs
|
|
154
|
+
|
|
155
|
+
To use notification and dialogs, you main layout must extend the `<BaseApp>` component.
|
|
156
|
+
This component will observe the pinia store and render dialogs and notifications.
|
|
157
|
+
|
|
158
|
+
```vue
|
|
159
|
+
<template>
|
|
160
|
+
<BaseApp>
|
|
161
|
+
<RouterView></RouterView>
|
|
162
|
+
</BaseApp>
|
|
163
|
+
</template>
|
|
164
|
+
|
|
165
|
+
<script lang="ts" setup>
|
|
166
|
+
</script>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
#### Custom notifications and dialogs
|
|
170
|
+
|
|
171
|
+
You may 100% customize the look and feel of dialogs and notifications by removing `<BaseApp>` and instead create you own render logic. Here's a simple example to render notifications:
|
|
172
|
+
|
|
173
|
+
```vue
|
|
174
|
+
<template>
|
|
175
|
+
<Teleport to="body">
|
|
176
|
+
<div class="pointer-events-none fixed inset-0 flex items-end justify-end p-6 md:p-8">
|
|
177
|
+
<div class="w-full max-w-sm">
|
|
178
|
+
<div v-for="notification in notifications" :key="notification.id">
|
|
179
|
+
<h2>{{ notification.title }}</h2>
|
|
180
|
+
<p>{{ notification.text }}</p>
|
|
181
|
+
</div>
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
</Teleport>
|
|
185
|
+
</template>
|
|
186
|
+
|
|
187
|
+
<script lang="ts" setup>
|
|
188
|
+
import { useNotificationsStore } from 'sprintify-ui';
|
|
189
|
+
|
|
190
|
+
const notificationsStore = useNotificationsStore();
|
|
191
|
+
|
|
192
|
+
const notifications = computed(() => {
|
|
193
|
+
return notificationsStore.notifications;
|
|
194
|
+
});
|
|
195
|
+
</script>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Using components
|
|
199
|
+
|
|
200
|
+
All components are globally available, you can use them without importation:
|
|
201
|
+
|
|
202
|
+
```vue
|
|
203
|
+
<template>
|
|
204
|
+
<BaseAlert title="Test" color="danger"></BaseAlert>
|
|
205
|
+
</template>
|
|
206
|
+
|
|
207
|
+
<script lang="ts" setup>
|
|
208
|
+
</script>
|
|
104
209
|
```
|