@propelinc/citrus-ui 1.0.4 → 1.3.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/README.md +51 -14
- package/dist/citrus-ui.cdn.css +1 -0
- package/dist/citrus-ui.css +1 -0
- package/dist/colors/colors.d.ts +31 -0
- package/dist/colors/theme.d.ts +3 -0
- package/dist/colors/util-classes.d.ts +11 -0
- package/dist/components/CAccordion.vue.d.ts +34 -0
- package/dist/components/CAccordionItem.vue.d.ts +39 -0
- package/dist/components/CAppBar.vue.d.ts +59 -0
- package/dist/components/CBadge.vue.d.ts +35 -0
- package/dist/components/CBottomSheet.vue.d.ts +90 -0
- package/dist/components/CButton/CButton.vue.d.ts +97 -0
- package/dist/components/CButton/types.d.ts +5 -0
- package/dist/components/CButtonStack.vue.d.ts +27 -0
- package/dist/components/CCard.vue.d.ts +53 -0
- package/dist/components/CCardFooter.vue.d.ts +20 -0
- package/dist/components/CCardHeader.vue.d.ts +22 -0
- package/dist/components/CCardSection.vue.d.ts +26 -0
- package/dist/components/CCheckbox.vue.d.ts +62 -0
- package/dist/components/CCol.vue.d.ts +30 -0
- package/dist/components/CDivider.vue.d.ts +9 -0
- package/dist/components/CDobField.vue.d.ts +60 -0
- package/dist/components/CDobSelect.vue.d.ts +50 -0
- package/dist/components/CEmailField.vue.d.ts +48 -0
- package/dist/components/CExpandTransition.vue.d.ts +29 -0
- package/dist/components/CFadeTransition.vue.d.ts +20 -0
- package/dist/components/CFileInput.vue.d.ts +50 -0
- package/dist/components/CFixedPageFooter.vue.d.ts +153 -0
- package/dist/components/CForm.vue.d.ts +44 -0
- package/dist/components/CFormFieldCounter.vue.d.ts +15 -0
- package/dist/components/CIconButton.vue.d.ts +97 -0
- package/dist/components/CLabel.vue.d.ts +36 -0
- package/dist/components/CListItem.vue.d.ts +56 -0
- package/dist/components/CListItemContent.vue.d.ts +27 -0
- package/dist/components/CListItemIcon.vue.d.ts +28 -0
- package/dist/components/CLoader.vue.d.ts +23 -0
- package/dist/components/CLogo.vue.d.ts +9 -0
- package/dist/components/CMaskedTextField.vue.d.ts +511 -0
- package/dist/components/CMenu.vue.d.ts +17 -0
- package/dist/components/CMenuItem.vue.d.ts +37 -0
- package/dist/components/CMenuLabel.vue.d.ts +20 -0
- package/dist/components/CModal.vue.d.ts +59 -0
- package/dist/components/CModalLoading.vue.d.ts +36 -0
- package/dist/components/CNotification.vue.d.ts +64 -0
- package/dist/components/CPhoneField.vue.d.ts +792 -0
- package/dist/components/CPill.vue.d.ts +41 -0
- package/dist/components/CPillGroup.vue.d.ts +39 -0
- package/dist/components/CPopup.vue.d.ts +37 -0
- package/dist/components/CProgressLinear.vue.d.ts +21 -0
- package/dist/components/CProgressRing.vue.d.ts +48 -0
- package/dist/components/CRadio.vue.d.ts +40 -0
- package/dist/components/CRadioGroup.vue.d.ts +54 -0
- package/dist/components/CRebrand.vue.d.ts +28 -0
- package/dist/components/CRow.vue.d.ts +41 -0
- package/dist/components/CSafeArea.vue.d.ts +18 -0
- package/dist/components/CSectionHeader.vue.d.ts +29 -0
- package/dist/components/CSelect.vue.d.ts +96 -0
- package/dist/components/CSkeleton.vue.d.ts +3 -0
- package/dist/components/CSkeletonLoaderCard.vue.d.ts +9 -0
- package/dist/components/CSkeletonLoaderCircle.vue.d.ts +3 -0
- package/dist/components/CSkeletonLoaderText.vue.d.ts +16 -0
- package/dist/components/CSlideFadeTransition.vue.d.ts +36 -0
- package/dist/components/CSplitInput.vue.d.ts +56 -0
- package/dist/components/CSquaredIcon.vue.d.ts +33 -0
- package/dist/components/CSsnField.vue.d.ts +798 -0
- package/dist/components/CStatusDot.vue.d.ts +10 -0
- package/dist/components/CSwitch.vue.d.ts +39 -0
- package/dist/components/CSwitchListItem.vue.d.ts +48 -0
- package/dist/components/CTextArea.vue.d.ts +96 -0
- package/dist/components/CTextField.vue.d.ts +129 -0
- package/dist/components/CTextLink.vue.d.ts +36 -0
- package/dist/components/CThirdPartyLogo.vue.d.ts +22 -0
- package/dist/components/CTimeago.vue.d.ts +12 -0
- package/dist/components/CToast.vue.d.ts +69 -0
- package/dist/components/CToastsList.vue.d.ts +3 -0
- package/dist/components/CValidationMessage.vue.d.ts +37 -0
- package/dist/components/CZipcodeField.vue.d.ts +796 -0
- package/dist/components/index.d.ts +66 -0
- package/dist/components/internal/CCloseButton.vue.d.ts +14 -0
- package/dist/composables/accessibility.d.ts +1 -0
- package/dist/composables/animation.d.ts +12 -0
- package/dist/composables/binding.d.ts +19 -0
- package/dist/composables/colors.d.ts +13 -0
- package/dist/composables/elements.d.ts +3 -0
- package/dist/composables/fields.d.ts +10 -0
- package/dist/composables/gestures.d.ts +53 -0
- package/dist/composables/i18n.d.ts +3 -0
- package/dist/composables/id.d.ts +11 -0
- package/dist/composables/input-mask.d.ts +18 -0
- package/dist/composables/router.d.ts +30 -0
- package/dist/composables/slots.d.ts +2 -0
- package/dist/composables/toast.d.ts +21 -0
- package/dist/composables/validations.d.ts +77 -0
- package/dist/icons.cdn.mjs +3 -0
- package/dist/icons.cdn.mjs.map +1 -0
- package/dist/icons.d.ts +1 -0
- package/dist/icons.mjs +6 -0
- package/dist/icons.mjs.map +1 -0
- package/dist/index.cdn.mjs +9328 -12875
- package/dist/index.cdn.mjs.map +1 -1
- package/dist/index.cdn2.mjs +55255 -0
- package/dist/index.cdn2.mjs.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.mjs +3946 -0
- package/dist/index.mjs.map +1 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/services/animation.d.ts +17 -0
- package/dist/services/directives/index.d.ts +2 -0
- package/dist/services/directives/scroll-into-view.d.ts +7 -0
- package/dist/services/directives/tap-animation.d.ts +6 -0
- package/dist/services/id.d.ts +22 -0
- package/dist/services/injections/accordions.d.ts +3 -0
- package/dist/services/injections/animations.d.ts +2 -0
- package/dist/services/injections/buttons.d.ts +4 -0
- package/dist/services/injections/forms.d.ts +6 -0
- package/dist/services/injections/icon-buttons.d.ts +3 -0
- package/dist/services/injections/pills.d.ts +4 -0
- package/dist/services/injections/radio.d.ts +10 -0
- package/dist/{styles/main.css → styles.css} +40 -2
- package/dist/theme/icons.d.ts +36 -0
- package/dist/types/CForm.d.ts +12 -0
- package/dist/types/font-awesome.d.ts +5 -0
- package/dist/types.d.ts +13 -0
- package/package.json +11 -4
- package/src/colors/colors.ts +8 -3
- package/src/components/CAccordion.vue +31 -24
- package/src/components/CAccordionItem.vue +46 -45
- package/src/components/CAppBar.vue +108 -101
- package/src/components/CBadge.vue +33 -25
- package/src/components/CBottomSheet.vue +212 -199
- package/src/components/CButton/CButton.vue +135 -147
- package/src/components/CButtonStack.vue +21 -13
- package/src/components/CCard.vue +72 -69
- package/src/components/CCardFooter.vue +5 -5
- package/src/components/CCardHeader.vue +9 -7
- package/src/components/CCardSection.vue +15 -8
- package/src/components/CCheckbox.vue +68 -69
- package/src/components/CCol.vue +21 -22
- package/src/components/CDivider.vue +9 -8
- package/src/components/CDobField.vue +114 -105
- package/src/components/CDobSelect.vue +162 -164
- package/src/components/CEmailField.vue +39 -27
- package/src/components/CExpandTransition.vue +14 -17
- package/src/components/CFadeTransition.vue +3 -3
- package/src/components/CFileInput.vue +57 -50
- package/src/components/CFixedPageFooter.vue +23 -17
- package/src/components/CForm.vue +67 -60
- package/src/components/CFormFieldCounter.vue +25 -28
- package/src/components/CIconButton.vue +84 -65
- package/src/components/CLabel.vue +19 -13
- package/src/components/CListItem.vue +67 -66
- package/src/components/CListItemContent.vue +14 -16
- package/src/components/CListItemIcon.vue +18 -14
- package/src/components/CLoader.vue +47 -56
- package/src/components/CLogo.vue +13 -12
- package/src/components/CMaskedTextField.vue +80 -64
- package/src/components/CMenu.vue +14 -6
- package/src/components/CMenuItem.vue +28 -22
- package/src/components/CMenuLabel.vue +6 -5
- package/src/components/CModal.vue +76 -71
- package/src/components/CModalLoading.vue +24 -15
- package/src/components/CNotification.vue +77 -28
- package/src/components/CPhoneField.vue +34 -25
- package/src/components/CPill.vue +92 -88
- package/src/components/CPillGroup.vue +30 -21
- package/src/components/CPopup.vue +46 -37
- package/src/components/CProgressLinear.vue +17 -11
- package/src/components/CProgressRing.vue +33 -33
- package/src/components/CRadio.vue +57 -57
- package/src/components/CRadioGroup.vue +85 -72
- package/src/components/CRow.vue +22 -20
- package/src/components/CSectionHeader.vue +20 -12
- package/src/components/CSelect.vue +89 -73
- package/src/components/CSkeletonLoaderCard.vue +9 -15
- package/src/components/CSkeletonLoaderCircle.vue +1 -9
- package/src/components/CSkeletonLoaderText.vue +17 -18
- package/src/components/CSlideFadeTransition.vue +12 -34
- package/src/components/CSplitInput.vue +46 -45
- package/src/components/CSquaredIcon.vue +39 -29
- package/src/components/CSsnField.vue +48 -36
- package/src/components/CStatusDot.vue +16 -16
- package/src/components/CSwitch.vue +31 -22
- package/src/components/CSwitchListItem.vue +27 -28
- package/src/components/CTextArea.vue +116 -83
- package/src/components/CTextField.vue +194 -198
- package/src/components/CTextLink.vue +28 -25
- package/src/components/CThirdPartyLogo.vue +30 -59
- package/src/components/CToast.vue +135 -132
- package/src/components/CToastsList.vue +2 -15
- package/src/components/CValidationMessage.vue +31 -24
- package/src/components/CZipcodeField.vue +40 -27
- package/src/composables/elements.ts +1 -1
- package/src/composables/fields.ts +4 -4
- package/src/composables/router.ts +6 -5
- package/src/icons.ts +6 -0
- package/src/services/injections/buttons.ts +1 -1
- package/src/styles/_core.scss +1 -2
- package/src/styles/_reset.scss +1 -1
- package/src/styles/main.scss +2 -0
- package/src/types.ts +2 -0
- package/dist/index.cdn.css +0 -1
- package/dist/styles/utils.css +0 -2709
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
</sl-button>
|
|
40
40
|
</template>
|
|
41
41
|
|
|
42
|
-
<script lang="ts">
|
|
42
|
+
<script setup lang="ts">
|
|
43
43
|
import type { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
44
44
|
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
|
45
45
|
import '@shoelace-style/shoelace/dist/components/button/button.js';
|
|
46
|
-
import type {
|
|
47
|
-
import { computed,
|
|
46
|
+
import type { VNode } from 'vue';
|
|
47
|
+
import { computed, inject, ref } from 'vue';
|
|
48
48
|
import type { RouteLocationRaw } from 'vue-router';
|
|
49
49
|
|
|
50
50
|
import type {
|
|
@@ -64,190 +64,178 @@ import { BLOCK, BOUNCE_AMOUNT, LARGE } from '@propelinc/citrus-ui/src/services/i
|
|
|
64
64
|
* This mapping is used to translate the variant names to the correct Shoelace variant names
|
|
65
65
|
* and apply it to the underlying Shoelace button component.
|
|
66
66
|
*/
|
|
67
|
-
|
|
67
|
+
const VARIANT_TO_SHOELACE_VARIANT: Record<ButtonVariant, ButtonShoelaceVariant> = {
|
|
68
68
|
primary: 'primary',
|
|
69
69
|
// Shoelace `default` is an outline style
|
|
70
70
|
secondary: 'default',
|
|
71
71
|
tertiary: 'text',
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
export default defineComponent({
|
|
78
|
-
components: {
|
|
79
|
-
FontAwesomeIcon,
|
|
80
|
-
},
|
|
81
|
-
props: {
|
|
74
|
+
const props = withDefaults(
|
|
75
|
+
defineProps<{
|
|
82
76
|
/** Controls whether button appears as full-width */
|
|
83
|
-
block
|
|
77
|
+
block?: boolean;
|
|
84
78
|
/** Controls whether button is disabled */
|
|
85
|
-
disabled
|
|
79
|
+
disabled?: boolean;
|
|
86
80
|
/** Designates the button as an anchor and applies the href attribute */
|
|
87
|
-
href
|
|
88
|
-
/** Chooses an icon to render
|
|
89
|
-
icon
|
|
90
|
-
type: [String, Array, Object] as PropType<string | string[] | IconDefinition>,
|
|
91
|
-
default: undefined,
|
|
92
|
-
},
|
|
81
|
+
href?: string;
|
|
82
|
+
/** Chooses an icon to render next to the button text */
|
|
83
|
+
icon?: string | string[] | IconDefinition;
|
|
93
84
|
/** Chooses whether to place the icon before or after the button text */
|
|
94
|
-
iconPosition
|
|
95
|
-
type: String as PropType<ButtonIconPosition>,
|
|
96
|
-
default: 'prefix',
|
|
97
|
-
validator: (value: string) => ['prefix', 'suffix'].includes(value),
|
|
98
|
-
},
|
|
85
|
+
iconPosition?: ButtonIconPosition;
|
|
99
86
|
/**
|
|
100
87
|
* @deprecated use `size` prop instead
|
|
101
88
|
* Controls whether button uses the large variant
|
|
102
89
|
*/
|
|
103
|
-
large
|
|
90
|
+
large?: boolean;
|
|
104
91
|
/** Controls the level of the button */
|
|
105
|
-
level
|
|
106
|
-
type: String as PropType<ButtonLevel>,
|
|
107
|
-
default: 'normal',
|
|
108
|
-
validator: (value: string) => ['normal', 'danger'].includes(value),
|
|
109
|
-
},
|
|
92
|
+
level?: ButtonLevel;
|
|
110
93
|
/** Controls whether button is loading */
|
|
111
|
-
loading
|
|
94
|
+
loading?: boolean;
|
|
112
95
|
/**
|
|
113
96
|
* @deprecated use `variant` prop instead
|
|
114
|
-
* Controls whether button uses the secondary variant
|
|
115
|
-
|
|
97
|
+
* Controls whether button uses the secondary variant
|
|
98
|
+
*/
|
|
99
|
+
secondary?: boolean;
|
|
116
100
|
/**
|
|
117
101
|
* Controls the size of the button
|
|
118
102
|
* @default 'medium'
|
|
119
103
|
*/
|
|
120
|
-
size
|
|
121
|
-
type: String as PropType<ButtonSize>,
|
|
122
|
-
default: 'medium',
|
|
123
|
-
validator: (value: string) => ['medium', 'large'].includes(value),
|
|
124
|
-
},
|
|
104
|
+
size?: ButtonSize;
|
|
125
105
|
/** Designates the target attribute. Only use with the href prop. */
|
|
126
|
-
target
|
|
106
|
+
target?: string;
|
|
127
107
|
/**
|
|
128
108
|
* @deprecated use `variant` prop instead
|
|
129
109
|
* Controls whether button uses the tertiary variant
|
|
130
110
|
*/
|
|
131
|
-
tertiary
|
|
111
|
+
tertiary?: boolean;
|
|
132
112
|
/** Controls whether button functions as a router-link */
|
|
133
|
-
to
|
|
113
|
+
to?: RouteLocationRaw;
|
|
134
114
|
/**
|
|
135
115
|
* Controls the styling of the button
|
|
136
116
|
* @default 'primary'
|
|
137
117
|
*/
|
|
138
|
-
variant
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
118
|
+
variant?: ButtonVariant;
|
|
119
|
+
}>(),
|
|
120
|
+
{
|
|
121
|
+
block: false,
|
|
122
|
+
disabled: false,
|
|
123
|
+
href: undefined,
|
|
124
|
+
icon: undefined,
|
|
125
|
+
iconPosition: 'prefix',
|
|
126
|
+
large: false,
|
|
127
|
+
level: 'normal',
|
|
128
|
+
loading: false,
|
|
129
|
+
secondary: false,
|
|
130
|
+
size: 'medium',
|
|
131
|
+
target: undefined,
|
|
132
|
+
tertiary: false,
|
|
133
|
+
to: undefined,
|
|
134
|
+
variant: 'primary',
|
|
135
|
+
}
|
|
136
|
+
);
|
|
149
137
|
|
|
150
|
-
|
|
138
|
+
const emit = defineEmits<{
|
|
139
|
+
click: [event: MouseEvent];
|
|
140
|
+
focus: [event: Event];
|
|
141
|
+
blur: [event: Event];
|
|
142
|
+
}>();
|
|
151
143
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
144
|
+
defineSlots<{
|
|
145
|
+
icon?: () => VNode[];
|
|
146
|
+
default?: () => VNode[];
|
|
147
|
+
}>();
|
|
155
148
|
|
|
156
|
-
|
|
157
|
-
|
|
149
|
+
const BLOCK_BOUNCE_AMOUNT = 0.96;
|
|
150
|
+
const BASE_BOUNCE_AMOUNT = 0.94;
|
|
158
151
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
*/
|
|
162
|
-
const computedVariant = computed((): ButtonVariant => {
|
|
163
|
-
if (props.secondary) {
|
|
164
|
-
return 'secondary';
|
|
165
|
-
}
|
|
152
|
+
const { href: routerDestination, navigate } = useRouterLink(() => props.to);
|
|
153
|
+
const routerDestinationOrHref = computed(() => routerDestination.value ?? props.href);
|
|
166
154
|
|
|
167
|
-
|
|
168
|
-
return 'tertiary';
|
|
169
|
-
}
|
|
155
|
+
const dataLoading = computed<true | undefined>(() => props.loading || undefined);
|
|
170
156
|
|
|
171
|
-
|
|
172
|
-
|
|
157
|
+
const injectedBlock = inject(BLOCK, undefined);
|
|
158
|
+
const injectedOrPropBlock = computed(() => injectedBlock?.value ?? props.block);
|
|
159
|
+
const dataBlock = computed<true | undefined>(() => injectedOrPropBlock.value || undefined);
|
|
173
160
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
*/
|
|
177
|
-
const shoelaceVariant = computed(() => VARIANT_TO_SHOELACE_VARIANT[computedVariant.value]);
|
|
161
|
+
const iconSlotHasContent = useSlotHasContent('icon');
|
|
162
|
+
const hasIcon = computed(() => iconSlotHasContent.value || !!props.icon);
|
|
178
163
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
164
|
+
/**
|
|
165
|
+
* Handle the deprecated `secondary` and `tertiary` props.
|
|
166
|
+
*/
|
|
167
|
+
const computedVariant = computed((): ButtonVariant => {
|
|
168
|
+
if (props.secondary) {
|
|
169
|
+
return 'secondary';
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (props.tertiary) {
|
|
173
|
+
return 'tertiary';
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return props.variant;
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Map the computed variant to the Shoelace variant
|
|
181
|
+
*/
|
|
182
|
+
const shoelaceVariant = computed(() => VARIANT_TO_SHOELACE_VARIANT[computedVariant.value]);
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* The deprecated `large` prop can be injected through a provider.
|
|
186
|
+
*/
|
|
187
|
+
const injectedLarge = inject(LARGE, undefined);
|
|
188
|
+
const injectedOrPropsLarge = computed(() => injectedLarge?.value ?? props.large);
|
|
189
|
+
/**
|
|
190
|
+
* Because we want the `size` prop to have a default, it's always supplied.
|
|
191
|
+
* Thus, our only option to respect the deprecated `large` prop is to give it priority.
|
|
192
|
+
*/
|
|
193
|
+
const computedSize = computed(() => {
|
|
194
|
+
if (injectedOrPropsLarge.value) {
|
|
195
|
+
return 'large';
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return props.size;
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
function onClick(event: MouseEvent): void {
|
|
202
|
+
/**
|
|
203
|
+
* If the button is disabled or loading, do not take action.
|
|
204
|
+
* This prevents double/extra clicks when an async operation is in progress.
|
|
205
|
+
*/
|
|
206
|
+
if (props.disabled || props.loading) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
navigate(event);
|
|
211
|
+
emit('click', event);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const button = ref<HTMLElement | null>(null);
|
|
215
|
+
const injectedBounceAmount = inject(BOUNCE_AMOUNT, null);
|
|
216
|
+
const bounceAmount = computed(() => {
|
|
217
|
+
/**
|
|
218
|
+
* If the button is disabled or loading, do not animate the button.
|
|
219
|
+
*/
|
|
220
|
+
if (props.disabled || props.loading) {
|
|
221
|
+
return 1;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if (injectedBounceAmount) {
|
|
225
|
+
return injectedBounceAmount;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (props.block) {
|
|
229
|
+
return BLOCK_BOUNCE_AMOUNT;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return BASE_BOUNCE_AMOUNT;
|
|
233
|
+
});
|
|
234
|
+
const animationListeners = useTapAnimation({
|
|
235
|
+
el: button,
|
|
236
|
+
keyframes: {
|
|
237
|
+
default: { transform: 'scale(1)' },
|
|
238
|
+
pressed: { transform: `scale(${bounceAmount.value})` },
|
|
251
239
|
},
|
|
252
240
|
});
|
|
253
241
|
</script>
|
|
@@ -4,23 +4,31 @@
|
|
|
4
4
|
</component>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
|
-
<script lang="ts">
|
|
8
|
-
import {
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import type { Ref, VNode } from 'vue';
|
|
9
|
+
import { provide, ref, toRef } from 'vue';
|
|
9
10
|
|
|
10
11
|
import { BLOCK, LARGE } from '@propelinc/citrus-ui/src/services/injections/buttons';
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
tag
|
|
15
|
-
large
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
const props = withDefaults(
|
|
14
|
+
defineProps<{
|
|
15
|
+
tag?: string;
|
|
16
|
+
large?: boolean | null;
|
|
17
|
+
}>(),
|
|
18
|
+
{
|
|
19
|
+
tag: 'div',
|
|
20
|
+
large: null,
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
defineSlots<{
|
|
25
|
+
default?: () => VNode[];
|
|
26
|
+
}>();
|
|
27
|
+
|
|
28
|
+
const large = toRef(props, 'large') as Ref<boolean | null>;
|
|
19
29
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
});
|
|
30
|
+
provide(BLOCK, ref(true));
|
|
31
|
+
provide(LARGE, large);
|
|
24
32
|
</script>
|
|
25
33
|
|
|
26
34
|
<style scoped>
|
package/src/components/CCard.vue
CHANGED
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
</component>
|
|
25
25
|
</template>
|
|
26
26
|
|
|
27
|
-
<script lang="ts">
|
|
28
|
-
import type {
|
|
29
|
-
import { computed,
|
|
27
|
+
<script setup lang="ts">
|
|
28
|
+
import type { VNode } from 'vue';
|
|
29
|
+
import { computed, useAttrs } from 'vue';
|
|
30
30
|
import type { RouteLocationRaw } from 'vue-router';
|
|
31
31
|
|
|
32
32
|
import CCardHeader from '@propelinc/citrus-ui/src/components/CCardHeader.vue';
|
|
@@ -40,80 +40,83 @@ export interface InternalCardConfig {
|
|
|
40
40
|
isLink: boolean;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
props: {
|
|
43
|
+
const props = withDefaults(
|
|
44
|
+
defineProps<{
|
|
46
45
|
/** Sets the border color of the card */
|
|
47
|
-
borderColor
|
|
48
|
-
|
|
46
|
+
borderColor?: string;
|
|
49
47
|
/** Removes the border of the card */
|
|
50
|
-
borderless
|
|
51
|
-
|
|
48
|
+
borderless?: boolean;
|
|
52
49
|
/** Sets the background color of the entire card */
|
|
53
|
-
color
|
|
54
|
-
|
|
50
|
+
color?: string;
|
|
55
51
|
/** Navigates externally on click */
|
|
56
|
-
href
|
|
57
|
-
|
|
52
|
+
href?: string;
|
|
58
53
|
/** Stretches the card vertically to fill the height of the parent container */
|
|
59
|
-
stretch
|
|
60
|
-
|
|
54
|
+
stretch?: boolean;
|
|
61
55
|
/** Toggles a squared-off card style intended to fill the width of the page */
|
|
62
|
-
tile
|
|
63
|
-
|
|
56
|
+
tile?: boolean;
|
|
64
57
|
/** Sets the title of the card */
|
|
65
|
-
title
|
|
66
|
-
|
|
58
|
+
title?: string;
|
|
67
59
|
/** Navigates within the app on click */
|
|
68
|
-
to
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
60
|
+
to?: RouteLocationRaw;
|
|
61
|
+
}>(),
|
|
62
|
+
{
|
|
63
|
+
borderColor: undefined,
|
|
64
|
+
borderless: false,
|
|
65
|
+
color: undefined,
|
|
66
|
+
href: undefined,
|
|
67
|
+
stretch: false,
|
|
68
|
+
tile: false,
|
|
69
|
+
title: undefined,
|
|
70
|
+
to: undefined,
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
defineSlots<{
|
|
75
|
+
default?: () => VNode[];
|
|
76
|
+
}>();
|
|
77
|
+
|
|
78
|
+
const attrs = useAttrs();
|
|
79
|
+
|
|
80
|
+
const { cssColor: backgroundCssColor } = useCssColor(() => props.color);
|
|
81
|
+
const { cssColor: borderCssColor } = useCssColor(() => props.borderColor);
|
|
82
|
+
|
|
83
|
+
const routingVariant = computed<RoutingVariant>(() => {
|
|
84
|
+
if (props.to) {
|
|
85
|
+
return 'internal';
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (props.href) {
|
|
89
|
+
return 'external';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return 'none';
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const config = computed<InternalCardConfig>(() => {
|
|
96
|
+
switch (routingVariant.value) {
|
|
97
|
+
case 'internal':
|
|
98
|
+
return {
|
|
99
|
+
attrs,
|
|
100
|
+
element: 'router-link',
|
|
101
|
+
isLink: true,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
case 'external':
|
|
105
|
+
return {
|
|
106
|
+
attrs: {
|
|
107
|
+
...attrs,
|
|
108
|
+
role: 'link',
|
|
109
|
+
tabindex: '0',
|
|
110
|
+
target: '_blank',
|
|
111
|
+
},
|
|
112
|
+
element: 'a',
|
|
113
|
+
isLink: true,
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
case 'none':
|
|
117
|
+
default:
|
|
118
|
+
return { attrs, element: 'div', isLink: false };
|
|
119
|
+
}
|
|
117
120
|
});
|
|
118
121
|
</script>
|
|
119
122
|
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
</CButtonStack>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
|
-
<script lang="ts">
|
|
8
|
-
import {
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import type { VNode } from 'vue';
|
|
9
9
|
|
|
10
10
|
import CButtonStack from '@propelinc/citrus-ui/src/components/CButtonStack.vue';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
12
|
+
defineSlots<{
|
|
13
|
+
default?: () => VNode[];
|
|
14
|
+
}>();
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
<style lang="scss" scoped>
|
|
@@ -10,16 +10,18 @@
|
|
|
10
10
|
</div>
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
|
-
<script lang="ts">
|
|
14
|
-
import {
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import type { VNode } from 'vue';
|
|
15
|
+
import { provide, ref } from 'vue';
|
|
15
16
|
|
|
16
17
|
import { TERTIARY as TERTIARY_ICON_BUTTON } from '@propelinc/citrus-ui/src/services/injections/icon-buttons';
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
defineSlots<{
|
|
20
|
+
default?: () => VNode[];
|
|
21
|
+
append?: () => VNode[];
|
|
22
|
+
}>();
|
|
23
|
+
|
|
24
|
+
provide(TERTIARY_ICON_BUTTON, ref(true));
|
|
23
25
|
</script>
|
|
24
26
|
|
|
25
27
|
<style lang="scss" scoped>
|
|
@@ -9,15 +9,22 @@
|
|
|
9
9
|
</div>
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
|
-
<script lang="ts">
|
|
13
|
-
import {
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import type { VNode } from 'vue';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/** Removes the padding from the
|
|
18
|
-
fluid
|
|
19
|
-
},
|
|
20
|
-
|
|
15
|
+
withDefaults(
|
|
16
|
+
defineProps<{
|
|
17
|
+
/** Removes the padding from the content */
|
|
18
|
+
fluid?: boolean;
|
|
19
|
+
}>(),
|
|
20
|
+
{
|
|
21
|
+
fluid: false,
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
defineSlots<{
|
|
26
|
+
default?: () => VNode[];
|
|
27
|
+
}>();
|
|
21
28
|
</script>
|
|
22
29
|
|
|
23
30
|
<style lang="scss" scoped>
|