@policystudio/policy-studio-ui-vue 1.0.62 → 1.0.65
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/.github/workflows/deploy-storybook.yml +47 -0
- package/package.json +1 -1
- package/src/components/chips/PsChips.vue +19 -2
- package/src/components/controls/PsCheckboxSimple.vue +1 -2
- package/src/components/controls/PsRadioButtonSimple.vue +97 -0
- package/src/components/forms/PsInputTextArea.vue +16 -16
- package/src/index.js +4 -1
- package/src/stories/RadioButtonSimple.stories.js +43 -0
- package/vercel.json +11 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: Deploy Storybook
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- master
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
pull-requests: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
deploy:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
timeout-minutes: 20
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout code
|
|
17
|
+
uses: actions/checkout@v2
|
|
18
|
+
|
|
19
|
+
- name: Cache dependencies
|
|
20
|
+
uses: actions/cache@v2
|
|
21
|
+
with:
|
|
22
|
+
path: ~/.npm
|
|
23
|
+
key: npm-${{ hashFiles('package-lock.json') }}
|
|
24
|
+
restore-keys: npm-
|
|
25
|
+
|
|
26
|
+
- name: Setup Node.js
|
|
27
|
+
uses: actions/setup-node@v2
|
|
28
|
+
with:
|
|
29
|
+
node-version: ^14.0.0
|
|
30
|
+
|
|
31
|
+
- name: Install dependencies
|
|
32
|
+
run: npm install && npm install vercel@25.1.0 && npm install -g vercel@25.1.0
|
|
33
|
+
|
|
34
|
+
- name: Build storybook
|
|
35
|
+
run: npm run build-storybook && cp ./vercel.json storybook-static/
|
|
36
|
+
|
|
37
|
+
- name: Deploy Storybook into vercel
|
|
38
|
+
uses: amondnet/vercel-action@v25.1.0
|
|
39
|
+
with:
|
|
40
|
+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
|
|
41
|
+
github-token: ${{ github.token }}
|
|
42
|
+
github-comment: false
|
|
43
|
+
vercel-org-id: ${{ secrets.VERCEL_TEAM_ID }}
|
|
44
|
+
vercel-project-id: ${{ secrets.VERCEL_STORYBOOK_PROJECT_ID }}
|
|
45
|
+
scope: ${{ secrets.VERCEL_TEAM_ID }}
|
|
46
|
+
working-directory: ./storybook-static
|
|
47
|
+
vercel-args: '--prod'
|
package/package.json
CHANGED
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
:disabled="disabled"
|
|
9
9
|
v-if="type != 'button'"
|
|
10
10
|
:type="type"
|
|
11
|
-
:id="
|
|
11
|
+
:id="getInputId"
|
|
12
12
|
:checked="checked"
|
|
13
13
|
/>
|
|
14
14
|
<label
|
|
15
15
|
:disabled="disabled"
|
|
16
|
-
:for="
|
|
16
|
+
:for="getInputId"
|
|
17
17
|
:class="{'checked':checked && type === 'button'}"
|
|
18
18
|
>
|
|
19
19
|
<i v-if="icon" class="psui-el-chips-icon psui-el-chips-icon-prepend">{{ icon }}</i>
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
|
|
32
32
|
<script>
|
|
33
33
|
export const type = ['radio', 'checkbox', 'button']
|
|
34
|
+
import { randomString } from '../../util/GeneralFunctions'
|
|
34
35
|
|
|
35
36
|
export default {
|
|
36
37
|
name: 'PsChips',
|
|
@@ -87,6 +88,13 @@ export default {
|
|
|
87
88
|
type: Boolean,
|
|
88
89
|
default: false
|
|
89
90
|
},
|
|
91
|
+
/**
|
|
92
|
+
* Add html attributes to the element input
|
|
93
|
+
*/
|
|
94
|
+
inputAttrs: {
|
|
95
|
+
type: Object,
|
|
96
|
+
default: () => ({})
|
|
97
|
+
},
|
|
90
98
|
},
|
|
91
99
|
emits: ['click', 'change'],
|
|
92
100
|
computed: {
|
|
@@ -97,6 +105,15 @@ export default {
|
|
|
97
105
|
return 'status-resting'
|
|
98
106
|
}
|
|
99
107
|
},
|
|
108
|
+
getInputId() {
|
|
109
|
+
if (this?.inputAttrs?.id) {
|
|
110
|
+
return this.inputAttrs.id
|
|
111
|
+
} else if (this?.$attrs?.id) {
|
|
112
|
+
return this.$attrs.id
|
|
113
|
+
} else {
|
|
114
|
+
return randomString(16)
|
|
115
|
+
}
|
|
116
|
+
},
|
|
100
117
|
},
|
|
101
118
|
methods: {
|
|
102
119
|
onClick() {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
class='psui-el-checkbox'
|
|
4
|
-
@click="$emit('click')"
|
|
5
4
|
:class="[getComponentClass, {'disabled':disabled}]"
|
|
6
5
|
v-bind="getComponentAttrs"
|
|
7
6
|
>
|
|
@@ -12,7 +11,7 @@
|
|
|
12
11
|
:name="label"
|
|
13
12
|
:id="getInputId"
|
|
14
13
|
v-bind="inputAttrs"
|
|
15
|
-
@change="$emit('change')"
|
|
14
|
+
@change="$emit('change')"
|
|
16
15
|
/>
|
|
17
16
|
<label
|
|
18
17
|
:for="getInputId"
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class='psui-el-radio'
|
|
4
|
+
:class="[getComponentClass, {'disabled':disabled}]"
|
|
5
|
+
v-bind="getComponentAttrs"
|
|
6
|
+
>
|
|
7
|
+
<input
|
|
8
|
+
type="radio"
|
|
9
|
+
:checked="checked"
|
|
10
|
+
:disabled="disabled"
|
|
11
|
+
:label="label"
|
|
12
|
+
:name="name"
|
|
13
|
+
:id="getInputId"
|
|
14
|
+
v-bind="inputAttrs"
|
|
15
|
+
@change="$emit('change')"
|
|
16
|
+
/>
|
|
17
|
+
<label
|
|
18
|
+
:for="getInputId"
|
|
19
|
+
class="psui-el-checkmark"
|
|
20
|
+
>
|
|
21
|
+
<slot name="content">
|
|
22
|
+
<span>{{ label }}</span>
|
|
23
|
+
</slot>
|
|
24
|
+
</label>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
import { randomString } from '../../util/GeneralFunctions'
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
name: 'PsRadioButtonSimple',
|
|
33
|
+
props: {
|
|
34
|
+
/**
|
|
35
|
+
* It sets the label of the checkbox input.
|
|
36
|
+
*/
|
|
37
|
+
label: {
|
|
38
|
+
type: String,
|
|
39
|
+
},
|
|
40
|
+
name:{
|
|
41
|
+
type: String,
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* It disables the checkbox input.
|
|
45
|
+
*/
|
|
46
|
+
disabled: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false,
|
|
49
|
+
},
|
|
50
|
+
/**
|
|
51
|
+
* Sets the input as checked
|
|
52
|
+
*/
|
|
53
|
+
checked: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: false
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* Add html attributes to the element input
|
|
59
|
+
*/
|
|
60
|
+
inputAttrs: {
|
|
61
|
+
type: Object,
|
|
62
|
+
default: () => ({})
|
|
63
|
+
},
|
|
64
|
+
/**
|
|
65
|
+
* It set the of the checkbox input. eg: big and small.
|
|
66
|
+
*/
|
|
67
|
+
size: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: 'big',
|
|
70
|
+
validator: (value)=> ['big', 'small'].includes(value)
|
|
71
|
+
},
|
|
72
|
+
/**
|
|
73
|
+
* It set the layout of the checkbox input. eg: default and mixed.
|
|
74
|
+
*/
|
|
75
|
+
},
|
|
76
|
+
inheritAttrs: false,
|
|
77
|
+
computed:{
|
|
78
|
+
getComponentClass(){
|
|
79
|
+
return `size-${this.size}`
|
|
80
|
+
},
|
|
81
|
+
getInputId() {
|
|
82
|
+
if (this?.inputAttrs?.id) {
|
|
83
|
+
return this.inputAttrs.id
|
|
84
|
+
} else if (this?.$attrs?.id) {
|
|
85
|
+
return this.$attrs.id
|
|
86
|
+
} else {
|
|
87
|
+
return randomString(16)
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
getComponentAttrs() {
|
|
91
|
+
let componentAttrs = { ... this.$attrs }
|
|
92
|
+
delete componentAttrs.id
|
|
93
|
+
return componentAttrs
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
</script>
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
:autocapitalize="autocapitalize"
|
|
8
8
|
:aria-required="required"
|
|
9
9
|
:value="value"
|
|
10
|
-
@
|
|
11
|
-
@
|
|
12
|
-
@input="
|
|
10
|
+
@focus="onInputFocus"
|
|
11
|
+
@blur="onInputBlur"
|
|
12
|
+
@input="$emit('input', $event)"
|
|
13
|
+
@change="$emit('change', $event)"
|
|
13
14
|
:rows="rows"
|
|
14
15
|
:placeholder="placeholder"
|
|
15
16
|
:readonly='disabled'
|
|
@@ -52,8 +53,8 @@ export default {
|
|
|
52
53
|
* It sets aria-required property. eg: true or false.
|
|
53
54
|
*/
|
|
54
55
|
required:{
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default:true
|
|
57
58
|
},
|
|
58
59
|
/**
|
|
59
60
|
* It sets the type of autocapitalize. See mdn web-doc for full information. default: sentences.
|
|
@@ -73,19 +74,18 @@ export default {
|
|
|
73
74
|
* It disabled the textarea input. All mouse events are disabled.
|
|
74
75
|
*/
|
|
75
76
|
disabled: {
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: false,
|
|
78
79
|
}
|
|
80
|
+
},
|
|
81
|
+
methods: {
|
|
82
|
+
onInputFocus($event) {
|
|
83
|
+
this.isFocus = true
|
|
84
|
+
this.$emit('focus', $event)
|
|
79
85
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
},
|
|
84
|
-
onFocus(){
|
|
85
|
-
this.$emit('focus',this.$event)
|
|
86
|
-
},
|
|
87
|
-
onInput(){
|
|
88
|
-
this.$emit('input', this.$event)
|
|
86
|
+
onInputBlur($event) {
|
|
87
|
+
this.isFocus = false
|
|
88
|
+
this.$emit('blur', $event)
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
package/src/index.js
CHANGED
|
@@ -30,6 +30,7 @@ import PsScrollBar from './components/playground/PsScrollBar.vue'
|
|
|
30
30
|
import PsMiniTag from './components/badges-and-tags/PsMiniTag.vue'
|
|
31
31
|
import PsCheckboxSimple from './components/controls/PsCheckboxSimple.vue'
|
|
32
32
|
import PsBadgeWithIcon from './components/badges-and-tags/PsBadgeWithIcon.vue'
|
|
33
|
+
import PsRadioButtonSimple from './components/controls/PsRadioButtonSimple.vue'
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
|
|
@@ -67,6 +68,7 @@ export default {
|
|
|
67
68
|
Vue.component('PsMiniTag', PsMiniTag)
|
|
68
69
|
Vue.component('PsCheckboxSimple', PsCheckboxSimple)
|
|
69
70
|
Vue.component('PsBadgeWithIcon', PsBadgeWithIcon)
|
|
71
|
+
Vue.component('PsRadioButtonSimple', PsRadioButtonSimple)
|
|
70
72
|
|
|
71
73
|
Vue.directive('click-outside', {
|
|
72
74
|
bind: function (el, binding, vnode) {
|
|
@@ -118,6 +120,7 @@ export {
|
|
|
118
120
|
PsScrollBar,
|
|
119
121
|
PsMiniTag,
|
|
120
122
|
PsCheckboxSimple,
|
|
121
|
-
PsBadgeWithIcon
|
|
123
|
+
PsBadgeWithIcon,
|
|
124
|
+
PsRadioButtonSimple
|
|
122
125
|
}
|
|
123
126
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import PsRadioButtonSimple from '../components/controls/PsRadioButtonSimple.vue'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/Inputs V2/RadioButton',
|
|
5
|
+
component: PsRadioButtonSimple,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const defaultTemplate = (args, {argTypes}) => ({
|
|
9
|
+
props: Object.keys(argTypes),
|
|
10
|
+
components: { PsRadioButtonSimple },
|
|
11
|
+
data: () => ({
|
|
12
|
+
checkBox1 : true
|
|
13
|
+
}),
|
|
14
|
+
template: `
|
|
15
|
+
<div style='display:flex; gap: 20px;'>
|
|
16
|
+
<div style='display:flex; flex-direction:column; gap:5px;'>
|
|
17
|
+
<p>Resting</p>
|
|
18
|
+
<div style='display: flex; flex-direction:column; gap: 10px;'>
|
|
19
|
+
<PsRadioButtonSimple :checked="radioButton1" @click="radioButton1 = true" label='Label 1' />
|
|
20
|
+
<PsRadioButtonSimple :checked="radioButton2" @click="radioButton2 = true" label='Label 2' size='small' />
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
<div style='display:flex; flex-direction:column; gap:5px;'>
|
|
24
|
+
<p>Active</p>
|
|
25
|
+
<div style='display: flex; flex-direction:column; gap: 10px;'>
|
|
26
|
+
<PsRadioButtonSimple v-bind="$props" label='Label 3' checked />
|
|
27
|
+
<PsRadioButtonSimple v-bind="$props" label='Label 4' checked size='small'/>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
<div style='display:flex; flex-direction:column; gap:5px;'>
|
|
31
|
+
<p>Disabled</p>
|
|
32
|
+
<div style='display: flex; flex-direction:column; gap: 10px;'>
|
|
33
|
+
<PsRadioButtonSimple v-bind="$props" label='Input via inputAttrs' :inputAttrs="{ id: 'my-input-id' }" disabled/>
|
|
34
|
+
<PsRadioButtonSimple v-bind="$props" label='Input via component id' size='small' id="my-component-id" data-test="test" disabled/>
|
|
35
|
+
<PsRadioButtonSimple v-bind="$props" label='Input fallback' size='small' disabled/>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
`
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
export const Default = defaultTemplate.bind({})
|
|
43
|
+
|