@policystudio/policy-studio-ui-vue 1.0.4 → 1.0.8

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 CHANGED
@@ -1,11 +1,29 @@
1
1
  # UI library of Vue components with StoryBook
2
2
 
3
- ### Run documentation
4
- ```$ npm run storybook```
3
+ ### Instalation
4
+ ```sh
5
+ npm i -S @policystudio/policy-studio-ui-vue
6
+ ```
5
7
 
6
- ### Instalation for use
7
- ```$ npm i -S @policystudio/policy-studio-ui-vue```
8
+ ### Import the library
9
+ ```javascript
10
+ // src/initComponents.js
8
11
 
12
+ import PolicyStudioUiVue from '@policystudio/policy-studio-ui-vue'
13
+ // ...
14
+ Vue.use(PolicyStudioUiVue)
15
+ ```
9
16
  ### Import CSS
10
17
  Add in your css file
11
- ```@import '~@policystudio/policy-studio-ui-vue/src/assets/scss/tailwind.css'```
18
+
19
+ ```css
20
+ /* src/assets/css/index.css */
21
+
22
+ @import '~@policystudio/policy-studio-ui-vue/src/assets/scss/tailwind.css'
23
+ ```
24
+
25
+ ### Run documentation
26
+ ```npm run storybook```
27
+
28
+ ### Website
29
+ [ui.policystudio.co](https://ui.policystudio.co/)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@policystudio/policy-studio-ui-vue",
3
- "version": "1.0.4",
3
+ "version": "1.0.8",
4
4
  "description": "Policy Studio UI",
5
5
  "main": "src/index.js",
6
6
  "author": "Policy Studio Team",
@@ -3,27 +3,3 @@
3
3
  @tailwind utilities;
4
4
  @import url('https://fonts.googleapis.com/icon?family=Material+Icons');
5
5
 
6
- .text-h1 {
7
- font-size: 28;
8
- line-height: 120%;
9
- }
10
- .text-h2 {
11
- font-size: 24px;
12
- line-height: 120%;
13
- }
14
- .text-h3 {
15
- font-size: 22px;
16
- line-height: 120%;
17
- }
18
- .text-h4 {
19
- font-size: 20px;
20
- line-height: 120%;
21
- }
22
- .text-h5 {
23
- font-size: 18px;
24
- line-height: 120%;
25
- }
26
- .text-h6 {
27
- font-size: 17px;
28
- line-height: 120%;
29
- }
@@ -6571,44 +6571,59 @@ video {
6571
6571
  height: 100vh;
6572
6572
  }
6573
6573
 
6574
- .psui-text-xs {
6575
- font-size: 0.75rem;
6574
+ .psui-text-small {
6575
+ font-size: 14px;
6576
+ line-height: 130%;
6576
6577
  }
6577
6578
 
6578
- .psui-text-sm {
6579
- font-size: 0.875rem;
6579
+ .psui-text-xSmall {
6580
+ font-size: 12px;
6581
+ line-height: 130%;
6580
6582
  }
6581
6583
 
6582
- .psui-text-base {
6583
- font-size: 1rem;
6584
+ .psui-text-accent {
6585
+ font-size: 14px;
6586
+ line-height: 130%;
6584
6587
  }
6585
6588
 
6586
- .psui-text-lg {
6587
- font-size: 1.125rem;
6589
+ .psui-text-accentSmall {
6590
+ font-size: 12px;
6591
+ line-height: 130%;
6588
6592
  }
6589
6593
 
6590
- .psui-text-xl {
6591
- font-size: 1.25rem;
6594
+ .psui-text-p {
6595
+ font-size: 16px;
6596
+ line-height: 120%;
6592
6597
  }
6593
6598
 
6594
- .psui-text-2xl {
6595
- font-size: 1.5rem;
6599
+ .psui-text-h1 {
6600
+ font-size: 28px;
6601
+ line-height: 120%;
6596
6602
  }
6597
6603
 
6598
- .psui-text-3xl {
6599
- font-size: 1.875rem;
6604
+ .psui-text-h2 {
6605
+ font-size: 24px;
6606
+ line-height: 120%;
6600
6607
  }
6601
6608
 
6602
- .psui-text-4xl {
6603
- font-size: 2.25rem;
6609
+ .psui-text-h3 {
6610
+ font-size: 22px;
6611
+ line-height: 120%;
6612
+ }
6613
+
6614
+ .psui-text-h4 {
6615
+ font-size: 20px;
6616
+ line-height: 120%;
6604
6617
  }
6605
6618
 
6606
- .psui-text-5xl {
6607
- font-size: 3rem;
6619
+ .psui-text-h5 {
6620
+ font-size: 18px;
6621
+ line-height: 120%;
6608
6622
  }
6609
6623
 
6610
- .psui-text-6xl {
6611
- font-size: 4rem;
6624
+ .psui-text-h6 {
6625
+ font-size: 17px;
6626
+ line-height: 120%;
6612
6627
  }
6613
6628
 
6614
6629
  .psui-leading-3 {
@@ -10043,6 +10058,30 @@ video {
10043
10058
  resize: both;
10044
10059
  }
10045
10060
 
10061
+ .psui-shadow-elevationInner {
10062
+ box-shadow: box-shadow: 0px 1px 0px #FFFFFF, inset 0px 1px 2px rgba(0, 0, 0, 0.1);
10063
+ }
10064
+
10065
+ .psui-shadow-elevation5 {
10066
+ box-shadow: box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.03), 0px 1px 2px rgba(0, 0, 0, 0.1);
10067
+ }
10068
+
10069
+ .psui-shadow-elevation10 {
10070
+ box-shadow: box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.04), 0px 2px 5px rgba(0, 0, 0, 0.08);
10071
+ }
10072
+
10073
+ .psui-shadow-elevation20 {
10074
+ box-shadow: box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.04), 0px 5px 6px rgba(0, 0, 0, 0.1);
10075
+ }
10076
+
10077
+ .psui-shadow-elevation30 {
10078
+ box-shadow: box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.05), 0px 10px 15px rgba(0, 0, 0, 0.15);
10079
+ }
10080
+
10081
+ .psui-shadow-elevation40 {
10082
+ box-shadow: box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.05), 0px 30px 60px rgba(0, 0, 0, 0.2);
10083
+ }
10084
+
10046
10085
  .psui-shadow-sm {
10047
10086
  box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.03), 0px 1px 2px rgba(0, 0, 0, 0.1);
10048
10087
  }
@@ -10071,6 +10110,30 @@ video {
10071
10110
  box-shadow: none;
10072
10111
  }
10073
10112
 
10113
+ .active\:psui-shadow-elevationInner:active {
10114
+ box-shadow: box-shadow: 0px 1px 0px #FFFFFF, inset 0px 1px 2px rgba(0, 0, 0, 0.1);
10115
+ }
10116
+
10117
+ .active\:psui-shadow-elevation5:active {
10118
+ box-shadow: box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.03), 0px 1px 2px rgba(0, 0, 0, 0.1);
10119
+ }
10120
+
10121
+ .active\:psui-shadow-elevation10:active {
10122
+ box-shadow: box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.04), 0px 2px 5px rgba(0, 0, 0, 0.08);
10123
+ }
10124
+
10125
+ .active\:psui-shadow-elevation20:active {
10126
+ box-shadow: box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.04), 0px 5px 6px rgba(0, 0, 0, 0.1);
10127
+ }
10128
+
10129
+ .active\:psui-shadow-elevation30:active {
10130
+ box-shadow: box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.05), 0px 10px 15px rgba(0, 0, 0, 0.15);
10131
+ }
10132
+
10133
+ .active\:psui-shadow-elevation40:active {
10134
+ box-shadow: box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.05), 0px 30px 60px rgba(0, 0, 0, 0.2);
10135
+ }
10136
+
10074
10137
  .active\:psui-shadow-sm:active {
10075
10138
  box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.03), 0px 1px 2px rgba(0, 0, 0, 0.1);
10076
10139
  }
