@policystudio/policy-studio-ui-vue 1.0.11 → 1.0.15

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.
@@ -6,15 +6,14 @@
6
6
  >
7
7
  <i
8
8
  v-if="icon"
9
- class="psui-my-auto material-icons psui-mr-2"
10
- :class="{ 'psui-text-sm': size === 'small' }"
9
+ :class="['psui-mr-2', iconClasses]"
11
10
  >
12
11
  {{ icon }}
13
12
  </i>
14
13
  <div class="psui-flex-grow psui-text-left">{{ label }}</div>
15
14
  <i
16
- v-if="iconRight" class="psui-my-auto material-icons psui-ml-2"
17
- :class="{ 'psui-text-sm': size === 'small' }"
15
+ v-if="iconRight"
16
+ :class="['psui-ml-2', iconClasses]"
18
17
  >
19
18
  {{ iconRight }}
20
19
  </i>
@@ -54,20 +53,45 @@ export default {
54
53
  },
55
54
  disabled: {
56
55
  type: [Boolean, String]
57
- }
58
- },
59
- data () {
60
- return {
56
+ },
57
+ 'text-color': {
58
+ type: String,
59
+ default: ''
60
+ },
61
+ 'icon-color': {
62
+ type: String,
63
+ default: ''
64
+ },
65
+ color: {
66
+ type: String,
67
+ default: ''
61
68
  }
62
69
  },
