@stsdti/approvable-vue 0.1.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.
- package/LICENSE +21 -0
- package/README.md +108 -0
- package/dist/approvable-vue.mjs +902 -0
- package/dist/approvable-vue.mjs.map +1 -0
- package/package.json +58 -0
- package/src/components/approvable/Approvable.vue +197 -0
- package/src/components/approvable/ApprovableAuditTimeline.vue +253 -0
- package/src/components/approvable/ApprovableButtons.vue +80 -0
- package/src/components/approvable/ApprovableStep.vue +235 -0
- package/src/components/approvable/ApprovableStepComment.vue +155 -0
- package/src/components/approvable/ApproveStatusInfo.vue +33 -0
- package/src/components/approvable/action-renderers.js +23 -0
- package/src/components/select/approvable-status-select/ApprovableStatusSelect.vue +64 -0
- package/src/components/select/approvable-status-select/ApprovableStatusSelectOption.vue +16 -0
- package/src/config.js +26 -0
- package/src/icons.js +36 -0
- package/src/index.js +109 -0
- package/src/messages.js +19 -0
- package/src/themes/approvable.css +1171 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 STSDTI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# @stsdti/approvable-vue
|
|
2
|
+
|
|
3
|
+
Vue 3 components for [laravel-approvable](https://github.com/stsdti/laravel-approvable):
|
|
4
|
+
approval trails, step actions, comments and the audit timeline.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npm install @stsdti/approvable-vue
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Vue 3 is a peer dependency. All behaviour comes from `@stsdti/approvable-core`,
|
|
11
|
+
which installs alongside.
|
|
12
|
+
|
|
13
|
+
This package is **ESM only**: it publishes ES modules and no CommonJS build. Use
|
|
14
|
+
`import`, or a dynamic `import()` from CommonJS.
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
import { createApp } from 'vue'
|
|
20
|
+
import ApprovableVue from '@stsdti/approvable-vue'
|
|
21
|
+
import '@stsdti/approvable-vue/themes/approvable.css'
|
|
22
|
+
|
|
23
|
+
app.use(ApprovableVue)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or import components individually:
|
|
27
|
+
|
|
28
|
+
```vue
|
|
29
|
+
<script setup>
|
|
30
|
+
import { Approvable } from '@stsdti/approvable-vue'
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<Approvable :value="document" @refresh="reload" />
|
|
35
|
+
</template>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`value` is the **resource** that carries the approval — a document, a request —
|
|
39
|
+
not the approvable itself.
|
|
40
|
+
|
|
41
|
+
## Theming
|
|
42
|
+
|
|
43
|
+
The components ship unstyled and emit `.approvable-*` class names. One
|
|
44
|
+
stylesheet — `themes/approvable.css` — gives them their look, in light and dark.
|
|
45
|
+
|
|
46
|
+
Dark mode follows the viewer's system setting; an application with its own
|
|
47
|
+
toggle stamps `data-theme="dark"` (or a `.dark` class) on an ancestor and the
|
|
48
|
+
panel follows it, in either direction.
|
|
49
|
+
|
|
50
|
+
A button's `icon` is a class name from the workflow definition, so the icon font
|
|
51
|
+
is the application's to load — `examples/vue` uses
|
|
52
|
+
[Tabler](https://tabler.io/icons) and workflow icons named `ti ti-check`.
|
|
53
|
+
|
|
54
|
+
There is **no Tailwind dependency and no build step to configure** — you do not
|
|
55
|
+
need to add this package to a Tailwind `content` glob. Every class it renders is
|
|
56
|
+
styled by the stylesheet you import.
|
|
57
|
+
|
|
58
|
+
Every colour, radius and shadow is a custom property, so changing one is a
|
|
59
|
+
declaration rather than a rule:
|
|
60
|
+
|
|
61
|
+
```css
|
|
62
|
+
.approvable {
|
|
63
|
+
--approvable-accent: #16a34a;
|
|
64
|
+
--approvable-radius: 12px;
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
To write a theme of your own, target the same class names — they are the public
|
|
69
|
+
contract, and a React binding would emit exactly the same ones.
|
|
70
|
+
|
|
71
|
+
## Links
|
|
72
|
+
|
|
73
|
+
A button that navigates renders as a plain `<a>` by default, so the package
|
|
74
|
+
works with no router installed. To use your router's link component:
|
|
75
|
+
|
|
76
|
+
```js
|
|
77
|
+
import { RouterLink } from 'vue-router'
|
|
78
|
+
|
|
79
|
+
app.use(ApprovableVue, { linkComponent: RouterLink })
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Custom action buttons
|
|
83
|
+
|
|
84
|
+
A button whose `action_ui` matches a registered renderer renders through it:
|
|
85
|
+
|
|
86
|
+
```js
|
|
87
|
+
import { registerApprovableActionRenderer } from '@stsdti/approvable-vue'
|
|
88
|
+
|
|
89
|
+
registerApprovableActionRenderer('pdf-signature', SignatureButton)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The renderer receives `button`, `step`, `approvable`, `resource` and a
|
|
93
|
+
`complete` callback to invoke when its own flow finishes.
|
|
94
|
+
|
|
95
|
+
## Configuration
|
|
96
|
+
|
|
97
|
+
Notifications and date formatting are configured on the core package:
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
import { setApprovableNotifier, setApprovableClient, ApprovableClient, axiosAdapter } from '@stsdti/approvable-core'
|
|
101
|
+
|
|
102
|
+
setApprovableNotifier({ success: toast.success, error: toast.error })
|
|
103
|
+
setApprovableClient(new ApprovableClient({ adapter: axiosAdapter(axios) }))
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
MIT
|