@usssa/component-library 1.0.0-alpha.10 → 1.0.0-alpha.11

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,4 +1,4 @@
1
- # Component Library
1
+ # Component Library v1.0.2-alpha.0
2
2
 
3
3
  This library provides custom UI components for USSSA applications.
4
4
 
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@usssa/component-library",
3
- "version": "1.0.0-alpha.10",
3
+ "version": "1.0.0-alpha.11",
4
4
  "description": "A Quasar component library project",
5
5
  "productName": "Quasar component library App",
6
6
  "author": "Troy Moreland <troy.moreland@usssa.com>",
7
7
  "main": "src/components/index.js",
8
8
  "files": [
9
9
  "src/components",
10
+ "src/composables",
10
11
  "README.md"
11
12
  ],
12
13
  "publishConfig": {
@@ -24,6 +25,7 @@
24
25
  },
25
26
  "dependencies": {
26
27
  "@quasar/extras": "^1.16.4",
28
+ "flag-icons": "^7.2.3",
27
29
  "quasar": "^2.16.0",
28
30
  "vue": "^3.4.18",
29
31
  "vue-router": "^4.0.12"
@@ -1,6 +1,5 @@
1
1
  <script setup>
2
- import UBtnStd from 'src/components/core/UBtnStd.vue'
3
- import { computed } from 'vue'
2
+ import UBtnStd from './UBtnStd.vue'
4
3
 
5
4
  const props = defineProps({
6
5
  type: {
@@ -46,11 +45,12 @@ const handleSecondaryActionClick = () => {
46
45
  <q-banner
47
46
  v-if="show && message"
48
47
  inline-actions
49
- :class="`u-banner u-banner-${type}`"
48
+ :class="`u-banner u-banner-${type} ${!icon ? 'no-padding-label' : ''}`"
50
49
  tabindex="0"
51
50
  >
52
51
  <template v-slot:avatar>
53
52
  <q-icon
53
+ v-if="icon"
54
54
  aria-label="Banner Icon"
55
55
  :class="icon"
56
56
  size="1.5rem"
@@ -93,7 +93,7 @@ const handleSecondaryActionClick = () => {
93
93
 
94
94
  .u-banner-positive
95
95
  background: $green-1 !important
96
- color: $green-6 !important
96
+ color: $green-7 !important
97
97
 
98
98
  .u-banner-info
99
99
  background: $purple-1 !important
@@ -110,4 +110,8 @@ const handleSecondaryActionClick = () => {
110
110
  .u-banner-primary
111
111
  background: $blue-1 !important
112
112
  color: $primary !important
113
+
114
+ .no-padding-label
115
+ .q-banner__content
116
+ padding-left: 0px !important
113
117
  </style>
@@ -39,20 +39,12 @@ const props = defineProps({
39
39
  },
40
40
  })
41
41
 
42
- const emit = defineEmits(['click'])
42
+ const emit = defineEmits(['onClick'])
43
43
 
44
44
  const handleClick = () => {
45
45
  return emit('onClick')
46
46
  }
47
47
 
48
- const paddingClass = computed(() => {
49
- if (props.size === 'sm') {
50
- return 'q-px-sm'
51
- }
52
-
53
- return 'q-px-ba'
54
- })
55
-
56
48
  const textClass = computed(() => {
57
49
  if (props.color === 'neutral') {
58
50
  return 'text-neutral-9'
@@ -71,7 +63,7 @@ const isFullWidth = computed(() => {
71
63
  <template>
72
64
  <q-btn
73
65
  class="u-btn q-py-none"
74
- :class="`size-${size} ${paddingClass} ${textClass} focus-${color} ${isFullWidth}`"
66
+ :class="`size-${size} ${textClass} focus-${color} ${isFullWidth}`"
75
67
  :color="color"
76
68
  :disable="disable"
77
69
  :unelevated="!outline"
@@ -106,19 +98,24 @@ const isFullWidth = computed(() => {
106
98
  <style lang="sass">
107
99
  .u-btn
108
100
  border-radius: $xs
109
- min-width: 5.5rem
101
+ min-width: 5.5rem !important
110
102
 
111
103
  &.bg-neutral
112
104
  background-color: $neutral-3
113
105
 
114
106
  &.size-sm
115
107
  min-height: $md
108
+ padding: 0 $sm !important
116
109
 
117
110
  &.size-md
118
111
  min-height: $lg
112
+ padding: 0 $ba !important
113
+
119
114
 
120
115
  &.size-lg
121
116
  min-height: $xl
117
+ padding: 0 $ba !important
118
+
122
119
 
123
120
  .button-label
124
121
  word-break: break-all
@@ -0,0 +1,68 @@
1
+ <script setup>
2
+ const props = defineProps({
3
+ options: {
4
+ type: Array,
5
+ require: true,
6
+ },
7
+ })
8
+ const model = defineModel()
9
+ </script>
10
+
11
+ <template>
12
+ <q-btn-toggle
13
+ class="u-btn-toggle"
14
+ v-model="model"
15
+ size="md"
16
+ text-color="dark"
17
+ unelevated
18
+ color="white"
19
+ no-caps
20
+ spread
21
+ toggle-color="primary"
22
+ :options="options"
23
+ >
24
+ <template
25
+ v-for="(option, index) in options"
26
+ v-slot:[option.slot]
27
+ :key="option"
28
+ >
29
+ <div class="row items-center no-wrap slot">
30
+ <q-icon
31
+ :class="options[index].iconClass"
32
+ v-if="options[index].iconClass"
33
+ />
34
+ <div class="text-center text-caption-md">
35
+ {{ options[index].name }}
36
+ </div>
37
+ </div>
38
+ </template>
39
+ </q-btn-toggle>
40
+ </template>
41
+
42
+ <style lang="sass">
43
+ .slot
44
+ gap: $xxs
45
+
46
+ .u-btn-toggle
47
+ &.q-btn-toggle
48
+ border-radius: $xs
49
+ padding: $xxs
50
+ box-shadow: $shadow-inner
51
+
52
+ .q-btn-item
53
+ .q-btn__content
54
+ font-size: 0.875rem
55
+ line-height: 1.25rem
56
+ letter-spacing: .03333rem
57
+ font-weight: 500
58
+
59
+ .q-btn-item
60
+ border-radius: $xxs !important
61
+ padding: $xs $sm !important
62
+ &[aria-pressed="true"]
63
+ &::before
64
+ color: $neutral-1
65
+ box-shadow: $shadow-skeumorphic-primary
66
+ border: $stroke-skeuomorphic
67
+ z-index: 2
68
+ </style>
@@ -4,7 +4,7 @@ import { onMounted } from 'vue'
4
4
  const props = defineProps({
5
5
  label: {
6
6
  type: String,
7
- default: 'Checkbox',
7
+ default: '',
8
8
  },
9
9
  name: {
10
10
  type: String,
@@ -28,18 +28,18 @@ const props = defineProps({
28
28
  const isChecked = defineModel({ default: false, type: Boolean })
29
29
 
30
30
  onMounted(() => {
31
- const checkboxElement = document.getElementById(`u-checkbox-${props.id}`)
31
+ const checkboxElement = document.getElementById(`${props.id}`)
32
32
  if (checkboxElement) {
33
33
  const inputElement = checkboxElement.querySelector('input')
34
- inputElement.id = `u-checkbox-${props.id}`
34
+ inputElement.id = `${props.id}`
35
35
  }
36
36
  })
37
37
  </script>
38
38
 
39
39
  <template>
40
- <label style="display: none" :for="`u-checkbox-${id}`">Checkbox </label>
40
+ <label style="display: none" :for="`${id}`">Checkbox </label>
41
41
  <q-checkbox
42
- :id="`u-checkbox-${id}`"
42
+ :id="`${id}`"
43
43
  class="u-checkbox text-caption-lg"
44
44
  :name="name"
45
45
  v-model="isChecked"
@@ -48,6 +48,7 @@ onMounted(() => {
48
48
  size="md"
49
49
  keep-color
50
50
  color="primary"
51
+ toggle-indeterminate
51
52
  />
52
53
  </template>
53
54
 
@@ -56,12 +57,21 @@ onMounted(() => {
56
57
  color: $primary
57
58
  font-weight: 500
58
59
 
59
- &.q-checkbox__inner
60
+ .q-checkbox__inner
60
61
  display: flex
61
62
  justify-content: center
62
63
  align-items: center
64
+ height: $ms
65
+ width: $ms
66
+
67
+ .q-checkbox__inner:before
68
+ top: -9px !important
69
+ left: -2px !important
70
+ width: 2.7rem
71
+ height: 2.7rem
72
+ border-radius: 10rem !important
63
73
 
64
- &.q-checkbox__bg
74
+ .q-checkbox__bg
65
75
  border: 0.125rem solid $primary
66
76
  border-radius: $xxs
67
77
  height: $ms
@@ -71,7 +81,7 @@ onMounted(() => {
71
81
  justify-content: center
72
82
  align-items: center
73
83
 
74
- &.q-checkbox__svg
84
+ .q-checkbox__svg
75
85
  position: static
76
86
  height: 1rem !important
77
87
  width: 1rem !important
@@ -16,15 +16,13 @@ const props = defineProps({
16
16
  },
17
17
  avatarLabel: {
18
18
  type: String,
19
- default: 'NA',
19
+ default: '',
20
20
  },
21
21
  icon: {
22
22
  type: String,
23
- default: 'NA',
24
23
  },
25
24
  iconClass: {
26
25
  type: String,
27
- default: 'NA',
28
26
  },
29
27
  type: {
30
28
  type: String,
@@ -34,6 +32,9 @@ const props = defineProps({
34
32
  type: Boolean,
35
33
  default: true,
36
34
  },
35
+ remove: {
36
+ type: Function,
37
+ },
37
38
  })
38
39
 
39
40
  const emit = defineEmits(['update:modelValue', 'onClick'])
@@ -64,7 +65,7 @@ const avatarLabel = computed(() => {
64
65
  :class="type"
65
66
  :modelValue="modelValue"
66
67
  :dense="dense"
67
- @remove="() => $emit('update:modelValue', false)"
68
+ @remove="remove"
68
69
  :removable="removable"
69
70
  :aria-label="chipLabel"
70
71
  @click="handleClick"
@@ -0,0 +1,202 @@
1
+ <script setup>
2
+ import { computed, ref } from 'vue'
3
+
4
+ const props = defineProps({
5
+ heading: {
6
+ type: String,
7
+ required: true,
8
+ },
9
+ fields: Object,
10
+ position: String,
11
+ size: {
12
+ type: String,
13
+ default: 'default',
14
+ },
15
+ headingCaption: String,
16
+ leftIcon: String,
17
+ closeIcon: String,
18
+ showActionButtons: Boolean,
19
+ leftIconLabel: String,
20
+ closeIconLabel: String,
21
+ divider: Boolean,
22
+ })
23
+
24
+ const model = defineModel()
25
+
26
+ const emit = defineEmits(['onBackIconClick', 'hideDialog'])
27
+ const dialogRef = ref(true)
28
+
29
+ const handleBackClick = () => {
30
+ return emit('onBackIconClick')
31
+ }
32
+
33
+ const headerClass = computed(() => {
34
+ return props.divider ? 'divider' : ''
35
+ })
36
+ </script>
37
+
38
+ <template>
39
+ <q-dialog
40
+ no-backdrop-dismiss
41
+ ref="dialogRef"
42
+ :position="position"
43
+ full-width
44
+ :class="`dialog-${size}`"
45
+ v-model="model"
46
+ v-bind="$attrs"
47
+ >
48
+ <q-card class="dialog-wrapper full-height">
49
+ <q-card-section
50
+ :class="`col items-center q-pa-none heading-section ${headerClass}`"
51
+ >
52
+ <div class="heading-wrapper row">
53
+ <div class="flex items-center dialog-heading-container">
54
+ <div v-if="leftIcon">
55
+ <q-icon
56
+ class="icon-back"
57
+ :class="leftIcon"
58
+ size="1.5rem"
59
+ @click="handleBackClick()"
60
+ tabindex="0"
61
+ :aria-label="leftIconLabel"
62
+ >
63
+ </q-icon>
64
+ </div>
65
+ <div class="col">
66
+ <div>
67
+ <span class="text-heading-sm dialog-heading">
68
+ {{ heading }}
69
+ </span>
70
+ </div>
71
+ <div>
72
+ <span class="text-body-sm dialog-caption" v-if="headingCaption">
73
+ {{ headingCaption }}
74
+ </span>
75
+ </div>
76
+ </div>
77
+ </div>
78
+ <q-icon
79
+ v-if="closeIcon"
80
+ class="icon-close"
81
+ :class="closeIcon"
82
+ size="1.5rem"
83
+ @click="dialogRef.hide()"
84
+ tabindex="0"
85
+ :aria-label="closeIconLabel"
86
+ :aria-hidden="false"
87
+ >
88
+ </q-icon>
89
+ </div>
90
+ <div class="row">
91
+ <slot name="secondary_row"></slot>
92
+ </div>
93
+ </q-card-section>
94
+
95
+ <q-card-section class="full-height main-content-dialog scroll q-px-ba">
96
+ <slot name="content" />
97
+ </q-card-section>
98
+
99
+ <div class="q-pa-ba action-wrapper" v-if="showActionButtons">
100
+ <q-card-actions align="left" class="action-buttons">
101
+ <slot name="action_secondary_one"></slot>
102
+ <slot name="action_secondary_two"></slot>
103
+ </q-card-actions>
104
+ <q-card-actions align="right" class="action-buttons">
105
+ <slot name="action_primary_one"></slot>
106
+ <slot name="action_primary_two"></slot>
107
+ </q-card-actions>
108
+ </div>
109
+ </q-card>
110
+ </q-dialog>
111
+ </template>
112
+
113
+ <style lang="sass">
114
+ .dialog-default, .dialog-half
115
+ .q-dialog__inner--left, .q-dialog__inner--right
116
+ .dialog-wrapper
117
+ max-height: 100vh !important
118
+ .q-dialog__inner
119
+ &.q-dialog__inner--right
120
+ padding-right: $ba !important
121
+ &.q-dialog__inner--left
122
+ padding-left: $ba !important
123
+ .dialog-heading-container
124
+ gap: $xs
125
+
126
+ .dialog-caption
127
+ color: $neutral-9
128
+ .dialog-heading
129
+ color: $dark
130
+
131
+ .heading-section
132
+ padding: $ba
133
+
134
+ .dialog-wrapper
135
+ border-radius: $xs !important
136
+ .divider
137
+ border-bottom: 1.5px solid $neutral-4
138
+ .action-wrapper
139
+ display: flex
140
+ justify-content: space-between
141
+ border-radius: 0 0 $xs $xs !important
142
+ .q-card__actions
143
+ padding: 0
144
+
145
+ .dialog-half
146
+ .q-dialog__inner
147
+ padding: $ba 0
148
+ width: 50% !important
149
+
150
+ .dialog-full
151
+ .q-dialog__inner
152
+ padding: 0 0
153
+ width: 100% !important
154
+ .dialog-wrapper
155
+ max-height: calc(100vh - 1rem)
156
+ border-radius: $xs $xs 0 0 !important
157
+ &.action-wrapper
158
+ border-radius: 0 !important
159
+ .main-content-dialog
160
+ padding: $ms $ms
161
+ padding-bottom: 0
162
+ margin-bottom: $ms !important
163
+ .heading-section
164
+ padding: $ba $ms !important
165
+ .action-wrapper
166
+ padding: $ba $ms
167
+
168
+ .dialog-default
169
+ .q-dialog__inner
170
+ padding: $ba 0
171
+ width: 35.25rem !important
172
+
173
+ .heading-wrapper
174
+ justify-content: space-between
175
+ flex-wrap: nowrap
176
+ margin-bottom: $ba
177
+
178
+ .icon-close
179
+ color: $neutral-9
180
+ cursor: pointer
181
+ align-self: flex-start
182
+
183
+ .icon-back
184
+ cursor: pointer
185
+ color: $neutral-9
186
+
187
+ .main-content-dialog
188
+ margin-bottom: $ba
189
+ padding-bottom: 0
190
+
191
+ .full-height
192
+ height: 100vh
193
+ display: flex
194
+ flex-direction: column
195
+
196
+ .action-buttons
197
+ display: flex
198
+ align-items: center
199
+ gap: $xs
200
+ .q-btn
201
+ margin: 0 !important
202
+ </style>