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