@@ -14733,36 +14796,6 @@ video {
14733
14796
 
14734
14797
  @import url('https://fonts.googleapis.com/icon?family=Material+Icons');
14735
14798
 
14736
- .text-h1 {
14737
- font-size: 28;
14738
- line-height: 120%;
14739
- }
14740
-
14741
- .text-h2 {
14742
- font-size: 24px;
14743
- line-height: 120%;
14744
- }
14745
-
14746
- .text-h3 {
14747
- font-size: 22px;
14748
- line-height: 120%;
14749
- }
14750
-
14751
- .text-h4 {
14752
- font-size: 20px;
14753
- line-height: 120%;
14754
- }
14755
-
14756
- .text-h5 {
14757
- font-size: 18px;
14758
- line-height: 120%;
14759
- }
14760
-
14761
- .text-h6 {
14762
- font-size: 17px;
14763
- line-height: 120%;
14764
- }
14765
-
14766
14799
  @media (min-width: 640px) {
14767
14800
  .sm\:psui-container {
14768
14801
  width: 100%;
@@ -19669,44 +19702,59 @@ video {
19669
19702
  height: 100vh;
19670
19703
  }
19671
19704
 
19672
- .sm\:psui-text-xs {
19673
- font-size: 0.75rem;
19705
+ .sm\:psui-text-small {
19706
+ font-size: 14px;
19707
+ line-height: 130%;
19674
19708
  }
19675
19709
 
19676
- .sm\:psui-text-sm {
19677
- font-size: 0.875rem;
19710
+ .sm\:psui-text-xSmall {
19711
+ font-size: 12px;
19712
+ line-height: 130%;
19678
19713
  }
19679
19714
 
19680
- .sm\:psui-text-base {
19681
- font-size: 1rem;
19715
+ .sm\:psui-text-accent {
19716
+ font-size: 14px;
19717
+ line-height: 130%;
19682
19718
  }
19683
19719
 
19684
- .sm\:psui-text-lg {
19685
- font-size: 1.125rem;
19720
+ .sm\:psui-text-accentSmall {
19721
+ font-size: 12px;
19722
+ line-height: 130%;
19686
19723
  }
19687
19724
 
19688
- .sm\:psui-text-xl {
19689
- font-size: 1.25rem;
19725
+ .sm\:psui-text-p {
19726
+ font-size: 16px;
19727
+ line-height: 120%;
19690
19728
  }
19691
19729
 
19692
- .sm\:psui-text-2xl {
19693
- font-size: 1.5rem;
19730
+ .sm\:psui-text-h1 {
19731
+ font-size: 28px;
19732
+ line-height: 120%;
19694
19733
  }
19695
19734
 
19696
- .sm\:psui-text-3xl {
19697
- font-size: 1.875rem;
19735
+ .sm\:psui-text-h2 {
19736
+ font-size: 24px;
19737
+ line-height: 120%;
19698
19738
  }
19699
19739
 
19700
- .sm\:psui-text-4xl {
19701
- font-size: 2.25rem;
19740
+ .sm\:psui-text-h3 {
19741
+ font-size: 22px;
19742
+ line-height: 120%;
19702
19743
  }
19703
19744
 
19704
- .sm\:psui-text-5xl {
19705
- font-size: 3rem;
19745
+ .sm\:psui-text-h4 {
19746
+ font-size: 20px;
19747
+ line-height: 120%;
19706
19748
  }
19707
19749
 
19708
- .sm\:psui-text-6xl {
19709
- font-size: 4rem;
19750
+ .sm\:psui-text-h5 {
19751
+ font-size: 18px;
19752
+ line-height: 120%;
19753
+ }
19754
+
19755
+ .sm\:psui-text-h6 {
19756
+ font-size: 17px;
19757
+ line-height: 120%;
19710
19758
  }
19711
19759
 
19712
19760
  .sm\:psui-leading-3 {
@@ -32614,44 +32662,59 @@ video {
32614
32662
  height: 100vh;
32615
32663
  }
32616
32664
 
32617
- .md\:psui-text-xs {
32618
- font-size: 0.75rem;
32665
+ .md\:psui-text-small {
32666
+ font-size: 14px;
32667
+ line-height: 130%;
32668
+ }
32669
+
32670
+ .md\:psui-text-xSmall {
32671
+ font-size: 12px;
32672
+ line-height: 130%;
32619
32673
  }
32620
32674
 
32621
- .md\:psui-text-sm {
32622
- font-size: 0.875rem;
32675
+ .md\:psui-text-accent {
32676
+ font-size: 14px;
32677
+ line-height: 130%;
32623
32678
  }
32624
32679
 
32625
- .md\:psui-text-base {
32626
- font-size: 1rem;
32680
+ .md\:psui-text-accentSmall {
32681
+ font-size: 12px;
32682
+ line-height: 130%;
32627
32683
  }
32628
32684
 
32629
- .md\:psui-text-lg {
32630
- font-size: 1.125rem;
32685
+ .md\:psui-text-p {
32686
+ font-size: 16px;
32687
+ line-height: 120%;
32631
32688
  }
32632
32689
 
32633
- .md\:psui-text-xl {
32634
- font-size: 1.25rem;
32690
+ .md\:psui-text-h1 {
32691
+ font-size: 28px;
32692
+ line-height: 120%;
32635
32693
  }
32636
32694
 
32637
- .md\:psui-text-2xl {
32638
- font-size: 1.5rem;
32695
+ .md\:psui-text-h2 {
32696
+ font-size: 24px;
32697
+ line-height: 120%;
32639
32698
  }
32640
32699
 
32641
- .md\:psui-text-3xl {
32642
- font-size: 1.875rem;
32700
+ .md\:psui-text-h3 {
32701
+ font-size: 22px;
32702
+ line-height: 120%;
32643
32703
  }
32644
32704
 
32645
- .md\:psui-text-4xl {
32646
- font-size: 2.25rem;
32705
+ .md\:psui-text-h4 {
32706
+ font-size: 20px;
32707
+ line-height: 120%;
32647
32708
  }
32648
32709
 
32649
- .md\:psui-text-5xl {
32650
- font-size: 3rem;
32710
+ .md\:psui-text-h5 {
32711
+ font-size: 18px;
32712
+ line-height: 120%;
32651
32713
  }
32652
32714
 
32653
- .md\:psui-text-6xl {
32654
- font-size: 4rem;
32715
+ .md\:psui-text-h6 {
32716
+ font-size: 17px;
32717
+ line-height: 120%;
32655
32718
  }
32656
32719
 
32657
32720
  .md\:psui-leading-3 {
@@ -45559,44 +45622,59 @@ video {
45559
45622
  height: 100vh;
45560
45623
  }
45561
45624
 
45562
- .lg\:psui-text-xs {
45563
- font-size: 0.75rem;
45625
+ .lg\:psui-text-small {
45626
+ font-size: 14px;
45627
+ line-height: 130%;
45628
+ }
45629
+
45630
+ .lg\:psui-text-xSmall {
45631
+ font-size: 12px;
45632
+ line-height: 130%;
45564
45633
  }
45565
45634
 
45566
- .lg\:psui-text-sm {
45567
- font-size: 0.875rem;
45635
+ .lg\:psui-text-accent {
45636
+ font-size: 14px;
45637
+ line-height: 130%;
45568
45638
  }
45569
45639
 
45570
- .lg\:psui-text-base {
45571
- font-size: 1rem;
45640
+ .lg\:psui-text-accentSmall {
45641
+ font-size: 12px;
45642
+ line-height: 130%;
45572
45643
  }
45573
45644
 
45574
- .lg\:psui-text-lg {
45575
- font-size: 1.125rem;
45645
+ .lg\:psui-text-p {
45646
+ font-size: 16px;
45647
+ line-height: 120%;
45576
45648
  }
45577
45649
 
45578
- .lg\:psui-text-xl {
45579
- font-size: 1.25rem;
45650
+ .lg\:psui-text-h1 {
45651
+ font-size: 28px;
45652
+ line-height: 120%;
45580
45653
  }
45581
45654
 
45582
- .lg\:psui-text-2xl {
45583
- font-size: 1.5rem;
45655
+ .lg\:psui-text-h2 {
45656
+ font-size: 24px;
45657
+ line-height: 120%;
45584
45658
  }
45585
45659
 
45586
- .lg\:psui-text-3xl {
45587
- font-size: 1.875rem;
45660
+ .lg\:psui-text-h3 {
45661
+ font-size: 22px;
45662
+ line-height: 120%;
45588
45663
  }
45589
45664
 
45590
- .lg\:psui-text-4xl {
45591
- font-size: 2.25rem;
45665
+ .lg\:psui-text-h4 {
45666
+ font-size: 20px;
45667
+ line-height: 120%;
45592
45668
  }
45593
45669
 
45594
- .lg\:psui-text-5xl {
45595
- font-size: 3rem;
45670
+ .lg\:psui-text-h5 {
45671
+ font-size: 18px;
45672
+ line-height: 120%;
45596
45673
  }
45597
45674
 
45598
- .lg\:psui-text-6xl {
45599
- font-size: 4rem;
45675
+ .lg\:psui-text-h6 {
45676
+ font-size: 17px;
45677
+ line-height: 120%;
45600
45678
  }
45601
45679
 
45602
45680
  .lg\:psui-leading-3 {
@@ -58504,44 +58582,59 @@ video {
58504
58582
  height: 100vh;
58505
58583
  }
58506
58584
 
58507
- .xl\:psui-text-xs {
58508
- font-size: 0.75rem;
58585
+ .xl\:psui-text-small {
58586
+ font-size: 14px;
58587
+ line-height: 130%;
58588
+ }
58589
+
58590
+ .xl\:psui-text-xSmall {
58591
+ font-size: 12px;
58592
+ line-height: 130%;
58509
58593
  }
58510
58594
 
58511
- .xl\:psui-text-sm {
58512
- font-size: 0.875rem;
58595
+ .xl\:psui-text-accent {
58596
+ font-size: 14px;
58597
+ line-height: 130%;
58513
58598
  }
58514
58599
 
58515
- .xl\:psui-text-base {
58516
- font-size: 1rem;
58600
+ .xl\:psui-text-accentSmall {
58601
+ font-size: 12px;
58602
+ line-height: 130%;
58517
58603
  }
58518
58604
 
58519
- .xl\:psui-text-lg {
58520
- font-size: 1.125rem;
58605
+ .xl\:psui-text-p {
58606
+ font-size: 16px;
58607
+ line-height: 120%;
58521
58608
  }
58522
58609
 
58523
- .xl\:psui-text-xl {
58524
- font-size: 1.25rem;
58610
+ .xl\:psui-text-h1 {
58611
+ font-size: 28px;
58612
+ line-height: 120%;
58525
58613
  }
58526
58614
 
58527
- .xl\:psui-text-2xl {
58528
- font-size: 1.5rem;
58615
+ .xl\:psui-text-h2 {
58616
+ font-size: 24px;
58617
+ line-height: 120%;
58529
58618
  }
58530
58619
 
58531
- .xl\:psui-text-3xl {
58532
- font-size: 1.875rem;
58620
+ .xl\:psui-text-h3 {
58621
+ font-size: 22px;
58622
+ line-height: 120%;
58533
58623
  }
58534
58624
 
58535
- .xl\:psui-text-4xl {
58536
- font-size: 2.25rem;
58625
+ .xl\:psui-text-h4 {
58626
+ font-size: 20px;
58627
+ line-height: 120%;
58537
58628
  }
58538
58629
 
58539
- .xl\:psui-text-5xl {
58540
- font-size: 3rem;
58630
+ .xl\:psui-text-h5 {
58631
+ font-size: 18px;
58632
+ line-height: 120%;
58541
58633
  }
58542
58634
 
58543
- .xl\:psui-text-6xl {
58544
- font-size: 4rem;
58635
+ .xl\:psui-text-h6 {
58636
+ font-size: 17px;
58637
+ line-height: 120%;
58545
58638
  }
58546
58639
 
58547
58640
  .xl\:psui-leading-3 {
@@ -66542,3 +66635,4 @@ video {
66542
66635
  animation: bounce 1s infinite;
66543
66636
  }
66544
66637
  }
66638
+
@@ -1,7 +1,11 @@
1
1
  <template>
2
2
  <label class="container">
3
3
  {{ label }}
4
- <input type="checkbox">
4
+ <input
5
+ type="checkbox"
6
+ v-model="childValue"
7
+ :disabled="disabled"
8
+ />
5
9
  <span class="checkmark"></span>
6
10
  </label>
7
11
  </template>
@@ -54,6 +58,7 @@ export default {
54
58
  return this.value
55
59
  },
56
60
  set (newValue) {
61
+ console.log(newValue)
57
62
  if(this.prevent) return
58
63
  this.$emit('input', newValue)
59
64
  this.$emit('change', newValue)
@@ -0,0 +1,13 @@
1
+ <template>
2
+
3
+ </template>
4
+
5
+ <script>
6
+ export default {
7
+
8
+ }
9
+ </script>
10
+
11
+ <style>
12
+
13
+ </style>
@@ -0,0 +1,135 @@
1
+ <template>
2
+ <div>
3
+ <div v-if="label" class="psui-mb-2">
4
+ <div class="psui-float-right">{{ value }}</div>
5
+ <div>{{ label }}</div>
6
+ </div>
7
+ <div class="" :class="{'psui-flex psui-items-center': !label && !bubble }">
8
+ <div
9
+ v-if="bubble"
10
+ class="psui-relative psui-bg-gray-40 psui-text-gray-20 psui-rounded-md psui-text-white psui-font-bold psui-w-10 psui-text-center range-value"
11
+ :style="{ left: `${positionBubble}px` }"
12
+ >
13
+ {{ value }}
14
+ </div>
15
+ <input
16
+ type="range"
17
+ :min="min"
18
+ :max="max"
19
+ :value="value"
20
+ @input="$emit('update:value', Number($event.target.value))"
21
+ class="slider psui-float-left"
22
+ ref="slider"
23
+ />
24
+ <span v-if="!label && !bubble" class="psui-bg-gray-20 psui-font-bold psui-text-gray-50 psui-px-2 psui-py-px psui-rounded-sm psui-float-left psui-ml-2">{{ value }}</span>
25
+ </div>
26
+ </div>
27
+ </template>
28
+
29
+ <script>
30
+ export default {
31
+ name: 'PsSlider',
32
+ computed: {
33
+ positionBubble() {
34
+ if (this.bubble && this.isMounted) {
35
+ return (this.$refs.slider.offsetWidth / this.max) * this.value - 15
36
+ }
37
+ }
38
+ },
39
+ methods: {
40
+ getValueToScale(value) {
41
+ return 100 * value / this.rangeDistanceMax
42
+ }
43
+ },
44
+ props: {
45
+ min: {
46
+ type: Number,
47
+ default: 0,
48
+ },
49
+ max: {
50
+ type: Number,
51
+ required: true,
52
+ },
53
+ label: {
54
+ type: String,
55
+ },
56
+ value: {
57
+ type: [Number, String],
58
+ },
59
+ baseValue: {
60
+ type: [Number, Boolean]
61
+ },
62
+ labelPosition: {
63
+ type: String
64
+ },
65
+ step: {
66
+ type: Number,
67
+ default: 1
68
+ },
69
+ bubble: {
70
+ type: Boolean
71
+ }
72
+ },
73
+ data: () => {
74
+ return {
75
+ isMounted: false
76
+ }
77
+ },
78
+ mounted() {
79
+ this.isMounted = true
80
+ }
81
+ }
82
+ </script>
83
+
84
+ <style>
85
+ .slider {
86
+ width: 100%;
87
+ -webkit-appearance: none;
88
+ height: 6px;
89
+ border-radius: 5px;
90
+ background: #d3d3d3;
91
+ outline: none;
92
+ opacity: 0.7;
93
+ -webkit-transition: .2s;
94
+ transition: opacity .2s;
95
+ }
96
+
97
+ .slider:hover {
98
+ opacity: 1;
99
+ }
100
+
101
+ .slider::-webkit-slider-thumb {
102
+ border: none;
103
+ -webkit-appearance: none;
104
+ appearance: none;
105
+ width: 20px;
106
+ height: 20px;
107
+ border-radius: 50%;
108
+ background: #64B5CE;
109
+ cursor: pointer;
110
+ }
111
+
112
+ .slider::-moz-range-thumb {
113
+ border: none;
114
+ width: 20px;
115
+ height: 20px;
116
+ border-radius: 50%;
117
+ background: #64B5CE;
118
+ cursor: pointer;
119
+ }
120
+ .slider::-webkit-slider-progress, .slider::-moz-range-progress {
121
+ border-top-left-radius: 5px;
122
+ border-bottom-left-radius: 5px;
123
+ -webkit-appearance: none;
124
+ box-shadow: none;
125
+ border: none;
126
+ background: #64B5CE;
127
+ height: 6px;
128
+ }
129
+
130
+ .range-value{
131
+ margin-bottom: 10px;
132
+ padding: 2px 4px;
133
+
134
+ }
135
+ </style>
@@ -0,0 +1,92 @@
1
+ <template>
2
+ <label for="ps-switch" class="psui-flex psui-items-center psui-cursor-pointer psui-relative">
3
+ <input type="checkbox" id="ps-switch" class="psui-hidden" :checked="active">
4
+ <div
5
+ :class="classes"
6
+ @click="change()"
7
+ ></div>
8
+ <span class="psui-ml-3 psui-text-gray-50 psui-text-sm psui-font-medium">{{ label }}</span>
9
+ </label>
10
+ </template>
11
+
12
+ <script>
13
+ export const sizes = ['big', 'small']
14
+ export default {
15
+ computed: {
16
+ text() {
17
+ if (this.label && this.labelActived) {
18
+ return this.active ? this.labelActived : this.label
19
+ } else if (this.label) {
20
+ return this.label
21
+ } else {
22
+ return false
23
+ }
24
+ },
25
+ classes() {
26
+ if (this.size === 'small') {
27
+ return 'toggle-bg psui-bg-gray-40 psui-border-gray-40 psui-border-2 psui-h-4 ps-switch-small psui-rounded-full'
28
+ }
29
+ return 'toggle-bg psui-bg-gray-40 psui-border-gray-40 psui-border-2 psui-h-6 ps-switch psui-rounded-full'
30
+ }
31
+ },
32
+ props: {
33
+ label: String,
34
+ active: {
35
+ type: Boolean,
36
+ default: false
37
+ },
38
+ disabled: {
39
+ type: Boolean,
40
+ default: false
41
+ },
42
+ size: {
43
+ type: String,
44
+ default: 'big',
45
+ validator: (value) => sizes.indexOf(value) !== -1
46
+ }
47
+ },
48
+ methods: {
49
+ change() {
50
+ if (!this.disabled) {
51
+ this.$emit('update:active', !this.active)
52
+ this.$emit('change', !this.active)
53
+ }
54
+ }
55
+ }
56
+ }
57
+ </script>
58
+
59
+ <style scoped>
60
+ .ps-switch {
61
+ width: 46px;
62
+ }
63
+ .ps-switch-small {
64
+ width: 30px;
65
+ }
66
+ .toggle-bg:after {
67
+ content: '';
68
+ @apply psui-absolute psui-bg-white psui-border-gray-40 psui-rounded-full psui-h-5 psui-w-5 psui-transition;
69
+ }
70
+ .toggle-bg:after + .ps-switch-small {
71
+ content: '';
72
+ @apply psui-absolute psui-bg-white psui-border-gray-40 psui-rounded-full psui-h-2 psui-w-2 psui-transition;
73
+ }
74
+
75
+ input:checked + .toggle-bg:after + .ps-switch-small {
76
+ transform: translateX(100%);
77
+ position: absolute;
78
+ left: 2px;
79
+ @apply border-white;
80
+ }
81
+
82
+ input:checked + .toggle-bg:after {
83
+ transform: translateX(100%);
84
+ position: absolute;
85
+ left: 4px;
86
+ @apply border-white;
87
+ }
88
+
89
+ input:checked + .toggle-bg {
90
+ @apply psui-bg-green-20 psui-border-green-20;
91
+ }
92
+ </style>
File without changes
package/src/index.js CHANGED
@@ -7,12 +7,12 @@ import PsRadioButton from './components/controls/PsRadioButton.vue';
7
7
 
8
8
  export default {
9
9
  install(Vue) {
10
- Vue.component(' PsButton', PsButton);
11
- Vue.component(' PsCheckbox', PsCheckbox);
12
- Vue.component(' PsDialog', PsDialog);
13
- Vue.component(' PsToast', PsToast);
14
- Vue.component(' PsTabHeader', PsTabHeader);
15
- Vue.component(' PsRadioButton', PsRadioButton);
10
+ Vue.component('PsButton', PsButton);
11
+ Vue.component('PsCheckbox', PsCheckbox);
12
+ Vue.component('PsDialog', PsDialog);
13
+ Vue.component('PsToast', PsToast);
14
+ Vue.component('PsTabHeader', PsTabHeader);
15
+ Vue.component('PsRadioButton', PsRadioButton);
16
16
  }
17
17
  };
18
18
 
@@ -11,8 +11,28 @@ export default {
11
11
  const Template = (args, { argTypes }) => ({
12
12
  props: Object.keys(argTypes),
13
13
  components: { PsCheckbox },
14
+ data: () => {
15
+ return {
16
+ items: [
17
+ { label: 'Label 1', id: 1 },
18
+ { label: 'Label 2', id: 2 },
19
+ { label: 'Label 3', id: 3 }
20
+ ],
21
+ selected: []
22
+ }
23
+ },
14
24
  template: `
15
- <PsCheckbox v-bind="$props" />
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 }}
35
+ </div>
16
36
  `
17
37
  });
18
38
 
@@ -21,3 +41,4 @@ Default.args = {
21
41
  label: 'Label',
22
42
  size: 16
23
43
  };
44
+
@@ -0,0 +1,40 @@
1
+ import PsSlider from '../components/controls/PsSlider.vue';
2
+ export default {
3
+ title: 'Components/Slider',
4
+ component: PsSlider,
5
+ argTypes: {
6
+ },
7
+ };
8
+
9
+ const Template = (args, { argTypes }) => ({
10
+ props: Object.keys(argTypes),
11
+ components: { PsSlider },
12
+ template: `
13
+ <div style="width: 500px;">
14
+ <PsSlider v-bind="$props" :value.sync="value" />
15
+ </div>
16
+ `
17
+ });
18
+
19
+ export const Label = Template.bind({});
20
+ Label.args = {
21
+ min: 1,
22
+ max: 100,
23
+ value: 30,
24
+ label: 'Score Label'
25
+ };
26
+
27
+ export const NoLabel = Template.bind({});
28
+ NoLabel.args = {
29
+ min: 1,
30
+ max: 100,
31
+ value: 15
32
+ };
33
+
34
+ export const Bubble = Template.bind({});
35
+ Bubble.args = {
36
+ min: 1,
37
+ max: 100,
38
+ value: 23,
39
+ bubble: true
40
+ };
@@ -0,0 +1,38 @@
1
+ import PsSwitch, { sizes } from '../components/controls/PsSwitch.vue';
2
+ export default {
3
+ title: 'Components/Switch',
4
+ component: PsSwitch,
5
+ argTypes: {
6
+ size: { control: { type: 'select', options: sizes } }
7
+ },
8
+ };
9
+
10
+ const Template = (args, { argTypes }) => ({
11
+ props: Object.keys(argTypes),
12
+ components: { PsSwitch },
13
+ data: () => {
14
+ return {
15
+ model: true
16
+ }
17
+ },
18
+ template: `
19
+ <div>
20
+ <PsSwitch v-bind="$props" :active.sync="model" />
21
+ </div>
22
+ `
23
+ });
24
+
25
+ export const Big = Template.bind({});
26
+ Big.args = {
27
+ size: 'big',
28
+ active: false,
29
+ label: 'Switch Big',
30
+ };
31
+
32
+ export const Small = Template.bind({});
33
+ Small.args = {
34
+ size: 'small',
35
+ active: false,
36
+ label: 'Switch Small',
37
+ };
38
+
@@ -38,7 +38,26 @@ module.exports = {
38
38
  fontFamily: {
39
39
  'sans': ['Lato'],
40
40
  },
41
+ fontSize: {
42
+ small: ['14px', '130%'],
43
+ xSmall: ['12px', '130%'],
44
+ accent: ['14px', '130%', { letterSpacing: '0.6px' }],
45
+ accentSmall: ['12px', '130%', { letterSpacing: '0.6px' }],
46
+ p: ['16px', '120%'],
47
+ h1: ['28px', '120%'],
48
+ h2: ['24px', '120%'],
49
+ h3: ['22px', '120%'],
50
+ h4: ['20px', '120%'],
51
+ h5: ['18px', '120%'],
52
+ h6: ['17px', '120%'],
53
+ },
41
54
  boxShadow: {
55
+ elevationInner: 'box-shadow: 0px 1px 0px #FFFFFF, inset 0px 1px 2px rgba(0, 0, 0, 0.1)',
56
+ elevation5: 'box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.03), 0px 1px 2px rgba(0, 0, 0, 0.1)',
57
+ elevation10: 'box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.04), 0px 2px 5px rgba(0, 0, 0, 0.08)',
58
+ elevation20: 'box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.04), 0px 5px 6px rgba(0, 0, 0, 0.1)',
59
+ elevation30: 'box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.05), 0px 10px 15px rgba(0, 0, 0, 0.15)',
60
+ elevation40: 'box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.05), 0px 30px 60px rgba(0, 0, 0, 0.2)',
42
61
  sm: '0px 0px 4px rgba(0, 0, 0, 0.03), 0px 1px 2px rgba(0, 0, 0, 0.1)',
43
62
  default: '0px 0px 8px rgba(0, 0, 0, 0.04), 0px 2px 5px rgba(0, 0, 0, 0.08)',
44
63
  md: '0px 0px 8px rgba(0, 0, 0, 0.04), 0px 5px 6px rgba(0, 0, 0, 0.1)',