@factoringplus/pl-components-pack-v3 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.
Files changed (44) hide show
  1. package/.eslintrc.js +17 -0
  2. package/README.md +24 -0
  3. package/babel.config.js +5 -0
  4. package/dist/@factoringplus/pl-components-pack-v3.common.js +996 -0
  5. package/dist/@factoringplus/pl-components-pack-v3.common.js.map +1 -0
  6. package/dist/@factoringplus/pl-components-pack-v3.css +1 -0
  7. package/dist/@factoringplus/pl-components-pack-v3.umd.js +1006 -0
  8. package/dist/@factoringplus/pl-components-pack-v3.umd.js.map +1 -0
  9. package/dist/@factoringplus/pl-components-pack-v3.umd.min.js +8 -0
  10. package/dist/@factoringplus/pl-components-pack-v3.umd.min.js.map +1 -0
  11. package/dist/demo.html +10 -0
  12. package/entry.js +37 -0
  13. package/package-lock.json +20696 -0
  14. package/package.json +69 -0
  15. package/public/favicon.ico +0 -0
  16. package/public/index.html +17 -0
  17. package/src/App.vue +6 -0
  18. package/src/assets/logo.png +0 -0
  19. package/src/components/pl-currency/src/pl-currency.vue +47 -0
  20. package/src/main.js +13 -0
  21. package/src/router/index.js +16 -0
  22. package/src/store/index.js +12 -0
  23. package/src/stories/Button.stories.js +52 -0
  24. package/src/stories/Button.vue +53 -0
  25. package/src/stories/Header.stories.js +28 -0
  26. package/src/stories/Header.vue +54 -0
  27. package/src/stories/Introduction.stories.mdx +211 -0
  28. package/src/stories/Page.stories.js +30 -0
  29. package/src/stories/Page.vue +79 -0
  30. package/src/stories/assets/code-brackets.svg +1 -0
  31. package/src/stories/assets/colors.svg +1 -0
  32. package/src/stories/assets/comments.svg +1 -0
  33. package/src/stories/assets/direction.svg +1 -0
  34. package/src/stories/assets/flow.svg +1 -0
  35. package/src/stories/assets/plugin.svg +1 -0
  36. package/src/stories/assets/repo.svg +1 -0
  37. package/src/stories/assets/stackalt.svg +1 -0
  38. package/src/stories/button.css +30 -0
  39. package/src/stories/currency-input/pl-currency.stories.js +27 -0
  40. package/src/stories/currency-input/pl-currency.vue +47 -0
  41. package/src/stories/header.css +26 -0
  42. package/src/stories/page.css +69 -0
  43. package/src/views/Home.vue +10 -0
  44. package/vue.config.js +8 -0
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@factoringplus/pl-components-pack-v3",
3
+ "version": "0.1.0",
4
+ "private": false,
5
+ "scripts": {
6
+ "serve": "vue-cli-service serve",
7
+ "build": "vue-cli-service build",
8
+ "lint": "vue-cli-service lint",
9
+ "storybook": "start-storybook -p 6006",
10
+ "build-storybook": "build-storybook",
11
+ "build-library": "vue-cli-service build --target lib --name @factoringplus/pl-components-pack-v3 ./entry.js"
12
+ },
13
+ "dependencies": {
14
+ "core-js": "^3.6.5",
15
+ "element-plus": "^2.0.1",
16
+ "vue": "^3.0.0",
17
+ "vue-currency-input": "^2.4.0",
18
+ "vue-router": "^4.0.0-0",
19
+ "vuex": "^4.0.0-0"
20
+ },
21
+ "devDependencies": {
22
+ "@babel/core": "^7.17.2",
23
+ "@storybook/addon-actions": "^6.4.18",
24
+ "@storybook/addon-essentials": "^6.4.18",
25
+ "@storybook/addon-links": "^6.4.18",
26
+ "@storybook/vue3": "^6.4.18",
27
+ "@vue/cli-plugin-babel": "~4.5.0",
28
+ "@vue/cli-plugin-eslint": "~4.5.0",
29
+ "@vue/cli-plugin-router": "~4.5.0",
30
+ "@vue/cli-plugin-vuex": "~4.5.0",
31
+ "@vue/cli-service": "~4.5.0",
32
+ "@vue/compiler-sfc": "^3.0.0",
33
+ "@vue/eslint-config-airbnb": "^5.0.2",
34
+ "babel-eslint": "^10.1.0",
35
+ "babel-loader": "^8.2.3",
36
+ "eslint": "^6.7.2",
37
+ "eslint-plugin-import": "^2.20.2",
38
+ "eslint-plugin-vue": "^7.0.0",
39
+ "lint-staged": "^9.5.0",
40
+ "sass": "^1.26.5",
41
+ "sass-loader": "^8.0.2",
42
+ "vue-loader": "^16.8.3"
43
+ },
44
+ "gitHooks": {
45
+ "pre-commit": "lint-staged"
46
+ },
47
+ "lint-staged": {
48
+ "*.{js,jsx,vue}": [
49
+ "vue-cli-service lint",
50
+ "git add"
51
+ ]
52
+ },
53
+ "description": "## Project setup ``` npm install ```",
54
+ "main": ".dist/@factoringplus/pl-components-pack-v3.common.js",
55
+ "repository": {
56
+ "type": "git",
57
+ "url": "https://bitbucket.izumfin.com/scm/plat/storybook3.git"
58
+ },
59
+ "author": "",
60
+ "files": [
61
+ "dist/*",
62
+ "src/*",
63
+ "public/*",
64
+ "*.json",
65
+ "*.js",
66
+ "plugins/*"
67
+ ],
68
+ "license": "ISC"
69
+ }
Binary file
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html lang="">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width,initial-scale=1.0">
7
+ <link rel="icon" href="<%= BASE_URL %>favicon.ico">
8
+ <title><%= htmlWebpackPlugin.options.title %></title>
9
+ </head>
10
+ <body>
11
+ <noscript>
12
+ <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
13
+ </noscript>
14
+ <div id="app"></div>
15
+ <!-- built files will be auto injected -->
16
+ </body>
17
+ </html>
package/src/App.vue ADDED
@@ -0,0 +1,6 @@
1
+ <template>
2
+ <router-view/>
3
+ </template>
4
+
5
+ <style lang="scss">
6
+ </style>
Binary file
@@ -0,0 +1,47 @@
1
+ <template>
2
+ <el-input
3
+ v-bind="$attrs"
4
+ ref="inputRef"
5
+ v-model="innerValue"
6
+ class="pl-currency">
7
+ <template #append>
8
+ <span class="pl-currency__rub-icon">&#x20bd;</span>
9
+ </template>
10
+ </el-input>
11
+ </template>
12
+
13
+ <script setup>
14
+ import { ref, reactive, watch } from 'vue';
15
+ import { useCurrencyInput } from 'vue-currency-input';
16
+
17
+ // eslint-disable-next-line no-unused-vars,no-undef
18
+ const props = defineProps({
19
+ modelValue: String,
20
+ });
21
+
22
+ // eslint-disable-next-line no-undef
23
+ const emit = defineEmits(['update:modelValue']);
24
+
25
+ const innerValue = ref(null);
26
+ const options = reactive({
27
+ currency: 'EUR',
28
+ currencyDisplay: 'hidden',
29
+ precision: 2,
30
+ });
31
+
32
+ const { inputRef } = useCurrencyInput(options);
33
+
34
+ watch(innerValue, (newValue) => {
35
+ emit('update:modelValue', newValue);
36
+ });
37
+ </script>
38
+
39
+ <style lang="scss">
40
+ .pl-currency {
41
+ width: 30%;
42
+ &__rub-icon {
43
+ font-size: 20px;
44
+ opacity: 0.3;
45
+ }
46
+ }
47
+ </style>
package/src/main.js ADDED
@@ -0,0 +1,13 @@
1
+ import { createApp } from 'vue';
2
+ import ElementPlus from 'element-plus';
3
+ import 'element-plus/dist/index.css';
4
+ import ru from 'element-plus/es/locale/lang/ru';
5
+ import App from './App.vue';
6
+ import router from './router';
7
+ import store from './store';
8
+
9
+ createApp(App)
10
+ .use(store)
11
+ .use(router)
12
+ .use(ElementPlus, { locale: ru })
13
+ .mount('#app');
@@ -0,0 +1,16 @@
1
+ import { createRouter, createWebHistory } from 'vue-router';
2
+
3
+ const routes = [
4
+ {
5
+ path: '/',
6
+ name: 'Home',
7
+ component: () => import('../views/Home.vue'),
8
+ },
9
+ ];
10
+
11
+ const router = createRouter({
12
+ history: createWebHistory(process.env.BASE_URL),
13
+ routes,
14
+ });
15
+
16
+ export default router;
@@ -0,0 +1,12 @@
1
+ import { createStore } from 'vuex';
2
+
3
+ export default createStore({
4
+ state: {
5
+ },
6
+ mutations: {
7
+ },
8
+ actions: {
9
+ },
10
+ modules: {
11
+ },
12
+ });
@@ -0,0 +1,52 @@
1
+ import MyButton from './Button.vue';
2
+
3
+ // More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
4
+ export default {
5
+ title: 'Example/Button',
6
+ component: MyButton,
7
+ // More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
8
+ argTypes: {
9
+ backgroundColor: { control: 'color' },
10
+ onClick: {},
11
+ size: {
12
+ control: { type: 'select' },
13
+ options: ['small', 'medium', 'large'],
14
+ },
15
+ },
16
+ };
17
+
18
+ // More on component templates: https://storybook.js.org/docs/vue/writing-stories/introduction#using-args
19
+ const Template = (args) => ({
20
+ // Components used in your story `template` are defined in the `components` object
21
+ components: { MyButton },
22
+ // The story's `args` need to be mapped into the template through the `setup()` method
23
+ setup() {
24
+ return { args };
25
+ },
26
+ // And then the `args` are bound to your component with `v-bind="args"`
27
+ template: '<my-button v-bind="args" />',
28
+ });
29
+
30
+ export const Primary = Template.bind({});
31
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
32
+ Primary.args = {
33
+ primary: true,
34
+ label: 'Button',
35
+ };
36
+
37
+ export const Secondary = Template.bind({});
38
+ Secondary.args = {
39
+ label: 'Button',
40
+ };
41
+
42
+ export const Large = Template.bind({});
43
+ Large.args = {
44
+ size: 'large',
45
+ label: 'Button',
46
+ };
47
+
48
+ export const Small = Template.bind({});
49
+ Small.args = {
50
+ size: 'small',
51
+ label: 'Button',
52
+ };
@@ -0,0 +1,53 @@
1
+ <template>
2
+ <button type="button" :class="classes" @click="onClick" :style="style">{{ label }}</button>
3
+ </template>
4
+
5
+ <script>
6
+ import './button.css';
7
+ import { reactive, computed } from 'vue';
8
+
9
+ export default {
10
+ name: 'my-button',
11
+
12
+ props: {
13
+ label: {
14
+ type: String,
15
+ required: true,
16
+ },
17
+ primary: {
18
+ type: Boolean,
19
+ default: false,
20
+ },
21
+ size: {
22
+ type: String,
23
+ validator(value) {
24
+ return ['small', 'medium', 'large'].indexOf(value) !== -1;
25
+ },
26
+ },
27
+ backgroundColor: {
28
+ type: String,
29
+ },
30
+ },
31
+
32
+ emits: ['click'],
33
+
34
+ setup(props, { emit }) {
35
+ // eslint-disable-next-line no-param-reassign
36
+ props = reactive(props);
37
+ return {
38
+ classes: computed(() => ({
39
+ 'storybook-button': true,
40
+ 'storybook-button--primary': props.primary,
41
+ 'storybook-button--secondary': !props.primary,
42
+ [`storybook-button--${props.size || 'medium'}`]: true,
43
+ })),
44
+ style: computed(() => ({
45
+ backgroundColor: props.backgroundColor,
46
+ })),
47
+ onClick() {
48
+ emit('click');
49
+ },
50
+ };
51
+ },
52
+ };
53
+ </script>
@@ -0,0 +1,28 @@
1
+ import MyHeader from './Header.vue';
2
+
3
+ export default {
4
+ title: 'Example/Header',
5
+ component: MyHeader,
6
+ };
7
+
8
+ const Template = (args) => ({
9
+ // Components used in your story `template` are defined in the `components` object
10
+ components: { MyHeader },
11
+ // The story's `args` need to be mapped into the template through the `setup()` method
12
+ setup() {
13
+ // Story args can be spread into the returned object
14
+ return { ...args };
15
+ },
16
+ // Then, the spread values can be accessed directly in the template
17
+ template: '<my-header :user="user" />',
18
+ });
19
+
20
+ export const LoggedIn = Template.bind({});
21
+ LoggedIn.args = {
22
+ user: {},
23
+ };
24
+
25
+ export const LoggedOut = Template.bind({});
26
+ LoggedOut.args = {
27
+ user: null,
28
+ };
@@ -0,0 +1,54 @@
1
+ <template>
2
+ <header>
3
+ <div class="wrapper">
4
+ <div>
5
+ <svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
6
+ <g fill="none" fill-rule="evenodd">
7
+ <path
8
+ d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
9
+ fill="#FFF"
10
+ />
11
+ <path
12
+ d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z"
13
+ fill="#555AB9"
14
+ />
15
+ <path
16
+ d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z"
17
+ fill="#91BAF8"
18
+ />
19
+ </g>
20
+ </svg>
21
+ <h1>Acme</h1>
22
+ </div>
23
+ <div>
24
+ <my-button size="small" @click="$emit('logout')" label="Log out" v-if="user" />
25
+ <my-button size="small" @click="$emit('login')" label="Log in" v-if="!user" />
26
+ <my-button
27
+ primary
28
+ size="small"
29
+ @click="$emit('createAccount')"
30
+ label="Sign up"
31
+ v-if="!user" />
32
+ </div>
33
+ </div>
34
+ </header>
35
+ </template>
36
+
37
+ <script>
38
+ import './header.css';
39
+ import MyButton from './Button.vue';
40
+
41
+ export default {
42
+ name: 'my-header',
43
+
44
+ components: { MyButton },
45
+
46
+ props: {
47
+ user: {
48
+ type: Object,
49
+ },
50
+ },
51
+
52
+ emits: ['login', 'logout', 'createAccount'],
53
+ };
54
+ </script>
@@ -0,0 +1,211 @@
1
+ import { Meta } from '@storybook/addon-docs';
2
+ import Code from './assets/code-brackets.svg';
3
+ import Colors from './assets/colors.svg';
4
+ import Comments from './assets/comments.svg';
5
+ import Direction from './assets/direction.svg';
6
+ import Flow from './assets/flow.svg';
7
+ import Plugin from './assets/plugin.svg';
8
+ import Repo from './assets/repo.svg';
9
+ import StackAlt from './assets/stackalt.svg';
10
+
11
+ <Meta title="Example/Introduction" />
12
+
13
+ <style>{`
14
+ .subheading {
15
+ --mediumdark: '#999999';
16
+ font-weight: 900;
17
+ font-size: 13px;
18
+ color: #999;
19
+ letter-spacing: 6px;
20
+ line-height: 24px;
21
+ text-transform: uppercase;
22
+ margin-bottom: 12px;
23
+ margin-top: 40px;
24
+ }
25
+
26
+ .link-list {
27
+ display: grid;
28
+ grid-template-columns: 1fr;
29
+ grid-template-rows: 1fr 1fr;
30
+ row-gap: 10px;
31
+ }
32
+
33
+ @media (min-width: 620px) {
34
+ .link-list {
35
+ row-gap: 20px;
36
+ column-gap: 20px;
37
+ grid-template-columns: 1fr 1fr;
38
+ }
39
+ }
40
+
41
+ @media all and (-ms-high-contrast:none) {
42
+ .link-list {
43
+ display: -ms-grid;
44
+ -ms-grid-columns: 1fr 1fr;
45
+ -ms-grid-rows: 1fr 1fr;
46
+ }
47
+ }
48
+
49
+ .link-item {
50
+ display: block;
51
+ padding: 20px 30px 20px 15px;
52
+ border: 1px solid #00000010;
53
+ border-radius: 5px;
54
+ transition: background 150ms ease-out, border 150ms ease-out, transform 150ms ease-out;
55
+ color: #333333;
56
+ display: flex;
57
+ align-items: flex-start;
58
+ }
59
+
60
+ .link-item:hover {
61
+ border-color: #1EA7FD50;
62
+ transform: translate3d(0, -3px, 0);
63
+ box-shadow: rgba(0, 0, 0, 0.08) 0 3px 10px 0;
64
+ }
65
+
66
+ .link-item:active {
67
+ border-color: #1EA7FD;
68
+ transform: translate3d(0, 0, 0);
69
+ }
70
+
71
+ .link-item strong {
72
+ font-weight: 700;
73
+ display: block;
74
+ margin-bottom: 2px;
75
+ }
76
+
77
+ .link-item img {
78
+ height: 40px;
79
+ width: 40px;
80
+ margin-right: 15px;
81
+ flex: none;
82
+ }
83
+
84
+ .link-item span {
85
+ font-size: 14px;
86
+ line-height: 20px;
87
+ }
88
+
89
+ .tip {
90
+ display: inline-block;
91
+ border-radius: 1em;
92
+ font-size: 11px;
93
+ line-height: 12px;
94
+ font-weight: 700;
95
+ background: #E7FDD8;
96
+ color: #66BF3C;
97
+ padding: 4px 12px;
98
+ margin-right: 10px;
99
+ vertical-align: top;
100
+ }
101
+
102
+ .tip-wrapper {
103
+ font-size: 13px;
104
+ line-height: 20px;
105
+ margin-top: 40px;
106
+ margin-bottom: 40px;
107
+ }
108
+
109
+ .tip-wrapper code {
110
+ font-size: 12px;
111
+ display: inline-block;
112
+ }
113
+
114
+
115
+ `}</style>
116
+
117
+ # Welcome to Storybook
118
+
119
+ Storybook helps you build UI components in isolation from your app's business logic, data, and context.
120
+ That makes it easy to develop hard-to-reach states. Save these UI states as **stories** to revisit during development, testing, or QA.
121
+
122
+ Browse example stories now by navigating to them in the sidebar.
123
+ View their code in the `src/stories` directory to learn how they work.
124
+ We recommend building UIs with a [**component-driven**](https://componentdriven.org) process starting with atomic components and ending with pages.
125
+
126
+ <div className="subheading">Configure</div>
127
+
128
+ <div className="link-list">
129
+ <a
130
+ className="link-item"
131
+ href="https://storybook.js.org/docs/react/addons/addon-types"
132
+ target="_blank"
133
+ >
134
+ <img src={Plugin} alt="plugin" />
135
+ <span>
136
+ <strong>Presets for popular tools</strong>
137
+ Easy setup for TypeScript, SCSS and more.
138
+ </span>
139
+ </a>
140
+ <a
141
+ className="link-item"
142
+ href="https://storybook.js.org/docs/react/configure/webpack"
143
+ target="_blank"
144
+ >
145
+ <img src={StackAlt} alt="Build" />
146
+ <span>
147
+ <strong>Build configuration</strong>
148
+ How to customize webpack and Babel
149
+ </span>
150
+ </a>
151
+ <a
152
+ className="link-item"
153
+ href="https://storybook.js.org/docs/react/configure/styling-and-css"
154
+ target="_blank"
155
+ >
156
+ <img src={Colors} alt="colors" />
157
+ <span>
158
+ <strong>Styling</strong>
159
+ How to load and configure CSS libraries
160
+ </span>
161
+ </a>
162
+ <a
163
+ className="link-item"
164
+ href="https://storybook.js.org/docs/react/get-started/setup#configure-storybook-for-your-stack"
165
+ target="_blank"
166
+ >
167
+ <img src={Flow} alt="flow" />
168
+ <span>
169
+ <strong>Data</strong>
170
+ Providers and mocking for data libraries
171
+ </span>
172
+ </a>
173
+ </div>
174
+
175
+ <div className="subheading">Learn</div>
176
+
177
+ <div className="link-list">
178
+ <a className="link-item" href="https://storybook.js.org/docs" target="_blank">
179
+ <img src={Repo} alt="repo" />
180
+ <span>
181
+ <strong>Storybook documentation</strong>
182
+ Configure, customize, and extend
183
+ </span>
184
+ </a>
185
+ <a className="link-item" href="https://storybook.js.org/tutorials/" target="_blank">
186
+ <img src={Direction} alt="direction" />
187
+ <span>
188
+ <strong>In-depth guides</strong>
189
+ Best practices from leading teams
190
+ </span>
191
+ </a>
192
+ <a className="link-item" href="https://github.com/storybookjs/storybook" target="_blank">
193
+ <img src={Code} alt="code" />
194
+ <span>
195
+ <strong>GitHub project</strong>
196
+ View the source and add issues
197
+ </span>
198
+ </a>
199
+ <a className="link-item" href="https://discord.gg/storybook" target="_blank">
200
+ <img src={Comments} alt="comments" />
201
+ <span>
202
+ <strong>Discord chat</strong>
203
+ Chat with maintainers and the community
204
+ </span>
205
+ </a>
206
+ </div>
207
+
208
+ <div className="tip-wrapper">
209
+ <span className="tip">Tip</span>Edit the Markdown in{' '}
210
+ <code>src/stories/Introduction.stories.mdx</code>
211
+ </div>
@@ -0,0 +1,30 @@
1
+ import MyPage from './Page.vue';
2
+ import * as HeaderStories from './Header.stories';
3
+
4
+ export default {
5
+ title: 'Example/Page',
6
+ component: MyPage,
7
+ };
8
+
9
+ const Template = (args) => ({
10
+ // Components used in your story `template` are defined in the `components` object
11
+ components: { MyPage },
12
+ // The story's `args` need to be mapped into the template through the `setup()` method
13
+ setup() {
14
+ // Story args can be mapped to keys in the returned object
15
+ return { user: args.user };
16
+ },
17
+ // Then, those values can be accessed directly in the template
18
+ template: '<my-page :user="user" />',
19
+ });
20
+
21
+ export const LoggedIn = Template.bind({});
22
+ LoggedIn.args = {
23
+ // More on composing args: https://storybook.js.org/docs/vue/writing-stories/args#args-composition
24
+ ...HeaderStories.LoggedIn.args,
25
+ };
26
+
27
+ export const LoggedOut = Template.bind({});
28
+ LoggedOut.args = {
29
+ ...HeaderStories.LoggedOut.args,
30
+ };