@policystudio/policy-studio-ui-vue 1.0.5 → 1.0.9
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 +23 -5
- package/package.json +1 -1
- package/src/assets/scss/base.scss +0 -24
- package/src/assets/scss/tailwind.css +176 -130
- package/src/components/controls/PsCheckbox.vue +6 -1
- package/src/components/controls/PsDraggable.vue +13 -0
- package/src/components/controls/PsSlider.vue +135 -0
- package/src/components/controls/PsSwitch.vue +92 -0
- package/src/components/controls/PsToggle.vue +0 -0
- package/src/stories/Checkbox.stories.js +22 -1
- package/src/stories/Slider.stories.js +40 -0
- package/src/stories/Swith.stories.js +38 -0
- package/tailwind.config.js +19 -0
package/README.md
CHANGED
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
# UI library of Vue components with StoryBook
|
|
2
2
|
|
|
3
|
-
###
|
|
4
|
-
|
|
3
|
+
### Instalation
|
|
4
|
+
```sh
|
|
5
|
+
npm i -S @policystudio/policy-studio-ui-vue
|
|
6
|
+
```
|
|
5
7
|
|
|
6
|
-
###
|
|
7
|
-
|
|
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
|
-
|
|
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
|
@@ -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-
|
|
6575
|
-
font-size:
|
|
6574
|
+
.psui-text-small {
|
|
6575
|
+
font-size: 14px;
|
|
6576
|
+
line-height: 130%;
|
|
6576
6577
|
}
|
|
6577
6578
|
|
|
6578
|
-
.psui-text-
|
|
6579
|
-
font-size:
|
|
6579
|
+
.psui-text-xSmall {
|
|
6580
|
+
font-size: 12px;
|
|
6581
|
+
line-height: 130%;
|
|
6580
6582
|
}
|
|
6581
6583
|
|
|
6582
|
-
.psui-text-
|
|
6583
|
-
font-size:
|
|
6584
|
+
.psui-text-accent {
|
|
6585
|
+
font-size: 14px;
|
|
6586
|
+
line-height: 130%;
|
|
6584
6587
|
}
|
|
6585
6588
|
|
|
6586
|
-
.psui-text-
|
|
6587
|
-
font-size:
|
|
6589
|
+
.psui-text-accentSmall {
|
|
6590
|
+
font-size: 12px;
|
|
6591
|
+
line-height: 130%;
|
|
6588
6592
|
}
|
|
6589
6593
|
|
|
6590
|
-
.psui-text-
|
|
6591
|
-
font-size:
|
|
6594
|
+
.psui-text-p {
|
|
6595
|
+
font-size: 16px;
|
|
6596
|
+
line-height: 120%;
|
|
6592
6597
|
}
|
|
6593
6598
|
|
|
6594
|
-
.psui-text-
|
|
6595
|
-
font-size:
|
|
6599
|
+
.psui-text-h1 {
|
|
6600
|
+
font-size: 28px;
|
|
6601
|
+
line-height: 120%;
|
|
6596
6602
|
}
|
|
6597
6603
|
|
|
6598
|
-
.psui-text-
|
|
6599
|
-
font-size:
|
|
6604
|
+
.psui-text-h2 {
|
|
6605
|
+
font-size: 24px;
|
|
6606
|
+
line-height: 120%;
|
|
6600
6607
|
}
|
|
6601
6608
|
|
|
6602
|
-
.psui-text-
|
|
6603
|
-
font-size:
|
|
6609
|
+
.psui-text-h3 {
|
|
6610
|
+
font-size: 22px;
|
|
6611
|
+
line-height: 120%;
|
|
6604
6612
|
}
|
|
6605
6613
|
|
|
6606
|
-
.psui-text-
|
|
6607
|
-
font-size:
|
|
6614
|
+
.psui-text-h4 {
|
|
6615
|
+
font-size: 20px;
|
|
6616
|
+
line-height: 120%;
|
|
6608
6617
|
}
|
|
6609
6618
|
|
|
6610
|
-
.psui-text-
|
|
6611
|
-
font-size:
|
|
6619
|
+
.psui-text-h5 {
|
|
6620
|
+
font-size: 18px;
|
|
6621
|
+
line-height: 120%;
|
|
6622
|
+
}
|
|
6623
|
+
|
|
6624
|
+
.psui-text-h6 {
|
|
6625
|
+
font-size: 17px;
|
|
6626
|
+
line-height: 120%;
|
|
6612
6627
|
}
|
|
6613
6628
|
|
|
6614
6629
|
.psui-leading-3 {
|
|
@@ -14733,36 +14748,6 @@ video {
|
|
|
14733
14748
|
|
|
14734
14749
|
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');
|
|
14735
14750
|
|
|
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
14751
|
@media (min-width: 640px) {
|
|
14767
14752
|
.sm\:psui-container {
|
|
14768
14753
|
width: 100%;
|
|
@@ -19669,44 +19654,59 @@ video {
|
|
|
19669
19654
|
height: 100vh;
|
|
19670
19655
|
}
|
|
19671
19656
|
|
|
19672
|
-
.sm\:psui-text-
|
|
19673
|
-
font-size:
|
|
19657
|
+
.sm\:psui-text-small {
|
|
19658
|
+
font-size: 14px;
|
|
19659
|
+
line-height: 130%;
|
|
19660
|
+
}
|
|
19661
|
+
|
|
19662
|
+
.sm\:psui-text-xSmall {
|
|
19663
|
+
font-size: 12px;
|
|
19664
|
+
line-height: 130%;
|
|
19674
19665
|
}
|
|
19675
19666
|
|
|
19676
|
-
.sm\:psui-text-
|
|
19677
|
-
font-size:
|
|
19667
|
+
.sm\:psui-text-accent {
|
|
19668
|
+
font-size: 14px;
|
|
19669
|
+
line-height: 130%;
|
|
19678
19670
|
}
|
|
19679
19671
|
|
|
19680
|
-
.sm\:psui-text-
|
|
19681
|
-
font-size:
|
|
19672
|
+
.sm\:psui-text-accentSmall {
|
|
19673
|
+
font-size: 12px;
|
|
19674
|
+
line-height: 130%;
|
|
19682
19675
|
}
|
|
19683
19676
|
|
|
19684
|
-
.sm\:psui-text-
|
|
19685
|
-
font-size:
|
|
19677
|
+
.sm\:psui-text-p {
|
|
19678
|
+
font-size: 16px;
|
|
19679
|
+
line-height: 120%;
|
|
19686
19680
|
}
|
|
19687
19681
|
|
|
19688
|
-
.sm\:psui-text-
|
|
19689
|
-
font-size:
|
|
19682
|
+
.sm\:psui-text-h1 {
|
|
19683
|
+
font-size: 28px;
|
|
19684
|
+
line-height: 120%;
|
|
19690
19685
|
}
|
|
19691
19686
|
|
|
19692
|
-
.sm\:psui-text-
|
|
19693
|
-
font-size:
|
|
19687
|
+
.sm\:psui-text-h2 {
|
|
19688
|
+
font-size: 24px;
|
|
19689
|
+
line-height: 120%;
|
|
19694
19690
|
}
|
|
19695
19691
|
|
|
19696
|
-
.sm\:psui-text-
|
|
19697
|
-
font-size:
|
|
19692
|
+
.sm\:psui-text-h3 {
|
|
19693
|
+
font-size: 22px;
|
|
19694
|
+
line-height: 120%;
|
|
19698
19695
|
}
|
|
19699
19696
|
|
|
19700
|
-
.sm\:psui-text-
|
|
19701
|
-
font-size:
|
|
19697
|
+
.sm\:psui-text-h4 {
|
|
19698
|
+
font-size: 20px;
|
|
19699
|
+
line-height: 120%;
|
|
19702
19700
|
}
|
|
19703
19701
|
|
|
19704
|
-
.sm\:psui-text-
|
|
19705
|
-
font-size:
|
|
19702
|
+
.sm\:psui-text-h5 {
|
|
19703
|
+
font-size: 18px;
|
|
19704
|
+
line-height: 120%;
|
|
19706
19705
|
}
|
|
19707
19706
|
|
|
19708
|
-
.sm\:psui-text-
|
|
19709
|
-
font-size:
|
|
19707
|
+
.sm\:psui-text-h6 {
|
|
19708
|
+
font-size: 17px;
|
|
19709
|
+
line-height: 120%;
|
|
19710
19710
|
}
|
|
19711
19711
|
|
|
19712
19712
|
.sm\:psui-leading-3 {
|
|
@@ -32614,44 +32614,59 @@ video {
|
|
|
32614
32614
|
height: 100vh;
|
|
32615
32615
|
}
|
|
32616
32616
|
|
|
32617
|
-
.md\:psui-text-
|
|
32618
|
-
font-size:
|
|
32617
|
+
.md\:psui-text-small {
|
|
32618
|
+
font-size: 14px;
|
|
32619
|
+
line-height: 130%;
|
|
32620
|
+
}
|
|
32621
|
+
|
|
32622
|
+
.md\:psui-text-xSmall {
|
|
32623
|
+
font-size: 12px;
|
|
32624
|
+
line-height: 130%;
|
|
32619
32625
|
}
|
|
32620
32626
|
|
|
32621
|
-
.md\:psui-text-
|
|
32622
|
-
font-size:
|
|
32627
|
+
.md\:psui-text-accent {
|
|
32628
|
+
font-size: 14px;
|
|
32629
|
+
line-height: 130%;
|
|
32623
32630
|
}
|
|
32624
32631
|
|
|
32625
|
-
.md\:psui-text-
|
|
32626
|
-
font-size:
|
|
32632
|
+
.md\:psui-text-accentSmall {
|
|
32633
|
+
font-size: 12px;
|
|
32634
|
+
line-height: 130%;
|
|
32627
32635
|
}
|
|
32628
32636
|
|
|
32629
|
-
.md\:psui-text-
|
|
32630
|
-
font-size:
|
|
32637
|
+
.md\:psui-text-p {
|
|
32638
|
+
font-size: 16px;
|
|
32639
|
+
line-height: 120%;
|
|
32631
32640
|
}
|
|
32632
32641
|
|
|
32633
|
-
.md\:psui-text-
|
|
32634
|
-
font-size:
|
|
32642
|
+
.md\:psui-text-h1 {
|
|
32643
|
+
font-size: 28px;
|
|
32644
|
+
line-height: 120%;
|
|
32635
32645
|
}
|
|
32636
32646
|
|
|
32637
|
-
.md\:psui-text-
|
|
32638
|
-
font-size:
|
|
32647
|
+
.md\:psui-text-h2 {
|
|
32648
|
+
font-size: 24px;
|
|
32649
|
+
line-height: 120%;
|
|
32639
32650
|
}
|
|
32640
32651
|
|
|
32641
|
-
.md\:psui-text-
|
|
32642
|
-
font-size:
|
|
32652
|
+
.md\:psui-text-h3 {
|
|
32653
|
+
font-size: 22px;
|
|
32654
|
+
line-height: 120%;
|
|
32643
32655
|
}
|
|
32644
32656
|
|
|
32645
|
-
.md\:psui-text-
|
|
32646
|
-
font-size:
|
|
32657
|
+
.md\:psui-text-h4 {
|
|
32658
|
+
font-size: 20px;
|
|
32659
|
+
line-height: 120%;
|
|
32647
32660
|
}
|
|
32648
32661
|
|
|
32649
|
-
.md\:psui-text-
|
|
32650
|
-
font-size:
|
|
32662
|
+
.md\:psui-text-h5 {
|
|
32663
|
+
font-size: 18px;
|
|
32664
|
+
line-height: 120%;
|
|
32651
32665
|
}
|
|
32652
32666
|
|
|
32653
|
-
.md\:psui-text-
|
|
32654
|
-
font-size:
|
|
32667
|
+
.md\:psui-text-h6 {
|
|
32668
|
+
font-size: 17px;
|
|
32669
|
+
line-height: 120%;
|
|
32655
32670
|
}
|
|
32656
32671
|
|
|
32657
32672
|
.md\:psui-leading-3 {
|
|
@@ -45559,44 +45574,59 @@ video {
|
|
|
45559
45574
|
height: 100vh;
|
|
45560
45575
|
}
|
|
45561
45576
|
|
|
45562
|
-
.lg\:psui-text-
|
|
45563
|
-
font-size:
|
|
45577
|
+
.lg\:psui-text-small {
|
|
45578
|
+
font-size: 14px;
|
|
45579
|
+
line-height: 130%;
|
|
45564
45580
|
}
|
|
45565
45581
|
|
|
45566
|
-
.lg\:psui-text-
|
|
45567
|
-
font-size:
|
|
45582
|
+
.lg\:psui-text-xSmall {
|
|
45583
|
+
font-size: 12px;
|
|
45584
|
+
line-height: 130%;
|
|
45568
45585
|
}
|
|
45569
45586
|
|
|
45570
|
-
.lg\:psui-text-
|
|
45571
|
-
font-size:
|
|
45587
|
+
.lg\:psui-text-accent {
|
|
45588
|
+
font-size: 14px;
|
|
45589
|
+
line-height: 130%;
|
|
45572
45590
|
}
|
|
45573
45591
|
|
|
45574
|
-
.lg\:psui-text-
|
|
45575
|
-
font-size:
|
|
45592
|
+
.lg\:psui-text-accentSmall {
|
|
45593
|
+
font-size: 12px;
|
|
45594
|
+
line-height: 130%;
|
|
45576
45595
|
}
|
|
45577
45596
|
|
|
45578
|
-
.lg\:psui-text-
|
|
45579
|
-
font-size:
|
|
45597
|
+
.lg\:psui-text-p {
|
|
45598
|
+
font-size: 16px;
|
|
45599
|
+
line-height: 120%;
|
|
45580
45600
|
}
|
|
45581
45601
|
|
|
45582
|
-
.lg\:psui-text-
|
|
45583
|
-
font-size:
|
|
45602
|
+
.lg\:psui-text-h1 {
|
|
45603
|
+
font-size: 28px;
|
|
45604
|
+
line-height: 120%;
|
|
45584
45605
|
}
|
|
45585
45606
|
|
|
45586
|
-
.lg\:psui-text-
|
|
45587
|
-
font-size:
|
|
45607
|
+
.lg\:psui-text-h2 {
|
|
45608
|
+
font-size: 24px;
|
|
45609
|
+
line-height: 120%;
|
|
45588
45610
|
}
|
|
45589
45611
|
|
|
45590
|
-
.lg\:psui-text-
|
|
45591
|
-
font-size:
|
|
45612
|
+
.lg\:psui-text-h3 {
|
|
45613
|
+
font-size: 22px;
|
|
45614
|
+
line-height: 120%;
|
|
45592
45615
|
}
|
|
45593
45616
|
|
|
45594
|
-
.lg\:psui-text-
|
|
45595
|
-
font-size:
|
|
45617
|
+
.lg\:psui-text-h4 {
|
|
45618
|
+
font-size: 20px;
|
|
45619
|
+
line-height: 120%;
|
|
45596
45620
|
}
|
|
45597
45621
|
|
|
45598
|
-
.lg\:psui-text-
|
|
45599
|
-
font-size:
|
|
45622
|
+
.lg\:psui-text-h5 {
|
|
45623
|
+
font-size: 18px;
|
|
45624
|
+
line-height: 120%;
|
|
45625
|
+
}
|
|
45626
|
+
|
|
45627
|
+
.lg\:psui-text-h6 {
|
|
45628
|
+
font-size: 17px;
|
|
45629
|
+
line-height: 120%;
|
|
45600
45630
|
}
|
|
45601
45631
|
|
|
45602
45632
|
.lg\:psui-leading-3 {
|
|
@@ -58504,44 +58534,59 @@ video {
|
|
|
58504
58534
|
height: 100vh;
|
|
58505
58535
|
}
|
|
58506
58536
|
|
|
58507
|
-
.xl\:psui-text-
|
|
58508
|
-
font-size:
|
|
58537
|
+
.xl\:psui-text-small {
|
|
58538
|
+
font-size: 14px;
|
|
58539
|
+
line-height: 130%;
|
|
58509
58540
|
}
|
|
58510
58541
|
|
|
58511
|
-
.xl\:psui-text-
|
|
58512
|
-
font-size:
|
|
58542
|
+
.xl\:psui-text-xSmall {
|
|
58543
|
+
font-size: 12px;
|
|
58544
|
+
line-height: 130%;
|
|
58513
58545
|
}
|
|
58514
58546
|
|
|
58515
|
-
.xl\:psui-text-
|
|
58516
|
-
font-size:
|
|
58547
|
+
.xl\:psui-text-accent {
|
|
58548
|
+
font-size: 14px;
|
|
58549
|
+
line-height: 130%;
|
|
58517
58550
|
}
|
|
58518
58551
|
|
|
58519
|
-
.xl\:psui-text-
|
|
58520
|
-
font-size:
|
|
58552
|
+
.xl\:psui-text-accentSmall {
|
|
58553
|
+
font-size: 12px;
|
|
58554
|
+
line-height: 130%;
|
|
58521
58555
|
}
|
|
58522
58556
|
|
|
58523
|
-
.xl\:psui-text-
|
|
58524
|
-
font-size:
|
|
58557
|
+
.xl\:psui-text-p {
|
|
58558
|
+
font-size: 16px;
|
|
58559
|
+
line-height: 120%;
|
|
58525
58560
|
}
|
|
58526
58561
|
|
|
58527
|
-
.xl\:psui-text-
|
|
58528
|
-
font-size:
|
|
58562
|
+
.xl\:psui-text-h1 {
|
|
58563
|
+
font-size: 28px;
|
|
58564
|
+
line-height: 120%;
|
|
58529
58565
|
}
|
|
58530
58566
|
|
|
58531
|
-
.xl\:psui-text-
|
|
58532
|
-
font-size:
|
|
58567
|
+
.xl\:psui-text-h2 {
|
|
58568
|
+
font-size: 24px;
|
|
58569
|
+
line-height: 120%;
|
|
58533
58570
|
}
|
|
58534
58571
|
|
|
58535
|
-
.xl\:psui-text-
|
|
58536
|
-
font-size:
|
|
58572
|
+
.xl\:psui-text-h3 {
|
|
58573
|
+
font-size: 22px;
|
|
58574
|
+
line-height: 120%;
|
|
58537
58575
|
}
|
|
58538
58576
|
|
|
58539
|
-
.xl\:psui-text-
|
|
58540
|
-
font-size:
|
|
58577
|
+
.xl\:psui-text-h4 {
|
|
58578
|
+
font-size: 20px;
|
|
58579
|
+
line-height: 120%;
|
|
58541
58580
|
}
|
|
58542
58581
|
|
|
58543
|
-
.xl\:psui-text-
|
|
58544
|
-
font-size:
|
|
58582
|
+
.xl\:psui-text-h5 {
|
|
58583
|
+
font-size: 18px;
|
|
58584
|
+
line-height: 120%;
|
|
58585
|
+
}
|
|
58586
|
+
|
|
58587
|
+
.xl\:psui-text-h6 {
|
|
58588
|
+
font-size: 17px;
|
|
58589
|
+
line-height: 120%;
|
|
58545
58590
|
}
|
|
58546
58591
|
|
|
58547
58592
|
.xl\:psui-leading-3 {
|
|
@@ -66542,3 +66587,4 @@ video {
|
|
|
66542
66587
|
animation: bounce 1s infinite;
|
|
66543
66588
|
}
|
|
66544
66589
|
}
|
|
66590
|
+
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<label class="container">
|
|
3
3
|
{{ label }}
|
|
4
|
-
<input
|
|
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,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
|
|
@@ -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
|
-
<
|
|
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
|
+
|
package/tailwind.config.js
CHANGED
|
@@ -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: '0px 1px 0px #FFFFFF, inset 0px 1px 2px rgba(0, 0, 0, 0.1)',
|
|
56
|
+
// elevation5: '0px 0px 4px rgba(0, 0, 0, 0.03), 0px 1px 2px rgba(0, 0, 0, 0.1)',
|
|
57
|
+
// elevation10: '0px 0px 8px rgba(0, 0, 0, 0.04), 0px 2px 5px rgba(0, 0, 0, 0.08)',
|
|
58
|
+
// elevation20: '0px 0px 8px rgba(0, 0, 0, 0.04), 0px 5px 6px rgba(0, 0, 0, 0.1)',
|
|
59
|
+
// elevation30: '0px 0px 8px rgba(0, 0, 0, 0.05), 0px 10px 15px rgba(0, 0, 0, 0.15)',
|
|
60
|
+
// elevation40: '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)',
|