63
70
  computed: {
71
+ iconClasses() {
72
+ const size = this.sizes === 'small' ? 'psui-text-sm' : ''
73
+ const color = this.iconColor.length > 0 ? `psui-text-${this.iconColor}` : ''
74
+ return `psui-my-auto material-icons ${size} ${color}`
75
+ },
64
76
  classes() {
65
77
  let sizeCss = 'psui-px-4 psui-py-2'
66
78
  if (this.size === 'medium') sizeCss = 'psui-px-4 psui-py-1'
67
79
  if (this.size === 'small') sizeCss = 'psui-px-2 psui-py-psui-px psui-text-sm'
68
80
  if (this.outline) return `${sizeCss} psui-bg-white psui-border ${this.disabled ? 'psui-border-gray-40 psui-text-gray-40' : 'psui-border-blue-60 psui-text-blue-60'}`
69
81
  if (this.ghost) return `${sizeCss} ${this.disabled ? 'psui-bg-gray-20 psui-text-gray-40' : 'psui-bg-blue-20 psui-text-blue-60 active:psui-shadow-inner'}`
70
- if (this.textOnly) return `${sizeCss} ${this.disabled ? 'psui-text-gray-40' : 'psui-text-blue-60'}`
82
+ if (this.textOnly) {
83
+ const hasTextColor = this.textColor.length > 0
84
+ const color = hasTextColor ? this.textColor.split('hover:')[0] : ''
85
+ const hover = hasTextColor ? this.textColor.split('hover:')[1] : ''
86
+
87
+ let textCss = 'psui-text-blue-50 hover:psui-text-blue-60'
88
+ if (this.disabled) textCss = 'psui-text-gray-40'
89
+
90
+ if (hasTextColor) textCss = `psui-text-${color}`
91
+ if (hover) textCss += `hover:psui-text-${hover}`
92
+
93
+ return `${sizeCss} ${textCss}`
94
+ }
71
95
  if (this.disabled) return `${sizeCss} psui-bg-gray-20 psui-text-gray-40`
72
96
  return `${sizeCss} psui-bg-blue-60 hover:psui-bg-blue-50 psui-text-white active:psui-shadow-inner`
73
97
  }
@@ -1,12 +1,13 @@
1
1
  <template>
2
- <label class="container">
2
+ <label class="container psui-pl-6" :class="[{ 'psui-text-gray-40': disabled }, { 'psui-text-gray-50': !disabled }, labelClasses]">
3
3
  {{ label }}
4
4
  <input
5
5
  type="checkbox"
6
- v-model="childValue"
6
+ v-model="model"
7
7
  :disabled="disabled"
8
+ :value="inputValue"
8
9
  />
9
- <span class="checkmark"></span>
10
+ <span class="checkmark psui-border-2" :class="classes" :style="getSize"></span>
10
11
  </label>
11
12
  </template>
12
13
 
@@ -15,68 +16,56 @@ export default {
15
16
  name: 'PsCheckbox',
16
17
  props: {
17
18
  value: {
18
- required: true
19
+ required: true,
19
20
  },
21
+ inputValue: String,
20
22
  label: {
21
23
  type: String,
22
24
  default: ''
23
25
  },
24
- bg: {
25
- type: String,
26
- default: 'blue-20'
27
- },
28
- type: {
29
- type: String,
30
- default: 'checkbox'
31
- },
32
26
  checkboxClasses: {
33
27
  type: String,
34
- default: 'mb-2'
28
+ default: 'psui-pl-8'
35
29
  },
36
30
  labelClasses: {
37
31
  type: String,
38
- default: 'text-gray04'
32
+ default: ''
39
33
  },
40
34
  disabled: {
41
35
  type: Boolean,
42
36
  default: false
43
37
  },
44
- tooltip: {
45
- type: [Object, Boolean, String, Promise],
46
- default: false
47
- },
48
- prevent: {
49
- default: false
50
- },
51
38
  size: {
52
- default: 16
39
+ default: 18
53
40
  }
54
41
  },
55
42
  computed: {
56
- childValue: {
57
- get () {
58
- return this.value
43
+ model: {
44
+ get() {
45
+ return this.value;
59
46
  },
60
- set (newValue) {
61
- console.log(newValue)
62
- if(this.prevent) return
47
+ set(newValue) {
63
48
  this.$emit('input', newValue)
64
49
  this.$emit('change', newValue)
65
- }
50
+ },
51
+ },
52
+ classes() {
53
+ return `${this.disabled ? 'psui-border-gray-40': 'psui-border-gray-50'} ${checkboxClasses}`
66
54
  },
67
55
  getSize() {
68
- return { width: this.size + 'px', height: this.size + 'px'}
56
+ return {
57
+ width: `${this.size}px`,
58
+ height: `${this.size}px`
59
+ }
69
60
  }
70
61
  }
71
62
  }
72
63
  </script>
73
64
 
74
- <style>
65
+ <style scoped>
75
66
  .container {
76
67
  display: block;
77
68
  position: relative;
78
- padding-left: 35px;
79
- margin-bottom: 12px;
80
69
  cursor: pointer;
81
70
  -webkit-user-select: none;
82
71
  -moz-user-select: none;
@@ -99,7 +88,6 @@ export default {
99
88
  height: 18px;
100
89
  width: 18px;
101
90
  background-color: #fff;
102
- border: solid 2px #A2ACB7;
103
91
  border-radius: 2px;
104
92
  }
105
93
 
@@ -119,10 +107,10 @@ export default {
119
107
  }
120
108
 
121
109
  .container .checkmark:after {
122
- left: 5px;
123
- top: 1px;
124
- width: 7px;
125
- height: 13px;
110
+ left: 35%;
111
+ top: 8%;
112
+ width: 35%;
113
+ height: 65%;
126
114
  border: solid white;
127
115
  border-radius: 1px;
128
116
  border-width: 0 2px 2px 0;
@@ -12,6 +12,7 @@
12
12
  <script>
13
13
  export const sizes = ['big', 'small']
14
14
  export default {
15
+ name: 'PsSwitch',
15
16
  computed: {
16
17
  text() {
17
18
  if (this.label && this.labelActived) {
@@ -57,6 +58,10 @@ export default {
57
58
  </script>
58
59
 
59
60
  <style scoped>
61
+ /*
62
+ @TODO - Fix the apply error
63
+ https://www.dropbox.com/s/83vwthcdvdt5t97/Screen%20Shot%202022-01-06%20at%2011.49.00%20AM.png?dl=0
64
+
60
65
  .ps-switch {
61
66
  width: 46px;
62
67
  }
@@ -88,5 +93,5 @@ input:checked + .toggle-bg:after {
88
93
 
89
94
  input:checked + .toggle-bg {
90
95
  @apply psui-bg-green-20 psui-border-green-20;
91
- }
96
+ } */
92
97
  </style>
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <div class="psui-rounded-sm psui-inline-flex psui-bg-gray-10 wrapper psui-gap-x-px" role="group">
3
+ <button
4
+ v-for="(item, index) in items"
5
+ :key="index"
6
+ @click="selectOption(item)"
7
+ type="button"
8
+ class="psui-inline-flex psui-rounded-sm psui-text-small psui-text-blue-60 psui-px-2"
9
+ :class="{'psui-bg-blue-60 psui-text-white psui-font-bold': selected === item}"
10
+ >
11
+ {{ item }}
12
+ </button>
13
+ </div>
14
+ </template>
15
+
16
+ <script>
17
+ export default {
18
+ name: 'PsSlider',
19
+ props: {
20
+ items: {
21
+ type: Array,
22
+ required: true
23
+ },
24
+ selected: {},
25
+ },
26
+ methods: {
27
+ selectOption(item) {
28
+ this.$emit('update:selected', item)
29
+ this.$emit('change', item)
30
+ }
31
+ }
32
+ }
33
+ </script>
34
+
35
+ <style>
36
+ .wrapper {
37
+ padding: 2px;
38
+ }
39
+ </style>
@@ -0,0 +1,98 @@
1
+ <template>
2
+ <div>
3
+ <div v-if="label" class="psui-font-bold psui-text-gray-80">{{ label }}</div>
4
+ <div class="psui-relative">
5
+ <div class="psui-absolute psui-inset-y-0 psui-left-0 psui-pl-2 psui-flex psui-items-center psui-pointer-events-none" v-if="this.$slots.prepend">
6
+ <slot name="prepend"></slot>
7
+ </div>
8
+ <input
9
+ :type="type"
10
+ :placeholder="placeholder"
11
+ :disabled="disabled"
12
+ :aria-required="required"
13
+ :aria-invalid="validation.hasError"
14
+ :class="[getInputClasses, { 'psui-border-red' : validation.hasError }]"
15
+ :required="required"
16
+ @focus="$emit('focus')"
17
+ @blur="$emit('blur')"
18
+ @input="$emit('input', $event.target.value)"
19
+ @keydown.enter="$emit('keydown', $event.target.value)"
20
+ @change="$emit('change')"
21
+ v-bind="getAttrs"
22
+ />
23
+ <div class="psui-absolute psui-inset-y-0 psui-right-0 psui-pr-2 psui-flex psui-items-center" v-if="this.$slots.append">
24
+ <slot name="append"></slot>
25
+ </div>
26
+ </div>
27
+ <div v-if="hint && !validation.hasError" class="psui-text-gray-50 psui-text-xsmall">{{ hint }}</div>
28
+ <div v-if="validation.hasError && validation.label" class="psui-text-red psui-text-xsmall">{{ validation.label }}</div>
29
+ </div>
30
+ </template>
31
+
32
+ <script>
33
+ export default {
34
+ name: 'PsInput',
35
+ props: {
36
+ type: {
37
+ type: String,
38
+ default: 'text'
39
+ },
40
+ required: {
41
+ type: Boolean
42
+ },
43
+ placeholder: {
44
+ type: String
45
+ },
46
+ label: {
47
+ type: String
48
+ },
49
+ hint: {
50
+ type: String
51
+ },
52
+ disabled: {
53
+ type: Boolean,
54
+ default: false
55
+ },
56
+ mini: {
57
+ type: Boolean,
58
+ default: false
59
+ },
60
+ validation: {
61
+ type: Object,
62
+ default: () => {
63
+ return { hasError: false, checked: false, filled: false, required: false }
64
+ }
65
+ },
66
+ value: {
67
+ required: true,
68
+ },
69
+ },
70
+ computed: {
71
+ getInputClasses() {
72
+ return `${this.getPadding} ${this.getText} psui-text-gray-60 psui-bg-white psui-w-full psui-border psui-border-gray-30 psui-rounded-md psui-block hover:psui-border-blue-50 focus:psui-border-blue-50`
73
+ },
74
+ getText() {
75
+ return this.mini ? 'psui-text-small' : ''
76
+ },
77
+ getPadding() {
78
+ return this.mini ? 'psui-px-2 mini-p' : 'psui-py-2 psui-px-4'
79
+ },
80
+ getAttrs() {
81
+ const defaultAttrs = {
82
+ autocapitalize: 'sentences',
83
+ autocomplete: 'chrome-off',
84
+ autocorrect: 'off',
85
+ spellcheck: 'spellcheck'
86
+ }
87
+ return { ...defaultAttrs, ...this.$attrs }
88
+ }
89
+ },
90
+ }
91
+ </script>
92
+
93
+ <style>
94
+ .mini-p {
95
+ padding-top: 6px;
96
+ padding-bottom: 6px;
97
+ }
98
+ </style>
package/src/index.js CHANGED
@@ -1,9 +1,13 @@
1
1
  import PsButton from './components/buttons/PsButton.vue';
2
2
  import PsCheckbox from './components/controls/PsCheckbox.vue';
3
+ import PsRadioButton from './components/controls/PsRadioButton.vue';
4
+ import PsSlider from './components/controls/PsSlider.vue';
5
+ import PsSwitch from './components/controls/PsSwitch.vue';
6
+ import PsToggle from './components/controls/PsToggle.vue';
7
+ import PsInput from './components/forms/PsInput.vue';
3
8
  import PsDialog from './components/notifications/PsDialog.vue';
4
9
  import PsToast from './components/notifications/PsToast.vue';
5
10
  import PsTabHeader from './components/tabs/PsTabHeader.vue';
6
- import PsRadioButton from './components/controls/PsRadioButton.vue';
7
11
 
8
12
  export default {
9
13
  install(Vue) {
@@ -13,6 +17,10 @@ export default {
13
17
  Vue.component('PsToast', PsToast);
14
18
  Vue.component('PsTabHeader', PsTabHeader);
15
19
  Vue.component('PsRadioButton', PsRadioButton);
20
+ Vue.component('PsSlider', PsSlider);
21
+ Vue.component('PsSwitch', PsSwitch);
22
+ Vue.component('PsInput', PsInput);
23
+ Vue.component('PsToggle', PsToggle);
16
24
  }
17
25
  };
18
26
 
@@ -22,5 +30,9 @@ export {
22
30
  PsDialog,
23
31
  PsToast,
24
32
  PsTabHeader,
25
- PsRadioButton
33
+ PsRadioButton,
34
+ PsSlider,
35
+ PsSwitch,
36
+ PsInput,
37
+ PsToggle
26
38
  }
@@ -47,8 +47,8 @@ Ghost.args = {
47
47
  export const TextOnly = Template.bind({});
48
48
  TextOnly.args = {
49
49
  label: 'TextOnly button',
50
- disabled: true,
50
+ disabled: false,
51
51
  icon: 'add_circle',
52
52
  size: 'big',
53
- textOnly: true
53
+ textOnly: true,
54
54
  };
@@ -23,22 +23,19 @@ const Template = (args, { argTypes }) => ({
23
23
  },
24
24
  template: `
25
25
  <div>
26
- <PsCheckbox
27
- v-bind="$props"
28
- v-for="(item, index) in items"
29
- :key="index"
30
- :label="item.label"
31
- :value.sync="item.id"
32
- v-model="selected"
33
- />
34
- {{ selected }}
26
+ <PsCheckbox v-bind="$props" label="Label 1" inputValue="1" v-model="selected" />
27
+ <PsCheckbox v-bind="$props" label="Label 2" inputValue="2" v-model="selected" />
28
+ <PsCheckbox v-bind="$props" label="Label 3" inputValue="3" v-model="selected" />
29
+ <p>Checked: {{ selected }}</p>
35
30
  </div>
36
31
  `
37
32
  });
38
33
 
39
34
  export const Default = Template.bind({});
40
35
  Default.args = {
36
+ size: 18,
37
+ disabled: false,
41
38
  label: 'Label',
42
- size: 16
39
+ labelClasses: '',
43
40
  };
44
41
 
@@ -10,13 +10,59 @@ import { Canvas, Meta, Story } from '@storybook/addon-docs';
10
10
  Out colors are designed to be harmonious, ensure accessible text, and distinguish UI elements and surfaces from one another. The support colors are used as a visual support to communicate and provide better and more meaningful feedback.
11
11
 
12
12
  ## Blue
13
+ <div class="psui-flex">
14
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-blue-80">Blue 80</div>
15
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-blue-70">Blue 70</div>
16
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-blue-60">Blue 60</div>
17
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-blue-50">Blue 50</div>
18
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-blue-70 psui-bg-blue-20">Blue 20</div>
19
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-blue-70 psui-bg-blue-10">Blue 10</div>
20
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-blue-70 psui-bg-white ">White</div>
21
+ </div>
13
22
 
14
- <div class="psui-grid psui-grid-flow-col">
15
- <div class="psui-p-2 psui-h-20 psui-text-white psui-bg-blue-80">Blue 80</div>
16
- <div class="psui-p-2 psui-h-20 psui-text-white psui-bg-blue-70">Blue 70</div>
17
- <div class="psui-p-2 psui-h-20 psui-text-white psui-bg-blue-60">Blue 60</div>
18
- <div class="psui-p-2 psui-h-20 psui-text-white psui-bg-blue-50">Blue 50</div>
19
- <div class="psui-p-2 psui-h-20 psui-text-blue-70 psui-bg-blue-20">Blue 20</div>
20
- <div class="psui-p-2 psui-h-20 psui-text-blue-70 psui-bg-blue-10">Blue 10</div>
21
- <div class="psui-p-2 psui-h-20 psui-text-blue-70 psui-bg-white ">White</div>
22
- </div>
23
+ ## Gray
24
+ <div class="psui-flex">
25
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-gray-80">Gray 80</div>
26
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-gray-70">Gray 70</div>
27
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-gray-60">Gray 60</div>
28
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-gray-50">Gray 50</div>
29
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-gray-40">Gray 40</div>
30
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-gray-50 psui-bg-gray-30">Gray 30</div>
31
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-gray-50 psui-bg-gray-20">Gray 20</div>
32
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-gray-50 psui-bg-gray-10">Gray 10</div>
33
+ </div>
34
+
35
+ ## Yellow
36
+ <div class="psui-flex">
37
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-yellow-80">Yellow 80</div>
38
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-yellow-70">Yellow 70</div>
39
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-yellow-20">Yellow 20</div>
40
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-yellow-20 psui-bg-yellow-10">Yellow 10</div>
41
+ </div>
42
+
43
+ ## Green
44
+ <div class="psui-flex">
45
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-green-80">Green 80</div>
46
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-green-70">Green 70</div>
47
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-green-20">Green 20</div>
48
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-green-20 psui-bg-green-10">Green 10</div>
49
+ </div>
50
+
51
+ ## Red
52
+ <div class="psui-flex">
53
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-red-80">Red 80</div>
54
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-red-70">Red 70</div>
55
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-red-20">Red 20</div>
56
+ <div class="psui-p-2 psui-h-24 psui-w-32 psui-text-red-20 psui-bg-red-10">Red 10</div>
57
+ </div>
58
+
59
+ ## Chart colors
60
+ <div class="psui-flex">
61
+ <div class="psui-float-left psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-sky">Sky</div>
62
+ <div class="psui-float-left psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-teal">Teal</div>
63
+ <div class="psui-float-left psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-emerald">Emerald</div>
64
+ <div class="psui-float-left psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-mustard">Mustard</div>
65
+ <div class="psui-float-left psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-orange">Orange</div>
66
+ <div class="psui-float-left psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-pink">Pink</div>
67
+ <div class="psui-float-left psui-p-2 psui-h-24 psui-w-32 psui-text-white psui-bg-purple">Purple</div>
68
+ </div>
@@ -31,11 +31,11 @@ The shadows in our elements are projected by these two light sources: main light
31
31
 
32
32
  ## 2. Elevation system
33
33
  Shadows provide cues about depth, direction of movement, and surface edges. A surface’s shadow is determined by its elevation and relationship to other surfaces.
34
- <div class="psui-grid grid-cols-2 psui-gap-6 psui-p-6 psui-bg-gray-20">
35
- <div class="psui-rounded-md psui-p-8 psui-h-20 psui-shadow-inner">Elevation -5</div>
36
- <div class="psui-rounded-md psui-p-8 psui-h-20 psui-bg-white psui-shadow-sm">Elevation 5</div>
37
- <div class="psui-rounded-md psui-p-8 psui-h-20 psui-bg-white psui-shadow">Elevation 10</div>
38
- <div class="psui-rounded-md psui-p-8 psui-h-20 psui-bg-white psui-shadow-md">Elevation 20</div>
39
- <div class="psui-rounded-md psui-p-8 psui-h-20 psui-bg-white psui-shadow-lg">Elevation 30</div>
40
- <div class="psui-rounded-md psui-p-8 psui-h-20 psui-bg-white psui-shadow-xl">Elevation 40</div>
34
+ <div class="psui-grid psui-grid-cols-2 psui-gap-6 psui-p-6 psui-bg-gray-20">
35
+ <div class="psui-rounded-md psui-p-8 psui-h-20 psui-shadow-elevation--5">Elevation -5</div>
36
+ <div class="psui-rounded-md psui-p-8 psui-h-20 psui-bg-white psui-shadow-elevation-5">Elevation 5</div>
37
+ <div class="psui-rounded-md psui-p-8 psui-h-20 psui-bg-white psui-shadow-elevation-10">Elevation 10</div>
38
+ <div class="psui-rounded-md psui-p-8 psui-h-20 psui-bg-white psui-shadow-elevation-20">Elevation 20</div>
39
+ <div class="psui-rounded-md psui-p-8 psui-h-20 psui-bg-white psui-shadow-elevation-30">Elevation 30</div>
40
+ <div class="psui-rounded-md psui-p-8 psui-h-20 psui-bg-white psui-shadow-elevation-40">Elevation 40</div>
41
41
  </div>
@@ -0,0 +1,85 @@
1
+ import PsInput from '../components/forms/PsInput.vue';
2
+ export default {
3
+ title: 'Components/Input',
4
+ component: PsInput,
5
+ argTypes: {
6
+ disabled: { control: 'boolean' },
7
+ required: { control: 'boolean' },
8
+ },
9
+ };
10
+
11
+ const TemplateDefault = (args, { argTypes }) => ({
12
+ props: Object.keys(argTypes),
13
+ components: { PsInput },
14
+ data: () => {
15
+ return {
16
+ validator: {
17
+ hasError: true,
18
+ label: 'Error message!'
19
+ }
20
+ }
21
+ },
22
+ template: `
23
+ <div class="psui-p-8 psui-bg-gray-10">
24
+ <PsInput v-bind="$props" />
25
+ <PsInput v-bind="$props" class="psui-mt-8" :validator="validator" />
26
+ </div>
27
+ `
28
+ });
29
+
30
+ const TemplateSlots = (args, { argTypes }) => ({
31
+ props: Object.keys(argTypes),
32
+ components: { PsInput },
33
+ template: `
34
+ <div class="psui-p-8 psui-bg-gray-10">
35
+ <PsInput v-bind="$props" class="psui-mb-4">
36
+ <template v-slot:append>
37
+ ft²
38
+ </template>
39
+ </PsInput>
40
+ <PsInput v-bind="$props" class="psui-mb-4">
41
+ <template v-slot:prepend>
42
+ ft²
43
+ </template>
44
+ </PsInput>
45
+ <PsInput v-bind="$props" class="psui-mb-4">
46
+ <template v-slot:prepend>
47
+ ft²
48
+ </template>
49
+ <template v-slot:append>
50
+ ft²
51
+ </template>
52
+ </PsInput>
53
+ </div>
54
+ `
55
+ });
56
+
57
+ export const InputText = TemplateDefault.bind({});
58
+ InputText.args = {
59
+ label: 'Label',
60
+ placeholder: 'Placeholder',
61
+ hint: 'Optional Assistive text',
62
+ disabled: false,
63
+ required: false,
64
+ mini: false,
65
+ };
66
+
67
+ export const InputPassword = TemplateDefault.bind({});
68
+ InputPassword.args = {
69
+ type: 'password',
70
+ label: 'Password',
71
+ hint: 'Optional Assistive text',
72
+ disabled: false,
73
+ required: false,
74
+ mini: false,
75
+ };
76
+
77
+ export const InputSlots = TemplateSlots.bind({});
78
+ InputSlots.args = {
79
+ label: 'Label',
80
+ placeholder: 'Placeholder',
81
+ hint: 'Optional Assistive text',
82
+ disabled: false,
83
+ required: false,
84
+ mini: false,
85
+ };
@@ -0,0 +1,22 @@
1
+ import PsToggle from '../components/controls/PsToggle.vue';
2
+ export default {
3
+ title: 'Components/Toggle',
4
+ component: PsToggle,
5
+ argTypes: {},
6
+ };
7
+ const items = ['Option 1', 'Option 2', 'Option 3']
8
+ const selected = 'Option 2'
9
+
10
+ const Template = (args, { argTypes }) => ({
11
+ props: Object.keys(argTypes),
12
+ components: { PsToggle },
13
+ template: `
14
+ <PsToggle v-bind="$props" :selected.sync="selected" />
15
+ `
16
+ });
17
+
18
+ export const Default = Template.bind({});
19
+ Default.args = {
20
+ items: items,
21
+ selected: selected
22
+ };