toggle-components-library 1.11.1 → 1.13.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toggle-components-library",
3
- "version": "1.11.1",
3
+ "version": "1.13.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -34,7 +34,8 @@
34
34
  "vue-moment": "^4.1.0",
35
35
  "vue-router": "^3.4.3",
36
36
  "vue2-dropzone": "^3.6.0",
37
- "vuedraggable": "^2.24.3"
37
+ "vuedraggable": "^2.24.3",
38
+ "webfontloader": "^1.6.28"
38
39
  },
39
40
  "devDependencies": {
40
41
  "@babel/core": "^7.11.1",
@@ -0,0 +1,102 @@
1
+ <template>
2
+ <ToggleInputSelect :options="fontOptions" :label="label" :name="name" :fontFamily="fontValue" v-model="fontValue" size="medium" :style="`font-family: ${fontValue};`"/>
3
+ </template>
4
+
5
+ <script>
6
+ import { mixins } from '../mixins/mixins';
7
+ import ToggleInputSelect from './ToggleInputSelect.vue';
8
+ var WebFont = require('webfontloader');
9
+
10
+ export default {
11
+ mixins:[mixins],
12
+ components:{ ToggleInputSelect },
13
+ name: 'FontPicker',
14
+ props: {
15
+ /**
16
+ * The name of the fontpicker component
17
+ */
18
+ name: {
19
+ type: String,
20
+ default: "ToggleFontPicker"
21
+ },
22
+ /**
23
+ * The label that will be displayed
24
+ */
25
+ label: {
26
+ type: String,
27
+ required: false,
28
+ default: "Font picker"
29
+ },
30
+ /**
31
+ * Whether this is a required field or not
32
+ */
33
+ required: {
34
+ type: Boolean,
35
+ default: false
36
+ },
37
+ },
38
+ data() {
39
+ return {
40
+ fontValue: '',
41
+ fonts: [
42
+ 'Abril Fatface',
43
+ 'Alpha Slab One',
44
+ 'Anton',
45
+ 'Arvo',
46
+ 'Bodoni Moda',
47
+ 'EB Garamond',
48
+ 'Fredoka One',
49
+ 'IBM Plex Mono',
50
+ 'Lato',
51
+ 'Libre Baskerville',
52
+ 'Lora',
53
+ 'Merriweather',
54
+ 'Montserrat',
55
+ 'Nunito',
56
+ 'Open Sans',
57
+ 'Open Sans Condensed',
58
+ 'Oswald',
59
+ 'Poppins',
60
+ 'Prata',
61
+ 'PT Serif',
62
+ 'Quicksand',
63
+ 'Roboto',
64
+ 'Roboto Mono',
65
+ 'Roboto Slab',
66
+ 'Rubik',
67
+ 'Sacramento',
68
+ 'Source Sans Pro',
69
+ 'Source Serif Pro',
70
+ 'Volkhov',
71
+ 'Work Sans Pro',
72
+ 'Space Mono'
73
+ ],
74
+ }
75
+ },
76
+ created() {
77
+ this.getFonts();
78
+ },
79
+
80
+ computed: {
81
+ fontOptions() {
82
+ // Format font list into value/label object for select input
83
+ return this.fonts.map(font => {
84
+ return {
85
+ value: font,
86
+ label: font
87
+ }
88
+ })
89
+ }
90
+ },
91
+
92
+ methods: {
93
+ getFonts() {
94
+ WebFont.load({
95
+ google: {
96
+ families: this.fonts
97
+ }
98
+ });
99
+ }
100
+ }
101
+ }
102
+ </script>
@@ -15,6 +15,7 @@
15
15
  v-model="inputVal"
16
16
  :autocomplete="autocomplete ? 'on' : 'off' "
17
17
  :required="required"
18
+ :style="`${fontFamily ? 'font-family: ' + fontFamily : ''}`"
18
19
  >
19
20
  <option value="">Select an option</option>
20
21
  <option :value="option.value" v-for="(option, key) in options" v-bind:key="key">{{option.label}}</option>
@@ -72,6 +73,10 @@ export default {
72
73
  errorMessage: {
73
74
  type: String,
74
75
  required: false
76
+ },
77
+ fontFamily: {
78
+ type: String,
79
+ required: false
75
80
  }
76
81
  },
77
82
 
package/src/index.js CHANGED
@@ -49,6 +49,8 @@ import ToggleHeaderTextLarge from "./components/text/ToggleHeaderTextLarge.vue";
49
49
  import ToggleHelperTextSmall from "./components/text/ToggleHelperTextSmall.vue";
50
50
  import ToggleInfoText from "./components/text/ToggleInfoText.vue";
51
51
 
52
+ import ToggleFontPicker from "./components/forms/ToggleFontPicker.vue";
53
+
52
54
  import './sass/main.scss';
53
55
 
54
56
  const Components = {
@@ -92,7 +94,8 @@ const Components = {
92
94
  ToggleFeatureButton,
93
95
  ToggleHelperTextSmall,
94
96
  ToggleInfoText,
95
- ToggleInternationalPhoneInputSelect
97
+ ToggleInternationalPhoneInputSelect,
98
+ ToggleFontPicker
96
99
  }
97
100
 
98
101
  Object.keys(Components).forEach(name => {
@@ -642,7 +642,7 @@ $iconWidth:20px;
642
642
  float: left;
643
643
  outline: 1px solid ;
644
644
  outline-offset: -1px;
645
- padding: 0 0 0 1rem;
645
+ padding: 0 0 0 1rem !important;
646
646
  }
647
647
 
648
648