@propelinc/citrus-ui 0.1.1 → 0.2.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": "@propelinc/citrus-ui",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/propelinc/citrus-ui"
@@ -2,18 +2,23 @@
2
2
  <v-btn
3
3
  class="button"
4
4
  :class="{
5
+ 'button--primary': !secondary && !tertiary,
5
6
  'button--secondary': secondary,
7
+ 'button--tertiary': tertiary,
8
+ 'button--dark': dark,
9
+ 'button--light': light,
6
10
  'button--large': large,
7
- [`${colorScheme.text}--text`]: true,
11
+ 'button--disabled': disabled,
8
12
  }"
9
13
  data-test="button"
10
14
  rounded
11
15
  :block="block"
12
16
  :elevation="0"
13
- :color="colorScheme.container"
14
17
  :large="large"
15
18
  :ripple="false"
16
19
  :to="to"
20
+ :text="tertiary"
21
+ :disabled="disabled"
17
22
  v-on="$listeners"
18
23
  >
19
24
  <div v-if="hasIcon" class="button__icon">
@@ -32,30 +37,18 @@ import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
32
37
  import { Component, Vue, Prop } from 'vue-property-decorator';
33
38
  import { RawLocation } from 'vue-router';
34
39
 
35
- interface ColorScheme {
36
- text: string;
37
- container: string;
38
- }
39
-
40
40
  @Component({ name: 'CButton', components: { FontAwesomeIcon } })
