@policystudio/policy-studio-ui-vue 1.0.3 → 1.0.7
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 +141 -120
- 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/index.js +8 -8
- 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 +12 -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,54 @@ video {
|
|
|
6571
6571
|
height: 100vh;
|
|
6572
6572
|
}
|
|
6573
6573
|
|
|
6574
|
-
.psui-text-xs {
|
|
6575
|
-
font-size: 0.75rem;
|
|
6576
|
-
}
|
|
6577
|
-
|
|
6578
6574
|
.psui-text-sm {
|
|
6579
|
-
font-size:
|
|
6575
|
+
font-size: 14px;
|
|
6576
|
+
line-height: 20px;
|
|
6580
6577
|
}
|
|
6581
6578
|
|
|
6582
6579
|
.psui-text-base {
|
|
6583
|
-
font-size:
|
|
6580
|
+
font-size: 16px;
|
|
6581
|
+
line-height: 24px;
|
|
6584
6582
|
}
|
|
6585
6583
|
|
|
6586
6584
|
.psui-text-lg {
|
|
6587
|
-
font-size:
|
|
6585
|
+
font-size: 20px;
|
|
6586
|
+
line-height: 28px;
|
|
6588
6587
|
}
|
|
6589
6588
|
|
|
6590
6589
|
.psui-text-xl {
|
|
6591
|
-
font-size:
|
|
6590
|
+
font-size: 24px;
|
|
6591
|
+
line-height: 32px;
|
|
6592
6592
|
}
|
|
6593
6593
|
|
|
6594
|
-
.psui-text-
|
|
6595
|
-
font-size:
|
|
6594
|
+
.psui-text-h1 {
|
|
6595
|
+
font-size: 28px;
|
|
6596
|
+
line-height: 120%;
|
|
6596
6597
|
}
|
|
6597
6598
|
|
|
6598
|
-
.psui-text-
|
|
6599
|
-
font-size:
|
|
6599
|
+
.psui-text-h2 {
|
|
6600
|
+
font-size: 24px;
|
|
6601
|
+
line-height: 120%;
|
|
6600
6602
|
}
|
|
6601
6603
|
|
|
6602
|
-
.psui-text-
|
|
6603
|
-
font-size:
|
|
6604
|
+
.psui-text-h3 {
|
|
6605
|
+
font-size: 22px;
|
|
6606
|
+
line-height: 120%;
|
|
6604
6607
|
}
|
|
6605
6608
|
|
|
6606
|
-
.psui-text-
|
|
6607
|
-
font-size:
|
|
6609
|
+
.psui-text-h4 {
|
|
6610
|
+
font-size: 20px;
|
|
6611
|
+
line-height: 120%;
|
|
6608
6612
|
}
|
|
6609
6613
|
|
|
6610
|
-
.psui-text-
|
|
6611
|
-
font-size:
|
|
6614
|
+
.psui-text-h5 {
|
|
6615
|
+
font-size: 18px;
|
|
6616
|
+
line-height: 120%;
|
|
6617
|
+
}
|
|
6618
|
+
|
|
6619
|
+
.psui-text-h6 {
|
|
6620
|
+
font-size: 17px;
|
|
6621
|
+
line-height: 120%;
|
|
6612
6622
|
}
|
|
6613
6623
|
|
|
6614
6624
|
.psui-leading-3 {
|
|
@@ -14733,36 +14743,6 @@ video {
|
|
|
14733
14743
|
|
|
14734
14744
|
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');
|
|
14735
14745
|
|
|
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
14746
|
@media (min-width: 640px) {
|
|
14767
14747
|
.sm\:psui-container {
|
|
14768
14748
|
width: 100%;
|
|
@@ -19669,44 +19649,54 @@ video {
|
|
|
19669
19649
|
height: 100vh;
|
|
19670
19650
|
}
|
|
19671
19651
|
|
|
19672
|
-
.sm\:psui-text-xs {
|
|
19673
|
-
font-size: 0.75rem;
|
|
19674
|
-
}
|
|
19675
|
-
|
|
19676
19652
|
.sm\:psui-text-sm {
|
|
19677
|
-
font-size:
|
|
19653
|
+
font-size: 14px;
|
|
19654
|
+
line-height: 20px;
|
|
19678
19655
|
}
|
|
19679
19656
|
|
|
19680
19657
|
.sm\:psui-text-base {
|
|
19681
|
-
font-size:
|
|
19658
|
+
font-size: 16px;
|
|
19659
|
+
line-height: 24px;
|
|
19682
19660
|
}
|
|
19683
19661
|
|
|
19684
19662
|
.sm\:psui-text-lg {
|
|
19685
|
-
font-size:
|
|
19663
|
+
font-size: 20px;
|
|
19664
|
+
line-height: 28px;
|
|
19686
19665
|
}
|
|
19687
19666
|
|
|
19688
19667
|
.sm\:psui-text-xl {
|
|
19689
|
-
font-size:
|
|
19668
|
+
font-size: 24px;
|
|
19669
|
+
line-height: 32px;
|
|
19670
|
+
}
|
|
19671
|
+
|
|
19672
|
+
.sm\:psui-text-h1 {
|
|
19673
|
+
font-size: 28px;
|
|
19674
|
+
line-height: 120%;
|
|
19690
19675
|
}
|
|
19691
19676
|
|
|
19692
|
-
.sm\:psui-text-
|
|
19693
|
-
font-size:
|
|
19677
|
+
.sm\:psui-text-h2 {
|
|
19678
|
+
font-size: 24px;
|
|
19679
|
+
line-height: 120%;
|
|
19694
19680
|
}
|
|
19695
19681
|
|
|
19696
|
-
.sm\:psui-text-
|
|
19697
|
-
font-size:
|
|
19682
|
+
.sm\:psui-text-h3 {
|
|
19683
|
+
font-size: 22px;
|
|
19684
|
+
line-height: 120%;
|
|
19698
19685
|
}
|
|
19699
19686
|
|
|
19700
|
-
.sm\:psui-text-
|
|
19701
|
-
font-size:
|
|
19687
|
+
.sm\:psui-text-h4 {
|
|
19688
|
+
font-size: 20px;
|
|
19689
|
+
line-height: 120%;
|
|
19702
19690
|
}
|
|
19703
19691
|
|
|
19704
|
-
.sm\:psui-text-
|
|
19705
|
-
font-size:
|
|
19692
|
+
.sm\:psui-text-h5 {
|
|
19693
|
+
font-size: 18px;
|
|
19694
|
+
line-height: 120%;
|
|
19706
19695
|
}
|
|
19707
19696
|
|
|
19708
|
-
.sm\:psui-text-
|
|
19709
|
-
font-size:
|
|
19697
|
+
.sm\:psui-text-h6 {
|
|
19698
|
+
font-size: 17px;
|
|
19699
|
+
line-height: 120%;
|
|
19710
19700
|
}
|
|
19711
19701
|
|
|
19712
19702
|
.sm\:psui-leading-3 {
|
|
@@ -32614,44 +32604,54 @@ video {
|
|
|
32614
32604
|
height: 100vh;
|
|
32615
32605
|
}
|
|
32616
32606
|
|
|
32617
|
-
.md\:psui-text-xs {
|
|
32618
|
-
font-size: 0.75rem;
|
|
32619
|
-
}
|
|
32620
|
-
|
|
32621
32607
|
.md\:psui-text-sm {
|
|
32622
|
-
font-size:
|
|
32608
|
+
font-size: 14px;
|
|
32609
|
+
line-height: 20px;
|
|
32623
32610
|
}
|
|
32624
32611
|
|
|
32625
32612
|
.md\:psui-text-base {
|
|
32626
|
-
font-size:
|
|
32613
|
+
font-size: 16px;
|
|
32614
|
+
line-height: 24px;
|
|
32627
32615
|
}
|
|
32628
32616
|
|
|
32629
32617
|
.md\:psui-text-lg {
|
|
32630
|
-
font-size:
|
|
32618
|
+
font-size: 20px;
|
|
32619
|
+
line-height: 28px;
|
|
32631
32620
|
}
|
|
32632
32621
|
|
|
32633
32622
|
.md\:psui-text-xl {
|
|
32634
|
-
font-size:
|
|
32623
|
+
font-size: 24px;
|
|
32624
|
+
line-height: 32px;
|
|
32635
32625
|
}
|
|
32636
32626
|
|
|
32637
|
-
.md\:psui-text-
|
|
32638
|
-
font-size:
|
|
32627
|
+
.md\:psui-text-h1 {
|
|
32628
|
+
font-size: 28px;
|
|
32629
|
+
line-height: 120%;
|
|
32639
32630
|
}
|
|
32640
32631
|
|
|
32641
|
-
.md\:psui-text-
|
|
32642
|
-
font-size:
|
|
32632
|
+
.md\:psui-text-h2 {
|
|
32633
|
+
font-size: 24px;
|
|
32634
|
+
line-height: 120%;
|
|
32643
32635
|
}
|
|
32644
32636
|
|
|
32645
|
-
.md\:psui-text-
|
|
32646
|
-
font-size:
|
|
32637
|
+
.md\:psui-text-h3 {
|
|
32638
|
+
font-size: 22px;
|
|
32639
|
+
line-height: 120%;
|
|
32647
32640
|
}
|
|
32648
32641
|
|
|
32649
|
-
.md\:psui-text-
|
|
32650
|
-
font-size:
|
|
32642
|
+
.md\:psui-text-h4 {
|
|
32643
|
+
font-size: 20px;
|
|
32644
|
+
line-height: 120%;
|
|
32651
32645
|
}
|
|
32652
32646
|
|
|
32653
|
-
.md\:psui-text-
|
|
32654
|
-
font-size:
|
|
32647
|
+
.md\:psui-text-h5 {
|
|
32648
|
+
font-size: 18px;
|
|
32649
|
+
line-height: 120%;
|
|
32650
|
+
}
|
|
32651
|
+
|
|
32652
|
+
.md\:psui-text-h6 {
|
|
32653
|
+
font-size: 17px;
|
|
32654
|
+
line-height: 120%;
|
|
32655
32655
|
}
|
|
32656
32656
|
|
|
32657
32657
|
.md\:psui-leading-3 {
|
|
@@ -45559,44 +45559,54 @@ video {
|
|
|
45559
45559
|
height: 100vh;
|
|
45560
45560
|
}
|
|
45561
45561
|
|
|
45562
|
-
.lg\:psui-text-xs {
|
|
45563
|
-
font-size: 0.75rem;
|
|
45564
|
-
}
|
|
45565
|
-
|
|
45566
45562
|
.lg\:psui-text-sm {
|
|
45567
|
-
font-size:
|
|
45563
|
+
font-size: 14px;
|
|
45564
|
+
line-height: 20px;
|
|
45568
45565
|
}
|
|
45569
45566
|
|
|
45570
45567
|
.lg\:psui-text-base {
|
|
45571
|
-
font-size:
|
|
45568
|
+
font-size: 16px;
|
|
45569
|
+
line-height: 24px;
|
|
45572
45570
|
}
|
|
45573
45571
|
|
|
45574
45572
|
.lg\:psui-text-lg {
|
|
45575
|
-
font-size:
|
|
45573
|
+
font-size: 20px;
|
|
45574
|
+
line-height: 28px;
|
|
45576
45575
|
}
|
|
45577
45576
|
|
|
45578
45577
|
.lg\:psui-text-xl {
|
|
45579
|
-
font-size:
|
|
45578
|
+
font-size: 24px;
|
|
45579
|
+
line-height: 32px;
|
|
45580
45580
|
}
|
|
45581
45581
|
|
|
45582
|
-
.lg\:psui-text-
|
|
45583
|
-
font-size:
|
|
45582
|
+
.lg\:psui-text-h1 {
|
|
45583
|
+
font-size: 28px;
|
|
45584
|
+
line-height: 120%;
|
|
45584
45585
|
}
|
|
45585
45586
|
|
|
45586
|
-
.lg\:psui-text-
|
|
45587
|
-
font-size:
|
|
45587
|
+
.lg\:psui-text-h2 {
|
|
45588
|
+
font-size: 24px;
|
|
45589
|
+
line-height: 120%;
|
|
45588
45590
|
}
|
|
45589
45591
|
|
|
45590
|
-
.lg\:psui-text-
|
|
45591
|
-
font-size:
|
|
45592
|
+
.lg\:psui-text-h3 {
|
|
45593
|
+
font-size: 22px;
|
|
45594
|
+
line-height: 120%;
|
|
45592
45595
|
}
|
|
45593
45596
|
|
|
45594
|
-
.lg\:psui-text-
|
|
45595
|
-
font-size:
|
|
45597
|
+
.lg\:psui-text-h4 {
|
|
45598
|
+
font-size: 20px;
|
|
45599
|
+
line-height: 120%;
|
|
45596
45600
|
}
|
|
45597
45601
|
|
|
45598
|
-
.lg\:psui-text-
|
|
45599
|
-
font-size:
|
|
45602
|
+
.lg\:psui-text-h5 {
|
|
45603
|
+
font-size: 18px;
|
|
45604
|
+
line-height: 120%;
|
|
45605
|
+
}
|
|
45606
|
+
|
|
45607
|
+
.lg\:psui-text-h6 {
|
|
45608
|
+
font-size: 17px;
|
|
45609
|
+
line-height: 120%;
|
|
45600
45610
|
}
|
|
45601
45611
|
|
|
45602
45612
|
.lg\:psui-leading-3 {
|
|
@@ -58504,44 +58514,54 @@ video {
|
|
|
58504
58514
|
height: 100vh;
|
|
58505
58515
|
}
|
|
58506
58516
|
|
|
58507
|
-
.xl\:psui-text-xs {
|
|
58508
|
-
font-size: 0.75rem;
|
|
58509
|
-
}
|
|
58510
|
-
|
|
58511
58517
|
.xl\:psui-text-sm {
|
|
58512
|
-
font-size:
|
|
58518
|
+
font-size: 14px;
|
|
58519
|
+
line-height: 20px;
|
|
58513
58520
|
}
|
|
58514
58521
|
|
|
58515
58522
|
.xl\:psui-text-base {
|
|
58516
|
-
font-size:
|
|
58523
|
+
font-size: 16px;
|
|
58524
|
+
line-height: 24px;
|
|
58517
58525
|
}
|
|
58518
58526
|
|
|
58519
58527
|
.xl\:psui-text-lg {
|
|
58520
|
-
font-size:
|
|
58528
|
+
font-size: 20px;
|
|
58529
|
+
line-height: 28px;
|
|
58521
58530
|
}
|
|
58522
58531
|
|
|
58523
58532
|
.xl\:psui-text-xl {
|
|
58524
|
-
font-size:
|
|
58533
|
+
font-size: 24px;
|
|
58534
|
+
line-height: 32px;
|
|
58525
58535
|
}
|
|
58526
58536
|
|
|
58527
|
-
.xl\:psui-text-
|
|
58528
|
-
font-size:
|
|
58537
|
+
.xl\:psui-text-h1 {
|
|
58538
|
+
font-size: 28px;
|
|
58539
|
+
line-height: 120%;
|
|
58529
58540
|
}
|
|
58530
58541
|
|
|
58531
|
-
.xl\:psui-text-
|
|
58532
|
-
font-size:
|
|
58542
|
+
.xl\:psui-text-h2 {
|
|
58543
|
+
font-size: 24px;
|
|
58544
|
+
line-height: 120%;
|
|
58533
58545
|
}
|
|
58534
58546
|
|
|
58535
|
-
.xl\:psui-text-
|
|
58536
|
-
font-size:
|
|
58547
|
+
.xl\:psui-text-h3 {
|
|
58548
|
+
font-size: 22px;
|
|
58549
|
+
line-height: 120%;
|
|
58537
58550
|
}
|
|
58538
58551
|
|
|
58539
|
-
.xl\:psui-text-
|
|
58540
|
-
font-size:
|
|
58552
|
+
.xl\:psui-text-h4 {
|
|
58553
|
+
font-size: 20px;
|
|
58554
|
+
line-height: 120%;
|
|
58541
58555
|
}
|
|
58542
58556
|
|
|
58543
|
-
.xl\:psui-text-
|
|
58544
|
-
font-size:
|
|
58557
|
+
.xl\:psui-text-h5 {
|
|
58558
|
+
font-size: 18px;
|
|
58559
|
+
line-height: 120%;
|
|
58560
|
+
}
|
|
58561
|
+
|
|
58562
|
+
.xl\:psui-text-h6 {
|
|
58563
|
+
font-size: 17px;
|
|
58564
|
+
line-height: 120%;
|
|
58545
58565
|
}
|
|
58546
58566
|
|
|
58547
58567
|
.xl\:psui-leading-3 {
|
|
@@ -66542,3 +66562,4 @@ video {
|
|
|
66542
66562
|
animation: bounce 1s infinite;
|
|
66543
66563
|
}
|
|
66544
66564
|
}
|
|
66565
|
+
|
|
@@ -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
|
package/src/index.js
CHANGED
|
@@ -3,16 +3,16 @@ import PsCheckbox from './components/controls/PsCheckbox.vue';
|
|
|
3
3
|
import PsDialog from './components/notifications/PsDialog.vue';
|
|
4
4
|
import PsToast from './components/notifications/PsToast.vue';
|
|
5
5
|
import PsTabHeader from './components/tabs/PsTabHeader.vue';
|
|
6
|
-
import
|
|
6
|
+
import PsRadioButton from './components/controls/PsRadioButton.vue';
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
9
|
install(Vue) {
|
|
10
|
-
Vue.component('
|
|
11
|
-
Vue.component('
|
|
12
|
-
Vue.component('
|
|
13
|
-
Vue.component('
|
|
14
|
-
Vue.component('
|
|
15
|
-
Vue.component('
|
|
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
|
|
|
@@ -22,5 +22,5 @@ export {
|
|
|
22
22
|
PsDialog,
|
|
23
23
|
PsToast,
|
|
24
24
|
PsTabHeader,
|
|
25
|
-
|
|
25
|
+
PsRadioButton
|
|
26
26
|
}
|
|
@@ -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,6 +38,18 @@ module.exports = {
|
|
|
38
38
|
fontFamily: {
|
|
39
39
|
'sans': ['Lato'],
|
|
40
40
|
},
|
|
41
|
+
fontSize: {
|
|
42
|
+
sm: ['14px', '20px'],
|
|
43
|
+
base: ['16px', '24px'],
|
|
44
|
+
lg: ['20px', '28px'],
|
|
45
|
+
xl: ['24px', '32px'],
|
|
46
|
+
h1: ['28px', '120%'],
|
|
47
|
+
h2: ['24px', '120%'],
|
|
48
|
+
h3: ['22px', '120%'],
|
|
49
|
+
h4: ['20px', '120%'],
|
|
50
|
+
h5: ['18px', '120%'],
|
|
51
|
+
h6: ['17px', '120%'],
|
|
52
|
+
},
|
|
41
53
|
boxShadow: {
|
|
42
54
|
sm: '0px 0px 4px rgba(0, 0, 0, 0.03), 0px 1px 2px rgba(0, 0, 0, 0.1)',
|
|
43
55
|
default: '0px 0px 8px rgba(0, 0, 0, 0.04), 0px 2px 5px rgba(0, 0, 0, 0.08)',
|