41
- export default class Button extends Vue {
42
- @Prop({ type: Boolean, default: false }) dark!: boolean;
41
+ export default class CButton extends Vue {
43
42
  @Prop({ type: Boolean, default: false }) block!: boolean;
43
+ @Prop({ type: Boolean, default: false }) dark!: boolean;
44
+ @Prop({ type: Boolean, default: false }) disabled!: boolean;
45
+ @Prop([String, Array, Object]) icon?: IconDefinition;
44
46
  @Prop({ type: Boolean, default: false }) large!: boolean;
47
+ @Prop({ type: Boolean, default: false }) light!: boolean;
45
48
  @Prop({ type: Boolean, default: false }) secondary!: boolean;
46
- @Prop([String, Array, Object]) icon?: IconDefinition;
49
+ @Prop({ type: Boolean, default: false }) tertiary!: boolean;
47
50
  @Prop([Object, String]) to?: RawLocation;
48
51
 
49
- get colorScheme(): ColorScheme {
50
- if (this.dark) {
51
- return { text: 'white', container: 'navy' };
52
- } else if (this.secondary) {
53
- return { text: 'primary', container: 'white' };
54
- } else {
55
- return { text: 'white', container: 'primary' };
56
- }
57
- }
58
-
59
52
  get hasIcon(): boolean {
60
53
  return !!(this.icon || this.$slots.icon || this.$scopedSlots.icon);
61
54
  }
@@ -75,12 +68,65 @@ export default class Button extends Vue {
75
68
  }
76
69
  }
77
70
 
78
- .button--large {
79
- font-size: 16px;
71
+ .button--primary {
72
+ background-color: @color-blue-accent !important;
73
+ color: @color-white;
74
+ }
75
+
76
+ .button--primary.button--dark {
77
+ background-color: @color-navy !important;
78
+ }
79
+
80
+ .button--primary.button--light {
81
+ background-color: @color-white !important;
82
+ color: @color-navy;
80
83
  }
81
84
 
82
85
  .button--secondary {
83
86
  border: @border !important;
87
+ color: @color-blue-accent;
88
+ }
89
+
90
+ .button--secondary.button--dark {
91
+ color: @color-navy;
92
+ }
93
+
94
+ .button--secondary.button--light {
95
+ background-color: @color-navy !important;
96
+ color: @color-white;
97
+ }
98
+
99
+ .button--tertiary {
100
+ color: @color-blue-accent;
101
+ }
102
+
103
+ .button--tertiary.button--dark {
104
+ color: @color-navy;
105
+ }
106
+
107
+ .button--tertiary.button--light {
108
+ color: @color-white;
109
+ }
110
+
111
+ // Add some insane specificity to override Vuetify.
112
+ .theme--light.v-btn.v-btn--disabled:not(.v-btn--outlined) {
113
+ &.button--disabled.button--primary {
114
+ background-color: @color-navy-tint-4 !important;
115
+ color: @color-navy-tint-1 !important;
116
+ }
117
+
118
+ &.button--disabled.button--secondary {
119
+ background-color: @color-white !important;
120
+ color: @color-navy-tint-2 !important;
121
+ }
122
+
123
+ &.button--disabled.button--tertiary {
124
+ color: @color-navy-tint-2 !important;
125
+ }
126
+ }
127
+
128
+ .button--large {
129
+ font-size: 16px;
84
130
  }
85
131
 
86
132
  .button__icon {
@@ -0,0 +1,46 @@
1
+ <template>
2
+ <v-btn-toggle
3
+ data-test="segmented-button"
4
+ :value="value"
5
+ rounded
6
+ class="segmented-button"
7
+ active-class="segmented-button__option--active"
8
+ @change="(value) => $emit('change', value)"
9
+ >
10
+ <slot>
11
+ <c-segmented-button-option
12
+ v-for="option in options"
13
+ :key="option.label"
14
+ :value="option.value"
15
+ :label="option.label"
16
+ />
17
+ </slot>
18
+ </v-btn-toggle>
19
+ </template>
20
+
21
+ <script lang="ts">
22
+ import { Component, Vue, Prop } from 'vue-property-decorator';
23
+
24
+ import CSegmentedButtonOption from '@/components/CSegmentedButtonOption.vue';
25
+
26
+ interface SegmentedButtonOption {
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
+ value: any;
29
+ label: string;
30
+ }
31
+
32
+ @Component({ name: 'CSegmentedButton', components: { CSegmentedButtonOption } })
33
+ export default class CSegmentedButton extends Vue {
34
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
+ @Prop() value?: any;
36
+ @Prop({ type: Array, required: true }) options!: SegmentedButtonOption[];
37
+ }
38
+ </script>
39
+
40
+ <style lang="less" scoped>
41
+ @import '~@/styles/variables.less';
42
+
43
+ .segmented-button {
44
+ width: 100%;
45
+ }
46
+ </style>
@@ -0,0 +1,45 @@
1
+ <template>
2
+ <v-btn
3
+ class="segmented-button__option"
4
+ data-test="segmented-button-option"
5
+ :ripple="false"
6
+ :value="value"
7
+ >
8
+ <slot>
9
+ {{ label }}
10
+ </slot>
11
+ </v-btn>
12
+ </template>
13
+
14
+ <script lang="ts">
15
+ import { Component, Vue, Prop } from 'vue-property-decorator';
16
+
17
+ @Component({ name: 'CSegmentedButtonOption' })
18
+ export default class CSegmentedButtonOption extends Vue {
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ @Prop({ required: true }) value?: any;
21
+ @Prop(String) label?: string;
22
+ }
23
+ </script>
24
+
25
+ <style lang="less" scoped>
26
+ @import '~@/styles/variables.less';
27
+
28
+ .segmented-button__option {
29
+ border: @border !important;
30
+ color: @color-navy;
31
+ flex: 1 1 0;
32
+ font-weight: @font-weight-heavy;
33
+ letter-spacing: 0;
34
+ text-transform: none;
35
+
36
+ &::before {
37
+ color: transparent;
38
+ }
39
+ }
40
+
41
+ // This class is applied by the CSegmentedButton component.
42
+ .segmented-button__option--active {
43
+ background-color: @color-blue !important;
44
+ }
45
+ </style>
package/src/index.d.ts CHANGED
@@ -10,6 +10,8 @@ export const CCard: Component;
10
10
  export const CIconButton: Component;
11
11
  export const CListItem: Component;
12
12
  export const CModalLoading: Component;
13
+ export const CSegmentedButton: Component;
14
+ export const CSegmentedButtonOption: Component;
13
15
  export const CSkeletonLoaderCircle: Component;
14
16
  export const CSkeletonLoaderText: Component;
15
17
  export const CTextField: Component;
package/src/index.ts CHANGED
@@ -7,6 +7,8 @@ import _CCard from '@/components/CCard.vue';
7
7
  import _CIconButton from '@/components/CIconButton.vue';
8
8
  import _CListItem from '@/components/CListItem.vue';
9
9
  import _CModalLoading from '@/components/CModalLoading.vue';
10
+ import _CSegmentedButton from '@/components/CSegmentedButton.vue';
11
+ import _CSegmentedButtonOption from '@/components/CSegmentedButtonOption.vue';
10
12
  import _CSkeletonLoaderCircle from '@/components/CSkeletonLoaderCircle.vue';
11
13
  import _CSkeletonLoaderText from '@/components/CSkeletonLoaderText.vue';
12
14
  import _CTextField from '@/components/CTextField.vue';
@@ -23,6 +25,8 @@ export const CCard = _CCard;
23
25
  export const CIconButton = _CIconButton;
24
26
  export const CListItem = _CListItem;
25
27
  export const CModalLoading = _CModalLoading;
28
+ export const CSegmentedButton = _CSegmentedButton;
29
+ export const CSegmentedButtonOption = _CSegmentedButtonOption;
26
30
  export const CSkeletonLoaderCircle = _CSkeletonLoaderCircle;
27
31
  export const CSkeletonLoaderText = _CSkeletonLoaderText;
28
32
  export const CTextField = _CTextField;
@@ -0,0 +1,8 @@
1
+ @import "./variables.less";
2
+
3
+ @font-face {
4
+ font-family: @font-family-blitz;
5
+ font-style: normal;
6
+ font-weight: @font-weight-normal;
7
+ src: url('../assets/fonts/Blitz-Script.woff2') format('woff2'),
8
+ }
@@ -1,4 +1,5 @@
1
1
  @import './object-sans.less';
2
+ @import './blitz.less';
2
3
 
3
4
  .provide.provide-theme {
4
5
  /* stylelint-disable-next-line no-invalid-position-at-import-rule */
@@ -10,6 +10,10 @@
10
10
  .large-headline();
11
11
  }
12
12
 
13
+ .large-headline-script {
14
+ .large-headline-script();
15
+ }
16
+
13
17
  .headline {
14
18
  .headline();
15
19
  }
@@ -34,3 +38,7 @@ p,
34
38
  .overline {
35
39
  .overline();
36
40
  }
41
+
42
+ .font-family-blitz {
43
+ font-family: @font-family-blitz;
44
+ }
@@ -7,6 +7,7 @@
7
7
 
8
8
  // TYPOGRAPHY
9
9
  @font-family-object-sans: ObjectSans;
10
+ @font-family-blitz: Blitz;
10
11
 
11
12
  @font-weight-thin: 100;
12
13
  @font-weight-light: 300; // Currently unused, but holding its place in case we add it.
@@ -46,6 +47,13 @@
46
47
  text-transform: uppercase;
47
48
  }
48
49
 
50
+ .large-headline-script() {
51
+ font-family: @font-family-blitz !important;
52
+ font-size: @font-size-3x-large !important;
53
+ font-weight: @font-weight-normal;
54
+ line-height: @line-height-large-headline;
55
+ }
56
+
49
57
  .headline() {
50
58
  font-family: @font-family-object-sans !important;
51
59
  font-size: @font-size-x-large !important;